Forms by CaptainForm – Form Builder for WordPress - Version 1.7.0

Version Description

(19 September 2016) = * Integration between CaptainForm and Forge

Download this release

Release Info

Developer 123contactform
Plugin Icon 128x128 Forms by CaptainForm – Form Builder for WordPress
Version 1.7.0
Comparing to
See all releases

Version 1.7.0

Files changed (72) hide show
  1. LICENSE +674 -0
  2. captainform.php +37 -0
  3. dialog/editor_plugin.js +90 -0
  4. includes/CaptainFormWidget.php +206 -0
  5. includes/admin-page.php +387 -0
  6. includes/css/chosen/chosen-sprite.png +0 -0
  7. includes/css/chosen/chosen-sprite@2x.png +0 -0
  8. includes/css/chosen/chosen.css +425 -0
  9. includes/css/credentials_error.css +8 -0
  10. includes/css/forge_element.css +48 -0
  11. includes/css/form_popup.css +106 -0
  12. includes/css/hide_adminbar.css +15 -0
  13. includes/css/iframe_popup.css +292 -0
  14. includes/css/publish_lightbox_posts.css +150 -0
  15. includes/css/review.css +98 -0
  16. includes/css/widget.css +123 -0
  17. includes/css/wp_captainform_os.css +71 -0
  18. includes/display-functions.php +240 -0
  19. includes/encryption.php +112 -0
  20. includes/form-resources/global-vars.php +11 -0
  21. includes/form-resources/lightbox-auto-embedding.php +8 -0
  22. includes/form-resources/lightbox-embedding.php +6 -0
  23. includes/form-resources/normal-embedding.php +29 -0
  24. includes/form-resources/tinybox-resources.php +17 -0
  25. includes/hooks.php +12 -0
  26. includes/images/black-50.png +0 -0
  27. includes/images/captainform-18.png +0 -0
  28. includes/images/captainform-32.png +0 -0
  29. includes/images/close.svg +1 -0
  30. includes/images/close_hover.svg +1 -0
  31. includes/images/dropdownarrow.png +0 -0
  32. includes/images/icon-alert-close.png +0 -0
  33. includes/images/icon-alert.png +0 -0
  34. includes/images/icon-danger.png +0 -0
  35. includes/images/icon-success.png +0 -0
  36. includes/images/loader_350.gif +0 -0
  37. includes/images/loader_cf.GIF +0 -0
  38. includes/images/ppform_preloader.gif +0 -0
  39. includes/images/publish_lighbox_default_image_v2.png +0 -0
  40. includes/images/ring.svg +1 -0
  41. includes/init.php +36 -0
  42. includes/integrations/forge-element.php +102 -0
  43. includes/integrations/wp-integrations-handler.php +134 -0
  44. includes/integrations/wp-posts.php +204 -0
  45. includes/integrations/wp-users.php +58 -0
  46. includes/js/chosen.jquery.js +1317 -0
  47. includes/js/form_popup.js +141 -0
  48. includes/js/iframeResizer.contentWindow.min.js +10 -0
  49. includes/js/iframeResizer.map +1 -0
  50. includes/js/iframeResizer.min.js +9 -0
  51. includes/js/jscolor/arrow.gif +0 -0
  52. includes/js/jscolor/cross.gif +0 -0
  53. includes/js/jscolor/hs.png +0 -0
  54. includes/js/jscolor/hv.png +0 -0
  55. includes/js/jscolor/jscolor.js +840 -0
  56. includes/js/main.js +484 -0
  57. includes/js/misc_functions.js +36 -0
  58. includes/js/nolink.js +9 -0
  59. includes/js/review.js +107 -0
  60. includes/js/tinybox/images/close.png +0 -0
  61. includes/js/tinybox/images/preload.gif +0 -0
  62. includes/js/tinybox/tinybox.js +134 -0
  63. includes/js/tinybox/tinyboxstyle.css +17 -0
  64. includes/js/tinybox/tinyboxstyle_ios.css +4 -0
  65. includes/js/widget.js +212 -0
  66. includes/settings.php +94 -0
  67. includes/shortcodes.php +34 -0
  68. readme.txt +201 -0
  69. views/credentials_error.php +30 -0
  70. views/main.php +36 -0
  71. views/options_page.php +51 -0
  72. views/publish_lightbox.php +142 -0
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>.
captainform.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+ /*
4
+ Plugin Name: CaptainForm Plugin
5
+ Plugin URI: http://captainform.com
6
+ Description: CaptainForm is a fully-featured WordPress form plugin created for web designers, developers, and also for non-tech savvy users.
7
+ Author: CaptainForm
8
+ Author URI: https://profiles.wordpress.org/captainform
9
+ Version: 1.7.0
10
+ */
11
+
12
+ /* * ****************************
13
+ * includes
14
+ * **************************** */
15
+ require_once(plugin_dir_path(__FILE__) . 'includes/init.php'); // session initialization
16
+ require_once(plugin_dir_path(__FILE__) . 'includes/encryption.php'); //captainform encryption class
17
+ require_once(plugin_dir_path(__FILE__) . 'includes/settings.php'); // this contain plugin settings
18
+ require_once(plugin_dir_path(__FILE__) . 'includes/shortcodes.php'); // this contain plugin shortcodes
19
+ require_once(plugin_dir_path(__FILE__) . 'includes/hooks.php'); //register the hooks
20
+ require_once(plugin_dir_path(__FILE__) . 'includes/display-functions.php'); // display content functions
21
+ require_once(plugin_dir_path(__FILE__) . 'includes/CaptainFormWidget.php'); // widget
22
+ require_once(plugin_dir_path(__FILE__) . 'includes/admin-page.php'); // the plugin options page HTML and save functions
23
+ require_once(plugin_dir_path(__FILE__) . 'views/main.php'); // the plugin options page HTML and save functions
24
+ require_once(plugin_dir_path(__FILE__) . 'views/options_page.php');
25
+ require_once(plugin_dir_path(__FILE__) . 'views/credentials_error.php');
26
+ require_once(plugin_dir_path(__FILE__) . 'includes/integrations/wp-integrations-handler.php');
27
+ require_once(plugin_dir_path(__FILE__) . 'includes/integrations/wp-posts.php');
28
+ require_once(plugin_dir_path(__FILE__) . 'includes/integrations/wp-users.php');
29
+
30
+ require_once(plugin_dir_path(__FILE__) . 'includes/integrations/forge-element.php');
31
+
32
+ /* * ****************************
33
+ * register hooks
34
+ * **************************** */
35
+ register_activation_hook(__FILE__, 'captainform_activate');
36
+ register_deactivation_hook(__FILE__, 'captainform_deactivate');
37
+ register_uninstall_hook(__FILE__, 'captainform_uninstall');
dialog/editor_plugin.js ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+ tinymce.create('tinymce.plugins.captainform', {
3
+ init: function (editor, url) {
4
+
5
+ var root_url = url.replace("/captainform/dialog", "/captainform");
6
+ editor.addButton('captainform', {
7
+ image: root_url + "/includes/images/captainform-18.png",
8
+ tooltip: 'Insert Form',
9
+ cmd: 'captainform_insert'
10
+ });
11
+
12
+ editor.addCommand('captainform_insert', function () {
13
+ // Calls the pop-up modal
14
+ editor.windowManager.open({
15
+ action: 'captainform_insert_dialog',
16
+ title: 'Insert Form',
17
+ width: (jQuery(window).width() * 0.7) < 600 ? jQuery(window).width() * 0.7 : 600,
18
+ // minus head and foot of dialog box
19
+ height: ((jQuery(window).height() - 36 - 50) * 0.7) < 365 ? (jQuery(window).height() - 36 - 50) * 0.7 : 365,
20
+ resizable: true,
21
+ inline: 1,
22
+ scrollbars: 'x',
23
+ id: 'captainform-insert-dialog',
24
+ buttons: [{
25
+ text: 'Insert form',
26
+ id: 'captainform-button-insert',
27
+ class: 'captainform-insert',
28
+ onclick: function (e) {
29
+ insertShortcode();
30
+ editor.windowManager.close();
31
+ },
32
+ },
33
+ {
34
+ text: 'Cancel',
35
+ id: 'captainform-button-cancel',
36
+ onclick: 'close'
37
+ }],
38
+ });
39
+ appendInsertDialog(root_url);
40
+ });
41
+ },
42
+ getInfo : function() {
43
+ return {
44
+ longname : 'CaptainForm for Wordpress plugin',
45
+ author : 'Captain Form',
46
+ authorurl : 'http://www.captainform.com',
47
+ infourl : '',
48
+ version : "1.2.0"
49
+ };
50
+ }
51
+
52
+ });
53
+
54
+ tinymce.PluginManager.add('captainform', tinymce.plugins.captainform);
55
+
56
+ function insertShortcode() {
57
+ var code = document.getElementById('captainform_publish_code').value;
58
+ top.window.tinyMCE.execCommand('mceInsertContent', false, code);
59
+ }
60
+ function appendInsertDialog(root_url) {
61
+ var captainformDialogBody;
62
+ captainformDialogBody = jQuery('#captainform-insert-dialog-body');
63
+
64
+ captainformDialogBody.append('<link rel="stylesheet" type="text/css" href="'+root_url+'/includes/css/chosen/chosen.css" />');
65
+ captainformDialogBody.append('<link rel="stylesheet" type="text/css" href="'+root_url+'/includes/css/widget.css" />');
66
+ captainformDialogBody.append('<link rel="stylesheet" type="text/css" href="'+root_url+'/includes/css/publish_lightbox_posts.css" />');
67
+
68
+ captainformDialogBody.append('<span class="captainform_spinner">Loading, please wait...</span>');
69
+ // Get the form template from WordPress
70
+ var ajax_url = captainform_get_absolute_path() + 'admin-ajax.php';
71
+ jQuery.post(ajax_url, {
72
+ action: 'captainform_insert_dialog'
73
+ }, function (response) {
74
+ window.captainform_is_widget_page = false;
75
+ captainformDialogBody.children('.captainform_spinner').remove();
76
+ captainformDialogBody.append(response);
77
+ }).done(function () {
78
+ if (typeof jscolor != 'undefined') {
79
+ jscolor.dir = root_url + "/includes/js/jscolor/";
80
+ captainform_bind_widget();
81
+ }
82
+ });
83
+ }
84
+ })();
85
+
86
+ function captainform_get_absolute_path() {
87
+ var loc = window.location;
88
+ var pathName = loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1);
89
+ return loc.href.substring(0, loc.href.length - ((loc.pathname + loc.search + loc.hash).length - pathName.length));
90
+ }
includes/CaptainFormWidget.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+ if (!class_exists('CaptainFormWidget')) {
4
+
5
+ class CaptainFormWidget extends WP_Widget
6
+ {
7
+ private $publish_type = 'widget';
8
+ private static $widget_count = 0;
9
+
10
+ function __construct()
11
+ {
12
+ parent::__construct(
13
+ false,
14
+ // name of the widget
15
+ __('CaptainForm', 'captainform'),
16
+ // widget options
17
+ array(
18
+ 'description' => __('Add a form to the sidebar', 'captainform')
19
+ )
20
+ );
21
+ if (is_admin()) {
22
+ add_action('admin_print_scripts-widgets.php', 'captainform_widget_css');
23
+ add_action('admin_print_scripts-widgets.php', 'captainform_widget_js');
24
+ }
25
+ }
26
+
27
+ function form($instance)
28
+ {
29
+ $embeded_form = isset($instance['captainform_form_id']) ? esc_attr($instance['captainform_form_id']) : '';
30
+ $response = captainform_get_forms($this->publish_type, ++self::$widget_count);
31
+
32
+ $captainform_display_as_lightbox_name = $this->get_field_name('captainform_display_as_lightbox');
33
+ $captainform_trigger_option_name = $this->get_field_name('captainform_selected_trigger');
34
+ $captainform_lightbox_publish_code_name = $this->get_field_name('captainform_lightbox_publish_code');
35
+
36
+ //Text
37
+ $captainform_trigger_0_name = $this->get_field_name('captainform_trigger_0_text');
38
+ $captainform_trigger_0_text = (isset($instance['captainform_trigger_0_text']) ? esc_attr($instance['captainform_trigger_0_text']) : "Contact us");
39
+
40
+ //click on image
41
+ $captainform_trigger_1_name = $this->get_field_name('captainform_trigger_1_url');
42
+ $captainform_trigger_1_url = isset($instance['captainform_trigger_1_url']) ? esc_attr($instance['captainform_trigger_1_url']) : '';
43
+ if ($captainform_trigger_1_url == "")
44
+ $captainform_trigger_1_url = plugins_url('/includes/images/publish_lighbox_default_image_v2.png', dirname(__FILE__));
45
+
46
+ //floating button
47
+ $captainform_trigger_2_text_name = $this->get_field_name('captainform_trigger_2_text');
48
+ $captainform_trigger_2_text = (isset($instance['captainform_trigger_2_text']) ? esc_attr($instance['captainform_trigger_2_text']) : "Contact us");
49
+ $captainform_trigger_2_position_name = $this->get_field_name('captainform_trigger_2_position');
50
+ $captainform_trigger_2_position = (isset($instance['captainform_trigger_2_position']) ? ($instance['captainform_trigger_2_position'] != '' ? esc_attr($instance['captainform_trigger_2_position']) : 1) : 1);
51
+ $captainform_trigger_2_background_name = $this->get_field_name('captainform_trigger_2_background');
52
+ $captainform_trigger_2_background = (isset($instance['captainform_trigger_2_background']) ? esc_attr($instance['captainform_trigger_2_background']) : '');
53
+ if ($captainform_trigger_2_background == '')
54
+ $captainform_trigger_2_background = "FF0000";
55
+ $captainform_trigger_2_color_name = $this->get_field_name('captainform_trigger_2_color');
56
+ $captainform_trigger_2_color = (isset($instance['captainform_trigger_2_color']) ? esc_attr($instance['captainform_trigger_2_color']) : '');
57
+ if ($captainform_trigger_2_color == '')
58
+ $captainform_trigger_2_color = "FFFFFF";
59
+
60
+ //Auto popup
61
+ $captainform_trigger_3_after_name = $this->get_field_name('captainform_trigger_3_after');
62
+ $captainform_trigger_3_after = (isset($instance['captainform_trigger_3_after']) ? esc_attr($instance['captainform_trigger_3_after']) : 5);
63
+
64
+ $captainform_publish_code_value = isset($instance['captainform_lightbox_publish_code']) ? esc_attr($instance['captainform_lightbox_publish_code']) : '';
65
+ $display_as_lightbox = (isset($instance['captainform_display_as_lightbox']) ? esc_attr($instance['captainform_display_as_lightbox']) : 3);
66
+ $captainform_selected_trigger = (isset($instance['captainform_selected_trigger']) && $display_as_lightbox == 1 ? esc_attr($instance['captainform_selected_trigger']) : 3);
67
+
68
+ if ($response->status == 'ok') {
69
+ // markup for form
70
+ ?>
71
+ <div class="captainform_widget_container">
72
+ <p>
73
+ <label for="<?php echo $this->get_field_id('captainform_form_id'); ?>">
74
+ Select the form you want to embed:
75
+ </label>
76
+ </p>
77
+ <div>
78
+ <select name="<?php echo $this->get_field_name('captainform_form_id'); ?>"
79
+ class="captainform_widget_select"
80
+ id="<?php echo $this->get_field_id('captainform_form_id'); ?>">
81
+ <?php foreach ($response->forms as $form): ?>
82
+ <option
83
+ value="<?php echo $form->f_id; ?>" <?php echo ($form->f_id == $embeded_form) ? 'selected' : '' ?> >
84
+ <?php echo $form->f_name; ?>
85
+ </option>
86
+ <?php endforeach; ?>
87
+ </select>
88
+ </div>
89
+ <?php
90
+ require(plugin_dir_path(dirname(__FILE__)) . 'views/publish_lightbox.php');
91
+ ?>
92
+ <input type="hidden" name="<?php echo $captainform_lightbox_publish_code_name; ?>"
93
+ class='cf_generated_code' value="<?php echo $captainform_publish_code_value; ?>"/>
94
+ </div>
95
+ <?php
96
+ } else {
97
+ ?>
98
+ <div class="error_message_container">
99
+ <?php
100
+ if ($response->error_message) {
101
+ if (isset($response->error_code) && $response->error_code == 2) {
102
+ echo sprintf("%sCreate a form%s and return here to publish it in your sidebar.", '<a href="admin.php?page=CaptainForm-NewForm">', "</a>");
103
+ } elseif (isset($response->error_code) && $response->error_code == 1) {
104
+ echo sprintf("Please activate your account first! Go to the CaptainForm tab and enter your license key or activate your free account. %sCreate a form%s and return here to publish it.", '<a href="admin.php?page=CaptainForm-NewForm">', "</a>");
105
+ } else
106
+ echo $response->error_message;
107
+ } else
108
+ echo 'Fatal error - ' . $response->status;
109
+ ?>
110
+ </div>
111
+ <?php
112
+ }
113
+ }
114
+
115
+ function update($new_instance, $old_instance)
116
+ {
117
+ $instance = $old_instance;
118
+ $instance['captainform_form_id'] = intval($new_instance['captainform_form_id']);
119
+ $display_as_lightbox = intval($new_instance['captainform_display_as_lightbox']);
120
+ $instance['captainform_display_as_lightbox'] = $display_as_lightbox;
121
+ $instance['captainform_selected_trigger'] = ($display_as_lightbox == 1 ? intval($new_instance['captainform_selected_trigger']) : 0);
122
+ $instance['captainform_trigger_0_text'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_0_text'] : '');
123
+ $instance['captainform_trigger_1_url'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_1_url'] : '');
124
+ $instance['captainform_trigger_2_text'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_text'] : '');
125
+ $instance['captainform_trigger_2_position'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_position'] : '');
126
+ $instance['captainform_trigger_2_background'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_background'] : '');
127
+ $instance['captainform_trigger_2_color'] = ($display_as_lightbox == 1 ? $new_instance['captainform_trigger_2_color'] : '');
128
+ $instance['captainform_trigger_3_after'] = ($display_as_lightbox == 1 ? (intval($new_instance['captainform_trigger_3_after']) > 0 ? intval($new_instance['captainform_trigger_3_after']) : 3) : 3);
129
+ $instance['captainform_lightbox_publish_code'] = $new_instance['captainform_lightbox_publish_code'];
130
+ return $instance;
131
+ }
132
+
133
+ function widget($args, $instance)
134
+ {
135
+ extract($args);
136
+ global $post;
137
+ $shortcode = '[captainform id="' . $instance['captainform_form_id'] . '"]';
138
+ if (isset($instance['captainform_lightbox_publish_code']) && $instance['captainform_lightbox_publish_code'] != '')
139
+ $shortcode = $instance['captainform_lightbox_publish_code'];
140
+
141
+ $is_lightbox_pattern = '/\[[^\[]*captain-?form.*lightbox=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
142
+ $is_lighbox = preg_match($is_lightbox_pattern, $shortcode) ? true : false;
143
+
144
+ $type_pattern = '/\[[^\[]*captain-?form.*type=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
145
+ preg_match($type_pattern, $shortcode, $matches_type);
146
+ $shortcode_option_type = isset($matches_type[1]) ? $matches_type[1] : null;
147
+
148
+ $show_widget_area = ($is_lighbox && in_array($shortcode_option_type, array('floating-button', 'auto-popup'))) ? false : true;
149
+
150
+ if ($show_widget_area) {
151
+ echo $before_widget;
152
+ echo $before_title . $after_title;
153
+ }
154
+
155
+ echo captainform_widget_text_filter($shortcode);
156
+
157
+ wp_reset_query();
158
+
159
+ if ($show_widget_area)
160
+ echo $after_widget;
161
+ }
162
+
163
+ }
164
+
165
+ }
166
+
167
+ function captainform_register_forms_widget()
168
+ {
169
+ register_widget('CaptainFormWidget');
170
+ }
171
+
172
+ $php_version = phpversion();
173
+ if ($php_version >= 5.3) {
174
+ add_action('widgets_init', 'captainform_register_forms_widget');
175
+ } else if ($php_version >= 5.2) {
176
+ add_action('widgets_init',
177
+ create_function('', 'return register_widget("CaptainFormWidget");')
178
+ );
179
+ }
180
+
181
+ function captainform_widget_text_filter($content)
182
+ {
183
+ $content = captainform_text_filter($content);
184
+ return $content;
185
+ }
186
+
187
+ add_filter('widget_text', 'captainform_widget_text_filter', 1);
188
+
189
+ /* resources */
190
+
191
+ function captainform_widget_css()
192
+ {
193
+ wp_enqueue_style('cf-widget-css', plugins_url('/css/widget.css', __FILE__), false, false);
194
+ wp_enqueue_style('cf-chosen-css', plugins_url('/css/chosen/chosen.css', __FILE__), false, false);
195
+ }
196
+
197
+ function captainform_widget_js()
198
+ {
199
+ wp_register_script('cf_color_picker_js', plugins_url('/js/jscolor/jscolor.js', __FILE__), array('jquery'), false, true);
200
+ wp_register_script('cf_widget_js', plugins_url('/js/widget.js', __FILE__), array('cf_color_picker_js'), false, true);
201
+ wp_register_script('cf_chosen_js', plugins_url('/js/chosen.jquery.js', __FILE__), array('cf_widget_js'), false, false);
202
+ wp_enqueue_script('jquery');
203
+ wp_enqueue_script('cf_color_picker_js');
204
+ wp_enqueue_script('cf_chosen_js');
205
+ wp_enqueue_script('cf_widget_js');
206
+ }
includes/admin-page.php ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+
4
+ function captainform_generate_installation_id()
5
+ {
6
+ // we generate an installationId with maximum length of 58, because the space in DB is 60
7
+ // and we prepend -- for the email
8
+ $alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
9
+
10
+ $admin_email = get_site_option("admin_email");
11
+ $timestamp = dechex(time());
12
+
13
+ $neededChars = 13 - strlen($timestamp);
14
+ $rand = substr(str_shuffle($alphanum), 0, $neededChars);
15
+
16
+ $computedId = $timestamp . $rand . "." . $admin_email;
17
+
18
+ if (strlen($computedId) >= 58)
19
+ $computedId = substr($computedId, -58);
20
+ return $computedId;
21
+ }
22
+
23
+ function captainform_generate_installation_key()
24
+ {
25
+ $alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
26
+ $installation_key = md5(substr(str_shuffle($alphanum), 0, 15));
27
+ return $installation_key;
28
+ }
29
+
30
+ function captainform_update_website_url(){
31
+ update_site_option($GLOBALS['captainform_option3'], get_site_option("siteurl"));
32
+ }
33
+
34
+ function captainform_generate_new_credentials()
35
+ {
36
+ $installation_id = captainform_generate_installation_id();
37
+ update_site_option($GLOBALS['captainform_option1'], $installation_id);
38
+
39
+ $installation_key = captainform_generate_installation_key();
40
+ update_site_option($GLOBALS['captainform_option2'], $installation_key);
41
+
42
+ captainform_update_website_url();
43
+ }
44
+
45
+ function captainform_get_site_type()
46
+ {
47
+ return is_multisite();
48
+ }
49
+
50
+ function captainform_get_ref_param()
51
+ {
52
+ $plugin_referer = '';
53
+ $myref = (__DIR__) . '/referer.php';
54
+ if (file_exists($myref)) {
55
+ require_once($myref);
56
+ $plugin_referer = '&plugin_referer=' . $captainform_referer;
57
+ }
58
+ return $plugin_referer;
59
+ }
60
+
61
+ function check_credentials_error(){
62
+ $site_url = get_site_option($GLOBALS['captainform_option3']);
63
+ $site = get_site_option("siteurl");
64
+
65
+ if(!empty($site_url) && $site_url != $site)
66
+ {
67
+ if(isset($_POST['captainform_reset_keys']))
68
+ {
69
+ if(intval($_POST['captainform_reset_keys']) == 1)
70
+ captainform_generate_new_credentials();
71
+ else
72
+ {
73
+ captainform_update_website_url();
74
+ return $site;
75
+ }
76
+ return true;
77
+ }
78
+ captainform_draw_credentials_error();
79
+ return false;
80
+ }
81
+ return true;
82
+ }
83
+
84
+ function captainform_page_handler()
85
+ {
86
+ global $captainform_plugin_version;
87
+
88
+ $credentials_check = check_credentials_error();
89
+ if (!$credentials_check) return false;
90
+
91
+ $installation_id = get_site_option($GLOBALS['captainform_option1']);
92
+ $installation_key = get_site_option($GLOBALS['captainform_option2']);
93
+ $site = get_site_option("siteurl");
94
+ $site_real = get_option("siteurl");
95
+
96
+ $current_user = wp_get_current_user();
97
+ $display_name = $current_user->data->display_name;
98
+ $page = $_GET['page'];
99
+ $wp_protocol = parse_url(site_url(), 0);
100
+ $wp_subid = "wp-" . str_replace('.' . get_site_option("admin_email"), "", $installation_id);
101
+ $wp_subid = explode('.', $wp_subid);
102
+ $wp_subid = $wp_subid[0];
103
+
104
+ $wp_seturl = $wp_protocol . "://" . $wp_subid . "." . $GLOBALS['captainform_servicedomain'];
105
+
106
+ $wp_seturl = strtolower($wp_seturl);
107
+ $url = $wp_seturl . "/fh-connect.php?inst=" . captainform_wpp_encrypt($installation_id) .
108
+ "&key=" . captainform_wpp_encrypt($installation_key) .
109
+ "&site=" . captainform_wpp_encrypt($site) .
110
+ "&site_real=" . captainform_wpp_encrypt($site_real) .
111
+ "&display_name=" . captainform_wpp_encrypt($display_name) .
112
+ "&page=" . $page .
113
+ "&is_multisite=" . var_export(captainform_get_site_type(), true) .
114
+ captainform_get_ref_param() .
115
+ "&wp_version=" . captainform_wpp_encrypt($captainform_plugin_version) .
116
+ "&wp_php=" . captainform_wpp_encrypt(phpversion());
117
+
118
+ if(gettype($credentials_check) == 'string')
119
+ $url .= '&wp_url_changed=true';
120
+
121
+ switch ($page) {
122
+ case "CaptainForm":
123
+ case 'CaptainForm-NewForm':
124
+ case 'CaptainForm-MyAccount':
125
+ case 'CaptainForm-ChangePlan':
126
+ case 'CaptainForm-Support':
127
+ if (isset($_GET['cf_form_id'])) {
128
+ ob_end_clean();
129
+ captainform_preview_form();
130
+ }
131
+ captainform_draw_main_iframe($url, array($wp_subid . "." . $GLOBALS['captainform_servicedomain'], $wp_protocol, $wp_seturl));
132
+ break;
133
+ case "Captainform-Preview":
134
+ break;
135
+ case "CaptainFormOptions":
136
+ captainform_options_page();
137
+ break;
138
+ default:
139
+ break;
140
+ }
141
+ }
142
+
143
+ function captainform_preview_form($redirect = true)
144
+ {
145
+ $special_captainform_code = '[captainform id="{cf_form_id}"]';
146
+ $post_type = "captainform_post";
147
+ $post_exists = false;
148
+ $post_arr = array();
149
+ $post_content = null;
150
+ $post_id = null;
151
+ if (isset($_GET['cf_form_id']))
152
+ $form_id = (int)$_GET['cf_form_id'];
153
+ else
154
+ $form_id = 726633;
155
+
156
+ if (isset($_GET['captainform_theme_style'])) {
157
+ $captainform_theme_style = $_GET['captainform_theme_style'];
158
+ }
159
+ if (isset($_GET['captainform_preview_as_lightbox'])) {
160
+ $captainform_preview_as_lightbox = $_GET['captainform_preview_as_lightbox'];
161
+ }
162
+
163
+ //search for the post
164
+ $args = "post_type=" . $post_type;
165
+ $query1 = new WP_Query($args);
166
+
167
+ if ($query1->have_posts())
168
+ while ($query1->have_posts()) {
169
+ $post_arr = $query1->the_post();
170
+ $post_id = $query1->post->ID;
171
+ $post_content = get_the_content();
172
+ $post_exists = true;
173
+ break;
174
+ }
175
+ wp_reset_postdata();
176
+
177
+ //Create the post if not exists
178
+ if ($post_exists == false) {
179
+ $post = array(
180
+ 'post_content' => $special_captainform_code, // The full text of the post.
181
+ 'post_name' => "CaptainForm_form_preview", // The name (slug) for your post
182
+ 'post_title' => "CaptainForm Preview", // The title of your post.
183
+ 'post_status' => 'draft',
184
+ 'post_type' => $post_type,
185
+ 'post_excerpt' => $special_captainform_code, // For all your post excerpt needs.
186
+ );
187
+ $post_id = wp_insert_post($post);
188
+ } else if ($post_exists == true && strpos($post_content, $special_captainform_code) === false && $post_id != null) {
189
+ $my_post = array();
190
+ $my_post['ID'] = $post_id;
191
+
192
+ $replace_old_shortcodes = captainform_replace_old_shortcodes($post_content);
193
+
194
+ if($replace_old_shortcodes['replaced'] === true)
195
+ {
196
+ $post_content = $replace_old_shortcodes['content'];
197
+ }
198
+
199
+ $my_post['post_excerpt' ] = $special_captainform_code;
200
+ $my_post['post_content'] = $post_content . $special_captainform_code;
201
+ wp_update_post($my_post);
202
+ }
203
+ elseif($post_exists == true && strpos($post_content, $special_captainform_code) !== false && $post_id != null )
204
+ {
205
+ $replace_old_shortcodes = captainform_replace_old_shortcodes($post_content);
206
+ if($replace_old_shortcodes['replaced'] === true)
207
+ {
208
+ $post_content = $replace_old_shortcodes['content'];
209
+
210
+ $my_post = array();
211
+ $my_post['ID'] = $post_id;
212
+ $my_post['post_content'] = $post_content;
213
+ $my_post['post_excerpt' ] = $special_captainform_code;
214
+ wp_update_post($my_post);
215
+ }
216
+ }
217
+
218
+ $url = add_query_arg('cf_form_id', $form_id, (get_permalink($post_id)));
219
+ if (isset($_GET['captainform_theme_style']))
220
+ $url = add_query_arg('captainform_theme_style', $captainform_theme_style, $url);
221
+ if (isset($_GET['captainform_preview_as_lightbox']))
222
+ $url = add_query_arg('captainform_preview_as_lightbox', $captainform_preview_as_lightbox, $url);
223
+
224
+ if ($redirect === true) {
225
+ wp_redirect($url);
226
+ exit();
227
+ } else
228
+ return $url;
229
+ }
230
+
231
+ /**
232
+ * @param String $content Remove old shortcodes from content
233
+ * @return Array
234
+ */
235
+ function captainform_replace_old_shortcodes($content)
236
+ {
237
+ $old_shortcodes = array(
238
+ '[captainform i{cf_form_id}]'
239
+ );
240
+
241
+ $old_shortcode_found = false;
242
+ foreach($old_shortcodes as $old_code)
243
+ {
244
+ if(strpos($content, $old_code) !== false)
245
+ {
246
+ $content = str_replace ($old_code, "", $content);
247
+ $old_shortcode_found = true;
248
+ }
249
+ }
250
+
251
+ return array(
252
+ 'content' => $content,
253
+ 'replaced' => $old_shortcode_found
254
+ );
255
+ }
256
+
257
+ function captainform_remove_menu_items()
258
+ {
259
+ remove_menu_page('edit.php?post_type=' . 'captainform_post');
260
+ }
261
+
262
+ add_action('admin_menu', 'captainform_remove_menu_items');
263
+
264
+ function captainform_add_options_link()
265
+ {
266
+ if (current_user_can('manage_options')) {
267
+ add_menu_page('CaptainForm', 'CaptainForm', 'manage_options', 'CaptainForm', 'captainform_page_handler', plugins_url('/images/captainform-18.png', __FILE__), '6.000000000000000000123123123123123123123');
268
+ add_submenu_page('CaptainForm', 'CaptainForm', 'My Forms', 'manage_options', 'CaptainForm', 'captainform_page_handler');
269
+ add_submenu_page('CaptainForm', 'NewForm', 'New Form', 'manage_options', 'CaptainForm-NewForm', 'captainform_page_handler');
270
+ add_submenu_page('CaptainForm', 'MyAccount', 'My Account', 'manage_options', 'CaptainForm-MyAccount', 'captainform_page_handler');
271
+ add_submenu_page('CaptainForm', 'ChangePlan', 'Change Plan', 'manage_options', 'CaptainForm-ChangePlan', 'captainform_page_handler');
272
+ add_submenu_page('CaptainForm', 'Support', 'Support', 'manage_options', 'CaptainForm-Support', 'captainform_page_handler');
273
+
274
+ //Wordpress Settings->CaptainForm
275
+ add_options_page('CaptainForm Options', 'CaptainForm', 'manage_options', 'CaptainFormOptions', 'captainform_page_handler');
276
+ }
277
+ }
278
+
279
+ add_action('admin_menu', 'captainform_add_options_link');
280
+
281
+ function captainform_register_settings()
282
+ {
283
+ // creates our settings in the options table
284
+ register_setting('cf_wpp_settings_group', 'cf_wpp_settings');
285
+ }
286
+
287
+ add_action('admin_init', 'captainform_register_settings');
288
+ add_action('init', 'add_ob_start');
289
+
290
+ function add_ob_start()
291
+ {
292
+ ob_start();
293
+ }
294
+
295
+ add_action('init', 'captainform_new_post_type');
296
+
297
+ function captainform_new_post_type()
298
+ {
299
+ register_post_type('captainform_post', array(
300
+ 'public' => true,
301
+ 'show_in_nav_menus' => false,
302
+ 'exclude_from_search' => true,
303
+ 'show_ui' => false,
304
+ ));
305
+ }
306
+
307
+ add_filter('mce_external_plugins', 'captainform_register_external_plugins');
308
+
309
+ function captainform_register_external_plugins($plugin_array)
310
+ {
311
+ $plugin_path = plugin_dir_url(plugin_dir_path(__FILE__));
312
+
313
+ $plugin_array['captainform'] = $plugin_path . 'dialog/editor_plugin.js';
314
+ $plugin_array['captainform_chosen'] = $plugin_path . 'includes/js/chosen.jquery.js';
315
+ $plugin_array['captainform_jscolor'] = $plugin_path . 'includes/js/jscolor/jscolor.js';
316
+ $plugin_array['captainform_widget_js'] = $plugin_path . 'includes/js/widget.js';
317
+ return $plugin_array;
318
+ }
319
+
320
+ add_action('wp_ajax_captainform_insert_dialog', 'captainform_insert_dialog');
321
+
322
+ function captainform_insert_dialog()
323
+ {
324
+ $response = captainform_get_forms('page_or_post');
325
+ if ($response->status == 'ok') {
326
+ $captainform_publish_code_value = "";
327
+ ?>
328
+ <div class="captainform_widget_container">
329
+ <b>Select the form you want to embed:</b>
330
+ <br>
331
+ <select name="<?php echo $GLOBALS['captainform_plugin_name']; ?>_form_toembed"
332
+ id="<?php echo $GLOBALS['captainform_plugin_name']; ?>_form_toembed"
333
+ class="captainform_widget_select">
334
+ <?php
335
+ $first_form_id = null;
336
+ foreach ($response->forms as $form) {
337
+ if ($captainform_publish_code_value == "")
338
+ $captainform_publish_code_value = '[captainform id="' . $form->f_id . '"]';
339
+ ?>
340
+ <option value="<?php echo $form->f_id; ?>"><?php echo $form->f_name; ?></option>
341
+ <?php
342
+ }
343
+ ?>
344
+ </select>
345
+ <div id="captainform_publish_lightbox_main_container">
346
+ <?php
347
+ $captainform_display_as_lightbox_name = "cf_display_as_lightbox_name";
348
+ $captainform_trigger_option_name = "cf_trigger_option_name";
349
+ $captainform_selected_trigger = 0;
350
+ $captainform_trigger_0_name = "cf_trigger_0_name";
351
+ $captainform_trigger_0_text = "Contact Us";
352
+ $captainform_trigger_1_name = "cf_trigger_1_name";
353
+ $captainform_trigger_1_url = plugins_url('/includes/images/publish_lighbox_default_image_v2.png', dirname(__FILE__));
354
+ $captainform_trigger_2_text_name = "cf_trigger_2_text_name";
355
+ $captainform_trigger_2_text = "Contact us";
356
+ $captainform_trigger_2_position_name = "cf_trigger_2_position_name";
357
+ $captainform_trigger_2_position = 1;
358
+ $captainform_trigger_2_background_name = "cf_trigger_2_background_name";
359
+ $captainform_trigger_2_background = "FF0000";
360
+ $captainform_trigger_2_color_name = "cf_trigger_2_color_name";
361
+ $captainform_trigger_2_color = "FFFFFF";
362
+ $captainform_trigger_3_after_name = "cf_trigger_3_after_name";
363
+ $captainform_trigger_3_after = 3;
364
+ require(plugin_dir_path(dirname(__FILE__)) . 'views/publish_lightbox.php');
365
+ ?>
366
+ <br/>
367
+ <input type="hidden" id="captainform_publish_code"
368
+ name="<?php if (isset($captainform_lightbox_publish_code_name)) echo $captainform_lightbox_publish_code_name; ?>"
369
+ class="cf_generated_code" value='<?php echo $captainform_publish_code_value; ?>'/>
370
+ <div class="clear"></div>
371
+ </div>
372
+ <div class="clear"></div>
373
+ </div>
374
+ <?php
375
+ } else {
376
+ if ($response->error_message) {
377
+ if (isset($response->error_code) && $response->error_code == 2) {
378
+ echo "Create a form and return here to publish it";
379
+ } elseif (isset($response->error_code) && $response->error_code == 1) {
380
+ echo "Please activate your account first! Go to the CaptainForm tab and enter your license key or activate your free account. Create a form and return here to publish it.";
381
+ } else
382
+ echo $response->error_message;
383
+ } else
384
+ echo 'Fatal error - ' . $response->status;
385
+ }
386
+ exit();
387
+ }
includes/css/chosen/chosen-sprite.png ADDED
Binary file
includes/css/chosen/chosen-sprite@2x.png ADDED
Binary file
includes/css/chosen/chosen.css ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ /* @group Base */
4
+ .chosen-container {
5
+ position: relative;
6
+ display: inline-block;
7
+ vertical-align: middle;
8
+ /*font-size: 13px;*/
9
+ zoom: 1;
10
+ *display: inline;
11
+ -webkit-user-select: none;
12
+ -moz-user-select: none;
13
+ user-select: none;
14
+ }
15
+ .chosen-container .chosen-drop {
16
+ position: absolute;
17
+ top: 100%;
18
+ left: -9999px;
19
+ z-index: 1010;
20
+ -webkit-box-sizing: border-box;
21
+ -moz-box-sizing: border-box;
22
+ box-sizing: border-box;
23
+ width: 100%;
24
+ border: 1px solid #aaa;
25
+ border-top: 0;
26
+ background: #fff;
27
+
28
+ /*box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);*/
29
+ }
30
+ .chosen-container.chosen-with-drop .chosen-drop {
31
+ left: 0;
32
+ }
33
+ .chosen-container a {
34
+ cursor: pointer;
35
+ }
36
+
37
+ /* @end */
38
+ /* @group Single Chosen */
39
+ .chosen-container-single .chosen-single {
40
+ position: relative;
41
+ display: block;
42
+ overflow: hidden;
43
+ padding: 0 0 0 8px;
44
+ height: 23px;
45
+ border: 1px solid #aaa;
46
+ /*border-radius: 5px;*/
47
+ background-color: #fff;
48
+ /* background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
49
+ background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
50
+ background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
51
+ background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
52
+ background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);*/
53
+ background-clip: padding-box;
54
+ /*box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);*/
55
+ color: #000000;
56
+ text-decoration: none;
57
+ white-space: nowrap;
58
+ line-height: 24px;
59
+ }
60
+ .chosen-container-single .chosen-default {
61
+ color: #000000;
62
+ color: red;
63
+ }
64
+ .chosen-container-single .chosen-single span {
65
+ display: block;
66
+ overflow: hidden;
67
+ margin-right: 26px;
68
+ text-overflow: ellipsis;
69
+ white-space: nowrap;
70
+ }
71
+ .chosen-container-single .chosen-single-with-deselect span {
72
+ margin-right: 38px;
73
+ }
74
+ .chosen-container-single .chosen-single abbr {
75
+ position: absolute;
76
+ top: 6px;
77
+ right: 26px;
78
+ display: block;
79
+ width: 12px;
80
+ height: 12px;
81
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
82
+ font-size: 1px;
83
+ }
84
+ .chosen-container-single .chosen-single abbr:hover {
85
+ background-position: -42px -10px;
86
+ }
87
+ .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
88
+ background-position: -42px -10px;
89
+ }
90
+
91
+ /* scos bbarraow*/
92
+
93
+
94
+ .chosen-container-single .chosen-single div b {
95
+ display: block;
96
+ width: 100%;
97
+ height: 100%;
98
+ background: url('chosen-sprite.png') no-repeat 0px 2px;
99
+ }
100
+ .chosen-container-single .chosen-search {
101
+ position: relative;
102
+ z-index: 1010;
103
+ margin: 0;
104
+ padding: 3px 4px;
105
+ white-space: nowrap;
106
+ }
107
+ .chosen-container-single .chosen-search input[type="text"] {
108
+ -webkit-box-sizing: border-box;
109
+ -moz-box-sizing: border-box;
110
+ box-sizing: border-box;
111
+ margin: 1px 0;
112
+ padding: 4px 20px 4px 5px;
113
+ width: 100%;
114
+ height: auto;
115
+ outline: 0;
116
+ border: 1px solid #aaa;
117
+ background: white url('chosen-sprite.png') no-repeat 100% -20px;
118
+ background: url('chosen-sprite.png') no-repeat 100% -20px;
119
+ font-size: 1em;
120
+ /*font-family: sans-serif;*/
121
+ line-height: normal;
122
+ border-radius: 0;
123
+ }
124
+ .chosen-container-single .chosen-drop {
125
+ margin-top: -1px;
126
+ /*border-radius: 0 0 4px 4px;*/
127
+ background-clip: padding-box;
128
+ }
129
+ .chosen-container-single.chosen-container-single-nosearch .chosen-search {
130
+ position: absolute;
131
+ left: -9999px;
132
+ }
133
+
134
+ /* @end */
135
+ /* @group Results */
136
+ .chosen-container .chosen-results {
137
+ position: relative;
138
+ overflow-x: hidden;
139
+ overflow-y: auto;
140
+ margin: 0 4px 4px 0;
141
+ padding: 0 0 0 4px;
142
+ max-height: 150px;
143
+ -webkit-overflow-scrolling: touch;
144
+ }
145
+ .chosen-container .chosen-results li {
146
+ display: none;
147
+ margin: 0;
148
+ padding: 5px 6px;
149
+ list-style: none;
150
+ line-height: 15px;
151
+ -webkit-touch-callout: none;
152
+ }
153
+ .chosen-container .chosen-results li.active-result {
154
+ display: list-item;
155
+ cursor: pointer;
156
+ }
157
+ .chosen-container .chosen-results li.disabled-result {
158
+ display: list-item;
159
+ color: #000000;
160
+ cursor: default;
161
+ /*opacity for disable*/
162
+ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
163
+ filter: alpha(opacity=50);
164
+ -moz-opacity:0.5;
165
+ -khtml-opacity: 0.5;
166
+ opacity: 0.5;
167
+ }
168
+ .chosen-container .chosen-results li.highlighted {
169
+ background-color: #3875d7;
170
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
171
+ background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
172
+ background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
173
+ background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
174
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
175
+ color: #fff;
176
+ }
177
+ .chosen-container .chosen-results li.no-results {
178
+ display: list-item;
179
+ background: #f4f4f4;
180
+ }
181
+ .chosen-container .chosen-results li.group-result {
182
+ display: list-item;
183
+ font-weight: bold;
184
+ cursor: default;
185
+ }
186
+ .chosen-container .chosen-results li.group-option {
187
+ padding-left: 15px;
188
+ }
189
+ .chosen-container .chosen-results li em {
190
+ font-style: normal;
191
+ text-decoration: underline;
192
+ }
193
+
194
+ /* @end */
195
+ /* @group Multi Chosen */
196
+ .chosen-container-multi .chosen-choices {
197
+ position: relative;
198
+ overflow: hidden;
199
+ -webkit-box-sizing: border-box;
200
+ -moz-box-sizing: border-box;
201
+ box-sizing: border-box;
202
+ margin: 0;
203
+ padding: 0;
204
+ width: 100%;
205
+ height: auto !important;
206
+ height: 1%;
207
+ border: 1px solid #aaa;
208
+ background-color: #fff;
209
+ /* background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
210
+ background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
211
+ background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
212
+ background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
213
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);*/
214
+ cursor: text;
215
+ }
216
+ .chosen-container-multi .chosen-choices li {
217
+ float: left;
218
+ list-style: none;
219
+ }
220
+ .chosen-container-multi .chosen-choices li.search-field {
221
+ margin: 0;
222
+ padding: 0;
223
+ white-space: nowrap;
224
+ }
225
+ .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
226
+ margin: 1px 0;
227
+ padding: 5px;
228
+ height: 15px;
229
+ outline: 0;
230
+ border: 0 !important;
231
+ background: transparent !important;
232
+ box-shadow: none;
233
+ color: #666;
234
+ font-size: 100%;
235
+ /*font-family: sans-serif;*/
236
+ line-height: normal;
237
+ border-radius: 0;
238
+ }
239
+ .chosen-container-multi .chosen-choices li.search-field .default {
240
+ color: #999;
241
+ }
242
+ .chosen-container-multi .chosen-choices li.search-choice {
243
+ position: relative;
244
+ margin: 3px 0 3px 5px;
245
+ padding: 3px 20px 3px 5px;
246
+ border: 1px solid #aaa;
247
+ border-radius: 3px;
248
+ background-color: #e4e4e4;
249
+
250
+ background-clip: padding-box;
251
+ /*box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);*/
252
+ color: #333;
253
+ line-height: 13px;
254
+ cursor: default;
255
+ }
256
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
257
+ position: absolute;
258
+ top: 4px;
259
+ right: 3px;
260
+ display: block;
261
+ width: 12px;
262
+ height: 12px;
263
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
264
+ font-size: 1px;
265
+ }
266
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
267
+ background-position: -42px -10px;
268
+ }
269
+ .chosen-container-multi .chosen-choices li.search-choice-disabled {
270
+ padding-right: 5px;
271
+ border: 1px solid #ccc;
272
+ background-color: #e4e4e4;
273
+ /* background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
274
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
275
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
276
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
277
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);*/
278
+ color: #666;
279
+ }
280
+ .chosen-container-multi .chosen-choices li.search-choice-focus {
281
+ background: #d4d4d4;
282
+ }
283
+ .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
284
+ background-position: -42px -10px;
285
+ }
286
+ .chosen-container-multi .chosen-results {
287
+ margin: 0;
288
+ padding: 0;
289
+ }
290
+ .chosen-container-multi .chosen-drop .result-selected {
291
+ display: list-item;
292
+ color: #ccc;
293
+ cursor: default;
294
+ }
295
+
296
+ /* @end */
297
+ /* @group Active */
298
+ .chosen-container-active .chosen-single {
299
+ border: 1px solid #5897fb;
300
+ /*box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
301
+ }
302
+ .chosen-container-active.chosen-with-drop .chosen-single {
303
+ border: 1px solid #aaa;
304
+ -moz-border-radius-bottomright: 0;
305
+ border-bottom-right-radius: 0;
306
+ -moz-border-radius-bottomleft: 0;
307
+ border-bottom-left-radius: 0;
308
+ /* background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
309
+ background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
310
+ background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
311
+ background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
312
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
313
+ box-shadow: 0 1px 0 #fff inset;*/
314
+ }
315
+ .chosen-container-active.chosen-with-drop .chosen-single div {
316
+ border-left: none;
317
+ background: transparent;
318
+ }
319
+ .chosen-container-active.chosen-with-drop .chosen-single div b {
320
+ background-position: -18px 2px;
321
+ }
322
+ .chosen-container-active .chosen-choices {
323
+ border: 1px solid #5897fb;
324
+ /*box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
325
+ }
326
+ .chosen-container-active .chosen-choices li.search-field input[type="text"] {
327
+ color: #111 !important;
328
+ }
329
+
330
+ /* @end */
331
+ /* @group Disabled Support */
332
+ .chosen-disabled {
333
+ opacity: 0.5 !important;
334
+ cursor: default;
335
+ }
336
+ .chosen-disabled .chosen-single {
337
+ cursor: default;
338
+ }
339
+ .chosen-disabled .chosen-choices .search-choice .search-choice-close {
340
+ cursor: default;
341
+ }
342
+
343
+ /* @end */
344
+ /* @group Right to Left */
345
+ .chosen-rtl {
346
+ text-align: right;
347
+ }
348
+ .chosen-rtl .chosen-single {
349
+ overflow: visible;
350
+ padding: 0 8px 0 0;
351
+ }
352
+ .chosen-rtl .chosen-single span {
353
+ margin-right: 0;
354
+ margin-left: 26px;
355
+ direction: rtl;
356
+ }
357
+ .chosen-rtl .chosen-single-with-deselect span {
358
+ margin-left: 38px;
359
+ }
360
+ .chosen-rtl .chosen-single div {
361
+ right: auto;
362
+ left: 3px;
363
+ }
364
+ .chosen-rtl .chosen-single abbr {
365
+ right: auto;
366
+ left: 26px;
367
+ }
368
+ .chosen-rtl .chosen-choices li {
369
+ float: right;
370
+ }
371
+ .chosen-rtl .chosen-choices li.search-field input[type="text"] {
372
+ direction: rtl;
373
+ }
374
+ .chosen-rtl .chosen-choices li.search-choice {
375
+ margin: 3px 5px 3px 0;
376
+ padding: 3px 5px 3px 19px;
377
+ }
378
+ .chosen-rtl .chosen-choices li.search-choice .search-choice-close {
379
+ right: auto;
380
+ left: 4px;
381
+ }
382
+ .chosen-rtl.chosen-container-single-nosearch .chosen-search,
383
+ .chosen-rtl .chosen-drop {
384
+ left: 9999px;
385
+ }
386
+ .chosen-rtl.chosen-container-single .chosen-results {
387
+ margin: 0 0 4px 4px;
388
+ padding: 0 4px 0 0;
389
+ }
390
+ .chosen-rtl .chosen-results li.group-option {
391
+ padding-right: 15px;
392
+ padding-left: 0;
393
+ }
394
+ .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
395
+ border-right: none;
396
+ }
397
+ .chosen-rtl .chosen-search input[type="text"] {
398
+ padding: 4px 5px 4px 20px;
399
+ background: white url('chosen-sprite.png') no-repeat -30px -20px;
400
+ background: url('chosen-sprite.png') no-repeat -30px -20px;
401
+ direction: rtl;
402
+ }
403
+ .chosen-rtl.chosen-container-single .chosen-single div b {
404
+ background-position: 6px 2px;
405
+ }
406
+ .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
407
+ background-position: -12px 2px;
408
+ }
409
+
410
+ /* @end */
411
+ /* @group Retina compatibility */
412
+ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
413
+ .chosen-rtl .chosen-search input[type="text"],
414
+ .chosen-container-single .chosen-single abbr,
415
+ .chosen-container-single .chosen-single div b,
416
+ .chosen-container-single .chosen-search input[type="text"],
417
+ .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
418
+ .chosen-container .chosen-results-scroll-down span,
419
+ .chosen-container .chosen-results-scroll-up span {
420
+ background-image: url('chosen-sprite@2x.png') !important;
421
+ background-size: 52px 37px !important;
422
+ background-repeat: no-repeat !important;
423
+ }
424
+ }
425
+ /* @end */
includes/css/credentials_error.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ #captainform_credentials_error_wrapper {
2
+ margin-top: 20px;
3
+ margin-right: 20px;
4
+ }
5
+
6
+ .captainform_credentials_error_text {
7
+ margin-bottom: 20px;
8
+ }
includes/css/forge_element.css ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .forge-builder-collection-icon-captainform {
2
+ background: url(../images/captainform-32.png);
3
+ background-size: cover;
4
+ background-repeat: no-repeat;
5
+ }
6
+
7
+ .forge-captainform-form-placeholder {
8
+ position: relative;
9
+ background: rgba(0,0,0,0.08);
10
+ width: 100%;
11
+ padding-top: 60%;
12
+ border-radius: 3px;
13
+ }
14
+
15
+ .forge-captainform-form-placeholder::before {
16
+ position: absolute;
17
+ top: 50%;
18
+ left: 50%;
19
+ margin: -20px 0 0 -70px;
20
+ width: 140px;
21
+ height: 40px;
22
+ line-height: 40px;
23
+ text-align: center;
24
+ color: #999;
25
+ font-size: 30px;
26
+ content: 'FORM';
27
+ }
28
+
29
+
30
+ /* CAPTAINFORM FIELDS */
31
+ .forge-captainform-field { display:block; overflow:hidden; }
32
+ .forge-captainform-field .forge-captainform-preview { border:3px solid #fff; background:#fff; margin:0 0 5px; }
33
+ .forge-captainform-field-empty .forge-captainform-preview { display:none; }
34
+ .forge-captainform-preview img { display:block; margin:0 auto; width:auto; max-width:100%; height:auto; }
35
+ .forge-captainform-field .forge-captainform-field-placeholder { display:none; background:#fff; margin:0 0 5px; padding:10px 20px; text-align:center; text-transform:uppercase; color:#999; }
36
+ .forge-captainform-field-empty .forge-captainform-field-placeholder { display:block; }
37
+ /* Controls */
38
+ .forge-captainform-field .forge-captainform-field-url { display:none; padding:0; margin:0; }
39
+ .forge-captainform-field .forge-captainform-field-controls { padding:0; margin:0; }
40
+ .forge-captainform-field-custom-url .forge-captainform-field-controls { display:none; }
41
+ .forge-captainform-field-custom-url .forge-captainform-field-url { display:block; }
42
+ /* Buttons */
43
+ .forge-captainform-field .forge-captainform-field-button { display:block; margin:0; font-weight:bold; float:left; padding:0; width:100%; text-align:center; color:#666; background:#fff; cursor:pointer; border-radius:0; font-size:14px; line-height:30px; height:30px; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; }
44
+ .forge-captainform-field .forge-captainform-create { display:block; border-right:1px solid #eee; }
45
+ .forge-captainform-field .forge-captainform-url { display:block; border-right:1px solid #eee; }
46
+ .forge-captainform-field .forge-captainform-remove { color:#f44; width:20%; }
47
+ .forge-captainform-field .forge-captainform-cancel { color:#f44; width:30%; }
48
+ .forge-captainform-field .forge-captainform-save { border-right:1px solid #eee; width:70%; }
includes/css/form_popup.css ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *{
2
+ outline: none;
3
+ }
4
+
5
+ .captainform_popup_bg_form{
6
+ position: fixed;
7
+ top: 0px;
8
+ left: 0px;
9
+ width: 100%;
10
+ height: 100%;
11
+ box-sizing: border-box;
12
+ background: url(../images/black-50.png);
13
+ display: none;
14
+ z-index: 9999990;
15
+ /*background-color: rgba(241, 241, 241,0.9);*/
16
+ }
17
+
18
+ .captainform_popup_box_form{
19
+ display: block;
20
+ /* overflow: hidden;*/
21
+ position: absolute;
22
+ width: 500px;
23
+ height: 250px;
24
+ max-height: 100%;
25
+ max-width: 100%;
26
+ box-sizing: border-box;
27
+ margin: auto;
28
+ top: 0; left: 0; bottom: 0; right: 0;
29
+ font-family: Arial;
30
+ font-size: 14px;
31
+ background: white;
32
+ /* border: solid 0px #868686;*/
33
+ border-radius: 4px;
34
+ border: none!important;
35
+ padding: 8px!important;
36
+ padding-bottom: 8px!important;
37
+ display: none;
38
+
39
+ }
40
+
41
+ .captainform_loader_form{
42
+ display: block;
43
+ overflow: hidden;
44
+ position: absolute;
45
+ width: 128px;
46
+ height: 128px;
47
+ box-sizing: border-box;
48
+ margin: auto;
49
+ top: 0; left: 0; bottom: 0; right: 0;
50
+ background: transparent url('../images/ring.svg') no-repeat center center;
51
+ /*background-size: 128px auto;*/
52
+ }
53
+
54
+ .captainform_popup_body_form{
55
+ display: block;
56
+ overflow: hidden;
57
+ box-sizing: border-box;
58
+ overflow-y: auto;
59
+ max-height: 1000px;
60
+ background: white;
61
+ padding: 0!important;
62
+ margin: 0!important;
63
+ line-height: normal!important;
64
+ /*-webkit-overflow-scrolling: touch;*/
65
+ }
66
+
67
+ .captainform_popup_close_form{
68
+ position: absolute;
69
+ box-sizing: border-box;
70
+ right: -22px;
71
+ top: -22px;
72
+ width: 28px!important;
73
+ height: 28px!important;
74
+ background-repeat: no-repeat;
75
+ background-position: 5px center;
76
+ background-image: url(../images/icon-alert-close.png);
77
+ border-radius: 50%;
78
+ cursor: pointer;
79
+ background-color: #313131;
80
+ border: solid 2px white;
81
+ overflow: hidden;
82
+ /* display: none;*/
83
+ }
84
+
85
+ .close_cnt{
86
+ display: block!important;
87
+ box-sizing: border-box;
88
+ overflow: visible!important;
89
+ position: relative!important;
90
+ height: 0px!important;
91
+ padding: 0!important;
92
+ margin: 0!important;
93
+ width: 100%;
94
+ }
95
+
96
+ .popup_iframe_form{
97
+ width:100%;
98
+ overflow: hidden;
99
+ border:none;
100
+ margin: 0!important;
101
+ padding: 0!important;
102
+ box-sizing: border-box;
103
+ /*background: #EFEFEF;*/
104
+ }
105
+
106
+
includes/css/hide_adminbar.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html{
2
+ margin-top: 0 !important;
3
+ }
4
+ #wpadminbar{
5
+ display: none!important;
6
+ }
7
+ #top-bar{
8
+ display: none!important;
9
+ }
10
+ header.site-header-sentinel.fixed {
11
+ top:0px!important;
12
+ }
13
+ .edit-link{
14
+ display: none!important;
15
+ }
includes/css/iframe_popup.css ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *{
2
+ outline: none;
3
+ }
4
+
5
+ .captainform_popup_bg{
6
+ position: fixed;
7
+ top: 0px;
8
+ left: 0px;
9
+ width: 100%;
10
+ height: 100%;
11
+ box-sizing: border-box;
12
+ background: url(../images/black-50.png);
13
+ display: none;
14
+ z-index: 9999999;
15
+ /*background-color: rgba(241, 241, 241,0.9);*/
16
+ }
17
+
18
+ .captainform_popup_box{
19
+ display: block;
20
+ overflow: hidden;
21
+ position: absolute;
22
+ width: 500px;
23
+ height: 250px;
24
+ max-height: 100%;
25
+ max-width: 100%;
26
+ box-sizing: border-box;
27
+ margin: auto;
28
+ top: 0; left: 0; bottom: 0; right: 0;
29
+ font-family: Arial;
30
+ font-size: 14px;
31
+ background: white;
32
+ border: solid 0px #868686;
33
+ border-radius: 4px;
34
+ }
35
+
36
+ .captainform_loader{
37
+ display: block;
38
+ overflow: hidden;
39
+ position: absolute;
40
+ width: 128px;
41
+ height: 128px;
42
+ box-sizing: border-box;
43
+ margin: auto;
44
+ top: 0; left: 0; bottom: 0; right: 0;
45
+ background: transparent url('../images/loader_cf.GIF') no-repeat center center;
46
+ opacity: .8;
47
+ /*background-size: 128px auto;*/
48
+ }
49
+
50
+ .captainform_popup_title{
51
+ display: block;
52
+ overflow: hidden;
53
+ position: relative;
54
+ box-sizing: border-box;
55
+ background: #25a7c1;
56
+ font-size: 16px;
57
+ padding: 0px 40px 0px 20px;
58
+ height: 40px;
59
+ line-height: 40px;
60
+ font-weight: bold;
61
+ color: white;
62
+ }
63
+
64
+ .dialog{
65
+ padding-left: 45px;
66
+ background-repeat: no-repeat;
67
+ background-position: 10px center;
68
+ }
69
+
70
+ .dialog_success{
71
+ background-color: rgb(94, 201, 49);
72
+ background-image: url(../images/icon-success.png);
73
+ }
74
+
75
+ .dialog_warning{
76
+ background-color: #ffc024;
77
+ background-image: url(../images/icon-alert.png);
78
+ }
79
+
80
+ .dialog_error{
81
+ background-color: rgb(252, 104, 104);
82
+ background-image: url(../images/icon-danger.png);
83
+ }
84
+
85
+ .close_success:hover{
86
+ background-color: #4EA628!important;
87
+ }
88
+
89
+ .close_warning:hover{
90
+ background-color: #EFAD07!important;
91
+ }
92
+
93
+ .close_error:hover{
94
+ background-color: #FA5050!important;
95
+ }
96
+
97
+ .doerror{
98
+ background-color: rgb(252, 104, 104);
99
+ }
100
+ .doerrorclose:hover{
101
+ background-color: #FA5050!important;
102
+ }
103
+
104
+ .captainform_popup_body{
105
+ display: block;
106
+ overflow: hidden;
107
+ box-sizing: border-box;
108
+ overflow-y: auto;
109
+ max-height: 1000px;
110
+ /*-webkit-overflow-scrolling: touch;*/
111
+
112
+ }
113
+
114
+ .captainform_popup_footer{
115
+ display: block;
116
+ overflow: hidden;
117
+ box-sizing: border-box;
118
+ height: 50px;
119
+ padding: 10px 10px 0px 10px;
120
+ text-align: center;
121
+ }
122
+
123
+ .captainform_popup_close{
124
+ position: absolute;
125
+ box-sizing: border-box;
126
+ right: 9px;
127
+ top: 8px;
128
+ width: 24px;
129
+ height: 24px;
130
+ background-repeat: no-repeat;
131
+ background-position: 5px center;
132
+ background-image: url(../images/icon-alert-close.png);
133
+ border-radius: 50%;
134
+ cursor: pointer;
135
+ }
136
+ .captainform_popup_close:hover{
137
+ background-color: #1F8DA3;
138
+ }
139
+
140
+ .popup_iframe{
141
+ width:100%;
142
+ overflow: hidden;
143
+ /*background: #EFEFEF;*/
144
+ }
145
+
146
+ .icontent{
147
+ display: block;
148
+ width: 100%;
149
+ padding: 20px 10px 10px 10px;
150
+ padding: 20px 20px 10px 20px;
151
+ box-sizing: border-box;
152
+ background: transparent;
153
+ }
154
+
155
+ .icontent_btn{
156
+ display: block;
157
+ width: 100%;
158
+ height: 70px;
159
+ box-sizing: border-box;
160
+ padding: 10px 10px 10px 10px;
161
+ text-align: center;
162
+ }
163
+
164
+ .formal{
165
+ padding: 0px 8px 0px 8px;
166
+ box-sizing: border-box;
167
+ border: solid 1px #b6b6b6;
168
+ border-radius: 3px;
169
+ height: 32px;
170
+ line-height: 32px;
171
+ width: 100%;
172
+ font-family: Arial;
173
+ font-size: 14px;
174
+ color: #33484d;
175
+ }
176
+ textarea.formal{
177
+ line-height: 1.15em;
178
+ padding: 8px;
179
+ }
180
+ .formal:focus{
181
+ /*border-color: #33484d;*/
182
+ }
183
+
184
+ .label{
185
+ display: block;
186
+ overflow: hidden;
187
+ box-sizing: border-box;
188
+ font-size: 14px;
189
+ color: #4A4A4A;
190
+ padding-bottom: 7px;
191
+ width: 100%;
192
+ }
193
+
194
+
195
+ .btn{
196
+ display: inline-block;
197
+ overflow: hidden;
198
+ text-align: center;
199
+ height: 30px;
200
+ line-height: 30px;
201
+ padding: 0 15px 0 15px;
202
+ border-radius: 3px;
203
+ font-size: 15px;
204
+ cursor: pointer;
205
+ margin: 0px 10px 0px 10px;
206
+ }
207
+
208
+ .btn_yellow{
209
+ color: white;
210
+ background-color: #F8B610;
211
+ box-shadow: 0px 2px 0px 0.00px #c19f49;
212
+ border: solid 1px #f7c548;
213
+ }
214
+ .btn_yellow:hover{
215
+ background-color: #EEAD08;
216
+ }
217
+
218
+ .btn_blue{
219
+ color: white;
220
+ background-color: #25a7c1;
221
+ box-shadow: 0px 2px 0px 0.00px #005a70;
222
+ border: solid 1px #1c93ab;
223
+ }
224
+ .btn_blue:hover{
225
+ background-color: #1c93ab;
226
+ }
227
+
228
+ .btn_green{
229
+ color: white;
230
+ background-color: #5EC931;
231
+ box-shadow: 0px 2px 0px 0.00px #39791D;
232
+ border: solid 1px #4EA628;
233
+ }
234
+ .btn_green:hover{
235
+ background-color: #4EA628;
236
+ }
237
+
238
+ .btn_red{
239
+ color: white;
240
+ background-color: #FC6868;
241
+ box-shadow: 0px 2px 0px 0.00px #B80606;
242
+ border: solid 1px #FA5050;
243
+ }
244
+ .btn_red:hover{
245
+ background-color: #FA5050;
246
+ }
247
+
248
+ .btn_white{
249
+ color: #33484d;
250
+ background-color: #ffffff;
251
+ box-shadow: 0px 2px 0px 0.00px #c0c0c0;
252
+ border: solid 1px #E6E6E6;
253
+ }
254
+ .btn_white:hover{
255
+ background-color: #f4f4f4;
256
+ }
257
+
258
+ #cf_settings_save_button{
259
+ background: #25A7C1;
260
+ box-shadow: 0px 2px 0px 0.00px #005a70;
261
+ cursor: pointer;
262
+ border-radius: 3px !important;
263
+ -moz-border-radius: 3px !important;
264
+ -webkit-border-radius: 3px !important;
265
+ padding: 0px 15px 0px 15px;
266
+ color: #FFFFFF;
267
+ font-weight: bold;
268
+ font-family: Arial;
269
+ font-size: 14px;
270
+ height: 29px;
271
+ line-height: 31px;
272
+ }
273
+ #cf_settings_save_button_container #cf_settings_save_button{
274
+ position: static;
275
+ float: right;
276
+ margin:15px;
277
+ }
278
+ #cf_settings_save_button_container{
279
+ width: 100%;
280
+ display: block;
281
+ position:fixed;
282
+ z-index: 2;
283
+ top: 32px;
284
+ /* Fallback for web browsers that don't support RGBa */
285
+ background-color: rgb(0, 0, 0);
286
+ /* RGBa with 0.6 opacity */
287
+ background-color: rgba(0, 0, 0, 0.4);
288
+ /* For IE 5.5 - 7*/
289
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
290
+ /* For IE 8*/
291
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";
292
+ }
includes/css/publish_lightbox_posts.css ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * CSS for the CaptainForm popup from Posts and Pages
3
+ */
4
+ body {
5
+ overflow: hidden;
6
+ }
7
+
8
+ .captainform_body_class {
9
+ overflow: visible;
10
+ }
11
+
12
+ .captainform_spinner {
13
+ width: 100%;
14
+ text-align: center;
15
+ display: inline-block;
16
+ }
17
+
18
+ .captainform_widget_container {
19
+ font-family: Arial;
20
+ font-size: 14px;
21
+ width: 100%;
22
+ float: left;
23
+ display: inline-block;
24
+ }
25
+
26
+ #captainform-insert-dialog-body,
27
+ .captainform_widget_container,
28
+ .captainform_widget_container b,
29
+ .captainform_widget_container p,
30
+ .captainform_widget_container div,
31
+ .captainform_widget_container span {
32
+ white-space: normal !important;
33
+ }
34
+
35
+ #captainform_form_toembed,
36
+ #captainform_form_toembed_chosen {
37
+ margin-right: 5px;
38
+ margin-top: 15px;
39
+ float: left;
40
+ min-height: 25px;
41
+ min-width: 100px;
42
+ min-width: initial;
43
+ }
44
+
45
+ #captainform_form_toembed_chosen .chosen-single {
46
+ background: url('../images/dropdownarrow.png');
47
+ background-position: right 5px center;
48
+ background-repeat: no-repeat;
49
+ background-size: 10px;
50
+ }
51
+
52
+ #captainform_form_toembed_button {
53
+ margin-top: 15px;
54
+ height: 25px;
55
+ background: #25a7c1;
56
+ color: #fff;
57
+ font-weight: 600;
58
+ border-radius: 3px;
59
+ }
60
+
61
+ .captainform_widget_container input[type=text]{
62
+ border-radius: 3px;
63
+ border: 1px solid #b6b6b6;
64
+ color: #303030;
65
+ font-size: 14px;
66
+ height: auto;
67
+ padding: 7px;
68
+ width: 300px;
69
+ border-top: 1px solid #b6b6b6;
70
+ border-left: 1px solid #b6b6b6;
71
+ border-bottom: 1px solid #dadada;
72
+ border-right: 1px solid #dadada;
73
+ outline: 0;
74
+ }
75
+
76
+ .cf_trigger_option {
77
+ padding: 5px;
78
+
79
+ }
80
+
81
+ .cf_trigger_selected_option_container .left {
82
+ width: 30%;
83
+ }
84
+
85
+ .cf_trigger_selected_option_container .right {
86
+ width: 70%;
87
+ }
88
+
89
+ .cf_trigger_selected_option_container .right input[type=text] {
90
+ width: 100%;
91
+ }
92
+
93
+ .cf_trigger_selected_option_container {
94
+ padding: 0 10px;
95
+ }
96
+
97
+ .cf_trigger_2_time {
98
+ width: 80px !important;
99
+ }
100
+
101
+ .lightbox_trigger {
102
+ padding: 0px;
103
+ }
104
+
105
+ #captainform_form_toembed_button {
106
+ display: inline-block;
107
+ float: left;
108
+ background: #25A7C1 !important;
109
+ box-shadow: 0px 2px 0px 0.00px #005a70;
110
+ color: #FFF;
111
+ cursor: pointer;
112
+ border-radius: 3px !important;
113
+ -moz-border-radius: 3px !important;
114
+ -webkit-border-radius: 3px !important;
115
+ padding: 0px 15px 0px 15px;
116
+ color: #FFFFFF;
117
+ font-weight: bold;
118
+ font-size: 14px;
119
+ height: 29px;
120
+ line-height: 30px;
121
+ }
122
+
123
+ .captainform_seconds {
124
+ float: left;
125
+ padding: 6px;
126
+ }
127
+
128
+ .cf_trigger_selected_option.cf_trigger_2_time {
129
+ float: left;
130
+ }
131
+
132
+ .chosen-single {
133
+ height: 29px !important;
134
+ }
135
+
136
+ .chosen-single span:first-child {
137
+ line-height: 30px !important;
138
+ }
139
+
140
+ #captainform-insert-dialog-body {
141
+ overflow: hidden;
142
+ overflow-y: visible;
143
+ padding: 10px;
144
+ box-sizing: border-box;
145
+ }
146
+
147
+ #captainform_publish_lightbox_main_container {
148
+ width: 100%;
149
+ float: left;
150
+ }
includes/css/review.css ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .captainform_review_bg{
2
+ position: fixed;
3
+ top: 0px;
4
+ left: 0px;
5
+ width: 100%;
6
+ height: 100%;
7
+ box-sizing: border-box;
8
+ -webkit-box-sizing: border-box;
9
+ -moz-box-sizing: border-box;
10
+ display: none;
11
+ z-index: 9999990;
12
+ background-color: rgba(0, 0, 0,0.5);
13
+ }
14
+
15
+ .captainform_loader{
16
+ display: block;
17
+ overflow: hidden;
18
+ position: absolute;
19
+ width: 128px;
20
+ height: 128px;
21
+ margin: auto;
22
+ top: 0; left: 0; bottom: 0; right: 0;
23
+ background: transparent url('../images/loader_cf.GIF') no-repeat center center;
24
+ opacity: .8;
25
+ /*background-size: 128px auto;*/
26
+ }
27
+
28
+ .captainform_review_div_close{
29
+ display: block;
30
+ overflow: hidden;
31
+ position: relative;
32
+ height: 40px;
33
+ box-sizing: border-box;
34
+ -webkit-box-sizing: border-box;
35
+ -moz-box-sizing: border-box;
36
+ }
37
+
38
+ .captainform_review_close{
39
+ position: absolute;
40
+ right: 0;
41
+ top:0;
42
+ width: 32px;
43
+ height: 32px;
44
+ background-repeat: no-repeat;
45
+ background-size: cover;
46
+ background-image: url('../images/close.svg');
47
+ cursor: pointer;
48
+ display: none;
49
+ }
50
+
51
+ .captainform_review_close:hover{
52
+ background-image: url('../images/close_hover.svg');
53
+ }
54
+
55
+ .captainform_review_box{
56
+ display: block;
57
+ overflow: hidden;
58
+ position: absolute;
59
+ width: 500px;
60
+ height: 250px;
61
+ max-height: 100%;
62
+ max-width: 100%;
63
+ margin: auto;
64
+ top: 0; left: 0; bottom: 0; right: 0;
65
+ font-family: Arial;
66
+ font-size: 14px;
67
+ background-color: #F4F4F4!important;
68
+ border: solid 1px #888;
69
+ padding: 20px;
70
+ padding: 20px 20px 20px 20px;
71
+ border-radius: 10px!important;
72
+ box-sizing: border-box;
73
+ -webkit-box-sizing: border-box;
74
+ -moz-box-sizing: border-box;
75
+ }
76
+
77
+ .captainform_review_body{
78
+ display: block;
79
+ overflow: hidden;
80
+ overflow-y: auto;
81
+ max-height: 1000px;
82
+ box-sizing: border-box;
83
+ -webkit-box-sizing: border-box;
84
+ -moz-box-sizing: border-box;
85
+ /*-webkit-overflow-scrolling: touch;*/
86
+ }
87
+
88
+ .captainform_iframe_review{
89
+ width:100%;
90
+ overflow: hidden;
91
+ border:none;
92
+ margin: 0!important;
93
+ padding: 0!important;
94
+ box-sizing: border-box;
95
+ -webkit-box-sizing: border-box;
96
+ -moz-box-sizing: border-box;
97
+ /*background: #EFEFEF;*/
98
+ }
includes/css/widget.css ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .lightbox_trigger{
2
+ width: 100%;
3
+ box-sizing: border-box;
4
+ padding: 0 5px;
5
+ margin:5px 0px;
6
+ float: left;
7
+ }
8
+ .lightbox_trigger_text{
9
+ line-height: 20px;
10
+ }
11
+ .captainform_widget_container .chosen-container {
12
+ margin-bottom: 10px;
13
+ min-height: 25px;
14
+ width: 100% !important;
15
+ }
16
+
17
+ .captainform_widget_container .chosen-container-single .chosen-single {
18
+ background: url('../images/dropdownarrow.png');
19
+ background-position: right 5px center;
20
+ background-repeat: no-repeat;
21
+ background-size: 10px;
22
+ }
23
+
24
+ .widgets-sortables.ui-sortable .widget {
25
+ overflow: visible;
26
+ }
27
+ /*this is new */
28
+ .cf_triggers_container{
29
+ padding: 0 5px;
30
+ display: none;
31
+ }
32
+ .cf_trigger_selected_option_title{
33
+ font-weight: bold;
34
+ float: left;
35
+ padding-top: 15px;
36
+ padding-bottom: 5px;
37
+
38
+ width: 100%;
39
+ }
40
+ .cf_lightbox_title{
41
+ width:100%;
42
+ font-weight: bold;
43
+ color: #000;
44
+ padding-top: 15px;
45
+ padding-bottom: 5px;
46
+ float: left;
47
+ }
48
+ .cf_trigger_option{
49
+ padding: 5px;
50
+ box-sizing: border-box;
51
+ width: 100%;
52
+ float: left;
53
+ }
54
+
55
+ .cf_trigger_2_label{
56
+ margin-right: 5px;
57
+ }
58
+ .widget-content .cf_trigger_2_label{
59
+ float: left;
60
+ margin: 5px 0;
61
+ width: 100%;
62
+ }
63
+ @media(max-width : 785px){
64
+ .widget-content .left,
65
+ .widget-content .right{
66
+ width :100% !important;
67
+ }
68
+
69
+ .widget-content .cf_trigger_option{
70
+ padding: 5px;
71
+ }
72
+ }
73
+ .cf_trigger_selected_option_container{
74
+ display: none;
75
+ padding: 10px;
76
+ padding-top: 0px;
77
+ }
78
+ .cf_trigger_2_time{
79
+ width: 60px;
80
+ }
81
+
82
+ .cf_trigger_selected_option_container_big .left{
83
+ float:left;
84
+ display:table;
85
+ vertical-align: middle;
86
+ width: 40%;
87
+ padding: 5px 0;
88
+ }
89
+ .cf_trigger_selected_option_container_big .right{
90
+ float:left;
91
+ display: table;
92
+ width: 60%;
93
+ padding: 5px 0;
94
+ position: relative;
95
+ }
96
+ .cf_trigger_selected_option_container_big .clear{
97
+ clear:both;
98
+ }
99
+ .cf_trigger_selected_option_container_big .left .label{
100
+ display: inline-block;
101
+ vertical-align: middle;
102
+ line-height: 28px;
103
+ }
104
+
105
+ .cf_red_border{
106
+ border: 1px solid #f00 !important;
107
+ }
108
+ .colorpicker-color,
109
+ .colorpicker-alpha{
110
+ display:none !important;
111
+ }
112
+
113
+ .cf_new_form_container{
114
+ width: 100%;
115
+ float:left;
116
+ margin: 10px;
117
+ }
118
+
119
+ .error_message_container{
120
+ width: 100%;
121
+ float: left;
122
+ margin: 15px 0px;
123
+ }
includes/css/wp_captainform_os.css ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .captainform_popup_body{
2
+ -webkit-overflow-scrolling: touch;
3
+ }
4
+
5
+ .captainform_popup_body::-webkit-scrollbar {
6
+ -webkit-appearance: none;
7
+ -webkit-overflow-scrolling: touch;
8
+ }
9
+
10
+ .captainform_popup_body::-webkit-scrollbar:vertical {
11
+ width: 12px;
12
+ }
13
+
14
+ .captainform_popup_body::-webkit-scrollbar-thumb {
15
+ border-radius: 8px;
16
+ border: 1px solid white; /* should match background, can't be transparent */
17
+ background-color: rgba(111, 111, 111, .4);
18
+ }
19
+
20
+ .captainform_popup_body::-webkit-scrollbar-track {
21
+ background-color: #F3F3F3;
22
+ }
23
+
24
+ .captainform_popup_body{
25
+ overflow: -moz-scrollbars-vertical;
26
+ }
27
+ .captainform_popup_body_form::-webkit-scrollbar {
28
+ -webkit-appearance: none;
29
+ -webkit-overflow-scrolling: touch;
30
+ }
31
+ .captainform_popup_body_form::-webkit-scrollbar:vertical {
32
+ width: 12px;
33
+ }
34
+ .captainform_popup_body_form::-webkit-scrollbar-thumb {
35
+ border-radius: 8px;
36
+ border: 1px solid white;
37
+ background-color: rgba(111, 111, 111, .4);
38
+ }
39
+ .captainform_popup_body_form::-webkit-scrollbar-track {
40
+ background-color: #F3F3F3;
41
+ }
42
+ .captainform_popup_body_form{
43
+ overflow: -moz-scrollbars-vertical;
44
+ }
45
+
46
+ .captainform_review_body{
47
+ -webkit-overflow-scrolling: touch;
48
+ }
49
+
50
+ .captainform_review_body::-webkit-scrollbar {
51
+ -webkit-appearance: none;
52
+ -webkit-overflow-scrolling: touch;
53
+ }
54
+
55
+ .captainform_review_body::-webkit-scrollbar:vertical {
56
+ width: 12px;
57
+ }
58
+
59
+ .captainform_review_body::-webkit-scrollbar-thumb {
60
+ border-radius: 8px;
61
+ border: 1px solid white; /* should match background, can't be transparent */
62
+ background-color: rgba(111, 111, 111, .4);
63
+ }
64
+
65
+ .captainform_review_body::-webkit-scrollbar-track {
66
+ background-color: #F3F3F3;
67
+ }
68
+
69
+ .captainform_review_body{
70
+ overflow: -moz-scrollbars-vertical;
71
+ }
includes/display-functions.php ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+ /*our display functions for outputting information*/
4
+ $custom_vars = null;
5
+ function captainform_add_content($content)
6
+ {
7
+ $content = captainform_text_filter($content);
8
+ return $content;
9
+ }
10
+
11
+ function captainform_filter_summary($content)
12
+ {
13
+ $content = captainform_text_filter($content, NULL, NULL, true);
14
+ return $content;
15
+ }
16
+
17
+ add_filter('the_content', 'captainform_add_content');
18
+ add_filter('post_content', 'captainform_add_content');
19
+ add_filter('the_excerpt', 'captainform_filter_summary');
20
+
21
+
22
+ function captainform_replace_pattern($matches)
23
+ {
24
+ global $custom_vars;
25
+ $shortcode = $matches[1];
26
+
27
+ $captainform_theme_style = '';
28
+ if (isset($_GET['captainform_theme_style'])) {
29
+ wp_register_script('captainform_iframe_resizer_win', plugins_url('/includes/js/iframeResizer.contentWindow.min.js', __DIR__), array(), '3.5', false);
30
+ wp_enqueue_script('captainform_iframe_resizer_win');
31
+ wp_register_script('nolink', plugins_url('/includes/js/nolink.js', __DIR__), array(), uniqid(), false);
32
+ wp_enqueue_script('nolink');
33
+ //wp_enqueue_style('hide_adminbar', plugins_url('/includes/css/hide_adminbar.css', __DIR__), false, uniqid());
34
+ $captainform_theme_style = '&style=' . $_GET['captainform_theme_style'];
35
+ }
36
+
37
+ $type_regex = '/\[[^\[]*captain-?form*.*type=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
38
+ $lightbox_regex = '/\[[^\[]*captain-?form.*lightbox=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
39
+
40
+ $content_regex = "/\\[[^\\[]*captain-?form.*content=[\\',\"]{1}([^'\"]+)[\\'\"]{1}[^\\]]*\\]/i";
41
+ $text_content_regex = '/\[[^\[]*captain-?form.*text_content=[\',"]{1}([^\'"]+)[\'"]{1}[^\]]*\]/';
42
+
43
+ $url_regex = '/\[[^\[]*captain-?form.*url=[\',"]{1}([a-zA-Z0-9\/\-_\.\s\:\?\=]+)[\',"]{1}[^\]]*\]/';
44
+ $miliseconds_regex = '/\[[^\[]*captain-?form.*miliseconds=[\',"]{1}([0-9]+)[\',"]{1}[^\]]*\]/';
45
+ $text_color_regex = '/\[[^\[]*captain-?form.*text_color=[\',"]{1}([a-zA-Z0-9]+)[\',"]{1}[^\]]*\]/';
46
+ $bg_color_regex = '/\[[^\[]*captain-?form.*bg_color=[\',"]{1}([a-zA-Z0-9]+)[\',"]{1}[^\]]*\]/';
47
+ $position_regex = '/\[[^\[]*captain-?form.*position=[\',"]{1}([a-zA-Z]+)[\',"]{1}[^\]]*\]/';
48
+
49
+ preg_match($type_regex, $shortcode, $matches_type);
50
+ preg_match($lightbox_regex, $shortcode, $matches_lightbox);
51
+ preg_match($content_regex, $shortcode, $matches_content);
52
+ preg_match($text_content_regex, $shortcode, $matches_text_content);
53
+ preg_match($url_regex, $shortcode, $matches_url);
54
+ preg_match($miliseconds_regex, $shortcode, $matches_miliseconds);
55
+ preg_match($text_color_regex, $shortcode, $matches_text_color);
56
+ preg_match($bg_color_regex, $shortcode, $matches_bg_color);
57
+ preg_match($position_regex, $shortcode, $matches_position);
58
+
59
+ $shortcode_option_type = isset($matches_type[1]) ? $matches_type[1] : null;
60
+ $shortcode_option_lightbox = isset($matches_lightbox[1]) ? $matches_lightbox[1] : null;
61
+ $shortcode_option_content = isset($matches_content[1]) ? urldecode($matches_content[1]) : null;
62
+ $shortcode_option_text_content = isset($matches_text_content[1]) ? urldecode($matches_text_content[1]) : null;
63
+ $shortcode_option_url = isset($matches_url[1]) ? $matches_url[1] : null;
64
+ $shortcode_option_miliseconds = isset($matches_miliseconds[1]) ? $matches_miliseconds[1] : null;
65
+ $shortcode_option_text_color = isset($matches_text_color[1]) ? $matches_text_color[1] : '';
66
+ $shortcode_option_bg_color = isset($matches_bg_color[1]) ? $matches_bg_color[1] : '';
67
+ $shortcode_option_position = isset($matches_position[1]) ? $matches_position[1] : '';
68
+
69
+ if (isset($_GET['cf_form_id']) && isset($_GET['captainform_theme_style'])) {
70
+ if (intval($_GET['cf_form_id']) && is_numeric($matches[4]) && $_GET['cf_form_id'] !== intval($matches[4])) {
71
+ echo 'Form hidden in preview mode.';
72
+ return '';
73
+ }
74
+ }
75
+
76
+ $form_id = 0;
77
+ if (is_numeric($matches[4]))
78
+ $form_id = intval($matches[4]);
79
+ elseif ($matches[4] == '{cf_form_id}') {
80
+ if (isset($_GET['cf_form_id']) && intval($_GET['cf_form_id'])) {
81
+ $form_id = intval($_GET['cf_form_id']);
82
+ }
83
+ }
84
+
85
+ if(!$form_id)
86
+ return '';
87
+
88
+ $button_style = '';
89
+ $content = 'Contact Us';
90
+
91
+ $options = array(
92
+ 'id' => $form_id,
93
+ 'style' => $captainform_theme_style
94
+ );
95
+
96
+ $pattern_type = $GLOBALS['captainform_formcode_pattern'];
97
+
98
+ if ($shortcode_option_lightbox == 1 || isset($_GET['captainform_preview_as_lightbox'])) {
99
+ $miliseconds = 3000;
100
+
101
+ if (isset($_GET['captainform_preview_as_lightbox'])) {
102
+ $shortcode_option_type = 'auto-popup';
103
+ $miliseconds = 1000;
104
+ }
105
+
106
+ if(isset( $GLOBALS['captainform_formcode_pattern_lightbox']))
107
+ $pattern_type = $GLOBALS['captainform_formcode_pattern_lightbox'];
108
+
109
+ if(strlen(trim($shortcode_option_text_content)))
110
+ {
111
+ $content = $shortcode_option_text_content;
112
+ }
113
+ else if (strlen(trim($shortcode_option_content))) {
114
+ $content = $shortcode_option_content;
115
+ }
116
+
117
+ switch ($shortcode_option_type) {
118
+ case 'text':
119
+ break;
120
+ case 'image':
121
+ if (strlen(trim($shortcode_option_url))) {
122
+ $content = '<img border="0" src="' . $shortcode_option_url . '" />';
123
+ }
124
+ break;
125
+ case 'floating-button':
126
+ if ($shortcode_option_position == 'right') {
127
+ $pos = 2;
128
+ $extra_style = 'right: 0; top: 40%;';
129
+ } elseif ($shortcode_option_position == 'left') {
130
+ $pos = 1;
131
+ $extra_style = 'left: 0; top: 40%;';
132
+ } elseif ($shortcode_option_position == 'bottom') {
133
+ $pos = 3;
134
+ $extra_style = 'right: 20%; bottom: 0;';
135
+ } else {
136
+ $pos = 1;
137
+ $extra_style = 'left: 0; top: 0; bottom: 0;';
138
+ }
139
+
140
+ $button_style = 'style="outline:0; text-decoration:none; color:transparent; display:scroll ;z-index:10; border: none; position:fixed; ' . $extra_style . '"';
141
+ $content = '<img style="box-shadow: none;" border="0" src="https://' . $GLOBALS['captainform_servicedomain'] . '/verticalbutton2.php?bg=' . $shortcode_option_bg_color . '&fnt=' . $shortcode_option_text_color . '&pos=' . $pos . '&text=' . $content . '&font=arialblk" />';
142
+ break;
143
+ case 'auto-popup':
144
+ if (strlen(trim($shortcode_option_miliseconds))) {
145
+ $miliseconds = intval($shortcode_option_miliseconds);
146
+ }
147
+ if(isset($GLOBALS['captainform_formcode_pattern_lightbox_auto']))
148
+ $pattern_type = $GLOBALS['captainform_formcode_pattern_lightbox_auto'];
149
+ break;
150
+ default:
151
+ break;
152
+ }
153
+
154
+ $options = array(
155
+ 'id' => $form_id,
156
+ 'button_style' => $button_style,
157
+ 'content' => $content,
158
+ 'miliseconds' => $miliseconds,
159
+ 'customVars' => isset($customVars) ? $customVars : "",
160
+ 'style' => $captainform_theme_style
161
+ );
162
+ }
163
+
164
+ $formcode = captainform_replace_patterns($pattern_type, $options);
165
+ return $formcode;
166
+ }
167
+
168
+ function captainform_remove_pattern()
169
+ {
170
+ return '';
171
+ }
172
+
173
+ /**
174
+ * parse content and replace plugin short tag with correct code
175
+ * @param string
176
+ * @return string
177
+ **/
178
+ function captainform_text_filter($content, $customVars2 = "", $custom_options = array(), $summary = false)
179
+ {
180
+ $GLOBALS['custom_vars'] = $customVars2;
181
+
182
+ $pattern = '/(\[[^\[]*(captain-?form).*(id?|i)=?"?([0-9]+|{cf_form_id})"?[^\]]*\])/';
183
+ if ($summary === true)
184
+ return preg_replace_callback($pattern, 'captainform_remove_pattern', $content);
185
+ else
186
+ return preg_replace_callback($pattern, 'captainform_replace_pattern', $content);
187
+ }
188
+
189
+ /**
190
+ * add editor button for select forms
191
+ * */
192
+ // Makes sure the plugin is defined before trying to use it
193
+ if (!function_exists('is_plugin_active_for_network')) {
194
+ require_once(ABSPATH . '/wp-admin/includes/plugin.php');
195
+ }
196
+
197
+ //show editor toolbar icon only if plugin is active
198
+ if (in_array($captainform_plugin_name . '/' . $captainform_plugin_name . '.php', get_option('active_plugins')) || is_plugin_active_for_network($captainform_plugin_name . '/' . $captainform_plugin_name . '.php'))
199
+ add_filter('mce_buttons', 'captainform_add_button', 0);
200
+
201
+ function captainform_add_button($buttons)
202
+ {
203
+ array_push($buttons, 'separator', 'captainform');
204
+ return $buttons;
205
+ }
206
+
207
+
208
+ if (!function_exists('captain_form')) {
209
+
210
+
211
+ function captain_form($id, $custom_options = array())
212
+ {
213
+ $custom_vars = isset($custom_options['custom_vars']) ? $custom_options['custom_vars'] : '';
214
+
215
+ $shortcode_final = '[captainform id="' . $id .'" ';
216
+ $shortcode_final .= (isset($custom_options['lightbox'])) ? "lightbox='{$custom_options['lightbox']}'" : '';
217
+ $shortcode_final .= (isset($custom_options['type'])) ? "type='{$custom_options['type']}'" : '';
218
+ $shortcode_final .= (isset($custom_options['url'])) ? "url='{$custom_options['url']}'" : '';
219
+ if(isset($custom_options['text_content']))
220
+ $shortcode_final .= "text_content='". $custom_options['text_content'] ."'";
221
+ else
222
+ $shortcode_final .= (isset($custom_options['content'])) ? "content='{$custom_options['content']}'" : '';
223
+ $shortcode_final .= (isset($custom_options['miliseconds'])) ? "miliseconds='{$custom_options['miliseconds']}'" : '';
224
+ $shortcode_final .= (isset($custom_options['text_color'])) ? "text_color='{$custom_options['text_color']}'" : '';
225
+ $shortcode_final .= (isset($custom_options['bg_color'])) ? "bg_color='{$custom_options['bg_color']}'" : '';
226
+ $shortcode_final .= (isset($custom_options['position'])) ? "position='{$custom_options['position']}'" : '';
227
+
228
+ $shortcode_final .= ']';
229
+
230
+ if ($custom_vars != "") {
231
+ if (gettype($custom_vars) == "array") {
232
+ $custom_vars = http_build_query($custom_vars);
233
+ }
234
+ }
235
+ return captainform_widget_text_filter($shortcode_final, $custom_vars);
236
+ }
237
+
238
+ //Allow captain_form() function to be called from any file
239
+ register_activation_hook(__FILE__, 'captain_form');
240
+ }
includes/encryption.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class captainform_encrytion
4
+ {
5
+ public static $cryptKey = 'q923Mr!x';
6
+
7
+ public static function encrypt($str)
8
+ {
9
+ $str_arr = str_split($str);
10
+ $pass_arr = str_split(self::$cryptKey);
11
+ $add = 0;
12
+ $div = strlen($str) / strlen(self::$cryptKey);
13
+ while ($add <= $div) {
14
+ if (!isset($newpass))
15
+ $newpass = '';
16
+ $newpass .= self::$cryptKey;
17
+ $add++;
18
+ }
19
+ $pass_arr = str_split($newpass);
20
+ foreach ($str_arr as $key => $asc) {
21
+ if (!isset($ascii))
22
+ $ascii = "";
23
+ $pass_int = ord($pass_arr[$key]);
24
+ $str_int = ord($asc);
25
+ $int_add = $str_int + $pass_int;
26
+ $ascii .= chr($int_add);
27
+ }
28
+ return '===' . self::base64url_encode($ascii);
29
+ }
30
+
31
+ public static function decrypt($enc)
32
+ {
33
+ if (self::left($enc, 3) == '===') {
34
+ $enc = self::base64url_decode(self::trim_left($enc, 3));
35
+ if (strlen($enc) == 0) {
36
+ return '';
37
+ }
38
+ $enc_arr = str_split($enc);
39
+ $pass_arr = str_split(self::$cryptKey);
40
+ $add = 0;
41
+ $div = strlen($enc) / strlen(self::$cryptKey);
42
+ while ($add <= $div) {
43
+ $newpass .= self::$cryptKey;
44
+ $add++;
45
+ }
46
+ $pass_arr = str_split($newpass);
47
+ foreach ($enc_arr as $key => $asc) {
48
+ $pass_int = ord($pass_arr[$key]);
49
+ $enc_int = ord($asc);
50
+ $str_int = $enc_int - $pass_int;
51
+ $ascii .= chr($str_int);
52
+ }
53
+ return $ascii;
54
+ } else {
55
+ return self::old_cf_wpp_decrypt($enc);
56
+ }
57
+ }
58
+
59
+ public static function old_cf_wpp_decrypt($str)
60
+ {
61
+ if (strlen($str) == 0)
62
+ return '';
63
+ $key = self::$cryptKey;
64
+ $str = mcrypt_decrypt(MCRYPT_DES, $key, base64_decode($str), MCRYPT_MODE_ECB);
65
+ $block = mcrypt_get_block_size('des', 'ecb');
66
+ $pad = ord($str[($len = strlen($str)) - 1]);
67
+ return substr($str, 0, strlen($str) - $pad);
68
+ }
69
+
70
+ public static function base64url_encode($data)
71
+ {
72
+ return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
73
+ }
74
+
75
+ public static function base64url_decode($data)
76
+ {
77
+ return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
78
+ }
79
+
80
+ public static function right($value, $count)
81
+ {
82
+ return substr($value, ($count * -1));
83
+ }
84
+
85
+ public static function left($string, $count)
86
+ {
87
+ return substr($string, 0, $count);
88
+ }
89
+
90
+ public static function trim_left($string, $count)
91
+ {
92
+ return substr($string, $count);
93
+ }
94
+ }
95
+
96
+ /**
97
+ * encrypt params
98
+ * @param string
99
+ **/
100
+ function captainform_wpp_encrypt($str)
101
+ {
102
+ return captainform_encrytion::encrypt($str);
103
+ }
104
+
105
+ /**
106
+ * decrypt params
107
+ * @param string
108
+ **/
109
+ function captainform_wpp_decrypt($str)
110
+ {
111
+ return captainform_encrytion::decrypt($str);
112
+ }
includes/form-resources/global-vars.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ if(document.getElementById('captainform_js_global_vars') == null)
3
+ {
4
+ append_element({
5
+ elementType: "script",
6
+ type: "text/javascript",
7
+ id: "captainform_js_global_vars",
8
+ textContent: 'var frmRef=""; try { frmRef=window.top.location.href; } catch(err) {}; var captainform_servicedomain="<?php echo $captainform_servicedomain ;?>";var cfJsHost = "https://";',
9
+ });
10
+ }
11
+ </script>
includes/form-resources/lightbox-auto-embedding.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ var customVarsMF = '{{CUSTOMVARS}}';
3
+ var captainform_theme_style = '{{STYLE}}';
4
+ setTimeout(function(){
5
+ if (typeof captainform_create_form_popup == 'function')
6
+ captainform_create_form_popup({url: cfJsHost + captainform_servicedomain + '/form-{{ID}}/?' + customVarsMF + captainform_theme_style, popup_w: 1000});
7
+ }, {{MILISECONDS}} );
8
+ </script>
includes/form-resources/lightbox-embedding.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ var customVarsMF = '{{CUSTOMVARS}}';
3
+ var captainform_theme_style = '{{STYLE}}';
4
+ </script>
5
+ <a href="javascript:" {{BUTTON_STYLE}} class="blueLink13"
6
+ onclick="captainform_create_form_popup({url: cfJsHost + captainform_servicedomain + '/form-{{ID}}/?' + customVarsMF + captainform_theme_style, popup_w: 1000})">{{CONTENT}}</a>
includes/form-resources/normal-embedding.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script id="{{ID}}" type="text/javascript">
2
+ var customVarsMF = '{{CUSTOMVARS}}';
3
+ var captainform_theme_style = '{{STYLE}}';
4
+ if(document.getElementById('captainform_easyxdmjs') == null)
5
+ {
6
+ append_element({
7
+ elementType: "script",
8
+ type: "text/javascript",
9
+ id: "captainform_easyxdmjs",
10
+ src: cfJsHost + captainform_servicedomain + "/includes/easyXDM.min.js",
11
+ });
12
+ }
13
+ if(document.getElementById('iframeresizer_embedding_system') == null)
14
+ {
15
+ append_element({
16
+ elementType: "script",
17
+ type: "text/javascript",
18
+ id: "iframeresizer_embedding_system",
19
+ src: cfJsHost + captainform_servicedomain + "/modules/captainform/js/iframe_resizer/3.5/iframeResizer.min.js",
20
+ });
21
+ }
22
+ append_element({
23
+ elementType: "script",
24
+ type: "text/javascript",
25
+ id: "jsform-{{ID}}",
26
+ src: cfJsHost + captainform_servicedomain + "/jsform-{{ID}}.js?" + customVarsMF + captainform_theme_style,
27
+ replacing: document.getElementById("{{ID}}"),
28
+ });
29
+ </script>
includes/form-resources/tinybox-resources.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action('init', 'captainform_popup_resorces');
3
+ function captainform_popup_resorces()
4
+ {
5
+ global $captainform_plugin_version;
6
+ wp_enqueue_style('captainform_form_popup_style', plugins_url('/css/form_popup.css', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version);
7
+ $user_agent = getenv("HTTP_USER_AGENT");
8
+ if (strpos($user_agent, "Mac") !== FALSE)
9
+ {
10
+ //wp_enqueue_style('captainform_form_popup_style', plugins_url('/css/wp_captainform_os.css', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version);
11
+ }
12
+ //wp_register_script('captainform_ires35', plugins_url('/js/iframeResizer.min.js', __DIR__), array(), $captainform_plugin_version, false);
13
+ wp_register_script('captainform_ires35', plugins_url('/js/iframeResizer.min.js', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version, false);
14
+ wp_enqueue_script('captainform_ires35');
15
+ wp_register_script('captainform_form_popup', plugins_url('/js/form_popup.js', plugin_dir_path(__FILE__)), array('jquery'), $captainform_plugin_version, false);
16
+ wp_enqueue_script('captainform_form_popup');
17
+ }
includes/hooks.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) or die( 'No direct access!' );
3
+
4
+ function captainform_deactivate(){
5
+ }
6
+
7
+ function captainform_activate(){
8
+ check_captainform_settings();
9
+ }
10
+
11
+ function captainform_uninstall(){
12
+ }
includes/images/black-50.png ADDED
Binary file
includes/images/captainform-18.png ADDED
Binary file
includes/images/captainform-32.png ADDED
Binary file
includes/images/close.svg ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 100 100" id="Layer_1" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><polygon fill="#B9B9B9" points="77.6,21.1 49.6,49.2 21.5,21.1 19.6,23 47.6,51.1 19.6,79.2 21.5,81.1 49.6,53 77.6,81.1 79.6,79.2 51.5,51.1 79.6,23 "/></svg>
includes/images/close_hover.svg ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 100 100" id="Layer_1" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><polygon fill="#6c6c6c" points="77.6,21.1 49.6,49.2 21.5,21.1 19.6,23 47.6,51.1 19.6,79.2 21.5,81.1 49.6,53 77.6,81.1 79.6,79.2 51.5,51.1 79.6,23 "/></svg>
includes/images/dropdownarrow.png ADDED
Binary file
includes/images/icon-alert-close.png ADDED
Binary file
includes/images/icon-alert.png ADDED
Binary file
includes/images/icon-danger.png ADDED
Binary file
includes/images/icon-success.png ADDED
Binary file
includes/images/loader_350.gif ADDED
Binary file
includes/images/loader_cf.GIF ADDED
Binary file
includes/images/ppform_preloader.gif ADDED
Binary file
includes/images/publish_lighbox_default_image_v2.png ADDED
Binary file
includes/images/ring.svg ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0" encoding="utf-8"?><svg width='70px' height='70px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-ring"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><defs><filter id="uil-ring-shadow" x="-100%" y="-100%" width="300%" height="300%"><feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset><feGaussianBlur result="blurOut" in="offOut" stdDeviation="0"></feGaussianBlur><feBlend in="SourceGraphic" in2="blurOut" mode="normal"></feBlend></filter></defs><path d="M10,50c0,0,0,0.5,0.1,1.4c0,0.5,0.1,1,0.2,1.7c0,0.3,0.1,0.7,0.1,1.1c0.1,0.4,0.1,0.8,0.2,1.2c0.2,0.8,0.3,1.8,0.5,2.8 c0.3,1,0.6,2.1,0.9,3.2c0.3,1.1,0.9,2.3,1.4,3.5c0.5,1.2,1.2,2.4,1.8,3.7c0.3,0.6,0.8,1.2,1.2,1.9c0.4,0.6,0.8,1.3,1.3,1.9 c1,1.2,1.9,2.6,3.1,3.7c2.2,2.5,5,4.7,7.9,6.7c3,2,6.5,3.4,10.1,4.6c3.6,1.1,7.5,1.5,11.2,1.6c4-0.1,7.7-0.6,11.3-1.6 c3.6-1.2,7-2.6,10-4.6c3-2,5.8-4.2,7.9-6.7c1.2-1.2,2.1-2.5,3.1-3.7c0.5-0.6,0.9-1.3,1.3-1.9c0.4-0.6,0.8-1.3,1.2-1.9 c0.6-1.3,1.3-2.5,1.8-3.7c0.5-1.2,1-2.4,1.4-3.5c0.3-1.1,0.6-2.2,0.9-3.2c0.2-1,0.4-1.9,0.5-2.8c0.1-0.4,0.1-0.8,0.2-1.2 c0-0.4,0.1-0.7,0.1-1.1c0.1-0.7,0.1-1.2,0.2-1.7C90,50.5,90,50,90,50s0,0.5,0,1.4c0,0.5,0,1,0,1.7c0,0.3,0,0.7,0,1.1 c0,0.4-0.1,0.8-0.1,1.2c-0.1,0.9-0.2,1.8-0.4,2.8c-0.2,1-0.5,2.1-0.7,3.3c-0.3,1.2-0.8,2.4-1.2,3.7c-0.2,0.7-0.5,1.3-0.8,1.9 c-0.3,0.7-0.6,1.3-0.9,2c-0.3,0.7-0.7,1.3-1.1,2c-0.4,0.7-0.7,1.4-1.2,2c-1,1.3-1.9,2.7-3.1,4c-2.2,2.7-5,5-8.1,7.1 c-0.8,0.5-1.6,1-2.4,1.5c-0.8,0.5-1.7,0.9-2.6,1.3L66,87.7l-1.4,0.5c-0.9,0.3-1.8,0.7-2.8,1c-3.8,1.1-7.9,1.7-11.8,1.8L47,90.8 c-1,0-2-0.2-3-0.3l-1.5-0.2l-0.7-0.1L41.1,90c-1-0.3-1.9-0.5-2.9-0.7c-0.9-0.3-1.9-0.7-2.8-1L34,87.7l-1.3-0.6 c-0.9-0.4-1.8-0.8-2.6-1.3c-0.8-0.5-1.6-1-2.4-1.5c-3.1-2.1-5.9-4.5-8.1-7.1c-1.2-1.2-2.1-2.7-3.1-4c-0.5-0.6-0.8-1.4-1.2-2 c-0.4-0.7-0.8-1.3-1.1-2c-0.3-0.7-0.6-1.3-0.9-2c-0.3-0.7-0.6-1.3-0.8-1.9c-0.4-1.3-0.9-2.5-1.2-3.7c-0.3-1.2-0.5-2.3-0.7-3.3 c-0.2-1-0.3-2-0.4-2.8c-0.1-0.4-0.1-0.8-0.1-1.2c0-0.4,0-0.7,0-1.1c0-0.7,0-1.2,0-1.7C10,50.5,10,50,10,50z" fill="#FFF" filter="url(#uil-ring-shadow)"><animateTransform attributeName="transform" type="rotate" from="0 50 50" to="360 50 50" repeatCount="indefinite" dur="1s"></animateTransform></path></svg>
includes/init.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function captainform_session_start()
3
+ {
4
+ @session_start(array('cookie_lifetime' => 86400));
5
+ }
6
+
7
+ //BugFix for WP4.4.2 + Twenty Ten Theme
8
+ function captainform_add_jquery()
9
+ {
10
+ wp_enqueue_script('jquery');
11
+ }
12
+
13
+ function check_captainform_settings(){
14
+ if (get_site_option($GLOBALS['captainform_option1']) == '') {
15
+ add_site_option($GLOBALS['captainform_option1'], captainform_generate_installation_id());
16
+ }
17
+
18
+ if (get_site_option($GLOBALS['captainform_option2']) == '') {
19
+ add_site_option($GLOBALS['captainform_option2'], captainform_generate_installation_key());
20
+ }
21
+
22
+ if (get_site_option($GLOBALS['captainform_option3']) == '') {
23
+ add_site_option($GLOBALS['captainform_option3'], get_site_option("siteurl"));
24
+ }
25
+ }
26
+
27
+ function adding_captainform_misc_functions() {
28
+ wp_register_script('captainform_misc_functions', plugins_url('/includes/js/misc_functions.js', __DIR__), array(), uniqid(), false);
29
+ wp_enqueue_script('captainform_misc_functions');
30
+ }
31
+
32
+ if (!session_id())
33
+ add_action('init', 'captainform_session_start');
34
+ add_action('init', 'captainform_add_jquery');
35
+ add_action('init', 'check_captainform_settings');
36
+ add_action('wp_enqueue_scripts', 'adding_captainform_misc_functions');
includes/integrations/forge-element.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: bogdan
5
+ * Date: 7/8/16
6
+ * Time: 12:05 PM
7
+ */
8
+
9
+ define('FORGE_ELEMENT_DOMAIN', 'captainform');
10
+
11
+ function adding_captainform_forge_element_css() {
12
+ wp_enqueue_style('forge_element_css', plugins_url('css/forge_element.css', __DIR__), false, uniqid());
13
+ }
14
+
15
+ function forge_element_captainform($atts, $content)
16
+ {
17
+ if($atts['form_id'] != "none")
18
+ {
19
+ $container_id = md5($atts['form_id'] + time());
20
+ $container = "<div id=\"{$container_id}\">%s</div>";
21
+ return sprintf($container, captain_form($atts['form_id']));
22
+ }
23
+ else
24
+ {
25
+ return '<div class="forge-captainform-form-placeholder"></div>';
26
+ }
27
+ }
28
+
29
+ add_filter('forge_elements', 'forge_element_captainform_metadata');
30
+ function forge_element_captainform_metadata($data)
31
+ {
32
+
33
+ $fields = [];
34
+
35
+ $selectField = [
36
+ 'type' => "list",
37
+ 'name' => "form_id",
38
+ 'label' => __('Select Form', FORGE_ELEMENT_DOMAIN),
39
+ 'default' => "none",
40
+ 'choices' => ['none' => __('Please select...', FORGE_ELEMENT_DOMAIN)],
41
+ ];
42
+
43
+ $fields['select'] = $selectField;
44
+
45
+ $response = captainform_get_forms('page_or_post');
46
+ if($response->status == "ok")
47
+ {
48
+ foreach($response->forms as $form)
49
+ {
50
+ $fields['select']['choices'][$form->f_id] = $form->f_name;
51
+ }
52
+ $fields['my_forms'] = get_forge_captainform_button("My Forms", admin_url("admin.php?page=CaptainForm"), "_captainFormTab");
53
+ }
54
+ else
55
+ {
56
+ $fields['select']['choices']['none'] = __('No forms available', FORGE_ELEMENT_DOMAIN);
57
+ $fields['select']['description'] = __('There are no forms available, please create one by clicking the button below.', FORGE_ELEMENT_DOMAIN);
58
+ $fields['create'] = get_forge_captainform_button("New Form", admin_url("admin.php?page=CaptainForm-NewForm"), "_captainFormTab");
59
+ }
60
+
61
+ $data['captainform'] = [
62
+ 'title' => __('CaptainForm', FORGE_ELEMENT_DOMAIN),
63
+ 'description' => __('User-friendly form builder', FORGE_ELEMENT_DOMAIN),
64
+ 'featured' => 50,
65
+ 'group' => 'forms',
66
+ 'callback' => 'forge_element_captainform',
67
+ 'fields' => $fields,
68
+ ];
69
+
70
+ return $data;
71
+ }
72
+
73
+ function forge_field_captainform_button($args, $value = '')
74
+ {
75
+ if(!isset($args['target']) || empty($args['target']))
76
+ $args['target'] = "_blank";
77
+
78
+ $fieldContainer = '<div class="forge-captainform-field">%s</div>';
79
+ $controlsContainer = '<div class="forge-captainform-field-controls">%s</div>';
80
+ $aTag = '<a class="forge-captainform-field-button forge-captainform-create" href="%s" target="%s">%s</a>';
81
+
82
+ $aTag = sprintf($aTag, $args['url'], $args['target'], $args['text']);
83
+ $controlsContainer = sprintf($controlsContainer, $aTag);
84
+
85
+ return sprintf($fieldContainer, $controlsContainer);
86
+ }
87
+
88
+ function get_forge_captainform_button($text = "null", $url = "null", $target = "_blank")
89
+ {
90
+
91
+ return [
92
+ 'type' => "captainform_button",
93
+ 'name' => "selector",
94
+ 'default' => "none",
95
+ 'text' => __($text, FORGE_ELEMENT_DOMAIN),
96
+ 'url' => $url,
97
+ 'target' => $target,
98
+ ];
99
+
100
+ }
101
+
102
+ add_action('wp_enqueue_scripts', 'adding_captainform_forge_element_css');
includes/integrations/wp-integrations-handler.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+
4
+ class CaptainForm_WP_Integrations_Handler
5
+ {
6
+ protected static $public_key;
7
+ protected static $message;
8
+ protected static $signature;
9
+ protected static $api_key;
10
+
11
+ public static function init_vars()
12
+ {
13
+ self::$public_key = $_REQUEST["pk"];
14
+ self::$message = $_REQUEST["message"];
15
+ self::$api_key = $_REQUEST["api_key"];
16
+ self::$signature = base64_decode(str_replace(" ", "+", $_REQUEST["signature"]));
17
+ }
18
+
19
+ public static function connect($option_db_name = null)
20
+ {
21
+ self::init_vars();
22
+
23
+ if (!isset(self::$public_key) || self::$public_key == "") {
24
+ echo self::message("Key is not sent", 0);
25
+ exit();
26
+ }
27
+
28
+ if (!isset(self::$api_key) || self::$api_key == "" || self::$api_key != get_option($GLOBALS['captainform_option2'])) {
29
+ echo self::message("Invalid API Key", 0);
30
+ exit();
31
+ }
32
+
33
+ $verify = openssl_verify(self::$message, self::$signature, base64_decode(self::$public_key), OPENSSL_ALGO_SHA1);
34
+
35
+ if ($verify == 1) {
36
+ if (!get_option($option_db_name)) {
37
+ add_option($option_db_name, self::$public_key);
38
+ } else {
39
+ update_option($option_db_name, self::$public_key);
40
+ }
41
+ echo self::message("WordPress connected", 1);
42
+ } elseif ($verify == 0) {
43
+ echo self::message("Signature not verified", 0);
44
+ } else {
45
+ echo self::message("Error: " . openssl_error_string(), 0);
46
+ }
47
+ exit();
48
+ }
49
+
50
+ public static function check_connection($option_db_name)
51
+ {
52
+ if (!self::authenticate($option_db_name)) {
53
+ echo self::message("There was an error while trying to authenticate with wordpress", 0);
54
+ exit();
55
+ }
56
+ echo self::message("Connection OK", 1);
57
+ exit();
58
+ }
59
+
60
+ protected static function authenticate($option_db_name)
61
+ {
62
+ if (!get_option($option_db_name)) {
63
+ return false;
64
+ }
65
+
66
+ self::$public_key = get_option($option_db_name);
67
+ self::$message = $_REQUEST["message"];
68
+ self::$signature = base64_decode(str_replace(" ", "+", $_REQUEST["signature"]));
69
+ return openssl_verify(self::$message, self::$signature, base64_decode(self::$public_key), OPENSSL_ALGO_SHA1);
70
+ }
71
+
72
+ protected static function message($message, $status, $data = '')
73
+ {
74
+ return json_encode(
75
+ array(
76
+ "message" => $message,
77
+ "status" => $status,
78
+ "data" => $data,
79
+ )
80
+ );
81
+ }
82
+
83
+ public static function strip_data($data)
84
+ {
85
+ $data = strip_tags(rawurldecode($data));
86
+ $data = preg_replace("/&nbsp;/", ' ', $data);
87
+ $data = stripslashes($data);
88
+ return $data;
89
+ }
90
+ }
91
+
92
+ function RetrieveExtension($data)
93
+ {
94
+ $imageContents = base64_decode($data);
95
+ // If its not base64 end processing and return false
96
+ if ($imageContents === false) {
97
+ return false;
98
+ }
99
+
100
+ if(function_exists('finfo_file') && function_exists('finfo_open'))
101
+ {
102
+ $validExtensions = array('png', 'jpeg', 'jpg', 'gif');
103
+ $tempFile = tmpfile();
104
+
105
+ fwrite($tempFile, $imageContents);
106
+ $contentType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $tempFile);
107
+ fclose($tempFile);
108
+
109
+ if (substr($contentType, 0, 5) !== 'image')
110
+ return false;
111
+
112
+ $extension = ltrim($contentType, 'image/');
113
+ return false;
114
+
115
+ return $extension;
116
+ }
117
+ else
118
+ {
119
+ if(strncmp($imageContents, "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8)==0) //89 50 4e 47 0d 0a 1a 0a
120
+ return "png";
121
+ if(strncmp($imageContents, "\x47\x49\x46\x38\x37\x61",6)==0) //47 49 46 38 37 61
122
+ return "gif";
123
+ if(strncmp($imageContents, "\x47\x49\x46\x38\x39\x61",6)==0) //47 49 46 38 39 61
124
+ return "gif";
125
+
126
+ if(strncmp($imageContents, "\xFF\xD8\xFF\xE0",4)==0) //FF D8 FF E0 xx xx 4A 46 49 46 00
127
+ return "jpg"; //JFIF, JPE, JPEG, JPG
128
+ if(strncmp($imageContents, "\xff\xd8\xff\xE1", 4)==0) //FF D8 FF E1 xx xx 45 78 69 66 00
129
+ return "jpg";
130
+ if(strncmp($imageContents, "\xFF\xD8\xFF\xE8",4)==0) //FF D8 FF E8 xx xx 53 50 49 46 46 00
131
+ return "jpg";
132
+ }
133
+ return false;
134
+ }
includes/integrations/wp-posts.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+
4
+ class CaptainForm_WP_POSTS extends CaptainForm_WP_Integrations_Handler
5
+ {
6
+ const OPTION_DB_NAME = '123cf_post_public_key';
7
+
8
+ public static function connect($param = null)
9
+ {
10
+ parent::connect(self::OPTION_DB_NAME);
11
+ }
12
+
13
+ public static function check_connection($param = null)
14
+ {
15
+ parent::check_connection(self::OPTION_DB_NAME);
16
+ }
17
+
18
+ public static function new_post()
19
+ {
20
+ if (!self::authenticate(self::OPTION_DB_NAME)) {
21
+ echo self::message("There was an error while trying to authenticate with wordpress", 0);
22
+ exit();
23
+ }
24
+ $post_title = strip_tags(rawurldecode($_POST["post_title"]));
25
+ $post_title = preg_replace("/&nbsp;/", ' ', $post_title);
26
+ $post_title = stripslashes($post_title);
27
+
28
+ $post_content = rawurldecode($_POST["post_content"]);
29
+ $post_content = stripslashes($post_content);
30
+ $post_status = $_POST["post_status"];
31
+ $post_category = urldecode($_POST["post_category"]);
32
+ $post_author = $_POST["post_author"];
33
+ $post_format = $_POST["post_format"];
34
+ $comments = $_POST["comment_status"];
35
+ $comments == "1" ? $comment_status = "open" : $comment_status = "closed";
36
+ $post_excerpt = rawurldecode($_POST["post_excerpt"]);
37
+ $post_excerpt = preg_replace("/&nbsp;/", ' ', $post_excerpt);
38
+ $post_excerpt = stripslashes($post_excerpt);
39
+ $post_tags = explode(",", rawurldecode($_POST["post_tags"]));
40
+ $post_image = str_replace(" ", "+", $_POST["post_image"]);
41
+ $post_image_name = $_POST["post_image_name"];
42
+
43
+ $custom_fields_keys = self::get_custom_post_fields();
44
+ $custom_fields_values = array();
45
+ foreach ($custom_fields_keys as $key) {
46
+ if ($_POST[$key]) {
47
+ $custom_fields_values[rawurldecode($key)] = $_POST[$key];
48
+ }
49
+ }
50
+
51
+ $post_categories = explode(",", $post_category);
52
+ $cat_id_arr = array();
53
+ if (is_array($post_categories)) {
54
+ foreach ($post_categories as $category_name) {
55
+ $category_id = get_cat_ID($category_name);
56
+ if ($category_id) {
57
+ $cat_id_arr[] = $category_id;
58
+ }
59
+ }
60
+ }
61
+
62
+ $new_post = array(
63
+ 'post_author' => $post_author,
64
+ 'post_title' => $post_title,
65
+ 'post_content' => $post_content,
66
+ 'post_status' => $post_status,
67
+ 'comment_status' => $comment_status,
68
+ 'post_excerpt' => $post_excerpt,
69
+ 'post_category' => $cat_id_arr
70
+ );
71
+
72
+ $post_id = wp_insert_post($new_post);
73
+ if ($post_id) {
74
+ foreach ($custom_fields_values as $meta_key => $meta_value) {
75
+ add_post_meta($post_id, str_replace("|***|", " ", $meta_key), $meta_value);
76
+ }
77
+ set_post_format($post_id, $post_format);
78
+ wp_set_post_tags($post_id, $post_tags);
79
+ if (isset($post_image) && RetrieveExtension($post_image)) {
80
+ self::upload_image($post_id, $post_image, $post_image_name);
81
+ }
82
+ echo self::message("New post created", 1);
83
+ exit();
84
+ }
85
+ echo self::message("There was an error while trying to create new post", 0);
86
+ exit();
87
+
88
+ private static function get_custom_post_fields()
89
+ {
90
+ global $wpdb;
91
+ $custom_fields = array();
92
+ $fields = $wpdb->get_results('SELECT DISTINCT meta_key FROM wp_postmeta', OBJECT);
93
+ foreach ($fields as $field) {
94
+ if (substr($field->meta_key, 0, 1) != "_") {
95
+
96
+ $meta_key = str_replace(" ", "|***|", $field->meta_key);
97
+ $custom_fields[] = $meta_key;
98
+ }
99
+ }
100
+ return $custom_fields;
101
+ }
102
+
103
+ private static function insert_child_category($category, $wp_categories)
104
+ {
105
+ if ($category->parent == 0) {
106
+ $wp_categories[] = $category;
107
+ $args = array('hierarchical' => true, 'hide_empty' => 0, 'child_of' => $category->cat_ID);
108
+ $child_categories = get_categories($args);
109
+ foreach ($child_categories as $child_cat) {
110
+ $wp_categories[] = $child_cat;
111
+ }
112
+ }
113
+ return $wp_categories;
114
+ }
115
+
116
+ public static function get_wp_data()
117
+ {
118
+ if (!self::authenticate(self::OPTION_DB_NAME)) {
119
+ echo captainform_cfp_message("There was an error while trying to authenticate with wordpress", 0);
120
+ exit();
121
+ }
122
+ global $wpdb;
123
+ $data = array();
124
+ $custom_fields = array();
125
+
126
+ $fields = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$wpdb->prefix}postmeta", OBJECT);
127
+ foreach ($fields as $field) {
128
+ if (substr($field->meta_key, 0, 1) != "_") {
129
+ $custom_fields[] = $field->meta_key;
130
+ }
131
+ }
132
+ $data["custom_fields"] = $custom_fields;
133
+ $args = array('orderby' => 'name', 'hierarchical' => true, 'hide_empty' => 0, 'parent' => 0);
134
+ $categories = get_categories($args);
135
+ $wp_categories = array();
136
+ foreach ($categories as $category) {
137
+ $wp_categories = self::insert_child_category($category, $wp_categories);
138
+ }
139
+
140
+ $data["categories"] = $wp_categories;
141
+ $args_authors = array('who' => 'author');
142
+ $users = get_users($args_authors);
143
+ $authors = array();
144
+ foreach ($users as $user) {
145
+ $authors[] = array("id" => $user->data->ID, "username" => $user->data->user_login);
146
+ }
147
+ $data["authors"] = $authors;
148
+ echo json_encode($data);
149
+ exit();
150
+ }
151
+ private static function upload_image($post_id, $post_image, $post_image_name = null)
152
+ {
153
+ $upload_dir = wp_upload_dir();
154
+ $upload_path = str_replace('/', DIRECTORY_SEPARATOR, $upload_dir['path']) . DIRECTORY_SEPARATOR;
155
+ $decoded_img = base64_decode($post_image);
156
+ if (!$post_image_name) {
157
+ $filename = 'image.png';
158
+ } else {
159
+ $filename = $post_image_name;
160
+ }
161
+ $hashed_filename = md5($filename . microtime()) . '_' . $filename;
162
+ $image_upload = file_put_contents($upload_path . $hashed_filename, $decoded_img);
163
+ if (!function_exists('wp_handle_sideload')) {
164
+ require_once(ABSPATH . 'wp-admin/includes/file.php');
165
+ }
166
+ if (!function_exists('wp_get_current_user')) {
167
+ require_once(ABSPATH . 'wp-includes/pluggable.php');
168
+ }
169
+
170
+ $file = array();
171
+ $file['error'] = '';
172
+ $file['tmp_name'] = $upload_path . $hashed_filename;
173
+ $file['name'] = $hashed_filename;
174
+ $file['type'] = 'image/jpg';
175
+ $file['size'] = filesize($upload_path . $hashed_filename);
176
+
177
+ $file_return = wp_handle_sideload($file, array('test_form' => false));
178
+ $file_url = $file_return['file'];
179
+ $filetype = wp_check_filetype(basename($file_url), null);
180
+ $attachment = array(
181
+ 'guid' => $upload_dir['url'] . '/' . basename($file_url),
182
+ 'post_mime_type' => $filetype['type'],
183
+ 'post_title' => preg_replace('/\.[^.]+$/', '', basename($file_url)),
184
+ 'post_content' => '',
185
+ 'post_status' => 'inherit'
186
+ );
187
+ $attach_id = wp_insert_attachment($attachment, $file_url, $post_id);
188
+ require_once(ABSPATH . 'wp-admin/includes/image.php');
189
+ $attach_data = wp_generate_attachment_metadata($attach_id, $file_url);
190
+ wp_update_attachment_metadata($attach_id, $attach_data);
191
+ update_post_meta($post_id, '_thumbnail_id', $attach_id);
192
+ }
193
+ }
194
+
195
+ new CaptainForm_WP_POSTS();
196
+ add_action('wp_ajax_cfp-connect', array('CaptainForm_WP_POSTS', 'connect'));
197
+ add_action('wp_ajax_nopriv_cfp-connect', array('CaptainForm_WP_POSTS', 'connect'));
198
+ add_action('wp_ajax_cfp-new-post', array('CaptainForm_WP_POSTS', 'new_post'));
199
+ add_action('wp_ajax_nopriv_cfp-new-post', array('CaptainForm_WP_POSTS', 'new_post'));
200
+ add_action('wp_ajax_cfp-get-wp-data', array('CaptainForm_WP_POSTS', 'get_wp_data'));
201
+ add_action('wp_ajax_nopriv_cfp-get-wp-data', array('CaptainForm_WP_POSTS', 'get_wp_data'));
202
+ add_action('wp_ajax_cfp-check-connection', array('CaptainForm_WP_POSTS', 'check_connection'));
203
+ add_action('wp_ajax_nopriv_cfp-check-connection', array('CaptainForm_WP_POSTS', 'check_connection'));
204
+
includes/integrations/wp-users.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+ static function connect($param = null)
4
+ private static function get_wp_roles()
5
+ $show_admin_bar_front = isset($_REQUEST['show_admin_bar_front']) ? (self::strip_data($_REQUEST['show_admin_bar_front']) == 1 ? 'true' : 'false') : 'false' ;
6
+ $role = isset($_REQUEST['role']) ? strtolower(self::strip_data($_REQUEST['role'])) : '';
7
+ $jabber =isset($_REQUEST['jabber']) ? self::strip_data($_REQUEST['jabber']) : '';
8
+ $aim = isset($_REQUEST['aim']) ? self::strip_data($_REQUEST['aim']) : '';
9
+ $yahoo =isset($_REQUEST['yahoo']) ? self::strip_data($_REQUEST['yahoo']) : '';
10
+ $wordpress_url = isset($_REQUEST['wordpress_url']) ? self::strip_data($_REQUEST['wordpress_url']) : '';
11
+ $send_password = isset($_REQUEST['send_password']) == 1 ? (self::strip_data($_REQUEST['send_password']) == 1 ? true : false) : false;
12
+ $random_password = isset($_REQUEST['random_password']) ? (self::strip_data($_REQUEST['random_password']) == 1 ? true : false) : false;
13
+
14
+ if($random_password == false && trim($password) == "")
15
+ $random_password = true;
16
+
17
+
18
+ $username_exists = username_exists($username);
19
+ $email_exists = email_exists($email_address);
20
+ if(!empty($username_exists)|| !empty($email_exists))
21
+ {
22
+ $labels_arr = array();
23
+ $message = '';
24
+ if(!empty($username_exists))
25
+ $labels_arr[] = 'username';
26
+ if(!empty($email_exists))
27
+ $labels_arr[] = 'email';
28
+ $labels_string = implode(" and ", $labels_arr);
29
+ $aux = (count($labels_arr)>1 ? "": "s");
30
+ $message = sprintf("There was an error when trying to create the WordPress user. Sorry, that %s already exist%s!", $labels_string, $aux);
31
+ echo self::message($message, 0);
32
+ exit();
33
+ }
34
+
35
+ if (empty($username_exists) && empty($email_exists))
36
+ {
37
+ // Generate the password and create the user
38
+ {
39
+ }
40
+ {
41
+ // Email the user
42
+ $headers = 'From: ' . $admin_email . ' <' . $admin_email . '>' . "\r\n";
43
+ $headers .= "MIME-Version: 1.0\r\n";
44
+ $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
45
+
46
+ $email_content = 'Hello,<br /><br />';
47
+ $email_content .= '<b>Email Address</b>: ' . $email_address . '<br />';
48
+
49
+ if($random_password || $send_password)
50
+ wp_mail($email_address, 'Welcome!', $email_content, $headers);
51
+ $data = array();
52
+ if($status == 0 && is_wp_error( $user_id ))
53
+ {
54
+ $message = $user_id->get_error_message();
55
+ }
56
+ echo self::message($message, $status, json_encode($data));
57
+ static function get_wp_data()
58
+ new CaptainForm_WP_Users();
includes/js/chosen.jquery.js ADDED
@@ -0,0 +1,1317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ (function() {
3
+ var $, AbstractChosen, Chosen, SelectParser, _ref,
4
+ __hasProp = {}.hasOwnProperty,
5
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
6
+
7
+ SelectParser = (function() {
8
+ function SelectParser() {
9
+ this.options_index = 0;
10
+ this.parsed = [];
11
+ }
12
+
13
+ SelectParser.prototype.add_node = function(child) {
14
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
15
+ return this.add_group(child);
16
+ } else {
17
+ return this.add_option(child);
18
+ }
19
+ };
20
+
21
+ SelectParser.prototype.add_group = function(group) {
22
+ var group_position, option, _i, _len, _ref, _results;
23
+ group_position = this.parsed.length;
24
+ this.parsed.push({
25
+ array_index: group_position,
26
+ group: true,
27
+ label: this.escapeExpression(group.label),
28
+ children: 0,
29
+ disabled: group.disabled
30
+ });
31
+ _ref = group.childNodes;
32
+ _results = [];
33
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
34
+ option = _ref[_i];
35
+ _results.push(this.add_option(option, group_position, group.disabled));
36
+ }
37
+ return _results;
38
+ };
39
+
40
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
41
+ if (option.nodeName.toUpperCase() === "OPTION") {
42
+ if (option.text !== "") {
43
+ if (group_position != null) {
44
+ this.parsed[group_position].children += 1;
45
+ }
46
+ this.parsed.push({
47
+ array_index: this.parsed.length,
48
+ options_index: this.options_index,
49
+ value: option.value,
50
+ text: option.text,
51
+ html: option.innerHTML,
52
+ selected: option.selected,
53
+ disabled: group_disabled === true ? group_disabled : option.disabled,
54
+ group_array_index: group_position,
55
+ classes: option.className,
56
+ style: option.style.cssText
57
+ });
58
+ } else {
59
+ this.parsed.push({
60
+ array_index: this.parsed.length,
61
+ options_index: this.options_index,
62
+ empty: true
63
+ });
64
+ }
65
+ return this.options_index += 1;
66
+ }
67
+ };
68
+
69
+ SelectParser.prototype.escapeExpression = function(text) {
70
+ var map, unsafe_chars;
71
+ if ((text == null) || text === false) {
72
+ return "";
73
+ }
74
+ if (!/[\&\<\>\"\'\`]/.test(text)) {
75
+ return text;
76
+ }
77
+ map = {
78
+ "<": "&lt;",
79
+ ">": "&gt;",
80
+ '"': "&quot;",
81
+ "'": "&#x27;",
82
+ "`": "&#x60;"
83
+ };
84
+ unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
85
+ return text.replace(unsafe_chars, function(chr) {
86
+ return map[chr] || "&amp;";
87
+ });
88
+ };
89
+
90
+ return SelectParser;
91
+
92
+ })();
93
+
94
+ SelectParser.select_to_array = function(select) {
95
+ var child, parser, _i, _len, _ref;
96
+ parser = new SelectParser();
97
+ _ref = select.childNodes;
98
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
99
+ child = _ref[_i];
100
+ parser.add_node(child);
101
+ }
102
+ return parser.parsed;
103
+ };
104
+
105
+ AbstractChosen = (function() {
106
+ function AbstractChosen(form_field, options) {
107
+ this.form_field = form_field;
108
+ this.options = options != null ? options : {};
109
+ if (!AbstractChosen.browser_is_supported()) {
110
+ return;
111
+ }
112
+ this.is_multiple = this.form_field.multiple;
113
+ this.set_default_text();
114
+ this.set_default_values();
115
+ this.setup();
116
+ this.set_up_html();
117
+ this.register_observers();
118
+ }
119
+
120
+ AbstractChosen.prototype.set_default_values = function() {
121
+ var _this = this;
122
+ this.click_test_action = function(evt) {
123
+ return _this.test_active_click(evt);
124
+ };
125
+ this.activate_action = function(evt) {
126
+ return _this.activate_field(evt);
127
+ };
128
+ this.active_field = false;
129
+ this.mouse_on_container = false;
130
+ this.results_showing = false;
131
+ this.result_highlighted = null;
132
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
133
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
134
+ this.disable_search = this.options.disable_search || false;
135
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
136
+ this.group_search = this.options.group_search != null ? this.options.group_search : true;
137
+ this.search_contains = this.options.search_contains || false;
138
+ this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
139
+ this.max_selected_options = this.options.max_selected_options || Infinity;
140
+ this.inherit_select_classes = this.options.inherit_select_classes || false;
141
+ this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
142
+ return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
143
+ };
144
+
145
+ AbstractChosen.prototype.set_default_text = function() {
146
+ if (this.form_field.getAttribute("data-placeholder")) {
147
+ this.default_text = this.form_field.getAttribute("data-placeholder");
148
+ } else if (this.is_multiple) {
149
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
150
+ } else {
151
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
152
+ }
153
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
154
+ };
155
+
156
+ AbstractChosen.prototype.mouse_enter = function() {
157
+ return this.mouse_on_container = true;
158
+ };
159
+
160
+ AbstractChosen.prototype.mouse_leave = function() {
161
+ return this.mouse_on_container = false;
162
+ };
163
+
164
+ AbstractChosen.prototype.input_focus = function(evt) {
165
+ var _this = this;
166
+ if (this.is_multiple) {
167
+ if (!this.active_field) {
168
+ return setTimeout((function() {
169
+ return _this.container_mousedown();
170
+ }), 50);
171
+ }
172
+ } else {
173
+ if (!this.active_field) {
174
+ return this.activate_field();
175
+ }
176
+ }
177
+ };
178
+
179
+ AbstractChosen.prototype.input_blur = function(evt) {
180
+ var _this = this;
181
+ if (!this.mouse_on_container) {
182
+ this.active_field = false;
183
+ return setTimeout((function() {
184
+ return _this.blur_test();
185
+ }), 100);
186
+ }
187
+ };
188
+
189
+ AbstractChosen.prototype.results_option_build = function(options) {
190
+ var content, data, _i, _len, _ref;
191
+ content = '';
192
+ _ref = this.results_data;
193
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
194
+ data = _ref[_i];
195
+ if (data.group) {
196
+ content += this.result_add_group(data);
197
+ } else {
198
+ content += this.result_add_option(data);
199
+ }
200
+ if (options != null ? options.first : void 0) {
201
+ if (data.selected && this.is_multiple) {
202
+ this.choice_build(data);
203
+ } else if (data.selected && !this.is_multiple) {
204
+ this.single_set_selected_text(data.text);
205
+ }
206
+ }
207
+ }
208
+ return content;
209
+ };
210
+
211
+ AbstractChosen.prototype.result_add_option = function(option) {
212
+ var classes, option_el;
213
+ if (!option.search_match) {
214
+ return '';
215
+ }
216
+ if (!this.include_option_in_results(option)) {
217
+ return '';
218
+ }
219
+ classes = [];
220
+ if (!option.disabled && !(option.selected && this.is_multiple)) {
221
+ classes.push("active-result");
222
+ }
223
+ if (option.disabled && !(option.selected && this.is_multiple)) {
224
+ classes.push("disabled-result");
225
+ }
226
+ if (option.selected) {
227
+ classes.push("result-selected");
228
+ }
229
+ if (option.group_array_index != null) {
230
+ classes.push("group-option");
231
+ }
232
+ if (option.classes !== "") {
233
+ classes.push(option.classes);
234
+ }
235
+ option_el = document.createElement("li");
236
+ option_el.className = classes.join(" ");
237
+ option_el.style.cssText = option.style;
238
+ option_el.setAttribute("data-option-array-index", option.array_index);
239
+ option_el.innerHTML = option.search_text;
240
+ return this.outerHTML(option_el);
241
+ };
242
+
243
+ AbstractChosen.prototype.result_add_group = function(group) {
244
+ var group_el;
245
+ if (!(group.search_match || group.group_match)) {
246
+ return '';
247
+ }
248
+ if (!(group.active_options > 0)) {
249
+ return '';
250
+ }
251
+ group_el = document.createElement("li");
252
+ group_el.className = "group-result";
253
+ group_el.innerHTML = group.search_text;
254
+ return this.outerHTML(group_el);
255
+ };
256
+
257
+ AbstractChosen.prototype.results_update_field = function() {
258
+ this.set_default_text();
259
+ if (!this.is_multiple) {
260
+ this.results_reset_cleanup();
261
+ }
262
+ this.result_clear_highlight();
263
+ this.results_build();
264
+ if (this.results_showing) {
265
+ return this.winnow_results();
266
+ }
267
+ };
268
+
269
+ AbstractChosen.prototype.reset_single_select_options = function() {
270
+ var result, _i, _len, _ref, _results;
271
+ _ref = this.results_data;
272
+ _results = [];
273
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
274
+ result = _ref[_i];
275
+ if (result.selected) {
276
+ _results.push(result.selected = false);
277
+ } else {
278
+ _results.push(void 0);
279
+ }
280
+ }
281
+ return _results;
282
+ };
283
+
284
+ AbstractChosen.prototype.results_toggle = function() {
285
+ if (this.results_showing) {
286
+ return this.results_hide();
287
+ } else {
288
+ return this.results_show();
289
+ }
290
+ };
291
+
292
+ AbstractChosen.prototype.results_search = function(evt) {
293
+ if (this.results_showing) {
294
+ return this.winnow_results();
295
+ } else {
296
+ return this.results_show();
297
+ }
298
+ };
299
+
300
+ AbstractChosen.prototype.winnow_results = function() {
301
+ var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
302
+ this.no_results_clear();
303
+ results = 0;
304
+ searchText = this.get_search_text();
305
+ escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
306
+ regexAnchor = this.search_contains ? "" : "^"; // aditza rev
307
+ regex = new RegExp(regexAnchor + escapedSearchText, 'i');
308
+ zregex = new RegExp(escapedSearchText, 'i');
309
+ _ref = this.results_data;
310
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
311
+ option = _ref[_i];
312
+ option.search_match = false;
313
+ results_group = null;
314
+ if (this.include_option_in_results(option)) {
315
+ if (option.group) {
316
+ option.group_match = false;
317
+ option.active_options = 0;
318
+ }
319
+ if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
320
+ results_group = this.results_data[option.group_array_index];
321
+ if (results_group.active_options === 0 && results_group.search_match) {
322
+ results += 1;
323
+ }
324
+ results_group.active_options += 1;
325
+ }
326
+ if (!(option.group && !this.group_search)) {
327
+ option.search_text = option.group ? option.label : option.html;
328
+ option.search_match = this.search_string_match(option.search_text, regex);
329
+ if (option.search_match && !option.group) {
330
+ results += 1;
331
+ }
332
+ if (option.search_match) {
333
+ if (searchText.length) {
334
+ startpos = option.search_text.search(zregex);
335
+ text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
336
+ option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
337
+ }
338
+ if (results_group != null) {
339
+ results_group.group_match = true;
340
+ }
341
+ } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
342
+ option.search_match = true;
343
+ }
344
+ }
345
+ }
346
+ }
347
+ this.result_clear_highlight();
348
+ if (results < 1 && searchText.length) {
349
+ this.update_results_content("");
350
+ return this.no_results(searchText);
351
+ } else {
352
+ this.update_results_content(this.results_option_build());
353
+ return this.winnow_results_set_highlight();
354
+ }
355
+ };
356
+
357
+ AbstractChosen.prototype.search_string_match = function(search_string, regex) {
358
+ var part, parts, _i, _len;
359
+ if (regex.test(search_string)) {
360
+ return true;
361
+ } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
362
+ parts = search_string.replace(/\[|\]/g, "").split(" ");
363
+ if (parts.length) {
364
+ for (_i = 0, _len = parts.length; _i < _len; _i++) {
365
+ part = parts[_i];
366
+ if (regex.test(part)) {
367
+ return true;
368
+ }
369
+ }
370
+ }
371
+ }
372
+ };
373
+
374
+ AbstractChosen.prototype.choices_count = function() {
375
+ var option, _i, _len, _ref;
376
+ if (this.selected_option_count != null) {
377
+ return this.selected_option_count;
378
+ }
379
+ this.selected_option_count = 0;
380
+ _ref = this.form_field.options;
381
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
382
+ option = _ref[_i];
383
+ if (option.selected) {
384
+ this.selected_option_count += 1;
385
+ }
386
+ }
387
+ return this.selected_option_count;
388
+ };
389
+
390
+ AbstractChosen.prototype.choices_click = function(evt) {
391
+ evt.preventDefault();
392
+ if (!(this.results_showing || this.is_disabled)) {
393
+ return this.results_show();
394
+ }
395
+ };
396
+
397
+ AbstractChosen.prototype.keyup_checker = function(evt) {
398
+ var stroke, _ref;
399
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
400
+ this.search_field_scale();
401
+ switch (stroke) {
402
+ case 8:
403
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
404
+ return this.keydown_backstroke();
405
+ } else if (!this.pending_backstroke) {
406
+ this.result_clear_highlight();
407
+ return this.results_search();
408
+ }
409
+ break;
410
+ case 13:
411
+ evt.preventDefault();
412
+ if (this.results_showing) {
413
+ if (!this.is_multiple || this.result_highlight) {
414
+ return this.result_select(evt);
415
+ }
416
+
417
+ //daca select-ul are clasa "chosen-allow-additem" will activate create option option
418
+ if( this.form_field_jq.hasClass('chosen-allow-additem') ) {
419
+ $(this.form_field).append('<option>' + $(evt.target).val() + '</option>');
420
+ $(this.form_field).trigger('chosen:updated');
421
+ this.result_highlight = this.search_results.find('li.active-result').last();
422
+ return this.result_select(evt);
423
+ }
424
+ }
425
+
426
+ break;
427
+ case 188:
428
+ evt.preventDefault();
429
+ if (this.results_showing) {
430
+ if (!this.is_multiple || this.result_highlight) {
431
+ return this.result_select(evt);
432
+ }
433
+
434
+ //daca select-ul are clasa "chosen-allow-additem" will activate create option option
435
+ if( this.form_field_jq.hasClass('chosen-allow-additem') ) {
436
+ $(this.form_field).append('<option>' + $(evt.target).val() + '</option>');
437
+ $(this.form_field).trigger('chosen:updated');
438
+ this.result_highlight = this.search_results.find('li.active-result').last();
439
+ return this.result_select(evt);
440
+ }
441
+ }
442
+
443
+ break;
444
+ case 27:
445
+ if (this.results_showing) {
446
+ this.results_hide();
447
+ }
448
+ return true;
449
+ case 9:
450
+ case 38:
451
+ case 40:
452
+ case 16:
453
+ case 91:
454
+ case 17:
455
+ break;
456
+ default:
457
+ return this.results_search();
458
+ }
459
+ };
460
+
461
+ AbstractChosen.prototype.clipboard_event_checker = function(evt) {
462
+ var _this = this;
463
+ return setTimeout((function() {
464
+ return _this.results_search();
465
+ }), 50);
466
+ };
467
+
468
+ // adrian
469
+ AbstractChosen.prototype.container_width = function() {
470
+ if (this.options.width != null) {
471
+ return this.options.width;
472
+ } else {
473
+ var xxx = this.form_field.offsetWidth + 20;
474
+ return "" + xxx + "px";
475
+ //return "70%";
476
+ }
477
+ };
478
+
479
+ // original
480
+ /*
481
+ AbstractChosen.prototype.container_width = function() {
482
+ if (this.options.width != null) {
483
+ return this.options.width;
484
+ } else {
485
+ return "" + this.form_field.offsetWidth + "px";
486
+ }
487
+ };
488
+ */
489
+
490
+ AbstractChosen.prototype.include_option_in_results = function(option) {
491
+ if (this.is_multiple && (!this.display_selected_options && option.selected)) {
492
+ return false;
493
+ }
494
+ if (!this.display_disabled_options && option.disabled) {
495
+ return false;
496
+ }
497
+ if (option.empty) {
498
+ return false;
499
+ }
500
+ return true;
501
+ };
502
+
503
+ AbstractChosen.prototype.search_results_touchstart = function(evt) {
504
+ this.touch_started = true;
505
+ return this.search_results_mouseover(evt);
506
+ };
507
+
508
+ AbstractChosen.prototype.search_results_touchmove = function(evt) {
509
+ this.touch_started = false;
510
+ return this.search_results_mouseout(evt);
511
+ };
512
+
513
+ AbstractChosen.prototype.search_results_touchend = function(evt) {
514
+ if (this.touch_started) {
515
+ return this.search_results_mouseup(evt);
516
+ }
517
+ };
518
+
519
+ AbstractChosen.prototype.outerHTML = function(element) {
520
+ var tmp;
521
+ if (element.outerHTML) {
522
+ return element.outerHTML;
523
+ }
524
+ tmp = document.createElement("div");
525
+ tmp.appendChild(element);
526
+ return tmp.innerHTML;
527
+ };
528
+
529
+ AbstractChosen.browser_is_supported = function() {
530
+ if (window.navigator.appName === "Microsoft Internet Explorer") {
531
+ return document.documentMode >= 8;
532
+ }
533
+ if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
534
+ return false;
535
+ }
536
+ if (/Android/i.test(window.navigator.userAgent)) {
537
+ if (/Mobile/i.test(window.navigator.userAgent)) {
538
+ return false;
539
+ }
540
+ }
541
+ return true;
542
+ };
543
+
544
+ AbstractChosen.default_multiple_text = "Select Some Options";
545
+
546
+ AbstractChosen.default_single_text = "Select an Option";
547
+
548
+ AbstractChosen.default_no_result_text = "No results match";
549
+
550
+ return AbstractChosen;
551
+
552
+ })();
553
+
554
+ $ = jQuery;
555
+
556
+ $.fn.extend({
557
+ chosen: function(options) {
558
+ if (!AbstractChosen.browser_is_supported()) {
559
+ return this;
560
+ }
561
+ return this.each(function(input_field) {
562
+ var $this, chosen;
563
+ $this = $(this);
564
+ chosen = $this.data('chosen');
565
+ if (options === 'destroy' && chosen) {
566
+ chosen.destroy();
567
+ } else if (!chosen) {
568
+ $this.data('chosen', new Chosen(this, options));
569
+ }
570
+ });
571
+ }
572
+ });
573
+
574
+ Chosen = (function(_super) {
575
+ __extends(Chosen, _super);
576
+
577
+ function Chosen() {
578
+ _ref = Chosen.__super__.constructor.apply(this, arguments);
579
+ return _ref;
580
+ }
581
+
582
+ Chosen.prototype.setup = function() {
583
+ this.form_field_jq = $(this.form_field);
584
+ this.current_selectedIndex = this.form_field.selectedIndex;
585
+ return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
586
+ };
587
+
588
+ Chosen.prototype.set_up_html = function() {
589
+ var container_classes, container_props;
590
+ container_classes = ["chosen-container"];
591
+ container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
592
+ if (this.inherit_select_classes && this.form_field.className) {
593
+ container_classes.push(this.form_field.className);
594
+ }
595
+ if (this.is_rtl) {
596
+ container_classes.push("chosen-rtl");
597
+ }
598
+
599
+ // adrian force width
600
+ $('#'+this.form_field.id).show();
601
+ var woobb = $('#'+this.form_field.id).width()+20;
602
+
603
+ container_props = {
604
+ 'class': container_classes.join(' '),
605
+ 'style': "width: " + ( woobb ) + "px;", // adrian
606
+ 'title': this.form_field.title
607
+ };
608
+
609
+
610
+ if (this.form_field.id.length) {
611
+ container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
612
+ }
613
+ if (this.form_field.getAttribute('onclick') != '') {
614
+ container_props.onclick = this.form_field.getAttribute('onclick');
615
+ container_props.onfocus = this.form_field.getAttribute('onclick');
616
+ }
617
+
618
+ this.container = $("<div />", container_props);
619
+ if (this.is_multiple) {
620
+ this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
621
+ } else {
622
+ this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div class="bbarrow"><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
623
+ }
624
+ this.form_field_jq.hide().after(this.container);
625
+ this.dropdown = this.container.find('div.chosen-drop').first();
626
+ this.search_field = this.container.find('input').first();
627
+ this.search_results = this.container.find('ul.chosen-results').first();
628
+ this.search_field_scale();
629
+ this.search_no_results = this.container.find('li.no-results').first();
630
+ if (this.is_multiple) {
631
+ this.search_choices = this.container.find('ul.chosen-choices').first();
632
+ this.search_container = this.container.find('li.search-field').first();
633
+ } else {
634
+ this.search_container = this.container.find('div.chosen-search').first();
635
+ this.selected_item = this.container.find('.chosen-single').first();
636
+ }
637
+ this.results_build();
638
+ this.set_tab_index();
639
+ this.set_label_behavior();
640
+ return this.form_field_jq.trigger("chosen:ready", {
641
+ chosen: this
642
+ });
643
+ };
644
+
645
+ Chosen.prototype.register_observers = function() {
646
+ var _this = this;
647
+ this.container.bind('mousedown.chosen', function(evt) {
648
+ _this.container_mousedown(evt);
649
+ });
650
+ this.container.bind('mouseup.chosen', function(evt) {
651
+ _this.container_mouseup(evt);
652
+ });
653
+ this.container.bind('mouseenter.chosen', function(evt) {
654
+ _this.mouse_enter(evt);
655
+ });
656
+ this.container.bind('mouseleave.chosen', function(evt) {
657
+ _this.mouse_leave(evt);
658
+ });
659
+ this.search_results.bind('mouseup.chosen', function(evt) {
660
+ _this.search_results_mouseup(evt);
661
+ });
662
+ this.search_results.bind('mouseover.chosen', function(evt) {
663
+ _this.search_results_mouseover(evt);
664
+ });
665
+ this.search_results.bind('mouseout.chosen', function(evt) {
666
+ _this.search_results_mouseout(evt);
667
+ });
668
+ this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
669
+ _this.search_results_mousewheel(evt);
670
+ });
671
+ this.search_results.bind('touchstart.chosen', function(evt) {
672
+ _this.search_results_touchstart(evt);
673
+ });
674
+ this.search_results.bind('touchmove.chosen', function(evt) {
675
+ _this.search_results_touchmove(evt);
676
+ });
677
+ this.search_results.bind('touchend.chosen', function(evt) {
678
+ _this.search_results_touchend(evt);
679
+ });
680
+ this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
681
+ _this.results_update_field(evt);
682
+ });
683
+ this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
684
+ _this.activate_field(evt);
685
+ });
686
+ this.form_field_jq.bind("chosen:open.chosen", function(evt) {
687
+ _this.container_mousedown(evt);
688
+ });
689
+ this.form_field_jq.bind("chosen:close.chosen", function(evt) {
690
+ _this.input_blur(evt);
691
+ });
692
+ this.search_field.bind('blur.chosen', function(evt) {
693
+ _this.input_blur(evt);
694
+ });
695
+ this.search_field.bind('keyup.chosen', function(evt) {
696
+ _this.keyup_checker(evt);
697
+ });
698
+ this.search_field.bind('keydown.chosen', function(evt) {
699
+ _this.keydown_checker(evt);
700
+ });
701
+ this.search_field.bind('focus.chosen', function(evt) {
702
+ _this.input_focus(evt);
703
+ });
704
+ this.search_field.bind('cut.chosen', function(evt) {
705
+ _this.clipboard_event_checker(evt);
706
+ });
707
+ this.search_field.bind('paste.chosen', function(evt) {
708
+ _this.clipboard_event_checker(evt);
709
+ });
710
+ if (this.is_multiple) {
711
+ return this.search_choices.bind('click.chosen', function(evt) {
712
+ _this.choices_click(evt);
713
+ });
714
+ } else {
715
+ return this.container.bind('click.chosen', function(evt) {
716
+ evt.preventDefault();
717
+ });
718
+ }
719
+ };
720
+
721
+ Chosen.prototype.destroy = function() {
722
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
723
+ if (this.search_field[0].tabIndex) {
724
+ this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
725
+ }
726
+ this.container.remove();
727
+ this.form_field_jq.removeData('chosen');
728
+ return this.form_field_jq.show();
729
+ };
730
+
731
+ Chosen.prototype.search_field_disabled = function() {
732
+ this.is_disabled = this.form_field_jq[0].disabled;
733
+ if (this.is_disabled) {
734
+ this.container.addClass('chosen-disabled');
735
+ this.search_field[0].disabled = true;
736
+ if (!this.is_multiple) {
737
+ this.selected_item.unbind("focus.chosen", this.activate_action);
738
+ }
739
+ return this.close_field();
740
+ } else {
741
+ this.container.removeClass('chosen-disabled');
742
+ this.search_field[0].disabled = false;
743
+ if (!this.is_multiple) {
744
+ return this.selected_item.bind("focus.chosen", this.activate_action);
745
+ }
746
+ }
747
+ };
748
+
749
+ Chosen.prototype.container_mousedown = function(evt) {
750
+ if (!this.is_disabled) {
751
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
752
+ evt.preventDefault();
753
+ }
754
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
755
+ if (!this.active_field) {
756
+ if (this.is_multiple) {
757
+ this.search_field.val("");
758
+ }
759
+ $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
760
+ this.results_show();
761
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
762
+ evt.preventDefault();
763
+ this.results_toggle();
764
+ }
765
+ return this.activate_field();
766
+ }
767
+ }
768
+ };
769
+
770
+ Chosen.prototype.container_mouseup = function(evt) {
771
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
772
+ return this.results_reset(evt);
773
+ }
774
+ };
775
+
776
+ Chosen.prototype.search_results_mousewheel = function(evt) {
777
+ var delta;
778
+ if (evt.originalEvent) {
779
+ delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
780
+ }
781
+ if (delta != null) {
782
+ evt.preventDefault();
783
+ if (evt.type === 'DOMMouseScroll') {
784
+ delta = delta * 40;
785
+ }
786
+ return this.search_results.scrollTop(delta + this.search_results.scrollTop());
787
+ }
788
+ };
789
+
790
+ Chosen.prototype.blur_test = function(evt) {
791
+ if (!this.active_field && this.container.hasClass("chosen-container-active")) {
792
+ return this.close_field();
793
+ }
794
+ };
795
+
796
+ Chosen.prototype.close_field = function() {
797
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
798
+ this.active_field = false;
799
+ this.results_hide();
800
+ this.container.removeClass("chosen-container-active");
801
+ this.clear_backstroke();
802
+ this.show_search_field_default();
803
+ return this.search_field_scale();
804
+ };
805
+
806
+ Chosen.prototype.activate_field = function() {
807
+ this.container.addClass("chosen-container-active");
808
+ this.active_field = true;
809
+ this.search_field.val(this.search_field.val());
810
+ return this.search_field.focus();
811
+ };
812
+
813
+ Chosen.prototype.test_active_click = function(evt) {
814
+ var active_container;
815
+ active_container = $(evt.target).closest('.chosen-container');
816
+ if (active_container.length && this.container[0] === active_container[0]) {
817
+ return this.active_field = true;
818
+ } else {
819
+ return this.close_field();
820
+ }
821
+ };
822
+
823
+ Chosen.prototype.results_build = function() {
824
+ this.parsing = true;
825
+ this.selected_option_count = null;
826
+ this.results_data = SelectParser.select_to_array(this.form_field);
827
+ if (this.is_multiple) {
828
+ this.search_choices.find("li.search-choice").remove();
829
+ } else if (!this.is_multiple) {
830
+ this.single_set_selected_text();
831
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
832
+ this.search_field[0].readOnly = true;
833
+ this.container.addClass("chosen-container-single-nosearch");
834
+ } else {
835
+ this.search_field[0].readOnly = false;
836
+ this.container.removeClass("chosen-container-single-nosearch");
837
+ }
838
+ }
839
+ this.update_results_content(this.results_option_build({
840
+ first: true
841
+ }));
842
+ this.search_field_disabled();
843
+ this.show_search_field_default();
844
+ this.search_field_scale();
845
+ return this.parsing = false;
846
+ };
847
+
848
+ Chosen.prototype.result_do_highlight = function(el) {
849
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
850
+ if (el.length) {
851
+ this.result_clear_highlight();
852
+ this.result_highlight = el;
853
+ this.result_highlight.addClass("highlighted");
854
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
855
+ visible_top = this.search_results.scrollTop();
856
+ visible_bottom = maxHeight + visible_top;
857
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
858
+ high_bottom = high_top + this.result_highlight.outerHeight();
859
+ if (high_bottom >= visible_bottom) {
860
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
861
+ } else if (high_top < visible_top) {
862
+ return this.search_results.scrollTop(high_top);
863
+ }
864
+ }
865
+ };
866
+
867
+ Chosen.prototype.result_clear_highlight = function() {
868
+ if (this.result_highlight) {
869
+ this.result_highlight.removeClass("highlighted");
870
+ }
871
+ return this.result_highlight = null;
872
+ };
873
+
874
+ Chosen.prototype.results_show = function() {
875
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
876
+ this.form_field_jq.trigger("chosen:maxselected", {
877
+ chosen: this
878
+ });
879
+ return false;
880
+ }
881
+ this.container.addClass("chosen-with-drop");
882
+ this.results_showing = true;
883
+ this.search_field.focus();
884
+ this.search_field.val(this.search_field.val());
885
+ this.winnow_results();
886
+ return this.form_field_jq.trigger("chosen:showing_dropdown", {
887
+ chosen: this
888
+ });
889
+ };
890
+
891
+ Chosen.prototype.update_results_content = function(content) {
892
+ return this.search_results.html(content);
893
+ };
894
+
895
+ Chosen.prototype.results_hide = function() {
896
+ if (this.results_showing) {
897
+ this.result_clear_highlight();
898
+ this.container.removeClass("chosen-with-drop");
899
+ this.form_field_jq.trigger("chosen:hiding_dropdown", {
900
+ chosen: this
901
+ });
902
+ }
903
+ return this.results_showing = false;
904
+ };
905
+
906
+ Chosen.prototype.set_tab_index = function(el) {
907
+ var ti;
908
+ if (this.form_field.tabIndex) {
909
+ ti = this.form_field.tabIndex;
910
+ this.form_field.tabIndex = -1;
911
+ return this.search_field[0].tabIndex = ti;
912
+ }
913
+ };
914
+
915
+ Chosen.prototype.set_label_behavior = function() {
916
+ var _this = this;
917
+ this.form_field_label = this.form_field_jq.parents("label");
918
+ if (!this.form_field_label.length && this.form_field.id.length) {
919
+ this.form_field_label = $("label[for='" + this.form_field.id + "']");
920
+ }
921
+ if (this.form_field_label.length > 0) {
922
+ return this.form_field_label.bind('click.chosen', function(evt) {
923
+ if (_this.is_multiple) {
924
+ return _this.container_mousedown(evt);
925
+ } else {
926
+ return _this.activate_field();
927
+ }
928
+ });
929
+ }
930
+ };
931
+
932
+ Chosen.prototype.show_search_field_default = function() {
933
+ if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
934
+ this.search_field.val(this.default_text);
935
+ return this.search_field.addClass("default");
936
+ } else {
937
+ this.search_field.val("");
938
+ return this.search_field.removeClass("default");
939
+ }
940
+ };
941
+
942
+ Chosen.prototype.search_results_mouseup = function(evt) {
943
+ var target;
944
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
945
+ if (target.length) {
946
+ this.result_highlight = target;
947
+ this.result_select(evt);
948
+ return this.search_field.focus();
949
+ }
950
+ };
951
+
952
+ Chosen.prototype.search_results_mouseover = function(evt) {
953
+ var target;
954
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
955
+ if (target) {
956
+ return this.result_do_highlight(target);
957
+ }
958
+ };
959
+
960
+ Chosen.prototype.search_results_mouseout = function(evt) {
961
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
962
+ return this.result_clear_highlight();
963
+ }
964
+ };
965
+
966
+ Chosen.prototype.choice_build = function(item) {
967
+ var choice, close_link,
968
+ _this = this;
969
+ choice = $('<li />', {
970
+ "class": "search-choice"
971
+ }).html("<span>" + item.html + "</span>");
972
+ if (item.disabled) {
973
+ choice.addClass('search-choice-disabled');
974
+ } else {
975
+ close_link = $('<a />', {
976
+ "class": 'search-choice-close',
977
+ 'data-option-array-index': item.array_index
978
+ });
979
+ close_link.bind('click.chosen', function(evt) {
980
+ return _this.choice_destroy_link_click(evt);
981
+ });
982
+ choice.append(close_link);
983
+ }
984
+ return this.search_container.before(choice);
985
+ };
986
+
987
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
988
+ evt.preventDefault();
989
+ evt.stopPropagation();
990
+ if (!this.is_disabled) {
991
+ return this.choice_destroy($(evt.target));
992
+ }
993
+ };
994
+
995
+ Chosen.prototype.choice_destroy = function(link) {
996
+ if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
997
+ this.show_search_field_default();
998
+ if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
999
+ this.results_hide();
1000
+ }
1001
+ link.parents('li').first().remove();
1002
+ return this.search_field_scale();
1003
+ }
1004
+ };
1005
+
1006
+ Chosen.prototype.results_reset = function() {
1007
+ this.reset_single_select_options();
1008
+ this.form_field.options[0].selected = true;
1009
+ this.single_set_selected_text();
1010
+ this.show_search_field_default();
1011
+ this.results_reset_cleanup();
1012
+ this.form_field_jq.trigger("change");
1013
+ if (this.active_field) {
1014
+ return this.results_hide();
1015
+ }
1016
+ };
1017
+
1018
+ Chosen.prototype.results_reset_cleanup = function() {
1019
+ this.current_selectedIndex = this.form_field.selectedIndex;
1020
+ return this.selected_item.find("abbr").remove();
1021
+ };
1022
+
1023
+ Chosen.prototype.result_select = function(evt) {
1024
+ var high, item;
1025
+ if (this.result_highlight) {
1026
+ high = this.result_highlight;
1027
+ this.result_clear_highlight();
1028
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
1029
+ this.form_field_jq.trigger("chosen:maxselected", {
1030
+ chosen: this
1031
+ });
1032
+ return false;
1033
+ }
1034
+ if (this.is_multiple) {
1035
+ high.removeClass("active-result");
1036
+ } else {
1037
+ this.reset_single_select_options();
1038
+ }
1039
+ item = this.results_data[high[0].getAttribute("data-option-array-index")];
1040
+ item.selected = true;
1041
+ this.form_field.options[item.options_index].selected = true;
1042
+ this.selected_option_count = null;
1043
+ if (this.is_multiple) {
1044
+ this.choice_build(item);
1045
+ } else {
1046
+ this.single_set_selected_text(item.text);
1047
+ }
1048
+ if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
1049
+ this.results_hide();
1050
+ }
1051
+ this.search_field.val("");
1052
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1053
+ this.form_field_jq.trigger("change", {
1054
+ 'selected': this.form_field.options[item.options_index].value
1055
+ });
1056
+ }
1057
+ this.current_selectedIndex = this.form_field.selectedIndex;
1058
+ return this.search_field_scale();
1059
+ }
1060
+ };
1061
+
1062
+ Chosen.prototype.single_set_selected_text = function(text) {
1063
+ if (text == null) {
1064
+ text = this.default_text;
1065
+ }
1066
+ if (text === this.default_text) {
1067
+ this.selected_item.addClass("chosen-default");
1068
+ } else {
1069
+ this.single_deselect_control_build();
1070
+ this.selected_item.removeClass("chosen-default");
1071
+ }
1072
+ return this.selected_item.find("span").text(text);
1073
+ };
1074
+
1075
+ Chosen.prototype.result_deselect = function(pos) {
1076
+ var result_data;
1077
+ result_data = this.results_data[pos];
1078
+ if (!this.form_field.options[result_data.options_index].disabled) {
1079
+ result_data.selected = false;
1080
+ this.form_field.options[result_data.options_index].selected = false;
1081
+ this.selected_option_count = null;
1082
+ this.result_clear_highlight();
1083
+ if (this.results_showing) {
1084
+ this.winnow_results();
1085
+ }
1086
+ this.form_field_jq.trigger("change", {
1087
+ deselected: this.form_field.options[result_data.options_index].value
1088
+ });
1089
+ this.search_field_scale();
1090
+ return true;
1091
+ } else {
1092
+ return false;
1093
+ }
1094
+ };
1095
+
1096
+ Chosen.prototype.single_deselect_control_build = function() {
1097
+ if (!this.allow_single_deselect) {
1098
+ return;
1099
+ }
1100
+ if (!this.selected_item.find("abbr").length) {
1101
+ this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
1102
+ }
1103
+ return this.selected_item.addClass("chosen-single-with-deselect");
1104
+ };
1105
+
1106
+ Chosen.prototype.get_search_text = function() {
1107
+ if (this.search_field.val() === this.default_text) {
1108
+ return "";
1109
+ } else {
1110
+ return $('<div/>').text($.trim(this.search_field.val())).html();
1111
+ }
1112
+ };
1113
+
1114
+ Chosen.prototype.winnow_results_set_highlight = function() {
1115
+ var do_high, selected_results;
1116
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
1117
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
1118
+ if (do_high != null) {
1119
+ return this.result_do_highlight(do_high);
1120
+ }
1121
+ };
1122
+
1123
+ Chosen.prototype.no_results = function(terms) {
1124
+ var no_results_html;
1125
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
1126
+ no_results_html.find("span").first().html(terms);
1127
+ this.search_results.append(no_results_html);
1128
+ return this.form_field_jq.trigger("chosen:no_results", {
1129
+ chosen: this
1130
+ });
1131
+ };
1132
+
1133
+ Chosen.prototype.no_results_clear = function() {
1134
+ return this.search_results.find(".no-results").remove();
1135
+ };
1136
+
1137
+ Chosen.prototype.keydown_arrow = function() {
1138
+ var next_sib;
1139
+ if (this.results_showing && this.result_highlight) {
1140
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
1141
+ if (next_sib) {
1142
+ return this.result_do_highlight(next_sib);
1143
+ }
1144
+ } else {
1145
+ return this.results_show();
1146
+ }
1147
+ };
1148
+
1149
+ Chosen.prototype.keyup_arrow = function() {
1150
+ var prev_sibs;
1151
+ if (!this.results_showing && !this.is_multiple) {
1152
+ return this.results_show();
1153
+ } else if (this.result_highlight) {
1154
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
1155
+ if (prev_sibs.length) {
1156
+ return this.result_do_highlight(prev_sibs.first());
1157
+ } else {
1158
+ if (this.choices_count() > 0) {
1159
+ this.results_hide();
1160
+ }
1161
+ return this.result_clear_highlight();
1162
+ }
1163
+ }
1164
+ };
1165
+
1166
+ Chosen.prototype.keydown_backstroke = function() {
1167
+ var next_available_destroy;
1168
+ if (this.pending_backstroke) {
1169
+ this.choice_destroy(this.pending_backstroke.find("a").first());
1170
+ return this.clear_backstroke();
1171
+ } else {
1172
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
1173
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
1174
+ this.pending_backstroke = next_available_destroy;
1175
+ if (this.single_backstroke_delete) {
1176
+ return this.keydown_backstroke();
1177
+ } else {
1178
+ return this.pending_backstroke.addClass("search-choice-focus");
1179
+ }
1180
+ }
1181
+ }
1182
+ };
1183
+
1184
+ Chosen.prototype.clear_backstroke = function() {
1185
+ if (this.pending_backstroke) {
1186
+ this.pending_backstroke.removeClass("search-choice-focus");
1187
+ }
1188
+ return this.pending_backstroke = null;
1189
+ };
1190
+
1191
+ Chosen.prototype.keydown_checker = function(evt) {
1192
+ var stroke, _ref1;
1193
+ stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
1194
+ this.search_field_scale();
1195
+ if (stroke !== 8 && this.pending_backstroke) {
1196
+ this.clear_backstroke();
1197
+ }
1198
+ switch (stroke) {
1199
+ case 8:
1200
+ this.backstroke_length = this.search_field.val().length;
1201
+ break;
1202
+ case 9:
1203
+ if (this.results_showing && !this.is_multiple) {
1204
+ this.result_select(evt);
1205
+ }
1206
+ this.mouse_on_container = false;
1207
+ break;
1208
+ case 13:
1209
+ evt.preventDefault();
1210
+ break;
1211
+ case 188:
1212
+ evt.preventDefault();
1213
+ break;
1214
+ case 38:
1215
+ evt.preventDefault();
1216
+ this.keyup_arrow();
1217
+ break;
1218
+ case 40:
1219
+ evt.preventDefault();
1220
+ this.keydown_arrow();
1221
+ break;
1222
+ }
1223
+ };
1224
+
1225
+ Chosen.prototype.search_field_scale = function() {
1226
+ var div, f_width, h, style, style_block, styles, w, _i, _len;
1227
+ if (this.is_multiple) {
1228
+ h = 0;
1229
+ w = 0;
1230
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1231
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1232
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
1233
+ style = styles[_i];
1234
+ style_block += style + ":" + this.search_field.css(style) + ";";
1235
+ }
1236
+ div = $('<div />', {
1237
+ 'style': style_block
1238
+ });
1239
+ div.text(this.search_field.val());
1240
+ $('body').append(div);
1241
+ w = div.width() + 25;
1242
+ div.remove();
1243
+ f_width = this.container.outerWidth();
1244
+ if (w > f_width - 10) {
1245
+ w = f_width - 10;
1246
+ }
1247
+ return this.search_field.css({
1248
+ 'width': w + 'px'
1249
+ });
1250
+ }
1251
+ };
1252
+
1253
+ return Chosen;
1254
+
1255
+ })(AbstractChosen);
1256
+
1257
+ }).call(this);
1258
+
1259
+
1260
+
1261
+
1262
+ (function($){
1263
+ $(document).ready(function() {
1264
+
1265
+ $('.clearable').mousemove(function() {
1266
+ var divname=$(this).attr("name");
1267
+ var cid_arr = divname.split("_");
1268
+ var cid = cid_arr[1];
1269
+ var xb = 'clear_'+cid;
1270
+ var obj = $( "input[id*="+cid+"]" );
1271
+ for(i=0;i<obj.length;i++){
1272
+ var id=obj[i].id;
1273
+ if($('#'+id).prop('checked')){
1274
+ $('#'+xb).show();
1275
+ }
1276
+ }
1277
+ $('.xbtnp').hide();
1278
+ });
1279
+
1280
+ $('.clearable').mouseout(function() {
1281
+ var divname=$(this).attr("name");
1282
+ var cid_arr = divname.split("_");
1283
+ var cid = cid_arr[1];
1284
+ var xb = 'clear_'+cid;
1285
+ $('#'+xb).hide();
1286
+ });
1287
+
1288
+ $('.xbtn_top').mousemove(function() {
1289
+ $(this).show();
1290
+ $('.xbtnp').hide();
1291
+ });
1292
+
1293
+ $('.xbtn_top').mouseenter(function() {
1294
+ $(this).show();
1295
+ });
1296
+
1297
+ $('.xbtn_top').click(function(e) {
1298
+ e.preventDefault();
1299
+ var divname=$(this).attr("id");
1300
+ var cid_arr = divname.split("_");
1301
+ var cid = cid_arr[1];
1302
+ var obj = $( "input[id*="+cid+"]" );
1303
+ obj.prop('checked', false);
1304
+
1305
+ var objother = $( "input[id*="+cid+"-other]" );
1306
+ objother.val('');
1307
+
1308
+ var c = InputRules(cid);
1309
+ $(this).hide();
1310
+ //OCULUS
1311
+ var oculus_class = 'customRadioImage'+cid;
1312
+ $('.'+oculus_class).css('background-position','0px 0px');
1313
+ });
1314
+
1315
+ //jQuery Functions
1316
+ });
1317
+ }(jQuery));
includes/js/form_popup.js ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ function captainform_popup_default(){
3
+
4
+ var popup_params={
5
+ popup_url: '',
6
+ popup_w: 500,
7
+ popup_h: 250,
8
+ popup_title: '',
9
+ pupup_body: '',
10
+ popup_buttons: [],
11
+ action_name:'',
12
+ action_params: []
13
+ }
14
+ return popup_params;
15
+
16
+ }
17
+
18
+ var element2;
19
+
20
+ function captainform_create_form_popup(msg) {
21
+ jQuery('#captainform_popup_form').remove();
22
+ url = msg.url;
23
+ w = msg.popup_w;
24
+
25
+ document.documentElement.style.overflow = 'hidden'; // firefox, chrome
26
+ document.body.scroll = "no"; // ie only
27
+ style_ios = '';
28
+ if (captainform_is_ios())
29
+ {
30
+ style_ios = ' style="-webkit-overflow-scrolling: touch"';
31
+ }
32
+
33
+ htm = '';
34
+ htm += '<div id="captainform_popup_form" onclick="close_popup_fx()" class="captainform_popup_bg_form">';
35
+ htm += '<div id="cfloader" class="captainform_loader_form"></div>';
36
+ htm += '<div id="popup_box_fx" class="captainform_popup_box_form">';
37
+ htm += '<div class="close_cnt"><div id="xclose" class="captainform_popup_close_form" onclick="close_popup_fx()"></div></div>';
38
+ htm += '<div id="popup_body_fx" class="captainform_popup_body_form"' + style_ios + '><iframe id="ppiframefx" src="' + url + '" class="popup_iframe_form" scrolling="no"></iframe></div>';
39
+ htm += '</div>';;
40
+ htm += '</div>';
41
+ ppi = document.getElementById('ppiframefx');
42
+
43
+ jQuery('body').append(htm);
44
+ jQuery('#popup_box_fx').width(w);
45
+ jQuery('#popup_box_fx').height(0);
46
+ jQuery('#captainform_popup_form').show();
47
+
48
+ jQuery("#ppiframefx").on("load", function () {
49
+ jQuery('#popup_box_fx').show();
50
+ resize_popup_iframe_fx();
51
+ });
52
+ jQuery("#popup_box_fx").on("click", function (e) {
53
+ e.preventDefault();
54
+ return false;
55
+ });
56
+
57
+ element2 = document.getElementById('ppiframefx');
58
+
59
+ var isOldIE = (navigator.userAgent.indexOf("MSIE") !== -1); // Detect IE10 and below
60
+
61
+ iFrameResize({
62
+ log: false,
63
+ scrolling: false,
64
+ enablePublicMethods: true,
65
+ checkOrigin: false,
66
+ heightCalculationMethod: isOldIE ? 'max' : 'documentElementOffset', // old wy max e obligatoriu pt ie8
67
+ resizedCallback: function (messageData) {
68
+ hh = messageData.height;
69
+ hhf = parseInt(hh) - 0;
70
+ iframe_height = hhf;
71
+ jQuery('#popup_box_fx').height(hhf);
72
+ resize_popup_iframe_fx();
73
+ jQuery('#cfloader').remove();
74
+ },
75
+ scrollCallback: function () {
76
+
77
+ },
78
+ messageCallback: function (messageData) { // Callback fn when message is received
79
+
80
+ }
81
+ }, element2);
82
+
83
+ }
84
+
85
+ function resize_popup_iframe_fx() {
86
+ if (jQuery('#ppiframefx').length == 0) {
87
+ return false;
88
+ }
89
+
90
+ max_h = jQuery(window).height() - 50;
91
+ jQuery('#popup_box_fx').css('max-height', max_h + 'px');
92
+ max_w = jQuery(window).width() - 50;
93
+ jQuery('#popup_box_fx').css('max-width', max_w + 'px');
94
+
95
+ jQuery('#popup_body_fx').css('max-height', jQuery('#popup_box_fx').height() + 'px');
96
+ diff = jQuery('#ppiframefx').outerHeight() - jQuery('#popup_box_fx').outerHeight();
97
+ jQuery('#popup_body_fx').delay(500).queue(function(next){
98
+ next();
99
+ });
100
+ }
101
+
102
+ function captainform_is_ios() {
103
+ var iDevices = [ 'iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod' ];
104
+ if (!!navigator.platform) {
105
+ while (iDevices.length) {
106
+ if (navigator.platform === iDevices.pop()){ return true; }
107
+ }
108
+ }
109
+ return false;
110
+ }
111
+ function close_popup_fx() {
112
+ jQuery('#captainform_popup_form').remove();
113
+ //jQuery("window").css("overflow", "auto");
114
+ document.documentElement.style.overflow = 'auto'; // firefox, chrome
115
+ document.body.scroll = "yes"; // ie only
116
+ }
117
+
118
+ function resize_payment_fx()
119
+ {
120
+ alert('Is payment!');
121
+ }
122
+ window.onresize = function(event) {
123
+ resize_popup_iframe_fx();
124
+ };
125
+ window.addEventListener('message', function(e){
126
+ msg_pp = e.data;
127
+ w=parseInt(msg_pp.fwidth);
128
+ if ( jQuery('#popup_box_fx').length && msg_pp.hasOwnProperty('fwidth') ) {
129
+ jQuery('#popup_box_fx').css('width',w+'px');
130
+ jQuery('#popup_body_fx').off('scrollTo').scrollTo(jQuery('#ppiframefx'), 300);
131
+ }
132
+ if ( msg_pp.hasOwnProperty('msgpreviewpopup') ) {
133
+ captainform_create_form_popup({url: 'https://app.captainform.com/form-'+ msg_pp.msgpreviewpopup +'/?style=preview_iframe:1', popup_w: 1000})
134
+ }
135
+ });
136
+ jQuery.fn.scrollTo = function(elem, speed) {
137
+ jQuery(this).animate({
138
+ scrollTop: jQuery(this).scrollTop() - jQuery(this).offset().top + jQuery(elem).offset().top
139
+ }, speed == undefined ? 500 : speed);
140
+ return this;
141
+ };
includes/js/iframeResizer.contentWindow.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v3.5.1 - 2015-11-04
2
+ * Desc: Include this file in any page being loaded into an iframe
3
+ * to force the iframe to resize to the content size.
4
+ * Requires: iframeResizer.min.js on host page.
5
+ * Copyright: (c) 2015 David J. Bradshaw - dave@bradshaw.net
6
+ * License: MIT
7
+ */
8
+
9
+ !function(a){"use strict";function b(b,c,d){"addEventListener"in a?b.addEventListener(c,d,!1):"attachEvent"in a&&b.attachEvent("on"+c,d)}function c(b,c,d){"removeEventListener"in a?b.removeEventListener(c,d,!1):"detachEvent"in a&&b.detachEvent("on"+c,d)}function d(a){return a.charAt(0).toUpperCase()+a.slice(1)}function e(a){var b,c,d,e=null,f=0,g=function(){f=Fa(),e=null,d=a.apply(b,c),e||(b=c=null)};return function(){var h=Fa();f||(f=h);var i=xa-(h-f);return b=this,c=arguments,0>=i||i>xa?(e&&(clearTimeout(e),e=null),f=h,d=a.apply(b,c),e||(b=c=null)):e||(e=setTimeout(g,i)),d}}function f(a){return ma+"["+oa+"] "+a}function g(b){la&&"object"==typeof a.console&&console.log(f(b))}function h(b){"object"==typeof a.console&&console.warn(f(b))}function i(){j(),g("Initialising iFrame ("+location.href+")"),k(),n(),m("background",W),m("padding",$),A(),s(),t(),o(),C(),u(),ia=B(),N("init","Init message from host page"),Da()}function j(){function a(a){return"true"===a?!0:!1}var b=ha.substr(na).split(":");oa=b[0],X=void 0!==b[1]?Number(b[1]):X,_=void 0!==b[2]?a(b[2]):_,la=void 0!==b[3]?a(b[3]):la,ja=void 0!==b[4]?Number(b[4]):ja,U=void 0!==b[6]?a(b[6]):U,Y=b[7],fa=void 0!==b[8]?b[8]:fa,W=b[9],$=b[10],ua=void 0!==b[11]?Number(b[11]):ua,ia.enable=void 0!==b[12]?a(b[12]):!1,qa=void 0!==b[13]?b[13]:qa,Aa=void 0!==b[14]?b[14]:Aa}function k(){function b(){var b=a.iFrameResizer;g("Reading data from page: "+JSON.stringify(b)),Ca="messageCallback"in b?b.messageCallback:Ca,Da="readyCallback"in b?b.readyCallback:Da,ta="targetOrigin"in b?b.targetOrigin:ta,fa="heightCalculationMethod"in b?b.heightCalculationMethod:fa,Aa="widthCalculationMethod"in b?b.widthCalculationMethod:Aa}"iFrameResizer"in a&&Object===a.iFrameResizer.constructor&&b(),g("TargetOrigin for parent set to: "+ta)}function l(a,b){return-1!==b.indexOf("-")&&(h("Negative CSS value ignored for "+a),b=""),b}function m(a,b){void 0!==b&&""!==b&&"null"!==b&&(document.body.style[a]=b,g("Body "+a+' set to "'+b+'"'))}function n(){void 0===Y&&(Y=X+"px"),m("margin",l("margin",Y))}function o(){document.documentElement.style.height="",document.body.style.height="",g('HTML & body height set to "auto"')}function p(e){function f(){N(e.eventName,e.eventType)}var h={add:function(c){b(a,c,f)},remove:function(b){c(a,b,f)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(h[e.method])):h[e.method](e.eventName),g(d(e.method)+" event listener: "+e.eventType)}function q(a){p({method:a,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),p({method:a,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),p({method:a,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),p({method:a,eventType:"Input",eventName:"input"}),p({method:a,eventType:"Mouse Up",eventName:"mouseup"}),p({method:a,eventType:"Mouse Down",eventName:"mousedown"}),p({method:a,eventType:"Orientation Change",eventName:"orientationchange"}),p({method:a,eventType:"Touch Start",eventName:"touchstart"}),p({method:a,eventType:"Touch End",eventName:"touchend"}),p({method:a,eventType:"Touch Cancel",eventName:"touchcancel"}),p({method:a,eventType:"Print",eventName:["afterprint","beforeprint"]}),p({method:a,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),p({method:a,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),p({method:a,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===qa&&p({method:a,eventType:"IFrame Resized",eventName:"resize"})}function r(a,b,c,d){return b!==a&&(a in c||(h(a+" is not a valid option for "+d+"CalculationMethod."),a=b),g(d+' calculation method set to "'+a+'"')),a}function s(){fa=r(fa,ea,Ga,"height")}function t(){Aa=r(Aa,za,Ha,"width")}function u(){!0===U?(q("add"),F()):g("Auto Resize disabled")}function v(){g("Disable outgoing messages"),ra=!1}function w(){g("Remove event listener: Message"),c(a,"message",S)}function x(){null!==Z&&Z.disconnect()}function y(){q("remove"),x(),clearInterval(ka)}function z(){v(),w(),!0===U&&y()}function A(){var a=document.createElement("div");a.style.clear="both",a.style.display="block",document.body.appendChild(a)}function B(){function c(){return{x:void 0!==a.pageXOffset?a.pageXOffset:document.documentElement.scrollLeft,y:void 0!==a.pageYOffset?a.pageYOffset:document.documentElement.scrollTop}}function d(a){var b=a.getBoundingClientRect(),d=c();return{x:parseInt(b.left,10)+parseInt(d.x,10),y:parseInt(b.top,10)+parseInt(d.y,10)}}function e(a){function b(a){var b=d(a);g("Moving to in page link (#"+c+") at x: "+b.x+" y: "+b.y),R(b.y,b.x,"scrollToOffset")}var c=a.split("#")[1]||a,e=decodeURIComponent(c),f=document.getElementById(e)||document.getElementsByName(e)[0];void 0!==f?b(f):(g("In page link (#"+c+") not found in iFrame, so sending to parent"),R(0,0,"inPageLink","#"+c))}function f(){""!==location.hash&&"#"!==location.hash&&e(location.href)}function i(){function a(a){function c(a){a.preventDefault(),e(this.getAttribute("href"))}"#"!==a.getAttribute("href")&&b(a,"click",c)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),a)}function j(){b(a,"hashchange",f)}function k(){setTimeout(f,ba)}function l(){Array.prototype.forEach&&document.querySelectorAll?(g("Setting up location.hash handlers"),i(),j(),k()):h("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return ia.enable?l():g("In page linking not enabled"),{findTarget:e}}function C(){g("Enable public methods"),Ba.parentIFrame={autoResize:function(a){return!0===a&&!1===U?(U=!0,u()):!1===a&&!0===U&&(U=!1,y()),U},close:function(){R(0,0,"close"),z()},getId:function(){return oa},getPageInfo:function(a){"function"==typeof a?(Ea=a,R(0,0,"pageInfo")):(Ea=a,R(0,0,"pageInfoStop"))},moveToAnchor:function(a){ia.findTarget(a)},reset:function(){Q("parentIFrame.reset")},scrollTo:function(a,b){R(b,a,"scrollTo")},scrollToOffset:function(a,b){R(b,a,"scrollToOffset")},sendMessage:function(a,b){R(0,0,"message",JSON.stringify(a),b)},setHeightCalculationMethod:function(a){fa=a,s()},setWidthCalculationMethod:function(a){Aa=a,t()},setTargetOrigin:function(a){g("Set targetOrigin: "+a),ta=a},size:function(a,b){var c=""+(a?a:"")+(b?","+b:"");N("size","parentIFrame.size("+c+")",a,b)}}}function D(){0!==ja&&(g("setInterval: "+ja+"ms"),ka=setInterval(function(){N("interval","setInterval: "+ja)},Math.abs(ja)))}function E(){function b(a){function b(a){!1===a.complete&&(g("Attach listeners to "+a.src),a.addEventListener("load",f,!1),a.addEventListener("error",h,!1),k.push(a))}"attributes"===a.type&&"src"===a.attributeName?b(a.target):"childList"===a.type&&Array.prototype.forEach.call(a.target.querySelectorAll("img"),b)}function c(a){k.splice(k.indexOf(a),1)}function d(a){g("Remove listeners from "+a.src),a.removeEventListener("load",f,!1),a.removeEventListener("error",h,!1),c(a)}function e(a,b,c){d(a.target),N(b,c+": "+a.target.src,void 0,void 0)}function f(a){e(a,"imageLoad","Image loaded")}function h(a){e(a,"imageLoadFailed","Image load failed")}function i(a){N("mutationObserver","mutationObserver: "+a[0].target+" "+a[0].type),a.forEach(b)}function j(){var a=document.querySelector("body"),b={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return m=new l(i),g("Create body MutationObserver"),m.observe(a,b),m}var k=[],l=a.MutationObserver||a.WebKitMutationObserver,m=j();return{disconnect:function(){"disconnect"in m&&(g("Disconnect body MutationObserver"),m.disconnect(),k.forEach(d))}}}function F(){var b=0>ja;a.MutationObserver||a.WebKitMutationObserver?b?D():Z=E():(g("MutationObserver not supported in this browser!"),D())}function G(a,b){function c(a){var c=/^\d+(px)?$/i;if(c.test(a))return parseInt(a,V);var d=b.style.left,e=b.runtimeStyle.left;return b.runtimeStyle.left=b.currentStyle.left,b.style.left=a||0,a=b.style.pixelLeft,b.style.left=d,b.runtimeStyle.left=e,a}var d=0;return b=b||document.body,"defaultView"in document&&"getComputedStyle"in document.defaultView?(d=document.defaultView.getComputedStyle(b,null),d=null!==d?d[a]:0):d=c(b.currentStyle[a]),parseInt(d,V)}function H(a){a>xa/2&&(xa=2*a,g("Event throttle increased to "+xa+"ms"))}function I(a,b){for(var c=b.length,e=0,f=0,h=d(a),i=Fa(),j=0;c>j;j++)e=b[j].getBoundingClientRect()[a]+G("margin"+h,b[j]),e>f&&(f=e);return i=Fa()-i,g("Parsed "+c+" HTML elements"),g("Element position calculated in "+i+"ms"),H(i),f}function J(a){return[a.bodyOffset(),a.bodyScroll(),a.documentElementOffset(),a.documentElementScroll()]}function K(a,b){function c(){return h("No tagged elements ("+b+") found on page"),da}var d=document.querySelectorAll("["+b+"]");return 0===d.length?c():I(a,d)}function L(){return document.querySelectorAll("body *")}function M(a,b,c,d){function e(){da=l,ya=m,R(da,ya,a)}function f(){function a(a,b){var c=Math.abs(a-b)<=ua;return!c}return l=void 0!==c?c:Ga[fa](),m=void 0!==d?d:Ha[Aa](),a(da,l)||_&&a(ya,m)}function h(){return!(a in{init:1,interval:1,size:1})}function i(){return fa in pa||_&&Aa in pa}function j(){g("No change in size detected")}function k(){h()&&i()?Q(b):a in{interval:1}||j()}var l,m;f()||"init"===a?(O(),e()):k()}function N(a,b,c,d){function e(){a in{reset:1,resetPage:1,init:1}||g("Trigger event: "+b)}function f(){return va&&a in aa}f()?g("Trigger event cancelled: "+a):(e(),Ia(a,b,c,d))}function O(){va||(va=!0,g("Trigger event lock on")),clearTimeout(wa),wa=setTimeout(function(){va=!1,g("Trigger event lock off"),g("--")},ba)}function P(a){da=Ga[fa](),ya=Ha[Aa](),R(da,ya,a)}function Q(a){var b=fa;fa=ea,g("Reset trigger event: "+a),O(),P("reset"),fa=b}function R(a,b,c,d,e){function f(){void 0===e?e=ta:g("Message targetOrigin: "+e)}function h(){var f=a+":"+b,h=oa+":"+f+":"+c+(void 0!==d?":"+d:"");g("Sending message to host page ("+h+")"),sa.postMessage(ma+h,e)}!0===ra&&(f(),h())}function S(b){function c(){return ma===(""+b.data).substr(0,na)}function d(){ha=b.data,sa=b.source,i(),ca=!1,setTimeout(function(){ga=!1},ba)}function e(){ga?g("Page reset ignored by init"):(g("Page size reset by host page"),P("resetPage"))}function f(){N("resizeParent","Parent window requested size check")}function j(){var a=l();ia.findTarget(a)}function k(){return b.data.split("]")[1].split(":")[0]}function l(){return b.data.substr(b.data.indexOf(":")+1)}function m(){return"iFrameResize"in a}function n(){var a=l();g("MessageCallback called from parent: "+a),Ca(JSON.parse(a)),g(" --")}function o(){var a=l();g("PageInfoFromParent called from parent: "+a),Ea(JSON.parse(a)),g(" --")}function p(){return b.data.split(":")[2]in{"true":1,"false":1}}function q(){switch(k()){case"reset":e();break;case"resize":f();break;case"moveToAnchor":j();break;case"message":n();break;case"pageInfo":o();break;default:m()||p()||h("Unexpected message ("+b.data+")")}}function r(){!1===ca?q():p()?d():g('Ignored message of type "'+k()+'". Received before initialization.')}c()&&r()}function T(){"loading"!==document.readyState&&a.parent.postMessage("[iFrameResizerChild]Ready","*")}var U=!0,V=10,W="",X=0,Y="",Z=null,$="",_=!1,aa={resize:1,click:1},ba=128,ca=!0,da=1,ea="bodyOffset",fa=ea,ga=!0,ha="",ia={},ja=32,ka=null,la=!1,ma="[iFrameSizer]",na=ma.length,oa="",pa={max:1,min:1,bodyScroll:1,documentElementScroll:1},qa="child",ra=!0,sa=a.parent,ta="*",ua=0,va=!1,wa=null,xa=16,ya=1,za="scroll",Aa=za,Ba=a,Ca=function(){h("MessageCallback function not defined")},Da=function(){},Ea=function(){},Fa=Date.now||function(){return(new Date).getTime()},Ga={bodyOffset:function(){return document.body.offsetHeight+G("marginTop")+G("marginBottom")},offset:function(){return Ga.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,J(Ga))},min:function(){return Math.min.apply(null,J(Ga))},grow:function(){return Ga.max()},lowestElement:function(){return Math.max(Ga.bodyOffset(),I("bottom",L()))},taggedElement:function(){return K("bottom","data-iframe-height")}},Ha={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Ha.bodyScroll(),Ha.documentElementScroll())},max:function(){return Math.max.apply(null,J(Ha))},min:function(){return Math.min.apply(null,J(Ha))},rightMostElement:function(){return I("right",L())},taggedElement:function(){return K("right","data-iframe-width")}},Ia=e(M);b(a,"message",S),T()}(window||{});
10
+ //# sourceMappingURL=iframeResizer.contentWindow.map
includes/js/iframeResizer.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["iframeResizer.js"],"names":["window","addEventListener","obj","evt","func","attachEvent","removeEventListener","el","detachEvent","setupRequestAnimationFrame","x","vendors","length","requestAnimationFrame","log","getMyID","iframeId","retStr","top","self","parentIFrame","getId","formatLogHeader","msgId","isLogEnabled","settings","logEnabled","msg","output","info","warn","type","enabled","console","iFrameListener","event","resizeIFrame","resize","setSize","messageData","setPagePosition","ensureInRange","syncResize","processMsg","data","substr","msgIdLen","split","iframe","id","height","width","Dimension","max","Number","min","dimension","toLowerCase","size","isMessageFromIFrame","checkAllowedOrigin","checkList","i","retCode","checkOrigin","origin","checkSingle","remoteHost","constructor","Array","Error","isMessageForUs","isMessageFromMetaParent","true","false","undefined","getMsgBody","offset","indexOf","msgHeaderLen","forwardMsgFromIFrame","msgBody","callback","message","JSON","parse","getPageInfo","bodyPosition","document","body","getBoundingClientRect","iFramePosition","stringify","clientHeight","Math","documentElement","innerHeight","clientWidth","innerWidth","offsetTop","parseInt","offsetLeft","left","scrollTop","pageYOffset","scrollLeft","pageXOffset","sendPageInfoToIframe","debouncedTrigger","trigger","debouce","startPageInfoMonitor","setListener","sendPageInfo","stop","forEach","start","stopPageInfo","stopPageInfoMonitor","checkIFrameExists","retBool","getElementPosition","target","getPagePosition","floor","pagePosition","y","scrollRequestFromChild","addOffset","reposition","newPosition","scrollTo","calcOffset","scrollParent","unsetPagePosition","findTarget","location","jumpToTarget","jumpPosition","hash","jumpToParent","moveToAnchor","hashData","decodeURIComponent","getElementById","getElementsByName","funcName","val","chkCallback","actionMsg","firstRun","closeIFrame","resetIFrame","hasSettings","iFrameReadyMsgReceived","createOutgoingMsg","logId","retVal","TypeError","parentNode","removeChild","reset","setDimension","style","chkZero","hiddenCheckEnabled","fixHiddenIFrames","processDimension","sizeHeight","sizeWidth","doNotSync","calleeMsg","postMessageToIFrame","targetOrigin","contentWindow","postMessage","iFrameNotFound","chkAndSend","bodyMarginV1","interval","enablePublicMethods","autoResize","bodyMargin","heightCalculationMethod","bodyBackground","bodyPadding","tolerance","inPageLinks","resizeFrom","widthCalculationMethod","setupIFrame","options","setLimits","addStyle","Infinity","chkMinMax","newId","defaults","count","ensureHasId","src","setScrolling","scrolling","overflow","setupBodyMarginValues","checkReset","resetRequertMethod","resetRequiredMethods","setupIFrameObject","Function","prototype","bind","iFrameResizer","close","anchor","sendMessage","init","iFrameLoaded","checkOptions","copyOptions","option","hasOwnProperty","getTargetOrigin","processOptions","slice","join","beenHere","fn","time","timer","setTimeout","checkIFrames","checkIFrame","settingId","chkDimension","isVisible","offsetParent","mutationObserved","mutations","createMutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","observer","MutationObserver","observe","WebKitMutationObserver","resizeIFrames","sendTriggerMsg","tabVisible","visibilityState","eventName","isIFrameResizeEnabled","setupEventListeners","factory","element","chkType","tagName","toUpperCase","iFrames","push","call","querySelectorAll","createJQueryPublicMethod","$","iFrameResize","this","filter","each","index","end","msgHeader","scroll","bodyScroll","documentElementScroll","maxHeight","maxWidth","minHeight","minWidth","closedCallback","initCallback","messageCallback","resizedCallback","scrollCallback","jQuery","define","amd","module","exports"],"mappings":";;;;;;;CAWC,SAAUA,GACV,YA+CA,SAASC,GAAiBC,EAAIC,EAAIC,GAE7B,oBAAsBJ,GACzBE,EAAID,iBAAiBE,EAAIC,GAAM,GACrB,eAAiBJ,IAC3BE,EAAIG,YAAY,KAAKF,EAAIC,GAI3B,QAASE,GAAoBC,EAAGJ,EAAIC,GAE/B,uBAAyBJ,GAC5BO,EAAGD,oBAAoBH,EAAIC,GAAM,GACvB,eAAiBJ,IAC3BO,EAAGC,YAAY,KAAKL,EAAIC,GAI1B,QAASK,KACR,GAECC,GADAC,GAAW,MAAO,SAAU,IAAK,KAIlC,KAAKD,EAAI,EAAGA,EAAIC,EAAQC,SAAWC,EAAuBH,GAAK,EAC9DG,EAAwBb,EAAOW,EAAQD,GAAK,wBAGxC,IACJI,EAAI,QAAQ,uCAId,QAASC,GAAQC,GAChB,GAAIC,GAAS,cAAcD,CAU3B,OARIhB,GAAOkB,MAAMlB,EAAOmB,OAEtBF,EADGjB,EAAOoB,cAAgBpB,EAAOoB,aAAaC,MACrCrB,EAAOoB,aAAaC,QAAQ,KAAKL,EAEjC,qBAAqBA,GAIzBC,EAGR,QAASK,GAAgBN,GACxB,MAAOO,GAAQ,IAAMR,EAAQC,GAAY,IAG1C,QAASQ,GAAaR,GACrB,MAAOS,GAAST,GAAYS,EAAST,GAAUF,IAAMY,EAGtD,QAASZ,GAAIE,EAASW,GACrBC,EAAO,MAAMZ,EAASW,EAAIH,EAAaR,IAGxC,QAASa,GAAKb,EAASW,GACtBC,EAAO,OAAOZ,EAASW,EAAIH,EAAaR,IAGzC,QAASc,GAAKd,EAASW,GACtBC,EAAO,OAAOZ,EAASW,GAAI,GAG5B,QAASC,GAAOG,EAAKf,EAASW,EAAIK,IAC7B,IAASA,GAAW,gBAAoBhC,GAAOiC,SAClDA,QAAQF,GAAMT,EAAgBN,GAAUW,GAI1C,QAASO,GAAeC,GACvB,QAASC,KACR,QAASC,KACRC,EAAQC,GACRC,EAAgBxB,GAGjByB,EAAc,UACdA,EAAc,SAEdC,EAAWL,EAAOE,EAAY,QAG/B,QAASI,KACR,GAAIC,GAAOjB,EAAIkB,OAAOC,GAAUC,MAAM,IAEtC,QACCC,OAAQvB,EAASmB,EAAK,IAAII,OAC1BC,GAAQL,EAAK,GACbM,OAAQN,EAAK,GACbO,MAAQP,EAAK,GACbb,KAAQa,EAAK,IAIf,QAASH,GAAcW,GACtB,GACCC,GAAOC,OAAO7B,EAAST,GAAU,MAAQoC,IACzCG,EAAOD,OAAO7B,EAAST,GAAU,MAAQoC,IACzCI,EAAYJ,EAAUK,cACtBC,EAAOJ,OAAOf,EAAYiB,GAE3B1C,GAAIE,EAAS,YAAcwC,EAAY,gBAAkBD,EAAM,IAAMF,GAE5DE,EAALG,IACHA,EAAKH,EACLzC,EAAIE,EAAS,OAASwC,EAAY,kBAG/BE,EAAKL,IACRK,EAAKL,EACLvC,EAAIE,EAAS,OAASwC,EAAY,kBAGnCjB,EAAYiB,GAAa,GAAKE,EAI/B,QAASC,KACR,QAASC,KACR,QAASC,KACR,GACCC,GAAI,EACJC,GAAU,CAIX,KAFAjD,EAAIE,EAAS,wDAA0DgD,GAEhEF,EAAIE,EAAYpD,OAAQkD,IAC9B,GAAIE,EAAYF,KAAOG,EAAQ,CAC9BF,GAAU,CACV,OAGF,MAAOA,GAGR,QAASG,KACR,GAAIC,GAAc1C,EAAST,GAAUmD,UAErC,OADArD,GAAIE,EAAS,gCAAgCmD,GACtCF,IAAWE,EAGnB,MAAOH,GAAYI,cAAgBC,MAAQR,IAAcK,IAG1D,GACCD,GAAc9B,EAAM8B,OACpBD,EAAcvC,EAAST,GAAUgD,WAElC,IAAIA,GAAgB,GAAGC,GAAW,SAAYL,IAC7C,KAAM,IAAIU,OACT,qCAAuCL,EACvC,QAAU1B,EAAYS,OAAOC,GAC7B,kBAAoBd,EAAMS,KAC1B,qHAIF,QAAO,EAGR,QAAS2B,KACR,MAAOhD,MAAY,GAAKI,GAAKkB,OAAO,EAAEC,IAAenB,EAAIkB,OAAOC,GAAUC,MAAM,KAAK,IAAMtB,GAG5F,QAAS+C,KAGR,GAAIT,GAAUxB,EAAYR,QAAS0C,OAAO,EAAEC,QAAQ,EAAEC,UAAY,EAMlE,OAJIZ,IACHjD,EAAIE,EAAS,+CAGP+C,EAGR,QAASa,GAAWC,GACnB,MAAOlD,GAAIkB,OAAOlB,EAAImD,QAAQ,KAAKC,EAAaF,GAGjD,QAASG,GAAqBC,GAC7BnE,EAAIE,EAAS,oCAAqCuB,EAAYS,OAAOC,GAAK,cAAgBgC,EAAU,KACpGC,EAAS,mBACRlC,OAAQT,EAAYS,OACpBmC,QAASC,KAAKC,MAAMJ,KAErBnE,EAAIE,EAAS,MAGd,QAASsE,KACR,GACCC,GAAiBC,SAASC,KAAKC,wBAC/BC,EAAiBpD,EAAYS,OAAO0C,uBAErC,OAAON,MAAKQ,WACXC,aAAcC,KAAKzC,IAAImC,SAASO,gBAAgBF,aAAc7F,EAAOgG,aAAe,GACpFC,YAAcH,KAAKzC,IAAImC,SAASO,gBAAgBE,YAAcjG,EAAOkG,YAAe,GACpFC,UAAcC,SAAST,EAAezE,IAAOqE,EAAarE,IAAM,IAChEmF,WAAcD,SAAST,EAAeW,KAAOf,EAAae,KAAM,IAChEC,UAAcvG,EAAOwG,YACrBC,WAAczG,EAAO0G,cAIvB,QAASC,GAAqB3D,EAAOhC,GACpC,QAAS4F,KACRC,EACC,iBACA,YAAcvB,IACdtC,EACAhC,GAIF8F,EAAQF,EAAiB,IAI1B,QAASG,KACR,QAASC,GAAYjF,EAAK3B,GACzB,QAAS6G,KACJxF,EAASwB,GACZ0D,EAAqBlF,EAASwB,GAAID,OAAOC,GAEzCiE,KAID,SAAS,UAAUC,QAAQ,SAAShH,GACpCW,EAAImC,EAAIlB,EAAQ5B,EAAM,8BACtBC,EAAKJ,EAAOG,EAAI8G,KAIlB,QAASC,KACRF,EAAY,UAAW1G,GAGxB,QAAS8G,KACRJ,EAAY,OAAQ/G,GAGrB,GAAIgD,GAAKjC,CAEToG,KAEA3F,EAASwB,GAAIoE,aAAeH,EAG7B,QAASI,KACJ7F,EAAST,IAAaS,EAAST,GAAUqG,eAC5C5F,EAAST,GAAUqG,qBACZ5F,GAAST,GAAUqG,cAI5B,QAASE,KACR,GAAIC,IAAU,CAMd,OAJI,QAASjF,EAAYS,SACxBlB,EAAKd,EAAS,WAAWuB,EAAYU,GAAG,eACxCuE,GAAU,GAEJA,EAGR,QAASC,GAAmBC,GAC3B,GAAI/B,GAAiB+B,EAAOhC,uBAI5B,OAFAiC,GAAgB3G,IAGfN,EAAGoF,KAAK8B,MAAOtE,OAAOqC,EAAeW,MAAQhD,OAAOuE,EAAanH,IACjEoH,EAAGhC,KAAK8B,MAAOtE,OAAOqC,EAAezE,KAAQoC,OAAOuE,EAAaC,KAInE,QAASC,GAAuBC,GAE/B,QAASC,KACRJ,EAAeK,EACfC,IACArH,EAAIE,EAAS,MAGd,QAASoH,KACR,OACC1H,EAAG4C,OAAOf,EAAYY,OAAS0B,EAAOnE,EACtCoH,EAAGxE,OAAOf,EAAYW,QAAU2B,EAAOiD,GAIzC,QAASO,KACJrI,EAAOoB,aACVpB,EAAOoB,aAAa,YAAY4G,EAAU,SAAS,KAAKE,EAAYxH,EAAEwH,EAAYJ,GAElFhG,EAAKd,EAAS,yEAIhB,GACC6D,GAASmD,EAAYP,EAAmBlF,EAAYS,SAAWtC,EAAE,EAAEoH,EAAE,GACrEI,EAAcE,GAEftH,GAAIE,EAAS,8CAA8C6D,EAAOnE,EAAE,MAAMmE,EAAOiD,EAAE,KAEhF9H,EAAOkB,MAAMlB,EAAOmB,KACtBkH,IAEAJ,IAIF,QAASE,MACJ,IAAUjD,EAAS,iBAAiB2C,GACvCrF,EAAgBxB,GAEhBsH,IAIF,QAASC,GAAWC,GACnB,QAASC,KACR,GAAIC,GAAejB,EAAmBC,EAEtC5G,GAAIE,EAAS,4BAA4B2H,EAAK,WAAWD,EAAahI,EAAE,OAAOgI,EAAaZ,GAC5FD,GACCnH,EAAGgI,EAAahI,EAChBoH,EAAGY,EAAaZ,GAGjBK,IACArH,EAAIE,EAAS,MAGd,QAAS4H,KACJ5I,EAAOoB,aACVpB,EAAOoB,aAAayH,aAAaF,GAEjC7H,EAAIE,EAAS,iBAAiB2H,EAAK,gDAIrC,GACCA,GAAWH,EAASzF,MAAM,KAAK,IAAM,GACrC+F,EAAWC,mBAAmBJ,GAC9BjB,EAAWlC,SAASwD,eAAeF,IAAatD,SAASyD,kBAAkBH,GAAU,EAElFpB,GACHe,IACSzI,EAAOkB,MAAMlB,EAAOmB,KAC7ByH,IAEA9H,EAAIE,EAAS,iBAAiB2H,EAAK,cAIrC,QAASzD,GAASgE,EAASC,GAC1B,MAAOC,GAAYpI,EAASkI,EAASC,GAGtC,QAASE,KAIR,OAFG5H,EAAST,GAAUsI,UAAUA,IAEzB/G,EAAYR,MACnB,IAAK,QACJwH,EAAYhH,EAAYS,OACxB,MACD,KAAK,UACJgC,EAAqBJ,EAAW,GAChC,MACD,KAAK,WACJmD,GAAuB,EACvB,MACD,KAAK,iBACJA,GAAuB,EACvB,MACD,KAAK,WACJpB,EAAqBlF,EAAST,GAAUgC,OAAOhC,GAC/C+F,GACA,MACD,KAAK,eACJO,GACA,MACD,KAAK,aACJiB,EAAW3D,EAAW,GACtB,MACD,KAAK,QACJ4E,EAAYjH,EACZ,MACD,KAAK,OACJH,IACA8C,EAAS,eAAe3C,EAAYS,QACpCkC,EAAS,kBAAkB3C,EAC3B,MACD,SACCH,IACA8C,EAAS,kBAAkB3C,IAI7B,QAASkH,GAAYzI,GACpB,GAAIwG,IAAU,CAOd,OALK/F,GAAST,KACbwG,GAAU,EACV1F,EAAKS,EAAYR,KAAO,oBAAsBf,EAAW,kBAAoBW,IAGvE6F,EAGR,QAASkC,KACR,IAAK,GAAI1I,KAAYS,GACpBoF,EAAQ,wBAAwB8C,EAAkB3I,GAAUwE,SAASwD,eAAehI,GAAUA,GAIhG,QAASsI,KACR7H,EAAST,GAAUsI,UAAW,EAG/B,GACC3H,GAAMQ,EAAMS,KACZL,KACAvB,EAAW,IAET,+BAAgCW,EAClC+H,IACUnF,KACVhC,EAAcI,IACd3B,EAAc4I,EAAQrH,EAAYU,IAE7BuB,KAA6BiF,EAAYzI,KAC7CF,EAAIE,EAAS,aAAaW,GAErB4F,KAAuB5D,KAC3B0F,MAIFxH,EAAKb,EAAS,YAAYW,GAM5B,QAASyH,GAAYpI,EAASkI,EAASC,GACtC,GACC/I,GAAO,KACPyJ,EAAS,IAEV,IAAGpI,EAAST,GAAU,CAGrB,GAFAZ,EAAOqB,EAAST,GAAUkI,GAEtB,kBAAsB9I,GAGzB,KAAM,IAAI0J,WAAUZ,EAAS,cAAclI,EAAS,sBAFpD6I,GAASzJ,EAAK+I,GAMhB,MAAOU,GAGR,QAASN,GAAYvG,GACpB,GAAIhC,GAAWgC,EAAOC,EAEtBnC,GAAIE,EAAS,oBAAoBA,GACjCgC,EAAO+G,WAAWC,YAAYhH,GAC9BoG,EAAYpI,EAAS,iBAAiBA,GACtCF,EAAIE,EAAS,YACNS,GAAST,GAGjB,QAAS2G,GAAgB3G,GACrB,OAAS6G,IACXA,GACCnH,EAA2BiE,SAAvB3E,EAAO0G,YAA6B1G,EAAO0G,YAAclB,SAASO,gBAAgBU,WACtFqB,EAA2BnD,SAAvB3E,EAAOwG,YAA6BxG,EAAOwG,YAAchB,SAASO,gBAAgBQ,WAEvFzF,EAAIE,EAAS,sBAAsB6G,EAAanH,EAAE,IAAImH,EAAaC,IAIrE,QAAStF,GAAgBxB,GACrB,OAAS6G,IACX7H,EAAOmI,SAASN,EAAanH,EAAEmH,EAAaC,GAC5ChH,EAAIE,EAAS,sBAAsB6G,EAAanH,EAAE,IAAImH,EAAaC,GACnEQ,KAIF,QAASA,KACRT,EAAe,KAGhB,QAAS2B,GAAYjH,GACpB,QAAS0H,KACR3H,EAAQC,GACRsE,EAAQ,QAAQ,QAAQtE,EAAYS,OAAOT,EAAYU,IAGxDnC,EAAIyB,EAAYU,GAAG,4BAA4B,SAASV,EAAYR,KAAK,YAAY,WACrF4F,EAAgBpF,EAAYU,IAC5BP,EAAWuH,EAAM1H,EAAY,SAG9B,QAASD,GAAQC,GAChB,QAAS2H,GAAa1G,GACrBjB,EAAYS,OAAOmH,MAAM3G,GAAajB,EAAYiB,GAAa,KAC/D1C,EACCyB,EAAYU,GACZ,WAAajC,EACb,KAAOwC,EACP,WAAajB,EAAYiB,GAAa,MAIxC,QAAS4G,GAAQ5G,GAMX6G,GAAsB,MAAQ9H,EAAYiB,KAC9C6G,GAAqB,EACrBvJ,EAAIE,EAAS,wDACbsJ,KAIF,QAASC,GAAiB/G,GACzB0G,EAAa1G,GACb4G,EAAQ5G,GAGT,GAAIxC,GAAWuB,EAAYS,OAAOC,EAE/BxB,GAAST,KACPS,EAAST,GAAUwJ,YAAcD,EAAiB,UAClD9I,EAAST,GAAUyJ,WAAcF,EAAiB,UAIxD,QAAS7H,GAAWtC,EAAKmC,EAAYmI,GAEjCA,IAAYnI,EAAYR,MAAQlB,GAClCC,EAAIyB,EAAYU,GAAG,8BACnBpC,EAAsBT,IAEtBA,IAIF,QAASyG,GAAQ8D,EAAUhJ,EAAIqB,EAAOC,GACrC,QAAS2H,KACR,GAAIlD,GAASjG,EAASwB,GAAI4H,YAC1B/J,GAAImC,EAAG,IAAM0H,EAAY,2BAA2B1H,EAAG,MAAMtB,EAAI,mBAAmB+F,GACpF1E,EAAO8H,cAAcC,YAAaxJ,EAAQI,EAAK+F,GAGhD,QAASsD,KACRnJ,EAAKoB,EAAG,IAAM0H,EAAY,YAAY1H,EAAG,eACtCxB,EAASwB,UACJxB,GAASwB,GAIlB,QAASgI,KACLjI,GAAU,iBAAmBA,IAAW,OAASA,EAAO8H,cAC1DF,IAEAI,IAIF/H,EAAKA,GAAMD,EAAOC,GAEfxB,EAASwB,IACXgI,IAKF,QAAStB,GAAkB3I,GAC1B,MAAOA,GACN,IAAMS,EAAST,GAAUkK,aACzB,IAAMzJ,EAAST,GAAUyJ,UACzB,IAAMhJ,EAAST,GAAUF,IACzB,IAAMW,EAAST,GAAUmK,SACzB,IAAM1J,EAAST,GAAUoK,oBACzB,IAAM3J,EAAST,GAAUqK,WACzB,IAAM5J,EAAST,GAAUsK,WACzB,IAAM7J,EAAST,GAAUuK,wBACzB,IAAM9J,EAAST,GAAUwK,eACzB,IAAM/J,EAAST,GAAUyK,YACzB,IAAMhK,EAAST,GAAU0K,UACzB,IAAMjK,EAAST,GAAU2K,YACzB,IAAMlK,EAAST,GAAU4K,WACzB,IAAMnK,EAAST,GAAU6K,uBAG3B,QAASC,GAAY9I,EAAO+I,GAC3B,QAASC,KACR,QAASC,GAAS9B,GACZ+B,EAAAA,IAAazK,EAAST,GAAUmJ,IAAY,IAAM1I,EAAST,GAAUmJ,KACzEnH,EAAOmH,MAAMA,GAAS1I,EAAST,GAAUmJ,GAAS,KAClDrJ,EAAIE,EAAS,OAAOmJ,EAAM,MAAM1I,EAAST,GAAUmJ,GAAO,OAI5D,QAASgC,GAAU3I,GAClB,GAAI/B,EAAST,GAAU,MAAMwC,GAAW/B,EAAST,GAAU,MAAMwC,GAChE,KAAM,IAAIc,OAAM,gBAAgBd,EAAU,+BAA+BA,GAI3E2I,EAAU,UACVA,EAAU,SAEVF,EAAS,aACTA,EAAS,aACTA,EAAS,YACTA,EAAS,YAGV,QAASG,KACR,GAAInJ,GAAO8I,GAAWA,EAAQ9I,IAAOoJ,EAASpJ,GAAKqJ,GAInD,OAHK,QAAO9G,SAASwD,eAAe/F,KACnCA,GAAUqJ,KAEJrJ,EAGR,QAASsJ,GAAYvL,GAUpB,MATA4I,GAAM5I,EACF,KAAKA,IACRgC,EAAOC,GAAKjC,EAAYoL,IACxB1K,GAAcqK,OAAejL,IAC7B8I,EAAM5I,EACNF,EAAIE,EAAS,4BAA6BA,EAAU,KAAOgC,EAAOwJ,IAAM,MAIlExL,EAGR,QAASyL,KACR3L,EAAIE,EAAS,qBAAuBS,EAAST,GAAU0L,UAAY,UAAY,YAAc,QAAU1L,GACvGgC,EAAOmH,MAAMwC,UAAW,IAAUlL,EAAST,GAAU0L,UAAY,SAAW,OAC5E1J,EAAO0J,WAAiB,IAAUjL,EAAST,GAAU0L,UAAY,KAAO,MAMzE,QAASE,MACH,gBAAkBnL,GAAST,GAAoB,YAAO,MAAMS,EAAST,GAAUsK,cACnF7J,EAAST,GAAUkK,aAAezJ,EAAST,GAAUsK,WACrD7J,EAAST,GAAUsK,WAAe,GAAK7J,EAAST,GAAUsK,WAAa,MAIzE,QAASuB,KAIR,GACCvD,GAAqB7H,EAAST,GAAUsI,SACxCwD,EAAqBrL,EAAST,GAAUuK,0BAA2BwB,IAE/DzD,GAAYwD,GAChBtD,GAAaxG,OAAOA,EAAQE,OAAO,EAAGC,MAAM,EAAGpB,KAAK,SAItD,QAASiL,KACLC,SAASC,UAAUC,OACrB1L,EAAST,GAAUgC,OAAOoK,eAEzBC,MAAe9D,EAAY4D,KAAK,KAAK1L,EAAST,GAAUgC,QAExDX,OAAewE,EAAQsG,KAAK,KAAK,gBAAiB,SAAU1L,EAAST,GAAUgC,QAE/E6F,aAAe,SAASyE,GACvBzG,EAAQ,iBAAiB,cAAcyG,EAAQ7L,EAAST,GAAUgC,OAAOhC,IAG1EuM,YAAe,SAASpI,GACvBA,EAAUC,KAAKQ,UAAUT,GACzB0B,EAAQ,eAAe,WAAW1B,EAAS1D,EAAST,GAAUgC,OAAOhC,MASzE,QAASwM,GAAK7L,GACb,QAAS8L,KACR5G,EAAQ,gBAAgBlF,EAAIqB,GAC5B6J,IAGD5M,EAAiB+C,EAAO,OAAOyK,GAC/B5G,EAAQ,OAAOlF,EAAIqB,GAGpB,QAAS0K,GAAa3B,GACrB,GAAI,gBAAoBA,GACvB,KAAM,IAAIjC,WAAU,4BAItB,QAAS6D,GAAY5B,GACpB,IAAK,GAAI6B,KAAUvB,GACdA,EAASwB,eAAeD,KAC3BnM,EAAST,GAAU4M,GAAU7B,EAAQ8B,eAAeD,GAAU7B,EAAQ6B,GAAUvB,EAASuB,IAK5F,QAASE,GAAiB3J,GACzB,MAAQ,KAAOA,GAAc,YAAcA,EAAc,IAAMA,EAGhE,QAAS4J,GAAehC,GACvBA,EAAUA,MACVtK,EAAST,IACRsI,UAAW,EACXtG,OAAUA,EACVmB,WAAanB,EAAOwJ,IAAIzJ,MAAM,KAAKiL,MAAM,EAAE,GAAGC,KAAK,MAGpDP,EAAa3B,GACb4B,EAAY5B,GAEZtK,EAAST,GAAU6J,cAAe,IAASpJ,EAAST,GAAUgD,YAAc8J,EAAgBrM,EAAST,GAAUmD,YAAc,IAG9H,QAAS+J,KACR,MAAQlN,KAAYS,IAAY,iBAAmBuB,GAGpD,GAAIhC,GAAWuL,EAAYvJ,EAAOC,GAE7BiL,KAQJpM,EAAKd,EAAS,mCAPd+M,EAAehC,GACfU,IACAT,IACAY,IACAY,EAAK7D,EAAkB3I,IACvBgM,KAMF,QAASlG,GAAQqH,EAAGC,GACf,OAASC,IACZA,EAAQC,WAAW,WAClBD,EAAQ,KACRF,KACEC,IAKL,QAAS9D,KACR,QAASiE,KACR,QAASC,GAAYC,GACpB,QAASC,GAAalL,GACrB,MAAO,QAAU/B,EAASgN,GAAWzL,OAAOmH,MAAM3G,GAGnD,QAASmL,GAAUpO,GAClB,MAAQ,QAASA,EAAGqO,aAGjBD,EAAUlN,EAASgN,GAAWzL,UAAY0L,EAAa,WAAaA,EAAa,WACpF7H,EAAQ,oBAAqB,SAAUpF,EAASgN,GAAWzL,OAAOyL,GAIpE,IAAK,GAAIA,KAAahN,GACrB+M,EAAYC,GAId,QAASI,GAAiBC,GACzBhO,EAAI,SAAS,sBAAwBgO,EAAU,GAAGpH,OAAS,IAAMoH,EAAU,GAAG/M,MAC9E+E,EAAQyH,EAAa,IAGtB,QAASQ,KACR,GACCrH,GAASlC,SAASwJ,cAAc,QAEhCC,GACCC,YAAwB,EACxBC,mBAAwB,EACxBC,eAAwB,EACxBC,uBAAwB,EACxBC,WAAwB,EACxBC,SAAwB,GAGzBC,EAAW,GAAIC,GAAiBZ,EAEjCW,GAASE,QAAQhI,EAAQuH,GAG1B,GAAIQ,GAAmBzP,EAAOyP,kBAAoBzP,EAAO2P,sBAErDF,IAAkBV,IAIvB,QAASa,GAAczN,GACtB,QAASE,KACRwN,EAAe,UAAU1N,EAAM,UAGhCrB,EAAI,SAAS,kBAAkBqB,GAC/B2E,EAAQzE,EAAO,IAIhB,QAASyN,KACR,QAASzN,KACRwN,EAAe,cAAc,UAG3B,WAAarK,SAASuK,kBACxBjP,EAAI,WAAW,mCACfgG,EAAQzE,EAAO,KAIjB,QAASwN,GAAeG,EAAU7N,GACjC,QAAS8N,GAAsBjP,GAC9B,MAAO,WAAaS,EAAST,GAAU4K,YACrCnK,EAAST,GAAUqK,aAClB5J,EAAST,GAAUsI,SAGvB,IAAK,GAAItI,KAAYS,GACjBwO,EAAsBjP,IACxB6F,EAAQmJ,EAAU7N,EAAMqD,SAASwD,eAAehI,GAAUA,GAK7D,QAASkP,KACRjQ,EAAiBD,EAAO,UAAUkC,GAElCjC,EAAiBD,EAAO,SAAU,WAAW4P,EAAc,YAE3D3P,EAAiBuF,SAAS,mBAAmBsK,GAC7C7P,EAAiBuF,SAAS,2BAA2BsK,GACrD7P,EAAiBD,EAAO,UAAU,WAAW4P,EAAc,WAC3D3P,EAAiBD,EAAO,QAAQ,WAAW4P,EAAc,WAI1D,QAASO,KACR,QAAS3C,GAAKzB,EAAQqE,GACrB,QAASC,KACR,IAAID,EAAQE,QACX,KAAM,IAAIxG,WAAU,oCACd,IAAI,WAAasG,EAAQE,QAAQC,cACvC,KAAM,IAAIzG,WAAU,iCAAiCsG,EAAQE,QAAQ,KAIpEF,IACFC,IACAvE,EAAYsE,EAASrE,GACrByE,EAAQC,KAAKL,IAIf,GAAII,EAKJ,OAHA/P,KACAyP,IAEO,SAAuBnE,EAAQrE,GAGrC,OAFA8I,WAEc,IACd,IAAK,YACL,IAAK,SACJnM,MAAM6I,UAAU/F,QAAQuJ,KACvBlL,SAASmL,iBAAkBjJ,GAAU,UACrC8F,EAAKL,KAAKxI,OAAWoH,GAEtB,MACD,KAAK,SACJyB,EAAKzB,EAAQrE,EACb,MACD,SACC,KAAM,IAAIoC,WAAU,+BAA+B,GAAS,KAG7D,MAAO0G,IAIT,QAASI,GAAyBC,GACjCA,EAAE1C,GAAG2C,aAAe,SAAwB/E,GAC3C,MAAOgF,MAAKC,OAAO,UAAUC,KAAK,SAAUC,EAAOd,GAClDtE,EAAYsE,EAASrE,KACnBoF,OAr8BL,GACC7E,GAAwB,EACxB5K,GAAwB,EACxB2I,GAAwB,EACxB+G,EAAwB,UACxBrM,EAAwBqM,EAAUxQ,OAClCW,EAAwB,gBACxBuB,EAAwBvB,EAAMX,OAC9BiH,EAAwB,KACxBhH,EAAwBb,EAAOa,sBAC/BkM,GAAyB1J,IAAI,EAAEgO,OAAO,EAAEC,WAAW,EAAEC,sBAAsB,GAC3E9P,KACA4M,EAAwB,KACxBzE,EAAwB,YAExByC,GACChB,YAA4B,EAC5BG,eAA4B,KAC5BF,WAA4B,KAC5BJ,aAA4B,EAC5BO,YAA4B,KAC5BzH,aAA4B,EAC5B2H,aAA4B,EAC5BP,qBAA4B,EAC5BG,wBAA4B,aAC5BtI,GAA4B,gBAC5BkI,SAA4B,GAC5BrK,KAA4B,EAC5B0Q,UAA4BtF,EAAAA,EAC5BuF,SAA4BvF,EAAAA,EAC5BwF,UAA4B,EAC5BC,SAA4B,EAC5B/F,WAA4B,SAC5Bc,WAA4B,EAC5BlC,YAA4B,EAC5BC,WAA4B,EAC5BiB,UAA4B,EAC5BG,uBAA4B,SAC5B+F,eAA4B,aAC5BC,aAA4B,aAC5BC,gBAA4B,WAAWhQ,EAAK,yCAC5CiQ,gBAA4B,aAC5BC,eAA4B,WAAW,OAAO,GA+5B5ChS,GAAOiS,QAAUrB,EAAyBqB,QAExB,kBAAXC,SAAyBA,OAAOC,IAC1CD,UAAU/B,GACkB,gBAAXiC,SAAiD,gBAAnBA,QAAOC,QACtDD,OAAOC,QAAUlC,IAEjBnQ,EAAO8Q,aAAe9Q,EAAO8Q,cAAgBX,KAG5CnQ","file":"iframeResizer.min.js","sourcesContent":["/*\n * File: iframeResizer.js\n * Desc: Force iframes to size to content.\n * Requires: iframeResizer.contentWindow.js to be loaded into the target frame.\n * Doc: https://github.com/davidjbradshaw/iframe-resizer\n * Author: David J. Bradshaw - dave@bradshaw.net\n * Contributor: Jure Mav - jure.mav@gmail.com\n * Contributor: Reed Dadoune - reed@dadoune.com\n */\n\n\n;(function(window) {\n\t'use strict';\n\n\tvar\n\t\tcount = 0,\n\t\tlogEnabled = false,\n\t\thiddenCheckEnabled = false,\n\t\tmsgHeader = 'message',\n\t\tmsgHeaderLen = msgHeader.length,\n\t\tmsgId = '[iFrameSizer]', //Must match iframe msg ID\n\t\tmsgIdLen = msgId.length,\n\t\tpagePosition = null,\n\t\trequestAnimationFrame = window.requestAnimationFrame,\n\t\tresetRequiredMethods = {max:1,scroll:1,bodyScroll:1,documentElementScroll:1},\n\t\tsettings = {},\n\t\ttimer = null,\n\t\tlogId = 'Host Page',\n\n\t\tdefaults = {\n\t\t\tautoResize : true,\n\t\t\tbodyBackground : null,\n\t\t\tbodyMargin : null,\n\t\t\tbodyMarginV1 : 8,\n\t\t\tbodyPadding : null,\n\t\t\tcheckOrigin : true,\n\t\t\tinPageLinks : false,\n\t\t\tenablePublicMethods : true,\n\t\t\theightCalculationMethod : 'bodyOffset',\n\t\t\tid : 'iFrameResizer',\n\t\t\tinterval : 32,\n\t\t\tlog : false,\n\t\t\tmaxHeight : Infinity,\n\t\t\tmaxWidth : Infinity,\n\t\t\tminHeight : 0,\n\t\t\tminWidth : 0,\n\t\t\tresizeFrom : 'parent',\n\t\t\tscrolling : false,\n\t\t\tsizeHeight : true,\n\t\t\tsizeWidth : false,\n\t\t\ttolerance : 0,\n\t\t\twidthCalculationMethod : 'scroll',\n\t\t\tclosedCallback : function(){},\n\t\t\tinitCallback : function(){},\n\t\t\tmessageCallback : function(){warn('MessageCallback function not defined');},\n\t\t\tresizedCallback : function(){},\n\t\t\tscrollCallback : function(){return true;}\n\t\t};\n\n\tfunction addEventListener(obj,evt,func){\n\t\t/* istanbul ignore else */ // Not testable in PhantonJS\n\t\tif ('addEventListener' in window){\n\t\t\tobj.addEventListener(evt,func, false);\n\t\t} else if ('attachEvent' in window){//IE\n\t\t\tobj.attachEvent('on'+evt,func);\n\t\t}\n\t}\n\n\tfunction removeEventListener(el,evt,func){\n\t\t/* istanbul ignore else */ // Not testable in phantonJS\n\t\tif ('removeEventListener' in window){\n\t\t\tel.removeEventListener(evt,func, false);\n\t\t} else if ('detachEvent' in window){ //IE\n\t\t\tel.detachEvent('on'+evt,func);\n\t\t}\n\t}\n\n\tfunction setupRequestAnimationFrame(){\n\t\tvar\n\t\t\tvendors = ['moz', 'webkit', 'o', 'ms'],\n\t\t\tx;\n\n\t\t// Remove vendor prefixing if prefixed and break early if not\n\t\tfor (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {\n\t\t\trequestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];\n\t\t}\n\n\t\tif (!(requestAnimationFrame)){\n\t\t\tlog('setup','RequestAnimationFrame not supported');\n\t\t}\n\t}\n\n\tfunction getMyID(iframeId){\n\t\tvar retStr = 'Host page: '+iframeId;\n\n\t\tif (window.top!==window.self){\n\t\t\tif (window.parentIFrame && window.parentIFrame.getId){\n\t\t\t\tretStr = window.parentIFrame.getId()+': '+iframeId;\n\t\t\t} else {\n\t\t\t\tretStr = 'Nested host page: '+iframeId;\n\t\t\t}\n\t\t}\n\n\t\treturn retStr;\n\t}\n\n\tfunction formatLogHeader(iframeId){\n\t\treturn msgId + '[' + getMyID(iframeId) + ']';\n\t}\n\n\tfunction isLogEnabled(iframeId){\n\t\treturn settings[iframeId] ? settings[iframeId].log : logEnabled;\n\t}\n\n\tfunction log(iframeId,msg){\n\t\toutput('log',iframeId,msg,isLogEnabled(iframeId));\n\t}\n\n\tfunction info(iframeId,msg){\n\t\toutput('info',iframeId,msg,isLogEnabled(iframeId));\n\t}\n\n\tfunction warn(iframeId,msg){\n\t\toutput('warn',iframeId,msg,true);\n\t}\n\n\tfunction output(type,iframeId,msg,enabled){\n\t\tif (true === enabled && 'object' === typeof window.console){\n\t\t\tconsole[type](formatLogHeader(iframeId),msg);\n\t\t}\n\t}\n\n\tfunction iFrameListener(event){\n\t\tfunction resizeIFrame(){\n\t\t\tfunction resize(){\n\t\t\t\tsetSize(messageData);\n\t\t\t\tsetPagePosition(iframeId);\n\t\t\t}\n\n\t\t\tensureInRange('Height');\n\t\t\tensureInRange('Width');\n\n\t\t\tsyncResize(resize,messageData,'init');\n\t\t}\n\n\t\tfunction processMsg(){\n\t\t\tvar data = msg.substr(msgIdLen).split(':');\n\n\t\t\treturn {\n\t\t\t\tiframe: settings[data[0]].iframe,\n\t\t\t\tid: data[0],\n\t\t\t\theight: data[1],\n\t\t\t\twidth: data[2],\n\t\t\t\ttype: data[3]\n\t\t\t};\n\t\t}\n\n\t\tfunction ensureInRange(Dimension){\n\t\t\tvar\n\t\t\t\tmax = Number(settings[iframeId]['max' + Dimension]),\n\t\t\t\tmin = Number(settings[iframeId]['min' + Dimension]),\n\t\t\t\tdimension = Dimension.toLowerCase(),\n\t\t\t\tsize = Number(messageData[dimension]);\n\n\t\t\tlog(iframeId,'Checking ' + dimension + ' is in range ' + min + '-' + max);\n\n\t\t\tif (size<min) {\n\t\t\t\tsize=min;\n\t\t\t\tlog(iframeId,'Set ' + dimension + ' to min value');\n\t\t\t}\n\n\t\t\tif (size>max) {\n\t\t\t\tsize=max;\n\t\t\t\tlog(iframeId,'Set ' + dimension + ' to max value');\n\t\t\t}\n\n\t\t\tmessageData[dimension] = '' + size;\n\t\t}\n\n\n\t\tfunction isMessageFromIFrame(){\n\t\t\tfunction checkAllowedOrigin(){\n\t\t\t\tfunction checkList(){\n\t\t\t\t\tvar\n\t\t\t\t\t\ti = 0,\n\t\t\t\t\t\tretCode = false;\n\n\t\t\t\t\tlog(iframeId,'Checking connection is from allowed list of origins: ' + checkOrigin);\n\n\t\t\t\t\tfor (; i < checkOrigin.length; i++) {\n\t\t\t\t\t\tif (checkOrigin[i] === origin) {\n\t\t\t\t\t\t\tretCode = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn retCode;\n\t\t\t\t}\n\n\t\t\t\tfunction checkSingle(){\n\t\t\t\t\tvar remoteHost = settings[iframeId].remoteHost;\n\t\t\t\t\tlog(iframeId,'Checking connection is from: '+remoteHost);\n\t\t\t\t\treturn origin === remoteHost;\n\t\t\t\t}\n\n\t\t\t\treturn checkOrigin.constructor === Array ? checkList() : checkSingle();\n\t\t\t}\n\n\t\t\tvar\n\t\t\t\torigin = event.origin,\n\t\t\t\tcheckOrigin = settings[iframeId].checkOrigin;\n\n\t\t\tif (checkOrigin && (''+origin !== 'null') && !checkAllowedOrigin()) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Unexpected message received from: ' + origin +\n\t\t\t\t\t' for ' + messageData.iframe.id +\n\t\t\t\t\t'. Message was: ' + event.data +\n\t\t\t\t\t'. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tfunction isMessageForUs(){\n\t\t\treturn msgId === (('' + msg).substr(0,msgIdLen)) && (msg.substr(msgIdLen).split(':')[0] in settings); //''+Protects against non-string msg\n\t\t}\n\n\t\tfunction isMessageFromMetaParent(){\n\t\t\t//Test if this message is from a parent above us. This is an ugly test, however, updating\n\t\t\t//the message format would break backwards compatibity.\n\t\t\tvar retCode = messageData.type in {'true':1,'false':1,'undefined':1};\n\n\t\t\tif (retCode){\n\t\t\t\tlog(iframeId,'Ignoring init message from meta parent page');\n\t\t\t}\n\n\t\t\treturn retCode;\n\t\t}\n\n\t\tfunction getMsgBody(offset){\n\t\t\treturn msg.substr(msg.indexOf(':')+msgHeaderLen+offset);\n\t\t}\n\n\t\tfunction forwardMsgFromIFrame(msgBody){\n\t\t\tlog(iframeId,'MessageCallback passed: {iframe: '+ messageData.iframe.id + ', message: ' + msgBody + '}');\n\t\t\tcallback('messageCallback',{\n\t\t\t\tiframe: messageData.iframe,\n\t\t\t\tmessage: JSON.parse(msgBody)\n\t\t\t});\n\t\t\tlog(iframeId,'--');\n\t\t}\n\n\t\tfunction getPageInfo(){\n\t\t\tvar\n\t\t\t\tbodyPosition = document.body.getBoundingClientRect(),\n\t\t\t\tiFramePosition = messageData.iframe.getBoundingClientRect();\n\n\t\t\treturn JSON.stringify({\n\t\t\t\tclientHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0),\n\t\t\t\tclientWidth: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),\n\t\t\t\toffsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),\n\t\t\t\toffsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),\n\t\t\t\tscrollTop: window.pageYOffset,\n\t\t\t\tscrollLeft: window.pageXOffset\n\t\t\t});\n\t\t}\n\n\t\tfunction sendPageInfoToIframe(iframe,iframeId){\n\t\t\tfunction debouncedTrigger(){\n\t\t\t\ttrigger(\n\t\t\t\t\t'Send Page Info',\n\t\t\t\t\t'pageInfo:' + getPageInfo(), \n\t\t\t\t\tiframe, \n\t\t\t\t\tiframeId\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tdebouce(debouncedTrigger,32);\n\t\t}\n\n\n\t\tfunction startPageInfoMonitor(){\n\t\t\tfunction setListener(type,func){\n\t\t\t\tfunction sendPageInfo(){\n\t\t\t\t\tif (settings[id]){\n\t\t\t\t\t\tsendPageInfoToIframe(settings[id].iframe,id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstop();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t['scroll','resize'].forEach(function(evt){\n\t\t\t\t\tlog(id, type + evt + ' listener for sendPageInfo');\n\t\t\t\t\tfunc(window,evt,sendPageInfo);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction stop(){\n\t\t\t\tsetListener('Remove ', removeEventListener);\n\t\t\t}\n\n\t\t\tfunction start(){\n\t\t\t\tsetListener('Add ', addEventListener);\n\t\t\t}\n\t\t\t\n\t\t\tvar id = iframeId; //Create locally scoped copy of iFrame ID\n\n\t\t\tstart();\n\n\t\t\tsettings[id].stopPageInfo = stop;\n\t\t}\n\n\t\tfunction stopPageInfoMonitor(){\n\t\t\tif (settings[iframeId] && settings[iframeId].stopPageInfo){\n\t\t\t\tsettings[iframeId].stopPageInfo();\n\t\t\t\tdelete settings[iframeId].stopPageInfo;\n\t\t\t}\n\t\t}\n\n\t\tfunction checkIFrameExists(){\n\t\t\tvar retBool = true;\n\n\t\t\tif (null === messageData.iframe) {\n\t\t\t\twarn(iframeId,'IFrame ('+messageData.id+') not found');\n\t\t\t\tretBool = false;\n\t\t\t}\n\t\t\treturn retBool;\n\t\t}\n\n\t\tfunction getElementPosition(target){\n\t\t\tvar iFramePosition = target.getBoundingClientRect();\n\n\t\t\tgetPagePosition(iframeId);\n\n\t\t\treturn {\n\t\t\t\tx: Math.floor( Number(iFramePosition.left) + Number(pagePosition.x) ),\n\t\t\t\ty: Math.floor( Number(iFramePosition.top) + Number(pagePosition.y) )\n\t\t\t};\n\t\t}\n\n\t\tfunction scrollRequestFromChild(addOffset){\n\t\t\t/* istanbul ignore next */ //Not testable in Karma\n\t\t\tfunction reposition(){\n\t\t\t\tpagePosition = newPosition;\n\t\t\t\tscrollTo();\n\t\t\t\tlog(iframeId,'--');\n\t\t\t}\n\n\t\t\tfunction calcOffset(){\n\t\t\t\treturn {\n\t\t\t\t\tx: Number(messageData.width) + offset.x,\n\t\t\t\t\ty: Number(messageData.height) + offset.y\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction scrollParent(){\n\t\t\t\tif (window.parentIFrame){\n\t\t\t\t\twindow.parentIFrame['scrollTo'+(addOffset?'Offset':'')](newPosition.x,newPosition.y);\n\t\t\t\t} else {\n\t\t\t\t\twarn(iframeId,'Unable to scroll to requested position, window.parentIFrame not found');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar\n\t\t\t\toffset = addOffset ? getElementPosition(messageData.iframe) : {x:0,y:0},\n\t\t\t\tnewPosition = calcOffset();\n\n\t\t\tlog(iframeId,'Reposition requested from iFrame (offset x:'+offset.x+' y:'+offset.y+')');\n\n\t\t\tif(window.top!==window.self){\n\t\t\t\tscrollParent();\n\t\t\t} else {\n\t\t\t\treposition();\n\t\t\t}\n\t\t}\n\n\t\tfunction scrollTo(){\n\t\t\tif (false !== callback('scrollCallback',pagePosition)){\n\t\t\t\tsetPagePosition(iframeId);\n\t\t\t} else {\n\t\t\t\tunsetPagePosition();\n\t\t\t}\n\t\t}\n\n\t\tfunction findTarget(location){\n\t\t\tfunction jumpToTarget(){\n\t\t\t\tvar jumpPosition = getElementPosition(target);\n\n\t\t\t\tlog(iframeId,'Moving to in page link (#'+hash+') at x: '+jumpPosition.x+' y: '+jumpPosition.y);\n\t\t\t\tpagePosition = {\n\t\t\t\t\tx: jumpPosition.x,\n\t\t\t\t\ty: jumpPosition.y\n\t\t\t\t};\n\n\t\t\t\tscrollTo();\n\t\t\t\tlog(iframeId,'--');\n\t\t\t}\n\n\t\t\tfunction jumpToParent(){\n\t\t\t\tif (window.parentIFrame){\n\t\t\t\t\twindow.parentIFrame.moveToAnchor(hash);\n\t\t\t\t} else {\n\t\t\t\t\tlog(iframeId,'In page link #'+hash+' not found and window.parentIFrame not found');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar\n\t\t\t\thash = location.split('#')[1] || '',\n\t\t\t\thashData = decodeURIComponent(hash),\n\t\t\t\ttarget = document.getElementById(hashData) || document.getElementsByName(hashData)[0];\n\n\t\t\tif (target){\n\t\t\t\tjumpToTarget();\n\t\t\t} else if(window.top!==window.self){\n\t\t\t\tjumpToParent();\n\t\t\t} else {\n\t\t\t\tlog(iframeId,'In page link #'+hash+' not found');\n\t\t\t}\n\t\t}\n\n\t\tfunction callback(funcName,val){\n\t\t\treturn chkCallback(iframeId,funcName,val);\n\t\t}\n\n\t\tfunction actionMsg(){\n\n\t\t\tif(settings[iframeId].firstRun) firstRun();\n\n\t\t\tswitch(messageData.type){\n\t\t\tcase 'close':\n\t\t\t\tcloseIFrame(messageData.iframe);\n\t\t\t\tbreak;\n\t\t\tcase 'message':\n\t\t\t\tforwardMsgFromIFrame(getMsgBody(6));\n\t\t\t\tbreak;\n\t\t\tcase 'scrollTo':\n\t\t\t\tscrollRequestFromChild(false);\n\t\t\t\tbreak;\n\t\t\tcase 'scrollToOffset':\n\t\t\t\tscrollRequestFromChild(true);\n\t\t\t\tbreak;\n\t\t\tcase 'pageInfo':\n\t\t\t\tsendPageInfoToIframe(settings[iframeId].iframe,iframeId);\n\t\t\t\tstartPageInfoMonitor();\n\t\t\t\tbreak;\n\t\t\tcase 'pageInfoStop':\n\t\t\t\tstopPageInfoMonitor();\n\t\t\t\tbreak;\n\t\t\tcase 'inPageLink':\n\t\t\t\tfindTarget(getMsgBody(9));\n\t\t\t\tbreak;\n\t\t\tcase 'reset':\n\t\t\t\tresetIFrame(messageData);\n\t\t\t\tbreak;\n\t\t\tcase 'init':\n\t\t\t\tresizeIFrame();\n\t\t\t\tcallback('initCallback',messageData.iframe);\n\t\t\t\tcallback('resizedCallback',messageData);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tresizeIFrame();\n\t\t\t\tcallback('resizedCallback',messageData);\n\t\t\t}\n\t\t}\n\n\t\tfunction hasSettings(iframeId){\n\t\t\tvar retBool = true;\n\n\t\t\tif (!settings[iframeId]){\n\t\t\t\tretBool = false;\n\t\t\t\twarn(messageData.type + ' No settings for ' + iframeId + '. Message was: ' + msg);\n\t\t\t}\n\n\t\t\treturn retBool;\n\t\t}\n\n\t\tfunction iFrameReadyMsgReceived(){\n\t\t\tfor (var iframeId in settings){\n\t\t\t\ttrigger('iFrame requested init',createOutgoingMsg(iframeId),document.getElementById(iframeId),iframeId);\n\t\t\t}\n\t\t}\n\n\t\tfunction firstRun() {\n\t\t\tsettings[iframeId].firstRun = false;\n\t\t}\n\n\t\tvar\n\t\t\tmsg = event.data,\n\t\t\tmessageData = {},\n\t\t\tiframeId = null;\n\n\t\tif('[iFrameResizerChild]Ready' === msg){\n\t\t\tiFrameReadyMsgReceived();\n\t\t} else if (isMessageForUs()){\n\t\t\tmessageData = processMsg();\n\t\t\tiframeId = logId = messageData.id;\n\n\t\t\tif (!isMessageFromMetaParent() && hasSettings(iframeId)){\n\t\t\t\tlog(iframeId,'Received: '+msg);\n\n\t\t\t\tif ( checkIFrameExists() && isMessageFromIFrame() ){\n\t\t\t\t\tactionMsg();\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tinfo(iframeId,'Ignored: '+msg);\n\t\t}\n\n\t}\n\n\n\tfunction chkCallback(iframeId,funcName,val){\n\t\tvar\n\t\t\tfunc = null,\n\t\t\tretVal = null;\n\n\t\tif(settings[iframeId]){\n\t\t\tfunc = settings[iframeId][funcName];\n\n\t\t\tif( 'function' === typeof func){\n\t\t\t\tretVal = func(val);\n\t\t\t} else {\n\t\t\t\tthrow new TypeError(funcName+' on iFrame['+iframeId+'] is not a function');\n\t\t\t}\n\t\t}\n\n\t\treturn retVal;\n\t}\n\n\tfunction closeIFrame(iframe){\n\t\tvar iframeId = iframe.id;\n\n\t\tlog(iframeId,'Removing iFrame: '+iframeId);\n\t\tiframe.parentNode.removeChild(iframe);\n\t\tchkCallback(iframeId,'closedCallback',iframeId);\n\t\tlog(iframeId,'--');\n\t\tdelete settings[iframeId];\n\t}\n\n\tfunction getPagePosition(iframeId){\n\t\tif(null === pagePosition){\n\t\t\tpagePosition = {\n\t\t\t\tx: (window.pageXOffset !== undefined) ? window.pageXOffset : document.documentElement.scrollLeft,\n\t\t\t\ty: (window.pageYOffset !== undefined) ? window.pageYOffset : document.documentElement.scrollTop\n\t\t\t};\n\t\t\tlog(iframeId,'Get page position: '+pagePosition.x+','+pagePosition.y);\n\t\t}\n\t}\n\n\tfunction setPagePosition(iframeId){\n\t\tif(null !== pagePosition){\n\t\t\twindow.scrollTo(pagePosition.x,pagePosition.y);\n\t\t\tlog(iframeId,'Set page position: '+pagePosition.x+','+pagePosition.y);\n\t\t\tunsetPagePosition();\n\t\t}\n\t}\n\n\tfunction unsetPagePosition(){\n\t\tpagePosition = null;\n\t}\n\n\tfunction resetIFrame(messageData){\n\t\tfunction reset(){\n\t\t\tsetSize(messageData);\n\t\t\ttrigger('reset','reset',messageData.iframe,messageData.id);\n\t\t}\n\n\t\tlog(messageData.id,'Size reset requested by '+('init'===messageData.type?'host page':'iFrame'));\n\t\tgetPagePosition(messageData.id);\n\t\tsyncResize(reset,messageData,'reset');\n\t}\n\n\tfunction setSize(messageData){\n\t\tfunction setDimension(dimension){\n\t\t\tmessageData.iframe.style[dimension] = messageData[dimension] + 'px';\n\t\t\tlog(\n\t\t\t\tmessageData.id,\n\t\t\t\t'IFrame (' + iframeId +\n\t\t\t\t') ' + dimension +\n\t\t\t\t' set to ' + messageData[dimension] + 'px'\n\t\t\t);\n\t\t}\n\n\t\tfunction chkZero(dimension){\n\t\t\t//FireFox sets dimension of hidden iFrames to zero.\n\t\t\t//So if we detect that set up an event to check for\n\t\t\t//when iFrame becomes visible.\n\n\t\t\t/* istanbul ignore next */ //Not testable in PhantomJS\n\t\t\tif (!hiddenCheckEnabled && '0' === messageData[dimension]){\n\t\t\t\thiddenCheckEnabled = true;\n\t\t\t\tlog(iframeId,'Hidden iFrame detected, creating visibility listener');\n\t\t\t\tfixHiddenIFrames();\n\t\t\t}\n\t\t}\n\n\t\tfunction processDimension(dimension){\n\t\t\tsetDimension(dimension);\n\t\t\tchkZero(dimension);\n\t\t}\n\n\t\tvar iframeId = messageData.iframe.id;\n\n\t\tif(settings[iframeId]){\n\t\t\tif( settings[iframeId].sizeHeight) { processDimension('height'); }\n\t\t\tif( settings[iframeId].sizeWidth ) { processDimension('width'); }\n\t\t}\n\t}\n\n\tfunction syncResize(func,messageData,doNotSync){\n\t\t/* istanbul ignore if */ //Not testable in PhantomJS\n\t\tif(doNotSync!==messageData.type && requestAnimationFrame){\n\t\t\tlog(messageData.id,'Requesting animation frame');\n\t\t\trequestAnimationFrame(func);\n\t\t} else {\n\t\t\tfunc();\n\t\t}\n\t}\n\n\tfunction trigger(calleeMsg,msg,iframe,id){\n\t\tfunction postMessageToIFrame(){\n\t\t\tvar target = settings[id].targetOrigin;\n\t\t\tlog(id,'[' + calleeMsg + '] Sending msg to iframe['+id+'] ('+msg+') targetOrigin: '+target);\n\t\t\tiframe.contentWindow.postMessage( msgId + msg, target );\n\t\t}\n\n\t\tfunction iFrameNotFound(){\n\t\t\tinfo(id,'[' + calleeMsg + '] IFrame('+id+') not found');\n\t\t\tif(settings[id]) {\n\t\t\t\tdelete settings[id];\n\t\t\t}\n\t\t}\n\n\t\tfunction chkAndSend(){\n\t\t\tif(iframe && 'contentWindow' in iframe && (null !== iframe.contentWindow)){ //Null test for PhantomJS\n\t\t\t\tpostMessageToIFrame();\n\t\t\t} else {\n\t\t\t\tiFrameNotFound();\n\t\t\t}\n\t\t}\n\n\t\tid = id || iframe.id;\n\n\t\tif(settings[id]) {\n\t\t\tchkAndSend();\n\t\t}\n\n\t}\n\n\tfunction createOutgoingMsg(iframeId){\n\t\treturn iframeId +\n\t\t\t':' + settings[iframeId].bodyMarginV1 +\n\t\t\t':' + settings[iframeId].sizeWidth +\n\t\t\t':' + settings[iframeId].log +\n\t\t\t':' + settings[iframeId].interval +\n\t\t\t':' + settings[iframeId].enablePublicMethods +\n\t\t\t':' + settings[iframeId].autoResize +\n\t\t\t':' + settings[iframeId].bodyMargin +\n\t\t\t':' + settings[iframeId].heightCalculationMethod +\n\t\t\t':' + settings[iframeId].bodyBackground +\n\t\t\t':' + settings[iframeId].bodyPadding +\n\t\t\t':' + settings[iframeId].tolerance +\n\t\t\t':' + settings[iframeId].inPageLinks +\n\t\t\t':' + settings[iframeId].resizeFrom +\n\t\t\t':' + settings[iframeId].widthCalculationMethod;\n\t}\n\n\tfunction setupIFrame(iframe,options){\n\t\tfunction setLimits(){\n\t\t\tfunction addStyle(style){\n\t\t\t\tif ((Infinity !== settings[iframeId][style]) && (0 !== settings[iframeId][style])){\n\t\t\t\t\tiframe.style[style] = settings[iframeId][style] + 'px';\n\t\t\t\t\tlog(iframeId,'Set '+style+' = '+settings[iframeId][style]+'px');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction chkMinMax(dimension){\n\t\t\t\tif (settings[iframeId]['min'+dimension]>settings[iframeId]['max'+dimension]){\n\t\t\t\t\tthrow new Error('Value for min'+dimension+' can not be greater than max'+dimension);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchkMinMax('Height');\n\t\t\tchkMinMax('Width');\n\n\t\t\taddStyle('maxHeight');\n\t\t\taddStyle('minHeight');\n\t\t\taddStyle('maxWidth');\n\t\t\taddStyle('minWidth');\n\t\t}\n\n\t\tfunction newId(){\n\t\t\tvar id = ((options && options.id) || defaults.id + count++);\n\t\t\tif (null!==document.getElementById(id)){\n\t\t\t\tid = id + count++;\n\t\t\t}\n\t\t\treturn id;\n\t\t}\n\n\t\tfunction ensureHasId(iframeId){\n\t\t\tlogId=iframeId;\n\t\t\tif (''===iframeId){\n\t\t\t\tiframe.id = iframeId = newId();\n\t\t\t\tlogEnabled = (options || {}).log;\n\t\t\t\tlogId=iframeId;\n\t\t\t\tlog(iframeId,'Added missing iframe ID: '+ iframeId +' (' + iframe.src + ')');\n\t\t\t}\n\n\n\t\t\treturn iframeId;\n\t\t}\n\n\t\tfunction setScrolling(){\n\t\t\tlog(iframeId,'IFrame scrolling ' + (settings[iframeId].scrolling ? 'enabled' : 'disabled') + ' for ' + iframeId);\n\t\t\tiframe.style.overflow = false === settings[iframeId].scrolling ? 'hidden' : 'auto';\n\t\t\tiframe.scrolling = false === settings[iframeId].scrolling ? 'no' : 'yes';\n\t\t}\n\n\t\t//The V1 iFrame script expects an int, where as in V2 expects a CSS\n\t\t//string value such as '1px 3em', so if we have an int for V2, set V1=V2\n\t\t//and then convert V2 to a string PX value.\n\t\tfunction setupBodyMarginValues(){\n\t\t\tif (('number'===typeof(settings[iframeId].bodyMargin)) || ('0'===settings[iframeId].bodyMargin)){\n\t\t\t\tsettings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;\n\t\t\t\tsettings[iframeId].bodyMargin = '' + settings[iframeId].bodyMargin + 'px';\n\t\t\t}\n\t\t}\n\n\t\tfunction checkReset(){\n\t\t\t// Reduce scope of firstRun to function, because IE8's JS execution\n\t\t\t// context stack is borked and this value gets externally\n\t\t\t// changed midway through running this function!!!\n\t\t\tvar\n\t\t\t\tfirstRun = settings[iframeId].firstRun,\n\t\t\t\tresetRequertMethod = settings[iframeId].heightCalculationMethod in resetRequiredMethods;\n\n\t\t\tif (!firstRun && resetRequertMethod){\n\t\t\t\tresetIFrame({iframe:iframe, height:0, width:0, type:'init'});\n\t\t\t}\n\t\t}\n\n\t\tfunction setupIFrameObject(){\n\t\t\tif(Function.prototype.bind){ //Ignore unpolyfilled IE8.\n\t\t\t\tsettings[iframeId].iframe.iFrameResizer = {\n\n\t\t\t\t\tclose : closeIFrame.bind(null,settings[iframeId].iframe),\n\n\t\t\t\t\tresize : trigger.bind(null,'Window resize', 'resize', settings[iframeId].iframe),\n\n\t\t\t\t\tmoveToAnchor : function(anchor){\n\t\t\t\t\t\ttrigger('Move to anchor','inPageLink:'+anchor, settings[iframeId].iframe,iframeId);\n\t\t\t\t\t},\n\n\t\t\t\t\tsendMessage : function(message){\n\t\t\t\t\t\tmessage = JSON.stringify(message);\n\t\t\t\t\t\ttrigger('Send Message','message:'+message, settings[iframeId].iframe,iframeId);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t//We have to call trigger twice, as we can not be sure if all\n\t\t//iframes have completed loading when this code runs. The\n\t\t//event listener also catches the page changing in the iFrame.\n\t\tfunction init(msg){\n\t\t\tfunction iFrameLoaded(){\n\t\t\t\ttrigger('iFrame.onload',msg,iframe);\n\t\t\t\tcheckReset();\n\t\t\t}\n\n\t\t\taddEventListener(iframe,'load',iFrameLoaded);\n\t\t\ttrigger('init',msg,iframe);\n\t\t}\n\n\t\tfunction checkOptions(options){\n\t\t\tif ('object' !== typeof options){\n\t\t\t\tthrow new TypeError('Options is not an object');\n\t\t\t}\n\t\t}\n\n\t\tfunction copyOptions(options){\n\t\t\tfor (var option in defaults) {\n\t\t\t\tif (defaults.hasOwnProperty(option)){\n\t\t\t\t\tsettings[iframeId][option] = options.hasOwnProperty(option) ? options[option] : defaults[option];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction getTargetOrigin (remoteHost){\n\t\t\treturn ('' === remoteHost || 'file://' === remoteHost) ? '*' : remoteHost;\n\t\t}\n\n\t\tfunction processOptions(options){\n\t\t\toptions = options || {};\n\t\t\tsettings[iframeId] = {\n\t\t\t\tfirstRun\t: true,\n\t\t\t\tiframe\t\t: iframe,\n\t\t\t\tremoteHost\t: iframe.src.split('/').slice(0,3).join('/')\n\t\t\t};\n\n\t\t\tcheckOptions(options);\n\t\t\tcopyOptions(options);\n\n\t\t\tsettings[iframeId].targetOrigin = true === settings[iframeId].checkOrigin ? getTargetOrigin(settings[iframeId].remoteHost) : '*';\n\t\t}\n\n\t\tfunction beenHere(){\n\t\t\treturn (iframeId in settings && 'iFrameResizer' in iframe);\n\t\t}\n\n\t\tvar iframeId = ensureHasId(iframe.id);\n\n\t\tif (!beenHere()){\n\t\t\tprocessOptions(options);\n\t\t\tsetScrolling();\n\t\t\tsetLimits();\n\t\t\tsetupBodyMarginValues();\n\t\t\tinit(createOutgoingMsg(iframeId));\n\t\t\tsetupIFrameObject();\n\t\t} else {\n\t\t\twarn(iframeId,'Ignored iFrame, already setup.');\n\t\t}\n\t}\n\n\tfunction debouce(fn,time){\n\t\tif (null === timer){\n\t\t\ttimer = setTimeout(function(){\n\t\t\t\ttimer = null;\n\t\t\t\tfn();\n\t\t\t}, time);\n\t\t}\n\t}\n\n\t/* istanbul ignore next */ //Not testable in PhantomJS\n\tfunction fixHiddenIFrames(){\n\t\tfunction checkIFrames(){\n\t\t\tfunction checkIFrame(settingId){\n\t\t\t\tfunction chkDimension(dimension){\n\t\t\t\t\treturn '0px' === settings[settingId].iframe.style[dimension];\n\t\t\t\t}\n\n\t\t\t\tfunction isVisible(el) {\n\t\t\t\t\treturn (null !== el.offsetParent);\n\t\t\t\t}\n\n\t\t\t\tif (isVisible(settings[settingId].iframe) && (chkDimension('height') || chkDimension('width'))){\n\t\t\t\t\ttrigger('Visibility change', 'resize', settings[settingId].iframe,settingId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var settingId in settings){\n\t\t\t\tcheckIFrame(settingId);\n\t\t\t}\n\t\t}\n\n\t\tfunction mutationObserved(mutations){\n\t\t\tlog('window','Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type);\n\t\t\tdebouce(checkIFrames,16);\n\t\t}\n\n\t\tfunction createMutationObserver(){\n\t\t\tvar\n\t\t\t\ttarget = document.querySelector('body'),\n\n\t\t\t\tconfig = {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tattributeOldValue : false,\n\t\t\t\t\tcharacterData : true,\n\t\t\t\t\tcharacterDataOldValue : false,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tsubtree : true\n\t\t\t\t},\n\n\t\t\t\tobserver = new MutationObserver(mutationObserved);\n\n\t\t\tobserver.observe(target, config);\n\t\t}\n\n\t\tvar MutationObserver = window.MutationObserver || window.WebKitMutationObserver;\n\n\t\tif (MutationObserver) createMutationObserver();\n\t}\n\n\n\tfunction resizeIFrames(event){\n\t\tfunction resize(){\n\t\t\tsendTriggerMsg('Window '+event,'resize');\n\t\t}\n\n\t\tlog('window','Trigger event: '+event);\n\t\tdebouce(resize,16);\n\t}\n\n\t/* istanbul ignore next */ //Not testable in PhantomJS\n\tfunction tabVisible() {\n\t\tfunction resize(){\n\t\t\tsendTriggerMsg('Tab Visable','resize');\n\t\t}\n\n\t\tif('hidden' !== document.visibilityState) {\n\t\t\tlog('document','Trigger event: Visiblity change');\n\t\t\tdebouce(resize,16);\n\t\t}\n\t}\n\n\tfunction sendTriggerMsg(eventName,event){\n\t\tfunction isIFrameResizeEnabled(iframeId) {\n\t\t\treturn\t'parent' === settings[iframeId].resizeFrom &&\n\t\t\t\t\tsettings[iframeId].autoResize &&\n\t\t\t\t\t!settings[iframeId].firstRun;\n\t\t}\n\n\t\tfor (var iframeId in settings){\n\t\t\tif(isIFrameResizeEnabled(iframeId)){\n\t\t\t\ttrigger(eventName,event,document.getElementById(iframeId),iframeId);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction setupEventListeners(){\n\t\taddEventListener(window,'message',iFrameListener);\n\n\t\taddEventListener(window,'resize', function(){resizeIFrames('resize');});\n\n\t\taddEventListener(document,'visibilitychange',tabVisible);\n\t\taddEventListener(document,'-webkit-visibilitychange',tabVisible); //Andriod 4.4\n\t\taddEventListener(window,'focusin',function(){resizeIFrames('focus');}); //IE8-9\n\t\taddEventListener(window,'focus',function(){resizeIFrames('focus');});\n\t}\n\n\n\tfunction factory(){\n\t\tfunction init(options,element){\n\t\t\tfunction chkType(){\n\t\t\t\tif(!element.tagName) {\n\t\t\t\t\tthrow new TypeError('Object is not a valid DOM element');\n\t\t\t\t} else if ('IFRAME' !== element.tagName.toUpperCase()) {\n\t\t\t\t\tthrow new TypeError('Expected <IFRAME> tag, found <'+element.tagName+'>');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(element) {\n\t\t\t\tchkType();\n\t\t\t\tsetupIFrame(element, options);\n\t\t\t\tiFrames.push(element);\n\t\t\t}\n\t\t}\n\n\t\tvar iFrames;\n\n\t\tsetupRequestAnimationFrame();\n\t\tsetupEventListeners();\n\n\t\treturn function iFrameResizeF(options,target){\n\t\t\tiFrames = []; //Only return iFrames past in on this call\n\n\t\t\tswitch (typeof(target)){\n\t\t\tcase 'undefined':\n\t\t\tcase 'string':\n\t\t\t\tArray.prototype.forEach.call(\n\t\t\t\t\tdocument.querySelectorAll( target || 'iframe' ),\n\t\t\t\t\tinit.bind(undefined, options)\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase 'object':\n\t\t\t\tinit(options,target);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new TypeError('Unexpected data type ('+typeof(target)+')');\n\t\t\t}\n\n\t\t\treturn iFrames;\n\t\t};\n\t}\n\n\tfunction createJQueryPublicMethod($){\n\t\t$.fn.iFrameResize = function $iFrameResizeF(options) {\n\t\t\treturn this.filter('iframe').each(function (index, element) {\n\t\t\t\tsetupIFrame(element, options);\n\t\t\t}).end();\n\t\t};\n\t}\n\n\tif (window.jQuery) { createJQueryPublicMethod(jQuery); }\n\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine([],factory);\n\t} else if (typeof module === 'object' && typeof module.exports === 'object') { //Node for browserfy\n\t\tmodule.exports = factory();\n\t} else {\n\t\twindow.iFrameResize = window.iFrameResize || factory();\n\t}\n\n})(window || {});\n"]}
includes/js/iframeResizer.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*! iFrame Resizer (iframeSizer.min.js ) - v3.5.1 - 2015-11-04
2
+ * Desc: Force cross domain iframes to size to content.
3
+ * Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.
4
+ * Copyright: (c) 2015 David J. Bradshaw - dave@bradshaw.net
5
+ * License: MIT
6
+ */
7
+
8
+ !function(a){"use strict";function b(b,c,d){"addEventListener"in a?b.addEventListener(c,d,!1):"attachEvent"in a&&b.attachEvent("on"+c,d)}function c(b,c,d){"removeEventListener"in a?b.removeEventListener(c,d,!1):"detachEvent"in a&&b.detachEvent("on"+c,d)}function d(){var b,c=["moz","webkit","o","ms"];for(b=0;b<c.length&&!N;b+=1)N=a[c[b]+"RequestAnimationFrame"];N||h("setup","RequestAnimationFrame not supported")}function e(b){var c="Host page: "+b;return a.top!==a.self&&(c=a.parentIFrame&&a.parentIFrame.getId?a.parentIFrame.getId()+": "+b:"Nested host page: "+b),c}function f(a){return K+"["+e(a)+"]"}function g(a){return P[a]?P[a].log:G}function h(a,b){k("log",a,b,g(a))}function i(a,b){k("info",a,b,g(a))}function j(a,b){k("warn",a,b,!0)}function k(b,c,d,e){!0===e&&"object"==typeof a.console&&console[b](f(c),d)}function l(d){function e(){function a(){s(V),p(W)}g("Height"),g("Width"),t(a,V,"init")}function f(){var a=U.substr(L).split(":");return{iframe:P[a[0]].iframe,id:a[0],height:a[1],width:a[2],type:a[3]}}function g(a){var b=Number(P[W]["max"+a]),c=Number(P[W]["min"+a]),d=a.toLowerCase(),e=Number(V[d]);h(W,"Checking "+d+" is in range "+c+"-"+b),c>e&&(e=c,h(W,"Set "+d+" to min value")),e>b&&(e=b,h(W,"Set "+d+" to max value")),V[d]=""+e}function k(){function a(){function a(){var a=0,d=!1;for(h(W,"Checking connection is from allowed list of origins: "+c);a<c.length;a++)if(c[a]===b){d=!0;break}return d}function d(){var a=P[W].remoteHost;return h(W,"Checking connection is from: "+a),b===a}return c.constructor===Array?a():d()}var b=d.origin,c=P[W].checkOrigin;if(c&&""+b!="null"&&!a())throw new Error("Unexpected message received from: "+b+" for "+V.iframe.id+". Message was: "+d.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function l(){return K===(""+U).substr(0,L)&&U.substr(L).split(":")[0]in P}function w(){var a=V.type in{"true":1,"false":1,undefined:1};return a&&h(W,"Ignoring init message from meta parent page"),a}function y(a){return U.substr(U.indexOf(":")+J+a)}function z(a){h(W,"MessageCallback passed: {iframe: "+V.iframe.id+", message: "+a+"}"),N("messageCallback",{iframe:V.iframe,message:JSON.parse(a)}),h(W,"--")}function A(){var b=document.body.getBoundingClientRect(),c=V.iframe.getBoundingClientRect();return JSON.stringify({clientHeight:Math.max(document.documentElement.clientHeight,a.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,a.innerWidth||0),offsetTop:parseInt(c.top-b.top,10),offsetLeft:parseInt(c.left-b.left,10),scrollTop:a.pageYOffset,scrollLeft:a.pageXOffset})}function B(a,b){function c(){u("Send Page Info","pageInfo:"+A(),a,b)}x(c,32)}function C(){function d(b,c){function d(){P[g]?B(P[g].iframe,g):e()}["scroll","resize"].forEach(function(e){h(g,b+e+" listener for sendPageInfo"),c(a,e,d)})}function e(){d("Remove ",c)}function f(){d("Add ",b)}var g=W;f(),P[g].stopPageInfo=e}function D(){P[W]&&P[W].stopPageInfo&&(P[W].stopPageInfo(),delete P[W].stopPageInfo)}function E(){var a=!0;return null===V.iframe&&(j(W,"IFrame ("+V.id+") not found"),a=!1),a}function F(a){var b=a.getBoundingClientRect();return o(W),{x:Math.floor(Number(b.left)+Number(M.x)),y:Math.floor(Number(b.top)+Number(M.y))}}function G(b){function c(){M=g,H(),h(W,"--")}function d(){return{x:Number(V.width)+f.x,y:Number(V.height)+f.y}}function e(){a.parentIFrame?a.parentIFrame["scrollTo"+(b?"Offset":"")](g.x,g.y):j(W,"Unable to scroll to requested position, window.parentIFrame not found")}var f=b?F(V.iframe):{x:0,y:0},g=d();h(W,"Reposition requested from iFrame (offset x:"+f.x+" y:"+f.y+")"),a.top!==a.self?e():c()}function H(){!1!==N("scrollCallback",M)?p(W):q()}function I(b){function c(){var a=F(g);h(W,"Moving to in page link (#"+e+") at x: "+a.x+" y: "+a.y),M={x:a.x,y:a.y},H(),h(W,"--")}function d(){a.parentIFrame?a.parentIFrame.moveToAnchor(e):h(W,"In page link #"+e+" not found and window.parentIFrame not found")}var e=b.split("#")[1]||"",f=decodeURIComponent(e),g=document.getElementById(f)||document.getElementsByName(f)[0];g?c():a.top!==a.self?d():h(W,"In page link #"+e+" not found")}function N(a,b){return m(W,a,b)}function O(){switch(P[W].firstRun&&T(),V.type){case"close":n(V.iframe);break;case"message":z(y(6));break;case"scrollTo":G(!1);break;case"scrollToOffset":G(!0);break;case"pageInfo":B(P[W].iframe,W),C();break;case"pageInfoStop":D();break;case"inPageLink":I(y(9));break;case"reset":r(V);break;case"init":e(),N("initCallback",V.iframe),N("resizedCallback",V);break;default:e(),N("resizedCallback",V)}}function Q(a){var b=!0;return P[a]||(b=!1,j(V.type+" No settings for "+a+". Message was: "+U)),b}function S(){for(var a in P)u("iFrame requested init",v(a),document.getElementById(a),a)}function T(){P[W].firstRun=!1}var U=d.data,V={},W=null;"[iFrameResizerChild]Ready"===U?S():l()?(V=f(),W=R=V.id,!w()&&Q(W)&&(h(W,"Received: "+U),E()&&k()&&O())):i(W,"Ignored: "+U)}function m(a,b,c){var d=null,e=null;if(P[a]){if(d=P[a][b],"function"!=typeof d)throw new TypeError(b+" on iFrame["+a+"] is not a function");e=d(c)}return e}function n(a){var b=a.id;h(b,"Removing iFrame: "+b),a.parentNode.removeChild(a),m(b,"closedCallback",b),h(b,"--"),delete P[b]}function o(b){null===M&&(M={x:void 0!==a.pageXOffset?a.pageXOffset:document.documentElement.scrollLeft,y:void 0!==a.pageYOffset?a.pageYOffset:document.documentElement.scrollTop},h(b,"Get page position: "+M.x+","+M.y))}function p(b){null!==M&&(a.scrollTo(M.x,M.y),h(b,"Set page position: "+M.x+","+M.y),q())}function q(){M=null}function r(a){function b(){s(a),u("reset","reset",a.iframe,a.id)}h(a.id,"Size reset requested by "+("init"===a.type?"host page":"iFrame")),o(a.id),t(b,a,"reset")}function s(a){function b(b){a.iframe.style[b]=a[b]+"px",h(a.id,"IFrame ("+e+") "+b+" set to "+a[b]+"px")}function c(b){H||"0"!==a[b]||(H=!0,h(e,"Hidden iFrame detected, creating visibility listener"),y())}function d(a){b(a),c(a)}var e=a.iframe.id;P[e]&&(P[e].sizeHeight&&d("height"),P[e].sizeWidth&&d("width"))}function t(a,b,c){c!==b.type&&N?(h(b.id,"Requesting animation frame"),N(a)):a()}function u(a,b,c,d){function e(){var e=P[d].targetOrigin;h(d,"["+a+"] Sending msg to iframe["+d+"] ("+b+") targetOrigin: "+e),c.contentWindow.postMessage(K+b,e)}function f(){i(d,"["+a+"] IFrame("+d+") not found"),P[d]&&delete P[d]}function g(){c&&"contentWindow"in c&&null!==c.contentWindow?e():f()}d=d||c.id,P[d]&&g()}function v(a){return a+":"+P[a].bodyMarginV1+":"+P[a].sizeWidth+":"+P[a].log+":"+P[a].interval+":"+P[a].enablePublicMethods+":"+P[a].autoResize+":"+P[a].bodyMargin+":"+P[a].heightCalculationMethod+":"+P[a].bodyBackground+":"+P[a].bodyPadding+":"+P[a].tolerance+":"+P[a].inPageLinks+":"+P[a].resizeFrom+":"+P[a].widthCalculationMethod}function w(a,c){function d(){function b(b){1/0!==P[w][b]&&0!==P[w][b]&&(a.style[b]=P[w][b]+"px",h(w,"Set "+b+" = "+P[w][b]+"px"))}function c(a){if(P[w]["min"+a]>P[w]["max"+a])throw new Error("Value for min"+a+" can not be greater than max"+a)}c("Height"),c("Width"),b("maxHeight"),b("minHeight"),b("maxWidth"),b("minWidth")}function e(){var a=c&&c.id||S.id+F++;return null!==document.getElementById(a)&&(a+=F++),a}function f(b){return R=b,""===b&&(a.id=b=e(),G=(c||{}).log,R=b,h(b,"Added missing iframe ID: "+b+" ("+a.src+")")),b}function g(){h(w,"IFrame scrolling "+(P[w].scrolling?"enabled":"disabled")+" for "+w),a.style.overflow=!1===P[w].scrolling?"hidden":"auto",a.scrolling=!1===P[w].scrolling?"no":"yes"}function i(){("number"==typeof P[w].bodyMargin||"0"===P[w].bodyMargin)&&(P[w].bodyMarginV1=P[w].bodyMargin,P[w].bodyMargin=""+P[w].bodyMargin+"px")}function k(){var b=P[w].firstRun,c=P[w].heightCalculationMethod in O;!b&&c&&r({iframe:a,height:0,width:0,type:"init"})}function l(){Function.prototype.bind&&(P[w].iframe.iFrameResizer={close:n.bind(null,P[w].iframe),resize:u.bind(null,"Window resize","resize",P[w].iframe),moveToAnchor:function(a){u("Move to anchor","inPageLink:"+a,P[w].iframe,w)},sendMessage:function(a){a=JSON.stringify(a),u("Send Message","message:"+a,P[w].iframe,w)}})}function m(c){function d(){u("iFrame.onload",c,a),k()}b(a,"load",d),u("init",c,a)}function o(a){if("object"!=typeof a)throw new TypeError("Options is not an object")}function p(a){for(var b in S)S.hasOwnProperty(b)&&(P[w][b]=a.hasOwnProperty(b)?a[b]:S[b])}function q(a){return""===a||"file://"===a?"*":a}function s(b){b=b||{},P[w]={firstRun:!0,iframe:a,remoteHost:a.src.split("/").slice(0,3).join("/")},o(b),p(b),P[w].targetOrigin=!0===P[w].checkOrigin?q(P[w].remoteHost):"*"}function t(){return w in P&&"iFrameResizer"in a}var w=f(a.id);t()?j(w,"Ignored iFrame, already setup."):(s(c),g(),d(),i(),m(v(w)),l())}function x(a,b){null===Q&&(Q=setTimeout(function(){Q=null,a()},b))}function y(){function b(){function a(a){function b(b){return"0px"===P[a].iframe.style[b]}function c(a){return null!==a.offsetParent}c(P[a].iframe)&&(b("height")||b("width"))&&u("Visibility change","resize",P[a].iframe,a)}for(var b in P)a(b)}function c(a){h("window","Mutation observed: "+a[0].target+" "+a[0].type),x(b,16)}function d(){var a=document.querySelector("body"),b={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},d=new e(c);d.observe(a,b)}var e=a.MutationObserver||a.WebKitMutationObserver;e&&d()}function z(a){function b(){B("Window "+a,"resize")}h("window","Trigger event: "+a),x(b,16)}function A(){function a(){B("Tab Visable","resize")}"hidden"!==document.visibilityState&&(h("document","Trigger event: Visiblity change"),x(a,16))}function B(a,b){function c(a){return"parent"===P[a].resizeFrom&&P[a].autoResize&&!P[a].firstRun}for(var d in P)c(d)&&u(a,b,document.getElementById(d),d)}function C(){b(a,"message",l),b(a,"resize",function(){z("resize")}),b(document,"visibilitychange",A),b(document,"-webkit-visibilitychange",A),b(a,"focusin",function(){z("focus")}),b(a,"focus",function(){z("focus")})}function D(){function a(a,c){function d(){if(!c.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==c.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+c.tagName+">")}c&&(d(),w(c,a),b.push(c))}var b;return d(),C(),function(c,d){switch(b=[],typeof d){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(d||"iframe"),a.bind(void 0,c));break;case"object":a(c,d);break;default:throw new TypeError("Unexpected data type ("+typeof d+")")}return b}}function E(a){a.fn.iFrameResize=function(a){return this.filter("iframe").each(function(b,c){w(c,a)}).end()}}var F=0,G=!1,H=!1,I="message",J=I.length,K="[iFrameSizer]",L=K.length,M=null,N=a.requestAnimationFrame,O={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},P={},Q=null,R="Host Page",S={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){j("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}};a.jQuery&&E(jQuery),"function"==typeof define&&define.amd?define([],D):"object"==typeof module&&"object"==typeof module.exports?module.exports=D():a.iFrameResize=a.iFrameResize||D()}(window||{});
9
+ //# sourceMappingURL=iframeResizer.map
includes/js/jscolor/arrow.gif ADDED
Binary file
includes/js/jscolor/cross.gif ADDED
Binary file
includes/js/jscolor/hs.png ADDED
Binary file
includes/js/jscolor/hv.png ADDED
Binary file
includes/js/jscolor/jscolor.js ADDED
@@ -0,0 +1,840 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * jscolor, JavaScript Color Picker
3
+ *
4
+ * @version 1.3.1
5
+ * @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
6
+ * @author Jan Odvarko, http://odvarko.cz
7
+ * @created 2008-06-15
8
+ * @updated 2010-01-23
9
+ * @link http://jscolor.com
10
+ */
11
+
12
+
13
+ var jscolor = {
14
+
15
+
16
+ dir : '', // location of jscolor directory (leave empty to autodetect)
17
+ bindClass : 'color', // class name
18
+ binding : true, // automatic binding via <input class="...">
19
+ preloading : true, // use image preloading?
20
+
21
+
22
+ install : function() {
23
+ jscolor.addEvent(window, 'load', jscolor.init);
24
+ },
25
+
26
+
27
+ init : function() {
28
+ if(jscolor.binding) {
29
+ jscolor.bind();
30
+ }
31
+ if(jscolor.preloading) {
32
+ jscolor.preload();
33
+ }
34
+ },
35
+
36
+
37
+ getDir : function() {
38
+ if(!jscolor.dir) {
39
+ var detected = jscolor.detectDir();
40
+ jscolor.dir = detected!==false ? detected : '';
41
+ }
42
+ return jscolor.dir;
43
+ },
44
+
45
+
46
+ detectDir : function() {
47
+ var base = location.href;
48
+
49
+ var e = document.getElementsByTagName('base');
50
+ for(var i=0; i<e.length; i+=1) {
51
+ if(e[i].href) { base = e[i].href; }
52
+ }
53
+
54
+ var e = document.getElementsByTagName('script');
55
+ for(var i=0; i<e.length; i+=1) {
56
+ if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
57
+ var src = new jscolor.URI(e[i].src);
58
+ var srcAbs = src.toAbsolute(base);
59
+ srcAbs.path = srcAbs.path.replace(/[^\/]+$/, ''); // remove filename
60
+ srcAbs.query = null;
61
+ srcAbs.fragment = null;
62
+ return srcAbs.toString();
63
+ }
64
+ }
65
+ return false;
66
+ },
67
+
68
+
69
+ bind : function() {
70
+ var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i');
71
+ var e = document.getElementsByTagName('input');
72
+ for(var i=0; i<e.length; i+=1) {
73
+ var m;
74
+ if(!e[i].color && e[i].className && (m = e[i].className.match(matchClass))) {
75
+ var prop = {};
76
+ if(m[3]) {
77
+ try {
78
+ eval('prop='+m[3]);
79
+ } catch(eInvalidProp) {}
80
+ }
81
+ e[i].color = new jscolor.color(e[i], prop);
82
+ }
83
+ }
84
+ },
85
+
86
+
87
+ preload : function() {
88
+ for(var fn in jscolor.imgRequire) {
89
+ if(jscolor.imgRequire.hasOwnProperty(fn)) {
90
+ jscolor.loadImage(fn);
91
+ }
92
+ }
93
+ },
94
+
95
+
96
+ images : {
97
+ pad : [ 181, 101 ],
98
+ sld : [ 16, 101 ],
99
+ cross : [ 15, 15 ],
100
+ arrow : [ 7, 11 ]
101
+ },
102
+
103
+
104
+ imgRequire : {},
105
+ imgLoaded : {},
106
+
107
+
108
+ requireImage : function(filename) {
109
+ jscolor.imgRequire[filename] = true;
110
+ },
111
+
112
+
113
+ loadImage : function(filename) {
114
+ if(!jscolor.imgLoaded[filename]) {
115
+ jscolor.imgLoaded[filename] = new Image();
116
+ jscolor.imgLoaded[filename].src = jscolor.getDir()+filename;
117
+ }
118
+ },
119
+
120
+
121
+ fetchElement : function(mixed) {
122
+ return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
123
+ },
124
+
125
+
126
+ addEvent : function(el, evnt, func) {
127
+ if(el.addEventListener) {
128
+ el.addEventListener(evnt, func, false);
129
+ } else if(el.attachEvent) {
130
+ el.attachEvent('on'+evnt, func);
131
+ }
132
+ },
133
+
134
+
135
+ fireEvent : function(el, evnt) {
136
+ if(!el) {
137
+ return;
138
+ }
139
+ if(document.createEventObject) {
140
+ var ev = document.createEventObject();
141
+ el.fireEvent('on'+evnt, ev);
142
+ } else if(document.createEvent) {
143
+ var ev = document.createEvent('HTMLEvents');
144
+ ev.initEvent(evnt, true, true);
145
+ el.dispatchEvent(ev);
146
+ } else if(el['on'+evnt]) { // alternatively use the traditional event model (IE5)
147
+ el['on'+evnt]();
148
+ }
149
+ },
150
+
151
+
152
+ getElementPos : function(e) {
153
+ var e1=e, e2=e;
154
+ var x=0, y=0;
155
+ if(e1.offsetParent) {
156
+ do {
157
+ x += e1.offsetLeft;
158
+ y += e1.offsetTop;
159
+ } while(e1 = e1.offsetParent);
160
+ }
161
+ while((e2 = e2.parentNode) && e2.nodeName.toUpperCase() !== 'BODY') {
162
+ x -= e2.scrollLeft;
163
+ y -= e2.scrollTop;
164
+ }
165
+ return [x, y];
166
+ },
167
+
168
+
169
+ getElementSize : function(e) {
170
+ return [e.offsetWidth, e.offsetHeight];
171
+ },
172
+
173
+
174
+ getMousePos : function(e) {
175
+ if(!e) { e = window.event; }
176
+ if(typeof e.pageX === 'number') {
177
+ return [e.pageX, e.pageY];
178
+ } else if(typeof e.clientX === 'number') {
179
+ return [
180
+ e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
181
+ e.clientY + document.body.scrollTop + document.documentElement.scrollTop
182
+ ];
183
+ }
184
+ },
185
+
186
+
187
+ getViewPos : function() {
188
+ if(typeof window.pageYOffset === 'number') {
189
+ return [window.pageXOffset, window.pageYOffset];
190
+ } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
191
+ return [document.body.scrollLeft, document.body.scrollTop];
192
+ } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
193
+ return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
194
+ } else {
195
+ return [0, 0];
196
+ }
197
+ },
198
+
199
+
200
+ getViewSize : function() {
201
+ if(typeof window.innerWidth === 'number') {
202
+ return [window.innerWidth, window.innerHeight];
203
+ } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
204
+ return [document.body.clientWidth, document.body.clientHeight];
205
+ } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
206
+ return [document.documentElement.clientWidth, document.documentElement.clientHeight];
207
+ } else {
208
+ return [0, 0];
209
+ }
210
+ },
211
+
212
+
213
+ URI : function(uri) { // See RFC3986
214
+
215
+ this.scheme = null;
216
+ this.authority = null;
217
+ this.path = '';
218
+ this.query = null;
219
+ this.fragment = null;
220
+
221
+ this.parse = function(uri) {
222
+ var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
223
+ this.scheme = m[3] ? m[2] : null;
224
+ this.authority = m[5] ? m[6] : null;
225
+ this.path = m[7];
226
+ this.query = m[9] ? m[10] : null;
227
+ this.fragment = m[12] ? m[13] : null;
228
+ return this;
229
+ };
230
+
231
+ this.toString = function() {
232
+ var result = '';
233
+ if(this.scheme !== null) { result = result + this.scheme + ':'; }
234
+ if(this.authority !== null) { result = result + '//' + this.authority; }
235
+ if(this.path !== null) { result = result + this.path; }
236
+ if(this.query !== null) { result = result + '?' + this.query; }
237
+ if(this.fragment !== null) { result = result + '#' + this.fragment; }
238
+ return result;
239
+ };
240
+
241
+ this.toAbsolute = function(base) {
242
+ var base = new jscolor.URI(base);
243
+ var r = this;
244
+ var t = new jscolor.URI;
245
+
246
+ if(base.scheme === null) { return false; }
247
+
248
+ if(r.scheme !== null && r.scheme.toLowerCase() === base.scheme.toLowerCase()) {
249
+ r.scheme = null;
250
+ }
251
+
252
+ if(r.scheme !== null) {
253
+ t.scheme = r.scheme;
254
+ t.authority = r.authority;
255
+ t.path = removeDotSegments(r.path);
256
+ t.query = r.query;
257
+ } else {
258
+ if(r.authority !== null) {
259
+ t.authority = r.authority;
260
+ t.path = removeDotSegments(r.path);
261
+ t.query = r.query;
262
+ } else {
263
+ if(r.path === '') { // TODO: == or === ?
264
+ t.path = base.path;
265
+ if(r.query !== null) {
266
+ t.query = r.query;
267
+ } else {
268
+ t.query = base.query;
269
+ }
270
+ } else {
271
+ if(r.path.substr(0,1) === '/') {
272
+ t.path = removeDotSegments(r.path);
273
+ } else {
274
+ if(base.authority !== null && base.path === '') { // TODO: == or === ?
275
+ t.path = '/'+r.path;
276
+ } else {
277
+ t.path = base.path.replace(/[^\/]+$/,'')+r.path;
278
+ }
279
+ t.path = removeDotSegments(t.path);
280
+ }
281
+ t.query = r.query;
282
+ }
283
+ t.authority = base.authority;
284
+ }
285
+ t.scheme = base.scheme;
286
+ }
287
+ t.fragment = r.fragment;
288
+
289
+ return t;
290
+ };
291
+
292
+ function removeDotSegments(path) {
293
+ var out = '';
294
+ while(path) {
295
+ if(path.substr(0,3)==='../' || path.substr(0,2)==='./') {
296
+ path = path.replace(/^\.+/,'').substr(1);
297
+ } else if(path.substr(0,3)==='/./' || path==='/.') {
298
+ path = '/'+path.substr(3);
299
+ } else if(path.substr(0,4)==='/../' || path==='/..') {
300
+ path = '/'+path.substr(4);
301
+ out = out.replace(/\/?[^\/]*$/, '');
302
+ } else if(path==='.' || path==='..') {
303
+ path = '';
304
+ } else {
305
+ var rm = path.match(/^\/?[^\/]*/)[0];
306
+ path = path.substr(rm.length);
307
+ out = out + rm;
308
+ }
309
+ }
310
+ return out;
311
+ }
312
+
313
+ if(uri) {
314
+ this.parse(uri);
315
+ }
316
+
317
+ },
318
+
319
+
320
+ /*
321
+ * Usage example:
322
+ * var myColor = new jscolor.color(myInputElement)
323
+ */
324
+
325
+ color : function(target, prop) {
326
+
327
+
328
+ this.required = true; // refuse empty values?
329
+ this.adjust = true; // adjust value to uniform notation?
330
+ this.hash = false; // prefix color with # symbol?
331
+ this.caps = true; // uppercase?
332
+ this.valueElement = target; // value holder
333
+ this.styleElement = target; // where to reflect current color
334
+ this.hsv = [0, 0, 1]; // read-only 0-6, 0-1, 0-1
335
+ this.rgb = [1, 1, 1]; // read-only 0-1, 0-1, 0-1
336
+
337
+ this.pickerOnfocus = true; // display picker on focus?
338
+ this.pickerMode = 'HSV'; // HSV | HVS
339
+ this.pickerPosition = 'bottom'; // left | right | top | bottom
340
+ this.pickerFace = 10; // px
341
+ this.pickerFaceColor = 'ThreeDFace'; // CSS color
342
+ this.pickerBorder = 1; // px
343
+ this.pickerBorderColor = 'ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight'; // CSS color
344
+ this.pickerInset = 1; // px
345
+ this.pickerInsetColor = 'ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow'; // CSS color
346
+ this.pickerZIndex = 12000000;
347
+
348
+
349
+ for(var p in prop) {
350
+ if(prop.hasOwnProperty(p)) {
351
+ this[p] = prop[p];
352
+ }
353
+ }
354
+
355
+
356
+ this.hidePicker = function() {
357
+ if(isPickerOwner()) {
358
+ removePicker();
359
+ }
360
+ };
361
+
362
+
363
+ this.showPicker = function() {
364
+ if(!isPickerOwner()) {
365
+ var tp = jscolor.getElementPos(target); // target pos
366
+ var ts = jscolor.getElementSize(target); // target size
367
+ var vp = jscolor.getViewPos(); // view pos
368
+ var vs = jscolor.getViewSize(); // view size
369
+ var ps = [ // picker size
370
+ 2*this.pickerBorder + 4*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0],
371
+ 2*this.pickerBorder + 2*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[1]
372
+ ];
373
+ var a, b, c;
374
+ switch(this.pickerPosition.toLowerCase()) {
375
+ case 'left': a=1; b=0; c=-1; break;
376
+ case 'right':a=1; b=0; c=1; break;
377
+ case 'top': a=0; b=1; c=-1; break;
378
+ default: a=0; b=1; c=1; break;
379
+ }
380
+ var l = (ts[b]+ps[b])/2;
381
+ var pp = [ // picker pos
382
+ -vp[a]+tp[a]+ps[a] > vs[a] ?
383
+ (-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
384
+ tp[a],
385
+ -vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
386
+ (-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
387
+ (tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
388
+ ];
389
+ drawPicker(pp[a], pp[b]);
390
+ }
391
+ };
392
+
393
+
394
+ this.importColor = function() {
395
+ if(!valueElement) {
396
+ this.exportColor();
397
+ } else {
398
+ if(!this.adjust) {
399
+ if(!this.fromString(valueElement.value, leaveValue)) {
400
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
401
+ styleElement.style.color = styleElement.jscStyle.color;
402
+ this.exportColor(leaveValue | leaveStyle);
403
+ }
404
+ } else if(!this.required && /^\s*$/.test(valueElement.value)) {
405
+ valueElement.value = '';
406
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
407
+ styleElement.style.color = styleElement.jscStyle.color;
408
+ this.exportColor(leaveValue | leaveStyle);
409
+
410
+ } else if(this.fromString(valueElement.value)) {
411
+ // OK
412
+ } else {
413
+ this.exportColor();
414
+ }
415
+ }
416
+ };
417
+
418
+
419
+ this.exportColor = function(flags) {
420
+ if(!(flags & leaveValue) && valueElement) {
421
+ var value = this.toString();
422
+ if(this.caps) { value = value.toUpperCase(); }
423
+ if(this.hash) { value = '#'+value; }
424
+ valueElement.value = value;
425
+ }
426
+ if(!(flags & leaveStyle) && styleElement) {
427
+ styleElement.style.backgroundColor =
428
+ '#'+this.toString();
429
+ styleElement.style.color =
430
+ 0.213 * this.rgb[0] +
431
+ 0.715 * this.rgb[1] +
432
+ 0.072 * this.rgb[2]
433
+ < 0.5 ? '#FFF' : '#000';
434
+ }
435
+ if(!(flags & leavePad) && isPickerOwner()) {
436
+ redrawPad();
437
+ }
438
+ if(!(flags & leaveSld) && isPickerOwner()) {
439
+ redrawSld();
440
+ }
441
+ };
442
+
443
+
444
+ this.fromHSV = function(h, s, v, flags) { // null = don't change
445
+ h<0 && (h=0) || h>6 && (h=6);
446
+ s<0 && (s=0) || s>1 && (s=1);
447
+ v<0 && (v=0) || v>1 && (v=1);
448
+ this.rgb = HSV_RGB(
449
+ h===null ? this.hsv[0] : (this.hsv[0]=h),
450
+ s===null ? this.hsv[1] : (this.hsv[1]=s),
451
+ v===null ? this.hsv[2] : (this.hsv[2]=v)
452
+ );
453
+ this.exportColor(flags);
454
+ };
455
+
456
+
457
+ this.fromRGB = function(r, g, b, flags) { // null = don't change
458
+ r<0 && (r=0) || r>1 && (r=1);
459
+ g<0 && (g=0) || g>1 && (g=1);
460
+ b<0 && (b=0) || b>1 && (b=1);
461
+ var hsv = RGB_HSV(
462
+ r===null ? this.rgb[0] : (this.rgb[0]=r),
463
+ g===null ? this.rgb[1] : (this.rgb[1]=g),
464
+ b===null ? this.rgb[2] : (this.rgb[2]=b)
465
+ );
466
+ if(hsv[0] !== null) {
467
+ this.hsv[0] = hsv[0];
468
+ }
469
+ if(hsv[2] !== 0) {
470
+ this.hsv[1] = hsv[1];
471
+ }
472
+ this.hsv[2] = hsv[2];
473
+ this.exportColor(flags);
474
+ };
475
+
476
+
477
+ this.fromString = function(hex, flags) {
478
+ var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
479
+ if(!m) {
480
+ return false;
481
+ } else {
482
+ if(m[1].length === 6) { // 6-char notation
483
+ this.fromRGB(
484
+ parseInt(m[1].substr(0,2),16) / 255,
485
+ parseInt(m[1].substr(2,2),16) / 255,
486
+ parseInt(m[1].substr(4,2),16) / 255,
487
+ flags
488
+ );
489
+ } else { // 3-char notation
490
+ this.fromRGB(
491
+ parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
492
+ parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
493
+ parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
494
+ flags
495
+ );
496
+ }
497
+ return true;
498
+ }
499
+ };
500
+
501
+
502
+ this.toString = function() {
503
+ return (
504
+ (0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
505
+ (0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
506
+ (0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
507
+ );
508
+ };
509
+
510
+
511
+ function RGB_HSV(r, g, b) {
512
+ var n = Math.min(Math.min(r,g),b);
513
+ var v = Math.max(Math.max(r,g),b);
514
+ var m = v - n;
515
+ if(m === 0) { return [ null, 0, v ]; }
516
+ var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
517
+ return [ h===6?0:h, m/v, v ];
518
+ }
519
+
520
+
521
+ function HSV_RGB(h, s, v) {
522
+ if(h === null) { return [ v, v, v ]; }
523
+ var i = Math.floor(h);
524
+ var f = i%2 ? h-i : 1-(h-i);
525
+ var m = v * (1 - s);
526
+ var n = v * (1 - s*f);
527
+ switch(i) {
528
+ case 6:
529
+ case 0: return [v,n,m];
530
+ case 1: return [n,v,m];
531
+ case 2: return [m,v,n];
532
+ case 3: return [m,n,v];
533
+ case 4: return [n,m,v];
534
+ case 5: return [v,m,n];
535
+ }
536
+ }
537
+
538
+
539
+ function removePicker() {
540
+ delete jscolor.picker.owner;
541
+ document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
542
+ }
543
+
544
+
545
+ function drawPicker(x, y) {
546
+ if(!jscolor.picker) {
547
+ jscolor.picker = {
548
+ box : document.createElement('div'),
549
+ boxB : document.createElement('div'),
550
+ pad : document.createElement('div'),
551
+ padB : document.createElement('div'),
552
+ padM : document.createElement('div'),
553
+ sld : document.createElement('div'),
554
+ sldB : document.createElement('div'),
555
+ sldM : document.createElement('div')
556
+ };
557
+ for(var i=0,segSize=4; i<jscolor.images.sld[1]; i+=segSize) {
558
+ var seg = document.createElement('div');
559
+ seg.style.height = segSize+'px';
560
+ seg.style.fontSize = '1px';
561
+ seg.style.lineHeight = '0';
562
+ jscolor.picker.sld.appendChild(seg);
563
+ }
564
+ jscolor.picker.sldB.appendChild(jscolor.picker.sld);
565
+ jscolor.picker.box.appendChild(jscolor.picker.sldB);
566
+ jscolor.picker.box.appendChild(jscolor.picker.sldM);
567
+ jscolor.picker.padB.appendChild(jscolor.picker.pad);
568
+ jscolor.picker.box.appendChild(jscolor.picker.padB);
569
+ jscolor.picker.box.appendChild(jscolor.picker.padM);
570
+ jscolor.picker.boxB.appendChild(jscolor.picker.box);
571
+ }
572
+
573
+ var p = jscolor.picker;
574
+
575
+ // recompute controls positions
576
+ posPad = [
577
+ x+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset,
578
+ y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
579
+ posSld = [
580
+ null,
581
+ y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
582
+
583
+ // controls interaction
584
+ p.box.onmouseup =
585
+ p.box.onmouseout = function() { target.focus(); };
586
+ p.box.onmousedown = function() { abortBlur=true; };
587
+ p.box.onmousemove = function(e) { holdPad && setPad(e); holdSld && setSld(e); };
588
+ p.padM.onmouseup =
589
+ p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
590
+ p.padM.onmousedown = function(e) { holdPad=true; setPad(e); };
591
+ p.sldM.onmouseup =
592
+ p.sldM.onmouseout = function() { if(holdSld) { holdSld=false; jscolor.fireEvent(valueElement,'change'); } };
593
+ p.sldM.onmousedown = function(e) { holdSld=true; setSld(e); };
594
+
595
+ // picker
596
+ p.box.style.width = 4*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0] + 'px';
597
+ p.box.style.height = 2*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[1] + 'px';
598
+
599
+ // picker border
600
+ p.boxB.style.position = 'absolute';
601
+ p.boxB.style.clear = 'both';
602
+ p.boxB.style.left = x+'px';
603
+ p.boxB.style.top = y+'px';
604
+ p.boxB.style.zIndex = THIS.pickerZIndex;
605
+ p.boxB.style.border = THIS.pickerBorder+'px solid';
606
+ p.boxB.style.borderColor = THIS.pickerBorderColor;
607
+ p.boxB.style.background = THIS.pickerFaceColor;
608
+
609
+ // pad image
610
+ p.pad.style.width = jscolor.images.pad[0]+'px';
611
+ p.pad.style.height = jscolor.images.pad[1]+'px';
612
+
613
+ // pad border
614
+ p.padB.style.position = 'absolute';
615
+ p.padB.style.left = THIS.pickerFace+'px';
616
+ p.padB.style.top = THIS.pickerFace+'px';
617
+ p.padB.style.border = THIS.pickerInset+'px solid';
618
+ p.padB.style.borderColor = THIS.pickerInsetColor;
619
+
620
+ // pad mouse area
621
+ p.padM.style.position = 'absolute';
622
+ p.padM.style.left = '0';
623
+ p.padM.style.top = '0';
624
+ p.padM.style.width = THIS.pickerFace + 2*THIS.pickerInset + jscolor.images.pad[0] + jscolor.images.arrow[0] + 'px';
625
+ p.padM.style.height = p.box.style.height;
626
+ p.padM.style.cursor = 'crosshair';
627
+
628
+ // slider image
629
+ p.sld.style.overflow = 'hidden';
630
+ p.sld.style.width = jscolor.images.sld[0]+'px';
631
+ p.sld.style.height = jscolor.images.sld[1]+'px';
632
+
633
+ // slider border
634
+ p.sldB.style.position = 'absolute';
635
+ p.sldB.style.right = THIS.pickerFace+'px';
636
+ p.sldB.style.top = THIS.pickerFace+'px';
637
+ p.sldB.style.border = THIS.pickerInset+'px solid';
638
+ p.sldB.style.borderColor = THIS.pickerInsetColor;
639
+
640
+ // slider mouse area
641
+ p.sldM.style.position = 'absolute';
642
+ p.sldM.style.right = '0';
643
+ p.sldM.style.top = '0';
644
+ p.sldM.style.width = jscolor.images.sld[0] + jscolor.images.arrow[0] + THIS.pickerFace + 2*THIS.pickerInset + 'px';
645
+ p.sldM.style.height = p.box.style.height;
646
+ try {
647
+ p.sldM.style.cursor = 'pointer';
648
+ } catch(eOldIE) {
649
+ p.sldM.style.cursor = 'hand';
650
+ }
651
+
652
+ // load images in optimal order
653
+ switch(modeID) {
654
+ case 0: var padImg = 'hs.png'; break;
655
+ case 1: var padImg = 'hv.png'; break;
656
+ }
657
+ p.padM.style.background = "url('"+jscolor.getDir()+"cross.gif') no-repeat";
658
+ p.sldM.style.background = "url('"+jscolor.getDir()+"arrow.gif') no-repeat";
659
+ p.pad.style.background = "url('"+jscolor.getDir()+padImg+"') 0 0 no-repeat";
660
+
661
+ // place pointers
662
+ redrawPad();
663
+ redrawSld();
664
+
665
+ jscolor.picker.owner = THIS;
666
+ document.getElementsByTagName('body')[0].appendChild(p.boxB);
667
+ }
668
+
669
+
670
+ function redrawPad() {
671
+ // redraw the pad pointer
672
+ switch(modeID) {
673
+ case 0: var yComponent = 1; break;
674
+ case 1: var yComponent = 2; break;
675
+ }
676
+ var x = Math.round((THIS.hsv[0]/6) * (jscolor.images.pad[0]-1));
677
+ var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.pad[1]-1));
678
+ jscolor.picker.padM.style.backgroundPosition =
679
+ (THIS.pickerFace+THIS.pickerInset+x - Math.floor(jscolor.images.cross[0]/2)) + 'px ' +
680
+ (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.cross[1]/2)) + 'px';
681
+
682
+ // redraw the slider image
683
+ var seg = jscolor.picker.sld.childNodes;
684
+
685
+ switch(modeID) {
686
+ case 0:
687
+ var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 1);
688
+ for(var i=0; i<seg.length; i+=1) {
689
+ seg[i].style.backgroundColor = 'rgb('+
690
+ (rgb[0]*(1-i/seg.length)*100)+'%,'+
691
+ (rgb[1]*(1-i/seg.length)*100)+'%,'+
692
+ (rgb[2]*(1-i/seg.length)*100)+'%)';
693
+ }
694
+ break;
695
+ case 1:
696
+ var rgb, s, c = [ THIS.hsv[2], 0, 0 ];
697
+ var i = Math.floor(THIS.hsv[0]);
698
+ var f = i%2 ? THIS.hsv[0]-i : 1-(THIS.hsv[0]-i);
699
+ switch(i) {
700
+ case 6:
701
+ case 0: rgb=[0,1,2]; break;
702
+ case 1: rgb=[1,0,2]; break;
703
+ case 2: rgb=[2,0,1]; break;
704
+ case 3: rgb=[2,1,0]; break;
705
+ case 4: rgb=[1,2,0]; break;
706
+ case 5: rgb=[0,2,1]; break;
707
+ }
708
+ for(var i=0; i<seg.length; i+=1) {
709
+ s = 1 - 1/(seg.length-1)*i;
710
+ c[1] = c[0] * (1 - s*f);
711
+ c[2] = c[0] * (1 - s);
712
+ seg[i].style.backgroundColor = 'rgb('+
713
+ (c[rgb[0]]*100)+'%,'+
714
+ (c[rgb[1]]*100)+'%,'+
715
+ (c[rgb[2]]*100)+'%)';
716
+ }
717
+ break;
718
+ }
719
+ }
720
+
721
+
722
+ function redrawSld() {
723
+ // redraw the slider pointer
724
+ switch(modeID) {
725
+ case 0: var yComponent = 2; break;
726
+ case 1: var yComponent = 1; break;
727
+ }
728
+ var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.sld[1]-1));
729
+ jscolor.picker.sldM.style.backgroundPosition =
730
+ '0 ' + (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.arrow[1]/2)) + 'px';
731
+ }
732
+
733
+
734
+ function isPickerOwner() {
735
+ return jscolor.picker && jscolor.picker.owner === THIS;
736
+ }
737
+
738
+
739
+ function blurTarget() {
740
+ if(valueElement === target) {
741
+ THIS.importColor();
742
+ }
743
+ if(THIS.pickerOnfocus) {
744
+ THIS.hidePicker();
745
+ }
746
+ }
747
+
748
+
749
+ function blurValue() {
750
+ if(valueElement !== target) {
751
+ THIS.importColor();
752
+ }
753
+ }
754
+
755
+
756
+ function setPad(e) {
757
+ var posM = jscolor.getMousePos(e);
758
+ var x = posM[0]-posPad[0];
759
+ var y = posM[1]-posPad[1];
760
+ switch(modeID) {
761
+ case 0: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), 1 - y/(jscolor.images.pad[1]-1), null, leaveSld); break;
762
+ case 1: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), null, 1 - y/(jscolor.images.pad[1]-1), leaveSld); break;
763
+ }
764
+ }
765
+
766
+
767
+ function setSld(e) {
768
+ var posM = jscolor.getMousePos(e);
769
+ var y = posM[1]-posPad[1];
770
+ switch(modeID) {
771
+ case 0: THIS.fromHSV(null, null, 1 - y/(jscolor.images.sld[1]-1), leavePad); break;
772
+ case 1: THIS.fromHSV(null, 1 - y/(jscolor.images.sld[1]-1), null, leavePad); break;
773
+ }
774
+ }
775
+
776
+
777
+ var THIS = this;
778
+ var modeID = this.pickerMode.toLowerCase()==='hvs' ? 1 : 0;
779
+ var abortBlur = false;
780
+ var
781
+ valueElement = jscolor.fetchElement(this.valueElement),
782
+ styleElement = jscolor.fetchElement(this.styleElement);
783
+ var
784
+ holdPad = false,
785
+ holdSld = false;
786
+ var
787
+ posPad,
788
+ posSld;
789
+ var
790
+ leaveValue = 1<<0,
791
+ leaveStyle = 1<<1,
792
+ leavePad = 1<<2,
793
+ leaveSld = 1<<3;
794
+
795
+ // target
796
+ jscolor.addEvent(target, 'focus', function() {
797
+ if(THIS.pickerOnfocus) { THIS.showPicker(); }
798
+ });
799
+ jscolor.addEvent(target, 'blur', function() {
800
+ if(!abortBlur) {
801
+ window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur=false; }, 0);
802
+ } else {
803
+ abortBlur = false;
804
+ }
805
+ });
806
+
807
+ // valueElement
808
+ if(valueElement) {
809
+ var updateField = function() {
810
+ THIS.fromString(valueElement.value, leaveValue);
811
+ };
812
+ jscolor.addEvent(valueElement, 'keyup', updateField);
813
+ jscolor.addEvent(valueElement, 'input', updateField);
814
+ jscolor.addEvent(valueElement, 'blur', blurValue);
815
+ valueElement.setAttribute('autocomplete', 'off');
816
+ }
817
+
818
+ // styleElement
819
+ if(styleElement) {
820
+ styleElement.jscStyle = {
821
+ backgroundColor : styleElement.style.backgroundColor,
822
+ color : styleElement.style.color
823
+ };
824
+ }
825
+
826
+ // require images
827
+ switch(modeID) {
828
+ case 0: jscolor.requireImage('hs.png'); break;
829
+ case 1: jscolor.requireImage('hv.png'); break;
830
+ }
831
+ jscolor.requireImage('cross.gif');
832
+ jscolor.requireImage('arrow.gif');
833
+
834
+ this.importColor();
835
+ }
836
+
837
+ };
838
+
839
+
840
+ jscolor.install();
includes/js/main.js ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var iframe_height = 0;
2
+ var dialog_message_return = false;
3
+ function create_popup() {
4
+ htm = '';
5
+ htm += '<div id="captainform_popup" class="captainform_popup_bg">';
6
+ htm += '<div class="captainform_popup_box">';
7
+ htm += '<div class="captainform_popup_title">';
8
+ htm += 'Popup title';
9
+ htm += '<div id="xclose" class="captainform_popup_close" onclick="close_popup()"></div>';
10
+ htm += '</div>';
11
+ htm += '<div class="captainform_popup_body"><a></a></div>';
12
+ htm += '</div>';
13
+ htm += '</div>';
14
+ jQuery('#captainform_iframe').after(htm);
15
+ jQuery('#captainform_popup').show();
16
+ }
17
+
18
+ function close_popup() {
19
+ if(dialog_message_return){
20
+ msgdialog = {dialog_response:dialog_message_return};
21
+ element.contentWindow.postMessage(msgdialog, chostp);
22
+ dialog_message_return = false;
23
+ }
24
+ jQuery('#captainform_popup').remove();
25
+ }
26
+
27
+ function captainform_is_ios_device() {
28
+ var iDevices = [ 'iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod' ];
29
+ if (!!navigator.platform) {
30
+ while (iDevices.length) {
31
+ if (navigator.platform === iDevices.pop()){ return true; }
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+
37
+ function create_popup_dialog(msg){
38
+ jQuery('#captainform_popup').remove();
39
+ title = msg.popup_title;
40
+ message = msg.popup_message;
41
+ dialog_type = msg.dialog_type;
42
+ dialog_message_return = msg.response_on_close;
43
+ w = msg.popup_w;
44
+ class_type = '';
45
+ if(dialog_type=='success'){
46
+ class_type = 'dialog dialog_success';
47
+ class_close = 'close_success';
48
+ }
49
+ if(dialog_type=='warning'){
50
+ class_type = 'dialog dialog_warning';
51
+ class_close = 'close_warning';
52
+ }
53
+ if(dialog_type=='error'){
54
+ class_type = 'dialog dialog_error';
55
+ class_close = 'close_error';
56
+ }
57
+ //class_type='';
58
+ // calculate buttons
59
+ buttons_html = '';
60
+ buttons = msg.buttons_list;
61
+ buttons_action = msg.buttons_action;
62
+ if (buttons !== null && typeof buttons === 'object') {
63
+ buttons_html += '<div id="popup_footer" class="captainform_popup_footer">';
64
+ Object.getOwnPropertyNames(buttons).forEach(function (val, idx, array) {
65
+ //btn = val + ' -> ' + buttons[val];
66
+ btn_title = buttons[val];
67
+ btn_action = buttons_action[val];
68
+ btn_action_type = btn_action.action_type;
69
+ btn_action_name = btn_action.action_name;
70
+ onclick = '';
71
+ lockurl = chostp;
72
+ if (btn_action_type == 'message') {
73
+ msg_return = btn_action_name;
74
+ vonclick = " onclick=\"element.contentWindow.postMessage('" + msg_return + "','" + lockurl + "')\"";
75
+ }
76
+ if (btn_action_type == 'callback') {
77
+ msg_return = btn_action_name;
78
+ vonclick = " onclick=\"" + btn_action_name + "\"";
79
+ }
80
+ buttons_html += '<div class="btn ' + val + '"' + vonclick + '>' + btn_title + '</div>';
81
+ });
82
+ buttons_html += '</div>';
83
+ }
84
+ htm = '';
85
+ htm += '<div id="captainform_popup" class="captainform_popup_bg">';
86
+ htm += '<div id="cfloader" class="captainform_loader"></div>';
87
+ htm += '<div id="popup_box" class="captainform_popup_box">';
88
+ htm += '<div id="popup_header" class="captainform_popup_title '+class_type+'">';
89
+ htm += decodeURIComponent(title);
90
+ htm += '<div id="xclose" class="captainform_popup_close '+class_close+'" onclick="close_popup()"></div>';
91
+ htm += '</div>';
92
+ htm += '<div id="popup_body" class="captainform_popup_body">';
93
+ htm += '<div class="icontent">'+decodeURIComponent(message)+'</div>';
94
+ htm += '</div>';
95
+ htm += buttons_html;
96
+ htm += '</div>';
97
+ htm += '</div>';
98
+ //ppi = document.getElementById('ppiframe');
99
+ jQuery('#captainform_iframe').after(htm);
100
+ jQuery('#popup_box').width(w);
101
+ jQuery('#cfloader').remove();
102
+ jQuery('#captainform_popup').show();
103
+ popup_box_height = jQuery('#popup_body').height()+95;
104
+ jQuery('#popup_box').height(popup_box_height);
105
+ jQuery('#popup_box').css('border','solid 1px #838383');
106
+ }
107
+
108
+ function create_popup_iframe(msg) {
109
+ jQuery('#captainform_popup').remove();
110
+ url = msg.popup_url + msg.popup_url_query;
111
+ url = url.replace('/app.captainform.com/', '/' + chost + '/');
112
+ title = msg.popup_title;
113
+ dialog_message_return = msg.response_on_close;
114
+ w = msg.popup_w;
115
+ h = msg.popup_h;
116
+ // calculate buttons
117
+ buttons_html = '';
118
+ buttons = msg.buttons_list;
119
+ buttons_action = msg.buttons_action;
120
+ if (buttons !== null && typeof buttons === 'object') {
121
+ buttons_html += '<div id="popup_footer" class="captainform_popup_footer">';
122
+ Object.getOwnPropertyNames(buttons).forEach(function (val, idx, array) {
123
+ //btn = val + ' -> ' + buttons[val];
124
+ btn_title = buttons[val];
125
+ btn_action = buttons_action[val];
126
+ btn_action_type = btn_action.action_type;
127
+ btn_action_name = btn_action.action_name;
128
+ onclick = '';
129
+ lockurl = chostp;
130
+ if (btn_action_type == 'message') {
131
+ msg_return = btn_action_name;
132
+ vonclick = " onclick=\"element1.contentWindow.postMessage('" + msg_return + "','" + lockurl + "')\"";
133
+ }
134
+ if (btn_action_type == 'callback') {
135
+ msg_return = btn_action_name;
136
+ vonclick = " onclick=\"" + btn_action_name + "\"";
137
+ }
138
+ buttons_html += '<div class="btn ' + val + '"' + vonclick + '>' + btn_title + '</div>';
139
+ });
140
+ buttons_html += '</div>';
141
+ }
142
+ htm = '';
143
+ htm += '<div id="captainform_popup" class="captainform_popup_bg">';
144
+ htm += '<div id="cfloader" class="captainform_loader"></div>';
145
+ htm += '<div id="popup_box" class="captainform_popup_box">';
146
+ htm += '<div id="popup_header" class="captainform_popup_title">';
147
+ htm += title;
148
+ htm += '<div id="xclose" class="captainform_popup_close" onclick="close_popup()"></div>';
149
+ htm += '</div>';
150
+ htm += '<div id="popup_body" class="captainform_popup_body"><iframe id="ppiframe" src="' + url + '" class="popup_iframe" scrolling="no">';
151
+ htm += '</iframe></div>';
152
+ htm += buttons_html;
153
+ htm += '</div>';
154
+ htm += '</div>';
155
+ ppi = document.getElementById('ppiframe');
156
+ jQuery('#captainform_iframe').after(htm);
157
+ jQuery('#popup_box').width(w);
158
+ jQuery('#popup_box').height(0);
159
+ jQuery('#captainform_popup').show();
160
+
161
+
162
+ element1 = document.getElementById('ppiframe');
163
+
164
+ var isOldIE = (navigator.userAgent.indexOf("MSIE") !== -1); // Detect IE10 and below
165
+
166
+ iFrameResize({
167
+ log: false,
168
+ scrolling: false,
169
+ enablePublicMethods: true,
170
+ checkOrigin: false,
171
+ //heightCalculationMethod: isOldIE ? 'max' : 'bodyOffset', // old wy max e obligatoriu pt ie8
172
+ //heightCalculationMethod: 'max',
173
+ heightCalculationMethod: isOldIE ? 'max' : 'documentElementOffset', // old wy max e obligatoriu pt ie8
174
+ resizedCallback: function (messageData) {
175
+ hh = messageData.height;
176
+ hhf = parseInt(hh) + 100;
177
+ iframe_height = hhf;
178
+ jQuery('#popup_box').height(hhf);
179
+ jQuery('#popup_box').css('border','solid 1px #838383');
180
+ resize_popup_iframe();
181
+ jQuery('#cfloader').remove();
182
+ },
183
+ scrollCallback: function () {
184
+ //console.log('scroll');
185
+ },
186
+ messageCallback: function (messageData) { // Callback fn when message is received
187
+ //console.log(messageData.message)
188
+ }
189
+ }, element1);
190
+
191
+ }
192
+
193
+ /**
194
+ * Add Settings Save Button and bar in page. It will be displayed when only when "Save" button from settings is not visible.
195
+ */
196
+ function show_settings_save_button()
197
+ {
198
+ if (typeof window.is_demo_account != 'undefined' && window.is_demo_account == true)
199
+ return;
200
+ html = '<div id="cf_settings_save_button_container">';
201
+ html += ' <div id="cf_settings_save_button" onclick="settings_click_save()">Save changes</div>';
202
+ html += '</div>';
203
+ if (document.getElementById('cf_settings_save_button_container') == null)
204
+ {
205
+ jQuery('body').prepend(html);
206
+ }
207
+ init_settings_save_menu_bar();
208
+ }
209
+ /**
210
+ * Init position and height of the Settings Save Bar
211
+ */
212
+ function init_settings_save_menu_bar()
213
+ {
214
+ if (document.getElementById('adminmenu') !== null && document.getElementById('cf_settings_save_button_container') !== null)
215
+ {
216
+ var window_width = jQuery(window).width();
217
+ var wp_adminmenu_width = 0;
218
+ if (jQuery('#adminmenu').is(':visible'))
219
+ wp_adminmenu_width = jQuery('#adminmenu').width();
220
+ var bar_width = window_width - wp_adminmenu_width;
221
+ jQuery('#cf_settings_save_button_container').css('width', bar_width).css('right', 0);
222
+ }
223
+ var admin_bar_height = 0;
224
+ var left_menu_z_index = 0;
225
+ if (document.getElementById('wpadminbar') !== null)
226
+ {
227
+ if (jQuery('#wpadminbar').css('position') == 'fixed')
228
+ admin_bar_height = jQuery('#wpadminbar').height();
229
+ }
230
+ jQuery('#cf_settings_save_button_container').css('top', admin_bar_height).show();
231
+ }
232
+ /**
233
+ * Removes the Settings Save Bar from the page.
234
+ */
235
+ function remove_settings_save_button()
236
+ {
237
+ if (document.getElementById('cf_settings_save_button_container') != null)
238
+ {
239
+ jQuery('#cf_settings_save_button_container').hide().remove();
240
+ }
241
+ }
242
+ /**
243
+ * Simulate click on the save button inside the child iframe . It's like clicking on the "Save" button.
244
+ */
245
+ function settings_click_save()
246
+ {
247
+ var iframe_obj = document.getElementById('captainform_iframe');
248
+ iframe_obj.contentWindow.postMessage(JSON.stringify({msg_id: 'settings_click_save'}), '*');
249
+ }
250
+ function resize_popup_iframe() {
251
+ if (jQuery('#ppiframe').length == 0) {
252
+ return false;
253
+ }
254
+
255
+ max_h = jQuery(window).height() - 20;
256
+ jQuery('#popup_box').css('max-height', max_h + 'px');
257
+ max_w = jQuery(window).width() - 20;
258
+ jQuery('#popup_box').css('max-width', max_w + 'px');
259
+
260
+ popup_header_h = jQuery('#popup_header').height();
261
+ popup_footer_h = jQuery('#popup_footer').height() + 10;
262
+ //popup_body_max_h = jQuery( window ).height() - popup_header_h - popup_footer_h;
263
+ popup_body_max_h = jQuery('#popup_box').height() - popup_header_h - popup_footer_h;
264
+ jQuery('#popup_body').css('max-height', popup_body_max_h + 'px');
265
+ }
266
+
267
+ function init_editor_menu_pos()
268
+ {
269
+ var top_scroll_pos = jQuery(document).scrollTop();
270
+ var iframe_obj = document.getElementById('captainform_iframe');
271
+ var iframe_offset_top = jQuery('#captainform_iframe').offset().top;
272
+ window.editor_menu_top_pos = iframe_offset_top;
273
+ if (typeof top_scroll_pos != 'undefined' && typeof iframe_offset_top != 'undefined')
274
+ iframe_obj.contentWindow.postMessage(JSON.stringify({msg_id: 'scroll_on_parent', msg_val: top_scroll_pos, 'iframe_offset_top': iframe_offset_top}), '*');
275
+ }
276
+
277
+
278
+ function doerror() {
279
+ jQuery('.btn_blue').hide();
280
+ jQuery('#popup_header').addClass('doerror');
281
+ jQuery('#xclose').addClass('doerrorclose');
282
+ }
283
+
284
+
285
+
286
+ jQuery(document).ready(function () {
287
+ init_editor_menu_pos();
288
+
289
+ jQuery(window).resize(function () {
290
+ resize_popup_iframe();
291
+ init_editor_menu_pos();
292
+ init_settings_save_menu_bar();
293
+ });
294
+
295
+ jQuery(window).scroll(function (event) {
296
+ clearTimeout(jQuery.data(this, 'scrollTimer'));
297
+ jQuery.data(this, 'scrollTimer', setTimeout(function () {
298
+ init_editor_menu_pos();
299
+ }, 250));
300
+ });
301
+ });
302
+ // resizer
303
+ element = document.getElementById('captainform_iframe');
304
+ iFrameResize({
305
+ log: false,
306
+ scrolling: false,
307
+ enablePublicMethods: true,
308
+ checkOrigin: false,
309
+ resizedCallback: function (messageData) {
310
+
311
+ },
312
+ scrollCallback: function () {
313
+ },
314
+ messageCallback: function (messageData) { // Callback fn when message is received
315
+ msgr = messageData.message;
316
+ switch (msgr.msg_type)
317
+ {
318
+ case 'show_popup_iframe':
319
+ create_popup_iframe(msgr);
320
+ break;
321
+ case 'show_popup_dialog':
322
+ create_popup_dialog(msgr);
323
+ break;
324
+ }
325
+
326
+ }
327
+ }, element);
328
+
329
+
330
+
331
+
332
+ // reseponse to parent 2
333
+ window.onmessage = function (e) {
334
+
335
+ msgresponse = e.data;
336
+ if(!msgresponse.hasOwnProperty('msg_id')){
337
+ return false;
338
+ }
339
+ msg_id = msgresponse.msg_id;
340
+
341
+ if (msgresponse.hasOwnProperty('msg_action')) {
342
+
343
+ msg_action = msgresponse.msg_action;
344
+
345
+ if (msg_action == 'response_resend') {
346
+ element.contentWindow.postMessage(msgresponse, chostp);
347
+ close_popup();
348
+ }
349
+ if (msg_action == 'response_reload') {
350
+ jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
351
+ close_popup();
352
+ }
353
+
354
+ if (msg_action == 'response_error'){
355
+ doerror();
356
+ return;
357
+ }
358
+
359
+ if(msg_action == 'response_alert'){
360
+
361
+ create_popup_dialog(msgresponse);
362
+ return;
363
+ }
364
+
365
+ } else {
366
+
367
+ if (msg_id == 'added_new_group') {
368
+ jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
369
+ top_scroll_pos = 0;
370
+ if (typeof msgresponse.last_div_pos != 'undefined')
371
+ top_scroll_pos = msgresponse.last_div_pos;
372
+ window.scroll(0, top_scroll_pos);
373
+ close_popup();
374
+ }
375
+ if (msg_id == 'renamed_group') {
376
+ element.contentWindow.postMessage(msgresponse, chostp);
377
+ close_popup();
378
+ }
379
+ if (msg_id == 'deleted_group') {
380
+ element.contentWindow.postMessage(msgresponse, chostp);
381
+ close_popup();
382
+ }
383
+ if (msg_id == 'group_settings_finish') {
384
+ element.contentWindow.postMessage(msgresponse, chostp);
385
+ close_popup();
386
+ }
387
+ if (msg_id == 'duplicated_group') {
388
+ jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
389
+ close_popup();
390
+ }
391
+
392
+ if (msg_id == 'renamed_form') {
393
+ element.contentWindow.postMessage(msgresponse, chostp);
394
+ close_popup();
395
+ }
396
+ if (msg_id == 'duplicated_form') {
397
+ element.contentWindow.postMessage(msgresponse, chostp);
398
+ close_popup();
399
+ }
400
+ if (msg_id == 'deleted_form') {
401
+ element.contentWindow.postMessage(msgresponse, chostp);
402
+ close_popup();
403
+ }
404
+ if (msg_id == 'form_activity_finish') {
405
+ element.contentWindow.postMessage(msgresponse, chostp);
406
+ //jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
407
+ close_popup();
408
+ }
409
+ //multisite_url_submited
410
+ if (msg_id == 'multisite_url_submited') {
411
+ jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
412
+ close_popup();
413
+ }
414
+ if (msg_id == 'myaccount_edit_finish') {
415
+ element.contentWindow.postMessage(msgresponse, chostp);
416
+ //jQuery('#captainform_iframe').attr('src', jQuery('#captainform_iframe').attr('src'));
417
+ close_popup();
418
+ }
419
+ if (msg_id == 'force_close_popup') {
420
+ close_popup();
421
+ }
422
+ if (msg_id == "reload_parent123")
423
+ {
424
+ window.location.href = window.location.href;
425
+ }
426
+ if (msg_id == "scroll_to_top")
427
+ {
428
+ window.scrollTo(0, 0);
429
+ }
430
+ if (msg_id == 'show_settings_save_button')
431
+ {
432
+ var is_demo = msgresponse.is_demo;
433
+ if (is_demo == false)
434
+ show_settings_save_button();
435
+ }
436
+ if (msg_id == "remove_settings_save_button")
437
+ {
438
+ remove_settings_save_button();
439
+ }
440
+ if (msg_id == "preview_form")
441
+ {
442
+ var preview_tab = "_blank";
443
+ var form_id = msgresponse.formid;
444
+ var is_demo = msgresponse.demo;
445
+ var protocol = window.location.protocol;
446
+ var host = window.location.hostname;
447
+
448
+ if (typeof captainform_plugin_dir != 'undefined')
449
+ window.open(parent_site_url + "/wp-admin/admin.php?page=CaptainForm&cf_form_id=" + form_id, preview_tab);
450
+ else //old preview method
451
+ window.open(chostp + "/form-" + form_id + "/", preview_tab);
452
+ }
453
+ if (msg_id == 'evernote_matches_popup_save') {
454
+ element.contentWindow.postMessage(msgresponse, chostp);
455
+ close_popup();
456
+ }
457
+ if (msg_id == 'wordpress_matches_popup_save') {
458
+ load_err = msgresponse.load_err;
459
+ if (load_err == 1) {
460
+ doerror();
461
+ return;
462
+ }
463
+ element.contentWindow.postMessage(msgresponse, chostp);
464
+ close_popup();
465
+ }
466
+ }
467
+
468
+
469
+ };
470
+
471
+ window.addEventListener('message', function(event){
472
+ if(typeof event.data != 'undefined' && event.data != null && typeof event.data == 'string' && event.data.indexOf('iFrameSizer') == -1)
473
+ {
474
+ try
475
+ {
476
+ msgresponse=JSON.parse(event.data);
477
+ if(typeof msgresponse.msg_id != 'undefined' && msgresponse.msg_id == 'scroll_on_parent' && typeof msgresponse.msg_val != 'undefined')
478
+ {
479
+ global_top_scroll = msgresponse.msg_val;
480
+ }
481
+ }
482
+ catch(error){}
483
+ }
484
+ });
includes/js/misc_functions.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Created by bogdan on 7/13/16.
3
+ */
4
+
5
+ function append_element(options) {
6
+ if(options == undefined)
7
+ return false;
8
+ if(!("elementType" in options))
9
+ return false;
10
+
11
+ var parent = null;
12
+
13
+ if(!!options.following)
14
+ parent = options.following.parentElement;
15
+ else if(!!options.inside)
16
+ parent = options.inside;
17
+ else if(!!options.replacing)
18
+ parent = options.replacing.parentElement;
19
+ else if(options.elementType == "script")
20
+ parent = document.head;
21
+ else
22
+ parent = document.body;
23
+
24
+ if(parent == null)
25
+ return false;
26
+
27
+ var element = document.createElement(options.elementType);
28
+ delete options.elementType;
29
+
30
+ element = jQuery.extend(element, options);
31
+
32
+ if(!!options.replacing)
33
+ parent.replaceChild(element, options.replacing);
34
+ else
35
+ parent.appendChild(element);
36
+ }
includes/js/nolink.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready(function() {
2
+ jQuery( '*' ).click(function(e) {
3
+ e.preventDefault();
4
+ });
5
+ jQuery( 'form' ).submit(function( event ) {
6
+ event.preventDefault();
7
+ });
8
+ jQuery('a').attr('href','javascript: void(0)');
9
+ });
includes/js/review.js ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Created by Adrian Dumitru on 8/28/2016.
3
+ */
4
+
5
+ var status;
6
+
7
+ function captainform_review_close()
8
+ {
9
+ jQuery('#captainform_review').remove();
10
+ }
11
+
12
+
13
+
14
+ function captainform_review_popup()
15
+ {
16
+
17
+ style_ios = '';
18
+ if (captainform_is_ios_device())
19
+ {
20
+ style_ios = ' style="-webkit-overflow-scrolling: touch"';
21
+ }
22
+
23
+ jQuery('#captainform_review').remove();
24
+ w = 550;
25
+ url = '//'+chost+'/wp_iframe.php?wp_action=show_review';
26
+ var htm = '';
27
+ htm += '<div id="captainform_review" class="captainform_review_bg">';
28
+ htm += '<div id="cfloader" class="captainform_loader"></div>';
29
+ htm += '<div id="captainform_review_box" class="captainform_review_box">';
30
+ htm += '<div class="captainform_review_div_close"><div id="captainform_review_close" class="captainform_review_close" onclick="captainform_review_close()"></div></div>';
31
+ htm += '<div id="captainform_review_body" class="captainform_review_body"'+style_ios+'>';
32
+ htm += '<iframe id="ppiframe_review" src="' + url + '" class="captainform_iframe_review" scrolling="no"></iframe>';
33
+ htm += '</div>';
34
+ htm += '</div>';
35
+ htm += '</div>';
36
+
37
+ jQuery('body').append(htm);
38
+ jQuery('#captainform_review_box').width(w);
39
+ jQuery('#captainform_review_box').height(0);
40
+
41
+ jQuery("#ppiframe_review").on("load", function () {
42
+ jQuery('#captainform_review').show();
43
+ captainform_review_resize();
44
+ });
45
+
46
+ element3 = document.getElementById('ppiframe_review');
47
+ var isOldIE = (navigator.userAgent.indexOf("MSIE") !== -1); // Detect IE10 and below
48
+
49
+ iFrameResize({
50
+ log: false,
51
+ scrolling: false,
52
+ enablePublicMethods: true,
53
+ checkOrigin: false,
54
+ heightCalculationMethod: isOldIE ? 'max' : 'documentElementOffset', // old wy max e obligatoriu pt ie8
55
+ resizedCallback: function (messageData) {
56
+ hh = messageData.height;
57
+ hhf = parseInt(hh) - 0 + 40;
58
+ iframe_height = hhf;
59
+ jQuery('#captainform_review_box').height(hhf);
60
+ captainform_review_resize();
61
+ jQuery('#cfloader').remove();
62
+ },
63
+ scrollCallback: function () {
64
+
65
+ },
66
+ messageCallback: function (messageData) { // Callback fn when message is received
67
+
68
+ }
69
+ }, element3);
70
+ }
71
+
72
+ function captainform_review_resize()
73
+ {
74
+ if (jQuery('#ppiframe_review').length == 0) {
75
+ return false;
76
+ }
77
+ max_h = jQuery(window).height() - 40;
78
+ jQuery('#captainform_review_box').css('max-height', max_h + 'px');
79
+ max_w = jQuery(window).width() - 40;
80
+ jQuery('#captainform_review_box').css('max-width', max_w + 'px');
81
+ popup_body_max_h = jQuery('#captainform_review_box').height()+10;
82
+ jQuery('#captainform_review_body').css('max-height', popup_body_max_h-40 + 'px');
83
+ }
84
+
85
+ window.onresize = function(event) {
86
+ captainform_review_resize();
87
+ };
88
+
89
+ window.addEventListener('message', function(e){
90
+ msg_review = e.data;
91
+ if(msg_review.msg_action == 'captainform_review_popup')
92
+ {
93
+ if(msg_review.msg_command == 'show')
94
+ {
95
+ status = msg_review.r_status;
96
+ captainform_review_popup();
97
+ }
98
+ if(msg_review.msg_command == 'close_popup')
99
+ {
100
+ captainform_review_close();
101
+ }
102
+ if(msg_review.msg_command == 'show_close')
103
+ {
104
+ jQuery('#captainform_review_close').show();
105
+ }
106
+ }
107
+ });
includes/js/tinybox/images/close.png ADDED
Binary file
includes/js/tinybox/images/preload.gif ADDED
Binary file
includes/js/tinybox/tinybox.js ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TINY={};
2
+
3
+ TINY.box=function(){
4
+ var j,m,b,g,v,p=0;
5
+ return{
6
+ show:function(o){
7
+ v={opacity:70,close:1,animate:1,fixed:1,mask:1,maskid:'',boxid:'',topsplit:2,url:0,post:0,height:0,width:0,html:0,iframe:0};
8
+ for(s in o){v[s]=o[s]}
9
+ if(!p){
10
+ j=document.createElement('div'); j.className='tbox';
11
+ p=document.createElement('div'); p.className='tinner';
12
+ b=document.createElement('div'); b.className='tcontent';
13
+ m=document.createElement('div'); m.className='tmask';
14
+ g=document.createElement('div'); g.className='tclose'; g.v=0;
15
+ document.body.appendChild(m); document.body.appendChild(j); j.appendChild(p); p.appendChild(b);
16
+ m.onclick=g.onclick=TINY.box.hide; window.onresize=TINY.box.resize
17
+ }else{
18
+ j.style.display='none'; clearTimeout(p.ah); if(g.v){j.removeChild(g); g.v=0}
19
+ }
20
+ p.id=v.boxid; m.id=v.maskid; j.style.position=v.fixed?'fixed':'absolute';
21
+ if(v.html&&!v.animate){
22
+ p.style.backgroundImage='none'; b.innerHTML=v.html; b.style.display='';
23
+ p.style.width=v.width?v.width+'px':'auto'; p.style.height=v.height?v.height+'px':'auto'
24
+ }else{
25
+ b.style.display='none';
26
+ if(!v.animate&&v.width&&v.height){
27
+ p.style.width=v.width+'px'; p.style.height=v.height+'px'
28
+ }else{
29
+ p.style.width=p.style.height='100px'
30
+ }
31
+ }
32
+ if(v.mask){this.mask(); this.alpha(m,1,v.opacity)}else{this.alpha(j,1,100)}
33
+ if(v.autohide){p.ah=setTimeout(TINY.box.hide,1000*v.autohide)}else{document.onkeyup=TINY.box.esc}
34
+ },
35
+ fill:function(c,u,k,a,w,h){
36
+ if(u){
37
+ if(v.image){
38
+ var i=new Image(); i.onload=function(){w=w||i.width; h=h||i.height; TINY.box.psh(i,a,w,h)}; i.src=v.image
39
+ }else if(v.iframe){
40
+ this.psh('<iframe src="'+v.iframe+'" width="'+v.width+'" frameborder="0" height="'+v.height+'"></iframe>',a,w,h)
41
+ }else{
42
+ var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
43
+ x.onreadystatechange=function(){
44
+ if(x.readyState==4&&x.status==200){p.style.backgroundImage=''; TINY.box.psh(x.responseText,a,w,h)}
45
+ };
46
+ if(k){
47
+ x.open('POST',c,true); x.setRequestHeader('Content-type','application/x-www-form-urlencoded'); x.send(k)
48
+ }else{
49
+ x.open('GET',c,true); x.send(null)
50
+ }
51
+ }
52
+ }else{
53
+ this.psh(c,a,w,h)
54
+ }
55
+ },
56
+ psh:function(c,a,w,h){
57
+ if(typeof c=='object'){b.appendChild(c)}else{b.innerHTML=c}
58
+ var x=p.style.width, y=p.style.height;
59
+ if(!w||!h){
60
+ p.style.width=w?w+'px':''; p.style.height=h?h+'px':''; b.style.display='';
61
+ if(!h){h=parseInt(b.offsetHeight)}
62
+ if(!w){w=parseInt(b.offsetWidth)}
63
+ b.style.display='none'
64
+ }
65
+ p.style.width=x; p.style.height=y;
66
+ this.size(w,h,a)
67
+ },
68
+ esc:function(e){e=e||window.event; if(e.keyCode==27){TINY.box.hide()}},
69
+ hide:function(){TINY.box.alpha(j,-1,0,3); document.onkeypress=null; if(v.closejs){v.closejs()}},
70
+ resize:function(){TINY.box.pos(); TINY.box.mask()},
71
+ mask:function(){m.style.height=this.total(1)+'px'; m.style.width=this.total(0)+'px'},
72
+ pos:function(){
73
+ var t;
74
+ if(typeof v.top!='undefined'){t=v.top}else{t=(this.height()/v.topsplit)-(j.offsetHeight/2); t=t<20?20:t}
75
+ if(!v.fixed&&!v.top){t+=this.top()}
76
+ j.style.top=t+'px';
77
+ j.style.left=typeof v.left!='undefined'?v.left+'px':(this.width()/2)-(j.offsetWidth/2)+'px'
78
+ },
79
+ alpha:function(e,d,a){
80
+ clearInterval(e.ai);
81
+ if(d){e.style.opacity=0; e.style.filter='alpha(opacity=0)'; e.style.display='block'; TINY.box.pos()}
82
+ e.ai=setInterval(function(){TINY.box.ta(e,a,d)},20)
83
+ },
84
+ ta:function(e,a,d){
85
+ var o=Math.round(e.style.opacity*100);
86
+ if(o==a){
87
+ clearInterval(e.ai);
88
+ if(d==-1){
89
+ e.style.display='none';
90
+ e==j?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage=''
91
+ }else{
92
+ if(e==m){
93
+ this.alpha(j,1,100)
94
+ }else{
95
+ j.style.filter='';
96
+ TINY.box.fill(v.html||v.url,v.url||v.iframe||v.image,v.post,v.animate,v.width,v.height)
97
+ }
98
+ }
99
+ }else{
100
+ var n=a-Math.floor(Math.abs(a-o)*.5)*d;
101
+ e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'
102
+ }
103
+ },
104
+ size:function(w,h,a){
105
+ if(a){
106
+ clearInterval(p.si); var wd=parseInt(p.style.width)>w?-1:1, hd=parseInt(p.style.height)>h?-1:1;
107
+ p.si=setInterval(function(){TINY.box.ts(w,wd,h,hd)},20)
108
+ }else{
109
+ p.style.backgroundImage='none'; if(v.close){j.appendChild(g); g.v=1}
110
+ p.style.width=w+'px'; p.style.height=h+'px'; b.style.display=''; this.pos();
111
+ if(v.openjs){v.openjs()}
112
+ }
113
+ },
114
+ ts:function(w,wd,h,hd){
115
+ var cw=parseInt(p.style.width), ch=parseInt(p.style.height);
116
+ if(cw==w&&ch==h){
117
+ clearInterval(p.si); p.style.backgroundImage='none'; b.style.display='block'; if(v.close){j.appendChild(g); g.v=1}
118
+ if(v.openjs){v.openjs()}
119
+ }else{
120
+ if(cw!=w){p.style.width=(w-Math.floor(Math.abs(w-cw)*.6)*wd)+'px'}
121
+ if(ch!=h){p.style.height=(h-Math.floor(Math.abs(h-ch)*.6)*hd)+'px'}
122
+ this.pos()
123
+ }
124
+ },
125
+ top:function(){return document.documentElement.scrollTop||document.body.scrollTop},
126
+ width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},
127
+ height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},
128
+ total:function(d){
129
+ var b=document.body, e=document.documentElement;
130
+ return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):
131
+ Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))
132
+ }
133
+ }
134
+ }();
includes/js/tinybox/tinyboxstyle.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .tbox {position:absolute; display:none; padding:14px 17px; z-index:90000}
2
+ .tinner {padding:15px; -moz-border-radius:5px; border-radius:5px; background:#fff url(images/preload.gif) no-repeat 50% 50%; border-right:1px solid #333; border-bottom:1px solid #333}
3
+ .tmask {position:absolute; display:none; top:0px; left:0px; height:100%; width:100%; background:#000; z-index:800}
4
+ .tclose {position:absolute; top:0px; right:0px; width:30px; height:30px; cursor:pointer; background:url(images/close.png) no-repeat}
5
+ .tclose:hover {background-position:0 -30px}
6
+
7
+ #error {background:#ff6969; color:#fff; text-shadow:1px 1px #cf5454; border-right:1px solid #000; border-bottom:1px solid #000; padding:0}
8
+ #error .tcontent {padding:10px 14px 11px; border:1px solid #ffb8b8; -moz-border-radius:5px; border-radius:5px}
9
+ #success {background:#2ea125; color:#fff; text-shadow:1px 1px #1b6116; border-right:1px solid #000; border-bottom:1px solid #000; padding:10; -moz-border-radius:0; border-radius:0}
10
+ #bluemask {background:#666666}
11
+ #frameless {padding:0; border: 10px solid #fff; overflow: hidden;}
12
+ #frameless .tclose {right:0px}
13
+
14
+ .tcontent, .tbox, .tinner{
15
+ box-sizing: initial;
16
+ overflow: hidden;
17
+ }
includes/js/tinybox/tinyboxstyle_ios.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ #frameless{
2
+ overflow-y: auto;
3
+ -webkit-overflow-scrolling: touch;
4
+ }
includes/js/widget.js ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.captainform_is_widget_page = true;
2
+ jQuery(document).ready(function ($) {
3
+ captainform_bind_widget();
4
+ });
5
+
6
+ function captainform_bind_widget(widget_id_to_bind)
7
+ {
8
+ var prefix = '';
9
+ if (typeof widget_id_to_bind != 'undefined' && widget_id_to_bind != '' && widget_id_to_bind != null)
10
+ prefix = "#" + widget_id_to_bind + " ";
11
+
12
+ bind_searchable(prefix);
13
+ bind_lightbox_publish(prefix);
14
+ if (typeof jscolor != 'undefined')
15
+ jscolor.init();
16
+ }
17
+
18
+ function bind_lightbox_publish(prefix)
19
+ {
20
+ jQuery(prefix + '.cf_lightbox_cotainer').each(function () {
21
+ if (jQuery(this).find(".cf_display_as_lightbox").is(':checked'))
22
+ {
23
+ jQuery(this).find('.cf_triggers_container').show();
24
+ if (jQuery(this).find('.cf_trigger:checked').val() == 1)
25
+ {
26
+ image_obj = jQuery(this).find('.cf_trigger_1_url');
27
+ captainform_test_valid_image(image_obj.val(), image_obj)
28
+ }
29
+ }
30
+ else if (!jQuery(this).find(".cf_display_as_lightbox").is(':checked'))
31
+ {
32
+ jQuery(this).find('.cf_triggers_container').hide();
33
+ }
34
+ });
35
+
36
+ jQuery(prefix + '.cf_display_as_lightbox').on('click', function () {
37
+ if (jQuery(this).is(':checked'))
38
+ jQuery(this).closest('.cf_lightbox_cotainer').find('.cf_triggers_container').show();
39
+ else
40
+ jQuery(this).closest('.cf_lightbox_cotainer').find('.cf_triggers_container').hide();
41
+ });
42
+
43
+ jQuery(prefix + '.cf_trigger').on('click', function () {
44
+ var value = jQuery(this).val();
45
+ var options_container = jQuery(this).closest('.cf_triggers_container');
46
+ jQuery(options_container).find('.cf_trigger_selected_option_container').hide();
47
+ jQuery(options_container).find('.cf_trigger_selected_option_cotainter_' + value).show();
48
+
49
+ });
50
+
51
+ jQuery(prefix + '.cf_trigger').each(function () {
52
+ var value = jQuery(this).val();
53
+ if (jQuery(this).is(':checked'))
54
+ {
55
+ var options_container = jQuery(this).closest('.cf_triggers_container');
56
+ jQuery(options_container).find('.cf_trigger_selected_option_container').hide();
57
+ jQuery(options_container).find('.cf_trigger_selected_option_cotainter_' + value).show();
58
+ }
59
+ });
60
+
61
+ jQuery(prefix + '.cf_display_as_lightbox').on('change', function () {
62
+ if (!jQuery(this).is(':checked'))
63
+ {
64
+ var formid = jQuery(this).closest('.captainform_widget_container').find('.captainform_widget_select').val();
65
+ var code = '[captainform id="' + formid + '"]';
66
+ jQuery(this).closest('.captainform_widget_container').find('.cf_generated_code').val(code);
67
+ }
68
+ });
69
+
70
+ jQuery(prefix + '.cf_trigger_1_url').on('change keyup', function () {
71
+ captainform_test_valid_image(jQuery(this).val(), jQuery(this));
72
+ })
73
+
74
+ jQuery(prefix + '.cf_triggers_container input , ' + prefix + ' .cf_display_as_lightbox' + ',' + prefix + ' .captainform_widget_select,' + prefix + ' .captainform_form_toembed').on('change keyup', function () {
75
+ if (window.captainform_is_widget_page == true)
76
+ var formid = jQuery(this).closest('.captainform_widget_container').find('.captainform_widget_select').val();
77
+ else
78
+ var formid = document.getElementById('captainform_form_toembed').options[document.getElementById('captainform_form_toembed').selectedIndex].value;
79
+ var display_as_lightbox = jQuery(this).closest('.captainform_widget_container').find('.cf_display_as_lightbox').is(':checked');
80
+ var code = '[captainform id="' + formid+'"';
81
+ if (display_as_lightbox == true)
82
+ {
83
+ code += ' lightbox="1" ';
84
+ var selected_trigger = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger:checked').val();
85
+ switch (selected_trigger)
86
+ {
87
+ case '0' : //text
88
+ var text_selected = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_0_text').val();
89
+ code += 'text_content="' + encodeURIComponent(text_selected) + '" type="text"';
90
+ break;
91
+ case '1': //image
92
+ var image_obj = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_1_url');
93
+ var image_url = image_obj.val();
94
+ code += 'url="' + encodeURI(image_url) + '" type="image"';
95
+ break;
96
+ case '2': //floating button
97
+ var text = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_text').val();
98
+ var position = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_position:checked').val();
99
+ var background_color = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_background_color').val();
100
+ var text_color = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_color').val();
101
+
102
+ code += 'text_content="' + encodeURIComponent(text) + '" ';
103
+ code += 'bg_color="' + background_color + '" ';
104
+ code += 'text_color="' + text_color + '" ';
105
+
106
+ switch (position)
107
+ {
108
+ case '1':
109
+ code += 'position="left" ';
110
+ break;
111
+ case '2':
112
+ code += 'position="right" ';
113
+ break;
114
+ case '3':
115
+ code += 'position="bottom" ';
116
+ break;
117
+ default:
118
+ code += 'position="left" ';
119
+ }
120
+ code += 'type="floating-button"';
121
+ break;
122
+ case '3': //Auto popup
123
+ var after = jQuery(this).closest('.captainform_widget_container').find('.cf_trigger_2_time').val() * 1000;
124
+ if(after <= 0)
125
+ after = 3000;
126
+ if (after != '')
127
+ code += 'miliseconds="' + after + '" ';
128
+ else
129
+ code += 'miliseconds="' + 3000 + '" ';
130
+ code += 'type="auto-popup"';
131
+ break;
132
+ }
133
+ }
134
+ code += ']';
135
+
136
+ if (window.captainform_is_widget_page == true)
137
+ jQuery(this).closest('.captainform_widget_container').find('.cf_generated_code').val(code);
138
+ else
139
+ jQuery('.cf_generated_code').val(code);
140
+
141
+ });
142
+ }
143
+
144
+ function bind_searchable(prefix)
145
+ {
146
+ try {
147
+ jQuery(prefix + '.captainform_widget_select').chosen({search_contains: true, no_results_text: 'No results match'});
148
+ jQuery(prefix + '.captainform_widget_container').find('.chosen-container.chosen-container-single').each(function () {
149
+ if (jQuery(this).parent().find('.chosen-container.chosen-container-single').length > 1)
150
+ {
151
+ jQuery(this).parent().find('.chosen-container.chosen-container-single').last().remove();
152
+ }
153
+ });
154
+ }
155
+ catch (err)
156
+ {
157
+ }
158
+ }
159
+
160
+ jQuery(document).ajaxComplete(function (event, XMLHttpRequest, ajaxOptions) {
161
+ var request = {}, pairs, i, split, widget;
162
+ if(typeof ajaxOptions.data != 'undefined')
163
+ {
164
+ pairs = ajaxOptions.data.split('&');
165
+ for (i in pairs) {
166
+ split = pairs[i].split('=');
167
+ request[decodeURIComponent(split[0])] = decodeURIComponent(split[1]);
168
+ }
169
+ }
170
+ if ((request.action && (request.action === 'save-widget') && (typeof request['widget-id'] != 'undefined') && (request['widget-id'].indexOf('captainformwidget') != -1))|| (typeof request.wp_customize != 'undefined' && request.wp_customize == 'on')) {
171
+ var my_widget_id = request['widget-id'];
172
+ var widget_div_id = null;
173
+ var bind_captainform_widgets = false;
174
+ if(typeof request.wp_customize != 'undefined' && request.wp_customize == 'on'){
175
+ bind_captainform_widgets = true;
176
+ }
177
+ else{
178
+ jQuery('.widget').each(function () {
179
+ if (jQuery(this).attr('id').match(new RegExp(my_widget_id))) {
180
+ widget_div_id = jQuery(this).attr('id');
181
+ }
182
+ });
183
+ if (widget_div_id != null)
184
+ bind_captainform_widgets =true;
185
+ }
186
+ if(bind_captainform_widgets == true)
187
+ captainform_bind_widget(widget_div_id);
188
+ }
189
+ });
190
+
191
+ function captainform_test_valid_image(url, object, timeout) {
192
+ timeout = timeout || 5000;
193
+ var timedOut = false, timer;
194
+ var img = new Image();
195
+ img.onerror = img.onabort = function () {
196
+ if (!timedOut) {
197
+ clearTimeout(timer);
198
+ jQuery(object).addClass('cf_red_border'); //error
199
+ }
200
+ };
201
+ img.onload = function () {
202
+ if (!timedOut) {
203
+ clearTimeout(timer);
204
+ jQuery(object).removeClass('cf_red_border'); //success
205
+ }
206
+ };
207
+ img.src = url;
208
+ timer = setTimeout(function () {
209
+ timedOut = true;
210
+ jQuery(object).addClass('cf_red_border'); //timeout
211
+ }, timeout);
212
+ }
includes/settings.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+ global $captainform_plugin_name,
4
+ $captainform_plugin_version,
5
+ $captainform_formcode_pattern,
6
+ $captainform_replace_patterns,
7
+ $captainform_servicedomain,
8
+ $captainform_option1,
9
+ $captainform_option2,
10
+ $captainform_option3,
11
+ $captainform_widget_text_filter;
12
+
13
+ $captainform_plugin_name = 'captainform';
14
+ $captainform_plugin_version = "1.7.0";
15
+
16
+ //plugin options key name
17
+ $captainform_option1 = $captainform_plugin_name . '_installation_id';
18
+ $captainform_option2 = $captainform_plugin_name . '_installation_key';
19
+ $captainform_option3 = $captainform_plugin_name . '_site_url';
20
+
21
+ //plugin directory
22
+ $captainform_plugin_dir = plugin_dir_url(dirname(__FILE__));
23
+
24
+ //service domain for handler of form code
25
+ $captainform_servicedomain = 'app.captainform.com';
26
+
27
+ $params = array(
28
+ 'captainform_servicedomain' => $captainform_servicedomain,
29
+ 'captainform_plugin_dir' => $captainform_plugin_dir,
30
+ );
31
+
32
+ //Global Resources -- used for every type of embedding
33
+ $captainform_common_js_vars = captainform_getFormResources('global-vars', $params);
34
+ //TinyBox Resources
35
+ $captainform_tinybox_resources = captainform_getFormResources('tinybox-resources', $params);
36
+ //Normal Embedding
37
+ $captainform_formcode_pattern = $captainform_common_js_vars . captainform_getFormResources('normal-embedding', $params);
38
+ //LightBox Embedding [text/image/floating button]
39
+ $captainform_formcode_pattern_lightbox = $captainform_common_js_vars . $captainform_tinybox_resources . captainform_getFormResources('lightbox-embedding', $params);
40
+ //LightBox Embedding [auto-popup]
41
+ $captainform_formcode_pattern_lightbox_auto = $captainform_common_js_vars . $captainform_tinybox_resources . captainform_getFormResources('lightbox-auto-embedding', $params);
42
+
43
+ /**
44
+ * Loads form resources
45
+ * @param string - resource file
46
+ * @param array - array of variables to replace in resource files
47
+ * @return string
48
+ **/
49
+ function captainform_getFormResources($resource, $params = array())
50
+ {
51
+ if (count($params))
52
+ foreach ($params as $key => $val)
53
+ $$key = $val;
54
+
55
+ ob_start();
56
+ include_once("form-resources/$resource.php");
57
+ return ob_get_clean();
58
+ }
59
+
60
+ /**
61
+ * captainform_get_forms validates users based on wordpress app instalattion id and key
62
+ **/
63
+ function captainform_get_forms($publish_method, $count = 2)
64
+ {
65
+ $url = 'http://' . $GLOBALS['captainform_servicedomain'] . '/wp_dispatcher.php?app_id='
66
+ . urlencode(get_site_option($GLOBALS['captainform_option1']))
67
+ . '&app_key=' . urlencode(get_site_option($GLOBALS['captainform_option2']));
68
+
69
+ if ($publish_method && $count == 2)
70
+ $url .= '&publish_method=' . $publish_method;
71
+
72
+ $res = wp_remote_fopen($url);
73
+ if ($res === false)
74
+ return false;
75
+
76
+ return json_decode($res);
77
+ }
78
+
79
+ /**
80
+ * replace patterns into strings that have patterns
81
+ * @param string
82
+ * @param array - associate array - key is pattern, value is string for replace pattern
83
+ * @return string
84
+ **/
85
+ function captainform_replace_patterns($str, $data = null)
86
+ {
87
+ if ($data)
88
+ if (is_array($data)) {
89
+ foreach ($data as $k => $v)
90
+ if ($k)
91
+ $str = str_replace('{{' . strtoupper($k) . '}}', $v, $str);
92
+ }
93
+ return $str;
94
+ }
includes/shortcodes.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function captainform_shortcode_handler($shortcode)
4
+ {
5
+ $custom_options = array(
6
+ 'form_id' => $shortcode[0],
7
+ 'lightbox' => (isset($shortcode['lightbox'])) ? $shortcode['lightbox'] : false,
8
+ 'type' => (isset($shortcode['type'])) ? $shortcode['type'] : null,
9
+ 'content' => (isset($shortcode['content'])) ? $shortcode['content'] : null,
10
+ 'url' => (isset($shortcode['url'])) ? $shortcode['url'] : null,
11
+ 'miliseconds' => (isset($shortcode['miliseconds'])) ? $shortcode['miliseconds'] : null,
12
+ 'text_color' => (isset($shortcode['text_color'])) ? $shortcode['text_color'] : null,
13
+ 'bg_color' => (isset($shortcode['bg_color'])) ? $shortcode['bg_color'] : null,
14
+ 'position' => (isset($shortcode['position'])) ? $shortcode['position'] : null,
15
+ );
16
+
17
+ $shortcode_final = '[captainform ' . $shortcode[0];
18
+ $shortcode_final .= (isset($shortcode['lightbox'])) ? " lightbox='{$shortcode['lightbox']}'" : '';
19
+ $shortcode_final .= (isset($shortcode['type'])) ? " type='{$shortcode['type']}'" : '';
20
+ $shortcode_final .= (isset($shortcode['url'])) ? " url='{$shortcode['url']}'" : '';
21
+ $shortcode_final .= (isset($shortcode['content'])) ? " content='{$shortcode['content']}'" : '';
22
+ $shortcode_final .= (isset($shortcode['miliseconds'])) ? " miliseconds='{$shortcode['miliseconds']}'" : '';
23
+ $shortcode_final .= (isset($shortcode['text_color'])) ? " text_color='{$shortcode['text_color']}'" : '';
24
+ $shortcode_final .= (isset($shortcode['bg_color'])) ? " bg_color='{$shortcode['bg_color']}'" : '';
25
+ $shortcode_final .= (isset($shortcode['position'])) ? " position='{$shortcode['position']}'" : '';
26
+
27
+ $shortcode_final .= ']';
28
+
29
+ $content = captainform_widget_text_filter($shortcode_final, NULL, $custom_options);
30
+ return $content;
31
+ }
32
+
33
+ add_shortcode('captainform', 'captainform_shortcode_handler');
34
+ add_shortcode('captain-form', 'captainform_shortcode_handler');
readme.txt ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Form Builder by CaptainForm ===
2
+
3
+ Contributors: captainform
4
+ Tags: CaptainForm, form builder plugin, drag-and-drop, event registration form, order form, paypal form, quiz, survey, popup form, newsletter subscription, contact form, secured forms
5
+ Requires at least: 3.9
6
+ Tested up to: 4.6
7
+ Stable tag: 1.7.0
8
+
9
+ User-friendly form builder with advanced features. Build any type of form or survey with drag & drop ease and no add-ons required.
10
+
11
+ == Description ==
12
+
13
+ > CaptainForm is a WordPress form builder that provides advanced functionality, is very easy to use and requires no add-ons. The form builder is ideal for building any type of form such as: order forms, registration forms, newsletter subscriptions, surveys, quizzes, user-submitted posts and more. CaptainForm is a form builder integrated with many 3rd party apps and payment processors such as Google Drive, SalesForce, ActiveCampaign, Dropbox, PayPal, Authorize.net, Stripe and many more. Stellar customer support through live chat & email and advanced data security are provided on all service plans, including the free one. This WordPress form builder and survey builder is useful for market research, lead generation, online registration management, payment collection and more.
14
+
15
+ **Some of CaptainForm's superpowers:**
16
+
17
+ * Build fully customizable forms using our drag & drop form editor with more than 30 field types.
18
+ * Depending on your data collection needs you can adapt your form by using simple fields (name, email, checkboxes, radio buttons, phone numbers, etc.) and advanced fields (multiple file upload, digital signature, Google maps, social buttons, terms of service, Likert Scale, password, page break, etc.).
19
+ * Start with a blank form or import one of our 30 form templates, including contact form, order form, feedback form, event registration form, donation form and many more.
20
+ * With our form builder, there are no more addons required, all 3rd party apps and payment integrations are already built in.
21
+ * Collect payments with popular payment gateways like PayPal, PayPal Pro, PayPal Payflow, Authorize.net, Stripe, Braintree, Sage Pay, PayU.ro, Sisow, PayFast, FreshBooks.
22
+ * Our form builder allows you to send collected data automatically to a wide range of 3rd party integrations used for different purposes: MailChimp, SalesForce, Zendesk, Google Drive, WebHook, Evernote, Google Calendar, Google Drive, ExactTarget and many more.
23
+ * Advanced security is a top priority for our web form builder, with CAPTCHA and SSL Encryption available on all plans.
24
+ * Multiple form publishing options are available: publish your forms as posts or pages, publish in a lightbox or add them as a widget.
25
+ * Send form entries to multiple recipients at once and setup custom notifications depending on form data.
26
+ * Setup your web forms to deliver collected data as PDF matching the form layout.
27
+ * Your customers can save the forms as drafts and continue them at a later date.
28
+ * Create complex calculation forms that include mathematical operations and link them to payment gateways with just a few clicks.
29
+ * With our web form builder you have the possibility to create autoresponders and redirect the form user to a custom "Thank you" page after submission.
30
+ * All collected data is available to sort, filter, analyze or export as CSV or PDF.
31
+ * CaptainForm supports Wordpress Multisite.
32
+ * Customer support is free of charge regardless of your plan and available by email and live chat.
33
+
34
+ **There are 4 different service plans available: a free plan and 3 paid plans, working on an annual subscription basis.**
35
+
36
+ * Regular (Free): 3 forms, 15 fields/form, 500 submissions/month, 100MB storage space
37
+ * Apprentice ($35/year): use on 1 site, unlimited forms and fields, 5K submissions/month, 500MB storage space, 5 native apps
38
+ * Master ($95/year): use on 3 sites, unlimited forms and fields, 20K submissions/month, 2GB storage space, 14 native apps
39
+ * Hero ($195/year): use on unlimited sites, unlimited forms and fields, 100K submissions/month, 10GB storage space, 24 native apps, multisite support, payment integration
40
+
41
+ All service plans (including the free one) come with SSL encryption and support by email and chat. View our complete [Features Matrix](http://www.captainform.com/features-matrix/).
42
+
43
+ For more information about our web form builder, visit the Captain at [captainform.com](http://www.captainform.com/?utm_source=WPDirectory&utm_medium=WP&utm_campaign=SubmitWPDirectory&x-channel=media&x-subchannel=partner&x-source=WPDirectory)
44
+
45
+ [youtube https://www.youtube.com/watch?v=FQ043Wq8Vi8]
46
+
47
+ == Installation ==
48
+
49
+ **Here's how you install and activate the CaptainForm plugin:**
50
+
51
+ 1. Download the CaptainForm plugin.
52
+ 2. Upload the .zip file in your WordPress plugin directory.
53
+ 3. Activate the plugin from the "Plugins" menu in WordPress.
54
+ 4. After activating CaptainForm, choose the type of plan you wish to use.
55
+
56
+ [youtube https://www.youtube.com/watch?v=yJBVR7RTz88]
57
+
58
+ == Screenshots ==
59
+
60
+ 1. The CaptainForm template library featuring the most used templates.
61
+ 2. The CaptainForm "My Forms" section.
62
+ 3. Building a "Contact & Lead Form".
63
+ 4. The CaptainForm collection of 3rd party applications.
64
+ 5. A part of the publishing screen, highlighting the popup method of posting a form on your website.
65
+ 6. An example of how the "Event Registration Form" looks inside a web page.
66
+ 7. An example of how the "Newsletter Subscription Form" looks on a website's sidebar menu.
67
+
68
+ == Frequently Asked Questions ==
69
+
70
+ **1. How do I upgrade the plugin?**
71
+
72
+ You need to buy a license key. Choose the service plan that you want to use and click on the Upgrade button. You will be redirected to Avangate - our payment gateway - to fill out an order form with your card information. Once you complete the payment, a license key will be sent to you by email. Next, return to this page, enter your license key into the activation box and hit the Activate button to activate your new plan
73
+
74
+ **2. How do I change service plans?**
75
+
76
+ The same way you have upgraded the plugin the first time. You click on the Upgrade or Downgrade button of the service plan you are interested in and complete the payment in Avangate. You will receive the new license key by email. Return to this page and enter the key in the activation box. Afterwards, hit the Activate button and you are done.
77
+
78
+ **3. How long is the license key valid?**
79
+
80
+ The license key is valid 365 days from the day you bought it. If you do not activate the license key during this period, you will need to buy a new one to upgrade your account.
81
+
82
+ **4. What happens to my old service plan?**
83
+
84
+ If your old service plan needs to be prorated, you will be contacted via email by one of our representatives. Depending on what you choose, you can either get a refund for what is left from your previous plan or receive an extension for your new plan.
85
+
86
+ **5. What type of credit cards are supported?**
87
+
88
+ We support MasterCard, Visa, PayPal, American Express, JCB, Discover/Novus and Diners Club. You can also purchase a license key by bank or wire transfer. You may select any of these options on the payment form.
89
+
90
+ **6. How do I downgrade my plugin to the free account?**
91
+
92
+ To downgrade the plugin, click on the Downgrade button under our Pioneer plan and fill out the cancellation form. All premium features will be deactivated, but you can upgrade again at any time by purchasing a new license key.
93
+
94
+ == Changelog ==
95
+ = 1.7.0 (19 September 2016) =
96
+ * Integration between CaptainForm and Forge
97
+
98
+ = 1.6.1 (07 September 2016) =
99
+ * Interaction design improvements
100
+
101
+ = 1.6 (02 September 2016) =
102
+ * Updated shortcode parameters
103
+
104
+ = 1.5.7 (22 August 2016) =
105
+ * Mac OS optimizations
106
+
107
+ = 1.5.6 (26 July 2016) =
108
+ * Support for special characters in floating button image
109
+
110
+ = 1.5.5 (20 July 2016) =
111
+ * Optimized user-submitted posts
112
+
113
+ = 1.5.4 (14 July 2016) =
114
+ * New popup loader
115
+
116
+ = 1.5.3 (29 June 2016) =
117
+ * Popup preview UX improvements
118
+
119
+ = 1.5.2 (16 June 2016) =
120
+ * Optimized popup width
121
+
122
+ = 1.5.1 (08 June 2016) =
123
+ * New component for popup publishing
124
+
125
+ = 1.5.0 (06 June 2016) =
126
+ * Optimized the process of duplicating and moving sites
127
+
128
+ = 1.4.2 (30 May 2016) =
129
+ * New presentation text
130
+
131
+ = 1.4.1 (18 April 2016) =
132
+ * Enabled SSL encryption for all users by default
133
+ * Optimized the widget publishing method
134
+
135
+ = 1.4 (24 March 2016) =
136
+ * New functionality: Create WordPress users through form submissions
137
+
138
+ = 1.3.6 (16 March 2016) =
139
+ * Popup fix for iPhone devices
140
+
141
+ = 1.3.5 (11 March 2016) =
142
+ * Fixed double loader bug
143
+
144
+ = 1.3.4 (8 March 2016) =
145
+ * Addressed jQuery issue in 2010 theme on WP version 4.4.2
146
+
147
+ = 1.3.3 (4 March 2016) =
148
+ * Improved user experience on small devices
149
+ * Optimized preview mode
150
+ * Start session if it is not started when WP initializes
151
+
152
+ = 1.3.2 (17 February 2016) =
153
+ * Compatibility optimizations for PHP versions below 5.4
154
+
155
+ = 1.3.1 (16 February 2016) =
156
+ * New presentation text
157
+
158
+ = 1.3.0 (16 February 2016) =
159
+ * Security updates for post creation
160
+
161
+ = 1.2.1 (04 February 2016) =
162
+ * Optimized debugging mode
163
+
164
+ = 1.2.0 (01 February 2016) =
165
+ * Unified loaders mechanism
166
+
167
+ = 1.1.9 (01 February 2016) =
168
+ * Added author URI
169
+
170
+ = 1.1.8 (14 January 2016) =
171
+ * Form styling tweaks for a better integration on websites
172
+ * Higher preview flexibility (embedded form or popup form)
173
+ * Updates for the publishing method from pages/posts and widgets
174
+
175
+ = 1.1.7 (07 January 2016) =
176
+ * New alerting system for better usability
177
+ * Optimization of first user experience
178
+ * Updates for compatibility with other plugins
179
+ * Updates for forms included in post excerpts
180
+
181
+ = 1.1.6 (22 December 2015) =
182
+ * Compatibility optimizations for PHP 5.2 and 5.3
183
+
184
+ = 1.1.5 (22 December 2015) =
185
+ * Added new variable to collect referrer
186
+
187
+ = 1.1.4 (19 November 2015) =
188
+ * Updated Iframe Resizer to version 3.5
189
+ * Updated TinyBox design for old themes
190
+ * Eliminated the duplicate Post tab
191
+
192
+ = 1.1.3 (10 November 2015) =
193
+ * Fixed popups for Safari
194
+ * Fixed widget when in theme customization mode
195
+
196
+ = 1.1.2 (04 November 2015) =
197
+ * Performance optimization
198
+ * Updated readme.txt, added screenshots, changed header image
199
+
200
+ = 1.0.0 (02 November 2015) =
201
+ * Initial release
views/credentials_error.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+
4
+ function captainform_draw_credentials_error()
5
+ {
6
+ wp_enqueue_style('captainform_credentials_error', plugins_url('/includes/css/credentials_error.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
7
+ $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
8
+ ?>
9
+ <div id='captainform_credentials_error_wrapper'>
10
+ <div class="captainform_credentials_error_text">
11
+ <strong>Hey there! Looks like you have duplicated your site or moved its location. Do you plan to use CaptainForm at the old location anymore?</strong>
12
+
13
+ <p>
14
+ If you choose Yes, this new website will become a new instance of your CaptainForm account.
15
+ <br />
16
+ If you choose No, then your old URL will be overwritten by this new one.
17
+ </p>
18
+ </div>
19
+
20
+
21
+ <div>
22
+ <form action='//<?=$url?>' method='POST'>
23
+ <input type='hidden' id='captainform_reset_keys' name='captainform_reset_keys' value=2 />
24
+ <button class="button button-primary" onclick="document.getElementById('captainform_reset_keys').value=1;">Yes</button>
25
+ <button class="button button-white" onclick="document.getElementById('captainform_reset_keys').value=0; if (!confirm('Attention! If you are moving your primary website (the one where you first activated a paid license key) or a duplicate of it, CaptainForm will not work at the primary website URL anymore. The website you are currently on will become your new primary website.')) return false;">No</button>
26
+ </form>
27
+ </div>
28
+ </div>
29
+ <?php
30
+ }
views/main.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+
4
+ function captainform_draw_main_iframe($url, $hostinfo)
5
+ {
6
+ global $captainform_wpp_options, $captainform_plugin_version;
7
+ ob_start();
8
+ $rev = uniqid();
9
+ $chost = $hostinfo[0];
10
+ $protocol = $hostinfo[1];
11
+ $chostp = $hostinfo[2];
12
+ ?>
13
+ <script>
14
+ var version = '<?php echo $captainform_plugin_version; ?>';
15
+ var chost = '<?php echo $chost; ?>';
16
+ var chostp = '<?php echo $chostp; ?>';
17
+ var parent_site_url = '<?php echo site_url(); ?>';
18
+ var captainform_plugin_dir = '<?php echo plugins_url('', __DIR__); ?>';
19
+ </script>
20
+ <iframe id="captainform_iframe" src="<?php print $url; ?>"
21
+ style="width:99%; background: transparent; min-height: 700px;" scrolling="no"></iframe>
22
+ <?php
23
+ wp_register_script('captainform_iframe_resizer', plugins_url('/includes/js/iframeResizer.min.js', plugin_dir_path(__FILE__)), array(), '3.5', false);
24
+ wp_register_script('captainform_main_js', plugins_url('/includes/js/main.js', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version, false);
25
+ wp_register_script('captainform_reviews_js', plugins_url('/includes/js/review.js', plugin_dir_path(__FILE__)), array(), $captainform_plugin_version, false);
26
+ wp_enqueue_script('captainform_iframe_resizer');
27
+ wp_enqueue_script('captainform_main_js');
28
+ wp_enqueue_script('captainform_reviews_js');
29
+ wp_enqueue_style('captainform_iframe_popup', plugins_url('/includes/css/iframe_popup.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
30
+ wp_enqueue_style('captainform_review_css', plugins_url('/includes/css/review.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
31
+ $user_agent = getenv("HTTP_USER_AGENT");
32
+ if (strpos($user_agent, "Mac") !== FALSE) {
33
+ wp_enqueue_style('captainform_iframe_popup', plugins_url('/includes/css/wp_captainform_os.css', plugin_dir_path(__FILE__)), false, $captainform_plugin_version);
34
+ }
35
+ ob_end_flush();
36
+ }
views/options_page.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') or die('No direct access!');
3
+
4
+ function captainform_options_page()
5
+ {
6
+ if(isset($_GET['reset']) && $_GET['reset'] == 'true'){
7
+ captainform_generate_new_credentials();
8
+ ?>
9
+ <script>window.location.href = 'options-general.php?page=CaptainFormOptions'</script>
10
+ <?php
11
+ }
12
+ $installation_id = get_site_option($GLOBALS['captainform_option1']);
13
+ $installation_key = get_site_option($GLOBALS['captainform_option2']);
14
+ $site_url = get_site_option($GLOBALS['captainform_option3']);
15
+ ob_start();
16
+ ?>
17
+ <div class="wrap">
18
+ <h1>CaptainForm Settings</h1>
19
+ <h2>Generate New Keys</h2>
20
+ <div>
21
+ <div>
22
+ <p>If you generate new keys, your website will be disconnected from its associated CaptainForm account. You will need to activate a new CaptainForm account.</p>
23
+ <p>Normally, you should not need to generate new keys. Please do this only when our Support Team asks you to do so.</p>
24
+ </div>
25
+ <table class="form-table">
26
+ <tr valign="top">
27
+ <td>Installation ID</td>
28
+ <td><code><?php echo $installation_id ?></code></td>
29
+ </tr>
30
+ <tr valign="top">
31
+ <td>Installation Key</td>
32
+ <td><code><?php echo $installation_key ?></code></td>
33
+ </tr>
34
+ <tr valign="top">
35
+ <td>Site URL</td>
36
+ <td><code><?php echo $site_url ?></code></td>
37
+ </tr>
38
+ <tr valign="top">
39
+ <td></td>
40
+ <td>
41
+ <a onclick="if(!confirm('Are you sure you want to do this? Please hit OK only after talking with our Support team (support@captainform.com).')) return false;" href="options-general.php?page=CaptainFormOptions&reset=true">
42
+ <button class="button button-primary">Generate New Keys</button>
43
+ </a>
44
+ </td>
45
+ </tr>
46
+ </table>
47
+ </div>
48
+ </div>
49
+ <?php
50
+ echo ob_get_clean();
51
+ }
views/publish_lightbox.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="cf_lightbox_cotainer">
2
+ <label class="lightbox_trigger">
3
+ <input type="checkbox" name="<?php echo $captainform_display_as_lightbox_name; ?>" class="cf_display_as_lightbox" value="1" <?php if (isset($display_as_lightbox) && ($display_as_lightbox == 1)): ?> checked="checked"<?php endif; ?>/>
4
+ <span class="lightbox_trigger_text">
5
+ Display as a lightbox
6
+ </span>
7
+ </label>
8
+ <div class="cf_triggers_container">
9
+ <div class="cf_lightbox_title">
10
+ <b>Lightbox trigger</b>
11
+ </div>
12
+ <div class="row">
13
+ <div class="cf_trigger_option">
14
+ <label>
15
+ <input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" <?php if ($captainform_selected_trigger == 0): ?> checked="checked" <?php endif; ?> class="cf_trigger" value="0" />
16
+ Text
17
+ </label>
18
+ </div>
19
+ <div class="cf_trigger_option">
20
+ <label>
21
+ <input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" class="cf_trigger" <?php if ($captainform_selected_trigger == 1): ?> checked="checked" <?php endif; ?> value="1" />
22
+ Click on image
23
+ </label>
24
+ </div>
25
+ <div class="cf_trigger_option">
26
+ <label>
27
+ <input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" class="cf_trigger" <?php if ($captainform_selected_trigger == 2): ?> checked="checked" <?php endif; ?> value="2" />
28
+ Floating button
29
+ </label>
30
+ </div>
31
+ <div class="cf_trigger_option">
32
+ <label>
33
+ <input type="radio" name="<?php echo $captainform_trigger_option_name; ?>" class="cf_trigger" <?php if ($captainform_selected_trigger == 3): ?> checked="checked" <?php endif; ?> value="3" />
34
+ Auto popup
35
+ </label>
36
+ </div>
37
+ </div>
38
+ <div class="cf_trigger_selected_option_container_big">
39
+ <div class="cf_trigger_selected_option_title">
40
+ Settings
41
+ </div>
42
+ <div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_0">
43
+ <!-- text -->
44
+ <div class="left">
45
+ <span class="label">
46
+ Text:
47
+ </span>
48
+ </div>
49
+ <div class="right">
50
+ <input type="text" name="<?php echo $captainform_trigger_0_name; ?>" class="cf_trigger_selected_option cf_trigger_0_text" value="<?php echo $captainform_trigger_0_text; ?>"/>
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+ <div class="clear"></div>
55
+
56
+ <div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_1">
57
+ <!-- image -->
58
+ <div class="left">
59
+ <span class="label">
60
+ Image :
61
+ </span>
62
+ </div>
63
+ <div class="right">
64
+ <input type="text" name="<?php echo $captainform_trigger_1_name; ?>" class="cf_trigger_1_url" value="<?php echo $captainform_trigger_1_url; ?>"/>
65
+ </div>
66
+ <div class="clear"></div>
67
+ </div>
68
+ <div class="clear"></div>
69
+
70
+ <div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_2">
71
+ <!-- floating button -->
72
+ <div class="left">
73
+ <span class="label">
74
+ Text:
75
+ </span>
76
+ </div>
77
+ <div class="right">
78
+ <input type="text" name="<?php echo $captainform_trigger_2_text_name; ?>" class="cf_trigger_2_text" value="<?php echo $captainform_trigger_2_text; ?>" />
79
+ </div>
80
+ <div class="clear"></div>
81
+
82
+ <div class="left">
83
+ <span class="label">
84
+ Position:
85
+ </span>
86
+ </div>
87
+ <div class="cf_trigger_2_container right">
88
+ <label class = "cf_trigger_2_label">
89
+ <input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>" class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 1): ?> checked="checked" <?php endif; ?> value="1" />
90
+ Left
91
+ </label>
92
+ <label class = "cf_trigger_2_label">
93
+ <input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>" class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 2): ?> checked="checked" <?php endif; ?> value="2" />
94
+ Right
95
+ </label>
96
+ <label class = "cf_trigger_2_label">
97
+ <input type="radio" name="<?php echo $captainform_trigger_2_position_name; ?>" class="cf_trigger_2_position" <?php if ($captainform_trigger_2_position == 3): ?> checked="checked" <?php endif; ?> value="3" />
98
+ Bottom
99
+ </label>
100
+ </div>
101
+ <div class="clear"></div>
102
+
103
+ <div class="left">
104
+ <span class="label">
105
+ Background color:
106
+ </span>
107
+ </div>
108
+ <div class="right">
109
+ <input type="text" name="<?php echo $captainform_trigger_2_background_name; ?>" class="color cf_trigger_2_background_color" value="<?php echo $captainform_trigger_2_background; ?>"/>
110
+ </div>
111
+ <div class="clear"></div>
112
+
113
+ <div class="left">
114
+ <span class="label">
115
+ Text color:
116
+ </span>
117
+ </div>
118
+ <div class="right">
119
+ <input type="text" name="<?php echo $captainform_trigger_2_color_name; ?>" class="color cf_trigger_2_color" value="<?php echo $captainform_trigger_2_color; ?>"/>
120
+ </div>
121
+ <div class="clear"></div>
122
+ </div>
123
+ <div class="clear"></div>
124
+
125
+ <div class="cf_trigger_selected_option_container cf_trigger_selected_option_cotainter_3">
126
+ <!-- auto popup -->
127
+ <div class="left">
128
+ <span class="label">
129
+ After :
130
+ </span>
131
+ </div>
132
+ <div class="right">
133
+ <input type="text" name="<?php echo $captainform_trigger_3_after_name; ?>" class="cf_trigger_selected_option cf_trigger_2_time" value="<?php echo $captainform_trigger_3_after; ?>"/>
134
+ <span class="captainform_seconds">seconds</span>
135
+ </div>
136
+ <div class="clear"></div>
137
+ </div>
138
+ <div class="clear"></div>
139
+ </div>
140
+
141
+ </div>
142
+ </div>