WP Table Builder – WordPress Table Plugin - Version 1.0.0

Version Description

  • First Release.
Download this release

Release Info

Developer imtiazrayhan
Plugin Icon 128x128 WP Table Builder – WordPress Table Plugin
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

Files changed (86) hide show
  1. LICENSE +674 -0
  2. assets/images/1.png +0 -0
  3. inc/admin/class-admin-menu.php +209 -0
  4. inc/admin/class-admin.php +104 -0
  5. inc/admin/class-tables.php +115 -0
  6. inc/admin/class-wptb-listing.php +250 -0
  7. inc/admin/css/admin.css +1786 -0
  8. inc/admin/index.php +1 -0
  9. inc/admin/js/admin.js +3963 -0
  10. inc/admin/js/admin.js.map +1 -0
  11. inc/admin/js/admin.min.js +1 -0
  12. inc/admin/js/core/WPTB_Builder.js +40 -0
  13. inc/admin/js/core/WPTB_Button.js +71 -0
  14. inc/admin/js/core/WPTB_Cell.js +121 -0
  15. inc/admin/js/core/WPTB_DropHandle.js +188 -0
  16. inc/admin/js/core/WPTB_ElementCounters.js +25 -0
  17. inc/admin/js/core/WPTB_ElementOptions.js +544 -0
  18. inc/admin/js/core/WPTB_Helper.js +257 -0
  19. inc/admin/js/core/WPTB_Image.js +56 -0
  20. inc/admin/js/core/WPTB_Initializer.js +51 -0
  21. inc/admin/js/core/WPTB_LeftPanel.js +408 -0
  22. inc/admin/js/core/WPTB_List.js +41 -0
  23. inc/admin/js/core/WPTB_ListItem.js +88 -0
  24. inc/admin/js/core/WPTB_MultipleSelect.js +74 -0
  25. inc/admin/js/core/WPTB_Parser.js +20 -0
  26. inc/admin/js/core/WPTB_Parser2.js +46 -0
  27. inc/admin/js/core/WPTB_Settings.js +103 -0
  28. inc/admin/js/core/WPTB_Space.js +79 -0
  29. inc/admin/js/core/WPTB_Stringifier.js +95 -0
  30. inc/admin/js/core/WPTB_Stringifier2.js +51 -0
  31. inc/admin/js/core/WPTB_Table.js +1302 -0
  32. inc/admin/js/core/WPTB_Text.js +33 -0
  33. inc/admin/js/core/WPTB_innerElementSet.js +94 -0
  34. inc/admin/js/core/applyGenericItemSettings.js +212 -0
  35. inc/admin/js/core/wptb-builder.js +0 -0
  36. inc/admin/js/patchs.js +8 -0
  37. inc/admin/js/tinymce/jquery.tinymce.min.js +1 -0
  38. inc/admin/js/tinymce/langs/readme.md +3 -0
  39. inc/admin/js/tinymce/license.txt +504 -0
  40. inc/admin/js/tinymce/plugins/advlist/plugin.min.js +1 -0
  41. inc/admin/js/tinymce/plugins/anchor/plugin.min.js +1 -0
  42. inc/admin/js/tinymce/plugins/autolink/plugin.min.js +1 -0
  43. inc/admin/js/tinymce/plugins/autoresize/plugin.min.js +1 -0
  44. inc/admin/js/tinymce/plugins/autosave/plugin.min.js +1 -0
  45. inc/admin/js/tinymce/plugins/bbcode/plugin.min.js +1 -0
  46. inc/admin/js/tinymce/plugins/charmap/plugin.min.js +1 -0
  47. inc/admin/js/tinymce/plugins/code/plugin.min.js +1 -0
  48. inc/admin/js/tinymce/plugins/codesample/css/prism.css +138 -0
  49. inc/admin/js/tinymce/plugins/codesample/plugin.min.js +1 -0
  50. inc/admin/js/tinymce/plugins/colorpicker/plugin.min.js +1 -0
  51. inc/admin/js/tinymce/plugins/contextmenu/plugin.min.js +1 -0
  52. inc/admin/js/tinymce/plugins/directionality/plugin.min.js +1 -0
  53. inc/admin/js/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
  54. inc/admin/js/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
  55. inc/admin/js/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  56. inc/admin/js/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  57. inc/admin/js/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
  58. inc/admin/js/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
  59. inc/admin/js/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
  60. inc/admin/js/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
  61. inc/admin/js/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  62. inc/admin/js/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
  63. inc/admin/js/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
  64. inc/admin/js/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
  65. inc/admin/js/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  66. inc/admin/js/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
  67. inc/admin/js/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
  68. inc/admin/js/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
  69. inc/admin/js/tinymce/plugins/emoticons/plugin.min.js +1 -0
  70. inc/admin/js/tinymce/plugins/fullpage/plugin.min.js +1 -0
  71. inc/admin/js/tinymce/plugins/fullscreen/plugin.min.js +1 -0
  72. inc/admin/js/tinymce/plugins/help/img/logo.png +0 -0
  73. inc/admin/js/tinymce/plugins/help/plugin.min.js +1 -0
  74. inc/admin/js/tinymce/plugins/hr/plugin.min.js +1 -0
  75. inc/admin/js/tinymce/plugins/image/plugin.min.js +1 -0
  76. inc/admin/js/tinymce/plugins/imagetools/plugin.min.js +1 -0
  77. inc/admin/js/tinymce/plugins/importcss/plugin.min.js +1 -0
  78. inc/admin/js/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
  79. inc/admin/js/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
  80. inc/admin/js/tinymce/plugins/link/plugin.min.js +1 -0
  81. inc/admin/js/tinymce/plugins/lists/plugin.min.js +1 -0
  82. inc/admin/js/tinymce/plugins/media/plugin.min.js +1 -0
  83. inc/admin/js/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
  84. inc/admin/js/tinymce/plugins/noneditable/plugin.min.js +1 -0
  85. inc/admin/js/tinymce/plugins/pagebreak/plugin.min.js +1 -0
  86. inc/admin/js/tinymce/plugins/paste/plugin.min.js +1 -0
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
assets/images/1.png ADDED
Binary file
inc/admin/class-admin-menu.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Table_Builder\Inc\Admin;
4
+ use WP_Table_Builder as NS;
5
+ Use WP_Table_Builder\Inc\Common\Helpers;
6
+
7
+ /**
8
+ * Register menu elements and do other global tasks.
9
+ *
10
+ * @link http://wptablebuilder.com/
11
+ * @since 1.0.0
12
+ *
13
+ * @author Imtiaz Rayhan
14
+ */
15
+ class Admin_Menu {
16
+
17
+ /**
18
+ * Primary class constructor.
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+ public function __construct() {
23
+ // Let's make some menus.
24
+ add_action( 'admin_menu', array( $this, 'register_menus' ), 9 );
25
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
26
+ add_action( 'wp_ajax_create_table', array( $this, 'create_table' ) );
27
+ add_action( 'wp_ajax_save_table', array( $this, 'save_table' ) );
28
+ add_action( 'wp_ajax_nopriv_save_table', array( $this, 'save_table' ) );
29
+ add_action( 'wp_ajax_get_table', array( $this, 'get_table' ) );
30
+ add_action( 'wp_ajax_nopriv_get_table', array( $this, 'get_table' ) );
31
+ }
32
+
33
+ public function create_table() {
34
+ $id = wp_insert_post([
35
+ 'post_title' => '',
36
+ 'post_content' => '',
37
+ 'post_type' => 'wptb-tables'
38
+ ]);
39
+ wp_die( json_encode( ['created',$id] ) );
40
+ }
41
+
42
+ public function save_table() {
43
+
44
+ $params = json_decode( file_get_contents( 'php://input' ) );
45
+
46
+ if( wp_verify_nonce( $params->security_code, 'wptb-security-nonce' ) ) {
47
+ if( ! isset( $params->id ) || ! absint( $params->id ) || ! get_post_meta( absint( $params->id ) , '_wptb_content_', true ) ) {
48
+ $id = wp_insert_post([
49
+ 'post_title' => sanitize_text_field( $params->title ),
50
+ 'post_content' => '',
51
+ 'post_type' => 'wptb-tables'
52
+ ]);
53
+ add_post_meta( $id, '_wptb_content_', $params->content );
54
+ wp_die( json_encode( ['saved',$id] ) );
55
+ } else {
56
+ wp_update_post([
57
+ 'ID' => absint( $params->id ),
58
+ 'post_title' => sanitize_text_field( $params->title ),
59
+ 'post_content' => '',
60
+ 'post_type' => 'wptb-tables'
61
+ ]);
62
+ update_post_meta( absint( $params->id ), '_wptb_content_', $params->content );
63
+ wp_die( json_encode( ['edited',''] ) );
64
+ }
65
+ } else {
66
+ wp_die( json_encode( ['security_problem', ''] ) );
67
+ }
68
+ }
69
+
70
+ public function get_table() {
71
+ $post = get_post( absint( $_REQUEST['id'] ) );
72
+ $html = get_post_meta( absint( $_REQUEST['id'] ) , '_wptb_content_', true );
73
+ $name = $post->post_title;
74
+ //$html = json_decode( $html );
75
+ die( json_encode( [$name, $html] ) );
76
+ }
77
+
78
+
79
+ /**
80
+ * Register our menus.
81
+ *
82
+ * @since 1.0.0
83
+ */
84
+ public function register_menus() {
85
+
86
+ global $builder_page, $tables_overview, $table_list;
87
+ $menu_cap = Helpers::wptb_get_capability_manage_options();
88
+
89
+ // Default Tables top level menu item.
90
+ $tables_overview = add_menu_page(
91
+ esc_html__( 'WP Table Builder', 'wp-table-builder' ),
92
+ esc_html__( 'Table Builder', 'wp-table-builder' ),
93
+ $menu_cap,
94
+ 'wptb-overview',
95
+ array( $this, 'tables_list' ),
96
+ 'dashicons-editor-table',
97
+ apply_filters( 'wptb_menu_position', '50' )
98
+ );
99
+
100
+ // All Tables sub menu item.
101
+ $table_list = add_submenu_page(
102
+ 'wptb-overview',
103
+ esc_html__( 'WP Table Builder', 'wp-table-builder' ),
104
+ esc_html__( 'All Tables', 'wp-table-builder' ),
105
+ $menu_cap,
106
+ 'wptb-overview',
107
+ array( $this, 'tables_list' )
108
+ );
109
+
110
+ // Add New Table sub menu item.
111
+ $builder_page = add_submenu_page(
112
+ 'wptb-overview',
113
+ esc_html__( 'Table Builder', 'wp-table-builder' ),
114
+ esc_html__( 'Add New', 'wp-table-builder' ),
115
+ $menu_cap,
116
+ 'wptb-builder',
117
+ array( $this, 'table_builder' )
118
+ );
119
+
120
+ do_action( 'wptb_admin_menu', $this );
121
+
122
+ }
123
+
124
+ public function enqueue_scripts( $hook ) {
125
+ /*
126
+ * This function is provided for demonstration purposes only.
127
+ *
128
+ * An instance of this class should be passed to the run() function
129
+ * defined in Loader as all of the hooks are defined
130
+ * in that particular class.
131
+ *
132
+ * The Loader will then create the relationship
133
+ * between the defined hooks and the functions defined in this
134
+ * class.
135
+ */
136
+ global $builder_page, $tables_overview, $table_list;
137
+
138
+ wp_enqueue_media();
139
+
140
+ if ( $hook != ( $builder_page || $table_list || $hook != $tables_overview ) ) {
141
+ return;
142
+ }
143
+
144
+
145
+ if( isset( $_GET['page'] ) && sanitize_text_field( $_GET['page'] ) == 'wptb-builder' ) {
146
+ wp_register_script( 'wptb-admin-builder-js', plugin_dir_url( __FILE__ ) . 'js/admin.js', array( 'jquery', 'wptb-admin-builder-tinymce-js', 'wp-color-picker' ), NS\PLUGIN_VERSION, true );
147
+ wp_register_script( 'wptb-admin-builder-tinymce-js', plugin_dir_url( __FILE__ ) . 'js/tinymce/tinymce.min.js', array(), NS\PLUGIN_VERSION, false );
148
+ wp_register_script( 'wptb-admin-builder-tinymce-jquery-js', plugin_dir_url( __FILE__ ) . 'js/tinymce/jquery.tinymce.min.js', array(), NS\PLUGIN_VERSION, false );
149
+
150
+ wp_enqueue_style( 'wp-color-picker' );
151
+
152
+ wp_enqueue_style( 'wptb-builder-css', plugin_dir_url( __FILE__ ) . 'css/admin.css', array(), NS\PLUGIN_VERSION, 'all' );
153
+ wp_enqueue_script( 'wptb-admin-builder-tinymce-js' );
154
+ wp_enqueue_script( 'wptb-admin-builder-tinymce-jquery-js' );
155
+ wp_enqueue_script( 'wptb-admin-builder-js' );
156
+
157
+ wp_localize_script(
158
+ 'wptb-admin-builder-js',
159
+ 'wptb_admin_object',
160
+ [
161
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
162
+ 'security_code' => wp_create_nonce( 'wptb-security-nonce' ),
163
+ ]
164
+ );
165
+ } elseif( isset( $_GET['page'] ) && sanitize_text_field( $_GET['page'] ) == 'wptb-overview' ) {
166
+ wp_enqueue_script( 'wptb-overview-js', plugin_dir_url( __FILE__ ) . 'js/wptb-overview.js', array( 'jquery' ), NS\PLUGIN_VERSION, true );
167
+ }
168
+
169
+ }
170
+
171
+ /**
172
+ * Wrapper for the hook to render our tables list.
173
+ *
174
+ * @since 1.0.0
175
+ */
176
+ public function tables_list() {
177
+ $table_list = new WPTB_Listing();
178
+ ?>
179
+ <div class="wrap">
180
+ <div style="margin-bottom: 30px;">
181
+ <h1 class="wp-heading-inline">
182
+ <?php esc_html_e( 'All Tables', 'wp-table-builder' ); ?>
183
+ </h1>
184
+ <span class="wptb-split-page-title-action">
185
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=wptb-builder' ) ); ?>" class="page-title-action">
186
+ <?php esc_html_e( 'Add New', 'wp-table-builder' ); ?>
187
+ </a>
188
+ </span>
189
+ </div>
190
+ </div>
191
+
192
+ <?php
193
+ $table_list->prepare_items();
194
+ ?>
195
+ <form method="post"><?php
196
+ $table_list->display();?>
197
+ </form><?php
198
+ }
199
+
200
+ /**
201
+ * Wrapper for the hook to render our tables builder.
202
+ *
203
+ * @since 1.0.0
204
+ */
205
+ public function table_builder() {
206
+ require_once NS\WP_TABLE_BUILDER_DIR . 'inc/admin/views/wptb-builder-ui.php';
207
+ }
208
+
209
+ };
inc/admin/class-admin.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Table_Builder\Inc\Admin;
4
+
5
+ /**
6
+ * The admin-specific functionality of the plugin.
7
+ *
8
+ * Defines the plugin name, version, and two examples hooks for how to
9
+ * enqueue the admin-specific stylesheet and JavaScript.
10
+ *
11
+ * @link http://wptablebuilder.com/
12
+ * @since 1.0.0
13
+ *
14
+ * @author Imtiaz Rayhan
15
+ */
16
+ class Admin {
17
+
18
+ /**
19
+ * The ID of this plugin.
20
+ *
21
+ * @since 1.0.0
22
+ * @access private
23
+ * @var string $plugin_name The ID of this plugin.
24
+ */
25
+ private $plugin_name;
26
+
27
+ /**
28
+ * The version of this plugin.
29
+ *
30
+ * @since 1.0.0
31
+ * @access private
32
+ * @var string $version The current version of this plugin.
33
+ */
34
+ private $version;
35
+
36
+ /**
37
+ * The text domain of this plugin.
38
+ *
39
+ * @since 1.0.0
40
+ * @access private
41
+ * @var string $plugin_text_domain The text domain of this plugin.
42
+ */
43
+ private $plugin_text_domain;
44
+
45
+ /**
46
+ * Initialize the class and set its properties.
47
+ *
48
+ * @since 1.0.0
49
+ * @param string $plugin_name The name of this plugin.
50
+ * @param string $version The version of this plugin.
51
+ * @param string $plugin_text_domain The text domain of this plugin.
52
+ */
53
+ public function __construct( $plugin_name, $version, $plugin_text_domain ) {
54
+
55
+ $this->plugin_name = $plugin_name;
56
+ $this->version = $version;
57
+ $this->plugin_text_domain = $plugin_text_domain;
58
+
59
+ }
60
+
61
+ /**
62
+ * Register the stylesheets for the admin area.
63
+ *
64
+ * @since 1.0.0
65
+ */
66
+ public function enqueue_styles() {
67
+
68
+ /**
69
+ * This function is provided for demonstration purposes only.
70
+ *
71
+ * An instance of this class should be passed to the run() function
72
+ * defined in Loader as all of the hooks are defined
73
+ * in that particular class.
74
+ *
75
+ * The Loader will then create the relationship
76
+ * between the defined hooks and the functions defined in this
77
+ * class.
78
+ */
79
+
80
+ }
81
+
82
+ /**
83
+ * Register the JavaScript for the admin area.
84
+ *
85
+ * @since 1.0.0
86
+ */
87
+ public function enqueue_scripts() {
88
+ /*
89
+ * This function is provided for demonstration purposes only.
90
+ *
91
+ * An instance of this class should be passed to the run() function
92
+ * defined in Loader as all of the hooks are defined
93
+ * in that particular class.
94
+ *
95
+ * The Loader will then create the relationship
96
+ * between the defined hooks and the functions defined in this
97
+ * class.
98
+ */
99
+
100
+ //wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-table-builder-admin.js', array( 'jquery' ), $this->version, false );
101
+
102
+ }
103
+
104
+ }
inc/admin/class-tables.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Table_Builder\Inc\Admin;
4
+
5
+ /**
6
+ * All the table stuffs.
7
+ *
8
+ * Contains a bunch of helper methods as well.
9
+ *
10
+ * @link http://wptablebuilder.com/
11
+ * @since 1.0.0
12
+ *
13
+ * @author Imtiaz Rayhan
14
+ */
15
+ class Tables {
16
+
17
+ /**
18
+ * Primary class constructor.
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+ public function __construct() {
23
+
24
+ // Register wptb-tables custom post type
25
+ $this->register_cpt();
26
+ // Add the custom columns to the book post type:
27
+ add_filter( 'manage_wptb-tables_posts_columns', [ $this,'addHeader' ] );
28
+ add_filter( 'post_row_actions', [ $this,'customizeActions'], 10, 2 );
29
+ add_action( 'manage_wptb-tables_posts_custom_column' , [ $this,'addContent' ], 10, 2 );
30
+ }
31
+
32
+ function customizeActions( $actions, $post ) {
33
+
34
+ if ( $post->post_type =="wptb-tables" ) {
35
+ unset( $actions['inline hide-if-no-js'] );
36
+ $actions['edit'] = '<a href="' . esc_url( menu_page_url( 'wptb-builder', false ) ) . '&table='.$post->ID.'">'. esc_html_e( 'Edit','wp-table-builder' ).'</a>';
37
+ }
38
+
39
+ return $actions;
40
+
41
+ }
42
+
43
+ function addHeader( $columns ) {
44
+ $columns['shortcode'] = __( 'Shortcode', 'wp-table-builder' );
45
+
46
+ return array(
47
+ 'cb' => '<input type="checkbox" />',
48
+ 'title' => __( 'Title', 'wp-table-builder' ),
49
+ 'shortcode' => __( 'Shortcode', 'wp-table-builder' ),
50
+ 'date' => __( 'Date', 'wp-table-builder' ),
51
+ );
52
+ }
53
+
54
+ // Add the data to the custom columns for the book post type:
55
+ function addContent( $column, $post_id ) {
56
+ switch ( $column ) {
57
+
58
+ case 'title' :
59
+ $post = get_post( $post_id );
60
+ $title = $post->post_title;
61
+ echo "$title";
62
+ break;
63
+ case 'shortcode' :
64
+ echo '<input class="wptb_shortcode" value="[wptb id='.$post_id.']" readonly style="border:none;display:inline;">'
65
+ . '<button onclick="event.preventDefault();var s=this.parentNode.getElementsByClassName(\'wptb_shortcode\')[0];s.select();document.execCommand(\'copy\');var elem = document.createElement(\'div\');elem.classList.add(\'notice\',\'notice-success\',\'is-dismissible\');elem.innerHTML = \'<p>Selected!</p><button onclick=\\\'var n = this.parentNode,p= n.parentNode;p.removeChild(n);\\\' type=\\\'button\\\' class=\\\'notice-dismiss\\\'><span class=\\\'screen-reader-text\\\'>Descartar este aviso.</span></button>\'; document.getElementsByClassName(\'wrap\')[0].prepend(elem);" class="button wptb-edit-button">Copy</button>';
66
+ break;
67
+
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Registers the custom post type to be used for table.
73
+ *
74
+ * @since 1.0.0
75
+ */
76
+ public function register_cpt() {
77
+
78
+ // Custom post type arguments, which can be filtered if needed
79
+ $args = apply_filters(
80
+ 'wptb_tables_post_type_args',
81
+ array(
82
+ 'label' => 'WPTB Tables',
83
+ 'public' => false,
84
+ 'exclude_from_search' => true,
85
+ 'show_ui' => false,
86
+ 'show_in_admin_bar' => false,
87
+ 'rewrite' => false,
88
+ 'query_var' => true,
89
+ 'can_export' => false,
90
+ 'supports' => array( 'title' ),
91
+ )
92
+ );
93
+
94
+ // Register the post type
95
+ register_post_type( 'wptb-tables', $args );
96
+ add_shortcode( 'wptb', array( $this, 'get_table' ) );
97
+
98
+ }
99
+
100
+ public function get_table( $args ) {
101
+ //$uniqueSequence = 't'.substr( md5(time()),0,8 );
102
+ $html = get_post_meta( $args['id'] , '_wptb_content_', true );
103
+ //$html = json_decode( $html );
104
+ $html = '<div class="wptb-table-container"><div class="wptb-table-container-matrix">' . $html . '</div></div>';
105
+ $html .= '<script>'
106
+ . 'let wptbPreviewTable = document.getElementsByClassName( "wptb-preview-table" );'
107
+ . 'if( wptbPreviewTable.length > 0 ) {'
108
+ . ' wptbPreviewTable[0].classList.remove( "wptb-table-preview-static-indic" );'
109
+ . ' wptbPreviewTable[0].style.display = "none";'
110
+ . '}'
111
+ . '</script>';
112
+ return ( $html );
113
+ }
114
+
115
+ }
inc/admin/class-wptb-listing.php ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Table_Builder\Inc\Admin;
4
+
5
+
6
+ if ( ! class_exists( 'WP_List_Table' ) ) {
7
+ die('NOT?');
8
+ require_once( ABSPATH . 'wp-admin\includes\class-wp-list-table.php' );
9
+ }
10
+ /**
11
+ * This allows us to render custom tables in admin view
12
+ *
13
+ * @link http://wptablebuilder.com/
14
+ * @since 1.0.0
15
+ *
16
+ * @author Imtiaz Rayhan
17
+ */
18
+ class WPTB_Listing extends \WP_List_Table{
19
+
20
+ public function __construct() {
21
+
22
+ parent::__construct( [
23
+ 'singular' => __( 'WPTB Table', 'wp-table-builder' ),
24
+ 'plural' => __( 'WPTB Tables', 'wp-table-builder' ),
25
+ 'ajax' => false
26
+ ] );
27
+ if ( isset( $_GET['success'] ) ) { ?>
28
+ <div class="notice notice-success is-dismissible">
29
+ <p><?php esc_html_e( 'Table deleted successfully.', 'wp-table-builder' ); ?></p>
30
+ </div>
31
+ <?php
32
+ unset( $_GET['success'] );
33
+ } if ( isset( $_GET['bulksuccess'] ) ) { ?>
34
+ <div class="notice notice-success is-dismissible">
35
+ <p><?php esc_html_e( 'Bulk Delete Performed Successfully.', 'wp-table-builder' ); ?></p>
36
+ </div>
37
+ <?php
38
+ unset( $_GET['bulksuccess'] );
39
+ }
40
+
41
+ }
42
+
43
+ public static function get_tables( $per_page = 5, $page_number = 1 ) {
44
+
45
+ global $wpdb, $post;
46
+
47
+ $params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page, 'paged' => $page_number );
48
+
49
+ $params['orderby'] = ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
50
+ $params['order'] = ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
51
+
52
+ $loop = new \WP_Query( $params );
53
+ $result=[];
54
+ while ( $loop->have_posts() ) { $loop->the_post(); $result[] = $post; }
55
+
56
+ return $result;
57
+
58
+ }
59
+
60
+ public static function delete_table( $id ) {
61
+
62
+ global $wpdb;
63
+
64
+ delete_post_meta( $id, '_wptb_content_' );
65
+
66
+ $wpdb->delete(
67
+ "{$wpdb->prefix}posts",
68
+ [ 'ID' => $id ],
69
+ [ '%d' ]
70
+ );
71
+
72
+ }
73
+
74
+ public static function record_count() {
75
+
76
+ global $wpdb, $post;
77
+
78
+ $params = array( 'post_type' => 'wptb-tables', 'posts_per_page' => $per_page );
79
+ $params['orderby'] = ! empty( sanitize_text_field( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'date';
80
+ $params['order'] = ! empty( sanitize_text_field( $_REQUEST['order'] ) ) ? sanitize_text_field( $_REQUEST['order'] ) : 'DESC';
81
+
82
+ $loop = new \WP_Query( $params );
83
+ return $loop->found_posts;
84
+
85
+ }
86
+
87
+ public function no_items() {
88
+
89
+ printf(
90
+ wp_kses(
91
+ /* translators: %s - admin area page builder page URL. */
92
+ __( 'Whoops, you haven\'t created a table yet. Want to <a href="%s">give it a go</a>?', 'wp-table-builder' ),
93
+ array(
94
+ 'a' => array(
95
+ 'href' => array(),
96
+ ),
97
+ )
98
+ ),
99
+ admin_url( 'admin.php?page=wptb-builder' )
100
+ );
101
+
102
+ }
103
+
104
+ function column_name( $item ) {
105
+
106
+ // create a nonce
107
+ $delete_nonce = wp_create_nonce( 'wptb_delete_table' );
108
+
109
+ $table_title = $item->post_title;
110
+
111
+ $title = ! empty( $table_title ) ? $table_title : __( 'Table (ID #' . absint( $item->ID ) . ')', 'wp-table-builder' );
112
+
113
+ $title = sprintf(
114
+ '<a class="row-title" href="%s" title="%s"><strong>%s</strong></a>',
115
+ add_query_arg(
116
+ array(
117
+ 'table' => $item->ID,
118
+ ),
119
+ esc_url( admin_url( 'admin.php?page=wptb-builder' ) )
120
+ ),
121
+ esc_html__( 'Edit This Table', 'wp-table-builder' ),
122
+ $title
123
+ );
124
+
125
+ $actions = [
126
+ 'delete' => sprintf( '<a href="?page=%s&action=%s&table_id=%s&_wpnonce=%s">Delete</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item->ID ), $delete_nonce ),
127
+ 'edit' => sprintf( '<a href="?page=wptb-builder&table=%d">Edit</a>', absint( $item->ID ) )
128
+ ];
129
+
130
+ return $title . $this->row_actions( $actions );
131
+
132
+ }
133
+
134
+ public function column_default( $item, $column_name ) {
135
+
136
+ switch ( $column_name ) {
137
+ case 'id':
138
+ return $item->ID;
139
+ case 'shortcode':
140
+ return '[wptb id='.$item->ID.']';
141
+ case 'created':
142
+ return get_the_date( '', $item->ID );
143
+ break;
144
+ }
145
+
146
+ }
147
+
148
+ function column_cb( $item ) {
149
+
150
+ return sprintf(
151
+ '<input type="checkbox" name="bulk-delete[]" value="%s" />', absint( $item->ID )
152
+ );
153
+
154
+ }
155
+
156
+ function get_columns() {
157
+
158
+ $columns = [
159
+ 'cb' => '<input type="checkbox" />',
160
+ 'name' => esc_html__( 'Title', 'wp-table-builder' ),
161
+ 'shortcode' => esc_html__( 'Shortcode', 'wp-table-builder' ),
162
+ 'created' => esc_html__( 'Created', 'wp-table-builder' ),
163
+ 'id' => esc_html__( 'ID', 'wp-table-builder' )
164
+ ];
165
+
166
+ return apply_filters( 'wptb_table_list_columns', $columns );
167
+
168
+ }
169
+
170
+ public function get_sortable_columns() {
171
+
172
+ $sortable_columns = array(
173
+ 'title' => array( 'title', true )
174
+ );
175
+
176
+ return $sortable_columns;
177
+
178
+ }
179
+
180
+ public function get_bulk_actions() {
181
+
182
+ $actions = [
183
+ 'bulk-delete' => 'Delete'
184
+ ];
185
+
186
+ return $actions;
187
+
188
+ }
189
+
190
+ public function prepare_items() {
191
+
192
+ $columns = $this->get_columns();
193
+ $hidden = array();
194
+ $sortable = $this->get_sortable_columns();
195
+ $this->_column_headers = array($columns, $hidden, $sortable);
196
+
197
+ /** Process bulk action */
198
+ $this->process_bulk_action();
199
+
200
+ $per_page = $this->get_items_per_page( 'tables_per_page', 10 );
201
+ $current_page = $this->get_pagenum();
202
+ $total_items = self::record_count();
203
+
204
+ $this->set_pagination_args( [
205
+ 'total_items' => $total_items, //WE have to calculate the total number of items
206
+ 'per_page' => $per_page //WE have to determine how many items to show on a page
207
+ ] );
208
+
209
+ $this->items = $this->get_tables( $per_page, $current_page );
210
+
211
+ }
212
+
213
+ public function process_bulk_action() {
214
+
215
+ $nonce = esc_attr( $_REQUEST['_wpnonce'] );
216
+
217
+ if ( 'delete' === $this->current_action() ) {
218
+
219
+ if ( ! wp_verify_nonce( $nonce, 'wptb_delete_table' ) ) {
220
+ die( 'Go get a life script kiddies' );
221
+ } else {
222
+ $this->delete_table( absint( $_GET['table_id'] ) );
223
+ die('<script>window.location=window.location.href.split(\'?\')[0]+"?page=wptb-overview&success=1";</script>');
224
+ exit;
225
+ }
226
+
227
+ }
228
+
229
+ // If the delete bulk action is triggered
230
+ if ( ( isset( $_POST['action'] ) && sanitize_text_field( $_POST['action'] ) == 'bulk-delete' ) ||
231
+ ( isset( $_POST['action2'] ) && sanitize_text_field( $_POST['action2'] ) == 'bulk-delete' ) ) {
232
+
233
+ if( ! wp_verify_nonce( $nonce, 'bulk-' . $this->_args['plural'] ) ){
234
+ die( 'Go get a life script kiddies' );
235
+ } else {
236
+ $delete_ids = esc_sql( $_POST['bulk-delete'] );
237
+
238
+ // loop over the array of record IDs and delete them
239
+ foreach ( $delete_ids as $id ) {
240
+ $this->delete_table( absint( $id ) );
241
+ }
242
+
243
+ die('<script>window.location=window.location.href.split(\'?\')[0]+"?page=wptb-overview&bulksuccess=1";</script>');
244
+ exit;
245
+ }
246
+ }
247
+ }
248
+ }
249
+
250
+ $table = new WPTB_Listing();
inc/admin/css/admin.css ADDED
@@ -0,0 +1,1786 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * All of the CSS for your admin-specific functionality should be included in this file.
3
+ *
4
+ * The file is enqueued from inc/admin/class-admin.php.
5
+ */
6
+
7
+ html {
8
+ overflow-y: hidden;
9
+ }
10
+
11
+ body>img {
12
+ position: absolute;
13
+ z-index: 1000001;
14
+ }
15
+
16
+ .wptb-admin-container {
17
+ background: #fff;
18
+ color: #444;
19
+ z-index: 100099;
20
+ position: fixed;
21
+ top: 0;
22
+ bottom: 0;
23
+ left: 0;
24
+ right: 0;
25
+ height: 100%;
26
+ min-width: 0;
27
+ margin: 0 !important;
28
+ overflow-y: auto;
29
+ }
30
+
31
+ .wptb-container {
32
+ position: fixed;
33
+ left: 0;
34
+ top: 89px;
35
+ right: 0;
36
+ bottom: 0;
37
+ overflow-y: auto;
38
+ overflow-x: hidden;
39
+ }
40
+
41
+ .wptb-container * {
42
+ box-sizing: border-box;
43
+ }
44
+
45
+
46
+ /**
47
+ * Header Section
48
+ */
49
+
50
+ .wptb-header {
51
+ width: 100%;
52
+ background-color: #f8f8f8;
53
+ padding: 10px 0;
54
+ border-bottom: 1px solid #ccc;
55
+ position: fixed;
56
+ z-index: 100101;
57
+ display: flex;
58
+ top: 0;
59
+ left: 0;
60
+ }
61
+
62
+ .wptb-logo {
63
+ padding-left: 30px;
64
+ }
65
+
66
+ .wptb-right {
67
+ top: 0;
68
+ right: 0;
69
+ position: absolute;
70
+ display: flex;
71
+ display: -webkit-flex;
72
+ align-items: center;
73
+ justify-content: space-around;
74
+ }
75
+
76
+ #wptb-messaging-area {
77
+ align-self: center;
78
+ margin: 0 auto;
79
+ }
80
+
81
+ #wptb-messaging-area .wptb-message {
82
+ border-radius: 4px;
83
+ max-width: 410px;
84
+ padding: 20px;
85
+ }
86
+
87
+ #wptb-messaging-area .wptb-success {
88
+ color: green;
89
+ background-color: lightgreen;
90
+ font-size: 15px;
91
+ }
92
+
93
+ #wptb-messaging-area .wptb-error {
94
+ color: red;
95
+ background-color: rgb(255, 213, 213);
96
+ font-size: 15px;
97
+ }
98
+
99
+ .wptb-embed {
100
+ display: inline-block;
101
+ margin-right: 15px;
102
+ }
103
+
104
+ .wptb-embed-btn {
105
+ background-color: #fff;
106
+ border: 1px solid #ccc;
107
+ font-size: 16px;
108
+ font-weight: 500;
109
+ text-transform: uppercase;
110
+ display: inline-block;
111
+ padding: 16px;
112
+ text-decoration: none;
113
+ color: #6b6b6b;
114
+ }
115
+
116
+ .wptb-embed-btn:active,
117
+ .wptb-embed-btn:focus {
118
+ outline: none !important;
119
+ box-shadow: none !important;
120
+ }
121
+
122
+ .wptb-embed-btn::-moz-focus-inner {
123
+ border: 0 !important;
124
+ }
125
+
126
+ .wptb-embed-btn.wptb-embed-disable {
127
+ opacity: 0.5;
128
+ cursor: not-allowed;
129
+ }
130
+
131
+ .wptb-embed-btn.wptb-embed-disable:hover {
132
+ text-decoration: none;
133
+ }
134
+
135
+ .wptb-save {
136
+ display: inline-block;
137
+ margin-right: 25px;
138
+ }
139
+
140
+ .wptb-save-btn {
141
+ background: #3B7EC0;
142
+ color: white;
143
+ padding: 16px;
144
+ font-size: 16px;
145
+ text-decoration: none;
146
+ }
147
+
148
+ .wptb-save-btn:hover {
149
+ color: white;
150
+ }
151
+
152
+ .wptb-close {
153
+ background-color: #fff;
154
+ border-left: 1px solid #d3d3d3;
155
+ display: inline-block;
156
+ padding: 30px 26px 28px 26px;
157
+ }
158
+
159
+ .wptb-close:hover {
160
+ background: #e4e4e4;
161
+ }
162
+
163
+ .wptb-close a {
164
+ color: #909090;
165
+ text-decoration: none;
166
+ }
167
+
168
+ .wptb-shortcode-popup-dark-area {
169
+ position: fixed;
170
+ width: 100%;
171
+ height: 100%;
172
+ visibility: hidden;
173
+ top: 0;
174
+ left: 0;
175
+ z-index: 1000;
176
+ background-color: slategray;
177
+ opacity: 0;
178
+ -webkit-transition: all 0.3s;
179
+ -moz-transition: all 0.3s;
180
+ transition: all 0.3s;
181
+ }
182
+
183
+ .wptb-shortcode-popup-window-modal.wptb-shortcode-popup-show~.wptb-shortcode-popup-dark-area {
184
+ visibility: visible;
185
+ opacity: .6;
186
+ }
187
+
188
+ .wptb-shortcode-popup-window-modal {
189
+ position: fixed;
190
+ top: 50%;
191
+ left: 50%;
192
+ width: 50%;
193
+ max-width: 630px;
194
+ min-width: 320px;
195
+ height: auto;
196
+ z-index: 2000;
197
+ visibility: hidden;
198
+ -webkit-backface-visibility: hidden;
199
+ -moz-backface-visibility: hidden;
200
+ backface-visibility: hidden;
201
+ -webkit-transform: translateX(-50%) translateY(-50%);
202
+ -moz-transform: translateX(-50%) translateY(-50%);
203
+ -ms-transform: translateX(-50%) translateY(-50%);
204
+ transform: translateX(-50%) translateY(-50%);
205
+ }
206
+
207
+ .wptb-shortcode-popup-window-modal.wptb-shortcode-popup-show {
208
+ visibility: visible;
209
+ }
210
+
211
+ .wptb-shortcode-popup-box {
212
+ -webkit-transform: scale(0.7);
213
+ -moz-transform: scale(0.7);
214
+ -ms-transform: scale(0.7);
215
+ transform: scale(0.7);
216
+ opacity: 0;
217
+ -webkit-transition: all 0.3s;
218
+ -moz-transition: all 0.3s;
219
+ transition: all 0.3s;
220
+ border-radius: 0;
221
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
222
+ padding: 30px;
223
+ background-color: white;
224
+ }
225
+
226
+ .wptb-shortcode-popup-window-modal.wptb-shortcode-popup-show .wptb-shortcode-popup-box {
227
+ -webkit-transform: scale(1);
228
+ -moz-transform: scale(1);
229
+ -ms-transform: scale(1);
230
+ transform: scale(1);
231
+ opacity: 1;
232
+ }
233
+
234
+ .wptb-shortcode-popup-window-close-icon {
235
+ height: 20px;
236
+ width: 20px;
237
+ position: absolute;
238
+ top: 10px;
239
+ right: 10px;
240
+ cursor: pointer;
241
+ opacity: .6;
242
+ text-align: center;
243
+ font-size: 27px !important;
244
+ line-height: 14px !important;
245
+ display: none;
246
+ z-index: 1;
247
+ }
248
+
249
+ .wptb-shortcode-popup-content p {
250
+ font-size: 15px;
251
+ text-align: center;
252
+ }
253
+
254
+ #wptb-embed-shortcode {
255
+ width: 100%;
256
+ text-align: center;
257
+ font-size: 24px;
258
+ display: block;
259
+ border: 1px solid #d6d6d6;
260
+ padding: 10px;
261
+ box-shadow: none;
262
+ margin: 20px auto 0 auto;
263
+ }
264
+
265
+ .wptb-edit-bar ul {
266
+ display: flex;
267
+ display: -webkit-flex;
268
+ list-style: none;
269
+ margin: 0;
270
+ padding: 0;
271
+ }
272
+
273
+ .wptb-edit-bar {
274
+ border-radius: 2px;
275
+ display: none;
276
+ padding: .3em .4em 0em .4em;
277
+ position: relative;
278
+ width: auto;
279
+ z-index: 10;
280
+ background: none;
281
+ max-width: 870px;
282
+ margin: auto;
283
+ }
284
+
285
+ .wptb-edit-bar.visible {
286
+ display: block;
287
+ }
288
+
289
+ .wptb-edit-bar ul li {
290
+ height: auto;
291
+ margin: 0;
292
+ padding: 0;
293
+ }
294
+
295
+ .wptb-table_change_button {
296
+ cursor: pointer;
297
+ -webkit-box-sizing: border-box;
298
+ box-sizing: border-box;
299
+ height: 41px;
300
+ background: #fafbfc;
301
+ font-size: 13px;
302
+ color: #37454c;
303
+ border-radius: 3px;
304
+ border: 1px solid #a4a4a4;
305
+ padding-left: 12px;
306
+ padding-right: 12px;
307
+ position: relative;
308
+ display: inline-block;
309
+ text-transform: uppercase;
310
+ letter-spacing: .02em;
311
+ font-weight: bolder;
312
+ text-align: center;
313
+ margin-top: 0;
314
+ margin-right: 1em;
315
+ line-height: 2.4em;
316
+ margin-bottom: 8px;
317
+ }
318
+
319
+ .wptb-management.wptb-bar.wptb-edit-bar.visible button.visible:hover {
320
+ color: #4fbe31;
321
+ -webkit-transition: all .1s ease-out;
322
+ -o-transition: all .1s ease-out;
323
+ transition: all .1s ease-out;
324
+ }
325
+
326
+ #wptb-delete-column,
327
+ #wptb-delete-row {
328
+ background-color: #eb4c63;
329
+ }
330
+
331
+ #wptb-table-edit-mode-close {
332
+ background: #329d3f;
333
+ color: #fff;
334
+ float: right;
335
+ }
336
+
337
+ .wptb-edit-bar svg {
338
+ cursor: pointer;
339
+ }
340
+
341
+ .wptb-edit-bar svg * {
342
+ fill: rgba(0, 0, 0, 0) !important;
343
+ stroke: #fff !important;
344
+ }
345
+
346
+
347
+ /**
348
+ * Left Panel
349
+ */
350
+
351
+ .wptb-left-panel {
352
+ box-sizing: border-box;
353
+ left: 0;
354
+ height: 100%;
355
+ position: fixed;
356
+ width: 310px;
357
+ z-index: 9999;
358
+ border-right: 1px solid #ccc;
359
+ background-color: #f0f3f3;
360
+ display: flex;
361
+ flex-direction: column;
362
+ -webkit-transition: left 0.2s ease-out, right 0.2s ease-out;
363
+ -o-transition: left 0.2s ease-out, right 0.2s ease-out;
364
+ transition: left 0.2s ease-out, right 0.2s ease-out;
365
+ }
366
+
367
+ .wptb-container.collapsed .wptb-left-panel {
368
+ left: -310px;
369
+ }
370
+
371
+ .wptb-left-scroll-panel {
372
+ overflow: auto;
373
+ height: calc(100% - 89px);
374
+ }
375
+
376
+ #wptb-left-scroll-panel-curtain {
377
+ position: absolute;
378
+ top: 0;
379
+ right: 0;
380
+ left: 0;
381
+ bottom: 0;
382
+ background-color: #fff;
383
+ padding: 20px;
384
+ display: none;
385
+ }
386
+
387
+ #wptb-left-scroll-panel-curtain.visible {
388
+ display: block;
389
+ }
390
+
391
+ #wptb-left-scroll-panel-curtain-close {
392
+ margin: auto;
393
+ display: block;
394
+ background: #329d3f;
395
+ color: #fff;
396
+ }
397
+
398
+ .wptb-panel-left {
399
+ position: relative;
400
+ height: 100%;
401
+ }
402
+
403
+ .wptb-left-panel-extend {
404
+ position: absolute;
405
+ top: 50%;
406
+ left: 100%;
407
+ margin-top: -55px;
408
+ overflow: hidden;
409
+ width: 18px;
410
+ border-top-right-radius: 8px;
411
+ border-bottom-right-radius: 8px;
412
+ height: 40px;
413
+ background-color: #f0f3f3;
414
+ -webkit-box-shadow: 1px 0 5px 0 rgba(25, 31, 40, 0.2);
415
+ box-shadow: 1px 0 5px 0 rgba(25, 31, 40, 0.2);
416
+ display: -webkit-box;
417
+ display: -webkit-flex;
418
+ display: -ms-flexbox;
419
+ display: flex;
420
+ -webkit-box-pack: center;
421
+ -webkit-justify-content: center;
422
+ -ms-flex-pack: center;
423
+ justify-content: center;
424
+ -webkit-box-align: center;
425
+ -webkit-align-items: center;
426
+ -ms-flex-align: center;
427
+ align-items: center;
428
+ font-size: 12px;
429
+ color: #353638;
430
+ z-index: -1;
431
+ border-right: 1px solid #ccc;
432
+ border-bottom: 1px solid #ccc;
433
+ border-top: 1px solid #ccc;
434
+ }
435
+
436
+ .wptb-left-panel-extend svg {
437
+ display: inline-block;
438
+ width: 1em;
439
+ height: 1em;
440
+ line-height: 1em;
441
+ vertical-align: middle;
442
+ stroke-width: 0;
443
+ stroke: currentColor;
444
+ fill: currentColor;
445
+ }
446
+
447
+ .wptb-container.collapsed .wptb-left-panel .wptb-left-panel-extend svg {
448
+ -webkit-transform: rotate(180deg);
449
+ -ms-transform: rotate(180deg);
450
+ transform: rotate(180deg);
451
+ }
452
+
453
+
454
+ /**
455
+ * Settings Section
456
+ */
457
+
458
+ .wptb-settings-section p {
459
+ font-size: 16px;
460
+ margin: 0 0 10px 0;
461
+ }
462
+
463
+ .wptb-input-px {
464
+ right: 35%;
465
+ top: 0px;
466
+ position: absolute;
467
+ margin-top: 7px;
468
+ }
469
+
470
+ .wptb-settings-dropdown {
471
+ font-size: 16px;
472
+ padding: 16px 0 16px 20px;
473
+ position: relative;
474
+ background-color: #fff;
475
+ color: #186cba;
476
+ border-top: .5px solid #ccc;
477
+ border-bottom: .5px solid #ccc;
478
+ }
479
+
480
+ .wptb-settings-items,
481
+ .wptb-cell-management {
482
+ margin: 0px 1px;
483
+ transition: 1s 0s ease;
484
+ }
485
+
486
+ .wptb-cell-management {
487
+ display: none;
488
+ }
489
+
490
+ .wptb-settings-items.visible,
491
+ #wptb-inner-border-settings.visible,
492
+ .wptb-cell-management.visible {
493
+ display: block !important;
494
+ opacity: 1;
495
+ }
496
+
497
+ .wptb-settings-item-title {
498
+ font-size: 15px;
499
+ font-weight: 500;
500
+ margin: 0;
501
+ }
502
+
503
+ .wptb-settings-item-header {
504
+ font-size: 14px;
505
+ font-weight: 500;
506
+ line-height: 14px;
507
+ padding: 14px 0 14px 10px;
508
+ position: relative;
509
+ border: 1px solid #ddd;
510
+ background: #fff;
511
+ margin-top: 5px;
512
+ margin-bottom: -10px;
513
+ }
514
+
515
+ .wptb-settings-row {
516
+ box-sizing: border-box !important;
517
+ display: flex;
518
+ flex: 0 1 auto;
519
+ flex-direction: row;
520
+ flex-wrap: wrap;
521
+ padding-bottom: 25px;
522
+ }
523
+
524
+ .wptb-settings-middle-xs {
525
+ align-items: center;
526
+ background: #fff;
527
+ padding: 10px 10px 20px 10px;
528
+ margin: 0px 0 6px 0;
529
+ border: 1px solid #e5dfdf;
530
+ border-radius: 2px;
531
+ }
532
+
533
+ .wptb-settings-col-xs-8 {
534
+ flex-basis: 66.66666667%;
535
+ max-width: 66.66666667%;
536
+ }
537
+
538
+ .wptb-settings-col-xs-4 {
539
+ flex-basis: 33.33333333%;
540
+ max-width: 33.33333333%;
541
+ position: relative;
542
+ }
543
+
544
+ .wptb-number-input {
545
+ max-width: 75px;
546
+ width: 100%;
547
+ margin-left: 10px;
548
+ margin-top: 3px;
549
+ }
550
+
551
+ input[type="number"] {
552
+ height: 28px !important;
553
+ line-height: 1;
554
+ padding: 3px 5px !important;
555
+ }
556
+
557
+ input[type=range]::-moz-focus-inner {
558
+ border: 0;
559
+ }
560
+
561
+ input[type=range]::-moz-focus-outer {
562
+ border: none;
563
+ outline: none;
564
+ }
565
+
566
+ input[type=range]:focus {
567
+ outline: 0;
568
+ }
569
+
570
+ input[type="range"] {
571
+ -webkit-appearance: none;
572
+ -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
573
+ width: 100%;
574
+ height: 8px;
575
+ margin: 0;
576
+ border: none;
577
+ padding: 1px 2px;
578
+ border-radius: 14px;
579
+ background: #cccccc;
580
+ outline: none;
581
+ /* no focus outline */
582
+ }
583
+
584
+ input[type="range"]::-moz-range-track {
585
+ border: inherit;
586
+ background: #cccccc;
587
+ }
588
+
589
+ input[type="range"]::-ms-track {
590
+ border: inherit;
591
+ color: transparent;
592
+ /* don't drawn vertical reference line */
593
+ background: #cccccc;
594
+ }
595
+
596
+ input[type="range"]::-ms-fill-lower,
597
+ input[type="range"]::-ms-fill-upper {
598
+ background: #cccccc;
599
+ }
600
+
601
+ input[type="range"]::-ms-tooltip {
602
+ display: none;
603
+ }
604
+
605
+ input[type=range]::-webkit-slider-thumb:before {
606
+ content: "";
607
+ position: absolute;
608
+ left: -3000px;
609
+ right: 100%;
610
+ top: 50%;
611
+ height: 6px;
612
+ padding: 0;
613
+ background: #1d9b2a;
614
+ transform: translate(0, -50%);
615
+ }
616
+
617
+ input[type=range]::-moz-range-progress {
618
+ background-color: #3B7EC0;
619
+ height: 6px;
620
+ }
621
+
622
+
623
+ /* thumb */
624
+
625
+ input[type="range"]::-webkit-slider-thumb {
626
+ -webkit-appearance: none;
627
+ width: 18px;
628
+ height: 18px;
629
+ border: 1px solid #3B7EC0;
630
+ border-radius: 50%;
631
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #ffffff));
632
+ /* android <= 2.2 */
633
+ background-image: -webkit-linear-gradient(top, #ffffff 0, #ffffff 100%);
634
+ /* older mobile safari and android > 2.2 */
635
+ ;
636
+ background-image: linear-gradient(to bottom, #ffffff 0, #ffffff 100%);
637
+ /* W3C */
638
+ }
639
+
640
+ input[type="range"]::-moz-range-thumb {
641
+ width: 18px;
642
+ height: 18px;
643
+ border: 1px solid #3B7EC0;
644
+ border-radius: 50%;
645
+ background-image: linear-gradient(to bottom, #ffffff 0, #ffffff 100%);
646
+ /* W3C */
647
+ }
648
+
649
+ input[type="range"]::-ms-thumb {
650
+ width: 18px;
651
+ height: 18px;
652
+ border-radius: 50%;
653
+ border: 1px solid #3B7EC0;
654
+ background-image: linear-gradient(to bottom, #ffffff 0, #ffffff 100%);
655
+ /* W3C */
656
+ }
657
+
658
+ .wptb-checkbox-button {
659
+ display: inline-block;
660
+ width: 95%;
661
+ padding: 25px 0 10px 0;
662
+ }
663
+
664
+ .wptb-checkbox-button input {
665
+ display: none;
666
+ }
667
+
668
+ .wptb-checkbox-button input:checked+i::after {
669
+ -webkit-transform: translateX(20px);
670
+ transform: translateX(20px);
671
+ }
672
+
673
+ .wptb-checkbox-button input:checked+i {
674
+ background: #3B7EC0;
675
+ }
676
+
677
+ .wptb-checkbox-button i {
678
+ float: right;
679
+ padding: 2px;
680
+ width: 40px;
681
+ height: 20px;
682
+ border-radius: 13px;
683
+ vertical-align: middle;
684
+ transition: .25s .09s;
685
+ position: relative;
686
+ background: #d8d9db;
687
+ box-sizing: initial;
688
+ }
689
+
690
+ .wptb-checkbox-button i::after {
691
+ content: " ";
692
+ display: block;
693
+ width: 20px;
694
+ height: 20px;
695
+ border-radius: 50%;
696
+ background: #fff;
697
+ position: absolute;
698
+ left: 2px;
699
+ transition: .25s;
700
+ }
701
+
702
+
703
+ /**
704
+ * Element Section
705
+ */
706
+
707
+ .wptb-elements-section {
708
+ height: auto;
709
+ }
710
+
711
+ .wptb-tabs {
712
+ width: 100%;
713
+ margin: 0;
714
+ padding: 0;
715
+ background: #ffffff;
716
+ border-bottom: .5px solid #ccc;
717
+ max-width: 349px;
718
+ z-index: 10;
719
+ }
720
+
721
+ ul.wptb-tabs {
722
+ list-style: none;
723
+ }
724
+
725
+ .wptb-tabs li {
726
+ float: left;
727
+ width: 49.3%;
728
+ margin: 0;
729
+ }
730
+
731
+ .wptb-tabs li:last-of-type {
732
+ float: right;
733
+ }
734
+
735
+ .wptb-tabs li a {
736
+ display: block;
737
+ text-align: center;
738
+ padding: 18px 10px;
739
+ font-size: 16px;
740
+ color: #186cba;
741
+ text-decoration: none;
742
+ }
743
+
744
+ .wptb-tabs li a:hover {
745
+ color: #186cba;
746
+ text-decoration: none;
747
+ }
748
+
749
+ .wptb-tabs li a:focus {
750
+ -webkit-box-shadow: none;
751
+ box-shadow: none;
752
+ }
753
+
754
+ .wptb-tabs li .active,
755
+ .wptb-tabs li .active:hover {
756
+ color: #186cba;
757
+ }
758
+
759
+ .wptb-tabs #wptb-add-elements .active {
760
+ background: #fff;
761
+ }
762
+
763
+ .wptb-tabs #element-options .active {
764
+ background: #fff;
765
+ }
766
+
767
+
768
+ /**
769
+ * Tabs Content
770
+ */
771
+
772
+ .wptb-tab-content {
773
+ padding: 0;
774
+ }
775
+
776
+
777
+ /**
778
+ * Elements
779
+ */
780
+
781
+ .wptb-elements-container {
782
+ width: 100%;
783
+ max-height: inherit;
784
+ display: table;
785
+ padding: 0 0 60px 0;
786
+ }
787
+
788
+ .wptb-element {
789
+ background: #fff;
790
+ color: #000;
791
+ font-size: 15px;
792
+ display: flex;
793
+ align-items: center;
794
+ justify-content: center;
795
+ flex-direction: column;
796
+ height: 100px;
797
+ text-align: center;
798
+ border-radius: 4px;
799
+ border: 1px solid #ccc;
800
+ transition: all .25s;
801
+ cursor: move;
802
+ }
803
+
804
+ .wptb-element p {
805
+ margin: 0;
806
+ font-size: 15px;
807
+ }
808
+
809
+ .wptb-element:hover {
810
+ box-shadow: 0px 1px 2px 0.5px #cececc;
811
+ }
812
+
813
+ .left {
814
+ width: 47.5%;
815
+ float: left;
816
+ margin: 6px 0 -4px 6px;
817
+ }
818
+
819
+ .right {
820
+ width: 47.5%;
821
+ float: right;
822
+ margin: 6px 5px -4px 0;
823
+ }
824
+
825
+
826
+ /**
827
+ * Builder Panel
828
+ */
829
+
830
+ .wptb-builder-panel {
831
+ position: relative;
832
+ left: 300px;
833
+ min-height: 100%;
834
+ padding-left: 20px;
835
+ padding-right: 20px;
836
+ -webkit-transition: left 0.2s ease-out, right 0.2s ease-out;
837
+ -o-transition: left 0.2s ease-out, right 0.2s ease-out;
838
+ transition: left 0.2s ease-out, right 0.2s ease-out;
839
+ width: calc(100% - 300px);
840
+ text-align: center;
841
+ }
842
+
843
+ .wptb-container.collapsed .wptb-builder-panel {
844
+ left: 0;
845
+ width: 100%;
846
+ }
847
+
848
+
849
+ /**
850
+ * Table name Setup
851
+ */
852
+
853
+ .wptb-name-setup {
854
+ border-bottom: 1px solid #d6d6d6;
855
+ justify-content: center;
856
+ text-align: center;
857
+ }
858
+
859
+ .wptb-name-setup span {
860
+ display: inline-block;
861
+ font-size: 24px;
862
+ height: 90px;
863
+ line-height: 90px;
864
+ padding: 0 30px;
865
+ }
866
+
867
+ #wptb-setup-name {
868
+ margin: 17px 0 18px 18px;
869
+ height: 55px;
870
+ box-shadow: none;
871
+ border: 1px solid #d6d6d6;
872
+ font-size: 18px;
873
+ width: 420px;
874
+ padding: 0 20px;
875
+ }
876
+
877
+ .wptb-messaging {
878
+ color: white;
879
+ height: 0;
880
+ margin: 0 auto;
881
+ padding: 5px;
882
+ transition: all 1s 0s;
883
+ width: 90%;
884
+ text-align: initial;
885
+ }
886
+
887
+ .wptb-messaging.wptb-success {
888
+ background: #4caf50;
889
+ background: -moz-linear-gradient(45deg, #4caf50 0%, #8bc34a 100%);
890
+ background: -webkit-linear-gradient(45deg, #4caf50 0%, #8bc34a 100%);
891
+ background: linear-gradient(45deg, #4caf50 0%, #8bc34a 100%);
892
+ filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#4caf50', endColorstr='#8bc34a', GradientType=1);
893
+ height: auto;
894
+ }
895
+
896
+ .wptb-messaging.wptb-warning {
897
+ background: #f44336;
898
+ background: -moz-linear-gradient(45deg, #f44336 0%, #ff5722 100%);
899
+ background: -webkit-linear-gradient(45deg, #f44336 0%, #ff5722 100%);
900
+ background: linear-gradient(45deg, #f44336 0%, #ff5722 100%);
901
+ filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#f44336', endColorstr='#ff5722', GradientType=1);
902
+ height: auto;
903
+ }
904
+
905
+
906
+ /**
907
+ *
908
+ */
909
+
910
+ .wptb-management_table_container {
911
+ margin: auto;
912
+ text-align: initial;
913
+ }
914
+
915
+ .wptb-table-setup {
916
+ justify-content: center;
917
+ position: relative;
918
+ z-index: 1;
919
+ margin: auto;
920
+ padding: 2px;
921
+ background: #fff;
922
+ margin-top: 30px;
923
+ margin-bottom: 30px;
924
+ max-width: 850px;
925
+ overflow-x: auto;
926
+ overflow-y: hidden;
927
+ }
928
+
929
+ #wptb-cell_mode_background {
930
+ position: absolute;
931
+ top: 0;
932
+ left: 0;
933
+ right: 0;
934
+ bottom: 0;
935
+ background: rgba(49, 59, 71, 0.49);
936
+ display: none;
937
+ text-align: initial;
938
+ }
939
+
940
+ #wptb-cell_mode_background.visible {
941
+ display: block;
942
+ }
943
+
944
+
945
+ /**
946
+ * Table
947
+ */
948
+
949
+ table.wptb-table {
950
+ border-collapse: collapse
951
+ }
952
+
953
+ .wptb-wrapper {
954
+ margin: 0 auto;
955
+ padding: 40px;
956
+ max-width: 960px;
957
+ text-align: initial;
958
+ }
959
+
960
+ .wptb-table {
961
+ margin: 20px 0 60px 0;
962
+ width: 100%;
963
+ border: 1px solid #ccc;
964
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
965
+ display: table;
966
+ }
967
+
968
+ @media screen and (max-width: 580px) {
969
+ .wptb-table {
970
+ display: block;
971
+ }
972
+ }
973
+
974
+ .wptb-row {
975
+ display: table-row;
976
+ background: #bebebe;
977
+ }
978
+
979
+ .wptb-row:nth-of-type(odd) {
980
+ background: #bebebe;
981
+ }
982
+
983
+ .wptb-row.wptb-table-header {
984
+ font-weight: 900;
985
+ color: #ffffff;
986
+ background: #ea6153;
987
+ }
988
+
989
+ .wptb-row.wptb-green {
990
+ background: #27ae60;
991
+ }
992
+
993
+ .wptb-row.wptb-blue {
994
+ background: #2980b9;
995
+ }
996
+
997
+ @media screen and (max-width: 580px) {
998
+ .wptb-row {
999
+ padding: 14px 0 7px;
1000
+ display: block;
1001
+ }
1002
+ .wptb-row.wptb-table-header {
1003
+ padding: 0;
1004
+ height: 6px;
1005
+ }
1006
+ .wptb-row.wptb-table-header .wptb-cell {
1007
+ display: none;
1008
+ }
1009
+ .wptb-row .wptb-cell {
1010
+ margin-bottom: 10px;
1011
+ }
1012
+ .wptb-row .wptb-cell:before {
1013
+ margin-bottom: 3px;
1014
+ content: attr(data-title);
1015
+ min-width: 98px;
1016
+ font-size: 10px;
1017
+ line-height: 10px;
1018
+ font-weight: bold;
1019
+ text-transform: uppercase;
1020
+ color: #969696;
1021
+ display: block;
1022
+ }
1023
+ }
1024
+
1025
+ .wptb-cell {
1026
+ padding: 12px 12px;
1027
+ display: table-wptb-cell;
1028
+ }
1029
+
1030
+ @media screen and (max-width: 580px) {
1031
+ /* .wptb-cell {
1032
+ padding: 2px 16px;
1033
+ display: block;
1034
+ }*/
1035
+ }
1036
+
1037
+ .wptb-preview-table {
1038
+ table-layout: fixed;
1039
+ font-size: 15px;
1040
+ width: 100%;
1041
+ display: table;
1042
+ border-collapse: collapse;
1043
+ }
1044
+
1045
+ .wptb-preview-table.wptb-preview-table-manage-cells tbody>tr>td::after {
1046
+ content: '';
1047
+ display: block;
1048
+ position: absolute;
1049
+ top: 0;
1050
+ right: 0;
1051
+ left: 0;
1052
+ bottom: 0;
1053
+ }
1054
+
1055
+ .wptb-preview-table.wptb-preview-table-manage-cells td:hover::after {
1056
+ background: rgba(207, 218, 239, 0.2);
1057
+ border-color: inherit;
1058
+ }
1059
+
1060
+ .wptb-preview-table p {
1061
+ margin: 0;
1062
+ font-size: 15px;
1063
+ word-wrap: break-word;
1064
+ overflow-wrap: break-word;
1065
+ }
1066
+
1067
+ .wptb-preview-table ul {
1068
+ list-style-type: disc;
1069
+ margin-left: 15px;
1070
+ }
1071
+
1072
+ .wptb-preview-table tr {
1073
+ display: table-row;
1074
+ background: #fcfcfc;
1075
+ }
1076
+
1077
+ .wptb-preview-table tr:nth-of-type(odd) {
1078
+ background: #eeeeee;
1079
+ }
1080
+
1081
+ .wptb-state-dragging td {
1082
+ cursor: all-scroll;
1083
+ }
1084
+
1085
+ .wptb-preview-table td {
1086
+ padding: 15px;
1087
+ position: relative;
1088
+ width: 100px;
1089
+ box-sizing: content-box;
1090
+ }
1091
+
1092
+ .wptb-preview-table .wptb-row td.wptb-highlighted,
1093
+ .wptb-state-dragging td:hover {
1094
+ outline: 1px solid lightgreen;
1095
+ }
1096
+
1097
+ .wptb-preview-table .wptb-row.wptb-highlighted-row {
1098
+ background-color: hsla(210, 53%, 49%, 0.34);
1099
+ border: 1px solid pink;
1100
+ }
1101
+
1102
+ .wptb-preview-table .wptb-row td.wptb-highlighted-row-first {
1103
+ background-color: hsla(210, 53%, 49%, 0.34);
1104
+ border-bottom: 1px solid pink;
1105
+ border-left: 1px solid pink;
1106
+ border-right: inherit;
1107
+ border-top: 1px solid pink;
1108
+ }
1109
+
1110
+ .wptb-preview-table .wptb-row td.wptb-highlighted-row-inner {
1111
+ background-color: hsla(210, 53%, 49%, 0.34);
1112
+ border-bottom: 1px solid pink;
1113
+ border-left: inherit;
1114
+ border-right: inherit;
1115
+ border-top: 1px solid pink;
1116
+ }
1117
+
1118
+ .wptb-preview-table .wptb-row td.wptb-highlighted-row-last {
1119
+ background-color: hsla(210, 53%, 49%, 0.34);
1120
+ border-bottom: 1px solid pink;
1121
+ border-left: inherit;
1122
+ border-right: 1px solid pink;
1123
+ border-top: 1px solid pink;
1124
+ }
1125
+
1126
+ .wptb-preview-table .wptb-row td.wptb-highlighted-column-first {
1127
+ background-color: hsla(210, 53%, 49%, 0.34);
1128
+ border-bottom: inherit;
1129
+ border-left: 1px solid pink;
1130
+ border-right: 1px solid pink;
1131
+ border-top: 1px solid pink;
1132
+ }
1133
+
1134
+ .wptb-preview-table .wptb-row td.wptb-highlighted-column-inner {
1135
+ background-color: hsla(210, 53%, 49%, 0.34);
1136
+ border-bottom: inherit;
1137
+ border-left: 1px solid pink;
1138
+ border-right: 1px solid pink;
1139
+ border-top: inherit;
1140
+ }
1141
+
1142
+ .wptb-preview-table .wptb-row td.wptb-highlighted-column-last {
1143
+ background-color: hsla(210, 53%, 49%, 0.34);
1144
+ border-bottom: 1px solid pink;
1145
+ border-left: 1px solid pink;
1146
+ border-right: 1px solid pink;
1147
+ border-top: inherit;
1148
+ }
1149
+
1150
+ .wptb-row td:empty::before {
1151
+ content: 'Cell';
1152
+ display: block;
1153
+ font-weight: normal;
1154
+ font-size: 80%;
1155
+ text-align: center;
1156
+ color: #969fa6;
1157
+ }
1158
+
1159
+ .wptb-row td:empty::after {
1160
+ content: '';
1161
+ display: block;
1162
+ border: 1px dashed #969fa6;
1163
+ position: absolute;
1164
+ top: 2px;
1165
+ right: 2px;
1166
+ bottom: 2px;
1167
+ left: 2px;
1168
+ }
1169
+
1170
+ .wptb-table-head td:empty::before {
1171
+ content: 'Header';
1172
+ }
1173
+
1174
+ .wptb-ph-element {
1175
+ position: relative;
1176
+ border: 1px solid #fff0;
1177
+ margin-top: 7px;
1178
+ margin-bottom: 7px;
1179
+ }
1180
+
1181
+
1182
+ /*
1183
+ ** Button Style
1184
+ */
1185
+
1186
+ .wptb-button-wrapper {
1187
+ display: flex;
1188
+ align-items: center;
1189
+ justify-content: center;
1190
+ }
1191
+
1192
+ .wptb-button-wrapper>a {
1193
+ text-decoration: none;
1194
+ max-width: 100%;
1195
+ }
1196
+
1197
+ .wptb-button {
1198
+ padding: 16px;
1199
+ background: #329d3f;
1200
+ color: #ffffff;
1201
+ cursor: pointer;
1202
+ }
1203
+
1204
+ .wptb-button:hover {
1205
+ color: #ffffff;
1206
+ }
1207
+
1208
+
1209
+ /**
1210
+ * Table Generator
1211
+ */
1212
+
1213
+ .wptb-table-generator {
1214
+ text-align: center;
1215
+ margin: 60px auto 20px auto;
1216
+ }
1217
+
1218
+ .wptb-table-generator input {
1219
+ margin: 0;
1220
+ }
1221
+
1222
+ .wptb-generator-btn {
1223
+ width: 92%;
1224
+ padding: 15px;
1225
+ background: #3B7EC0;
1226
+ color: white;
1227
+ cursor: pointer;
1228
+ }
1229
+
1230
+ .wptb-input-number {
1231
+ width: 80px;
1232
+ padding: 0 12px;
1233
+ vertical-align: top;
1234
+ text-align: center;
1235
+ outline: none;
1236
+ }
1237
+
1238
+ .wptb-input-number,
1239
+ .wptb-input-number-decrement,
1240
+ .wptb-input-number-increment {
1241
+ border: 1px solid #ccc;
1242
+ height: 40px;
1243
+ }
1244
+
1245
+ .wptb-input-number-decrement,
1246
+ .wptb-input-number-increment {
1247
+ display: inline-block;
1248
+ width: 30px;
1249
+ line-height: 38px;
1250
+ background: #f1f1f1;
1251
+ color: #444;
1252
+ text-align: center;
1253
+ font-weight: bold;
1254
+ cursor: pointer;
1255
+ user-select: none;
1256
+ }
1257
+
1258
+ .wptb-input-number-decrement:active,
1259
+ .wptb-input-number-increment:active {
1260
+ background: #ddd;
1261
+ }
1262
+
1263
+ .wptb-input-number-decrement {
1264
+ border-right: none;
1265
+ border-radius: 4px 0 0 4px;
1266
+ }
1267
+
1268
+ .wptb-input-number-increment {
1269
+ border-left: none;
1270
+ border-radius: 0 4px 4px 0;
1271
+ }
1272
+
1273
+ .wptb-allow-drop {
1274
+ background: #b5e0d7;
1275
+ }
1276
+
1277
+ #wpcd_fixed_toolbar {
1278
+ min-height: 55px;
1279
+ text-align: center;
1280
+ position: sticky !important;
1281
+ top: 20px;
1282
+ z-index: 100;
1283
+ display: inline-block;
1284
+ }
1285
+
1286
+ #wpcd_fixed_toolbar>div.toolbar-active {
1287
+ display: block !important;
1288
+ }
1289
+
1290
+
1291
+ /*
1292
+ ** Button Size Selector Style
1293
+ */
1294
+
1295
+ .wptb-btn-size-btn {
1296
+ padding: 8px 15px;
1297
+ margin: 0;
1298
+ vertical-align: middle;
1299
+ border: solid 1px #ccc;
1300
+ font-size: 12px;
1301
+ border-radius: 4px;
1302
+ cursor: pointer;
1303
+ }
1304
+
1305
+ .wptb-btn-size-switcher {
1306
+ background: linear-gradient(to bottom, white, #eeeeee);
1307
+ display: table-cell;
1308
+ border-right: none;
1309
+ border-radius: 0;
1310
+ color: #433f33;
1311
+ }
1312
+
1313
+ .wptb-btn-size-switcher:first-child {
1314
+ border-radius: 4px 0 0 4px;
1315
+ }
1316
+
1317
+ .wptb-btn-size-switcher:last-child {
1318
+ border-radius: 0 4px 4px 0;
1319
+ border-right: solid 1px #ccc;
1320
+ }
1321
+
1322
+ .wptb-btn-size-switcher:hover {
1323
+ background: #fff;
1324
+ }
1325
+
1326
+ .wptb-btn-size-switcher:active {
1327
+ box-shadow: inset 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
1328
+ }
1329
+
1330
+ .wptb-btn-size-switcher.selected {
1331
+ background: #fff;
1332
+ box-shadow: inset 0px 0px 20px 4px rgba(0, 0, 0, 0.15);
1333
+ cursor: default;
1334
+ }
1335
+
1336
+
1337
+ /* customize tinymce Editor */
1338
+
1339
+ .mce-tinymce.mce-tinymce-inline.mce-container.mce-panel {
1340
+ left: 50% !important;
1341
+ transform: translate(-50%, 0) !important;
1342
+ border: 0px !important;
1343
+ }
1344
+
1345
+ .mce-container.mce-panel.mce-floatpanel.mce-window.mce-in {
1346
+ z-index: 100100 !important;
1347
+ }
1348
+
1349
+ .mce-container.mce-panel.mce-floatpanel.mce-menu.mce-animate.mce-fixed.mce-menu-align.mce-in {
1350
+ z-index: 100101 !important;
1351
+ }
1352
+
1353
+ .mce-edit-focus {
1354
+ outline: none !important;
1355
+ }
1356
+
1357
+ .mce-btn button {
1358
+ padding: 14px 18px !important;
1359
+ }
1360
+
1361
+ .mce-ico {
1362
+ font-size: 20px !important;
1363
+ }
1364
+
1365
+ .mce-content-body [data-mce-selected="inline-boundary"] {
1366
+ background: transparent !important;
1367
+ }
1368
+
1369
+ .wptb-droppable.wptb-cell ul,
1370
+ .wptb-droppable.wptb-cell ol {
1371
+ border: 1px solid transparent;
1372
+ margin: 0;
1373
+ padding: 1em 0 0 0;
1374
+ width: 100%;
1375
+ }
1376
+
1377
+ .wptb-droppable.wptb-cell ul article,
1378
+ .wptb-droppable.wptb-cell ol article {
1379
+ align-items: flex-start;
1380
+ border: 1px solid transparent;
1381
+ display: flex;
1382
+ flex-direction: row;
1383
+ justify-content: start;
1384
+ list-style-type: none;
1385
+ margin-bottom: 0;
1386
+ padding: 0;
1387
+ position: relative;
1388
+ width: 100%;
1389
+ }
1390
+
1391
+ .wptb-list-item-container ul li {
1392
+ list-style: none;
1393
+ }
1394
+
1395
+ .wptb-droppable.wptb-cell li .wptb-list-item-content {
1396
+ min-height: 30px;
1397
+ }
1398
+
1399
+ .wptb-droppable.wptb-cell li .wptb-list-item-content p {
1400
+ word-wrap: break-word;
1401
+ line-height: 30px;
1402
+ }
1403
+
1404
+ .wptb-list-item-container ul li>div>p::before {
1405
+ content: attr(data-list-style-type-index);
1406
+ display: inline-block;
1407
+ line-height: 30px;
1408
+ padding: 0 5px 0 0;
1409
+ font-size: 15px;
1410
+ font-family: verdana, sans-serif;
1411
+ cursor: text;
1412
+ }
1413
+
1414
+ .wptb-list-item-container ul li>div>p::before {
1415
+ padding-right: 10px;
1416
+ }
1417
+
1418
+ .wptb-list-item-container ul li>div>p.wptb-list-style-type-disc::before {
1419
+ content: '\25CF';
1420
+ }
1421
+
1422
+ .wptb-list-item-container ul li>div>p.wptb-list-style-type-circle::before {
1423
+ content: '\25CB';
1424
+ }
1425
+
1426
+ .wptb-list-item-container ul li>div>p.wptb-list-style-type-square::before {
1427
+ content: '\25A0';
1428
+ }
1429
+
1430
+ .wptb-list-item-container ul li>div>p.wptb-list-style-type-none::before {
1431
+ content: '';
1432
+ padding-right: 0px;
1433
+ }
1434
+
1435
+ .wptb-droppable.wptb-cell .wptb-directlyhovered {
1436
+ border: 1px solid #1ea5e5 !important;
1437
+ position: relative;
1438
+ width: 100%;
1439
+ }
1440
+
1441
+ .wptb-droppable.wptb-cell .wptb-list-item-container.wptb-directlyhovered {
1442
+ display: block;
1443
+ }
1444
+
1445
+ .wptb-droppable.wptb-cell .wptb-directlyhovered .wptb-directlyhovered {
1446
+ display: flex;
1447
+ width: 100%;
1448
+ }
1449
+
1450
+ .wptb-droppable.wptb-cell .wptb-list-item-container.wptb-directlyhovered .wptb-directlyhovered {
1451
+ display: list-item;
1452
+ border: none !important;
1453
+ }
1454
+
1455
+ .wptb-droppable.wptb-cell .wptb-list-item-container.wptb-directlyhovered .wptb-directlyhovered:before {
1456
+ content: "";
1457
+ display: inline-block;
1458
+ position: absolute;
1459
+ top: 0;
1460
+ right: 0;
1461
+ bottom: 0;
1462
+ left: 0;
1463
+ border: 1px solid #1ea5e5 !important;
1464
+ }
1465
+
1466
+ .wptb-list-item-container {
1467
+ /*padding-left: 20px;*/
1468
+ }
1469
+
1470
+ .wptb-actions {
1471
+ align-items: center;
1472
+ background-color: #1ea5e5;
1473
+ border-top-left-radius: 4px;
1474
+ border-top-right-radius: 4px;
1475
+ box-sizing: border-box;
1476
+ color: white;
1477
+ display: flex;
1478
+ display: -webkit-flex;
1479
+ justify-content: space-between;
1480
+ line-height: 1em;
1481
+ padding: 0px 5px;
1482
+ position: absolute;
1483
+ right: 0;
1484
+ top: -15px;
1485
+ height: 15px;
1486
+ font-size: 9pt;
1487
+ display: none;
1488
+ }
1489
+
1490
+ .wptb-ph-element:hover .wptb-actions {
1491
+ display: inline;
1492
+ }
1493
+
1494
+ .wptb-actions .dashicons.dashicons-admin-page.wptb-duplicate-action {
1495
+ font-size: 10pt;
1496
+ margin: 0em 0.05em 0 0.1em;
1497
+ width: 15px;
1498
+ height: 15px;
1499
+ }
1500
+
1501
+ .wptb-actions .dashicons.dashicons-trash.wptb-delete-action {
1502
+ font-size: 10pt;
1503
+ margin: 0em 0.1em 0 0.05em;
1504
+ width: 15px;
1505
+ height: 15px;
1506
+ }
1507
+
1508
+ .wptb-cell-management .wptb-button {
1509
+ background: #3e99ca;
1510
+ color: #ffffff;
1511
+ border: none;
1512
+ border-radius: 2px;
1513
+ padding: .4em 0;
1514
+ width: 100%;
1515
+ box-shadow: 2px 1px 0px 0px rgba(13, 85, 126, 0.71);
1516
+ }
1517
+
1518
+ .wptb-cell-management .wptb-button[disabled] {
1519
+ display: none;
1520
+ }
1521
+
1522
+ .wptb-space-between {
1523
+ min-height: 10px;
1524
+ width: 100%;
1525
+ }
1526
+
1527
+ .wptb-ph-element.wptb-ondragenter::before {
1528
+ content: "";
1529
+ display: block;
1530
+ position: absolute;
1531
+ top: 0;
1532
+ bottom: 0;
1533
+ left: 0;
1534
+ right: 0;
1535
+ z-index: 100;
1536
+ }
1537
+
1538
+ .wptb-ph-element.wptb-moving-mode {
1539
+ opacity: .4;
1540
+ -webkit-transform: scale(0.9) translate(-5%, -5%);
1541
+ -ms-transform: scale(0.9) translate(-5%, -5%);
1542
+ transform: scale(0.9) translate(-5%, -5%);
1543
+ -webkit-transition: all .2s ease-in-out;
1544
+ -o-transition: all .2s ease-in-out;
1545
+ transition: all .2s ease-in-out;
1546
+ }
1547
+
1548
+ .wptb-drop-handle {
1549
+ height: 11px;
1550
+ position: absolute;
1551
+ z-index: 100100;
1552
+ display: none;
1553
+ }
1554
+
1555
+ .wptb-drop-handle::after {
1556
+ content: attr(data-text);
1557
+ background-color: dodgerblue;
1558
+ color: white;
1559
+ display: block;
1560
+ font-variant: small-caps;
1561
+ position: relative;
1562
+ text-align: center;
1563
+ width: 100%;
1564
+ height: 100%;
1565
+ font-size: 11px;
1566
+ line-height: 1;
1567
+ text-transform: uppercase;
1568
+ box-sizing: border-box;
1569
+ }
1570
+
1571
+ .wptb-drop-border-marker {
1572
+ position: absolute;
1573
+ width: 1px;
1574
+ height: 1px;
1575
+ z-index: 100100;
1576
+ }
1577
+
1578
+ .wptb-drop-handle.wptb-moving-into-same-elem,
1579
+ .wptb-drop-border-marker.wptb-moving-into-same-elem {
1580
+ opacity: 0;
1581
+ visibility: hidden;
1582
+ }
1583
+
1584
+ .wptb-drop-border-marker>div {
1585
+ position: absolute;
1586
+ background: #1ea9eb;
1587
+ }
1588
+
1589
+ .wptb-drop-border-marker-top {
1590
+ top: 0;
1591
+ left: 0;
1592
+ height: 1px;
1593
+ }
1594
+
1595
+ .wptb-drop-border-marker-right {
1596
+ top: 0;
1597
+ width: 1px;
1598
+ }
1599
+
1600
+ .wptb-drop-border-marker-bottom {
1601
+ left: 0;
1602
+ height: 1px;
1603
+ }
1604
+
1605
+ .wptb-drop-border-marker-left {
1606
+ top: 0;
1607
+ left: 0;
1608
+ width: 1px;
1609
+ }
1610
+
1611
+ .wptb-space-between.visible:empty::before {
1612
+ background-color: dodgerblue;
1613
+ border: 1px solid dodgerblue;
1614
+ color: white;
1615
+ content: 'drop here';
1616
+ display: block;
1617
+ font-variant: small-caps;
1618
+ margin: 2px 5%;
1619
+ padding: 0.5em 0;
1620
+ position: relative;
1621
+ text-align: center;
1622
+ width: 90%;
1623
+ }
1624
+
1625
+ .wptb-draggable {
1626
+ border: none;
1627
+ }
1628
+
1629
+ .wptb-actions .dashicons.dashicons-move.wptb-move-action {
1630
+ font-size: 17px !important;
1631
+ cursor: move;
1632
+ }
1633
+
1634
+ .wptb-no-cell-action:not(.visible),
1635
+ .wptb-single-action:not(.visible),
1636
+ .wptb-multiple-select-action:not(.visible) {
1637
+ cursor: not-allowed;
1638
+ opacity: 0.3;
1639
+ }
1640
+
1641
+ .wptb-item-dragging {
1642
+ background-color: purple;
1643
+ min-height: 30px;
1644
+ min-width: 30px;
1645
+ position: absolute;
1646
+ transition: all 0.2s ease;
1647
+ transition-property: left, top;
1648
+ width: auto;
1649
+ z-index: 110000;
1650
+ }
1651
+
1652
+ .wptb-range-input {
1653
+ height: 20px;
1654
+ position: relative;
1655
+ }
1656
+
1657
+ .wptb-range-input .slider {
1658
+ background-color: white;
1659
+ border: 1px solid #4b88c4;
1660
+ border-radius: 200px;
1661
+ box-sizing: border-box;
1662
+ height: 20px;
1663
+ left: 2px;
1664
+ position: absolute;
1665
+ top: 0;
1666
+ width: 20px;
1667
+ z-index: 10;
1668
+ }
1669
+
1670
+ .wptb-range-input .rail {
1671
+ background: #cccccc;
1672
+ border-radius: 14px;
1673
+ bottom: 6px;
1674
+ height: 8px;
1675
+ position: absolute;
1676
+ width: 100%;
1677
+ z-index: 1;
1678
+ }
1679
+
1680
+ .wptb-table-head td.wptb-drop-here-empty:empty::before,
1681
+ .wptb-row td.wptb-drop-here-empty:empty::before {
1682
+ background-color: dodgerblue;
1683
+ border: 1px solid dodgerblue;
1684
+ box-sizing: border-box;
1685
+ color: white;
1686
+ content: 'drop here';
1687
+ display: block;
1688
+ font-size: 1em;
1689
+ font-variant: small-caps;
1690
+ padding: 0.2em 0.4em;
1691
+ text-align: center;
1692
+ width: 100%;
1693
+ }
1694
+
1695
+ td[class*="wptb-fused-cell"] {
1696
+ display: none !important;
1697
+ }
1698
+
1699
+ .wptb-size-S .wptb-button {
1700
+ border-radius: .2rem;
1701
+ padding: .35rem .6rem;
1702
+ max-width: 100%;
1703
+ }
1704
+
1705
+ .wptb-size-S .wptb-button p {
1706
+ font-size: .875rem;
1707
+ line-height: 1.5;
1708
+ }
1709
+
1710
+ .wptb-size-M .wptb-button {
1711
+ border-radius: .3rem;
1712
+ padding: .475rem .85rem;
1713
+ max-width: 100%;
1714
+ }
1715
+
1716
+ .wptb-size-M .wptb-button p {
1717
+ font-size: 1.125rem;
1718
+ line-height: 1.5;
1719
+ }
1720
+
1721
+ .wptb-size-L .wptb-button {
1722
+ border-radius: .3rem;
1723
+ padding: .6rem 1.2rem;
1724
+ max-width: 100%;
1725
+ }
1726
+
1727
+ .wptb-size-L .wptb-button p {
1728
+ font-size: 1.25rem;
1729
+ line-height: 1.5;
1730
+ }
1731
+
1732
+ .wptb-size-XL .wptb-button {
1733
+ border-radius: .4rem;
1734
+ padding: .8rem 1.35rem;
1735
+ max-width: 100%;
1736
+ }
1737
+
1738
+ .wptb-size-XL .wptb-button p {
1739
+ font-size: 1.35rem;
1740
+ line-height: 1.5;
1741
+ }
1742
+
1743
+ [class*=wptb-element-text-] p {
1744
+ color: inherit !important;
1745
+ font-size: inherit !important;
1746
+ }
1747
+
1748
+ .wptb-split-page-title-action a,
1749
+ .wptb-split-page-title-action a:active,
1750
+ .wptb-split-page-title-action .wptb-expander::after {
1751
+ padding: 6px 10px;
1752
+ position: relative;
1753
+ top: -3px;
1754
+ text-decoration: none;
1755
+ border: 1px solid #ccc;
1756
+ border-radius: 2px;
1757
+ background: #f7f7f7;
1758
+ text-shadow: none;
1759
+ font-weight: 600;
1760
+ font-size: 13px;
1761
+ line-height: normal;
1762
+ color: #0073aa;
1763
+ cursor: pointer;
1764
+ outline: 0;
1765
+ }
1766
+
1767
+ .wptb-split-page-title-action a:hover {
1768
+ color: #fff;
1769
+ background-color: #1f8abb;
1770
+ }
1771
+
1772
+ .wptb-column-title-mobile {
1773
+ display: none;
1774
+ }
1775
+
1776
+ @media screen and (max-width: 970px) {
1777
+ #wptb-setup-name {
1778
+ width: 100%;
1779
+ max-width: 420px;
1780
+ margin-left: 0px;
1781
+ }
1782
+ }
1783
+
1784
+ .wptb-cell img {
1785
+ max-width: 100%;
1786
+ }
inc/admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
inc/admin/js/admin.js ADDED
@@ -0,0 +1,3963 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+ var WPTB_Builder = function WPTB_Builder() {
3
+ var table_id = WPTB_Helper.detectMode();
4
+ if (table_id) {
5
+ var http = new XMLHttpRequest(),
6
+ urlSet = ajaxurl + "?action=get_table" + '&id=' + table_id;
7
+ http.open('GET', urlSet, true);
8
+ http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
9
+ http.onreadystatechange = function (d) {
10
+ if (this.readyState == 4 && this.status == 200) {
11
+ var ans = JSON.parse(http.responseText);
12
+ document.getElementById('wptb-setup-name').value = ans[0];
13
+
14
+ if (ans[1]) {
15
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';
16
+ var wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];
17
+ wptbTableSetupEl.appendChild(WPTB_Parser(ans[1]));
18
+ WPTB_Table();
19
+ WPTB_LeftPanel();
20
+ WPTB_Settings();
21
+ } else {
22
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
23
+ }
24
+
25
+ return;
26
+ }
27
+ };
28
+ http.send(null);
29
+ } else {
30
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
31
+ }
32
+ document.counter = new ElementCounters();
33
+ document.select = new MultipleSelect();
34
+
35
+ var initializer = WPTB_Initializer();
36
+ settings = WPTB_Settings();
37
+ };
38
+
39
+ document.addEventListener('DOMContentLoaded', WPTB_Builder);
40
+ })();
41
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
42
+
43
+ var WPTB_Button = function WPTB_Button(text, DOMElementProt) {
44
+
45
+ var DOMElement = document.createElement('div'),
46
+ elButton = document.createElement('div'),
47
+ el_B = document.createElement('a'),
48
+ el_BDiv = document.createElement('div'),
49
+ kindIndexProt = undefined,
50
+ copy = false;
51
+
52
+ DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');
53
+ elButton.classList.add('wptb-button-wrapper');
54
+ el_BDiv.classList.add('wptb-button');
55
+ el_BDiv.innerHTML = text != undefined ? text : 'Button Text';
56
+
57
+ // Creation of a new button when copying to avoid errors when assigning new event handlers.
58
+ if (DOMElementProt) {
59
+ var wptbElementMutch = DOMElementProt.className.match(/wptb-element-((.+-)\d+)/i);
60
+ if (wptbElementMutch && Array.isArray(wptbElementMutch)) {
61
+ kindIndexProt = wptbElementMutch[1];
62
+ copy = true;
63
+ };
64
+ var attributesContainer = [].concat(_toConsumableArray(DOMElementProt.attributes));
65
+ if (attributesContainer.length > 0) {
66
+ for (var i = 0; i < attributesContainer.length; i++) {
67
+ DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);
68
+ }
69
+ }
70
+
71
+ var wptbButtonWrapper = DOMElementProt.querySelector('.wptb-button-wrapper');
72
+ if (wptbButtonWrapper) {
73
+ var wptbButtonWrapAttributes = [].concat(_toConsumableArray(wptbButtonWrapper.attributes));
74
+ if (wptbButtonWrapAttributes.length > 0) {
75
+ for (var _i = 0; _i < wptbButtonWrapAttributes.length; _i++) {
76
+ if (wptbButtonWrapAttributes[_i].name == 'style') {
77
+ elButton.setAttribute(wptbButtonWrapAttributes[_i].name, wptbButtonWrapAttributes[_i].value);
78
+ }
79
+ }
80
+ }
81
+ }
82
+
83
+ var wptbButton = DOMElementProt.querySelector('a');
84
+ if (wptbButton) {
85
+ var wptbButtonAttributes = [].concat(_toConsumableArray(wptbButton.attributes));
86
+ if (wptbButtonAttributes.length > 0) {
87
+ for (var _i2 = 0; _i2 < wptbButtonAttributes.length; _i2++) {
88
+ if (wptbButtonAttributes[_i2].name == 'style' || wptbButtonAttributes[_i2].name == 'href' || wptbButtonAttributes[_i2].name == 'target') {
89
+ el_B.setAttribute(wptbButtonAttributes[_i2].name, wptbButtonAttributes[_i2].value);
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ elButton.appendChild(el_B);
97
+ el_B.appendChild(el_BDiv);
98
+ DOMElement.appendChild(elButton);
99
+
100
+ this.kind = 'button';
101
+
102
+ this.getDOMElement = function () {
103
+ return DOMElement;
104
+ };
105
+
106
+ applyGenericItemSettings(this, kindIndexProt, copy);
107
+
108
+ return this;
109
+ };
110
+ var WPTB_Cell = function WPTB_Cell(callback, DOMElement) {
111
+
112
+ function highlightRow(td) {
113
+ var parentRow = td.parentNode,
114
+ columnCount = parseInt(document.getElementById('wptb-columns-number').value),
115
+ tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');
116
+ for (var i = 0; i < tds.length; i++) {
117
+ tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');
118
+ }
119
+ for (var i = 0; i < columnCount; i++) {
120
+
121
+ var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';
122
+ var ttd = parentRow.getElementsByTagName('td')[i];
123
+ if (ttd !== td) {
124
+ ttd.classList.add(classToAdd);
125
+ }
126
+ }
127
+ }
128
+
129
+ function highlightColumn(td) {
130
+
131
+ var index,
132
+ parentRow = td.parentNode;
133
+ columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];
134
+ for (var i = 0; i < columnCount; i++) {
135
+ if (parentRow.getElementsByTagName('td')[i] === td) {
136
+ index = i;
137
+ break;
138
+ }
139
+ }
140
+
141
+ for (var i = 0; i < rowCount; i++) {
142
+ var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';
143
+ var tr = table.getElementsByTagName('tr')[i];
144
+ if (tr.getElementsByTagName('td')[index] !== td) {
145
+ tr.getElementsByTagName('td')[index].classList.add(classToAdd);
146
+ }
147
+ }
148
+ }
149
+
150
+ if (!DOMElement) {
151
+ DOMElement = document.createElement("td");
152
+
153
+ DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';
154
+
155
+ var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();
156
+
157
+ if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {
158
+ DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();
159
+ }
160
+
161
+ DOMElement.classList.add('wptb-droppable', 'wptb-cell');
162
+ }
163
+
164
+ DOMElement.draggable = false;
165
+ if (callback) {
166
+ DOMElement.onclick = callback;
167
+ }
168
+
169
+ WPTB_innerElementSet(DOMElement);
170
+
171
+ var wptbPhElement = DOMElement.getElementsByClassName('wptb-ph-element');
172
+
173
+ if (wptbPhElement.length > 0) {
174
+ var _loop = function _loop(i) {
175
+
176
+ var wptbSpaceBetween = DOMElement.getElementsByClassName('wptb-space-between');
177
+
178
+ if (wptbSpaceBetween.length > 0) {
179
+ for (var j = 0; j < wptbSpaceBetween.length; j++) {
180
+ WPTB_Space(wptbSpaceBetween[j]);
181
+ }
182
+ }
183
+
184
+ wptbPhElement[i].getDOMElement = function () {
185
+ return wptbPhElement[i];
186
+ };
187
+
188
+ WPTB_innerElementSet(wptbPhElement[i]);
189
+
190
+ var wptbElementTypeClass = wptbPhElement[i].className.match(/wptb-element-((.+-)\d+)/i);
191
+ if (wptbElementTypeClass && Array.isArray(wptbElementTypeClass)) {
192
+ var wptbTypeElementArr = wptbElementTypeClass[1].split('-');
193
+ wptbPhElement[i].kind = wptbTypeElementArr[0];
194
+ applyGenericItemSettings(wptbPhElement[i], wptbElementTypeClass[1]);
195
+ if (wptbPhElement[i].kind == 'list') {
196
+ var wptbListItems = wptbPhElement[i].getElementsByTagName('li');
197
+ if (wptbListItems.length > 0) {
198
+ for (var _i = 0; _i < wptbListItems.length; _i++) {
199
+ WPTB_ListItem(undefined, wptbListItems[_i]);
200
+ }
201
+ }
202
+ }
203
+ }
204
+ };
205
+
206
+ for (var i = 0; i < wptbPhElement.length; i++) {
207
+ _loop(i);
208
+ }
209
+ }
210
+
211
+ this.getDOMElement = function () {
212
+ return DOMElement;
213
+ };
214
+
215
+ this.setCoords = function (y, x) {
216
+ var el = this.getDOMElement();
217
+ el.dataset.yIndex = y;
218
+ el.dataset.xIndex = x;
219
+ };
220
+
221
+ this.getCoords = function () {
222
+ var coords,
223
+ el = this.getDOMElement();
224
+ coords.x = el.dataset.xIndex;
225
+ coords.y = el.dataset.yIndex;
226
+ return coords;
227
+ };
228
+
229
+ this.appendElement = function (node) {
230
+ getDOMElement().appendChild(node);
231
+ };
232
+
233
+ return this;
234
+ };
235
+ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
236
+
237
+ function newElementProxy(el) {
238
+ if (el.includes('list')) {
239
+ return new WPTB_List();
240
+ } else if (el.includes('image')) {
241
+ return new WPTB_Image();
242
+ } else if (el.includes('text')) {
243
+ return new WPTB_Text();
244
+ } else if (el.includes('button')) {
245
+ return new WPTB_Button();
246
+ }
247
+ }
248
+
249
+ var wptbDropHandle = void 0,
250
+ wptbDropBorderMarker = void 0;
251
+ if (document.getElementsByClassName('wptb-drop-handle').length == 0) {
252
+ wptbDropHandle = document.createElement('div');
253
+ wptbDropHandle.classList.add('wptb-drop-handle');
254
+
255
+ wptbDropBorderMarker = document.createElement('div');
256
+ wptbDropBorderMarker.classList.add('wptb-drop-border-marker');
257
+
258
+ var _wptbDropBorderMarkerTop = document.createElement('div'),
259
+ _wptbDropBorderMarkerRight = document.createElement('div'),
260
+ _wptbDropBorderMarkerBottom = document.createElement('div'),
261
+ _wptbDropBorderMarkerLeft = document.createElement('div');
262
+
263
+ _wptbDropBorderMarkerTop.classList.add('wptb-drop-border-marker-top');
264
+ _wptbDropBorderMarkerRight.classList.add('wptb-drop-border-marker-right');
265
+ _wptbDropBorderMarkerBottom.classList.add('wptb-drop-border-marker-bottom');
266
+ _wptbDropBorderMarkerLeft.classList.add('wptb-drop-border-marker-left');
267
+
268
+ wptbDropBorderMarker.appendChild(_wptbDropBorderMarkerTop);
269
+ wptbDropBorderMarker.appendChild(_wptbDropBorderMarkerRight);
270
+ wptbDropBorderMarker.appendChild(_wptbDropBorderMarkerBottom);
271
+ wptbDropBorderMarker.appendChild(_wptbDropBorderMarkerLeft);
272
+
273
+ var body = document.getElementsByTagName('body');
274
+ if (body.length > 0) {
275
+ body[0].appendChild(wptbDropHandle);
276
+ body[0].appendChild(wptbDropBorderMarker);
277
+ }
278
+
279
+ wptbDropHandle.ondragenter = function () {};
280
+
281
+ wptbDropHandle.ondragover = function (e) {
282
+ e.preventDefault();
283
+ };
284
+
285
+ wptbDropHandle.ondragleave = function () {};
286
+ wptbDropHandle.ondrop = function (e) {
287
+ e.preventDefault();
288
+ var element = void 0;
289
+
290
+ if (e.dataTransfer.getData('wptbElement')) {
291
+ element = newElementProxy(e.dataTransfer.getData('wptbElement'));
292
+ element = element.getDOMElement();
293
+ } else {
294
+ element = document.getElementsByClassName(e.dataTransfer.getData('node'))[0];
295
+ element.classList.remove('wptb-moving-mode');
296
+ element.classList.remove('wptb-moving-into-same-elem');
297
+ }
298
+
299
+ var td = void 0;
300
+ if (wptbDropHandle.dataset.text == 'Drop Here') {
301
+ thisElem = wptbDropHandle.getDOMParentElement();
302
+ if (thisElem.nodeName.toLowerCase() == 'td') {
303
+ td = wptbDropHandle.getDOMParentElement();
304
+ td.appendChild(element);
305
+ }
306
+ } else {
307
+ var innerElement = wptbDropHandle.getDOMParentElement();
308
+ td = innerElement.parentNode;
309
+
310
+ if (wptbDropHandle.dataset.text == 'Abowe Element') {
311
+ td.insertBefore(element, innerElement);
312
+ } else if (wptbDropHandle.dataset.text == 'Below Element') {
313
+ var innerElementNext = innerElement.nextSibling;
314
+ td.insertBefore(element, innerElementNext);
315
+ }
316
+ }
317
+
318
+ var thisRow = td.parentNode;
319
+ if (thisRow.classList.contains('wptb-table-head')) {
320
+ var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
321
+ WPTB_Helper.dataTitleColumnSet(table);
322
+ }
323
+
324
+ wptbDropHandle.style.display = 'none';
325
+ wptbDropBorderMarker.style.display = 'none';
326
+
327
+ WPTB_innerElementSet(element);
328
+ };
329
+ var wptbContainer = document.querySelector('.wptb-container');
330
+ wptbContainer.onscroll = function () {
331
+ wptbDropHandle.style.display = 'none';
332
+ wptbDropBorderMarker.style.display = 'none';
333
+ };
334
+ } else {
335
+ wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
336
+ wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
337
+ }
338
+ if (thisElem && thisElem.nodeName.toLowerCase() == 'td' && thisElem.getElementsByClassName('wptb-ph-element').length != 0) {
339
+ return;
340
+ }
341
+
342
+ var thisRow = void 0;
343
+ if (thisElem.localName == 'td') {
344
+ thisRow = thisElem.parentNode;
345
+ } else if (thisElem.localName == 'div' && thisElem.classList.contains('wptb-ph-element')) {
346
+ thisRow = thisElem.parentNode.parentNode;
347
+ }
348
+ if (thisRow.classList.contains('wptb-table-head')) {
349
+ var indics = e.dataTransfer.types;
350
+ var notDragEnter = false;
351
+ for (var i = 0; i < indics.length; i++) {
352
+ var infArr = indics[i].match(/wptbelindic-([a-z]+)/i);
353
+ if (infArr && infArr[1] != 'text') {
354
+ notDragEnter = true;
355
+ break;
356
+ }
357
+ }
358
+ if (notDragEnter) {
359
+ return;
360
+ }
361
+ }
362
+
363
+ wptbDropHandle.style.width = thisElem.offsetWidth + 'px';
364
+ var height = thisElem.offsetHeight,
365
+ coordinatesElement = thisElem.getBoundingClientRect(),
366
+ left = Number(coordinatesElement.left),
367
+ top = void 0;
368
+ wptbDropHandle.style.left = left + 'px';
369
+
370
+ if (e.dataTransfer.types.indexOf('wptb-moving-mode') != -1) {
371
+ var elementDrag = document.getElementsByClassName('wptb-moving-mode')[0];
372
+ if (thisElem == elementDrag) {
373
+ wptbDropHandle.classList.add('wptb-moving-into-same-elem');
374
+ wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');
375
+ } else {
376
+ wptbDropHandle.classList.remove('wptb-moving-into-same-elem');
377
+ wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');
378
+ }
379
+ }
380
+
381
+ wptbDropHandle.getDOMParentElement = function () {
382
+ return thisElem;
383
+ };
384
+
385
+ wptbDropHandle.style.display = 'block';
386
+ wptbDropBorderMarker.style.display = 'block';
387
+ if (thisElem.nodeName.toLowerCase() != 'td') {
388
+ var y = e.offsetY == undefined ? e.layerY : e.offsetY;
389
+ top = Number(coordinatesElement.top) - Number(11);
390
+ wptbDropHandle.dataset.text = 'Abowe Element';
391
+ if (y > height / 2) {
392
+ top = Number(coordinatesElement.top) + height - 1;
393
+ wptbDropHandle.dataset.text = 'Below Element';
394
+ }
395
+ } else {
396
+ wptbDropHandle.dataset.text = 'Drop Here';
397
+ top = Number(coordinatesElement.top) + height / 2 - 5;
398
+ }
399
+ wptbDropHandle.style.top = top + 'px';
400
+
401
+ wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';
402
+ wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';
403
+
404
+ wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-top');
405
+ wptbDropBorderMarkerTop.style.width = Number(thisElem.offsetWidth) - Number(1) + 'px';
406
+
407
+ wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-right');
408
+ wptbDropBorderMarkerRight.style.height = Number(coordinatesElement.bottom) - Number(coordinatesElement.top) - 1 + 'px';
409
+ wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;
410
+
411
+ wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-bottom');
412
+ wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;
413
+ wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;
414
+
415
+ wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector('.wptb-drop-border-marker-left');
416
+ wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;
417
+ };
418
+ var ElementCounters = function ElementCounters() {
419
+
420
+ var priv = [];
421
+ priv['text'] = 0;
422
+ priv['image'] = 0;
423
+ priv['list'] = 0;
424
+ priv['button'] = 0;
425
+
426
+ this.increment = function (key) {
427
+ if (!(key in priv)) {
428
+ return;
429
+ }
430
+ priv[key]++;
431
+ };
432
+
433
+ this.nextIndex = function (key) {
434
+ if (!(key in priv)) {
435
+ return undefined;
436
+ }
437
+ return priv[key] + 1;
438
+ };
439
+
440
+ return this;
441
+ };
442
+ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndexProt) {
443
+
444
+ var node = element.getDOMElement(),
445
+ elemIdClass;
446
+
447
+ prop = document.querySelector(".wptb-" + element.kind + "-options-prototype").cloneNode(true);
448
+ prop.classList.remove("wptb-" + element.kind + "-options-prototype"); // remove prototype from the class
449
+ elemIdClass = 'wptb-options-' + element.kind + "-" + index;
450
+
451
+ var properties = prop.getElementsByClassName('wptb-element-property');
452
+
453
+ for (var i = 0; i < properties.length; i++) {
454
+ properties[i].dataset.element = elemIdClass;
455
+ }
456
+
457
+ prop.classList.add(elemIdClass);
458
+ document.getElementById("element-options-group").appendChild(prop);
459
+
460
+ if (kindIndexProt) {
461
+ if (element.kind == 'button') {
462
+ var _affectedEl = document.getElementsByClassName('wptb-element-' + kindIndexProt)[0],
463
+ wptbButtonWrapper = void 0,
464
+ wptbButtonA = void 0,
465
+ wptbButton = void 0,
466
+ wptbSize = void 0;
467
+
468
+ if (_affectedEl) {
469
+ wptbSize = _affectedEl.className.match(/wptb-size-([a-z]+)/i);
470
+ }
471
+
472
+ if (wptbSize && Array.isArray(wptbSize)) {
473
+ var b = prop.getElementsByClassName('wptb-btn-size-btn');
474
+
475
+ for (var i = 0; i < b.length; i++) {
476
+ b[i].classList.remove('selected');
477
+
478
+ if (b[i].innerHTML == wptbSize[1]) {
479
+ b[i].classList.add('selected');
480
+ }
481
+ }
482
+ }
483
+
484
+ if (_affectedEl) {
485
+ wptbButtonWrapper = _affectedEl.getElementsByClassName('wptb-button-wrapper');
486
+
487
+ wptbButtonA = _affectedEl.getElementsByTagName('a');
488
+
489
+ wptbButton = _affectedEl.getElementsByClassName('wptb-button');
490
+ }
491
+
492
+ if (wptbButtonWrapper) {
493
+ var buttonAlignment = wptbButtonWrapper[0].style.justifyContent,
494
+ buttonAlignmentSelect = prop.querySelector('select[data-type="button-alignment"]'),
495
+ selectOption = buttonAlignmentSelect.getElementsByTagName('option'),
496
+ selectOptionVal = void 0;
497
+
498
+ if (buttonAlignment == 'flex-start') {
499
+ selectOptionVal = 'left';
500
+ } else if (buttonAlignment == 'center' || !buttonAlignment) {
501
+ selectOptionVal = 'center';
502
+ } else if (buttonAlignment == 'flex-end') {
503
+ selectOptionVal = 'right';
504
+ }
505
+
506
+ for (var _i = 0; _i < selectOption.length; _i++) {
507
+ if (selectOption[_i].value == selectOptionVal) {
508
+ selectOption[_i].selected = true;
509
+ }
510
+ }
511
+ }
512
+
513
+ if (wptbButtonA.length > 0) {
514
+ var buttonHref = wptbButtonA[0].getAttribute('href'),
515
+ buttonLinkTarget = wptbButtonA[0].getAttribute('target'),
516
+ buttonId = wptbButtonA[0].getAttribute('id'),
517
+ buttonHrefInput = prop.querySelector('input[data-type="button-link"]'),
518
+ buttonLinkTargetInput = prop.querySelector('input[data-type="button-link-target"]'),
519
+ buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute('id'),
520
+ buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName('label')[0],
521
+ buttotIdInput = prop.querySelector('input[data-type="button-id"]');
522
+
523
+ buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split('-')[1];
524
+ buttonLinkTargetInput.setAttribute('id', buttonLinkTargetInputId);
525
+ buttonLinkTargetInputLabel.setAttribute('for', buttonLinkTargetInputId);
526
+
527
+ buttonHrefInput.value = buttonHref;
528
+
529
+ if (buttonLinkTarget && buttonLinkTarget == '_blank') {
530
+ buttonLinkTargetInput.checked = true;
531
+ }
532
+
533
+ buttotIdInput.value = buttonId;
534
+ }
535
+
536
+ if (wptbButton) {
537
+ var buttonTextColor = wptbButton[0].style.color,
538
+ buttonColor = wptbButton[0].style.backgroundColor,
539
+ buttonTextColorInput = prop.querySelector('input[data-type="button-text-color"]'),
540
+ buttonBackgroundColorInput = prop.querySelector('input[data-type="button-color"]');
541
+
542
+ buttonTextColorInput.value = WPTB_Helper.rgbToHex(buttonTextColor);
543
+
544
+ buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex(buttonColor);
545
+ }
546
+ } else if (element.kind == 'image') {
547
+ var _affectedEl2 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
548
+ if (_affectedEl2.length > 0) {
549
+ var elementsA = _affectedEl2[0].getElementsByTagName('a');
550
+ if (elementsA.length > 0) {
551
+ var a = elementsA[0];
552
+
553
+ if (a) {
554
+ a.onclick = function (e) {
555
+ e.preventDefault();
556
+ };
557
+ // set select according to the alignment of the image
558
+ var aTextAlign = a.style.textAlign,
559
+ imageAlignmentSelect = prop.querySelector('select[data-type="image-alignment"]'),
560
+ _selectOption = imageAlignmentSelect.getElementsByTagName('option');
561
+
562
+ for (var _i2 = 0; _i2 < _selectOption.length; _i2++) {
563
+ if (_selectOption[_i2].value == aTextAlign) {
564
+ _selectOption[_i2].selected = true;
565
+ }
566
+ }
567
+
568
+ // set text link for input field of setting panel
569
+ var imageLinkHref = a.getAttribute('href'),
570
+ inputImageLink = prop.querySelector('input[data-type="image-link"]');
571
+ if (imageLinkHref) {
572
+ inputImageLink.value = imageLinkHref;
573
+ }
574
+
575
+ // set checkbox for target of link
576
+ var imageLinkTarget = a.getAttribute('target'),
577
+ imageLinkTargetInput = prop.querySelector('input[data-type="image-link-target"]'),
578
+ imageLinkTargetInputId = imageLinkTargetInput.getAttribute('id'),
579
+ imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName('label')[0];
580
+
581
+ imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split('-')[1];
582
+
583
+ imageLinkTargetInput.setAttribute('id', imageLinkTargetInputId);
584
+ imageLinkTargetInputLabel.setAttribute('for', imageLinkTargetInputId);
585
+
586
+ if (imageLinkTarget && imageLinkTarget == '_blank') {
587
+ imageLinkTargetInput.checked = true;
588
+ }
589
+
590
+ var img = a.getElementsByTagName('img');
591
+ if (img.length > 0) {
592
+ // set value for input fields of image size
593
+ var imgWidth = img[0].style.width;
594
+ if (imgWidth) {
595
+ var imageWidthInputRange = prop.querySelector('input[type="range"][data-type="image-size"]'),
596
+ imageWidthInputNumber = prop.querySelector('input[type="number"][data-type="image-size"]');
597
+
598
+ imageWidthInputRange.value = parseInt(imgWidth);
599
+ imageWidthInputNumber.value = parseInt(imgWidth);
600
+ }
601
+
602
+ // set value for input field of alternative text image
603
+ var imgAlternativeText = img[0].getAttribute('alt'),
604
+ imageAlternativeTextInput = prop.querySelector('input[type="text"][data-type="alternative-text"]');
605
+
606
+ imageAlternativeTextInput.value = imgAlternativeText;
607
+ }
608
+ }
609
+ }
610
+ }
611
+ } else if (element.kind == 'text') {
612
+ var _affectedEl3 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
613
+ if (_affectedEl3.length > 0) {
614
+ var elementFontSize = _affectedEl3[0].style.fontSize,
615
+ elementTextColor = _affectedEl3[0].style.color;
616
+ var textFontSizeInputRange = prop.querySelector('input[type="range"][data-type="font-size"]'),
617
+ textFontSizeInputNumber = prop.querySelector('input[type="number"][data-type="font-size"]'),
618
+ textColorInput = prop.querySelector('input[type="text"][data-type="color"]');
619
+
620
+ textFontSizeInputRange.value = parseInt(elementFontSize);
621
+ textFontSizeInputNumber.value = parseInt(elementFontSize);
622
+ textColorInput.value = WPTB_Helper.rgbToHex(elementTextColor);
623
+ }
624
+ } else if (element.kind == 'list') {
625
+ var elementList = document.getElementsByClassName('wptb-element-' + kindIndexProt);
626
+ if (elementList.length > 0) {
627
+ var elementListColor = elementList[0].querySelector('p').style.color;
628
+ var listColorInput = prop.querySelector('input[type="text"][data-type="list-text-color"]');
629
+ listColorInput.value = WPTB_Helper.rgbToHex(elementListColor);
630
+
631
+ var elementListItem = elementList[0].querySelectorAll('li');
632
+ if (elementListItem.length > 0) {
633
+ var listItemP = elementListItem[0].querySelector('p');
634
+ var listItemPClasses = listItemP.classList;
635
+ //listItemPClasses = [...listItemPClasses];
636
+ if (listItemPClasses.length > 0) {
637
+ var elementListClassSelect = prop.querySelector('select[data-type="list-class"]');
638
+ if (elementListClassSelect) {
639
+ elementListClassSelect.value = 'unordered';
640
+
641
+ var listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;
642
+ for (var _i3 = 0; _i3 < 10; _i3++) {
643
+ if (listIconSelectLabel.nodeType == '1') {
644
+ break;
645
+ } else {
646
+ listIconSelectLabel = listIconSelectLabel.nextSibling;
647
+ }
648
+ }
649
+ if (listIconSelectLabel) {
650
+ var listIconSelectLabelId = listIconSelectLabel.getAttribute('id');
651
+ listIconSelectLabel.setAttribute('id', listIconSelectLabelId + '-' + kindIndexProt);
652
+ listIconSelectLabel.style.display = 'flex';
653
+ }
654
+
655
+ var elementListStyleTypeSelect = prop.querySelector('select[data-type="list-style-type"]');
656
+ if (elementListStyleTypeSelect) {
657
+ elementListStyleTypeSelect.parentNode.style.display = 'flex';
658
+
659
+ if (listItemPClasses.contains('wptb-list-style-type-disc')) {
660
+ elementListStyleTypeSelect.value = 'disc';
661
+ } else if (listItemPClasses.contains('wptb-list-style-type-circle')) {
662
+ elementListStyleTypeSelect.value = 'circle';
663
+ } else if (listItemPClasses.contains('wptb-list-style-type-square')) {
664
+ elementListStyleTypeSelect.value = 'square';
665
+ } else if (listItemPClasses.contains('wptb-list-style-type-none')) {
666
+ elementListStyleTypeSelect.value = 'none';
667
+ }
668
+ }
669
+ }
670
+ }
671
+ }
672
+
673
+ var elementListItemContent = elementList[0].getElementsByClassName('wptb-list-item-content');
674
+ if (elementListItemContent.length > 0) {
675
+ var listItemPTextAlignArr = [];
676
+ for (var _i4 = 0; _i4 < elementListItemContent.length; _i4++) {
677
+ var p = elementListItemContent[_i4].querySelector('p');
678
+ if (p) {
679
+ if (p.style.textAlign) {
680
+ listItemPTextAlignArr.push(p.style.textAlign);
681
+ } else {
682
+ listItemPTextAlignArr.push('left');
683
+ }
684
+ }
685
+ }
686
+
687
+ var listItemPTextAlignLeftCount = 0,
688
+ listItemPTextAlignCenterCount = 0,
689
+ listItemPTextAlignRightCount = 0;
690
+
691
+ if (listItemPTextAlignArr.length > 0) {
692
+ for (var _i5 = 0; _i5 < listItemPTextAlignArr.length; _i5++) {
693
+ if (listItemPTextAlignArr[_i5]) {
694
+ if (listItemPTextAlignArr[_i5] == 'left') {
695
+ listItemPTextAlignLeftCount++;
696
+ } else if (listItemPTextAlignArr[_i5] == 'center') {
697
+ listItemPTextAlignCenterCount++;
698
+ } else if (listItemPTextAlignArr[_i5] == 'right') {
699
+ listItemPTextAlignRightCount++;
700
+ }
701
+ }
702
+ }
703
+ }
704
+
705
+ var elementListAlignmentSelect = prop.querySelector('select[data-type="list-alignment"]'),
706
+ maxListItemTAlLeftC = Math.max(listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount);
707
+
708
+ if (listItemPTextAlignLeftCount == maxListItemTAlLeftC) {
709
+ elementListAlignmentSelect.value = 'left';
710
+ } else if (listItemPTextAlignCenterCount == maxListItemTAlLeftC) {
711
+ elementListAlignmentSelect.value = 'center';
712
+ } else if (listItemPTextAlignRightCount == maxListItemTAlLeftC) {
713
+ elementListAlignmentSelect.value = 'right';
714
+ }
715
+ }
716
+ }
717
+ }
718
+ }
719
+
720
+ node.onclick = function () {
721
+ var infArr = this.className.match(/wptb-element-((.+-)\d+)/i),
722
+ optionsClass = '.wptb-' + infArr[2] + 'options' + '.wptb-options-' + infArr[1];
723
+
724
+ document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';
725
+ document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';
726
+ document.getElementById("element-options-group").style.display = 'block';
727
+
728
+ var children = document.getElementById("element-options-group").childNodes;
729
+ for (var i = 0; i < children.length; i++) {
730
+ if (children[i].style) children[i].style.display = 'none';
731
+ }
732
+
733
+ document.querySelector(optionsClass).style.display = 'block';
734
+
735
+ //var listStyleType, textAlign;
736
+
737
+ // switch (element.kind) {
738
+
739
+ // case 'text':
740
+ // jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });
741
+ // prop.querySelector('[type=number][data-type=font-size]').value
742
+ // = prop.querySelector('[type=range][data-type=font-size]').value
743
+ // = node.style.fontSize.substring(0, node.style.fontSize.length - 2);
744
+ // break;
745
+ // case 'list':
746
+ // textAlign = node.querySelector('li p').style.textAlign;
747
+ // listStyleType = node.querySelector('li').style.listStyleType;
748
+ // if ( prop.querySelector( 'select[data-type=list-class]' ) ) {
749
+ // console.log(textAlign);
750
+ // console.log(listStyleType);
751
+ // console.log(listStyleType);
752
+ // console.log(prop);
753
+ // prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );
754
+ // }
755
+ // if ( prop.querySelector('select[data-type=list-style-type]') ) {
756
+ // prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));
757
+ // }
758
+ // if ( prop.querySelector('select[data-type=list-alignment]') ) {
759
+ // prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));
760
+ // }
761
+ // break;
762
+ // case 'image':
763
+ // break;
764
+ // case 'button':
765
+ // jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });
766
+ // break;
767
+ //
768
+ // }
769
+ };
770
+
771
+ if (element.kind == 'button') {
772
+ //We must add this special kind of property, since it is triggered with click event
773
+ var buttons = prop.getElementsByClassName('wptb-btn-size-btn');
774
+
775
+ for (var i = 0; i < buttons.length; i++) {
776
+ buttons[i].onclick = function () {
777
+ var size = this.innerHTML,
778
+ n_Class = this.dataset.element,
779
+ infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
780
+ type = infArr[1],
781
+ num = infArr[2],
782
+ affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];
783
+ affectedEl.classList.remove('wptb-size-S');
784
+ affectedEl.classList.remove('wptb-size-M');
785
+ affectedEl.classList.remove('wptb-size-L');
786
+ affectedEl.classList.remove('wptb-size-XL');
787
+ affectedEl.classList.add('wptb-size-' + size);
788
+ var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');
789
+ for (var i = 0; i < b.length; i++) {
790
+ b[i].classList.remove('selected');
791
+ }
792
+ this.classList.add('selected');
793
+ };
794
+ }
795
+ }
796
+
797
+ var optionControls = prop.getElementsByClassName('wptb-element-property');
798
+
799
+ for (var i = 0; i < optionControls.length; i++) {
800
+ if (optionControls[i].classList.contains('wptb-color-picker')) {
801
+ jQuery(optionControls[i]).wpColorPicker({
802
+ change: function change(event, ui) {
803
+ var parent = event.target,
804
+ classe,
805
+ type,
806
+ ps,
807
+ number;
808
+ classe = parent.dataset.element.match(/wptb-options-(.+)-(\d+)/i);
809
+ type = classe[1];
810
+ number = classe[2];
811
+ affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];
812
+ if (type == 'button') {
813
+ if (parent.dataset.type == 'button-text-color') {
814
+ affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();
815
+ } else {
816
+ affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();
817
+ }
818
+ } else if (type == 'list') {
819
+ var _ps = affectedEl.querySelectorAll('p');
820
+ if (_ps.length > 0) {
821
+ for (var _i6 = 0; _i6 < _ps.length; _i6++) {
822
+ _ps[_i6].style.color = ui.color.toString();
823
+ }
824
+ }
825
+ } else {
826
+ affectedEl.style.color = ui.color.toString();
827
+ }
828
+ }
829
+ });
830
+ }
831
+
832
+ if (optionControls[i].dataset.type === 'font-size') {
833
+ var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];
834
+ slider.oninput = function () {
835
+ this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;
836
+ this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange();
837
+ };
838
+ }
839
+
840
+ if (optionControls[i].dataset.type === 'image-size') {
841
+ var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];
842
+ slider.oninput = function () {
843
+ this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;
844
+ this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange();
845
+ };
846
+ }
847
+
848
+ optionControls[i].onchange = function (event) {
849
+
850
+ var n_Class = this.dataset.element,
851
+ infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
852
+ type = infArr[1],
853
+ num = infArr[2],
854
+ affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],
855
+ val = this.value;
856
+
857
+ switch (this.dataset.type) {
858
+ case 'src':
859
+ var img = affectedEl.getElementsByTagName("img")[0];
860
+ img.src = this.value;
861
+ break;
862
+ case 'alternative-text':
863
+ var img = affectedEl.getElementsByTagName('img')[0];
864
+ img.alt = this.value;
865
+ break;
866
+ case 'image-link':
867
+ affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange(this.value);
868
+ break;
869
+ case 'image-link-target':
870
+ if (this.checked == true) {
871
+ affectedEl.getElementsByTagName('a')[0].target = '_blank';
872
+ } else {
873
+ affectedEl.getElementsByTagName('a')[0].target = '_self';
874
+ }
875
+ break;
876
+ case 'image-link-nofollow':
877
+ if (this.checked == true) {
878
+ affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';
879
+ } else {
880
+ affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');
881
+ }
882
+ break;
883
+ case 'image-size':
884
+ affectedEl.getElementsByTagName('img')[0].style.width = this.value + '%';
885
+ affectedEl.getElementsByTagName('img')[0].style.height = 'auto';
886
+ this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;
887
+ break;
888
+ case 'image-alignment':
889
+ affectedEl.getElementsByTagName('img')[0].parentNode.style.textAlign = this.value;
890
+ break;
891
+ case 'font-size':
892
+ affectedEl.style.fontSize = val + 'px';
893
+ break;
894
+ case 'button-alignment':
895
+ var jc = '';
896
+ if (this.value == 'left') {
897
+ jc = 'start';
898
+ } else if (this.value == 'right') {
899
+ jc = 'flex-end';
900
+ } else {
901
+ jc = 'center';
902
+ }
903
+ affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;
904
+ break;
905
+ case 'button-link':
906
+ if (this.value) {
907
+ affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange(this.value);
908
+ } else {
909
+ affectedEl.getElementsByTagName('a')[0].removeAttribute('href');
910
+ }
911
+ break;
912
+ case 'button-link-target':
913
+ if (this.checked == true) {
914
+ affectedEl.getElementsByTagName('a')[0].target = '_blank';
915
+ } else {
916
+ affectedEl.getElementsByTagName('a')[0].target = '_self';
917
+ }
918
+ break;
919
+ case 'button-link-nofollow':
920
+ if (this.checked == true) {
921
+ affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';
922
+ } else {
923
+ affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');
924
+ }
925
+ break;
926
+ case 'button-id':
927
+ if (this.value) {
928
+ affectedEl.getElementsByTagName('a')[0].id = this.value;
929
+ } else {
930
+ affectedEl.getElementsByTagName('a')[0].removeAttribute('id');
931
+ }
932
+ case 'button-color':
933
+ break;
934
+ case 'list-alignment':
935
+ var listItems = affectedEl.querySelectorAll('li');
936
+ for (var i = 0; i < listItems.length; i++) {
937
+ var _p = listItems[i].querySelector('p');
938
+ if (_p) {
939
+ _p.style.textAlign = this.value;
940
+ }
941
+ }
942
+ break;
943
+ case 'list-class':
944
+ var parentNode = event.target.parentNode.parentNode.querySelector('[data-type=list-style-type]').parentNode,
945
+ parentNodeSettingItem = parentNode.parentNode;
946
+ if (val == 'unordered') {
947
+ parentNode.style.display = 'flex';
948
+
949
+ parentNodeSettingItem.querySelector('.wptb-list-icon-select-label').style.display = 'flex';
950
+ var _listItem = affectedEl.querySelectorAll('li');
951
+ for (var i = 0; i < _listItem.length; i++) {
952
+ var _p2 = _listItem[i].querySelector('p');
953
+ _p2.removeAttribute('class');
954
+ _p2.classList.add('wptb-list-style-type-disc');
955
+ }
956
+ parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';
957
+ } else {
958
+ parentNode.style.display = 'none';
959
+ parentNodeSettingItem.querySelector('.wptb-list-icon-select-label').style.display = 'none';
960
+ var listItem = affectedEl.querySelectorAll('li');
961
+ for (var i = 0; i < listItem.length; i++) {
962
+ var _p3 = listItem[i].querySelector('p');
963
+ _p3.removeAttribute('class');
964
+ }
965
+ }
966
+ break;
967
+ case 'list-style-type':
968
+ var listItem = affectedEl.querySelectorAll('li');
969
+ for (var i = 0; i < listItem.length; i++) {
970
+ var _p4 = listItem[i].querySelector('p');
971
+ _p4.removeAttribute('class');
972
+ _p4.classList.add('wptb-list-style-type-' + val.toLowerCase());
973
+ }
974
+ break;
975
+ }
976
+ };
977
+ }
978
+ };
979
+ var WPTB_Helper = {
980
+ hexToRgb: function hexToRgb(hex) {
981
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
982
+ return result ? 'rgb(' + parseInt(result[1], 16) + ',' + parseInt(result[2], 16) + ',' + parseInt(result[3], 16) + ')' : null;
983
+ },
984
+ rgbToHex: function rgbToHex(rgb) {
985
+ var rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
986
+
987
+ return rgb && rgb.length === 4 ? "#" + ("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) + ("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) + ("0" + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
988
+ },
989
+ getDragImageCustom: function getDragImageCustom(type) {
990
+ var hostName = location.protocol + '//' + location.hostname;
991
+ var img = document.createElement('img');
992
+ img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';
993
+ return img;
994
+ },
995
+ dragImagesArr: function dragImagesArr() {
996
+ return {
997
+ text: WPTB_Helper.getDragImageCustom('text'),
998
+ image: WPTB_Helper.getDragImageCustom('image'),
999
+ button: WPTB_Helper.getDragImageCustom('button'),
1000
+ list: WPTB_Helper.getDragImageCustom('list')
1001
+ };
1002
+ },
1003
+ listItemsRecalculateIndex: function listItemsRecalculateIndex(ulElem) {
1004
+ var par = ulElem.querySelectorAll('p');
1005
+ if (par.length > 0) {
1006
+ for (var i = 0; i < par.length; i++) {
1007
+ par[i].dataset.listStyleTypeIndex = Number(i) + 1 + '.';
1008
+ }
1009
+ }
1010
+ },
1011
+ listItemsTinyMceInit: function listItemsTinyMceInit(listItem) {
1012
+ tinyMCE.init({
1013
+ target: listItem,
1014
+ inline: true,
1015
+ plugins: "link, paste",
1016
+ dialog_type: "modal",
1017
+ theme: 'modern',
1018
+ menubar: false,
1019
+ fixed_toolbar_container: '#wpcd_fixed_toolbar',
1020
+ paste_as_text: true,
1021
+ toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
1022
+ setup: function setup(ed) {
1023
+ ed.on('keydown', function (e) {
1024
+ var article = e.target.parentNode;
1025
+ if (e.keyCode == 13) {
1026
+ e.preventDefault();
1027
+ var text = e.target.innerHTML;
1028
+ var duplicate = new WPTB_ListItem(text, article, true);
1029
+
1030
+ article.parentNode.insertBefore(duplicate.getDOMElement(), article);
1031
+ WPTB_Helper.listItemsTinyMceInit(duplicate.getDOMElement().firstChild);
1032
+ e.target.querySelector('p').innerText = 'New List Item';
1033
+ //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');
1034
+ WPTB_Helper.listItemsRecalculateIndex(article.parentNode);
1035
+ } else if (e.keyCode == '8' || e.keyCode == '46') {
1036
+ var p = e.target.querySelector('p');
1037
+ var pText = p.innerHTML.replace(/<[^>]+>/g, '');
1038
+ pText = pText.replace(/\s+/g, ' ').trim();
1039
+ pText = pText.replace(/&nbsp;/g, '').trim();
1040
+
1041
+ if (pText == '') {
1042
+ e.preventDefault();
1043
+ e.target.querySelector('p').innerText = '\n';
1044
+ } else {
1045
+ var selectedText = WPTB_Helper.getSelectionText();
1046
+ selectedText = selectedText.replace(/\s+/g, ' ').trim();
1047
+ selectedText = selectedText.replace(/&nbsp;/g, '').trim();
1048
+ if (selectedText == pText) {
1049
+ e.preventDefault();
1050
+ e.target.querySelector('p').innerText = '\n';
1051
+ }
1052
+ }
1053
+ }
1054
+ });
1055
+
1056
+ ed.on('keyup', function (e) {});
1057
+ },
1058
+ init_instance_callback: function init_instance_callback(editor) {
1059
+ window.currentEditor = editor;
1060
+ editor.on('focus', function (e) {
1061
+ var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
1062
+ if (window.currentEditor && document.getElementById('wptb_builder').scrollTop >= 55 && window.currentEditor.bodyElement.style.display != 'none') {
1063
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
1064
+ document.getElementById('wpcd_fixed_toolbar').style.right = totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2 + 'px';
1065
+ document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
1066
+ } else {
1067
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
1068
+ delete document.getElementById('wpcd_fixed_toolbar').style.right;
1069
+ delete document.getElementById('wpcd_fixed_toolbar').style.top;
1070
+ }
1071
+ });
1072
+ }
1073
+ });
1074
+ },
1075
+ buttonsTinyMceInit: function buttonsTinyMceInit(target) {
1076
+ tinyMCE.init({
1077
+ target: target,
1078
+ inline: true,
1079
+ plugins: "link",
1080
+ dialog_type: "modal",
1081
+ theme: 'modern',
1082
+ menubar: false,
1083
+ fixed_toolbar_container: '#wpcd_fixed_toolbar',
1084
+ toolbar: 'bold italic strikethrough',
1085
+ setup: function setup(ed) {
1086
+ ed.on('keydown', function (e) {
1087
+ if (e.keyCode == 13) {
1088
+ e.preventDefault();
1089
+ }
1090
+ });
1091
+ },
1092
+ init_instance_callback: function init_instance_callback(editor) {
1093
+ window.currentEditor = editor;
1094
+ editor.on('focus', function (e) {
1095
+ var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
1096
+ if (window.currentEditor && document.getElementById('wptb_builder').scrollTop >= 55 && window.currentEditor.bodyElement.style.display != 'none') {
1097
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
1098
+ document.getElementById('wpcd_fixed_toolbar').style.right = totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2 + 'px';
1099
+ document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
1100
+ } else {
1101
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
1102
+ delete document.getElementById('wpcd_fixed_toolbar').style.right;
1103
+ delete document.getElementById('wpcd_fixed_toolbar').style.top;
1104
+ }
1105
+ });
1106
+ }
1107
+ });
1108
+ },
1109
+ linkHttpCheckChange: function linkHttpCheckChange(link) {
1110
+ if (link) {
1111
+ if (link.indexOf('http://') == -1 && link.indexOf('https://') == -1) {
1112
+ var linkArr = link.split('/'),
1113
+ linkClean = void 0;
1114
+ if (Array.isArray(linkArr) && linkArr.length > 0) {
1115
+ linkClean = linkArr[linkArr.length - 1];
1116
+ }
1117
+ return document.location.protocol + '//' + linkClean;
1118
+ } else {
1119
+ return link;
1120
+ }
1121
+ } else {
1122
+ return '';
1123
+ }
1124
+ },
1125
+ dataTitleColumnSet: function dataTitleColumnSet(table) {
1126
+ var rows = table.rows,
1127
+ rowHead = rows[0];
1128
+ var computedStyleRowHead = getComputedStyle(rowHead);
1129
+
1130
+ var rowHeadChildren = rowHead.children;
1131
+ var contentsForHeader = {};
1132
+ for (var i = 0; i < rowHeadChildren.length; i++) {
1133
+ var tdElements = rowHeadChildren[i].children;
1134
+ for (var j = 0; j < tdElements.length; j++) {
1135
+ var element = tdElements[j];
1136
+ if (element.classList.contains('wptb-ph-element')) {
1137
+ var textContentStyle = element.getAttribute('style');
1138
+ var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i);
1139
+ if (infArr[1] == 'text') {
1140
+ var p = element.querySelector('p'),
1141
+ textContent = p.textContent,
1142
+ textAlign = p.style.textAlign;
1143
+ contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, element.style.color, computedStyleRowHead.backgroundColor, textAlign];
1144
+ break;
1145
+ }
1146
+ }
1147
+ }
1148
+ if (!contentsForHeader[rowHeadChildren[i].dataset.xIndex]) {
1149
+ contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', '', computedStyleRowHead.backgroundColor, ''];
1150
+ }
1151
+ }
1152
+ for (var _i = 1; _i < rows.length; _i++) {
1153
+ var thisRow = rows[_i],
1154
+ thisRowChildren = thisRow.children;
1155
+ for (var _j = 0; _j < thisRowChildren.length; _j++) {
1156
+ if (contentsForHeader[thisRowChildren[_j].dataset.xIndex]) {
1157
+ thisRowChildren[_j].dataset.titleColumn = contentsForHeader[thisRowChildren[_j].dataset.xIndex][0];
1158
+ thisRowChildren[_j].dataset.titleColumnFontSize = contentsForHeader[thisRowChildren[_j].dataset.xIndex][1];
1159
+ thisRowChildren[_j].dataset.titleColumnColor = contentsForHeader[thisRowChildren[_j].dataset.xIndex][2];
1160
+ thisRowChildren[_j].dataset.titleBackgroundColor = contentsForHeader[thisRowChildren[_j].dataset.xIndex][3];
1161
+ thisRowChildren[_j].dataset.titleAlign = contentsForHeader[thisRowChildren[_j].dataset.xIndex][4];
1162
+ } else {
1163
+ thisRowChildren[_j].dataset.titleColumn = '';
1164
+ thisRowChildren[_j].dataset.titleColumnFontSize = '';
1165
+ thisRowChildren[_j].dataset.titleColumnColor = '';
1166
+ thisRowChildren[_j].dataset.titleBackgroundColor = '';
1167
+ thisRowChildren[_j].dataset.titleAlign = '';
1168
+ }
1169
+ }
1170
+ }
1171
+ },
1172
+ findAncestor: function findAncestor(el, cls) {
1173
+ while ((el = el.parentElement) && !el.classList.contains(cls)) {}
1174
+ return el;
1175
+ },
1176
+ getSelectionText: function getSelectionText() {
1177
+ var txt = '';
1178
+ if (txt = window.getSelection) {
1179
+ txt = window.getSelection().toString();
1180
+ } else {
1181
+ txt = document.selection.createRange().text;
1182
+ }
1183
+ return txt;
1184
+ },
1185
+ settingsPanelClear: function settingsPanelClear() {
1186
+ document.getElementById('wptb-top-row-as-header').checked = false;
1187
+ document.getElementById('wptb-table-border-slider').value = 0;
1188
+ document.getElementById('wptb-table-border-number').value = 0;
1189
+ document.getElementById('wptb-inner-border-check').checked = false;
1190
+ document.getElementById('wptb-apply-inner-border').classList.remove('visible');
1191
+ document.getElementById('wptb-table-inner-border-slider').value = 1;
1192
+ document.getElementById('wptb-table-inner-border-number').value = 1;
1193
+
1194
+ WPTB_Helper.wpColorPickerClear('wptb-table-border-color');
1195
+
1196
+ WPTB_Helper.wpColorPickerClear('wptb-table-header-bg');
1197
+
1198
+ WPTB_Helper.wpColorPickerClear('wptb-even-row-bg');
1199
+
1200
+ WPTB_Helper.wpColorPickerClear('wptb-odd-row-bg');
1201
+
1202
+ document.getElementById('wptb-table-cell-slider').value = 15;
1203
+ document.getElementById('wptb-table-cell-number').value = 15;
1204
+ },
1205
+ wpColorPickerClear: function wpColorPickerClear(inputId) {
1206
+ var input = document.getElementById(inputId);
1207
+ var wpPickerContainer = WPTB_Helper.findAncestor(input, 'wp-picker-container');
1208
+ var parent = wpPickerContainer.parentNode;
1209
+ parent.removeChild(wpPickerContainer);
1210
+ var newInput = document.createElement('input');
1211
+ newInput.setAttribute('id', inputId);
1212
+ newInput.value = "";
1213
+ parent.appendChild(newInput);
1214
+ },
1215
+ detectMode: function detectMode() {
1216
+ var url = window.location.href,
1217
+ regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),
1218
+ results = regex.exec(url);
1219
+ if (!results) return false;
1220
+ if (!results[2]) return '';
1221
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
1222
+ }
1223
+ };
1224
+ var WPTB_Image = function WPTB_Image(src, DOMElementProt) {
1225
+ var DOMElement = void 0,
1226
+ kindIndexProt = undefined,
1227
+ copy = false;
1228
+ if (DOMElementProt == undefined) {
1229
+ DOMElement = document.createElement('div');
1230
+ var anchor = document.createElement('a'),
1231
+ img = document.createElement('img');
1232
+ anchor.style.display = 'inline-block';
1233
+ anchor.appendChild(img);
1234
+ DOMElement.appendChild(anchor);
1235
+
1236
+ anchor.onclick = function (e) {
1237
+ e.preventDefault();
1238
+ };
1239
+
1240
+ file_frame = wp.media.frames.file_frame = wp.media({
1241
+ title: 'Select a image to upload',
1242
+ button: {
1243
+ text: 'Use this image'
1244
+ },
1245
+ multiple: false
1246
+ });
1247
+ // When an image is selected, run a callback.
1248
+ file_frame.on('select', function () {
1249
+ attachment = file_frame.state().get('selection').first().toJSON();
1250
+ img.src = attachment.url;
1251
+ });
1252
+ // Finally, open the modal
1253
+ if (src == undefined) {
1254
+ file_frame.open();
1255
+ } else {
1256
+ img.src = src;
1257
+ }
1258
+ } else {
1259
+ DOMElement = DOMElementProt.cloneNode(true);
1260
+
1261
+ DOMElement.getElementsByTagName('a')[0].onclick = function (e) {
1262
+ e.preventDefault();
1263
+ };
1264
+
1265
+ var wptbElementMutch = DOMElementProt.className.match(/wptb-element-((.+-)\d+)/i);
1266
+ if (wptbElementMutch && Array.isArray(wptbElementMutch)) {
1267
+ kindIndexProt = wptbElementMutch[1];
1268
+ copy = true;
1269
+ };
1270
+ }
1271
+
1272
+ this.kind = 'image';
1273
+ this.getDOMElement = function () {
1274
+ return DOMElement;
1275
+ };
1276
+ applyGenericItemSettings(this, kindIndexProt, copy);
1277
+
1278
+ return this;
1279
+ };
1280
+ var WPTB_Initializer = function WPTB_Initializer() {
1281
+
1282
+ var MIN_COLUMNS = 1,
1283
+ MIN_ROWS = 1,
1284
+ MAX_COLUMNS = 10,
1285
+ MAX_ROWS = 10;
1286
+
1287
+ var tableGenerator = document.body;
1288
+ columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0], columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0], rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1], rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1], columnsInput = document.getElementById('wptb-columns-number'), rowsInput = document.getElementById('wptb-rows-number');
1289
+
1290
+ columnsDecrementButton.onclick = function () {
1291
+ if (columnsInput.value > MIN_COLUMNS) {
1292
+ columnsInput.value--;
1293
+ }
1294
+ };
1295
+
1296
+ columnsIncrementButton.onclick = function () {
1297
+ if (columnsInput.value < MAX_COLUMNS) {
1298
+ columnsInput.value++;
1299
+ }
1300
+ };
1301
+
1302
+ rowsDecrementButton.onclick = function () {
1303
+ if (rowsInput.value > MIN_ROWS) {
1304
+ rowsInput.value--;
1305
+ }
1306
+ };
1307
+
1308
+ rowsIncrementButton.onclick = function () {
1309
+ if (rowsInput.value < MAX_ROWS) {
1310
+ rowsInput.value++;
1311
+ }
1312
+ };
1313
+
1314
+ document.getElementById('wptb-generate-table').onclick = function () {
1315
+ var columns = document.getElementById('wptb-columns-number').value,
1316
+ rows = document.getElementById('wptb-rows-number').value;
1317
+
1318
+ WPTB_Table(columns, rows);
1319
+ };
1320
+
1321
+ // if( document.getElementsByClassName( 'wptb-preview-table' ).length == 0 ) {
1322
+ // WPTB_LeftPanel();
1323
+ // }
1324
+ };
1325
+ var WPTB_LeftPanel = function WPTB_LeftPanel() {
1326
+
1327
+ var table = document.getElementsByClassName('wptb-preview-table')[0],
1328
+ wptbElementButtons = document.getElementsByClassName('wptb-element');
1329
+
1330
+ function wptbTdBgColorSavedSet(inputId, trNumber) {
1331
+ if (trNumber > 3) return;
1332
+ if (table) {
1333
+ var tableRows = table.getElementsByTagName('tr');
1334
+ if (tableRows.length > trNumber) {
1335
+ var trBackgroundColor = tableRows[trNumber].style.backgroundColor;
1336
+ var wptbEvenRowBg = document.getElementById(inputId);
1337
+ if (wptbEvenRowBg && trBackgroundColor) {
1338
+ wptbEvenRowBg.value = WPTB_Helper.rgbToHex(trBackgroundColor);
1339
+ }
1340
+ }
1341
+ }
1342
+ }
1343
+
1344
+ wptbTdBgColorSavedSet('wptb-even-row-bg', 1);
1345
+ jQuery('#wptb-even-row-bg').wpColorPicker({
1346
+ change: function change(event, ui) {
1347
+ var tableRows = table.getElementsByTagName('tr');
1348
+ for (var _i = 1; _i < tableRows.length; _i += 2) {
1349
+ tableRows[_i].style.backgroundColor = ui.color.toString();
1350
+ }
1351
+ },
1352
+ clear: function clear() {
1353
+ var tableRows = table.getElementsByTagName('tr');
1354
+ for (var _i2 = 1; _i2 < tableRows.length; _i2 += 2) {
1355
+ tableRows[_i2].style.backgroundColor = '';
1356
+ var tds = tableRows[_i2].getElementsByTagName('td');
1357
+ for (var j = 0; j < tds.length; j++) {
1358
+ tds[j].style.backgroundColor = '';
1359
+ }
1360
+ }
1361
+ }
1362
+
1363
+ });
1364
+
1365
+ wptbTdBgColorSavedSet('wptb-odd-row-bg', 2);
1366
+ jQuery('#wptb-odd-row-bg').wpColorPicker({
1367
+ change: function change(event, ui) {
1368
+ var tableRows = table.getElementsByTagName('tr');
1369
+ for (var _i3 = 2; _i3 < tableRows.length; _i3 += 2) {
1370
+ tableRows[_i3].style.backgroundColor = ui.color.toString();
1371
+ }
1372
+ },
1373
+ clear: function clear() {
1374
+ var tableRows = table.getElementsByTagName('tr');
1375
+ for (var _i4 = 2; _i4 < tableRows.length; _i4 += 2) {
1376
+ tableRows[_i4].style.backgroundColor = '';
1377
+ var tds = tableRows[_i4].getElementsByTagName('td');
1378
+ for (var j = 0; j < tds.length; j++) {
1379
+ tds[j].style.backgroundColor = '';
1380
+ }
1381
+ }
1382
+ }
1383
+ });
1384
+
1385
+ wptbTdBgColorSavedSet('wptb-table-header-bg', 0);
1386
+ jQuery('#wptb-table-header-bg').wpColorPicker({
1387
+ change: function change(event, ui) {
1388
+ var tableHeader = table.getElementsByTagName('tr')[0];
1389
+ tableHeader.style.backgroundColor = ui.color.toString();
1390
+ },
1391
+ clear: function clear() {
1392
+ var tableHeader = table.getElementsByTagName('tr')[0];
1393
+ tableHeader.style.backgroundColor = '';
1394
+ var tds = tableHeader.getElementsByTagName('td');
1395
+ for (var j = 0; j < tds.length; j++) {
1396
+ tds[j].style.backgroundColor = '';
1397
+ }
1398
+ }
1399
+ });
1400
+
1401
+ function tableTopRowAsHeadSavedSet(table) {
1402
+ var wptbTopRowAsHeader = document.getElementById('wptb-top-row-as-header');
1403
+
1404
+ if (table && table.classList.contains('wptb-table-preview-head')) {
1405
+ wptbTopRowAsHeader.checked = true;
1406
+ } else {
1407
+ wptbTopRowAsHeader.checked = false;
1408
+ }
1409
+ }
1410
+ tableTopRowAsHeadSavedSet(table);
1411
+
1412
+ function tableBorderColorWidthSavedSet() {
1413
+ var table = document.getElementsByClassName('wptb-preview-table');
1414
+ if (table.length > 0) {
1415
+ var tableBorderColor = table[0].style.borderColor;
1416
+ if (tableBorderColor) {
1417
+ var tableBorderColorInput = document.getElementById('wptb-table-border-color');
1418
+ if (tableBorderColorInput) {
1419
+ tableBorderColorInput.value = WPTB_Helper.rgbToHex(tableBorderColor);
1420
+ }
1421
+ }
1422
+
1423
+ var tableBorderWidth = table[0].style.borderWidth;
1424
+ if (tableBorderWidth) {
1425
+ var wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),
1426
+ wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');
1427
+
1428
+ if (wptbTableBorderWidthSlider) {
1429
+ wptbTableBorderWidthSlider.value = parseInt(tableBorderWidth);
1430
+ }
1431
+ if (wptbTableBorderWidthNumber) {
1432
+ wptbTableBorderWidthNumber.value = parseInt(tableBorderWidth);
1433
+ }
1434
+ }
1435
+
1436
+ var tableTd = table[0].querySelector('td');
1437
+ var applyInnerBorder = tableTd.style.borderWidth;
1438
+ if (applyInnerBorder) {
1439
+ var innerBorderCheckInput = document.getElementById('wptb-inner-border-check');
1440
+ var wptbApplyInnerBorder = document.getElementById('wptb-apply-inner-border');
1441
+ if (applyInnerBorder && parseInt(applyInnerBorder) > 0) {
1442
+ if (innerBorderCheckInput) {
1443
+ innerBorderCheckInput.checked = true;
1444
+
1445
+ if (wptbApplyInnerBorder) {
1446
+ wptbApplyInnerBorder.classList.add('visible');
1447
+ var wptbTableInnerBorderSlider = document.getElementById('wptb-table-inner-border-slider');
1448
+ var _wptbTableInnerBorderNumber = document.getElementById('wptb-table-inner-border-number');
1449
+ wptbTableInnerBorderSlider.value = parseInt(applyInnerBorder);
1450
+ _wptbTableInnerBorderNumber.value = parseInt(applyInnerBorder);
1451
+ }
1452
+ }
1453
+ } else {
1454
+ innerBorderCheckInput.checked = false;
1455
+ }
1456
+ }
1457
+
1458
+ if (tableBorderWidth && parseInt(tableBorderWidth) > 0 || applyInnerBorder && parseInt(applyInnerBorder) > 0) {
1459
+ document.getElementById('wptb-table-border-color-set-area').style.display = '';
1460
+ }
1461
+ }
1462
+ }
1463
+
1464
+ tableBorderColorWidthSavedSet();
1465
+
1466
+ jQuery('#wptb-table-border-color').wpColorPicker({
1467
+ change: function change(event, ui) {
1468
+ var tableCells = table.getElementsByTagName('td');
1469
+ table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();
1470
+
1471
+ for (var i = 0; i < tableCells.length; i++) {
1472
+ var tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;
1473
+ if (document.getElementById('wptb-inner-border-check').checked) {
1474
+ tableCells[i].style.border = (tableInnerborderNumber != 0 ? tableInnerborderNumber : 1) + 'px solid ' + ui.color.toString();
1475
+ }
1476
+ }
1477
+ },
1478
+ clear: function clear() {
1479
+ var tableCells = table.getElementsByTagName('td');
1480
+ table.style.borderColor = '';
1481
+
1482
+ for (var i = 0; i < tableCells.length; i++) {
1483
+ tableCells[i].style.borderColor = '';
1484
+ }
1485
+ }
1486
+ });
1487
+
1488
+ function addInnerBorderSize(value) {
1489
+ var tableCells = table.getElementsByTagName('td');
1490
+ for (var i = 0; i < tableCells.length; i++) {
1491
+ tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';
1492
+ tableCells[i].style.borderStyle = 'solid';
1493
+ }
1494
+ }
1495
+
1496
+ function addCellPadding(value) {
1497
+ var tableCells = table.getElementsByTagName('td');
1498
+ for (var i = 0; i < tableCells.length; i++) {
1499
+ tableCells[i].style.padding = value + 'px';
1500
+ }
1501
+ }
1502
+
1503
+ function addInnerBorder(checked) {
1504
+ var styles,
1505
+ color = document.querySelector('#wptb-table-border-color').value != undefined ? document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';
1506
+ if (document.querySelector('#wptb-table-inner-border-slider').value == 0 || document.querySelector('#wptb-table-inner-border-number').value == 0) {
1507
+ document.querySelector('#wptb-table-inner-border-slider').value = 1;
1508
+ document.querySelector('#wptb-table-inner-border-number').value = 1;
1509
+ }
1510
+ var width = document.querySelector('#wptb-table-inner-border-slider').value + 'px';
1511
+ var wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');
1512
+ if (wptbPreviewTable.length > 0) {
1513
+ if (checked == 'checked') {
1514
+ document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';
1515
+ var tableCells = wptbPreviewTable[0].getElementsByTagName('td');
1516
+ for (var i = 0; i < tableCells.length; i++) {
1517
+ tableCells[i].style.border = width + ' solid ' + color;
1518
+ }
1519
+ document.getElementById('wptb-apply-inner-border').classList.add('visible');
1520
+ } else {
1521
+ document.getElementById('wptb-apply-inner-border').classList.remove('visible');
1522
+ var tableCells = wptbPreviewTable[0].getElementsByTagName('td');
1523
+ for (var i = 0; i < tableCells.length; i++) {
1524
+ tableCells[i].style.border = '0px solid ' + color;
1525
+ }
1526
+ }
1527
+ }
1528
+ }
1529
+
1530
+ function addBorderSize(value) {
1531
+ table.style.borderWidth = value + 'px';
1532
+ table.style.borderStyle = 'solid';
1533
+ }
1534
+
1535
+ function cellPaddingSavedSet() {
1536
+ var table = document.getElementsByClassName('wptb-preview-table');
1537
+
1538
+ if (table.length > 0) {
1539
+ var td = table[0].querySelector('td');
1540
+
1541
+ if (td) {
1542
+ var padding = td.style.padding;
1543
+
1544
+ if (padding) {
1545
+ var wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),
1546
+ _wptbTableCellNumber = document.getElementById('wptb-table-cell-number');
1547
+
1548
+ if (wptbTableCellSlider) {
1549
+ wptbTableCellSlider.value = parseInt(padding);
1550
+ }
1551
+ if (_wptbTableCellNumber) {
1552
+ _wptbTableCellNumber.value = parseInt(padding);
1553
+ }
1554
+ }
1555
+ }
1556
+ }
1557
+ }
1558
+
1559
+ cellPaddingSavedSet();
1560
+
1561
+ function numberImputSize(wptbNumberInputs, maxCount, maxValue) {
1562
+ wptbNumberInputs.onkeydown = function () {
1563
+ var thisValue = this.value;
1564
+ thisValue = String(thisValue);
1565
+ if (thisValue[0] == 0) {
1566
+ this.value = "";
1567
+ } else {
1568
+ thisValue = thisValue.substring(0, maxCount);
1569
+ this.value = thisValue;
1570
+ }
1571
+ };
1572
+ wptbNumberInputs.onkeyup = function () {
1573
+ var thisValue = this.value;
1574
+ thisValue = String(thisValue);
1575
+ if (thisValue > maxValue) {
1576
+ this.value = maxValue;
1577
+ }
1578
+ };
1579
+ }
1580
+
1581
+ var wptbTableBorderNumber = document.getElementById('wptb-table-border-number');
1582
+ numberImputSize(wptbTableBorderNumber, 1, 50);
1583
+
1584
+ var wptbTableInnerBorderNumber = document.getElementById('wptb-table-inner-border-number');
1585
+ numberImputSize(wptbTableInnerBorderNumber, 1, 50);
1586
+
1587
+ var wptbTableCellNumber = document.getElementById('wptb-table-cell-number');
1588
+ numberImputSize(wptbTableCellNumber, 1, 50);
1589
+
1590
+ var wptbTextfontSizeNumber = document.getElementById('wptb-text-font-size-number');
1591
+ numberImputSize(wptbTextfontSizeNumber, 1, 50);
1592
+
1593
+ var wptbImageWidthNumber = document.getElementById('wptb-image-width-number');
1594
+ numberImputSize(wptbImageWidthNumber, 2, 100);
1595
+
1596
+ document.getElementById('wptb-table-cell-slider').oninput = function () {
1597
+ document.getElementById('wptb-table-cell-number').value = this.value;
1598
+ addCellPadding(this.value);
1599
+ };
1600
+
1601
+ document.getElementById('wptb-table-cell-number').onchange = function () {
1602
+ document.getElementById('wptb-table-cell-slider').value = this.value;
1603
+ addCellPadding(this.value);
1604
+ };
1605
+
1606
+ document.getElementById('wptb-table-border-slider').oninput = function () {
1607
+ document.getElementById('wptb-table-border-number').value = this.value;
1608
+ addBorderSize(this.value);
1609
+
1610
+ var wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,
1611
+ tableBorderColorSetArea = document.getElementById('wptb-table-border-color-set-area');
1612
+ if (this.value == 0 && wptbInnerBorderCheck == false) {
1613
+ tableBorderColorSetArea.style.display = 'none';
1614
+ } else {
1615
+ tableBorderColorSetArea.style.display = '';
1616
+ }
1617
+ };
1618
+
1619
+ document.getElementById('wptb-table-border-number').onchange = function () {
1620
+ document.getElementById('wptb-table-border-slider').value = this.value;
1621
+ addBorderSize(this.value);
1622
+ };
1623
+
1624
+ document.getElementById('wptb-table-inner-border-slider').oninput = function () {
1625
+ document.getElementById('wptb-table-inner-border-number').value = this.value;
1626
+ addInnerBorderSize(this.value);
1627
+ };
1628
+
1629
+ document.getElementById('wptb-table-inner-border-number').onchange = function () {
1630
+ document.getElementById('wptb-table-inner-border-slider').value = this.value;
1631
+ addInnerBorderSize(this.value);
1632
+ };
1633
+
1634
+ document.getElementById('wptb-inner-border-check').onchange = function () {
1635
+ if (table) {
1636
+ var val = this.checked ? 'checked' : 'unchecked';
1637
+ addInnerBorder(val);
1638
+ var borderWidth = document.getElementById('wptb-table-border-slider').value,
1639
+ tableBorderColorSetArea = document.getElementById('wptb-table-border-color-set-area');
1640
+ if (val == 'unchecked' && borderWidth == 0) {
1641
+ tableBorderColorSetArea.style.display = 'none';
1642
+ } else {
1643
+ tableBorderColorSetArea.style.display = '';
1644
+ }
1645
+ }
1646
+ };
1647
+
1648
+ function createMobileHeadForTable(table, thisEvent) {
1649
+
1650
+ if (thisEvent.checked) {
1651
+ WPTB_Helper.dataTitleColumnSet(table);
1652
+
1653
+ table.classList.add('wptb-table-preview-head');
1654
+ table.rows[0].classList.add('wptb-table-head');
1655
+ } else {
1656
+ var rows = table.rows;
1657
+ table.classList.remove('wptb-table-preview-head');
1658
+ rows[0].classList.remove('wptb-table-head');
1659
+
1660
+ for (var _i5 = 1; _i5 < rows.length; _i5++) {
1661
+ var thisRow = rows[_i5],
1662
+ thisRowChildren = thisRow.children;
1663
+ for (var j = 0; j < thisRowChildren.length; j++) {
1664
+ thisRowChildren[j].removeAttribute('data-title-column');
1665
+ }
1666
+ }
1667
+ }
1668
+ }
1669
+
1670
+ document.getElementById('wptb-top-row-as-header').onchange = function () {
1671
+ createMobileHeadForTable(table, this);
1672
+ };
1673
+
1674
+ for (var i = 0; i < wptbElementButtons.length; i++) {
1675
+ wptbElementButtons[i].ondragstart = function (e) {
1676
+ e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);
1677
+ e.dataTransfer.setData('wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement);
1678
+ };
1679
+ }
1680
+
1681
+ if (table) {
1682
+ document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;
1683
+ document.getElementById('wptb-table-edit-mode-close').onclick = table.toggleTableEditMode;
1684
+ document.getElementById('wptb-left-scroll-panel-curtain-close').onclick = table.toggleTableEditMode;
1685
+ document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;
1686
+ document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;
1687
+ document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;
1688
+ document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;
1689
+ document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;
1690
+ document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;
1691
+ document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;
1692
+ document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;
1693
+ document.getElementById('wptb-delete-column').onclick = table.deleteColumn;
1694
+ document.getElementById('wptb-delete-row').onclick = table.deleteRow;
1695
+ document.getElementById('wptb-merge-cells').onclick = table.mergeCells;
1696
+ document.getElementById('wptb-split-cell').onclick = table.splitCell;
1697
+ }
1698
+
1699
+ document.querySelector('.wptb-left-panel-extend').onclick = function () {
1700
+ var wptbContainer = document.querySelector('.wptb-container');
1701
+ if (wptbContainer) {
1702
+ if (wptbContainer.classList.contains('collapsed')) {
1703
+ wptbContainer.classList.remove('collapsed');
1704
+ } else {
1705
+ wptbContainer.classList.add('collapsed');
1706
+ }
1707
+ }
1708
+ };
1709
+
1710
+ // this code hides the "element parameters" area
1711
+ // when clicked outside this element and its "tinymce" toolbar
1712
+ var wptbBuilderPanel = document.getElementsByClassName('wptb-builder-panel')[0];
1713
+ wptbBuilderPanel.addEventListener('click', function (e) {
1714
+ if (!e.target.classList.contains('wptb-ph-element') && !WPTB_Helper.findAncestor(e.target, 'wptb-ph-element') && !e.target.classList.contains('wptb-fixed-toolbar') && !WPTB_Helper.findAncestor(e.target, 'wptb-fixed-toolbar')) {
1715
+ document.getElementsByClassName('wptb-elements-container')[0].style.display = 'table';
1716
+ document.getElementsByClassName('wptb-settings-section')[0].style.display = 'block';
1717
+ document.getElementById('element-options-group').style.display = 'none';
1718
+ var wpcdFixedToolbar = document.getElementById('wpcd_fixed_toolbar');
1719
+ if (wpcdFixedToolbar.hasAttribute('data-toolbar-active-id')) {
1720
+ document.getElementById(wpcdFixedToolbar.getAttribute('data-toolbar-active-id')).classList.remove('toolbar-active');
1721
+ }
1722
+ }
1723
+ }, false);
1724
+ };
1725
+ var WPTB_List = function WPTB_List(innerElements, DOMElementProt) {
1726
+
1727
+ var el_L = document.createElement('ul'),
1728
+ item,
1729
+ DOMElement = document.createElement('div'),
1730
+ kindIndexProt = undefined,
1731
+ copy = false;
1732
+ DOMElement.classList.add('wptb-list-item-container');
1733
+
1734
+ this.kind = 'list';
1735
+
1736
+ if (innerElements === '') {
1737
+ //Case for edit mode list
1738
+ } else if (!innerElements) {
1739
+ for (var i = 0; i < 3; i++) {
1740
+ item = new WPTB_ListItem('<p>List Item ' + (i + 1) + '</p>');
1741
+ el_L.appendChild(item.getDOMElement());
1742
+ }
1743
+ } else {
1744
+ var wptbElementMutch = DOMElementProt.className.match(/wptb-element-((.+-)\d+)/i);
1745
+ if (wptbElementMutch && Array.isArray(wptbElementMutch)) {
1746
+ kindIndexProt = wptbElementMutch[1];
1747
+ copy = true;
1748
+ };
1749
+
1750
+ for (var i = 0; i < innerElements.length; i++) {
1751
+ var listItem = DOMElementProt.querySelector('li');
1752
+ item = new WPTB_ListItem(innerElements[i], listItem, true);
1753
+ el_L.appendChild(item.getDOMElement());
1754
+ }
1755
+ }
1756
+ DOMElement.appendChild(el_L);
1757
+ //window.addElementOptions('list', elList);
1758
+
1759
+ this.getDOMElement = function () {
1760
+ return DOMElement;
1761
+ };
1762
+ applyGenericItemSettings(this, kindIndexProt, copy);
1763
+ WPTB_Helper.listItemsRecalculateIndex(el_L);
1764
+
1765
+ return this;
1766
+ };
1767
+ var WPTB_ListItem = function WPTB_ListItem(text, DOMElementProt, copy) {
1768
+ var wptbListItemReturn = void 0;
1769
+ if (DOMElementProt == undefined || DOMElementProt && copy) {
1770
+ if (text == undefined) text = 'New List Item';
1771
+ var DOMElement = document.createElement('li'),
1772
+
1773
+ //divdot = document.createElement('div'),
1774
+ divcontent = document.createElement('div');
1775
+ //libullet = document.createElement('li');
1776
+ //divdot.classList.add('wptb-list-item-style-dot');
1777
+ divcontent.classList.add('wptb-list-item-content');
1778
+ //libullet.classList.add('wptb-bullet');
1779
+ if (DOMElementProt) {
1780
+ var styleDot = DOMElementProt.getAttribute('style');
1781
+ if (styleDot) {
1782
+ DOMElement.setAttribute('style', styleDot);
1783
+ }
1784
+ }
1785
+ //DOMElement.appendChild(divdot);
1786
+ DOMElement.appendChild(divcontent);
1787
+ //divdot.appendChild(libullet);
1788
+ divcontent.innerHTML = text;
1789
+ divcontent.onkeyup = window.listItemKeyListener;
1790
+
1791
+ wptbListItemReturn = true;
1792
+ } else {
1793
+ var DOMElement = DOMElementProt;
1794
+ var divcontent = DOMElement.getElementsByClassName('wptb-list-item-content')[0];
1795
+
1796
+ divcontent.onkeyup = window.listItemKeyListener;
1797
+
1798
+ wptbListItemReturn = false;
1799
+ }
1800
+
1801
+ DOMElement.onmouseenter = function (event) {
1802
+
1803
+ var btnDelete = document.createElement('span'),
1804
+ btnCopy = document.createElement('span'),
1805
+ actions = document.createElement('span'),
1806
+ previous,
1807
+ i;
1808
+ actions.classList.add('wptb-actions');
1809
+ btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
1810
+ btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
1811
+ this.classList.add('wptb-directlyhovered');
1812
+
1813
+ btnDelete.onclick = function () {
1814
+ var action = this.parentNode,
1815
+ item = this.parentNode.parentNode,
1816
+ parent = item.parentNode;
1817
+ item.removeChild(action);
1818
+ parent.removeChild(item);
1819
+ WPTB_Helper.listItemsRecalculateIndex(parent);
1820
+ };
1821
+
1822
+ btnCopy.onclick = function (event) {
1823
+ var listItem = event.target.parentNode.parentNode,
1824
+ content = listItem.querySelector('.wptb-list-item-content'),
1825
+ html = content.innerHTML;
1826
+ var duplicate = new WPTB_ListItem(html, listItem, true);
1827
+ listItem.parentNode.insertBefore(duplicate.getDOMElement(), DOMElement);
1828
+ WPTB_Helper.listItemsTinyMceInit(duplicate.getDOMElement().firstChild);
1829
+ setTimeout(function () {
1830
+ divcontent.innerHTML = html;
1831
+ WPTB_Helper.listItemsRecalculateIndex(listItem.parentNode);
1832
+ }, 5);
1833
+ };
1834
+
1835
+ actions.append(btnCopy, btnDelete);
1836
+ this.appendChild(actions);
1837
+ };
1838
+
1839
+ DOMElement.onmouseleave = function (event) {
1840
+ this.removeAttribute('class');
1841
+ var iter = 0;
1842
+ while (event.target.querySelector('.wptb-actions') && iter < 5) {
1843
+ event.target.querySelector('.wptb-actions').remove();
1844
+ iter++;
1845
+ }
1846
+ };
1847
+
1848
+ this.getDOMElement = function () {
1849
+ return DOMElement;
1850
+ };
1851
+
1852
+ if (wptbListItemReturn) {
1853
+ return this;
1854
+ }
1855
+ };
1856
+ var MultipleSelect = function MultipleSelect() {
1857
+
1858
+ var selectedCells = [],
1859
+ multipleCellMode = false;
1860
+
1861
+ this.activateMultipleSelectMode = function () {
1862
+ selectedCells = [];
1863
+ var tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');
1864
+ for (var i = 0; i < tds.length; i++) {
1865
+ tds[i].classList.remove('wptb-highlighted');
1866
+ }
1867
+ multipleCellMode = true;
1868
+ };
1869
+
1870
+ this.deactivateMultipleSelectMode = function () {
1871
+ multipleCellMode = false;
1872
+ };
1873
+
1874
+ this.isActivated = function () {
1875
+ return multipleCellMode;
1876
+ };
1877
+
1878
+ this.pushSelectedCell = function (cell) {
1879
+ if (!multipleCellMode) {
1880
+ return;
1881
+ }
1882
+ selectedCells.push(cell);
1883
+ cell.classList.add('wptb-highlighted');
1884
+ };
1885
+
1886
+ this.selectedCells = function () {
1887
+ return selectedCells;
1888
+ };
1889
+
1890
+ this.flushSelectedCells = function () {
1891
+ selectedCells = [];
1892
+ };
1893
+
1894
+ this.getFirst = function () {
1895
+ var minXIndex = 1000,
1896
+ minYIndex = 1000,
1897
+ first;
1898
+ for (var i = selectedCells.length - 1; i >= 0; i--) {
1899
+ if (minXIndex >= selectedCells[i].dataset.xIndex && minYIndex >= selectedCells[i].dataset.yIndex) {
1900
+ first = selectedCells[i];
1901
+ minXIndex = selectedCells[i].dataset.xIndex;
1902
+ minYIndex = selectedCells[i].dataset.yIndex;
1903
+ }
1904
+ }
1905
+ return first;
1906
+ };
1907
+
1908
+ this.getLast = function () {
1909
+ var maxXIndex = -1,
1910
+ maxYIndex = -1,
1911
+ last;
1912
+ for (var i = selectedCells.length - 1; i >= 0; i--) {
1913
+ if (maxXIndex <= selectedCells[i].dataset.xIndex && maxYIndex <= selectedCells[i].dataset.yIndex) {
1914
+ last = selectedCells[i];
1915
+ maxXIndex = selectedCells[i].dataset.xIndex;
1916
+ maxYIndex = selectedCells[i].dataset.yIndex;
1917
+ }
1918
+ }
1919
+ return last;
1920
+ };
1921
+
1922
+ this.removeAllButFirst = function () {
1923
+ var td = this.getFirst();
1924
+ for (var i = 1; i < selectedCells.length; i++) {
1925
+ selectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);
1926
+ }
1927
+ };
1928
+
1929
+ return this;
1930
+ };
1931
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
1932
+
1933
+ var WPTB_Parser = function WPTB_Parser(code) {
1934
+ var div = document.createElement('div');
1935
+ div.innerHTML = code;
1936
+
1937
+ var table = div.children[0];
1938
+ var columnTitleMobile = [].concat(_toConsumableArray(table.querySelectorAll('.wptb-column-title-mobile-container')));
1939
+
1940
+ for (var i = 0; i < columnTitleMobile.length; i++) {
1941
+ var parent = columnTitleMobile[i].parentNode;
1942
+ parent.removeChild(columnTitleMobile[i]);
1943
+ }
1944
+
1945
+ var tds = table.querySelectorAll('td');
1946
+ for (var _i = 0; _i < tds.length; _i++) {
1947
+ tds[_i].classList.add('wptb-droppable');
1948
+ tds[_i].classList.remove('wptb-column-title-mobile-not-elements');
1949
+ }
1950
+
1951
+ return table;
1952
+ };
1953
+ var WPTB_Parser2 = function WPTB_Parser2(code) {
1954
+ if (Array.isArray(code)) {
1955
+ var elementHtml = void 0;
1956
+
1957
+ if (code.length == 1) {
1958
+ return elementHtml.appendChild(document.createTextNode(code[0]));
1959
+ }
1960
+ if (0 in code) {
1961
+ var tagName = code[0];
1962
+ elementHtml = document.createElement(tagName);
1963
+
1964
+ if (1 in code) {
1965
+ if (Array.isArray(code[1])) {
1966
+ var attributes = code[1];
1967
+
1968
+ for (var i = 0; i < attributes.length; i++) {
1969
+ if (Array.isArray(attributes[i])) {
1970
+ elementHtml.setAttribute(attributes[i][0], attributes[i][1]);
1971
+ }
1972
+ }
1973
+ }
1974
+ }
1975
+
1976
+ if (2 in code) {
1977
+ if (Array.isArray(code[2])) {
1978
+ for (var _i = 0; _i < code[2].length; _i++) {
1979
+ if (typeof code[2][_i] === 'string' && tagName.toLowerCase() == 'p') {
1980
+ elementHtml.appendChild(document.createTextNode(code[2][_i]));
1981
+ continue;
1982
+ }
1983
+ if (!WPTB_Parser(code[2][_i])) continue;
1984
+ elementHtml.appendChild(WPTB_Parser(code[2][_i]));
1985
+ }
1986
+ } else if (typeof code[2] === 'string') {
1987
+ elementHtml.appendChild(document.createTextNode(code[2]));
1988
+ }
1989
+ }
1990
+ }
1991
+
1992
+ return elementHtml;
1993
+ } else {
1994
+ return false;
1995
+ }
1996
+ };
1997
+ var WPTB_Settings = function WPTB_Settings() {
1998
+ var elems = document.getElementsByClassName('wptb-element');
1999
+
2000
+ for (var i = 0; i < elems.length; i++) {
2001
+ elems[i].ondragstart = function (event) {
2002
+ event.dataTransfer.effectAllowed = 'move';
2003
+ event.dataTransfer.setData('wptbElement', event.target.dataset.wptbElement);
2004
+ event.dataTransfer.setData('wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement);
2005
+ };
2006
+ elems[i].ondragend = function () {
2007
+ var wptbDropHandle = document.querySelector('.wptb-drop-handle'),
2008
+ wptbDropBorderMarker = document.querySelector('.wptb-drop-border-marker');
2009
+ if (wptbDropHandle || wptbDropBorderMarker) {
2010
+ wptbDropHandle.style.display = 'none';
2011
+ wptbDropBorderMarker.style.display = 'none';
2012
+ }
2013
+ };
2014
+ };
2015
+
2016
+ var shortcodePopupWindow = document.getElementsByClassName('wptb-shortcode-popup-window-modal')[0];
2017
+ document.getElementsByClassName('wptb-embed-btn')[0].onclick = function () {
2018
+ if (!this.classList.contains('wptb-embed-disable')) {
2019
+ shortcodePopupWindow.classList.add('wptb-shortcode-popup-show');
2020
+ }
2021
+ };
2022
+
2023
+ document.getElementsByClassName('wptb-shortcode-popup-dark-area')[0].onclick = function () {
2024
+ shortcodePopupWindow.classList.remove('wptb-shortcode-popup-show');
2025
+ };
2026
+
2027
+ document.getElementsByClassName('wptb-shortcode-popup-window-close-icon')[0].onclick = function () {
2028
+ shortcodePopupWindow.classList.remove('wptb-shortcode-popup-show');
2029
+ };
2030
+
2031
+ document.getElementsByClassName('wptb-save-btn')[0].onclick = function () {
2032
+ var bar = document.querySelector('.wptb-edit-bar');
2033
+ if (bar && bar.classList.contains('visible')) {
2034
+ var table = document.getElementsByClassName('wptb-preview-table')[0];
2035
+ table.toggleTableEditMode();
2036
+ }
2037
+
2038
+ var http = new XMLHttpRequest(),
2039
+ url = (wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl) + "?action=save_table",
2040
+ t = document.getElementById('wptb-setup-name').value.trim(),
2041
+ messagingArea = void 0,
2042
+ code = document.getElementsByClassName('wptb-preview-table');
2043
+ if (code.length > 0) {
2044
+ code = WPTB_Stringifier(code[0]);
2045
+ code = code.outerHTML;
2046
+ } else {
2047
+ code = '';
2048
+ }
2049
+
2050
+ if (t === '' || code === '') {
2051
+ var messagingAreaText = '';
2052
+ if (t === '') messagingAreaText += 'You must assign a name to the table before saving it.</br>';
2053
+ if (code === '') messagingAreaText += 'Table wasn\'t created';
2054
+ messagingArea = document.getElementById('wptb-messaging-area');
2055
+ messagingArea.innerHTML = '<div class="wptb-error wptb-message">Error: ' + messagingAreaText + '</div>';
2056
+ messagingArea.classList.add('wptb-warning');
2057
+ setTimeout(function () {
2058
+ messagingArea.removeChild(messagingArea.firstChild);
2059
+ }, 4000);
2060
+ return;
2061
+ }
2062
+
2063
+ var params = {
2064
+ title: t,
2065
+ content: code,
2066
+ security_code: wptb_admin_object.security_code
2067
+ };
2068
+ if ((rs = WPTB_Helper.detectMode()) || (rs = document.wptbId)) {
2069
+ params.id = rs;
2070
+ }
2071
+ params = JSON.stringify(params);
2072
+
2073
+ http.open('POST', url, true);
2074
+ http.setRequestHeader('Content-type', 'application/json; charset=utf-8');
2075
+
2076
+ http.onreadystatechange = function (action) {
2077
+ if (this.readyState == 4 && this.status == 200) {
2078
+ var data = JSON.parse(http.responseText);
2079
+ messagingArea = document.getElementById('wptb-messaging-area');
2080
+
2081
+ if (data[0] == 'saved') {
2082
+ document.wptbId = data[1];
2083
+ messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully saved.</div>';
2084
+ document.getElementsByClassName('wptb-embed-btn')[0].classList.remove('wptb-embed-disable');
2085
+ document.getElementById('wptb-embed-shortcode').value = '[wptb id=' + data[1] + ']';
2086
+ } else if (data[0] == 'edited') {
2087
+ messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
2088
+ } else {
2089
+ messagingArea.innerHTML = '<div class="wptb-error wptb-message">Safety problems</div>';
2090
+ }
2091
+ messagingArea.classList.add('wptb-success');
2092
+ setTimeout(function () {
2093
+ messagingArea.removeChild(messagingArea.firstChild);
2094
+ }, 4000);
2095
+ }
2096
+ };
2097
+ http.send(params);
2098
+ };
2099
+ };
2100
+ var WPTB_Space = function WPTB_Space(elSpaceBetween) {
2101
+
2102
+ function newElementProxy(el) {
2103
+ if (el.includes('list')) {
2104
+ return new WPTB_List();
2105
+ } else if (el.includes('image')) {
2106
+ return new WPTB_Image();
2107
+ } else if (el.includes('text')) {
2108
+ return new WPTB_Text();
2109
+ } else if (el.includes('button')) {
2110
+ return new WPTB_Button();
2111
+ }
2112
+ }
2113
+ var spaceBetween = void 0;
2114
+ if (!elSpaceBetween) {
2115
+ spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');
2116
+ } else {
2117
+ spaceBetween = elSpaceBetween;
2118
+ }
2119
+
2120
+ spaceBetween.ondragenter = function () {
2121
+ this.classList.add('visible');
2122
+ };
2123
+ spaceBetween.ondragover = function (event) {
2124
+ event.preventDefault();
2125
+ };
2126
+
2127
+ spaceBetween.ondragleave = function () {
2128
+ this.classList.remove('visible');
2129
+ };
2130
+
2131
+ spaceBetween.ondrop = function (event) {
2132
+ event.stopPropagation();
2133
+
2134
+ var p = event.target.nextSibling,
2135
+ td = event.target,
2136
+ element,
2137
+ t_space,
2138
+ spaceParent;
2139
+
2140
+ while (!td.classList.contains('wptb-droppable')) {
2141
+ td = td.parentNode;
2142
+ }
2143
+
2144
+ if (event.dataTransfer.getData('wptbElement')) {
2145
+ element = newElementProxy(event.dataTransfer.getData('wptbElement'));
2146
+ this.classList.remove('visible');
2147
+
2148
+ if (p == null) {
2149
+ td.appendChild(element.getDOMElement());
2150
+ td.appendChild(new WPTB_Space());
2151
+ } else {
2152
+ td.insertBefore(element.getDOMElement(), p);
2153
+ td.insertBefore(new WPTB_Space(), p);
2154
+ }
2155
+ } else {
2156
+ alert(event.dataTransfer.getData('node'));
2157
+ element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];
2158
+ t_space = element.nextSibling;
2159
+ spaceParent = element.parentNode;
2160
+ if (t_space != undefined) {
2161
+ spaceParent.removeChild(t_space);
2162
+ }
2163
+
2164
+ if (p == null) {
2165
+ td.appendChild(element);
2166
+ td.appendChild(new WPTB_Space());
2167
+ } else {
2168
+ td.insertBefore(element, p);
2169
+ td.insertBefore(new WPTB_Space(), p);
2170
+ }
2171
+ }
2172
+ this.classList.remove('visible');
2173
+ };
2174
+
2175
+ if (!elSpaceBetween) {
2176
+ return spaceBetween;
2177
+ }
2178
+ };
2179
+ var WPTB_Stringifier = function WPTB_Stringifier(codeMain) {
2180
+ if (codeMain) {
2181
+ var code = codeMain.cloneNode(true);
2182
+ code.classList.add('wptb-table-preview-static-indic');
2183
+ code.dataset.tableColumns = codeMain.columns;
2184
+ code.dataset.reconstraction = 1;
2185
+
2186
+ var tds = code.getElementsByTagName('td');
2187
+ if (tds.length > 0) {
2188
+ for (var i = 0; i < tds.length; i++) {
2189
+
2190
+ for (var _i = 0; _i < tds.length; _i++) {
2191
+ if (code.dataset.reconstraction == 1 && tds[_i].colSpan > 1 || tds[_i].rowSpan > 1) {
2192
+ code.dataset.reconstraction = 0;
2193
+ break;
2194
+ }
2195
+ }
2196
+
2197
+ if (codeMain.querySelector('wptb-table-preview-head')) {
2198
+ tds[i].removeAttribute('data-x-index');
2199
+ }
2200
+ tds[i].removeAttribute('data-y-index');
2201
+ tds[i].removeAttribute('draggable');
2202
+ tds[i].classList.remove('wptb-droppable');
2203
+ var innerElements = tds[i].getElementsByClassName('wptb-ph-element');
2204
+
2205
+ if (innerElements.length > 0) {
2206
+ for (var j = 0; j < innerElements.length; j++) {
2207
+ innerElements[j].classList.remove('wptb-directlyhovered');
2208
+
2209
+ var mceContentBodys = innerElements[j].querySelectorAll('.mce-content-body');
2210
+ if (mceContentBodys.length > 0) {
2211
+ for (var k = 0; k < mceContentBodys.length; k++) {
2212
+ mceContentBodys[k].classList.remove('mce-content-body');
2213
+ }
2214
+ }
2215
+
2216
+ var dataMceStyle = innerElements[j].querySelectorAll('[data-mce-style]');
2217
+ if (dataMceStyle.length > 0) {
2218
+ for (var _k = 0; _k < dataMceStyle.length; _k++) {
2219
+ dataMceStyle[_k].removeAttribute('data-mce-style');
2220
+ }
2221
+ }
2222
+
2223
+ var contentEditable = innerElements[j].querySelectorAll('[contenteditable]');
2224
+ if (contentEditable.length > 0) {
2225
+ for (var _k2 = 0; _k2 < contentEditable.length; _k2++) {
2226
+ contentEditable[_k2].removeAttribute('contenteditable');
2227
+ }
2228
+ }
2229
+
2230
+ var spellCheck = innerElements[j].querySelectorAll('[spellcheck]');
2231
+ if (spellCheck.length > 0) {
2232
+ for (var _k3 = 0; _k3 < spellCheck.length; _k3++) {
2233
+ spellCheck[_k3].removeAttribute('spellcheck');
2234
+ }
2235
+ }
2236
+
2237
+ var mceIds = innerElements[j].querySelectorAll('[id^=mce_]');
2238
+ if (mceIds.length > 0) {
2239
+ for (var _k4 = 0; _k4 < mceIds.length; _k4++) {
2240
+ mceIds[_k4].removeAttribute('id');
2241
+ }
2242
+ }
2243
+
2244
+ var wptbActions = innerElements[j].querySelectorAll('.wptb-actions');
2245
+ var wptbActionsLength = wptbActions.length;
2246
+ while (wptbActionsLength > 0) {
2247
+ wptbActions[0].parentNode.removeChild(wptbActions[0]);
2248
+ wptbActionsLength--;
2249
+ }
2250
+ }
2251
+ }
2252
+
2253
+ if (tds[i].hasAttribute('data-title-column')) {
2254
+ var columnNameDivContainer = document.createElement('div'),
2255
+ columnNameDiv = document.createElement('div');
2256
+ columnNameDivContainer.classList.add('wptb-column-title-mobile-container');
2257
+ columnNameDiv.classList.add('wptb-column-title-mobile');
2258
+ columnNameDiv.dataset.titleColumn = tds[i].dataset.titleColumn;
2259
+ columnNameDiv.setAttribute('style', 'font-size:' + tds[i].dataset.titleColumnFontSize + '; \n\
2260
+ color:' + tds[i].dataset.titleColumnColor + '; background-color:' + tds[i].dataset.titleBackgroundColor + '; text-align:' + tds[i].dataset.titleAlign + ';');
2261
+ columnNameDiv.style.padding = tds[i].style.padding;
2262
+ if (tds[i].children.length == 0) {
2263
+ tds[i].classList.add('wptb-column-title-mobile-not-elements');
2264
+ }
2265
+ columnNameDivContainer.appendChild(columnNameDiv);
2266
+ tds[i].insertBefore(columnNameDivContainer, tds[i].firstChild);
2267
+ }
2268
+ }
2269
+ }
2270
+
2271
+ return code;
2272
+ }
2273
+ };
2274
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
2275
+
2276
+ var WPTB_Stringifier2 = function WPTB_Stringifier2(node) {
2277
+ var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2278
+
2279
+
2280
+ if (node == undefined) {
2281
+ return '';
2282
+ } else if (node.tagName == undefined && node.nodeType == 3) {
2283
+ return node.nodeValue;
2284
+ }
2285
+
2286
+ var code = [],
2287
+ children = void 0,
2288
+ int_elem_arr = false,
2289
+ attributes = [].concat(_toConsumableArray(node.attributes)),
2290
+ attributes_list = [],
2291
+ internal_elements = [];
2292
+ if ((node.parentNode.classList.contains('wptb-list-item-content') || node.parentNode.classList.contains('mce-content-body')) && node.tagName.toLowerCase() == 'p') {
2293
+ children = node.childNodes;
2294
+ int_elem_arr = true;
2295
+ } else if (node.children.length > 0) {
2296
+ children = node.children;
2297
+ } else {
2298
+ children = node.childNodes;
2299
+ }
2300
+ if (attributes.length > 0) {
2301
+ for (var i = 0; i < attributes.length; i++) {
2302
+ attributes_list[i] = [attributes[i].name, attributes[i].value];
2303
+ }
2304
+ } else {
2305
+ attributes_list = '';
2306
+ }
2307
+
2308
+ if (children.length > 0) {
2309
+ for (var _i = 0; _i < children.length; _i++) {
2310
+ var inter_elem = WPTB_Stringifier(children[_i]);
2311
+
2312
+ if (Array.isArray(inter_elem) || int_elem_arr) {
2313
+ internal_elements[_i] = inter_elem;
2314
+ } else if (typeof inter_elem === 'string' && inter_elem) {
2315
+ internal_elements = inter_elem;
2316
+ }
2317
+ }
2318
+ } else {
2319
+ internal_elements = '';
2320
+ }
2321
+
2322
+ code.push(node.tagName.toLowerCase(), attributes_list, internal_elements);
2323
+
2324
+ return code;
2325
+ };
2326
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2327
+
2328
+ var array = [],
2329
+ WPTB_Table = function WPTB_Table(columns, rows) {
2330
+
2331
+ /* The members of the class */
2332
+ var settings = document.getElementsByClassName('wptb-settings-items'),
2333
+ wptbTableSetup = document.getElementsByClassName("wptb-table-setup")[0],
2334
+ table,
2335
+ row,
2336
+ cell,
2337
+ maxAmountOfCells,
2338
+ maxAmountOfRows;
2339
+
2340
+ //HERE ARE THE PRIVATE FUNCTIONS
2341
+ /*
2342
+ * This function toggles buttons visibility in cell edit mode
2343
+ * (according to the amount of currently selected cells), and
2344
+ * highlights visually the clicked cell if it is not highlighted, or
2345
+ * removes highlight if clicked cell is already highlighted.
2346
+ * It too toggles the bits of our abstract representation.
2347
+ * @param Event this is the event instance of the click performed over a cell.
2348
+ */
2349
+ var mark = function mark(event) {
2350
+ var rs = this.rowSpan,
2351
+ cs = this.colSpan,
2352
+ markedCells,
2353
+ noCells = document.getElementsByClassName('wptb-no-cell-action'),
2354
+ singleCells = document.getElementsByClassName('wptb-single-action'),
2355
+ multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
2356
+ position = getCoords(this),
2357
+ row = position[0],
2358
+ column = position[1];
2359
+ if (!document.select.isActivated()) {
2360
+ return;
2361
+ }
2362
+ if (this.className.match(/wptb-highlighted/)) {
2363
+ this.classList.remove('wptb-highlighted');
2364
+ for (var i = 0; i < rs; i++) {
2365
+ for (var j = 0; j < cs; j++) {
2366
+ array[row + i][column + j] = 0;
2367
+ }
2368
+ }
2369
+ } else {
2370
+ this.classList.add('wptb-highlighted');
2371
+ for (var i = 0; i < rs; i++) {
2372
+ for (var j = 0; j < cs; j++) {
2373
+ array[row + i][column + j] = 1;
2374
+ }
2375
+ }
2376
+ }
2377
+
2378
+ markedCells = document.getElementsByClassName('wptb-highlighted').length;
2379
+ if (markedCells === 0) {
2380
+ for (var i = 0; i < multipleCells.length; i++) {
2381
+ multipleCells[i].classList.remove('visible');
2382
+ multipleCells[i].setAttribute('disabled', 'disabled');
2383
+ }
2384
+ for (var i = 0; i < noCells.length; i++) {
2385
+ noCells[i].classList.add('visible');
2386
+ noCells[i].removeAttribute('disabled');
2387
+ }
2388
+ for (var i = 0; i < singleCells.length; i++) {
2389
+ singleCells[i].classList.remove('visible');
2390
+ singleCells[i].setAttribute('disabled', 'disabled');
2391
+ }
2392
+ } else if (markedCells === 1) {
2393
+ for (var i = 0; i < multipleCells.length; i++) {
2394
+ multipleCells[i].classList.remove('visible');
2395
+ multipleCells[i].setAttribute('disabled', 'disabled');
2396
+ }
2397
+ for (var i = 0; i < noCells.length; i++) {
2398
+ noCells[i].classList.remove('visible');
2399
+ noCells[i].setAttribute('disabled', 'disabled');
2400
+ }
2401
+ for (var i = 0; i < singleCells.length; i++) {
2402
+ singleCells[i].classList.add('visible');
2403
+ singleCells[i].removeAttribute('disabled');
2404
+ }
2405
+ } else {
2406
+ for (var i = 0; i < multipleCells.length; i++) {
2407
+ if (table.isSquare(array)) {
2408
+ multipleCells[i].classList.add('visible');
2409
+ multipleCells[i].removeAttribute('disabled');
2410
+ } else {
2411
+ multipleCells[i].classList.remove('visible');
2412
+ multipleCells[i].setAttribute('disabled', 'disabled');
2413
+ }
2414
+ }
2415
+ for (var i = 0; i < noCells.length; i++) {
2416
+ noCells[i].classList.remove('visible');
2417
+ noCells[i].setAttribute('disabled', 'disabled');
2418
+ }
2419
+ for (var i = 0; i < singleCells.length; i++) {
2420
+ singleCells[i].classList.remove('visible');
2421
+ singleCells[i].setAttribute('disabled', 'disabled');
2422
+ }
2423
+ }
2424
+ };
2425
+
2426
+ /*
2427
+ * This function fills an array with 1's according to the actual design
2428
+ * of HTML table.
2429
+ * @returns an array of arrays containing an abstract representation
2430
+ * of HTML table.
2431
+ * @deprecated
2432
+ * */
2433
+
2434
+ var realTimeArray = function realTimeArray() {
2435
+ var carried = [],
2436
+ tds,
2437
+ cols,
2438
+ matriz = [];
2439
+
2440
+ for (var i = 0; i < maxAmountOfCells; i++) {
2441
+ carried[i] = 0;
2442
+ }
2443
+
2444
+ for (var i = 0; i < table.rows.length; i++) {
2445
+ cols = [];
2446
+
2447
+ var tds = table.rows[i].getElementsByTagName('td');
2448
+
2449
+ for (items = 0; items < tds.length; items++) {
2450
+
2451
+ for (var k = 0; k < tds[items].colSpan; k++) {
2452
+ cols.push(1);
2453
+ }
2454
+
2455
+ if (tds[items].rowSpan > 1) {
2456
+ for (var k = 0; k < tds[items].colSpan; k++) {
2457
+ carried[items + k] = {
2458
+ justAssigned: true,
2459
+ amount: tds[items].rowSpan
2460
+ };
2461
+ }
2462
+ }
2463
+ }
2464
+
2465
+ for (var k = 0; k < maxAmountOfCells; k++) {
2466
+ if (_typeof(carried[k]) == 'object' && carried[k].amount > 0) {
2467
+ carried[k].amount--;
2468
+ if (carried[k].justAssigned) {
2469
+ carried[k].justAssigned = false;
2470
+ } else {
2471
+ cols.push(1);
2472
+ }
2473
+ }
2474
+ }
2475
+
2476
+ matriz.push(cols);
2477
+ }
2478
+ return matriz;
2479
+ };
2480
+
2481
+ /*
2482
+ * This function gets the number and position of cell spaces in current row that are occuped
2483
+ * by upper rowspanned cells.
2484
+ * @param number the number of row where we wish to calculate the carried rowspans up to.
2485
+ * @return an array with the remaining rowspans in each column.
2486
+ */
2487
+ var carriedRowspans = function carriedRowspans(row) {
2488
+ var carried = [],
2489
+ tds,
2490
+ cols;
2491
+
2492
+ for (var i = 0; i < maxAmountOfCells; i++) {
2493
+ carried[i] = 0;
2494
+ }
2495
+
2496
+ if (row == -1) {
2497
+ return carried;
2498
+ }
2499
+
2500
+ for (var i = 0; i <= row; i++) {
2501
+ cellsBuffer = table.rows[i].getElementsByTagName('td');
2502
+ cellPointer = 0;
2503
+
2504
+ for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {
2505
+ stepsToMove = 1;
2506
+
2507
+ if (carried[xPosition]) {
2508
+ carried[xPosition]--;
2509
+ } else {
2510
+ celda = cellsBuffer[cellPointer++];
2511
+ if (celda.rowSpan > 1) {
2512
+ for (k = 0; k < celda.colSpan; k++) {
2513
+ carried[xPosition + k] = celda.rowSpan - 1;
2514
+ }
2515
+ stepsToMove = celda.colSpan;
2516
+ } else if (celda.colSpan > 1) {
2517
+ stepsToMove = celda.colSpan;
2518
+ }
2519
+ }
2520
+ }
2521
+ }
2522
+ return carried;
2523
+ };
2524
+
2525
+ /*
2526
+ * A helpful function for showing
2527
+ * the abstract table in console.
2528
+ * @param Array our abstract table.
2529
+ */
2530
+ var drawTable = function drawTable(a) {
2531
+ var string = 'DRAWING TABLE:\n';
2532
+ for (var i = 0; i < a.length; i++) {
2533
+
2534
+ for (var j = 0; j < a[i].length; j++) {
2535
+ string += ' ' + a[i][j];
2536
+ }
2537
+ string += '\n';
2538
+ }
2539
+ table.isSquare(a);
2540
+ };
2541
+
2542
+ /*
2543
+ * It resets all the bits of our abstract representation
2544
+ * to 0 and removes the highlighting class of all cells.
2545
+ */
2546
+
2547
+ var undoSelect = function undoSelect() {
2548
+ var noCells = document.getElementsByClassName('wptb-no-cell-action'),
2549
+ singleCells = document.getElementsByClassName('wptb-single-action'),
2550
+ multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
2551
+ tds = table.getElementsByClassName('wptb-highlighted');
2552
+ while (tds.length) {
2553
+ tds[0].classList.remove('wptb-highlighted');
2554
+ }
2555
+ for (var i = 0; i < array.length; i++) {
2556
+ for (var j = 0; j < array[i].length; j++) {
2557
+ array[i][j] = 0;
2558
+ }
2559
+ }
2560
+ for (var i = 0; i < multipleCells.length; i++) {
2561
+ multipleCells[i].classList.remove('visible');
2562
+ multipleCells[i].setAttribute('disabled', 'disabled');
2563
+ }
2564
+ for (var i = 0; i < noCells.length; i++) {
2565
+ noCells[i].classList.add('visible');
2566
+ noCells[i].removeAttribute('disabled');
2567
+ }
2568
+ for (var i = 0; i < singleCells.length; i++) {
2569
+ singleCells[i].classList.remove('visible');
2570
+ singleCells[i].setAttribute('disabled', 'disabled');
2571
+ }
2572
+ };
2573
+
2574
+ /*
2575
+ * This fills the abstract representation of our table with
2576
+ * zeros, at the start. the max amount of cells is the greatest sum
2577
+ * of all colspans for row.
2578
+ */
2579
+
2580
+ var fillTableArray = function fillTableArray() {
2581
+ var colspansSums = [],
2582
+ a = [];
2583
+
2584
+ //calculate max amount of cells inside a row
2585
+ for (var i = 0; i < table.rows.length; i++) {
2586
+ var cells = table.rows[i].getElementsByTagName('td'),
2587
+ colspanSumInRow = 0;
2588
+ for (var j = 0; j < cells.length; j++) {
2589
+ colspanSumInRow += cells[j].colSpan;
2590
+ }
2591
+ colspansSums.push(colspanSumInRow);
2592
+ }
2593
+
2594
+ maxAmountOfCells = Math.max.apply(null, colspansSums);
2595
+ //calculate max rows
2596
+ var maxAmountOfRows = table.rows.length;
2597
+
2598
+ // fill with zeros from both values
2599
+ for (var i = 0; i < maxAmountOfRows; i++) {
2600
+ a[i] = [];
2601
+ for (var j = 0; j < maxAmountOfCells; j++) {
2602
+ a[i].push(0);
2603
+ }
2604
+ }
2605
+ drawTable(a);
2606
+ return a;
2607
+ };
2608
+
2609
+ /*
2610
+ * This function gets the sum of all colspans in a row.
2611
+ * @param number the number of row to be used as reference.
2612
+ */
2613
+ var getActualPointsInRow = function getActualPointsInRow(row) {
2614
+ var tds = table.rows[row].getElementsByTagName('td'),
2615
+ points = 0;
2616
+ for (var i = 0; i < tds.length; i++) {
2617
+ points += tds[i].colSpan;
2618
+ }
2619
+ return points;
2620
+ };
2621
+
2622
+ /*
2623
+ * This function gets us the exact coordinates of
2624
+ * an exact cell, in a more reliable way than xIndex and yIndex,
2625
+ * these last ones were meant to be used for getting the cell trough them.
2626
+ * @param DOMElement the cell to get the coordinates.
2627
+ */
2628
+ var getCoords = function getCoords(search) {
2629
+ var skipInCols = [],
2630
+ cell;
2631
+
2632
+ for (var i = 0; i < maxAmountOfCells; i++) {
2633
+ skipInCols[i] = 0;
2634
+ }
2635
+
2636
+ for (var i = 0; i < table.rows.length; i++) {
2637
+ var cellsBuffer = table.rows[i].getElementsByTagName('td');
2638
+ cellPointer = 0;
2639
+ for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {
2640
+ stepsToMove = 1;
2641
+
2642
+ if (skipInCols[xPosition]) {
2643
+ skipInCols[xPosition]--;
2644
+ } else {
2645
+ var td = cellsBuffer[cellPointer++];
2646
+ if (td == search) {
2647
+ return [i, xPosition];
2648
+ }
2649
+ if (td.rowSpan > 1) {
2650
+ for (var _k = 0; _k < td.colSpan; _k++) {
2651
+ skipInCols[xPosition + _k] = td.rowSpan - 1;
2652
+ }
2653
+ stepsToMove = td.colSpan;
2654
+ } else if (td.colSpan > 1) {
2655
+ stepsToMove = td.colSpan;
2656
+ }
2657
+ }
2658
+ }
2659
+ }
2660
+ };
2661
+
2662
+ jQuery('#wptb-table-header-bg').val('');
2663
+ jQuery('#wptb-even-row-bg').val('');
2664
+ jQuery('#wptb-odd-row-bg').val('');
2665
+ jQuery('#wptb-table-border-color').val('');
2666
+ jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');
2667
+ jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');
2668
+ jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');
2669
+
2670
+ if (columns || rows) {
2671
+ //END OF PRIVATE FUNCTIONS
2672
+ for (var i = 0; i < settings.length; i++) {
2673
+ if (settings[i].id !== 'wptb-apply-inner-border') {
2674
+ settings[i].classList.add('visible');
2675
+ }
2676
+ }
2677
+
2678
+ //Create a HTML Table element.
2679
+ table = document.createElement('table');
2680
+ table.classList.add('wptb-preview-table');
2681
+
2682
+ //Add the data rows.
2683
+ for (var i = 0; i < rows; i++) {
2684
+
2685
+ row = table.insertRow(-1);
2686
+ row.classList.add('wptb-row');
2687
+
2688
+ for (var j = 0; j < columns; j++) {
2689
+ cell = new WPTB_Cell(mark);
2690
+ cell.setCoords(i, j);
2691
+ row.appendChild(cell.getDOMElement());
2692
+ }
2693
+ }
2694
+ } else {
2695
+ var wptb_preview_table = document.getElementsByClassName('wptb-preview-table');
2696
+
2697
+ if (wptb_preview_table.length > 0) {
2698
+ table = wptb_preview_table[0];
2699
+
2700
+ var cells = table.getElementsByTagName('td');
2701
+
2702
+ if (cells.length > 0) {
2703
+ for (var _i = 0; _i < cells.length; _i++) {
2704
+ WPTB_Cell(mark, cells[_i]);
2705
+ }
2706
+ }
2707
+ }
2708
+ }
2709
+
2710
+ /*
2711
+ * This just toggles visibility of cell edit bar, and toggles
2712
+ * cell selecting mode.
2713
+ */
2714
+
2715
+ table.toggleTableEditMode = function () {
2716
+ var bar = document.getElementsByClassName('wptb-edit-bar'),
2717
+ cellModeBackground = document.getElementById('wptb-cell_mode_background'),
2718
+ leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),
2719
+ wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');
2720
+ if (wptbPreviewTable.length > 0) {
2721
+ wptbPreviewTable = wptbPreviewTable[0];
2722
+ }
2723
+
2724
+ if (bar.length > 0) {
2725
+ for (var _i2 = 0; _i2 < bar.length; _i2++) {
2726
+ if (bar[_i2].classList.contains('visible')) {
2727
+ document.select.deactivateMultipleSelectMode();
2728
+ bar[_i2].classList.remove('visible');
2729
+ cellModeBackground.classList.remove('visible');
2730
+ leftScrollPanelCurtain.classList.remove('visible');
2731
+ wptbPreviewTable.classList.remove('wptb-preview-table-manage-cells');
2732
+ var wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
2733
+ if (wptbPreviewTableTds.length > 0) {
2734
+ for (var _i3 = 0; _i3 < wptbPreviewTableTds.length; _i3++) {
2735
+ wptbPreviewTableTds[_i3].classList.remove('wptb-highlighted');
2736
+ }
2737
+ }
2738
+ } else {
2739
+ document.select.activateMultipleSelectMode();
2740
+ bar[_i2].classList.add('visible');
2741
+ cellModeBackground.classList.add('visible');
2742
+ leftScrollPanelCurtain.classList.add('visible');
2743
+ wptbPreviewTable.classList.add('wptb-preview-table-manage-cells');
2744
+ }
2745
+ }
2746
+ }
2747
+ };
2748
+
2749
+ /*
2750
+ * For assigning to each cell xIndex and y Index attributes,
2751
+ * these are the column number and row number of cell in table.
2752
+ */
2753
+
2754
+ table.recalculateIndexes = function (start) {
2755
+ var trs = this.getElementsByTagName('tr'),
2756
+ tds = void 0,
2757
+ maxCols = 0,
2758
+ tdsArr = [];
2759
+ var wptbTopRowAsHeader = document.getElementById('wptb-top-row-as-header');
2760
+
2761
+ for (var i = 0; i < trs.length; i++) {
2762
+ if (i == 0) {
2763
+ if (start == undefined) {
2764
+ trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();
2765
+ }
2766
+ if (wptbTopRowAsHeader.checked) {
2767
+ if (start == undefined) {
2768
+ this.classList.add('wptb-table-preview-head');
2769
+ trs[i].classList.add('wptb-table-head');
2770
+ };
2771
+ } else {
2772
+ if (start == undefined) {
2773
+ this.classList.remove('wptb-table-preview-head');
2774
+ trs[i].classList.remove('wptb-table-head');
2775
+ }
2776
+ }
2777
+ } else {
2778
+ if (i % 2 == 0) {
2779
+ if (start == undefined) {
2780
+ trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();
2781
+ }
2782
+ trs[i].classList.remove('wptb-table-head');
2783
+ } else {
2784
+ if (start == undefined) {
2785
+ trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();
2786
+ }
2787
+ trs[i].classList.remove('wptb-table-head');
2788
+ }
2789
+ }
2790
+
2791
+ tdsArr[i];
2792
+ tds = trs[i].getElementsByTagName('td');
2793
+
2794
+ if (tdsArr[i] == undefined) {
2795
+ tdsArr[i] = [];
2796
+ }
2797
+
2798
+ var jMainIter = 0;
2799
+ for (var j = 0; j < tds.length; j++) {
2800
+ if (tdsArr[i][j] != undefined) {
2801
+ for (var y = 0; y < 100; y++) {
2802
+ if (tdsArr[i][jMainIter] != undefined) {
2803
+ jMainIter++;
2804
+ continue;
2805
+ }
2806
+ tdsArr[i][jMainIter] = tds[j];
2807
+ tds[j].dataset.xIndex = jMainIter;
2808
+ break;
2809
+ }
2810
+ } else {
2811
+ tdsArr[i][j] = tds[j];
2812
+ tds[j].dataset.xIndex = jMainIter;
2813
+ }
2814
+ tds[j].dataset.yIndex = i;
2815
+
2816
+ if (tds[j].colSpan > 1) {
2817
+ for (var _k2 = 1; _k2 < tds[j].colSpan; _k2++) {
2818
+ jMainIter++;
2819
+ tdsArr[i][jMainIter] = 'tdDummy';
2820
+ }
2821
+ }
2822
+
2823
+ if (tds[j].rowSpan > 1) {
2824
+ for (var x = 1; x < tds[j].rowSpan; x++) {
2825
+ if (tdsArr[i + x] == undefined) {
2826
+ tdsArr[i + x] = [];
2827
+ }
2828
+ for (var z = 0; z < tds[j].colSpan; z++) {
2829
+ tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z] = 'tdDummy';
2830
+ }
2831
+ }
2832
+ }
2833
+ jMainIter++;
2834
+ }
2835
+ if (j > maxCols) {
2836
+ maxCols = j;
2837
+ }
2838
+ }
2839
+ this.columns = maxCols;
2840
+ };
2841
+
2842
+ /*
2843
+ * As simple as it is: adds a column to the end of table.
2844
+ */
2845
+ table.addColumnEnd = function () {
2846
+ var td = void 0,
2847
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
2848
+ currentTableTd = void 0,
2849
+ currentTdStyle = void 0;
2850
+ if (currentTable.length > 0) {
2851
+ currentTableTd = currentTable[0].querySelector('td');
2852
+ }
2853
+
2854
+ if (currentTableTd) {
2855
+ currentTdStyle = currentTableTd.getAttribute('style');
2856
+ }
2857
+ for (var i = 0; i < table.rows.length; i++) {
2858
+ td = new WPTB_Cell(mark);
2859
+ if (currentTdStyle) {
2860
+ td.getDOMElement().setAttribute('style', currentTdStyle);
2861
+ }
2862
+ table.rows[i].appendChild(td.getDOMElement());
2863
+ array[i].push(0);
2864
+ }
2865
+ maxAmountOfCells++;
2866
+ table.recalculateIndexes();
2867
+ WPTB_Helper.dataTitleColumnSet(table);
2868
+ undoSelect();
2869
+ };
2870
+
2871
+ /*
2872
+ * As simple as it looks: adds a column to the start of table.
2873
+ */
2874
+
2875
+ table.addColumnStart = function () {
2876
+ var td = void 0,
2877
+ firstCell = void 0,
2878
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
2879
+ currentTableTd = void 0,
2880
+ currentTdStyle = void 0;
2881
+ if (currentTable.length > 0) {
2882
+ currentTableTd = currentTable[0].querySelector('td');
2883
+ }
2884
+
2885
+ if (currentTableTd) {
2886
+ currentTdStyle = currentTableTd.getAttribute('style');
2887
+ }
2888
+ for (var i = 0; i < table.rows.length; i++) {
2889
+ td = new WPTB_Cell(mark);
2890
+ if (currentTdStyle) {
2891
+ td.getDOMElement().setAttribute('style', currentTdStyle);
2892
+ }
2893
+ firstCell = table.rows[i].getElementsByTagName('td')[0];
2894
+ if (firstCell) {
2895
+ table.rows[i].insertBefore(td.getDOMElement(), firstCell);
2896
+ } else {
2897
+ table.rows[i].appendChild(td.getDOMElement());
2898
+ }
2899
+ array[i].push(0);
2900
+ }
2901
+
2902
+ maxAmountOfCells++;
2903
+ table.recalculateIndexes();
2904
+ WPTB_Helper.dataTitleColumnSet(table);
2905
+ undoSelect();
2906
+ };
2907
+
2908
+ /*
2909
+ * Well, not so simple as previous functions.
2910
+ * It adds a column after a certain column of reference.
2911
+ * @param integer the column number to be used as reference.
2912
+ * If empty, then the first highlighted cell is used as reference.
2913
+ */
2914
+
2915
+ table.addColumnAfter = function (c_pos) {
2916
+ var rows = table.rows,
2917
+ cellPointer = void 0,
2918
+ cellsBuffer = void 0,
2919
+ cell = document.querySelector('.wptb-highlighted'),
2920
+ cellStyle = cell.getAttribute('style'),
2921
+ pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];
2922
+
2923
+ if (maxAmountOfCells - pos - cell.colSpan + 1 == 1) {
2924
+ table.addColumnEnd();
2925
+ } else {
2926
+ var pendingInsertion = false,
2927
+ _stepsToMove = void 0,
2928
+ td = void 0,
2929
+ bro = void 0,
2930
+ _carriedRowspans = [],
2931
+ currentCell = void 0;
2932
+
2933
+ for (var i = 0; i < maxAmountOfCells; i++) {
2934
+ _carriedRowspans.push(0);
2935
+ }
2936
+
2937
+ for (var i = 0; i < rows.length; i++) {
2938
+ cellPointer = 0;
2939
+ cellsBuffer = rows[i].getElementsByTagName('td');
2940
+ pendingInsertion = false;
2941
+ for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += _stepsToMove) {
2942
+ _stepsToMove = 1;
2943
+
2944
+ if (pendingInsertion) {
2945
+ td = new WPTB_Cell(mark);
2946
+ if (cellStyle) {
2947
+ td.getDOMElement().setAttribute('style', cellStyle);
2948
+ }
2949
+ if (currentCell && rows[i].contains(currentCell)) {
2950
+ bro = currentCell.nextSibling;
2951
+ if (bro) {
2952
+ rows[i].insertBefore(td.getDOMElement(), bro);
2953
+ } else {
2954
+ rows[i].appendChild(td.getDOMElement());
2955
+ }
2956
+ } else {
2957
+ rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);
2958
+ }
2959
+ break;
2960
+ } else if (_carriedRowspans[xPosition] > 0) {
2961
+ // If no pending insertion, let's check if no rowspan from upper cells is pending in current position
2962
+ if (pos == xPosition) {
2963
+ pendingInsertion = true;
2964
+ }
2965
+ } else {
2966
+ currentCell = cellsBuffer[cellPointer++];
2967
+ if (currentCell.rowSpan > 1) {
2968
+ _stepsToMove = currentCell.colSpan;
2969
+ for (var k = 0; k < currentCell.colSpan; k++) {
2970
+ _carriedRowspans[xPosition + k] = currentCell.rowSpan;
2971
+ if (xPosition + k == pos) {
2972
+ pendingInsertion = true;
2973
+ }
2974
+ }
2975
+ } else if (currentCell.colSpan > 1) {
2976
+ _stepsToMove = currentCell.colSpan;
2977
+ for (var k = 0; k < currentCell.colSpan; k++) {
2978
+ if (xPosition + k == pos) {
2979
+ pendingInsertion = true;
2980
+ }
2981
+ }
2982
+ } else if (xPosition == pos) {
2983
+ pendingInsertion = true;
2984
+ }
2985
+ }
2986
+ }
2987
+
2988
+ for (var l = 0; l < maxAmountOfCells; l++) {
2989
+ if (_carriedRowspans[l] > 0) _carriedRowspans[l]--;
2990
+ }
2991
+ }
2992
+
2993
+ for (var i = 0; i < array.length; i++) {
2994
+ array[i].push(0);
2995
+ }
2996
+ maxAmountOfCells++;
2997
+ drawTable(array);
2998
+ table.recalculateIndexes();
2999
+ WPTB_Helper.dataTitleColumnSet(table);
3000
+ undoSelect();
3001
+ }
3002
+ };
3003
+
3004
+ /*
3005
+ * For preventing us to take a lot of time,
3006
+ * This is just calling the function addColumnAfter, but
3007
+ * using the previous column to current one as reference.
3008
+ * @see addColumnAfter
3009
+ */
3010
+
3011
+ table.addColumnBefore = function () {
3012
+ var cell = document.querySelector('.wptb-highlighted'),
3013
+ pos = getCoords(cell)[1];
3014
+
3015
+ if (pos === 0) {
3016
+ table.addColumnStart();
3017
+ } else {
3018
+ table.addColumnAfter(pos - 1);
3019
+ }
3020
+ };
3021
+
3022
+ /*
3023
+ * Luckily, thisfunction is simple,
3024
+ * it just add a row to the end of table.
3025
+ */
3026
+
3027
+ table.addRowToTheEnd = function () {
3028
+ var r = table.insertRow(-1),
3029
+ td = void 0,
3030
+ aux = void 0,
3031
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
3032
+ currentTableTd = void 0,
3033
+ currentTdStyle = void 0;
3034
+ r.classList.add('wptb-row');
3035
+ if (currentTable.length > 0) {
3036
+ currentTableTd = currentTable[0].querySelector('td');
3037
+ }
3038
+
3039
+ if (currentTableTd) {
3040
+ currentTdStyle = currentTableTd.getAttribute('style');
3041
+ }
3042
+
3043
+ for (var i = 0; i < maxAmountOfCells; i++) {
3044
+ td = new WPTB_Cell(mark);
3045
+ if (currentTdStyle) {
3046
+ td.getDOMElement().setAttribute('style', currentTdStyle);
3047
+ }
3048
+ r.appendChild(td.getDOMElement());
3049
+ }
3050
+ aux = Array.from(array[0]);
3051
+ array.push(aux);
3052
+ drawTable(array);
3053
+ table.recalculateIndexes();
3054
+ WPTB_Helper.dataTitleColumnSet(table);
3055
+ undoSelect();
3056
+ };
3057
+
3058
+ /*
3059
+ * Yet another simple function,
3060
+ * it just add a row to the start of table.
3061
+ */
3062
+
3063
+ table.addRowToTheStart = function () {
3064
+ var r = table.insertRow(0),
3065
+ td = void 0,
3066
+ aux = void 0,
3067
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
3068
+ currentTableTd = void 0,
3069
+ currentTdStyle = void 0;
3070
+ r.classList.add('wptb-row');
3071
+ if (currentTable.length > 0) {
3072
+ currentTableTd = currentTable[0].querySelector('td');
3073
+ }
3074
+
3075
+ if (currentTableTd) {
3076
+ currentTdStyle = currentTableTd.getAttribute('style');
3077
+ }
3078
+
3079
+ for (var i = 0; i < maxAmountOfCells; i++) {
3080
+ td = new WPTB_Cell(mark);
3081
+ if (currentTdStyle) {
3082
+ td.getDOMElement().setAttribute('style', currentTdStyle);
3083
+ }
3084
+ r.appendChild(td.getDOMElement());
3085
+ }
3086
+ aux = Array.from(array[0]);
3087
+ array.push(aux);
3088
+ drawTable(array);
3089
+ table.recalculateIndexes();
3090
+ WPTB_Helper.dataTitleColumnSet(table);
3091
+ undoSelect();
3092
+ };
3093
+
3094
+ /*
3095
+ * This function adds a row before the current one.
3096
+ * Since the biggest factor of problem is a not-started but ongoing rowspan,
3097
+ * the most of the troubles is not here.
3098
+ */
3099
+
3100
+ table.addRowBefore = function () {
3101
+ var cell = document.querySelector('.wptb-highlighted'),
3102
+ cellStyle = cell.getAttribute('style'),
3103
+ row = getCoords(cell)[0],
3104
+ cellNew = void 0;
3105
+ for (var _i4 = row - 1; _i4 >= 0; _i4--) {
3106
+ var rowChildren = table.rows[_i4].children;
3107
+ var rowChildrenLength = rowChildren.length;
3108
+ if (rowChildrenLength > 0) {
3109
+ for (var _j = 0; _j < rowChildrenLength; _j++) {
3110
+ if (rowChildren[_j].rowSpan == 1) {
3111
+ row = _i4;
3112
+ cellNew = true;
3113
+ break;
3114
+ }
3115
+ }
3116
+ }
3117
+ if (cellNew) {
3118
+ break;
3119
+ }
3120
+ }
3121
+
3122
+ if (row === 0) {
3123
+ table.addRowToTheStart();
3124
+ } else {
3125
+ table.addRowAfter(row, cellStyle);
3126
+ }
3127
+ };
3128
+
3129
+ /*
3130
+ * Well... by the name convention of the previous 3 functions,
3131
+ * it's pretty obvious that this functions attaches a new
3132
+ * row after highlighted cell row. The greatest obstacle it was
3133
+ * the possibility of a TR not having the exact amount of columns
3134
+ * occuped by actual node but rowspanned upper cells. For that purpose
3135
+ * it was created the function realTimeArray.
3136
+ * @see realTimeArray
3137
+ */
3138
+
3139
+ table.addRowAfter = function (row, cellStyle) {
3140
+ var cellRowSpan = void 0,
3141
+ rowAfter = void 0,
3142
+ aux = void 0;
3143
+
3144
+ if ((row == undefined || typeof row !== 'number') && cellStyle == undefined) {
3145
+ var _cell = document.querySelector('.wptb-highlighted');
3146
+ cellStyle = _cell.getAttribute('style'), row = getCoords(_cell)[0], cellRowSpan = _cell.rowSpan, rowAfter = row + cellRowSpan - 1;
3147
+ } else {
3148
+ rowAfter = row;
3149
+ }
3150
+
3151
+ var cellsColSpan = 0;
3152
+ if (rowAfter < table.rows.length - 1) {
3153
+ for (var _i5 = 0; _i5 <= rowAfter; _i5++) {
3154
+ var tableRowsIChildren = table.rows[_i5].children,
3155
+ tableRIChildrenLength = tableRowsIChildren.length;
3156
+ if (tableRIChildrenLength > 0) {
3157
+ for (var _j2 = 0; _j2 < tableRIChildrenLength; _j2++) {
3158
+ var rowIRowSpan = tableRowsIChildren[_j2].rowSpan;
3159
+
3160
+ if (rowIRowSpan - 1 + _i5 > rowAfter) {
3161
+ tableRowsIChildren[_j2].rowSpan++;
3162
+ }
3163
+ }
3164
+ }
3165
+ }
3166
+
3167
+ var rNext = table.rows[rowAfter + 1],
3168
+ rNextChildren = rNext.children,
3169
+ rNextChildrenLength = rNextChildren.length;
3170
+
3171
+ if (rNextChildrenLength > 0) {
3172
+ for (var _i6 = 0; _i6 < rNextChildrenLength; _i6++) {
3173
+ cellsColSpan += rNextChildren[_i6].colSpan;
3174
+ }
3175
+ }
3176
+ } else {
3177
+ cellsColSpan = array[0].length;
3178
+ }
3179
+
3180
+ var r = table.insertRow(rowAfter + 1);
3181
+ r.classList.add('wptb-row');
3182
+
3183
+ for (j = 0; j < cellsColSpan; j++) {
3184
+ var td = new WPTB_Cell(mark);
3185
+ td.getDOMElement().setAttribute('style', cellStyle);
3186
+ r.appendChild(td.getDOMElement());
3187
+ }
3188
+
3189
+ aux = Array.from(array[0]);
3190
+ array.push(aux);
3191
+ drawTable(array);
3192
+ table.recalculateIndexes();
3193
+ WPTB_Helper.dataTitleColumnSet(table);
3194
+ undoSelect();
3195
+ };
3196
+
3197
+ /*
3198
+ * This function checks the current selected cells
3199
+ * make a rectangular shape.
3200
+ * @param Array the abstract table.
3201
+ * @return false, if not making a rectangle, or
3202
+ * Array an array containing number of rows and columns, if selection makes a rectangle.
3203
+ */
3204
+
3205
+ table.isSquare = function (a) {
3206
+ var rowStart = -1,
3207
+ columnStart = -1,
3208
+ rowEnd = -1,
3209
+ columnEnd = -1,
3210
+ height,
3211
+ width,
3212
+ itemsEstimate = 0,
3213
+ items = 0;
3214
+
3215
+ for (var i = 0; i < a.length; i++) {
3216
+ for (var j = 0; j < a[i].length; j++) {
3217
+ if (a[i][j] == 1) {
3218
+ if (j < columnStart || columnStart == -1) {
3219
+ columnStart = j;
3220
+ }
3221
+ if (i < rowStart || rowStart == -1) {
3222
+ rowStart = i;
3223
+ }
3224
+ }
3225
+ }
3226
+ }
3227
+
3228
+ for (var i = a.length - 1; i > -1; i--) {
3229
+ for (var j = a[i].length - 1; j > -1; j--) {
3230
+ if (a[i][j] == 1) {
3231
+ if (j > columnEnd) {
3232
+ columnEnd = j;
3233
+ }
3234
+ if (i > rowEnd) {
3235
+ rowEnd = i;
3236
+ }
3237
+ }
3238
+ }
3239
+ }
3240
+
3241
+ for (var i = rowStart; i < rowEnd; i++) {
3242
+ for (var j = columnStart; j < columnEnd; j++) {
3243
+ if (a[i][j] == 0 || a[i][j] == undefined) {
3244
+ return false;
3245
+ }
3246
+ }
3247
+ }
3248
+
3249
+ for (var i = 0; i < a.length; i++) {
3250
+ for (var j = 0; j < a[i].length; j++) {
3251
+ if (a[i][j] == 1) {
3252
+ items++;
3253
+ }
3254
+ }
3255
+ }
3256
+
3257
+ height = rowEnd - rowStart + 1;
3258
+ width = columnEnd - columnStart + 1;
3259
+ itemsEstimate = height * width;
3260
+
3261
+ if (itemsEstimate !== items) {
3262
+ return false;
3263
+ }
3264
+ return [height, width];
3265
+ };
3266
+
3267
+ /*
3268
+ * This function merges all selected cells.
3269
+ * Well, actually sets the colspan and rowspan of first
3270
+ * upper left cell in selection and deletes the another selected cells.
3271
+ */
3272
+
3273
+ table.mergeCells = function () {
3274
+ var dimensions = table.isSquare(array),
3275
+ rowspan = dimensions[0],
3276
+ colspan = dimensions[1],
3277
+ first = document.querySelector('.wptb-highlighted'),
3278
+ tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),
3279
+ tdsChildrenNew = [];
3280
+
3281
+ for (var _i7 = 0; _i7 < tds.length; _i7++) {
3282
+ var tdsInternalElements = tds[_i7].getElementsByClassName('wptb-ph-element');
3283
+ if (tdsInternalElements.length > 0) {
3284
+ var tdsIntElemLength = tdsInternalElements.length;
3285
+ for (var _j3 = 0; _j3 < tdsIntElemLength; _j3++) {
3286
+ tdsChildrenNew.push(tdsInternalElements[_j3]);
3287
+ }
3288
+ }
3289
+ var p = tds[_i7].parentNode;
3290
+ p.removeChild(tds[_i7]);
3291
+ }
3292
+ if (tdsChildrenNew.length > 0) {
3293
+ for (var _i8 = 0; _i8 < tdsChildrenNew.length; _i8++) {
3294
+ first.appendChild(tdsChildrenNew[_i8]);
3295
+ }
3296
+ }
3297
+
3298
+ first.colSpan = colspan;
3299
+ first.rowSpan = rowspan;
3300
+ table.recalculateIndexes();
3301
+ WPTB_Helper.dataTitleColumnSet(table);
3302
+ undoSelect();
3303
+ };
3304
+
3305
+ /*
3306
+ * This functions makes the exact inverse as above.
3307
+ * It resets colspan and rowspan and appends
3308
+ * the same amount in cells to the table.
3309
+ * @bug
3310
+ */
3311
+
3312
+ table.splitCell = function () {
3313
+ var cell = document.getElementsByClassName('wptb-highlighted')[0],
3314
+ rowspan = cell.rowSpan,
3315
+ colspan = cell.colSpan,
3316
+ cellStyles = cell.getAttribute('style'),
3317
+ row = getCoords(cell)[0],
3318
+ thisRow = table.rows[row],
3319
+ cellXIndex = cell.dataset.xIndex;
3320
+
3321
+ cell.rowSpan = 1;
3322
+ cell.colSpan = 1;
3323
+
3324
+ for (var _i9 = 1; _i9 < colspan; _i9++) {
3325
+ var td = new WPTB_Cell(mark);
3326
+ td.getDOMElement().setAttribute('style', cellStyles);
3327
+ if (cell.nextSibling) {
3328
+ thisRow.insertBefore(td.getDOMElement(), cell.nextSibling);
3329
+ } else {
3330
+ thisRow.appendChild(td.getDOMElement());
3331
+ }
3332
+ }
3333
+
3334
+ if (rowspan > 1) {
3335
+ for (var _i10 = 1; _i10 < rowspan; _i10++) {
3336
+ var rowChildInsertBefore = undefined,
3337
+ rowNext = table.rows[row + _i10],
3338
+ rowChildren = rowNext.children,
3339
+ rowChildrenLength = rowChildren.length;
3340
+
3341
+ if (rowChildrenLength > 0) {
3342
+ for (var _k3 = 0; _k3 < rowChildrenLength; _k3++) {
3343
+ if (Number(rowChildren[_k3].dataset.xIndex) > Number(cellXIndex)) {
3344
+ rowChildInsertBefore = rowChildren[_k3];
3345
+ break;
3346
+ }
3347
+ }
3348
+ }
3349
+ for (var _j4 = 0; _j4 < colspan; _j4++) {
3350
+ var _td = new WPTB_Cell(mark);
3351
+ _td.getDOMElement().setAttribute('style', cellStyles);
3352
+ if (rowChildInsertBefore != undefined) {
3353
+ rowNext.insertBefore(_td.getDOMElement(), rowChildInsertBefore);
3354
+ } else {
3355
+ rowNext.appendChild(_td.getDOMElement());
3356
+ }
3357
+ }
3358
+ }
3359
+ }
3360
+
3361
+ table.recalculateIndexes();
3362
+ WPTB_Helper.dataTitleColumnSet(table);
3363
+ undoSelect();
3364
+ };
3365
+
3366
+ /*
3367
+ * Searches for rowspanned cells up to row number meeting it.
3368
+ * @param number the number of row where the function
3369
+ * must search up to.
3370
+ */
3371
+
3372
+ table.findRowspannedCells = function (row) {
3373
+ var array = [],
3374
+ difference;
3375
+ actualPoints = getActualPointsInRow(row);
3376
+ if (actualPoints === maxAmountOfCells) {
3377
+ return [];
3378
+ }
3379
+ difference = maxAmountOfCells - actualPoints;
3380
+
3381
+ for (var i = row - 1; i >= 0 && difference; i--) {
3382
+ var tds = table.rows[i].getElementsByTagName('td');
3383
+ for (var i = 0; i < tds.length; i++) {
3384
+ if (tds[i].rowSpan > 1) {
3385
+ array.push(tds[i]);
3386
+ difference -= tds[i].colSpan;
3387
+ }
3388
+ }
3389
+ }
3390
+ return array;
3391
+ };
3392
+
3393
+ /*
3394
+ * This function explores the table and adds
3395
+ * a cell for each lacking one for each row
3396
+ * to meet an even amount of cells.
3397
+ */
3398
+
3399
+ table.addLackingCells = function () {
3400
+ var sumRows = [];
3401
+ for (var i = 0; i < table.rows.length; i++) {
3402
+ sumRows.push(0);
3403
+ }
3404
+
3405
+ for (var i = 0; i < table.rows.length; i++) {
3406
+ var tds = table.rows[i].getElementsByTagName('td');
3407
+ for (var j = 0; j < tds.length; j++) {
3408
+ if (tds[j].rowSpan > 1) {
3409
+ for (var k = 1; k < tds[j].rowSpan; k++) {
3410
+ sumRows[i + k]++;
3411
+ }
3412
+ }
3413
+ }
3414
+ }
3415
+
3416
+ for (var i = 0; i < table.rows.length; i++) {
3417
+ var tds = table.rows[i].getElementsByTagName('td'),
3418
+ totalColspan = 0;
3419
+ for (var j = 0; j < tds.length; j++) {
3420
+ totalColspan += tds[j].colSpan;
3421
+ }
3422
+ totalColspan += sumRows[i];
3423
+ difference = maxAmountOfCells - totalColspan;
3424
+ for (var j = 0; j < difference; j++) {
3425
+ var td = new WPTB_Cell(mark);
3426
+ table.rows[i].appendChild(td.getDOMElement());
3427
+ //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );
3428
+ }
3429
+ }
3430
+ };
3431
+
3432
+ /*
3433
+ * This function deletes the row of currently
3434
+ * selected cell.
3435
+ */
3436
+
3437
+ table.deleteRow = function () {
3438
+ var cell = document.querySelector('.wptb-highlighted'),
3439
+ cellStyles = cell.getAttribute('style'),
3440
+ rowspan = cell.rowSpan,
3441
+ row = getCoords(cell)[0],
3442
+ thisRow = void 0,
3443
+ aux = void 0;
3444
+
3445
+ if (rowspan == undefined) rowspan = 1;
3446
+
3447
+ for (var _i11 = 0; _i11 < rowspan; _i11++) {
3448
+ thisRow = table.rows[row];
3449
+ var thisRowChildren = thisRow.children,
3450
+ nextRow = table.rows[row + 1],
3451
+ nextRowChildren = void 0,
3452
+ nextRowChildrenLength = void 0,
3453
+ tdArr = [];
3454
+
3455
+ if (nextRow != undefined) {
3456
+ nextRowChildren = nextRow.children;
3457
+ nextRowChildrenLength = nextRowChildren.length;
3458
+ for (var _j5 = 0; _j5 < thisRowChildren.length; _j5++) {
3459
+ if (thisRowChildren[_j5].rowSpan > 1) {
3460
+ var td = new WPTB_Cell(mark);
3461
+ td.getDOMElement().setAttribute('style', cellStyles);
3462
+ td.getDOMElement().colSpan = thisRowChildren[_j5].colSpan;
3463
+ td.getDOMElement().rowSpan = thisRowChildren[_j5].rowSpan - 1;
3464
+
3465
+ var nextRowChildrenK = undefined;
3466
+ for (var _k4 = 0; _k4 < nextRowChildrenLength; _k4++) {
3467
+ if (Number(nextRowChildren[_k4].dataset.xIndex) > Number(thisRowChildren[_j5].dataset.xIndex)) {
3468
+ nextRowChildrenK = nextRowChildren[_k4];
3469
+ break;
3470
+ }
3471
+ }
3472
+
3473
+ if (nextRowChildrenK) {
3474
+ tdArr.push([td, nextRowChildrenK]);
3475
+ } else {
3476
+ tdArr.push([td]);
3477
+ }
3478
+ }
3479
+ }
3480
+
3481
+ if (tdArr.length > 0) {
3482
+ for (var _k5 = 0; _k5 < tdArr.length; _k5++) {
3483
+ if (tdArr[_k5][1] != undefined) {
3484
+ nextRow.insertBefore(tdArr[_k5][0].getDOMElement(), tdArr[_k5][1]);
3485
+ } else {
3486
+ nextRow.appendChild(tdArr[_k5][0].getDOMElement());
3487
+ }
3488
+ }
3489
+ }
3490
+ }
3491
+
3492
+ var tableRows = table.rows;
3493
+ if (tableRows.length > 0) {
3494
+ for (var _j6 = 0; _j6 < row; _j6++) {
3495
+ var jRowChildren = tableRows[_j6].children;
3496
+ if (jRowChildren.length > 0) {
3497
+ for (var x = 0; x < jRowChildren.length; x++) {
3498
+ if (jRowChildren[x].rowSpan - 1 >= row - _j6) {
3499
+ jRowChildren[x].rowSpan--;
3500
+ }
3501
+ }
3502
+ }
3503
+ }
3504
+ }
3505
+ aux = Array.from(array[0]);
3506
+ array.pop(aux);
3507
+ drawTable(array);
3508
+ table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);
3509
+
3510
+ if (table.rows.length == 0) {
3511
+ table.toggleTableEditMode();
3512
+ wptbTableSetup.innerHTML = '';
3513
+ WPTB_Helper.settingsPanelClear();
3514
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
3515
+ }
3516
+
3517
+ table.recalculateIndexes();
3518
+ WPTB_Helper.dataTitleColumnSet(table);
3519
+ }
3520
+ undoSelect();
3521
+ };
3522
+
3523
+ /*
3524
+ * This function deletes the column of currently
3525
+ * selected cell. Again, this is way more complicated than
3526
+ * delete row case.
3527
+ */
3528
+
3529
+ table.deleteColumn = function () {
3530
+ var cell = document.querySelector('.wptb-highlighted'),
3531
+ cellXIndex = cell.dataset.xIndex,
3532
+ colspan = cell.colSpan;
3533
+
3534
+ for (var _i12 = 0; _i12 < colspan; _i12++) {
3535
+ for (var _j7 = 0; _j7 < table.rows.length; _j7++) {
3536
+ var rowChildren = table.rows[_j7].children;
3537
+ var rowChildrenLength = rowChildren.length;
3538
+ if (rowChildrenLength > 0) {
3539
+ for (var _k6 = rowChildrenLength - 1; _k6 >= 0; _k6--) {
3540
+ if (Number(rowChildren[_k6].dataset.xIndex) == Number(cellXIndex)) {
3541
+ if (rowChildren[_k6].colSpan > 1) {
3542
+ rowChildren[_k6].colSpan--;
3543
+ } else {
3544
+ table.rows[_j7].removeChild(rowChildren[_k6]);
3545
+ }
3546
+ break;
3547
+ } else if (Number(rowChildren[_k6].dataset.xIndex) < Number(cellXIndex) && Number(rowChildren[_k6].dataset.xIndex) + Number(rowChildren[_k6].colSpan - 1) >= cellXIndex) {
3548
+ if (rowChildren[_k6].colSpan > 1) {
3549
+ rowChildren[_k6].colSpan--;
3550
+ }
3551
+ break;
3552
+ }
3553
+ }
3554
+ }
3555
+ }
3556
+
3557
+ for (var _j8 = 0; _j8 < table.rows.length; _j8++) {
3558
+ if (array[_j8] != undefined) array[_j8].pop();
3559
+ }
3560
+
3561
+ maxAmountOfCells--;
3562
+
3563
+ if (table.querySelectorAll('td').length == 0) {
3564
+ table.toggleTableEditMode();
3565
+ wptbTableSetup.innerHTML = '';
3566
+ WPTB_Helper.settingsPanelClear();
3567
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
3568
+ }
3569
+
3570
+ table.recalculateIndexes();
3571
+ WPTB_Helper.dataTitleColumnSet(table);
3572
+ }
3573
+ undoSelect();
3574
+ };
3575
+
3576
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';
3577
+
3578
+ array = fillTableArray();
3579
+
3580
+ undoSelect();
3581
+ drawTable(array);
3582
+
3583
+ wptbTableSetup.appendChild(table);
3584
+ //if (columns || rows) {
3585
+ table.recalculateIndexes(true);
3586
+ //}
3587
+
3588
+ WPTB_LeftPanel();
3589
+
3590
+ // this code gets the ID of the active element in the toolbar
3591
+ // and stores it in the data attribute of the common container element "wpcd_fixed_toolbar"
3592
+ // let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );
3593
+ // let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );
3594
+ // for ( let i = 0; i < wptbPhElement.length; i++ ) {
3595
+ // wptbPhElement[i].addEventListener( 'click', function( e ) {
3596
+ // let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;
3597
+ // for ( let j = 0; j < wptbToolbar.length; j++ ) {
3598
+ // let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );
3599
+ // if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {
3600
+ // wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );
3601
+ // }
3602
+ // }
3603
+ // }, false );
3604
+ // }
3605
+
3606
+ // let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );
3607
+ // if( wptbPanelLeft.length > 0 ) {
3608
+ // wptbPanelLeft[0].addEventListener( 'click', function( e ) {
3609
+ // let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;
3610
+ // document.getElementById( toolbarActiveElementId ).style.display = '';
3611
+ // }, false );
3612
+ // }
3613
+
3614
+ // let body = document.getElementsByTagName( 'body' );
3615
+ // if( body.length > 0 ) {
3616
+ // body[0].addEventListener( 'click', function( e ) {
3617
+ // if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {
3618
+ // let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;
3619
+ // document.getElementById( toolbarActiveElementId ).style.display = '';
3620
+ // }
3621
+ // }, false );
3622
+ // }
3623
+ };
3624
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
3625
+
3626
+ var WPTB_Text = function WPTB_Text(text, DOMElementProt) {
3627
+ var DOMElement = document.createElement('div'),
3628
+ elText2 = document.createElement('div'),
3629
+ elP = document.createElement('p'),
3630
+ kindIndexProt = undefined,
3631
+ copy = false;
3632
+
3633
+ DOMElement.classList.add('wptb-text-container');
3634
+
3635
+ elP.innerHTML = text != undefined ? text : 'Text';
3636
+ elText2.appendChild(elP);
3637
+ DOMElement.appendChild(elText2);
3638
+ if (DOMElementProt) {
3639
+ var wptbElementMutch = DOMElementProt.className.match(/wptb-element-((.+-)\d+)/i);
3640
+ if (wptbElementMutch && Array.isArray(wptbElementMutch)) {
3641
+ kindIndexProt = wptbElementMutch[1];
3642
+ copy = true;
3643
+ };
3644
+
3645
+ var attributes = [].concat(_toConsumableArray(DOMElementProt.attributes));
3646
+ for (var i = 0; i < attributes.length; i++) {
3647
+ DOMElement.setAttribute(attributes[i].name, attributes[i].value);
3648
+ }
3649
+ }
3650
+
3651
+ this.kind = 'text';
3652
+ this.getDOMElement = function () {
3653
+ return DOMElement;
3654
+ };
3655
+ applyGenericItemSettings(this, kindIndexProt, copy);
3656
+
3657
+ return this;
3658
+ };
3659
+ var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
3660
+
3661
+ function newElementProxy(el) {
3662
+ if (el == 'list') {
3663
+ return new WPTB_List();
3664
+ } else if (el == 'image') {
3665
+ return new WPTB_Image();
3666
+ } else if (el == 'text') {
3667
+ return new WPTB_Text();
3668
+ } else if (el == 'button') {
3669
+ return new WPTB_Button();
3670
+ }
3671
+ }
3672
+
3673
+ element.ondragenter = function (e) {
3674
+ var div;
3675
+ if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
3676
+ return;
3677
+ }
3678
+ WPTB_DropHandle(this, e);
3679
+
3680
+ element.classList.add('wptb-ondragenter');
3681
+ };
3682
+ element.ondragover = function (e) {
3683
+ e.preventDefault();
3684
+ WPTB_DropHandle(this, e);
3685
+ };
3686
+ element.ondragleave = function () {};
3687
+ element.ondrop = function (e) {
3688
+ this.classList.remove('wptb-ondragenter');
3689
+ var element = void 0,
3690
+ classId = void 0;
3691
+ e.preventDefault();
3692
+ e.stopPropagation();
3693
+
3694
+ if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
3695
+ return;
3696
+ }
3697
+ var wptbDropHandle = void 0,
3698
+ wptbDropBorderMarker = void 0;
3699
+ if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
3700
+ wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
3701
+ }
3702
+ if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
3703
+ wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
3704
+ }
3705
+
3706
+ if (e.dataTransfer.getData('wptbElement')) {
3707
+ element = newElementProxy(e.dataTransfer.getData('wptbElement'));
3708
+ element = element.getDOMElement();
3709
+ } else {
3710
+ classId = e.dataTransfer.getData('node');
3711
+ element = document.getElementsByClassName(classId)[0];
3712
+ element.classList.remove('wptb-moving-mode');
3713
+ }
3714
+
3715
+ if (wptbDropHandle.style.display == 'block') {
3716
+ var td = void 0;
3717
+ if (wptbDropHandle.dataset.text == 'Drop Here') {
3718
+ td = wptbDropHandle.getDOMParentElement();
3719
+ td.appendChild(element);
3720
+ } else {
3721
+ var innerElement = wptbDropHandle.getDOMParentElement();
3722
+ td = innerElement.parentNode;
3723
+
3724
+ if (wptbDropHandle.dataset.text == 'Abowe Element') {
3725
+ td.insertBefore(element, innerElement);
3726
+ } else if (wptbDropHandle.dataset.text == 'Below Element') {
3727
+ var innerElementNext = innerElement.nextSibling;
3728
+ td.insertBefore(element, innerElementNext);
3729
+ }
3730
+ }
3731
+ var thisRow = td.parentNode;
3732
+ if (thisRow.classList.contains('wptb-table-head')) {
3733
+ var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
3734
+ WPTB_Helper.dataTitleColumnSet(table);
3735
+ }
3736
+ } else {
3737
+ return;
3738
+ }
3739
+
3740
+ wptbDropHandle.style.display = 'none';
3741
+ wptbDropBorderMarker.style.display = 'none';
3742
+
3743
+ WPTB_innerElementSet(element);
3744
+
3745
+ return true;
3746
+ };
3747
+ element.onmouseover = function (e) {
3748
+ element.classList.remove('wptb-ondragenter');
3749
+ };
3750
+ };
3751
+ var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
3752
+ var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3753
+
3754
+ var node = element.getDOMElement(),
3755
+ index,
3756
+ listItems,
3757
+ copy;
3758
+
3759
+ if (kindIndexProt == undefined || copy == true) {
3760
+ index = document.counter.nextIndex(element.kind);
3761
+ var wptbElements = document.getElementsByClassName('wptb-ph-element');
3762
+ var elementIndexesArr = [];
3763
+ for (var i = 0; i < wptbElements.length; i++) {
3764
+ var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
3765
+ var infArr = wptbElements[i].className.match(regex);
3766
+ if (infArr) {
3767
+ elementIndexesArr.push(infArr[1]);
3768
+ }
3769
+ }
3770
+ if (elementIndexesArr.length > 0) {
3771
+ var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
3772
+ index = elementIndexMax + 1;
3773
+ } else {
3774
+ index = 1;
3775
+ }
3776
+ } else if (kindIndexProt && !copy) {
3777
+ index = kindIndexProt.split('-')[1];
3778
+ }
3779
+
3780
+ node.onmouseenter = function (event) {
3781
+ this.classList.add('wptb-directlyhovered');
3782
+ var btnDelete = document.createElement('span'),
3783
+ btnCopy = document.createElement('span'),
3784
+ btnMove = document.createElement('span'),
3785
+ actions = document.createElement('span'),
3786
+ i = void 0;
3787
+
3788
+ actions.classList.add('wptb-actions');
3789
+ btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
3790
+ btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
3791
+ btnMove.classList.add("dashicons", "dashicons-move", 'wptb-move-action');
3792
+ btnMove.draggable = true;
3793
+ btnDelete.onclick = function (event) {
3794
+ var act = this.parentNode.parentNode,
3795
+ el = act.parentNode;
3796
+ el.removeChild(act);
3797
+
3798
+ if (act.kind == 'text') {
3799
+ var thisRow = el.parentNode;
3800
+ if (thisRow.classList.contains('wptb-table-head')) {
3801
+ var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
3802
+ WPTB_Helper.dataTitleColumnSet(table);
3803
+ }
3804
+ }
3805
+ };
3806
+ btnCopy.onclick = function (event) {
3807
+ var copy = void 0;
3808
+ if (element.kind == 'list') {
3809
+ var td = event.target.parentNode.parentNode.parentNode,
3810
+ temp = [],
3811
+ srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');
3812
+
3813
+ for (var i = 0; i < srcList.length; i++) {
3814
+ temp.push(srcList[i].innerHTML);
3815
+ }
3816
+
3817
+ copy = new WPTB_List(temp, node);
3818
+
3819
+ node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
3820
+ } else if (element.kind == 'text') {
3821
+ var td = event.target.parentNode.parentNode.parentNode;
3822
+ copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);
3823
+
3824
+ node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
3825
+ } else if (element.kind == 'image') {
3826
+ var td = event.target.parentNode.parentNode.parentNode;
3827
+ copy = new WPTB_Image(event.target.parentNode.parentNode.children[0].children[0].src, node);
3828
+
3829
+ node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
3830
+ } else {
3831
+ var td = event.target.parentNode.parentNode.parentNode,
3832
+ text = event.target.parentNode.parentNode.childNodes[0].querySelector('p').innerHTML;
3833
+ copy = new WPTB_Button(text, node);
3834
+
3835
+ node.parentNode.insertBefore(copy.getDOMElement(), node.nextSibling);
3836
+ }
3837
+
3838
+ WPTB_innerElementSet(copy.getDOMElement());
3839
+ };
3840
+ var parent = this,
3841
+ infArr = void 0,
3842
+ type = void 0;
3843
+ infArr = parent.className.match(/wptb-element-(.+)-(\d+)/i);
3844
+ type = infArr[1];
3845
+ var dragImagesArr = WPTB_Helper.dragImagesArr();
3846
+ btnMove.ondragstart = function (event) {
3847
+ this.parentNode.style.opacity = 0;
3848
+ parent.classList.remove('wptb-directlyhovered');
3849
+ parent.classList.add('wptb-moving-mode');
3850
+
3851
+ event.dataTransfer.setDragImage(dragImagesArr[type], 0, 0);
3852
+ event.dataTransfer.setData('node', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
3853
+ event.dataTransfer.setData('wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2]);
3854
+ event.dataTransfer.setData('wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1]);
3855
+ var act = event.target.parentNode.parentNode;
3856
+ if (act.kind == 'text') {
3857
+ var thisRow = el.parentNode;
3858
+ if (thisRow.classList.contains('wptb-table-head')) {
3859
+ var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
3860
+ WPTB_Helper.dataTitleColumnSet(table);
3861
+ }
3862
+ }
3863
+ };
3864
+
3865
+ if (element.kind === 'button') {
3866
+ var a = node.querySelector('a'),
3867
+ target = a.querySelector('div');
3868
+ a.onclick = function (e) {
3869
+ e.preventDefault();
3870
+ };
3871
+ WPTB_Helper.buttonsTinyMceInit(target);
3872
+ } else if (element.kind === 'text') {
3873
+ tinyMCE.init({
3874
+ target: node.childNodes[0],
3875
+ inline: true,
3876
+ plugins: "link, paste",
3877
+ dialog_type: "modal",
3878
+ theme: 'modern',
3879
+ menubar: false,
3880
+ fixed_toolbar_container: '#wpcd_fixed_toolbar',
3881
+ paste_as_text: true,
3882
+ toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
3883
+ setup: function setup(ed) {
3884
+ ed.on('change', function (e) {
3885
+ var row = WPTB_Helper.findAncestor(node, 'wptb-row');
3886
+ if (row.classList.contains('wptb-table-head')) {
3887
+ var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
3888
+ WPTB_Helper.dataTitleColumnSet(table);
3889
+ }
3890
+ });
3891
+ },
3892
+ init_instance_callback: function init_instance_callback(editor) {
3893
+ window.currentEditor = editor;
3894
+ //editor.fire('focus');
3895
+ editor.on('focus', function (e) {
3896
+ var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
3897
+ if (window.currentEditor && document.getElementById('wptb_builder').scrollTop >= 55 && window.currentEditor.bodyElement.style.display != 'none') {
3898
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
3899
+ document.getElementById('wpcd_fixed_toolbar').style.right = totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2 + 'px';
3900
+ document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
3901
+ } else {
3902
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
3903
+ delete document.getElementById('wpcd_fixed_toolbar').style.right;
3904
+ delete document.getElementById('wpcd_fixed_toolbar').style.top;
3905
+ }
3906
+ });
3907
+ }
3908
+ });
3909
+ } else {
3910
+ listItems = node.getElementsByClassName('wptb-list-item-content');
3911
+ for (var _i = 0; _i < listItems.length; _i++) {
3912
+ WPTB_Helper.listItemsTinyMceInit(listItems[_i]);
3913
+ }
3914
+ }
3915
+
3916
+ actions.appendChild(btnMove);
3917
+ actions.appendChild(btnCopy);
3918
+ actions.appendChild(btnDelete);
3919
+ this.appendChild(actions);
3920
+ };
3921
+
3922
+ node.onmouseleave = function (event) {
3923
+ this.classList.remove('wptb-directlyhovered');
3924
+ var iter = 0;
3925
+ while (event.target.querySelector('.wptb-actions') && iter < 5) {
3926
+ event.target.querySelector('.wptb-actions').remove();
3927
+ iter++;
3928
+ }
3929
+ };
3930
+
3931
+ // Change data-title-column if the title was changed
3932
+ if (element.kind == 'text') {
3933
+ var observer = new MutationObserver(function (mutations) {
3934
+ var row = WPTB_Helper.findAncestor(node, 'wptb-row');
3935
+ if (row.classList.contains('wptb-table-head')) {
3936
+ var table = WPTB_Helper.findAncestor(row, 'wptb-preview-table');
3937
+ WPTB_Helper.dataTitleColumnSet(table);
3938
+ }
3939
+ });
3940
+ var config = { attributes: true, attributeFilter: ['style'] };
3941
+ observer.observe(element.getDOMElement(), config);
3942
+ }
3943
+
3944
+ var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
3945
+ if (node_wptb_element_kind_num) {
3946
+ node.classList.remove(node_wptb_element_kind_num[0]);
3947
+ }
3948
+ if (!node.classList.contains('wptb-ph-element')) {
3949
+ node.classList.add('wptb-ph-element');
3950
+ if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
3951
+ node.classList.add('wptb-element-' + element.kind + '-' + index);
3952
+ }
3953
+ } else {
3954
+ if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
3955
+ node.classList.add('wptb-element-' + element.kind + '-' + index);
3956
+ }
3957
+ }
3958
+ new WPTB_ElementOptions(element, index, kindIndexProt);
3959
+
3960
+ document.counter.increment(element.kind);
3961
+ };
3962
+
3963
+ //# sourceMappingURL=admin.js.map
inc/admin/js/admin.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_Text.js","WPTB_innerElementSet.js","applyGenericItemSettings.js","wptb-builder.js"],"names":["WPTB_Builder","table_id","WPTB_Helper","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","document","getElementById","value","getElementsByClassName","style","display","wptbTableSetupEl","appendChild","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","addEventListener","WPTB_Button","text","DOMElementProt","DOMElement","createElement","elButton","el_B","el_BDiv","kindIndexProt","undefined","copy","classList","add","innerHTML","wptbElementMutch","className","match","Array","isArray","attributesContainer","attributes","length","i","setAttribute","name","wptbButtonWrapper","querySelector","wptbButtonWrapAttributes","wptbButton","wptbButtonAttributes","kind","getDOMElement","applyGenericItemSettings","WPTB_Cell","callback","highlightRow","td","parentRow","parentNode","columnCount","parseInt","tds","getElementsByTagName","remove","classToAdd","ttd","highlightColumn","index","rowCount","table","tr","padding","jQuery","val","innerBorderWidth","border","draggable","onclick","WPTB_innerElementSet","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","split","wptbListItems","WPTB_ListItem","setCoords","y","x","el","dataset","yIndex","xIndex","getCoords","coords","appendElement","node","WPTB_DropHandle","thisElem","e","newElementProxy","includes","WPTB_List","WPTB_Image","WPTB_Text","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","body","ondragenter","ondragover","preventDefault","ondragleave","ondrop","element","dataTransfer","getData","getDOMParentElement","nodeName","toLowerCase","innerElement","insertBefore","innerElementNext","nextSibling","thisRow","contains","findAncestor","dataTitleColumnSet","wptbContainer","onscroll","localName","indics","types","notDragEnter","infArr","width","offsetWidth","height","offsetHeight","coordinatesElement","getBoundingClientRect","left","Number","top","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","WPTB_ElementOptions","elemIdClass","prop","cloneNode","properties","affectedEl","wptbButtonA","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","a","aTextAlign","textAlign","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","img","imgWidth","imageWidthInputRange","imageWidthInputNumber","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","querySelectorAll","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","push","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","Math","max","optionsClass","children","childNodes","buttons","size","n_Class","type","num","optionControls","wpColorPicker","change","event","ui","parent","target","classe","ps","number","toString","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","jc","id","listItems","parentNodeSettingItem","listItem","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","dragImagesArr","image","button","list","listItemsRecalculateIndex","ulElem","par","listStyleTypeIndex","listItemsTinyMceInit","tinyMCE","init","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","article","keyCode","duplicate","firstChild","innerText","pText","replace","trim","selectedText","getSelectionText","init_instance_callback","editor","window","currentEditor","totalWidth","scrollTop","bodyElement","position","right","buttonsTinyMceInit","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","getComputedStyle","rowHeadChildren","contentsForHeader","tdElements","textContentStyle","textContent","thisRowChildren","titleColumn","titleColumnFontSize","titleColumnColor","titleBackgroundColor","titleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","inputId","input","wpPickerContainer","removeChild","newInput","url","regex","RegExp","results","decodeURIComponent","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","wptbElementButtons","wptbTdBgColorSavedSet","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","clear","tableHeader","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbInnerBorderCheck","tableBorderColorSetArea","createMobileHeadForTable","thisEvent","ondragstart","setData","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","wpcdFixedToolbar","hasAttribute","innerElements","el_L","item","wptbListItemReturn","divcontent","styleDot","listItemKeyListener","onmouseenter","btnDelete","btnCopy","actions","previous","action","content","html","setTimeout","append","onmouseleave","iter","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","cell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","div","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","effectAllowed","ondragend","shortcodePopupWindow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","elSpaceBetween","spaceBetween","stopPropagation","t_space","spaceParent","alert","codeMain","tableColumns","reconstraction","colSpan","rowSpan","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActions","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","row","maxAmountOfCells","maxAmountOfRows","mark","cs","markedCells","noCells","singleCells","multipleCells","column","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","tdsArr","jMainIter","z","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","rowspan","colspan","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","elText2","elP","classId","onmouseover","wptbElements","elementIndexesArr","elementIndexMax","btnMove","act","temp","srcList","opacity","setDragImage","observer","MutationObserver","mutations","config","attributeFilter","observe","node_wptb_element_kind_num"],"mappings":"AAAA,CAAC,YAAY;AACT,QAAIA,eAAe,SAAfA,YAAe,GAAY;AAC3B,YAAIC,WAAWC,YAAYC,UAAZ,EAAf;AACA,YAAKF,QAAL,EAAgB;AACZ,gBAAIG,OAAO,IAAIC,cAA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iB,KAAhE,CAAN,EAAgF;AAC5E+B,iBAAKnE,SAAL,CAAeC,GAAf,CAAoB,kBAAkBuF,QAAQrE,IAA1B,GAAiC,GAAjC,GAAuCiB,KAA3D;AACH;AACJ;AACD,QAAI2F,mBAAJ,CAAyBvC,OAAzB,EAAkCpD,KAAlC,EAAyCvC,aAAzC;;AAEA7B,aAASa,OAAT,CAAiB+I,SAAjB,CAA2BpC,QAAQrE,IAAnC;AACH,CAnND;ACAA","file":"admin.js","sourcesContent":["(function () {\n var WPTB_Builder = function () {\n var table_id = WPTB_Helper.detectMode();\n if ( table_id ) {\n var http = new XMLHttpRequest(),\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\n http.open('GET', urlSet, true);\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n http.onreadystatechange = function (d) {\n if (this.readyState == 4 && this.status == 200) {\n var ans = JSON.parse(http.responseText);\n document.getElementById('wptb-setup-name').value = ans[0];\n \n if( ans[1] ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\n WPTB_Table();\n WPTB_LeftPanel();\n WPTB_Settings();\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n return;\n }\n };\n http.send(null);\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n})();","var WPTB_Button = function( text, DOMElementProt ) {\n \n var DOMElement = document.createElement('div'),\n elButton = document.createElement('div'),\n el_B = document.createElement('a'),\n el_BDiv = document.createElement( 'div' ),\n kindIndexProt = undefined,\n copy = false;\n\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\n elButton.classList.add('wptb-button-wrapper');\n el_BDiv.classList.add('wptb-button');\n el_BDiv.innerHTML = text != undefined ? text : 'Button Text';\n \n // Creation of a new button when copying to avoid errors when assigning new event handlers.\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n }; \n var attributesContainer = [...DOMElementProt.attributes];\n if ( attributesContainer.length > 0 ) {\n for( let i = 0; i < attributesContainer.length; i++ ) {\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\n } \n }\n \n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\n if ( wptbButtonWrapper ) {\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\n if ( wptbButtonWrapAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\n if ( wptbButtonWrapAttributes[i].name == 'style') {\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\n }\n } \n }\n }\n \n var wptbButton = DOMElementProt.querySelector( 'a' );\n if ( wptbButton ) {\n var wptbButtonAttributes = [...wptbButton.attributes];\n if ( wptbButtonAttributes.length > 0 ) {\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\n if ( wptbButtonAttributes[i].name == 'style' || \n wptbButtonAttributes[i].name == 'href' || \n wptbButtonAttributes[i].name == 'target' ) {\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\n }\n } \n }\n }\n }\n \n elButton.appendChild(el_B);\n el_B.appendChild( el_BDiv );\n DOMElement.appendChild(elButton);\n \n \n \n this.kind = 'button';\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n applyGenericItemSettings( this, kindIndexProt, copy );\n\n return this;\n};","var WPTB_Cell = function (callback, DOMElement) {\n\n function highlightRow(td) {\n var parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\n }\n for (var i = 0; i < columnCount; i++) {\n\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\n var ttd = parentRow.getElementsByTagName('td')[i];\n if (ttd !== td) {\n ttd.classList.add(classToAdd);\n }\n }\n }\n\n function highlightColumn(td) {\n\n var index,\n parentRow = td.parentNode;\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\n for (var i = 0; i < columnCount; i++) {\n if (parentRow.getElementsByTagName('td')[i] === td) {\n index = i;\n break;\n }\n }\n\n for (var i = 0; i < rowCount; i++) {\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\n var tr = table.getElementsByTagName('tr')[i];\n if (tr.getElementsByTagName('td')[index] !== td) {\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\n }\n }\n }\n \n if( ! DOMElement ) {\n DOMElement = document.createElement(\"td\");\n\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\n\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\n\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\n } \n\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\n }\n\n DOMElement.draggable = false;\n if ( callback ) {\n DOMElement.onclick = callback;\n }\n \n WPTB_innerElementSet( DOMElement );\n \n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\n \n if ( wptbPhElement.length > 0 ) {\n for( let i = 0; i < wptbPhElement.length; i++ ) {\n\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\n\n if ( wptbSpaceBetween.length > 0 ) {\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\n WPTB_Space( wptbSpaceBetween[j] );\n }\n }\n \n wptbPhElement[i].getDOMElement = function() {\n return wptbPhElement[i];\n }\n \n WPTB_innerElementSet( wptbPhElement[i] );\n \n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\n wptbPhElement[i].kind = wptbTypeElementArr[0];\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\n if ( wptbPhElement[i].kind == 'list' ) {\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\n if( wptbListItems.length > 0 ) {\n for ( let i = 0; i < wptbListItems.length; i++ ) {\n WPTB_ListItem( undefined, wptbListItems[i] );\n }\n }\n }\n }\n }\n }\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n this.setCoords = function (y, x) {\n var el = this.getDOMElement();\n el.dataset.yIndex = y;\n el.dataset.xIndex = x;\n };\n\n this.getCoords = function () {\n var coords,\n el = this.getDOMElement();\n coords.x = el.dataset.xIndex;\n coords.y = el.dataset.yIndex;\n return coords;\n };\n\n this.appendElement = function (node) {\n getDOMElement().appendChild(node);\n };\n\n return this;\n};","var WPTB_DropHandle = function (thisElem, e) {\n \n function newElementProxy(el) {\n if (el.includes('list')) {\n return new WPTB_List();\n } else if (el.includes('image')) {\n return new WPTB_Image();\n } else if (el.includes('text')) {\n return new WPTB_Text();\n } else if (el.includes('button')) {\n return new WPTB_Button();\n }\n }\n \n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\n wptbDropHandle = document.createElement( 'div' );\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\n \n wptbDropBorderMarker = document.createElement( 'div' );\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\n \n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\n \n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\n \n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\n \n let body = document.getElementsByTagName( 'body' );\n if ( body.length > 0 ) {\n body[0].appendChild( wptbDropHandle );\n body[0].appendChild( wptbDropBorderMarker );\n }\n \n wptbDropHandle.ondragenter = function () {\n\n }\n\n wptbDropHandle.ondragover = function (e) {\n e.preventDefault();\n }\n\n wptbDropHandle.ondragleave = function () {\n\n }\n wptbDropHandle.ondrop = function (e) {\n e.preventDefault();\n let element;\n \n if ( e.dataTransfer.getData('wptbElement') ) {\n element = newElementProxy( e.dataTransfer.getData('wptbElement') );\n element = element.getDOMElement();\n } else {\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\n element.classList.remove( 'wptb-moving-mode' );\n element.classList.remove( 'wptb-moving-into-same-elem' );\n }\n \n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n thisElem = wptbDropHandle.getDOMParentElement();\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n }\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n \n if( wptbDropHandle.dataset.text == 'Abowe Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n \n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet(element);\n }\n let wptbContainer = document.querySelector( '.wptb-container' );\n wptbContainer.onscroll = function() {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n } else {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\n return;\n }\n \n let thisRow;\n if ( thisElem.localName == 'td' ) {\n thisRow = thisElem.parentNode;\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\n thisRow = thisElem.parentNode.parentNode;\n }\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let indics = e.dataTransfer.types;\n let notDragEnter = false;\n for ( let i = 0; i < indics.length; i++ ) {\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\n if ( infArr && infArr[1] != 'text' ) {\n notDragEnter = true;\n break;\n }\n }\n if( notDragEnter ) {\n return;\n }\n }\n \n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = Number( coordinatesElement.left ),\n top;\n wptbDropHandle.style.left = left + 'px';\n \n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\n if( thisElem == elementDrag ) {\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\n } else {\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\n }\n }\n \n wptbDropHandle.getDOMParentElement = function() {\n return thisElem;\n }\n \n wptbDropHandle.style.display = 'block';\n wptbDropBorderMarker.style.display = 'block';\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\n top = Number( coordinatesElement.top ) - Number( 11 );\n wptbDropHandle.dataset.text = 'Abowe Element';\n if ( y > height/2 ) {\n top = Number( coordinatesElement.top ) + height - 1;\n wptbDropHandle.dataset.text = 'Below Element';\n }\n } else {\n wptbDropHandle.dataset.text = 'Drop Here';\n top = Number( coordinatesElement.top ) + height/2 - 5;\n }\n wptbDropHandle.style.top = top + 'px';\n\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\n\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\n wptbDropBorderMarkerTop.style.width = ( Number( thisElem.offsetWidth ) - Number( 1 ) ) + 'px';\n\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\n wptbDropBorderMarkerRight.style.height = ( Number( coordinatesElement.bottom ) - Number( coordinatesElement.top ) - 1 ) + 'px';\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\n\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\n\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\n}","var ElementCounters = function () {\n\n\tvar priv = [];\n\tpriv['text'] = 0;\n\tpriv['image'] = 0;\n\tpriv['list'] = 0;\n\tpriv['button'] = 0;\n\n\tthis.increment = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn;\n\t\t}\n\t\tpriv[key]++;\n\t}\n\n\tthis.nextIndex = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn priv[key] + 1;\n\t}\n\n\treturn this;\n\n};","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement(), elemIdClass;\n\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\n\n var properties = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < properties.length; i++) {\n properties[i].dataset.element = elemIdClass;\n }\n\n prop.classList.add(elemIdClass);\n document.getElementById(\"element-options-group\").appendChild(prop);\n \n if ( kindIndexProt ) {\n if ( element.kind == 'button' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\n wptbButtonWrapper,\n wptbButtonA,\n wptbButton,\n wptbSize;\n \n if ( affectedEl ) {\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\n }\n \n if( wptbSize && Array.isArray( wptbSize ) ) {\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\n \n for ( var i = 0; i < b.length; i++ ) {\n b[i].classList.remove( 'selected' );\n \n if ( b[i].innerHTML == wptbSize[1] ) {\n b[i].classList.add( 'selected' );\n }\n }\n }\n \n if( affectedEl ) {\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\n \n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\n \n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\n }\n \n if ( wptbButtonWrapper ) {\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\n selectOptionVal;\n \n if ( buttonAlignment == 'flex-start' ) {\n selectOptionVal = 'left';\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\n selectOptionVal = 'center';\n } else if ( buttonAlignment == 'flex-end' ) {\n selectOptionVal = 'right';\n }\n \n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == selectOptionVal ) {\n selectOption[i].selected = true;\n }\n }\n }\n \n if ( wptbButtonA.length > 0 ) {\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\n \n \n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\n \n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\n\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\n\n buttonHrefInput.value = buttonHref;\n\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\n buttonLinkTargetInput.checked = true;\n }\n \n buttotIdInput.value = buttonId;\n }\n \n if( wptbButton ) {\n let buttonTextColor = wptbButton[0].style.color,\n buttonColor = wptbButton[0].style.backgroundColor,\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\n \n \n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\n \n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\n \n }\n } else if ( element.kind == 'image' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\n if ( elementsA.length > 0 ) {\n let a = elementsA[0];\n\n if ( a ) {\n a.onclick = function( e ) {\n e.preventDefault();\n }\n // set select according to the alignment of the image\n let aTextAlign = a.style.textAlign,\n imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\n\n for ( let i = 0; i < selectOption.length; i++ ) {\n if ( selectOption[i].value == aTextAlign ) {\n selectOption[i].selected = true;\n }\n }\n\n // set text link for input field of setting panel\n let imageLinkHref = a.getAttribute( 'href' ),\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\n if ( imageLinkHref ) {\n inputImageLink.value = imageLinkHref;\n }\n\n // set checkbox for target of link \n let imageLinkTarget = a.getAttribute( 'target' ),\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\n\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\n\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\n\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\n imageLinkTargetInput.checked = true;\n }\n\n let img = a.getElementsByTagName( 'img' );\n if ( img.length > 0 ) {\n // set value for input fields of image size\n let imgWidth = img[0].style.width;\n if ( imgWidth ) {\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\n\n imageWidthInputRange.value = parseInt( imgWidth );\n imageWidthInputNumber.value = parseInt( imgWidth );\n }\n\n // set value for input field of alternative text image\n let imgAlternativeText = img[0].getAttribute('alt'),\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\n\n imageAlternativeTextInput.value = imgAlternativeText;\n }\n }\n }\n }\n } else if ( element.kind == 'text' ) {\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( affectedEl.length > 0 ) {\n let elementFontSize = affectedEl[0].style.fontSize,\n elementTextColor = affectedEl[0].style.color;\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\n\n textFontSizeInputRange.value = parseInt( elementFontSize );\n textFontSizeInputNumber.value = parseInt( elementFontSize );\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\n }\n } else if ( element.kind == 'list' ) {\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\n if ( elementList.length > 0 ) {\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\n \n let elementListItem = elementList[0].querySelectorAll( 'li' );\n if ( elementListItem.length > 0 ) {\n let listItemP = elementListItem[0].querySelector( 'p' );\n let listItemPClasses = listItemP.classList;\n //listItemPClasses = [...listItemPClasses];\n if ( listItemPClasses.length > 0 ) {\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\n if ( elementListClassSelect ) {\n elementListClassSelect.value = 'unordered';\n \n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\n for ( let i = 0; i < 10; i++ ) {\n if ( listIconSelectLabel.nodeType == '1' ) {\n break;\n } else {\n listIconSelectLabel = listIconSelectLabel.nextSibling;\n }\n }\n if ( listIconSelectLabel ) {\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\n listIconSelectLabel.style.display = 'flex';\n }\n \n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\n if ( elementListStyleTypeSelect ) {\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\n \n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\n elementListStyleTypeSelect.value = 'disc';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\n elementListStyleTypeSelect.value = 'circle';\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\n elementListStyleTypeSelect.value = 'square';\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\n elementListStyleTypeSelect.value = 'none';\n }\n }\n }\n }\n }\n \n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\n if ( elementListItemContent.length > 0 ) {\n let listItemPTextAlignArr = [];\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\n let p = elementListItemContent[i].querySelector( 'p' );\n if ( p ) {\n if ( p.style.textAlign ) {\n listItemPTextAlignArr.push( p.style.textAlign );\n } else {\n listItemPTextAlignArr.push( 'left' );\n }\n }\n \n }\n \n let listItemPTextAlignLeftCount = 0,\n listItemPTextAlignCenterCount = 0,\n listItemPTextAlignRightCount = 0;\n \n if ( listItemPTextAlignArr.length > 0 ) {\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\n if ( listItemPTextAlignArr[i] ) {\n if ( listItemPTextAlignArr[i] == 'left' ) {\n listItemPTextAlignLeftCount++;\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\n listItemPTextAlignCenterCount++;\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\n listItemPTextAlignRightCount++;\n }\n }\n }\n }\n \n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\n \n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'left';\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'center';\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\n elementListAlignmentSelect.value = 'right';\n }\n }\n } \n }\n }\n\n node.onclick = function () {\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\n optionsClass = '.wptb-' + infArr[2] + 'options' +\n '.wptb-options-' + infArr[1];\n\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\n document.getElementById(\"element-options-group\").style.display = 'block';\n\n var children = document.getElementById(\"element-options-group\").childNodes;\n for (var i = 0; i < children.length; i++) {\n if (children[i].style)\n children[i].style.display = 'none';\n }\n\n document.querySelector(optionsClass).style.display = 'block';\n\n //var listStyleType, textAlign;\n\n// switch (element.kind) {\n\n// case 'text':\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\n// prop.querySelector('[type=number][data-type=font-size]').value\n// = prop.querySelector('[type=range][data-type=font-size]').value\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\n// break;\n// case 'list':\n// textAlign = node.querySelector('li p').style.textAlign;\n// listStyleType = node.querySelector('li').style.listStyleType;\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\n// console.log(textAlign);\n// console.log(listStyleType);\n// console.log(listStyleType);\n// console.log(prop);\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\n// }\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\n// }\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\n// }\n// break;\n// case 'image':\n// break;\n// case 'button':\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\n// break;\n//\n// }\n };\n\n if (element.kind == 'button') {\n //We must add this special kind of property, since it is triggered with click event\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\n\n for (var i = 0; i < buttons.length; i++) {\n buttons[i].onclick = function () {\n var size = this.innerHTML,\n n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\n affectedEl.classList.remove('wptb-size-S');\n affectedEl.classList.remove('wptb-size-M');\n affectedEl.classList.remove('wptb-size-L');\n affectedEl.classList.remove('wptb-size-XL');\n affectedEl.classList.add('wptb-size-' + size);\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\n for (var i = 0; i < b.length; i++) {\n b[i].classList.remove('selected');\n }\n this.classList.add('selected');\n }\n }\n }\n\n var optionControls = prop.getElementsByClassName('wptb-element-property');\n\n for (var i = 0; i < optionControls.length; i++) {\n if (optionControls[i].classList.contains('wptb-color-picker')) {\n jQuery(optionControls[i]).wpColorPicker({\n change: function (event, ui) {\n var parent = event.target, classe, type, ps, number;\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\n type = classe[1];\n number = classe[2];\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];\n if ( type == 'button' ) {\n if (parent.dataset.type == 'button-text-color') {\n affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();\n } else {\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\n }\n } else if( type == 'list' ) {\n let ps = affectedEl.querySelectorAll( 'p' );\n if( ps.length > 0 ) {\n for ( let i = 0; i < ps.length; i++ ) {\n ps[i].style.color = ui.color.toString();\n }\n }\n } else {\n affectedEl.style.color = ui.color.toString();\n }\n }\n });\n }\n\n if (optionControls[i].dataset.type === 'font-size') {\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\n slider.oninput = function () {\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange();\n }\n }\n\n if (optionControls[i].dataset.type === 'image-size') {\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\n slider.oninput = function () {\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange();\n }\n }\n\n optionControls[i].onchange = function (event) {\n\n var n_Class = this.dataset.element,\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\n type = infArr[1],\n num = infArr[2],\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\n val = this.value;\n\n switch (this.dataset.type) {\n case 'src':\n var img = affectedEl.getElementsByTagName(\"img\")[0];\n img.src = this.value;\n break;\n case 'alternative-text':\n var img = affectedEl.getElementsByTagName('img')[0];\n img.alt = this.value;\n break;\n case 'image-link':\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n break;\n case 'image-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'image-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\n }\n break;\n case 'image-size':\n affectedEl.getElementsByTagName('img')[0].style.width = this.value + '%';\n affectedEl.getElementsByTagName('img')[0].style.height = 'auto';\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\n break;\n case 'image-alignment':\n affectedEl.getElementsByTagName( 'img' )[0].parentNode.style.textAlign = this.value;\n break;\n case 'font-size':\n affectedEl.style.fontSize = val + 'px';\n break;\n case 'button-alignment':\n var jc = '';\n if (this.value == 'left') {\n jc = 'start';\n } else if (this.value == 'right') {\n jc = 'flex-end';\n } else {\n jc = 'center';\n }\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\n break;\n case 'button-link':\n if ( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\n }\n break;\n case 'button-link-target':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\n } else {\n affectedEl.getElementsByTagName('a')[0].target = '_self';\n }\n break;\n case 'button-link-nofollow':\n if (this.checked == true) {\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\n } else {\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\n }\n break;\n case 'button-id':\n if( this.value ) {\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\n } else {\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\n }\n case 'button-color':\n break;\n case 'list-alignment':\n let listItems = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItems.length; i++) {\n let p = listItems[i].querySelector( 'p' );\n if ( p ) {\n p.style.textAlign = this.value;\n }\n }\n break;\n case 'list-class':\n let parentNode = event.target\n .parentNode\n .parentNode\n .querySelector('[data-type=list-style-type]')\n .parentNode,\n parentNodeSettingItem = parentNode.parentNode;\n if (val == 'unordered') {\n parentNode.style.display = 'flex';\n \n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\n let listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-disc' );\n }\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\n } else {\n parentNode.style.display = 'none';\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n }\n }\n break;\n case 'list-style-type':\n var listItem = affectedEl.querySelectorAll('li');\n for (var i = 0; i < listItem.length; i++) {\n let p = listItem[i].querySelector( 'p' );\n p.removeAttribute ( 'class' );\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\n }\n break;\n }\n }\n }\n};","var WPTB_Helper = {\n hexToRgb: function( hex ) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\n },\n rgbToHex: function ( rgb ) {\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\n\n return ( rgb && rgb.length === 4 ) ? \"#\" +\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\n },\n getDragImageCustom: function ( type ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\n return img;\n },\n dragImagesArr: function() {\n return {\n text: WPTB_Helper.getDragImageCustom( 'text' ),\n image: WPTB_Helper.getDragImageCustom( 'image' ),\n button: WPTB_Helper.getDragImageCustom( 'button' ),\n list: WPTB_Helper.getDragImageCustom( 'list' )\n };\n },\n listItemsRecalculateIndex: function( ulElem ) {\n let par = ulElem.querySelectorAll( 'p' );\n if ( par.length > 0 ) {\n for ( let i = 0; i < par.length; i++ ) {\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\n }\n }\n },\n listItemsTinyMceInit: function( listItem ) {\n tinyMCE.init({\n target: listItem,\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup: function(ed) {\n ed.on('keydown', function(e) {\n let article = e.target.parentNode;\n if ( e.keyCode == 13 ) {\n e.preventDefault();\n let text = e.target.innerHTML;\n let duplicate = new WPTB_ListItem( text, article, true );\n \n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n e.target.querySelector( 'p' ).innerText = 'New List Item';\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\n \n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\n let p = e.target.querySelector( 'p' );\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\n pText = pText.replace( /\\s+/g, ' ' ).trim();\n pText = pText.replace( /&nbsp;/g, '').trim();\n \n if( pText == '' ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n } else {\n let selectedText = WPTB_Helper.getSelectionText();\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\n selectedText = selectedText.replace( /&nbsp;/g, '' ).trim();\n if( selectedText == pText ) {\n e.preventDefault();\n e.target.querySelector( 'p' ).innerText = '\\n';\n }\n }\n }\n });\n \n ed.on( 'keyup', function( e ) {\n \n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n buttonsTinyMceInit: function( target ) {\n tinyMCE.init({\n target: target,\n inline: true,\n plugins: \"link\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n toolbar: 'bold italic strikethrough',\n setup : function(ed) {\n ed.on('keydown', function(e) {\n if (e.keyCode == 13) {\n e.preventDefault();\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n },\n linkHttpCheckChange: function( link ) {\n if ( link ) {\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\n let linkArr = link.split( '/' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n return document.location.protocol + '//' + linkClean;\n } else { \n return link;\n }\n } else {\n return '';\n }\n },\n dataTitleColumnSet: function( table ) {\n let rows = table.rows,\n rowHead = rows[0];\n let computedStyleRowHead = getComputedStyle(rowHead);\n \n let rowHeadChildren = rowHead.children;\n let contentsForHeader = {};\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\n let tdElements = rowHeadChildren[i].children;\n for( let j = 0; j < tdElements.length; j++ ) {\n let element = tdElements[j];\n if( element.classList.contains( 'wptb-ph-element' ) ) {\n let textContentStyle = element.getAttribute( 'style' );\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr[1] == 'text' ) {\n let p = element.querySelector( 'p' ),\n textContent = p.textContent,\n textAlign = p.style.textAlign;\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\n break;\n }\n }\n }\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \n '', computedStyleRowHead.backgroundColor, ''];\n }\n }\n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\n thisRowChildren[j].dataset.titleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\n thisRowChildren[j].dataset.titleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\n thisRowChildren[j].dataset.titleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\n thisRowChildren[j].dataset.titleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\n thisRowChildren[j].dataset.titleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\n } else {\n thisRowChildren[j].dataset.titleColumn = '';\n thisRowChildren[j].dataset.titleColumnFontSize = '';\n thisRowChildren[j].dataset.titleColumnColor = '';\n thisRowChildren[j].dataset.titleBackgroundColor = '';\n thisRowChildren[j].dataset.titleAlign = '';\n }\n }\n }\n },\n findAncestor: function(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls));\n return el;\n },\n getSelectionText: function() {\n var txt = '';\n if (txt = window.getSelection) {\n txt = window.getSelection().toString();\n } else {\n txt = document.selection.createRange().text;\n }\n return txt;\n },\n settingsPanelClear: function() {\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\n document.getElementById( 'wptb-table-border-number' ).value = 0;\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color' );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg' );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg' );\n \n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg' );\n \n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\n },\n wpColorPickerClear: function( inputId ) {\n let input = document.getElementById( inputId );\n let wpPickerContainer = WPTB_Helper.findAncestor( input, 'wp-picker-container' );\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n newInput.setAttribute( 'id', inputId );\n newInput.value = \"\";\n parent.appendChild( newInput );\n },\n detectMode: function() {\n var url = window.location.href,\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\n results = regex.exec(url);\n if (!results) return false;\n if (!results[2]) return '';\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\n }\n}\n","var WPTB_Image = function ( src, DOMElementProt ) {\n let DOMElement,\n kindIndexProt = undefined,\n copy = false;\n if ( DOMElementProt == undefined ) {\n DOMElement = document.createElement('div');\n\t let anchor = document.createElement('a'),\n\t img = document.createElement('img');\n anchor.style.display = 'inline-block';\n anchor.appendChild(img);\n DOMElement.appendChild(anchor);\n \n anchor.onclick = function( e ) {\n e.preventDefault();\n }\n \n file_frame = wp.media.frames.file_frame = wp.media({\n\t\ttitle: 'Select a image to upload',\n\t\tbutton: {\n\t\t\ttext: 'Use this image'\n\t\t},\n\t\tmultiple: false\n });\n // When an image is selected, run a callback.\n file_frame.on('select', function () {\n attachment = file_frame.state().get('selection').first().toJSON();\n img.src = attachment.url;\n });\n // Finally, open the modal\n if (src == undefined) {\n file_frame.open();\n } else {\n img.src = src;\n }\n } else {\n DOMElement = DOMElementProt.cloneNode( true );\n \n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\n e.preventDefault();\n };\n \n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n }\n \n this.kind = 'image';\n this.getDOMElement = function () {\n return DOMElement;\n };\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\n\n\treturn this;\n};","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 10,\n MAX_ROWS = 10;\n\n var tableGenerator = document.body;\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\n columnsInput = document.getElementById('wptb-columns-number'),\n rowsInput = document.getElementById('wptb-rows-number');\n \n columnsDecrementButton.onclick = function () {\n if (columnsInput.value > MIN_COLUMNS) {\n columnsInput.value--;\n }\n };\n\n columnsIncrementButton.onclick = function () {\n if (columnsInput.value < MAX_COLUMNS) {\n columnsInput.value++;\n }\n };\n\n rowsDecrementButton.onclick = function () {\n if (rowsInput.value > MIN_ROWS) {\n rowsInput.value--;\n }\n };\n\n rowsIncrementButton.onclick = function () {\n if (rowsInput.value < MAX_ROWS) {\n rowsInput.value++;\n }\n };\n\n document.getElementById('wptb-generate-table').onclick = function () {\n var columns = document.getElementById('wptb-columns-number').value,\n rows = document.getElementById('wptb-rows-number').value;\n\n WPTB_Table(columns, rows);\n }\n \n// if( document.getElementsByClassName( 'wptb-preview-table' ).length == 0 ) {\n// WPTB_LeftPanel();\n// }\n\n};\n","var WPTB_LeftPanel = function () {\n\n var table = document.getElementsByClassName('wptb-preview-table')[0],\n wptbElementButtons = document.getElementsByClassName('wptb-element');\n \n function wptbTdBgColorSavedSet( inputId, trNumber ) {\n if ( trNumber > 3 ) return;\n if( table ) {\n let tableRows = table.getElementsByTagName('tr');\n if ( tableRows.length > trNumber ) {\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\n var wptbEvenRowBg = document.getElementById(inputId);\n if ( wptbEvenRowBg && trBackgroundColor ) {\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\n }\n }\n }\n \n }\n \n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\n jQuery('#wptb-even-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 1; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName('td');\n for ( let j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n },\n\n });\n \n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\n jQuery('#wptb-odd-row-bg').wpColorPicker({\n change: function ( event, ui ) {\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = ui.color.toString();\n }\n },\n clear: function(){\n var tableRows = table.getElementsByTagName('tr');\n for ( let i = 2; i < tableRows.length; i += 2 ) {\n tableRows[i].style.backgroundColor = '';\n let tds = tableRows[i].getElementsByTagName( 'td' );\n for ( var j = 0; j < tds.length; j++ ) {\n tds[j].style.backgroundColor = '';\n }\n }\n },\n });\n \n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\n jQuery('#wptb-table-header-bg').wpColorPicker({\n change: function (event, ui) {\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = ui.color.toString();\n },\n clear: function(){\n var tableHeader = table.getElementsByTagName('tr')[0];\n tableHeader.style.backgroundColor = '';\n let tds = tableHeader.getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n tds[j].style.backgroundColor = '';\n }\n },\n });\n \n function tableTopRowAsHeadSavedSet( table ) {\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\n wptbTopRowAsHeader.checked = true;\n } else {\n wptbTopRowAsHeader.checked = false;\n }\n }\n tableTopRowAsHeadSavedSet( table );\n \n function tableBorderColorWidthSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n if ( table.length > 0 ) {\n let tableBorderColor = table[0].style.borderColor;\n if ( tableBorderColor ) {\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\n if ( tableBorderColorInput ) {\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\n }\n }\n \n let tableBorderWidth = table[0].style.borderWidth;\n if ( tableBorderWidth ) {\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\n \n if ( wptbTableBorderWidthSlider ) {\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\n }\n if ( wptbTableBorderWidthNumber ) {\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\n }\n }\n \n \n let tableTd = table[0].querySelector( 'td' );\n let applyInnerBorder = tableTd.style.borderWidth;\n if ( applyInnerBorder ) {\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\n if ( innerBorderCheckInput ) {\n innerBorderCheckInput.checked = true;\n \n if ( wptbApplyInnerBorder ) {\n wptbApplyInnerBorder.classList.add( 'visible' );\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\n }\n }\n } else {\n innerBorderCheckInput.checked = false;\n }\n }\n \n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\n }\n }\n }\n \n tableBorderColorWidthSavedSet();\n\n jQuery('#wptb-table-border-color').wpColorPicker({\n change: function (event, ui) {\n var tableCells = table.getElementsByTagName('td');\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\n\n for (var i = 0; i < tableCells.length; i++) {\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\n if ( document.getElementById('wptb-inner-border-check').checked ) {\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\n }\n }\n },\n clear: function() {\n var tableCells = table.getElementsByTagName('td');\n table.style.borderColor = '';\n\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderColor = '';\n }\n }\n });\n\n function addInnerBorderSize(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\n tableCells[i].style.borderStyle = 'solid';\n }\n }\n\n function addCellPadding(value) {\n var tableCells = table.getElementsByTagName('td');\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.padding = value + 'px';\n }\n }\n\n function addInnerBorder(checked) {\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\n }\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if( wptbPreviewTable.length > 0 ) {\n if (checked == 'checked') {\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = width + ' solid ' + color;\n }\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\n } else {\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\n for (var i = 0; i < tableCells.length; i++) {\n tableCells[i].style.border = '0px solid ' + color;\n }\n }\n }\n \n }\n\n function addBorderSize(value) {\n table.style.borderWidth = value + 'px';\n table.style.borderStyle = 'solid';\n }\n \n function cellPaddingSavedSet() {\n let table = document.getElementsByClassName('wptb-preview-table');\n \n if ( table.length > 0 ) {\n let td = table[0].querySelector( 'td' );\n \n if ( td ) {\n let padding = td.style.padding;\n \n if ( padding ) {\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\n \n if ( wptbTableCellSlider ) {\n wptbTableCellSlider.value = parseInt( padding );\n }\n if ( wptbTableCellNumber ) {\n wptbTableCellNumber.value = parseInt( padding );\n }\n }\n }\n }\n }\n \n cellPaddingSavedSet();\n \n function numberImputSize( wptbNumberInputs, maxCount, maxValue ) {\n wptbNumberInputs.onkeydown = function() {\n let thisValue = this.value;\n thisValue = String( thisValue );\n if ( thisValue[0] == 0 ) {\n this.value = \"\";\n } else {\n thisValue = thisValue.substring( 0, maxCount );\n this.value = thisValue;\n }\n }\n wptbNumberInputs.onkeyup = function() {\n let thisValue = this.value;\n thisValue = String( thisValue );\n if ( thisValue > maxValue ) {\n this.value = maxValue;\n }\n }\n }\n \n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\n numberImputSize( wptbTableBorderNumber, 1, 50 );\n \n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\n numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\n \n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\n numberImputSize( wptbTableCellNumber, 1, 50 );\n \n let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );\n numberImputSize( wptbTextfontSizeNumber, 1, 50 );\n \n let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );\n numberImputSize( wptbImageWidthNumber, 2, 100 );\n \n \n \n document.getElementById('wptb-table-cell-slider').oninput = function () {\n document.getElementById('wptb-table-cell-number').value = this.value;\n addCellPadding(this.value);\n };\n\n document.getElementById('wptb-table-cell-number').onchange = function () {\n document.getElementById('wptb-table-cell-slider').value = this.value;\n addCellPadding(this.value);\n };\n\n document.getElementById('wptb-table-border-slider').oninput = function () {\n document.getElementById('wptb-table-border-number').value = this.value;\n addBorderSize(this.value);\n \n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n };\n\n document.getElementById('wptb-table-border-number').onchange = function () {\n document.getElementById('wptb-table-border-slider').value = this.value;\n addBorderSize(this.value);\n };\n\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\n document.getElementById('wptb-table-inner-border-number').value = this.value;\n addInnerBorderSize(this.value);\n };\n\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\n addInnerBorderSize(this.value);\n };\n\n document.getElementById('wptb-inner-border-check').onchange = function () {\n if( table ) {\n let val = this.checked ? 'checked' : 'unchecked';\n addInnerBorder( val );\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\n if( val == 'unchecked' && borderWidth == 0 ) {\n tableBorderColorSetArea.style.display = 'none';\n } else {\n tableBorderColorSetArea.style.display = '';\n }\n }\n \n };\n \n function createMobileHeadForTable( table, thisEvent ) {\n \n if( thisEvent.checked ) {\n WPTB_Helper.dataTitleColumnSet( table );\n \n table.classList.add( 'wptb-table-preview-head' );\n table.rows[0].classList.add( 'wptb-table-head' );\n } else {\n let rows = table.rows;\n table.classList.remove( 'wptb-table-preview-head' );\n rows[0].classList.remove( 'wptb-table-head' );\n \n for ( let i = 1; i < rows.length; i++ ) {\n let thisRow = rows[i],\n thisRowChildren = thisRow.children;\n for( let j = 0; j < thisRowChildren.length; j++ ) {\n thisRowChildren[j].removeAttribute( 'data-title-column' );\n }\n }\n }\n }\n \n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\n createMobileHeadForTable( table, this );\n }\n\n for (var i = 0; i < wptbElementButtons.length; i++) {\n wptbElementButtons[i].ondragstart = function (e) {\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\n }\n }\n \n if( table ) {\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\n }\n \n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\n let wptbContainer = document.querySelector( '.wptb-container' );\n if( wptbContainer ) {\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\n wptbContainer.classList.remove( 'collapsed' );\n } else {\n wptbContainer.classList.add( 'collapsed' );\n }\n }\n };\n \n // this code hides the \"element parameters\" area \n // when clicked outside this element and its \"tinymce\" toolbar \n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\n wptbBuilderPanel.addEventListener( 'click', function( e ) {\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\n document.getElementById( 'element-options-group' ).style.display = 'none';\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\n }\n } \n }, false);\n \n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\n\n var el_L = document.createElement('ul'), item,\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-list-item-container' );\n\n this.kind = 'list';\n\n if (innerElements === '') {\n //Case for edit mode list\n } else if ( !innerElements ) {\n for (var i = 0; i < 3; i++) {\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\n el_L.appendChild(item.getDOMElement());\n }\n } else {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n \n for ( var i = 0; i < innerElements.length; i++ ) {\n let listItem = DOMElementProt.querySelector( 'li' );\n item = new WPTB_ListItem( innerElements[i], listItem, true );\n el_L.appendChild(item.getDOMElement());\n }\n }\n DOMElement.appendChild(el_L);\n //window.addElementOptions('list', elList);\n\n this.getDOMElement = function () {\n return DOMElement;\n }\n applyGenericItemSettings( this, kindIndexProt, copy );\n WPTB_Helper.listItemsRecalculateIndex( el_L );\n\n return this;\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\n let wptbListItemReturn;\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\n if (text == undefined) text = 'New List Item';\n var DOMElement = document.createElement('li'),\n //divdot = document.createElement('div'),\n divcontent = document.createElement('div');\n //libullet = document.createElement('li');\n //divdot.classList.add('wptb-list-item-style-dot');\n divcontent.classList.add('wptb-list-item-content');\n //libullet.classList.add('wptb-bullet');\n if ( DOMElementProt ) {\n let styleDot = DOMElementProt.getAttribute( 'style' );\n if ( styleDot ) {\n DOMElement.setAttribute( 'style', styleDot );\n }\n }\n //DOMElement.appendChild(divdot);\n DOMElement.appendChild(divcontent);\n //divdot.appendChild(libullet);\n divcontent.innerHTML = text;\n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = true;\n } else {\n var DOMElement = DOMElementProt;\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\n \n divcontent.onkeyup = window.listItemKeyListener;\n \n wptbListItemReturn = false;\n }\n \n DOMElement.onmouseenter = function (event) {\n\n var btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span'),\n previous,\n i;\n actions.classList.add('wptb-actions');\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\n this.classList.add('wptb-directlyhovered');\n\n btnDelete.onclick = function () {\n var action = this.parentNode, \n item = this.parentNode.parentNode,\n parent = item.parentNode;\n item.removeChild( action );\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n };\n\n btnCopy.onclick = function (event) {\n var listItem = event.target.parentNode.parentNode,\n content = listItem.querySelector('.wptb-list-item-content'),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), DOMElement );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n };\n\n actions.append(btnCopy, btnDelete);\n this.appendChild(actions);\n };\n\n DOMElement.onmouseleave = function (event) {\n this.removeAttribute( 'class' );\n let iter = 0;\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\n event.target.querySelector( '.wptb-actions' ).remove();\n iter++;\n }\n };\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n if ( wptbListItemReturn ) {\n return this;\n }\n};","var MultipleSelect = function () {\n\n\tvar selectedCells = [],\n\t\tmultipleCellMode = false;\n\n\tthis.activateMultipleSelectMode = function () {\n\t\tselectedCells = [];\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n\t\tfor (var i = 0; i < tds.length; i++) {\n\t\t\ttds[i].classList.remove('wptb-highlighted');\n\t\t}\n\t\tmultipleCellMode = true;\n\t}\n\n\tthis.deactivateMultipleSelectMode = function () {\n\t\tmultipleCellMode = false;\n\t}\n\n\tthis.isActivated = function () {\n\t\treturn multipleCellMode;\n\t}\n\n\tthis.pushSelectedCell = function (cell) {\n\t\tif (!multipleCellMode) {\n\t\t\treturn;\n\t\t}\n\t\tselectedCells.push(cell);\n\t\tcell.classList.add('wptb-highlighted');\n\t};\n\n\tthis.selectedCells = function () {\n\t\treturn selectedCells;\n\t}\n\n\tthis.flushSelectedCells = function () {\n\t\tselectedCells = [];\n\t}\n\n\tthis.getFirst = function () {\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\n\t\t\t\tfirst = selectedCells[i];\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn first;\n\t}\n\n\tthis.getLast = function () {\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\n\t\t\t\tlast = selectedCells[i];\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn last;\n\t}\n\n\tthis.removeAllButFirst = function () {\n\t\tvar td = this.getFirst();\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\n\t\t}\n\t}\n\n\treturn this;\n\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\n if( Array.isArray( code ) ) {\n let elementHtml;\n \n if ( code.length == 1) {\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\n }\n if( 0 in code ) {\n let tagName = code[0];\n elementHtml = document.createElement( tagName );\n \n if ( 1 in code ) {\n if( Array.isArray( code[1] ) ) {\n let attributes = code[1];\n \n for( let i = 0; i < attributes.length; i++ ) {\n if( Array.isArray( attributes[i] ) ) {\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\n }\n }\n }\n }\n \n if ( 2 in code ) {\n if ( Array.isArray( code[2] ) ) {\n for ( let i = 0; i < code[2].length; i++ ) {\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\n continue;\n }\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\n }\n } else if( typeof code[2] === 'string' ) {\n elementHtml.appendChild( document.createTextNode( code[2] ) );\n }\n \n }\n }\n \n return elementHtml;\n } else {\n return false;\n }\n \n}","var WPTB_Settings = function () {\n var elems = document.getElementsByClassName('wptb-element');\n\n for ( var i = 0; i < elems.length; i++ ) {\n elems[i].ondragstart = function ( event ) {\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\n }\n elems[i].ondragend = function () {\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\n if ( wptbDropHandle || wptbDropBorderMarker ) {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n }\n };\n \n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-shortcode-popup-window-modal' )[0];\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\n if( ! this.classList.contains( 'wptb-embed-disable' ) ) {\n shortcodePopupWindow.classList.add( 'wptb-shortcode-popup-show' );\n }\n }\n \n document.getElementsByClassName( 'wptb-shortcode-popup-dark-area' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-shortcode-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-shortcode-popup-window-close-icon' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-shortcode-popup-show' );\n }\n\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function () {\n let bar = document.querySelector( '.wptb-edit-bar' );\n if ( bar && bar.classList.contains( 'visible' ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\n table.toggleTableEditMode();\n }\n\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\n messagingArea,\n code = document.getElementsByClassName( 'wptb-preview-table' );\n if( code.length > 0 ) {\n code = WPTB_Stringifier( code[0] );\n code = code.outerHTML;\n } else { \n code = '';\n }\n \n if ( t === '' || code === '' ) {\n let messagingAreaText = '';\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\n messagingArea.classList.add( 'wptb-warning' );\n setTimeout(function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n return;\n }\n\n let params = {\n title: t,\n content: code,\n security_code: wptb_admin_object.security_code\n };\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n params.id = rs;\n }\n params = JSON.stringify( params );\n\n http.open('POST', url, true);\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function (action) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n\n if ( data[0] == 'saved' ) {\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-embed-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\n } else if( data[0] == 'edited' ) {\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\n } else {\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\n }\n messagingArea.classList.add( 'wptb-success' );\n setTimeout( function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n }\n }\n http.send( params );\n }\n};\n","var WPTB_Space = function ( elSpaceBetween ) {\n\n function newElementProxy(el) {\n if (el.includes('list')) {\n return new WPTB_List();\n } else if (el.includes('image')) {\n return new WPTB_Image();\n } else if (el.includes('text')) {\n return new WPTB_Text();\n } else if (el.includes('button')) {\n return new WPTB_Button();\n }\n }\n let spaceBetween;\n if ( ! elSpaceBetween ) {\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\n } else {\n spaceBetween = elSpaceBetween;\n }\n\n spaceBetween.ondragenter = function () {\n this.classList.add('visible');\n };\n spaceBetween.ondragover = function (event) {\n event.preventDefault();\n };\n\n spaceBetween.ondragleave = function () {\n this.classList.remove('visible');\n };\n\n spaceBetween.ondrop = function (event) {\n event.stopPropagation();\n\n var p = event.target.nextSibling,\n td = event.target,\n element, t_space, spaceParent;\n\n while ( !td.classList.contains('wptb-droppable') ) {\n td = td.parentNode;\n }\n\n if (event.dataTransfer.getData('wptbElement')) {\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\n this.classList.remove('visible');\n\n if (p == null) {\n td.appendChild(element.getDOMElement());\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element.getDOMElement(), p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n } else {\n alert(event.dataTransfer.getData('node'));\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\n t_space = element.nextSibling;\n spaceParent = element.parentNode;\n if (t_space != undefined) {\n spaceParent.removeChild(t_space);\n }\n\n if (p == null) {\n td.appendChild(element);\n td.appendChild(new WPTB_Space());\n } else {\n td.insertBefore(element, p);\n td.insertBefore(new WPTB_Space(), p);\n }\n\n }\n this.classList.remove('visible');\n };\n \n if ( ! elSpaceBetween ) {\n return spaceBetween;\n }\n};","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.classList.add( 'wptb-table-preview-static-indic' );\n code.dataset.tableColumns = codeMain.columns;\n code.dataset.reconstraction = 1;\n \n let tds = code.getElementsByTagName( 'td' );\n if ( tds.length > 0 ) {\n for ( let i = 0; i < tds.length; i++ ) {\n \n for( let i = 0; i < tds.length; i++ ) {\n if( code.dataset.reconstraction == 1 && tds[i].colSpan > 1 || tds[i].rowSpan > 1 ) {\n code.dataset.reconstraction = 0;\n break;\n }\n }\n \n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\n tds[i].removeAttribute( 'data-x-index' );\n }\n tds[i].removeAttribute( 'data-y-index' );\n tds[i].removeAttribute( 'draggable' );\n tds[i].classList.remove( 'wptb-droppable' );\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\n \n if ( innerElements.length > 0 ) {\n for ( let j = 0; j < innerElements.length; j++ ) {\n innerElements[j].classList.remove( 'wptb-directlyhovered' );\n \n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n \n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n \n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n \n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n \n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\n let wptbActionsLength = wptbActions.length;\n while ( wptbActionsLength > 0 ) {\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\n wptbActionsLength--;\n } \n }\n }\n \n if( tds[i].hasAttribute( 'data-title-column' ) ) {\n let columnNameDivContainer = document.createElement( 'div' ),\n columnNameDiv = document.createElement( 'div' );\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\n columnNameDiv.dataset.titleColumn = tds[i].dataset.titleColumn;\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.titleColumnFontSize + '; \\n\\\n color:' + tds[i].dataset.titleColumnColor + '; background-color:' + tds[i].dataset.titleBackgroundColor + '; text-align:' + tds[i].dataset.titleAlign + ';' );\n columnNameDiv.style.padding = tds[i].style.padding;\n if( tds[i].children.length == 0 ) {\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\n }\n columnNameDivContainer.appendChild( columnNameDiv );\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\n }\n }\n }\n \n return code;\n }\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\n\n\tif ( node == undefined ) {\n\t\treturn '';\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\n return node.nodeValue;\n }\n \n let code = [],\n children,\n int_elem_arr = false,\n attributes = [...node.attributes],\n attributes_list = [],\n internal_elements = [];\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \n node.parentNode.classList.contains( 'mce-content-body' ) ) && \n node.tagName.toLowerCase() == 'p' ) {\n children = node.childNodes;\n int_elem_arr = true;\n } else if( node.children.length > 0 ) {\n children = node.children;\n } else {\n children = node.childNodes;\n }\n if ( attributes.length > 0 ) {\n for ( let i = 0; i < attributes.length; i++ ) {\n attributes_list[i] = [attributes[i].name, attributes[i].value];\n }\n } else {\n attributes_list = '';\n }\n \n if ( children.length > 0 ) {\n for ( let i = 0; i < children.length; i++) {\n let inter_elem = WPTB_Stringifier(children[i]);\n \n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\n internal_elements[i] = inter_elem;\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\n internal_elements = inter_elem;\n }\n }\n } else {\n internal_elements = '';\n }\n \n \n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\n \n return code;\n}","var array = [], WPTB_Table = function (columns, rows) {\n\n /* The members of the class */\n var settings = document.getElementsByClassName('wptb-settings-items'),\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\n table, row, cell,\n maxAmountOfCells,\n maxAmountOfRows;\n\n //HERE ARE THE PRIVATE FUNCTIONS\n /*\n * This function toggles buttons visibility in cell edit mode\n * (according to the amount of currently selected cells), and\n * highlights visually the clicked cell if it is not highlighted, or\n * removes highlight if clicked cell is already highlighted. \n * It too toggles the bits of our abstract representation.\n * @param Event this is the event instance of the click performed over a cell.\n */\n var mark = function (event) {\n var rs = this.rowSpan,\n cs = this.colSpan,\n markedCells,\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n position = getCoords(this),\n row = position[0],\n column = position[1];\n if (!document.select.isActivated()) {\n return;\n }\n if (this.className.match(/wptb-highlighted/)) {\n this.classList.remove('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 0;\n }\n }\n } else {\n this.classList.add('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 1;\n }\n }\n }\n\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\n if (markedCells === 0) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n } else if (markedCells === 1) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.add('visible');\n singleCells[i].removeAttribute('disabled');\n }\n } else {\n for (var i = 0; i < multipleCells.length; i++) {\n if (table.isSquare(array)) {\n multipleCells[i].classList.add('visible');\n multipleCells[i].removeAttribute('disabled');\n } else {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n };\n\n /* \n * This function fills an array with 1's according to the actual design\n * of HTML table.\n * @returns an array of arrays containing an abstract representation\n * of HTML table.\n * @deprecated\n * */\n\n var realTimeArray = function () {\n var carried = [], tds, cols, matriz = [];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n cols = [];\n\n var tds = table.rows[i].getElementsByTagName('td');\n\n for (items = 0; items < tds.length; items++) {\n\n for (var k = 0; k < tds[items].colSpan; k++) {\n cols.push(1);\n }\n\n if (tds[items].rowSpan > 1) {\n for (var k = 0; k < tds[items].colSpan; k++) {\n carried[items + k] = {\n justAssigned: true,\n amount: tds[items].rowSpan\n };\n }\n }\n }\n\n for (var k = 0; k < maxAmountOfCells; k++) {\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\n carried[k].amount--;\n if (carried[k].justAssigned) {\n carried[k].justAssigned = false;\n } else {\n cols.push(1);\n }\n }\n }\n\n matriz.push(cols);\n\n }\n return matriz;\n };\n\n /*\n * This function gets the number and position of cell spaces in current row that are occuped \n * by upper rowspanned cells.\n * @param number the number of row where we wish to calculate the carried rowspans up to.\n * @return an array with the remaining rowspans in each column.\n */\n var carriedRowspans = function (row) {\n var carried = [], tds, cols;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n if (row == -1) {\n return carried;\n }\n\n for (var i = 0; i <= row; i++) {\n cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (carried[xPosition]) {\n carried[xPosition]--;\n } else {\n celda = cellsBuffer[cellPointer++];\n if (celda.rowSpan > 1) {\n for (k = 0; k < celda.colSpan; k++) {\n carried[xPosition + k] = celda.rowSpan - 1;\n }\n stepsToMove = celda.colSpan;\n } else if (celda.colSpan > 1) {\n stepsToMove = celda.colSpan;\n }\n }\n }\n\n }\n return carried;\n };\n\n /*\n * A helpful function for showing\n * the abstract table in console.\n * @param Array our abstract table.\n */\n var drawTable = function (a) {\n var string = 'DRAWING TABLE:\\n';\n for (var i = 0; i < a.length; i++) {\n\n for (var j = 0; j < a[i].length; j++) {\n string += ' ' + a[i][j];\n }\n string += '\\n';\n }\n table.isSquare(a);\n };\n\n /*\n * It resets all the bits of our abstract representation\n * to 0 and removes the highlighting class of all cells.\n */\n\n var undoSelect = function () {\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < array[i].length; j++) {\n array[i][j] = 0;\n }\n }\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n };\n\n /*\n * This fills the abstract representation of our table with \n * zeros, at the start. the max amount of cells is the greatest sum\n * of all colspans for row.\n */\n\n var fillTableArray = function () {\n var colspansSums = [], a = [];\n\n //calculate max amount of cells inside a row\n for (var i = 0; i < table.rows.length; i++) {\n var cells = table.rows[i].getElementsByTagName('td'),\n colspanSumInRow = 0;\n for (var j = 0; j < cells.length; j++) {\n colspanSumInRow += cells[j].colSpan;\n }\n colspansSums.push(colspanSumInRow);\n }\n\n maxAmountOfCells = Math.max.apply(null, colspansSums);\n //calculate max rows\n var maxAmountOfRows = table.rows.length;\n\n // fill with zeros from both values\n for (var i = 0; i < maxAmountOfRows; i++) {\n a[i] = [];\n for (var j = 0; j < maxAmountOfCells; j++) {\n a[i].push(0);\n }\n }\n drawTable(a);\n return a;\n };\n\n /*\n * This function gets the sum of all colspans in a row.\n * @param number the number of row to be used as reference.\n */\n var getActualPointsInRow = function (row) {\n var tds = table.rows[row].getElementsByTagName('td'),\n points = 0;\n for (var i = 0; i < tds.length; i++) {\n points += tds[i].colSpan;\n }\n return points;\n }\n\n /*\n * This function gets us the exact coordinates of\n * an exact cell, in a more reliable way than xIndex and yIndex,\n * these last ones were meant to be used for getting the cell trough them.\n * @param DOMElement the cell to get the coordinates.\n */\n var getCoords = function (search) {\n var skipInCols = [], cell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n skipInCols[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (skipInCols[xPosition]) {\n skipInCols[xPosition]--;\n } else {\n var td = cellsBuffer[cellPointer++];\n if (td == search) {\n return [i, xPosition];\n }\n if (td.rowSpan > 1) {\n for ( let k = 0; k < td.colSpan; k++ ) {\n skipInCols[xPosition + k] = td.rowSpan - 1;\n }\n stepsToMove = td.colSpan;\n } else if (td.colSpan > 1) {\n stepsToMove = td.colSpan;\n }\n }\n }\n }\n };\n\n jQuery('#wptb-table-header-bg').val('');\n jQuery('#wptb-even-row-bg').val('');\n jQuery('#wptb-odd-row-bg').val('');\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\n\n if (columns || rows) {\n //END OF PRIVATE FUNCTIONS\n for (var i = 0; i < settings.length; i++) {\n if (settings[i].id !== 'wptb-apply-inner-border') {\n settings[i].classList.add('visible');\n }\n }\n\n //Create a HTML Table element.\n table = document.createElement('table');\n table.classList.add('wptb-preview-table');\n\n //Add the data rows.\n for (var i = 0; i < rows; i++) {\n\n row = table.insertRow(-1);\n row.classList.add( 'wptb-row' );\n\n for (var j = 0; j < columns; j++) {\n cell = new WPTB_Cell(mark);\n cell.setCoords(i, j);\n row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\n\n if (wptb_preview_table.length > 0) {\n table = wptb_preview_table[0];\n\n let cells = table.getElementsByTagName('td');\n\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n WPTB_Cell(mark, cells[i]);\n }\n }\n }\n }\n\n /*\n * This just toggles visibility of cell edit bar, and toggles \n * cell selecting mode.\n */\n\n table.toggleTableEditMode = function () {\n let bar = document.getElementsByClassName('wptb-edit-bar'),\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if (wptbPreviewTable.length > 0) {\n wptbPreviewTable = wptbPreviewTable[0];\n }\n\n if (bar.length > 0) {\n for (let i = 0; i < bar.length; i++) {\n if (bar[i].classList.contains('visible')) {\n document.select.deactivateMultipleSelectMode();\n bar[i].classList.remove('visible');\n cellModeBackground.classList.remove('visible');\n leftScrollPanelCurtain.classList.remove('visible');\n wptbPreviewTable.classList.remove('wptb-preview-table-manage-cells');\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');\n if (wptbPreviewTableTds.length > 0) {\n for (let i = 0; i < wptbPreviewTableTds.length; i++) {\n wptbPreviewTableTds[i].classList.remove('wptb-highlighted');\n }\n }\n } else {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add('visible');\n cellModeBackground.classList.add('visible');\n leftScrollPanelCurtain.classList.add('visible');\n wptbPreviewTable.classList.add('wptb-preview-table-manage-cells');\n }\n }\n\n }\n }\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table. \n */\n\n table.recalculateIndexes = function ( start ) {\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0,\n tdsArr = [];\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\n \n for (var i = 0; i < trs.length; i++) {\n if ( i == 0 ) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\n }\n if( wptbTopRowAsHeader.checked ) {\n if( start == undefined ) {\n this.classList.add( 'wptb-table-preview-head' ); \n trs[i].classList.add( 'wptb-table-head' )\n } ;\n } else {\n if( start == undefined ) {\n this.classList.remove( 'wptb-table-preview-head' );\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n } else {\n if (i % 2 == 0) {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n } else {\n if ( start == undefined ) {\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\n }\n trs[i].classList.remove( 'wptb-table-head' );\n }\n }\n\n tdsArr[i];\n tds = trs[i].getElementsByTagName('td');\n\n if (tdsArr[i] == undefined) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for (var j = 0; j < tds.length; j++) {\n if (tdsArr[i][j] != undefined) {\n for (let y = 0; y < 100; y++) {\n if (tdsArr[i][jMainIter] != undefined) {\n jMainIter++;\n continue;\n }\n tdsArr[i][jMainIter] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n break;\n }\n } else {\n tdsArr[i][j] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n }\n tds[j].dataset.yIndex = i;\n\n if (tds[j].colSpan > 1) {\n for (let k = 1; k < tds[j].colSpan; k++) {\n jMainIter++;\n tdsArr[i][jMainIter] = 'tdDummy';\n }\n }\n\n if (tds[j].rowSpan > 1) {\n for (let x = 1; x < tds[j].rowSpan; x++) {\n if (tdsArr[i + x] == undefined) {\n tdsArr[i + x] = [];\n }\n for (let z = 0; z < tds[j].colSpan; z++) {\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\n }\n }\n }\n jMainIter++;\n }\n if (j > maxCols) {\n maxCols = j;\n }\n }\n this.columns = maxCols;\n }\n\n /*\n * As simple as it is: adds a column to the end of table.\n */\n table.addColumnEnd = function () {\n let td,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n table.rows[i].appendChild(td.getDOMElement());\n array[i].push(0);\n }\n maxAmountOfCells++;\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n };\n\n /*\n * As simple as it looks: adds a column to the start of table.\n */\n\n table.addColumnStart = function () {\n let td,\n firstCell,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n firstCell = table.rows[i].getElementsByTagName('td')[0];\n if (firstCell) {\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\n } else {\n table.rows[i].appendChild(td.getDOMElement());\n }\n array[i].push(0);\n }\n\n maxAmountOfCells++;\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n };\n\n /*\n * Well, not so simple as previous functions.\n * It adds a column after a certain column of reference.\n * @param integer the column number to be used as reference.\n *\tIf empty, then the first highlighted cell is used as reference.\n */\n\n table.addColumnAfter = function (c_pos) {\n let rows = table.rows,\n cellPointer,\n cellsBuffer,\n cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\n \n \n \n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\n table.addColumnEnd();\n } else {\n let pendingInsertion = false,\n stepsToMove,\n td, bro,\n carriedRowspans = [],\n currentCell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carriedRowspans.push(0);\n }\n\n for (var i = 0; i < rows.length; i++) {\n cellPointer = 0;\n cellsBuffer = rows[i].getElementsByTagName('td');\n pendingInsertion = false;\n for (var xPosition = 0;\n xPosition < maxAmountOfCells;\n xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (pendingInsertion) {\n td = new WPTB_Cell(mark);\n if (cellStyle) {\n td.getDOMElement().setAttribute('style', cellStyle);\n }\n if (currentCell && rows[i].contains(currentCell)) {\n bro = currentCell.nextSibling;\n if (bro) {\n rows[i].insertBefore(td.getDOMElement(), bro);\n } else {\n rows[i].appendChild(td.getDOMElement());\n }\n } else {\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\n }\n break;\n } else if (carriedRowspans[xPosition] > 0) {\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\n if (pos == xPosition) {\n pendingInsertion = true;\n }\n } else {\n currentCell = cellsBuffer[cellPointer++];\n if (currentCell.rowSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (currentCell.colSpan > 1) {\n stepsToMove = currentCell.colSpan;\n for (var k = 0; k < currentCell.colSpan; k++) {\n if (xPosition + k == pos) {\n pendingInsertion = true;\n }\n }\n } else if (xPosition == pos) {\n pendingInsertion = true;\n }\n }\n }\n\n for (var l = 0; l < maxAmountOfCells; l++) {\n if (carriedRowspans[l] > 0)\n carriedRowspans[l]--;\n }\n\n }\n\n for (var i = 0; i < array.length; i++) {\n array[i].push(0);\n }\n maxAmountOfCells++;\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n }\n };\n\n /*\n * For preventing us to take a lot of time,\n * This is just calling the function addColumnAfter, but\n * using the previous column to current one as reference.\n * @see addColumnAfter\n */\n\n table.addColumnBefore = function () {\n var cell = document.querySelector('.wptb-highlighted'),\n pos = getCoords(cell)[1];\n\n if (pos === 0) {\n table.addColumnStart();\n } else {\n table.addColumnAfter(pos - 1);\n }\n };\n\n /*\n * Luckily, thisfunction is simple, \n * it just add a row to the end of table.\n */\n\n table.addRowToTheEnd = function () {\n let r = table.insertRow(-1),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n };\n\n /*\n * Yet another simple function, \n * it just add a row to the start of table.\n */\n\n table.addRowToTheStart = function () {\n let r = table.insertRow(0),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n }\n r.appendChild(td.getDOMElement());\n }\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n };\n\n /* \n * This function adds a row before the current one.\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\n * the most of the troubles is not here.\n */\n\n table.addRowBefore = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellNew;\n for( let i = row - 1; i >= 0; i-- ) {\n let rowChildren = table.rows[i].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].rowSpan == 1 ) {\n row = i;\n cellNew = true;\n break;\n }\n }\n }\n if ( cellNew ) {\n break;\n }\n }\n\n if (row === 0) {\n table.addRowToTheStart();\n } else {\n table.addRowAfter( row, cellStyle );\n }\n };\n\n /*\n * Well... by the name convention of the previous 3 functions,\n * it's pretty obvious that this functions attaches a new\n * row after highlighted cell row. The greatest obstacle it was\n * the possibility of a TR not having the exact amount of columns\n * occuped by actual node but rowspanned upper cells. For that purpose\n * it was created the function realTimeArray.\n * @see realTimeArray\n */\n\n table.addRowAfter = function ( row, cellStyle ) {\n let cellRowSpan,\n rowAfter,\n aux;\n \n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\n let cell = document.querySelector('.wptb-highlighted');\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellRowSpan = cell.rowSpan,\n rowAfter = row + cellRowSpan - 1;\n } else {\n rowAfter = row;\n }\n \n \n let cellsColSpan = 0;\n if ( rowAfter < table.rows.length -1 ) {\n for( let i = 0; i <= rowAfter ; i++ ) {\n let tableRowsIChildren = table.rows[i].children,\n tableRIChildrenLength = tableRowsIChildren.length;\n if( tableRIChildrenLength > 0 ) {\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\n\n if ( rowIRowSpan - 1 + i > rowAfter ) {\n tableRowsIChildren[j].rowSpan++;\n }\n }\n }\n }\n \n let rNext = table.rows[rowAfter + 1],\n rNextChildren = rNext.children,\n rNextChildrenLength = rNextChildren.length;\n \n if( rNextChildrenLength > 0 ) {\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\n cellsColSpan += rNextChildren[i].colSpan;\n }\n }\n } else {\n cellsColSpan = array[0].length;\n }\n \n let r = table.insertRow( rowAfter + 1 );\n r.classList.add( 'wptb-row' );\n \n for ( j = 0; j < cellsColSpan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyle );\n r.appendChild( td.getDOMElement() );\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n };\n\n /*\n * This function checks the current selected cells\n * make a rectangular shape.\n * @param Array the abstract table.\n * @return false, if not making a rectangle, or\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\n */\n\n table.isSquare = function (a) {\n var rowStart = -1,\n columnStart = -1,\n rowEnd = -1,\n columnEnd = -1,\n height,\n width,\n itemsEstimate = 0,\n items = 0;\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n if ( j < columnStart || columnStart == -1 ) {\n columnStart = j;\n }\n if ( i < rowStart || rowStart == -1 ) {\n rowStart = i;\n }\n }\n }\n \n }\n\n for (var i = a.length - 1; i > -1; i--) {\n for (var j = a[i].length - 1; j > -1; j--) {\n if (a[i][j] == 1) {\n if ( j > columnEnd ) {\n columnEnd = j;\n }\n if ( i > rowEnd ) {\n rowEnd = i;\n }\n }\n }\n }\n\n for (var i = rowStart; i < rowEnd; i++) {\n for (var j = columnStart; j < columnEnd; j++) {\n if (a[i][j] == 0 || a[i][j] == undefined) {\n return false;\n }\n }\n }\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n items++;\n }\n }\n }\n\n height = rowEnd - rowStart + 1;\n width = columnEnd - columnStart + 1;\n itemsEstimate = height * width;\n\n if (itemsEstimate !== items) {\n return false;\n }\n return [height, width];\n };\n\n /*\n * This function merges all selected cells.\n * Well, actually sets the colspan and rowspan of first \n * upper left cell in selection and deletes the another selected cells.\n */\n\n table.mergeCells = function () {\n var dimensions = table.isSquare(array),\n rowspan = dimensions[0],\n colspan = dimensions[1],\n first = document.querySelector('.wptb-highlighted'),\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\n tdsChildrenNew = [];\n\n for (let i = 0; i < tds.length; i++) {\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\n if (tdsInternalElements.length > 0) {\n let tdsIntElemLength = tdsInternalElements.length;\n for (let j = 0; j < tdsIntElemLength; j++) {\n tdsChildrenNew.push(tdsInternalElements[j]);\n }\n }\n let p = tds[i].parentNode;\n p.removeChild(tds[i]);\n }\n if (tdsChildrenNew.length > 0) {\n for (let i = 0; i < tdsChildrenNew.length; i++) {\n first.appendChild(tdsChildrenNew[i]);\n }\n }\n\n first.colSpan = colspan;\n first.rowSpan = rowspan;\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n };\n\n /*\n * This functions makes the exact inverse as above.\n * It resets colspan and rowspan and appends \n * the same amount in cells to the table.\n * @bug\n */\n\n table.splitCell = function () {\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\n rowspan = cell.rowSpan,\n colspan = cell.colSpan,\n cellStyles = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n thisRow = table.rows[row],\n cellXIndex =cell.dataset.xIndex;\n \n cell.rowSpan = 1;\n cell.colSpan = 1;\n \n for (let i = 1; i < colspan; i++) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n if ( cell.nextSibling ) {\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\n } else {\n thisRow.appendChild( td.getDOMElement() );\n }\n \n }\n\n if (rowspan > 1) {\n for (let i = 1; i < rowspan; i++) {\n let rowChildInsertBefore = undefined,\n rowNext = table.rows[row + i],\n rowChildren = rowNext.children,\n rowChildrenLength = rowChildren.length;\n \n if ( rowChildrenLength > 0 ) {\n for ( let k = 0; k < rowChildrenLength; k++ ) {\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\n rowChildInsertBefore = rowChildren[k];\n break;\n } \n }\n }\n for ( let j = 0; j < colspan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyles );\n if ( rowChildInsertBefore != undefined ) {\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\n } else {\n rowNext.appendChild( td.getDOMElement() );\n }\n }\n }\n }\n\n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n };\n\n /*\n * Searches for rowspanned cells up to row number meeting it.\n * @param number the number of row where the function\n * must search up to.\n */\n\n table.findRowspannedCells = function (row) {\n var array = [],\n difference;\n actualPoints = getActualPointsInRow(row);\n if (actualPoints === maxAmountOfCells) {\n return [];\n }\n difference = maxAmountOfCells - actualPoints;\n\n for (var i = row - 1; i >= 0 && difference; i--) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n if (tds[i].rowSpan > 1) {\n array.push(tds[i]);\n difference -= tds[i].colSpan;\n }\n }\n }\n return array;\n\n }\n\n /*\n * This function explores the table and adds \n * a cell for each lacking one for each row\n * to meet an even amount of cells.\n */\n\n table.addLackingCells = function () {\n var sumRows = [];\n for (var i = 0; i < table.rows.length; i++) {\n sumRows.push(0);\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n if (tds[j].rowSpan > 1) {\n for (var k = 1; k < tds[j].rowSpan; k++) {\n sumRows[i + k]++;\n }\n }\n }\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td'),\n totalColspan = 0;\n for (var j = 0; j < tds.length; j++) {\n totalColspan += tds[j].colSpan;\n }\n totalColspan += sumRows[i];\n difference = maxAmountOfCells - totalColspan;\n for (var j = 0; j < difference; j++) {\n var td = new WPTB_Cell(mark);\n table.rows[i].appendChild(td.getDOMElement());\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\n }\n }\n };\n\n /*\n * This function deletes the row of currently\n * selected cell. \n */\n\n table.deleteRow = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyles = cell.getAttribute('style'),\n rowspan = cell.rowSpan,\n row = getCoords(cell)[0],\n thisRow,\n aux;\n \n if ( rowspan == undefined ) rowspan = 1;\n \n for ( let i = 0; i < rowspan; i++ ) {\n thisRow = table.rows[row];\n let thisRowChildren = thisRow.children,\n nextRow = table.rows[row + 1],\n nextRowChildren,\n nextRowChildrenLength,\n tdArr = [];\n\n if( nextRow != undefined ) {\n nextRowChildren = nextRow.children;\n nextRowChildrenLength = nextRowChildren.length;\n for (let j = 0; j < thisRowChildren.length; j++) {\n if ( thisRowChildren[j].rowSpan > 1 ) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\n\n let nextRowChildrenK = undefined;\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\n nextRowChildrenK = nextRowChildren[k];\n break;\n } \n }\n\n if ( nextRowChildrenK ) {\n tdArr.push( [td, nextRowChildrenK] );\n } else {\n tdArr.push( [td] );\n }\n }\n }\n\n if ( tdArr.length > 0 ) {\n for ( let k = 0; k < tdArr.length; k++ ) {\n if ( tdArr[k][1] != undefined ) {\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\n } else {\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\n }\n }\n }\n }\n \n let tableRows = table.rows;\n if ( tableRows.length > 0 ) {\n for ( let j = 0; j < row; j++ ) {\n let jRowChildren = tableRows[j].children;\n if ( jRowChildren.length > 0 ) {\n for ( let x = 0; x < jRowChildren.length; x++ ) {\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\n jRowChildren[x].rowSpan--;\n }\n }\n }\n }\n }\n aux = Array.from(array[0]);\n array.pop(aux);\n drawTable(array);\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\n \n if( table.rows.length == 0 ) {\n table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n undoSelect();\n }\n\n /*\n * This function deletes the column of currently\n * selected cell. Again, this is way more complicated than\n * delete row case.\n */\n\n table.deleteColumn = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellXIndex = cell.dataset.xIndex,\n colspan = cell.colSpan;\n \n for ( let i = 0; i < colspan; i++ ) {\n for ( let j = 0; j < table.rows.length; j++ ) {\n let rowChildren = table.rows[j].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n } else {\n table.rows[j].removeChild( rowChildren[k] );\n }\n break;\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \n Number( rowChildren[k].dataset.xIndex ) + \n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n }\n break;\n }\n }\n }\n }\n \n for ( let j = 0; j < table.rows.length; j++ ) {\n if (array[j] != undefined)\n array[j].pop();\n }\n \n maxAmountOfCells--;\n \n if( table.querySelectorAll( 'td' ).length == 0 ) {\n table.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n WPTB_Helper.settingsPanelClear();\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n table.recalculateIndexes();\n WPTB_Helper.dataTitleColumnSet( table );\n }\n undoSelect();\n };\n\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n\n array = fillTableArray();\n\n undoSelect();\n drawTable(array);\n\n wptbTableSetup.appendChild(table);\n //if (columns || rows) {\n table.recalculateIndexes( true );\n //}\n\n WPTB_LeftPanel();\n \n // this code gets the ID of the active element in the toolbar \n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\n// }\n// }\n// }, false );\n// }\n \n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\n// if( wptbPanelLeft.length > 0 ) {\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }, false );\n// }\n \n// let body = document.getElementsByTagName( 'body' );\n// if( body.length > 0 ) {\n// body[0].addEventListener( 'click', function( e ) {\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }\n// }, false );\n// }\n};","var WPTB_Text = function ( text , DOMElementProt ) {\n let DOMElement = document.createElement('div'),\n elText2 = document.createElement('div'),\n elP = document.createElement('p'),\n kindIndexProt = undefined,\n copy = false;\n \n DOMElement.classList.add( 'wptb-text-container' );\n\n elP.innerHTML = text != undefined ? text : 'Text';\n elText2.appendChild(elP);\n DOMElement.appendChild(elText2);\n if ( DOMElementProt ) {\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n copy = true;\n };\n\n let attributes = [...DOMElementProt.attributes];\n for( let i = 0; i < attributes.length; i++ ) {\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\n }\n } \n\n this.kind = 'text';\n this.getDOMElement = function () {\n return DOMElement;\n };\n applyGenericItemSettings( this, kindIndexProt, copy );\n\n return this;\n};","var WPTB_innerElementSet = function ( element ) {\n \n function newElementProxy(el) {\n if (el == 'list') {\n return new WPTB_List();\n } else if (el == 'image') {\n return new WPTB_Image();\n } else if (el == 'text') {\n return new WPTB_Text();\n } else if (el == 'button') {\n return new WPTB_Button();\n }\n }\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function () {\n \n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n element.classList.remove( 'wptb-moving-mode' );\n }\n \n if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Abowe Element' ) {\n td.insertBefore( element, innerElement );\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n }\n }\n let thisRow = td.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n \n } else {\n return;\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n\n WPTB_innerElementSet( element );\n\n return true;\n }\n element.onmouseover = function(e) {\n element.classList.remove( 'wptb-ondragenter' );\n }\n}","var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\n var node = element.getDOMElement(),\n index,\n listItems,\n copy;\n \n if ( kindIndexProt == undefined || copy == true ) {\n index = document.counter.nextIndex( element.kind );\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\n let elementIndexesArr = [];\n for( let i = 0; i < wptbElements.length; i++ ) {\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\n let infArr = wptbElements[i].className.match( regex );\n if( infArr ) {\n elementIndexesArr.push( infArr[1] );\n }\n }\n if( elementIndexesArr.length > 0 ) {\n let elementIndexMax = Math.max( ...elementIndexesArr );\n index = elementIndexMax + 1;\n } else { \n index = 1;\n }\n } else if ( kindIndexProt && ! copy ) {\n index = kindIndexProt.split('-')[1];\n }\n \n node.onmouseenter = function (event) {\n this.classList.add('wptb-directlyhovered');\n let btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = document.createElement( 'span' ),\n actions = document.createElement( 'span' ), i;\n\n actions.classList.add('wptb-actions');\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\n btnMove.classList.add(\"dashicons\", \"dashicons-move\", 'wptb-move-action');\n btnMove.draggable = true;\n btnDelete.onclick = function (event) {\n let act = this.parentNode.parentNode,\n el = act.parentNode;\n el.removeChild(act);\n \n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n };\n btnCopy.onclick = function (event) {\n let copy;\n if (element.kind == 'list') {\n var td = event.target.parentNode.parentNode.parentNode,\n temp = [],\n srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, node );\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n } else if (element.kind == 'text') {\n var td = event.target.parentNode.parentNode.parentNode;\n copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n } else if ( element.kind == 'image' ) {\n var td = event.target.parentNode.parentNode.parentNode;\n copy = new WPTB_Image( event.target.parentNode.parentNode.children[0].children[0].src, node );\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n } else {\n var td = event.target.parentNode.parentNode.parentNode,\n text = event.target.parentNode.parentNode.childNodes[0].querySelector( 'p' ).innerHTML;\n copy = new WPTB_Button( text, node );\n\n node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );\n }\n \n WPTB_innerElementSet( copy.getDOMElement() );\n };\n let parent = this,\n infArr,\n type;\n infArr = parent.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let dragImagesArr = WPTB_Helper.dragImagesArr();\n btnMove.ondragstart = function (event) {\n this.parentNode.style.opacity = 0;\n parent.classList.remove( 'wptb-directlyhovered' );\n parent.classList.add( 'wptb-moving-mode' );\n \n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.parentNode;\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n };\n\n if (element.kind === 'button') {\n let a = node.querySelector( 'a' ),\n target = a.querySelector( 'div' );\n a.onclick = function( e ) {\n e.preventDefault();\n }\n WPTB_Helper.buttonsTinyMceInit( target );\n } else if (element.kind === 'text') {\n tinyMCE.init({\n target: node.childNodes[0],\n inline: true,\n plugins: \"link, paste\",\n dialog_type: \"modal\",\n theme: 'modern',\n menubar: false,\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\n paste_as_text: true,\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\n setup : function( ed ) {\n ed.on( 'change', function(e) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n });\n },\n init_instance_callback: function (editor) {\n window.currentEditor = editor;\n //editor.fire('focus');\n editor.on('focus', function (e) {\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\n if (window.currentEditor &&\n document.getElementById('wptb_builder').scrollTop >= 55 &&\n window.currentEditor.bodyElement.style.display != 'none') {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\n } else {\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\n }\n });\n }\n });\n \n } else {\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\n for ( let i = 0; i < listItems.length; i++ ) {\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\n }\n }\n\n actions.appendChild(btnMove);\n actions.appendChild(btnCopy);\n actions.appendChild(btnDelete);\n this.appendChild( actions );\n };\n\n node.onmouseleave = function ( event ) {\n this.classList.remove( 'wptb-directlyhovered' );\n let iter = 0;\n while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {\n event.target.querySelector( '.wptb-actions' ).remove();\n iter++;\n }\n };\n \n // Change data-title-column if the title was changed\n if( element.kind == 'text' ) {\n var observer = new MutationObserver( function( mutations ) {\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\n if( row.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n });\n var config = { attributes: true, attributeFilter: ['style'] };\n observer.observe( element.getDOMElement(), config );\n }\n\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\n if ( node_wptb_element_kind_num ) {\n node.classList.remove( node_wptb_element_kind_num[0] );\n }\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\n node.classList.add( 'wptb-ph-element' );\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n } else {\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n }\n new WPTB_ElementOptions( element, index, kindIndexProt );\n\n document.counter.increment(element.kind);\n};",""]}
inc/admin/js/admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var n=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;n.open("GET",t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(n.responseText);document.getElementById("wptb-setup-name").value=t[0],t[1]?(document.getElementsByClassName("wptb-table-generator")[0].style.display="none",document.getElementsByClassName("wptb-table-setup")[0].appendChild(WPTB_Parser(t[1])),WPTB_Table(),WPTB_LeftPanel(),WPTB_Settings()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},n.send(null)}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table";document.counter=new ElementCounters,document.select=new MultipleSelect,WPTB_Initializer(),settings=WPTB_Settings()});var WPTB_Button=function(e,t){var n=document.createElement("div"),a=document.createElement("div"),r=document.createElement("a"),l=document.createElement("div"),o=void 0,s=!1;if(n.classList.add("wptb-button-container","wptb-size-M","wptb-"),a.classList.add("wptb-button-wrapper"),l.classList.add("wptb-button"),l.innerHTML=null!=e?e:"Button Text",t){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(o=i[1],s=!0);var d=[].concat(_toConsumableArray(t.attributes));if(0<d.length)for(var c=0;c<d.length;c++)n.setAttribute(d[c].name,d[c].value);var m=t.querySelector(".wptb-button-wrapper");if(m){var p=[].concat(_toConsumableArray(m.attributes));if(0<p.length)for(var u=0;u<p.length;u++)"style"==p[u].name&&a.setAttribute(p[u].name,p[u].value)}var b=t.querySelector("a");if(b){var g=[].concat(_toConsumableArray(b.attributes));if(0<g.length)for(var y=0;y<g.length;y++)"style"!=g[y].name&&"href"!=g[y].name&&"target"!=g[y].name||r.setAttribute(g[y].name,g[y].value)}}return a.appendChild(r),r.appendChild(l),n.appendChild(a),this.kind="button",this.getDOMElement=function(){return n},applyGenericItemSettings(this,o,s),this},WPTB_Cell=function(e,s){if(!s){(s=document.createElement("td")).style.padding=jQuery("#wptb-table-padding-number").val()+"px";var t=jQuery("#wptb-table-inner-border-number").val();""!=t&&0!=parseInt(t)&&(s.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),s.classList.add("wptb-droppable","wptb-cell")}s.draggable=!1,e&&(s.onclick=e),WPTB_innerElementSet(s);var i=s.getElementsByClassName("wptb-ph-element");if(0<i.length)for(var n=function(e){var t=s.getElementsByClassName("wptb-space-between");if(0<t.length)for(var n=0;n<t.length;n++)WPTB_Space(t[n]);i[e].getDOMElement=function(){return i[e]},WPTB_innerElementSet(i[e]);var a=i[e].className.match(/wptb-element-((.+-)\d+)/i);if(a&&Array.isArray(a)){var r=a[1].split("-");if(i[e].kind=r[0],applyGenericItemSettings(i[e],a[1]),"list"==i[e].kind){var l=i[e].getElementsByTagName("li");if(0<l.length)for(var o=0;o<l.length;o++)WPTB_ListItem(void 0,l[o])}}},a=0;a<i.length;a++)n(a);return this.getDOMElement=function(){return s},this.setCoords=function(e,t){var n=this.getDOMElement();n.dataset.yIndex=e,n.dataset.xIndex=t},this.getCoords=function(){var e,t=this.getDOMElement();return e.x=t.dataset.xIndex,e.y=t.dataset.yIndex,e},this.appendElement=function(e){getDOMElement().appendChild(e)},this},WPTB_DropHandle=function(i,e){var d=void 0,c=void 0;if(0==document.getElementsByClassName("wptb-drop-handle").length){(d=document.createElement("div")).classList.add("wptb-drop-handle"),(c=document.createElement("div")).classList.add("wptb-drop-border-marker");var t=document.createElement("div"),n=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div");t.classList.add("wptb-drop-border-marker-top"),n.classList.add("wptb-drop-border-marker-right"),a.classList.add("wptb-drop-border-marker-bottom"),r.classList.add("wptb-drop-border-marker-left"),c.appendChild(t),c.appendChild(n),c.appendChild(a),c.appendChild(r);var l=document.getElementsByTagName("body");0<l.length&&(l[0].appendChild(d),l[0].appendChild(c)),d.ondragenter=function(){},d.ondragover=function(e){e.preventDefault()},d.ondragleave=function(){},d.ondrop=function(e){e.preventDefault();var t,n=void 0;e.dataTransfer.getData("wptbElement")?n=(n=(t=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:t.includes("image")?new WPTB_Image:t.includes("text")?new WPTB_Text:t.includes("button")?new WPTB_Button:void 0).getDOMElement():((n=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).classList.remove("wptb-moving-mode"),n.classList.remove("wptb-moving-into-same-elem"));var a=void 0;if("Drop Here"==d.dataset.text)"td"==(i=d.getDOMParentElement()).nodeName.toLowerCase()&&(a=d.getDOMParentElement()).appendChild(n);else{var r=d.getDOMParentElement();if(a=r.parentNode,"Abowe Element"==d.dataset.text)a.insertBefore(n,r);else if("Below Element"==d.dataset.text){var l=r.nextSibling;a.insertBefore(n,l)}}var o=a.parentNode;if(o.classList.contains("wptb-table-head")){var s=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(s)}d.style.display="none",c.style.display="none",WPTB_innerElementSet(n)},document.querySelector(".wptb-container").onscroll=function(){d.style.display="none",c.style.display="none"}}else d=document.getElementsByClassName("wptb-drop-handle")[0],c=document.getElementsByClassName("wptb-drop-border-marker")[0];if(!i||"td"!=i.nodeName.toLowerCase()||0==i.getElementsByClassName("wptb-ph-element").length){var o=void 0;if("td"==i.localName?o=i.parentNode:"div"==i.localName&&i.classList.contains("wptb-ph-element")&&(o=i.parentNode.parentNode),o.classList.contains("wptb-table-head")){for(var s=e.dataTransfer.types,m=!1,p=0;p<s.length;p++){var u=s[p].match(/wptbelindic-([a-z]+)/i);if(u&&"text"!=u[1]){m=!0;break}}if(m)return}d.style.width=i.offsetWidth+"px";var b=i.offsetHeight,g=i.getBoundingClientRect(),y=Number(g.left),f=void 0;if(d.style.left=y+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var v=document.getElementsByClassName("wptb-moving-mode")[0];i==v?(d.classList.add("wptb-moving-into-same-elem"),c.classList.add("wptb-moving-into-same-elem")):(d.classList.remove("wptb-moving-into-same-elem"),c.classList.remove("wptb-moving-into-same-elem"))}if(d.getDOMParentElement=function(){return i},d.style.display="block",c.style.display="block","td"!=i.nodeName.toLowerCase()){var w=null==e.offsetY?e.layerY:e.offsetY;f=Number(g.top)-Number(11),d.dataset.text="Abowe Element",b/2<w&&(f=Number(g.top)+b-1,d.dataset.text="Below Element")}else d.dataset.text="Drop Here",f=Number(g.top)+b/2-5;d.style.top=f+"px",c.style.top=g.top+"px",c.style.left=g.left+"px",wptbDropBorderMarkerTop=c.querySelector(".wptb-drop-border-marker-top"),wptbDropBorderMarkerTop.style.width=Number(i.offsetWidth)-Number(1)+"px",wptbDropBorderMarkerRight=c.querySelector(".wptb-drop-border-marker-right"),wptbDropBorderMarkerRight.style.height=Number(g.bottom)-Number(g.top)-1+"px",wptbDropBorderMarkerRight.style.left=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom=c.querySelector(".wptb-drop-border-marker-bottom"),wptbDropBorderMarkerBottom.style.width=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom.style.top=wptbDropBorderMarkerRight.style.height,wptbDropBorderMarkerLeft=c.querySelector(".wptb-drop-border-marker-left"),wptbDropBorderMarkerLeft.style.height=wptbDropBorderMarkerRight.style.height}},ElementCounters=function(){var t=[];return t.text=0,t.image=0,t.list=0,t.button=0,this.increment=function(e){e in t&&t[e]++},this.nextIndex=function(e){if(e in t)return t[e]+1},this},WPTB_ElementOptions=function(e,t,n){var a,r=e.getDOMElement();prop=document.querySelector(".wptb-"+e.kind+"-options-prototype").cloneNode(!0),prop.classList.remove("wptb-"+e.kind+"-options-prototype"),a="wptb-options-"+e.kind+"-"+t;for(var l=prop.getElementsByClassName("wptb-element-property"),o=0;o<l.length;o++)l[o].dataset.element=a;if(prop.classList.add(a),document.getElementById("element-options-group").appendChild(prop),n)if("button"==e.kind){var s=document.getElementsByClassName("wptb-element-"+n)[0],i=void 0,d=void 0,c=void 0,m=void 0;if(s&&(m=s.className.match(/wptb-size-([a-z]+)/i)),m&&Array.isArray(m)){var p=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<p.length;o++)p[o].classList.remove("selected"),p[o].innerHTML==m[1]&&p[o].classList.add("selected")}if(s&&(i=s.getElementsByClassName("wptb-button-wrapper"),d=s.getElementsByTagName("a"),c=s.getElementsByClassName("wptb-button")),i){var u=i[0].style.justifyContent,b=prop.querySelector('select[data-type="button-alignment"]').getElementsByTagName("option"),g=void 0;"flex-start"==u?g="left":"center"!=u&&u?"flex-end"==u&&(g="right"):g="center";for(var y=0;y<b.length;y++)b[y].value==g&&(b[y].selected=!0)}if(0<d.length){var f=d[0].getAttribute("href"),v=d[0].getAttribute("target"),w=d[0].getAttribute("id"),h=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),E=B.getAttribute("id"),T=B.parentNode.getElementsByTagName("label")[0],C=prop.querySelector('input[data-type="button-id"]');E=E+"-"+n.split("-")[1],B.setAttribute("id",E),T.setAttribute("for",E),h.value=f,v&&"_blank"==v&&(B.checked=!0),C.value=w}if(c){var N=c[0].style.color,S=c[0].style.backgroundColor,x=prop.querySelector('input[data-type="button-text-color"]'),I=prop.querySelector('input[data-type="button-color"]');x.value=WPTB_Helper.rgbToHex(N),I.value=WPTB_Helper.rgbToHex(S)}}else if("image"==e.kind){var _=document.getElementsByClassName("wptb-element-"+n);if(0<_.length){var k=_[0].getElementsByTagName("a");if(0<k.length){var L=k[0];if(L){L.onclick=function(e){e.preventDefault()};for(var A=L.style.textAlign,P=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),W=0;W<P.length;W++)P[W].value==A&&(P[W].selected=!0);var M=L.getAttribute("href"),D=prop.querySelector('input[data-type="image-link"]');M&&(D.value=M);var q=L.getAttribute("target"),H=prop.querySelector('input[data-type="image-link-target"]'),O=H.getAttribute("id"),R=H.parentNode.getElementsByTagName("label")[0];O=O+"-"+n.split("-")[1],H.setAttribute("id",O),R.setAttribute("for",O),q&&"_blank"==q&&(H.checked=!0);var z=L.getElementsByTagName("img");if(0<z.length){var j=z[0].style.width;if(j){var Q=prop.querySelector('input[type="range"][data-type="image-size"]'),F=prop.querySelector('input[type="number"][data-type="image-size"]');Q.value=parseInt(j),F.value=parseInt(j)}var G=z[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=G}}}}}else if("text"==e.kind){var J=document.getElementsByClassName("wptb-element-"+n);if(0<J.length){var Y=J[0].style.fontSize,X=J[0].style.color,K=prop.querySelector('input[type="range"][data-type="font-size"]'),U=prop.querySelector('input[type="number"][data-type="font-size"]'),$=prop.querySelector('input[type="text"][data-type="color"]');K.value=parseInt(Y),U.value=parseInt(Y),$.value=WPTB_Helper.rgbToHex(X)}}else if("list"==e.kind){var V=document.getElementsByClassName("wptb-element-"+n);if(0<V.length){var Z=V[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(Z);var ee=V[0].querySelectorAll("li");if(0<ee.length){var te=ee[0].querySelector("p").classList;if(0<te.length){var ne=prop.querySelector('select[data-type="list-class"]');if(ne){ne.value="unordered";for(var ae=ne.parentNode.nextSibling,re=0;re<10&&"1"!=ae.nodeType;re++)ae=ae.nextSibling;if(ae){var le=ae.getAttribute("id");ae.setAttribute("id",le+"-"+n),ae.style.display="flex"}var oe=prop.querySelector('select[data-type="list-style-type"]');oe&&(oe.parentNode.style.display="flex",te.contains("wptb-list-style-type-disc")?oe.value="disc":te.contains("wptb-list-style-type-circle")?oe.value="circle":te.contains("wptb-list-style-type-square")?oe.value="square":te.contains("wptb-list-style-type-none")&&(oe.value="none"))}}}var se=V[0].getElementsByClassName("wptb-list-item-content");if(0<se.length){for(var ie=[],de=0;de<se.length;de++){var ce=se[de].querySelector("p");ce&&(ce.style.textAlign?ie.push(ce.style.textAlign):ie.push("left"))}var me=0,pe=0,ue=0;if(0<ie.length)for(var be=0;be<ie.length;be++)ie[be]&&("left"==ie[be]?me++:"center"==ie[be]?pe++:"right"==ie[be]&&ue++);var ge=prop.querySelector('select[data-type="list-alignment"]'),ye=Math.max(me,pe,ue);me==ye?ge.value="left":pe==ye?ge.value="center":ue==ye&&(ge.value="right")}}}if(r.onclick=function(){var e=this.className.match(/wptb-element-((.+-)\d+)/i),t=".wptb-"+e[2]+"options.wptb-options-"+e[1];document.getElementsByClassName("wptb-elements-container")[0].style.display="none",document.getElementsByClassName("wptb-settings-section")[0].style.display="none",document.getElementById("element-options-group").style.display="block";for(var n=document.getElementById("element-options-group").childNodes,a=0;a<n.length;a++)n[a].style&&(n[a].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var fe=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<fe.length;o++)fe[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),n=t[1],a=t[2],r=document.getElementsByClassName("wptb-element-"+n+"-"+a)[0];r.classList.remove("wptb-size-S"),r.classList.remove("wptb-size-M"),r.classList.remove("wptb-size-L"),r.classList.remove("wptb-size-XL"),r.classList.add("wptb-size-"+e);for(var l=this.parentNode.getElementsByClassName("wptb-btn-size-btn"),o=0;o<l.length;o++)l[o].classList.remove("selected");this.classList.add("selected")}}var ve=prop.getElementsByClassName("wptb-element-property");for(o=0;o<ve.length;o++){if(ve[o].classList.contains("wptb-color-picker")&&jQuery(ve[o]).wpColorPicker({change:function(e,t){var n,a,r,l=e.target;if(a=(n=l.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],r=n[2],affectedEl=document.getElementsByClassName("wptb-element-"+a+"-"+r)[0],"button"==a)"button-text-color"==l.dataset.type?affectedEl.getElementsByClassName("wptb-button")[0].style.color=t.color.toString():affectedEl.getElementsByClassName("wptb-button")[0].style.backgroundColor=t.color.toString();else if("list"==a){var o=affectedEl.querySelectorAll("p");if(0<o.length)for(var s=0;s<o.length;s++)o[s].style.color=t.color.toString()}else affectedEl.style.color=t.color.toString()}}),"font-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].onchange()};if("image-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].onchange()};ve[o].onchange=function(e){var t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),n=t[1],a=t[2],r=document.getElementsByClassName("wptb-element-"+n+"-"+a)[0],l=this.value;switch(this.dataset.type){case"src":r.getElementsByTagName("img")[0].src=this.value;break;case"alternative-text":r.getElementsByTagName("img")[0].alt=this.value;break;case"image-link":r.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value);break;case"image-link-target":1==this.checked?r.getElementsByTagName("a")[0].target="_blank":r.getElementsByTagName("a")[0].target="_self";break;case"image-link-nofollow":1==this.checked?r.getElementsByTagName("a")[0].rel="nofollow":r.getElementsByTagName("a")[0].removeAttribute("rel");break;case"image-size":r.getElementsByTagName("img")[0].style.width=this.value+"%",r.getElementsByTagName("img")[0].style.height="auto",this.parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].value=this.value;break;case"image-alignment":r.getElementsByTagName("img")[0].parentNode.style.textAlign=this.value;break;case"font-size":r.style.fontSize=l+"px";break;case"button-alignment":var o="";o="left"==this.value?"start":"right"==this.value?"flex-end":"center",r.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=o;break;case"button-link":this.value?r.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value):r.getElementsByTagName("a")[0].removeAttribute("href");break;case"button-link-target":1==this.checked?r.getElementsByTagName("a")[0].target="_blank":r.getElementsByTagName("a")[0].target="_self";break;case"button-link-nofollow":1==this.checked?r.getElementsByTagName("a")[0].rel="nofollow":r.getElementsByTagName("a")[0].removeAttribute("rel");break;case"button-id":this.value?r.getElementsByTagName("a")[0].id=this.value:r.getElementsByTagName("a")[0].removeAttribute("id");case"button-color":break;case"list-alignment":for(var s=r.querySelectorAll("li"),i=0;i<s.length;i++){var d=s[i].querySelector("p");d&&(d.style.textAlign=this.value)}break;case"list-class":var c=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,m=c.parentNode;if("unordered"==l){c.style.display="flex",m.querySelector(".wptb-list-icon-select-label").style.display="flex";var p=r.querySelectorAll("li");for(i=0;i<p.length;i++){var u=p[i].querySelector("p");u.removeAttribute("class"),u.classList.add("wptb-list-style-type-disc")}m.querySelector("[data-type=list-style-type]").value="disc"}else{c.style.display="none",m.querySelector(".wptb-list-icon-select-label").style.display="none";var b=r.querySelectorAll("li");for(i=0;i<b.length;i++){b[i].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(b=r.querySelectorAll("li"),i=0;i<b.length;i++){var g=b[i].querySelector("p");g.removeAttribute("class"),g.classList.add("wptb-list-style-type-"+l.toLowerCase())}}}}},WPTB_Helper={hexToRgb:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+parseInt(t[1],16)+","+parseInt(t[2],16)+","+parseInt(t[3],16)+")":null},rgbToHex:function(e){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},getDragImageCustom:function(e){var t=location.protocol+"//"+location.hostname,n=document.createElement("img");return n.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",n},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var n=0;n<t.length;n++)t[n].dataset.listStyleTypeIndex=Number(n)+1+"."},listItemsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("keydown",function(e){var t=e.target.parentNode;if(13==e.keyCode){e.preventDefault();var n=e.target.innerHTML,a=new WPTB_ListItem(n,t,!0);t.parentNode.insertBefore(a.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(a.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}else if("8"==e.keyCode||"46"==e.keyCode){var r=e.target.querySelector("p").innerHTML.replace(/<[^>]+>/g,"");if(""==(r=(r=r.replace(/\s+/g," ").trim()).replace(/&nbsp;/g,"").trim()))e.preventDefault(),e.target.querySelector("p").innerText="\n";else{var l=WPTB_Helper.getSelectionText();(l=(l=l.replace(/\s+/g," ").trim()).replace(/&nbsp;/g,"").trim())==r&&(e.preventDefault(),e.target.querySelector("p").innerText="\n")}}}),e.on("keyup",function(e){})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},buttonsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",toolbar:"bold italic strikethrough",setup:function(e){e.on("keydown",function(e){13==e.keyCode&&e.preventDefault()})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},linkHttpCheckChange:function(e){if(e){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var t=e.split("/"),n=void 0;return Array.isArray(t)&&0<t.length&&(n=t[t.length-1]),document.location.protocol+"//"+n}return""},dataTitleColumnSet:function(e){for(var t=e.rows,n=t[0],a=getComputedStyle(n),r=n.children,l={},o=0;o<r.length;o++){for(var s=r[o].children,i=0;i<s.length;i++){var d=s[i];if(d.classList.contains("wptb-ph-element")){d.getAttribute("style");if("text"==d.className.match(/wptb-element-(.+)-(\d+)/i)[1]){var c=d.querySelector("p"),m=c.textContent,p=c.style.textAlign;l[r[o].dataset.xIndex]=[m,d.style.fontSize,d.style.color,a.backgroundColor,p];break}}}l[r[o].dataset.xIndex]||(l[r[o].dataset.xIndex]=["","","",a.backgroundColor,""])}for(var u=1;u<t.length;u++)for(var b=t[u].children,g=0;g<b.length;g++)l[b[g].dataset.xIndex]?(b[g].dataset.titleColumn=l[b[g].dataset.xIndex][0],b[g].dataset.titleColumnFontSize=l[b[g].dataset.xIndex][1],b[g].dataset.titleColumnColor=l[b[g].dataset.xIndex][2],b[g].dataset.titleBackgroundColor=l[b[g].dataset.xIndex][3],b[g].dataset.titleAlign=l[b[g].dataset.xIndex][4]):(b[g].dataset.titleColumn="",b[g].dataset.titleColumnFontSize="",b[g].dataset.titleColumnColor="",b[g].dataset.titleBackgroundColor="",b[g].dataset.titleAlign="")},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},settingsPanelClear:function(){document.getElementById("wptb-top-row-as-header").checked=!1,document.getElementById("wptb-table-border-slider").value=0,document.getElementById("wptb-table-border-number").value=0,document.getElementById("wptb-inner-border-check").checked=!1,document.getElementById("wptb-apply-inner-border").classList.remove("visible"),document.getElementById("wptb-table-inner-border-slider").value=1,document.getElementById("wptb-table-inner-border-number").value=1,WPTB_Helper.wpColorPickerClear("wptb-table-border-color"),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg"),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg"),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg"),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},wpColorPickerClear:function(e){var t=document.getElementById(e),n=WPTB_Helper.findAncestor(t,"wp-picker-container"),a=n.parentNode;a.removeChild(n);var r=document.createElement("input");r.setAttribute("id",e),r.value="",a.appendChild(r)},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")}},WPTB_Image=function(e,t){var n=void 0,a=void 0,r=!1;if(null==t){n=document.createElement("div");var l=document.createElement("a"),o=document.createElement("img");l.style.display="inline-block",l.appendChild(o),n.appendChild(l),l.onclick=function(e){e.preventDefault()},file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1}),file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),o.src=attachment.url}),null==e?file_frame.open():o.src=e}else{(n=t.cloneNode(!0)).getElementsByTagName("a")[0].onclick=function(e){e.preventDefault()};var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(a=s[1],r=!0)}return this.kind="image",this.getDOMElement=function(){return n},applyGenericItemSettings(this,a,r),this},WPTB_Initializer=function(){var e=document.body;columnsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[0],columnsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[0],rowsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[1],rowsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[1],columnsInput=document.getElementById("wptb-columns-number"),rowsInput=document.getElementById("wptb-rows-number"),columnsDecrementButton.onclick=function(){1<columnsInput.value&&columnsInput.value--},columnsIncrementButton.onclick=function(){columnsInput.value<10&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<10&&rowsInput.value++},document.getElementById("wptb-generate-table").onclick=function(){var e=document.getElementById("wptb-columns-number").value,t=document.getElementById("wptb-rows-number").value;WPTB_Table(e,t)}},WPTB_LeftPanel=function(){var e,t,l=document.getElementsByClassName("wptb-preview-table")[0],n=document.getElementsByClassName("wptb-element");function a(e,t){if(!(3<t)&&l){var n=l.getElementsByTagName("tr");if(n.length>t){var a=n[t].style.backgroundColor,r=document.getElementById(e);r&&a&&(r.value=WPTB_Helper.rgbToHex(a))}}}function r(e){for(var t=l.getElementsByTagName("td"),n=0;n<t.length;n++)t[n].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[n].style.borderStyle="solid"}function o(e){for(var t=l.getElementsByTagName("td"),n=0;n<t.length;n++)t[n].style.padding=e+"px"}function s(e){l.style.borderWidth=e+"px",l.style.borderStyle="solid"}function i(e,t,n){e.onkeydown=function(){var e=this.value;0==(e=String(e))[0]?this.value="":(e=e.substring(0,t),this.value=e)},e.onkeyup=function(){var e=this.value;e=String(e),n<e&&(this.value=n)}}a("wptb-even-row-bg",1),jQuery("#wptb-even-row-bg").wpColorPicker({change:function(e,t){for(var n=l.getElementsByTagName("tr"),a=1;a<n.length;a+=2)n[a].style.backgroundColor=t.color.toString()},clear:function(){for(var e=l.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var n=e[t].getElementsByTagName("td"),a=0;a<n.length;a++)n[a].style.backgroundColor=""}}}),a("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var n=l.getElementsByTagName("tr"),a=2;a<n.length;a+=2)n[a].style.backgroundColor=t.color.toString()},clear:function(){for(var e=l.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var n=e[t].getElementsByTagName("td"),a=0;a<n.length;a++)n[a].style.backgroundColor=""}}}),a("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){l.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString()},clear:function(){var e=l.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),n=0;n<t.length;n++)t[n].style.backgroundColor=""}}),e=l,t=document.getElementById("wptb-top-row-as-header"),e&&e.classList.contains("wptb-table-preview-head")?t.checked=!0:t.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var n=document.getElementById("wptb-table-border-color");n&&(n.value=WPTB_Helper.rgbToHex(t))}var a=e[0].style.borderWidth;if(a){var r=document.getElementById("wptb-table-border-slider"),l=document.getElementById("wptb-table-border-number");r&&(r.value=parseInt(a)),l&&(l.value=parseInt(a))}var o=e[0].querySelector("td").style.borderWidth;if(o){var s=document.getElementById("wptb-inner-border-check"),i=document.getElementById("wptb-apply-inner-border");if(o&&0<parseInt(o)){if(s&&(s.checked=!0,i)){i.classList.add("visible");var d=document.getElementById("wptb-table-inner-border-slider"),c=document.getElementById("wptb-table-inner-border-number");d.value=parseInt(o),c.value=parseInt(o)}}else s.checked=!1}(a&&0<parseInt(a)||o&&0<parseInt(o))&&(document.getElementById("wptb-table-border-color-set-area").style.display="")}}(),jQuery("#wptb-table-border-color").wpColorPicker({change:function(e,t){var n=l.getElementsByTagName("td");l.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var a=0;a<n.length;a++){var r=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(n[a].style.border=(0!=r?r:1)+"px solid "+t.color.toString())}},clear:function(){var e=l.getElementsByTagName("td");l.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor=""}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var n=t.style.padding;if(n){var a=document.getElementById("wptb-table-cell-slider"),r=document.getElementById("wptb-table-cell-number");a&&(a.value=parseInt(n)),r&&(r.value=parseInt(n))}}}}(),i(document.getElementById("wptb-table-border-number"),1,50),i(document.getElementById("wptb-table-inner-border-number"),1,50),i(document.getElementById("wptb-table-cell-number"),1,50),i(document.getElementById("wptb-text-font-size-number"),1,50),i(document.getElementById("wptb-image-width-number"),2,100),document.getElementById("wptb-table-cell-slider").oninput=function(){document.getElementById("wptb-table-cell-number").value=this.value,o(this.value)},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,o(this.value)},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,s(this.value);var e=document.getElementById("wptb-inner-border-check").checked,t=document.getElementById("wptb-table-border-color-set-area");0==this.value&&0==e?t.style.display="none":t.style.display=""},document.getElementById("wptb-table-border-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,s(this.value)},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,r(this.value)},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,r(this.value)},document.getElementById("wptb-inner-border-check").onchange=function(){if(l){var e=this.checked?"checked":"unchecked";!function(e){var t=null!=document.querySelector("#wptb-table-border-color").value?document.querySelector("#wptb-table-border-color").value:"rgb(0,0,0)";0!=document.querySelector("#wptb-table-inner-border-slider").value&&0!=document.querySelector("#wptb-table-inner-border-number").value||(document.querySelector("#wptb-table-inner-border-slider").value=1,document.querySelector("#wptb-table-inner-border-number").value=1);var n=document.querySelector("#wptb-table-inner-border-slider").value+"px",a=document.getElementsByClassName("wptb-preview-table");if(0<a.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var r=a[0].getElementsByTagName("td"),l=0;l<r.length;l++)r[l].style.border=n+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),r=a[0].getElementsByTagName("td"),l=0;l<r.length;l++)r[l].style.border="0px solid "+t}(e);var t=document.getElementById("wptb-table-border-slider").value,n=document.getElementById("wptb-table-border-color-set-area");n.style.display="unchecked"==e&&0==t?"none":""}},document.getElementById("wptb-top-row-as-header").onchange=function(){!function(e,t){if(t.checked)WPTB_Helper.dataTitleColumnSet(e),e.classList.add("wptb-table-preview-head"),e.rows[0].classList.add("wptb-table-head");else{var n=e.rows;e.classList.remove("wptb-table-preview-head"),n[0].classList.remove("wptb-table-head");for(var a=1;a<n.length;a++)for(var r=n[a].children,l=0;l<r.length;l++)r[l].removeAttribute("data-title-column")}}(l,this)};for(var d=0;d<n.length;d++)n[d].ondragstart=function(e){e.dataTransfer.setData("wptbElement",this.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+this.dataset.wptbElement,"wptbElIndic-"+this.dataset.wptbElement)};l&&(document.getElementById("wptb-activate-cell-management-mode").onclick=l.toggleTableEditMode,document.getElementById("wptb-table-edit-mode-close").onclick=l.toggleTableEditMode,document.getElementById("wptb-left-scroll-panel-curtain-close").onclick=l.toggleTableEditMode,document.getElementById("wptb-add-end-row").onclick=l.addRowToTheEnd,document.getElementById("wptb-add-start-row").onclick=l.addRowToTheStart,document.getElementById("wptb-add-row-before").onclick=l.addRowBefore,document.getElementById("wptb-add-row-after").onclick=l.addRowAfter,document.getElementById("wptb-add-end-column").onclick=l.addColumnEnd,document.getElementById("wptb-add-start-column").onclick=l.addColumnStart,document.getElementById("wptb-add-column-before").onclick=l.addColumnBefore,document.getElementById("wptb-add-column-after").onclick=l.addColumnAfter,document.getElementById("wptb-delete-column").onclick=l.deleteColumn,document.getElementById("wptb-delete-row").onclick=l.deleteRow,document.getElementById("wptb-merge-cells").onclick=l.mergeCells,document.getElementById("wptb-split-cell").onclick=l.splitCell),document.querySelector(".wptb-left-panel-extend").onclick=function(){var e=document.querySelector(".wptb-container");e&&(e.classList.contains("collapsed")?e.classList.remove("collapsed"):e.classList.add("collapsed"))},document.getElementsByClassName("wptb-builder-panel")[0].addEventListener("click",function(e){if(!(e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar"))){document.getElementsByClassName("wptb-elements-container")[0].style.display="table",document.getElementsByClassName("wptb-settings-section")[0].style.display="block",document.getElementById("element-options-group").style.display="none";var t=document.getElementById("wpcd_fixed_toolbar");t.hasAttribute("data-toolbar-active-id")&&document.getElementById(t.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}},!1)},WPTB_List=function(e,t){var n,a=document.createElement("ul"),r=document.createElement("div"),l=void 0,o=!1;if(r.classList.add("wptb-list-item-container"),this.kind="list",""===e);else if(e){var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],o=!0);for(d=0;d<e.length;d++){var i=t.querySelector("li");n=new WPTB_ListItem(e[d],i,!0),a.appendChild(n.getDOMElement())}}else for(var d=0;d<3;d++)n=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),a.appendChild(n.getDOMElement());return r.appendChild(a),this.getDOMElement=function(){return r},applyGenericItemSettings(this,l,o),WPTB_Helper.listItemsRecalculateIndex(a),this},WPTB_ListItem=function r(e,t,n){var a=void 0;if(null==t||t&&n){null==e&&(e="New List Item");var l=document.createElement("li");if((s=document.createElement("div")).classList.add("wptb-list-item-content"),t){var o=t.getAttribute("style");o&&l.setAttribute("style",o)}l.appendChild(s),s.innerHTML=e,s.onkeyup=window.listItemKeyListener,a=!0}else{var s;(s=(l=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,a=!1}if(l.onmouseenter=function(e){var t=document.createElement("span"),n=document.createElement("span"),a=document.createElement("span");a.classList.add("wptb-actions"),t.classList.add("dashicons","dashicons-trash","wptb-delete-action"),n.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),this.classList.add("wptb-directlyhovered"),t.onclick=function(){var e=this.parentNode,t=this.parentNode.parentNode,n=t.parentNode;t.removeChild(e),n.removeChild(t),WPTB_Helper.listItemsRecalculateIndex(n)},n.onclick=function(e){var t=e.target.parentNode.parentNode,n=t.querySelector(".wptb-list-item-content").innerHTML,a=new r(n,t,!0);t.parentNode.insertBefore(a.getDOMElement(),l),WPTB_Helper.listItemsTinyMceInit(a.getDOMElement().firstChild),setTimeout(function(){s.innerHTML=n,WPTB_Helper.listItemsRecalculateIndex(t.parentNode)},5)},a.append(n,t),this.appendChild(a)},l.onmouseleave=function(e){this.removeAttribute("class");for(var t=0;e.target.querySelector(".wptb-actions")&&t<5;)e.target.querySelector(".wptb-actions").remove(),t++},this.getDOMElement=function(){return l},a)return this},MultipleSelect=function(){var r=[],n=!1;return this.activateMultipleSelectMode=function(){r=[];for(var e=document.getElementsByClassName("wptb-preview-table")[0].getElementsByTagName("td"),t=0;t<e.length;t++)e[t].classList.remove("wptb-highlighted");n=!0},this.deactivateMultipleSelectMode=function(){n=!1},this.isActivated=function(){return n},this.pushSelectedCell=function(e){n&&(r.push(e),e.classList.add("wptb-highlighted"))},this.selectedCells=function(){return r},this.flushSelectedCells=function(){r=[]},this.getFirst=function(){for(var e,t=1e3,n=1e3,a=r.length-1;0<=a;a--)t>=r[a].dataset.xIndex&&n>=r[a].dataset.yIndex&&(e=r[a],t=r[a].dataset.xIndex,n=r[a].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,n=-1,a=r.length-1;0<=a;a--)t<=r[a].dataset.xIndex&&n<=r[a].dataset.yIndex&&(e=r[a],t=r[a].dataset.xIndex,n=r[a].dataset.yIndex);return e},this.removeAllButFirst=function(){for(var e=this.getFirst(),t=1;t<r.length;t++)r[t].classList.add("wptb-fused-cell-"+e.dataset.xIndex+"-"+e.dataset.yIndex)},this};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var WPTB_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.children[0],a=[].concat(_toConsumableArray(n.querySelectorAll(".wptb-column-title-mobile-container"))),r=0;r<a.length;r++){a[r].parentNode.removeChild(a[r])}for(var l=n.querySelectorAll("td"),o=0;o<l.length;o++)l[o].classList.add("wptb-droppable"),l[o].classList.remove("wptb-column-title-mobile-not-elements");return n},WPTB_Parser2=function(e){if(Array.isArray(e)){var t=void 0;if(1==e.length)return t.appendChild(document.createTextNode(e[0]));if(0 in e){var n=e[0];if(t=document.createElement(n),1 in e&&Array.isArray(e[1]))for(var a=e[1],r=0;r<a.length;r++)Array.isArray(a[r])&&t.setAttribute(a[r][0],a[r][1]);if(2 in e)if(Array.isArray(e[2]))for(var l=0;l<e[2].length;l++)"string"!=typeof e[2][l]||"p"!=n.toLowerCase()?WPTB_Parser(e[2][l])&&t.appendChild(WPTB_Parser(e[2][l])):t.appendChild(document.createTextNode(e[2][l]));else"string"==typeof e[2]&&t.appendChild(document.createTextNode(e[2]))}return t}return!1},WPTB_Settings=function(){for(var e=document.getElementsByClassName("wptb-element"),t=0;t<e.length;t++)e[t].ondragstart=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("wptbElement",e.target.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+e.target.dataset.wptbElement,"wptbElIndic-"+e.target.dataset.wptbElement)},e[t].ondragend=function(){var e=document.querySelector(".wptb-drop-handle"),t=document.querySelector(".wptb-drop-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var n=document.getElementsByClassName("wptb-shortcode-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-embed-disable")||n.classList.add("wptb-shortcode-popup-show")},document.getElementsByClassName("wptb-shortcode-popup-dark-area")[0].onclick=function(){n.classList.remove("wptb-shortcode-popup-show")},document.getElementsByClassName("wptb-shortcode-popup-window-close-icon")[0].onclick=function(){n.classList.remove("wptb-shortcode-popup-show")},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(){var e=document.querySelector(".wptb-edit-bar");e&&e.classList.contains("visible")&&document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var n=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",a=document.getElementById("wptb-setup-name").value.trim(),r=void 0,l=document.getElementsByClassName("wptb-preview-table");if(l=0<l.length?(l=WPTB_Stringifier(l[0])).outerHTML:"",""===a||""===l){var o="";return""===a&&(o+="You must assign a name to the table before saving it.</br>"),""===l&&(o+="Table wasn't created"),(r=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+o+"</div>",r.classList.add("wptb-warning"),void setTimeout(function(){r.removeChild(r.firstChild)},4e3)}var s={title:a,content:l,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(s.id=rs),s=JSON.stringify(s),n.open("POST",t,!0),n.setRequestHeader("Content-type","application/json; charset=utf-8"),n.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(n.responseText);r=document.getElementById("wptb-messaging-area"),"saved"==t[0]?(document.wptbId=t[1],r.innerHTML='<div class="wptb-success wptb-message">Table "'+a+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-embed-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]"):"edited"==t[0]?r.innerHTML='<div class="wptb-success wptb-message">Table "'+a+'" was successfully updated.</div>':r.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>',r.classList.add("wptb-success"),setTimeout(function(){r.removeChild(r.firstChild)},4e3)}},n.send(s)}},WPTB_Space=function s(e){var t=void 0;if(e?t=e:(t=document.createElement("div")).classList.add("wptb-space-between"),t.ondragenter=function(){this.classList.add("visible")},t.ondragover=function(e){e.preventDefault()},t.ondragleave=function(){this.classList.remove("visible")},t.ondrop=function(e){e.stopPropagation();for(var t,n,a,r,l=e.target.nextSibling,o=e.target;!o.classList.contains("wptb-droppable");)o=o.parentNode;e.dataTransfer.getData("wptbElement")?(t=(r=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:r.includes("image")?new WPTB_Image:r.includes("text")?new WPTB_Text:r.includes("button")?new WPTB_Button:void 0,this.classList.remove("visible"),null==l?(o.appendChild(t.getDOMElement()),o.appendChild(new s)):(o.insertBefore(t.getDOMElement(),l),o.insertBefore(new s,l))):(alert(e.dataTransfer.getData("node")),n=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,a=t.parentNode,null!=n&&a.removeChild(n),null==l?(o.appendChild(t),o.appendChild(new s)):(o.insertBefore(t,l),o.insertBefore(new s,l))),this.classList.remove("visible")},!e)return t},WPTB_Stringifier=function(e){if(e){var t=e.cloneNode(!0);t.classList.add("wptb-table-preview-static-indic"),t.dataset.tableColumns=e.columns,t.dataset.reconstraction=1;var n=t.getElementsByTagName("td");if(0<n.length)for(var a=0;a<n.length;a++){for(var r=0;r<n.length;r++)if(1==t.dataset.reconstraction&&1<n[r].colSpan||1<n[r].rowSpan){t.dataset.reconstraction=0;break}e.querySelector("wptb-table-preview-head")&&n[a].removeAttribute("data-x-index"),n[a].removeAttribute("data-y-index"),n[a].removeAttribute("draggable"),n[a].classList.remove("wptb-droppable");var l=n[a].getElementsByClassName("wptb-ph-element");if(0<l.length)for(var o=0;o<l.length;o++){l[o].classList.remove("wptb-directlyhovered");var s=l[o].querySelectorAll(".mce-content-body");if(0<s.length)for(var i=0;i<s.length;i++)s[i].classList.remove("mce-content-body");var d=l[o].querySelectorAll("[data-mce-style]");if(0<d.length)for(var c=0;c<d.length;c++)d[c].removeAttribute("data-mce-style");var m=l[o].querySelectorAll("[contenteditable]");if(0<m.length)for(var p=0;p<m.length;p++)m[p].removeAttribute("contenteditable");var u=l[o].querySelectorAll("[spellcheck]");if(0<u.length)for(var b=0;b<u.length;b++)u[b].removeAttribute("spellcheck");var g=l[o].querySelectorAll("[id^=mce_]");if(0<g.length)for(var y=0;y<g.length;y++)g[y].removeAttribute("id");for(var f=l[o].querySelectorAll(".wptb-actions"),v=f.length;0<v;)f[0].parentNode.removeChild(f[0]),v--}if(n[a].hasAttribute("data-title-column")){var w=document.createElement("div"),h=document.createElement("div");w.classList.add("wptb-column-title-mobile-container"),h.classList.add("wptb-column-title-mobile"),h.dataset.titleColumn=n[a].dataset.titleColumn,h.setAttribute("style","font-size:"+n[a].dataset.titleColumnFontSize+"; \n color:"+n[a].dataset.titleColumnColor+"; background-color:"+n[a].dataset.titleBackgroundColor+"; text-align:"+n[a].dataset.titleAlign+";"),h.style.padding=n[a].style.padding,0==n[a].children.length&&n[a].classList.add("wptb-column-title-mobile-not-elements"),w.appendChild(h),n[a].insertBefore(w,n[a].firstChild)}}return t}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var WPTB_Stringifier2=function(e){1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(null==e)return"";if(null==e.tagName&&3==e.nodeType)return e.nodeValue;var t=[],n=void 0,a=!1,r=[].concat(_toConsumableArray(e.attributes)),l=[],o=[];if((e.parentNode.classList.contains("wptb-list-item-content")||e.parentNode.classList.contains("mce-content-body"))&&"p"==e.tagName.toLowerCase()?(n=e.childNodes,a=!0):n=0<e.children.length?e.children:e.childNodes,0<r.length)for(var s=0;s<r.length;s++)l[s]=[r[s].name,r[s].value];else l="";if(0<n.length)for(var i=0;i<n.length;i++){var d=WPTB_Stringifier(n[i]);Array.isArray(d)||a?o[i]=d:"string"==typeof d&&d&&(o=d)}else o="";return t.push(e.tagName.toLowerCase(),l,o),t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},array=[],WPTB_Table=function(e,t){var h,n,a,f,r=document.getElementsByClassName("wptb-settings-items"),B=document.getElementsByClassName("wptb-table-setup")[0],E=function(e){var t,n=this.rowSpan,a=this.colSpan,r=document.getElementsByClassName("wptb-no-cell-action"),l=document.getElementsByClassName("wptb-single-action"),o=document.getElementsByClassName("wptb-multiple-select-action"),s=N(this),i=s[0],d=s[1];if(document.select.isActivated()){if(this.className.match(/wptb-highlighted/)){this.classList.remove("wptb-highlighted");for(var c=0;c<n;c++)for(var m=0;m<a;m++)array[i+c][d+m]=0}else{this.classList.add("wptb-highlighted");for(c=0;c<n;c++)for(m=0;m<a;m++)array[i+c][d+m]=1}if(0===(t=document.getElementsByClassName("wptb-highlighted").length)){for(c=0;c<o.length;c++)o[c].classList.remove("visible"),o[c].setAttribute("disabled","disabled");for(c=0;c<r.length;c++)r[c].classList.add("visible"),r[c].removeAttribute("disabled");for(c=0;c<l.length;c++)l[c].classList.remove("visible"),l[c].setAttribute("disabled","disabled")}else if(1===t){for(c=0;c<o.length;c++)o[c].classList.remove("visible"),o[c].setAttribute("disabled","disabled");for(c=0;c<r.length;c++)r[c].classList.remove("visible"),r[c].setAttribute("disabled","disabled");for(c=0;c<l.length;c++)l[c].classList.add("visible"),l[c].removeAttribute("disabled")}else{for(c=0;c<o.length;c++)h.isSquare(array)?(o[c].classList.add("visible"),o[c].removeAttribute("disabled")):(o[c].classList.remove("visible"),o[c].setAttribute("disabled","disabled"));for(c=0;c<r.length;c++)r[c].classList.remove("visible"),r[c].setAttribute("disabled","disabled");for(c=0;c<l.length;c++)l[c].classList.remove("visible"),l[c].setAttribute("disabled","disabled")}}},T=function(e){for(var t=0;t<e.length;t++){for(var n=0;n<e[t].length;n++)" "+e[t][n];"\n"}h.isSquare(e)},C=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),n=document.getElementsByClassName("wptb-multiple-select-action"),a=h.getElementsByClassName("wptb-highlighted");a.length;)a[0].classList.remove("wptb-highlighted");for(var r=0;r<array.length;r++)for(var l=0;l<array[r].length;l++)array[r][l]=0;for(r=0;r<n.length;r++)n[r].classList.remove("visible"),n[r].setAttribute("disabled","disabled");for(r=0;r<e.length;r++)e[r].classList.add("visible"),e[r].removeAttribute("disabled");for(r=0;r<t.length;r++)t[r].classList.remove("visible"),t[r].setAttribute("disabled","disabled")},N=function(e){for(var t=[],n=0;n<f;n++)t[n]=0;for(n=0;n<h.rows.length;n++)for(var a=h.rows[n].getElementsByTagName("td"),r=cellPointer=0;r<f;r+=stepsToMove)if(stepsToMove=1,t[r])t[r]--;else{var l=a[cellPointer++];if(l==e)return[n,r];if(1<l.rowSpan){for(var o=0;o<l.colSpan;o++)t[r+o]=l.rowSpan-1;stepsToMove=l.colSpan}else 1<l.colSpan&&(stepsToMove=l.colSpan)}};if(jQuery("#wptb-table-header-bg").val(""),jQuery("#wptb-even-row-bg").val(""),jQuery("#wptb-odd-row-bg").val(""),jQuery("#wptb-table-border-color").val(""),jQuery("#wptb-table-inner-border-number,#wptb-table-inner-border-slider").val("0"),jQuery("#wptb-table-border-number,#wptb-table-border-slider").val("0"),jQuery("#wptb-table-padding-number,#wptb-table-padding-slider").val("15"),e||t){for(var l=0;l<r.length;l++)"wptb-apply-inner-border"!==r[l].id&&r[l].classList.add("visible");(h=document.createElement("table")).classList.add("wptb-preview-table");for(l=0;l<t;l++){(n=h.insertRow(-1)).classList.add("wptb-row");for(var g=0;g<e;g++)(a=new WPTB_Cell(E)).setCoords(l,g),n.appendChild(a.getDOMElement())}}else{var o=document.getElementsByClassName("wptb-preview-table");if(0<o.length){var s=(h=o[0]).getElementsByTagName("td");if(0<s.length)for(var i=0;i<s.length;i++)WPTB_Cell(E,s[i])}}h.toggleTableEditMode=function(){var e=document.getElementsByClassName("wptb-edit-bar"),t=document.getElementById("wptb-cell_mode_background"),n=document.getElementById("wptb-left-scroll-panel-curtain"),a=document.getElementsByClassName("wptb-preview-table");if(0<a.length&&(a=a[0]),0<e.length)for(var r=0;r<e.length;r++)if(e[r].classList.contains("visible")){document.select.deactivateMultipleSelectMode(),e[r].classList.remove("visible"),t.classList.remove("visible"),n.classList.remove("visible"),a.classList.remove("wptb-preview-table-manage-cells");var l=a.getElementsByTagName("td");if(0<l.length)for(var o=0;o<l.length;o++)l[o].classList.remove("wptb-highlighted")}else document.select.activateMultipleSelectMode(),e[r].classList.add("visible"),t.classList.add("visible"),n.classList.add("visible"),a.classList.add("wptb-preview-table-manage-cells")},h.recalculateIndexes=function(e){for(var t=this.getElementsByTagName("tr"),n=void 0,a=0,r=[],l=document.getElementById("wptb-top-row-as-header"),o=0;o<t.length;o++){0==o?(null==e&&(t[o].style.backgroundColor=jQuery("#wptb-table-header-bg").val()),l.checked?null==e&&(this.classList.add("wptb-table-preview-head"),t[o].classList.add("wptb-table-head")):null==e&&(this.classList.remove("wptb-table-preview-head"),t[o].classList.remove("wptb-table-head"))):(o%2==0?null==e&&(t[o].style.backgroundColor=jQuery("#wptb-odd-row-bg").val()):null==e&&(t[o].style.backgroundColor=jQuery("#wptb-even-row-bg").val()),t[o].classList.remove("wptb-table-head")),r[o],n=t[o].getElementsByTagName("td"),null==r[o]&&(r[o]=[]);for(var s=0,i=0;i<n.length;i++){if(null!=r[o][i])for(var d=0;d<100;d++){if(null==r[o][s]){r[o][s]=n[i],n[i].dataset.xIndex=s;break}s++}else r[o][i]=n[i],n[i].dataset.xIndex=s;if(n[i].dataset.yIndex=o,1<n[i].colSpan)for(var c=1;c<n[i].colSpan;c++)s++,r[o][s]="tdDummy";if(1<n[i].rowSpan)for(var m=1;m<n[i].rowSpan;m++){null==r[o+m]&&(r[o+m]=[]);for(var p=0;p<n[i].colSpan;p++)r[o+m][s-n[i].colSpan+1+p]="tdDummy"}s++}a<i&&(a=i)}this.columns=a},h.addColumnEnd=function(){var e=void 0,t=document.getElementsByClassName("wptb-preview-table"),n=void 0,a=void 0;0<t.length&&(n=t[0].querySelector("td")),n&&(a=n.getAttribute("style"));for(var r=0;r<h.rows.length;r++)e=new WPTB_Cell(E),a&&e.getDOMElement().setAttribute("style",a),h.rows[r].appendChild(e.getDOMElement()),array[r].push(0);f++,h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()},h.addColumnStart=function(){var e=void 0,t=void 0,n=document.getElementsByClassName("wptb-preview-table"),a=void 0,r=void 0;0<n.length&&(a=n[0].querySelector("td")),a&&(r=a.getAttribute("style"));for(var l=0;l<h.rows.length;l++)e=new WPTB_Cell(E),r&&e.getDOMElement().setAttribute("style",r),(t=h.rows[l].getElementsByTagName("td")[0])?h.rows[l].insertBefore(e.getDOMElement(),t):h.rows[l].appendChild(e.getDOMElement()),array[l].push(0);f++,h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()},h.addColumnAfter=function(e){var t=h.rows,n=void 0,a=void 0,r=document.querySelector(".wptb-highlighted"),l=r.getAttribute("style"),o=null!=e&&"number"==typeof e?e:N(r)[1];if(f-o-r.colSpan+1==1)h.addColumnEnd();else{for(var s=!1,i=void 0,d=void 0,c=void 0,m=[],p=void 0,u=0;u<f;u++)m.push(0);for(u=0;u<t.length;u++){n=0,a=t[u].getElementsByTagName("td"),s=!1;for(var b=0;b<f;b+=i){if(i=1,s){d=new WPTB_Cell(E),l&&d.getDOMElement().setAttribute("style",l),p&&t[u].contains(p)?(c=p.nextSibling)?t[u].insertBefore(d.getDOMElement(),c):t[u].appendChild(d.getDOMElement()):t[u].insertBefore(d.getDOMElement(),a[0]);break}if(0<m[b])o==b&&(s=!0);else if(1<(p=a[n++]).rowSpan){i=p.colSpan;for(var g=0;g<p.colSpan;g++)m[b+g]=p.rowSpan,b+g==o&&(s=!0)}else if(1<p.colSpan){i=p.colSpan;for(g=0;g<p.colSpan;g++)b+g==o&&(s=!0)}else b==o&&(s=!0)}for(var y=0;y<f;y++)0<m[y]&&m[y]--}for(u=0;u<array.length;u++)array[u].push(0);f++,T(array),h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()}},h.addColumnBefore=function(){var e=document.querySelector(".wptb-highlighted"),t=N(e)[1];0===t?h.addColumnStart():h.addColumnAfter(t-1)},h.addRowToTheEnd=function(){var e,t=h.insertRow(-1),n=void 0,a=document.getElementsByClassName("wptb-preview-table"),r=void 0,l=void 0;t.classList.add("wptb-row"),0<a.length&&(r=a[0].querySelector("td")),r&&(l=r.getAttribute("style"));for(var o=0;o<f;o++)n=new WPTB_Cell(E),l&&n.getDOMElement().setAttribute("style",l),t.appendChild(n.getDOMElement());e=Array.from(array[0]),array.push(e),T(array),h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()},h.addRowToTheStart=function(){var e,t=h.insertRow(0),n=void 0,a=document.getElementsByClassName("wptb-preview-table"),r=void 0,l=void 0;t.classList.add("wptb-row"),0<a.length&&(r=a[0].querySelector("td")),r&&(l=r.getAttribute("style"));for(var o=0;o<f;o++)n=new WPTB_Cell(E),l&&n.getDOMElement().setAttribute("style",l),t.appendChild(n.getDOMElement());e=Array.from(array[0]),array.push(e),T(array),h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()},h.addRowBefore=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),n=N(e)[0],a=void 0,r=n-1;0<=r;r--){var l=h.rows[r].children,o=l.length;if(0<o)for(var s=0;s<o;s++)if(1==l[s].rowSpan){n=r,a=!0;break}if(a)break}0===n?h.addRowToTheStart():h.addRowAfter(n,t)},h.addRowAfter=function(e,t){var n,a=void 0;if(null!=e&&"number"==typeof e||null!=t)a=e;else{var r=document.querySelector(".wptb-highlighted");t=r.getAttribute("style"),a=(e=N(r)[0])+r.rowSpan-1}var l=0;if(a<h.rows.length-1){for(var o=0;o<=a;o++){var s=h.rows[o].children,i=s.length;if(0<i)for(var d=0;d<i;d++){a<s[d].rowSpan-1+o&&s[d].rowSpan++}}var c=h.rows[a+1].children,m=c.length;if(0<m)for(var p=0;p<m;p++)l+=c[p].colSpan}else l=array[0].length;var u=h.insertRow(a+1);for(u.classList.add("wptb-row"),g=0;g<l;g++){var b=new WPTB_Cell(E);b.getDOMElement().setAttribute("style",t),u.appendChild(b.getDOMElement())}n=Array.from(array[0]),array.push(n),T(array),h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()},h.isSquare=function(e){for(var t,n,a=-1,r=-1,l=-1,o=-1,s=0,i=0;i<e.length;i++)for(var d=0;d<e[i].length;d++)1==e[i][d]&&((d<r||-1==r)&&(r=d),(i<a||-1==a)&&(a=i));for(i=e.length-1;-1<i;i--)for(d=e[i].length-1;-1<d;d--)1==e[i][d]&&(o<d&&(o=d),l<i&&(l=i));for(i=a;i<l;i++)for(d=r;d<o;d++)if(0==e[i][d]||null==e[i][d])return!1;for(i=0;i<e.length;i++)for(d=0;d<e[i].length;d++)1==e[i][d]&&s++;return(t=l-a+1)*(n=o-r+1)===s&&[t,n]},h.mergeCells=function(){for(var e=h.isSquare(array),t=e[0],n=e[1],a=document.querySelector(".wptb-highlighted"),r=[].slice.call(document.getElementsByClassName("wptb-highlighted"),1),l=[],o=0;o<r.length;o++){var s=r[o].getElementsByClassName("wptb-ph-element");if(0<s.length)for(var i=s.length,d=0;d<i;d++)l.push(s[d]);r[o].parentNode.removeChild(r[o])}if(0<l.length)for(var c=0;c<l.length;c++)a.appendChild(l[c]);a.colSpan=n,a.rowSpan=t,h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()},h.splitCell=function(){var e=document.getElementsByClassName("wptb-highlighted")[0],t=e.rowSpan,n=e.colSpan,a=e.getAttribute("style"),r=N(e)[0],l=h.rows[r],o=e.dataset.xIndex;e.rowSpan=1;for(var s=e.colSpan=1;s<n;s++){var i=new WPTB_Cell(E);i.getDOMElement().setAttribute("style",a),e.nextSibling?l.insertBefore(i.getDOMElement(),e.nextSibling):l.appendChild(i.getDOMElement())}if(1<t)for(var d=1;d<t;d++){var c=void 0,m=h.rows[r+d],p=m.children,u=p.length;if(0<u)for(var b=0;b<u;b++)if(Number(p[b].dataset.xIndex)>Number(o)){c=p[b];break}for(var g=0;g<n;g++){var y=new WPTB_Cell(E);y.getDOMElement().setAttribute("style",a),null!=c?m.insertBefore(y.getDOMElement(),c):m.appendChild(y.getDOMElement())}}h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h),C()},h.findRowspannedCells=function(e){var t,n=[];if(actualPoints=function(e){for(var t=h.rows[e].getElementsByTagName("td"),n=0,a=0;a<t.length;a++)n+=t[a].colSpan;return n}(e),actualPoints===f)return[];t=f-actualPoints;for(var a=e-1;0<=a&&t;a--){var r=h.rows[a].getElementsByTagName("td");for(a=0;a<r.length;a++)1<r[a].rowSpan&&(n.push(r[a]),t-=r[a].colSpan)}return n},h.addLackingCells=function(){for(var e=[],t=0;t<h.rows.length;t++)e.push(0);for(t=0;t<h.rows.length;t++)for(var n=h.rows[t].getElementsByTagName("td"),a=0;a<n.length;a++)if(1<n[a].rowSpan)for(var r=1;r<n[a].rowSpan;r++)e[t+r]++;for(t=0;t<h.rows.length;t++){n=h.rows[t].getElementsByTagName("td");var l=0;for(a=0;a<n.length;a++)l+=n[a].colSpan;l+=e[t],difference=f-l;for(a=0;a<difference;a++){var o=new WPTB_Cell(E);h.rows[t].appendChild(o.getDOMElement())}}},h.deleteRow=function(){var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),n=e.rowSpan,a=N(e)[0],r=void 0;null==n&&(n=1);for(var l=0;l<n;l++){var o=h.rows[a].children,s=h.rows[a+1],i=void 0,d=void 0,c=[];if(null!=s){d=(i=s.children).length;for(var m=0;m<o.length;m++)if(1<o[m].rowSpan){var p=new WPTB_Cell(E);p.getDOMElement().setAttribute("style",t),p.getDOMElement().colSpan=o[m].colSpan,p.getDOMElement().rowSpan=o[m].rowSpan-1;for(var u=void 0,b=0;b<d;b++)if(Number(i[b].dataset.xIndex)>Number(o[m].dataset.xIndex)){u=i[b];break}u?c.push([p,u]):c.push([p])}if(0<c.length)for(var g=0;g<c.length;g++)null!=c[g][1]?s.insertBefore(c[g][0].getDOMElement(),c[g][1]):s.appendChild(c[g][0].getDOMElement())}var y=h.rows;if(0<y.length)for(var f=0;f<a;f++){var v=y[f].children;if(0<v.length)for(var w=0;w<v.length;w++)v[w].rowSpan-1>=a-f&&v[w].rowSpan--}r=Array.from(array[0]),array.pop(r),T(array),h.getElementsByTagName("tbody")[0].removeChild(h.rows[a]),0==h.rows.length&&(h.toggleTableEditMode(),B.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h)}C()},h.deleteColumn=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.dataset.xIndex,n=e.colSpan,a=0;a<n;a++){for(var r=0;r<h.rows.length;r++){var l=h.rows[r].children,o=l.length;if(0<o)for(var s=o-1;0<=s;s--){if(Number(l[s].dataset.xIndex)==Number(t)){1<l[s].colSpan?l[s].colSpan--:h.rows[r].removeChild(l[s]);break}if(Number(l[s].dataset.xIndex)<Number(t)&&Number(l[s].dataset.xIndex)+Number(l[s].colSpan-1)>=t){1<l[s].colSpan&&l[s].colSpan--;break}}}for(var i=0;i<h.rows.length;i++)null!=array[i]&&array[i].pop();f--,0==h.querySelectorAll("td").length&&(h.toggleTableEditMode(),B.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),h.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(h)}C()},document.getElementsByClassName("wptb-table-generator")[0].style.display="none",array=function(){for(var e=[],t=[],n=0;n<h.rows.length;n++){for(var a=h.rows[n].getElementsByTagName("td"),r=0,l=0;l<a.length;l++)r+=a[l].colSpan;e.push(r)}f=Math.max.apply(null,e);var o=h.rows.length;for(n=0;n<o;n++)for(t[n]=[],l=0;l<f;l++)t[n].push(0);return T(t),t}(),C(),T(array),B.appendChild(h),h.recalculateIndexes(!0),WPTB_LeftPanel()};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var WPTB_Text=function(e,t){var n=document.createElement("div"),a=document.createElement("div"),r=document.createElement("p"),l=void 0,o=!1;if(n.classList.add("wptb-text-container"),r.innerHTML=null!=e?e:"Text",a.appendChild(r),n.appendChild(a),t){var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],o=!0);for(var i=[].concat(_toConsumableArray(t.attributes)),d=0;d<i.length;d++)n.setAttribute(i[d].name,i[d].value)}return this.kind="text",this.getDOMElement=function(){return n},applyGenericItemSettings(this,l,o),this},WPTB_innerElementSet=function m(t){t.ondragenter=function(e){-1==e.dataTransfer.types.indexOf("wptbelement")&&-1==e.dataTransfer.types.indexOf("wptb-moving-mode")||(WPTB_DropHandle(this,e),t.classList.add("wptb-ondragenter"))},t.ondragover=function(e){e.preventDefault(),WPTB_DropHandle(this,e)},t.ondragleave=function(){},t.ondrop=function(e){this.classList.remove("wptb-ondragenter");var t=void 0,n=void 0;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer.getData("wptbElement")||e.dataTransfer.getData("node")){var a,r=void 0,l=void 0;if(0<document.getElementsByClassName("wptb-drop-handle").length&&(r=document.getElementsByClassName("wptb-drop-handle")[0]),0<document.getElementsByClassName("wptb-drop-border-marker").length&&(l=document.getElementsByClassName("wptb-drop-border-marker")[0]),e.dataTransfer.getData("wptbElement")?t=(t="list"==(a=e.dataTransfer.getData("wptbElement"))?new WPTB_List:"image"==a?new WPTB_Image:"text"==a?new WPTB_Text:"button"==a?new WPTB_Button:void 0).getDOMElement():(n=e.dataTransfer.getData("node"),(t=document.getElementsByClassName(n)[0]).classList.remove("wptb-moving-mode")),"block"==r.style.display){var o=void 0;if("Drop Here"==r.dataset.text)(o=r.getDOMParentElement()).appendChild(t);else{var s=r.getDOMParentElement();if(o=s.parentNode,"Abowe Element"==r.dataset.text)o.insertBefore(t,s);else if("Below Element"==r.dataset.text){var i=s.nextSibling;o.insertBefore(t,i)}}var d=o.parentNode;if(d.classList.contains("wptb-table-head")){var c=WPTB_Helper.findAncestor(d,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(c)}return r.style.display="none",l.style.display="none",m(t),!0}}},t.onmouseover=function(e){t.classList.remove("wptb-ondragenter")}},applyGenericItemSettings=function(p,e){var t,u,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],b=p.getDOMElement();if(null==e||1==n){t=document.counter.nextIndex(p.kind);for(var a=document.getElementsByClassName("wptb-ph-element"),r=[],l=0;l<a.length;l++){var o=new RegExp("wptb-element-"+p.kind+"-(\\d+)","i"),s=a[l].className.match(o);s&&r.push(s[1])}if(0<r.length)t=Math.max.apply(Math,r)+1;else t=1}else e&&!n&&(t=e.split("-")[1]);if(b.onmouseenter=function(e){this.classList.add("wptb-directlyhovered");var t=document.createElement("span"),n=document.createElement("span"),a=document.createElement("span"),r=document.createElement("span");r.classList.add("wptb-actions"),t.classList.add("dashicons","dashicons-trash","wptb-delete-action"),n.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),a.classList.add("dashicons","dashicons-move","wptb-move-action"),a.draggable=!0,t.onclick=function(e){var t=this.parentNode.parentNode,n=t.parentNode;if(n.removeChild(t),"text"==t.kind){var a=n.parentNode;if(a.classList.contains("wptb-table-head")){var r=WPTB_Helper.findAncestor(a,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(r)}}},n.onclick=function(e){var t=void 0;if("list"==p.kind){e.target.parentNode.parentNode.parentNode;for(var n=[],a=e.target.parentNode.parentNode.querySelectorAll("ul li .wptb-list-item-content"),r=0;r<a.length;r++)n.push(a[r].innerHTML);t=new WPTB_List(n,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}else if("text"==p.kind){e.target.parentNode.parentNode.parentNode;t=new WPTB_Text(e.target.parentNode.parentNode.childNodes[0].innerHTML,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}else if("image"==p.kind){e.target.parentNode.parentNode.parentNode;t=new WPTB_Image(e.target.parentNode.parentNode.children[0].children[0].src,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}else{e.target.parentNode.parentNode.parentNode;var l=e.target.parentNode.parentNode.childNodes[0].querySelector("p").innerHTML;t=new WPTB_Button(l,b),b.parentNode.insertBefore(t.getDOMElement(),b.nextSibling)}WPTB_innerElementSet(t.getDOMElement())};var l,o,s=this;l=s.className.match(/wptb-element-(.+)-(\d+)/i),o=l[1];var i=WPTB_Helper.dragImagesArr();if(a.ondragstart=function(e){if(this.parentNode.style.opacity=0,s.classList.remove("wptb-directlyhovered"),s.classList.add("wptb-moving-mode"),e.dataTransfer.setDragImage(i[o],0,0),e.dataTransfer.setData("node","wptb-element-"+l[1]+"-"+l[2]),e.dataTransfer.setData("wptb-moving-mode","wptb-element-"+l[1]+"-"+l[2]),e.dataTransfer.setData("wptbElIndic-"+l[1],"wptbElIndic-"+l[1]),"text"==e.target.parentNode.parentNode.kind){var t=el.parentNode;if(t.classList.contains("wptb-table-head")){var n=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(n)}}},"button"===p.kind){var d=b.querySelector("a"),c=d.querySelector("div");d.onclick=function(e){e.preventDefault()},WPTB_Helper.buttonsTinyMceInit(c)}else if("text"===p.kind)tinyMCE.init({target:b.childNodes[0],inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("change",function(e){var t=WPTB_Helper.findAncestor(b,"wptb-row");if(t.classList.contains("wptb-table-head")){var n=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(n)}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}});else{u=b.getElementsByClassName("wptb-list-item-content");for(var m=0;m<u.length;m++)WPTB_Helper.listItemsTinyMceInit(u[m])}r.appendChild(a),r.appendChild(n),r.appendChild(t),this.appendChild(r)},b.onmouseleave=function(e){this.classList.remove("wptb-directlyhovered");for(var t=0;e.target.querySelector(".wptb-actions")&&t<5;)e.target.querySelector(".wptb-actions").remove(),t++},"text"==p.kind){new MutationObserver(function(e){var t=WPTB_Helper.findAncestor(b,"wptb-row");if(t.classList.contains("wptb-table-head")){var n=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(n)}}).observe(p.getDOMElement(),{attributes:!0,attributeFilter:["style"]})}var i=b.className.match(/wptb-element-(.+)-(\d+)/i);i&&b.classList.remove(i[0]),b.classList.contains("wptb-ph-element")||b.classList.add("wptb-ph-element"),b.classList.contains("wptb-element-"+p.kind+"-"+t)||b.classList.add("wptb-element-"+p.kind+"-"+t),new WPTB_ElementOptions(p,t,e),document.counter.increment(p.kind)};
inc/admin/js/core/WPTB_Builder.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+ var WPTB_Builder = function () {
3
+ var table_id = WPTB_Helper.detectMode();
4
+ if ( table_id ) {
5
+ var http = new XMLHttpRequest(),
6
+ urlSet = ajaxurl + "?action=get_table" + '&id=' + table_id;
7
+ http.open('GET', urlSet, true);
8
+ http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
9
+ http.onreadystatechange = function (d) {
10
+ if (this.readyState == 4 && this.status == 200) {
11
+ var ans = JSON.parse(http.responseText);
12
+ document.getElementById('wptb-setup-name').value = ans[0];
13
+
14
+ if( ans[1] ) {
15
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';
16
+ let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];
17
+ wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );
18
+ WPTB_Table();
19
+ WPTB_LeftPanel();
20
+ WPTB_Settings();
21
+ } else {
22
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
23
+ }
24
+
25
+ return;
26
+ }
27
+ };
28
+ http.send(null);
29
+ } else {
30
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
31
+ }
32
+ document.counter = new ElementCounters();
33
+ document.select = new MultipleSelect();
34
+
35
+ var initializer = WPTB_Initializer();
36
+ settings = WPTB_Settings();
37
+ };
38
+
39
+ document.addEventListener('DOMContentLoaded', WPTB_Builder);
40
+ })();
inc/admin/js/core/WPTB_Button.js ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Button = function( text, DOMElementProt ) {
2
+
3
+ var DOMElement = document.createElement('div'),
4
+ elButton = document.createElement('div'),
5
+ el_B = document.createElement('a'),
6
+ el_BDiv = document.createElement( 'div' ),
7
+ kindIndexProt = undefined,
8
+ copy = false;
9
+
10
+ DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');
11
+ elButton.classList.add('wptb-button-wrapper');
12
+ el_BDiv.classList.add('wptb-button');
13
+ el_BDiv.innerHTML = text != undefined ? text : 'Button Text';
14
+
15
+ // Creation of a new button when copying to avoid errors when assigning new event handlers.
16
+ if ( DOMElementProt ) {
17
+ let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\d+)/i );
18
+ if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {
19
+ kindIndexProt = wptbElementMutch[1];
20
+ copy = true;
21
+ };
22
+ var attributesContainer = [...DOMElementProt.attributes];
23
+ if ( attributesContainer.length > 0 ) {
24
+ for( let i = 0; i < attributesContainer.length; i++ ) {
25
+ DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);
26
+ }
27
+ }
28
+
29
+ var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );
30
+ if ( wptbButtonWrapper ) {
31
+ var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];
32
+ if ( wptbButtonWrapAttributes.length > 0 ) {
33
+ for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {
34
+ if ( wptbButtonWrapAttributes[i].name == 'style') {
35
+ elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ var wptbButton = DOMElementProt.querySelector( 'a' );
42
+ if ( wptbButton ) {
43
+ var wptbButtonAttributes = [...wptbButton.attributes];
44
+ if ( wptbButtonAttributes.length > 0 ) {
45
+ for( let i = 0; i < wptbButtonAttributes.length; i++ ) {
46
+ if ( wptbButtonAttributes[i].name == 'style' ||
47
+ wptbButtonAttributes[i].name == 'href' ||
48
+ wptbButtonAttributes[i].name == 'target' ) {
49
+ el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ elButton.appendChild(el_B);
57
+ el_B.appendChild( el_BDiv );
58
+ DOMElement.appendChild(elButton);
59
+
60
+
61
+
62
+ this.kind = 'button';
63
+
64
+ this.getDOMElement = function () {
65
+ return DOMElement;
66
+ };
67
+
68
+ applyGenericItemSettings( this, kindIndexProt, copy );
69
+
70
+ return this;
71
+ };
inc/admin/js/core/WPTB_Cell.js ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Cell = function (callback, DOMElement) {
2
+
3
+ function highlightRow(td) {
4
+ var parentRow = td.parentNode,
5
+ columnCount = parseInt(document.getElementById('wptb-columns-number').value),
6
+ tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');
7
+ for (var i = 0; i < tds.length; i++) {
8
+ tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');
9
+ }
10
+ for (var i = 0; i < columnCount; i++) {
11
+
12
+ var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';
13
+ var ttd = parentRow.getElementsByTagName('td')[i];
14
+ if (ttd !== td) {
15
+ ttd.classList.add(classToAdd);
16
+ }
17
+ }
18
+ }
19
+
20
+ function highlightColumn(td) {
21
+
22
+ var index,
23
+ parentRow = td.parentNode;
24
+ columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];
25
+ for (var i = 0; i < columnCount; i++) {
26
+ if (parentRow.getElementsByTagName('td')[i] === td) {
27
+ index = i;
28
+ break;
29
+ }
30
+ }
31
+
32
+ for (var i = 0; i < rowCount; i++) {
33
+ var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';
34
+ var tr = table.getElementsByTagName('tr')[i];
35
+ if (tr.getElementsByTagName('td')[index] !== td) {
36
+ tr.getElementsByTagName('td')[index].classList.add(classToAdd);
37
+ }
38
+ }
39
+ }
40
+
41
+ if( ! DOMElement ) {
42
+ DOMElement = document.createElement("td");
43
+
44
+ DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';
45
+
46
+ var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();
47
+
48
+ if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {
49
+ DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();
50
+ }
51
+
52
+ DOMElement.classList.add('wptb-droppable', 'wptb-cell');
53
+ }
54
+
55
+ DOMElement.draggable = false;
56
+ if ( callback ) {
57
+ DOMElement.onclick = callback;
58
+ }
59
+
60
+ WPTB_innerElementSet( DOMElement );
61
+
62
+ let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );
63
+
64
+ if ( wptbPhElement.length > 0 ) {
65
+ for( let i = 0; i < wptbPhElement.length; i++ ) {
66
+
67
+ let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );
68
+
69
+ if ( wptbSpaceBetween.length > 0 ) {
70
+ for( let j = 0; j < wptbSpaceBetween.length; j++ ) {
71
+ WPTB_Space( wptbSpaceBetween[j] );
72
+ }
73
+ }
74
+
75
+ wptbPhElement[i].getDOMElement = function() {
76
+ return wptbPhElement[i];
77
+ }
78
+
79
+ WPTB_innerElementSet( wptbPhElement[i] );
80
+
81
+ let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\d+)/i );
82
+ if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {
83
+ let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );
84
+ wptbPhElement[i].kind = wptbTypeElementArr[0];
85
+ applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );
86
+ if ( wptbPhElement[i].kind == 'list' ) {
87
+ let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );
88
+ if( wptbListItems.length > 0 ) {
89
+ for ( let i = 0; i < wptbListItems.length; i++ ) {
90
+ WPTB_ListItem( undefined, wptbListItems[i] );
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ this.getDOMElement = function () {
99
+ return DOMElement;
100
+ };
101
+
102
+ this.setCoords = function (y, x) {
103
+ var el = this.getDOMElement();
104
+ el.dataset.yIndex = y;
105
+ el.dataset.xIndex = x;
106
+ };
107
+
108
+ this.getCoords = function () {
109
+ var coords,
110
+ el = this.getDOMElement();
111
+ coords.x = el.dataset.xIndex;
112
+ coords.y = el.dataset.yIndex;
113
+ return coords;
114
+ };
115
+
116
+ this.appendElement = function (node) {
117
+ getDOMElement().appendChild(node);
118
+ };
119
+
120
+ return this;
121
+ };
inc/admin/js/core/WPTB_DropHandle.js ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_DropHandle = function (thisElem, e) {
2
+
3
+ function newElementProxy(el) {
4
+ if (el.includes('list')) {
5
+ return new WPTB_List();
6
+ } else if (el.includes('image')) {
7
+ return new WPTB_Image();
8
+ } else if (el.includes('text')) {
9
+ return new WPTB_Text();
10
+ } else if (el.includes('button')) {
11
+ return new WPTB_Button();
12
+ }
13
+ }
14
+
15
+ let wptbDropHandle,
16
+ wptbDropBorderMarker;
17
+ if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {
18
+ wptbDropHandle = document.createElement( 'div' );
19
+ wptbDropHandle.classList.add( 'wptb-drop-handle' );
20
+
21
+ wptbDropBorderMarker = document.createElement( 'div' );
22
+ wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );
23
+
24
+ let wptbDropBorderMarkerTop = document.createElement( 'div' ),
25
+ wptbDropBorderMarkerRight = document.createElement( 'div' ),
26
+ wptbDropBorderMarkerBottom = document.createElement( 'div' ),
27
+ wptbDropBorderMarkerLeft = document.createElement( 'div' );
28
+
29
+ wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );
30
+ wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );
31
+ wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );
32
+ wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );
33
+
34
+ wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );
35
+ wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );
36
+ wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );
37
+ wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );
38
+
39
+ let body = document.getElementsByTagName( 'body' );
40
+ if ( body.length > 0 ) {
41
+ body[0].appendChild( wptbDropHandle );
42
+ body[0].appendChild( wptbDropBorderMarker );
43
+ }
44
+
45
+ wptbDropHandle.ondragenter = function () {
46
+
47
+ }
48
+
49
+ wptbDropHandle.ondragover = function (e) {
50
+ e.preventDefault();
51
+ }
52
+
53
+ wptbDropHandle.ondragleave = function () {
54
+
55
+ }
56
+ wptbDropHandle.ondrop = function (e) {
57
+ e.preventDefault();
58
+ let element;
59
+
60
+ if ( e.dataTransfer.getData('wptbElement') ) {
61
+ element = newElementProxy( e.dataTransfer.getData('wptbElement') );
62
+ element = element.getDOMElement();
63
+ } else {
64
+ element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];
65
+ element.classList.remove( 'wptb-moving-mode' );
66
+ element.classList.remove( 'wptb-moving-into-same-elem' );
67
+ }
68
+
69
+ let td;
70
+ if( wptbDropHandle.dataset.text == 'Drop Here' ) {
71
+ thisElem = wptbDropHandle.getDOMParentElement();
72
+ if ( thisElem.nodeName.toLowerCase() == 'td' ) {
73
+ td = wptbDropHandle.getDOMParentElement();
74
+ td.appendChild( element );
75
+ }
76
+ } else {
77
+ let innerElement = wptbDropHandle.getDOMParentElement();
78
+ td = innerElement.parentNode;
79
+
80
+ if( wptbDropHandle.dataset.text == 'Abowe Element' ) {
81
+ td.insertBefore( element, innerElement );
82
+ } else if( wptbDropHandle.dataset.text == 'Below Element' ) {
83
+ let innerElementNext = innerElement.nextSibling;
84
+ td.insertBefore( element, innerElementNext );
85
+ }
86
+ }
87
+
88
+ let thisRow = td.parentNode
89
+ if( thisRow.classList.contains( 'wptb-table-head' ) ) {
90
+ let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );
91
+ WPTB_Helper.dataTitleColumnSet( table );
92
+ }
93
+
94
+ wptbDropHandle.style.display = 'none';
95
+ wptbDropBorderMarker.style.display = 'none';
96
+
97
+ WPTB_innerElementSet(element);
98
+ }
99
+ let wptbContainer = document.querySelector( '.wptb-container' );
100
+ wptbContainer.onscroll = function() {
101
+ wptbDropHandle.style.display = 'none';
102
+ wptbDropBorderMarker.style.display = 'none';
103
+ }
104
+ } else {
105
+ wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];
106
+ wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];
107
+ }
108
+ if( thisElem && thisElem.nodeName.toLowerCase() == 'td' &&
109
+ thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {
110
+ return;
111
+ }
112
+
113
+ let thisRow;
114
+ if ( thisElem.localName == 'td' ) {
115
+ thisRow = thisElem.parentNode;
116
+ } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {
117
+ thisRow = thisElem.parentNode.parentNode;
118
+ }
119
+ if( thisRow.classList.contains( 'wptb-table-head' ) ) {
120
+ let indics = e.dataTransfer.types;
121
+ let notDragEnter = false;
122
+ for ( let i = 0; i < indics.length; i++ ) {
123
+ let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );
124
+ if ( infArr && infArr[1] != 'text' ) {
125
+ notDragEnter = true;
126
+ break;
127
+ }
128
+ }
129
+ if( notDragEnter ) {
130
+ return;
131
+ }
132
+ }
133
+
134
+ wptbDropHandle.style.width = thisElem.offsetWidth + 'px';
135
+ let height = thisElem.offsetHeight,
136
+ coordinatesElement = thisElem.getBoundingClientRect(),
137
+ left = Number( coordinatesElement.left ),
138
+ top;
139
+ wptbDropHandle.style.left = left + 'px';
140
+
141
+ if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {
142
+ let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];
143
+ if( thisElem == elementDrag ) {
144
+ wptbDropHandle.classList.add('wptb-moving-into-same-elem');
145
+ wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');
146
+ } else {
147
+ wptbDropHandle.classList.remove('wptb-moving-into-same-elem');
148
+ wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');
149
+ }
150
+ }
151
+
152
+ wptbDropHandle.getDOMParentElement = function() {
153
+ return thisElem;
154
+ }
155
+
156
+ wptbDropHandle.style.display = 'block';
157
+ wptbDropBorderMarker.style.display = 'block';
158
+ if( thisElem.nodeName.toLowerCase() != 'td' ) {
159
+ let y = e.offsetY==undefined?e.layerY:e.offsetY;
160
+ top = Number( coordinatesElement.top ) - Number( 11 );
161
+ wptbDropHandle.dataset.text = 'Abowe Element';
162
+ if ( y > height/2 ) {
163
+ top = Number( coordinatesElement.top ) + height - 1;
164
+ wptbDropHandle.dataset.text = 'Below Element';
165
+ }
166
+ } else {
167
+ wptbDropHandle.dataset.text = 'Drop Here';
168
+ top = Number( coordinatesElement.top ) + height/2 - 5;
169
+ }
170
+ wptbDropHandle.style.top = top + 'px';
171
+
172
+ wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';
173
+ wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';
174
+
175
+ wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );
176
+ wptbDropBorderMarkerTop.style.width = ( Number( thisElem.offsetWidth ) - Number( 1 ) ) + 'px';
177
+
178
+ wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );
179
+ wptbDropBorderMarkerRight.style.height = ( Number( coordinatesElement.bottom ) - Number( coordinatesElement.top ) - 1 ) + 'px';
180
+ wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;
181
+
182
+ wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );
183
+ wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;
184
+ wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;
185
+
186
+ wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );
187
+ wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;
188
+ }
inc/admin/js/core/WPTB_ElementCounters.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var ElementCounters = function () {
2
+
3
+ var priv = [];
4
+ priv['text'] = 0;
5
+ priv['image'] = 0;
6
+ priv['list'] = 0;
7
+ priv['button'] = 0;
8
+
9
+ this.increment = function (key) {
10
+ if (!(key in priv)) {
11
+ return;
12
+ }
13
+ priv[key]++;
14
+ }
15
+
16
+ this.nextIndex = function (key) {
17
+ if (!(key in priv)) {
18
+ return undefined;
19
+ }
20
+ return priv[key] + 1;
21
+ }
22
+
23
+ return this;
24
+
25
+ };
inc/admin/js/core/WPTB_ElementOptions.js ADDED
@@ -0,0 +1,544 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {
2
+
3
+ var node = element.getDOMElement(), elemIdClass;
4
+
5
+ prop = document.querySelector(".wptb-" + element.kind + "-options-prototype").cloneNode(true);
6
+ prop.classList.remove("wptb-" + element.kind + "-options-prototype"); // remove prototype from the class
7
+ elemIdClass = 'wptb-options-' + element.kind + "-" + index;
8
+
9
+ var properties = prop.getElementsByClassName('wptb-element-property');
10
+
11
+ for (var i = 0; i < properties.length; i++) {
12
+ properties[i].dataset.element = elemIdClass;
13
+ }
14
+
15
+ prop.classList.add(elemIdClass);
16
+ document.getElementById("element-options-group").appendChild(prop);
17
+
18
+ if ( kindIndexProt ) {
19
+ if ( element.kind == 'button' ) {
20
+ let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],
21
+ wptbButtonWrapper,
22
+ wptbButtonA,
23
+ wptbButton,
24
+ wptbSize;
25
+
26
+ if ( affectedEl ) {
27
+ wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);
28
+ }
29
+
30
+ if( wptbSize && Array.isArray( wptbSize ) ) {
31
+ var b = prop.getElementsByClassName('wptb-btn-size-btn');
32
+
33
+ for ( var i = 0; i < b.length; i++ ) {
34
+ b[i].classList.remove( 'selected' );
35
+
36
+ if ( b[i].innerHTML == wptbSize[1] ) {
37
+ b[i].classList.add( 'selected' );
38
+ }
39
+ }
40
+ }
41
+
42
+ if( affectedEl ) {
43
+ wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );
44
+
45
+ wptbButtonA = affectedEl.getElementsByTagName( 'a' );
46
+
47
+ wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );
48
+ }
49
+
50
+ if ( wptbButtonWrapper ) {
51
+ let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,
52
+ buttonAlignmentSelect = prop.querySelector( 'select[data-type="button-alignment"]' ),
53
+ selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),
54
+ selectOptionVal;
55
+
56
+ if ( buttonAlignment == 'flex-start' ) {
57
+ selectOptionVal = 'left';
58
+ } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {
59
+ selectOptionVal = 'center';
60
+ } else if ( buttonAlignment == 'flex-end' ) {
61
+ selectOptionVal = 'right';
62
+ }
63
+
64
+ for ( let i = 0; i < selectOption.length; i++ ) {
65
+ if ( selectOption[i].value == selectOptionVal ) {
66
+ selectOption[i].selected = true;
67
+ }
68
+ }
69
+ }
70
+
71
+ if ( wptbButtonA.length > 0 ) {
72
+ let buttonHref = wptbButtonA[0].getAttribute( 'href' ),
73
+ buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),
74
+ buttonId = wptbButtonA[0].getAttribute( 'id' ),
75
+
76
+
77
+ buttonHrefInput = prop.querySelector( 'input[data-type="button-link"]' ),
78
+ buttonLinkTargetInput = prop.querySelector( 'input[data-type="button-link-target"]' ),
79
+ buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),
80
+ buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],
81
+
82
+ buttotIdInput = prop.querySelector( 'input[data-type="button-id"]' );
83
+
84
+ buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];
85
+ buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );
86
+ buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );
87
+
88
+ buttonHrefInput.value = buttonHref;
89
+
90
+ if( buttonLinkTarget && buttonLinkTarget == '_blank') {
91
+ buttonLinkTargetInput.checked = true;
92
+ }
93
+
94
+ buttotIdInput.value = buttonId;
95
+ }
96
+
97
+ if( wptbButton ) {
98
+ let buttonTextColor = wptbButton[0].style.color,
99
+ buttonColor = wptbButton[0].style.backgroundColor,
100
+ buttonTextColorInput = prop.querySelector( 'input[data-type="button-text-color"]' ),
101
+ buttonBackgroundColorInput = prop.querySelector( 'input[data-type="button-color"]' );
102
+
103
+
104
+ buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );
105
+
106
+ buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );
107
+
108
+ }
109
+ } else if ( element.kind == 'image' ) {
110
+ let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );
111
+ if ( affectedEl.length > 0 ) {
112
+ let elementsA = affectedEl[0].getElementsByTagName( 'a' );
113
+ if ( elementsA.length > 0 ) {
114
+ let a = elementsA[0];
115
+
116
+ if ( a ) {
117
+ a.onclick = function( e ) {
118
+ e.preventDefault();
119
+ }
120
+ // set select according to the alignment of the image
121
+ let aTextAlign = a.style.textAlign,
122
+ imageAlignmentSelect = prop.querySelector( 'select[data-type="image-alignment"]' ),
123
+ selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );
124
+
125
+ for ( let i = 0; i < selectOption.length; i++ ) {
126
+ if ( selectOption[i].value == aTextAlign ) {
127
+ selectOption[i].selected = true;
128
+ }
129
+ }
130
+
131
+ // set text link for input field of setting panel
132
+ let imageLinkHref = a.getAttribute( 'href' ),
133
+ inputImageLink = prop.querySelector( 'input[data-type="image-link"]' );
134
+ if ( imageLinkHref ) {
135
+ inputImageLink.value = imageLinkHref;
136
+ }
137
+
138
+ // set checkbox for target of link
139
+ let imageLinkTarget = a.getAttribute( 'target' ),
140
+ imageLinkTargetInput = prop.querySelector( 'input[data-type="image-link-target"]' ),
141
+ imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),
142
+ imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];
143
+
144
+ imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];
145
+
146
+ imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );
147
+ imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );
148
+
149
+ if ( imageLinkTarget && imageLinkTarget == '_blank' ) {
150
+ imageLinkTargetInput.checked = true;
151
+ }
152
+
153
+ let img = a.getElementsByTagName( 'img' );
154
+ if ( img.length > 0 ) {
155
+ // set value for input fields of image size
156
+ let imgWidth = img[0].style.width;
157
+ if ( imgWidth ) {
158
+ let imageWidthInputRange = prop.querySelector( 'input[type="range"][data-type="image-size"]' ),
159
+ imageWidthInputNumber = prop.querySelector( 'input[type="number"][data-type="image-size"]' );
160
+
161
+ imageWidthInputRange.value = parseInt( imgWidth );
162
+ imageWidthInputNumber.value = parseInt( imgWidth );
163
+ }
164
+
165
+ // set value for input field of alternative text image
166
+ let imgAlternativeText = img[0].getAttribute('alt'),
167
+ imageAlternativeTextInput = prop.querySelector( 'input[type="text"][data-type="alternative-text"]' );
168
+
169
+ imageAlternativeTextInput.value = imgAlternativeText;
170
+ }
171
+ }
172
+ }
173
+ }
174
+ } else if ( element.kind == 'text' ) {
175
+ let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );
176
+ if ( affectedEl.length > 0 ) {
177
+ let elementFontSize = affectedEl[0].style.fontSize,
178
+ elementTextColor = affectedEl[0].style.color;
179
+ let textFontSizeInputRange = prop.querySelector( 'input[type="range"][data-type="font-size"]' ),
180
+ textFontSizeInputNumber = prop.querySelector( 'input[type="number"][data-type="font-size"]' ),
181
+ textColorInput = prop.querySelector( 'input[type="text"][data-type="color"]' );
182
+
183
+ textFontSizeInputRange.value = parseInt( elementFontSize );
184
+ textFontSizeInputNumber.value = parseInt( elementFontSize );
185
+ textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );
186
+ }
187
+ } else if ( element.kind == 'list' ) {
188
+ let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );
189
+ if ( elementList.length > 0 ) {
190
+ let elementListColor = elementList[0].querySelector( 'p' ).style.color;
191
+ let listColorInput = prop.querySelector( 'input[type="text"][data-type="list-text-color"]' );
192
+ listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );
193
+
194
+ let elementListItem = elementList[0].querySelectorAll( 'li' );
195
+ if ( elementListItem.length > 0 ) {
196
+ let listItemP = elementListItem[0].querySelector( 'p' );
197
+ let listItemPClasses = listItemP.classList;
198
+ //listItemPClasses = [...listItemPClasses];
199
+ if ( listItemPClasses.length > 0 ) {
200
+ let elementListClassSelect = prop.querySelector( 'select[data-type="list-class"]' );
201
+ if ( elementListClassSelect ) {
202
+ elementListClassSelect.value = 'unordered';
203
+
204
+ let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;
205
+ for ( let i = 0; i < 10; i++ ) {
206
+ if ( listIconSelectLabel.nodeType == '1' ) {
207
+ break;
208
+ } else {
209
+ listIconSelectLabel = listIconSelectLabel.nextSibling;
210
+ }
211
+ }
212
+ if ( listIconSelectLabel ) {
213
+ let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );
214
+ listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );
215
+ listIconSelectLabel.style.display = 'flex';
216
+ }
217
+
218
+ let elementListStyleTypeSelect = prop.querySelector( 'select[data-type="list-style-type"]' );
219
+ if ( elementListStyleTypeSelect ) {
220
+ elementListStyleTypeSelect.parentNode.style.display = 'flex';
221
+
222
+ if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {
223
+ elementListStyleTypeSelect.value = 'disc';
224
+ } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {
225
+ elementListStyleTypeSelect.value = 'circle';
226
+ } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {
227
+ elementListStyleTypeSelect.value = 'square';
228
+ } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {
229
+ elementListStyleTypeSelect.value = 'none';
230
+ }
231
+ }
232
+ }
233
+ }
234
+ }
235
+
236
+ let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );
237
+ if ( elementListItemContent.length > 0 ) {
238
+ let listItemPTextAlignArr = [];
239
+ for ( let i = 0; i < elementListItemContent.length; i++ ) {
240
+ let p = elementListItemContent[i].querySelector( 'p' );
241
+ if ( p ) {
242
+ if ( p.style.textAlign ) {
243
+ listItemPTextAlignArr.push( p.style.textAlign );
244
+ } else {
245
+ listItemPTextAlignArr.push( 'left' );
246
+ }
247
+ }
248
+
249
+ }
250
+
251
+ let listItemPTextAlignLeftCount = 0,
252
+ listItemPTextAlignCenterCount = 0,
253
+ listItemPTextAlignRightCount = 0;
254
+
255
+ if ( listItemPTextAlignArr.length > 0 ) {
256
+ for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {
257
+ if ( listItemPTextAlignArr[i] ) {
258
+ if ( listItemPTextAlignArr[i] == 'left' ) {
259
+ listItemPTextAlignLeftCount++;
260
+ } else if ( listItemPTextAlignArr[i] == 'center' ) {
261
+ listItemPTextAlignCenterCount++;
262
+ } else if ( listItemPTextAlignArr[i] == 'right' ) {
263
+ listItemPTextAlignRightCount++;
264
+ }
265
+ }
266
+ }
267
+ }
268
+
269
+ let elementListAlignmentSelect = prop.querySelector( 'select[data-type="list-alignment"]' ),
270
+ maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );
271
+
272
+ if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {
273
+ elementListAlignmentSelect.value = 'left';
274
+ } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {
275
+ elementListAlignmentSelect.value = 'center';
276
+ } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {
277
+ elementListAlignmentSelect.value = 'right';
278
+ }
279
+ }
280
+ }
281
+ }
282
+ }
283
+
284
+ node.onclick = function () {
285
+ var infArr = this.className.match(/wptb-element-((.+-)\d+)/i),
286
+ optionsClass = '.wptb-' + infArr[2] + 'options' +
287
+ '.wptb-options-' + infArr[1];
288
+
289
+ document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';
290
+ document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';
291
+ document.getElementById("element-options-group").style.display = 'block';
292
+
293
+ var children = document.getElementById("element-options-group").childNodes;
294
+ for (var i = 0; i < children.length; i++) {
295
+ if (children[i].style)
296
+ children[i].style.display = 'none';
297
+ }
298
+
299
+ document.querySelector(optionsClass).style.display = 'block';
300
+
301
+ //var listStyleType, textAlign;
302
+
303
+ // switch (element.kind) {
304
+
305
+ // case 'text':
306
+ // jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });
307
+ // prop.querySelector('[type=number][data-type=font-size]').value
308
+ // = prop.querySelector('[type=range][data-type=font-size]').value
309
+ // = node.style.fontSize.substring(0, node.style.fontSize.length - 2);
310
+ // break;
311
+ // case 'list':
312
+ // textAlign = node.querySelector('li p').style.textAlign;
313
+ // listStyleType = node.querySelector('li').style.listStyleType;
314
+ // if ( prop.querySelector( 'select[data-type=list-class]' ) ) {
315
+ // console.log(textAlign);
316
+ // console.log(listStyleType);
317
+ // console.log(listStyleType);
318
+ // console.log(prop);
319
+ // prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );
320
+ // }
321
+ // if ( prop.querySelector('select[data-type=list-style-type]') ) {
322
+ // prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));
323
+ // }
324
+ // if ( prop.querySelector('select[data-type=list-alignment]') ) {
325
+ // prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));
326
+ // }
327
+ // break;
328
+ // case 'image':
329
+ // break;
330
+ // case 'button':
331
+ // jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });
332
+ // break;
333
+ //
334
+ // }
335
+ };
336
+
337
+ if (element.kind == 'button') {
338
+ //We must add this special kind of property, since it is triggered with click event
339
+ var buttons = prop.getElementsByClassName('wptb-btn-size-btn');
340
+
341
+ for (var i = 0; i < buttons.length; i++) {
342
+ buttons[i].onclick = function () {
343
+ var size = this.innerHTML,
344
+ n_Class = this.dataset.element,
345
+ infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
346
+ type = infArr[1],
347
+ num = infArr[2],
348
+ affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];
349
+ affectedEl.classList.remove('wptb-size-S');
350
+ affectedEl.classList.remove('wptb-size-M');
351
+ affectedEl.classList.remove('wptb-size-L');
352
+ affectedEl.classList.remove('wptb-size-XL');
353
+ affectedEl.classList.add('wptb-size-' + size);
354
+ var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');
355
+ for (var i = 0; i < b.length; i++) {
356
+ b[i].classList.remove('selected');
357
+ }
358
+ this.classList.add('selected');
359
+ }
360
+ }
361
+ }
362
+
363
+ var optionControls = prop.getElementsByClassName('wptb-element-property');
364
+
365
+ for (var i = 0; i < optionControls.length; i++) {
366
+ if (optionControls[i].classList.contains('wptb-color-picker')) {
367
+ jQuery(optionControls[i]).wpColorPicker({
368
+ change: function (event, ui) {
369
+ var parent = event.target, classe, type, ps, number;
370
+ classe = parent.dataset.element.match(/wptb-options-(.+)-(\d+)/i);
371
+ type = classe[1];
372
+ number = classe[2];
373
+ affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];
374
+ if ( type == 'button' ) {
375
+ if (parent.dataset.type == 'button-text-color') {
376
+ affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();
377
+ } else {
378
+ affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();
379
+ }
380
+ } else if( type == 'list' ) {
381
+ let ps = affectedEl.querySelectorAll( 'p' );
382
+ if( ps.length > 0 ) {
383
+ for ( let i = 0; i < ps.length; i++ ) {
384
+ ps[i].style.color = ui.color.toString();
385
+ }
386
+ }
387
+ } else {
388
+ affectedEl.style.color = ui.color.toString();
389
+ }
390
+ }
391
+ });
392
+ }
393
+
394
+ if (optionControls[i].dataset.type === 'font-size') {
395
+ var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];
396
+ slider.oninput = function () {
397
+ this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;
398
+ this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange();
399
+ }
400
+ }
401
+
402
+ if (optionControls[i].dataset.type === 'image-size') {
403
+ var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];
404
+ slider.oninput = function () {
405
+ this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;
406
+ this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange();
407
+ }
408
+ }
409
+
410
+ optionControls[i].onchange = function (event) {
411
+
412
+ var n_Class = this.dataset.element,
413
+ infArr = n_Class.match(/wptb-options-(.+)-(\d+)/i),
414
+ type = infArr[1],
415
+ num = infArr[2],
416
+ affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],
417
+ val = this.value;
418
+
419
+ switch (this.dataset.type) {
420
+ case 'src':
421
+ var img = affectedEl.getElementsByTagName("img")[0];
422
+ img.src = this.value;
423
+ break;
424
+ case 'alternative-text':
425
+ var img = affectedEl.getElementsByTagName('img')[0];
426
+ img.alt = this.value;
427
+ break;
428
+ case 'image-link':
429
+ affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );
430
+ break;
431
+ case 'image-link-target':
432
+ if (this.checked == true) {
433
+ affectedEl.getElementsByTagName('a')[0].target = '_blank';
434
+ } else {
435
+ affectedEl.getElementsByTagName('a')[0].target = '_self';
436
+ }
437
+ break;
438
+ case 'image-link-nofollow':
439
+ if (this.checked == true) {
440
+ affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';
441
+ } else {
442
+ affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');
443
+ }
444
+ break;
445
+ case 'image-size':
446
+ affectedEl.getElementsByTagName('img')[0].style.width = this.value + '%';
447
+ affectedEl.getElementsByTagName('img')[0].style.height = 'auto';
448
+ this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;
449
+ break;
450
+ case 'image-alignment':
451
+ affectedEl.getElementsByTagName( 'img' )[0].parentNode.style.textAlign = this.value;
452
+ break;
453
+ case 'font-size':
454
+ affectedEl.style.fontSize = val + 'px';
455
+ break;
456
+ case 'button-alignment':
457
+ var jc = '';
458
+ if (this.value == 'left') {
459
+ jc = 'start';
460
+ } else if (this.value == 'right') {
461
+ jc = 'flex-end';
462
+ } else {
463
+ jc = 'center';
464
+ }
465
+ affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;
466
+ break;
467
+ case 'button-link':
468
+ if ( this.value ) {
469
+ affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );
470
+ } else {
471
+ affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );
472
+ }
473
+ break;
474
+ case 'button-link-target':
475
+ if (this.checked == true) {
476
+ affectedEl.getElementsByTagName('a')[0].target = '_blank';
477
+ } else {
478
+ affectedEl.getElementsByTagName('a')[0].target = '_self';
479
+ }
480
+ break;
481
+ case 'button-link-nofollow':
482
+ if (this.checked == true) {
483
+ affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';
484
+ } else {
485
+ affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );
486
+ }
487
+ break;
488
+ case 'button-id':
489
+ if( this.value ) {
490
+ affectedEl.getElementsByTagName( 'a' )[0].id = this.value;
491
+ } else {
492
+ affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );
493
+ }
494
+ case 'button-color':
495
+ break;
496
+ case 'list-alignment':
497
+ let listItems = affectedEl.querySelectorAll('li');
498
+ for (var i = 0; i < listItems.length; i++) {
499
+ let p = listItems[i].querySelector( 'p' );
500
+ if ( p ) {
501
+ p.style.textAlign = this.value;
502
+ }
503
+ }
504
+ break;
505
+ case 'list-class':
506
+ let parentNode = event.target
507
+ .parentNode
508
+ .parentNode
509
+ .querySelector('[data-type=list-style-type]')
510
+ .parentNode,
511
+ parentNodeSettingItem = parentNode.parentNode;
512
+ if (val == 'unordered') {
513
+ parentNode.style.display = 'flex';
514
+
515
+ parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';
516
+ let listItem = affectedEl.querySelectorAll('li');
517
+ for (var i = 0; i < listItem.length; i++) {
518
+ let p = listItem[i].querySelector( 'p' );
519
+ p.removeAttribute ( 'class' );
520
+ p.classList.add( 'wptb-list-style-type-disc' );
521
+ }
522
+ parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';
523
+ } else {
524
+ parentNode.style.display = 'none';
525
+ parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';
526
+ var listItem = affectedEl.querySelectorAll('li');
527
+ for (var i = 0; i < listItem.length; i++) {
528
+ let p = listItem[i].querySelector( 'p' );
529
+ p.removeAttribute ( 'class' );
530
+ }
531
+ }
532
+ break;
533
+ case 'list-style-type':
534
+ var listItem = affectedEl.querySelectorAll('li');
535
+ for (var i = 0; i < listItem.length; i++) {
536
+ let p = listItem[i].querySelector( 'p' );
537
+ p.removeAttribute ( 'class' );
538
+ p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );
539
+ }
540
+ break;
541
+ }
542
+ }
543
+ }
544
+ };
inc/admin/js/core/WPTB_Helper.js ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Helper = {
2
+ hexToRgb: function( hex ) {
3
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec( hex );
4
+ return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;
5
+ },
6
+ rgbToHex: function ( rgb ) {
7
+ var rgb = rgb.match( /^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i );
8
+
9
+ return ( rgb && rgb.length === 4 ) ? "#" +
10
+ ( "0" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +
11
+ ( "0" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +
12
+ ( "0" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';
13
+ },
14
+ getDragImageCustom: function ( type ) {
15
+ let hostName = location.protocol + '//' + location.hostname;
16
+ let img = document.createElement( 'img' );
17
+ img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';
18
+ return img;
19
+ },
20
+ dragImagesArr: function() {
21
+ return {
22
+ text: WPTB_Helper.getDragImageCustom( 'text' ),
23
+ image: WPTB_Helper.getDragImageCustom( 'image' ),
24
+ button: WPTB_Helper.getDragImageCustom( 'button' ),
25
+ list: WPTB_Helper.getDragImageCustom( 'list' )
26
+ };
27
+ },
28
+ listItemsRecalculateIndex: function( ulElem ) {
29
+ let par = ulElem.querySelectorAll( 'p' );
30
+ if ( par.length > 0 ) {
31
+ for ( let i = 0; i < par.length; i++ ) {
32
+ par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';
33
+ }
34
+ }
35
+ },
36
+ listItemsTinyMceInit: function( listItem ) {
37
+ tinyMCE.init({
38
+ target: listItem,
39
+ inline: true,
40
+ plugins: "link, paste",
41
+ dialog_type: "modal",
42
+ theme: 'modern',
43
+ menubar: false,
44
+ fixed_toolbar_container: '#wpcd_fixed_toolbar',
45
+ paste_as_text: true,
46
+ toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
47
+ setup: function(ed) {
48
+ ed.on('keydown', function(e) {
49
+ let article = e.target.parentNode;
50
+ if ( e.keyCode == 13 ) {
51
+ e.preventDefault();
52
+ let text = e.target.innerHTML;
53
+ let duplicate = new WPTB_ListItem( text, article, true );
54
+
55
+ article.parentNode.insertBefore( duplicate.getDOMElement(), article );
56
+ WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );
57
+ e.target.querySelector( 'p' ).innerText = 'New List Item';
58
+ //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');
59
+ WPTB_Helper.listItemsRecalculateIndex( article.parentNode );
60
+
61
+ } else if ( e.keyCode == '8' || e.keyCode == '46' ) {
62
+ let p = e.target.querySelector( 'p' );
63
+ let pText = p.innerHTML.replace(/<[^>]+>/g, '');
64
+ pText = pText.replace( /\s+/g, ' ' ).trim();
65
+ pText = pText.replace( /&nbsp;/g, '').trim();
66
+
67
+ if( pText == '' ) {
68
+ e.preventDefault();
69
+ e.target.querySelector( 'p' ).innerText = '\n';
70
+ } else {
71
+ let selectedText = WPTB_Helper.getSelectionText();
72
+ selectedText = selectedText.replace( /\s+/g, ' ' ).trim();
73
+ selectedText = selectedText.replace( /&nbsp;/g, '' ).trim();
74
+ if( selectedText == pText ) {
75
+ e.preventDefault();
76
+ e.target.querySelector( 'p' ).innerText = '\n';
77
+ }
78
+ }
79
+ }
80
+ });
81
+
82
+ ed.on( 'keyup', function( e ) {
83
+
84
+ });
85
+ },
86
+ init_instance_callback: function (editor) {
87
+ window.currentEditor = editor;
88
+ editor.on('focus', function (e) {
89
+ var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
90
+ if (window.currentEditor &&
91
+ document.getElementById('wptb_builder').scrollTop >= 55 &&
92
+ window.currentEditor.bodyElement.style.display != 'none') {
93
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
94
+ document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';
95
+ document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
96
+ } else {
97
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
98
+ delete document.getElementById('wpcd_fixed_toolbar').style.right;
99
+ delete document.getElementById('wpcd_fixed_toolbar').style.top;
100
+ }
101
+ });
102
+ }
103
+ });
104
+ },
105
+ buttonsTinyMceInit: function( target ) {
106
+ tinyMCE.init({
107
+ target: target,
108
+ inline: true,
109
+ plugins: "link",
110
+ dialog_type: "modal",
111
+ theme: 'modern',
112
+ menubar: false,
113
+ fixed_toolbar_container: '#wpcd_fixed_toolbar',
114
+ toolbar: 'bold italic strikethrough',
115
+ setup : function(ed) {
116
+ ed.on('keydown', function(e) {
117
+ if (e.keyCode == 13) {
118
+ e.preventDefault();
119
+ }
120
+ });
121
+ },
122
+ init_instance_callback: function (editor) {
123
+ window.currentEditor = editor;
124
+ editor.on('focus', function (e) {
125
+ var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
126
+ if (window.currentEditor &&
127
+ document.getElementById('wptb_builder').scrollTop >= 55 &&
128
+ window.currentEditor.bodyElement.style.display != 'none') {
129
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
130
+ document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';
131
+ document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
132
+ } else {
133
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
134
+ delete document.getElementById('wpcd_fixed_toolbar').style.right;
135
+ delete document.getElementById('wpcd_fixed_toolbar').style.top;
136
+ }
137
+ });
138
+ }
139
+ });
140
+ },
141
+ linkHttpCheckChange: function( link ) {
142
+ if ( link ) {
143
+ if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {
144
+ let linkArr = link.split( '/' ),
145
+ linkClean;
146
+ if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {
147
+ linkClean = linkArr[linkArr.length - 1];
148
+ }
149
+ return document.location.protocol + '//' + linkClean;
150
+ } else {
151
+ return link;
152
+ }
153
+ } else {
154
+ return '';
155
+ }
156
+ },
157
+ dataTitleColumnSet: function( table ) {
158
+ let rows = table.rows,
159
+ rowHead = rows[0];
160
+ let computedStyleRowHead = getComputedStyle(rowHead);
161
+
162
+ let rowHeadChildren = rowHead.children;
163
+ let contentsForHeader = {};
164
+ for( let i = 0; i < rowHeadChildren.length; i++ ) {
165
+ let tdElements = rowHeadChildren[i].children;
166
+ for( let j = 0; j < tdElements.length; j++ ) {
167
+ let element = tdElements[j];
168
+ if( element.classList.contains( 'wptb-ph-element' ) ) {
169
+ let textContentStyle = element.getAttribute( 'style' );
170
+ let infArr = element.className.match( /wptb-element-(.+)-(\d+)/i );
171
+ if( infArr[1] == 'text' ) {
172
+ let p = element.querySelector( 'p' ),
173
+ textContent = p.textContent,
174
+ textAlign = p.style.textAlign;
175
+ contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize,
176
+ element.style.color, computedStyleRowHead.backgroundColor, textAlign];
177
+ break;
178
+ }
179
+ }
180
+ }
181
+ if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {
182
+ contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '',
183
+ '', computedStyleRowHead.backgroundColor, ''];
184
+ }
185
+ }
186
+ for ( let i = 1; i < rows.length; i++ ) {
187
+ let thisRow = rows[i],
188
+ thisRowChildren = thisRow.children;
189
+ for( let j = 0; j < thisRowChildren.length; j++ ) {
190
+ if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {
191
+ thisRowChildren[j].dataset.titleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];
192
+ thisRowChildren[j].dataset.titleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];
193
+ thisRowChildren[j].dataset.titleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];
194
+ thisRowChildren[j].dataset.titleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];
195
+ thisRowChildren[j].dataset.titleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];
196
+ } else {
197
+ thisRowChildren[j].dataset.titleColumn = '';
198
+ thisRowChildren[j].dataset.titleColumnFontSize = '';
199
+ thisRowChildren[j].dataset.titleColumnColor = '';
200
+ thisRowChildren[j].dataset.titleBackgroundColor = '';
201
+ thisRowChildren[j].dataset.titleAlign = '';
202
+ }
203
+ }
204
+ }
205
+ },
206
+ findAncestor: function(el, cls) {
207
+ while ((el = el.parentElement) && !el.classList.contains(cls));
208
+ return el;
209
+ },
210
+ getSelectionText: function() {
211
+ var txt = '';
212
+ if (txt = window.getSelection) {
213
+ txt = window.getSelection().toString();
214
+ } else {
215
+ txt = document.selection.createRange().text;
216
+ }
217
+ return txt;
218
+ },
219
+ settingsPanelClear: function() {
220
+ document.getElementById( 'wptb-top-row-as-header' ).checked = false;
221
+ document.getElementById( 'wptb-table-border-slider' ).value = 0;
222
+ document.getElementById( 'wptb-table-border-number' ).value = 0;
223
+ document.getElementById( 'wptb-inner-border-check' ).checked = false;
224
+ document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );
225
+ document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;
226
+ document.getElementById( 'wptb-table-inner-border-number' ).value = 1;
227
+
228
+ WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color' );
229
+
230
+ WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg' );
231
+
232
+ WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg' );
233
+
234
+ WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg' );
235
+
236
+ document.getElementById( 'wptb-table-cell-slider' ).value = 15;
237
+ document.getElementById( 'wptb-table-cell-number' ).value = 15;
238
+ },
239
+ wpColorPickerClear: function( inputId ) {
240
+ let input = document.getElementById( inputId );
241
+ let wpPickerContainer = WPTB_Helper.findAncestor( input, 'wp-picker-container' );
242
+ let parent = wpPickerContainer.parentNode;
243
+ parent.removeChild( wpPickerContainer );
244
+ let newInput = document.createElement( 'input' );
245
+ newInput.setAttribute( 'id', inputId );
246
+ newInput.value = "";
247
+ parent.appendChild( newInput );
248
+ },
249
+ detectMode: function() {
250
+ var url = window.location.href,
251
+ regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),
252
+ results = regex.exec(url);
253
+ if (!results) return false;
254
+ if (!results[2]) return '';
255
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
256
+ }
257
+ }
inc/admin/js/core/WPTB_Image.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Image = function ( src, DOMElementProt ) {
2
+ let DOMElement,
3
+ kindIndexProt = undefined,
4
+ copy = false;
5
+ if ( DOMElementProt == undefined ) {
6
+ DOMElement = document.createElement('div');
7
+ let anchor = document.createElement('a'),
8
+ img = document.createElement('img');
9
+ anchor.style.display = 'inline-block';
10
+ anchor.appendChild(img);
11
+ DOMElement.appendChild(anchor);
12
+
13
+ anchor.onclick = function( e ) {
14
+ e.preventDefault();
15
+ }
16
+
17
+ file_frame = wp.media.frames.file_frame = wp.media({
18
+ title: 'Select a image to upload',
19
+ button: {
20
+ text: 'Use this image'
21
+ },
22
+ multiple: false
23
+ });
24
+ // When an image is selected, run a callback.
25
+ file_frame.on('select', function () {
26
+ attachment = file_frame.state().get('selection').first().toJSON();
27
+ img.src = attachment.url;
28
+ });
29
+ // Finally, open the modal
30
+ if (src == undefined) {
31
+ file_frame.open();
32
+ } else {
33
+ img.src = src;
34
+ }
35
+ } else {
36
+ DOMElement = DOMElementProt.cloneNode( true );
37
+
38
+ DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {
39
+ e.preventDefault();
40
+ };
41
+
42
+ let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\d+)/i );
43
+ if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {
44
+ kindIndexProt = wptbElementMutch[1];
45
+ copy = true;
46
+ };
47
+ }
48
+
49
+ this.kind = 'image';
50
+ this.getDOMElement = function () {
51
+ return DOMElement;
52
+ };
53
+ applyGenericItemSettings( this, kindIndexProt, copy );
54
+
55
+ return this;
56
+ };
inc/admin/js/core/WPTB_Initializer.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Initializer = function () {
2
+
3
+ const MIN_COLUMNS = 1,
4
+ MIN_ROWS = 1,
5
+ MAX_COLUMNS = 10,
6
+ MAX_ROWS = 10;
7
+
8
+ var tableGenerator = document.body;
9
+ columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],
10
+ columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],
11
+ rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],
12
+ rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],
13
+ columnsInput = document.getElementById('wptb-columns-number'),
14
+ rowsInput = document.getElementById('wptb-rows-number');
15
+
16
+ columnsDecrementButton.onclick = function () {
17
+ if (columnsInput.value > MIN_COLUMNS) {
18
+ columnsInput.value--;
19
+ }
20
+ };
21
+
22
+ columnsIncrementButton.onclick = function () {
23
+ if (columnsInput.value < MAX_COLUMNS) {
24
+ columnsInput.value++;
25
+ }
26
+ };
27
+
28
+ rowsDecrementButton.onclick = function () {
29
+ if (rowsInput.value > MIN_ROWS) {
30
+ rowsInput.value--;
31
+ }
32
+ };
33
+
34
+ rowsIncrementButton.onclick = function () {
35
+ if (rowsInput.value < MAX_ROWS) {
36
+ rowsInput.value++;
37
+ }
38
+ };
39
+
40
+ document.getElementById('wptb-generate-table').onclick = function () {
41
+ var columns = document.getElementById('wptb-columns-number').value,
42
+ rows = document.getElementById('wptb-rows-number').value;
43
+
44
+ WPTB_Table(columns, rows);
45
+ }
46
+
47
+ // if( document.getElementsByClassName( 'wptb-preview-table' ).length == 0 ) {
48
+ // WPTB_LeftPanel();
49
+ // }
50
+
51
+ };
inc/admin/js/core/WPTB_LeftPanel.js ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_LeftPanel = function () {
2
+
3
+ var table = document.getElementsByClassName('wptb-preview-table')[0],
4
+ wptbElementButtons = document.getElementsByClassName('wptb-element');
5
+
6
+ function wptbTdBgColorSavedSet( inputId, trNumber ) {
7
+ if ( trNumber > 3 ) return;
8
+ if( table ) {
9
+ let tableRows = table.getElementsByTagName('tr');
10
+ if ( tableRows.length > trNumber ) {
11
+ let trBackgroundColor = tableRows[trNumber].style.backgroundColor;
12
+ var wptbEvenRowBg = document.getElementById(inputId);
13
+ if ( wptbEvenRowBg && trBackgroundColor ) {
14
+ wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );
15
+ }
16
+ }
17
+ }
18
+
19
+ }
20
+
21
+ wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );
22
+ jQuery('#wptb-even-row-bg').wpColorPicker({
23
+ change: function ( event, ui ) {
24
+ var tableRows = table.getElementsByTagName('tr');
25
+ for ( let i = 1; i < tableRows.length; i += 2 ) {
26
+ tableRows[i].style.backgroundColor = ui.color.toString();
27
+ }
28
+ },
29
+ clear: function(){
30
+ var tableRows = table.getElementsByTagName('tr');
31
+ for ( let i = 1; i < tableRows.length; i += 2 ) {
32
+ tableRows[i].style.backgroundColor = '';
33
+ let tds = tableRows[i].getElementsByTagName('td');
34
+ for ( let j = 0; j < tds.length; j++ ) {
35
+ tds[j].style.backgroundColor = '';
36
+ }
37
+ }
38
+ },
39
+
40
+ });
41
+
42
+ wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );
43
+ jQuery('#wptb-odd-row-bg').wpColorPicker({
44
+ change: function ( event, ui ) {
45
+ var tableRows = table.getElementsByTagName('tr');
46
+ for ( let i = 2; i < tableRows.length; i += 2 ) {
47
+ tableRows[i].style.backgroundColor = ui.color.toString();
48
+ }
49
+ },
50
+ clear: function(){
51
+ var tableRows = table.getElementsByTagName('tr');
52
+ for ( let i = 2; i < tableRows.length; i += 2 ) {
53
+ tableRows[i].style.backgroundColor = '';
54
+ let tds = tableRows[i].getElementsByTagName( 'td' );
55
+ for ( var j = 0; j < tds.length; j++ ) {
56
+ tds[j].style.backgroundColor = '';
57
+ }
58
+ }
59
+ },
60
+ });
61
+
62
+ wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );
63
+ jQuery('#wptb-table-header-bg').wpColorPicker({
64
+ change: function (event, ui) {
65
+ var tableHeader = table.getElementsByTagName('tr')[0];
66
+ tableHeader.style.backgroundColor = ui.color.toString();
67
+ },
68
+ clear: function(){
69
+ var tableHeader = table.getElementsByTagName('tr')[0];
70
+ tableHeader.style.backgroundColor = '';
71
+ let tds = tableHeader.getElementsByTagName('td');
72
+ for (var j = 0; j < tds.length; j++) {
73
+ tds[j].style.backgroundColor = '';
74
+ }
75
+ },
76
+ });
77
+
78
+ function tableTopRowAsHeadSavedSet( table ) {
79
+ let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );
80
+
81
+ if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {
82
+ wptbTopRowAsHeader.checked = true;
83
+ } else {
84
+ wptbTopRowAsHeader.checked = false;
85
+ }
86
+ }
87
+ tableTopRowAsHeadSavedSet( table );
88
+
89
+ function tableBorderColorWidthSavedSet() {
90
+ let table = document.getElementsByClassName('wptb-preview-table');
91
+ if ( table.length > 0 ) {
92
+ let tableBorderColor = table[0].style.borderColor;
93
+ if ( tableBorderColor ) {
94
+ let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );
95
+ if ( tableBorderColorInput ) {
96
+ tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );
97
+ }
98
+ }
99
+
100
+ let tableBorderWidth = table[0].style.borderWidth;
101
+ if ( tableBorderWidth ) {
102
+ let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),
103
+ wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');
104
+
105
+ if ( wptbTableBorderWidthSlider ) {
106
+ wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );
107
+ }
108
+ if ( wptbTableBorderWidthNumber ) {
109
+ wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );
110
+ }
111
+ }
112
+
113
+
114
+ let tableTd = table[0].querySelector( 'td' );
115
+ let applyInnerBorder = tableTd.style.borderWidth;
116
+ if ( applyInnerBorder ) {
117
+ let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );
118
+ let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );
119
+ if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {
120
+ if ( innerBorderCheckInput ) {
121
+ innerBorderCheckInput.checked = true;
122
+
123
+ if ( wptbApplyInnerBorder ) {
124
+ wptbApplyInnerBorder.classList.add( 'visible' );
125
+ let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );
126
+ let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );
127
+ wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );
128
+ wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );
129
+ }
130
+ }
131
+ } else {
132
+ innerBorderCheckInput.checked = false;
133
+ }
134
+ }
135
+
136
+ if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {
137
+ document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';
138
+ }
139
+ }
140
+ }
141
+
142
+ tableBorderColorWidthSavedSet();
143
+
144
+ jQuery('#wptb-table-border-color').wpColorPicker({
145
+ change: function (event, ui) {
146
+ var tableCells = table.getElementsByTagName('td');
147
+ table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();
148
+
149
+ for (var i = 0; i < tableCells.length; i++) {
150
+ let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;
151
+ if ( document.getElementById('wptb-inner-border-check').checked ) {
152
+ tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();
153
+ }
154
+ }
155
+ },
156
+ clear: function() {
157
+ var tableCells = table.getElementsByTagName('td');
158
+ table.style.borderColor = '';
159
+
160
+ for (var i = 0; i < tableCells.length; i++) {
161
+ tableCells[i].style.borderColor = '';
162
+ }
163
+ }
164
+ });
165
+
166
+ function addInnerBorderSize(value) {
167
+ var tableCells = table.getElementsByTagName('td');
168
+ for (var i = 0; i < tableCells.length; i++) {
169
+ tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';
170
+ tableCells[i].style.borderStyle = 'solid';
171
+ }
172
+ }
173
+
174
+ function addCellPadding(value) {
175
+ var tableCells = table.getElementsByTagName('td');
176
+ for (var i = 0; i < tableCells.length; i++) {
177
+ tableCells[i].style.padding = value + 'px';
178
+ }
179
+ }
180
+
181
+ function addInnerBorder(checked) {
182
+ var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?
183
+ document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';
184
+ if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {
185
+ document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;
186
+ document.querySelector( '#wptb-table-inner-border-number' ).value = 1;
187
+ }
188
+ let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';
189
+ let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');
190
+ if( wptbPreviewTable.length > 0 ) {
191
+ if (checked == 'checked') {
192
+ document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';
193
+ var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );
194
+ for (var i = 0; i < tableCells.length; i++) {
195
+ tableCells[i].style.border = width + ' solid ' + color;
196
+ }
197
+ document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );
198
+ } else {
199
+ document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );
200
+ var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );
201
+ for (var i = 0; i < tableCells.length; i++) {
202
+ tableCells[i].style.border = '0px solid ' + color;
203
+ }
204
+ }
205
+ }
206
+
207
+ }
208
+
209
+ function addBorderSize(value) {
210
+ table.style.borderWidth = value + 'px';
211
+ table.style.borderStyle = 'solid';
212
+ }
213
+
214
+ function cellPaddingSavedSet() {
215
+ let table = document.getElementsByClassName('wptb-preview-table');
216
+
217
+ if ( table.length > 0 ) {
218
+ let td = table[0].querySelector( 'td' );
219
+
220
+ if ( td ) {
221
+ let padding = td.style.padding;
222
+
223
+ if ( padding ) {
224
+ let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),
225
+ wptbTableCellNumber = document.getElementById('wptb-table-cell-number');
226
+
227
+ if ( wptbTableCellSlider ) {
228
+ wptbTableCellSlider.value = parseInt( padding );
229
+ }
230
+ if ( wptbTableCellNumber ) {
231
+ wptbTableCellNumber.value = parseInt( padding );
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+
238
+ cellPaddingSavedSet();
239
+
240
+ function numberImputSize( wptbNumberInputs, maxCount, maxValue ) {
241
+ wptbNumberInputs.onkeydown = function() {
242
+ let thisValue = this.value;
243
+ thisValue = String( thisValue );
244
+ if ( thisValue[0] == 0 ) {
245
+ this.value = "";
246
+ } else {
247
+ thisValue = thisValue.substring( 0, maxCount );
248
+ this.value = thisValue;
249
+ }
250
+ }
251
+ wptbNumberInputs.onkeyup = function() {
252
+ let thisValue = this.value;
253
+ thisValue = String( thisValue );
254
+ if ( thisValue > maxValue ) {
255
+ this.value = maxValue;
256
+ }
257
+ }
258
+ }
259
+
260
+ let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );
261
+ numberImputSize( wptbTableBorderNumber, 1, 50 );
262
+
263
+ let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );
264
+ numberImputSize( wptbTableInnerBorderNumber, 1, 50 );
265
+
266
+ let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );
267
+ numberImputSize( wptbTableCellNumber, 1, 50 );
268
+
269
+ let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );
270
+ numberImputSize( wptbTextfontSizeNumber, 1, 50 );
271
+
272
+ let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );
273
+ numberImputSize( wptbImageWidthNumber, 2, 100 );
274
+
275
+
276
+
277
+ document.getElementById('wptb-table-cell-slider').oninput = function () {
278
+ document.getElementById('wptb-table-cell-number').value = this.value;
279
+ addCellPadding(this.value);
280
+ };
281
+
282
+ document.getElementById('wptb-table-cell-number').onchange = function () {
283
+ document.getElementById('wptb-table-cell-slider').value = this.value;
284
+ addCellPadding(this.value);
285
+ };
286
+
287
+ document.getElementById('wptb-table-border-slider').oninput = function () {
288
+ document.getElementById('wptb-table-border-number').value = this.value;
289
+ addBorderSize(this.value);
290
+
291
+ let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,
292
+ tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );
293
+ if ( this.value == 0 && wptbInnerBorderCheck == false ) {
294
+ tableBorderColorSetArea.style.display = 'none';
295
+ } else {
296
+ tableBorderColorSetArea.style.display = '';
297
+ }
298
+ };
299
+
300
+ document.getElementById('wptb-table-border-number').onchange = function () {
301
+ document.getElementById('wptb-table-border-slider').value = this.value;
302
+ addBorderSize(this.value);
303
+ };
304
+
305
+ document.getElementById('wptb-table-inner-border-slider').oninput = function () {
306
+ document.getElementById('wptb-table-inner-border-number').value = this.value;
307
+ addInnerBorderSize(this.value);
308
+ };
309
+
310
+ document.getElementById('wptb-table-inner-border-number').onchange = function () {
311
+ document.getElementById('wptb-table-inner-border-slider').value = this.value;
312
+ addInnerBorderSize(this.value);
313
+ };
314
+
315
+ document.getElementById('wptb-inner-border-check').onchange = function () {
316
+ if( table ) {
317
+ let val = this.checked ? 'checked' : 'unchecked';
318
+ addInnerBorder( val );
319
+ let borderWidth = document.getElementById('wptb-table-border-slider').value,
320
+ tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );
321
+ if( val == 'unchecked' && borderWidth == 0 ) {
322
+ tableBorderColorSetArea.style.display = 'none';
323
+ } else {
324
+ tableBorderColorSetArea.style.display = '';
325
+ }
326
+ }
327
+
328
+ };
329
+
330
+ function createMobileHeadForTable( table, thisEvent ) {
331
+
332
+ if( thisEvent.checked ) {
333
+ WPTB_Helper.dataTitleColumnSet( table );
334
+
335
+ table.classList.add( 'wptb-table-preview-head' );
336
+ table.rows[0].classList.add( 'wptb-table-head' );
337
+ } else {
338
+ let rows = table.rows;
339
+ table.classList.remove( 'wptb-table-preview-head' );
340
+ rows[0].classList.remove( 'wptb-table-head' );
341
+
342
+ for ( let i = 1; i < rows.length; i++ ) {
343
+ let thisRow = rows[i],
344
+ thisRowChildren = thisRow.children;
345
+ for( let j = 0; j < thisRowChildren.length; j++ ) {
346
+ thisRowChildren[j].removeAttribute( 'data-title-column' );
347
+ }
348
+ }
349
+ }
350
+ }
351
+
352
+ document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {
353
+ createMobileHeadForTable( table, this );
354
+ }
355
+
356
+ for (var i = 0; i < wptbElementButtons.length; i++) {
357
+ wptbElementButtons[i].ondragstart = function (e) {
358
+ e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);
359
+ e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );
360
+ }
361
+ }
362
+
363
+ if( table ) {
364
+ document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;
365
+ document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;
366
+ document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;
367
+ document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;
368
+ document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;
369
+ document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;
370
+ document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;
371
+ document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;
372
+ document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;
373
+ document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;
374
+ document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;
375
+ document.getElementById('wptb-delete-column').onclick = table.deleteColumn;
376
+ document.getElementById('wptb-delete-row').onclick = table.deleteRow;
377
+ document.getElementById('wptb-merge-cells').onclick = table.mergeCells;
378
+ document.getElementById('wptb-split-cell').onclick = table.splitCell;
379
+ }
380
+
381
+ document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {
382
+ let wptbContainer = document.querySelector( '.wptb-container' );
383
+ if( wptbContainer ) {
384
+ if ( wptbContainer.classList.contains( 'collapsed' ) ) {
385
+ wptbContainer.classList.remove( 'collapsed' );
386
+ } else {
387
+ wptbContainer.classList.add( 'collapsed' );
388
+ }
389
+ }
390
+ };
391
+
392
+ // this code hides the "element parameters" area
393
+ // when clicked outside this element and its "tinymce" toolbar
394
+ let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];
395
+ wptbBuilderPanel.addEventListener( 'click', function( e ) {
396
+ if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) &&
397
+ ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {
398
+ document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';
399
+ document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';
400
+ document.getElementById( 'element-options-group' ).style.display = 'none';
401
+ let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );
402
+ if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {
403
+ document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );
404
+ }
405
+ }
406
+ }, false);
407
+
408
+ };
inc/admin/js/core/WPTB_List.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_List = function ( innerElements, DOMElementProt ) {
2
+
3
+ var el_L = document.createElement('ul'), item,
4
+ DOMElement = document.createElement('div'),
5
+ kindIndexProt = undefined,
6
+ copy = false;
7
+ DOMElement.classList.add( 'wptb-list-item-container' );
8
+
9
+ this.kind = 'list';
10
+
11
+ if (innerElements === '') {
12
+ //Case for edit mode list
13
+ } else if ( !innerElements ) {
14
+ for (var i = 0; i < 3; i++) {
15
+ item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');
16
+ el_L.appendChild(item.getDOMElement());
17
+ }
18
+ } else {
19
+ let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\d+)/i );
20
+ if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {
21
+ kindIndexProt = wptbElementMutch[1];
22
+ copy = true;
23
+ };
24
+
25
+ for ( var i = 0; i < innerElements.length; i++ ) {
26
+ let listItem = DOMElementProt.querySelector( 'li' );
27
+ item = new WPTB_ListItem( innerElements[i], listItem, true );
28
+ el_L.appendChild(item.getDOMElement());
29
+ }
30
+ }
31
+ DOMElement.appendChild(el_L);
32
+ //window.addElementOptions('list', elList);
33
+
34
+ this.getDOMElement = function () {
35
+ return DOMElement;
36
+ }
37
+ applyGenericItemSettings( this, kindIndexProt, copy );
38
+ WPTB_Helper.listItemsRecalculateIndex( el_L );
39
+
40
+ return this;
41
+ };
inc/admin/js/core/WPTB_ListItem.js ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_ListItem = function ( text, DOMElementProt, copy ) {
2
+ let wptbListItemReturn;
3
+ if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {
4
+ if (text == undefined) text = 'New List Item';
5
+ var DOMElement = document.createElement('li'),
6
+ //divdot = document.createElement('div'),
7
+ divcontent = document.createElement('div');
8
+ //libullet = document.createElement('li');
9
+ //divdot.classList.add('wptb-list-item-style-dot');
10
+ divcontent.classList.add('wptb-list-item-content');
11
+ //libullet.classList.add('wptb-bullet');
12
+ if ( DOMElementProt ) {
13
+ let styleDot = DOMElementProt.getAttribute( 'style' );
14
+ if ( styleDot ) {
15
+ DOMElement.setAttribute( 'style', styleDot );
16
+ }
17
+ }
18
+ //DOMElement.appendChild(divdot);
19
+ DOMElement.appendChild(divcontent);
20
+ //divdot.appendChild(libullet);
21
+ divcontent.innerHTML = text;
22
+ divcontent.onkeyup = window.listItemKeyListener;
23
+
24
+ wptbListItemReturn = true;
25
+ } else {
26
+ var DOMElement = DOMElementProt;
27
+ var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];
28
+
29
+ divcontent.onkeyup = window.listItemKeyListener;
30
+
31
+ wptbListItemReturn = false;
32
+ }
33
+
34
+ DOMElement.onmouseenter = function (event) {
35
+
36
+ var btnDelete = document.createElement('span'),
37
+ btnCopy = document.createElement('span'),
38
+ actions = document.createElement('span'),
39
+ previous,
40
+ i;
41
+ actions.classList.add('wptb-actions');
42
+ btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
43
+ btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
44
+ this.classList.add('wptb-directlyhovered');
45
+
46
+ btnDelete.onclick = function () {
47
+ var action = this.parentNode,
48
+ item = this.parentNode.parentNode,
49
+ parent = item.parentNode;
50
+ item.removeChild( action );
51
+ parent.removeChild( item );
52
+ WPTB_Helper.listItemsRecalculateIndex( parent );
53
+ };
54
+
55
+ btnCopy.onclick = function (event) {
56
+ var listItem = event.target.parentNode.parentNode,
57
+ content = listItem.querySelector('.wptb-list-item-content'),
58
+ html = content.innerHTML;
59
+ var duplicate = new WPTB_ListItem( html, listItem, true );
60
+ listItem.parentNode.insertBefore( duplicate.getDOMElement(), DOMElement );
61
+ WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );
62
+ setTimeout( function(){
63
+ divcontent.innerHTML = html;
64
+ WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );
65
+ }, 5 );
66
+ };
67
+
68
+ actions.append(btnCopy, btnDelete);
69
+ this.appendChild(actions);
70
+ };
71
+
72
+ DOMElement.onmouseleave = function (event) {
73
+ this.removeAttribute( 'class' );
74
+ let iter = 0;
75
+ while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {
76
+ event.target.querySelector( '.wptb-actions' ).remove();
77
+ iter++;
78
+ }
79
+ };
80
+
81
+ this.getDOMElement = function () {
82
+ return DOMElement;
83
+ };
84
+
85
+ if ( wptbListItemReturn ) {
86
+ return this;
87
+ }
88
+ };
inc/admin/js/core/WPTB_MultipleSelect.js ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var MultipleSelect = function () {
2
+
3
+ var selectedCells = [],
4
+ multipleCellMode = false;
5
+
6
+ this.activateMultipleSelectMode = function () {
7
+ selectedCells = [];
8
+ var tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');
9
+ for (var i = 0; i < tds.length; i++) {
10
+ tds[i].classList.remove('wptb-highlighted');
11
+ }
12
+ multipleCellMode = true;
13
+ }
14
+
15
+ this.deactivateMultipleSelectMode = function () {
16
+ multipleCellMode = false;
17
+ }
18
+
19
+ this.isActivated = function () {
20
+ return multipleCellMode;
21
+ }
22
+
23
+ this.pushSelectedCell = function (cell) {
24
+ if (!multipleCellMode) {
25
+ return;
26
+ }
27
+ selectedCells.push(cell);
28
+ cell.classList.add('wptb-highlighted');
29
+ };
30
+
31
+ this.selectedCells = function () {
32
+ return selectedCells;
33
+ }
34
+
35
+ this.flushSelectedCells = function () {
36
+ selectedCells = [];
37
+ }
38
+
39
+ this.getFirst = function () {
40
+ var minXIndex = 1000, minYIndex = 1000, first;
41
+ for (var i = selectedCells.length - 1; i >= 0; i--) {
42
+ if (minXIndex >= selectedCells[i].dataset.xIndex
43
+ && minYIndex >= selectedCells[i].dataset.yIndex) {
44
+ first = selectedCells[i];
45
+ minXIndex = selectedCells[i].dataset.xIndex;
46
+ minYIndex = selectedCells[i].dataset.yIndex;
47
+ }
48
+ }
49
+ return first;
50
+ }
51
+
52
+ this.getLast = function () {
53
+ var maxXIndex = -1, maxYIndex = -1, last;
54
+ for (var i = selectedCells.length - 1; i >= 0; i--) {
55
+ if (maxXIndex <= selectedCells[i].dataset.xIndex
56
+ && maxYIndex <= selectedCells[i].dataset.yIndex) {
57
+ last = selectedCells[i];
58
+ maxXIndex = selectedCells[i].dataset.xIndex;
59
+ maxYIndex = selectedCells[i].dataset.yIndex;
60
+ }
61
+ }
62
+ return last;
63
+ }
64
+
65
+ this.removeAllButFirst = function () {
66
+ var td = this.getFirst();
67
+ for (var i = 1; i < selectedCells.length; i++) {
68
+ selectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);
69
+ }
70
+ }
71
+
72
+ return this;
73
+
74
+ };
inc/admin/js/core/WPTB_Parser.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Parser = function (code) {
2
+ let div = document.createElement( 'div' );
3
+ div.innerHTML = code;
4
+
5
+ let table = div.children[0];
6
+ let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];
7
+
8
+ for( let i = 0; i < columnTitleMobile.length; i++ ) {
9
+ let parent = columnTitleMobile[i].parentNode;
10
+ parent.removeChild( columnTitleMobile[i] );
11
+ }
12
+
13
+ let tds = table.querySelectorAll( 'td' );
14
+ for ( let i = 0; i < tds.length; i++ ) {
15
+ tds[i].classList.add( 'wptb-droppable' );
16
+ tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );
17
+ }
18
+
19
+ return table;
20
+ }
inc/admin/js/core/WPTB_Parser2.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Parser2 = function (code) {
2
+ if( Array.isArray( code ) ) {
3
+ let elementHtml;
4
+
5
+ if ( code.length == 1) {
6
+ return elementHtml.appendChild( document.createTextNode( code[0] ) );
7
+ }
8
+ if( 0 in code ) {
9
+ let tagName = code[0];
10
+ elementHtml = document.createElement( tagName );
11
+
12
+ if ( 1 in code ) {
13
+ if( Array.isArray( code[1] ) ) {
14
+ let attributes = code[1];
15
+
16
+ for( let i = 0; i < attributes.length; i++ ) {
17
+ if( Array.isArray( attributes[i] ) ) {
18
+ elementHtml.setAttribute(attributes[i][0], attributes[i][1]);
19
+ }
20
+ }
21
+ }
22
+ }
23
+
24
+ if ( 2 in code ) {
25
+ if ( Array.isArray( code[2] ) ) {
26
+ for ( let i = 0; i < code[2].length; i++ ) {
27
+ if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {
28
+ elementHtml.appendChild( document.createTextNode( code[2][i] ) );
29
+ continue;
30
+ }
31
+ if ( ! WPTB_Parser( code[2][i] ) ) continue;
32
+ elementHtml.appendChild( WPTB_Parser( code[2][i] ) );
33
+ }
34
+ } else if( typeof code[2] === 'string' ) {
35
+ elementHtml.appendChild( document.createTextNode( code[2] ) );
36
+ }
37
+
38
+ }
39
+ }
40
+
41
+ return elementHtml;
42
+ } else {
43
+ return false;
44
+ }
45
+
46
+ }
inc/admin/js/core/WPTB_Settings.js ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Settings = function () {
2
+ var elems = document.getElementsByClassName('wptb-element');
3
+
4
+ for ( var i = 0; i < elems.length; i++ ) {
5
+ elems[i].ondragstart = function ( event ) {
6
+ event.dataTransfer.effectAllowed = 'move';
7
+ event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );
8
+ event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );
9
+ }
10
+ elems[i].ondragend = function () {
11
+ let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),
12
+ wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );
13
+ if ( wptbDropHandle || wptbDropBorderMarker ) {
14
+ wptbDropHandle.style.display = 'none';
15
+ wptbDropBorderMarker.style.display = 'none';
16
+ }
17
+ }
18
+ };
19
+
20
+ let shortcodePopupWindow = document.getElementsByClassName( 'wptb-shortcode-popup-window-modal' )[0];
21
+ document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {
22
+ if( ! this.classList.contains( 'wptb-embed-disable' ) ) {
23
+ shortcodePopupWindow.classList.add( 'wptb-shortcode-popup-show' );
24
+ }
25
+ }
26
+
27
+ document.getElementsByClassName( 'wptb-shortcode-popup-dark-area' )[0].onclick = function () {
28
+ shortcodePopupWindow.classList.remove( 'wptb-shortcode-popup-show' );
29
+ }
30
+
31
+ document.getElementsByClassName( 'wptb-shortcode-popup-window-close-icon' )[0].onclick = function () {
32
+ shortcodePopupWindow.classList.remove( 'wptb-shortcode-popup-show' );
33
+ }
34
+
35
+ document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function () {
36
+ let bar = document.querySelector( '.wptb-edit-bar' );
37
+ if ( bar && bar.classList.contains( 'visible' ) ) {
38
+ let table = document.getElementsByClassName( 'wptb-preview-table' )[0];
39
+ table.toggleTableEditMode();
40
+ }
41
+
42
+ let http = new XMLHttpRequest(),
43
+ url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + "?action=save_table",
44
+ t = document.getElementById( 'wptb-setup-name' ).value.trim(),
45
+ messagingArea,
46
+ code = document.getElementsByClassName( 'wptb-preview-table' );
47
+ if( code.length > 0 ) {
48
+ code = WPTB_Stringifier( code[0] );
49
+ code = code.outerHTML;
50
+ } else {
51
+ code = '';
52
+ }
53
+
54
+ if ( t === '' || code === '' ) {
55
+ let messagingAreaText = '';
56
+ if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';
57
+ if( code === '' ) messagingAreaText += 'Table wasn\'t created';
58
+ messagingArea = document.getElementById( 'wptb-messaging-area' );
59
+ messagingArea.innerHTML = '<div class="wptb-error wptb-message">Error: ' + messagingAreaText + '</div>';
60
+ messagingArea.classList.add( 'wptb-warning' );
61
+ setTimeout(function () {
62
+ messagingArea.removeChild( messagingArea.firstChild );
63
+ }, 4000 );
64
+ return;
65
+ }
66
+
67
+ let params = {
68
+ title: t,
69
+ content: code,
70
+ security_code: wptb_admin_object.security_code
71
+ };
72
+ if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {
73
+ params.id = rs;
74
+ }
75
+ params = JSON.stringify( params );
76
+
77
+ http.open('POST', url, true);
78
+ http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );
79
+
80
+ http.onreadystatechange = function (action) {
81
+ if ( this.readyState == 4 && this.status == 200 ) {
82
+ var data = JSON.parse( http.responseText );
83
+ messagingArea = document.getElementById( 'wptb-messaging-area' );
84
+
85
+ if ( data[0] == 'saved' ) {
86
+ document.wptbId = data[1];
87
+ messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully saved.</div>';
88
+ document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-embed-disable' );
89
+ document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';
90
+ } else if( data[0] == 'edited' ) {
91
+ messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
92
+ } else {
93
+ messagingArea.innerHTML = '<div class="wptb-error wptb-message">Safety problems</div>';
94
+ }
95
+ messagingArea.classList.add( 'wptb-success' );
96
+ setTimeout( function () {
97
+ messagingArea.removeChild( messagingArea.firstChild );
98
+ }, 4000 );
99
+ }
100
+ }
101
+ http.send( params );
102
+ }
103
+ };
inc/admin/js/core/WPTB_Space.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Space = function ( elSpaceBetween ) {
2
+
3
+ function newElementProxy(el) {
4
+ if (el.includes('list')) {
5
+ return new WPTB_List();
6
+ } else if (el.includes('image')) {
7
+ return new WPTB_Image();
8
+ } else if (el.includes('text')) {
9
+ return new WPTB_Text();
10
+ } else if (el.includes('button')) {
11
+ return new WPTB_Button();
12
+ }
13
+ }
14
+ let spaceBetween;
15
+ if ( ! elSpaceBetween ) {
16
+ spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');
17
+ } else {
18
+ spaceBetween = elSpaceBetween;
19
+ }
20
+
21
+ spaceBetween.ondragenter = function () {
22
+ this.classList.add('visible');
23
+ };
24
+ spaceBetween.ondragover = function (event) {
25
+ event.preventDefault();
26
+ };
27
+
28
+ spaceBetween.ondragleave = function () {
29
+ this.classList.remove('visible');
30
+ };
31
+
32
+ spaceBetween.ondrop = function (event) {
33
+ event.stopPropagation();
34
+
35
+ var p = event.target.nextSibling,
36
+ td = event.target,
37
+ element, t_space, spaceParent;
38
+
39
+ while ( !td.classList.contains('wptb-droppable') ) {
40
+ td = td.parentNode;
41
+ }
42
+
43
+ if (event.dataTransfer.getData('wptbElement')) {
44
+ element = newElementProxy(event.dataTransfer.getData('wptbElement'));
45
+ this.classList.remove('visible');
46
+
47
+ if (p == null) {
48
+ td.appendChild(element.getDOMElement());
49
+ td.appendChild(new WPTB_Space());
50
+ } else {
51
+ td.insertBefore(element.getDOMElement(), p);
52
+ td.insertBefore(new WPTB_Space(), p);
53
+ }
54
+
55
+ } else {
56
+ alert(event.dataTransfer.getData('node'));
57
+ element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];
58
+ t_space = element.nextSibling;
59
+ spaceParent = element.parentNode;
60
+ if (t_space != undefined) {
61
+ spaceParent.removeChild(t_space);
62
+ }
63
+
64
+ if (p == null) {
65
+ td.appendChild(element);
66
+ td.appendChild(new WPTB_Space());
67
+ } else {
68
+ td.insertBefore(element, p);
69
+ td.insertBefore(new WPTB_Space(), p);
70
+ }
71
+
72
+ }
73
+ this.classList.remove('visible');
74
+ };
75
+
76
+ if ( ! elSpaceBetween ) {
77
+ return spaceBetween;
78
+ }
79
+ };
inc/admin/js/core/WPTB_Stringifier.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Stringifier = function ( codeMain ) {
2
+ if ( codeMain ) {
3
+ let code = codeMain.cloneNode( true );
4
+ code.classList.add( 'wptb-table-preview-static-indic' );
5
+ code.dataset.tableColumns = codeMain.columns;
6
+ code.dataset.reconstraction = 1;
7
+
8
+ let tds = code.getElementsByTagName( 'td' );
9
+ if ( tds.length > 0 ) {
10
+ for ( let i = 0; i < tds.length; i++ ) {
11
+
12
+ for( let i = 0; i < tds.length; i++ ) {
13
+ if( code.dataset.reconstraction == 1 && tds[i].colSpan > 1 || tds[i].rowSpan > 1 ) {
14
+ code.dataset.reconstraction = 0;
15
+ break;
16
+ }
17
+ }
18
+
19
+ if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {
20
+ tds[i].removeAttribute( 'data-x-index' );
21
+ }
22
+ tds[i].removeAttribute( 'data-y-index' );
23
+ tds[i].removeAttribute( 'draggable' );
24
+ tds[i].classList.remove( 'wptb-droppable' );
25
+ let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );
26
+
27
+ if ( innerElements.length > 0 ) {
28
+ for ( let j = 0; j < innerElements.length; j++ ) {
29
+ innerElements[j].classList.remove( 'wptb-directlyhovered' );
30
+
31
+ let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );
32
+ if( mceContentBodys.length > 0 ) {
33
+ for ( let k = 0; k < mceContentBodys.length; k++ ) {
34
+ mceContentBodys[k].classList.remove( 'mce-content-body' );
35
+ }
36
+ }
37
+
38
+ let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );
39
+ if ( dataMceStyle.length > 0 ) {
40
+ for ( let k = 0; k < dataMceStyle.length; k++ ) {
41
+ dataMceStyle[k].removeAttribute( 'data-mce-style' );
42
+ }
43
+ }
44
+
45
+ let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );
46
+ if ( contentEditable.length > 0 ) {
47
+ for ( let k = 0; k < contentEditable.length; k++ ) {
48
+ contentEditable[k].removeAttribute( 'contenteditable' );
49
+ }
50
+ }
51
+
52
+ let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );
53
+ if ( spellCheck.length > 0 ) {
54
+ for ( let k = 0; k < spellCheck.length; k++ ) {
55
+ spellCheck[k].removeAttribute( 'spellcheck' );
56
+ }
57
+ }
58
+
59
+ let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );
60
+ if ( mceIds.length > 0 ) {
61
+ for ( let k = 0; k < mceIds.length; k++ ) {
62
+ mceIds[k].removeAttribute( 'id' );
63
+ }
64
+ }
65
+
66
+ let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );
67
+ let wptbActionsLength = wptbActions.length;
68
+ while ( wptbActionsLength > 0 ) {
69
+ wptbActions[0].parentNode.removeChild( wptbActions[0] );
70
+ wptbActionsLength--;
71
+ }
72
+ }
73
+ }
74
+
75
+ if( tds[i].hasAttribute( 'data-title-column' ) ) {
76
+ let columnNameDivContainer = document.createElement( 'div' ),
77
+ columnNameDiv = document.createElement( 'div' );
78
+ columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );
79
+ columnNameDiv.classList.add( 'wptb-column-title-mobile' );
80
+ columnNameDiv.dataset.titleColumn = tds[i].dataset.titleColumn;
81
+ columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.titleColumnFontSize + '; \n\
82
+ color:' + tds[i].dataset.titleColumnColor + '; background-color:' + tds[i].dataset.titleBackgroundColor + '; text-align:' + tds[i].dataset.titleAlign + ';' );
83
+ columnNameDiv.style.padding = tds[i].style.padding;
84
+ if( tds[i].children.length == 0 ) {
85
+ tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );
86
+ }
87
+ columnNameDivContainer.appendChild( columnNameDiv );
88
+ tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );
89
+ }
90
+ }
91
+ }
92
+
93
+ return code;
94
+ }
95
+ }
inc/admin/js/core/WPTB_Stringifier2.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Stringifier2 = function ( node, start = false ) {
2
+
3
+ if ( node == undefined ) {
4
+ return '';
5
+ } else if ( node.tagName == undefined && node.nodeType == 3 ) {
6
+ return node.nodeValue;
7
+ }
8
+
9
+ let code = [],
10
+ children,
11
+ int_elem_arr = false,
12
+ attributes = [...node.attributes],
13
+ attributes_list = [],
14
+ internal_elements = [];
15
+ if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) ||
16
+ node.parentNode.classList.contains( 'mce-content-body' ) ) &&
17
+ node.tagName.toLowerCase() == 'p' ) {
18
+ children = node.childNodes;
19
+ int_elem_arr = true;
20
+ } else if( node.children.length > 0 ) {
21
+ children = node.children;
22
+ } else {
23
+ children = node.childNodes;
24
+ }
25
+ if ( attributes.length > 0 ) {
26
+ for ( let i = 0; i < attributes.length; i++ ) {
27
+ attributes_list[i] = [attributes[i].name, attributes[i].value];
28
+ }
29
+ } else {
30
+ attributes_list = '';
31
+ }
32
+
33
+ if ( children.length > 0 ) {
34
+ for ( let i = 0; i < children.length; i++) {
35
+ let inter_elem = WPTB_Stringifier(children[i]);
36
+
37
+ if ( Array.isArray( inter_elem ) || int_elem_arr ) {
38
+ internal_elements[i] = inter_elem;
39
+ } else if ( typeof inter_elem === 'string' && inter_elem ) {
40
+ internal_elements = inter_elem;
41
+ }
42
+ }
43
+ } else {
44
+ internal_elements = '';
45
+ }
46
+
47
+
48
+ code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);
49
+
50
+ return code;
51
+ }
inc/admin/js/core/WPTB_Table.js ADDED
@@ -0,0 +1,1302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var array = [], WPTB_Table = function (columns, rows) {
2
+
3
+ /* The members of the class */
4
+ var settings = document.getElementsByClassName('wptb-settings-items'),
5
+ wptbTableSetup = document.getElementsByClassName("wptb-table-setup")[0],
6
+ table, row, cell,
7
+ maxAmountOfCells,
8
+ maxAmountOfRows;
9
+
10
+ //HERE ARE THE PRIVATE FUNCTIONS
11
+ /*
12
+ * This function toggles buttons visibility in cell edit mode
13
+ * (according to the amount of currently selected cells), and
14
+ * highlights visually the clicked cell if it is not highlighted, or
15
+ * removes highlight if clicked cell is already highlighted.
16
+ * It too toggles the bits of our abstract representation.
17
+ * @param Event this is the event instance of the click performed over a cell.
18
+ */
19
+ var mark = function (event) {
20
+ var rs = this.rowSpan,
21
+ cs = this.colSpan,
22
+ markedCells,
23
+ noCells = document.getElementsByClassName('wptb-no-cell-action'),
24
+ singleCells = document.getElementsByClassName('wptb-single-action'),
25
+ multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
26
+ position = getCoords(this),
27
+ row = position[0],
28
+ column = position[1];
29
+ if (!document.select.isActivated()) {
30
+ return;
31
+ }
32
+ if (this.className.match(/wptb-highlighted/)) {
33
+ this.classList.remove('wptb-highlighted');
34
+ for (var i = 0; i < rs; i++) {
35
+ for (var j = 0; j < cs; j++) {
36
+ array[row + i][column + j] = 0;
37
+ }
38
+ }
39
+ } else {
40
+ this.classList.add('wptb-highlighted');
41
+ for (var i = 0; i < rs; i++) {
42
+ for (var j = 0; j < cs; j++) {
43
+ array[row + i][column + j] = 1;
44
+ }
45
+ }
46
+ }
47
+
48
+ markedCells = document.getElementsByClassName('wptb-highlighted').length;
49
+ if (markedCells === 0) {
50
+ for (var i = 0; i < multipleCells.length; i++) {
51
+ multipleCells[i].classList.remove('visible');
52
+ multipleCells[i].setAttribute('disabled', 'disabled');
53
+ }
54
+ for (var i = 0; i < noCells.length; i++) {
55
+ noCells[i].classList.add('visible');
56
+ noCells[i].removeAttribute('disabled');
57
+ }
58
+ for (var i = 0; i < singleCells.length; i++) {
59
+ singleCells[i].classList.remove('visible');
60
+ singleCells[i].setAttribute('disabled', 'disabled');
61
+ }
62
+ } else if (markedCells === 1) {
63
+ for (var i = 0; i < multipleCells.length; i++) {
64
+ multipleCells[i].classList.remove('visible');
65
+ multipleCells[i].setAttribute('disabled', 'disabled');
66
+ }
67
+ for (var i = 0; i < noCells.length; i++) {
68
+ noCells[i].classList.remove('visible');
69
+ noCells[i].setAttribute('disabled', 'disabled');
70
+ }
71
+ for (var i = 0; i < singleCells.length; i++) {
72
+ singleCells[i].classList.add('visible');
73
+ singleCells[i].removeAttribute('disabled');
74
+ }
75
+ } else {
76
+ for (var i = 0; i < multipleCells.length; i++) {
77
+ if (table.isSquare(array)) {
78
+ multipleCells[i].classList.add('visible');
79
+ multipleCells[i].removeAttribute('disabled');
80
+ } else {
81
+ multipleCells[i].classList.remove('visible');
82
+ multipleCells[i].setAttribute('disabled', 'disabled');
83
+ }
84
+ }
85
+ for (var i = 0; i < noCells.length; i++) {
86
+ noCells[i].classList.remove('visible');
87
+ noCells[i].setAttribute('disabled', 'disabled');
88
+ }
89
+ for (var i = 0; i < singleCells.length; i++) {
90
+ singleCells[i].classList.remove('visible');
91
+ singleCells[i].setAttribute('disabled', 'disabled');
92
+ }
93
+ }
94
+ };
95
+
96
+ /*
97
+ * This function fills an array with 1's according to the actual design
98
+ * of HTML table.
99
+ * @returns an array of arrays containing an abstract representation
100
+ * of HTML table.
101
+ * @deprecated
102
+ * */
103
+
104
+ var realTimeArray = function () {
105
+ var carried = [], tds, cols, matriz = [];
106
+
107
+ for (var i = 0; i < maxAmountOfCells; i++) {
108
+ carried[i] = 0;
109
+ }
110
+
111
+ for (var i = 0; i < table.rows.length; i++) {
112
+ cols = [];
113
+
114
+ var tds = table.rows[i].getElementsByTagName('td');
115
+
116
+ for (items = 0; items < tds.length; items++) {
117
+
118
+ for (var k = 0; k < tds[items].colSpan; k++) {
119
+ cols.push(1);
120
+ }
121
+
122
+ if (tds[items].rowSpan > 1) {
123
+ for (var k = 0; k < tds[items].colSpan; k++) {
124
+ carried[items + k] = {
125
+ justAssigned: true,
126
+ amount: tds[items].rowSpan
127
+ };
128
+ }
129
+ }
130
+ }
131
+
132
+ for (var k = 0; k < maxAmountOfCells; k++) {
133
+ if (typeof carried[k] == 'object' && carried[k].amount > 0) {
134
+ carried[k].amount--;
135
+ if (carried[k].justAssigned) {
136
+ carried[k].justAssigned = false;
137
+ } else {
138
+ cols.push(1);
139
+ }
140
+ }
141
+ }
142
+
143
+ matriz.push(cols);
144
+
145
+ }
146
+ return matriz;
147
+ };
148
+
149
+ /*
150
+ * This function gets the number and position of cell spaces in current row that are occuped
151
+ * by upper rowspanned cells.
152
+ * @param number the number of row where we wish to calculate the carried rowspans up to.
153
+ * @return an array with the remaining rowspans in each column.
154
+ */
155
+ var carriedRowspans = function (row) {
156
+ var carried = [], tds, cols;
157
+
158
+ for (var i = 0; i < maxAmountOfCells; i++) {
159
+ carried[i] = 0;
160
+ }
161
+
162
+ if (row == -1) {
163
+ return carried;
164
+ }
165
+
166
+ for (var i = 0; i <= row; i++) {
167
+ cellsBuffer = table.rows[i].getElementsByTagName('td');
168
+ cellPointer = 0;
169
+
170
+ for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {
171
+ stepsToMove = 1;
172
+
173
+ if (carried[xPosition]) {
174
+ carried[xPosition]--;
175
+ } else {
176
+ celda = cellsBuffer[cellPointer++];
177
+ if (celda.rowSpan > 1) {
178
+ for (k = 0; k < celda.colSpan; k++) {
179
+ carried[xPosition + k] = celda.rowSpan - 1;
180
+ }
181
+ stepsToMove = celda.colSpan;
182
+ } else if (celda.colSpan > 1) {
183
+ stepsToMove = celda.colSpan;
184
+ }
185
+ }
186
+ }
187
+
188
+ }
189
+ return carried;
190
+ };
191
+
192
+ /*
193
+ * A helpful function for showing
194
+ * the abstract table in console.
195
+ * @param Array our abstract table.
196
+ */
197
+ var drawTable = function (a) {
198
+ var string = 'DRAWING TABLE:\n';
199
+ for (var i = 0; i < a.length; i++) {
200
+
201
+ for (var j = 0; j < a[i].length; j++) {
202
+ string += ' ' + a[i][j];
203
+ }
204
+ string += '\n';
205
+ }
206
+ table.isSquare(a);
207
+ };
208
+
209
+ /*
210
+ * It resets all the bits of our abstract representation
211
+ * to 0 and removes the highlighting class of all cells.
212
+ */
213
+
214
+ var undoSelect = function () {
215
+ var noCells = document.getElementsByClassName('wptb-no-cell-action'),
216
+ singleCells = document.getElementsByClassName('wptb-single-action'),
217
+ multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),
218
+ tds = table.getElementsByClassName('wptb-highlighted');
219
+ while (tds.length) {
220
+ tds[0].classList.remove('wptb-highlighted');
221
+ }
222
+ for (var i = 0; i < array.length; i++) {
223
+ for (var j = 0; j < array[i].length; j++) {
224
+ array[i][j] = 0;
225
+ }
226
+ }
227
+ for (var i = 0; i < multipleCells.length; i++) {
228
+ multipleCells[i].classList.remove('visible');
229
+ multipleCells[i].setAttribute('disabled', 'disabled');
230
+ }
231
+ for (var i = 0; i < noCells.length; i++) {
232
+ noCells[i].classList.add('visible');
233
+ noCells[i].removeAttribute('disabled');
234
+ }
235
+ for (var i = 0; i < singleCells.length; i++) {
236
+ singleCells[i].classList.remove('visible');
237
+ singleCells[i].setAttribute('disabled', 'disabled');
238
+ }
239
+ };
240
+
241
+ /*
242
+ * This fills the abstract representation of our table with
243
+ * zeros, at the start. the max amount of cells is the greatest sum
244
+ * of all colspans for row.
245
+ */
246
+
247
+ var fillTableArray = function () {
248
+ var colspansSums = [], a = [];
249
+
250
+ //calculate max amount of cells inside a row
251
+ for (var i = 0; i < table.rows.length; i++) {
252
+ var cells = table.rows[i].getElementsByTagName('td'),
253
+ colspanSumInRow = 0;
254
+ for (var j = 0; j < cells.length; j++) {
255
+ colspanSumInRow += cells[j].colSpan;
256
+ }
257
+ colspansSums.push(colspanSumInRow);
258
+ }
259
+
260
+ maxAmountOfCells = Math.max.apply(null, colspansSums);
261
+ //calculate max rows
262
+ var maxAmountOfRows = table.rows.length;
263
+
264
+ // fill with zeros from both values
265
+ for (var i = 0; i < maxAmountOfRows; i++) {
266
+ a[i] = [];
267
+ for (var j = 0; j < maxAmountOfCells; j++) {
268
+ a[i].push(0);
269
+ }
270
+ }
271
+ drawTable(a);
272
+ return a;
273
+ };
274
+
275
+ /*
276
+ * This function gets the sum of all colspans in a row.
277
+ * @param number the number of row to be used as reference.
278
+ */
279
+ var getActualPointsInRow = function (row) {
280
+ var tds = table.rows[row].getElementsByTagName('td'),
281
+ points = 0;
282
+ for (var i = 0; i < tds.length; i++) {
283
+ points += tds[i].colSpan;
284
+ }
285
+ return points;
286
+ }
287
+
288
+ /*
289
+ * This function gets us the exact coordinates of
290
+ * an exact cell, in a more reliable way than xIndex and yIndex,
291
+ * these last ones were meant to be used for getting the cell trough them.
292
+ * @param DOMElement the cell to get the coordinates.
293
+ */
294
+ var getCoords = function (search) {
295
+ var skipInCols = [], cell;
296
+
297
+ for (var i = 0; i < maxAmountOfCells; i++) {
298
+ skipInCols[i] = 0;
299
+ }
300
+
301
+ for (var i = 0; i < table.rows.length; i++) {
302
+ var cellsBuffer = table.rows[i].getElementsByTagName('td');
303
+ cellPointer = 0;
304
+ for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {
305
+ stepsToMove = 1;
306
+
307
+ if (skipInCols[xPosition]) {
308
+ skipInCols[xPosition]--;
309
+ } else {
310
+ var td = cellsBuffer[cellPointer++];
311
+ if (td == search) {
312
+ return [i, xPosition];
313
+ }
314
+ if (td.rowSpan > 1) {
315
+ for ( let k = 0; k < td.colSpan; k++ ) {
316
+ skipInCols[xPosition + k] = td.rowSpan - 1;
317
+ }
318
+ stepsToMove = td.colSpan;
319
+ } else if (td.colSpan > 1) {
320
+ stepsToMove = td.colSpan;
321
+ }
322
+ }
323
+ }
324
+ }
325
+ };
326
+
327
+ jQuery('#wptb-table-header-bg').val('');
328
+ jQuery('#wptb-even-row-bg').val('');
329
+ jQuery('#wptb-odd-row-bg').val('');
330
+ jQuery('#wptb-table-border-color').val('');
331
+ jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');
332
+ jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');
333
+ jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');
334
+
335
+ if (columns || rows) {
336
+ //END OF PRIVATE FUNCTIONS
337
+ for (var i = 0; i < settings.length; i++) {
338
+ if (settings[i].id !== 'wptb-apply-inner-border') {
339
+ settings[i].classList.add('visible');
340
+ }
341
+ }
342
+
343
+ //Create a HTML Table element.
344
+ table = document.createElement('table');
345
+ table.classList.add('wptb-preview-table');
346
+
347
+ //Add the data rows.
348
+ for (var i = 0; i < rows; i++) {
349
+
350
+ row = table.insertRow(-1);
351
+ row.classList.add( 'wptb-row' );
352
+
353
+ for (var j = 0; j < columns; j++) {
354
+ cell = new WPTB_Cell(mark);
355
+ cell.setCoords(i, j);
356
+ row.appendChild(cell.getDOMElement());
357
+ }
358
+ }
359
+ } else {
360
+ let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );
361
+
362
+ if (wptb_preview_table.length > 0) {
363
+ table = wptb_preview_table[0];
364
+
365
+ let cells = table.getElementsByTagName('td');
366
+
367
+ if (cells.length > 0) {
368
+ for (let i = 0; i < cells.length; i++) {
369
+ WPTB_Cell(mark, cells[i]);
370
+ }
371
+ }
372
+ }
373
+ }
374
+
375
+ /*
376
+ * This just toggles visibility of cell edit bar, and toggles
377
+ * cell selecting mode.
378
+ */
379
+
380
+ table.toggleTableEditMode = function () {
381
+ let bar = document.getElementsByClassName('wptb-edit-bar'),
382
+ cellModeBackground = document.getElementById('wptb-cell_mode_background'),
383
+ leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),
384
+ wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');
385
+ if (wptbPreviewTable.length > 0) {
386
+ wptbPreviewTable = wptbPreviewTable[0];
387
+ }
388
+
389
+ if (bar.length > 0) {
390
+ for (let i = 0; i < bar.length; i++) {
391
+ if (bar[i].classList.contains('visible')) {
392
+ document.select.deactivateMultipleSelectMode();
393
+ bar[i].classList.remove('visible');
394
+ cellModeBackground.classList.remove('visible');
395
+ leftScrollPanelCurtain.classList.remove('visible');
396
+ wptbPreviewTable.classList.remove('wptb-preview-table-manage-cells');
397
+ let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
398
+ if (wptbPreviewTableTds.length > 0) {
399
+ for (let i = 0; i < wptbPreviewTableTds.length; i++) {
400
+ wptbPreviewTableTds[i].classList.remove('wptb-highlighted');
401
+ }
402
+ }
403
+ } else {
404
+ document.select.activateMultipleSelectMode();
405
+ bar[i].classList.add('visible');
406
+ cellModeBackground.classList.add('visible');
407
+ leftScrollPanelCurtain.classList.add('visible');
408
+ wptbPreviewTable.classList.add('wptb-preview-table-manage-cells');
409
+ }
410
+ }
411
+
412
+ }
413
+ }
414
+
415
+ /*
416
+ * For assigning to each cell xIndex and y Index attributes,
417
+ * these are the column number and row number of cell in table.
418
+ */
419
+
420
+ table.recalculateIndexes = function ( start ) {
421
+ let trs = this.getElementsByTagName('tr'), tds, maxCols = 0,
422
+ tdsArr = [];
423
+ let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );
424
+
425
+ for (var i = 0; i < trs.length; i++) {
426
+ if ( i == 0 ) {
427
+ if ( start == undefined ) {
428
+ trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();
429
+ }
430
+ if( wptbTopRowAsHeader.checked ) {
431
+ if( start == undefined ) {
432
+ this.classList.add( 'wptb-table-preview-head' );
433
+ trs[i].classList.add( 'wptb-table-head' )
434
+ } ;
435
+ } else {
436
+ if( start == undefined ) {
437
+ this.classList.remove( 'wptb-table-preview-head' );
438
+ trs[i].classList.remove( 'wptb-table-head' );
439
+ }
440
+ }
441
+ } else {
442
+ if (i % 2 == 0) {
443
+ if ( start == undefined ) {
444
+ trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();
445
+ }
446
+ trs[i].classList.remove( 'wptb-table-head' );
447
+ } else {
448
+ if ( start == undefined ) {
449
+ trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();
450
+ }
451
+ trs[i].classList.remove( 'wptb-table-head' );
452
+ }
453
+ }
454
+
455
+ tdsArr[i];
456
+ tds = trs[i].getElementsByTagName('td');
457
+
458
+ if (tdsArr[i] == undefined) {
459
+ tdsArr[i] = [];
460
+ }
461
+
462
+ let jMainIter = 0;
463
+ for (var j = 0; j < tds.length; j++) {
464
+ if (tdsArr[i][j] != undefined) {
465
+ for (let y = 0; y < 100; y++) {
466
+ if (tdsArr[i][jMainIter] != undefined) {
467
+ jMainIter++;
468
+ continue;
469
+ }
470
+ tdsArr[i][jMainIter] = tds[j];
471
+ tds[j].dataset.xIndex = jMainIter;
472
+ break;
473
+ }
474
+ } else {
475
+ tdsArr[i][j] = tds[j];
476
+ tds[j].dataset.xIndex = jMainIter;
477
+ }
478
+ tds[j].dataset.yIndex = i;
479
+
480
+ if (tds[j].colSpan > 1) {
481
+ for (let k = 1; k < tds[j].colSpan; k++) {
482
+ jMainIter++;
483
+ tdsArr[i][jMainIter] = 'tdDummy';
484
+ }
485
+ }
486
+
487
+ if (tds[j].rowSpan > 1) {
488
+ for (let x = 1; x < tds[j].rowSpan; x++) {
489
+ if (tdsArr[i + x] == undefined) {
490
+ tdsArr[i + x] = [];
491
+ }
492
+ for (let z = 0; z < tds[j].colSpan; z++) {
493
+ tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';
494
+ }
495
+ }
496
+ }
497
+ jMainIter++;
498
+ }
499
+ if (j > maxCols) {
500
+ maxCols = j;
501
+ }
502
+ }
503
+ this.columns = maxCols;
504
+ }
505
+
506
+ /*
507
+ * As simple as it is: adds a column to the end of table.
508
+ */
509
+ table.addColumnEnd = function () {
510
+ let td,
511
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
512
+ currentTableTd,
513
+ currentTdStyle;
514
+ if (currentTable.length > 0) {
515
+ currentTableTd = currentTable[0].querySelector('td');
516
+ }
517
+
518
+ if (currentTableTd) {
519
+ currentTdStyle = currentTableTd.getAttribute('style');
520
+ }
521
+ for (var i = 0; i < table.rows.length; i++) {
522
+ td = new WPTB_Cell(mark);
523
+ if (currentTdStyle) {
524
+ td.getDOMElement().setAttribute('style', currentTdStyle);
525
+ }
526
+ table.rows[i].appendChild(td.getDOMElement());
527
+ array[i].push(0);
528
+ }
529
+ maxAmountOfCells++;
530
+ table.recalculateIndexes();
531
+ WPTB_Helper.dataTitleColumnSet( table );
532
+ undoSelect();
533
+ };
534
+
535
+ /*
536
+ * As simple as it looks: adds a column to the start of table.
537
+ */
538
+
539
+ table.addColumnStart = function () {
540
+ let td,
541
+ firstCell,
542
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
543
+ currentTableTd,
544
+ currentTdStyle;
545
+ if (currentTable.length > 0) {
546
+ currentTableTd = currentTable[0].querySelector('td');
547
+ }
548
+
549
+ if (currentTableTd) {
550
+ currentTdStyle = currentTableTd.getAttribute('style');
551
+ }
552
+ for (var i = 0; i < table.rows.length; i++) {
553
+ td = new WPTB_Cell(mark);
554
+ if (currentTdStyle) {
555
+ td.getDOMElement().setAttribute('style', currentTdStyle);
556
+ }
557
+ firstCell = table.rows[i].getElementsByTagName('td')[0];
558
+ if (firstCell) {
559
+ table.rows[i].insertBefore(td.getDOMElement(), firstCell);
560
+ } else {
561
+ table.rows[i].appendChild(td.getDOMElement());
562
+ }
563
+ array[i].push(0);
564
+ }
565
+
566
+ maxAmountOfCells++;
567
+ table.recalculateIndexes();
568
+ WPTB_Helper.dataTitleColumnSet( table );
569
+ undoSelect();
570
+ };
571
+
572
+ /*
573
+ * Well, not so simple as previous functions.
574
+ * It adds a column after a certain column of reference.
575
+ * @param integer the column number to be used as reference.
576
+ * If empty, then the first highlighted cell is used as reference.
577
+ */
578
+
579
+ table.addColumnAfter = function (c_pos) {
580
+ let rows = table.rows,
581
+ cellPointer,
582
+ cellsBuffer,
583
+ cell = document.querySelector('.wptb-highlighted'),
584
+ cellStyle = cell.getAttribute('style'),
585
+ pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];
586
+
587
+
588
+
589
+ if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {
590
+ table.addColumnEnd();
591
+ } else {
592
+ let pendingInsertion = false,
593
+ stepsToMove,
594
+ td, bro,
595
+ carriedRowspans = [],
596
+ currentCell;
597
+
598
+ for (var i = 0; i < maxAmountOfCells; i++) {
599
+ carriedRowspans.push(0);
600
+ }
601
+
602
+ for (var i = 0; i < rows.length; i++) {
603
+ cellPointer = 0;
604
+ cellsBuffer = rows[i].getElementsByTagName('td');
605
+ pendingInsertion = false;
606
+ for (var xPosition = 0;
607
+ xPosition < maxAmountOfCells;
608
+ xPosition += stepsToMove) {
609
+ stepsToMove = 1;
610
+
611
+ if (pendingInsertion) {
612
+ td = new WPTB_Cell(mark);
613
+ if (cellStyle) {
614
+ td.getDOMElement().setAttribute('style', cellStyle);
615
+ }
616
+ if (currentCell && rows[i].contains(currentCell)) {
617
+ bro = currentCell.nextSibling;
618
+ if (bro) {
619
+ rows[i].insertBefore(td.getDOMElement(), bro);
620
+ } else {
621
+ rows[i].appendChild(td.getDOMElement());
622
+ }
623
+ } else {
624
+ rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);
625
+ }
626
+ break;
627
+ } else if (carriedRowspans[xPosition] > 0) {
628
+ // If no pending insertion, let's check if no rowspan from upper cells is pending in current position
629
+ if (pos == xPosition) {
630
+ pendingInsertion = true;
631
+ }
632
+ } else {
633
+ currentCell = cellsBuffer[cellPointer++];
634
+ if (currentCell.rowSpan > 1) {
635
+ stepsToMove = currentCell.colSpan;
636
+ for (var k = 0; k < currentCell.colSpan; k++) {
637
+ carriedRowspans[xPosition + k] = currentCell.rowSpan;
638
+ if (xPosition + k == pos) {
639
+ pendingInsertion = true;
640
+ }
641
+ }
642
+ } else if (currentCell.colSpan > 1) {
643
+ stepsToMove = currentCell.colSpan;
644
+ for (var k = 0; k < currentCell.colSpan; k++) {
645
+ if (xPosition + k == pos) {
646
+ pendingInsertion = true;
647
+ }
648
+ }
649
+ } else if (xPosition == pos) {
650
+ pendingInsertion = true;
651
+ }
652
+ }
653
+ }
654
+
655
+ for (var l = 0; l < maxAmountOfCells; l++) {
656
+ if (carriedRowspans[l] > 0)
657
+ carriedRowspans[l]--;
658
+ }
659
+
660
+ }
661
+
662
+ for (var i = 0; i < array.length; i++) {
663
+ array[i].push(0);
664
+ }
665
+ maxAmountOfCells++;
666
+ drawTable(array);
667
+ table.recalculateIndexes();
668
+ WPTB_Helper.dataTitleColumnSet( table );
669
+ undoSelect();
670
+ }
671
+ };
672
+
673
+ /*
674
+ * For preventing us to take a lot of time,
675
+ * This is just calling the function addColumnAfter, but
676
+ * using the previous column to current one as reference.
677
+ * @see addColumnAfter
678
+ */
679
+
680
+ table.addColumnBefore = function () {
681
+ var cell = document.querySelector('.wptb-highlighted'),
682
+ pos = getCoords(cell)[1];
683
+
684
+ if (pos === 0) {
685
+ table.addColumnStart();
686
+ } else {
687
+ table.addColumnAfter(pos - 1);
688
+ }
689
+ };
690
+
691
+ /*
692
+ * Luckily, thisfunction is simple,
693
+ * it just add a row to the end of table.
694
+ */
695
+
696
+ table.addRowToTheEnd = function () {
697
+ let r = table.insertRow(-1),
698
+ td,
699
+ aux,
700
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
701
+ currentTableTd,
702
+ currentTdStyle;
703
+ r.classList.add( 'wptb-row' );
704
+ if (currentTable.length > 0) {
705
+ currentTableTd = currentTable[0].querySelector('td');
706
+ }
707
+
708
+ if (currentTableTd) {
709
+ currentTdStyle = currentTableTd.getAttribute('style');
710
+ }
711
+
712
+ for (var i = 0; i < maxAmountOfCells; i++) {
713
+ td = new WPTB_Cell(mark);
714
+ if (currentTdStyle) {
715
+ td.getDOMElement().setAttribute('style', currentTdStyle);
716
+ }
717
+ r.appendChild(td.getDOMElement());
718
+ }
719
+ aux = Array.from(array[0]);
720
+ array.push(aux);
721
+ drawTable(array);
722
+ table.recalculateIndexes();
723
+ WPTB_Helper.dataTitleColumnSet( table );
724
+ undoSelect();
725
+ };
726
+
727
+ /*
728
+ * Yet another simple function,
729
+ * it just add a row to the start of table.
730
+ */
731
+
732
+ table.addRowToTheStart = function () {
733
+ let r = table.insertRow(0),
734
+ td,
735
+ aux,
736
+ currentTable = document.getElementsByClassName('wptb-preview-table'),
737
+ currentTableTd,
738
+ currentTdStyle;
739
+ r.classList.add( 'wptb-row' );
740
+ if (currentTable.length > 0) {
741
+ currentTableTd = currentTable[0].querySelector('td');
742
+ }
743
+
744
+ if (currentTableTd) {
745
+ currentTdStyle = currentTableTd.getAttribute('style');
746
+ }
747
+
748
+ for (var i = 0; i < maxAmountOfCells; i++) {
749
+ td = new WPTB_Cell(mark);
750
+ if (currentTdStyle) {
751
+ td.getDOMElement().setAttribute('style', currentTdStyle);
752
+ }
753
+ r.appendChild(td.getDOMElement());
754
+ }
755
+ aux = Array.from(array[0]);
756
+ array.push(aux);
757
+ drawTable(array);
758
+ table.recalculateIndexes();
759
+ WPTB_Helper.dataTitleColumnSet( table );
760
+ undoSelect();
761
+ };
762
+
763
+ /*
764
+ * This function adds a row before the current one.
765
+ * Since the biggest factor of problem is a not-started but ongoing rowspan,
766
+ * the most of the troubles is not here.
767
+ */
768
+
769
+ table.addRowBefore = function () {
770
+ let cell = document.querySelector('.wptb-highlighted'),
771
+ cellStyle = cell.getAttribute('style'),
772
+ row = getCoords(cell)[0],
773
+ cellNew;
774
+ for( let i = row - 1; i >= 0; i-- ) {
775
+ let rowChildren = table.rows[i].children;
776
+ let rowChildrenLength = rowChildren.length;
777
+ if( rowChildrenLength > 0 ) {
778
+ for( let j = 0; j < rowChildrenLength; j++ ) {
779
+ if( rowChildren[j].rowSpan == 1 ) {
780
+ row = i;
781
+ cellNew = true;
782
+ break;
783
+ }
784
+ }
785
+ }
786
+ if ( cellNew ) {
787
+ break;
788
+ }
789
+ }
790
+
791
+ if (row === 0) {
792
+ table.addRowToTheStart();
793
+ } else {
794
+ table.addRowAfter( row, cellStyle );
795
+ }
796
+ };
797
+
798
+ /*
799
+ * Well... by the name convention of the previous 3 functions,
800
+ * it's pretty obvious that this functions attaches a new
801
+ * row after highlighted cell row. The greatest obstacle it was
802
+ * the possibility of a TR not having the exact amount of columns
803
+ * occuped by actual node but rowspanned upper cells. For that purpose
804
+ * it was created the function realTimeArray.
805
+ * @see realTimeArray
806
+ */
807
+
808
+ table.addRowAfter = function ( row, cellStyle ) {
809
+ let cellRowSpan,
810
+ rowAfter,
811
+ aux;
812
+
813
+ if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {
814
+ let cell = document.querySelector('.wptb-highlighted');
815
+ cellStyle = cell.getAttribute('style'),
816
+ row = getCoords(cell)[0],
817
+ cellRowSpan = cell.rowSpan,
818
+ rowAfter = row + cellRowSpan - 1;
819
+ } else {
820
+ rowAfter = row;
821
+ }
822
+
823
+
824
+ let cellsColSpan = 0;
825
+ if ( rowAfter < table.rows.length -1 ) {
826
+ for( let i = 0; i <= rowAfter ; i++ ) {
827
+ let tableRowsIChildren = table.rows[i].children,
828
+ tableRIChildrenLength = tableRowsIChildren.length;
829
+ if( tableRIChildrenLength > 0 ) {
830
+ for( let j = 0; j < tableRIChildrenLength; j++ ) {
831
+ let rowIRowSpan = tableRowsIChildren[j].rowSpan;
832
+
833
+ if ( rowIRowSpan - 1 + i > rowAfter ) {
834
+ tableRowsIChildren[j].rowSpan++;
835
+ }
836
+ }
837
+ }
838
+ }
839
+
840
+ let rNext = table.rows[rowAfter + 1],
841
+ rNextChildren = rNext.children,
842
+ rNextChildrenLength = rNextChildren.length;
843
+
844
+ if( rNextChildrenLength > 0 ) {
845
+ for ( let i = 0; i < rNextChildrenLength; i++ ) {
846
+ cellsColSpan += rNextChildren[i].colSpan;
847
+ }
848
+ }
849
+ } else {
850
+ cellsColSpan = array[0].length;
851
+ }
852
+
853
+ let r = table.insertRow( rowAfter + 1 );
854
+ r.classList.add( 'wptb-row' );
855
+
856
+ for ( j = 0; j < cellsColSpan; j++ ) {
857
+ let td = new WPTB_Cell( mark );
858
+ td.getDOMElement().setAttribute( 'style', cellStyle );
859
+ r.appendChild( td.getDOMElement() );
860
+ }
861
+
862
+ aux = Array.from(array[0]);
863
+ array.push(aux);
864
+ drawTable(array);
865
+ table.recalculateIndexes();
866
+ WPTB_Helper.dataTitleColumnSet( table );
867
+ undoSelect();
868
+ };
869
+
870
+ /*
871
+ * This function checks the current selected cells
872
+ * make a rectangular shape.
873
+ * @param Array the abstract table.
874
+ * @return false, if not making a rectangle, or
875
+ * Array an array containing number of rows and columns, if selection makes a rectangle.
876
+ */
877
+
878
+ table.isSquare = function (a) {
879
+ var rowStart = -1,
880
+ columnStart = -1,
881
+ rowEnd = -1,
882
+ columnEnd = -1,
883
+ height,
884
+ width,
885
+ itemsEstimate = 0,
886
+ items = 0;
887
+
888
+ for (var i = 0; i < a.length; i++) {
889
+ for (var j = 0; j < a[i].length; j++) {
890
+ if (a[i][j] == 1) {
891
+ if ( j < columnStart || columnStart == -1 ) {
892
+ columnStart = j;
893
+ }
894
+ if ( i < rowStart || rowStart == -1 ) {
895
+ rowStart = i;
896
+ }
897
+ }
898
+ }
899
+
900
+ }
901
+
902
+ for (var i = a.length - 1; i > -1; i--) {
903
+ for (var j = a[i].length - 1; j > -1; j--) {
904
+ if (a[i][j] == 1) {
905
+ if ( j > columnEnd ) {
906
+ columnEnd = j;
907
+ }
908
+ if ( i > rowEnd ) {
909
+ rowEnd = i;
910
+ }
911
+ }
912
+ }
913
+ }
914
+
915
+ for (var i = rowStart; i < rowEnd; i++) {
916
+ for (var j = columnStart; j < columnEnd; j++) {
917
+ if (a[i][j] == 0 || a[i][j] == undefined) {
918
+ return false;
919
+ }
920
+ }
921
+ }
922
+
923
+ for (var i = 0; i < a.length; i++) {
924
+ for (var j = 0; j < a[i].length; j++) {
925
+ if (a[i][j] == 1) {
926
+ items++;
927
+ }
928
+ }
929
+ }
930
+
931
+ height = rowEnd - rowStart + 1;
932
+ width = columnEnd - columnStart + 1;
933
+ itemsEstimate = height * width;
934
+
935
+ if (itemsEstimate !== items) {
936
+ return false;
937
+ }
938
+ return [height, width];
939
+ };
940
+
941
+ /*
942
+ * This function merges all selected cells.
943
+ * Well, actually sets the colspan and rowspan of first
944
+ * upper left cell in selection and deletes the another selected cells.
945
+ */
946
+
947
+ table.mergeCells = function () {
948
+ var dimensions = table.isSquare(array),
949
+ rowspan = dimensions[0],
950
+ colspan = dimensions[1],
951
+ first = document.querySelector('.wptb-highlighted'),
952
+ tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),
953
+ tdsChildrenNew = [];
954
+
955
+ for (let i = 0; i < tds.length; i++) {
956
+ let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');
957
+ if (tdsInternalElements.length > 0) {
958
+ let tdsIntElemLength = tdsInternalElements.length;
959
+ for (let j = 0; j < tdsIntElemLength; j++) {
960
+ tdsChildrenNew.push(tdsInternalElements[j]);
961
+ }
962
+ }
963
+ let p = tds[i].parentNode;
964
+ p.removeChild(tds[i]);
965
+ }
966
+ if (tdsChildrenNew.length > 0) {
967
+ for (let i = 0; i < tdsChildrenNew.length; i++) {
968
+ first.appendChild(tdsChildrenNew[i]);
969
+ }
970
+ }
971
+
972
+ first.colSpan = colspan;
973
+ first.rowSpan = rowspan;
974
+ table.recalculateIndexes();
975
+ WPTB_Helper.dataTitleColumnSet( table );
976
+ undoSelect();
977
+ };
978
+
979
+ /*
980
+ * This functions makes the exact inverse as above.
981
+ * It resets colspan and rowspan and appends
982
+ * the same amount in cells to the table.
983
+ * @bug
984
+ */
985
+
986
+ table.splitCell = function () {
987
+ var cell = document.getElementsByClassName('wptb-highlighted')[0],
988
+ rowspan = cell.rowSpan,
989
+ colspan = cell.colSpan,
990
+ cellStyles = cell.getAttribute('style'),
991
+ row = getCoords(cell)[0],
992
+ thisRow = table.rows[row],
993
+ cellXIndex =cell.dataset.xIndex;
994
+
995
+ cell.rowSpan = 1;
996
+ cell.colSpan = 1;
997
+
998
+ for (let i = 1; i < colspan; i++) {
999
+ let td = new WPTB_Cell(mark);
1000
+ td.getDOMElement().setAttribute('style', cellStyles);
1001
+ if ( cell.nextSibling ) {
1002
+ thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );
1003
+ } else {
1004
+ thisRow.appendChild( td.getDOMElement() );
1005
+ }
1006
+
1007
+ }
1008
+
1009
+ if (rowspan > 1) {
1010
+ for (let i = 1; i < rowspan; i++) {
1011
+ let rowChildInsertBefore = undefined,
1012
+ rowNext = table.rows[row + i],
1013
+ rowChildren = rowNext.children,
1014
+ rowChildrenLength = rowChildren.length;
1015
+
1016
+ if ( rowChildrenLength > 0 ) {
1017
+ for ( let k = 0; k < rowChildrenLength; k++ ) {
1018
+ if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {
1019
+ rowChildInsertBefore = rowChildren[k];
1020
+ break;
1021
+ }
1022
+ }
1023
+ }
1024
+ for ( let j = 0; j < colspan; j++ ) {
1025
+ let td = new WPTB_Cell( mark );
1026
+ td.getDOMElement().setAttribute( 'style', cellStyles );
1027
+ if ( rowChildInsertBefore != undefined ) {
1028
+ rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );
1029
+ } else {
1030
+ rowNext.appendChild( td.getDOMElement() );
1031
+ }
1032
+ }
1033
+ }
1034
+ }
1035
+
1036
+ table.recalculateIndexes();
1037
+ WPTB_Helper.dataTitleColumnSet( table );
1038
+ undoSelect();
1039
+ };
1040
+
1041
+ /*
1042
+ * Searches for rowspanned cells up to row number meeting it.
1043
+ * @param number the number of row where the function
1044
+ * must search up to.
1045
+ */
1046
+
1047
+ table.findRowspannedCells = function (row) {
1048
+ var array = [],
1049
+ difference;
1050
+ actualPoints = getActualPointsInRow(row);
1051
+ if (actualPoints === maxAmountOfCells) {
1052
+ return [];
1053
+ }
1054
+ difference = maxAmountOfCells - actualPoints;
1055
+
1056
+ for (var i = row - 1; i >= 0 && difference; i--) {
1057
+ var tds = table.rows[i].getElementsByTagName('td');
1058
+ for (var i = 0; i < tds.length; i++) {
1059
+ if (tds[i].rowSpan > 1) {
1060
+ array.push(tds[i]);
1061
+ difference -= tds[i].colSpan;
1062
+ }
1063
+ }
1064
+ }
1065
+ return array;
1066
+
1067
+ }
1068
+
1069
+ /*
1070
+ * This function explores the table and adds
1071
+ * a cell for each lacking one for each row
1072
+ * to meet an even amount of cells.
1073
+ */
1074
+
1075
+ table.addLackingCells = function () {
1076
+ var sumRows = [];
1077
+ for (var i = 0; i < table.rows.length; i++) {
1078
+ sumRows.push(0);
1079
+ }
1080
+
1081
+ for (var i = 0; i < table.rows.length; i++) {
1082
+ var tds = table.rows[i].getElementsByTagName('td');
1083
+ for (var j = 0; j < tds.length; j++) {
1084
+ if (tds[j].rowSpan > 1) {
1085
+ for (var k = 1; k < tds[j].rowSpan; k++) {
1086
+ sumRows[i + k]++;
1087
+ }
1088
+ }
1089
+ }
1090
+ }
1091
+
1092
+ for (var i = 0; i < table.rows.length; i++) {
1093
+ var tds = table.rows[i].getElementsByTagName('td'),
1094
+ totalColspan = 0;
1095
+ for (var j = 0; j < tds.length; j++) {
1096
+ totalColspan += tds[j].colSpan;
1097
+ }
1098
+ totalColspan += sumRows[i];
1099
+ difference = maxAmountOfCells - totalColspan;
1100
+ for (var j = 0; j < difference; j++) {
1101
+ var td = new WPTB_Cell(mark);
1102
+ table.rows[i].appendChild(td.getDOMElement());
1103
+ //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );
1104
+ }
1105
+ }
1106
+ };
1107
+
1108
+ /*
1109
+ * This function deletes the row of currently
1110
+ * selected cell.
1111
+ */
1112
+
1113
+ table.deleteRow = function () {
1114
+ let cell = document.querySelector('.wptb-highlighted'),
1115
+ cellStyles = cell.getAttribute('style'),
1116
+ rowspan = cell.rowSpan,
1117
+ row = getCoords(cell)[0],
1118
+ thisRow,
1119
+ aux;
1120
+
1121
+ if ( rowspan == undefined ) rowspan = 1;
1122
+
1123
+ for ( let i = 0; i < rowspan; i++ ) {
1124
+ thisRow = table.rows[row];
1125
+ let thisRowChildren = thisRow.children,
1126
+ nextRow = table.rows[row + 1],
1127
+ nextRowChildren,
1128
+ nextRowChildrenLength,
1129
+ tdArr = [];
1130
+
1131
+ if( nextRow != undefined ) {
1132
+ nextRowChildren = nextRow.children;
1133
+ nextRowChildrenLength = nextRowChildren.length;
1134
+ for (let j = 0; j < thisRowChildren.length; j++) {
1135
+ if ( thisRowChildren[j].rowSpan > 1 ) {
1136
+ let td = new WPTB_Cell(mark);
1137
+ td.getDOMElement().setAttribute('style', cellStyles);
1138
+ td.getDOMElement().colSpan = thisRowChildren[j].colSpan;
1139
+ td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;
1140
+
1141
+ let nextRowChildrenK = undefined;
1142
+ for ( let k = 0; k < nextRowChildrenLength; k++ ) {
1143
+ if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {
1144
+ nextRowChildrenK = nextRowChildren[k];
1145
+ break;
1146
+ }
1147
+ }
1148
+
1149
+ if ( nextRowChildrenK ) {
1150
+ tdArr.push( [td, nextRowChildrenK] );
1151
+ } else {
1152
+ tdArr.push( [td] );
1153
+ }
1154
+ }
1155
+ }
1156
+
1157
+ if ( tdArr.length > 0 ) {
1158
+ for ( let k = 0; k < tdArr.length; k++ ) {
1159
+ if ( tdArr[k][1] != undefined ) {
1160
+ nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );
1161
+ } else {
1162
+ nextRow.appendChild( tdArr[k][0].getDOMElement() );
1163
+ }
1164
+ }
1165
+ }
1166
+ }
1167
+
1168
+ let tableRows = table.rows;
1169
+ if ( tableRows.length > 0 ) {
1170
+ for ( let j = 0; j < row; j++ ) {
1171
+ let jRowChildren = tableRows[j].children;
1172
+ if ( jRowChildren.length > 0 ) {
1173
+ for ( let x = 0; x < jRowChildren.length; x++ ) {
1174
+ if ( jRowChildren[x].rowSpan - 1 >= row - j ) {
1175
+ jRowChildren[x].rowSpan--;
1176
+ }
1177
+ }
1178
+ }
1179
+ }
1180
+ }
1181
+ aux = Array.from(array[0]);
1182
+ array.pop(aux);
1183
+ drawTable(array);
1184
+ table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);
1185
+
1186
+ if( table.rows.length == 0 ) {
1187
+ table.toggleTableEditMode();
1188
+ wptbTableSetup.innerHTML = '';
1189
+ WPTB_Helper.settingsPanelClear();
1190
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
1191
+ }
1192
+
1193
+ table.recalculateIndexes();
1194
+ WPTB_Helper.dataTitleColumnSet( table );
1195
+ }
1196
+ undoSelect();
1197
+ }
1198
+
1199
+ /*
1200
+ * This function deletes the column of currently
1201
+ * selected cell. Again, this is way more complicated than
1202
+ * delete row case.
1203
+ */
1204
+
1205
+ table.deleteColumn = function () {
1206
+ let cell = document.querySelector('.wptb-highlighted'),
1207
+ cellXIndex = cell.dataset.xIndex,
1208
+ colspan = cell.colSpan;
1209
+
1210
+ for ( let i = 0; i < colspan; i++ ) {
1211
+ for ( let j = 0; j < table.rows.length; j++ ) {
1212
+ let rowChildren = table.rows[j].children;
1213
+ let rowChildrenLength = rowChildren.length;
1214
+ if( rowChildrenLength > 0 ) {
1215
+ for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {
1216
+ if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {
1217
+ if ( rowChildren[k].colSpan > 1 ) {
1218
+ rowChildren[k].colSpan--;
1219
+ } else {
1220
+ table.rows[j].removeChild( rowChildren[k] );
1221
+ }
1222
+ break;
1223
+ } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) &&
1224
+ Number( rowChildren[k].dataset.xIndex ) +
1225
+ Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {
1226
+ if ( rowChildren[k].colSpan > 1 ) {
1227
+ rowChildren[k].colSpan--;
1228
+ }
1229
+ break;
1230
+ }
1231
+ }
1232
+ }
1233
+ }
1234
+
1235
+ for ( let j = 0; j < table.rows.length; j++ ) {
1236
+ if (array[j] != undefined)
1237
+ array[j].pop();
1238
+ }
1239
+
1240
+ maxAmountOfCells--;
1241
+
1242
+ if( table.querySelectorAll( 'td' ).length == 0 ) {
1243
+ table.toggleTableEditMode();
1244
+ wptbTableSetup.innerHTML = '';
1245
+ WPTB_Helper.settingsPanelClear();
1246
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';
1247
+ }
1248
+
1249
+ table.recalculateIndexes();
1250
+ WPTB_Helper.dataTitleColumnSet( table );
1251
+ }
1252
+ undoSelect();
1253
+ };
1254
+
1255
+ document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';
1256
+
1257
+ array = fillTableArray();
1258
+
1259
+ undoSelect();
1260
+ drawTable(array);
1261
+
1262
+ wptbTableSetup.appendChild(table);
1263
+ //if (columns || rows) {
1264
+ table.recalculateIndexes( true );
1265
+ //}
1266
+
1267
+ WPTB_LeftPanel();
1268
+
1269
+ // this code gets the ID of the active element in the toolbar
1270
+ // and stores it in the data attribute of the common container element "wpcd_fixed_toolbar"
1271
+ // let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );
1272
+ // let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );
1273
+ // for ( let i = 0; i < wptbPhElement.length; i++ ) {
1274
+ // wptbPhElement[i].addEventListener( 'click', function( e ) {
1275
+ // let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;
1276
+ // for ( let j = 0; j < wptbToolbar.length; j++ ) {
1277
+ // let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );
1278
+ // if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {
1279
+ // wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );
1280
+ // }
1281
+ // }
1282
+ // }, false );
1283
+ // }
1284
+
1285
+ // let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );
1286
+ // if( wptbPanelLeft.length > 0 ) {
1287
+ // wptbPanelLeft[0].addEventListener( 'click', function( e ) {
1288
+ // let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;
1289
+ // document.getElementById( toolbarActiveElementId ).style.display = '';
1290
+ // }, false );
1291
+ // }
1292
+
1293
+ // let body = document.getElementsByTagName( 'body' );
1294
+ // if( body.length > 0 ) {
1295
+ // body[0].addEventListener( 'click', function( e ) {
1296
+ // if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {
1297
+ // let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;
1298
+ // document.getElementById( toolbarActiveElementId ).style.display = '';
1299
+ // }
1300
+ // }, false );
1301
+ // }
1302
+ };
inc/admin/js/core/WPTB_Text.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_Text = function ( text , DOMElementProt ) {
2
+ let DOMElement = document.createElement('div'),
3
+ elText2 = document.createElement('div'),
4
+ elP = document.createElement('p'),
5
+ kindIndexProt = undefined,
6
+ copy = false;
7
+
8
+ DOMElement.classList.add( 'wptb-text-container' );
9
+
10
+ elP.innerHTML = text != undefined ? text : 'Text';
11
+ elText2.appendChild(elP);
12
+ DOMElement.appendChild(elText2);
13
+ if ( DOMElementProt ) {
14
+ let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\d+)/i );
15
+ if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {
16
+ kindIndexProt = wptbElementMutch[1];
17
+ copy = true;
18
+ };
19
+
20
+ let attributes = [...DOMElementProt.attributes];
21
+ for( let i = 0; i < attributes.length; i++ ) {
22
+ DOMElement.setAttribute(attributes[i].name, attributes[i].value);
23
+ }
24
+ }
25
+
26
+ this.kind = 'text';
27
+ this.getDOMElement = function () {
28
+ return DOMElement;
29
+ };
30
+ applyGenericItemSettings( this, kindIndexProt, copy );
31
+
32
+ return this;
33
+ };
inc/admin/js/core/WPTB_innerElementSet.js ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var WPTB_innerElementSet = function ( element ) {
2
+
3
+ function newElementProxy(el) {
4
+ if (el == 'list') {
5
+ return new WPTB_List();
6
+ } else if (el == 'image') {
7
+ return new WPTB_Image();
8
+ } else if (el == 'text') {
9
+ return new WPTB_Text();
10
+ } else if (el == 'button') {
11
+ return new WPTB_Button();
12
+ }
13
+ }
14
+
15
+ element.ondragenter = function (e) {
16
+ var div;
17
+ if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {
18
+ return;
19
+ }
20
+ WPTB_DropHandle(this, e);
21
+
22
+ element.classList.add( 'wptb-ondragenter' );
23
+ }
24
+ element.ondragover = function (e) {
25
+ e.preventDefault();
26
+ WPTB_DropHandle(this, e);
27
+ }
28
+ element.ondragleave = function () {
29
+
30
+ }
31
+ element.ondrop = function(e) {
32
+ this.classList.remove( 'wptb-ondragenter' );
33
+ let element, classId;
34
+ e.preventDefault();
35
+ e.stopPropagation();
36
+
37
+ if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
38
+ return;
39
+ }
40
+ let wptbDropHandle,
41
+ wptbDropBorderMarker;
42
+ if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {
43
+ wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];
44
+ }
45
+ if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {
46
+ wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];
47
+ }
48
+
49
+ if ( e.dataTransfer.getData( 'wptbElement' ) ) {
50
+ element = newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );
51
+ element = element.getDOMElement();
52
+ } else {
53
+ classId = e.dataTransfer.getData( 'node' );
54
+ element = document.getElementsByClassName( classId )[0];
55
+ element.classList.remove( 'wptb-moving-mode' );
56
+ }
57
+
58
+ if( wptbDropHandle.style.display == 'block' ) {
59
+ let td;
60
+ if( wptbDropHandle.dataset.text == 'Drop Here' ) {
61
+ td = wptbDropHandle.getDOMParentElement();
62
+ td.appendChild( element );
63
+ } else {
64
+ let innerElement = wptbDropHandle.getDOMParentElement();
65
+ td = innerElement.parentNode;
66
+
67
+ if( wptbDropHandle.dataset.text == 'Abowe Element' ) {
68
+ td.insertBefore( element, innerElement );
69
+ } else if( wptbDropHandle.dataset.text == 'Below Element' ) {
70
+ let innerElementNext = innerElement.nextSibling;
71
+ td.insertBefore( element, innerElementNext );
72
+ }
73
+ }
74
+ let thisRow = td.parentNode
75
+ if( thisRow.classList.contains( 'wptb-table-head' ) ) {
76
+ let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );
77
+ WPTB_Helper.dataTitleColumnSet( table );
78
+ }
79
+
80
+ } else {
81
+ return;
82
+ }
83
+
84
+ wptbDropHandle.style.display = 'none';
85
+ wptbDropBorderMarker.style.display = 'none';
86
+
87
+ WPTB_innerElementSet( element );
88
+
89
+ return true;
90
+ }
91
+ element.onmouseover = function(e) {
92
+ element.classList.remove( 'wptb-ondragenter' );
93
+ }
94
+ }
inc/admin/js/core/applyGenericItemSettings.js ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {
2
+ var node = element.getDOMElement(),
3
+ index,
4
+ listItems,
5
+ copy;
6
+
7
+ if ( kindIndexProt == undefined || copy == true ) {
8
+ index = document.counter.nextIndex( element.kind );
9
+ let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );
10
+ let elementIndexesArr = [];
11
+ for( let i = 0; i < wptbElements.length; i++ ) {
12
+ var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\d+)', "i" );
13
+ let infArr = wptbElements[i].className.match( regex );
14
+ if( infArr ) {
15
+ elementIndexesArr.push( infArr[1] );
16
+ }
17
+ }
18
+ if( elementIndexesArr.length > 0 ) {
19
+ let elementIndexMax = Math.max( ...elementIndexesArr );
20
+ index = elementIndexMax + 1;
21
+ } else {
22
+ index = 1;
23
+ }
24
+ } else if ( kindIndexProt && ! copy ) {
25
+ index = kindIndexProt.split('-')[1];
26
+ }
27
+
28
+ node.onmouseenter = function (event) {
29
+ this.classList.add('wptb-directlyhovered');
30
+ let btnDelete = document.createElement( 'span' ),
31
+ btnCopy = document.createElement( 'span' ),
32
+ btnMove = document.createElement( 'span' ),
33
+ actions = document.createElement( 'span' ), i;
34
+
35
+ actions.classList.add('wptb-actions');
36
+ btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');
37
+ btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');
38
+ btnMove.classList.add("dashicons", "dashicons-move", 'wptb-move-action');
39
+ btnMove.draggable = true;
40
+ btnDelete.onclick = function (event) {
41
+ let act = this.parentNode.parentNode,
42
+ el = act.parentNode;
43
+ el.removeChild(act);
44
+
45
+ if( act.kind == 'text' ) {
46
+ let thisRow = el.parentNode
47
+ if( thisRow.classList.contains( 'wptb-table-head' ) ) {
48
+ let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );
49
+ WPTB_Helper.dataTitleColumnSet( table );
50
+ }
51
+ }
52
+
53
+ };
54
+ btnCopy.onclick = function (event) {
55
+ let copy;
56
+ if (element.kind == 'list') {
57
+ var td = event.target.parentNode.parentNode.parentNode,
58
+ temp = [],
59
+ srcList = event.target.parentNode.parentNode.querySelectorAll('ul li .wptb-list-item-content');
60
+
61
+ for (var i = 0; i < srcList.length; i++) {
62
+ temp.push(srcList[i].innerHTML);
63
+ }
64
+
65
+ copy = new WPTB_List( temp, node );
66
+
67
+ node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );
68
+ } else if (element.kind == 'text') {
69
+ var td = event.target.parentNode.parentNode.parentNode;
70
+ copy = new WPTB_Text(event.target.parentNode.parentNode.childNodes[0].innerHTML, node);
71
+
72
+ node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );
73
+ } else if ( element.kind == 'image' ) {
74
+ var td = event.target.parentNode.parentNode.parentNode;
75
+ copy = new WPTB_Image( event.target.parentNode.parentNode.children[0].children[0].src, node );
76
+
77
+ node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );
78
+ } else {
79
+ var td = event.target.parentNode.parentNode.parentNode,
80
+ text = event.target.parentNode.parentNode.childNodes[0].querySelector( 'p' ).innerHTML;
81
+ copy = new WPTB_Button( text, node );
82
+
83
+ node.parentNode.insertBefore( copy.getDOMElement(), node.nextSibling );
84
+ }
85
+
86
+ WPTB_innerElementSet( copy.getDOMElement() );
87
+ };
88
+ let parent = this,
89
+ infArr,
90
+ type;
91
+ infArr = parent.className.match(/wptb-element-(.+)-(\d+)/i);
92
+ type = infArr[1];
93
+ let dragImagesArr = WPTB_Helper.dragImagesArr();
94
+ btnMove.ondragstart = function (event) {
95
+ this.parentNode.style.opacity = 0;
96
+ parent.classList.remove( 'wptb-directlyhovered' );
97
+ parent.classList.add( 'wptb-moving-mode' );
98
+
99
+ event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );
100
+ event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );
101
+ event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );
102
+ event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );
103
+ let act = event.target.parentNode.parentNode;
104
+ if( act.kind == 'text' ) {
105
+ let thisRow = el.parentNode
106
+ if( thisRow.classList.contains( 'wptb-table-head' ) ) {
107
+ let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );
108
+ WPTB_Helper.dataTitleColumnSet( table );
109
+ }
110
+ }
111
+ };
112
+
113
+ if (element.kind === 'button') {
114
+ let a = node.querySelector( 'a' ),
115
+ target = a.querySelector( 'div' );
116
+ a.onclick = function( e ) {
117
+ e.preventDefault();
118
+ }
119
+ WPTB_Helper.buttonsTinyMceInit( target );
120
+ } else if (element.kind === 'text') {
121
+ tinyMCE.init({
122
+ target: node.childNodes[0],
123
+ inline: true,
124
+ plugins: "link, paste",
125
+ dialog_type: "modal",
126
+ theme: 'modern',
127
+ menubar: false,
128
+ fixed_toolbar_container: '#wpcd_fixed_toolbar',
129
+ paste_as_text: true,
130
+ toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
131
+ setup : function( ed ) {
132
+ ed.on( 'change', function(e) {
133
+ let row = WPTB_Helper.findAncestor( node, 'wptb-row' );
134
+ if( row.classList.contains( 'wptb-table-head' ) ) {
135
+ let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );
136
+ WPTB_Helper.dataTitleColumnSet( table );
137
+ }
138
+ });
139
+ },
140
+ init_instance_callback: function (editor) {
141
+ window.currentEditor = editor;
142
+ //editor.fire('focus');
143
+ editor.on('focus', function (e) {
144
+ var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;
145
+ if (window.currentEditor &&
146
+ document.getElementById('wptb_builder').scrollTop >= 55 &&
147
+ window.currentEditor.bodyElement.style.display != 'none') {
148
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';
149
+ document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';
150
+ document.getElementById('wpcd_fixed_toolbar').style.top = '100px';
151
+ } else {
152
+ document.getElementById('wpcd_fixed_toolbar').style.position = 'static';
153
+ delete document.getElementById('wpcd_fixed_toolbar').style.right;
154
+ delete document.getElementById('wpcd_fixed_toolbar').style.top;
155
+ }
156
+ });
157
+ }
158
+ });
159
+
160
+ } else {
161
+ listItems = node.getElementsByClassName( 'wptb-list-item-content' );
162
+ for ( let i = 0; i < listItems.length; i++ ) {
163
+ WPTB_Helper.listItemsTinyMceInit( listItems[i] );
164
+ }
165
+ }
166
+
167
+ actions.appendChild(btnMove);
168
+ actions.appendChild(btnCopy);
169
+ actions.appendChild(btnDelete);
170
+ this.appendChild( actions );
171
+ };
172
+
173
+ node.onmouseleave = function ( event ) {
174
+ this.classList.remove( 'wptb-directlyhovered' );
175
+ let iter = 0;
176
+ while( event.target.querySelector( '.wptb-actions' ) && iter < 5 ) {
177
+ event.target.querySelector( '.wptb-actions' ).remove();
178
+ iter++;
179
+ }
180
+ };
181
+
182
+ // Change data-title-column if the title was changed
183
+ if( element.kind == 'text' ) {
184
+ var observer = new MutationObserver( function( mutations ) {
185
+ let row = WPTB_Helper.findAncestor( node, 'wptb-row' );
186
+ if( row.classList.contains( 'wptb-table-head' ) ) {
187
+ let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );
188
+ WPTB_Helper.dataTitleColumnSet( table );
189
+ }
190
+ });
191
+ var config = { attributes: true, attributeFilter: ['style'] };
192
+ observer.observe( element.getDOMElement(), config );
193
+ }
194
+
195
+ let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
196
+ if ( node_wptb_element_kind_num ) {
197
+ node.classList.remove( node_wptb_element_kind_num[0] );
198
+ }
199
+ if ( ! node.classList.contains( 'wptb-ph-element' ) ) {
200
+ node.classList.add( 'wptb-ph-element' );
201
+ if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {
202
+ node.classList.add( 'wptb-element-' + element.kind + '-' + index );
203
+ }
204
+ } else {
205
+ if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {
206
+ node.classList.add( 'wptb-element-' + element.kind + '-' + index );
207
+ }
208
+ }
209
+ new WPTB_ElementOptions( element, index, kindIndexProt );
210
+
211
+ document.counter.increment(element.kind);
212
+ };
inc/admin/js/core/wptb-builder.js ADDED
File without changes
inc/admin/js/patchs.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ (function () {
2
+ document.onready = function () {
3
+ document.querySelector('.toplevel_page_wptb-overview .wp-submenu .wp-first-item a').href = ajaxurl.substring(0, 17) + '/edit.php?post_type=wptb-tables';
4
+ if (window.location.href.search('wptb-tables') !== -1) {
5
+ document.querySelector('.toplevel_page_wptb-overview .wp-submenu .wp-first-item a').classList.add('current');
6
+ }
7
+ };
8
+ })()
inc/admin/js/tinymce/jquery.tinymce.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){var f,c,u,p,d,s=[];d="undefined"!=typeof global?global:window,p=d.jQuery;var v=function(){return d.tinymce};p.fn.tinymce=function(o){var e,t,i,l=this,r="";if(!l.length)return l;if(!o)return v()?v().get(l[0].id):null;l.css("visibility","hidden");var n=function(){var a=[],c=0;u||(m(),u=!0),l.each(function(e,t){var n,i=t.id,r=o.oninit;i||(t.id=i=v().DOM.uniqueId()),v().get(i)||(n=v().createEditor(i,o),a.push(n),n.on("init",function(){var e,t=r;l.css("visibility",""),r&&++c==a.length&&("string"==typeof t&&(e=-1===t.indexOf(".")?null:v().resolve(t.replace(/\.\w+$/,"")),t=v().resolve(t)),t.apply(e||v(),a))}))}),p.each(a,function(e,t){t.render()})};if(d.tinymce||c||!(e=o.script_url))1===c?s.push(n):n();else{c=1,t=e.substring(0,e.lastIndexOf("/")),-1!=e.indexOf(".min")&&(r=".min"),d.tinymce=d.tinyMCEPreInit||{base:t,suffix:r},-1!=e.indexOf("gzip")&&(i=o.language||"en",e=e+(/\?/.test(e)?"&":"?")+"js=true&core=true&suffix="+escape(r)+"&themes="+escape(o.theme||"modern")+"&plugins="+escape(o.plugins||"")+"&languages="+(i||""),d.tinyMCE_GZ||(d.tinyMCE_GZ={start:function(){var n=function(e){v().ScriptLoader.markDone(v().baseURI.toAbsolute(e))};n("langs/"+i+".js"),n("themes/"+o.theme+"/theme"+r+".js"),n("themes/"+o.theme+"/langs/"+i+".js"),p.each(o.plugins.split(","),function(e,t){t&&(n("plugins/"+t+"/plugin"+r+".js"),n("plugins/"+t+"/langs/"+i+".js"))})},end:function(){}}));var a=document.createElement("script");a.type="text/javascript",a.onload=a.onreadystatechange=function(e){e=e||window.event,2===c||"load"!=e.type&&!/complete|loaded/.test(a.readyState)||(v().dom.Event.domLoaded=1,c=2,o.script_loaded&&o.script_loaded(),n(),p.each(s,function(e,t){t()}))},a.src=e,document.body.appendChild(a)}return l},p.extend(p.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in d&&(t=v().get(e.id))&&t.editorManager===v())}});var m=function(){var r=function(e){"remove"===e&&this.each(function(e,t){var n=l(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=v().get(t.id.replace(/_parent$/,""));n&&n.remove()})},o=function(i){var e,t=this;if(null!=i)r.call(t),t.each(function(e,t){var n;(n=v().get(t.id))&&n.setContent(i)});else if(0<t.length&&(e=v().get(t[0].id)))return e.getContent()},l=function(e){var t=null;return e&&e.id&&d.tinymce&&(t=v().get(e.id)),t},u=function(e){return!!(e&&e.length&&d.tinymce&&e.is(":tinymce"))},s={};p.each(["text","html","val"],function(e,t){var a=s[t]=p.fn[t],c="text"===t;p.fn[t]=function(e){var t=this;if(!u(t))return a.apply(t,arguments);if(e!==f)return o.call(t.filter(":tinymce"),e),a.apply(t.not(":tinymce"),arguments),t;var i="",r=arguments;return(c?t:t.eq(0)).each(function(e,t){var n=l(t);i+=n?c?n.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):n.getContent({save:!0}):a.apply(p(t),r)}),i}}),p.each(["append","prepend"],function(e,t){var n=s[t]=p.fn[t],r="prepend"===t;p.fn[t]=function(i){var e=this;return u(e)?i!==f?("string"==typeof i&&e.filter(":tinymce").each(function(e,t){var n=l(t);n&&n.setContent(r?i+n.getContent():n.getContent()+i)}),n.apply(e.not(":tinymce"),arguments),e):void 0:n.apply(e,arguments)}}),p.each(["remove","replaceWith","replaceAll","empty"],function(e,t){var n=s[t]=p.fn[t];p.fn[t]=function(){return r.call(this,t),n.apply(this,arguments)}}),s.attr=p.fn.attr,p.fn.attr=function(e,t){var n=this,i=arguments;if(!e||"value"!==e||!u(n))return s.attr.apply(n,i);if(t!==f)return o.call(n.filter(":tinymce"),t),s.attr.apply(n.not(":tinymce"),i),n;var r=n[0],a=l(r);return a?a.getContent({save:!0}):s.attr.apply(p(r),i)}}}();
inc/admin/js/tinymce/langs/readme.md ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ This is where language files should be placed.
2
+
3
+ Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/
inc/admin/js/tinymce/license.txt ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 2.1, February 1999
3
+
4
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ [This is the first released version of the Lesser GPL. It also counts
10
+ as the successor of the GNU Library Public License, version 2, hence
11
+ the version number 2.1.]
12
+
13
+ Preamble
14
+
15
+ The licenses for most software are designed to take away your
16
+ freedom to share and change it. By contrast, the GNU General Public
17
+ Licenses are intended to guarantee your freedom to share and change
18
+ free software--to make sure the software is free for all its users.
19
+
20
+ This license, the Lesser General Public License, applies to some
21
+ specially designated software packages--typically libraries--of the
22
+ Free Software Foundation and other authors who decide to use it. You
23
+ can use it too, but we suggest you first think carefully about whether
24
+ this license or the ordinary General Public License is the better
25
+ strategy to use in any particular case, based on the explanations below.
26
+
27
+ When we speak of free software, we are referring to freedom of use,
28
+ not price. Our General Public Licenses are designed to make sure that
29
+ you have the freedom to distribute copies of free software (and charge
30
+ for this service if you wish); that you receive source code or can get
31
+ it if you want it; that you can change the software and use pieces of
32
+ it in new free programs; and that you are informed that you can do
33
+ these things.
34
+
35
+ To protect your rights, we need to make restrictions that forbid
36
+ distributors to deny you these rights or to ask you to surrender these
37
+ rights. These restrictions translate to certain responsibilities for
38
+ you if you distribute copies of the library or if you modify it.
39
+
40
+ For example, if you distribute copies of the library, whether gratis
41
+ or for a fee, you must give the recipients all the rights that we gave
42
+ you. You must make sure that they, too, receive or can get the source
43
+ code. If you link other code with the library, you must provide
44
+ complete object files to the recipients, so that they can relink them
45
+ with the library after making changes to the library and recompiling
46
+ it. And you must show them these terms so they know their rights.
47
+
48
+ We protect your rights with a two-step method: (1) we copyright the
49
+ library, and (2) we offer you this license, which gives you legal
50
+ permission to copy, distribute and/or modify the library.
51
+
52
+ To protect each distributor, we want to make it very clear that
53
+ there is no warranty for the free library. Also, if the library is
54
+ modified by someone else and passed on, the recipients should know
55
+ that what they have is not the original version, so that the original
56
+ author's reputation will not be affected by problems that might be
57
+ introduced by others.
58
+
59
+ Finally, software patents pose a constant threat to the existence of
60
+ any free program. We wish to make sure that a company cannot
61
+ effectively restrict the users of a free program by obtaining a
62
+ restrictive license from a patent holder. Therefore, we insist that
63
+ any patent license obtained for a version of the library must be
64
+ consistent with the full freedom of use specified in this license.
65
+
66
+ Most GNU software, including some libraries, is covered by the
67
+ ordinary GNU General Public License. This license, the GNU Lesser
68
+ General Public License, applies to certain designated libraries, and
69
+ is quite different from the ordinary General Public License. We use
70
+ this license for certain libraries in order to permit linking those
71
+ libraries into non-free programs.
72
+
73
+ When a program is linked with a library, whether statically or using
74
+ a shared library, the combination of the two is legally speaking a
75
+ combined work, a derivative of the original library. The ordinary
76
+ General Public License therefore permits such linking only if the
77
+ entire combination fits its criteria of freedom. The Lesser General
78
+ Public License permits more lax criteria for linking other code with
79
+ the library.
80
+
81
+ We call this license the "Lesser" General Public License because it
82
+ does Less to protect the user's freedom than the ordinary General
83
+ Public License. It also provides other free software developers Less
84
+ of an advantage over competing non-free programs. These disadvantages
85
+ are the reason we use the ordinary General Public License for many
86
+ libraries. However, the Lesser license provides advantages in certain
87
+ special circumstances.
88
+
89
+ For example, on rare occasions, there may be a special need to
90
+ encourage the widest possible use of a certain library, so that it becomes
91
+ a de-facto standard. To achieve this, non-free programs must be
92
+ allowed to use the library. A more frequent case is that a free
93
+ library does the same job as widely used non-free libraries. In this
94
+ case, there is little to gain by limiting the free library to free
95
+ software only, so we use the Lesser General Public License.
96
+
97
+ In other cases, permission to use a particular library in non-free
98
+ programs enables a greater number of people to use a large body of
99
+ free software. For example, permission to use the GNU C Library in
100
+ non-free programs enables many more people to use the whole GNU
101
+ operating system, as well as its variant, the GNU/Linux operating
102
+ system.
103
+
104
+ Although the Lesser General Public License is Less protective of the
105
+ users' freedom, it does ensure that the user of a program that is
106
+ linked with the Library has the freedom and the wherewithal to run
107
+ that program using a modified version of the Library.
108
+
109
+ The precise terms and conditions for copying, distribution and
110
+ modification follow. Pay close attention to the difference between a
111
+ "work based on the library" and a "work that uses the library". The
112
+ former contains code derived from the library, whereas the latter must
113
+ be combined with the library in order to run.
114
+
115
+ GNU LESSER GENERAL PUBLIC LICENSE
116
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
+
118
+ 0. This License Agreement applies to any software library or other
119
+ program which contains a notice placed by the copyright holder or
120
+ other authorized party saying it may be distributed under the terms of
121
+ this Lesser General Public License (also called "this License").
122
+ Each licensee is addressed as "you".
123
+
124
+ A "library" means a collection of software functions and/or data
125
+ prepared so as to be conveniently linked with application programs
126
+ (which use some of those functions and data) to form executables.
127
+
128
+ The "Library", below, refers to any such software library or work
129
+ which has been distributed under these terms. A "work based on the
130
+ Library" means either the Library or any derivative work under
131
+ copyright law: that is to say, a work containing the Library or a
132
+ portion of it, either verbatim or with modifications and/or translated
133
+ straightforwardly into another language. (Hereinafter, translation is
134
+ included without limitation in the term "modification".)
135
+
136
+ "Source code" for a work means the preferred form of the work for
137
+ making modifications to it. For a library, complete source code means
138
+ all the source code for all modules it contains, plus any associated
139
+ interface definition files, plus the scripts used to control compilation
140
+ and installation of the library.
141
+
142
+ Activities other than copying, distribution and modification are not
143
+ covered by this License; they are outside its scope. The act of
144
+ running a program using the Library is not restricted, and output from
145
+ such a program is covered only if its contents constitute a work based
146
+ on the Library (independent of the use of the Library in a tool for
147
+ writing it). Whether that is true depends on what the Library does
148
+ and what the program that uses the Library does.
149
+
150
+ 1. You may copy and distribute verbatim copies of the Library's
151
+ complete source code as you receive it, in any medium, provided that
152
+ you conspicuously and appropriately publish on each copy an
153
+ appropriate copyright notice and disclaimer of warranty; keep intact
154
+ all the notices that refer to this License and to the absence of any
155
+ warranty; and distribute a copy of this License along with the
156
+ Library.
157
+
158
+ You may charge a fee for the physical act of transferring a copy,
159
+ and you may at your option offer warranty protection in exchange for a
160
+ fee.
161
+
162
+ 2. You may modify your copy or copies of the Library or any portion
163
+ of it, thus forming a work based on the Library, and copy and
164
+ distribute such modifications or work under the terms of Section 1
165
+ above, provided that you also meet all of these conditions:
166
+
167
+ a) The modified work must itself be a software library.
168
+
169
+ b) You must cause the files modified to carry prominent notices
170
+ stating that you changed the files and the date of any change.
171
+
172
+ c) You must cause the whole of the work to be licensed at no
173
+ charge to all third parties under the terms of this License.
174
+
175
+ d) If a facility in the modified Library refers to a function or a
176
+ table of data to be supplied by an application program that uses
177
+ the facility, other than as an argument passed when the facility
178
+ is invoked, then you must make a good faith effort to ensure that,
179
+ in the event an application does not supply such function or
180
+ table, the facility still operates, and performs whatever part of
181
+ its purpose remains meaningful.
182
+
183
+ (For example, a function in a library to compute square roots has
184
+ a purpose that is entirely well-defined independent of the
185
+ application. Therefore, Subsection 2d requires that any
186
+ application-supplied function or table used by this function must
187
+ be optional: if the application does not supply it, the square
188
+ root function must still compute square roots.)
189
+
190
+ These requirements apply to the modified work as a whole. If
191
+ identifiable sections of that work are not derived from the Library,
192
+ and can be reasonably considered independent and separate works in
193
+ themselves, then this License, and its terms, do not apply to those
194
+ sections when you distribute them as separate works. But when you
195
+ distribute the same sections as part of a whole which is a work based
196
+ on the Library, the distribution of the whole must be on the terms of
197
+ this License, whose permissions for other licensees extend to the
198
+ entire whole, and thus to each and every part regardless of who wrote
199
+ it.
200
+
201
+ Thus, it is not the intent of this section to claim rights or contest
202
+ your rights to work written entirely by you; rather, the intent is to
203
+ exercise the right to control the distribution of derivative or
204
+ collective works based on the Library.
205
+
206
+ In addition, mere aggregation of another work not based on the Library
207
+ with the Library (or with a work based on the Library) on a volume of
208
+ a storage or distribution medium does not bring the other work under
209
+ the scope of this License.
210
+
211
+ 3. You may opt to apply the terms of the ordinary GNU General Public
212
+ License instead of this License to a given copy of the Library. To do
213
+ this, you must alter all the notices that refer to this License, so
214
+ that they refer to the ordinary GNU General Public License, version 2,
215
+ instead of to this License. (If a newer version than version 2 of the
216
+ ordinary GNU General Public License has appeared, then you can specify
217
+ that version instead if you wish.) Do not make any other change in
218
+ these notices.
219
+
220
+ Once this change is made in a given copy, it is irreversible for
221
+ that copy, so the ordinary GNU General Public License applies to all
222
+ subsequent copies and derivative works made from that copy.
223
+
224
+ This option is useful when you wish to copy part of the code of
225
+ the Library into a program that is not a library.
226
+
227
+ 4. You may copy and distribute the Library (or a portion or
228
+ derivative of it, under Section 2) in object code or executable form
229
+ under the terms of Sections 1 and 2 above provided that you accompany
230
+ it with the complete corresponding machine-readable source code, which
231
+ must be distributed under the terms of Sections 1 and 2 above on a
232
+ medium customarily used for software interchange.
233
+
234
+ If distribution of object code is made by offering access to copy
235
+ from a designated place, then offering equivalent access to copy the
236
+ source code from the same place satisfies the requirement to
237
+ distribute the source code, even though third parties are not
238
+ compelled to copy the source along with the object code.
239
+
240
+ 5. A program that contains no derivative of any portion of the
241
+ Library, but is designed to work with the Library by being compiled or
242
+ linked with it, is called a "work that uses the Library". Such a
243
+ work, in isolation, is not a derivative work of the Library, and
244
+ therefore falls outside the scope of this License.
245
+
246
+ However, linking a "work that uses the Library" with the Library
247
+ creates an executable that is a derivative of the Library (because it
248
+ contains portions of the Library), rather than a "work that uses the
249
+ library". The executable is therefore covered by this License.
250
+ Section 6 states terms for distribution of such executables.
251
+
252
+ When a "work that uses the Library" uses material from a header file
253
+ that is part of the Library, the object code for the work may be a
254
+ derivative work of the Library even though the source code is not.
255
+ Whether this is true is especially significant if the work can be
256
+ linked without the Library, or if the work is itself a library. The
257
+ threshold for this to be true is not precisely defined by law.
258
+
259
+ If such an object file uses only numerical parameters, data
260
+ structure layouts and accessors, and small macros and small inline
261
+ functions (ten lines or less in length), then the use of the object
262
+ file is unrestricted, regardless of whether it is legally a derivative
263
+ work. (Executables containing this object code plus portions of the
264
+ Library will still fall under Section 6.)
265
+
266
+ Otherwise, if the work is a derivative of the Library, you may
267
+ distribute the object code for the work under the terms of Section 6.
268
+ Any executables containing that work also fall under Section 6,
269
+ whether or not they are linked directly with the Library itself.
270
+
271
+ 6. As an exception to the Sections above, you may also combine or
272
+ link a "work that uses the Library" with the Library to produce a
273
+ work containing portions of the Library, and distribute that work
274
+ under terms of your choice, provided that the terms permit
275
+ modification of the work for the customer's own use and reverse
276
+ engineering for debugging such modifications.
277
+
278
+ You must give prominent notice with each copy of the work that the
279
+ Library is used in it and that the Library and its use are covered by
280
+ this License. You must supply a copy of this License. If the work
281
+ during execution displays copyright notices, you must include the
282
+ copyright notice for the Library among them, as well as a reference
283
+ directing the user to the copy of this License. Also, you must do one
284
+ of these things:
285
+
286
+ a) Accompany the work with the complete corresponding
287
+ machine-readable source code for the Library including whatever
288
+ changes were used in the work (which must be distributed under
289
+ Sections 1 and 2 above); and, if the work is an executable linked
290
+ with the Library, with the complete machine-readable "work that
291
+ uses the Library", as object code and/or source code, so that the
292
+ user can modify the Library and then relink to produce a modified
293
+ executable containing the modified Library. (It is understood
294
+ that the user who changes the contents of definitions files in the
295
+ Library will not necessarily be able to recompile the application
296
+ to use the modified definitions.)
297
+
298
+ b) Use a suitable shared library mechanism for linking with the
299
+ Library. A suitable mechanism is one that (1) uses at run time a
300
+ copy of the library already present on the user's computer system,
301
+ rather than copying library functions into the executable, and (2)
302
+ will operate properly with a modified version of the library, if
303
+ the user installs one, as long as the modified version is
304
+ interface-compatible with the version that the work was made with.
305
+
306
+ c) Accompany the work with a written offer, valid for at
307
+ least three years, to give the same user the materials
308
+ specified in Subsection 6a, above, for a charge no more
309
+ than the cost of performing this distribution.
310
+
311
+ d) If distribution of the work is made by offering access to copy
312
+ from a designated place, offer equivalent access to copy the above
313
+ specified materials from the same place.
314
+
315
+ e) Verify that the user has already received a copy of these
316
+ materials or that you have already sent this user a copy.
317
+
318
+ For an executable, the required form of the "work that uses the
319
+ Library" must include any data and utility programs needed for
320
+ reproducing the executable from it. However, as a special exception,
321
+ the materials to be distributed need not include anything that is
322
+ normally distributed (in either source or binary form) with the major
323
+ components (compiler, kernel, and so on) of the operating system on
324
+ which the executable runs, unless that component itself accompanies
325
+ the executable.
326
+
327
+ It may happen that this requirement contradicts the license
328
+ restrictions of other proprietary libraries that do not normally
329
+ accompany the operating system. Such a contradiction means you cannot
330
+ use both them and the Library together in an executable that you
331
+ distribute.
332
+
333
+ 7. You may place library facilities that are a work based on the
334
+ Library side-by-side in a single library together with other library
335
+ facilities not covered by this License, and distribute such a combined
336
+ library, provided that the separate distribution of the work based on
337
+ the Library and of the other library facilities is otherwise
338
+ permitted, and provided that you do these two things:
339
+
340
+ a) Accompany the combined library with a copy of the same work
341
+ based on the Library, uncombined with any other library
342
+ facilities. This must be distributed under the terms of the
343
+ Sections above.
344
+
345
+ b) Give prominent notice with the combined library of the fact
346
+ that part of it is a work based on the Library, and explaining
347
+ where to find the accompanying uncombined form of the same work.
348
+
349
+ 8. You may not copy, modify, sublicense, link with, or distribute
350
+ the Library except as expressly provided under this License. Any
351
+ attempt otherwise to copy, modify, sublicense, link with, or
352
+ distribute the Library is void, and will automatically terminate your
353
+ rights under this License. However, parties who have received copies,
354
+ or rights, from you under this License will not have their licenses
355
+ terminated so long as such parties remain in full compliance.
356
+
357
+ 9. You are not required to accept this License, since you have not
358
+ signed it. However, nothing else grants you permission to modify or
359
+ distribute the Library or its derivative works. These actions are
360
+ prohibited by law if you do not accept this License. Therefore, by
361
+ modifying or distributing the Library (or any work based on the
362
+ Library), you indicate your acceptance of this License to do so, and
363
+ all its terms and conditions for copying, distributing or modifying
364
+ the Library or works based on it.
365
+
366
+ 10. Each time you redistribute the Library (or any work based on the
367
+ Library), the recipient automatically receives a license from the
368
+ original licensor to copy, distribute, link with or modify the Library
369
+ subject to these terms and conditions. You may not impose any further
370
+ restrictions on the recipients' exercise of the rights granted herein.
371
+ You are not responsible for enforcing compliance by third parties with
372
+ this License.
373
+
374
+ 11. If, as a consequence of a court judgment or allegation of patent
375
+ infringement or for any other reason (not limited to patent issues),
376
+ conditions are imposed on you (whether by court order, agreement or
377
+ otherwise) that contradict the conditions of this License, they do not
378
+ excuse you from the conditions of this License. If you cannot
379
+ distribute so as to satisfy simultaneously your obligations under this
380
+ License and any other pertinent obligations, then as a consequence you
381
+ may not distribute the Library at all. For example, if a patent
382
+ license would not permit royalty-free redistribution of the Library by
383
+ all those who receive copies directly or indirectly through you, then
384
+ the only way you could satisfy both it and this License would be to
385
+ refrain entirely from distribution of the Library.
386
+
387
+ If any portion of this section is held invalid or unenforceable under any
388
+ particular circumstance, the balance of the section is intended to apply,
389
+ and the section as a whole is intended to apply in other circumstances.
390
+
391
+ It is not the purpose of this section to induce you to infringe any
392
+ patents or other property right claims or to contest validity of any
393
+ such claims; this section has the sole purpose of protecting the
394
+ integrity of the free software distribution system which is
395
+ implemented by public license practices. Many people have made
396
+ generous contributions to the wide range of software distributed
397
+ through that system in reliance on consistent application of that
398
+ system; it is up to the author/donor to decide if he or she is willing
399
+ to distribute software through any other system and a licensee cannot
400
+ impose that choice.
401
+
402
+ This section is intended to make thoroughly clear what is believed to
403
+ be a consequence of the rest of this License.
404
+
405
+ 12. If the distribution and/or use of the Library is restricted in
406
+ certain countries either by patents or by copyrighted interfaces, the
407
+ original copyright holder who places the Library under this License may add
408
+ an explicit geographical distribution limitation excluding those countries,
409
+ so that distribution is permitted only in or among countries not thus
410
+ excluded. In such case, this License incorporates the limitation as if
411
+ written in the body of this License.
412
+
413
+ 13. The Free Software Foundation may publish revised and/or new
414
+ versions of the Lesser General Public License from time to time.
415
+ Such new versions will be similar in spirit to the present version,
416
+ but may differ in detail to address new problems or concerns.
417
+
418
+ Each version is given a distinguishing version number. If the Library
419
+ specifies a version number of this License which applies to it and
420
+ "any later version", you have the option of following the terms and
421
+ conditions either of that version or of any later version published by
422
+ the Free Software Foundation. If the Library does not specify a
423
+ license version number, you may choose any version ever published by
424
+ the Free Software Foundation.
425
+
426
+ 14. If you wish to incorporate parts of the Library into other free
427
+ programs whose distribution conditions are incompatible with these,
428
+ write to the author to ask for permission. For software which is
429
+ copyrighted by the Free Software Foundation, write to the Free
430
+ Software Foundation; we sometimes make exceptions for this. Our
431
+ decision will be guided by the two goals of preserving the free status
432
+ of all derivatives of our free software and of promoting the sharing
433
+ and reuse of software generally.
434
+
435
+ NO WARRANTY
436
+
437
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438
+ WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440
+ OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444
+ LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445
+ THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
+
447
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449
+ AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450
+ FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451
+ CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452
+ LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454
+ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456
+ DAMAGES.
457
+
458
+ END OF TERMS AND CONDITIONS
459
+
460
+ How to Apply These Terms to Your New Libraries
461
+
462
+ If you develop a new library, and you want it to be of the greatest
463
+ possible use to the public, we recommend making it free software that
464
+ everyone can redistribute and change. You can do so by permitting
465
+ redistribution under these terms (or, alternatively, under the terms of the
466
+ ordinary General Public License).
467
+
468
+ To apply these terms, attach the following notices to the library. It is
469
+ safest to attach them to the start of each source file to most effectively
470
+ convey the exclusion of warranty; and each file should have at least the
471
+ "copyright" line and a pointer to where the full notice is found.
472
+
473
+ <one line to give the library's name and a brief idea of what it does.>
474
+ Copyright (C) <year> <name of author>
475
+
476
+ This library is free software; you can redistribute it and/or
477
+ modify it under the terms of the GNU Lesser General Public
478
+ License as published by the Free Software Foundation; either
479
+ version 2.1 of the License, or (at your option) any later version.
480
+
481
+ This library is distributed in the hope that it will be useful,
482
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
483
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484
+ Lesser General Public License for more details.
485
+
486
+ You should have received a copy of the GNU Lesser General Public
487
+ License along with this library; if not, write to the Free Software
488
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
489
+
490
+ Also add information on how to contact you by electronic and paper mail.
491
+
492
+ You should also get your employer (if you work as a programmer) or your
493
+ school, if any, to sign a "copyright disclaimer" for the library, if
494
+ necessary. Here is a sample; alter the names:
495
+
496
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
497
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498
+
499
+ <signature of Ty Coon>, 1 April 1990
500
+ Ty Coon, President of Vice
501
+
502
+ That's all there is to it!
503
+
504
+
inc/admin/js/tinymce/plugins/advlist/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=function(t,e,n){var r="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(r,!1,!1===n?null:{"list-style-type":n})},o=function(n){n.addCommand("ApplyUnorderedListStyle",function(t,e){s(n,"UL",e["list-style-type"])}),n.addCommand("ApplyOrderedListStyle",function(t,e){s(n,"OL",e["list-style-type"])})},e=function(t){var e=t.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return e?e.split(/[ ,]/):[]},n=function(t){var e=t.getParam("advlist_bullet_styles","default,circle,disc,square");return e?e.split(/[ ,]/):[]},u=function(t){return t&&/^(TH|TD)$/.test(t.nodeName)},c=function(r){return function(t){return t&&/^(OL|UL|DL)$/.test(t.nodeName)&&(n=t,(e=r).$.contains(e.getBody(),n));var e,n}},d=function(t){var e=t.dom.getParent(t.selection.getNode(),"ol,ul");return t.dom.getStyle(e,"listStyleType")||""},p=function(t){return a.map(t,function(t){return{text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}),data:"default"===t?"":t}})},f=function(i,l){return function(t){var o=t.control;i.on("NodeChange",function(t){var e=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}(t.parents,u),n=-1!==e?t.parents.slice(0,e):t.parents,r=a.grep(n,c(i));o.active(0<r.length&&r[0].nodeName===l)})}},m=function(e,t,n,r,o,i){var l;e.addButton(t,{active:!1,type:"splitbutton",tooltip:n,menu:p(i),onPostRender:f(e,o),onshow:(l=e,function(t){var e=d(l);t.control.items().each(function(t){t.active(t.settings.data===e)})}),onselect:function(t){s(e,o,t.control.settings.data)},onclick:function(){e.execCommand(r)}})},r=function(t,e,n,r,o,i){var l,a,s,u,c;0<i.length?m(t,e,n,r,o,i):(a=e,s=n,u=r,c=o,(l=t).addButton(a,{active:!1,type:"button",tooltip:s,onPostRender:f(l,c),onclick:function(){l.execCommand(u)}}))},i=function(t){r(t,"numlist","Numbered list","InsertOrderedList","OL",e(t)),r(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))};t.add("advlist",function(t){var e,n,r;n="lists",r=(e=t).settings.plugins?e.settings.plugins:"",-1!==a.inArray(r.split(/[ ,]/),n)&&(i(t),o(t))})}();
inc/admin/js/tinymce/plugins/anchor/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(t){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)},e=function(t){var e=t.selection.getNode();return"A"===e.tagName&&""===t.dom.getAttrib(e,"href")?e.id||e.name:""},i=function(t,e){var n=t.selection.getNode();"A"===n.tagName&&""===t.dom.getAttrib(n,"href")?(n.removeAttribute("name"),n.id=e,t.undoManager.add()):(t.focus(),t.selection.collapse(!0),t.execCommand("mceInsertContent",!1,t.dom.createHTML("a",{id:e})))},n=function(r){var t=e(r);r.windowManager.open({title:"Anchor",body:{type:"textbox",name:"id",size:40,label:"Id",value:t},onsubmit:function(t){var e,n,o=t.data.id;e=r,(a(n=o)?(i(e,n),0):(e.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),1))&&t.preventDefault()}})},o=function(t){t.addCommand("mceAnchor",function(){n(t)})},r=function(o){return function(t){for(var e=0;e<t.length;e++)(n=t[e]).attr("href")||!n.attr("id")&&!n.attr("name")||n.firstChild||t[e].attr("contenteditable",o);var n}},c=function(t){t.on("PreInit",function(){t.parser.addNodeFilter("a",r("false")),t.serializer.addNodeFilter("a",r(null))})},d=function(t){t.addButton("anchor",{icon:"anchor",tooltip:"Anchor",cmd:"mceAnchor",stateSelector:"a:not([href])"}),t.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",cmd:"mceAnchor"})};t.add("anchor",function(t){c(t),o(t),d(t)})}();
inc/admin/js/tinymce/plugins/autolink/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=tinymce.util.Tools.resolve("tinymce.Env"),m=function(e){return e.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},y=function(e){return e.getParam("default_link_target","")},o=function(e,t){if(t<0&&(t=0),3===e.nodeType){var n=e.data.length;n<t&&(t=n)}return t},k=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,o(t,n)):e.setStartBefore(t)},p=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,o(t,n)):e.setEndAfter(t)},r=function(e,t,n){var i,o,r,a,f,s,d,l,c,u,g=m(e),h=y(e);if("A"!==e.selection.getNode().tagName){if((i=e.selection.getRng(!0).cloneRange()).startOffset<5){if(!(l=i.endContainer.previousSibling)){if(!i.endContainer.firstChild||!i.endContainer.firstChild.nextSibling)return;l=i.endContainer.firstChild.nextSibling}if(c=l.length,k(i,l,c),p(i,l,c),i.endOffset<5)return;o=i.endOffset,a=l}else{if(3!==(a=i.endContainer).nodeType&&a.firstChild){for(;3!==a.nodeType&&a.firstChild;)a=a.firstChild;3===a.nodeType&&(k(i,a,0),p(i,a,a.nodeValue.length))}o=1===i.endOffset?2:i.endOffset-1-t}for(r=o;k(i,a,2<=o?o-2:0),p(i,a,1<=o?o-1:0),o-=1," "!==(u=i.toString())&&""!==u&&160!==u.charCodeAt(0)&&0<=o-2&&u!==n;);var C;(C=i.toString())===n||" "===C||160===C.charCodeAt(0)?(k(i,a,o),p(i,a,r),o+=1):(0===i.startOffset?k(i,a,0):k(i,a,o),p(i,a,r)),"."===(s=i.toString()).charAt(s.length-1)&&p(i,a,r-1),(d=(s=i.toString().trim()).match(g))&&("www."===d[1]?d[1]="http://www.":/@$/.test(d[1])&&!/^mailto:/.test(d[1])&&(d[1]="mailto:"+d[1]),f=e.selection.getBookmark(),e.selection.setRng(i),e.execCommand("createlink",!1,d[1]+d[2]),h&&e.dom.setAttrib(e.selection.getNode(),"target",h),e.selection.moveToBookmark(f),e.nodeChanged())}},t=function(t){var n;t.on("keydown",function(e){13!==e.keyCode||r(t,-1,"")}),i.ie?t.on("focus",function(){if(!n){n=!0;try{t.execCommand("AutoUrlDetect",!1,!0)}catch(e){}}}):(t.on("keypress",function(e){41!==e.keyCode||r(t,-1,"(")}),t.on("keyup",function(e){32!==e.keyCode||r(t,0,"")}))};e.add("autolink",function(e){t(e)})}();
inc/admin/js/tinymce/plugins/autoresize/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var i=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return i(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),h=function(t){return parseInt(t.getParam("autoresize_min_height",t.getElement().offsetHeight),10)},v=function(t){return parseInt(t.getParam("autoresize_max_height",0),10)},o=function(t){return t.getParam("autoresize_overflow_padding",1)},a=function(t){return t.getParam("autoresize_bottom_margin",50)},n=function(t){return t.getParam("autoresize_on_init",!0)},u=function(t,e,n,i,o){r.setEditorTimeout(t,function(){_(t,e),n--?u(t,e,n,i,o):o&&o()},i)},S=function(t,e){var n=t.getBody();n&&(n.style.overflowY=e?"":"hidden",e||(n.scrollTop=0))},_=function(t,e){var n,i,o,r,a,u,s,l,g,c,f,d=t.dom;if(i=t.getDoc())if((m=t).plugins.fullscreen&&m.plugins.fullscreen.isFullscreen())S(t,!0);else{var m;o=i.body,r=h(t),u=d.getStyle(o,"margin-top",!0),s=d.getStyle(o,"margin-bottom",!0),l=d.getStyle(o,"padding-top",!0),g=d.getStyle(o,"padding-bottom",!0),c=d.getStyle(o,"border-top-width",!0),f=d.getStyle(o,"border-bottom-width",!0),a=o.offsetHeight+parseInt(u,10)+parseInt(s,10)+parseInt(l,10)+parseInt(g,10)+parseInt(c,10)+parseInt(f,10),(isNaN(a)||a<=0)&&(a=y.ie?o.scrollHeight:y.webkit&&0===o.clientHeight?0:o.offsetHeight),a>h(t)&&(r=a);var p=v(t);p&&p<a?(r=p,S(t,!0)):S(t,!1),r!==e.get()&&(n=r-e.get(),d.setStyle(t.iframeElement,"height",r+"px"),e.set(r),y.webkit&&n<0&&_(t,e))}},s={setup:function(i,e){i.on("init",function(){var t,e,n=i.dom;t=o(i),e=a(i),!1!==t&&n.setStyles(i.getBody(),{paddingLeft:t,paddingRight:t}),!1!==e&&n.setStyles(i.getBody(),{paddingBottom:e})}),i.on("nodechange setcontent keyup FullscreenStateChanged",function(t){_(i,e)}),n(i)&&i.on("init",function(){u(i,e,20,100,function(){u(i,e,5,1e3)})})},resize:_},l=function(t,e){t.addCommand("mceAutoResize",function(){s.resize(t,e)})};t.add("autoresize",function(t){if(!t.inline){var e=i(0);l(t,e),s.setup(t,e)}})}();
inc/admin/js/tinymce/plugins/autosave/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var n=function(t){var e=t,r=function(){return e};return{get:r,set:function(t){e=t},clone:function(){return n(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),o=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=function(t){return t.fire("RestoreDraft")},i=function(t){return t.fire("StoreDraft")},s=function(t){return t.fire("RemoveDraft")},e=function(t,e){return((t=/^(\d+)([ms]?)$/.exec(""+(t||e)))[2]?{s:1e3,m:6e4}[t[2]]:1)*parseInt(t,10)},u=function(t){return t.getParam("autosave_ask_before_unload",!0)},f=function(t){var e=t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return e=(e=(e=(e=e.replace(/\{path\}/g,document.location.pathname)).replace(/\{query\}/g,document.location.search)).replace(/\{hash\}/g,document.location.hash)).replace(/\{id\}/g,t.id)},c=function(t){return e(t.settings.autosave_interval,"30s")},l=function(t){return e(t.settings.autosave_retention,"20m")},m=function(t,e){var r=t.settings.forced_root_block;return""===(e=o.trim(void 0===e?t.getBody().innerHTML:e))||new RegExp("^<"+r+"[^>]*>((\xa0|&nbsp;|[ \t]|<br[^>]*>)+?|)</"+r+">|<br>$","i").test(e)},v=function(t){var e=parseInt(a.getItem(f(t)+"time"),10)||0;return!((new Date).getTime()-e>l(t)&&(d(t,!1),1))},d=function(t,e){var r=f(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&s(t)},D=function(t){var e=f(t);!m(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),i(t))},g=function(t){var e=f(t);v(t)&&(t.setContent(a.getItem(e+"draft"),{format:"raw"}),r(t))},y={isEmpty:m,hasDraft:v,removeDraft:d,storeDraft:D,restoreDraft:g,startStoreDraft:function(t,e){var r=c(t);e.get()||(setInterval(function(){t.removed||D(t)},r),e.set(!0))},restoreLastDraft:function(t){t.undoManager.transact(function(){g(t),d(t)}),t.focus()}},p=function(e,r){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[r].concat(t))}},h=function(t){return{hasDraft:p(y.hasDraft,t),storeDraft:p(y.storeDraft,t),restoreDraft:p(y.restoreDraft,t),removeDraft:p(y.removeDraft,t),isEmpty:p(y.isEmpty,t)}},_=tinymce.util.Tools.resolve("tinymce.EditorManager");_._beforeUnloadHandler=function(){var e;return o.each(_.get(),function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&u(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e};var b=function(t){window.onbeforeunload=_._beforeUnloadHandler},I=function(r,n){return function(t){var e=t.control;e.disabled(!y.hasDraft(r)),r.on("StoreDraft RestoreDraft RemoveDraft",function(){e.disabled(!y.hasDraft(r))}),y.startStoreDraft(r,n)}},w=function(t,e){t.addButton("restoredraft",{title:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e)}),t.addMenuItem("restoredraft",{text:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e),context:"file"})};t.add("autosave",function(t){var e=n(!1);return b(t),w(t,e),h(t)})}();
inc/admin/js/tinymce/plugins/bbcode/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),o(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/<font>(.*?)<\/font>/gi,"$1"),o(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),o(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),o(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),o(/<\/(strong|b)>/gi,"[/b]"),o(/<(strong|b)>/gi,"[b]"),o(/<\/(em|i)>/gi,"[/i]"),o(/<(em|i)>/gi,"[i]"),o(/<\/u>/gi,"[/u]"),o(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),o(/<u>/gi,"[u]"),o(/<blockquote[^>]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/<br \/>/gi,"\n"),o(/<br\/>/gi,"\n"),o(/<br>/gi,"\n"),o(/<p>/gi,""),o(/<\/p>/gi,"\n"),o(/&nbsp;|\u00a0/gi," "),o(/&quot;/gi,'"'),o(/&lt;/gi,"<"),o(/&gt;/gi,">"),o(/&amp;/gi,"&"),e},i=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/\n/gi,"<br />"),o(/\[b\]/gi,"<strong>"),o(/\[\/b\]/gi,"</strong>"),o(/\[i\]/gi,"<em>"),o(/\[\/i\]/gi,"</em>"),o(/\[u\]/gi,"<u>"),o(/\[\/u\]/gi,"</u>"),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),o(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),o(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),o(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span>&nbsp;'),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;'),e};o.add("bbcode",function(){return{init:function(o){o.on("beforeSetContent",function(o){o.content=i(o.content)}),o.on("postProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=e(o.content))})}}})}();
inc/admin/js/tinymce/plugins/charmap/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(e,t){return e.fire("insertCustomChar",{chr:t})},l=function(e,t){var a=i(e,t).chr;e.execCommand("mceInsertContent",!1,a)},a=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=function(e){return e.settings.charmap},n=function(e){return e.settings.charmap_append},o=a.isArray,c=function(e){return o(e)?[].concat((t=e,a.grep(t,function(e){return o(e)&&2===e.length}))):"function"==typeof e?e():[];var t},s=function(e){return function(e,t){var a=r(e);a&&(t=c(a));var i=n(e);return i?[].concat(t).concat(c(i)):t}(e,[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["256","A - macron"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["274","E - macron"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["298","I - macron"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["332","O - macron"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["362","U - macron"],["221","Y - acute"],["376","Y - diaeresis"],["562","Y - macron"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["257","a - macron"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["275","e - macron"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["299","i - macron"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["333","o macron"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["363","u - macron"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["563","y - macron"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]])},t=function(t){return{getCharMap:function(){return s(t)},insertChar:function(e){l(t,e)}}},u=function(e){var t,a,i,r=Math.min(e.length,25),n=Math.ceil(e.length/r);for(t='<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>',i=0;i<n;i++){for(t+="<tr>",a=0;a<r;a++){var o=i*r+a;if(o<e.length){var l=e[o],c=parseInt(l[0],10),s=l?String.fromCharCode(c):"&nbsp;";t+='<td title="'+l[1]+'"><div tabindex="-1" title="'+l[1]+'" role="button" data-chr="'+c+'">'+s+"</div></td>"}else t+="<td />"}t+="</tr>"}return t+="</tbody></table>"},d=function(e){for(;e;){if("TD"===e.nodeName)return e;e=e.parentNode}},m=function(n){var o,e={type:"container",html:u(s(n)),onclick:function(e){var t=e.target;if(/^(TD|DIV)$/.test(t.nodeName)){var a=d(t).firstChild;if(a&&a.hasAttribute("data-chr")){var i=a.getAttribute("data-chr"),r=parseInt(i,10);isNaN(r)||l(n,String.fromCharCode(r)),e.ctrlKey||o.close()}}},onmouseover:function(e){var t=d(e.target);t&&t.firstChild?(o.find("#preview").text(t.firstChild.firstChild.data),o.find("#previewTitle").text(t.title)):(o.find("#preview").text(" "),o.find("#previewTitle").text(" "))}};o=n.windowManager.open({title:"Special character",spacing:10,padding:10,items:[e,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){o.close()}}]})},g=function(e){e.addCommand("mceShowCharmap",function(){m(e)})},p=function(e){e.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),e.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"})};e.add("charmap",function(e){return g(e),p(e),t(e)})}();
inc/admin/js/tinymce/plugins/code/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),o=function(t){return t.getParam("code_dialog_width",600)},i=function(t){return t.getParam("code_dialog_height",Math.min(n.DOM.getViewPort().h-200,500))},c=function(t,n){t.focus(),t.undoManager.transact(function(){t.setContent(n)}),t.selection.setCursorLocation(),t.nodeChanged()},d=function(t){return t.getContent({source_view:!0})},e=function(n){var t=o(n),e=i(n);n.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:t,minHeight:e,spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(t){c(n,t.data.code)}}).find("#code").value(d(n))},u=function(t){t.addCommand("mceCodeEditor",function(){e(t)})},a=function(t){t.addButton("code",{icon:"code",tooltip:"Source code",onclick:function(){e(t)}}),t.addMenuItem("code",{icon:"code",text:"Source code",onclick:function(){e(t)}})};t.add("code",function(t){return u(t),a(t),{}})}();
inc/admin/js/tinymce/plugins/codesample/css/prism.css ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */
2
+ /**
3
+ * prism.js default theme for JavaScript, CSS and HTML
4
+ * Based on dabblet (http://dabblet.com)
5
+ * @author Lea Verou
6
+ */
7
+
8
+ code[class*="language-"],
9
+ pre[class*="language-"] {
10
+ color: black;
11
+ text-shadow: 0 1px white;
12
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
13
+ direction: ltr;
14
+ text-align: left;
15
+ white-space: pre;
16
+ word-spacing: normal;
17
+ word-break: normal;
18
+ word-wrap: normal;
19
+ line-height: 1.5;
20
+
21
+ -moz-tab-size: 4;
22
+ -o-tab-size: 4;
23
+ tab-size: 4;
24
+
25
+ -webkit-hyphens: none;
26
+ -moz-hyphens: none;
27
+ -ms-hyphens: none;
28
+ hyphens: none;
29
+ }
30
+
31
+ pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
32
+ code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
33
+ text-shadow: none;
34
+ background: #b3d4fc;
35
+ }
36
+
37
+ pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
38
+ code[class*="language-"]::selection, code[class*="language-"] ::selection {
39
+ text-shadow: none;
40
+ background: #b3d4fc;
41
+ }
42
+
43
+ @media print {
44
+ code[class*="language-"],
45
+ pre[class*="language-"] {
46
+ text-shadow: none;
47
+ }
48
+ }
49
+
50
+ /* Code blocks */
51
+ pre[class*="language-"] {
52
+ padding: 1em;
53
+ margin: .5em 0;
54
+ overflow: auto;
55
+ }
56
+
57
+ :not(pre) > code[class*="language-"],
58
+ pre[class*="language-"] {
59
+ background: #f5f2f0;
60
+ }
61
+
62
+ /* Inline code */
63
+ :not(pre) > code[class*="language-"] {
64
+ padding: .1em;
65
+ border-radius: .3em;
66
+ }
67
+
68
+ .token.comment,
69
+ .token.prolog,
70
+ .token.doctype,
71
+ .token.cdata {
72
+ color: slategray;
73
+ }
74
+
75
+ .token.punctuation {
76
+ color: #999;
77
+ }
78
+
79
+ .namespace {
80
+ opacity: .7;
81
+ }
82
+
83
+ .token.property,
84
+ .token.tag,
85
+ .token.boolean,
86
+ .token.number,
87
+ .token.constant,
88
+ .token.symbol,
89
+ .token.deleted {
90
+ color: #905;
91
+ }
92
+
93
+ .token.selector,
94
+ .token.attr-name,
95
+ .token.string,
96
+ .token.char,
97
+ .token.builtin,
98
+ .token.inserted {
99
+ color: #690;
100
+ }
101
+
102
+ .token.operator,
103
+ .token.entity,
104
+ .token.url,
105
+ .language-css .token.string,
106
+ .style .token.string {
107
+ color: #a67f59;
108
+ background: hsla(0, 0%, 100%, .5);
109
+ }
110
+
111
+ .token.atrule,
112
+ .token.attr-value,
113
+ .token.keyword {
114
+ color: #07a;
115
+ }
116
+
117
+ .token.function {
118
+ color: #DD4A68;
119
+ }
120
+
121
+ .token.regex,
122
+ .token.important,
123
+ .token.variable {
124
+ color: #e90;
125
+ }
126
+
127
+ .token.important,
128
+ .token.bold {
129
+ font-weight: bold;
130
+ }
131
+ .token.italic {
132
+ font-style: italic;
133
+ }
134
+
135
+ .token.entity {
136
+ cursor: help;
137
+ }
138
+
inc/admin/js/tinymce/plugins/codesample/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var n=function(e){var t=e,a=function(){return t};return{get:a,set:function(e){t=e},clone:function(){return n(a())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=function(e){return e.settings.codesample_content_css},a=function(e){return e.settings.codesample_languages},o=function(e){return Math.min(i.DOM.getViewPort().w,e.getParam("codesample_dialog_width",800))},l=function(e){return Math.min(i.DOM.getViewPort().w,e.getParam("codesample_dialog_height",650))},t={},r=t,u=void 0!==t?t:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},c=function(){var c=/\blang(?:uage)?-(?!\*)(\w+)\b/i,S=u.Prism={util:{encode:function(e){return e instanceof o?new o(e.type,S.util.encode(e.content),e.alias):"Array"===S.util.type(e)?e.map(S.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){switch(S.util.type(e)){case"Object":var t={};for(var a in e)e.hasOwnProperty(a)&&(t[a]=S.util.clone(e[a]));return t;case"Array":return e.map&&e.map(function(e){return S.util.clone(e)})}return e}},languages:{extend:function(e,t){var a=S.util.clone(S.languages[e]);for(var n in t)a[n]=t[n];return a},insertBefore:function(a,e,t,n){var i=(n=n||S.languages)[a];if(2===arguments.length){for(var r in t=e)t.hasOwnProperty(r)&&(i[r]=t[r]);return i}var s={};for(var o in i)if(i.hasOwnProperty(o)){if(o===e)for(var r in t)t.hasOwnProperty(r)&&(s[r]=t[r]);s[o]=i[o]}return S.languages.DFS(S.languages,function(e,t){t===n[a]&&e!==a&&(this[e]=s)}),n[a]=s},DFS:function(e,t,a){for(var n in e)e.hasOwnProperty(n)&&(t.call(e,n,e[n],a||n),"Object"===S.util.type(e[n])?S.languages.DFS(e[n],t):"Array"===S.util.type(e[n])&&S.languages.DFS(e[n],t,n))}},plugins:{},highlightAll:function(e,t){for(var a=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),n=0,i=void 0;i=a[n++];)S.highlightElement(i,!0===e,t)},highlightElement:function(e,t,a){for(var n,i,r=e;r&&!c.test(r.className);)r=r.parentNode;r&&(n=(r.className.match(c)||[,""])[1],i=S.languages[n]),e.className=e.className.replace(c,"").replace(/\s+/g," ")+" language-"+n,r=e.parentNode,/pre/i.test(r.nodeName)&&(r.className=r.className.replace(c,"").replace(/\s+/g," ")+" language-"+n);var s=e.textContent,o={element:e,language:n,grammar:i,code:s};if(s&&i)if(S.hooks.run("before-highlight",o),t&&u.Worker){var l=new Worker(S.filename);l.onmessage=function(e){o.highlightedCode=e.data,S.hooks.run("before-insert",o),o.element.innerHTML=o.highlightedCode,a&&a.call(o.element),S.hooks.run("after-highlight",o),S.hooks.run("complete",o)},l.postMessage(JSON.stringify({language:o.language,code:o.code,immediateClose:!0}))}else o.highlightedCode=S.highlight(o.code,o.grammar,o.language),S.hooks.run("before-insert",o),o.element.innerHTML=o.highlightedCode,a&&a.call(e),S.hooks.run("after-highlight",o),S.hooks.run("complete",o);else S.hooks.run("complete",o)},highlight:function(e,t,a){var n=S.tokenize(e,t);return o.stringify(S.util.encode(n),a)},tokenize:function(e,t,a){var n=S.Token,i=[e],r=t.rest;if(r){for(var s in r)t[s]=r[s];delete t.rest}e:for(var s in t)if(t.hasOwnProperty(s)&&t[s]){var o=t[s];o="Array"===S.util.type(o)?o:[o];for(var l=0;l<o.length;++l){var c=o[l],u=c.inside,g=!!c.lookbehind,d=0,p=c.alias;c=c.pattern||c;for(var f=0;f<i.length;f++){var h=i[f];if(i.length>e.length)break e;if(!(h instanceof n)){c.lastIndex=0;var m=c.exec(h);if(m){g&&(d=m[1].length);var b=m.index-1+d,y=b+(m=m[0].slice(d)).length,v=h.slice(0,b+1),k=h.slice(y+1),w=[f,1];v&&w.push(v);var x=new n(s,u?S.tokenize(m,u):m,p);w.push(x),k&&w.push(k),Array.prototype.splice.apply(i,w)}}}}}return i},hooks:{all:{},add:function(e,t){var a=S.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=S.hooks.all[e];if(a&&a.length)for(var n=0,i=void 0;i=a[n++];)i(t)}}},o=S.Token=function(e,t,a){this.type=e,this.content=t,this.alias=a};if(o.stringify=function(t,a,e){if("string"==typeof t)return t;if("Array"===S.util.type(t))return t.map(function(e){return o.stringify(e,a,t)}).join("");var n={type:t.type,content:o.stringify(t.content,a,e),tag:"span",classes:["token",t.type],attributes:{},language:a,parent:e};if("comment"===n.type&&(n.attributes.spellcheck="true"),t.alias){var i="Array"===S.util.type(t.alias)?t.alias:[t.alias];Array.prototype.push.apply(n.classes,i)}S.hooks.run("wrap",n);var r="";for(var s in n.attributes)r+=(r?" ":"")+s+'="'+(n.attributes[s]||"")+'"';return"<"+n.tag+' class="'+n.classes.join(" ")+'" '+r+">"+n.content+"</"+n.tag+">"},!u.document)return u.addEventListener&&u.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,n=t.code,i=t.immediateClose;u.postMessage(S.highlight(n,S.languages[a],a)),i&&u.close()},!1),u.Prism}();void 0!==r&&(r.Prism=c),c.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},c.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},c.languages.css.atrule.inside.rest=c.util.clone(c.languages.css),c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/i,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/i,inside:c.languages.markup.tag.inside},rest:c.languages.css},alias:"language-css"}}),c.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:c.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:c.languages.css}},alias:"language-css"}},c.languages.markup.tag)),c.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},c.languages.javascript=c.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),c.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),c.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:c.languages.javascript}},string:/[\s\S]+/}}}),c.languages.markup&&c.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/i,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/i,inside:c.languages.markup.tag.inside},rest:c.languages.javascript},alias:"language-javascript"}}),c.languages.js=c.languages.javascript,c.languages.c=c.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i}),c.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,lookbehind:!0}}}}),delete c.languages.c["class-name"],delete c.languages.c["boolean"],c.languages.csharp=c.languages.extend("clike",{keyword:/\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,string:[/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,/("|')(\\?.)*?\1/],number:/\b-?(0x[\da-f]+|\d*\.?\d+)\b/i}),c.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}}),c.languages.cpp=c.languages.extend("c",{keyword:/\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(true|false)\b/,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),c.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}}),c.languages.java=c.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,operator:{pattern:/(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,lookbehind:!0}}),c.languages.php=c.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),c.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),c.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),c.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),c.languages.markup&&(c.hooks.add("before-highlight",function(t){"php"===t.language&&(t.tokenStack=[],t.backupCode=t.code,t.code=t.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(e){return t.tokenStack.push(e),"{{{PHP"+t.tokenStack.length+"}}}"}))}),c.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),c.hooks.add("after-highlight",function(e){if("php"===e.language){for(var t=0,a=void 0;a=e.tokenStack[t];t++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(t+1)+"}}}",c.highlight(a,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),c.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'<span class="token php">$1</span>'))}),c.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:c.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})),c.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/},function(e){e.languages.ruby=e.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var t={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.util.clone(e.languages.ruby)}};e.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:t}},{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:t}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:t}}]}(c);var g={isCodeSample:function(e){return e&&"PRE"===e.nodeName&&-1!==e.className.indexOf("language-")},trimArg:function(a){return function(e,t){return a(t)}}},d=function(e){var t=e.selection.getNode();return g.isCodeSample(t)?t:null},p=d,f=function(t,a,n){t.undoManager.transact(function(){var e=d(t);n=i.DOM.encode(n),e?(t.dom.setAttrib(e,"class","language-"+a),e.innerHTML=n,c.highlightElement(e),t.selection.select(e)):(t.insertContent('<pre id="__new" class="language-'+a+'">'+n+"</pre>"),t.selection.select(t.$("#__new").removeAttr("id")[0]))})},h=function(e){var t=d(e);return t?t.textContent:""},m=function(e){var t=a(e);return t||[{text:"HTML/XML",value:"markup"},{text:"JavaScript",value:"javascript"},{text:"CSS",value:"css"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"}]},b=function(e){var t,a=p(e);return a&&(t=a.className.match(/language-(\w+)/))?t[1]:""},y=function(t){var e=o(t),a=l(t),n=b(t),i=m(t),r=h(t);t.windowManager.open({title:"Insert/Edit code sample",minWidth:e,minHeight:a,layout:"flex",direction:"column",align:"stretch",body:[{type:"listbox",name:"language",label:"Language",maxWidth:200,value:n,values:i},{type:"textbox",name:"code",multiline:!0,spellcheck:!1,ariaLabel:"Code view",flex:1,style:"direction: ltr; text-align: left",classes:"monospace",value:r,autofocus:!0}],onSubmit:function(e){f(t,e.data.language,e.data.code)}})},v=function(t){t.addCommand("codesample",function(){var e=t.selection.getNode();t.selection.isCollapsed()||g.isCodeSample(e)?y(t):t.formatter.toggle("code")})},k=function(a){var i=a.$;a.on("PreProcess",function(e){i("pre[contenteditable=false]",e.node).filter(g.trimArg(g.isCodeSample)).each(function(e,t){var a=i(t),n=t.textContent;a.attr("class",i.trim(a.attr("class"))),a.removeAttr("contentEditable"),a.empty().append(i("<code></code>").each(function(){this.textContent=n}))})}),a.on("SetContent",function(){var e=i("pre").filter(g.trimArg(g.isCodeSample)).filter(function(e,t){return"false"!==t.contentEditable});e.length&&a.undoManager.transact(function(){e.each(function(e,t){i(t).find("br").each(function(e,t){t.parentNode.replaceChild(a.getDoc().createTextNode("\n"),t)}),t.contentEditable=!1,t.innerHTML=a.dom.encode(t.textContent),c.highlightElement(t),t.className=i.trim(t.className)})})})},w=function(e,t,a,n){var i,r=s(e);e.inline&&a.get()||!e.inline&&n.get()||(e.inline?a.set(!0):n.set(!0),!1!==r&&(i=e.dom.create("link",{rel:"stylesheet",href:r||t+"/css/prism.css"}),e.getDoc().getElementsByTagName("head")[0].appendChild(i)))},x=function(e){e.addButton("codesample",{cmd:"codesample",title:"Insert/Edit code sample"}),e.addMenuItem("codesample",{cmd:"codesample",text:"Code sample",icon:"codesample"})},S=n(!1);e.add("codesample",function(t,e){var a=n(!1);k(t),x(t),v(t),t.on("init",function(){w(t,e,S,a)}),t.on("dblclick",function(e){g.isCodeSample(e.target)&&y(t)})})}();
inc/admin/js/tinymce/plugins/colorpicker/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Color"),a=function(e,n){e.find("#preview")[0].getEl().style.background=n},o=function(e,n){var i=l(n),t=i.toRgb();e.fromJSON({r:t.r,g:t.g,b:t.b,hex:i.toHex().substr(1)}),a(e,i.toHex())},t=function(e,n,i){var t=e.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:i,onchange:function(){var e=this.rgb();t&&(t.find("#r").value(e.r),t.find("#g").value(e.g),t.find("#b").value(e.b),t.find("#hex").value(this.value().substr(1)),a(t,this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var e,n,i=t.find("colorpicker")[0];if(e=this.name(),n=this.value(),"hex"===e)return o(t,n="#"+n),void i.value(n);n={r:t.find("#r").value(),g:t.find("#g").value(),b:t.find("#b").value()},i.value(n),o(t,n)}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){n("#"+t.toJSON().hex)}});o(t,i)};e.add("colorpicker",function(i){i.settings.color_picker_callback||(i.settings.color_picker_callback=function(e,n){t(i,e,n)})})}();
inc/admin/js/tinymce/plugins/contextmenu/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var o=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return o(e())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(t){return{isContextMenuVisible:function(){return t.get()}}},r=function(t){return t.settings.contextmenu_never_use_native},u=function(t){return t.getParam("contextmenu","link openlink image inserttable | cell row column deletetable")},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=function(t){return l.DOM.select(t.settings.ui_container)[0]},a=function(t,n){return{x:t,y:n}},f=function(t,n,e){return a(t.x+n,t.y+e)},m=function(t,n){if(t&&"static"!==l.DOM.getStyle(t,"position",!0)){var e=l.DOM.getPos(t),o=e.x-t.scrollLeft,i=e.y-t.scrollTop;return f(n,-o,-i)}return f(n,0,0)},c=function(t,n){if(t.inline)return m(s(t),a((u=n).pageX,u.pageY));var e,o,i,r,u,c=(e=t.getContentAreaContainer(),o=a((r=n).clientX,r.clientY),i=l.DOM.getPos(e),f(o,i.x,i.y));return m(s(t),c)},g=tinymce.util.Tools.resolve("tinymce.ui.Factory"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),y=function(t,n,e,o){null===o.get()?o.set(function(e,n){var t,o,i=[];o=u(e),v.each(o.split(/[ ,]/),function(t){var n=e.menuItems[t];"|"===t&&(n={text:t}),n&&(n.shortcut="",i.push(n))});for(var r=0;r<i.length;r++)"|"===i[r].text&&(0!==r&&r!==i.length-1||i.splice(r,1));return(t=g.create("menu",{items:i,context:"contextmenu",classes:"contextmenu"})).uiContainer=s(e),t.renderTo(s(e)),t.on("hide",function(t){t.control===this&&n.set(!1)}),e.on("remove",function(){t.remove(),t=null}),t}(t,e)):o.get().show(),o.get().moveTo(n.x,n.y),e.set(!0)},x=function(e,o,i){e.on("contextmenu",function(t){var n;n=e,(!t.ctrlKey||r(n))&&(t.preventDefault(),y(e,c(e,t),o,i))})};t.add("contextmenu",function(t){var n=o(null),e=o(!1);return x(t,e,n),i(e)})}();
inc/admin/js/tinymce/plugins/directionality/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(t,e){var i,n=t.dom,o=t.selection.getSelectedBlocks();o.length&&(i=n.getAttrib(o[0],"dir"),c.each(o,function(t){n.getParent(t.parentNode,'*[dir="'+e+'"]',n.getRoot())||n.setAttrib(t,"dir",i!==e?e:null)}),t.nodeChanged())},i=function(t){t.addCommand("mceDirectionLTR",function(){e(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){e(t,"rtl")})},n=function(e){var i=[];return c.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(t){i.push(t+"[dir="+e+"]")}),i.join(",")},o=function(t){t.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:n("ltr")}),t.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:n("rtl")})};t.add("directionality",function(t){i(t),o(t)})}();
inc/admin/js/tinymce/plugins/emoticons/img/smiley-cool.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-cry.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-embarassed.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-frown.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-innocent.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-kiss.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-laughing.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-money-mouth.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-sealed.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-smile.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-surprised.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-tongue-out.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-undecided.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-wink.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/img/smiley-yell.gif ADDED
Binary file
inc/admin/js/tinymce/plugins/emoticons/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]],i=function(i){var o;return o='<table role="list" class="mce-grid">',e.each(n,function(t){o+="<tr>",e.each(t,function(t){var e=i+"/img/smiley-"+t+".gif";o+='<td><a href="#" data-mce-url="'+e+'" data-mce-alt="'+t+'" tabindex="-1" role="option" aria-label="'+t+'"><img src="'+e+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),o+="</tr>"}),o+="</table>"},o=function(a,t){var e=i(t);a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:e,onclick:function(t){var e,i,o,n=a.dom.getParent(t.target,"a");n&&(e=a,i=n.getAttribute("data-mce-url"),o=n.getAttribute("data-mce-alt"),e.insertContent(e.dom.createHTML("img",{src:i,alt:o})),this.hide())}},tooltip:"Emoticons"})};t.add("emoticons",function(t,e){o(t,e)})}();
inc/admin/js/tinymce/plugins/fullpage/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var l=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return l(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),g=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=tinymce.util.Tools.resolve("tinymce.html.DomParser"),f=tinymce.util.Tools.resolve("tinymce.html.Node"),m=tinymce.util.Tools.resolve("tinymce.html.Serializer"),h=function(e){return e.getParam("fullpage_hide_in_source_view")},r=function(e){return e.getParam("fullpage_default_xml_pi")},o=function(e){return e.getParam("fullpage_default_encoding")},a=function(e){return e.getParam("fullpage_default_font_family")},c=function(e){return e.getParam("fullpage_default_font_size")},s=function(e){return e.getParam("fullpage_default_text_color")},u=function(e){return e.getParam("fullpage_default_title")},d=function(e){return e.getParam("fullpage_default_doctype","<!DOCTYPE html>")},p=function(e){return t({validate:!1,root_name:"#document"}).parse(e)},y=p,v=function(e,t){var n,l,i=p(t),r={};function o(e,t){return e.attr(t)||""}return r.fontface=a(e),r.fontsize=c(e),7===(n=i.firstChild).type&&(r.xml_pi=!0,(l=/encoding="([^"]+)"/.exec(n.value))&&(r.docencoding=l[1])),(n=i.getAll("#doctype")[0])&&(r.doctype="<!DOCTYPE"+n.value+">"),(n=i.getAll("title")[0])&&n.firstChild&&(r.title=n.firstChild.value),g.each(i.getAll("meta"),function(e){var t,n=e.attr("name"),l=e.attr("http-equiv");n?r[n.toLowerCase()]=e.attr("content"):"Content-Type"===l&&(t=/charset\s*=\s*(.*)\s*/gi.exec(e.attr("content")))&&(r.docencoding=t[1])}),(n=i.getAll("html")[0])&&(r.langcode=o(n,"lang")||o(n,"xml:lang")),r.stylesheets=[],g.each(i.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&r.stylesheets.push(e.attr("href"))}),(n=i.getAll("body")[0])&&(r.langdir=o(n,"dir"),r.style=o(n,"style"),r.visited_color=o(n,"vlink"),r.link_color=o(n,"link"),r.active_color=o(n,"alink")),r},_=function(e,r,t){var o,n,l,a,i,c=e.dom;function s(e,t,n){e.attr(t,n||undefined)}function u(e){n.firstChild?n.insert(e,n.firstChild):n.append(e)}o=p(t),(n=o.getAll("head")[0])||(a=o.getAll("html")[0],n=new f("head",1),a.firstChild?a.insert(n,a.firstChild,!0):a.append(n)),a=o.firstChild,r.xml_pi?(i='version="1.0"',r.docencoding&&(i+=' encoding="'+r.docencoding+'"'),7!==a.type&&(a=new f("xml",7),o.insert(a,o.firstChild,!0)),a.value=i):a&&7===a.type&&a.remove(),a=o.getAll("#doctype")[0],r.doctype?(a||(a=new f("#doctype",10),r.xml_pi?o.insert(a,o.firstChild):u(a)),a.value=r.doctype.substring(9,r.doctype.length-1)):a&&a.remove(),a=null,g.each(o.getAll("meta"),function(e){"Content-Type"===e.attr("http-equiv")&&(a=e)}),r.docencoding?(a||((a=new f("meta",1)).attr("http-equiv","Content-Type"),a.shortEnded=!0,u(a)),a.attr("content","text/html; charset="+r.docencoding)):a&&a.remove(),a=o.getAll("title")[0],r.title?(a?a.empty():u(a=new f("title",1)),a.append(new f("#text",3)).value=r.title):a&&a.remove(),g.each("keywords,description,author,copyright,robots".split(","),function(e){var t,n,l=o.getAll("meta"),i=r[e];for(t=0;t<l.length;t++)if((n=l[t]).attr("name")===e)return void(i?n.attr("content",i):n.remove());i&&((a=new f("meta",1)).attr("name",e),a.attr("content",i),a.shortEnded=!0,u(a))});var d={};return g.each(o.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&(d[e.attr("href")]=e)}),g.each(r.stylesheets,function(e){d[e]||((a=new f("link",1)).attr({rel:"stylesheet",text:"text/css",href:e}),a.shortEnded=!0,u(a)),delete d[e]}),g.each(d,function(e){e.remove()}),(a=o.getAll("body")[0])&&(s(a,"dir",r.langdir),s(a,"style",r.style),s(a,"vlink",r.visited_color),s(a,"link",r.link_color),s(a,"alink",r.active_color),c.setAttribs(e.getBody(),{style:r.style,dir:r.dir,vLink:r.visited_color,link:r.link_color,aLink:r.active_color})),(a=o.getAll("html")[0])&&(s(a,"lang",r.langcode),s(a,"xml:lang",r.langcode)),n.firstChild||n.remove(),(l=m({validate:!1,indent:!0,apply_source_formatting:!0,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(o)).substring(0,l.indexOf("</body>"))},n=function(n,l){var i=v(n,l.get());n.windowManager.open({title:"Document properties",data:i,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(e){var t=_(n,g.extend(i,e.data),l.get());l.set(t)}})},i=function(e,t){e.addCommand("mceFullPageProperties",function(){n(e,t)})},b=function(e,t){return g.each(e,function(e){t=t.replace(e,function(e){return"\x3c!--mce:protected "+escape(e)+"--\x3e"})}),t},x=function(e){return e.replace(/<!--mce:protected ([\s\S]*?)-->/g,function(e,t){return unescape(t)})},k=g.each,C=function(e){return e.replace(/<\/?[A-Z]+/g,function(e){return e.toLowerCase()})},A=function(e){var t,n="",l="";if(r(e)){var i=o(e);n+='<?xml version="1.0" encoding="'+(i||"ISO-8859-1")+'" ?>\n'}return n+=d(e),n+="\n<html>\n<head>\n",(t=u(e))&&(n+="<title>"+t+"</title>\n"),(t=o(e))&&(n+='<meta http-equiv="Content-Type" content="text/html; charset='+t+'" />\n'),(t=a(e))&&(l+="font-family: "+t+";"),(t=c(e))&&(l+="font-size: "+t+";"),(t=s(e))&&(l+="color: "+t+";"),n+="</head>\n<body"+(l?' style="'+l+'"':"")+">\n"},w=function(r,o,a){r.on("BeforeSetContent",function(e){!function(e,t,n,l){var i,r,o,a,c,s="",u=e.dom;if(!(l.selection||(o=b(e.settings.protect,l.content),"raw"===l.format&&t.get()||l.source_view&&h(e)))){0!==o.length||l.source_view||(o=g.trim(t.get())+"\n"+g.trim(o)+"\n"+g.trim(n.get())),-1!==(i=(o=o.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("<body"))?(i=o.indexOf(">",i),t.set(C(o.substring(0,i+1))),-1===(r=o.indexOf("</body",i))&&(r=o.length),l.content=g.trim(o.substring(i+1,r)),n.set(C(o.substring(r)))):(t.set(A(e)),n.set("\n</body>\n</html>")),a=y(t.get()),k(a.getAll("style"),function(e){e.firstChild&&(s+=e.firstChild.value)}),(c=a.getAll("body")[0])&&u.setAttribs(e.getBody(),{style:c.attr("style")||"",dir:c.attr("dir")||"",vLink:c.attr("vlink")||"",link:c.attr("link")||"",aLink:c.attr("alink")||""}),u.remove("fullpage_styles");var d=e.getDoc().getElementsByTagName("head")[0];s&&(u.add(d,"style",{id:"fullpage_styles"},s),(c=u.get("fullpage_styles")).styleSheet&&(c.styleSheet.cssText=s));var f={};g.each(d.getElementsByTagName("link"),function(e){"stylesheet"===e.rel&&e.getAttribute("data-mce-fullpage")&&(f[e.href]=e)}),g.each(a.getAll("link"),function(e){var t=e.attr("href");if(!t)return!0;f[t]||"stylesheet"!==e.attr("rel")||u.add(d,"link",{rel:"stylesheet",text:"text/css",href:t,"data-mce-fullpage":"1"}),delete f[t]}),g.each(f,function(e){e.parentNode.removeChild(e)})}}(r,o,a,e)}),r.on("GetContent",function(e){var t,n,l,i;t=r,n=o.get(),l=a.get(),(i=e).selection||i.source_view&&h(t)||(i.content=x(g.trim(n)+"\n"+g.trim(i.content)+"\n"+g.trim(l)))})},P=function(e){e.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),e.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"})};e.add("fullpage",function(e){var t=l(""),n=l("");i(e,t),P(e),w(e,t,n)})}();
inc/admin/js/tinymce/plugins/fullscreen/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var i=function(e){var n=e,t=function(){return n};return{get:t,set:function(e){n=e},clone:function(){return i(t())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e){return{isFullscreen:function(){return null!==e.get()}}},n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),m=function(e,n){e.fire("FullscreenStateChanged",{state:n})},g=n.DOM,r=function(e,n){var t,r,l,i,o,c,s=document.body,u=document.documentElement,d=n.get(),a=function(){var e,n,t,i;g.setStyle(l,"height",(t=window,i=document.body,i.offsetWidth&&(e=i.offsetWidth,n=i.offsetHeight),t.innerWidth&&t.innerHeight&&(e=t.innerWidth,n=t.innerHeight),{w:e,h:n}).h-(r.clientHeight-l.clientHeight))},h=function(){g.unbind(window,"resize",a)};if(t=(r=e.getContainer()).style,i=(l=e.getContentAreaContainer().firstChild).style,d)i.width=d.iframeWidth,i.height=d.iframeHeight,d.containerWidth&&(t.width=d.containerWidth),d.containerHeight&&(t.height=d.containerHeight),g.removeClass(s,"mce-fullscreen"),g.removeClass(u,"mce-fullscreen"),g.removeClass(r,"mce-fullscreen"),o=d.scrollPos,window.scrollTo(o.x,o.y),g.unbind(window,"resize",d.resizeHandler),e.off("remove",d.removeHandler),n.set(null),m(e,!1);else{var f={scrollPos:(c=g.getViewPort(),{x:c.x,y:c.y}),containerWidth:t.width,containerHeight:t.height,iframeWidth:i.width,iframeHeight:i.height,resizeHandler:a,removeHandler:h};i.width=i.height="100%",t.width=t.height="",g.addClass(s,"mce-fullscreen"),g.addClass(u,"mce-fullscreen"),g.addClass(r,"mce-fullscreen"),g.bind(window,"resize",a),e.on("remove",h),a(),n.set(f),m(e,!0)}},l=function(e,n){e.addCommand("mceFullScreen",function(){r(e,n)})},o=function(t){return function(e){var n=e.control;t.on("FullscreenStateChanged",function(e){n.active(e.state)})}},c=function(e){e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,cmd:"mceFullScreen",onPostRender:o(e),context:"view"}),e.addButton("fullscreen",{active:!1,tooltip:"Fullscreen",cmd:"mceFullScreen",onPostRender:o(e)})};e.add("fullscreen",function(e){var n=i(null);return e.settings.inline||(l(e,n),c(e),e.addShortcut("Ctrl+Shift+F","","mceFullScreen")),t(n)})}();
inc/admin/js/tinymce/plugins/help/img/logo.png ADDED
Binary file
inc/admin/js/tinymce/plugins/help/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e,t,n,r,o,a,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(e){return function(){return e}},c=u(!1),l=u(!0),s={noop:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},noarg:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n()}},compose:function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,arguments))}},constant:u,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(a){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var i=new Array(arguments.length-1),n=1;n<arguments.length;n++)i[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var o=i.concat(n);return a.apply(null,o)}},not:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:c,always:l},f=s.never,m=s.always,p=function(){return y},y=(r={fold:function(e,t){return e()},is:f,isSome:f,isNone:m,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:p,ap:p,each:function(){},bind:p,flatten:p,exists:f,forall:m,filter:p,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:s.constant("none()")},Object.freeze&&Object.freeze(r),r),d=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:m,isNone:f,getOr:e,getOrThunk:e,getOrDie:e,or:t,orThunk:t,map:function(e){return d(e(n))},ap:function(e){return e.fold(p,function(e){return d(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:y},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(f,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},h={some:d,none:p,from:function(e){return null===e||e===undefined?y:d(e)}},g=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},k={isString:g("string"),isObject:g("object"),isArray:g("array"),isNull:g("null"),isBoolean:g("boolean"),isUndefined:g("undefined"),isFunction:g("function"),isNumber:g("number")},v=(o=Array.prototype.indexOf)===undefined?function(e,t){return A(e,t)}:function(e,t){return o.call(e,t)},b=function(e,t){return-1<v(e,t)},x=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var a=e[o];r[o]=t(a,o,e)}return r},w=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var a=e[r];t(a,r,e)&&n.push(a)}return n},A=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},C=(Array.prototype.push,Array.prototype.slice,k.isFunction(Array.from)&&Array.from,x),S=w,P=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return h.some(o)}return h.none()},T=b,O=tinymce.util.Tools.resolve("tinymce.util.I18n"),_=tinymce.util.Tools.resolve("tinymce.Env"),F=_.mac?"\u2318":"Ctrl",H=_.mac?"Ctrl + Alt":"Shift + Alt",M={shortcuts:[{shortcut:F+" + B",action:"Bold"},{shortcut:F+" + I",action:"Italic"},{shortcut:F+" + U",action:"Underline"},{shortcut:F+" + A",action:"Select all"},{shortcut:F+" + Y or "+F+" + Shift + Z",action:"Redo"},{shortcut:F+" + Z",action:"Undo"},{shortcut:H+" + 1",action:"Header 1"},{shortcut:H+" + 2",action:"Header 2"},{shortcut:H+" + 3",action:"Header 3"},{shortcut:H+" + 4",action:"Header 4"},{shortcut:H+" + 5",action:"Header 5"},{shortcut:H+" + 6",action:"Header 6"},{shortcut:H+" + 7",action:"Paragraph"},{shortcut:H+" + 8",action:"Div"},{shortcut:H+" + 9",action:"Address"},{shortcut:"Alt + F9",action:"Focus to menubar"},{shortcut:"Alt + F10",action:"Focus to toolbar"},{shortcut:"Alt + F11",action:"Focus to element path"},{shortcut:"Ctrl + Shift + P > Ctrl + Shift + P",action:"Focus to contextual toolbar"},{shortcut:F+" + K",action:"Insert link (if link plugin activated)"},{shortcut:F+" + S",action:"Save (if save plugin activated)"},{shortcut:F+" + F",action:"Find (if searchreplace plugin activated)"}]},E=function(){var e=C(M.shortcuts,function(e){return'<tr data-mce-tabstop="1" tabindex="-1" aria-label="Action: '+(t=e).action+", Shortcut: "+t.shortcut.replace(/Ctrl/g,"Control")+'"><td>'+O.translate(e.action)+"</td><td>"+e.shortcut+"</td></tr>";var t}).join("");return{title:"Handy Shortcuts",type:"container",style:"overflow-y: auto; overflow-x: hidden; max-height: 250px",items:[{type:"container",html:'<div><table class="mce-table-striped"><thead><th>'+O.translate("Action")+"</th><th>"+O.translate("Shortcut")+"</th></thead>"+e+"</table></div>"}]}},j=(a=Object.keys)===undefined?function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}:a,I=function(e,t){for(var n=j(e),r=0,o=n.length;r<o;r++){var a=n[r];t(e[a],a,e)}},B=function(r,o){var a={};return I(r,function(e,t){var n=o(e,t,r);a[n.k]=n.v}),a},L=function(e,n){var r=[];return I(e,function(e,t){r.push(n(e,t))}),r},N=function(e){return L(e,function(e){return e})},z={bifilter:function(e,n){var r={},o={};return I(e,function(e,t){(n(e,t)?r:o)[t]=e}),{t:r,f:o}},each:I,map:function(e,r){return B(e,function(e,t,n){return{k:t,v:r(e,t,n)}})},mapToArray:L,tupleMap:B,find:function(e,t){for(var n=j(e),r=0,o=n.length;r<o;r++){var a=n[r],i=e[a];if(t(i,a,e))return h.some(i)}return h.none()},keys:j,values:N,size:function(e){return N(e).length}},D=[{key:"advlist",name:"Advanced List"},{key:"anchor",name:"Anchor"},{key:"autolink",name:"Autolink"},{key:"autoresize",name:"Autoresize"},{key:"autosave",name:"Autosave"},{key:"bbcode",name:"BBCode"},{key:"charmap",name:"Character Map"},{key:"code",name:"Code"},{key:"codesample",name:"Code Sample"},{key:"colorpicker",name:"Color Picker"},{key:"compat3x",name:"3.x Compatibility"},{key:"contextmenu",name:"Context Menu"},{key:"directionality",name:"Directionality"},{key:"emoticons",name:"Emoticons"},{key:"fullpage",name:"Full Page"},{key:"fullscreen",name:"Full Screen"},{key:"help",name:"Help"},{key:"hr",name:"Horizontal Rule"},{key:"image",name:"Image"},{key:"imagetools",name:"Image Tools"},{key:"importcss",name:"Import CSS"},{key:"insertdatetime",name:"Insert Date/Time"},{key:"legacyoutput",name:"Legacy Output"},{key:"link",name:"Link"},{key:"lists",name:"Lists"},{key:"media",name:"Media"},{key:"nonbreaking",name:"Nonbreaking"},{key:"noneditable",name:"Noneditable"},{key:"pagebreak",name:"Page Break"},{key:"paste",name:"Paste"},{key:"preview",name:"Preview"},{key:"print",name:"Print"},{key:"save",name:"Save"},{key:"searchreplace",name:"Search and Replace"},{key:"spellchecker",name:"Spell Checker"},{key:"tabfocus",name:"Tab Focus"},{key:"table",name:"Table"},{key:"template",name:"Template"},{key:"textcolor",name:"Text Color"},{key:"textpattern",name:"Text Pattern"},{key:"toc",name:"Table of Contents"},{key:"visualblocks",name:"Visual Blocks"},{key:"visualchars",name:"Visual Characters"},{key:"wordcount",name:"Word Count"}],q=s.curry(function(e,o){return e.replace(/\${([^{}]*)}/g,function(e,t){var n,r=o[t];return"string"==(n=typeof r)||"number"===n?r:e})},'<a href="${url}" target="_blank" rel="noopener">${name}</a>'),R=function(r){var e,t,n=(e=r,t=z.keys(e.plugins),e.settings.forced_plugins===undefined?t:S(t,s.not(s.curry(T,e.settings.forced_plugins)))),o=C(n,function(e){return"<li>"+(t=r,n=e,P(D,function(e){return e.key===n}).fold(function(){var e=t.plugins[n].getMetadata;return"function"==typeof e?q(e()):n},function(e){return q({name:e.name,url:"https://www.tinymce.com/docs/plugins/"+e.key})}))+"</li>";var t,n}),a=o.length,i=o.join("");return"<p><b>"+O.translate(["Plugins installed ({0}):",a])+"</b></p><ul>"+i+"</ul>"},U=function(e){return{title:"Plugins",type:"container",style:"overflow-y: auto; overflow-x: hidden;",layout:"flex",padding:10,spacing:10,items:[(t=e,{type:"container",html:'<div style="overflow-y: auto; overflow-x: hidden; max-height: 230px; height: 230px;" data-mce-tabstop="1" tabindex="-1">'+R(t)+"</div>",flex:1}),{type:"container",html:'<div style="padding: 10px; background: #e3e7f4; height: 100%;" data-mce-tabstop="1" tabindex="-1"><p><b>'+O.translate("Premium plugins:")+'</b></p><ul><li>PowerPaste</li><li>Spell Checker Pro</li><li>Accessibility Checker</li><li>Advanced Code Editor</li><li>Enhanced Media Embed</li><li>Link Checker</li></ul><br /><p style="float: right;"><a href="https://www.tinymce.com/pricing/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">'+O.translate("Learn more...")+"</a></p></div>",flex:1}]};var t},V=tinymce.util.Tools.resolve("tinymce.EditorManager"),X=function(){var e,t,n='<a href="https://www.tinymce.com/docs/changelog/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">TinyMCE '+(e=V.majorVersion,t=V.minorVersion,0===e.indexOf("@")?"X.X.X":e+"."+t)+"</a>";return[{type:"label",html:O.translate(["You are using {0}",n])},{type:"spacer",flex:1},{text:"Close",onclick:function(){this.parent().parent().close()}}]},$=function(e,t){return function(){e.windowManager.open({title:"Help",bodyType:"tabpanel",layout:"flex",body:[E(),U(e)],buttons:X(),onPostRender:function(){this.getEl("title").innerHTML='<img src="'+t+'/img/logo.png" alt="TinyMCE Logo" style="display: inline-block; width: 200px; height: 50px">'}})}},Y=function(e,t){e.addCommand("mceHelp",$(e,t))},Z=function(e,t){e.addButton("help",{icon:"help",onclick:$(e,t)}),e.addMenuItem("help",{text:"Help",icon:"help",context:"help",onclick:$(e,t)})};i.add("help",function(e,t){Z(e,t),Y(e,t),e.shortcuts.add("Alt+0","Open help dialog","mceHelp")})}();
inc/admin/js/tinymce/plugins/hr/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"<hr />")})},o=function(n){n.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),n.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};n.add("hr",function(n){t(n),o(n)})}();
inc/admin/js/tinymce/plugins/image/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=function(e){return!1!==e.settings.image_dimensions},a=function(e){return!0===e.settings.image_advtab},f=function(e){return e.getParam("image_prepend_url","")},n=function(e){return e.getParam("image_class_list")},r=function(e){return!1!==e.settings.image_description},i=function(e){return!0===e.settings.image_title},o=function(e){return!0===e.settings.image_caption},l=function(e){return e.getParam("image_list",!1)},u=function(e){return e.getParam("images_upload_url",!1)},c=function(e){return e.getParam("images_upload_handler",!1)},s=function(e){return e.getParam("images_upload_url")},g=function(e){return e.getParam("images_upload_handler")},m=function(e){return e.getParam("images_upload_base_path")},p=function(e){return e.getParam("images_upload_credentials")},h="undefined"!=typeof window?window:Function("return this;")(),v=function(e,t){for(var n=t!==undefined&&null!==t?t:h,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n},b=function(e,t){var n=e.split(".");return v(n,t)},t={getOrDie:function(e,t){var n=b(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n}};function y(){return new(t.getOrDie("FileReader"))}var x=tinymce.util.Tools.resolve("tinymce.util.Promise"),w=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=tinymce.util.Tools.resolve("tinymce.util.XHR"),N=function(e,t){return Math.max(parseInt(e,10),parseInt(t,10))},C=function(e,n){var r=document.createElement("img");function t(e,t){r.parentNode&&r.parentNode.removeChild(r),n({width:e,height:t})}r.onload=function(){t(N(r.width,r.clientWidth),N(r.height,r.clientHeight))},r.onerror=function(){t(0,0)};var i=r.style;i.visibility="hidden",i.position="fixed",i.bottom=i.left="0px",i.width=i.height="auto",document.body.appendChild(r),r.src=e},A=function(e,i,t){return function n(e,r){return r=r||[],w.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=n(e.menu):(t.value=e.value,i(t)),r.push(t)}),r}(e,t||[])},_=function(e){return e&&(e=e.replace(/px$/,"")),e},T=function(e){return 0<e.length&&/^[0-9]+$/.test(e)&&(e+="px"),e},O=function(e){if(e.margin){var t=e.margin.split(" ");switch(t.length){case 1:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[0],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[0];break;case 2:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[1];break;case 3:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[1];break;case 4:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[3]}delete e.margin}return e},R=function(e,t){var n=l(e);"string"==typeof n?S.send({url:n,success:function(e){t(JSON.parse(e))}}):"function"==typeof n?n(t):t(n)},P=function(e,t,n){function r(){n.onload=n.onerror=null,e.selection&&(e.selection.select(n),e.nodeChanged())}n.onload=function(){t.width||t.height||!d(e)||e.dom.setAttribs(n,{width:n.clientWidth,height:n.clientHeight}),r()},n.onerror=r},I=function(r){return new x(function(e,t){var n=new y;n.onload=function(){e(n.result)},n.onerror=function(){t(y.error.message)},n.readAsDataURL(r)})},L=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),U=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},E={isString:U("string"),isObject:U("object"),isArray:U("array"),isNull:U("null"),isBoolean:U("boolean"),isUndefined:U("undefined"),isFunction:U("function"),isNumber:U("number")},M=function(a){return function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var i=e[r];for(var o in i)i.hasOwnProperty(o)&&(n[o]=a(n[o],i[o]))}return n}},j=M(function(e,t){return E.isObject(e)&&E.isObject(t)?j(e,t):t}),k=M(function(e,t){return t}),D={deepMerge:j,merge:k},z=L.DOM,B=function(e){return e.style.marginLeft&&e.style.marginRight&&e.style.marginLeft===e.style.marginRight?_(e.style.marginLeft):""},H=function(e){return e.style.marginTop&&e.style.marginBottom&&e.style.marginTop===e.style.marginBottom?_(e.style.marginTop):""},F=function(e){return e.style.borderWidth?_(e.style.borderWidth):""},W=function(e,t){return e.hasAttribute(t)?e.getAttribute(t):""},J=function(e,t){return e.style[t]?e.style[t]:""},V=function(e){return null!==e.parentNode&&"FIGURE"===e.parentNode.nodeName},G=function(e,t,n){e.setAttribute(t,n)},$=function(e){var t,n,r,i;V(e)?(i=(r=e).parentNode,z.insertAfter(r,i),z.remove(i)):(t=e,n=z.create("figure",{"class":"image"}),z.insertAfter(n,t),n.appendChild(t),n.appendChild(z.create("figcaption",{contentEditable:!0},"Caption")),n.contentEditable="false")},X=function(e,t){var n=e.getAttribute("style"),r=t(null!==n?n:"");0<r.length?(e.setAttribute("style",r),e.setAttribute("data-mce-style",r)):e.removeAttribute("style")},q=function(e,r){return function(e,t,n){e.style[t]?(e.style[t]=T(n),X(e,r)):G(e,t,n)}},K=function(e,t){return e.style[t]?_(e.style[t]):W(e,t)},Q=function(e,t){var n=T(t);e.style.marginLeft=n,e.style.marginRight=n},Y=function(e,t){var n=T(t);e.style.marginTop=n,e.style.marginBottom=n},Z=function(e,t){var n=T(t);e.style.borderWidth=n},ee=function(e,t){e.style.borderStyle=t},te=function(e){return"FIGURE"===e.nodeName},ne=function(e,t){var n=document.createElement("img");return G(n,"style",t.style),(B(n)||""!==t.hspace)&&Q(n,t.hspace),(H(n)||""!==t.vspace)&&Y(n,t.vspace),(F(n)||""!==t.border)&&Z(n,t.border),(J(n,"borderStyle")||""!==t.borderStyle)&&ee(n,t.borderStyle),e(n.getAttribute("style"))},re=function(e,t){return{src:W(t,"src"),alt:W(t,"alt"),title:W(t,"title"),width:K(t,"width"),height:K(t,"height"),"class":W(t,"class"),style:e(W(t,"style")),caption:V(t),hspace:B(t),vspace:H(t),border:F(t),borderStyle:J(t,"borderStyle")}},ie=function(e,t,n,r,i){n[r]!==t[r]&&i(e,r,n[r])},oe=function(r,i){return function(e,t,n){r(e,n),X(e,i)}},ae=function(e,t,n){var r=re(e,n);ie(n,r,t,"caption",function(e,t,n){return $(e)}),ie(n,r,t,"src",G),ie(n,r,t,"alt",G),ie(n,r,t,"title",G),ie(n,r,t,"width",q(0,e)),ie(n,r,t,"height",q(0,e)),ie(n,r,t,"class",G),ie(n,r,t,"style",oe(function(e,t){return G(e,"style",t)},e)),ie(n,r,t,"hspace",oe(Q,e)),ie(n,r,t,"vspace",oe(Y,e)),ie(n,r,t,"border",oe(Z,e)),ie(n,r,t,"borderStyle",oe(ee,e))},le=function(e,t){var n=e.dom.styles.parse(t),r=O(n),i=e.dom.styles.parse(e.dom.styles.serialize(r));return e.dom.styles.serialize(i)},ue=function(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"figure.image");return n?e.dom.select("img",n)[0]:t&&("IMG"!==t.nodeName||t.getAttribute("data-mce-object")||t.getAttribute("data-mce-placeholder"))?null:t},ce=function(t,e){var n=t.dom,r=n.getParent(e.parentNode,function(e){return t.schema.getTextBlockElements()[e.nodeName]});return r?n.split(r,e):e},se=function(t){var e=ue(t);return e?re(function(e){return le(t,e)},e):{src:"",alt:"",title:"",width:"",height:"","class":"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:""}},de=function(t,e){var n=function(e,t){var n=document.createElement("img");if(ae(e,D.merge(t,{caption:!1}),n),G(n,"alt",t.alt),t.caption){var r=z.create("figure",{"class":"image"});return r.appendChild(n),r.appendChild(z.create("figcaption",{contentEditable:!0},"Caption")),r.contentEditable="false",r}return n}(function(e){return le(t,e)},e);t.dom.setAttrib(n,"data-mce-id","__mcenew"),t.focus(),t.selection.setContent(n.outerHTML);var r=t.dom.select('*[data-mce-id="__mcenew"]')[0];if(t.dom.setAttrib(r,"data-mce-id",null),te(r)){var i=ce(t,r);t.selection.select(i)}else t.selection.select(r)},fe=function(e,t){var n=ue(e);n?t.src?function(t,e){var n,r=ue(t);if(ae(function(e){return le(t,e)},e,r),n=r,t.dom.setAttrib(n,"src",n.getAttribute("src")),te(r.parentNode)){var i=r.parentNode;ce(t,i),t.selection.select(r.parentNode)}else t.selection.select(r),P(t,e,r)}(e,t):function(e,t){if(t){var n=e.dom.is(t.parentNode,"figure.image")?t.parentNode:t;e.dom.remove(n),e.focus(),e.nodeChanged(),e.dom.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}}(e,n):t.src&&de(e,t)},ge=function(n,r){r.find("#style").each(function(e){var t=ne(function(e){return le(n,e)},D.merge({src:"",alt:"",title:"",width:"",height:"","class":"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:""},r.toJSON()));e.value(t)})},me=function(t){return{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:(o=t,function(e){var t=o.dom,n=e.control.rootControl;if(a(o)){var r=n.toJSON(),i=t.parseStyle(r.style);n.find("#vspace").value(""),n.find("#hspace").value(""),((i=O(i))["margin-top"]&&i["margin-bottom"]||i["margin-right"]&&i["margin-left"])&&(i["margin-top"]===i["margin-bottom"]?n.find("#vspace").value(_(i["margin-top"])):n.find("#vspace").value(""),i["margin-right"]===i["margin-left"]?n.find("#hspace").value(_(i["margin-right"])):n.find("#hspace").value("")),i["border-width"]?n.find("#border").value(_(i["border-width"])):n.find("#border").value(""),i["border-style"]?n.find("#borderStyle").value(i["border-style"]):n.find("#borderStyle").value(""),n.find("#style").value(t.serializeStyle(t.parseStyle(t.serializeStyle(i))))}})},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,defaults:{type:"textbox",maxWidth:50,onchange:function(e){ge(t,e.control.rootControl)}},items:[{label:"Vertical space",name:"vspace"},{label:"Border width",name:"border"},{label:"Horizontal space",name:"hspace"},{label:"Border style",type:"listbox",name:"borderStyle",width:90,maxWidth:90,onselect:function(e){ge(t,e.control.rootControl)},values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]};var o},pe=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},he=function(e,t){var n=e.find("#width")[0],r=e.find("#height")[0],i=e.find("#constrain")[0];n&&r&&i&&t(n,r,i.checked())},ve=function(e,t,n){var r=e.state.get("oldVal"),i=t.state.get("oldVal"),o=e.value(),a=t.value();n&&r&&i&&o&&a&&(o!==r?(a=Math.round(o/r*a),isNaN(a)||t.value(a)):(o=Math.round(a/i*o),isNaN(o)||e.value(o))),pe(e,t)},be=function(e){he(e,ve)},ye=function(){var e=function(e){be(e.control.rootControl)};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},xe=function(e){he(e,pe)},we=be,Se=function(e){e.meta=e.control.rootControl.toJSON()},Ne=function(s,e){var t=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:function(e){var t,n,r,i,o,a,l,u,c;n=s,a=(t=e).meta||{},l=t.control,u=l.rootControl,(c=u.find("#image-list")[0])&&c.value(n.convertURL(l.value(),"src")),w.each(a,function(e,t){u.find("#"+t).value(e)}),a.width||a.height||(r=n.convertURL(l.value(),"src"),i=f(n),o=new RegExp("^(?:[a-z]+:)?//","i"),i&&!o.test(r)&&r.substring(0,i.length)!==i&&(r=i+r),l.value(r),C(n.documentBaseURI.toAbsolute(l.value()),function(e){e.width&&e.height&&d(n)&&(u.find("#width").value(e.width),u.find("#height").value(e.height),xe(u))}))},onbeforecall:Se},e];return r(s)&&t.push({name:"alt",type:"textbox",label:"Image description"}),i(s)&&t.push({name:"title",type:"textbox",label:"Image Title"}),d(s)&&t.push(ye()),n(s)&&t.push({name:"class",type:"listbox",label:"Class",values:A(n(s),function(e){e.value&&(e.textStyle=function(){return s.formatter.getCssText({inline:"img",classes:[e.value]})})})}),o(s)&&t.push({name:"caption",type:"checkbox",label:"Caption"}),t},Ce=function(e,t){return{title:"General",type:"form",items:Ne(e,t)}},Ae=Ne,_e=function(){return t.getOrDie("URL")},Te=function(e){return _e().createObjectURL(e)},Oe=function(e){_e().revokeObjectURL(e)},Re=tinymce.util.Tools.resolve("tinymce.ui.Factory");function Pe(){return new(t.getOrDie("XMLHttpRequest"))}var Ie=function(){};function Le(a){var t=function(e,r,i,t){var o,n;(o=new Pe).open("POST",a.url),o.withCredentials=a.credentials,o.upload.onprogress=function(e){t(e.loaded/e.total*100)},o.onerror=function(){i("Image upload failed due to a XHR Transport error. Code: "+o.status)},o.onload=function(){var e,t,n;o.status<200||300<=o.status?i("HTTP Error: "+o.status):(e=JSON.parse(o.responseText))&&"string"==typeof e.location?r((t=a.basePath,n=e.location,t?t.replace(/\/$/,"")+"/"+n.replace(/^\//,""):n)):i("Invalid JSON: "+o.responseText)},(n=new FormData).append("file",e.blob(),e.filename()),o.send(n)};return a=w.extend({credentials:!1,handler:t},a),{upload:function(e){return a.url||a.handler!==t?(r=e,i=a.handler,new x(function(e,t){try{i(r,e,t,Ie)}catch(n){t(n.message)}})):x.reject("Upload url missing from the settings.");var r,i}}}var Ue=function(u){return function(e){var t=Re.get("Throbber"),n=e.control.rootControl,r=new t(n.getEl()),i=e.control.value(),o=Te(i),a=Le({url:s(u),basePath:m(u),credentials:p(u),handler:g(u)}),l=function(){r.hide(),Oe(o)};return r.show(),I(i).then(function(e){var t=u.editorUpload.blobCache.create({blob:i,blobUri:o,name:i.name?i.name.replace(/\.[^\.]+$/,""):null,base64:e.split(",")[1]});return a.upload(t).then(function(e){var t=n.find("#src");return t.value(e),n.find("tabpanel")[0].activateTab(0),t.fire("change"),l(),e})})["catch"](function(e){u.windowManager.alert(e),l()})}},Ee=".jpg,.jpeg,.png,.gif",Me=function(e){return{title:"Upload",type:"form",layout:"flex",direction:"column",align:"stretch",padding:"20 20 20 20",items:[{type:"container",layout:"flex",direction:"column",align:"center",spacing:10,items:[{text:"Browse for an image",type:"browsebutton",accept:Ee,onchange:Ue(e)},{text:"OR",type:"label"}]},{text:"Drop an image here",type:"dropzone",accept:Ee,height:100,onchange:Ue(e)}]}},je=function(e){return function(){return e}},ke=(je(!1),je(!0),function(o){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var a=new Array(arguments.length-1),n=1;n<arguments.length;n++)a[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var i=a.concat(n);return o.apply(null,i)}}),De=function(t,e){var n=e.control.getRoot();we(n),t.undoManager.transact(function(){var e=D.merge(se(t),n.toJSON());fe(t,e)}),t.editorUpload.uploadImagesAuto()};function ze(o){function e(e){var n,t,r=se(o);if(e&&(t={type:"listbox",label:"Image list",name:"image-list",values:A(e,function(e){e.value=o.convertURL(e.value||e.url,"src")},[{text:"None",value:""}]),value:r.src&&o.convertURL(r.src,"src"),onselect:function(e){var t=n.find("#alt");(!t.value()||e.lastControl&&t.value()===e.lastControl.text())&&t.value(e.control.text()),n.find("#src").value(e.control.value()).fire("change")},onPostRender:function(){t=this}}),a(o)||u(o)||c(o)){var i=[Ce(o,t)];a(o)&&i.push(me(o)),(u(o)||c(o))&&i.push(Me(o)),n=o.windowManager.open({title:"Insert/edit image",data:r,bodyType:"tabpanel",body:i,onSubmit:ke(De,o)})}else n=o.windowManager.open({title:"Insert/edit image",data:r,body:Ae(o,t),onSubmit:ke(De,o)});xe(n)}return{open:function(){R(o,e)}}}var Be=function(e){e.addCommand("mceImage",ze(e).open)},He=function(o){return function(e){for(var t,n,r=e.length,i=function(e){e.attr("contenteditable",o?"true":null)};r--;)t=e[r],(n=t.attr("class"))&&/\bimage\b/.test(n)&&(t.attr("contenteditable",o?"false":null),w.each(t.getAll("figcaption"),i))}},Fe=function(e){e.on("preInit",function(){e.parser.addNodeFilter("figure",He(!0)),e.serializer.addNodeFilter("figure",He(!1))})},We=function(e){e.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:ze(e).open,stateSelector:"img:not([data-mce-object],[data-mce-placeholder]),figure.image"}),e.addMenuItem("image",{icon:"image",text:"Image",onclick:ze(e).open,context:"insert",prependToContext:!0})};e.add("image",function(e){Fe(e),We(e),Be(e)})}();
inc/admin/js/tinymce/plugins/imagetools/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var r=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return r(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),Y=tinymce.util.Tools.resolve("tinymce.util.Tools");function n(t,e){return i(document.createElement("canvas"),t,e)}function o(t){return t.getContext("2d")}function i(t,e,n){return t.width=e,t.height=n,t}var a,u,c,l,h={create:n,clone:function(t){var e;return o(e=n(t.width,t.height)).drawImage(t,0,0),e},resize:i,get2dContext:o,get3dContext:function(t){var e=null;try{e=t.getContext("webgl")||t.getContext("experimental-webgl")}catch(n){}return e||(e=null),e}},p={getWidth:function(t){return t.naturalWidth||t.width},getHeight:function(t){return t.naturalHeight||t.height}},g=window.Promise?window.Promise:function(){var t=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],l(t,r(o,this),r(a,this))},e=t.immediateFn||"function"==typeof setImmediate&&setImmediate||function(t){setTimeout(t,1)};function r(t,e){return function(){t.apply(e,arguments)}}var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(r){var o=this;null!==this._state?e(function(){var t=o._state?r.onFulfilled:r.onRejected;if(null!==t){var e;try{e=t(o._value)}catch(n){return void r.reject(n)}r.resolve(e)}else(o._state?r.resolve:r.reject)(o._value)}):this._deferreds.push(r)}function o(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void l(r(e,t),r(o,this),r(a,this))}this._state=!0,this._value=t,u.call(this)}catch(n){a.call(this,n)}}function a(t){this._state=!1,this._value=t,u.call(this)}function u(){for(var t=0,e=this._deferreds.length;t<e;t++)i.call(this,this._deferreds[t]);this._deferreds=null}function c(t,e,n,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=r}function l(t,e,n){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,n(t))})}catch(o){if(r)return;r=!0,n(o)}}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype.then=function(n,r){var o=this;return new t(function(t,e){i.call(o,new c(n,r,t,e))})},t.all=function(){var c=Array.prototype.slice.call(1===arguments.length&&n(arguments[0])?arguments[0]:arguments);return new t(function(o,i){if(0===c.length)return o([]);var a=c.length;function u(e,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void n.call(t,function(t){u(e,t)},i)}c[e]=t,0==--a&&o(c)}catch(r){i(r)}}for(var t=0;t<c.length;t++)u(t,c[t])})},t.resolve=function(e){return e&&"object"==typeof e&&e.constructor===t?e:new t(function(t){t(e)})},t.reject=function(n){return new t(function(t,e){e(n)})},t.race=function(o){return new t(function(t,e){for(var n=0,r=o.length;n<r;n++)o[n].then(t,e)})},t}(),s=function(t){return function(){return t}},f=s(!1),d=s(!0),m={noop:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},noarg:function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n()}},compose:function(n,r){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(r.apply(null,arguments))}},constant:s,identity:function(t){return t},tripleEquals:function(t,e){return t===e},curry:function(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var a=new Array(arguments.length-1),n=1;n<arguments.length;n++)a[n-1]=arguments[n];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var o=a.concat(n);return i.apply(null,o)}},not:function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return!n.apply(null,arguments)}},die:function(t){return function(){throw new Error(t)}},apply:function(t){return t()},call:function(t){t()},never:f,always:d},v=m.never,y=m.always,b=function(){return w},w=(l={fold:function(t,e){return t()},is:v,isSome:v,isNone:y,getOr:c=function(t){return t},getOrThunk:u=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},or:c,orThunk:u,map:b,ap:b,each:function(){},bind:b,flatten:b,exists:v,forall:y,filter:b,equals:a=function(t){return t.isNone()},equals_:a,toArray:function(){return[]},toString:m.constant("none()")},Object.freeze&&Object.freeze(l),l),x=function(n){var t=function(){return n},e=function(){return o},r=function(t){return t(n)},o={fold:function(t,e){return e(n)},is:function(t){return n===t},isSome:y,isNone:v,getOr:t,getOrThunk:t,getOrDie:t,or:e,orThunk:e,map:function(t){return x(t(n))},ap:function(t){return t.fold(b,function(t){return x(t(n))})},each:function(t){t(n)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(n)?o:w},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(v,function(t){return e(n,t)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},R={some:x,none:b,from:function(t){return null===t||t===undefined?w:x(t)}},I="undefined"!=typeof window?window:Function("return this;")(),T=function(t,e){for(var n=e!==undefined&&null!==e?e:I,r=0;r<t.length&&n!==undefined&&null!==n;++r)n=n[t[r]];return n},k=function(t,e){var n=t.split(".");return T(n,e)},C={getOrDie:function(t,e){var n=k(t,e);if(n===undefined||null===n)throw t+" not available on this browser";return n}};function B(){return new(C.getOrDie("FileReader"))}var j={atob:function(t){return C.getOrDie("atob")(t)},requestAnimationFrame:function(t){C.getOrDie("requestAnimationFrame")(t)}};function A(u){return new g(function(t,e){var n=URL.createObjectURL(u),r=new Image,o=function(){r.removeEventListener("load",i),r.removeEventListener("error",a)};function i(){o(),t(r)}function a(){o(),e("Unable to load data of type "+u.type+": "+n)}r.addEventListener("load",i),r.addEventListener("error",a),r.src=n,r.complete&&i()})}function U(r){return new g(function(t,n){var e=new XMLHttpRequest;e.open("GET",r,!0),e.responseType="blob",e.onload=function(){200==this.status&&t(this.response)},e.onerror=function(){var t,e=this;n(0===this.status?((t=new Error("No access to download image")).code=18,t.name="SecurityError",t):new Error("Error "+e.status+" downloading image"))},e.send()})}function M(t){var e=t.split(","),n=/data:([^;]+)/.exec(e[0]);if(!n)return R.none();for(var r,o,i,a=n[1],u=e[1],c=j.atob(u),l=c.length,s=Math.ceil(l/1024),f=new Array(s),d=0;d<s;++d){for(var h=1024*d,p=Math.min(h+1024,l),g=new Array(p-h),m=h,v=0;m<p;++v,++m)g[v]=c[m].charCodeAt(0);f[d]=(r=g,new(C.getOrDie("Uint8Array"))(r))}return R.some((o=f,i={type:a},new(C.getOrDie("Blob"))(o,i)))}function O(n){return new g(function(t,e){M(n).fold(function(){e("uri is not base64: "+n)},t)})}function z(n){return new g(function(t){var e=new B;e.onloadend=function(){t(e.result)},e.readAsDataURL(n)})}var D={blobToImage:A,imageToBlob:function(t){var e=t.src;return 0===e.indexOf("data:")?O(e):U(e)},blobToArrayBuffer:function(n){return new g(function(t){var e=new B;e.onloadend=function(){t(e.result)},e.readAsArrayBuffer(n)})},blobToDataUri:z,blobToBase64:function(t){return z(t).then(function(t){return t.split(",")[1]})},dataUriToBlobSync:M,canvasToBlob:function(t,n,r){return n=n||"image/png",HTMLCanvasElement.prototype.toBlob?new g(function(e){t.toBlob(function(t){e(t)},n,r)}):O(t.toDataURL(n,r))},canvasToDataURL:function(t,e,n){return e=e||"image/png",t.then(function(t){return t.toDataURL(e,n)})},blobToCanvas:function(t){return A(t).then(function(t){var e,n;return e=t,URL.revokeObjectURL(e.src),n=h.create(p.getWidth(t),p.getHeight(t)),h.get2dContext(n).drawImage(t,0,0),n})},uriToBlob:function(t){return 0===t.indexOf("blob:")?U(t):0===t.indexOf("data:")?O(t):null}},S=function(t){return D.blobToImage(t)},E=function(t){return D.imageToBlob(t)};function _(t,e,n){var r=e.type;function o(e,n){return t.then(function(t){return D.canvasToDataURL(t,e,n)})}return{getType:m.constant(r),toBlob:function(){return g.resolve(e)},toDataURL:function(){return n},toBase64:function(){return n.split(",")[1]},toAdjustedBlob:function(e,n){return t.then(function(t){return D.canvasToBlob(t,e,n)})},toAdjustedDataURL:o,toAdjustedBase64:function(t,e){return o(t,e).then(function(t){return t.split(",")[1]})},toCanvas:function(){return t.then(h.clone)}}}function L(e){return D.blobToDataUri(e).then(function(t){return _(D.blobToCanvas(e),e,t)})}var H={fromBlob:L,fromCanvas:function(e,t){return D.canvasToBlob(e,t).then(function(t){return _(g.resolve(e),t,e.toDataURL())})},fromImage:function(t){return D.imageToBlob(t).then(function(t){return L(t)})},fromBlobAndUrlSync:function(t,e){return _(D.blobToCanvas(t),t,e)}};function F(t,e,n){return n<(t=parseFloat(t))?t=n:t<e&&(t=e),t}var P=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10];function W(t,e){var n,r,o,i,a=[],u=new Array(10);for(n=0;n<5;n++){for(r=0;r<5;r++)a[r]=e[r+5*n];for(r=0;r<5;r++){for(o=i=0;o<5;o++)i+=t[r+5*o]*a[o];u[r+5*n]=i}}return u}function V(t,n){return n=F(n,0,1),t.map(function(t,e){return e%6==0?t=1-(1-t)*n:t*=n,F(t,0,1)})}var N={identity:function(){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]},adjust:V,multiply:W,adjustContrast:function(t,e){var n;return e=F(e,-1,1),W(t,[(n=(e*=100)<0?127+e/100*127:127*(n=0==(n=e%1)?P[e]:P[Math.floor(e)]*(1-n)+P[Math.floor(e)+1]*n)+127)/127,0,0,0,.5*(127-n),0,n/127,0,0,.5*(127-n),0,0,n/127,0,.5*(127-n),0,0,0,1,0,0,0,0,0,1])},adjustBrightness:function(t,e){return W(t,[1,0,0,0,e=F(255*e,-255,255),0,1,0,0,e,0,0,1,0,e,0,0,0,1,0,0,0,0,0,1])},adjustSaturation:function(t,e){var n;return W(t,[.3086*(1-(n=1+(0<(e=F(e,-1,1))?3*e:e)))+n,.6094*(1-n),.082*(1-n),0,0,.3086*(1-n),.6094*(1-n)+n,.082*(1-n),0,0,.3086*(1-n),.6094*(1-n),.082*(1-n)+n,0,0,0,0,0,1,0,0,0,0,0,1])},adjustHue:function(t,e){var n,r,o,i,a;return e=F(e,-180,180)/180*Math.PI,W(t,[(o=.213)+.787*(n=Math.cos(e))+(r=Math.sin(e))*-o,(i=.715)+n*-i+r*-i,(a=.072)+n*-a+.928*r,0,0,o+n*-o+.143*r,i+n*(1-i)+.14*r,a+n*-a+-.283*r,0,0,o+n*-o+-.787*r,i+n*-i+r*i,a+.928*n+r*a,0,0,0,0,0,1,0,0,0,0,0,1])},adjustColors:function(t,e,n,r){return W(t,[e=F(e,0,2),0,0,0,0,0,n=F(n,0,2),0,0,0,0,0,r=F(r,0,2),0,0,0,0,0,1,0,0,0,0,0,1])},adjustSepia:function(t,e){return W(t,V([.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0,0,0,0,0,1],e=F(e,0,1)))},adjustGrayscale:function(t,e){return W(t,V([.33,.34,.33,0,0,.33,.34,.33,0,0,.33,.34,.33,0,0,0,0,0,1,0,0,0,0,0,1],e=F(e,0,1)))}};function q(a,u){return a.toCanvas().then(function(t){return e=t,n=a.getType(),r=u,i=h.get2dContext(e),o=function(t,e){var n,r,o,i,a,u=t.data,c=e[0],l=e[1],s=e[2],f=e[3],d=e[4],h=e[5],p=e[6],g=e[7],m=e[8],v=e[9],y=e[10],b=e[11],w=e[12],x=e[13],R=e[14],I=e[15],T=e[16],k=e[17],C=e[18],B=e[19];for(a=0;a<u.length;a+=4)n=u[a],r=u[a+1],o=u[a+2],i=u[a+3],u[a]=n*c+r*l+o*s+i*f+d,u[a+1]=n*h+r*p+o*g+i*m+v,u[a+2]=n*y+r*b+o*w+i*x+R,u[a+3]=n*I+r*T+o*k+i*C+B;return t}(i.getImageData(0,0,e.width,e.height),r),i.putImageData(o,0,0),H.fromCanvas(e,n);var e,n,r,o,i})}function $(u,c){return u.toCanvas().then(function(t){return e=t,n=u.getType(),r=c,a=h.get2dContext(e),o=a.getImageData(0,0,e.width,e.height),i=a.getImageData(0,0,e.width,e.height),i=function(t,e,n){var r,o,i,a,u,c,l,s,f,d,h,p,g,m,v,y,b;function w(t,e,n){return n<t?t=n:t<e&&(t=e),t}for(i=Math.round(Math.sqrt(n.length)),a=Math.floor(i/2),r=t.data,o=e.data,y=t.width,b=t.height,c=0;c<b;c++)for(u=0;u<y;u++){for(l=s=f=0,h=0;h<i;h++)for(d=0;d<i;d++)p=w(u+d-a,0,y-1),g=w(c+h-a,0,b-1),m=4*(g*y+p),v=n[h*i+d],l+=r[m]*v,s+=r[m+1]*v,f+=r[m+2]*v;o[m=4*(c*y+u)]=w(l,0,255),o[m+1]=w(s,0,255),o[m+2]=w(f,0,255)}return e}(o,i,r),a.putImageData(i,0,0),H.fromCanvas(e,n);var e,n,r,o,i,a})}function X(u){return function(e,n){return e.toCanvas().then(function(t){return function(t,e,n){var r,o,i=h.get2dContext(t),a=new Array(256);for(o=0;o<a.length;o++)a[o]=u(o,n);return r=function(t,e){var n,r=t.data;for(n=0;n<r.length;n+=4)r[n]=e[r[n]],r[n+1]=e[r[n+1]],r[n+2]=e[r[n+2]];return t}(i.getImageData(0,0,t.width,t.height),a),i.putImageData(r,0,0),H.fromCanvas(t,e)}(t,e.getType(),n)})}}function G(n){return function(t,e){return q(t,n(N.identity(),e))}}function K(e){return function(t){return $(t,e)}}var J,Z={invert:(J=[-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0],function(t){return q(t,J)}),brightness:G(N.adjustBrightness),hue:G(N.adjustHue),saturate:G(N.adjustSaturation),contrast:G(N.adjustContrast),grayscale:G(N.adjustGrayscale),sepia:G(N.adjustSepia),colorize:function(t,e,n,r){return q(t,N.adjustColors(N.identity(),e,n,r))},sharpen:K([0,-1,0,-1,5,-1,0,-1,0]),emboss:K([-2,-1,0,-1,1,1,0,1,2]),gamma:X(function(t,e){return 255*Math.pow(t/255,1-e)}),exposure:X(function(t,e){return 255*(1-Math.exp(-t/255*e))}),colorFilter:q,convoluteFilter:$},Q={scale:function e(t,n,r){var o=p.getWidth(t),i=p.getHeight(t),a=n/o,u=r/i,c=!1;(a<.5||2<a)&&(a=a<.5?.5:2,c=!0),(u<.5||2<u)&&(u=u<.5?.5:2,c=!0);var l,s,f,d=(l=t,s=a,f=u,new g(function(t){var e=p.getWidth(l),n=p.getHeight(l),r=Math.floor(e*s),o=Math.floor(n*f),i=h.create(r,o),a=h.get2dContext(i);a.drawImage(l,0,0,e,n,0,0,r,o),t(i)}));return c?d.then(function(t){return e(t,n,r)}):d}},tt={rotate:function(c,l){return c.toCanvas().then(function(t){return e=t,n=c.getType(),r=l,o=h.create(e.width,e.height),i=h.get2dContext(o),90!=(r=r<(u=a=0)?360+r:r)&&270!=r||h.resize(o,o.height,o.width),90!=r&&180!=r||(a=o.width),270!=r&&180!=r||(u=o.height),i.translate(a,u),i.rotate(r*Math.PI/180),i.drawImage(e,0,0),H.fromCanvas(o,n);var e,n,r,o,i,a,u})},flip:function(a,u){return a.toCanvas().then(function(t){return e=t,n=a.getType(),r=u,o=h.create(e.width,e.height),i=h.get2dContext(o),"v"==r?(i.scale(1,-1),i.drawImage(e,0,-o.height)):(i.scale(-1,1),i.drawImage(e,-o.width,0)),H.fromCanvas(o,n);var e,n,r,o,i})},crop:function(c,l,s,f,d){return c.toCanvas().then(function(t){return e=t,n=c.getType(),r=l,o=s,i=f,a=d,u=h.create(i,a),h.get2dContext(u).drawImage(e,-r,-o),H.fromCanvas(u,n);var e,n,r,o,i,a,u})},resize:function(e,n,r){return e.toCanvas().then(function(t){return Q.scale(t,n,r).then(function(t){return H.fromCanvas(t,e.getType())})})}},et={invert:function(t){return Z.invert(t)},sharpen:function(t){return Z.sharpen(t)},emboss:function(t){return Z.emboss(t)},brightness:function(t,e){return Z.brightness(t,e)},hue:function(t,e){return Z.hue(t,e)},saturate:function(t,e){return Z.saturate(t,e)},contrast:function(t,e){return Z.contrast(t,e)},grayscale:function(t,e){return Z.grayscale(t,e)},sepia:function(t,e){return Z.sepia(t,e)},colorize:function(t,e,n,r){return Z.colorize(t,e,n,r)},gamma:function(t,e){return Z.gamma(t,e)},exposure:function(t,e){return Z.exposure(t,e)},flip:function(t,e){return tt.flip(t,e)},crop:function(t,e,n,r,o){return tt.crop(t,e,n,r,o)},resize:function(t,e,n){return tt.resize(t,e,n)},rotate:function(t,e){return tt.rotate(t,e)}},nt=function(t){return t.toBlob()},rt={blobToImageResult:function(t){return H.fromBlob(t)},fromBlobAndUrlSync:function(t,e){return H.fromBlobAndUrlSync(t,e)},imageToImageResult:function(t){return H.fromImage(t)},imageResultToBlob:function(t,e,n){return e===undefined&&n===undefined?nt(t):t.toAdjustedBlob(e,n)},imageResultToOriginalBlob:nt,imageResultToDataURL:function(t){return t.toDataURL()}},ot=function(){return C.getOrDie("URL")},it={createObjectURL:function(t){return ot().createObjectURL(t)},revokeObjectURL:function(t){ot().revokeObjectURL(t)}},at=tinymce.util.Tools.resolve("tinymce.util.Delay"),ut=tinymce.util.Tools.resolve("tinymce.util.Promise"),ct=tinymce.util.Tools.resolve("tinymce.util.URI"),lt=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),st=tinymce.util.Tools.resolve("tinymce.ui.Factory"),ft=tinymce.util.Tools.resolve("tinymce.geom.Rect"),dt=function(n){return new ut(function(t){var e=function(){n.removeEventListener("load",e),t(n)};n.complete?t(n):n.addEventListener("load",e)})},ht=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),pt=tinymce.util.Tools.resolve("tinymce.util.Observable"),gt=tinymce.util.Tools.resolve("tinymce.util.VK"),mt=0,vt={create:function(t){return new(st.get("Control").extend({Defaults:{classes:"imagepanel"},selection:function(t){return arguments.length?(this.state.set("rect",t),this):this.state.get("rect")},imageSize:function(){var t=this.state.get("viewRect");return{w:t.w,h:t.h}},toggleCropRect:function(t){this.state.set("cropEnabled",t)},imageSrc:function(t){var o=this,i=new Image;i.src=t,dt(i).then(function(){var t,e,n=o.state.get("viewRect");if((e=o.$el.find("img"))[0])e.replaceWith(i);else{var r=document.createElement("div");r.className="mce-imagepanel-bg",o.getEl().appendChild(r),o.getEl().appendChild(i)}t={x:0,y:0,w:i.naturalWidth,h:i.naturalHeight},o.state.set("viewRect",t),o.state.set("rect",ft.inflate(t,-20,-20)),n&&n.w===t.w&&n.h===t.h||o.zoomFit(),o.repaintImage(),o.fire("load")})},zoom:function(t){return arguments.length?(this.state.set("zoom",t),this):this.state.get("zoom")},postRender:function(){return this.imageSrc(this.settings.imageSrc),this._super()},zoomFit:function(){var t,e,n,r,o,i;t=this.$el.find("img"),e=this.getEl().clientWidth,n=this.getEl().clientHeight,r=t[0].naturalWidth,o=t[0].naturalHeight,1<=(i=Math.min((e-10)/r,(n-10)/o))&&(i=1),this.zoom(i)},repaintImage:function(){var t,e,n,r,o,i,a,u,c,l,s;s=this.getEl(),c=this.zoom(),l=this.state.get("rect"),a=this.$el.find("img"),u=this.$el.find(".mce-imagepanel-bg"),o=s.offsetWidth,i=s.offsetHeight,n=a[0].naturalWidth*c,r=a[0].naturalHeight*c,t=Math.max(0,o/2-n/2),e=Math.max(0,i/2-r/2),a.css({left:t,top:e,width:n,height:r}),u.css({left:t,top:e,width:n,height:r}),this.cropRect&&(this.cropRect.setRect({x:l.x*c+t,y:l.y*c+e,w:l.w*c,h:l.h*c}),this.cropRect.setClampRect({x:t,y:e,w:n,h:r}),this.cropRect.setViewPortRect({x:0,y:0,w:o,h:i}))},bindStates:function(){var r=this;function n(t){r.cropRect=function(l,n,s,r,o){var f,a,t,i,e="mce-",u=e+"crid-"+mt++;function d(t,e){return{x:e.x-t.x,y:e.y-t.y,w:e.w,h:e.h}}function c(t,e,n,r){var o,i,a,u,c;o=e.x,i=e.y,a=e.w,u=e.h,o+=n*t.deltaX,i+=r*t.deltaY,(a+=n*t.deltaW)<20&&(a=20),(u+=r*t.deltaH)<20&&(u=20),c=l=ft.clamp({x:o,y:i,w:a,h:u},s,"move"===t.name),c=d(s,c),f.fire("updateRect",{rect:c}),g(c)}function h(e){function t(t,e){e.h<0&&(e.h=0),e.w<0&&(e.w=0),ht("#"+u+"-"+t,r).css({left:e.x,top:e.y,width:e.w,height:e.h})}Y.each(a,function(t){ht("#"+u+"-"+t.name,r).css({left:e.w*t.xMul+e.x,top:e.h*t.yMul+e.y})}),t("top",{x:n.x,y:n.y,w:n.w,h:e.y-n.y}),t("right",{x:e.x+e.w,y:e.y,w:n.w-e.x-e.w+n.x,h:e.h}),t("bottom",{x:n.x,y:e.y+e.h,w:n.w,h:n.h-e.y-e.h+n.y}),t("left",{x:n.x,y:e.y,w:e.x-n.x,h:e.h}),t("move",e)}function p(t){h(l=t)}function g(t){var e,n;p((e=s,{x:(n=t).x+e.x,y:n.y+e.y,w:n.w,h:n.h}))}return a=[{name:"move",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:0,deltaH:0,label:"Crop Mask"},{name:"nw",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:-1,deltaH:-1,label:"Top Left Crop Handle"},{name:"ne",xMul:1,yMul:0,deltaX:0,deltaY:1,deltaW:1,deltaH:-1,label:"Top Right Crop Handle"},{name:"sw",xMul:0,yMul:1,deltaX:1,deltaY:0,deltaW:-1,deltaH:1,label:"Bottom Left Crop Handle"},{name:"se",xMul:1,yMul:1,deltaX:0,deltaY:0,deltaW:1,deltaH:1,label:"Bottom Right Crop Handle"}],i=["top","right","bottom","left"],ht('<div id="'+u+'" class="'+e+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(r),Y.each(i,function(t){ht("#"+u,r).append('<div id="'+u+"-"+t+'"class="'+e+'croprect-block" style="display: none" data-mce-bogus="all">')}),Y.each(a,function(t){ht("#"+u,r).append('<div id="'+u+"-"+t.name+'" class="'+e+"croprect-handle "+e+"croprect-handle-"+t.name+'"style="display: none" data-mce-bogus="all" role="gridcell" tabindex="-1" aria-label="'+t.label+'" aria-grabbed="false">')}),t=Y.map(a,function(e){var n;return new(st.get("DragHelper"))(u,{document:r.ownerDocument,handle:u+"-"+e.name,start:function(){n=l},drag:function(t){c(e,n,t.deltaX,t.deltaY)}})}),h(l),ht(r).on("focusin focusout",function(t){ht(t.target).attr("aria-grabbed","focus"===t.type)}),ht(r).on("keydown",function(e){var i;function t(t,e,n,r,o){t.stopPropagation(),t.preventDefault(),c(i,n,r,o)}switch(Y.each(a,function(t){if(e.target.id===u+"-"+t.name)return i=t,!1}),e.keyCode){case gt.LEFT:t(e,0,l,-10,0);break;case gt.RIGHT:t(e,0,l,10,0);break;case gt.UP:t(e,0,l,0,-10);break;case gt.DOWN:t(e,0,l,0,10);break;case gt.ENTER:case gt.SPACEBAR:e.preventDefault(),o()}}),f=Y.extend({toggleVisibility:function(t){var e;e=Y.map(a,function(t){return"#"+u+"-"+t.name}).concat(Y.map(i,function(t){return"#"+u+"-"+t})).join(","),t?ht(e,r).show():ht(e,r).hide()},setClampRect:function(t){s=t,h(l)},setRect:p,getInnerRect:function(){return d(s,l)},setInnerRect:g,setViewPortRect:function(t){n=t,h(l)},destroy:function(){Y.each(t,function(t){t.destroy()}),t=[]}},pt)}(t,r.state.get("viewRect"),r.state.get("viewRect"),r.getEl(),function(){r.fire("crop")}),r.cropRect.on("updateRect",function(t){var e=t.rect,n=r.zoom();e={x:Math.round(e.x/n),y:Math.round(e.y/n),w:Math.round(e.w/n),h:Math.round(e.h/n)},r.state.set("rect",e)}),r.on("remove",r.cropRect.destroy)}r.state.on("change:cropEnabled",function(t){r.cropRect.toggleVisibility(t.value),r.repaintImage()}),r.state.on("change:zoom",function(){r.repaintImage()}),r.state.on("change:rect",function(t){var e=t.value;r.cropRect||n(e),r.cropRect.setRect(e)})}}))(t)}};function yt(t){return{blob:t,url:it.createObjectURL(t)}}function bt(t){t&&it.revokeObjectURL(t.url)}function wt(t){Y.each(t,bt)}function xt(i,a,t,e){var u,n,r,c,o,l,s,f,d,h,p,g,m,v,y,b,w,x,R,I,T,k,C,B,j,A,U,M=function(){var n=[],r=-1;function t(){return 0<r}function e(){return-1!==r&&r<n.length-1}return{data:n,add:function(t){var e;return e=n.splice(++r),n.push(t),{state:t,removed:e}},undo:function(){if(t())return n[--r]},redo:function(){if(e())return n[++r]},canUndo:t,canRedo:e}}(),O=function(t){return i.rtl?t.reverse():t};function z(t){var e,n,r,o;e=u.find("#w")[0],n=u.find("#h")[0],r=parseInt(e.value(),10),o=parseInt(n.value(),10),u.find("#constrain")[0].checked()&&B&&j&&r&&o&&("w"===t.control.settings.name?(o=Math.round(r*A),n.value(o)):(r=Math.round(o*U),e.value(r))),B=r,j=o}function D(t){return Math.round(100*t)+"%"}function S(){u.find("#undo").disabled(!M.canUndo()),u.find("#redo").disabled(!M.canRedo()),u.statusbar.find("#save").disabled(!M.canUndo())}function E(){u.find("#undo").disabled(!0),u.find("#redo").disabled(!0)}function _(t){t&&f.imageSrc(t.url)}function L(e){return function(){var t=Y.grep(C,function(t){return t.settings.name!==e});Y.each(t,function(t){t.hide()}),e.show(),e.focus()}}function H(t){_(c=yt(t))}function F(t){_(a=yt(t)),wt(M.add(a).removed),S()}function P(){var e=f.selection();rt.blobToImageResult(a.blob).then(function(t){et.crop(t,e.x,e.y,e.w,e.h).then($).then(function(t){F(t),V()})})}var W=function(e){var n=[].slice.call(arguments,1);return function(){var t=c||a;rt.blobToImageResult(t.blob).then(function(t){e.apply(this,[t].concat(n)).then($).then(H)})}};function V(){_(a),bt(c),L(n)(),S()}function N(){c?(F(c.blob),V()):function t(e,n){c?n():setTimeout(function(){0<e--?t(e,n):i.windowManager.alert("Error: failed to apply image operation.")},10)}(100,N)}function q(t){return st.create("Form",{layout:"flex",direction:"row",labelGap:5,border:"0 0 1 0",align:"center",pack:"center",padding:"0 10 0 10",spacing:5,flex:0,minHeight:60,defaults:{classes:"imagetool",type:"button"},items:t})}var $=function(t){return t.toBlob()};function X(t,e){return q(O([{text:"Back",onclick:V},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:N}])).hide().on("show",function(){E(),rt.blobToImageResult(a.blob).then(function(t){return e(t)}).then($).then(function(t){var e=yt(t);_(e),bt(c),c=e})})}function G(t,n,e,r,o){return q(O([{text:"Back",onclick:V},{type:"spacer",flex:1},{type:"slider",flex:1,ondragend:function(t){var e;e=t.value,rt.blobToImageResult(a.blob).then(function(t){return n(t,e)}).then($).then(function(t){var e=yt(t);_(e),bt(c),c=e})},minValue:i.rtl?o:r,maxValue:i.rtl?r:o,value:e,previewFilter:D},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:N}])).hide().on("show",function(){this.find("slider").value(e),E()})}o=q(O([{text:"Back",onclick:V},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:P}])).hide().on("show hide",function(t){f.toggleCropRect("show"===t.type)}).on("show",E),l=q(O([{text:"Back",onclick:V},{type:"spacer",flex:1},{type:"textbox",name:"w",label:"Width",size:4,onkeyup:z},{type:"textbox",name:"h",label:"Height",size:4,onkeyup:z},{type:"checkbox",name:"constrain",text:"Constrain proportions",checked:!0,onchange:function(t){!0===t.control.value()&&(A=j/B,U=B/j)}},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:"submit"}])).hide().on("submit",function(t){var e=parseInt(u.find("#w").value(),10),n=parseInt(u.find("#h").value(),10);t.preventDefault(),function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=[].slice.call(arguments,1);return function(){rt.blobToImageResult(a.blob).then(function(t){e.apply(this,[t].concat(r)).then($).then(F)})}}(et.resize,e,n)(),V()}).on("show",E),s=q(O([{text:"Back",onclick:V},{type:"spacer",flex:1},{icon:"fliph",tooltip:"Flip horizontally",onclick:W(et.flip,"h")},{icon:"flipv",tooltip:"Flip vertically",onclick:W(et.flip,"v")},{icon:"rotateleft",tooltip:"Rotate counterclockwise",onclick:W(et.rotate,-90)},{icon:"rotateright",tooltip:"Rotate clockwise",onclick:W(et.rotate,90)},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:N}])).hide().on("show",E),p=X(0,et.invert),R=X(0,et.sharpen),I=X(0,et.emboss),g=G(0,et.brightness,0,-1,1),m=G(0,et.hue,180,0,360),v=G(0,et.saturate,0,-1,1),y=G(0,et.contrast,0,-1,1),b=G(0,et.grayscale,0,0,1),w=G(0,et.sepia,0,0,1),x=function(t,o){function e(){var e,n,r;e=u.find("#r")[0].value(),n=u.find("#g")[0].value(),r=u.find("#b")[0].value(),rt.blobToImageResult(a.blob).then(function(t){return o(t,e,n,r)}).then($).then(function(t){var e=yt(t);_(e),bt(c),c=e})}var n=i.rtl?2:0,r=i.rtl?0:2;return q(O([{text:"Back",onclick:V},{type:"spacer",flex:1},{type:"slider",label:"R",name:"r",minValue:n,value:1,maxValue:r,ondragend:e,previewFilter:D},{type:"slider",label:"G",name:"g",minValue:n,value:1,maxValue:r,ondragend:e,previewFilter:D},{type:"slider",label:"B",name:"b",minValue:n,value:1,maxValue:r,ondragend:e,previewFilter:D},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:N}])).hide().on("show",function(){u.find("#r,#g,#b").value(1),E()})}(0,et.colorize),T=G(0,et.gamma,0,-1,1),k=G(0,et.exposure,1,0,2),r=q(O([{text:"Back",onclick:V},{type:"spacer",flex:1},{text:"hue",icon:"hue",onclick:L(m)},{text:"saturate",icon:"saturate",onclick:L(v)},{text:"sepia",icon:"sepia",onclick:L(w)},{text:"emboss",icon:"emboss",onclick:L(I)},{text:"exposure",icon:"exposure",onclick:L(k)},{type:"spacer",flex:1}])).hide(),n=q(O([{tooltip:"Crop",icon:"crop",onclick:L(o)},{tooltip:"Resize",icon:"resize2",onclick:L(l)},{tooltip:"Orientation",icon:"orientation",onclick:L(s)},{tooltip:"Brightness",icon:"sun",onclick:L(g)},{tooltip:"Sharpen",icon:"sharpen",onclick:L(R)},{tooltip:"Contrast",icon:"contrast",onclick:L(y)},{tooltip:"Color levels",icon:"drop",onclick:L(x)},{tooltip:"Gamma",icon:"gamma",onclick:L(T)},{tooltip:"Invert",icon:"invert",onclick:L(p)}])),f=vt.create({flex:1,imageSrc:a.url}),d=st.create("Container",{layout:"flex",direction:"column",pack:"start",border:"0 1 0 0",padding:5,spacing:5,items:[{type:"button",icon:"undo",tooltip:"Undo",name:"undo",onclick:function(){_(a=M.undo()),S()}},{type:"button",icon:"redo",tooltip:"Redo",name:"redo",onclick:function(){_(a=M.redo()),S()}},{type:"button",icon:"zoomin",tooltip:"Zoom in",onclick:function(){var t=f.zoom();t<2&&(t+=.1),f.zoom(t)}},{type:"button",icon:"zoomout",tooltip:"Zoom out",onclick:function(){var t=f.zoom();.1<t&&(t-=.1),f.zoom(t)}}]}),h=st.create("Container",{type:"container",layout:"flex",direction:"row",align:"stretch",flex:1,items:O([d,f])}),C=[n,o,l,s,r,p,g,m,v,y,b,w,x,R,I,T,k],(u=i.windowManager.open({layout:"flex",direction:"column",align:"stretch",minWidth:Math.min(lt.DOM.getViewPort().w,800),minHeight:Math.min(lt.DOM.getViewPort().h,650),title:"Edit image",items:C.concat([h]),buttons:O([{text:"Save",name:"save",subtype:"primary",onclick:function(){t(a.blob),u.close()}},{text:"Cancel",onclick:"close"}])})).on("close",function(){e(),wt(M.data),c=M=null}),M.add(a),S(),f.on("load",function(){B=f.imageSize().w,j=f.imageSize().h,A=j/B,U=B/j,u.find("#w").value(B),u.find("#h").value(j)}),f.on("crop",P)}var Rt={edit:function(r,t){return new ut(function(e,n){return t.toBlob().then(function(t){xt(r,yt(t),e,n)})})}},It={getImageSize:function(t){var e,n;function r(t){return/^[0-9\.]+px$/.test(t)}return e=t.style.width,n=t.style.height,e||n?r(e)&&r(n)?{w:parseInt(e,10),h:parseInt(n,10)}:null:(e=t.width,n=t.height,e&&n?{w:parseInt(e,10),h:parseInt(n,10)}:null)},setImageSize:function(t,e){var n,r;e&&(n=t.style.width,r=t.style.height,(n||r)&&(t.style.width=e.w+"px",t.style.height=e.h+"px",t.removeAttribute("data-mce-style")),n=t.width,r=t.height,(n||r)&&(t.setAttribute("width",e.w),t.setAttribute("height",e.h)))},getNaturalImageSize:function(t){return{w:t.naturalWidth,h:t.naturalHeight}}},Tt=function(e){return function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&Array.prototype.isPrototypeOf(t)?"array":"object"===e&&String.prototype.isPrototypeOf(t)?"string":e}(t)===e}},kt={isString:Tt("string"),isObject:Tt("object"),isArray:Tt("array"),isNull:Tt("null"),isBoolean:Tt("boolean"),isUndefined:Tt("undefined"),isFunction:Tt("function"),isNumber:Tt("number")},Ct=(Array.prototype.indexOf,undefined,Array.prototype.push,Array.prototype.slice,kt.isFunction(Array.from)&&Array.from,function(t,e){for(var n=0,r=t.length;n<r;n++){var o=t[n];if(e(o,n,t))return R.some(o)}return R.none()});function Bt(){return new(C.getOrDie("XMLHttpRequest"))}var jt=function(t){return null!==t&&t!==undefined},At=function(t,e){var n;return n=e.reduce(function(t,e){return jt(t)?t[e]:undefined},t),jt(n)?n:null},Ut=function(e){return new ut(function(n){var t=new B;t.onload=function(t){var e=t.target;n(e.result)},t.readAsText(e)})},Mt=function(e,r,o){return new ut(function(t){var n;(n=new Bt).onreadystatechange=function(){4===n.readyState&&t({status:n.status,blob:this.response})},n.open("GET",e,!0),n.withCredentials=o,Y.each(r,function(t,e){n.setRequestHeader(e,t)}),n.responseType="blob",n.send()})},Ot=function(t){var e;try{e=JSON.parse(t)}catch(n){}return e},zt=[{code:404,message:"Could not find Image Proxy"},{code:403,message:"Rejected request"},{code:0,message:"Incorrect Image Proxy URL"}],Dt=[{type:"key_missing",message:"The request did not include an api key."},{type:"key_not_found",message:"The provided api key could not be found."},{type:"domain_not_trusted",message:"The api key is not valid for the request origins."}],St=function(e){return"ImageProxy HTTP error: "+Ct(zt,function(t){return e===t.code}).fold(m.constant("Unknown ImageProxy error"),function(t){return t.message})},Et=function(t){var e=St(t);return ut.reject(e)},_t=function(e){return Ct(Dt,function(t){return t.type===e}).fold(m.constant("Unknown service error"),function(t){return t.message})},Lt=function(t,e){return Ut(e).then(function(t){var e,n,r=(e=Ot(t),"ImageProxy Service error: "+((n=At(e,["error","type"]))?_t(n):"Invalid JSON in service error message"));return ut.reject(r)})},Ht=function(t,e){return 400===(n=t)||403===n||500===n?Lt(0,e):Et(t);var n},Ft=Et,Pt=function(t,e){var n,r,o,i={"Content-Type":"application/json;charset=UTF-8","tiny-api-key":e};return Mt((n=t,r=e,o=-1===n.indexOf("?")?"?":"&",/[?&]apiKey=/.test(n)||!r?n:n+o+"apiKey="+encodeURIComponent(r)),i,!1).then(function(t){return t.status<200||300<=t.status?Ht(t.status,t.blob):ut.resolve(t.blob)})},Wt=function(t,e,n){return e?Pt(t,e):Mt(t,{},n).then(function(t){return t.status<200||300<=t.status?Ft(t.status):ut.resolve(t.blob)})},Vt=0,Nt=function(t,e){t.notificationManager.open({text:e,type:"error"})},qt=function(t){return t.selection.getNode()},$t=function(t,e){var n=e.src;return 0===n.indexOf("data:")||0===n.indexOf("blob:")||new ct(n).host===t.documentBaseURI.host},Xt=function(t,e){return-1!==Y.inArray(t.getParam("imagetools_cors_hosts",[],"string[]"),new ct(e.src).host)},Gt=function(t,e){var n,r,o,i,a=e.src;return Xt(t,e)?Wt(e.src,null,(r=t,o=e,-1!==Y.inArray(r.getParam("imagetools_credentials_hosts",[],"string[]"),new ct(o.src).host))):$t(t,e)?E(e):(a=t.getParam("imagetools_proxy"),a+=(-1===a.indexOf("?")?"?":"&")+"url="+encodeURIComponent(e.src),n=(i=t).getParam("api_key",i.getParam("imagetools_api_key","","string"),"string"),Wt(a,n,!1))},Yt=function(t){var e;return(e=t.editorUpload.blobCache.getByUri(qt(t).src))?ut.resolve(e.blob()):Gt(t,qt(t))},Kt=function(t){clearTimeout(t.get())},Jt=function(c,l,s,f,d){return l.toBlob().then(function(t){var e,n,r,o,i,a,u;return r=c.editorUpload.blobCache,e=(i=qt(c)).src,c.getParam("images_reuse_filename",!1,"boolean")&&((o=r.getByUri(e))?(e=o.uri(),n=o.name()):(a=c,n=(u=e.match(/\/([^\/\?]+)?\.(?:jpeg|jpg|png|gif)(?:\?|$)/i))?a.dom.encode(u[1]):null)),o=r.create({id:"imagetools"+Vt++,blob:t,base64:l.toBase64(),uri:e,name:n}),r.add(o),c.undoManager.transact(function(){c.$(i).on("load",function t(){var e,n,r;c.$(i).off("load",t),c.nodeChanged(),s?c.editorUpload.uploadImagesAuto():(Kt(f),e=c,n=f,r=at.setEditorTimeout(e,function(){e.editorUpload.uploadImagesAuto()},e.getParam("images_upload_timeout",3e4,"number")),n.set(r))}),d&&c.$(i).attr({width:d.w,height:d.h}),c.$(i).attr({src:o.blobUri()}).removeAttr("data-mce-src")}),o})},Zt=function(e,n,t,r){return function(){return e._scanForImages().then(m.curry(Yt,e)).then(rt.blobToImageResult).then(t).then(function(t){return Jt(e,t,!1,n,r)},function(t){Nt(e,t)})}},Qt=function(n,r,o){return function(){var t=It.getImageSize(qt(n)),e=t?{w:t.h,h:t.w}:null;return Zt(n,r,function(t){return et.rotate(t,o)},e)()}},te=function(t,e,n){return function(){return Zt(t,e,function(t){return et.flip(t,n)})()}},ee=function(e,r){return function(){var o=qt(e),i=It.getNaturalImageSize(o),n=function(r){return new ut(function(n){S(r).then(function(t){var e=It.getNaturalImageSize(t);i.w===e.w&&i.h===e.h||It.getImageSize(o)&&It.setImageSize(o,e),it.revokeObjectURL(t.src),n(r)})})};Yt(e).then(rt.blobToImageResult).then(m.curry(function(e,t){return Rt.edit(e,t).then(n).then(rt.blobToImageResult).then(function(t){return Jt(e,t,!0,r)},function(){})},e),function(t){Nt(e,t)})}},ne=function(t,e){return t.dom.is(e,"img:not([data-mce-object],[data-mce-placeholder])")&&($t(t,e)||Xt(t,e)||t.settings.imagetools_proxy)},re=Kt,oe=function(n,t){Y.each({mceImageRotateLeft:Qt(n,t,-90),mceImageRotateRight:Qt(n,t,90),mceImageFlipVertical:te(n,t,"v"),mceImageFlipHorizontal:te(n,t,"h"),mceEditImage:ee(n,t)},function(t,e){n.addCommand(e,t)})},ie=function(n,r,o){n.on("NodeChange",function(t){var e=o.get();e&&e.src!==t.element.src&&(re(r),n.editorUpload.uploadImagesAuto(),o.set(null)),ne(n,t.element)&&o.set(t.element)})},ae=function(t){t.addButton("rotateleft",{title:"Rotate counterclockwise",cmd:"mceImageRotateLeft"}),t.addButton("rotateright",{title:"Rotate clockwise",cmd:"mceImageRotateRight"}),t.addButton("flipv",{title:"Flip vertically",cmd:"mceImageFlipVertical"}),t.addButton("fliph",{title:"Flip horizontally",cmd:"mceImageFlipHorizontal"}),t.addButton("editimage",{title:"Edit image",cmd:"mceEditImage"}),t.addButton("imageoptions",{title:"Image options",icon:"options",cmd:"mceImage"})},ue=function(t){t.addContextToolbar(m.curry(ne,t),t.getParam("imagetools_toolbar","rotateleft rotateright | flipv fliph | crop editimage imageoptions"))};t.add("imagetools",function(t){var e=r(0),n=r(null);oe(t,e),ae(t),ue(t),ie(t,e,n)})}();
inc/admin/js/tinymce/plugins/importcss/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),v=tinymce.util.Tools.resolve("tinymce.EditorManager"),h=tinymce.util.Tools.resolve("tinymce.Env"),y=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=function(e){return e.getParam("importcss_merge_classes")},n=function(e){return e.getParam("importcss_exclusive")},_=function(e){return e.getParam("importcss_selector_converter")},r=function(e){return e.getParam("importcss_selector_filter")},i=function(e){return e.getParam("importcss_groups")},u=function(e){return e.getParam("importcss_append")},l=function(e){return e.getParam("importcss_file_filter")},a=function(t){return"string"==typeof t?function(e){return-1!==e.indexOf(t)}:t instanceof RegExp?function(e){return t.test(e)}:t},f=function(f,e,m){var g=[],n={};function p(e,t){var n,r,i,c=e.href;if(r=c,i=h.cacheSuffix,"string"==typeof r&&(r=r.replace("?"+i,"").replace("&"+i,"")),(c=r)&&m(c,t)&&(o=c,u=(s=f).settings,!(l=!1!==u.skin&&(u.skin||"lightgray"))||o!==(u.skin_url?s.documentBaseURI.toAbsolute(u.skin_url):v.baseURL+"/skins/"+l)+"/content"+(s.inline?".inline":"")+".min.css")){var s,o,u,l;y.each(e.imports,function(e){p(e,!0)});try{n=e.cssRules||e.rules}catch(a){}y.each(n,function(e){e.styleSheet?p(e.styleSheet,!0):e.selectorText&&y.each(e.selectorText.split(","),function(e){g.push(y.trim(e))})})}}y.each(f.contentCSS,function(e){n[e]=!0}),m||(m=function(e,t){return t||n[e]});try{y.each(e.styleSheets,function(e){p(e)})}catch(t){}return g},x=function(e,t){var n,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(t);if(r){var i=r[1],c=r[2].substr(1).split(".").join(" "),s=y.makeMap("a,img");return r[1]?(n={title:t},e.schema.getTextBlockElements()[i]?n.block=i:e.schema.getBlockElements()[i]||s[i.toLowerCase()]?n.selector=i:n.inline=i):r[2]&&(n={inline:"span",title:t.substr(1),classes:c}),!1!==o(e)?n.classes=c:n.attributes={"class":c},n}},T=function(e,t){return null===t||!1!==n(e)},c=x,t=function(h){h.on("renderFormatsMenu",function(e){var t,p={},c=a(r(h)),v=e.control,s=(t=i(h),y.map(t,function(e){return y.extend({},e,{original:e,selectors:{},filter:a(e.filter),item:{text:e.title,menu:[]}})})),o=function(e,t){if(f=e,g=p,!(T(h,m=t)?f in g:f in m.selectors)){u=e,a=p,T(h,l=t)?a[u]=!0:l.selectors[u]=!0;var n=(c=(i=h).plugins.importcss,s=e,((o=t)&&o.selector_converter?o.selector_converter:_(i)?_(i):function(){return x(i,s)}).call(c,s,o));if(n){var r=n.name||d.DOM.uniqueId();return h.formatter.register(r,n),y.extend({},v.settings.itemDefaults,{text:n.title,format:r})}}var i,c,s,o,u,l,a,f,m,g;return null};u(h)||v.items().remove(),y.each(f(h,e.doc||h.getDoc(),a(l(h))),function(n){if(-1===n.indexOf(".mce-")&&(!c||c(n))){var e=(r=s,i=n,y.grep(r,function(e){return!e.filter||e.filter(i)}));if(0<e.length)y.each(e,function(e){var t=o(n,e);t&&e.item.menu.push(t)});else{var t=o(n,null);t&&v.add(t)}}var r,i}),y.each(s,function(e){0<e.item.menu.length&&v.add(e.item)}),e.control.renderNew()})},s=function(t){return{convertSelectorToFormat:function(e){return c(t,e)}}};e.add("importcss",function(e){return t(e),s(e)})}();
inc/admin/js/tinymce/plugins/insertdatetime/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var r=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return r(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))},a=function(e){return e.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])},t=function(e){return e.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d"))},i=n,o=a,u=function(e){var t=a(e);return 0<t.length?t[0]:n(e)},m=function(e){return e.getParam("insertdatetime_element",!1)},c="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),l="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),s="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),d="January February March April May June July August September October November December".split(" "),p=function(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e},f=function(e,t,n){return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",p(n.getMonth()+1,2))).replace("%d",p(n.getDate(),2))).replace("%H",""+p(n.getHours(),2))).replace("%M",""+p(n.getMinutes(),2))).replace("%S",""+p(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(d[n.getMonth()]))).replace("%b",""+e.translate(s[n.getMonth()]))).replace("%A",""+e.translate(l[n.getDay()]))).replace("%a",""+e.translate(c[n.getDay()]))).replace("%%","%")},g=function(e,t){if(m(e)){var n=f(e,t),r=void 0;r=/%[HMSIp]/.test(t)?f(e,"%Y-%m-%dT%H:%M"):f(e,"%Y-%m-%d");var a=e.dom.getParent(e.selection.getStart(),"time");a?(o=a,u=r,c=n,l=(i=e).dom.create("time",{datetime:u},c),o.parentNode.insertBefore(l,o),i.dom.remove(o),i.selection.select(l,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")}else e.insertContent(f(e,t));var i,o,u,c,l},y=f,M=function(e){e.addCommand("mceInsertDate",function(){g(e,t(e))}),e.addCommand("mceInsertTime",function(){g(e,i(e))})},v=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(t,n){var r,a,e,i=(a=n,e=o(r=t),v.map(e,function(e){return{text:y(r,e),onclick:function(){a.set(e),g(r,e)}}}));t.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",menu:i,onclick:function(){var e=n.get();g(t,e||u(t))}}),t.addMenuItem("insertdatetime",{icon:"date",text:"Date/time",menu:i,context:"insert"})};e.add("insertdatetime",function(e){var t=r(null);M(e),S(e,t)})}();
inc/admin/js/tinymce/plugins/legacyoutput/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=function(a){a.settings.inline_styles=!1,a.on("init",function(){var e,t,n,i;e=a,t="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",n=o.explode(e.settings.font_size_style_values),i=e.schema,e.formatter.register({alignleft:{selector:t,attributes:{align:"left"}},aligncenter:{selector:t,attributes:{align:"center"}},alignright:{selector:t,attributes:{align:"right"}},alignjustify:{selector:t,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(e){return o.inArray(n,e.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),o.each("b,i,u,strike".split(","),function(e){i.addValidElements(e+"[*]")}),i.getElementRule("font")||i.addValidElements("font[face|size|color|style]"),o.each(t.split(","),function(e){var t=i.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})},n=function(i){i.addButton("fontsizeselect",function(){var o=[],e=i.settings.fontsizeFormats||"8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7";return i.$.each(e.split(" "),function(e,t){var n=t,i=t,a=t.split("=");1<a.length&&(n=a[0],i=a[1]),o.push({text:n,value:i})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:o,fixedWidth:!0,onPostRender:function(){var t=this;i.on("NodeChange",function(){var e;(e=i.dom.getParent(i.selection.getNode(),"font"))?t.value(e.size):t.value("")})},onclick:function(e){e.control.settings.value&&i.execCommand("FontSize",!1,e.control.settings.value)}}}),i.addButton("fontselect",function(){var n=[],e=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(i.settings.font_formats||"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats");return i.$.each(e,function(e,t){n.push({text:{raw:t[0]},value:t[1],textStyle:-1===t[1].indexOf("dings")?"font-family:"+t[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:n,fixedWidth:!0,onPostRender:function(){var t=this;i.on("NodeChange",function(){var e;(e=i.dom.getParent(i.selection.getNode(),"font"))?t.value(e.face):t.value("")})},onselect:function(e){e.control.settings.value&&i.execCommand("FontName",!1,e.control.settings.value)}}})};e.add("legacyoutput",function(e){t(e),n(e)})}();
inc/admin/js/tinymce/plugins/link/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.VK"),e=function(t){return t.target_list},o=function(t){return t.rel_list},i=function(t){return t.link_class_list},p=function(t){return"boolean"==typeof t.link_assume_external_targets&&t.link_assume_external_targets},a=function(t){return"boolean"==typeof t.link_context_toolbar&&t.link_context_toolbar},r=function(t){return t.link_list},k=function(t){return"string"==typeof t.default_link_target},y=function(t){return t.default_link_target},b=e,_=function(t,e){t.settings.target_list=e},w=function(t){return!1!==e(t)},T=o,C=function(t){return o(t)!==undefined},M=i,O=function(t){return i(t)!==undefined},R=function(t){return!1!==t.link_title},N=function(t){return"boolean"==typeof t.allow_unsafe_link_target&&t.allow_unsafe_link_target},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),u=tinymce.util.Tools.resolve("tinymce.Env"),c=function(t){if(!u.ie||10<u.ie){var e=document.createElement("a");e.target="_blank",e.href=t,e.rel="noreferrer noopener";var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r=e,a=n,document.body.appendChild(r),r.dispatchEvent(a),document.body.removeChild(r)}else{var o=window.open("","_blank");if(o){o.opener=null;var i=o.document;i.open(),i.write('<meta http-equiv="refresh" content="0; url='+l.DOM.encode(t)+'">'),i.close()}}var r,a},A=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=function(t,e){var n,o,i=["noopener"],r=t?t.split(/\s+/):[],a=function(t){return t.filter(function(t){return-1===A.inArray(i,t)})};return(r=e?(n=a(n=r)).length?n.concat(i):i:a(r)).length?(o=r,A.trim(o.sort().join(" "))):null},f=function(t,e){return e=e||t.selection.getNode(),m(e)?t.dom.select("a[href]",e)[0]:t.dom.getParent(e,"a[href]")},d=function(t){return t&&"A"===t.nodeName&&t.href},m=function(t){return t&&"FIGURE"===t.nodeName&&/\bimage\b/i.test(t.className)},v=function(t,e){var n,o;(o=t.dom.select("img",e)[0])&&(n=t.dom.getParents(o,"a[href]",e)[0])&&(n.parentNode.insertBefore(o,n),t.dom.remove(n))},g=function(t,e,n){var o,i;(i=t.dom.select("img",e)[0])&&(o=t.dom.create("a",n),i.parentNode.insertBefore(o,i),o.appendChild(i))},L=function(i,r){return function(o){i.undoManager.transact(function(){var t=i.selection.getNode(),e=f(i,t),n={href:o.href,target:o.target?o.target:null,rel:o.rel?o.rel:null,"class":o["class"]?o["class"]:null,title:o.title?o.title:null};C(i.settings)||!1!==N(i.settings)||(n.rel=s(n.rel,"_blank"===n.target)),o.href===r.href&&(r.attach(),r={}),e?(i.focus(),o.hasOwnProperty("text")&&("innerText"in e?e.innerText=o.text:e.textContent=o.text),i.dom.setAttribs(e,n),i.selection.select(e),i.undoManager.add()):m(t)?g(i,t,n):o.hasOwnProperty("text")?i.insertContent(i.dom.createHTML("a",n,i.dom.encode(o.text))):i.execCommand("mceInsertLink",!1,n)})}},P=function(e){return function(){e.undoManager.transact(function(){var t=e.selection.getNode();m(t)?v(e,t):e.execCommand("unlink")})}},h=d,x=function(t){return 0<A.grep(t,d).length},E=function(t){return!(/</.test(t)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(t)||-1===t.indexOf("href=")))},S=f,I=function(t,e){var n=e?e.innerText||e.textContent:t.getContent({format:"text"});return n.replace(/\uFEFF/g,"")},K=s,U=tinymce.util.Tools.resolve("tinymce.util.Delay"),D=tinymce.util.Tools.resolve("tinymce.util.XHR"),B={},F=function(t,o,e){var i=function(t,n){return n=n||[],A.each(t,function(t){var e={text:t.text||t.title};t.menu?e.menu=i(t.menu):(e.value=t.value,o&&o(e)),n.push(e)}),n};return i(t,e||[])},q=function(e,t,n){var o=e.selection.getRng();U.setEditorTimeout(e,function(){e.windowManager.confirm(t,function(t){e.selection.setRng(o),n(t)})})},V=function(a,t){var e,l,o,u,n,i,r,c,s,f,d,m={},v=a.selection,g=a.dom,h=function(t){var e=o.find("#text");(!e.value()||t.lastControl&&e.value()===t.lastControl.text())&&e.value(t.control.text()),o.find("#href").value(t.control.value())},x=function(){l||!u||m.text||this.parent().parent().find("#text")[0].value(this.value())};u=E(v.getContent()),e=S(a),m.text=l=I(a.selection,e),m.href=e?g.getAttrib(e,"href"):"",e?m.target=g.getAttrib(e,"target"):k(a.settings)&&(m.target=y(a.settings)),(d=g.getAttrib(e,"rel"))&&(m.rel=d),(d=g.getAttrib(e,"class"))&&(m["class"]=d),(d=g.getAttrib(e,"title"))&&(m.title=d),u&&(n={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){m.text=this.value()}}),t&&(i={type:"listbox",label:"Link list",values:F(t,function(t){t.value=a.convertURL(t.value||t.url,"href")},[{text:"None",value:""}]),onselect:h,value:a.convertURL(m.href,"href"),onPostRender:function(){i=this}}),w(a.settings)&&(b(a.settings)===undefined&&_(a,[{text:"None",value:""},{text:"New window",value:"_blank"}]),c={name:"target",type:"listbox",label:"Target",values:F(b(a.settings))}),C(a.settings)&&(r={name:"rel",type:"listbox",label:"Rel",values:F(T(a.settings),function(t){!1===N(a.settings)&&(t.value=K(t.value,"_blank"===m.target))})}),O(a.settings)&&(s={name:"class",type:"listbox",label:"Class",values:F(M(a.settings),function(t){t.value&&(t.textStyle=function(){return a.formatter.getCssText({inline:"a",classes:[t.value]})})})}),R(a.settings)&&(f={name:"title",type:"textbox",label:"Title",value:m.title}),o=a.windowManager.open({title:"Insert link",data:m,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:function(t){var e=t.meta||{};i&&i.value(a.convertURL(this.value(),"href")),A.each(t.meta,function(t,e){var n=o.find("#"+e);"text"===e?0===l.length&&(n.value(t),m.text=t):n.value(t)}),e.attach&&(B={href:this.value(),attach:e.attach}),e.text||x.call(this)},onkeyup:x,onpaste:x,onbeforecall:function(t){t.meta=o.toJSON()}},n,f,function(n){var o=[];if(A.each(a.dom.select("a:not([href])"),function(t){var e=t.name||t.id;e&&o.push({text:e,value:"#"+e,selected:-1!==n.indexOf("#"+e)})}),o.length)return o.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:o,onselect:h}}(m.href),i,r,c,s],onSubmit:function(t){var e=p(a.settings),n=L(a,B),o=P(a),i=A.extend({},m,t.data),r=i.href;r?(u&&i.text!==l||delete i.text,0<r.indexOf("@")&&-1===r.indexOf("//")&&-1===r.indexOf("mailto:")?q(a,"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(t){t&&(i.href="mailto:"+r),n(i)}):!0===e&&!/^\w+:/i.test(r)||!1===e&&/^\s*www[\.|\d\.]/i.test(r)?q(a,"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(t){t&&(i.href="http://"+r),n(i)}):n(i)):o()}})},z=function(t){var e,n,o;n=V,"string"==typeof(o=r((e=t).settings))?D.send({url:o,success:function(t){n(e,JSON.parse(t))}}):"function"==typeof o?o(function(t){n(e,t)}):n(e,o)},H=function(t,e){return t.dom.getParent(e,"a[href]")},J=function(t){return H(t,t.selection.getStart())},$=function(t,e){if(e){var n=(i=e).getAttribute("data-mce-href")||i.getAttribute("href");if(/^#/.test(n)){var o=t.$(n);o.length&&t.selection.scrollIntoView(o[0],!0)}else c(e.href)}var i},j=function(t){return function(){z(t)}},G=function(t){return function(){$(t,J(t))}},X=function(r){return function(t){var e,n,o,i;return!!(a(r.settings)&&(!(i=r.plugins.contextmenu)||!i.isContextMenuVisible())&&h(t)&&3===(o=(n=(e=r.selection).getRng()).startContainer).nodeType&&e.isCollapsed()&&0<n.startOffset&&n.startOffset<o.data.length)}},Q=function(o){o.on("click",function(t){var e=H(o,t.target);e&&n.metaKeyPressed(t)&&(t.preventDefault(),$(o,e))}),o.on("keydown",function(t){var e,n=J(o);n&&13===t.keyCode&&!0===(e=t).altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey&&(t.preventDefault(),$(o,n))})},W=function(n){return function(){var e=this;n.on("nodechange",function(t){e.active(!n.readonly&&!!S(n,t.element))})}},Y=function(n){return function(){var e=this,t=function(t){x(t.parents)?e.show():e.hide()};x(n.dom.getParents(n.selection.getStart()))||e.hide(),n.on("nodechange",t),e.on("remove",function(){n.off("nodechange",t)})}},Z=function(t){t.addCommand("mceLink",j(t))},tt=function(t){t.addShortcut("Meta+K","",j(t))},et=function(t){t.addButton("link",{active:!1,icon:"link",tooltip:"Insert/edit link",onclick:j(t),onpostrender:W(t)}),t.addButton("unlink",{active:!1,icon:"unlink",tooltip:"Remove link",onclick:P(t),onpostrender:W(t)}),t.addContextToolbar&&t.addButton("openlink",{icon:"newtab",tooltip:"Open link",onclick:G(t)})},nt=function(t){t.addMenuItem("openlink",{text:"Open link",icon:"newtab",onclick:G(t),onPostRender:Y(t),prependToContext:!0}),t.addMenuItem("link",{icon:"link",text:"Link",shortcut:"Meta+K",onclick:j(t),stateSelector:"a[href]",context:"insert",prependToContext:!0}),t.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onclick:P(t),stateSelector:"a[href]"})},ot=function(t){t.addContextToolbar&&t.addContextToolbar(X(t),"openlink | link unlink")};t.add("link",function(t){et(t),nt(t),ot(t),Q(t),Z(t),tt(t)})}();
inc/admin/js/tinymce/plugins/lists/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),l=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),n=tinymce.util.Tools.resolve("tinymce.util.VK"),p=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),o=function(e){return e&&"BR"===e.nodeName},r=function(e){return e&&3===e.nodeType},h=function(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)},i=function(e){return e&&/^(LI|DT|DD)$/.test(e.nodeName)},a=function(e){return e&&/^(TH|TD)$/.test(e.nodeName)},C=o,s=function(e){return e.parentNode.firstChild===e},c=function(e){return e.parentNode.lastChild===e},y=function(e,t){return t&&!!e.schema.getTextBlockElements()[t.nodeName]},f=function(e,t){return e&&e.nodeName in t},u=function(e,t){return!!o(t)&&!(!e.isBlock(t.nextSibling)||o(t.previousSibling))},m=function(e,t,n){var o=e.isEmpty(t);return!(n&&0<e.select("span[data-mce-type=bookmark]",t).length)&&o},g=function(e,t){return e.isChildOf(t,e.getRoot())},N=function(e,t){var n=d.getNode(e,t);return i(e)&&r(n)?{container:n,offset:t>=e.childNodes.length?n.data.length:0}:{container:e,offset:t}},L=function(e){var t=e.cloneRange(),n=N(e.startContainer,e.startOffset);t.setStart(n.container,n.offset);var o=N(e.endContainer,e.endOffset);return t.setEnd(o.container,o.offset),t},S=t.DOM,b=function(r){var i={},e=function(e){var t,n,o;n=r[e?"startContainer":"endContainer"],o=r[e?"startOffset":"endOffset"],1===n.nodeType&&(t=S.create("span",{"data-mce-type":"bookmark"}),n.hasChildNodes()?(o=Math.min(o,n.childNodes.length-1),e?n.insertBefore(t,n.childNodes[o]):S.insertAfter(t,n.childNodes[o])):n.appendChild(t),n=t,o=0),i[e?"startContainer":"endContainer"]=n,i[e?"startOffset":"endOffset"]=o};return e(!0),r.collapsed||e(),i},D=function(r){function e(e){var t,n,o;t=o=r[e?"startContainer":"endContainer"],n=r[e?"startOffset":"endOffset"],t&&(1===t.nodeType&&(n=function(e){for(var t=e.parentNode.firstChild,n=0;t;){if(t===e)return n;1===t.nodeType&&"bookmark"===t.getAttribute("data-mce-type")||n++,t=t.nextSibling}return-1}(t),t=t.parentNode,S.remove(o),!t.hasChildNodes()&&S.isBlock(t)&&t.appendChild(S.create("br"))),r[e?"startContainer":"endContainer"]=t,r[e?"startOffset":"endOffset"]=n)}e(!0),e();var t=S.createRng();return t.setStart(r.startContainer,r.startOffset),r.endContainer&&t.setEnd(r.endContainer,r.endOffset),L(t)},k=t.DOM,T=function(e,t){var n,o=t.parentNode;"LI"===o.nodeName&&o.firstChild===t&&((n=o.previousSibling)&&"LI"===n.nodeName?(n.appendChild(t),m(e,o)&&k.remove(o)):k.setStyle(o,"listStyleType","none")),h(o)&&(n=o.previousSibling)&&"LI"===n.nodeName&&n.appendChild(t)},I=function(t,e){v.each(v.grep(t.select("ol,ul",e)),function(e){T(t,e)})},B=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),R=function(e){var t=e.selection.getStart(!0);return e.dom.getParent(t,"OL,UL,DL",O(e,t))},O=function(e,t){var n=e.dom.getParents(t,"TD,TH");return 0<n.length?n[0]:e.getBody()},E={getParentList:R,getSelectedSubLists:function(e){var t,n,o,r=R(e),i=e.selection.getSelectedBlocks();return o=i,(n=r)&&1===o.length&&o[0]===n?(t=r,v.grep(t.querySelectorAll("ol,ul,dl"),function(e){return h(e)})):v.grep(i,function(e){return h(e)&&r!==e})},getSelectedListItems:function(e){var n,t,o,r=e.selection.getSelectedBlocks();return v.grep((n=e,t=r,o=v.map(t,function(e){var t=n.dom.getParent(e,"li,dd,dt",O(n,e));return t||e}),B.unique(o)),function(e){return i(e)})},getClosestListRootElm:O},A=tinymce.util.Tools.resolve("tinymce.Env"),P=t.DOM,x=function(e,t,n){var o,r,i,a=P.createFragment(),s=e.schema.getBlockElements();if(e.settings.forced_root_block&&(n=n||e.settings.forced_root_block),n&&((r=P.create(n)).tagName===e.settings.forced_root_block&&P.setAttribs(r,e.settings.forced_root_block_attrs),f(t.firstChild,s)||a.appendChild(r)),t)for(;o=t.firstChild;){var d=o.nodeName;i||"SPAN"===d&&"bookmark"===o.getAttribute("data-mce-type")||(i=!0),f(o,s)?(a.appendChild(o),r=null):n?(r||(r=P.create(n),a.appendChild(r)),r.appendChild(o)):a.appendChild(o)}return e.settings.forced_root_block?i||A.ie&&!(10<A.ie)||r.appendChild(P.create("br",{"data-mce-bogus":"1"})):a.appendChild(P.create("br")),a},_=t.DOM,M=function(e,t,n,o){var r,i,a,s,d;for(a=_.select('span[data-mce-type="bookmark"]',t),o=o||x(e,n),(r=_.createRng()).setStartAfter(n),r.setEndAfter(t),s=(i=r.extractContents()).firstChild;s;s=s.firstChild)if("LI"===s.nodeName&&e.dom.isEmpty(s)){_.remove(s);break}e.dom.isEmpty(i)||_.insertAfter(i,t),_.insertAfter(o,t),m(e.dom,n.parentNode)&&(d=n.parentNode,v.each(a,function(e){d.parentNode.insertBefore(e,n.parentNode)}),_.remove(d)),_.remove(n),m(e.dom,t)&&_.remove(t)},U=t.DOM,H=function(e,t){m(e,t)&&U.remove(t)},$=function(e,t){var n,o,r=t.parentNode;return r?(n=r.parentNode,r===e.getBody()||("DD"===t.nodeName?U.rename(t,"DT"):s(t)&&c(t)?"LI"===n.nodeName?(U.insertAfter(t,n),H(e.dom,n),U.remove(r)):h(n)?U.remove(r,!0):(n.insertBefore(x(e,t),r),U.remove(r)):s(t)?"LI"===n.nodeName?(U.insertAfter(t,n),t.appendChild(r),H(e.dom,n)):h(n)?n.insertBefore(t,r):(n.insertBefore(x(e,t),r),U.remove(t)):c(t)?"LI"===n.nodeName?U.insertAfter(t,n):h(n)?U.insertAfter(t,r):(U.insertAfter(x(e,t),r),U.remove(t)):("LI"===n.nodeName?(r=n,o=x(e,t,"LI")):o=h(n)?x(e,t,"LI"):x(e,t),M(e,r,t,o),I(e.dom,r.parentNode)))):H(e.dom,t),!0},w=$,K=function(e){var t=E.getSelectedListItems(e);if(t.length){var n=b(e.selection.getRng()),o=void 0,r=void 0,i=E.getClosestListRootElm(e,e.selection.getStart(!0));for(o=t.length;o--;)for(var a=t[o].parentNode;a&&a!==i;){for(r=t.length;r--;)if(t[r]===a){t.splice(o,1);break}a=a.parentNode}for(o=0;o<t.length&&($(e,t[o])||0!==o);o++);return e.selection.setRng(D(n)),e.nodeChanged(),!0}},Q=function(n,e){v.each(e,function(e,t){n.setAttribute(t,e)})},W=function(e,t,n){var o,r,i,a,s,d,l;o=e,r=t,a=(i=n)["list-style-type"]?i["list-style-type"]:null,o.setStyle(r,"list-style-type",a),s=e,Q(d=t,(l=n)["list-attributes"]),v.each(s.select("li",d),function(e){Q(e,l["list-item-attributes"])})},j=function(e,t,n,o){var r,i;for(r=t[n?"startContainer":"endContainer"],i=t[n?"startOffset":"endOffset"],1===r.nodeType&&(r=r.childNodes[Math.min(i,r.childNodes.length-1)]||r),!n&&C(r.nextSibling)&&(r=r.nextSibling);r.parentNode!==o;){if(y(e,r))return r;if(/^(TD|TH)$/.test(r.parentNode.nodeName))return r;r=r.parentNode}return r},q=function(c,f,u){void 0===u&&(u={});var e,t=c.selection.getRng(!0),m="LI",n=E.getClosestListRootElm(c,c.selection.getStart(!0)),g=c.dom;"false"!==g.getContentEditable(c.selection.getNode())&&("DL"===(f=f.toUpperCase())&&(m="DT"),e=b(t),v.each(function(n,e,o){for(var r,i=[],a=n.dom,t=j(n,e,!0,o),s=j(n,e,!1,o),d=[],l=t;l&&(d.push(l),l!==s);l=l.nextSibling);return v.each(d,function(e){if(y(n,e))return i.push(e),void(r=null);if(a.isBlock(e)||C(e))return C(e)&&a.remove(e),void(r=null);var t=e.nextSibling;p.isBookmarkNode(e)&&(y(n,t)||!t&&e.parentNode===o)?r=null:(r||(r=a.create("p"),e.parentNode.insertBefore(r,e),i.push(r)),r.appendChild(e))}),i}(c,t,n),function(e){var t,n,o,r,i,a,s,d,l;(n=e.previousSibling)&&h(n)&&n.nodeName===f&&(o=n,r=u,i=g.getStyle(o,"list-style-type"),a=r?r["list-style-type"]:"",i===(a=null===a?"":a))?(t=n,e=g.rename(e,m),n.appendChild(e)):(t=g.create(f),e.parentNode.insertBefore(t,e),t.appendChild(e),e=g.rename(e,m)),s=g,d=e,l=["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"],v.each(l,function(e){return s.setStyle(d,((t={})[e]="",t));var t}),W(g,t,u),z(c.dom,t)}),c.selection.setRng(D(e)))},F=function(o){var e=b(o.selection.getRng(!0)),r=E.getClosestListRootElm(o,o.selection.getStart(!0)),t=E.getSelectedListItems(o),n=v.grep(t,function(e){return o.dom.isEmpty(e)});t=v.grep(t,function(e){return!o.dom.isEmpty(e)}),v.each(n,function(e){m(o.dom,e)&&w(o,e)}),v.each(t,function(e){var t,n;if(e.parentNode!==o.getBody()){for(t=e;t&&t!==r;t=t.parentNode)h(t)&&(n=t);M(o,n,e),I(o.dom,n.parentNode)}}),o.selection.setRng(D(e))},V=function(e,t,n){return d=n,(s=t)&&d&&h(s)&&s.nodeName===d.nodeName&&(i=t,a=n,(r=e).getStyle(i,"list-style-type",!0)===r.getStyle(a,"list-style-type",!0))&&(o=n,t.className===o.className);var o,r,i,a,s,d},z=function(e,t){var n,o;if(n=t.nextSibling,V(e,t,n)){for(;o=n.firstChild;)t.appendChild(o);e.remove(n)}if(n=t.previousSibling,V(e,t,n)){for(;o=n.lastChild;)t.insertBefore(o,t.firstChild);e.remove(n)}},G=function(t,e,n,o,r){if(e.nodeName!==o||J(r)){var i=b(t.selection.getRng(!0));v.each([e].concat(n),function(e){!function(e,t,n,o){if(t.nodeName!==n){var r=e.rename(t,n);W(e,r,o)}else W(e,t,o)}(t.dom,e,o,r)}),t.selection.setRng(D(i))}else F(t)},J=function(e){return"list-style-type"in e},X={toggleList:function(e,t,n){var o=E.getParentList(e),r=E.getSelectedSubLists(e);n=n||{},o&&0<r.length?G(e,o,r,t,n):function(e,t,n,o){if(t!==e.getBody())if(t)if(t.nodeName!==n||J(o)){var r=b(e.selection.getRng(!0));W(e.dom,t,o),z(e.dom,e.dom.rename(t,n)),e.selection.setRng(D(r))}else F(e);else q(e,n,o)}(e,o,t,n)},removeList:F,mergeWithAdjacentLists:z},Y=function(e,t,n,o){var r,i,a=t.startContainer,s=t.startOffset;if(3===a.nodeType&&(n?s<a.data.length:0<s))return a;for(r=e.schema.getNonEmptyElements(),1===a.nodeType&&(a=d.getNode(a,s)),i=new l(a,o),n&&u(e.dom,a)&&i.next();a=i[n?"next":"prev2"]();){if("LI"===a.nodeName&&!a.hasChildNodes())return a;if(r[a.nodeName])return a;if(3===a.nodeType&&0<a.data.length)return a}},Z=function(e,t){var n=t.childNodes;return 1===n.length&&!h(n[0])&&e.isBlock(n[0])},ee=function(e,t,n){var o,r,i,a;if(r=Z(e,n)?n.firstChild:n,Z(i=e,a=t)&&i.remove(a.firstChild,!0),!m(e,t,!0))for(;o=t.firstChild;)r.appendChild(o)},te=function(e,t,n){var o,r,i=t.parentNode;g(e,t)&&g(e,n)&&(h(n.lastChild)&&(r=n.lastChild),i===n.lastChild&&C(i.previousSibling)&&e.remove(i.previousSibling),(o=n.lastChild)&&C(o)&&t.hasChildNodes()&&e.remove(o),m(e,n,!0)&&e.$(n).empty(),ee(e,t,n),r&&n.appendChild(r),e.remove(t),m(e,i)&&i!==e.getRoot()&&e.remove(i))},ne=function(e,t,n,o){var r,i,a,s=e.dom;if(s.isEmpty(o))i=n,a=o,(r=e).dom.$(a).empty(),te(r.dom,i,a),r.selection.setCursorLocation(a);else{var d=b(t);te(s,n,o),e.selection.setRng(D(d))}},oe=function(e,t){var n,o,r,i=e.dom,a=e.selection,s=a.getStart(),d=E.getClosestListRootElm(e,s),l=i.getParent(a.getStart(),"LI",d);if(l){if((n=l.parentNode)===e.getBody()&&m(i,n))return!0;if(o=L(a.getRng(!0)),(r=i.getParent(Y(e,o,t,d),"LI",d))&&r!==l)return t?ne(e,o,r,l):function(e,t,n,o){var r=b(t);te(e.dom,n,o);var i=D(r);e.selection.setRng(i)}(e,o,l,r),!0;if(!r&&!t&&X.removeList(e))return!0}return!1},re=function(e,t){return oe(e,t)||function(r,i){var a=r.dom,e=r.selection.getStart(),s=E.getClosestListRootElm(r,e),d=a.getParent(e,a.isBlock,s);if(d&&a.isEmpty(d)){var t=L(r.selection.getRng(!0)),l=a.getParent(Y(r,t,i,s),"LI",s);if(l)return r.undoManager.transact(function(){var e,t,n,o;t=d,n=s,o=(e=a).getParent(t.parentNode,e.isBlock,n),e.remove(t),o&&e.isEmpty(o)&&e.remove(o),X.mergeWithAdjacentLists(a,l.parentNode),r.selection.select(l,!0),r.selection.collapse(i)}),!0}return!1}(e,t)},ie=function(e,t){return e.selection.isCollapsed()?re(e,t):(o=(n=e).selection.getStart(),r=E.getClosestListRootElm(n,o),!!(n.dom.getParent(o,"LI,DT,DD",r)||0<E.getSelectedListItems(n).length)&&(n.undoManager.transact(function(){n.execCommand("Delete"),I(n.dom,n.getBody())}),!0));var n,o,r},ae=function(t){t.on("keydown",function(e){e.keyCode===n.BACKSPACE?ie(t,!1)&&e.preventDefault():e.keyCode===n.DELETE&&ie(t,!0)&&e.preventDefault()})},se=ie,de=function(t){return{backspaceDelete:function(e){se(t,e)}}},le=t.DOM,ce=function(e,t){var n;if(h(e)){for(;n=e.firstChild;)t.appendChild(n);le.remove(e)}},fe=function(e){var t,n,o,r,i=E.getSelectedListItems(e);if(i.length){for(var a=b(e.selection.getRng(!0)),s=0;s<i.length&&(t=i[s],r=o=n=void 0,("DT"===t.nodeName?(le.rename(t,"DD"),1):(n=t.previousSibling)&&h(n)?(n.appendChild(t),1):n&&"LI"===n.nodeName&&h(n.lastChild)?(n.lastChild.appendChild(t),ce(t.lastChild,n.lastChild),1):(n=t.nextSibling)&&h(n)?(n.insertBefore(t,n.firstChild),1):(n=t.previousSibling)&&"LI"===n.nodeName&&(o=le.create(t.parentNode.nodeName),(r=le.getStyle(t.parentNode,"listStyleType"))&&le.setStyle(o,"listStyleType",r),n.appendChild(o),o.appendChild(t),ce(t.lastChild,o),1))||0!==s);s++);return e.selection.setRng(D(a)),e.nodeChanged(),!0}},ue=function(t,n){return function(){var e=t.dom.getParent(t.selection.getStart(),"UL,OL,DL");return e&&e.nodeName===n}},me=function(o){o.on("BeforeExecCommand",function(e){var t,n=e.command.toLowerCase();if("indent"===n?fe(o)&&(t=!0):"outdent"===n&&K(o)&&(t=!0),t)return o.fire("ExecCommand",{command:e.command}),e.preventDefault(),!0}),o.addCommand("InsertUnorderedList",function(e,t){X.toggleList(o,"UL",t)}),o.addCommand("InsertOrderedList",function(e,t){X.toggleList(o,"OL",t)}),o.addCommand("InsertDefinitionList",function(e,t){X.toggleList(o,"DL",t)}),o.addQueryStateHandler("InsertUnorderedList",ue(o,"UL")),o.addQueryStateHandler("InsertOrderedList",ue(o,"OL")),o.addQueryStateHandler("InsertDefinitionList",ue(o,"DL"))},ge=function(e){return e.getParam("lists_indent_on_tab",!0)},pe=function(e){var t;ge(e)&&(t=e).on("keydown",function(e){e.keyCode!==n.TAB||n.metaKeyPressed(e)||t.dom.getParent(t.selection.getStart(),"LI,DT,DD")&&(e.preventDefault(),e.shiftKey?K(t):fe(t))}),ae(e)},ve=function(t,i){return function(e){var r=e.control;t.on("NodeChange",function(e){var t=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}(e.parents,a),n=-1!==t?e.parents.slice(0,t):e.parents,o=v.grep(n,h);r.active(0<o.length&&o[0].nodeName===i)})}},he=function(e){var t,n,o,r;n="advlist",o=(t=e).settings.plugins?t.settings.plugins:"",-1===v.inArray(o.split(/[ ,]/),n)&&(e.addButton("numlist",{active:!1,title:"Numbered list",cmd:"InsertOrderedList",onPostRender:ve(e,"OL")}),e.addButton("bullist",{active:!1,title:"Bullet list",cmd:"InsertUnorderedList",onPostRender:ve(e,"UL")})),e.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:(r=e,function(e){var n=e.control;r.on("nodechange",function(){var e=E.getSelectedListItems(r),t=0<e.length&&s(e[0]);n.disabled(t)})})})};e.add("lists",function(e){return pe(e),he(e),me(e),de(e)})}();
inc/admin/js/tinymce/plugins/media/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.Env"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),w=function(e){return e.getParam("media_scripts")},b=function(e){return e.getParam("audio_template_callback")},y=function(e){return e.getParam("video_template_callback")},n=function(e){return e.getParam("media_live_embeds",!0)},t=function(e){return e.getParam("media_filter_html",!0)},s=function(e){return e.getParam("media_url_resolver")},m=function(e){return e.getParam("media_alt_source",!0)},d=function(e){return e.getParam("media_poster",!0)},h=function(e){return e.getParam("media_dimensions",!0)},p=tinymce.util.Tools.resolve("tinymce.html.SaxParser"),r=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),x=function(e,t){if(e)for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r].filter))return e[r]},i=function(t){return function(e){return e?e.style[t].replace(/px$/,""):""}},a=function(i){return function(e,t){var r;e&&(e.style[i]=/^[0-9.]+$/.test(r=t)?r+"px":r)}},f={getMaxWidth:i("maxWidth"),getMaxHeight:i("maxHeight"),setMaxWidth:a("maxWidth"),setMaxHeight:a("maxHeight")},u=r.DOM,l=function(e){return u.getAttrib(e,"data-ephox-embed-iri")},j=function(e,t){return c=t,s=u.createFragment(c),""!==l(s.firstChild)?(o=t,n=u.createFragment(o).firstChild,{type:"ephox-embed-iri",source1:l(n),source2:"",poster:"",width:f.getMaxWidth(n),height:f.getMaxHeight(n)}):(i=e,r=t,p({validate:(a={},!1),allow_conditional_comments:!0,special:"script,noscript",start:function(e,t){if(a.source1||"param"!==e||(a.source1=t.map.movie),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(a.type||(a.type=e),a=v.extend(t.map,a)),"script"===e){var r=x(i,t.map.src);if(!r)return;a={type:"script",source1:t.map.src,width:r.width,height:r.height}}"source"===e&&(a.source1?a.source2||(a.source2=t.map.src):a.source1=t.map.src),"img"!==e||a.poster||(a.poster=t.map.src)}}).parse(r),a.source1=a.source1||a.src||a.data,a.source2=a.source2||"",a.poster=a.poster||"",a);var i,r,a,o,n,c,s},g=tinymce.util.Tools.resolve("tinymce.util.Promise"),M=function(e){var t={mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"}[e.toLowerCase().split(".").pop()];return t||""},_=tinymce.util.Tools.resolve("tinymce.html.Writer"),C=tinymce.util.Tools.resolve("tinymce.html.Schema"),S=r.DOM,F=function(e,t){var r,i,a,o;for(r in t)if(a=""+t[r],e.map[r])for(i=e.length;i--;)(o=e[i]).name===r&&(a?(e.map[r]=a,o.value=a):(delete e.map[r],e.splice(i,1)));else a&&(e.push({name:r,value:a}),e.map[r]=a)},k=function(e,t){var r,i,a=S.createFragment(e).firstChild;return f.setMaxWidth(a,t.width),f.setMaxHeight(a,t.height),r=a.outerHTML,i=_(),p(i).parse(r),i.getContent()},A=function(e,t,r){return u=e,l=S.createFragment(u),""!==S.getAttrib(l.firstChild,"data-ephox-embed-iri")?k(e,t):(i=e,a=t,o=r,c=_(),p({validate:!1,allow_conditional_comments:!(s=0),special:"script,noscript",comment:function(e){c.comment(e)},cdata:function(e){c.cdata(e)},text:function(e,t){c.text(e,t)},start:function(e,t,r){switch(e){case"video":case"object":case"embed":case"img":case"iframe":a.height!==undefined&&a.width!==undefined&&F(t,{width:a.width,height:a.height})}if(o)switch(e){case"video":F(t,{poster:a.poster,src:""}),a.source2&&F(t,{src:""});break;case"iframe":F(t,{src:a.source1});break;case"source":if(++s<=2&&(F(t,{src:a["source"+s],type:a["source"+s+"mime"]}),!a["source"+s]))return;break;case"img":if(!a.poster)return;n=!0}c.start(e,t,r)},end:function(e){if("video"===e&&o)for(var t=1;t<=2;t++)if(a["source"+t]){var r=[];r.map={},s<t&&(F(r,{src:a["source"+t],type:a["source"+t+"mime"]}),c.start("source",r,!0))}if(a.poster&&"object"===e&&o&&!n){var i=[];i.map={},F(i,{src:a.poster,width:a.width,height:a.height}),c.start("img",i,!0)}c.end(e)}},C({})).parse(i),c.getContent());var i,a,o,n,c,s,u,l},N=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&amp;byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],c=function(r,e){var i=v.extend({},e);if(!i.source1&&(v.extend(i,j(w(r),i.embed)),!i.source1))return"";i.source2||(i.source2=""),i.poster||(i.poster=""),i.source1=r.convertURL(i.source1,"source"),i.source2=r.convertURL(i.source2,"source"),i.source1mime=M(i.source1),i.source2mime=M(i.source2),i.poster=r.convertURL(i.poster,"poster");var t,a,o=(t=i.source1,0<(a=N.filter(function(e){return e.regex.test(t)})).length?v.extend({},a[0],{url:function(e,t){for(var r=e.regex.exec(t),i=e.url,a=function(e){i=i.replace("$"+e,function(){return r[e]?r[e]:""})},o=0;o<r.length;o++)a(o);return i.replace(/\?$/,"")}(a[0],t)}):null);if(o&&(i.source1=o.url,i.type=o.type,i.allowFullscreen=o.allowFullscreen,i.width=i.width||o.w,i.height=i.height||o.h),i.embed)return A(i.embed,i,!0);var n=x(w(r),i.source1);n&&(i.type="script",i.width=n.width,i.height=n.height);var c,s,u,l,m,d,h,p,f=b(r),g=y(r);return i.width=i.width||300,i.height=i.height||150,v.each(i,function(e,t){i[t]=r.dom.encode(e)}),"iframe"===i.type?(p=(h=i).allowFullscreen?' allowFullscreen="1"':"",'<iframe src="'+h.source1+'" width="'+h.width+'" height="'+h.height+'"'+p+"></iframe>"):"application/x-shockwave-flash"===i.source1mime?(d='<object data="'+(m=i).source1+'" width="'+m.width+'" height="'+m.height+'" type="application/x-shockwave-flash">',m.poster&&(d+='<img src="'+m.poster+'" width="'+m.width+'" height="'+m.height+'" />'),d+="</object>"):-1!==i.source1mime.indexOf("audio")?(u=i,(l=f)?l(u):'<audio controls="controls" src="'+u.source1+'">'+(u.source2?'\n<source src="'+u.source2+'"'+(u.source2mime?' type="'+u.source2mime+'"':"")+" />\n":"")+"</audio>"):"script"===i.type?'<script src="'+i.source1+'"><\/script>':(c=i,(s=g)?s(c):'<video width="'+c.width+'" height="'+c.height+'"'+(c.poster?' poster="'+c.poster+'"':"")+' controls="controls">\n<source src="'+c.source1+'"'+(c.source1mime?' type="'+c.source1mime+'"':"")+" />\n"+(c.source2?'<source src="'+c.source2+'"'+(c.source2mime?' type="'+c.source2mime+'"':"")+" />\n":"")+"</video>")},O={},P=function(t){return function(e){return c(t,e)}},T=function(e,t){var r,i,a,o,n,c=s(e);return c?(a=t,o=P(e),n=c,new g(function(t,e){var r=function(e){return e.html&&(O[a.source1]=e),t({url:a.source1,html:e.html?e.html:o(a)})};O[a.source1]?r(O[a.source1]):n({url:a.source1},r,e)})):(r=t,i=P(e),new g(function(e){e({html:i(r),url:r.source1})}))},$=function(e){return O.hasOwnProperty(e)},z=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},L=function(e,t){var r=e.find("#width")[0],i=e.find("#height")[0],a=e.find("#constrain")[0];r&&i&&a&&t(r,i,a.checked())},H=function(e,t,r){var i=e.state.get("oldVal"),a=t.state.get("oldVal"),o=e.value(),n=t.value();r&&i&&a&&o&&n&&(o!==i?(n=Math.round(o/i*n),isNaN(n)||t.value(n)):(o=Math.round(n/a*o),isNaN(o)||e.value(o))),z(e,t)},W=function(e){L(e,H)},J=function(e){var t=function(){e(function(e){W(e)})};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},R=function(e){L(e,z)},D=W,E=o.ie&&o.ie<=8?"onChange":"onInput",I=function(r){return function(e){var t=e&&e.msg?"Media embed handler error: "+e.msg:"Media embed handler threw unknown error.";r.notificationManager.open({type:"error",text:t})}},U=function(a,o){return function(e){var t=e.html,r=a.find("#embed")[0],i=v.extend(j(w(o),t),{source1:e.url});a.fromJSON(i),r&&(r.value(t),D(a))}},V=function(e,t){var r=e.dom.select("img[data-mce-object]");e.insertContent(t),function(e,t){var r,i,a=e.dom.select("img[data-mce-object]");for(r=0;r<t.length;r++)for(i=a.length-1;0<=i;i--)t[r]===a[i]&&a.splice(i,1);e.selection.select(a[0])}(e,r),e.nodeChanged()},B=function(i){var a,t,e,r,o,n=[{name:"source1",type:"filepicker",filetype:"media",size:40,autofocus:!0,label:"Source",onpaste:function(){setTimeout(function(){T(i,a.toJSON()).then(U(a,i))["catch"](I(i))},1)},onchange:function(e){var r,t;T(i,a.toJSON()).then(U(a,i))["catch"](I(i)),r=a,t=e.meta,v.each(t,function(e,t){r.find("#"+t).value(e)})},onbeforecall:function(e){e.meta=a.toJSON()}}],c=[];if(m(i)&&c.push({name:"source2",type:"filepicker",filetype:"media",size:40,label:"Alternative source"}),d(i)&&c.push({name:"poster",type:"filepicker",filetype:"image",size:40,label:"Poster"}),h(i)){var s=J(function(e){e(a),t=a.toJSON(),a.find("#embed").value(A(t.embed,t))});n.push(s)}r=(e=i).selection.getNode(),o=r.getAttribute("data-ephox-embed-iri"),t=o?{source1:o,"data-ephox-embed-iri":o,width:f.getMaxWidth(r),height:f.getMaxHeight(r)}:r.getAttribute("data-mce-object")?j(w(e),e.serializer.serialize(r,{selection:!0})):{};var u={id:"mcemediasource",type:"textbox",flex:1,name:"embed",value:function(e){var t=e.selection.getNode();if(t.getAttribute("data-mce-object")||t.getAttribute("data-ephox-embed-iri"))return e.selection.getContent()}(i),multiline:!0,rows:5,label:"Source"};u[E]=function(){t=v.extend({},j(w(i),this.value())),this.parent().parent().fromJSON(t)};var l=[{title:"General",type:"form",items:n},{title:"Embed",type:"container",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,items:[{type:"label",text:"Paste your embed code below:",forId:"mcemediasource"},u]}];0<c.length&&l.push({title:"Advanced",type:"form",items:c}),a=i.windowManager.open({title:"Insert/edit media",data:t,bodyType:"tabpanel",body:l,onSubmit:function(){var t,e;D(a),t=i,(e=a.toJSON()).embed=A(e.embed,e),e.embed&&$(e.source1)?V(t,e.embed):T(t,e).then(function(e){V(t,e.html)})["catch"](I(t))}}),R(a)},G=function(e){return{showDialog:function(){B(e)}}},q=function(e){e.addCommand("mceMedia",function(){B(e)})},K=tinymce.util.Tools.resolve("tinymce.html.Node"),Q=function(a,e){if(!1===t(a))return e;var o,n=_();return p({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(e){n.comment(e)},cdata:function(e){n.cdata(e)},text:function(e,t){n.text(e,t)},start:function(e,t,r){if(o=!0,"script"!==e&&"noscript"!==e){for(var i=0;i<t.length;i++){if(0===t[i].name.indexOf("on"))return;"style"===t[i].name&&(t[i].value=a.dom.serializeStyle(a.dom.parseStyle(t[i].value),e))}n.start(e,t,r),o=!1}},end:function(e){o||n.end(e)}},C({})).parse(e),n.getContent()},X=function(e,t){var r,i=t.name;return(r=new K("img",1)).shortEnded=!0,Z(e,t,r),r.attr({width:t.attr("width")||"300",height:t.attr("height")||("audio"===i?"30":"150"),style:t.attr("style"),src:o.transparentSrc,"data-mce-object":i,"class":"mce-object mce-object-"+i}),r},Y=function(e,t){var r,i,a,o=t.name;return(r=new K("span",1)).attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":o,"class":"mce-preview-object mce-object-"+o}),Z(e,t,r),(i=new K(o,1)).attr({src:t.attr("src"),allowfullscreen:t.attr("allowfullscreen"),style:t.attr("style"),"class":t.attr("class"),width:t.attr("width"),height:t.attr("height"),frameborder:"0"}),(a=new K("span",1)).attr("class","mce-shim"),r.append(i),r.append(a),r},Z=function(e,t,r){var i,a,o,n,c;for(n=(o=t.attributes).length;n--;)i=o[n].name,a=o[n].value,"width"!==i&&"height"!==i&&"style"!==i&&("data"!==i&&"src"!==i||(a=e.convertURL(a,i)),r.attr("data-mce-p-"+i,a));(c=t.firstChild&&t.firstChild.value)&&(r.attr("data-mce-html",escape(Q(e,c))),r.firstChild=null)},ee=function(e){for(;e=e.parent;)if(e.attr("data-ephox-embed-iri"))return!0;return!1},te=function(a){return function(e){for(var t,r,i=e.length;i--;)(t=e[i]).parent&&(t.parent.attr("data-mce-object")||("script"!==t.name||(r=x(w(a),t.attr("src"))))&&(r&&(r.width&&t.attr("width",r.width.toString()),r.height&&t.attr("height",r.height.toString())),"iframe"===t.name&&n(a)&&o.ceFalse?ee(t)||t.replace(Y(a,t)):ee(t)||t.replace(X(a,t))))}},re=function(d){d.on("preInit",function(){var t=d.schema.getSpecialElements();v.each("video audio iframe object".split(" "),function(e){t[e]=new RegExp("</"+e+"[^>]*>","gi")});var r=d.schema.getBoolAttrs();v.each("webkitallowfullscreen mozallowfullscreen allowfullscreen".split(" "),function(e){r[e]={}}),d.parser.addNodeFilter("iframe,video,audio,object,embed,script",te(d)),d.serializer.addAttributeFilter("data-mce-object",function(e,t){for(var r,i,a,o,n,c,s,u,l=e.length;l--;)if((r=e[l]).parent){for(s=r.attr(t),i=new K(s,1),"audio"!==s&&"script"!==s&&((u=r.attr("class"))&&-1!==u.indexOf("mce-preview-object")?i.attr({width:r.firstChild.attr("width"),height:r.firstChild.attr("height")}):i.attr({width:r.attr("width"),height:r.attr("height")})),i.attr({style:r.attr("style")}),a=(o=r.attributes).length;a--;){var m=o[a].name;0===m.indexOf("data-mce-p-")&&i.attr(m.substr(11),o[a].value)}"script"===s&&i.attr("type","text/javascript"),(n=r.attr("data-mce-html"))&&((c=new K("#text",3)).raw=!0,c.value=Q(d,unescape(n)),i.append(c)),r.replace(i)}})}),d.on("setContent",function(){d.$("span.mce-preview-object").each(function(e,t){var r=d.$(t);0===r.find("span.mce-shim",t).length&&r.append('<span class="mce-shim"></span>')})})},ie=function(e){e.on("ResolveName",function(e){var t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)})},ae=function(t){t.on("click keyup",function(){var e=t.selection.getNode();e&&t.dom.hasClass(e,"mce-preview-object")&&t.dom.getAttrib(e,"data-mce-selected")&&e.setAttribute("data-mce-selected","2")}),t.on("ObjectSelected",function(e){var t=e.target.getAttribute("data-mce-object");"audio"!==t&&"script"!==t||e.preventDefault()}),t.on("objectResized",function(e){var t,r=e.target;r.getAttribute("data-mce-object")&&(t=r.getAttribute("data-mce-html"))&&(t=unescape(t),r.setAttribute("data-mce-html",escape(A(t,{width:e.width,height:e.height}))))})},oe=function(e){e.addButton("media",{tooltip:"Insert/edit media",cmd:"mceMedia",stateSelector:["img[data-mce-object]","span[data-mce-object]","div[data-ephox-embed-iri]"]}),e.addMenuItem("media",{icon:"media",text:"Media",cmd:"mceMedia",context:"insert",prependToContext:!0})};e.add("media",function(e){return q(e),oe(e),ie(e),re(e),ae(e),G(e)})}();
inc/admin/js/tinymce/plugins/nonbreaking/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n,e){var t,i=(t=n).plugins.visualchars&&t.plugins.visualchars.isEnabled()?'<span class="mce-nbsp">&nbsp;</span>':"&nbsp;";n.insertContent(function(n,e){for(var t="",i=0;i<e;i++)t+=n;return t}(i,e)),n.dom.setAttrib(n.dom.select("span.mce-nbsp"),"data-mce-bogus","1")},e=function(n){n.addCommand("mceNonBreaking",function(){i(n,1)})},o=tinymce.util.Tools.resolve("tinymce.util.VK"),a=function(n){var e=n.getParam("nonbreaking_force_tab",0);return"boolean"==typeof e?!0===e?3:0:e},t=function(e){var t=a(e);0<t&&e.on("keydown",function(n){if(n.keyCode===o.TAB&&!n.isDefaultPrevented()){if(n.shiftKey)return;n.preventDefault(),n.stopImmediatePropagation(),i(e,t)}})},r=function(n){n.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),n.addMenuItem("nonbreaking",{icon:"nonbreaking",text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"})};n.add("nonbreaking",function(n){e(n),r(n),t(n)})}();
inc/admin/js/tinymce/plugins/noneditable/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=function(t){return t.getParam("noneditable_noneditable_class","mceNonEditable")},u=function(t){return t.getParam("noneditable_editable_class","mceEditable")},f=function(t){var n=t.getParam("noneditable_regexp",[]);return n&&n.constructor===RegExp?[n]:n},s=function(n){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(n)}},d=function(i,o,c){return function(t){var n=arguments,e=n[n.length-2],r=0<e?o.charAt(e-1):"";if('"'===r)return t;if(">"===r){var a=o.lastIndexOf("<",e);if(-1!==a&&-1!==o.substring(a,e).indexOf('contenteditable="false"'))return t}return'<span class="'+c+'" data-mce-content="'+i.dom.encode(n[0])+'">'+i.dom.encode("string"==typeof n[1]?n[1]:n[0])+"</span>"}},n=function(n){var t,e,r="contenteditable";t=" "+c.trim(u(n))+" ",e=" "+c.trim(l(n))+" ";var a=s(t),i=s(e),o=f(n);n.on("PreInit",function(){0<o.length&&n.on("BeforeSetContent",function(t){!function(t,n,e){var r=n.length,a=e.content;if("raw"!==e.format){for(;r--;)a=a.replace(n[r],d(t,a,l(t)));e.content=a}}(n,o,t)}),n.parser.addAttributeFilter("class",function(t){for(var n,e=t.length;e--;)n=t[e],a(n)?n.attr(r,"true"):i(n)&&n.attr(r,"false")}),n.serializer.addAttributeFilter(r,function(t){for(var n,e=t.length;e--;)n=t[e],(a(n)||i(n))&&(0<o.length&&n.attr("data-mce-content")?(n.name="#text",n.type=3,n.raw=!0,n.value=n.attr("data-mce-content")):n.attr(r,null))})})};t.add("noneditable",function(t){n(t)})}();
inc/admin/js/tinymce/plugins/pagebreak/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return e.getParam("pagebreak_separator","\x3c!-- pagebreak --\x3e")},i=function(e){return e.getParam("pagebreak_split_block",!1)},t=function(){return"mce-pagebreak"},r=function(){return'<img src="'+a.transparentSrc+'" class="mce-pagebreak" data-mce-resize="false" data-mce-placeholder />'},c=function(c){var o=n(c),a=new RegExp(o.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi");c.on("BeforeSetContent",function(e){e.content=e.content.replace(a,r())}),c.on("PreInit",function(){c.serializer.addNodeFilter("img",function(e){for(var a,n,t=e.length;t--;)if((n=(a=e[t]).attr("class"))&&-1!==n.indexOf("mce-pagebreak")){var r=a.parent;if(c.schema.getBlockElements()[r.name]&&i(c)){r.type=3,r.value=o,r.raw=!0,a.remove();continue}a.type=3,a.value=o,a.raw=!0}})})},o=r,g=t,u=function(e){e.addCommand("mcePageBreak",function(){e.settings.pagebreak_split_block?e.insertContent("<p>"+o()+"</p>"):e.insertContent(o())})},m=function(a){a.on("ResolveName",function(e){"IMG"===e.target.nodeName&&a.dom.hasClass(e.target,g())&&(e.name="pagebreak")})},s=function(e){e.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),e.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"})};e.add("pagebreak",function(e){u(e),s(e),c(e),m(e)})}();
inc/admin/js/tinymce/plugins/paste/plugin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var u=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return u(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=function(e){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(e.settings.plugins)||!t.get("powerpaste")||("undefined"!=typeof window.console&&window.console.log&&window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))},s=function(e,t){return{clipboard:e,quirks:t}},f=function(e,t,n,r){return e.fire("PastePreProcess",{content:t,internal:n,wordContent:r})},d=function(e,t,n,r){return e.fire("PastePostProcess",{node:t,internal:n,wordContent:r})},l=function(e,t){return e.fire("PastePlainTextToggle",{state:t})},n=function(e,t){return e.fire("paste",{ieFake:t})},m={shouldPlainTextInform:function(e){return e.getParam("paste_plaintext_inform",!0)},shouldBlockDrop:function(e){return e.getParam("paste_block_drop",!1)},shouldPasteDataImages:function(e){return e.getParam("paste_data_images",!1)},shouldFilterDrop:function(e){return e.getParam("paste_filter_drop",!0)},getPreProcess:function(e){return e.getParam("paste_preprocess")},getPostProcess:function(e){return e.getParam("paste_postprocess")},getWebkitStyles:function(e){return e.getParam("paste_webkit_styles")},shouldRemoveWebKitStyles:function(e){return e.getParam("paste_remove_styles_if_webkit",!0)},shouldMergeFormats:function(e){return e.getParam("paste_merge_formats",!0)},isSmartPasteEnabled:function(e){return e.getParam("smart_paste",!0)},isPasteAsTextEnabled:function(e){return e.getParam("paste_as_text",!1)},getRetainStyleProps:function(e){return e.getParam("paste_retain_style_properties")},getWordValidElements:function(e){return e.getParam("paste_word_valid_elements","-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")},shouldConvertWordFakeLists:function(e){return e.getParam("paste_convert_word_fake_lists",!0)},shouldUseDefaultFilters:function(e){return e.getParam("paste_enable_default_filters",!0)}},r=function(e,t,n){var r,a,i;"text"===t.pasteFormat.get()?(t.pasteFormat.set("html"),l(e,!1)):(t.pasteFormat.set("text"),l(e,!0),i=e,!1===n.get()&&m.shouldPlainTextInform(i)&&(a="Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",(r=e).notificationManager.open({text:r.translate(a),type:"info"}),n.set(!0))),e.focus()},c=function(e,n,t){e.addCommand("mceTogglePlainTextPaste",function(){r(e,n,t)}),e.addCommand("mceInsertClipboardContent",function(e,t){t.content&&n.pasteHtml(t.content,t.internal),t.text&&n.pasteText(t.text)})},v=tinymce.util.Tools.resolve("tinymce.Env"),h=tinymce.util.Tools.resolve("tinymce.util.Delay"),b=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=tinymce.util.Tools.resolve("tinymce.util.VK"),e="x-tinymce/html",i="\x3c!-- "+e+" --\x3e",p=function(e){return i+e},g=function(e){return e.replace(i,"")},y=function(e){return-1!==e.indexOf(i)},x=function(){return e},P=tinymce.util.Tools.resolve("tinymce.html.Entities"),w=function(e){return e.replace(/\r?\n/g,"<br>")},_=function(e,t,n){var r=e.split(/\n\n/),a=function(e,t){var n,r=[],a="<"+e;if("object"==typeof t){for(n in t)t.hasOwnProperty(n)&&r.push(n+'="'+P.encodeAllRaw(t[n])+'"');r.length&&(a+=" "+r.join(" "))}return a+">"}(t,n),i="</"+t+">",o=b.map(r,function(e){return e.split(/\n/).join("<br />")});return 1===o.length?o[0]:b.map(o,function(e){return a+e+i}).join("")},D=function(e){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e)},T=function(e,t,n){return t?_(e,t,n):w(e)},C=tinymce.util.Tools.resolve("tinymce.html.DomParser"),k=tinymce.util.Tools.resolve("tinymce.html.Node"),R=tinymce.util.Tools.resolve("tinymce.html.Schema"),F=tinymce.util.Tools.resolve("tinymce.html.Serializer");function E(t,e){return b.each(e,function(e){t=e.constructor===RegExp?t.replace(e,""):t.replace(e[0],e[1])}),t}var S={filter:E,innerText:function(t){var n=R(),r=C({},n),a="",i=n.getShortEndedElements(),o=b.makeMap("script noscript style textarea video audio iframe object"," "),s=n.getBlockElements();return t=E(t,[/<!\[[^\]]+\]>/g]),function e(t){var n=t.name,r=t;if("br"!==n)if(i[n]&&(a+=" "),o[n])a+=" ";else{if(3===t.type&&(a+=t.value),!t.shortEnded&&(t=t.firstChild))for(;e(t),t=t.next;);s[n]&&r.next&&(a+="\n","p"===n&&(a+="\n"))}else a+="\n"}(r.parse(t)),a},trimHtml:function(e){return e=E(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,function(e,t,n){return t||n?"\xa0":" "}],/<br class="Apple-interchange-newline">/g,/<br>$/i])},createIdGenerator:function(e){var t=0;return function(){return e+t++}},isMsEdge:function(){return-1!==navigator.userAgent.indexOf(" Edge/")}};function I(t){var n,e;return e=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],t=t.replace(/^[\u00a0 ]+/,""),b.each(e,function(e){if(e.test(t))return!(n=!0)}),n}function M(e){var i,o,s=1;function n(e){var t="";if(3===e.type)return e.value;if(e=e.firstChild)for(;t+=n(e),e=e.next;);return t}function l(e,t){if(3===e.type&&t.test(e.value))return e.value=e.value.replace(t,""),!1;if(e=e.firstChild)do{if(!l(e,t))return!1}while(e=e.next);return!0}function t(t,n,r){var a=t._listLevel||s;a!==s&&(a<s?i&&(i=i.parent.parent):(o=i,i=null)),i&&i.name===n?i.append(t):(o=o||i,i=new k(n,1),1<r&&i.attr("start",""+r),t.wrap(i)),t.name="li",s<a&&o&&o.lastChild.append(i),s=a,function e(t){if(t._listIgnore)t.remove();else if(t=t.firstChild)for(;e(t),t=t.next;);}(t),l(t,/^\u00a0+/),l(t,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),l(t,/^\u00a0+/)}for(var r=[],a=e.firstChild;null!=a;)if(r.push(a),null!==(a=a.walk()))for(;void 0!==a&&a.parent!==e;)a=a.walk();for(var u=0;u<r.length;u++)if("p"===(e=r[u]).name&&e.firstChild){var c=n(e);if(/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(c)){t(e,"ul");continue}if(I(c)){var f=/([0-9]+)\./.exec(c),d=1;f&&(d=parseInt(f[1],10)),t(e,"ol",d);continue}if(e._listLevel){t(e,"ul",1);continue}i=null}else o=i,i=null}function O(n,r,a,i){var o,s={},e=n.dom.parseStyle(i);return b.each(e,function(e,t){switch(t){case"mso-list":(o=/\w+ \w+([0-9]+)/i.exec(i))&&(a._listLevel=parseInt(o[1],10)),/Ignore/i.test(e)&&a.firstChild&&(a._listIgnore=!0,a.firstChild._listIgnore=!0);break;case"horiz-align":t="text-align";break;case"vert-align":t="vertical-align";break;case"font-color":case"mso-foreground":t="color";break;case"mso-background":case"mso-highlight":t="background";break;case"font-weight":case"font-style":return void("normal"!==e&&(s[t]=e));case"mso-element":if(/^(comment|comment-list)$/i.test(e))return void a.remove()}0!==t.indexOf("mso-comment")?0!==t.indexOf("mso-")&&("all"===m.getRetainStyleProps(n)||r&&r[t])&&(s[t]=e):a.remove()}),/(bold)/i.test(s["font-weight"])&&(delete s["font-weight"],a.wrap(new k("b",1))),/(italic)/i.test(s["font-style"])&&(delete s["font-style"],a.wrap(new k("i",1))),(s=n.dom.serializeStyle(s,a.name))||null}var A={preProcess:function(e,t){return m.shouldUseDefaultFilters(e)?function(r,e){var t,a;(t=m.getRetainStyleProps(r))&&(a=b.makeMap(t.split(/[, ]/))),e=S.filter(e,[/<br class="?Apple-interchange-newline"?>/gi,/<b[^>]+id="?docs-internal-[^>]*>/gi,/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(e,t){return 0<t.length?t.replace(/./," ").slice(Math.floor(t.length/2)).split("").join("\xa0"):""}]]);var n=m.getWordValidElements(r),i=R({valid_elements:n,valid_children:"-li[p]"});b.each(i.elements,function(e){e.attributes["class"]||(e.attributes["class"]={},e.attributesOrder.push("class")),e.attributes.style||(e.attributes.style={},e.attributesOrder.push("style"))});var o=C({},i);o.addAttributeFilter("style",function(e){for(var t,n=e.length;n--;)(t=e[n]).attr("style",O(r,a,t,t.attr("style"))),"span"===t.name&&t.parent&&!t.attributes.length&&t.unwrap()}),o.addAttributeFilter("class",function(e){for(var t,n,r=e.length;r--;)n=(t=e[r]).attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(n)&&t.remove(),t.attr("class",null)}),o.addNodeFilter("del",function(e){for(var t=e.length;t--;)e[t].remove()}),o.addNodeFilter("a",function(e){for(var t,n,r,a=e.length;a--;)if(n=(t=e[a]).attr("href"),r=t.attr("name"),n&&-1!==n.indexOf("#_msocom_"))t.remove();else if(n&&0===n.indexOf("file://")&&(n=n.split("#")[1])&&(n="#"+n),n||r){if(r&&!/^_?(?:toc|edn|ftn)/i.test(r)){t.unwrap();continue}t.attr({href:n,name:r})}else t.unwrap()});var s=o.parse(e);return m.shouldConvertWordFakeLists(r)&&M(s),e=F({validate:r.settings.validate},i).serialize(s)}(e,t):t},isWordContent:function(e){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(e)||/class="OutlineElement/.test(e)||/id="?docs\-internal\-guid\-/.test(e)}},H=function(e,t){return{content:e,cancelled:t}},B=function(e,t,n,r){var a,i,o,s,l,u,c=f(e,t,n,r);return e.hasEventListeners("PastePostProcess")&&!c.isDefaultPrevented()?(a=e,i=c.content,o=n,s=r,l=a.dom.create("div",{style:"display:none"},i),u=d(a,l,o,s),H(u.node.innerHTML,u.isDefaultPrevented())):H(c.content,c.isDefaultPrevented())},L=function(e,t,n){var r=A.isWordContent(t),a=r?A.preProcess(e,t):t;return B(e,a,n,r)},$=function(e,t){return e.insertContent(t,{merge:m.shouldMergeFormats(e),paste:!0}),!0},j=function(e){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(e)},W=function(e){return j(e)&&/.(gif|jpe?g|png)$/.test(e)},N=function(e,t,n){return!(!1!==e.selection.isCollapsed()||!j(t)||(a=t,i=n,(r=e).undoManager.extra(function(){i(r,a)},function(){r.execCommand("mceInsertLink",!1,a)}),0));var r,a,i},V=function(e,t,n){return!!W(t)&&(a=t,i=n,(r=e).undoManager.extra(function(){i(r,a)},function(){r.insertContent('<img src="'+a+'">')}),!0);var r,a,i},z=function(e,t){var n,r;!1===m.isSmartPasteEnabled(e)?$(e,t):(n=e,r=t,b.each([N,V,$],function(e){return!0!==e(n,r,$)}))},K=function(e,t,n){var r=n||y(t),a=L(e,g(t),r);!1===a.cancelled&&z(e,a.content)},U=function(e,t){t=e.dom.encode(t).replace(/\r\n/g,"\n"),t=T(t,e.settings.forced_root_block,e.settings.forced_root_block_attrs),K(e,t,!1)},G=function(e){var t={};if(e){if(e.getData){var n=e.getData("Text");n&&0<n.length&&-1===n.indexOf("data:text/mce-internal,")&&(t["text/plain"]=n)}if(e.types)for(var r=0;r<e.types.length;r++){var a=e.types[r];try{t[a]=e.getData(a)}catch(i){t[a]=""}}}return t},X=function(e,t){return t in e&&0<e[t].length},q=function(e){return X(e,"text/html")||X(e,"text/plain")},Y=S.createIdGenerator("mceclip"),Z=function(e,t,n,r){t&&(e.selection.setRng(t),t=null);var a,i,o,s,l,u,c,f=n.result,d=-1!==(i=(a=f).indexOf(","))?a.substr(i+1):null,m=Y(),p=e.settings.images_reuse_filename&&r.name?(o=e,s=r.name,(l=s.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i))?o.dom.encode(l[1]):null):m,g=new Image;if(g.src=f,u=e.settings,c=g,!u.images_dataimg_filter||u.images_dataimg_filter(c)){var v,h=e.editorUpload.blobCache,b=void 0;(v=h.findFirst(function(e){return e.base64()===d}))?b=v:(b=h.create(m,r,d,p),h.add(b)),K(e,'<img src="'+b.blobUri()+'">',!1)}else K(e,'<img src="'+f+'">',!1)},J=function(o,s,l){var e="paste"===s.type?s.clipboardData:s.dataTransfer;function t(e){var t,n,r,a=!1;if(e)for(t=0;t<e.length;t++)if(n=e[t],/^image\/(jpeg|png|gif|bmp)$/.test(n.type)){var i=n.getAsFile?n.getAsFile():n;(r=new window.FileReader).onload=Z.bind(null,o,l,r,i),r.readAsDataURL(i),s.preventDefault(),a=!0}return a}if(o.settings.paste_data_images&&e)return t(e.items)||t(e.files)},Q=function(e){return a.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode},ee=function(c,f,d){var m,p=0;function g(e,t,n,r){var a,i;X(e,"text/html")?a=e["text/html"]:(a=f.getHtml(),r=r||y(a),f.isDefaultContent(a)&&(n=!0)),a=S.trimHtml(a),f.remove(),i=!1===r&&D(a),a.length&&!i||(n=!0),n&&(a=X(e,"text/plain")&&i?e["text/plain"]:S.innerText(a)),f.isDefaultContent(a)?t||c.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):n?U(c,a):K(c,a,r)}c.on("keydown",function(e){function t(e){Q(e)&&!e.isDefaultPrevented()&&f.remove()}if(Q(e)&&!e.isDefaultPrevented()){if((m=e.shiftKey&&86===e.keyCode)&&v.webkit&&-1!==navigator.userAgent.indexOf("Version/"))return;if(e.stopImmediatePropagation(),p=(new Date).getTime(),v.ie&&m)return e.preventDefault(),void n(c,!0);f.remove(),f.create(),c.once("keyup",t),c.once("paste",function(){c.off("keyup",t)})}}),c.on("paste",function(e){var t,n,r,a=(new Date).getTime(),i=(t=c,n=G(e.clipboardData||t.getDoc().dataTransfer),S.isMsEdge()?b.extend(n,{"text/html":""}):n),o=(new Date).getTime()-a,s=(new Date).getTime()-p-o<1e3,l="text"===d.get()||m,u=X(i,x());m=!1,e.isDefaultPrevented()||(r=e.clipboardData,-1!==navigator.userAgent.indexOf("Android")&&r&&r.items&&0===r.items.length)?f.remove():q(i)||!J(c,e,f.getLastRng()||c.selection.getRng())?(s||e.preventDefault(),!v.ie||s&&!e.ieFake||X(i,"text/html")||(f.create(),c.dom.bind(f.getEl(),"paste",function(e){e.stopPropagation()}),c.getDoc().execCommand("Paste",!1,null),i["text/html"]=f.getHtml()),X(i,"text/html")?(e.preventDefault(),u||(u=y(i["text/html"])),g(i,s,l,u)):h.setEditorTimeout(c,function(){g(i,s,l,u)},0)):f.remove()})},te=function(e){return v.ie&&e.inline?document.body:e.getBody()},ne=function(t,e){var n;te(n=t)!==n.getBody()&&t.dom.bind(e,"paste keyup",function(e){setTimeout(function(){t.fire("paste")},0)})},re=function(e){return e.dom.get("mcepastebin")},ae=function(e,t){return t===e},ie=function(o){var s=u(null),l="%MCEPASTEBIN%";return{create:function(){return t=s,n=l,a=(e=o).dom,i=e.getBody(),t.set(e.selection.getRng()),r=e.dom.add(te(e),"div",{id:"mcepastebin","class":"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},n),(v.ie||v.gecko)&&a.setStyle(r,"left","rtl"===a.getStyle(i,"direction",!0)?65535:-65535),a.bind(r,"beforedeactivate focusin focusout",function(e){e.stopPropagation()}),ne(e,r),r.focus(),void e.selection.select(r,!0);var e,t,n,r,a,i},remove:function(){return function(e,t){if(re(e)){for(var n=void 0,r=t.get();n=e.dom.get("mcepastebin");)e.dom.remove(n),e.dom.unbind(n);r&&e.selection.setRng(r)}t.set(null)}(o,s)},getEl:function(){return re(o)},getHtml:function(){return function(n){var t,e,r,a,i,o=function(e,t){e.appendChild(t),n.dom.remove(t,!0)};for(e=b.grep(te(n).childNodes,function(e){return"mcepastebin"===e.id}),t=e.shift(),b.each(e,function(e){o(t,e)}),r=(a=n.dom.select("div[id=mcepastebin]",t)).length-1;0<=r;r--)i=n.dom.create("div"),t.insertBefore(i,a[r]),o(i,a[r]);return t?t.innerHTML:""}(o)},getLastRng:function(){return s.get()},isDefault:function(){return e=l,n=re(o),(t=n)&&"mcepastebin"===t.id&&ae(e,n.innerHTML);var e,t,n},isDefaultContent:function(e){return ae(l,e)}}},oe=function(n,e){var t=ie(n);return n.on("preInit",function(){return ee(o=n,t,e),void o.parser.addNodeFilter("img",function(e,t,n){var r,a=function(e){e.attr("data-mce-object")||s===v.transparentSrc||e.remove()};if(!o.settings.paste_data_images&&(r=n).data&&!0===r.data.paste)for(var i=e.length;i--;)(s=e[i].attributes.map.src)&&(0===s.indexOf("webkit-fake-url")?a(e[i]):o.settings.allow_html_data_urls||0!==s.indexOf("data:")||a(e[i]))});var o,s}),{pasteFormat:e,pasteHtml:function(e,t){return K(n,e,t)},pasteText:function(e){return U(n,e)},pasteImageData:function(e,t){return J(n,e,t)},getDataTransferItems:G,hasHtmlOrText:q,hasContentType:X}},se=function(){},le=function(e,t,n){if(r=e,!1!==v.iOS||r===undefined||"function"!=typeof r.setData||!0===S.isMsEdge())return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(x(),t),!0}catch(a){return!1}var r},ue=function(e,t,n,r){le(e.clipboardData,t.html,t.text)?(e.preventDefault(),r()):n(t.html,r)},ce=function(s){return function(e,t){var n=p(e),r=s.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=s.dom.create("div",{contenteditable:"true"},n);s.dom.setStyles(r,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),r.appendChild(a),s.dom.add(s.getBody(),r);var i=s.selection.getRng();a.focus();var o=s.dom.createRng();o.selectNodeContents(a),s.selection.setRng(o),setTimeout(function(){s.selection.setRng(i),r.parentNode.removeChild(r),t()},0)}},fe=function(e){return{html:e.selection.getContent({contextual:!0}),text:e.selection.getContent({format:"text"})}},de=function(e){var t,n;e.on("cut",(t=e,function(e){!1===t.selection.isCollapsed()&&ue(e,fe(t),ce(t),function(){setTimeout(function(){t.execCommand("Delete")},0)})})),e.on("copy",(n=e,function(e){!1===n.selection.isCollapsed()&&ue(e,fe(n),ce(n),se)}))},me=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),pe=function(e,t){return me.getCaretRangeFromPoint(t.clientX,t.clientY,e.getDoc())},ge=function(e,t){e.focus(),e.selection.setRng(t)},ve=function(o,s,l){m.shouldBlockDrop(o)&&o.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault(),e.stopPropagation()}),m.shouldPasteDataImages(o)||o.on("drop",function(e){var t=e.dataTransfer;t&&t.files&&0<t.files.length&&e.preventDefault()}),o.on("drop",function(e){var t,n;if(n=pe(o,e),!e.isDefaultPrevented()&&!l.get()){t=s.getDataTransferItems(e.dataTransfer);var r,a=s.hasContentType(t,x());if((s.hasHtmlOrText(t)&&(!(r=t["text/plain"])||0!==r.indexOf("file://"))||!s.pasteImageData(e,n))&&n&&m.shouldFilterDrop(o)){var i=t["mce-internal"]||t["text/html"]||t["text/plain"];i&&(e.preventDefault(),h.setEditorTimeout(o,function(){o.undoManager.transact(function(){t["mce-internal"]&&o.execCommand("Delete"),ge(o,n),i=S.trimHtml(i),t["text/html"]?s.pasteHtml(i,a):s.pasteText(i)})}))}