Version Description
Download this release
Release Info
Developer | TemplateMonster 2002 |
Plugin | Cherry Sidebars |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- LICENSE +675 -0
- README.md +4 -0
- admin/assets/css/cherry-admin-sidebars.css +1 -0
- admin/assets/css/cherry-sidebars-post-page.css +1 -0
- admin/assets/css/interface-builder.css +90 -0
- admin/assets/js/cherry-admin-sidebars.js +173 -0
- admin/assets/js/min/cherry-admin-sidebars.min.js +1 -0
- admin/assets/scss/cherry-admin-sidebars.scss +197 -0
- admin/assets/scss/cherry-sidebars-post-page.scss +6 -0
- admin/includes/class-cherry-custom-sidebar.php +249 -0
- admin/includes/class-cherry-sidebar-utils.php +80 -0
- admin/includes/class-cherry-sidebars-admin.php +146 -0
- admin/includes/index.php +9 -0
- admin/views/cherry-new-sidebar.php +163 -0
- admin/views/cherry-widgets-page.php +141 -0
- admin/views/index.php +9 -0
- cherry-framework/.gitignore +30 -0
- cherry-framework/README.md +2 -0
- cherry-framework/cherry-core.php +481 -0
- cherry-framework/codesniffer.ruleset.xml +24 -0
- cherry-framework/config.json +189 -0
- cherry-framework/modules/cherry-js-core/assets/js/cherry-js-core.js +170 -0
- cherry-framework/modules/cherry-js-core/assets/js/min/cherry-js-core.min.js +1 -0
- cherry-framework/modules/cherry-js-core/cherry-js-core.php +184 -0
- cherry-framework/modules/cherry-toolkit/cherry-toolkit.php +208 -0
- cherry-framework/modules/cherry-ui-elements/cherry-ui-elements.php +152 -0
- cherry-framework/modules/cherry-ui-elements/i-ui.php +45 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/min/ui-checkbox.min.css +56 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/min/ui-checkbox.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-checkbox.js +73 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-checkbox.scss +52 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/ui-checkbox.php +130 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/min/ui-colorpicker.min.css +41 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/min/ui-colorpicker.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.js +24 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.scss +53 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/ui-colorpicker.php +98 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/jquery-iconpicker.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/ui-iconpicker.min.css +326 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/ui-iconpicker.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-iconpicker.js +37 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-iconpicker.scss +324 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/ui-iconpicker.php +279 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/min/ui-media.min.css +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/min/ui-media.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-kit/_mixins.scss +184 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-media.js +158 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-media.scss +158 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/ui-media.php +165 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/min/ui-radio.min.css +67 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/min/ui-radio.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-kit/_mixins.scss +166 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-kit/_variables.scss +21 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-radio.js +52 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-radio.scss +78 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/ui-radio.php +130 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/min/ui-repeater.min.css +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/min/ui-repeater.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-kit/_mixins.scss +166 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-kit/_variables.scss +21 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-repeater.js +174 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-repeater.scss +137 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/ui-repeater.php +327 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/select2.min.css +103 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/select2.min.js +3 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/ui-select.min.css +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/ui-select.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/select2.css +484 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/select2.js +5725 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-select.js +28 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-select.scss +112 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/ui-select.php +179 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/min/ui-slider.min.css +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/min/ui-slider.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-slider.js +25 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-slider.scss +126 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/ui-slider.php +117 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/min/ui-stepper.min.css +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/ui-stepper.scss +24 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/ui-stepper.php +93 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/min/ui-switcher.min.css +80 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/min/ui-switcher.min.js +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-switcher.js +60 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-switcher.scss +101 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/ui-switcher.php +107 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/min/ui-text.min.css +20 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/ui-text.scss +13 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/ui-text.php +99 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/min/ui-textarea.min.css +22 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/ui-kit/_variables.scss +23 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/ui-textarea.scss +15 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/ui-textarea.php +88 -0
- cherry-framework/modules/cherry-ui-elements/ui-element.php +94 -0
- cherry-framework/setup.php +44 -0
- cherry-sidebars.php +245 -0
- includes/class-cherry-include-sidebars.php +93 -0
- includes/index.php +9 -0
- index.php +9 -0
- languages/cherry-sidebars.pot +80 -0
- readme.txt +47 -0
- wpml-config.xml +5 -0
LICENSE
ADDED
@@ -0,0 +1,675 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
{project} Copyright (C) {year} {fullname}
|
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>.
|
675 |
+
|
README.md
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Cherry Sidebars [![Build Status](https://travis-ci.org/CherryFramework/cherry-sidebars.svg?branch=master)](https://travis-ci.org/CherryFramework/cherry-sidebars)
|
2 |
+
Plugin for creating and managing sidebars in WordPress.
|
3 |
+
|
4 |
+
Сompatibility: __Cherry Framework v.4+__
|
admin/assets/css/cherry-admin-sidebars.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-display-none{display:none}.description.cherry-default-description{padding:0 0 15px;margin:0;font-style:normal;color:#777}#default-sidebars:after{content:".";display:block;height:0;clear:both;visibility:hidden}#cherry-sidebars-wrap{margin-top:10px}#cherry-sidebars-wrap .sidebar-manager-name h3{padding:10px 0;margin:0 10px 0 0}#cherry-default-sidebars-title h3{padding:10px 0;margin:12px 0 0 0}.sidebar-manager-name{cursor:pointer;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.sidebar-manager-name .sidebar-name-arrow{display:none}.sidebar-manager-name .sidebar-name-arrow:before{right:12px;padding:4px 6px 4px 4px;font:400 20px/1 dashicons;speak:none;display:inline-block;padding:8px 10px;top:0;position:relative;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none !important;content:'\f142'}.sidebar-manager-name .sidebar-name-arrow.closed-arrow{display:block;color:#777}.sidebar-manager-name .sidebar-name-arrow.closed-arrow:before{content:'\f140'}.sidebar-manager-name:hover .sidebar-name-arrow{display:block}.sidebars-holder.closed{display:none}#create-new-sidebar-manager form#cherry-sidebars-form{border-top:1px solid #d4d5d6}#create-new-sidebar-manager form#cherry-sidebars-form .cherry-section{padding:15px;border:none}#create-new-sidebar-manager form#cherry-sidebars-form .cherry-section .cherry-col-1{width:24%}#create-new-sidebar-manager form#cherry-sidebars-form .cherry-section .cherry-col-1 label{margin:11px 0 0 0}#create-new-sidebar-manager form#cherry-sidebars-form .cherry-section .cherry-col-2 input[type=text]:-webkit-autofill{-webkit-box-shadow:inset 0 0 0 50px #fff;box-shadow:inset 0 0 0 50px #fff}#create-new-sidebar-manager form#cherry-sidebars-form #cherry-error-message{display:none;color:red;position:absolute;right:170px;bottom:40px}.cherry-ui-core input[type=text].error-invalid{border:1px solid red}.cherry-widgets-holder-wrap{position:relative}.cherry-widgets-holder-wrap .cherry-delete-sidebar-manager{position:absolute;right:48px;top:0px;height:35px;border:1px solid #e5e5e5;border-top:none;padding:14px 14px 0;color:#a0a5aa;z-index:1;cursor:pointer}.cherry-widgets-holder-wrap .cherry-delete-sidebar-manager:hover{color:red}.cherry-widgets-holder-wrap .sidebar-name-arrow{border:1px solid #e5e5e5;padding:3px 5px 0px 3px;top:0px;right:-9px;border-left:none;height:46px;border-top:none}.cherry-widgets-holder-wrap .spinner-wordpress-type-1.cherry-spinner-wordpress{right:12px;bottom:12px}body.widgets_access .sidebar-manager-name{cursor:default}body.widgets_access .sidebar-name-arrow{display:none !important}body.widgets_access .cherry-widgets-holder-wrap .cherry-delete-sidebar-manager{right:-1px}.spinner-wordpress-type-1.cherry-spinner-wordpress{display:none;background-color:#f62e46;width:25px;height:25px;border-radius:30px;position:absolute}#cherry-sidebars-form .spinner-wordpress-type-1.cherry-spinner-wordpress{right:160px;bottom:28px}.cherry-spinner-wordpress.spinner-wordpress-type-1{-webkit-animation:cherry-innerCircle 1s linear infinite;animation:cherry-innerCircle 1s linear infinite}.cherry-spinner-wordpress.spinner-wordpress-type-1 .cherry-inner-circle{display:block;background-color:#fff;width:8px;height:8px;position:absolute;border-radius:8px;top:4px;left:4px}@-webkit-keyframes cherry-innerCircle{0%{-webkit-transform:rotate(o);transform:rotate(o)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes sk-innerCircle{0%{-webkit-transform:rotate(o);transform:rotate(o)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes sk-innerCircle{0%{-webkit-transform:rotate(o);transform:rotate(o)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
|
admin/assets/css/cherry-sidebars-post-page.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.postbox .cherry-sidebar-select{border-top:none;padding:0px;position:relative}
|
admin/assets/css/interface-builder.css
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-section {
|
2 |
+
border-top: 1px solid #d4d5d6;
|
3 |
+
padding: 18px;
|
4 |
+
position: relative;
|
5 |
+
/*Cherry column style*/
|
6 |
+
/*End Cherry column style*/
|
7 |
+
/*Text input, textarea, select size*/
|
8 |
+
/*End text input size*/
|
9 |
+
}
|
10 |
+
.cherry-section .cherry-title {
|
11 |
+
margin: 14px 0 14px 0;
|
12 |
+
}
|
13 |
+
.cherry-section .cherry-title:first-letter {
|
14 |
+
text-transform: uppercase;
|
15 |
+
}
|
16 |
+
.cherry-section .cherry-label {
|
17 |
+
margin: 0 0 5px 0;
|
18 |
+
display: block;
|
19 |
+
}
|
20 |
+
.cherry-section .cherry-label:first-letter {
|
21 |
+
text-transform: uppercase;
|
22 |
+
}
|
23 |
+
.cherry-section .cherry-description {
|
24 |
+
display: block;
|
25 |
+
font-size: 11px;
|
26 |
+
color: #999;
|
27 |
+
clear: left;
|
28 |
+
}
|
29 |
+
.cherry-section .cherry-description:first-letter {
|
30 |
+
text-transform: uppercase;
|
31 |
+
}
|
32 |
+
.cherry-section .cherry-col-1, .cherry-section .cherry-col-2 {
|
33 |
+
display: inline-block;
|
34 |
+
position: relative;
|
35 |
+
vertical-align: top;
|
36 |
+
}
|
37 |
+
.cherry-section .cherry-col-1 {
|
38 |
+
width: 25%;
|
39 |
+
}
|
40 |
+
.cherry-section .cherry-col-1 label {
|
41 |
+
margin-right: 60px;
|
42 |
+
}
|
43 |
+
.cherry-section .cherry-col-1 small {
|
44 |
+
margin-right: 60px;
|
45 |
+
}
|
46 |
+
@media screen and (max-width: 782px) {
|
47 |
+
.cherry-section .cherry-col-1 {
|
48 |
+
width: 100%;
|
49 |
+
margin: 0 0 10px 0;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
.cherry-section .cherry-col-2 {
|
53 |
+
width: 75%;
|
54 |
+
}
|
55 |
+
@media screen and (max-width: 782px) {
|
56 |
+
.cherry-section .cherry-col-2 {
|
57 |
+
width: 100%;
|
58 |
+
margin: 0 0 10px 0;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
.cherry-section .cherry-element-wrap {
|
62 |
+
position: relative;
|
63 |
+
overflow: hidden;
|
64 |
+
}
|
65 |
+
.cherry-section .cherry-element-wrap .cherry-stepper-input {
|
66 |
+
max-width: 100px;
|
67 |
+
}
|
68 |
+
.cherry-section .cherry-block {
|
69 |
+
display: block;
|
70 |
+
}
|
71 |
+
.cherry-section .width-small {
|
72 |
+
max-width: 250px;
|
73 |
+
width: 100%;
|
74 |
+
}
|
75 |
+
.cherry-section .width-medium {
|
76 |
+
max-width: 500px;
|
77 |
+
width: 100%;
|
78 |
+
}
|
79 |
+
.cherry-section .width-full {
|
80 |
+
width: 100%;
|
81 |
+
}
|
82 |
+
.cherry-section .hint-text {
|
83 |
+
position: absolute;
|
84 |
+
top: 0;
|
85 |
+
right: 10px;
|
86 |
+
}
|
87 |
+
.cherry-section.single-section {
|
88 |
+
padding: 0;
|
89 |
+
border: none;
|
90 |
+
}
|
admin/assets/js/cherry-admin-sidebars.js
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
// Form Handling Module
|
5 |
+
var formHandling = {
|
6 |
+
submitButton: null,
|
7 |
+
spinner: null,
|
8 |
+
errorMessage: null,
|
9 |
+
form: null,
|
10 |
+
btnNewSidebar: null,
|
11 |
+
btnRemoveSidebar: null,
|
12 |
+
customSidebarHolder1: null,
|
13 |
+
customSidebarHolder2: null,
|
14 |
+
ajaxRequest: null,
|
15 |
+
newSidebarData: {
|
16 |
+
action: 'add_new_custom_sidebar',
|
17 |
+
security: window.cherryFramework.ajax_nonce_new_sidebar,
|
18 |
+
formdata:{}
|
19 |
+
},
|
20 |
+
removeSidebarData: {
|
21 |
+
action: 'remove_custom_sidebar',
|
22 |
+
id: '',
|
23 |
+
security: window.cherryFramework.ajax_nonce_remove_sidebar
|
24 |
+
},
|
25 |
+
|
26 |
+
// Init function
|
27 |
+
init: function() {
|
28 |
+
|
29 |
+
// Init variable
|
30 |
+
var formHandling = this;
|
31 |
+
|
32 |
+
formHandling.form = $( '#cherry-sidebars-form' );
|
33 |
+
formHandling.submitButton = $( '#sidebar-manager-submit', formHandling.form );
|
34 |
+
formHandling.spinner = $( '.spinner-wordpress-type-1', formHandling.form );
|
35 |
+
formHandling.errorMessage = $( '#cherry-error-message', formHandling.form );
|
36 |
+
formHandling.customSidebarHolder1 = $( '#cherry-sidebars-holder .sidebars-column-1' );
|
37 |
+
formHandling.customSidebarHolder2 = $( '#cherry-sidebars-holder .sidebars-column-2' );
|
38 |
+
formHandling.btnNewSidebar = $( '.btn-create-sidebar.thickbox' );
|
39 |
+
formHandling.btnRemoveSidebar = $( '.cherry-delete-sidebar-manager' );
|
40 |
+
|
41 |
+
// Added handler
|
42 |
+
formHandling.submitButton.on( 'click', formHandling.submitByttonHandler );
|
43 |
+
formHandling.btnNewSidebar.on( 'click', formHandling.openThickBox );
|
44 |
+
formHandling.btnRemoveSidebar.on( 'click', formHandling.removeCustomSidebar );
|
45 |
+
|
46 |
+
$.ajaxSetup( {
|
47 |
+
type: 'GET',
|
48 |
+
url: window.ajaxurl,
|
49 |
+
cache: false
|
50 |
+
} );
|
51 |
+
},
|
52 |
+
openThickBox: function() {
|
53 |
+
$( 'input[type="text"]', formHandling.form ).removeClass( 'error-invalid' );
|
54 |
+
},
|
55 |
+
submitByttonHandler: function() {
|
56 |
+
|
57 |
+
// Validated form
|
58 |
+
var formData = formHandling.form.serializeArray(),
|
59 |
+
key,
|
60 |
+
object,
|
61 |
+
input;
|
62 |
+
|
63 |
+
for ( key in formData ) {
|
64 |
+
object = formData[ key ];
|
65 |
+
input = $( 'input[name="' + object.name + '"]', formHandling.form );
|
66 |
+
|
67 |
+
if ( ! object.value && input.hasClass( 'required' ) ) {
|
68 |
+
input.addClass( 'error-invalid' );
|
69 |
+
} else {
|
70 |
+
input.removeClass( 'error-invalid' );
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
if ( ! $( '.error-invalid', formHandling.form )[0] ) {
|
75 |
+
formHandling.newSidebarData.formdata = formData;
|
76 |
+
formHandling.aJaxRequestNewSitebar();
|
77 |
+
}
|
78 |
+
|
79 |
+
return ! 1;
|
80 |
+
},
|
81 |
+
reInitWidgets: function() {
|
82 |
+
$( '#widgets-right .sidebar-name' ).off( 'click' );
|
83 |
+
$( '#widgets-left .sidebar-name' ).off( 'click' );
|
84 |
+
$( 'body' ).off( 'click.widgets-toggle' );
|
85 |
+
$( '.widgets-chooser' ).off( 'click.widgets-chooser' ).off( 'keyup.widgets-chooser' );
|
86 |
+
$( '#available-widgets .widget .widget-title' ).off( 'click.widgets-chooser' );
|
87 |
+
|
88 |
+
$( '.widgets-chooser-sidebars > li' ).remove();
|
89 |
+
|
90 |
+
if ( window.wpWidgets ) {
|
91 |
+
window.wpWidgets.hoveredSidebar = null;
|
92 |
+
window.wpWidgets.init();
|
93 |
+
}
|
94 |
+
},
|
95 |
+
aJaxRequestNewSitebar: function() {
|
96 |
+
|
97 |
+
// Add new sidebar aJax request
|
98 |
+
formHandling.ajaxRequest = $.ajax( {
|
99 |
+
data: formHandling.newSidebarData,
|
100 |
+
beforeSend: function() {
|
101 |
+
formHandling.submitButton.attr( { 'disabled':true } );
|
102 |
+
formHandling.spinner.css( { 'display':'block' } );
|
103 |
+
|
104 |
+
if ( formHandling.ajaxRequest ) {
|
105 |
+
formHandling.ajaxRequest.abort();
|
106 |
+
}
|
107 |
+
},
|
108 |
+
success: function( response ) {
|
109 |
+
var sidebarCounter1 = $( '.widgets-holder-wrap', formHandling.customSidebarHolder1 ).length,
|
110 |
+
sidebarCounter2 = $( '.widgets-holder-wrap', formHandling.customSidebarHolder2 ).length,
|
111 |
+
newSidebar = $( response );
|
112 |
+
|
113 |
+
if ( sidebarCounter1 <= sidebarCounter2 ) {
|
114 |
+
formHandling.customSidebarHolder1.append( newSidebar );
|
115 |
+
} else {
|
116 |
+
formHandling.customSidebarHolder2.append( newSidebar );
|
117 |
+
}
|
118 |
+
|
119 |
+
$( '.cherry-delete-sidebar-manager', newSidebar ).on( 'click', formHandling.removeCustomSidebar );
|
120 |
+
|
121 |
+
$( 'input[type="text"]', formHandling.form ).val( '' );
|
122 |
+
$( '.tb-close-icon' ).trigger( 'click' );
|
123 |
+
|
124 |
+
formHandling.reInitWidgets();
|
125 |
+
},
|
126 |
+
complete: function() {
|
127 |
+
formHandling.spinner.delay( 200 ).css( { 'display':'none' } );
|
128 |
+
formHandling.submitButton.attr( { 'disabled':false } );
|
129 |
+
},
|
130 |
+
error: function() {
|
131 |
+
formHandling.errorMessage.css( { 'display':'block' } ).delay( 3000 ).fadeOut( 800, 0 );
|
132 |
+
}
|
133 |
+
} );
|
134 |
+
},
|
135 |
+
|
136 |
+
// Remove button handler
|
137 |
+
removeCustomSidebar: function() {
|
138 |
+
var customSidebar = $( this ).parents( '.cherry-widgets-holder-wrap' );
|
139 |
+
|
140 |
+
formHandling.removeSidebarData.id = $( '.widgets-sortables', customSidebar ).attr( 'id' );
|
141 |
+
|
142 |
+
formHandling.requestRemoveSidebar( customSidebar );
|
143 |
+
},
|
144 |
+
|
145 |
+
// Remove sidebar aJax request
|
146 |
+
requestRemoveSidebar: function( sidebar ) {
|
147 |
+
formHandling.ajaxRequest = $.ajax( {
|
148 |
+
data: formHandling.removeSidebarData,
|
149 |
+
beforeSend: function() {
|
150 |
+
$( '.cherry-spinner-wordpress', sidebar ).css( { 'display':'block' } );
|
151 |
+
},
|
152 |
+
success: function() {
|
153 |
+
sidebar.remove();
|
154 |
+
formHandling.reInitWidgets();
|
155 |
+
}
|
156 |
+
} );
|
157 |
+
}
|
158 |
+
};
|
159 |
+
|
160 |
+
$( document ).ready( function() {
|
161 |
+
|
162 |
+
formHandling.init();
|
163 |
+
|
164 |
+
// Add handler on sidebar wrapper title
|
165 |
+
$( 'body:not(.widgets_access) .sidebar-manager-name' ).on( 'click', function() {
|
166 |
+
var _this = $( this );
|
167 |
+
|
168 |
+
$( '~ .sidebars-holder', _this ).toggleClass( 'closed' );
|
169 |
+
$( '.sidebar-name-arrow', _this ).toggleClass( 'closed-arrow' );
|
170 |
+
} );
|
171 |
+
|
172 |
+
});
|
173 |
+
}( jQuery ) );
|
admin/assets/js/min/cherry-admin-sidebars.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e){"use strict";var r={submitButton:null,spinner:null,errorMessage:null,form:null,btnNewSidebar:null,btnRemoveSidebar:null,customSidebarHolder1:null,customSidebarHolder2:null,ajaxRequest:null,newSidebarData:{action:"add_new_custom_sidebar",security:window.cherryFramework.ajax_nonce_new_sidebar,formdata:{}},removeSidebarData:{action:"remove_custom_sidebar",id:"",security:window.cherryFramework.ajax_nonce_remove_sidebar},init:function(){var r=this;r.form=e("#cherry-sidebars-form"),r.submitButton=e("#sidebar-manager-submit",r.form),r.spinner=e(".spinner-wordpress-type-1",r.form),r.errorMessage=e("#cherry-error-message",r.form),r.customSidebarHolder1=e("#cherry-sidebars-holder .sidebars-column-1"),r.customSidebarHolder2=e("#cherry-sidebars-holder .sidebars-column-2"),r.btnNewSidebar=e(".btn-create-sidebar.thickbox"),r.btnRemoveSidebar=e(".cherry-delete-sidebar-manager"),r.submitButton.on("click",r.submitByttonHandler),r.btnNewSidebar.on("click",r.openThickBox),r.btnRemoveSidebar.on("click",r.removeCustomSidebar),e.ajaxSetup({type:"GET",url:window.ajaxurl,cache:!1})},openThickBox:function(){e('input[type="text"]',r.form).removeClass("error-invalid")},submitByttonHandler:function(){var a,i,t,o=r.form.serializeArray();for(a in o)i=o[a],t=e('input[name="'+i.name+'"]',r.form),!i.value&&t.hasClass("required")?t.addClass("error-invalid"):t.removeClass("error-invalid");return e(".error-invalid",r.form)[0]||(r.newSidebarData.formdata=o,r.aJaxRequestNewSitebar()),!1},reInitWidgets:function(){e("#widgets-right .sidebar-name").off("click"),e("#widgets-left .sidebar-name").off("click"),e("body").off("click.widgets-toggle"),e(".widgets-chooser").off("click.widgets-chooser").off("keyup.widgets-chooser"),e("#available-widgets .widget .widget-title").off("click.widgets-chooser"),e(".widgets-chooser-sidebars > li").remove(),window.wpWidgets&&(window.wpWidgets.hoveredSidebar=null,window.wpWidgets.init())},aJaxRequestNewSitebar:function(){r.ajaxRequest=e.ajax({data:r.newSidebarData,beforeSend:function(){r.submitButton.attr({disabled:!0}),r.spinner.css({display:"block"}),r.ajaxRequest&&r.ajaxRequest.abort()},success:function(a){var i=e(".widgets-holder-wrap",r.customSidebarHolder1).length,t=e(".widgets-holder-wrap",r.customSidebarHolder2).length,o=e(a);t>=i?r.customSidebarHolder1.append(o):r.customSidebarHolder2.append(o),e(".cherry-delete-sidebar-manager",o).on("click",r.removeCustomSidebar),e('input[type="text"]',r.form).val(""),e(".tb-close-icon").trigger("click"),r.reInitWidgets()},complete:function(){r.spinner.delay(200).css({display:"none"}),r.submitButton.attr({disabled:!1})},error:function(){r.errorMessage.css({display:"block"}).delay(3e3).fadeOut(800,0)}})},removeCustomSidebar:function(){var a=e(this).parents(".cherry-widgets-holder-wrap");r.removeSidebarData.id=e(".widgets-sortables",a).attr("id"),r.requestRemoveSidebar(a)},requestRemoveSidebar:function(a){r.ajaxRequest=e.ajax({data:r.removeSidebarData,beforeSend:function(){e(".cherry-spinner-wordpress",a).css({display:"block"})},success:function(){a.remove(),r.reInitWidgets()}})}};e(document).ready(function(){r.init(),e("body:not(.widgets_access) .sidebar-manager-name").on("click",function(){var r=e(this);e("~ .sidebars-holder",r).toggleClass("closed"),e(".sidebar-name-arrow",r).toggleClass("closed-arrow")})})}(jQuery);
|
admin/assets/scss/cherry-admin-sidebars.scss
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-display-none{
|
2 |
+
display: none;
|
3 |
+
}
|
4 |
+
.description.cherry-default-description{
|
5 |
+
padding: 0 0 15px;
|
6 |
+
margin: 0;
|
7 |
+
font-style: normal;
|
8 |
+
color: #777;
|
9 |
+
}
|
10 |
+
#default-sidebars{
|
11 |
+
&:after{
|
12 |
+
content: ".";
|
13 |
+
display: block;
|
14 |
+
height: 0;
|
15 |
+
clear: both;
|
16 |
+
visibility: hidden;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
#cherry-sidebars-wrap{
|
20 |
+
margin-top: 10px;
|
21 |
+
.sidebar-manager-name{
|
22 |
+
h3{
|
23 |
+
padding: 10px 0;
|
24 |
+
margin: 0 10px 0 0;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
28 |
+
#cherry-default-sidebars-title{
|
29 |
+
h3{
|
30 |
+
padding: 10px 0;
|
31 |
+
margin: 12px 0 0 0;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
.sidebar-manager-name{
|
35 |
+
cursor: pointer;
|
36 |
+
position: relative;
|
37 |
+
-webkit-user-select: none;
|
38 |
+
-moz-user-select: none;
|
39 |
+
-ms-user-select: none;
|
40 |
+
user-select: none;
|
41 |
+
.sidebar-name-arrow{
|
42 |
+
display: none;
|
43 |
+
&:before{
|
44 |
+
right: 12px;
|
45 |
+
padding: 4px 6px 4px 4px;
|
46 |
+
font: 400 20px/1 dashicons;
|
47 |
+
speak: none;
|
48 |
+
display: inline-block;
|
49 |
+
padding: 8px 10px;
|
50 |
+
top: 0;
|
51 |
+
position: relative;
|
52 |
+
-webkit-font-smoothing: antialiased;
|
53 |
+
-moz-osx-font-smoothing: grayscale;
|
54 |
+
text-decoration: none!important;
|
55 |
+
content: '\f142';
|
56 |
+
}
|
57 |
+
&.closed-arrow{
|
58 |
+
display: block;
|
59 |
+
color: #777;
|
60 |
+
&:before{
|
61 |
+
content: '\f140';
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
&:hover{
|
66 |
+
.sidebar-name-arrow{
|
67 |
+
display: block;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
.sidebars-holder.closed{
|
73 |
+
display: none;
|
74 |
+
}
|
75 |
+
#create-new-sidebar-manager{
|
76 |
+
form#cherry-sidebars-form{
|
77 |
+
border-top: 1px solid #d4d5d6;
|
78 |
+
.cherry-section{
|
79 |
+
padding: 15px;
|
80 |
+
border: none;
|
81 |
+
.cherry-col-1{
|
82 |
+
width:24%;
|
83 |
+
label {
|
84 |
+
margin: 11px 0 0 0;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
.cherry-col-2{
|
88 |
+
input[type=text]{
|
89 |
+
&:-webkit-autofill{
|
90 |
+
box-shadow: inset 0 0 0 50px #fff;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
95 |
+
#cherry-error-message{
|
96 |
+
display: none;
|
97 |
+
color:red;
|
98 |
+
position: absolute;
|
99 |
+
right: 170px;
|
100 |
+
bottom: 40px
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
.cherry-ui-core input[type=text].error-invalid{
|
105 |
+
border: 1px solid red;
|
106 |
+
}
|
107 |
+
.cherry-widgets-holder-wrap{
|
108 |
+
position: relative;
|
109 |
+
.cherry-delete-sidebar-manager{
|
110 |
+
position: absolute;
|
111 |
+
right: 48px;
|
112 |
+
top: 0px;
|
113 |
+
height: 35px;
|
114 |
+
border: 1px solid #e5e5e5;
|
115 |
+
border-top: none;
|
116 |
+
padding: 14px 14px 0;
|
117 |
+
color:#a0a5aa;
|
118 |
+
z-index: 1;
|
119 |
+
cursor: pointer;
|
120 |
+
&:hover{
|
121 |
+
color:red;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
.sidebar-name-arrow{
|
125 |
+
border: 1px solid #e5e5e5;
|
126 |
+
padding: 3px 5px 0px 3px;
|
127 |
+
top: 0px;
|
128 |
+
right: -9px;
|
129 |
+
border-left: none;
|
130 |
+
height: 46px;
|
131 |
+
border-top: none;
|
132 |
+
}
|
133 |
+
.spinner-wordpress-type-1.cherry-spinner-wordpress{
|
134 |
+
right: 12px;
|
135 |
+
bottom: 12px;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
body.widgets_access{
|
139 |
+
.sidebar-manager-name{
|
140 |
+
cursor: default;
|
141 |
+
}
|
142 |
+
.sidebar-name-arrow{
|
143 |
+
display: none !important;
|
144 |
+
}
|
145 |
+
.cherry-widgets-holder-wrap .cherry-delete-sidebar-manager{
|
146 |
+
right: -1px;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
/*spinner*/
|
150 |
+
.spinner-wordpress-type-1.cherry-spinner-wordpress{
|
151 |
+
display: none;
|
152 |
+
background-color: #f62e46;
|
153 |
+
width: 25px;
|
154 |
+
height: 25px;
|
155 |
+
border-radius: 30px;
|
156 |
+
position: absolute;
|
157 |
+
}
|
158 |
+
#cherry-sidebars-form{
|
159 |
+
.spinner-wordpress-type-1.cherry-spinner-wordpress{
|
160 |
+
right: 160px;
|
161 |
+
bottom: 28px;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
.cherry-spinner-wordpress.spinner-wordpress-type-1{
|
165 |
+
-webkit-animation: cherry-innerCircle 1s linear infinite;
|
166 |
+
animation: cherry-innerCircle 1s linear infinite;
|
167 |
+
.cherry-inner-circle {
|
168 |
+
display: block;
|
169 |
+
background-color: #fff;
|
170 |
+
width: 8px;
|
171 |
+
height: 8px;
|
172 |
+
position: absolute;
|
173 |
+
border-radius: 8px;
|
174 |
+
top: 4px;
|
175 |
+
left: 4px;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
@-webkit-keyframes cherry-innerCircle {
|
179 |
+
0% {
|
180 |
+
-webkit-transform: rotate(o);
|
181 |
+
transform: rotate(o);
|
182 |
+
}
|
183 |
+
100% {
|
184 |
+
-webkit-transform: rotate(360deg);
|
185 |
+
transform: rotate(360deg);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
@keyframes sk-innerCircle {
|
189 |
+
0% {
|
190 |
+
-webkit-transform: rotate(o);
|
191 |
+
transform: rotate(o);
|
192 |
+
}
|
193 |
+
100% {
|
194 |
+
-webkit-transform: rotate(360deg);
|
195 |
+
transform: rotate(360deg);
|
196 |
+
}
|
197 |
+
}
|
admin/assets/scss/cherry-sidebars-post-page.scss
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*Style on post pages*/
|
2 |
+
.postbox .cherry-sidebar-select{
|
3 |
+
border-top: none;
|
4 |
+
padding: 0px;
|
5 |
+
position: relative;
|
6 |
+
}
|
admin/includes/class-cherry-custom-sidebar.php
ADDED
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for render and saving custom sidebars.
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
10 |
+
|
11 |
+
// If this file is called directly, abort.
|
12 |
+
if ( ! defined( 'WPINC' ) ) {
|
13 |
+
die;
|
14 |
+
}
|
15 |
+
|
16 |
+
if ( ! class_exists( 'Cherry_Custom_Sidebar' ) ) {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Class for render and saving custom sidebars.
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
*/
|
23 |
+
class Cherry_Custom_Sidebar {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Holds the instances of this class.
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @var object
|
30 |
+
*/
|
31 |
+
private static $instance = null;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Sets up the needed actions for adding and saving the meta boxes.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
*/
|
38 |
+
public function __construct() {
|
39 |
+
|
40 |
+
// Add the `Layout` meta box on the 'add_meta_boxes' hook.
|
41 |
+
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 );
|
42 |
+
|
43 |
+
// Saves the post format on the post editing page.
|
44 |
+
add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
|
45 |
+
|
46 |
+
// Registrate dynamic sidebar
|
47 |
+
add_action( 'register_sidebar', array( $this, 'register_dynamic_sidebar' ) );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Adds the meta box if the post type supports 'cherry-post-style' and the current user has
|
52 |
+
* permission to edit post meta.
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
* @param string $post_type The post type of the current post being edited.
|
56 |
+
* @param object $post The current post object.
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function add_meta_boxes( $post_type, $post ) {
|
60 |
+
$allowed_post_types = apply_filters(
|
61 |
+
'cherry_sidebar_post_type',
|
62 |
+
array(
|
63 |
+
'page',
|
64 |
+
'post',
|
65 |
+
'portfolio',
|
66 |
+
'testimonial',
|
67 |
+
'service',
|
68 |
+
'team',
|
69 |
+
'product',
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
if ( in_array( $post_type, $allowed_post_types )
|
74 |
+
&& ( current_user_can( 'edit_post_meta', $post->ID )
|
75 |
+
|| current_user_can( 'add_post_meta', $post->ID )
|
76 |
+
|| current_user_can( 'delete_post_meta', $post->ID ) )
|
77 |
+
) {
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Filter the array of 'add_meta_box' parametrs.
|
81 |
+
*
|
82 |
+
* @since 1.0.0
|
83 |
+
*/
|
84 |
+
$metabox = apply_filters( 'cherry_custom_sidebar', array(
|
85 |
+
'id' => 'cherry-sidebars',
|
86 |
+
'title' => __( 'Post Sidebars', 'cherry' ),
|
87 |
+
'page' => $post_type,
|
88 |
+
'context' => 'side',
|
89 |
+
'priority' => 'default',
|
90 |
+
'callback_args' => false,
|
91 |
+
) );
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Add meta box to the administrative interface.
|
95 |
+
*
|
96 |
+
* @link http://codex.wordpress.org/Function_Reference/add_meta_box
|
97 |
+
*/
|
98 |
+
add_meta_box(
|
99 |
+
$metabox['id'],
|
100 |
+
$metabox['title'],
|
101 |
+
array( $this, 'callback_metabox' ),
|
102 |
+
$metabox['page'],
|
103 |
+
$metabox['context'],
|
104 |
+
$metabox['priority'],
|
105 |
+
$metabox['callback_args']
|
106 |
+
);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Displays a meta box of radio selectors on the post editing screen, which allows theme users to select
|
112 |
+
* the layout they wish to use for the specific post.
|
113 |
+
*
|
114 |
+
* @since 1.0.0
|
115 |
+
* @param object $post The post object currently being edited.
|
116 |
+
* @param array $metabox Specific information about the meta box being loaded.
|
117 |
+
* @return void
|
118 |
+
*/
|
119 |
+
public function callback_metabox( $post, $metabox ) {
|
120 |
+
wp_nonce_field( basename( __FILE__ ), 'cherry-sidebar-nonce' );
|
121 |
+
|
122 |
+
global $wp_registered_sidebars;
|
123 |
+
|
124 |
+
$select_sidebar = $this->get_post_sidebar( $post->ID );
|
125 |
+
$select_options = array( '' => __( 'Sidebar not selected', 'cherry-sidebars' ) );
|
126 |
+
|
127 |
+
foreach ( $wp_registered_sidebars as $sidebar => $sidebar_value ) {
|
128 |
+
$select_options[ $sidebar_value['id'] ] = $sidebar_value['name'];
|
129 |
+
}
|
130 |
+
|
131 |
+
foreach ( $wp_registered_sidebars as $sidebar => $sidebar_value ) {
|
132 |
+
if ( array_key_exists( 'dynamic-sidebar',$sidebar_value ) ) {
|
133 |
+
continue;
|
134 |
+
}
|
135 |
+
|
136 |
+
if ( array_key_exists( 'is_global',$sidebar_value ) && false === $sidebar_value['is_global'] ) {
|
137 |
+
continue;
|
138 |
+
}
|
139 |
+
|
140 |
+
$output = '<p><strong>' . $sidebar_value['name'] . '</strong></p>';
|
141 |
+
|
142 |
+
$value = ( is_array( $select_sidebar ) && array_key_exists( $sidebar_value['id'], $select_sidebar ) ) ? $select_sidebar[ $sidebar_value['id'] ] : '' ;
|
143 |
+
|
144 |
+
$ui_select = new UI_Select(
|
145 |
+
array(
|
146 |
+
'id' => $sidebar_value['id'],
|
147 |
+
'name' => 'theme_sidebar[' . $sidebar_value['id'] . ']',
|
148 |
+
'value' => $value,
|
149 |
+
'options' => $select_options,
|
150 |
+
|
151 |
+
)
|
152 |
+
);
|
153 |
+
|
154 |
+
$output .= $ui_select->render();
|
155 |
+
|
156 |
+
echo $output;
|
157 |
+
};
|
158 |
+
|
159 |
+
?>
|
160 |
+
<p class="howto">
|
161 |
+
<?php printf(
|
162 |
+
__( 'You can choose page sidebars or create a new sidebar on %swidgets page%s .', 'cherry-sidebars' ),
|
163 |
+
'<a href="widgets.php" target="_blank" title="' . __( 'Widgets Page', 'cherry-sidebars' ) . '">',
|
164 |
+
'</a>'
|
165 |
+
); ?>
|
166 |
+
</p>
|
167 |
+
<?php
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Register dynamic sidebar.
|
172 |
+
*
|
173 |
+
* @since 1.0.0
|
174 |
+
* @return void
|
175 |
+
*/
|
176 |
+
public function register_dynamic_sidebar() {
|
177 |
+
global $wp_registered_sidebars;
|
178 |
+
|
179 |
+
$instance = new Cherry_Sidebar_Utils();
|
180 |
+
$cusotm_sidebar_array = $instance->get_custom_sidebar_array();
|
181 |
+
|
182 |
+
unset( $cusotm_sidebar_array['cherry-sidebars-counter'] );
|
183 |
+
$wp_registered_sidebars = array_merge( $wp_registered_sidebars, $cusotm_sidebar_array );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Saves the post style metadata if on the post editing screen in the admin.
|
188 |
+
*
|
189 |
+
* @since 1.0.0
|
190 |
+
* @param int $post_id The ID of the current post being saved.
|
191 |
+
* @param object $post The post object currently being saved.
|
192 |
+
* @return void|int
|
193 |
+
*/
|
194 |
+
public function save_post( $post_id, $post = '' ) {
|
195 |
+
|
196 |
+
if ( ! is_object( $post ) ) {
|
197 |
+
$post = get_post();
|
198 |
+
}
|
199 |
+
|
200 |
+
// Verify the nonce for the post formats meta box.
|
201 |
+
if ( ! isset( $_POST['cherry-sidebar-nonce'] )
|
202 |
+
|| ! wp_verify_nonce( $_POST['cherry-sidebar-nonce'], basename( __FILE__ ) )
|
203 |
+
) {
|
204 |
+
return $post_id;
|
205 |
+
}
|
206 |
+
|
207 |
+
// Get the meta key.
|
208 |
+
$meta_key = 'post_sidebar';
|
209 |
+
|
210 |
+
// Get the all submitted `page-sidebar-manager` data.
|
211 |
+
$sidebar_id = $_POST['theme_sidebar'];
|
212 |
+
|
213 |
+
update_post_meta( $post_id, $meta_key, $sidebar_id );
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Function get post or page sidebar.
|
218 |
+
*
|
219 |
+
* @since 1.0.0
|
220 |
+
* @param int $post_id The ID of the current post being saved.
|
221 |
+
* @return string $post_sidebar Sidebar id value.
|
222 |
+
*/
|
223 |
+
public function get_post_sidebar( $post_id ) {
|
224 |
+
|
225 |
+
// Get the $post_sidebar.
|
226 |
+
$post_sidebar = get_post_meta( $post_id, 'post_sidebar', true );
|
227 |
+
|
228 |
+
return $post_sidebar;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Returns the instance.
|
233 |
+
*
|
234 |
+
* @since 1.0.0
|
235 |
+
* @return object
|
236 |
+
*/
|
237 |
+
public static function get_instance() {
|
238 |
+
|
239 |
+
// If the single instance hasn't been set, set it now.
|
240 |
+
if ( null == self::$instance ) {
|
241 |
+
self::$instance = new self;
|
242 |
+
}
|
243 |
+
|
244 |
+
return self::$instance;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
Cherry_Custom_Sidebar::get_instance();
|
249 |
+
}
|
admin/includes/class-cherry-sidebar-utils.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cherry Sidebar Utils.
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
10 |
+
|
11 |
+
// If this file is called directly, abort.
|
12 |
+
if ( ! defined( 'WPINC' ) ) {
|
13 |
+
die();
|
14 |
+
}
|
15 |
+
|
16 |
+
if ( ! class_exists( 'Cherry_Sidebar_Utils' ) ) {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Cherry Sidebar Utils.
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
*/
|
23 |
+
class Cherry_Sidebar_Utils {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Current theme name.
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $current_theme;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Current sidebars theme settings.
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
public $get_theme_option;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Sets up our actions/filters or another settings.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
function __construct() {
|
45 |
+
$this->current_theme = wp_get_theme();
|
46 |
+
$this->get_theme_option = get_option( $this->current_theme . '_sidebars', array() );
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get current sidebars theme settings.
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
* @return array Current sidebar settings.
|
54 |
+
*/
|
55 |
+
public function get_custom_sidebar_array() {
|
56 |
+
|
57 |
+
if ( ! is_array( $this->get_theme_option ) || ! array_key_exists( 'custom_sidebar', $this->get_theme_option ) ) {
|
58 |
+
$custom_sidebar_array = array();
|
59 |
+
} else {
|
60 |
+
$custom_sidebar_array = $this->get_theme_option['custom_sidebar'];
|
61 |
+
}
|
62 |
+
|
63 |
+
return $custom_sidebar_array;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Updated custom sidebars array and save to database.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
* @param array $new_custom_sidebar_array New theme sidebar settings.
|
71 |
+
* @return void
|
72 |
+
*/
|
73 |
+
public function set_custom_sidebar_array( $new_custom_sidebar_array ) {
|
74 |
+
|
75 |
+
$this->get_theme_option['custom_sidebar'] = $new_custom_sidebar_array;
|
76 |
+
|
77 |
+
update_option( $this->current_theme . '_sidebars', $this->get_theme_option );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
admin/includes/class-cherry-sidebars-admin.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sets up the admin functionality for the plugin.
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
10 |
+
|
11 |
+
// If this file is called directly, abort.
|
12 |
+
if ( ! defined( 'WPINC' ) ) {
|
13 |
+
die();
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class for admin functionally.
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*/
|
21 |
+
class Cherry_Sidebars_Admin {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Holds the instances of this class.
|
25 |
+
*
|
26 |
+
* @since 1.0.0
|
27 |
+
* @var object
|
28 |
+
*/
|
29 |
+
private static $instance = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Sets up needed actions/filters for the admin to initialize.
|
33 |
+
*
|
34 |
+
* @since 1.0.0
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
+
|
39 |
+
// Load admin javascript and stylesheet.
|
40 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'add_admin_assets' ), 1 );
|
41 |
+
|
42 |
+
add_action( 'after_setup_theme', array( $this, 'widgets_ajax_page' ) );
|
43 |
+
add_action( 'sidebar_admin_setup', array( $this, 'registrates_custom_sidebar' ) );
|
44 |
+
add_action( 'widgets_admin_page', array( $this, 'edit_wp_registered_sidebars' ) );
|
45 |
+
add_action( 'sidebar_admin_page', array( $this, 'widgets_page' ) );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Register and Enqueue admin-specific stylesheet and javascript.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
* @param string $hook_suffix Hook suffix.
|
53 |
+
* @return void
|
54 |
+
*/
|
55 |
+
public function add_admin_assets( $hook_suffix ) {
|
56 |
+
|
57 |
+
if ( 'widgets.php' === $hook_suffix ) {
|
58 |
+
wp_register_script( 'cherry_admin_sidebars_js', trailingslashit( CHERRY_SIDEBARS_URI ) . 'admin/assets/js/min/cherry-admin-sidebars.min.js', array( 'jquery' ), CHERRY_SIDEBARS_VERSION, true );
|
59 |
+
wp_register_style( 'cherry_admin_sidebars_css', trailingslashit( CHERRY_SIDEBARS_URI ) . 'admin/assets/css/cherry-admin-sidebars.css', array(), CHERRY_SIDEBARS_VERSION, 'all' );
|
60 |
+
|
61 |
+
wp_register_style( 'interface-builder', trailingslashit( CHERRY_SIDEBARS_URI ) . 'admin/assets/css/interface-builder.css', array(), CHERRY_SIDEBARS_VERSION, 'all' );
|
62 |
+
|
63 |
+
$cherry_framework_object = array( 'ajax_nonce_new_sidebar' => wp_create_nonce( 'new_custom_sidebar' ) , 'ajax_nonce_remove_sidebar' => wp_create_nonce( 'remove_custom_sidebar' ) );
|
64 |
+
wp_localize_script( 'cherry_admin_sidebars_js', 'cherryFramework', $cherry_framework_object );
|
65 |
+
|
66 |
+
wp_enqueue_script( 'cherry_admin_sidebars_js' );
|
67 |
+
wp_enqueue_style( 'cherry_admin_sidebars_css' );
|
68 |
+
wp_enqueue_style( 'interface-builder' );
|
69 |
+
|
70 |
+
} elseif ( false !== strpos( $hook_suffix, 'post' ) ) {
|
71 |
+
wp_register_style( 'cherry-sidebars-post-page', trailingslashit( CHERRY_SIDEBARS_URI ) . 'admin/assets/css/cherry-sidebars-post-page.css', array(), CHERRY_SIDEBARS_VERSION, 'all' );
|
72 |
+
wp_enqueue_style( 'cherry-sidebars-post-page' );
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Returns the instance.
|
78 |
+
*
|
79 |
+
* @since 1.0.0
|
80 |
+
*/
|
81 |
+
public function widgets_page() {
|
82 |
+
require_once( trailingslashit( CHERRY_SIDEBARS_DIR ) . 'admin/views/cherry-widgets-page.php' );
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Registration new custom sidebars.
|
87 |
+
*
|
88 |
+
* @since 1.0.0
|
89 |
+
* @return void
|
90 |
+
*/
|
91 |
+
public function registrates_custom_sidebar() {
|
92 |
+
global $wp_registered_sidebars;
|
93 |
+
|
94 |
+
$instance = new Cherry_Sidebar_Utils();
|
95 |
+
$sidebars_array = $instance->get_custom_sidebar_array();
|
96 |
+
unset( $sidebars_array['cherry-sidebars-counter'] );
|
97 |
+
|
98 |
+
$wp_registered_sidebars = array_merge( $wp_registered_sidebars, $sidebars_array );
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Editing registered sidebars.
|
103 |
+
*
|
104 |
+
* @since 1.0.0
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function edit_wp_registered_sidebars() {
|
108 |
+
global $wp_registered_sidebars;
|
109 |
+
|
110 |
+
$instance = new Cherry_Sidebar_Utils();
|
111 |
+
$sidebars_array = $instance->get_custom_sidebar_array();
|
112 |
+
unset( $sidebars_array['cherry-sidebars-counter'] );
|
113 |
+
$sidebars_array_lengh = count( $sidebars_array );
|
114 |
+
|
115 |
+
foreach ( $sidebars_array as $sidebar => $custom_sidebar ) {
|
116 |
+
unset( $wp_registered_sidebars[ $sidebar ] );
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Returns the instance.
|
122 |
+
*
|
123 |
+
* @since 1.0.0
|
124 |
+
*/
|
125 |
+
public function widgets_ajax_page() {
|
126 |
+
require_once( trailingslashit( CHERRY_SIDEBARS_DIR ) . 'admin/views/cherry-new-sidebar.php' );
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Returns the instance.
|
131 |
+
*
|
132 |
+
* @since 1.0.0
|
133 |
+
* @return object
|
134 |
+
*/
|
135 |
+
public static function get_instance() {
|
136 |
+
|
137 |
+
// If the single instance hasn't been set, set it now.
|
138 |
+
if ( null == self::$instance ) {
|
139 |
+
self::$instance = new self;
|
140 |
+
}
|
141 |
+
|
142 |
+
return self::$instance;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
Cherry_Sidebars_Admin::get_instance();
|
admin/includes/index.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
admin/views/cherry-new-sidebar.php
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom sidebar DOM render functions.
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
10 |
+
|
11 |
+
// If this file is called directly, abort.
|
12 |
+
if ( ! defined( 'WPINC' ) ) {
|
13 |
+
die;
|
14 |
+
}
|
15 |
+
|
16 |
+
if ( ! function_exists( 'cherry_sidebars_register_sidebar' ) ) {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* New sidebar register.
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
* @param array $args Sidebar settings.
|
23 |
+
* @return string Sidebar ID added to $wp_registered_sidebars global.
|
24 |
+
*/
|
25 |
+
function cherry_sidebars_register_sidebar( $args ) {
|
26 |
+
|
27 |
+
// Set up some default sidebar arguments.
|
28 |
+
$defaults = array(
|
29 |
+
'id' => '',
|
30 |
+
'name' => '',
|
31 |
+
'description' => '',
|
32 |
+
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
33 |
+
'after_widget' => '</aside>',
|
34 |
+
'before_title' => '<h3 class="widget-title">',
|
35 |
+
'after_title' => '</h3>',
|
36 |
+
);
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Filter sidebar arguments defaults.
|
40 |
+
*
|
41 |
+
* @since 1.0.0
|
42 |
+
* @param array $defaults
|
43 |
+
*/
|
44 |
+
$defaults = apply_filters( 'cherry_sidebars_default_args', $defaults );
|
45 |
+
|
46 |
+
// Parse the arguments.
|
47 |
+
$args = wp_parse_args( $args, $defaults );
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Filters the sidebar arguments.
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
* @param array $args
|
54 |
+
*/
|
55 |
+
$args = apply_filters( 'cherry_sidebars_sidebar_args', $args );
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Fires before execute WordPress `register_sidebar` function.
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
* @param array $args
|
62 |
+
*/
|
63 |
+
do_action( 'cherry_sidebars_register_sidebar', $args );
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Register the sidebar.
|
67 |
+
*
|
68 |
+
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
|
69 |
+
*/
|
70 |
+
return register_sidebar( $args );
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
if ( ! function_exists( 'cherry_sidebars_add_custom_sidebar' ) ) {
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Custom sidebar item render.
|
78 |
+
*
|
79 |
+
* @return void
|
80 |
+
*/
|
81 |
+
function cherry_sidebars_add_custom_sidebar() {
|
82 |
+
check_ajax_referer( 'new_custom_sidebar', 'security' );
|
83 |
+
|
84 |
+
$nonce = isset( $_GET['security'] ) ? $_GET['security'] : $security ;
|
85 |
+
|
86 |
+
if ( ! wp_verify_nonce( $nonce, 'new_custom_sidebar' ) ) {
|
87 |
+
exit;
|
88 |
+
}
|
89 |
+
|
90 |
+
global $wp_registered_sidebars;
|
91 |
+
|
92 |
+
$instance = new Cherry_Sidebar_Utils();
|
93 |
+
$custom_sidebar_array = $instance->get_custom_sidebar_array();
|
94 |
+
|
95 |
+
$form_data = isset( $_GET['formdata'] ) ? $_GET['formdata'] : $formdata ;
|
96 |
+
|
97 |
+
if ( ! array_key_exists( 'cherry-sidebars-counter', $custom_sidebar_array ) ) {
|
98 |
+
$custom_sidebar_array['cherry-sidebars-counter'] = 0;
|
99 |
+
} else {
|
100 |
+
$custom_sidebar_array['cherry-sidebars-counter'] += 1;
|
101 |
+
}
|
102 |
+
|
103 |
+
$id = $custom_sidebar_array['cherry-sidebars-counter'];
|
104 |
+
$args = array(
|
105 |
+
'name' => $form_data[0]['value'],
|
106 |
+
'id' => 'cherry-sidebars-' . $id,
|
107 |
+
'description' => $form_data[1]['value'],
|
108 |
+
'dynamic-sidebar' => true,
|
109 |
+
);
|
110 |
+
$registrate_custom_sidebar = cherry_sidebars_register_sidebar( $args );
|
111 |
+
$custom_sidebar_array[ 'cherry-sidebars-' . $id ] = $wp_registered_sidebars[ $registrate_custom_sidebar ];
|
112 |
+
?>
|
113 |
+
<div class="widgets-holder-wrap closed cherry-widgets-holder-wrap">
|
114 |
+
<div class='cherry-delete-sidebar-manager'>
|
115 |
+
<div class="cherry-spinner-wordpress spinner-wordpress-type-1"><span class="cherry-inner-circle"></span></div>
|
116 |
+
<span class="dashicons dashicons-trash"></span>
|
117 |
+
</div>
|
118 |
+
<div id="<?php echo esc_attr( 'cherry-sidebars-' . $id ) ?>" class="widgets-sortables ui-sortable cherry-sidebars-manager">
|
119 |
+
<div class="sidebar-name">
|
120 |
+
<div class="sidebar-name-arrow"><br></div>
|
121 |
+
<h2><?php echo esc_html( $form_data[0]['value'] ) ?><span class="spinner"></span></h2>
|
122 |
+
</div>
|
123 |
+
<div class="sidebar-description">
|
124 |
+
<p class="description"><?php echo esc_html( $form_data[1]['value'] ) ?></p>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
<?php
|
129 |
+
$instance->set_custom_sidebar_array( $custom_sidebar_array );
|
130 |
+
wp_die();
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
add_action( 'wp_ajax_add_new_custom_sidebar', 'cherry_sidebars_add_custom_sidebar' );
|
135 |
+
|
136 |
+
if ( ! function_exists( 'cherry_sidebars_remove_custom_sidebar' ) ) {
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Custom sidebar removing function.
|
140 |
+
*
|
141 |
+
* @since 1.0.0
|
142 |
+
* @return void
|
143 |
+
*/
|
144 |
+
function cherry_sidebars_remove_custom_sidebar() {
|
145 |
+
check_ajax_referer( 'remove_custom_sidebar', 'security' );
|
146 |
+
|
147 |
+
$nonce = isset( $_GET['security'] ) ? $_GET['security'] : $security ;
|
148 |
+
|
149 |
+
if ( ! wp_verify_nonce( $nonce, 'remove_custom_sidebar' ) ) {
|
150 |
+
exit;
|
151 |
+
}
|
152 |
+
|
153 |
+
$id = isset( $_GET['id'] ) ? $_GET['id'] : $id ;
|
154 |
+
|
155 |
+
$instance = new Cherry_Sidebar_Utils();
|
156 |
+
$custom_sidebar_array = $instance->get_custom_sidebar_array();
|
157 |
+
unset( $custom_sidebar_array[ $id ] );
|
158 |
+
|
159 |
+
$instance->set_custom_sidebar_array( $custom_sidebar_array );
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
add_action( 'wp_ajax_remove_custom_sidebar', 'cherry_sidebars_remove_custom_sidebar' );
|
admin/views/cherry-widgets-page.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Widget page functions.
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
10 |
+
|
11 |
+
// If this file is called directly, abort.
|
12 |
+
if ( ! defined( 'WPINC' ) ) {
|
13 |
+
die;
|
14 |
+
}
|
15 |
+
?>
|
16 |
+
|
17 |
+
<!-- Modal window to creating new custom sidebar. -->
|
18 |
+
<?php add_thickbox(); ?>
|
19 |
+
<div id="new-sidebar-manager-wrap" style="display:none;">
|
20 |
+
<div id="create-new-sidebar-manager">
|
21 |
+
<h3><?php echo esc_html__( 'Create a new custom sidebar', 'cherry-sidebars' ); ?></h3>
|
22 |
+
<form id="cherry-sidebars-form" class="cherry-ui-core" method="post">
|
23 |
+
<div class="cherry-section">
|
24 |
+
<?php
|
25 |
+
$ui_text = new UI_Text(
|
26 |
+
array(
|
27 |
+
'id' => 'sidebar-manager-name',
|
28 |
+
'name' => 'sidebar-manager-name',
|
29 |
+
'class' => 'required',
|
30 |
+
'label' => __( 'Sidebar name:', 'cherry-sidebars' ),
|
31 |
+
)
|
32 |
+
);
|
33 |
+
echo $ui_text->render();
|
34 |
+
?>
|
35 |
+
</div>
|
36 |
+
<div class="cherry-section">
|
37 |
+
<?php
|
38 |
+
$ui_text = new UI_Text(
|
39 |
+
array(
|
40 |
+
'id' => 'sidebar-manager-description',
|
41 |
+
'name' => 'sidebar-manager-description',
|
42 |
+
'class' => 'required',
|
43 |
+
'label' => __( 'Sidebar description:', 'cherry-sidebars' ),
|
44 |
+
)
|
45 |
+
);
|
46 |
+
echo $ui_text->render();
|
47 |
+
?>
|
48 |
+
</div>
|
49 |
+
<div class="cherry-section">
|
50 |
+
<?php
|
51 |
+
echo get_submit_button( __( 'Create Sidebar', 'cherry-sidebars' ), 'button-primary', 'sidebar-manager-submit', false , 'style="float:right"' );
|
52 |
+
?>
|
53 |
+
</div>
|
54 |
+
<div class="cherry-spinner-wordpress spinner-wordpress-type-1"><span class="cherry-inner-circle"></span></div>
|
55 |
+
<div id="cherry-error-message"><?php echo esc_html__( 'Cannot add new custom sidebar', 'cherry-sidebars' ); ?></div>
|
56 |
+
</form>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<!-- Default sidebar title and description block. -->
|
61 |
+
<div id="cherry-default-sidebars-title" class="cherry-display-none sidebar-manager-name">
|
62 |
+
<div class="sidebar-name-arrow"><br></div>
|
63 |
+
<h3><?php echo esc_html__( 'Default Sidebars', 'cherry-sidebars' ); ?></h3>
|
64 |
+
</div>
|
65 |
+
<div id="cherry-default-sidebars-description" class="cherry-display-none">
|
66 |
+
<p class="description cherry-default-description"><?php echo esc_html__( 'Default sidebars created in child theme code itself.', 'cherry-sidebars' ); ?></p>
|
67 |
+
</div>
|
68 |
+
|
69 |
+
<!-- Custom sidebar block. -->
|
70 |
+
<div id="cherry-sidebars-wrap" class="cherry-display-none">
|
71 |
+
<div class="sidebar-manager-name"><div class="sidebar-name-arrow"><br></div>
|
72 |
+
<h3><?php echo esc_html__( 'Cherry Sidebars', 'cherry-sidebars' ); ?></h3>
|
73 |
+
</div>
|
74 |
+
<div id="cherry-sidebars" class="sidebars-holder">
|
75 |
+
<p class="description cherry-default-description"><?php echo esc_html__( 'You can create a custom sidebar and enable it for any page or post. This can be done on page editing stage.', 'cherry-sidebars' ); ?></p>
|
76 |
+
<span class="cherry-ui-core"><a class="thickbox button button-default btn-create-sidebar" href="#TB_inline?width=600&height=380&inlineId=new-sidebar-manager-wrap"><?php echo esc_html__( 'Create a new sidebar', 'cherry-sidebars' ); ?></a></span>
|
77 |
+
|
78 |
+
<div id="cherry-sidebars-holder">
|
79 |
+
<div class="sidebars-column-1">
|
80 |
+
<?php
|
81 |
+
global $wp_registered_sidebars;
|
82 |
+
|
83 |
+
$instance = new Cherry_Sidebar_Utils();
|
84 |
+
$custom_sidebar_array = $instance->get_custom_sidebar_array();
|
85 |
+
unset( $custom_sidebar_array['cherry-sidebars-counter'] );
|
86 |
+
|
87 |
+
$sidebar_counter = count( $custom_sidebar_array ) - 1;
|
88 |
+
$last_sidebar = end( $custom_sidebar_array );
|
89 |
+
$counter = 0;
|
90 |
+
$wp_registered_sidebars = array_merge( $wp_registered_sidebars, $custom_sidebar_array );
|
91 |
+
|
92 |
+
if ( empty( $custom_sidebar_array ) ) {
|
93 |
+
echo '</div><div class="sidebars-column-2">';
|
94 |
+
}
|
95 |
+
|
96 |
+
foreach ( $custom_sidebar_array as $sidebar => $custom_sidebar ) :
|
97 |
+
|
98 |
+
if ( intval( $sidebar_counter / 2 ) + 1 === $counter || 0 === $sidebar_counter ) {
|
99 |
+
echo '</div><div class="sidebars-column-2">';
|
100 |
+
}
|
101 |
+
|
102 |
+
$wrap_class = 'widgets-holder-wrap';
|
103 |
+
if ( ! empty( $custom_sidebar['class'] ) ) {
|
104 |
+
$wrap_class .= ' sidebar-' . $custom_sidebar['class'];
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( $counter > 0 ) {
|
108 |
+
$wrap_class .= ' closed';
|
109 |
+
}
|
110 |
+
|
111 |
+
?>
|
112 |
+
<div class="<?php echo esc_attr( $wrap_class ); ?> cherry-widgets-holder-wrap">
|
113 |
+
<div class='cherry-delete-sidebar-manager'>
|
114 |
+
<div class="cherry-spinner-wordpress spinner-wordpress-type-1"><span class="cherry-inner-circle"></span></div>
|
115 |
+
<span class="dashicons dashicons-trash"></span>
|
116 |
+
</div>
|
117 |
+
<?php wp_list_widget_controls( $sidebar, $custom_sidebar['name'] ); // Show the control forms for each of the widgets in this sidebar ?>
|
118 |
+
</div>
|
119 |
+
<?php $counter += 1; ?>
|
120 |
+
<?php endforeach; ?>
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
<!-- Script changed widgets page dom. -->
|
126 |
+
<script>
|
127 |
+
(function(){
|
128 |
+
'use strict';
|
129 |
+
|
130 |
+
var custemSitebarsWrapper = jQuery("#cherry-sidebars-wrap"),
|
131 |
+
defoultSitebarsTitle = jQuery("#cherry-default-sidebars-title"),
|
132 |
+
defoultSitebarsDescription = jQuery("#cherry-default-sidebars-description"),
|
133 |
+
defoultSitebarsWrapper = jQuery("#widgets-right");
|
134 |
+
|
135 |
+
/*Changed widgets page dom*/
|
136 |
+
custemSitebarsWrapper.remove().removeClass('cherry-display-none').clone().appendTo(defoultSitebarsWrapper);
|
137 |
+
defoultSitebarsDescription.remove().removeClass('cherry-display-none').clone().prependTo(defoultSitebarsWrapper);
|
138 |
+
jQuery('>[class ^= "sidebars-column"], #cherry-default-sidebars-description', defoultSitebarsWrapper).wrapAll('<div id="default-sidebars" class="sidebars-holder"></div>');
|
139 |
+
defoultSitebarsTitle.remove().removeClass('cherry-display-none').clone().prependTo(defoultSitebarsWrapper);
|
140 |
+
}())
|
141 |
+
</script>
|
admin/views/index.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
cherry-framework/.gitignore
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#########################
|
2 |
+
# Files
|
3 |
+
#########################
|
4 |
+
.sass-cache
|
5 |
+
package.json
|
6 |
+
|
7 |
+
# Windows
|
8 |
+
Thumbs.db
|
9 |
+
Desktop.ini
|
10 |
+
|
11 |
+
# OSX
|
12 |
+
.DS_Store
|
13 |
+
*.swp
|
14 |
+
*~.nib
|
15 |
+
|
16 |
+
#########################
|
17 |
+
# Expansion
|
18 |
+
#########################
|
19 |
+
*.map
|
20 |
+
*.log
|
21 |
+
*.dll
|
22 |
+
|
23 |
+
#########################
|
24 |
+
# Folder
|
25 |
+
#########################
|
26 |
+
node_modules
|
27 |
+
|
28 |
+
#########################
|
29 |
+
# Travis-si files
|
30 |
+
#########################
|
cherry-framework/README.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
# cherry-framework
|
2 |
+
Module system.
|
cherry-framework/cherry-core.php
ADDED
@@ -0,0 +1,481 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class Cherry Core
|
4 |
+
* Version: 1.1.0
|
5 |
+
*
|
6 |
+
* @package Cherry_Framework
|
7 |
+
* @subpackage Class
|
8 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
9 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
10 |
+
* @link http://www.cherryframework.com/
|
11 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
|
12 |
+
*/
|
13 |
+
|
14 |
+
// If this file is called directly, abort.
|
15 |
+
if ( ! defined( 'WPINC' ) ) {
|
16 |
+
die;
|
17 |
+
}
|
18 |
+
|
19 |
+
if ( ! class_exists( 'Cherry_Core' ) ) {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Class Cherry Core.
|
23 |
+
*/
|
24 |
+
class Cherry_Core {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* A reference to an instance of this class.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @var object
|
31 |
+
*/
|
32 |
+
private static $instance = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Core settings.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
public $settings = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Holder for all registered modules for current core instance.
|
44 |
+
*
|
45 |
+
* @since 1.0.0
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
+
public $modules = array();
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Holder for all modules.
|
52 |
+
*
|
53 |
+
* @since 1.1.0
|
54 |
+
* @var array
|
55 |
+
*/
|
56 |
+
public static $all_modules = array();
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Constructor.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
*/
|
63 |
+
public function __construct( $settings = array() ) {
|
64 |
+
$base_dir = trailingslashit( __DIR__ );
|
65 |
+
$base_url = trailingslashit( $this->base_url( '', __FILE__ ) );
|
66 |
+
|
67 |
+
$defaults = array(
|
68 |
+
'framework_path' => 'cherry-framework',
|
69 |
+
'modules' => array(),
|
70 |
+
'base_dir' => $base_dir,
|
71 |
+
'base_url' => $base_url,
|
72 |
+
'extra_base_dir' => '',
|
73 |
+
);
|
74 |
+
|
75 |
+
$this->settings = array_merge( $defaults, $settings );
|
76 |
+
|
77 |
+
$this->settings['extra_base_dir'] = trailingslashit( $this->settings['base_dir'] );
|
78 |
+
$this->settings['base_dir'] = $base_dir;
|
79 |
+
$this->settings['base_url'] = $base_url;
|
80 |
+
|
81 |
+
$this->run_collector();
|
82 |
+
|
83 |
+
/**
|
84 |
+
* In this hooks priority parameter are very important.
|
85 |
+
*/
|
86 |
+
add_action( 'after_setup_theme', array( 'Cherry_Core', 'load_all_modules' ), 2 );
|
87 |
+
add_action( 'after_setup_theme', array( $this, 'init_required_modules' ), 2 );
|
88 |
+
|
89 |
+
// Init modules with autoload seted up into true.
|
90 |
+
add_action( 'after_setup_theme', array( $this, 'init_autoload_modules' ), 9999 );
|
91 |
+
|
92 |
+
// Backward compatibility for `cherry-widget-factory` module.
|
93 |
+
remove_all_filters( 'cherry_widget_factory_core', 10 );
|
94 |
+
add_filter( 'cherry_widget_factory_core', array( $this, 'pass_core_to_widgets' ), 11, 2 );
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Fire collector for modules.
|
99 |
+
*
|
100 |
+
* @since 1.0.0
|
101 |
+
* @return bool
|
102 |
+
*/
|
103 |
+
private function run_collector() {
|
104 |
+
|
105 |
+
if ( ! is_array( $this->settings['modules'] ) || empty( $this->settings['modules'] ) ) {
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
// Cherry_Toolkit module should be loaded by default.
|
110 |
+
if ( ! isset( $this->settings['modules']['cherry-toolkit'] ) ) {
|
111 |
+
$this->settings['modules']['cherry-toolkit'] = array(
|
112 |
+
'autoload' => true,
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
foreach ( $this->settings['modules'] as $module => $settings ) {
|
117 |
+
$priority = $this->get_module_priority( $module );
|
118 |
+
$path = $this->get_module_path( $module );
|
119 |
+
|
120 |
+
if ( ! array_key_exists( $module, self::$all_modules ) ) {
|
121 |
+
self::$all_modules[ $module ] = array( $priority => $path );
|
122 |
+
} else {
|
123 |
+
|
124 |
+
$old_priority = array_keys( self::$all_modules[ $module ] );
|
125 |
+
|
126 |
+
if ( ! is_array( $old_priority ) || ! isset( $old_priority[0] ) ) {
|
127 |
+
continue;
|
128 |
+
}
|
129 |
+
|
130 |
+
$compare = version_compare( $old_priority[0], $priority, '<' );
|
131 |
+
|
132 |
+
if ( $compare ) {
|
133 |
+
continue;
|
134 |
+
}
|
135 |
+
|
136 |
+
self::$all_modules[ $module ] = array( $priority => $path );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Filter a holder for all modules.
|
142 |
+
*
|
143 |
+
* @since 1.1.0
|
144 |
+
* @var array
|
145 |
+
*/
|
146 |
+
self::$all_modules = apply_filters( 'cherry_core_all_modules', self::$all_modules, $this );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Loaded all modules.
|
151 |
+
*
|
152 |
+
* @since 1.1.0
|
153 |
+
*/
|
154 |
+
public static function load_all_modules() {
|
155 |
+
|
156 |
+
foreach ( self::$all_modules as $module => $data ) {
|
157 |
+
|
158 |
+
$path = current( $data );
|
159 |
+
$loaded = self::load_module( $module, $path );
|
160 |
+
|
161 |
+
if ( ! $loaded ) {
|
162 |
+
continue;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Init a required modules.
|
169 |
+
*
|
170 |
+
* @since 1.1.0
|
171 |
+
*/
|
172 |
+
public function init_required_modules() {
|
173 |
+
$required_modules = apply_filters( 'cherry_core_required_modules', array(
|
174 |
+
'cherry-toolkit',
|
175 |
+
'cherry-widget-factory',
|
176 |
+
), $this );
|
177 |
+
|
178 |
+
foreach ( $required_modules as $module ) {
|
179 |
+
|
180 |
+
if ( ! array_key_exists( $module, $this->settings['modules'] ) ) {
|
181 |
+
continue;
|
182 |
+
}
|
183 |
+
|
184 |
+
$settings = $this->settings['modules'][ $module ];
|
185 |
+
$args = ! empty( $settings['args'] ) ? $settings['args'] : array();
|
186 |
+
|
187 |
+
$this->init_module( $module, $args );
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Init autoload modules.
|
193 |
+
*
|
194 |
+
* @since 1.1.0
|
195 |
+
*/
|
196 |
+
public function init_autoload_modules() {
|
197 |
+
|
198 |
+
if ( empty( $this->modules ) ) {
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
|
202 |
+
foreach ( $this->settings['modules'] as $module => $settings ) {
|
203 |
+
|
204 |
+
if ( ! $this->is_module_autoload( $module ) ) {
|
205 |
+
continue;
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( ! empty( $this->modules[ $module ] ) ) {
|
209 |
+
continue;
|
210 |
+
}
|
211 |
+
|
212 |
+
$args = ! empty( $settings['args'] ) ? $settings['args'] : array();
|
213 |
+
$this->init_module( $module, $args );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Init single module.
|
219 |
+
*
|
220 |
+
* @since 1.0.0
|
221 |
+
* @param string $module Module slug.
|
222 |
+
* @param array $args Module arguments array.
|
223 |
+
* @return mixed
|
224 |
+
*/
|
225 |
+
public function init_module( $module, $args = array() ) {
|
226 |
+
$this->modules[ $module ] = $this->get_module_instance( $module, $args );
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Filter a single module after initialization.
|
230 |
+
*
|
231 |
+
* @since 1.1.0
|
232 |
+
*/
|
233 |
+
return apply_filters( 'cherry_core_init_module', $this->modules[ $module ], $module, $args, $this );
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Check module autoload.
|
238 |
+
*
|
239 |
+
* @since 1.0.0
|
240 |
+
* @param string $module Module slug.
|
241 |
+
* @return bool
|
242 |
+
*/
|
243 |
+
public function is_module_autoload( $module ) {
|
244 |
+
|
245 |
+
if ( empty( $this->settings['modules'][ $module ]['autoload'] ) ) {
|
246 |
+
return false;
|
247 |
+
}
|
248 |
+
|
249 |
+
return $this->settings['modules'][ $module ]['autoload'];
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Include module.
|
254 |
+
*
|
255 |
+
* @since 1.0.0
|
256 |
+
* @param string $module Module slug.
|
257 |
+
* @param string $path Module path.
|
258 |
+
* @return bool
|
259 |
+
*/
|
260 |
+
public static function load_module( $module, $path ) {
|
261 |
+
$class_name = self::get_class_name( $module );
|
262 |
+
|
263 |
+
if ( class_exists( $class_name ) ) {
|
264 |
+
return true;
|
265 |
+
}
|
266 |
+
|
267 |
+
if ( ! $path ) {
|
268 |
+
return false;
|
269 |
+
}
|
270 |
+
|
271 |
+
require_once( $path );
|
272 |
+
|
273 |
+
return true;
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Get module instance.
|
278 |
+
*
|
279 |
+
* @since 1.0.0
|
280 |
+
* @param string $module Module slug.
|
281 |
+
* @param array $args Module arguments.
|
282 |
+
* @return object
|
283 |
+
*/
|
284 |
+
public function get_module_instance( $module, $args = array() ) {
|
285 |
+
$class_name = self::get_class_name( $module );
|
286 |
+
|
287 |
+
if ( ! class_exists( $class_name ) ) {
|
288 |
+
echo '<p>Class <b>' . $class_name . '</b> not exist!</p>';
|
289 |
+
return false;
|
290 |
+
}
|
291 |
+
|
292 |
+
return $this->modules[ $module ] = call_user_func( array( $class_name, 'get_instance' ), $this, $args );
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Get class name by module slug.
|
297 |
+
*
|
298 |
+
* @since 1.0.0
|
299 |
+
* @param string $slug Module slug.
|
300 |
+
* @return string
|
301 |
+
*/
|
302 |
+
public static function get_class_name( $slug = '' ) {
|
303 |
+
$slug = str_replace( '-', ' ', $slug );
|
304 |
+
$class = str_replace( ' ', '_', ucwords( $slug ) );
|
305 |
+
|
306 |
+
return $class;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Get path to main file for passed module.
|
311 |
+
*
|
312 |
+
* @since 1.0.1
|
313 |
+
* @param string $module Module slug.
|
314 |
+
* @return string
|
315 |
+
*/
|
316 |
+
public function get_module_path( $module ) {
|
317 |
+
$abs_path = false;
|
318 |
+
$rel_path = 'modules/' . $module . '/' . $module . '.php';
|
319 |
+
|
320 |
+
if ( file_exists( $this->settings['extra_base_dir'] . $rel_path ) ) {
|
321 |
+
$abs_path = $this->settings['extra_base_dir'] . $rel_path;
|
322 |
+
} else if ( file_exists( $this->settings['base_dir'] . $rel_path ) ) {
|
323 |
+
$abs_path = $this->settings['base_dir'] . $rel_path;
|
324 |
+
}
|
325 |
+
|
326 |
+
return $abs_path;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Get module priority from it's version.
|
331 |
+
* Version information should be provided as a value stored in the header notation.
|
332 |
+
*
|
333 |
+
* @link https://developer.wordpress.org/reference/functions/get_file_data/
|
334 |
+
* @since 1.0.0
|
335 |
+
* @param string $module Module slug or path.
|
336 |
+
* @param bool $is_path Set this as true, if `$module` contains a path.
|
337 |
+
* @return int
|
338 |
+
*/
|
339 |
+
public function get_module_priority( $module, $is_path = false ) {
|
340 |
+
|
341 |
+
// Default phpDoc headers.
|
342 |
+
$default_headers = array(
|
343 |
+
'version' => 'Version',
|
344 |
+
);
|
345 |
+
|
346 |
+
// Maximum version number (major, minor, patch).
|
347 |
+
$max_version = array(
|
348 |
+
99,
|
349 |
+
99,
|
350 |
+
999,
|
351 |
+
);
|
352 |
+
|
353 |
+
// If `$module` is a slug, get module path.
|
354 |
+
if ( ! $is_path ) {
|
355 |
+
$module = $this->get_module_path( $module );
|
356 |
+
}
|
357 |
+
|
358 |
+
$version = '1.0.0';
|
359 |
+
|
360 |
+
/* @TODO: Add smart check */
|
361 |
+
if ( ! $module ) {
|
362 |
+
return $version;
|
363 |
+
}
|
364 |
+
|
365 |
+
$data = get_file_data( $module , $default_headers );
|
366 |
+
|
367 |
+
// Check if version string has a valid value.
|
368 |
+
if ( isset( $data['version'] ) && false !== strpos( $data['version'], '.' ) ) {
|
369 |
+
|
370 |
+
// Clean the version string.
|
371 |
+
preg_match( '/[\d\.]+/', $data['version'], $version );
|
372 |
+
$version = $version[0];
|
373 |
+
}
|
374 |
+
|
375 |
+
// Convert version into integer.
|
376 |
+
$parts = explode( '.', $version );
|
377 |
+
|
378 |
+
// Calculate priority.
|
379 |
+
foreach ( $parts as $index => $part ) {
|
380 |
+
$parts[ $index ] = $max_version[ $index ] - (int) $part;
|
381 |
+
}
|
382 |
+
|
383 |
+
return (int) join( '', $parts );
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Retrieves the absolute URL to the current file.
|
388 |
+
* Like a WordPress function `plugins_url`.
|
389 |
+
*
|
390 |
+
* @link https://codex.wordpress.org/Function_Reference/plugins_url
|
391 |
+
* @since 1.0.1
|
392 |
+
* @param string $file_path Optional. Extra path appended to the end of the URL.
|
393 |
+
* @param string $module_path A full path to the core or module file.
|
394 |
+
* @return string
|
395 |
+
*/
|
396 |
+
public static function base_url( $file_path = '', $module_path ) {
|
397 |
+
$module_path = wp_normalize_path( $module_path );
|
398 |
+
$module_dir = dirname( $module_path );
|
399 |
+
|
400 |
+
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
|
401 |
+
$stylesheet = get_stylesheet();
|
402 |
+
$theme_root = get_raw_theme_root( $stylesheet );
|
403 |
+
$theme_dir = "$theme_root/$stylesheet";
|
404 |
+
|
405 |
+
if ( 0 === strpos( $module_path, $plugin_dir ) ) {
|
406 |
+
$url = plugin_dir_url( $module_path );
|
407 |
+
} else if ( false !== strpos( $module_path, $theme_dir ) ) {
|
408 |
+
$explode = explode( $theme_dir, $module_dir, 2 );
|
409 |
+
$url = get_stylesheet_directory_uri() . $explode[1];
|
410 |
+
} else {
|
411 |
+
$site_url = site_url();
|
412 |
+
$abs_path = wp_normalize_path( ABSPATH );
|
413 |
+
$url = str_replace( untrailingslashit( $abs_path ), $site_url, $module_dir );
|
414 |
+
}
|
415 |
+
|
416 |
+
if ( $file_path && is_string( $file_path ) ) {
|
417 |
+
$url = trailingslashit( $url );
|
418 |
+
$url .= ltrim( $file_path, '/' );
|
419 |
+
}
|
420 |
+
|
421 |
+
return apply_filters( 'cherry_core_base_url', $url, $file_path, $module_path );
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Pass core instance into widget.
|
426 |
+
*
|
427 |
+
* @since 1.1.0
|
428 |
+
* @param mixed $core Current core object.
|
429 |
+
* @param string $path Abstract widget file path.
|
430 |
+
* @return mixed
|
431 |
+
*/
|
432 |
+
public function pass_core_to_widgets( $core, $path ) {
|
433 |
+
$path = str_replace( '\\', '/', $path );
|
434 |
+
$current_core = str_replace( '\\', '/', $this->settings['extra_base_dir'] );
|
435 |
+
|
436 |
+
if ( false !== strpos( $path, $current_core ) ) {
|
437 |
+
return self::get_instance();
|
438 |
+
}
|
439 |
+
|
440 |
+
return $core;
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Get path to the core directory.
|
445 |
+
*
|
446 |
+
* @since 1.0.0
|
447 |
+
* @deprecated 1.1.0 Use constant `__DIR__`
|
448 |
+
* @return string
|
449 |
+
*/
|
450 |
+
public function get_core_dir() {
|
451 |
+
return trailingslashit( $this->settings['base_dir'] );
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Get URI to the core directory.
|
456 |
+
*
|
457 |
+
* @since 1.0.0
|
458 |
+
* @deprecated 1.1.0 Use `base_url()` method
|
459 |
+
* @return string
|
460 |
+
*/
|
461 |
+
public function get_core_url() {
|
462 |
+
return trailingslashit( $this->settings['base_url'] );
|
463 |
+
}
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Returns the instance.
|
467 |
+
*
|
468 |
+
* @since 1.0.0
|
469 |
+
* @return object
|
470 |
+
*/
|
471 |
+
public static function get_instance() {
|
472 |
+
|
473 |
+
// If the single instance hasn't been set, set it now.
|
474 |
+
if ( null == self::$instance ) {
|
475 |
+
self::$instance = new self;
|
476 |
+
}
|
477 |
+
|
478 |
+
return self::$instance;
|
479 |
+
}
|
480 |
+
}
|
481 |
+
}
|
cherry-framework/codesniffer.ruleset.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<ruleset name="WordPress Theme Coding Standards">
|
3 |
+
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
|
4 |
+
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
|
5 |
+
|
6 |
+
<!-- Set a description for this ruleset. -->
|
7 |
+
<description>A custom set of code standard rules to check for WordPress themes.</description>
|
8 |
+
|
9 |
+
<!-- Include the WordPress ruleset, with space for exclusions if necessary. -->
|
10 |
+
<rule ref="WordPress-Core">
|
11 |
+
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
|
12 |
+
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
|
13 |
+
|
14 |
+
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
|
15 |
+
|
16 |
+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" />
|
17 |
+
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
|
18 |
+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
|
19 |
+
<exclude name="Squiz.Commenting.InlineComment.NotCapital" />
|
20 |
+
</rule>
|
21 |
+
<rule ref="WordPress-Docs">
|
22 |
+
|
23 |
+
</rule>
|
24 |
+
</ruleset>
|
cherry-framework/config.json
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name" : "Cherry Framework",
|
3 |
+
"version" : "1.0.0",
|
4 |
+
"description" : "",
|
5 |
+
"doc_link" : "",
|
6 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework",
|
7 |
+
"modules" : {
|
8 |
+
"cherry-breadcrumbs" : {
|
9 |
+
"name" : "Breadcrumb Trail",
|
10 |
+
"description" : "A breadcrumb menu script for WordPress.",
|
11 |
+
"doc_link" : "",
|
12 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-breadcrumbs",
|
13 |
+
"compatible" : ["theme", "plugin"],
|
14 |
+
"wordpress_org" : true,
|
15 |
+
"required" : false,
|
16 |
+
"dependencies" : []
|
17 |
+
},
|
18 |
+
"cherry-creator" : {
|
19 |
+
"name" : "Creator.",
|
20 |
+
"description" : "Creator.",
|
21 |
+
"doc_link" : "",
|
22 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-creator",
|
23 |
+
"compatible" : ["theme", "plugin"],
|
24 |
+
"wordpress_org" : true,
|
25 |
+
"required" : false,
|
26 |
+
"dependencies" : []
|
27 |
+
},
|
28 |
+
"cherry-customizer" : {
|
29 |
+
"name" : "Customizer",
|
30 |
+
"description" : "Customizer functionality.",
|
31 |
+
"doc_link" : "",
|
32 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-customizer",
|
33 |
+
"compatible" : ["theme", "plugin"],
|
34 |
+
"wordpress_org" : true,
|
35 |
+
"required" : false,
|
36 |
+
"dependencies" : []
|
37 |
+
},
|
38 |
+
"cherry-dynamic-css" : {
|
39 |
+
"name" : "Dynamic Css",
|
40 |
+
"description" : "Generate Css.",
|
41 |
+
"doc_link" : "",
|
42 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-dynamic-css",
|
43 |
+
"compatible" : ["theme", "plugin"],
|
44 |
+
"wordpress_org" : true,
|
45 |
+
"required" : false,
|
46 |
+
"dependencies" : []
|
47 |
+
},
|
48 |
+
"cherry-google-fonts-loader" : {
|
49 |
+
"name" : "Google Fonts Loader",
|
50 |
+
"description" : "Enqueue Google font.",
|
51 |
+
"doc_link" : "",
|
52 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-google-fonts-loader",
|
53 |
+
"compatible" : ["theme", "plugin"],
|
54 |
+
"wordpress_org" : true,
|
55 |
+
"required" : false,
|
56 |
+
"dependencies" : []
|
57 |
+
},
|
58 |
+
"cherry-js-core" : {
|
59 |
+
"name" : "JS Core",
|
60 |
+
"description" : "Initializes global JS object which provides additional plugin functionality.",
|
61 |
+
"doc_link" : "",
|
62 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-js-core",
|
63 |
+
"compatible" : ["theme", "plugin"],
|
64 |
+
"wordpress_org" : true,
|
65 |
+
"required" : false,
|
66 |
+
"dependencies" : []
|
67 |
+
},
|
68 |
+
"cherry-page-builder" : {
|
69 |
+
"name" : "Page Builder",
|
70 |
+
"description" : "Provides functionality for building custom options pages.",
|
71 |
+
"doc_link" : "",
|
72 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-page-builder",
|
73 |
+
"compatible" : ["plugin"],
|
74 |
+
"wordpress_org" : true,
|
75 |
+
"required" : false,
|
76 |
+
"dependencies" : []
|
77 |
+
},
|
78 |
+
"cherry-plugin-updater" : {
|
79 |
+
"name" : "Plugin Updater",
|
80 |
+
"description" : "Provides functionality for updating plugins.",
|
81 |
+
"doc_link" : "",
|
82 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-plugin-updater",
|
83 |
+
"compatible" : ["plugin"],
|
84 |
+
"wordpress_org" : false,
|
85 |
+
"required" : false,
|
86 |
+
"dependencies" : []
|
87 |
+
},
|
88 |
+
"cherry-post-formats-api" : {
|
89 |
+
"name" : "Post Formats API",
|
90 |
+
"description" : "API for post formats specific content.",
|
91 |
+
"doc_link" : "",
|
92 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-formats-api",
|
93 |
+
"compatible" : ["theme", "plugin"],
|
94 |
+
"wordpress_org" : true,
|
95 |
+
"required" : false,
|
96 |
+
"dependencies" : [ "cherry-js-core" ]
|
97 |
+
},
|
98 |
+
"cherry-post-meta" : {
|
99 |
+
"name" : "Post Meta",
|
100 |
+
"description" : "Manage post meta.",
|
101 |
+
"doc_link" : "",
|
102 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-meta",
|
103 |
+
"compatible" : ["theme", "plugin"],
|
104 |
+
"wordpress_org" : true,
|
105 |
+
"required" : false,
|
106 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
107 |
+
},
|
108 |
+
"cherry-post-types" : {
|
109 |
+
"name" : "Post Types",
|
110 |
+
"description" : "Provides functionality for creating custom post types.",
|
111 |
+
"doc_link" : "",
|
112 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-types",
|
113 |
+
"compatible" : ["plugin"],
|
114 |
+
"wordpress_org" : true,
|
115 |
+
"required" : false,
|
116 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
117 |
+
},
|
118 |
+
"cherry-taxonomies" : {
|
119 |
+
"name" : "Taxanomies",
|
120 |
+
"description" : "Provides functionality for creating custom taxanomies.",
|
121 |
+
"doc_link" : "",
|
122 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-taxonomies",
|
123 |
+
"compatible" : ["plugin"],
|
124 |
+
"wordpress_org" : true,
|
125 |
+
"required" : false,
|
126 |
+
"dependencies" : []
|
127 |
+
},
|
128 |
+
"cherry-term-meta" : {
|
129 |
+
"name" : "Term Meta",
|
130 |
+
"description" : "Manage term metadata.",
|
131 |
+
"doc_link" : "",
|
132 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-term-meta",
|
133 |
+
"compatible" : ["theme", "plugin"],
|
134 |
+
"wordpress_org" : true,
|
135 |
+
"required" : false,
|
136 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
137 |
+
},
|
138 |
+
"cherry-theme-updater" : {
|
139 |
+
"name" : "Theme Updater",
|
140 |
+
"description" : "Provides functionality for updating themes.",
|
141 |
+
"doc_link" : "",
|
142 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-theme-updater",
|
143 |
+
"compatible" : ["theme"],
|
144 |
+
"wordpress_org" : false,
|
145 |
+
"required" : false,
|
146 |
+
"dependencies" : []
|
147 |
+
},
|
148 |
+
"cherry-ui-elements" : {
|
149 |
+
"name" : "UI Elements",
|
150 |
+
"description" : "UI Elements",
|
151 |
+
"doc_link" : "",
|
152 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-ui-elements",
|
153 |
+
"compatible" : ["theme", "plugin"],
|
154 |
+
"wordpress_org" : true,
|
155 |
+
"required" : false,
|
156 |
+
"dependencies" : [ "cherry-js-core" ]
|
157 |
+
},
|
158 |
+
"cherry-utility" : {
|
159 |
+
"name" : "Utility",
|
160 |
+
"description" : "Multiple utility functions.",
|
161 |
+
"doc_link" : "",
|
162 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-utility",
|
163 |
+
"compatible" : ["theme", "plugin"],
|
164 |
+
"wordpress_org" : true,
|
165 |
+
"required" : false,
|
166 |
+
"dependencies" : []
|
167 |
+
},
|
168 |
+
"cherry-widget-factory" : {
|
169 |
+
"name" : "Widget Factory.",
|
170 |
+
"description" : "Base widget class that simplifies creating of your own widgets.",
|
171 |
+
"doc_link" : "",
|
172 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-widget-factory",
|
173 |
+
"compatible" : ["theme", "plugin"],
|
174 |
+
"wordpress_org" : true,
|
175 |
+
"required" : false,
|
176 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
177 |
+
},
|
178 |
+
"cherry-toolkit": {
|
179 |
+
"name": "Framework Toolkit",
|
180 |
+
"description": "Framework Toolkit contains various PHP utilities",
|
181 |
+
"doc_link": "",
|
182 |
+
"git_link": "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-toolkit",
|
183 |
+
"compatible": ["theme", "plugin"],
|
184 |
+
"wordpress_org": true,
|
185 |
+
"required": true,
|
186 |
+
"dependencies": []
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
cherry-framework/modules/cherry-js-core/assets/js/cherry-js-core.js
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var CherryJsCore = {};
|
2 |
+
|
3 |
+
( function( $ ) {
|
4 |
+
'use strict';
|
5 |
+
|
6 |
+
CherryJsCore = {
|
7 |
+
name: 'Cherry Js Core',
|
8 |
+
version: '1.0.0',
|
9 |
+
author: 'Cherry Team',
|
10 |
+
|
11 |
+
variable: {
|
12 |
+
$document: $( document ),
|
13 |
+
$window: $( window ),
|
14 |
+
browser: $.browser,
|
15 |
+
browser_supported: true,
|
16 |
+
security: window.cherry_ajax,
|
17 |
+
loaded_assets: {
|
18 |
+
script: window.wp_load_script,
|
19 |
+
style: window.wp_load_style
|
20 |
+
},
|
21 |
+
ui_auto_init: ( 'true' === window.ui_init_object.auto_init ) ? true : false,
|
22 |
+
ui_auto_target: window.ui_init_object.targets
|
23 |
+
},
|
24 |
+
|
25 |
+
status: {
|
26 |
+
on_load: false,
|
27 |
+
is_ready: false
|
28 |
+
},
|
29 |
+
|
30 |
+
init: function(){
|
31 |
+
|
32 |
+
CherryJsCore.set_variable();
|
33 |
+
|
34 |
+
$( document ).ready( CherryJsCore.ready );
|
35 |
+
|
36 |
+
$( window ).load( CherryJsCore.load );
|
37 |
+
},
|
38 |
+
|
39 |
+
set_variable: function() {
|
40 |
+
//Set variable browser_supported
|
41 |
+
CherryJsCore.variable.browser_supported = ( function (){
|
42 |
+
var uset_browser = CherryJsCore.variable.browser,
|
43 |
+
not_supported = { 'msie': [8] };
|
44 |
+
|
45 |
+
for ( var browser in not_supported ) {
|
46 |
+
if( uset_browser.browser !== 'undefined' ){
|
47 |
+
for ( var version in not_supported[ browser ] ) {
|
48 |
+
if( uset_browser.version <= not_supported [ browser ] [ version ] ){
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
return true;
|
56 |
+
}() );
|
57 |
+
},
|
58 |
+
|
59 |
+
ready: function() {
|
60 |
+
CherryJsCore.status.is_ready = true;
|
61 |
+
|
62 |
+
// UI target init
|
63 |
+
CherryJsCore.expressions.ui_init();
|
64 |
+
|
65 |
+
// UI init after widget adding to sidebar
|
66 |
+
CherryJsCore.expressions.widget_added_ui_init();
|
67 |
+
|
68 |
+
// UI init after widget saving
|
69 |
+
CherryJsCore.expressions.widget_updated_ui_init();
|
70 |
+
},
|
71 |
+
|
72 |
+
load: function() {
|
73 |
+
CherryJsCore.status.on_load = true;
|
74 |
+
},
|
75 |
+
|
76 |
+
expressions: {
|
77 |
+
ui_init: function() {
|
78 |
+
if ( CherryJsCore.variable.ui_auto_init ) {
|
79 |
+
CherryJsCore.variable.ui_auto_target.forEach( function( target ) {
|
80 |
+
CherryJsCore.variable.$window.trigger( 'cherry-ui-elements-init', { 'target': $( target ) } );
|
81 |
+
});
|
82 |
+
}
|
83 |
+
},
|
84 |
+
widget_added_ui_init: function() {
|
85 |
+
$( document ).on( 'widget-added', function( event, data ) {
|
86 |
+
$( window ).trigger( 'cherry-ui-elements-init', { 'target': data } );
|
87 |
+
} );
|
88 |
+
},
|
89 |
+
widget_updated_ui_init: function() {
|
90 |
+
$( document ).on( 'widget-updated', function( event, data ) {
|
91 |
+
$( window ).trigger( 'cherry-ui-elements-init', { 'target': data } );
|
92 |
+
} );
|
93 |
+
}
|
94 |
+
},
|
95 |
+
|
96 |
+
utilites: {
|
97 |
+
namespace: function( space_path ) {
|
98 |
+
var parts = space_path.split( '.' ),
|
99 |
+
parent = CherryJsCore,
|
100 |
+
length = parts.length,
|
101 |
+
i = 0;
|
102 |
+
|
103 |
+
for(i = 0; i < length; i += 1 ){
|
104 |
+
if( typeof parent[ parts[ i ] ] === 'undefined' ){
|
105 |
+
parent[ parts[ i ] ] = {};
|
106 |
+
}
|
107 |
+
parent = parent[ parts[ i ] ];
|
108 |
+
}
|
109 |
+
return parent;
|
110 |
+
},
|
111 |
+
get_compress_assets: function( url, callback ) {
|
112 |
+
var data = {
|
113 |
+
action: 'get_compress_assets',
|
114 |
+
security: CherryJsCore.variable.security,
|
115 |
+
style: [],
|
116 |
+
script: []
|
117 |
+
},
|
118 |
+
reg_name = /([\S.]+\/)/gmi,
|
119 |
+
reg_type = /(\.js|\.css)/gmi,
|
120 |
+
callback_function = callback || function() {};
|
121 |
+
|
122 |
+
if( !$.isArray( url ) ){
|
123 |
+
url = [ url ];
|
124 |
+
}
|
125 |
+
|
126 |
+
for( var index in url ){
|
127 |
+
var file_url = url[ index ],
|
128 |
+
file_name = file_url.replace( reg_name, '' ),
|
129 |
+
file_type = file_url.match( reg_type )[ 0 ];
|
130 |
+
|
131 |
+
if( '.js' === file_type && -1 === $.inArray( file_name, CherryJsCore.variable.loaded_assets.script ) ){
|
132 |
+
data.script.push( file_url );
|
133 |
+
CherryJsCore.variable.loaded_assets.script.push( file_name );
|
134 |
+
}
|
135 |
+
|
136 |
+
if( '.css' === file_type && -1 === $.inArray( file_name, CherryJsCore.variable.loaded_assets.style ) ){
|
137 |
+
data.style.push( file_url );
|
138 |
+
CherryJsCore.variable.loaded_assets.style.push( file_name );
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
$.get( window.ajaxurl, data, function( response ) {
|
143 |
+
var json = $.parseJSON(response),
|
144 |
+
compressStyle = json.style,
|
145 |
+
compressScript = json.script,
|
146 |
+
script = null;
|
147 |
+
|
148 |
+
if(compressStyle){
|
149 |
+
var style = document.createElement('style');
|
150 |
+
|
151 |
+
style.type = 'text/css';
|
152 |
+
style.media = 'all';
|
153 |
+
style.innerHTML = compressStyle;
|
154 |
+
|
155 |
+
$('body', document).append(style);
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( compressScript ) {
|
160 |
+
script = new Function( compressScript ) ();
|
161 |
+
}
|
162 |
+
|
163 |
+
return callback_function();
|
164 |
+
});
|
165 |
+
}
|
166 |
+
}
|
167 |
+
};
|
168 |
+
|
169 |
+
CherryJsCore.init();
|
170 |
+
}(jQuery));
|
cherry-framework/modules/cherry-js-core/assets/js/min/cherry-js-core.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var CherryJsCore={};!function(e){"use strict";CherryJsCore={name:"Cherry Js Core",version:"1.0.0",author:"Cherry Team",variable:{$document:e(document),$window:e(window),browser:e.browser,browser_supported:!0,security:window.cherry_ajax,loaded_assets:{script:window.wp_load_script,style:window.wp_load_style},ui_auto_init:"true"===window.ui_init_object.auto_init?!0:!1,ui_auto_target:window.ui_init_object.targets},status:{on_load:!1,is_ready:!1},init:function(){CherryJsCore.set_variable(),e(document).ready(CherryJsCore.ready),e(window).load(CherryJsCore.load)},set_variable:function(){CherryJsCore.variable.browser_supported=function(){var e=CherryJsCore.variable.browser,r={msie:[8]};for(var i in r)if("undefined"!==e.browser)for(var t in r[i])if(e.version<=r[i][t])return!1;return!0}()},ready:function(){CherryJsCore.status.is_ready=!0,CherryJsCore.expressions.ui_init(),CherryJsCore.expressions.widget_added_ui_init(),CherryJsCore.expressions.widget_updated_ui_init()},load:function(){CherryJsCore.status.on_load=!0},expressions:{ui_init:function(){CherryJsCore.variable.ui_auto_init&&CherryJsCore.variable.ui_auto_target.forEach(function(r){CherryJsCore.variable.$window.trigger("cherry-ui-elements-init",{target:e(r)})})},widget_added_ui_init:function(){e(document).on("widget-added",function(r,i){e(window).trigger("cherry-ui-elements-init",{target:i})})},widget_updated_ui_init:function(){e(document).on("widget-updated",function(r,i){e(window).trigger("cherry-ui-elements-init",{target:i})})}},utilites:{namespace:function(e){var r=e.split("."),i=CherryJsCore,t=r.length,s=0;for(s=0;t>s;s+=1)"undefined"==typeof i[r[s]]&&(i[r[s]]={}),i=i[r[s]];return i},get_compress_assets:function(r,i){var t={action:"get_compress_assets",security:CherryJsCore.variable.security,style:[],script:[]},s=/([\S.]+\/)/gim,o=/(\.js|\.css)/gim,n=i||function(){};e.isArray(r)||(r=[r]);for(var a in r){var u=r[a],d=u.replace(s,""),c=u.match(o)[0];".js"===c&&-1===e.inArray(d,CherryJsCore.variable.loaded_assets.script)&&(t.script.push(u),CherryJsCore.variable.loaded_assets.script.push(d)),".css"===c&&-1===e.inArray(d,CherryJsCore.variable.loaded_assets.style)&&(t.style.push(u),CherryJsCore.variable.loaded_assets.style.push(d))}e.get(window.ajaxurl,t,function(r){var i=e.parseJSON(r),t=i.style,s=i.script,o=null;if(t){var a=document.createElement("style");a.type="text/css",a.media="all",a.innerHTML=t,e("body",document).append(a)}return s&&(o=new Function(s)()),n()})}}},CherryJsCore.init()}(jQuery);
|
cherry-framework/modules/cherry-js-core/cherry-js-core.php
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: JS Core
|
4 |
+
* Description: Initializes global JS object which provides additional plugin functionality
|
5 |
+
* Version: 1.1.1
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Modules
|
13 |
+
* @version 1.1.1
|
14 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
+
* @link http://www.cherryframework.com/
|
17 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Cherry_Js_Core' ) ) {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* JS-core class.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @since 1.0.1 Removed `module_directory` and `module_directory_uri` properties.
|
32 |
+
*/
|
33 |
+
class Cherry_Js_Core {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* A reference to an instance of this class.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @var object
|
40 |
+
*/
|
41 |
+
private static $instance = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Module version.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
private $module_version = '1.1.0';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Default options.
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
* @var array
|
56 |
+
*/
|
57 |
+
private $options = array(
|
58 |
+
'product_type' => 'framework',
|
59 |
+
'src' => false,
|
60 |
+
'version' => false,
|
61 |
+
);
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Class constructor.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
* @param object $core Core instance.
|
68 |
+
* @param array $args Class args.
|
69 |
+
*/
|
70 |
+
public function __construct( $core, $args = array() ) {
|
71 |
+
$this->options = array_merge( $this->options, $args );
|
72 |
+
|
73 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_cherry_scripts' ), 0 );
|
74 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_cherry_scripts' ), 0 );
|
75 |
+
add_action( 'wp_print_scripts', array( $this, 'localize_script' ) );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Register and enqueue JS-core.
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
*/
|
83 |
+
public function enqueue_cherry_scripts() {
|
84 |
+
|
85 |
+
if ( 'framework' === $this->options['product_type'] ) {
|
86 |
+
$src = esc_url( Cherry_Core::base_url( 'assets/js/min/cherry-js-core.min.js', __FILE__ ) );
|
87 |
+
$version = $this->module_version;
|
88 |
+
} else {
|
89 |
+
$src = ( ! empty( $this->options['src'] ) ? esc_url( $this->options['src'] ) : false );
|
90 |
+
$version = ( ! empty( $this->options['version'] ) ? absint( $this->options['src'] ) : false );
|
91 |
+
}
|
92 |
+
|
93 |
+
wp_enqueue_script( 'cherry-js-core', $src, array( 'jquery' ), $version, true );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Retrieve a scripts list.
|
98 |
+
*
|
99 |
+
* @since 1.0.0
|
100 |
+
* @return $array
|
101 |
+
*/
|
102 |
+
private function get_include_script() {
|
103 |
+
return $this->add_suffix( '.js', wp_scripts()->queue );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Retrieve a styles list.
|
108 |
+
*
|
109 |
+
* @since 1.0.0
|
110 |
+
* @return $array
|
111 |
+
*/
|
112 |
+
private function get_include_style() {
|
113 |
+
return $this->add_suffix( '.css', wp_styles()->queue );
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* [get_ui_init_settings]
|
118 |
+
*
|
119 |
+
* @since 1.0.0
|
120 |
+
* @return $array
|
121 |
+
*/
|
122 |
+
private function get_ui_init_settings() {
|
123 |
+
|
124 |
+
// Default auto ui init settings.
|
125 |
+
$ui_init_settings = array(
|
126 |
+
'auto_init' => false,
|
127 |
+
'targets' => array(),
|
128 |
+
);
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Filter to determine the list of selectors and the value of the automatic initialization ui js scripts
|
132 |
+
*
|
133 |
+
* @var array
|
134 |
+
*/
|
135 |
+
return apply_filters( 'cherry_core_js_ui_init_settings', $ui_init_settings );
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Add suffix to array.
|
140 |
+
*
|
141 |
+
* @since 1.0.0
|
142 |
+
*/
|
143 |
+
private function add_suffix( $suffix, $array ) {
|
144 |
+
|
145 |
+
foreach ( $array as $key => $value ) {
|
146 |
+
$array[ $key ] = $value . $suffix;
|
147 |
+
}
|
148 |
+
|
149 |
+
return $array;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Prepare data for API script.
|
154 |
+
*
|
155 |
+
* @since 1.0.0
|
156 |
+
* @return void
|
157 |
+
*/
|
158 |
+
public function localize_script() {
|
159 |
+
wp_localize_script( 'cherry-js-core', 'wp_load_style', $this->get_include_style() );
|
160 |
+
wp_localize_script( 'cherry-js-core', 'wp_load_script', $this->get_include_script() );
|
161 |
+
wp_localize_script( 'cherry-js-core', 'cherry_ajax', wp_create_nonce( 'cherry_ajax_nonce' ) );
|
162 |
+
|
163 |
+
$ui_init_settings = $this->get_ui_init_settings();
|
164 |
+
$ui_init_settings['auto_init'] = ( true == $ui_init_settings['auto_init'] ) ? 'true' : 'false';
|
165 |
+
wp_localize_script( 'cherry-js-core', 'ui_init_object', $ui_init_settings );
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Returns the instance.
|
170 |
+
*
|
171 |
+
* @since 1.0.0
|
172 |
+
* @return object
|
173 |
+
*/
|
174 |
+
public static function get_instance( $core, $args ) {
|
175 |
+
|
176 |
+
// If the single instance hasn't been set, set it now.
|
177 |
+
if ( null == self::$instance ) {
|
178 |
+
self::$instance = new self( $core, $args );
|
179 |
+
}
|
180 |
+
|
181 |
+
return self::$instance;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
cherry-framework/modules/cherry-toolkit/cherry-toolkit.php
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: Framework Toolkit
|
4 |
+
* Description: Framework Toolkit contains various PHP utilities
|
5 |
+
* Version: 1.1.0
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Class
|
13 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
14 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
15 |
+
* @link http://www.cherryframework.com/
|
16 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
17 |
+
*/
|
18 |
+
|
19 |
+
// If this file is called directly, abort.
|
20 |
+
if ( ! defined( 'WPINC' ) ) {
|
21 |
+
die;
|
22 |
+
}
|
23 |
+
|
24 |
+
if ( ! class_exists( 'Cherry_Toolkit' ) ) {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Various PHP utilities
|
28 |
+
*/
|
29 |
+
class Cherry_Toolkit {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Module version
|
33 |
+
*
|
34 |
+
* @var string Module version
|
35 |
+
*/
|
36 |
+
public $module_version = '1.1.0';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Module slug
|
40 |
+
*
|
41 |
+
* @var string Module slug
|
42 |
+
*/
|
43 |
+
public $module_slug = 'cherry-toolkit';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Constructor for the module
|
47 |
+
*
|
48 |
+
* @param Cherry_Core $core Core instance.
|
49 |
+
* @param array $args Module arguments.
|
50 |
+
*/
|
51 |
+
public function __construct( $core, $args ) {}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns the instance.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
+
* @return object
|
58 |
+
*/
|
59 |
+
public static function get_instance( $core, $args ) {
|
60 |
+
return new self( $core, $args );
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Safely get attribute from field settings array.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
* @param array $field arguments array.
|
68 |
+
* @param string|int|float $arg argument key.
|
69 |
+
* @param mixed $default default argument value.
|
70 |
+
* @return mixed
|
71 |
+
*/
|
72 |
+
public static function get_arg( $field, $arg, $default = '' ) {
|
73 |
+
|
74 |
+
if ( is_array( $field ) && isset( $field[ $arg ] ) ) {
|
75 |
+
return $field[ $arg ];
|
76 |
+
}
|
77 |
+
|
78 |
+
return $default;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Get class instance
|
83 |
+
*
|
84 |
+
* @param string $class_name Class name.
|
85 |
+
* @param Cherry_Core $core Core instance.
|
86 |
+
* @param array $args Additional arguments.
|
87 |
+
* @return object New class instance.
|
88 |
+
* @throws InvalidArgumentException If class does not exists.
|
89 |
+
*/
|
90 |
+
public static function get_class_instance( $class_name = '', $core, $args ) {
|
91 |
+
if ( ! class_exists( $class_name ) ) {
|
92 |
+
throw new InvalidArgumentException( 'Class "' . $class_name . '" doesn\'t exists' );
|
93 |
+
}
|
94 |
+
|
95 |
+
return new $class_name( $core, $args );
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Render view
|
100 |
+
*
|
101 |
+
* @param string $path View path.
|
102 |
+
* @param array $data Include data.
|
103 |
+
* @return string Rendered html.
|
104 |
+
*/
|
105 |
+
public static function render_view( $path, array $data = array() ) {
|
106 |
+
|
107 |
+
// Add parameters to temporary query variable.
|
108 |
+
if ( array_key_exists( 'wp_query', $GLOBALS ) ) {
|
109 |
+
if ( is_array( $GLOBALS['wp_query']->query_vars ) ) {
|
110 |
+
$GLOBALS['wp_query']->query_vars['__data'] = $data;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
ob_start();
|
115 |
+
load_template( $path, false );
|
116 |
+
$result = ltrim( ob_get_clean() );
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Remove temporary wp query variable
|
120 |
+
* Yeah. I'm paranoic.
|
121 |
+
*/
|
122 |
+
if ( array_key_exists( 'wp_query', $GLOBALS ) ) {
|
123 |
+
if ( is_array( $GLOBALS['wp_query']->query_vars ) ) {
|
124 |
+
unset( $GLOBALS['wp_query']->query_vars['__data'] );
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
// Return the compiled view and terminate the output buffer.
|
129 |
+
return $result;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Remove empty elements
|
134 |
+
*
|
135 |
+
* @param array $arr --- array with empty elements.
|
136 |
+
* @return array --- array without empty elements
|
137 |
+
*/
|
138 |
+
public static function remove_empty( $arr ) {
|
139 |
+
return array_filter( $arr, array( __CLASS__, 'remove_empty_check' ) );
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Check if empty.
|
144 |
+
* It's need for PHP 5.2.4 version
|
145 |
+
*
|
146 |
+
* @param [type] $var variable.
|
147 |
+
* @return boolean
|
148 |
+
*/
|
149 |
+
public static function remove_empty_check( $var ) {
|
150 |
+
return '' != $var;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Join array to string
|
155 |
+
*
|
156 |
+
* @param array $arr --- array like 'key' => 'value'.
|
157 |
+
* @return string --- joined string
|
158 |
+
*/
|
159 |
+
public static function join( $arr = array() ) {
|
160 |
+
$arr = self::remove_empty( $arr );
|
161 |
+
$result = array();
|
162 |
+
foreach ( $arr as $key => $value ) {
|
163 |
+
$result[] = sprintf( '%s="%s"', $key, $value );
|
164 |
+
}
|
165 |
+
return implode( ' ', $result );
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Lave just right keys in array
|
170 |
+
*
|
171 |
+
* @param array $right_keys right keys to leave.
|
172 |
+
* @param array $array list.
|
173 |
+
* @return array
|
174 |
+
*/
|
175 |
+
public static function leave_right_keys( $right_keys, $array ) {
|
176 |
+
$right_keys = (array) $right_keys;
|
177 |
+
$array = (array) $array;
|
178 |
+
if ( count( $array ) ) {
|
179 |
+
foreach ( $array as $key => $value ) {
|
180 |
+
if ( ! in_array( $key, $right_keys ) ) {
|
181 |
+
unset( $array[ $key ] );
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
185 |
+
return $array;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Remove some keys form array
|
190 |
+
*
|
191 |
+
* @param [type] $right_keys keys to remove.
|
192 |
+
* @param [type] $array where we want remove this keys.
|
193 |
+
* @return array without keys
|
194 |
+
*/
|
195 |
+
public static function remove_right_keys( $right_keys, $array ) {
|
196 |
+
$right_keys = (array) $right_keys;
|
197 |
+
$array = (array) $array;
|
198 |
+
if ( count( $right_keys ) ) {
|
199 |
+
foreach ( $right_keys as $key ) {
|
200 |
+
if ( array_key_exists( $key, $array ) ) {
|
201 |
+
unset( $array[ $key ] );
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
return $array;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
cherry-framework/modules/cherry-ui-elements/cherry-ui-elements.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: UI Elements
|
4 |
+
* Description: Class for the building ui elements
|
5 |
+
* Version: 1.1.1
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Modules
|
13 |
+
* @version 1.1.1
|
14 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
+
* @link http://www.cherryframework.com/
|
17 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Cherry_UI_Elements' ) ) {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class for the building ui elements.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @since 1.0.3 Removed `module_directory` and `module_directory_uri` properties.
|
32 |
+
*/
|
33 |
+
class Cherry_UI_Elements {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Default arguments.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @var array
|
40 |
+
*/
|
41 |
+
private $args = array(
|
42 |
+
'ui_elements' => array(
|
43 |
+
'text',
|
44 |
+
'textarea',
|
45 |
+
'select',
|
46 |
+
'checkbox',
|
47 |
+
'radio',
|
48 |
+
'colorpicker',
|
49 |
+
'media',
|
50 |
+
'stepper',
|
51 |
+
'switcher',
|
52 |
+
'slider',
|
53 |
+
'repeater',
|
54 |
+
'iconpicker',
|
55 |
+
),
|
56 |
+
);
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Constructor.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
* @param object $core Core.
|
63 |
+
* @param array $args Arguments.
|
64 |
+
*/
|
65 |
+
public function __construct( $core, $args ) {
|
66 |
+
$this->args = array_merge( $this->args, $args );
|
67 |
+
$this->ui_elements_require();
|
68 |
+
|
69 |
+
// Load admin assets.
|
70 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ), 9 );
|
71 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_admin_assets' ), 9 );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get UI-element instance.
|
76 |
+
*
|
77 |
+
* @since 1.0.0
|
78 |
+
* @param [type] $ui_slug ui element.
|
79 |
+
* @param array $args arguments.
|
80 |
+
* @return object
|
81 |
+
*/
|
82 |
+
public function get_ui_element_instance( $ui_slug, $args ) {
|
83 |
+
|
84 |
+
if ( empty( $ui_slug ) ) {
|
85 |
+
echo '<p>Set an empty slug</p>';
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( ! in_array( $ui_slug, $this->args['ui_elements'] ) ) {
|
90 |
+
echo '<p> Element <b>' . $ui_slug . '</b> has not been initialized in this instance!</p>';
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
|
94 |
+
$ui_class_name = 'UI_' . ucwords( $ui_slug );
|
95 |
+
|
96 |
+
if ( ! class_exists( $ui_class_name ) ) {
|
97 |
+
echo '<p>Class <b>' . $ui_class_name . '</b> not exist!</p>';
|
98 |
+
return false;
|
99 |
+
}
|
100 |
+
return new $ui_class_name( $args );
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Require UI-elements.
|
105 |
+
*
|
106 |
+
* @since 1.0.0
|
107 |
+
* @return void
|
108 |
+
*/
|
109 |
+
public function ui_elements_require() {
|
110 |
+
|
111 |
+
// Add I_UI interface.
|
112 |
+
if ( ! interface_exists( 'I_UI' ) ) {
|
113 |
+
require_once( __DIR__ . '/i-ui.php' );
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( ! class_exists( 'UI_Element' ) ) {
|
117 |
+
require_once( __DIR__ . '/ui-element.php' );
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( ! empty( $this->args['ui_elements'] ) ) {
|
121 |
+
foreach ( $this->args['ui_elements'] as $ui_element ) {
|
122 |
+
require_once( __DIR__ . '/inc/ui-elements/ui-' . $ui_element . '/ui-' . $ui_element . '.php' );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Load admin assets.
|
129 |
+
*
|
130 |
+
* @since 1.0.0
|
131 |
+
*/
|
132 |
+
public function enqueue_admin_assets() {
|
133 |
+
if ( ! empty( $this->args['ui_elements'] ) ) {
|
134 |
+
foreach ( $this->args['ui_elements'] as $ui_element ) {
|
135 |
+
$ui_class_name = 'UI_' . ucwords( $ui_element );
|
136 |
+
call_user_func( array( $ui_class_name, 'enqueue_assets' ) );
|
137 |
+
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Returns the instance.
|
144 |
+
*
|
145 |
+
* @since 1.0.0
|
146 |
+
* @return object
|
147 |
+
*/
|
148 |
+
public static function get_instance( $core, $args ) {
|
149 |
+
return new self( $core, $args );
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
cherry-framework/modules/cherry-ui-elements/i-ui.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* I'am UI interface
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* UI element interface
|
15 |
+
*/
|
16 |
+
|
17 |
+
interface I_UI {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Enqueue javascript and stylesheet to UI element.
|
21 |
+
*/
|
22 |
+
public static function enqueue_assets();
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Render UI element.
|
26 |
+
*
|
27 |
+
* @return string.
|
28 |
+
*/
|
29 |
+
public function render();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get control name
|
33 |
+
*
|
34 |
+
* @return string control name.
|
35 |
+
*/
|
36 |
+
public function get_name();
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Set control name
|
40 |
+
*
|
41 |
+
* @param [type] $name new control name.
|
42 |
+
*/
|
43 |
+
public function set_name( $name );
|
44 |
+
|
45 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/min/ui-checkbox.min.css
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-container {
|
2 |
+
margin: 10px 0 20px 0; }
|
3 |
+
|
4 |
+
label.cherry-label {
|
5 |
+
margin: 0 0 5px 0;
|
6 |
+
display: block; }
|
7 |
+
|
8 |
+
.cherry-checkbox-item {
|
9 |
+
width: 26px;
|
10 |
+
height: 26px;
|
11 |
+
display: inline-block;
|
12 |
+
border-radius: 2px;
|
13 |
+
margin-right: 10px;
|
14 |
+
margin-bottom: 6px;
|
15 |
+
cursor: pointer;
|
16 |
+
position: relative;
|
17 |
+
background-color: #f1f1f1;
|
18 |
+
-webkit-user-select: none;
|
19 |
+
-moz-user-select: none;
|
20 |
+
-ms-user-select: none;
|
21 |
+
user-select: none;
|
22 |
+
-webkit-transition: all 0.2s ease-out;
|
23 |
+
transition: all 0.2s ease-out; }
|
24 |
+
.cherry-checkbox-item .marker {
|
25 |
+
position: absolute;
|
26 |
+
width: 26px;
|
27 |
+
height: 26px;
|
28 |
+
top: 0px;
|
29 |
+
left: 0px;
|
30 |
+
color: #fff;
|
31 |
+
font-size: 28px;
|
32 |
+
-webkit-transform: scale(0);
|
33 |
+
-ms-transform: scale(0);
|
34 |
+
transform: scale(0);
|
35 |
+
-webkit-transition: all 0.3s cubic-bezier(0.27, 0.63, 0.54, 0.96);
|
36 |
+
transition: all 0.3s cubic-bezier(0.27, 0.63, 0.54, 0.96); }
|
37 |
+
.cherry-checkbox-item .marker:before {
|
38 |
+
position: relative;
|
39 |
+
left: -2px; }
|
40 |
+
.cherry-checkbox-item.checked {
|
41 |
+
background-color: #48c569; }
|
42 |
+
.cherry-checkbox-item.checked .marker {
|
43 |
+
-webkit-transform: scale(1);
|
44 |
+
-ms-transform: scale(1);
|
45 |
+
transform: scale(1); }
|
46 |
+
|
47 |
+
.cherry-checkbox-label {
|
48 |
+
display: inline-block;
|
49 |
+
vertical-align: top;
|
50 |
+
font-size: 14px;
|
51 |
+
line-height: 26px;
|
52 |
+
color: #23282d;
|
53 |
+
-webkit-user-select: none;
|
54 |
+
-moz-user-select: none;
|
55 |
+
-ms-user-select: none;
|
56 |
+
user-select: none; }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/min/ui-checkbox.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,c){"use strict";c.utilites.namespace("ui_elements.checkbox"),c.ui_elements.checkbox={init:function(){e(window).on("cherry-ui-elements-init",this.render.bind(this))},render:function(c,i){var t=i.target;e('.cherry-checkbox-input[type="hidden"]',t).each(function(){var c=e(this),i=c.data("slave"),s="true"===c.val();s||e("."+i,t).stop().hide()}),e(".cherry-checkbox-item",t).on("click",function(){var c=e(this).siblings('.cherry-checkbox-input[type="hidden"]'),i=c.data("slave"),s="true"===c.val();e(this).hasClass("checked")?(e(this).removeClass("checked"),c.val("false"),s=!1,e("."+i,t).hide()):(e(this).addClass("checked"),c.val("true"),s=!0,e("."+i,t).show()),c.trigger("change")}),e(".cherry-checkbox-label",t).on("click",function(){var c=e(this).siblings('.cherry-checkbox-input[type="hidden"]'),i=e(this).siblings(".cherry-checkbox-item"),s=c.data("slave"),h="true"===c.val();i.hasClass("checked")?(i.removeClass("checked"),c.val("false"),h=!1,e("."+s,t).hide()):(i.addClass("checked"),c.val("true"),h=!0,e("."+s,t).show()),c.trigger("change")})}},c.ui_elements.checkbox.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-checkbox.js
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Checkbox
|
3 |
+
*/
|
4 |
+
(function($, CherryJsCore){
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace('ui_elements.checkbox');
|
8 |
+
CherryJsCore.ui_elements.checkbox = {
|
9 |
+
init: function () {
|
10 |
+
$( window ).on( 'cherry-ui-elements-init', this.render.bind( this ) );
|
11 |
+
},
|
12 |
+
render: function ( event, data ) {
|
13 |
+
var target = data.target;
|
14 |
+
|
15 |
+
$( '.cherry-checkbox-input[type="hidden"]', target ).each( function() {
|
16 |
+
var $this = $( this ),
|
17 |
+
this_slave = $this.data( 'slave' ),
|
18 |
+
state = ( $this.val() === 'true' );
|
19 |
+
|
20 |
+
if ( ! state ) {
|
21 |
+
$( '.'+ this_slave, target ).stop().hide();
|
22 |
+
}
|
23 |
+
});
|
24 |
+
|
25 |
+
$( '.cherry-checkbox-item', target ).on( 'click', function() {
|
26 |
+
var input = $( this ).siblings( '.cherry-checkbox-input[type="hidden"]' ),
|
27 |
+
slave = input.data( 'slave' ),
|
28 |
+
state = ( input.val() === 'true' );
|
29 |
+
|
30 |
+
if ( $( this ).hasClass( 'checked' ) ) {
|
31 |
+
$( this ).removeClass( 'checked' );
|
32 |
+
input.val( 'false' );
|
33 |
+
state = false;
|
34 |
+
|
35 |
+
$( '.' + slave, target ).hide();
|
36 |
+
} else {
|
37 |
+
$( this ).addClass( 'checked' );
|
38 |
+
input.val( 'true' );
|
39 |
+
state = true;
|
40 |
+
|
41 |
+
$( '.' + slave, target ).show();
|
42 |
+
}
|
43 |
+
|
44 |
+
input.trigger( 'change' );
|
45 |
+
} );
|
46 |
+
|
47 |
+
$( '.cherry-checkbox-label', target ).on( 'click', function() {
|
48 |
+
var input = $( this ).siblings( '.cherry-checkbox-input[type="hidden"]' ),
|
49 |
+
item = $( this ).siblings( '.cherry-checkbox-item' ),
|
50 |
+
slave = input.data( 'slave' ),
|
51 |
+
state = ( input.val() === 'true' );
|
52 |
+
|
53 |
+
if ( item.hasClass( 'checked' ) ) {
|
54 |
+
item.removeClass( 'checked' );
|
55 |
+
input.val( 'false' );
|
56 |
+
state = false;
|
57 |
+
|
58 |
+
$( '.' + slave, target ).hide();
|
59 |
+
} else {
|
60 |
+
item.addClass( 'checked' );
|
61 |
+
input.val( 'true' );
|
62 |
+
state = true;
|
63 |
+
|
64 |
+
$( '.' + slave, target ).show();
|
65 |
+
}
|
66 |
+
|
67 |
+
input.trigger( 'change' );
|
68 |
+
} );
|
69 |
+
}
|
70 |
+
};
|
71 |
+
|
72 |
+
CherryJsCore.ui_elements.checkbox.init();
|
73 |
+
}(jQuery, window.CherryJsCore));
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-checkbox.scss
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
.cherry-checkbox-item{
|
12 |
+
width: 26px;
|
13 |
+
height: 26px;
|
14 |
+
display: inline-block;
|
15 |
+
border-radius: $border_radius_extra_small;
|
16 |
+
margin-right: 10px;
|
17 |
+
margin-bottom: 6px;
|
18 |
+
cursor: pointer;
|
19 |
+
position: relative;
|
20 |
+
background-color: $grey_color_3;
|
21 |
+
user-select: none;
|
22 |
+
transition: all 0.2s ease-out;
|
23 |
+
.marker{
|
24 |
+
position: absolute;
|
25 |
+
width: 26px;
|
26 |
+
height: 26px;
|
27 |
+
top: 0px;
|
28 |
+
left: 0px;
|
29 |
+
color: #fff;
|
30 |
+
font-size: 28px;
|
31 |
+
transform: scale(0);
|
32 |
+
transition: all 0.3s cubic-bezier(.27,.63,.54,.96);
|
33 |
+
&:before{
|
34 |
+
position: relative;
|
35 |
+
left: -2px;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
&.checked{
|
39 |
+
background-color: $green_color;
|
40 |
+
.marker{
|
41 |
+
transform: scale(1);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
.cherry-checkbox-label{
|
46 |
+
display: inline-block;
|
47 |
+
vertical-align: top;
|
48 |
+
font-size: 14px;
|
49 |
+
line-height: 26px;
|
50 |
+
color: $dark_color_1;
|
51 |
+
user-select: none;
|
52 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/ui-checkbox.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-checkbox elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Checkbox' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Checkbox elements.
|
22 |
+
*/
|
23 |
+
class UI_Checkbox extends UI_Element implements I_UI {
|
24 |
+
/**
|
25 |
+
* Default settings
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
private $defaults_settings = array(
|
30 |
+
'id' => 'cherry-ui-checkbox-id',
|
31 |
+
'name' => 'cherry-ui-checkbox-name',
|
32 |
+
'value' => array(
|
33 |
+
'checkbox-1' => 'true',
|
34 |
+
'checkbox-2' => 'true',
|
35 |
+
'checkbox-3' => 'true',
|
36 |
+
),
|
37 |
+
'options' => array(
|
38 |
+
'checkbox-1' => 'checkbox 1',
|
39 |
+
'checkbox-2' => 'checkbox 2',
|
40 |
+
'checkbox-3' => 'checkbox 3',
|
41 |
+
),
|
42 |
+
'label' => '',
|
43 |
+
'class' => '',
|
44 |
+
'master' => '',
|
45 |
+
);
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Constructor method for the UI_Checkbox class.
|
49 |
+
*
|
50 |
+
* @since 4.0.0
|
51 |
+
*/
|
52 |
+
function __construct( $args = array() ) {
|
53 |
+
$this->defaults_settings['id'] = 'cherry-ui-checkbox-'.uniqid();
|
54 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
55 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Render html UI_Checkbox.
|
60 |
+
*
|
61 |
+
* @since 4.0.0
|
62 |
+
*/
|
63 |
+
public function render() {
|
64 |
+
$html = '';
|
65 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
66 |
+
|
67 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
68 |
+
|
69 |
+
$counter = 0;
|
70 |
+
if ( $this->settings['options'] && ! empty( $this->settings['options'] ) && is_array( $this->settings['options'] ) ) {
|
71 |
+
if ( ! is_array( $this->settings['value'] ) ) {
|
72 |
+
$this->settings['value'] = array( $this->settings['value'] );
|
73 |
+
}
|
74 |
+
if ( '' !== $this->settings['label'] ) {
|
75 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
76 |
+
}
|
77 |
+
|
78 |
+
foreach ( $this->settings['options'] as $option => $option_value ) {
|
79 |
+
|
80 |
+
if ( ! empty( $this->settings['value'] ) ) {
|
81 |
+
$option_checked = array_key_exists( $option, $this->settings['value'] ) ? $option : '';
|
82 |
+
$item_value = ! empty( $option_checked ) ? $this->settings['value'][ $option ] : 'false';
|
83 |
+
} else {
|
84 |
+
$option_checked = '';
|
85 |
+
$item_value = 'false';
|
86 |
+
}
|
87 |
+
|
88 |
+
$checked = ( ! empty( $option_checked ) && 'true' === $item_value ) ? 'checked' : '';
|
89 |
+
|
90 |
+
$option_label = isset( $option_value ) && is_array( $option_value ) ? $option_value['label'] : $option_value;
|
91 |
+
$data_slave = isset( $option_value['slave'] ) && ! empty( $option_value['slave'] ) ? ' data-slave="' . $option_value['slave'] . '"' : '';
|
92 |
+
|
93 |
+
$html .= '<div class="cherry-checkbox-item-wrap ' . esc_attr( $this->settings['class'] ) . '">';
|
94 |
+
$html .= '<div class="cherry-checkbox-item ' . $checked . '"><span class="marker dashicons dashicons-yes"></span></div>';
|
95 |
+
$html .= '<input type="hidden" id="' . esc_attr( $this->settings['id'] ) . '-' . $counter . '" class="cherry-checkbox-input" name="' . esc_attr( $this->settings['name'] ) . '['. $option .']" value="' . esc_html( $item_value ) . '"' . $data_slave . '>';
|
96 |
+
$html .= '<label class="cherry-checkbox-label" for="' . esc_attr( $this->settings['id'] ) . '-' . $counter . '">' . esc_html( $option_label ) . '</label> ';
|
97 |
+
$html .= '</div>';
|
98 |
+
|
99 |
+
$counter++;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
$html .= '</div>';
|
103 |
+
|
104 |
+
return $html;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Enqueue javascript and stylesheet UI_Checkbox
|
109 |
+
*
|
110 |
+
* @since 4.0.0
|
111 |
+
*/
|
112 |
+
public static function enqueue_assets() {
|
113 |
+
wp_enqueue_script(
|
114 |
+
'ui-checkbox-min',
|
115 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-checkbox.min.js', __FILE__ ) ),
|
116 |
+
array( 'jquery' ),
|
117 |
+
'1.0.0',
|
118 |
+
true
|
119 |
+
);
|
120 |
+
|
121 |
+
wp_enqueue_style(
|
122 |
+
'ui-checkbox-min',
|
123 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-checkbox.min.css', __FILE__ ) ),
|
124 |
+
array(),
|
125 |
+
'1.0.0',
|
126 |
+
'all'
|
127 |
+
);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/min/ui-colorpicker.min.css
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-container {
|
2 |
+
margin: 10px 0 20px 0; }
|
3 |
+
|
4 |
+
label.cherry-label {
|
5 |
+
margin: 0 0 5px 0;
|
6 |
+
display: block; }
|
7 |
+
|
8 |
+
.wp-picker-container {
|
9 |
+
display: block;
|
10 |
+
background-color: #f1f1f1;
|
11 |
+
border-radius: 2px;
|
12 |
+
display: inline-block;
|
13 |
+
padding: 8px;
|
14 |
+
max-width: 380px; }
|
15 |
+
.wp-picker-container a.wp-color-result {
|
16 |
+
border: medium none;
|
17 |
+
box-shadow: none;
|
18 |
+
height: 36px;
|
19 |
+
margin: 0;
|
20 |
+
border-radius: 0;
|
21 |
+
padding-left: 36px; }
|
22 |
+
.wp-picker-container a.wp-color-result:after {
|
23 |
+
background-color: #f1f1f1;
|
24 |
+
border: medium none;
|
25 |
+
border-radius: 0;
|
26 |
+
line-height: 36px;
|
27 |
+
font-size: 14px;
|
28 |
+
color: #23282d;
|
29 |
+
padding: 0 80px 0 20px; }
|
30 |
+
@media screen and (max-width: 782px) {
|
31 |
+
.wp-picker-container a.wp-color-result {
|
32 |
+
height: 36px; }
|
33 |
+
.wp-picker-container a.wp-color-result:after {
|
34 |
+
line-height: 36px; } }
|
35 |
+
.wp-picker-container .wp-picker-holder {
|
36 |
+
position: absolute;
|
37 |
+
z-index: 1000; }
|
38 |
+
.wp-picker-container .wp-picker-input-wrap input[type="text"] {
|
39 |
+
padding: 7px 4px; }
|
40 |
+
.wp-picker-container .wp-picker-input-wrap input.wp-picker-clear {
|
41 |
+
height: 32px; }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/min/ui-colorpicker.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,i){"use strict";i.utilites.namespace("ui_elements.colorpicker"),i.ui_elements.colorpicker={init:function(){e(window).on("cherry-ui-elements-init",this.render.bind(this))},render:function(i,r){var n=r.target,t=e('input.cherry-ui-colorpicker:not([name*="__i__"])',n);t[0]&&t.wpColorPicker()}},i.ui_elements.colorpicker.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* ColorPicker
|
3 |
+
*/
|
4 |
+
( function( $, CherryJsCore ) {
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace('ui_elements.colorpicker');
|
8 |
+
CherryJsCore.ui_elements.colorpicker = {
|
9 |
+
init: function () {
|
10 |
+
$( window ).on( 'cherry-ui-elements-init', this.render.bind( this ) );
|
11 |
+
},
|
12 |
+
render: function ( event, data ) {
|
13 |
+
var target = data.target,
|
14 |
+
input = $( 'input.cherry-ui-colorpicker:not([name*="__i__"])', target );
|
15 |
+
|
16 |
+
if ( input[0] ) {
|
17 |
+
input.wpColorPicker();
|
18 |
+
}
|
19 |
+
}
|
20 |
+
};
|
21 |
+
|
22 |
+
CherryJsCore.ui_elements.colorpicker.init();
|
23 |
+
|
24 |
+
}( jQuery, window.CherryJsCore ));
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.scss
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
.wp-picker-container{
|
12 |
+
display: block;
|
13 |
+
background-color: $grey_color_3;
|
14 |
+
border-radius: $border_radius_extra_small;
|
15 |
+
display: inline-block;
|
16 |
+
padding: 8px;
|
17 |
+
max-width: 380px;
|
18 |
+
a.wp-color-result{
|
19 |
+
border: medium none;
|
20 |
+
box-shadow: none;
|
21 |
+
height: 36px;
|
22 |
+
margin: 0;
|
23 |
+
border-radius: 0;
|
24 |
+
padding-left: 36px;
|
25 |
+
&:after{
|
26 |
+
background-color: $grey_color_3;
|
27 |
+
border: medium none;
|
28 |
+
border-radius: 0;
|
29 |
+
line-height: 36px;
|
30 |
+
font-size: 14px;
|
31 |
+
color: $dark_color_1;
|
32 |
+
padding: 0 80px 0 20px;
|
33 |
+
}
|
34 |
+
@media screen and (max-width: 782px){
|
35 |
+
height: 36px;
|
36 |
+
&:after{
|
37 |
+
line-height: 36px;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
.wp-picker-holder{
|
42 |
+
position: absolute;
|
43 |
+
z-index: 1000;
|
44 |
+
}
|
45 |
+
.wp-picker-input-wrap{
|
46 |
+
input[type="text"]{
|
47 |
+
padding: 7px 4px;
|
48 |
+
}
|
49 |
+
input.wp-picker-clear{
|
50 |
+
height: 32px;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/ui-colorpicker.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-colorpicker elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Colorpicker' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Colorpicker elements.
|
22 |
+
*/
|
23 |
+
class UI_Colorpicker extends UI_Element implements I_UI {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Default settings
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
private $defaults_settings = array(
|
31 |
+
'id' => 'cherry-ui-colorpicker-id',
|
32 |
+
'name' => 'cherry-ui-colorpicker-name',
|
33 |
+
'value' => '',
|
34 |
+
'label' => '',
|
35 |
+
'class' => '',
|
36 |
+
'master' => '',
|
37 |
+
);
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Constructor method for the UI_Colorpicker class.
|
41 |
+
*
|
42 |
+
* @since 4.0.0
|
43 |
+
*/
|
44 |
+
function __construct( $args = array() ) {
|
45 |
+
|
46 |
+
$this->defaults_settings['id'] = 'cherry-ui-colorpicker-'.uniqid();
|
47 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
48 |
+
|
49 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Render html UI_Colorpicker.
|
54 |
+
*
|
55 |
+
* @since 4.0.0
|
56 |
+
*/
|
57 |
+
public function render() {
|
58 |
+
$html = '';
|
59 |
+
|
60 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
61 |
+
|
62 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
63 |
+
if ( '' !== $this->settings['label'] ) {
|
64 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
65 |
+
}
|
66 |
+
$html .= '<div class="cherry-ui-colorpicker-wrapper">';
|
67 |
+
$html .= '<input type="text" id="' . esc_attr( $this->settings['id'] ) . '" class="cherry-ui-colorpicker '. esc_attr( $this->settings['class'] ) . '" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '"/>';
|
68 |
+
$html .= '</div>';
|
69 |
+
$html .= '</div>';
|
70 |
+
|
71 |
+
return $html;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Enqueue javascript and stylesheet UI_Colorpicker
|
76 |
+
*
|
77 |
+
* @since 4.0.0
|
78 |
+
*/
|
79 |
+
public static function enqueue_assets() {
|
80 |
+
|
81 |
+
wp_enqueue_script(
|
82 |
+
'ui-colorpicker-min',
|
83 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-colorpicker.min.js', __FILE__ ) ),
|
84 |
+
array( 'jquery', 'wp-color-picker' ),
|
85 |
+
'1.0.0',
|
86 |
+
true
|
87 |
+
);
|
88 |
+
|
89 |
+
wp_enqueue_style(
|
90 |
+
'ui-colorpicker-min',
|
91 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-colorpicker.min.css', __FILE__ ) ),
|
92 |
+
array( 'wp-color-picker' ),
|
93 |
+
'1.0.0',
|
94 |
+
'all'
|
95 |
+
);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/jquery-iconpicker.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(a,b){function c(a,b,c){return[parseFloat(a[0])*(n.test(a[0])?b/100:1),parseFloat(a[1])*(n.test(a[1])?c/100:1)]}function d(b,c){return parseInt(a.css(b,c),10)||0}function e(b){var c=b[0];return 9===c.nodeType?{width:b.width(),height:b.height(),offset:{top:0,left:0}}:a.isWindow(c)?{width:b.width(),height:b.height(),offset:{top:b.scrollTop(),left:b.scrollLeft()}}:c.preventDefault?{width:0,height:0,offset:{top:c.pageY,left:c.pageX}}:{width:b.outerWidth(),height:b.outerHeight(),offset:b.offset()}}a.ui=a.ui||{};var f,g=Math.max,h=Math.abs,i=Math.round,j=/left|center|right/,k=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,m=/^\w+/,n=/%$/,o=a.fn.pos;a.pos={scrollbarWidth:function(){if(f!==b)return f;var c,d,e=a("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),g=e.children()[0];return a("body").append(e),c=g.offsetWidth,e.css("overflow","scroll"),d=g.offsetWidth,c===d&&(d=e[0].clientWidth),e.remove(),f=c-d},getScrollInfo:function(b){var c=b.isWindow||b.isDocument?"":b.element.css("overflow-x"),d=b.isWindow||b.isDocument?"":b.element.css("overflow-y"),e="scroll"===c||"auto"===c&&b.width<b.element[0].scrollWidth,f="scroll"===d||"auto"===d&&b.height<b.element[0].scrollHeight;return{width:f?a.pos.scrollbarWidth():0,height:e?a.pos.scrollbarWidth():0}},getWithinInfo:function(b){var c=a(b||window),d=a.isWindow(c[0]),e=!!c[0]&&9===c[0].nodeType;return{element:c,isWindow:d,isDocument:e,offset:c.offset()||{left:0,top:0},scrollLeft:c.scrollLeft(),scrollTop:c.scrollTop(),width:d?c.width():c.outerWidth(),height:d?c.height():c.outerHeight()}}},a.fn.pos=function(b){if(!b||!b.of)return o.apply(this,arguments);b=a.extend({},b);var f,n,p,q,r,s,t=a(b.of),u=a.pos.getWithinInfo(b.within),v=a.pos.getScrollInfo(u),w=(b.collision||"flip").split(" "),x={};return s=e(t),t[0].preventDefault&&(b.at="left top"),n=s.width,p=s.height,q=s.offset,r=a.extend({},q),a.each(["my","at"],function(){var a,c,d=(b[this]||"").split(" ");1===d.length&&(d=j.test(d[0])?d.concat(["center"]):k.test(d[0])?["center"].concat(d):["center","center"]),d[0]=j.test(d[0])?d[0]:"center",d[1]=k.test(d[1])?d[1]:"center",a=l.exec(d[0]),c=l.exec(d[1]),x[this]=[a?a[0]:0,c?c[0]:0],b[this]=[m.exec(d[0])[0],m.exec(d[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===b.at[0]?r.left+=n:"center"===b.at[0]&&(r.left+=n/2),"bottom"===b.at[1]?r.top+=p:"center"===b.at[1]&&(r.top+=p/2),f=c(x.at,n,p),r.left+=f[0],r.top+=f[1],this.each(function(){var e,j,k=a(this),l=k.outerWidth(),m=k.outerHeight(),o=d(this,"marginLeft"),s=d(this,"marginTop"),y=l+o+d(this,"marginRight")+v.width,z=m+s+d(this,"marginBottom")+v.height,A=a.extend({},r),B=c(x.my,k.outerWidth(),k.outerHeight());"right"===b.my[0]?A.left-=l:"center"===b.my[0]&&(A.left-=l/2),"bottom"===b.my[1]?A.top-=m:"center"===b.my[1]&&(A.top-=m/2),A.left+=B[0],A.top+=B[1],a.support.offsetFractions||(A.left=i(A.left),A.top=i(A.top)),e={marginLeft:o,marginTop:s},a.each(["left","top"],function(c,d){a.ui.pos[w[c]]&&a.ui.pos[w[c]][d](A,{targetWidth:n,targetHeight:p,elemWidth:l,elemHeight:m,collisionPosition:e,collisionWidth:y,collisionHeight:z,offset:[f[0]+B[0],f[1]+B[1]],my:b.my,at:b.at,within:u,elem:k})}),b.using&&(j=function(a){var c=q.left-A.left,d=c+n-l,e=q.top-A.top,f=e+p-m,i={target:{element:t,left:q.left,top:q.top,width:n,height:p},element:{element:k,left:A.left,top:A.top,width:l,height:m},horizontal:0>d?"left":c>0?"right":"center",vertical:0>f?"top":e>0?"bottom":"middle"};l>n&&h(c+d)<n&&(i.horizontal="center"),m>p&&h(e+f)<p&&(i.vertical="middle"),i.important=g(h(c),h(d))>g(h(e),h(f))?"horizontal":"vertical",b.using.call(this,a,i)}),k.offset(a.extend(A,{using:j}))})},a.ui.pos={_trigger:function(a,b,c,d){b.elem&&b.elem.trigger({type:c,position:a,positionData:b,triggered:d})},fit:{left:function(b,c){a.ui.pos._trigger(b,c,"posCollide","fitLeft");var d,e=c.within,f=e.isWindow?e.scrollLeft:e.offset.left,h=e.width,i=b.left-c.collisionPosition.marginLeft,j=f-i,k=i+c.collisionWidth-h-f;c.collisionWidth>h?j>0&&0>=k?(d=b.left+j+c.collisionWidth-h-f,b.left+=j-d):b.left=k>0&&0>=j?f:j>k?f+h-c.collisionWidth:f:j>0?b.left+=j:k>0?b.left-=k:b.left=g(b.left-i,b.left),a.ui.pos._trigger(b,c,"posCollided","fitLeft")},top:function(b,c){a.ui.pos._trigger(b,c,"posCollide","fitTop");var d,e=c.within,f=e.isWindow?e.scrollTop:e.offset.top,h=c.within.height,i=b.top-c.collisionPosition.marginTop,j=f-i,k=i+c.collisionHeight-h-f;c.collisionHeight>h?j>0&&0>=k?(d=b.top+j+c.collisionHeight-h-f,b.top+=j-d):b.top=k>0&&0>=j?f:j>k?f+h-c.collisionHeight:f:j>0?b.top+=j:k>0?b.top-=k:b.top=g(b.top-i,b.top),a.ui.pos._trigger(b,c,"posCollided","fitTop")}},flip:{left:function(b,c){a.ui.pos._trigger(b,c,"posCollide","flipLeft");var d,e,f=c.within,g=f.offset.left+f.scrollLeft,i=f.width,j=f.isWindow?f.scrollLeft:f.offset.left,k=b.left-c.collisionPosition.marginLeft,l=k-j,m=k+c.collisionWidth-i-j,n="left"===c.my[0]?-c.elemWidth:"right"===c.my[0]?c.elemWidth:0,o="left"===c.at[0]?c.targetWidth:"right"===c.at[0]?-c.targetWidth:0,p=-2*c.offset[0];0>l?(d=b.left+n+o+p+c.collisionWidth-i-g,(0>d||d<h(l))&&(b.left+=n+o+p)):m>0&&(e=b.left-c.collisionPosition.marginLeft+n+o+p-j,(e>0||h(e)<m)&&(b.left+=n+o+p)),a.ui.pos._trigger(b,c,"posCollided","flipLeft")},top:function(b,c){a.ui.pos._trigger(b,c,"posCollide","flipTop");var d,e,f=c.within,g=f.offset.top+f.scrollTop,i=f.height,j=f.isWindow?f.scrollTop:f.offset.top,k=b.top-c.collisionPosition.marginTop,l=k-j,m=k+c.collisionHeight-i-j,n="top"===c.my[1],o=n?-c.elemHeight:"bottom"===c.my[1]?c.elemHeight:0,p="top"===c.at[1]?c.targetHeight:"bottom"===c.at[1]?-c.targetHeight:0,q=-2*c.offset[1];0>l?(e=b.top+o+p+q+c.collisionHeight-i-g,b.top+o+p+q>l&&(0>e||e<h(l))&&(b.top+=o+p+q)):m>0&&(d=b.top-c.collisionPosition.marginTop+o+p+q-j,b.top+o+p+q>m&&(d>0||h(d)<m)&&(b.top+=o+p+q)),a.ui.pos._trigger(b,c,"posCollided","flipTop")}},flipfit:{left:function(){a.ui.pos.flip.left.apply(this,arguments),a.ui.pos.fit.left.apply(this,arguments)},top:function(){a.ui.pos.flip.top.apply(this,arguments),a.ui.pos.fit.top.apply(this,arguments)}}},function(){var b,c,d,e,f,g=document.getElementsByTagName("body")[0],h=document.createElement("div");b=document.createElement(g?"div":"body"),d={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},g&&a.extend(d,{position:"absolute",left:"-1000px",top:"-1000px"});for(f in d)b.style[f]=d[f];b.appendChild(h),c=g||document.documentElement,c.insertBefore(b,c.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",e=a(h).offset().left,a.support.offsetFractions=e>10&&11>e,b.innerHTML="",c.removeChild(b)}()}(jQuery),function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):window.jQuery&&!window.jQuery.fn.iconpicker&&a(window.jQuery)}(function(a){"use strict";var b={isEmpty:function(a){return a===!1||""===a||null===a||void 0===a},isEmptyObject:function(a){return this.isEmpty(a)===!0||0===a.length},isElement:function(b){return a(b).length>0},isString:function(a){return"string"==typeof a||a instanceof String},isArray:function(b){return a.isArray(b)},inArray:function(b,c){return-1!==a.inArray(b,c)},throwError:function(a){throw"Font Awesome Icon Picker Exception: "+a}},c=function(d,e){this._id=c._idCounter++,this.element=a(d).addClass("iconpicker-element"),this._trigger("iconpickerCreate"),this.options=a.extend({},c.defaultOptions,this.element.data(),e),this.options.templates=a.extend({},c.defaultOptions.templates,this.options.templates),this.options.originalPlacement=this.options.placement,this.container=b.isElement(this.options.container)?a(this.options.container):!1,this.container===!1&&(this.container=this.element.is("input")?this.element.parent():this.element),this.container.addClass("iconpicker-container").is(".dropdown-menu")&&(this.options.placement="inline"),this.input=this.element.is("input")?this.element.addClass("iconpicker-input"):!1,this.input===!1&&(this.input=this.container.find(this.options.input)),this.component=this.container.find(this.options.component).addClass("iconpicker-component"),0===this.component.length?this.component=!1:this.component.find("i").addClass(this.options.iconComponentBaseClass),this._createPopover(),this._createIconpicker(),0===this.getAcceptButton().length&&(this.options.mustAccept=!1),this.container.is(".input-group")?this.container.parent().append(this.popover):this.container.append(this.popover),this._bindElementEvents(),this._bindWindowEvents(),this.update(this.options.selected),this.isInline()&&this.show(),this._trigger("iconpickerCreated")};c._idCounter=0,c.defaultOptions={title:!1,selected:!1,defaultValue:!1,placement:"bottom",collision:"none",animation:!0,hideOnSelect:!1,showFooter:!1,searchInFooter:!1,mustAccept:!1,selectedCustomClass:"bg-primary",icons:[],iconBaseClass:"fa",iconComponentBaseClass:"fa fa-fw",iconClassPrefix:"fa-",input:"input",component:".input-group-addon",container:!1,templates:{popover:'<div class="iconpicker-popover popover"><div class="arrow"></div><div class="popover-title"></div><div class="popover-content"></div></div>',footer:'<div class="popover-footer"></div>',buttons:'<button class="iconpicker-btn iconpicker-btn-cancel btn btn-default btn-sm">Cancel</button> <button class="iconpicker-btn iconpicker-btn-accept btn btn-primary btn-sm">Accept</button>',search:'<input type="search" class="form-control iconpicker-search" placeholder="Type to filter" />',iconpicker:'<div class="iconpicker"><div class="iconpicker-items"></div></div>',iconpickerItem:'<div class="iconpicker-item"><i></i></div>'}},c.batch=function(b,c){var d=Array.prototype.slice.call(arguments,2);return a(b).each(function(){var b=a(this).data("iconpicker");b&&b[c].apply(b,d)})},c.prototype={constructor:c,options:{},_id:0,_trigger:function(b,c){c=c||{},this.element.trigger(a.extend({type:b,iconpickerInstance:this},c))},_createPopover:function(){this.popover=a(this.options.templates.popover);var c=this.popover.find(".popover-title");if(this.options.title&&c.append(a('<div class="popover-title-text">'+this.options.title+"</div>")),this.options.searchInFooter||b.isEmpty(this.options.templates.buttons)?this.options.title||c.remove():c.append(this.options.templates.search),this.options.showFooter&&!b.isEmpty(this.options.templates.footer)){var d=a(this.options.templates.footer);!b.isEmpty(this.options.templates.search)&&this.options.searchInFooter&&d.append(a(this.options.templates.search)),b.isEmpty(this.options.templates.buttons)||d.append(a(this.options.templates.buttons)),this.popover.append(d)}return this.options.animation===!0&&this.popover.addClass("fade"),this.popover},_createIconpicker:function(){var b=this;this.iconpicker=a(this.options.templates.iconpicker);var c=function(){var c=a(this);c.is("."+b.options.iconBaseClass)&&(c=c.parent()),b._trigger("iconpickerSelect",{iconpickerItem:c,iconpickerValue:b.iconpickerValue}),b.options.mustAccept===!1?(b.update(c.data("iconpickerValue")),b._trigger("iconpickerSelected",{iconpickerItem:this,iconpickerValue:b.iconpickerValue})):b.update(c.data("iconpickerValue"),!0),b.options.hideOnSelect&&b.options.mustAccept===!1&&b.hide()};for(var d in this.options.icons){var e=a(this.options.templates.iconpickerItem);e.find("i").addClass(b.options.iconBaseClass+" "+this.options.iconClassPrefix+this.options.icons[d]),e.data("iconpickerValue",this.options.icons[d]).on("click.iconpicker",c),this.iconpicker.find(".iconpicker-items").append(e.attr("title","."+this.getValue(this.options.icons[d])))}return this.popover.find(".popover-content").append(this.iconpicker),this.iconpicker},_isEventInsideIconpicker:function(b){var c=a(b.target);return c.hasClass("iconpicker-element")&&(!c.hasClass("iconpicker-element")||c.is(this.element))||0!==c.parents(".iconpicker-popover").length?!0:!1},_bindElementEvents:function(){var c=this;this.getSearchInput().on("keyup",function(){c.filter(a(this).val().toLowerCase())}),this.getAcceptButton().on("click.iconpicker",function(){var a=c.iconpicker.find(".iconpicker-selected").get(0);c.update(c.iconpickerValue),c._trigger("iconpickerSelected",{iconpickerItem:a,iconpickerValue:c.iconpickerValue}),c.isInline()||c.hide()}),this.getCancelButton().on("click.iconpicker",function(){c.isInline()||c.hide()}),this.element.on("focus.iconpicker",function(a){c.show(),a.stopPropagation()}),this.hasComponent()&&this.component.on("click.iconpicker",function(){c.toggle()}),this.hasInput()&&this.input.on("keyup.iconpicker",function(a){b.inArray(a.keyCode,[38,40,37,39,16,17,18,9,8,91,93,20,46,186,190,46,78,188,44,86])?c._updateFormGroupStatus(c.getValid(this.value)!==!1):c.update()})},_bindWindowEvents:function(){var b=a(window.document),c=this,d=".iconpicker.inst"+this._id;return a(window).on("resize.iconpicker"+d+" orientationchange.iconpicker"+d,function(){c.popover.hasClass("in")&&c.updatePlacement()}),c.isInline()||b.on("mouseup"+d,function(a){return c._isEventInsideIconpicker(a)||c.isInline()||c.hide(),a.stopPropagation(),a.preventDefault(),!1}),!1},_unbindElementEvents:function(){this.popover.off(".iconpicker"),this.element.off(".iconpicker"),this.hasInput()&&this.input.off(".iconpicker"),this.hasComponent()&&this.component.off(".iconpicker"),this.hasContainer()&&this.container.off(".iconpicker")},_unbindWindowEvents:function(){a(window).off(".iconpicker.inst"+this._id),a(window.document).off(".iconpicker.inst"+this._id)},updatePlacement:function(b,c){b=b||this.options.placement,this.options.placement=b,c=c||this.options.collision,c=c===!0?"flip":c;var d={at:"right bottom",my:"right top",of:this.hasInput()?this.input:this.container,collision:c===!0?"flip":c,within:window};if(this.popover.removeClass("inline topLeftCorner topLeft top topRight topRightCorner rightTop right rightBottom bottomRight bottomRightCorner bottom bottomLeft bottomLeftCorner leftBottom left leftTop"),"object"==typeof b)return this.popover.pos(a.extend({},d,b));switch(b){case"inline":d=!1;break;case"topLeftCorner":d.my="right bottom",d.at="left top";break;case"topLeft":d.my="left bottom",d.at="left top";break;case"top":d.my="center bottom",d.at="center top";break;case"topRight":d.my="right bottom",d.at="right top";break;case"topRightCorner":d.my="left bottom",d.at="right top";break;case"rightTop":d.my="left bottom",d.at="right center";break;case"right":d.my="left center",d.at="right center";break;case"rightBottom":d.my="left top",d.at="right center";break;case"bottomRightCorner":d.my="left top",d.at="right bottom";break;case"bottomRight":d.my="right top",d.at="right bottom";break;case"bottom":d.my="center top",d.at="center bottom";break;case"bottomLeft":d.my="left top",d.at="left bottom";break;case"bottomLeftCorner":d.my="right top",d.at="left bottom";break;case"leftBottom":d.my="right top",d.at="left center";break;case"left":d.my="right center",d.at="left center";break;case"leftTop":d.my="right bottom",d.at="left center";break;default:return!1}return this.popover.css({display:"inline"===this.options.placement?"":"block"}),d!==!1?this.popover.pos(d).css("maxWidth",a(window).width()-this.container.offset().left-5):this.popover.css({top:"auto",right:"auto",bottom:"auto",left:"auto",maxWidth:"none"}),this.popover.addClass(this.options.placement),!0},_updateComponents:function(){if(this.iconpicker.find(".iconpicker-item.iconpicker-selected").removeClass("iconpicker-selected "+this.options.selectedCustomClass),this.iconpicker.find("."+this.options.iconBaseClass+"."+this.options.iconClassPrefix+this.iconpickerValue).parent().addClass("iconpicker-selected "+this.options.selectedCustomClass),this.hasComponent()){var a=this.component.find("i");a.length>0?a.attr("class",this.options.iconComponentBaseClass+" "+this.getValue()):this.component.html(this.getValueHtml())}},_updateFormGroupStatus:function(a){return this.hasInput()?(a!==!1?this.input.parents(".form-group:first").removeClass("has-error"):this.input.parents(".form-group:first").addClass("has-error"),!0):!1},getValid:function(c){b.isString(c)||(c="");var d=""===c;return c=a.trim(c.replace(this.options.iconClassPrefix,"")),b.inArray(c,this.options.icons)||d?c:!1},setValue:function(a){var b=this.getValid(a);return b!==!1?(this.iconpickerValue=b,this._trigger("iconpickerSetValue",{iconpickerValue:b}),this.iconpickerValue):(this._trigger("iconpickerInvalid",{iconpickerValue:a}),!1)},getValue:function(a){return this.options.iconClassPrefix+(a?a:this.iconpickerValue)},getValueHtml:function(){return'<i class="'+this.options.iconBaseClass+" "+this.getValue()+'"></i>'},setSourceValue:function(a){return a=this.setValue(a),a!==!1&&""!==a&&(this.hasInput()?this.input.val(this.getValue()):this.element.data("iconpickerValue",this.getValue()),this._trigger("iconpickerSetSourceValue",{iconpickerValue:a})),a},getSourceValue:function(a){a=a||this.options.defaultValue;var b=a;return b=this.hasInput()?this.input.val():this.element.data("iconpickerValue"),(void 0===b||""===b||null===b||b===!1)&&(b=a),b},hasInput:function(){return this.input!==!1},hasComponent:function(){return this.component!==!1},hasContainer:function(){return this.container!==!1},getAcceptButton:function(){return this.popover.find(".iconpicker-btn-accept")},getCancelButton:function(){return this.popover.find(".iconpicker-btn-cancel")},getSearchInput:function(){return this.popover.find(".iconpicker-search")},filter:function(c){if(b.isEmpty(c))return this.iconpicker.find(".iconpicker-item").show(),a(!1);var d=[];return this.iconpicker.find(".iconpicker-item").each(function(){var b=a(this),e=b.attr("title").toLowerCase(),f=!1;try{f=new RegExp(c,"g")}catch(g){f=!1}f!==!1&&e.match(f)?(d.push(b),b.show()):b.hide()}),d},show:function(){return this.popover.hasClass("in")?!1:(a.iconpicker.batch(a(".iconpicker-popover.in:not(.inline)").not(this.popover),"hide"),this._trigger("iconpickerShow"),this.updatePlacement(),this.popover.addClass("in"),void setTimeout(a.proxy(function(){this.popover.css("display",this.isInline()?"":"block"),this._trigger("iconpickerShown")},this),this.options.animation?300:1))},hide:function(){return this.popover.hasClass("in")?(this._trigger("iconpickerHide"),this.popover.removeClass("in"),void setTimeout(a.proxy(function(){this.popover.css("display","none"),this.getSearchInput().val(""),this.filter(""),this._trigger("iconpickerHidden")},this),this.options.animation?300:1)):!1},toggle:function(){this.popover.is(":visible")?this.hide():this.show(!0)},update:function(a,b){return a=a?a:this.getSourceValue(this.iconpickerValue),this._trigger("iconpickerUpdate"),b===!0?a=this.setValue(a):(a=this.setSourceValue(a),this._updateFormGroupStatus(a!==!1)),a!==!1&&this._updateComponents(),this._trigger("iconpickerUpdated"),a},destroy:function(){this._trigger("iconpickerDestroy"),this.element.removeData("iconpicker").removeData("iconpickerValue").removeClass("iconpicker-element"),this._unbindElementEvents(),this._unbindWindowEvents(),a(this.popover).remove(),this._trigger("iconpickerDestroyed")},disable:function(){return this.hasInput()?(this.input.prop("disabled",!0),!0):!1},enable:function(){return this.hasInput()?(this.input.prop("disabled",!1),!0):!1},isDisabled:function(){return this.hasInput()?this.input.prop("disabled")===!0:!1},isInline:function(){return"inline"===this.options.placement||this.popover.hasClass("inline")}},a.iconpicker=c,a.fn.iconpicker=function(b){return this.each(function(){var d=a(this);d.data("iconpicker")||d.data("iconpicker",new c(this,"object"==typeof b?b:{}))})},c.defaultOptions.icons=["adjust","adn","align-center","align-justify","align-left","align-right","ambulance","anchor","android","angle-double-down","angle-double-left","angle-double-right","angle-double-up","angle-down","angle-left","angle-right","angle-up","apple","archive","arrow-circle-down","arrow-circle-left","arrow-circle-o-down","arrow-circle-o-left","arrow-circle-o-right","arrow-circle-o-up","arrow-circle-right","arrow-circle-up","arrow-down","arrow-left","arrow-right","arrow-up","arrows","arrows-alt","arrows-h","arrows-v","asterisk","automobile","backward","ban","bank","bar-chart-o","barcode","bars","beer","behance","behance-square","bell","bell-o","bitbucket","bitbucket-square","bitcoin","bold","bolt","bomb","book","bookmark","bookmark-o","briefcase","btc","bug","building","building-o","bullhorn","bullseye","cab","calendar","calendar-o","camera","camera-retro","car","caret-down","caret-left","caret-right","caret-square-o-down","caret-square-o-left","caret-square-o-right","caret-square-o-up","caret-up","certificate","chain","chain-broken","check","check-circle","check-circle-o","check-square","check-square-o","chevron-circle-down","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-down","chevron-left","chevron-right","chevron-up","child","circle","circle-o","circle-o-notch","circle-thin","clipboard","clock-o","cloud","cloud-download","cloud-upload","cny","code","code-fork","codepen","coffee","cog","cogs","columns","comment","comment-o","comments","comments-o","compass","compress","copy","credit-card","crop","crosshairs","css3","cube","cubes","cut","cutlery","dashboard","database","dedent","delicious","desktop","deviantart","digg","dollar","dot-circle-o","download","dribbble","dropbox","drupal","edit","eject","ellipsis-h","ellipsis-v","empire","envelope","envelope-o","envelope-square","eraser","eur","euro","exchange","exclamation","exclamation-circle","exclamation-triangle","expand","external-link","external-link-square","eye","eye-slash","facebook","facebook-square","fast-backward","fast-forward","fax","female","fighter-jet","file","file-archive-o","file-audio-o","file-code-o","file-excel-o","file-image-o","file-movie-o","file-o","file-pdf-o","file-photo-o","file-picture-o","file-powerpoint-o","file-sound-o","file-text","file-text-o","file-video-o","file-word-o","file-zip-o","files-o","film","filter","fire","fire-extinguisher","flag","flag-checkered","flag-o","flash","flask","flickr","floppy-o","folder","folder-o","folder-open","folder-open-o","font","forward","foursquare","frown-o","gamepad","gavel","gbp","ge","gear","gears","gift","git","git-square","github","github-alt","github-square","gittip","glass","globe","google","google-plus","google-plus-square","graduation-cap","group","h-square","hacker-news","hand-o-down","hand-o-left","hand-o-right","hand-o-up","hdd-o","header","headphones","heart","heart-o","history","home","hospital-o","html5","image","inbox","indent","info","info-circle","inr","instagram","institution","italic","joomla","jpy","jsfiddle","key","keyboard-o","krw","language","laptop","leaf","legal","lemon-o","level-down","level-up","life-bouy","life-ring","life-saver","lightbulb-o","link","linkedin","linkedin-square","linux","list","list-alt","list-ol","list-ul","location-arrow","lock","long-arrow-down","long-arrow-left","long-arrow-right","long-arrow-up","magic","magnet","mail-forward","mail-reply","mail-reply-all","male","map-marker","maxcdn","medkit","meh-o","microphone","microphone-slash","minus","minus-circle","minus-square","minus-square-o","mobile","mobile-phone","money","moon-o","mortar-board","music","navicon","openid","outdent","pagelines","paper-plane","paper-plane-o","paperclip","paragraph","paste","pause","paw","pencil","pencil-square","pencil-square-o","phone","phone-square","photo","picture-o","pied-piper","pied-piper-alt","pied-piper-square","pinterest","pinterest-square","plane","play","play-circle","play-circle-o","plus","plus-circle","plus-square","plus-square-o","power-off","print","puzzle-piece","qq","qrcode","question","question-circle","quote-left","quote-right","ra","random","rebel","recycle","reddit","reddit-square","refresh","renren","reorder","repeat","reply","reply-all","retweet","rmb","road","rocket","rotate-left","rotate-right","rouble","rss","rss-square","rub","ruble","rupee","save","scissors","search","search-minus","search-plus","send","send-o","share","share-alt","share-alt-square","share-square","share-square-o","shield","shopping-cart","sign-in","sign-out","signal","sitemap","skype","slack","sliders","smile-o","sort","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-asc","sort-desc","sort-down","sort-numeric-asc","sort-numeric-desc","sort-up","soundcloud","space-shuttle","spinner","spoon","spotify","square","square-o","stack-exchange","stack-overflow","star","star-half","star-half-empty","star-half-full","star-half-o","star-o","steam","steam-square","step-backward","step-forward","stethoscope","stop","strikethrough","stumbleupon","stumbleupon-circle","subscript","suitcase","sun-o","superscript","support","table","tablet","tachometer","tag","tags","tasks","taxi","tencent-weibo","terminal","text-height","text-width","th","th-large","th-list","thumb-tack","thumbs-down","thumbs-o-down","thumbs-o-up","thumbs-up","ticket","times","times-circle","times-circle-o","tint","toggle-down","toggle-left","toggle-right","toggle-up","trash-o","tree","trello","trophy","truck","try","tumblr","tumblr-square","turkish-lira","twitter","twitter-square","umbrella","underline","undo","university","unlink","unlock","unlock-alt","unsorted","upload","usd","user","user-md","users","video-camera","vimeo-square","vine","vk","volume-down","volume-off","volume-up","warning","wechat","weibo","weixin","wheelchair","windows","won","wordpress","wrench","xing","xing-square","yahoo","yen","youtube","youtube-play","youtube-square"]});
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/ui-iconpicker.min.css
ADDED
@@ -0,0 +1,326 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-iconpicker-group {
|
2 |
+
max-width: 230px;
|
3 |
+
position: relative; }
|
4 |
+
.cherry-ui-iconpicker-group .input-group-addon {
|
5 |
+
position: absolute;
|
6 |
+
width: 36px;
|
7 |
+
height: 36px;
|
8 |
+
left: 0px;
|
9 |
+
top: 0px;
|
10 |
+
background: #f1f1f1;
|
11 |
+
font-size: 14px;
|
12 |
+
line-height: 36px;
|
13 |
+
text-align: center;
|
14 |
+
border-radius: 3px 0 0 3px;
|
15 |
+
border-right: 1px solid #dddcdc;
|
16 |
+
margin: 7px; }
|
17 |
+
.cherry-ui-iconpicker-group .cherry-ui-text {
|
18 |
+
font-size: 14px;
|
19 |
+
line-height: 20px;
|
20 |
+
color: #23282d;
|
21 |
+
background-color: #f1f1f1;
|
22 |
+
border-radius: 2px;
|
23 |
+
padding: 10px 20px;
|
24 |
+
height: 50px;
|
25 |
+
border: 1px solid #f1f1f1;
|
26 |
+
box-shadow: none;
|
27 |
+
padding-left: 60px; }
|
28 |
+
.cherry-ui-iconpicker-group .cherry-ui-text:focus {
|
29 |
+
border-color: rgba(72, 197, 105, 0.6);
|
30 |
+
box-shadow: 0 0 2px rgba(72, 197, 105, 0.6); }
|
31 |
+
|
32 |
+
.iconpicker-popover.popover {
|
33 |
+
position: absolute;
|
34 |
+
top: 0;
|
35 |
+
left: 0;
|
36 |
+
display: none;
|
37 |
+
max-width: none;
|
38 |
+
padding: 1px;
|
39 |
+
text-align: left;
|
40 |
+
width: 242px;
|
41 |
+
background: #f0f0f0;
|
42 |
+
z-index: 999; }
|
43 |
+
|
44 |
+
.iconpicker-popover.popover.top,
|
45 |
+
.iconpicker-popover.popover.topLeftCorner,
|
46 |
+
.iconpicker-popover.popover.topLeft,
|
47 |
+
.iconpicker-popover.popover.topRight,
|
48 |
+
.iconpicker-popover.popover.topRightCorner {
|
49 |
+
margin-top: -10px; }
|
50 |
+
|
51 |
+
.iconpicker-popover.popover.right,
|
52 |
+
.iconpicker-popover.popover.rightTop,
|
53 |
+
.iconpicker-popover.popover.rightBottom {
|
54 |
+
margin-left: 10px; }
|
55 |
+
|
56 |
+
.iconpicker-popover.popover.bottom,
|
57 |
+
.iconpicker-popover.popover.bottomRightCorner,
|
58 |
+
.iconpicker-popover.popover.bottomRight,
|
59 |
+
.iconpicker-popover.popover.bottomLeft,
|
60 |
+
.iconpicker-popover.popover.bottomLeftCorner {
|
61 |
+
margin-top: 10px; }
|
62 |
+
|
63 |
+
.iconpicker-popover.popover.left,
|
64 |
+
.iconpicker-popover.popover.leftBottom,
|
65 |
+
.iconpicker-popover.popover.leftTop {
|
66 |
+
margin-left: -10px; }
|
67 |
+
|
68 |
+
.iconpicker-popover.popover.inline {
|
69 |
+
margin: 0 0 14px 0;
|
70 |
+
position: relative;
|
71 |
+
display: inline-block;
|
72 |
+
opacity: 1;
|
73 |
+
top: auto;
|
74 |
+
left: auto;
|
75 |
+
bottom: auto;
|
76 |
+
right: auto;
|
77 |
+
max-width: 100%;
|
78 |
+
box-shadow: none;
|
79 |
+
z-index: auto;
|
80 |
+
vertical-align: top; }
|
81 |
+
|
82 |
+
.iconpicker-popover.popover.inline > .arrow {
|
83 |
+
display: none; }
|
84 |
+
|
85 |
+
.dropdown-menu .iconpicker-popover.inline {
|
86 |
+
margin: 0;
|
87 |
+
border: none; }
|
88 |
+
|
89 |
+
.dropdown-menu.iconpicker-container {
|
90 |
+
padding: 0; }
|
91 |
+
|
92 |
+
.iconpicker-popover.popover .popover-title {
|
93 |
+
padding: 14px;
|
94 |
+
font-size: 14px;
|
95 |
+
line-height: 16px;
|
96 |
+
border-bottom: 1px solid #ebebeb;
|
97 |
+
background-color: #f0f0f0; }
|
98 |
+
|
99 |
+
.iconpicker-popover.popover .popover-title input[type=search].iconpicker-search {
|
100 |
+
margin: 0 0 2px 0; }
|
101 |
+
|
102 |
+
.iconpicker-popover.popover .popover-title-text ~ input[type=search].iconpicker-search {
|
103 |
+
margin-top: 14px; }
|
104 |
+
|
105 |
+
.iconpicker-popover.popover .popover-content {
|
106 |
+
padding: 0px;
|
107 |
+
text-align: center; }
|
108 |
+
|
109 |
+
.iconpicker-popover .popover-footer {
|
110 |
+
float: none;
|
111 |
+
clear: both;
|
112 |
+
padding: 14px;
|
113 |
+
text-align: right;
|
114 |
+
margin: 0;
|
115 |
+
border-top: 1px solid #ebebeb;
|
116 |
+
background-color: #f0f0f0; }
|
117 |
+
|
118 |
+
.iconpicker-popover .popover-footer:before,
|
119 |
+
.iconpicker-popover .popover-footer:after {
|
120 |
+
content: " ";
|
121 |
+
display: table; }
|
122 |
+
|
123 |
+
.iconpicker-popover .popover-footer:after {
|
124 |
+
clear: both; }
|
125 |
+
|
126 |
+
.iconpicker-popover .popover-footer .iconpicker-btn {
|
127 |
+
margin-left: 10px; }
|
128 |
+
|
129 |
+
.iconpicker-popover .popover-footer input[type=search].iconpicker-search {
|
130 |
+
/*width:auto;
|
131 |
+
float:left;*/
|
132 |
+
margin-bottom: 14px; }
|
133 |
+
|
134 |
+
.iconpicker-popover.popover > .arrow,
|
135 |
+
.iconpicker-popover.popover > .arrow:after {
|
136 |
+
position: absolute;
|
137 |
+
display: block;
|
138 |
+
width: 0;
|
139 |
+
height: 0;
|
140 |
+
border-color: transparent;
|
141 |
+
border-style: solid; }
|
142 |
+
|
143 |
+
.iconpicker-popover.popover > .arrow {
|
144 |
+
border-width: 11px; }
|
145 |
+
|
146 |
+
.iconpicker-popover.popover > .arrow:after {
|
147 |
+
border-width: 10px;
|
148 |
+
content: ""; }
|
149 |
+
|
150 |
+
.iconpicker-popover.popover.top > .arrow,
|
151 |
+
.iconpicker-popover.popover.topLeft > .arrow,
|
152 |
+
.iconpicker-popover.popover.topRight > .arrow {
|
153 |
+
left: 50%;
|
154 |
+
margin-left: -11px;
|
155 |
+
border-bottom-width: 0;
|
156 |
+
border-top-color: #f0f0f0;
|
157 |
+
bottom: -11px; }
|
158 |
+
|
159 |
+
.iconpicker-popover.popover.top > .arrow:after,
|
160 |
+
.iconpicker-popover.popover.topLeft > .arrow:after,
|
161 |
+
.iconpicker-popover.popover.topRight > .arrow:after {
|
162 |
+
content: " ";
|
163 |
+
bottom: 1px;
|
164 |
+
margin-left: -10px;
|
165 |
+
border-bottom-width: 0;
|
166 |
+
border-top-color: #ffffff; }
|
167 |
+
|
168 |
+
.iconpicker-popover.popover.topLeft > .arrow {
|
169 |
+
left: 14px;
|
170 |
+
margin-left: 0; }
|
171 |
+
|
172 |
+
.iconpicker-popover.popover.topRight > .arrow {
|
173 |
+
left: auto;
|
174 |
+
right: 14px;
|
175 |
+
margin-left: 0; }
|
176 |
+
|
177 |
+
.iconpicker-popover.popover.right > .arrow,
|
178 |
+
.iconpicker-popover.popover.rightTop > .arrow,
|
179 |
+
.iconpicker-popover.popover.rightBottom > .arrow {
|
180 |
+
top: 50%;
|
181 |
+
left: -11px;
|
182 |
+
margin-top: -11px;
|
183 |
+
border-left-width: 0;
|
184 |
+
border-right-color: #f0f0f0; }
|
185 |
+
|
186 |
+
.iconpicker-popover.popover.right > .arrow:after,
|
187 |
+
.iconpicker-popover.popover.rightTop > .arrow:after,
|
188 |
+
.iconpicker-popover.popover.rightBottom > .arrow:after {
|
189 |
+
content: " ";
|
190 |
+
left: 1px;
|
191 |
+
bottom: -10px;
|
192 |
+
border-left-width: 0;
|
193 |
+
border-right-color: #ffffff; }
|
194 |
+
|
195 |
+
.iconpicker-popover.popover.rightTop > .arrow {
|
196 |
+
top: auto;
|
197 |
+
bottom: 14px;
|
198 |
+
margin-top: 0; }
|
199 |
+
|
200 |
+
.iconpicker-popover.popover.rightBottom > .arrow {
|
201 |
+
top: 14px;
|
202 |
+
margin-top: 0; }
|
203 |
+
|
204 |
+
.iconpicker-popover.popover.bottom > .arrow,
|
205 |
+
.iconpicker-popover.popover.bottomRight > .arrow,
|
206 |
+
.iconpicker-popover.popover.bottomLeft > .arrow {
|
207 |
+
left: 50%;
|
208 |
+
margin-left: -11px;
|
209 |
+
border-top-width: 0;
|
210 |
+
border-bottom-color: #f0f0f0;
|
211 |
+
top: -11px; }
|
212 |
+
|
213 |
+
.iconpicker-popover.popover.bottom > .arrow:after,
|
214 |
+
.iconpicker-popover.popover.bottomRight > .arrow:after,
|
215 |
+
.iconpicker-popover.popover.bottomLeft > .arrow:after {
|
216 |
+
content: " ";
|
217 |
+
top: 1px;
|
218 |
+
margin-left: -10px;
|
219 |
+
border-top-width: 0;
|
220 |
+
border-bottom-color: #f0f0f0; }
|
221 |
+
|
222 |
+
.iconpicker-popover.popover.bottomLeft > .arrow {
|
223 |
+
left: 14px;
|
224 |
+
margin-left: 0; }
|
225 |
+
|
226 |
+
.iconpicker-popover.popover.bottomRight > .arrow {
|
227 |
+
left: auto;
|
228 |
+
right: 14px;
|
229 |
+
margin-left: 0; }
|
230 |
+
|
231 |
+
.iconpicker-popover.popover.left > .arrow,
|
232 |
+
.iconpicker-popover.popover.leftBottom > .arrow,
|
233 |
+
.iconpicker-popover.popover.leftTop > .arrow {
|
234 |
+
top: 50%;
|
235 |
+
right: -11px;
|
236 |
+
margin-top: -11px;
|
237 |
+
border-right-width: 0;
|
238 |
+
border-left-color: #f0f0f0; }
|
239 |
+
|
240 |
+
.iconpicker-popover.popover.left > .arrow:after,
|
241 |
+
.iconpicker-popover.popover.leftBottom > .arrow:after,
|
242 |
+
.iconpicker-popover.popover.leftTop > .arrow:after {
|
243 |
+
content: " ";
|
244 |
+
right: 1px;
|
245 |
+
border-right-width: 0;
|
246 |
+
border-left-color: #ffffff;
|
247 |
+
bottom: -10px; }
|
248 |
+
|
249 |
+
.iconpicker-popover.popover.leftBottom > .arrow {
|
250 |
+
top: 14px;
|
251 |
+
margin-top: 0; }
|
252 |
+
|
253 |
+
.iconpicker-popover.popover.leftTop > .arrow {
|
254 |
+
top: auto;
|
255 |
+
bottom: 14px;
|
256 |
+
margin-top: 0; }
|
257 |
+
|
258 |
+
.iconpicker {
|
259 |
+
position: relative;
|
260 |
+
text-align: left;
|
261 |
+
text-shadow: none;
|
262 |
+
line-height: 0;
|
263 |
+
display: block;
|
264 |
+
margin: 0;
|
265 |
+
overflow: hidden; }
|
266 |
+
|
267 |
+
.iconpicker * {
|
268 |
+
box-sizing: content-box;
|
269 |
+
position: relative; }
|
270 |
+
|
271 |
+
.iconpicker:before,
|
272 |
+
.iconpicker:after {
|
273 |
+
content: " ";
|
274 |
+
display: table; }
|
275 |
+
|
276 |
+
.iconpicker:after {
|
277 |
+
clear: both; }
|
278 |
+
|
279 |
+
.iconpicker .iconpicker-items {
|
280 |
+
position: relative;
|
281 |
+
clear: both;
|
282 |
+
float: none;
|
283 |
+
padding: 10px 0 0 10px;
|
284 |
+
background: #fff;
|
285 |
+
margin: 0;
|
286 |
+
overflow: hidden;
|
287 |
+
overflow-y: auto;
|
288 |
+
min-height: 55px;
|
289 |
+
max-height: 275px; }
|
290 |
+
|
291 |
+
.iconpicker .iconpicker-items:before,
|
292 |
+
.iconpicker .iconpicker-items:after {
|
293 |
+
content: " ";
|
294 |
+
display: table; }
|
295 |
+
|
296 |
+
.iconpicker .iconpicker-items:after {
|
297 |
+
clear: both; }
|
298 |
+
|
299 |
+
.iconpicker .iconpicker-item {
|
300 |
+
float: left;
|
301 |
+
width: 28px;
|
302 |
+
height: 28px;
|
303 |
+
line-height: 28px;
|
304 |
+
margin: 0 7px 7px 0;
|
305 |
+
text-align: center;
|
306 |
+
cursor: pointer;
|
307 |
+
border-radius: 3px;
|
308 |
+
font-size: 18px;
|
309 |
+
color: #444;
|
310 |
+
box-shadow: 0 0 0 1px #dddddd
|
311 |
+
/*&:nth-child(4n+4) {
|
312 |
+
margin-right: 0;
|
313 |
+
}
|
314 |
+
&:nth-last-child(-n+4) {
|
315 |
+
margin-bottom: 0;
|
316 |
+
}*/ }
|
317 |
+
|
318 |
+
.iconpicker .iconpicker-item:hover:not(.iconpicker-selected) {
|
319 |
+
background-color: #eeeeee; }
|
320 |
+
|
321 |
+
.iconpicker .iconpicker-item.iconpicker-selected {
|
322 |
+
box-shadow: none;
|
323 |
+
background: #ddd; }
|
324 |
+
|
325 |
+
.iconpicker-component {
|
326 |
+
cursor: pointer; }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/ui-iconpicker.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,i){"use strict";i.utilites.namespace("ui_elements.iconpicker"),i.ui_elements.iconpicker={init:function(){e(window).on("cherry-ui-elements-init",this.render.bind(this))},render:function(i,n){var t=n.target,c=e(".cherry-ui-iconpicker",t),r=c.data("set"),s=window[r];c.length&&c.iconpicker({icons:s.icons,iconBaseClass:s.iconBase,iconClassPrefix:s.iconPrefix}).on("iconpickerUpdated",function(){e(this).trigger("change")}),s&&e("body").append('<link rel="stylesheet" type="text/css" href="'+s.iconCSS+'"">')}},i.ui_elements.iconpicker.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-iconpicker.js
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Iconpicker
|
3 |
+
*/
|
4 |
+
(function( $, CherryJsCore ) {
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace( 'ui_elements.iconpicker' );
|
8 |
+
CherryJsCore.ui_elements.iconpicker = {
|
9 |
+
init: function() {
|
10 |
+
$( window ).on( 'cherry-ui-elements-init', this.render.bind( this ) );
|
11 |
+
},
|
12 |
+
render: function( event, data ) {
|
13 |
+
var target = data.target,
|
14 |
+
$picker = $( '.cherry-ui-iconpicker', target ),
|
15 |
+
set = $picker.data( 'set' ),
|
16 |
+
setData = window[set];
|
17 |
+
|
18 |
+
if ( $picker.length ) {
|
19 |
+
$picker.iconpicker({
|
20 |
+
icons: setData.icons,
|
21 |
+
iconBaseClass: setData.iconBase,
|
22 |
+
iconClassPrefix: setData.iconPrefix
|
23 |
+
}).on( 'iconpickerUpdated', function() {
|
24 |
+
$( this ).trigger( 'change' );
|
25 |
+
});
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( setData ) {
|
29 |
+
$( 'body' ).append( '<link rel="stylesheet" type="text/css" href="' + setData.iconCSS + '"">' );
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
};
|
34 |
+
|
35 |
+
CherryJsCore.ui_elements.iconpicker.init();
|
36 |
+
|
37 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-iconpicker.scss
ADDED
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-iconpicker-group {
|
5 |
+
max-width: 230px;
|
6 |
+
position: relative;
|
7 |
+
.input-group-addon {
|
8 |
+
position: absolute;
|
9 |
+
width: 36px;
|
10 |
+
height: 36px;
|
11 |
+
left: 0px;
|
12 |
+
top: 0px;
|
13 |
+
background: $grey_color_3;
|
14 |
+
font-size: 14px;
|
15 |
+
line-height: 36px;
|
16 |
+
text-align: center;
|
17 |
+
border-radius: 3px 0 0 3px;
|
18 |
+
border-right: 1px solid #dddcdc;
|
19 |
+
margin: 7px;
|
20 |
+
}
|
21 |
+
.cherry-ui-text{
|
22 |
+
@include input();
|
23 |
+
padding-left: 60px;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
.iconpicker-popover.popover {
|
28 |
+
position: absolute;
|
29 |
+
top: 0;
|
30 |
+
left: 0;
|
31 |
+
display: none;
|
32 |
+
max-width: none;
|
33 |
+
padding: 1px;
|
34 |
+
text-align: left;
|
35 |
+
width: 242px;
|
36 |
+
background: #f0f0f0;
|
37 |
+
z-index: 999;
|
38 |
+
}
|
39 |
+
.iconpicker-popover.popover.top,
|
40 |
+
.iconpicker-popover.popover.topLeftCorner,
|
41 |
+
.iconpicker-popover.popover.topLeft,
|
42 |
+
.iconpicker-popover.popover.topRight,
|
43 |
+
.iconpicker-popover.popover.topRightCorner {
|
44 |
+
margin-top: -10px;
|
45 |
+
}
|
46 |
+
.iconpicker-popover.popover.right,
|
47 |
+
.iconpicker-popover.popover.rightTop,
|
48 |
+
.iconpicker-popover.popover.rightBottom {
|
49 |
+
margin-left: 10px;
|
50 |
+
}
|
51 |
+
.iconpicker-popover.popover.bottom,
|
52 |
+
.iconpicker-popover.popover.bottomRightCorner,
|
53 |
+
.iconpicker-popover.popover.bottomRight,
|
54 |
+
.iconpicker-popover.popover.bottomLeft,
|
55 |
+
.iconpicker-popover.popover.bottomLeftCorner {
|
56 |
+
margin-top: 10px;
|
57 |
+
}
|
58 |
+
.iconpicker-popover.popover.left,
|
59 |
+
.iconpicker-popover.popover.leftBottom,
|
60 |
+
.iconpicker-popover.popover.leftTop {
|
61 |
+
margin-left: -10px;
|
62 |
+
}
|
63 |
+
.iconpicker-popover.popover.inline {
|
64 |
+
margin: 0 0 14px 0;
|
65 |
+
position: relative;
|
66 |
+
display: inline-block;
|
67 |
+
opacity: 1;
|
68 |
+
top: auto;
|
69 |
+
left: auto;
|
70 |
+
bottom: auto;
|
71 |
+
right: auto;
|
72 |
+
max-width: 100%;
|
73 |
+
box-shadow: none;
|
74 |
+
z-index: auto;
|
75 |
+
vertical-align: top;
|
76 |
+
}
|
77 |
+
.iconpicker-popover.popover.inline > .arrow {
|
78 |
+
display: none;
|
79 |
+
}
|
80 |
+
.dropdown-menu .iconpicker-popover.inline {
|
81 |
+
margin: 0;
|
82 |
+
border: none;
|
83 |
+
}
|
84 |
+
.dropdown-menu.iconpicker-container {
|
85 |
+
padding: 0;
|
86 |
+
}
|
87 |
+
.iconpicker-popover.popover .popover-title {
|
88 |
+
padding: 14px;
|
89 |
+
font-size: 14px;
|
90 |
+
line-height: 16px;
|
91 |
+
border-bottom: 1px solid #ebebeb;
|
92 |
+
background-color: #f0f0f0;
|
93 |
+
}
|
94 |
+
.iconpicker-popover.popover .popover-title input[type=search].iconpicker-search {
|
95 |
+
margin: 0 0 2px 0;
|
96 |
+
}
|
97 |
+
.iconpicker-popover.popover .popover-title-text ~ input[type=search].iconpicker-search {
|
98 |
+
margin-top: 14px;
|
99 |
+
}
|
100 |
+
.iconpicker-popover.popover .popover-content {
|
101 |
+
padding: 0px;
|
102 |
+
text-align: center;
|
103 |
+
}
|
104 |
+
.iconpicker-popover .popover-footer {
|
105 |
+
float: none;
|
106 |
+
clear: both;
|
107 |
+
padding: 14px;
|
108 |
+
text-align: right;
|
109 |
+
margin: 0;
|
110 |
+
border-top: 1px solid #ebebeb;
|
111 |
+
background-color: #f0f0f0;
|
112 |
+
}
|
113 |
+
.iconpicker-popover .popover-footer:before,
|
114 |
+
.iconpicker-popover .popover-footer:after {
|
115 |
+
content: " ";
|
116 |
+
display: table;
|
117 |
+
}
|
118 |
+
.iconpicker-popover .popover-footer:after {
|
119 |
+
clear: both;
|
120 |
+
}
|
121 |
+
.iconpicker-popover .popover-footer .iconpicker-btn {
|
122 |
+
margin-left: 10px;
|
123 |
+
}
|
124 |
+
.iconpicker-popover .popover-footer input[type=search].iconpicker-search {
|
125 |
+
/*width:auto;
|
126 |
+
float:left;*/
|
127 |
+
margin-bottom: 14px;
|
128 |
+
}
|
129 |
+
.iconpicker-popover.popover > .arrow,
|
130 |
+
.iconpicker-popover.popover > .arrow:after {
|
131 |
+
position: absolute;
|
132 |
+
display: block;
|
133 |
+
width: 0;
|
134 |
+
height: 0;
|
135 |
+
border-color: transparent;
|
136 |
+
border-style: solid;
|
137 |
+
}
|
138 |
+
.iconpicker-popover.popover > .arrow {
|
139 |
+
border-width: 11px;
|
140 |
+
}
|
141 |
+
.iconpicker-popover.popover > .arrow:after {
|
142 |
+
border-width: 10px;
|
143 |
+
content: "";
|
144 |
+
}
|
145 |
+
.iconpicker-popover.popover.top > .arrow,
|
146 |
+
.iconpicker-popover.popover.topLeft > .arrow,
|
147 |
+
.iconpicker-popover.popover.topRight > .arrow {
|
148 |
+
left: 50%;
|
149 |
+
margin-left: -11px;
|
150 |
+
border-bottom-width: 0;
|
151 |
+
border-top-color: #f0f0f0;
|
152 |
+
bottom: -11px;
|
153 |
+
}
|
154 |
+
.iconpicker-popover.popover.top > .arrow:after,
|
155 |
+
.iconpicker-popover.popover.topLeft > .arrow:after,
|
156 |
+
.iconpicker-popover.popover.topRight > .arrow:after {
|
157 |
+
content: " ";
|
158 |
+
bottom: 1px;
|
159 |
+
margin-left: -10px;
|
160 |
+
border-bottom-width: 0;
|
161 |
+
border-top-color: #ffffff;
|
162 |
+
}
|
163 |
+
.iconpicker-popover.popover.topLeft > .arrow {
|
164 |
+
left: 14px;
|
165 |
+
margin-left: 0;
|
166 |
+
}
|
167 |
+
.iconpicker-popover.popover.topRight > .arrow {
|
168 |
+
left: auto;
|
169 |
+
right: 14px;
|
170 |
+
margin-left: 0;
|
171 |
+
}
|
172 |
+
.iconpicker-popover.popover.right > .arrow,
|
173 |
+
.iconpicker-popover.popover.rightTop > .arrow,
|
174 |
+
.iconpicker-popover.popover.rightBottom > .arrow {
|
175 |
+
top: 50%;
|
176 |
+
left: -11px;
|
177 |
+
margin-top: -11px;
|
178 |
+
border-left-width: 0;
|
179 |
+
border-right-color: #f0f0f0;
|
180 |
+
}
|
181 |
+
.iconpicker-popover.popover.right > .arrow:after,
|
182 |
+
.iconpicker-popover.popover.rightTop > .arrow:after,
|
183 |
+
.iconpicker-popover.popover.rightBottom > .arrow:after {
|
184 |
+
content: " ";
|
185 |
+
left: 1px;
|
186 |
+
bottom: -10px;
|
187 |
+
border-left-width: 0;
|
188 |
+
border-right-color: #ffffff;
|
189 |
+
}
|
190 |
+
.iconpicker-popover.popover.rightTop > .arrow {
|
191 |
+
top: auto;
|
192 |
+
bottom: 14px;
|
193 |
+
margin-top: 0;
|
194 |
+
}
|
195 |
+
.iconpicker-popover.popover.rightBottom > .arrow {
|
196 |
+
top: 14px;
|
197 |
+
margin-top: 0;
|
198 |
+
}
|
199 |
+
.iconpicker-popover.popover.bottom > .arrow,
|
200 |
+
.iconpicker-popover.popover.bottomRight > .arrow,
|
201 |
+
.iconpicker-popover.popover.bottomLeft > .arrow {
|
202 |
+
left: 50%;
|
203 |
+
margin-left: -11px;
|
204 |
+
border-top-width: 0;
|
205 |
+
border-bottom-color: #f0f0f0;
|
206 |
+
top: -11px;
|
207 |
+
}
|
208 |
+
.iconpicker-popover.popover.bottom > .arrow:after,
|
209 |
+
.iconpicker-popover.popover.bottomRight > .arrow:after,
|
210 |
+
.iconpicker-popover.popover.bottomLeft > .arrow:after {
|
211 |
+
content: " ";
|
212 |
+
top: 1px;
|
213 |
+
margin-left: -10px;
|
214 |
+
border-top-width: 0;
|
215 |
+
border-bottom-color: #f0f0f0;
|
216 |
+
}
|
217 |
+
.iconpicker-popover.popover.bottomLeft > .arrow {
|
218 |
+
left: 14px;
|
219 |
+
margin-left: 0;
|
220 |
+
}
|
221 |
+
.iconpicker-popover.popover.bottomRight > .arrow {
|
222 |
+
left: auto;
|
223 |
+
right: 14px;
|
224 |
+
margin-left: 0;
|
225 |
+
}
|
226 |
+
.iconpicker-popover.popover.left > .arrow,
|
227 |
+
.iconpicker-popover.popover.leftBottom > .arrow,
|
228 |
+
.iconpicker-popover.popover.leftTop > .arrow {
|
229 |
+
top: 50%;
|
230 |
+
right: -11px;
|
231 |
+
margin-top: -11px;
|
232 |
+
border-right-width: 0;
|
233 |
+
border-left-color: #f0f0f0;
|
234 |
+
}
|
235 |
+
.iconpicker-popover.popover.left > .arrow:after,
|
236 |
+
.iconpicker-popover.popover.leftBottom > .arrow:after,
|
237 |
+
.iconpicker-popover.popover.leftTop > .arrow:after {
|
238 |
+
content: " ";
|
239 |
+
right: 1px;
|
240 |
+
border-right-width: 0;
|
241 |
+
border-left-color: #ffffff;
|
242 |
+
bottom: -10px;
|
243 |
+
}
|
244 |
+
.iconpicker-popover.popover.leftBottom > .arrow {
|
245 |
+
top: 14px;
|
246 |
+
margin-top: 0;
|
247 |
+
}
|
248 |
+
.iconpicker-popover.popover.leftTop > .arrow {
|
249 |
+
top: auto;
|
250 |
+
bottom: 14px;
|
251 |
+
margin-top: 0;
|
252 |
+
}
|
253 |
+
.iconpicker {
|
254 |
+
position: relative;
|
255 |
+
text-align: left;
|
256 |
+
text-shadow: none;
|
257 |
+
line-height: 0;
|
258 |
+
display: block;
|
259 |
+
margin: 0;
|
260 |
+
overflow: hidden;
|
261 |
+
}
|
262 |
+
.iconpicker * {
|
263 |
+
-webkit-box-sizing: content-box;
|
264 |
+
-moz-box-sizing: content-box;
|
265 |
+
box-sizing: content-box;
|
266 |
+
position: relative;
|
267 |
+
}
|
268 |
+
.iconpicker:before,
|
269 |
+
.iconpicker:after {
|
270 |
+
content: " ";
|
271 |
+
display: table;
|
272 |
+
}
|
273 |
+
.iconpicker:after {
|
274 |
+
clear: both;
|
275 |
+
}
|
276 |
+
.iconpicker .iconpicker-items {
|
277 |
+
position: relative;
|
278 |
+
clear: both;
|
279 |
+
float: none;
|
280 |
+
padding: 10px 0 0 10px;
|
281 |
+
background: #fff;
|
282 |
+
margin: 0;
|
283 |
+
overflow: hidden;
|
284 |
+
overflow-y: auto;
|
285 |
+
min-height: 55px;
|
286 |
+
max-height: 275px;
|
287 |
+
}
|
288 |
+
.iconpicker .iconpicker-items:before,
|
289 |
+
.iconpicker .iconpicker-items:after {
|
290 |
+
content: " ";
|
291 |
+
display: table;
|
292 |
+
}
|
293 |
+
.iconpicker .iconpicker-items:after {
|
294 |
+
clear: both;
|
295 |
+
}
|
296 |
+
.iconpicker .iconpicker-item {
|
297 |
+
float: left;
|
298 |
+
width: 28px;
|
299 |
+
height: 28px;
|
300 |
+
line-height: 28px;
|
301 |
+
margin: 0 7px 7px 0;
|
302 |
+
text-align: center;
|
303 |
+
cursor: pointer;
|
304 |
+
border-radius: 3px;
|
305 |
+
font-size: 18px;
|
306 |
+
color: #444;
|
307 |
+
box-shadow: 0 0 0 1px #dddddd;
|
308 |
+
/*&:nth-child(4n+4) {
|
309 |
+
margin-right: 0;
|
310 |
+
}
|
311 |
+
&:nth-last-child(-n+4) {
|
312 |
+
margin-bottom: 0;
|
313 |
+
}*/
|
314 |
+
}
|
315 |
+
.iconpicker .iconpicker-item:hover:not(.iconpicker-selected) {
|
316 |
+
background-color: #eeeeee;
|
317 |
+
}
|
318 |
+
.iconpicker .iconpicker-item.iconpicker-selected {
|
319 |
+
box-shadow: none;
|
320 |
+
background: #ddd;
|
321 |
+
}
|
322 |
+
.iconpicker-component {
|
323 |
+
cursor: pointer;
|
324 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/ui-iconpicker.php
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-iconpicker elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Iconpicker' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building ui-iconpicker elements.
|
22 |
+
*/
|
23 |
+
class UI_Iconpicker extends UI_Element implements I_UI {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Default settings
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
private $defaults_settings = array(
|
31 |
+
'type' => 'iconpicker',
|
32 |
+
'id' => 'cherry-ui-input-id',
|
33 |
+
'name' => 'cherry-ui-input-name',
|
34 |
+
'value' => '',
|
35 |
+
'placeholder' => '',
|
36 |
+
'icon_data' => array(),
|
37 |
+
'auto_parse' => false,
|
38 |
+
'label' => '',
|
39 |
+
'class' => '',
|
40 |
+
'master' => '',
|
41 |
+
'required' => false,
|
42 |
+
);
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Default icon data settings
|
46 |
+
*
|
47 |
+
* @var array
|
48 |
+
*/
|
49 |
+
private $default_icon_data = array(
|
50 |
+
'icon_set' => '',
|
51 |
+
'icon_css' => '',
|
52 |
+
'icon_base' => 'icon',
|
53 |
+
'icon_prefix' => '',
|
54 |
+
'icons' => '',
|
55 |
+
);
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Icons sets
|
59 |
+
*
|
60 |
+
* @var array
|
61 |
+
*/
|
62 |
+
public static $sets = array();
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Check if sets already printed
|
66 |
+
*
|
67 |
+
* @var boolean
|
68 |
+
*/
|
69 |
+
public static $printed = false;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Constructor method for the UI_Text class.
|
73 |
+
*
|
74 |
+
* @since 4.0.0
|
75 |
+
*/
|
76 |
+
function __construct( $args = array() ) {
|
77 |
+
$this->defaults_settings['id'] = 'cherry-ui-input-icon-'.uniqid();
|
78 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
79 |
+
|
80 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
81 |
+
add_action( 'admin_footer', array( $this, 'print_icon_set' ), 1 );
|
82 |
+
add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_icon_set' ), 9999 );
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get required attribute
|
87 |
+
*
|
88 |
+
* @return string required attribute
|
89 |
+
*/
|
90 |
+
public function get_required() {
|
91 |
+
if ( $this->settings['required'] ) {
|
92 |
+
return 'required="required"';
|
93 |
+
}
|
94 |
+
return '';
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Render html UI_Text.
|
99 |
+
*
|
100 |
+
* @since 4.0.0
|
101 |
+
*/
|
102 |
+
public function render() {
|
103 |
+
$html = '';
|
104 |
+
|
105 |
+
$html .= '<div class="cherry-ui-container ' . esc_attr( $this->settings['master'] ) . '">';
|
106 |
+
if ( '' !== $this->settings['label'] ) {
|
107 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
108 |
+
}
|
109 |
+
|
110 |
+
$this->settings['icon_data'] = wp_parse_args(
|
111 |
+
$this->settings['icon_data'],
|
112 |
+
$this->default_icon_data
|
113 |
+
);
|
114 |
+
|
115 |
+
$this->maybe_parse_set_from_css();
|
116 |
+
|
117 |
+
$html .= '<div class="cherry-ui-iconpicker-group">';
|
118 |
+
|
119 |
+
if ( $this->validate_icon_data( $this->settings['icon_data'] ) ) {
|
120 |
+
$html .= $this->render_picker();
|
121 |
+
} else {
|
122 |
+
$html .= 'Incorrect Icon Data Settings';
|
123 |
+
}
|
124 |
+
|
125 |
+
$html .= '</div>';
|
126 |
+
$html .= '</div>';
|
127 |
+
return $html;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Returns iconpicker html markup
|
132 |
+
*
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
private function render_picker() {
|
136 |
+
|
137 |
+
$format = '<span class="input-group-addon"></span><input type="text" name="%1$s" id="%2$s" value="%3$s" class="widefat cherry-ui-text cherry-ui-iconpicker %4$s" data-set="%5$s">';
|
138 |
+
|
139 |
+
$this->prepare_icon_set();
|
140 |
+
|
141 |
+
return sprintf(
|
142 |
+
$format,
|
143 |
+
$this->settings['name'],
|
144 |
+
$this->settings['id'],
|
145 |
+
$this->settings['value'],
|
146 |
+
$this->settings['class'],
|
147 |
+
$this->settings['icon_data']['icon_set']
|
148 |
+
);
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Return JS markup for icon set variable.
|
154 |
+
*
|
155 |
+
* @return void
|
156 |
+
*/
|
157 |
+
public function prepare_icon_set() {
|
158 |
+
|
159 |
+
if ( ! array_key_exists( $this->settings['icon_data']['icon_set'], self::$sets ) ) {
|
160 |
+
self::$sets[ $this->settings['icon_data']['icon_set'] ] = array(
|
161 |
+
'iconCSS' => $this->settings['icon_data']['icon_css'],
|
162 |
+
'iconBase' => $this->settings['icon_data']['icon_base'],
|
163 |
+
'iconPrefix' => $this->settings['icon_data']['icon_prefix'],
|
164 |
+
'icons' => $this->settings['icon_data']['icons'],
|
165 |
+
);
|
166 |
+
}
|
167 |
+
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Check if 'parse_set' is true and try to get icons set from CSS file
|
172 |
+
*
|
173 |
+
* @return void
|
174 |
+
*/
|
175 |
+
private function maybe_parse_set_from_css() {
|
176 |
+
|
177 |
+
if ( true !== $this->settings['auto_parse'] || empty( $this->settings['icon_data']['icon_css'] ) ) {
|
178 |
+
return;
|
179 |
+
}
|
180 |
+
|
181 |
+
ob_start();
|
182 |
+
|
183 |
+
$path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $this->settings['icon_data']['icon_css'] );
|
184 |
+
if ( file_exists( $path ) ) {
|
185 |
+
include $path;
|
186 |
+
}
|
187 |
+
|
188 |
+
$result = ob_get_clean();
|
189 |
+
|
190 |
+
preg_match_all( '/\.([-a-zA-Z0-9]+):before[, {]/', $result, $matches );
|
191 |
+
|
192 |
+
if ( ! is_array( $matches ) || empty( $matches[1] ) ) {
|
193 |
+
return;
|
194 |
+
}
|
195 |
+
|
196 |
+
if ( is_array( $this->settings['icon_data']['icons'] ) ) {
|
197 |
+
$this->settings['icon_data']['icons'] = array_merge(
|
198 |
+
$this->settings['icon_data']['icons'],
|
199 |
+
$matches[1]
|
200 |
+
);
|
201 |
+
} else {
|
202 |
+
$this->settings['icon_data']['icons'] = $matches[1];
|
203 |
+
}
|
204 |
+
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Checks if all required icon data fields are passed
|
209 |
+
*
|
210 |
+
* @param array $data Icon data.
|
211 |
+
* @return bool
|
212 |
+
*/
|
213 |
+
private function validate_icon_data( $data ) {
|
214 |
+
|
215 |
+
$validate = array_diff( $this->default_icon_data, array( 'icon_base', 'icon_prefix' ) );
|
216 |
+
|
217 |
+
foreach ( $validate as $key => $field ) {
|
218 |
+
|
219 |
+
if ( empty( $data[ $key ] ) ) {
|
220 |
+
return false;
|
221 |
+
}
|
222 |
+
|
223 |
+
return true;
|
224 |
+
}
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Print icon sets
|
230 |
+
*
|
231 |
+
* @return void
|
232 |
+
*/
|
233 |
+
public function print_icon_set() {
|
234 |
+
|
235 |
+
if ( empty( self::$sets ) || true === self::$printed ) {
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
self::$printed = true;
|
240 |
+
|
241 |
+
foreach ( self::$sets as $set => $data ) {
|
242 |
+
$json = json_encode( $data );
|
243 |
+
printf( '<script>window.%1$s = %2$s</script>', $set, $json );
|
244 |
+
}
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Enqueue javascript and stylesheet UI_Text
|
250 |
+
*
|
251 |
+
* @since 4.0.0
|
252 |
+
*/
|
253 |
+
public static function enqueue_assets() {
|
254 |
+
|
255 |
+
wp_enqueue_style(
|
256 |
+
'ui-iconpicker',
|
257 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-iconpicker.min.css', __FILE__ ) ),
|
258 |
+
array(),
|
259 |
+
'1.0.0',
|
260 |
+
'all'
|
261 |
+
);
|
262 |
+
|
263 |
+
wp_enqueue_script(
|
264 |
+
'jquery-iconpicker',
|
265 |
+
esc_url( Cherry_Core::base_url( 'assets/min/jquery-iconpicker.min.js', __FILE__ ) ),
|
266 |
+
array( 'jquery' ),
|
267 |
+
'1.0.0',
|
268 |
+
true
|
269 |
+
);
|
270 |
+
wp_enqueue_script(
|
271 |
+
'ui-iconpicker',
|
272 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-iconpicker.min.js', __FILE__ ) ),
|
273 |
+
array( 'jquery' ),
|
274 |
+
'1.0.0',
|
275 |
+
true
|
276 |
+
);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/min/ui-media.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-ui-container{margin:10px 0 20px 0}label.cherry-label{margin:0 0 5px 0;display:block}.cherry-ui-media-wrap .cherry-upload-preview{display:block;margin:0 0 5px 0}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap{position:relative;display:inline-block;vertical-align:top;width:120px;height:120px}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap .inner{width:110px;height:110px;margin:3px;position:relative;border:2px solid #298ffc;border-radius:2px;overflow:hidden}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap .inner .preview-holder{width:100%;height:100%;position:relative;background:#f1f1f1;box-sizing:border-box}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap .inner .preview-holder .centered{position:absolute;width:100%;height:100%;top:0;left:0;-webkit-transform:translate(50%, 50%);-ms-transform:translate(50%, 50%);transform:translate(50%, 50%)}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap .inner .preview-holder img{max-width:100%;height:auto;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap .inner .preview-holder span{width:auto;height:auto;font-size:60px;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap .inner .title{position:absolute;width:100%;padding:5px 0;bottom:0;left:0;color:#fff;background:rgba(41,143,252,0.8);text-align:center;font-size:11px;overflow:hidden}.cherry-ui-media-wrap .cherry-upload-preview .cherry-image-wrap:hover .cherry-remove-image{display:block}.cherry-ui-media-wrap .cherry-upload-preview .cherry-media-thumb-sortable-placeholder{width:112px;height:112px;margin:3px;vertical-align:top;border:1px dashed #96989a;display:inline-block;background-color:#f1f1f1}.cherry-ui-media-wrap .upload-button{float:left}.cherry-ui-media-wrap .cherry-remove-image{width:30px;height:30px;color:#e54343;display:block;position:absolute;top:0;right:0;cursor:pointer;text-decoration:none;outline:0;display:none}.cherry-ui-media-wrap .cherry-remove-image i{width:30px;height:30px;font-size:30px}.cherry-ui-media-wrap .cherry-remove-image:hover{color:#c73434}.cherry-ui-media-wrap .cherry-bgsetting{float:left;width:32%;margin-right:1%}.cherry-ui-media-wrap .cherry-bgsetting:nth-child(3n+1){width:34%;margin-right:0}.cherry-ui-media-wrap .cherry-bgsetting select{margin-bottom:10px}.button-default_{display:inline-block;text-decoration:none;font-size:12px;line-height:20px;font-weight:bold;padding:15px 20px;color:#fff;text-transform:uppercase;border-radius:4px;-webkit-transition:all 200ms linear;transition:all 200ms linear;box-shadow:0 5px 13px rgba(0,0,0,0.18);border:none;cursor:pointer;background:#495159}.button-default_:hover{color:#fff;box-shadow:none}.button-default_:focus,.button-default_:active{outline:none;box-shadow:none;color:#fff}.button-default_:hover{background:#393f45}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/min/ui-media.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,i){"use strict";i.utilites.namespace("ui_elements.media"),i.ui_elements.media={init:function(){e(window).on("cherry-ui-elements-init",this.render.bind(this))},render:function(i,a){var r=a.target,t=e(".upload-button",r);t.each(function(){var i=e(this),a=i.closest(".cherry-ui-media-wrap"),r={input:e(".cherry-upload-input",a),img_holder:e(".cherry-upload-preview",a),title_text:i.data("title"),multiple:i.data("multi-upload"),library_type:i.data("library-type")},t=wp.media.frames.file_frame=wp.media({title:r.title_text,button:{text:r.title_text},multiple:r.multiple,library:{type:r.library_type}});i.on("click",function(){return t.open(),!1}),t.on("select",function(){var i=t.state().get("selection").toJSON(),a=0,c="",n=e(".cherry-all-images-wrap",r.img_holder),l="",o="";for(r.multiple&&(c=r.input.val(),o=",",l=n.html());i[a];){var d=i[a],u=d.id,p=d.mime,m="",h="";switch(p){case"image/jpeg":case"image/png":case"image/gif":void 0!==d.sizes&&(m=d.sizes.thumbnail?d.sizes.thumbnail.url:d.sizes.full.url),h='<img src="'+m+'" alt="" data-img-attr="'+u+'">';break;case"image/x-icon":h='<span class="dashicons dashicons-format-image"></span>';break;case"video/mpeg":case"video/mp4":case"video/quicktime":case"video/webm":case"video/ogg":h='<span class="dashicons dashicons-format-video"></span>';break;case"audio/mpeg":case"audio/wav":case"audio/ogg":h='<span class="dashicons dashicons-format-audio"></span>'}l+='<div class="cherry-image-wrap"><div class="inner"><div class="preview-holder" data-id-attr="'+u+'"><div class="centered">'+h+'</div></div><a class="cherry-remove-image" href="#"><i class="dashicons dashicons-no"></i></a><span class="title">'+d.title+"</span></div></div>",c+=o+u,a++}r.input.val(c.replace(/(^,)/,"")).trigger("change"),n.html(l),e(".cherry-remove-image").on("click",function(){return s(e(this)),!1})});var s=function(e){var i=e.closest(".cherry-ui-media-wrap"),a=jQuery(".cherry-upload-input",i),r=e.parent().parent(".cherry-image-wrap"),t=jQuery(".preview-holder",r).data("id-attr"),s=a.attr("value"),c=new RegExp(""+t+"(,*)","i");s=s.replace(c,""),s=s.replace(/(,$)/,""),a.attr({value:s}).trigger("change"),r.remove()};jQuery(".cherry-remove-image",a).on("click",function(){return s(jQuery(this)),!1})}),jQuery(".cherry-all-images-wrap",r).sortable({items:"div.cherry-image-wrap",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,placeholder:"cherry-media-thumb-sortable-placeholder",start:function(){},stop:function(){},update:function(){var e="";jQuery(".cherry-image-wrap",this).each(function(){var i=jQuery(".preview-holder",this).data("id-attr");e=e+i+","}),e=e.substr(0,e.lastIndexOf(",")),jQuery(this).parent().siblings(".cherry-element-wrap").find("input.cherry-upload-input").val(e).trigger("change")}})}},i.ui_elements.media.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
border: none;
|
14 |
+
cursor: pointer;
|
15 |
+
&:hover {
|
16 |
+
color: #fff;
|
17 |
+
box-shadow: none;
|
18 |
+
}
|
19 |
+
&:focus,
|
20 |
+
&:active {
|
21 |
+
outline: none;
|
22 |
+
box-shadow: none;
|
23 |
+
color: #fff;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
@mixin button_normal() {
|
28 |
+
background: $dark_color_2;
|
29 |
+
&:hover {
|
30 |
+
background: $dark_color_2_h;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
@mixin button_primary() {
|
35 |
+
background: $blue_color;
|
36 |
+
&:hover {
|
37 |
+
background: $blue_color_h;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
@mixin button_success() {
|
42 |
+
background: $green_color;
|
43 |
+
&:hover {
|
44 |
+
background: $green_color_h;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
@mixin button_danger() {
|
49 |
+
background: $red_color;
|
50 |
+
&:hover {
|
51 |
+
background: $red_color_h;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
@mixin button_warning() {
|
56 |
+
background: $orange_color;
|
57 |
+
&:hover {
|
58 |
+
background: $orange_color_h;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
@mixin input() {
|
63 |
+
font-size: 14px;
|
64 |
+
line-height: 20px;
|
65 |
+
color: $dark_color_1;
|
66 |
+
background-color: $grey_color_3;
|
67 |
+
border-radius: $border_radius_extra_small;
|
68 |
+
padding: 10px 20px;
|
69 |
+
height: 50px;
|
70 |
+
border: 1px solid $grey_color_3;
|
71 |
+
box-shadow: none;
|
72 |
+
&:focus{
|
73 |
+
border-color: rgba(72,197,105,.6);
|
74 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
@mixin button_icon( $icon ) {
|
79 |
+
content: $icon;
|
80 |
+
display: inline-block;
|
81 |
+
font-family: dashicons;
|
82 |
+
font-size: 16px;
|
83 |
+
font-style: normal;
|
84 |
+
font-weight: 400;
|
85 |
+
height: 18px;
|
86 |
+
line-height: 18px;
|
87 |
+
text-align: center;
|
88 |
+
text-decoration: inherit;
|
89 |
+
transition: all 200ms linear;
|
90 |
+
vertical-align: middle;
|
91 |
+
}
|
92 |
+
|
93 |
+
@mixin button_icon_before( $icon ) {
|
94 |
+
&:before {
|
95 |
+
@include button_icon( $icon );
|
96 |
+
padding: 0 5px 0 0;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
@mixin button_icon_after( $icon ) {
|
101 |
+
&:after {
|
102 |
+
@include button_icon( $icon );
|
103 |
+
padding: 0 0 0 5px;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
@mixin button_icon_middle( $icon ) {
|
108 |
+
&:before {
|
109 |
+
@include button_icon( $icon );
|
110 |
+
margin: 0 -5px;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
@mixin link() {
|
115 |
+
display: inline-block;
|
116 |
+
text-decoration: none;
|
117 |
+
font-size: 12px;
|
118 |
+
line-height: 20px;
|
119 |
+
font-weight: bold;
|
120 |
+
color: $blue_color;
|
121 |
+
text-transform: uppercase;
|
122 |
+
transition: all 200ms linear;
|
123 |
+
&:hover {
|
124 |
+
color: $dark_color_1;
|
125 |
+
box-shadow: none;
|
126 |
+
}
|
127 |
+
&:focus,
|
128 |
+
&:active {
|
129 |
+
outline: none;
|
130 |
+
box-shadow: none;
|
131 |
+
color: $blue_color;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
@mixin link_icon_before( $icon ) {
|
136 |
+
&:before {
|
137 |
+
@include button_icon( $icon );
|
138 |
+
padding: 0 5px 0 0;
|
139 |
+
color: $grey_color_4;
|
140 |
+
}
|
141 |
+
&:hover {
|
142 |
+
&:before {
|
143 |
+
color: $blue_color;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
@mixin container() {
|
149 |
+
padding: 30px;
|
150 |
+
border: 2px solid $grey_color_2;
|
151 |
+
background: $grey_color_3;
|
152 |
+
border-radius: $border_radius_large;
|
153 |
+
}
|
154 |
+
|
155 |
+
@mixin container_heading() {
|
156 |
+
margin: -30px -30px 30px -30px;
|
157 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
158 |
+
border-bottom: 1px solid $grey_color_2;
|
159 |
+
padding: 20px 30px;
|
160 |
+
font-weight: bold;
|
161 |
+
font-size: 16px;
|
162 |
+
line-height: 18px;
|
163 |
+
text-align: center;
|
164 |
+
background: #fff;
|
165 |
+
}
|
166 |
+
|
167 |
+
@mixin box() {
|
168 |
+
margin: 0 0 30px;
|
169 |
+
padding: 20px;
|
170 |
+
background: #fff;
|
171 |
+
box-shadow: $box_shadow_box;
|
172 |
+
border-radius: $border_radius;
|
173 |
+
}
|
174 |
+
|
175 |
+
@mixin box_heading() {
|
176 |
+
margin: -20px -20px 20px -20px;
|
177 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
178 |
+
border-bottom: 1px solid $grey_color_2;
|
179 |
+
padding: 20px 30px;
|
180 |
+
font-weight: bold;
|
181 |
+
font-size: 16px;
|
182 |
+
line-height: 18px;
|
183 |
+
background: #fff;
|
184 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-media.js
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Media
|
3 |
+
*/
|
4 |
+
(function( $, CherryJsCore){
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace('ui_elements.media');
|
8 |
+
CherryJsCore.ui_elements.media = {
|
9 |
+
init: function () {
|
10 |
+
$( window ).on( 'cherry-ui-elements-init', this.render.bind( this ) );
|
11 |
+
},
|
12 |
+
render: function ( event, data ) {
|
13 |
+
var target = data.target,
|
14 |
+
buttons = $('.upload-button', target);
|
15 |
+
|
16 |
+
buttons.each( function() {
|
17 |
+
var button = $( this ),
|
18 |
+
button_parent = button.closest('.cherry-ui-media-wrap'),
|
19 |
+
settings = {
|
20 |
+
input: $('.cherry-upload-input', button_parent),
|
21 |
+
img_holder: $('.cherry-upload-preview', button_parent),
|
22 |
+
title_text: button.data('title'),
|
23 |
+
multiple: button.data('multi-upload'),
|
24 |
+
library_type: button.data('library-type'),
|
25 |
+
},
|
26 |
+
cherry_uploader = wp.media.frames.file_frame = wp.media({
|
27 |
+
title: settings.title_text,
|
28 |
+
button: { text: settings.title_text },
|
29 |
+
multiple: settings.multiple,
|
30 |
+
library : { type : settings.library_type }
|
31 |
+
});
|
32 |
+
|
33 |
+
button.on( 'click', function() {
|
34 |
+
cherry_uploader.open();
|
35 |
+
return !1;
|
36 |
+
} ); // end click
|
37 |
+
|
38 |
+
cherry_uploader.on('select', function() {
|
39 |
+
var attachment = cherry_uploader.state().get('selection').toJSON(),
|
40 |
+
count = 0,
|
41 |
+
input_value = '',
|
42 |
+
new_img_object = $('.cherry-all-images-wrap', settings.img_holder),
|
43 |
+
new_img = '',
|
44 |
+
delimiter = '';
|
45 |
+
|
46 |
+
if ( settings.multiple ) {
|
47 |
+
input_value = settings.input.val();
|
48 |
+
delimiter = ',';
|
49 |
+
new_img = new_img_object.html();
|
50 |
+
}
|
51 |
+
|
52 |
+
while( attachment[ count ] ) {
|
53 |
+
var img_data = attachment[count],
|
54 |
+
return_data = img_data.id,
|
55 |
+
mimeType = img_data.mime,
|
56 |
+
img_src = '',
|
57 |
+
thumb = '';
|
58 |
+
|
59 |
+
switch (mimeType) {
|
60 |
+
case 'image/jpeg':
|
61 |
+
case 'image/png':
|
62 |
+
case 'image/gif':
|
63 |
+
if( img_data.sizes !== undefined){
|
64 |
+
img_src = img_data.sizes.thumbnail ? img_data.sizes.thumbnail.url : img_data.sizes.full.url;
|
65 |
+
}
|
66 |
+
thumb = '<img src="' + img_src + '" alt="" data-img-attr="'+return_data+'">';
|
67 |
+
break;
|
68 |
+
case 'image/x-icon':
|
69 |
+
thumb = '<span class="dashicons dashicons-format-image"></span>';
|
70 |
+
break;
|
71 |
+
case 'video/mpeg':
|
72 |
+
case 'video/mp4':
|
73 |
+
case 'video/quicktime':
|
74 |
+
case 'video/webm':
|
75 |
+
case 'video/ogg':
|
76 |
+
thumb = '<span class="dashicons dashicons-format-video"></span>';
|
77 |
+
break;
|
78 |
+
case 'audio/mpeg':
|
79 |
+
case 'audio/wav':
|
80 |
+
case 'audio/ogg':
|
81 |
+
thumb = '<span class="dashicons dashicons-format-audio"></span>';
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
|
85 |
+
new_img += '<div class="cherry-image-wrap">'+
|
86 |
+
'<div class="inner">'+
|
87 |
+
'<div class="preview-holder" data-id-attr="' + return_data +'"><div class="centered">' + thumb + '</div></div>'+
|
88 |
+
'<a class="cherry-remove-image" href="#"><i class="dashicons dashicons-no"></i></a>'+
|
89 |
+
'<span class="title">' + img_data.title + '</span>'+
|
90 |
+
'</div>'+
|
91 |
+
'</div>';
|
92 |
+
|
93 |
+
input_value += delimiter+return_data;
|
94 |
+
count++;
|
95 |
+
}
|
96 |
+
|
97 |
+
settings.input.val(input_value.replace(/(^,)/, '')).trigger( 'change' );
|
98 |
+
new_img_object.html(new_img);
|
99 |
+
|
100 |
+
$('.cherry-remove-image').on('click', function () {
|
101 |
+
removeMediaPreview( $(this) );
|
102 |
+
return !1;
|
103 |
+
});
|
104 |
+
} );
|
105 |
+
|
106 |
+
var removeMediaPreview = function( item ) {
|
107 |
+
var button_parent = item.closest('.cherry-ui-media-wrap'),
|
108 |
+
input = jQuery('.cherry-upload-input', button_parent),
|
109 |
+
img_holder = item.parent().parent('.cherry-image-wrap'),
|
110 |
+
img_attr = jQuery('.preview-holder', img_holder).data('id-attr'),
|
111 |
+
input_value = input.attr('value'),
|
112 |
+
pattern = new RegExp(''+img_attr+'(,*)', 'i');
|
113 |
+
|
114 |
+
input_value = input_value.replace(pattern, '');
|
115 |
+
input_value = input_value.replace(/(,$)/, '');
|
116 |
+
input.attr({'value':input_value}).trigger( 'change' );
|
117 |
+
img_holder.remove();
|
118 |
+
|
119 |
+
};
|
120 |
+
|
121 |
+
// This function remove upload image
|
122 |
+
jQuery('.cherry-remove-image', button_parent).on('click', function () {
|
123 |
+
removeMediaPreview( jQuery(this) );
|
124 |
+
return !1;
|
125 |
+
});
|
126 |
+
} ); // end each
|
127 |
+
|
128 |
+
// Image ordering
|
129 |
+
jQuery('.cherry-all-images-wrap', target).sortable( {
|
130 |
+
items: 'div.cherry-image-wrap',
|
131 |
+
cursor: 'move',
|
132 |
+
scrollSensitivity: 40,
|
133 |
+
forcePlaceholderSize: true,
|
134 |
+
forceHelperSize: false,
|
135 |
+
helper: 'clone',
|
136 |
+
opacity: 0.65,
|
137 |
+
placeholder: 'cherry-media-thumb-sortable-placeholder',
|
138 |
+
start:function(){},
|
139 |
+
stop:function(){},
|
140 |
+
update: function() {
|
141 |
+
var attachment_ids = '';
|
142 |
+
jQuery('.cherry-image-wrap', this).each(
|
143 |
+
function() {
|
144 |
+
var attachment_id = jQuery('.preview-holder', this).data( 'id-attr' );
|
145 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
146 |
+
}
|
147 |
+
);
|
148 |
+
attachment_ids = attachment_ids.substr(0, attachment_ids.lastIndexOf(',') );
|
149 |
+
jQuery(this).parent().siblings('.cherry-element-wrap').find('input.cherry-upload-input').val( attachment_ids ).trigger( 'change' );
|
150 |
+
}
|
151 |
+
} );
|
152 |
+
// End Image ordering
|
153 |
+
}
|
154 |
+
};
|
155 |
+
|
156 |
+
CherryJsCore.ui_elements.media.init();
|
157 |
+
|
158 |
+
}(jQuery , window.CherryJsCore));
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-media.scss
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
.cherry-ui-media-wrap{
|
12 |
+
.cherry-upload-preview{
|
13 |
+
display: block;
|
14 |
+
margin: 0 0 5px 0;
|
15 |
+
.cherry-image-wrap{
|
16 |
+
position: relative;
|
17 |
+
display: inline-block;
|
18 |
+
vertical-align: top;
|
19 |
+
width: 120px;
|
20 |
+
height: 120px;
|
21 |
+
.inner{
|
22 |
+
width: 110px;
|
23 |
+
height: 110px;
|
24 |
+
margin: 3px;
|
25 |
+
position: relative;
|
26 |
+
border: 2px solid $blue_color;
|
27 |
+
border-radius: $border_radius_extra_small;
|
28 |
+
overflow: hidden;
|
29 |
+
.preview-holder{
|
30 |
+
width: 100%;
|
31 |
+
height: 100%;
|
32 |
+
position: relative;
|
33 |
+
background: $grey_color_3;
|
34 |
+
box-sizing: border-box;
|
35 |
+
.centered{
|
36 |
+
position: absolute;
|
37 |
+
width: 100%;
|
38 |
+
height: 100%;
|
39 |
+
top: 0;
|
40 |
+
left: 0;
|
41 |
+
transform: translate(50%,50%);
|
42 |
+
}
|
43 |
+
img{
|
44 |
+
max-width: 100%;
|
45 |
+
height: auto;
|
46 |
+
transform: translate(-50%,-50%);
|
47 |
+
}
|
48 |
+
span{
|
49 |
+
width: auto;
|
50 |
+
height: auto;
|
51 |
+
font-size: 60px;
|
52 |
+
transform: translate(-50%,-50%);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
.title{
|
56 |
+
position: absolute;
|
57 |
+
width: 100%;
|
58 |
+
padding: 5px 0;
|
59 |
+
bottom: 0;
|
60 |
+
left: 0;
|
61 |
+
color: #fff;
|
62 |
+
background: rgba(41, 143, 252, 0.8);
|
63 |
+
text-align: center;
|
64 |
+
font-size: 11px;
|
65 |
+
overflow: hidden;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
&:hover{
|
69 |
+
.cherry-remove-image{
|
70 |
+
display: block;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
.cherry-media-thumb-sortable-placeholder{
|
75 |
+
width: 112px;
|
76 |
+
height: 112px;
|
77 |
+
margin: 3px;
|
78 |
+
vertical-align: top;
|
79 |
+
border: 1px dashed $grey_color_1;
|
80 |
+
display: inline-block;
|
81 |
+
background-color: $grey_color_3;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
.upload-button{
|
85 |
+
float: left;
|
86 |
+
}
|
87 |
+
.cherry-remove-image{
|
88 |
+
width: 30px;
|
89 |
+
height: 30px;
|
90 |
+
color: $red_color;
|
91 |
+
display: block;
|
92 |
+
position: absolute;
|
93 |
+
top: 0;
|
94 |
+
right: 0;
|
95 |
+
cursor: pointer;
|
96 |
+
text-decoration: none;
|
97 |
+
outline: 0;
|
98 |
+
display: none;
|
99 |
+
i{
|
100 |
+
width: 30px;
|
101 |
+
height: 30px;
|
102 |
+
font-size: 30px;
|
103 |
+
}
|
104 |
+
&:hover{
|
105 |
+
color: $red_color_h;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
.cherry-bgsetting{
|
109 |
+
float: left;
|
110 |
+
width: 32%;
|
111 |
+
margin-right: 1%;
|
112 |
+
&:nth-child(3n+1){
|
113 |
+
width: 34%;
|
114 |
+
margin-right: 0;
|
115 |
+
}
|
116 |
+
select{
|
117 |
+
margin-bottom: 10px;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
.button-default_{
|
123 |
+
@include button_base();
|
124 |
+
@include button_normal();
|
125 |
+
}
|
126 |
+
/*.button_{
|
127 |
+
display: inline-block;
|
128 |
+
cursor: pointer;
|
129 |
+
white-space: nowrap;
|
130 |
+
text-decoration: none;
|
131 |
+
box-sizing: border-box;
|
132 |
+
backface-visibility: hidden;
|
133 |
+
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
|
134 |
+
position: relative;
|
135 |
+
transform: translateZ(0px);
|
136 |
+
transition-duration: 0.5s;
|
137 |
+
transition-property: color;
|
138 |
+
vertical-align: middle;
|
139 |
+
&:hover,
|
140 |
+
&:active,
|
141 |
+
&:focus {
|
142 |
+
outline: none;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
.button-default_{
|
147 |
+
@extend .button_;
|
148 |
+
font-size: 13px;
|
149 |
+
background-color: #ffffff;
|
150 |
+
border: 1px solid #dddcdc;
|
151 |
+
border-radius: 3px;
|
152 |
+
line-height: 32px;
|
153 |
+
margin: 0;
|
154 |
+
padding: 0 14px;
|
155 |
+
box-shadow: none;
|
156 |
+
color: #464646;
|
157 |
+
height: auto;
|
158 |
+
}*/
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/ui-media.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-media elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Media' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Media elements.
|
22 |
+
*/
|
23 |
+
class UI_Media extends UI_Element implements I_UI {
|
24 |
+
/**
|
25 |
+
* Default settings
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
|
30 |
+
private $defaults_settings = array(
|
31 |
+
'id' => 'cherry-ui-media-id',
|
32 |
+
'name' => 'cherry-ui-media-name',
|
33 |
+
'value' => '',
|
34 |
+
'multi_upload' => true,
|
35 |
+
'library_type' => '', // image, video
|
36 |
+
'upload_button_text' => 'Choose Media',
|
37 |
+
'label' => '',
|
38 |
+
'class' => '',
|
39 |
+
'master' => '',
|
40 |
+
);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Constructor method for the UI_Media class.
|
44 |
+
*
|
45 |
+
* @since 4.0.0
|
46 |
+
*/
|
47 |
+
function __construct( $args = array() ) {
|
48 |
+
|
49 |
+
$this->defaults_settings['id'] = 'cherry-ui-media-'.uniqid();
|
50 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
51 |
+
|
52 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Render html UI_Media.
|
57 |
+
*
|
58 |
+
* @since 4.0.0
|
59 |
+
*/
|
60 |
+
public function render() {
|
61 |
+
$html = '';
|
62 |
+
|
63 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
64 |
+
|
65 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
66 |
+
if ( '' != $this->settings['value'] ) {
|
67 |
+
$this->settings['value'] = str_replace( ' ', '', $this->settings['value'] );
|
68 |
+
$medias = explode( ',', $this->settings['value'] );
|
69 |
+
} else {
|
70 |
+
$this->settings['value'] = '';
|
71 |
+
$medias = array();
|
72 |
+
}
|
73 |
+
|
74 |
+
$img_style = ! $this->settings['value'] ? 'style="display:none;"' : '' ;
|
75 |
+
|
76 |
+
if ( '' !== $this->settings['label'] ) {
|
77 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
78 |
+
}
|
79 |
+
$html .= '<div class="cherry-ui-media-wrap">';
|
80 |
+
$html .= '<div class="cherry-upload-preview" >';
|
81 |
+
$html .= '<div class="cherry-all-images-wrap">';
|
82 |
+
if ( is_array( $medias ) && ! empty( $medias ) ) {
|
83 |
+
foreach ( $medias as $medias_key => $medias_value ) {
|
84 |
+
$media_title = get_the_title( $medias_value );
|
85 |
+
$mime_type = get_post_mime_type( $medias_value );
|
86 |
+
$tmp = wp_get_attachment_metadata( $medias_value );
|
87 |
+
$img_src = '';
|
88 |
+
$thumb = '';
|
89 |
+
|
90 |
+
switch ( $mime_type ) {
|
91 |
+
case 'image/jpeg':
|
92 |
+
case 'image/png':
|
93 |
+
case 'image/gif':
|
94 |
+
$img_src = wp_get_attachment_image_src( $medias_value, 'thumbnail' );
|
95 |
+
$img_src = $img_src[0];
|
96 |
+
$thumb = '<img src="' . esc_html( $img_src ) . '" alt="">';
|
97 |
+
break;
|
98 |
+
case 'image/x-icon':
|
99 |
+
$thumb = '<span class="dashicons dashicons-format-image"></span>';
|
100 |
+
break;
|
101 |
+
case 'video/mpeg':
|
102 |
+
case 'video/mp4':
|
103 |
+
case 'video/quicktime':
|
104 |
+
case 'video/webm':
|
105 |
+
case 'video/ogg':
|
106 |
+
$thumb = '<span class="dashicons dashicons-format-video"></span>';
|
107 |
+
break;
|
108 |
+
case 'audio/mpeg':
|
109 |
+
case 'audio/wav':
|
110 |
+
case 'audio/ogg':
|
111 |
+
$thumb = '<span class="dashicons dashicons-format-audio"></span>';
|
112 |
+
break;
|
113 |
+
}
|
114 |
+
$html .= '<div class="cherry-image-wrap">';
|
115 |
+
$html .= '<div class="inner">';
|
116 |
+
$html .= '<div class="preview-holder" data-id-attr="' . esc_attr( $medias_value ) . '">';
|
117 |
+
$html .= '<div class="centered">';
|
118 |
+
$html .= $thumb;
|
119 |
+
$html .= '</div>';
|
120 |
+
$html .= '</div>';
|
121 |
+
$html .= '<span class="title">' . $media_title . '</span>';
|
122 |
+
$html .= '<a class="cherry-remove-image" href="#" title=""><i class="dashicons dashicons-no"></i></a>';
|
123 |
+
$html .= '</div>';
|
124 |
+
$html .= '</div>';
|
125 |
+
}
|
126 |
+
}
|
127 |
+
$html .= '</div>';
|
128 |
+
$html .= '</div>';
|
129 |
+
$html .= '<div class="cherry-element-wrap">';
|
130 |
+
$html .= '<input type="hidden" id="' . esc_attr( $this->settings['id'] ) . '" class="cherry-upload-input" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '" >';
|
131 |
+
$html .= '<input type="button" class="upload-button button-default_" value="' . esc_attr( $this->settings['upload_button_text'] ) . '" data-title="' . esc_attr( $this->settings['upload_button_text'] ) . '" data-multi-upload="' . esc_attr( $this->settings['multi_upload'] ) . '" data-library-type="' . esc_attr( $this->settings['library_type'] ) . '"/>';
|
132 |
+
$html .= '<div class="clear"></div>';
|
133 |
+
$html .= '</div>';
|
134 |
+
$html .= '</div>';
|
135 |
+
$html .= '</div>';
|
136 |
+
|
137 |
+
return $html;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Enqueue javascript and stylesheet UI_Media
|
142 |
+
*
|
143 |
+
* @since 4.0.0
|
144 |
+
*/
|
145 |
+
public static function enqueue_assets() {
|
146 |
+
wp_enqueue_media();
|
147 |
+
|
148 |
+
wp_enqueue_script(
|
149 |
+
'ui-media-min',
|
150 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-media.min.js', __FILE__ ) ),
|
151 |
+
array( 'jquery', 'jquery-ui-sortable' ),
|
152 |
+
'1.0.0',
|
153 |
+
true
|
154 |
+
);
|
155 |
+
|
156 |
+
wp_enqueue_style(
|
157 |
+
'ui-media-min',
|
158 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-media.min.css', __FILE__ ) ),
|
159 |
+
array(),
|
160 |
+
'1.0.0',
|
161 |
+
'all'
|
162 |
+
);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/min/ui-radio.min.css
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-container {
|
2 |
+
margin: 10px 0 20px 0; }
|
3 |
+
|
4 |
+
label.cherry-label {
|
5 |
+
margin: 0 0 5px 0;
|
6 |
+
display: block; }
|
7 |
+
|
8 |
+
input.cherry-radio-input {
|
9 |
+
display: none; }
|
10 |
+
|
11 |
+
.cherry-radio-item {
|
12 |
+
margin-bottom: 10px; }
|
13 |
+
.cherry-radio-item:last-child {
|
14 |
+
margin-bottom: 0; }
|
15 |
+
.cherry-radio-item label {
|
16 |
+
display: inline-block;
|
17 |
+
font-size: 14px;
|
18 |
+
line-height: 22px;
|
19 |
+
color: #23282d; }
|
20 |
+
.cherry-radio-item span {
|
21 |
+
width: 25px;
|
22 |
+
height: 25px;
|
23 |
+
border-radius: 25px;
|
24 |
+
margin-right: 10px;
|
25 |
+
cursor: pointer;
|
26 |
+
position: relative;
|
27 |
+
background-color: #f1f1f1;
|
28 |
+
display: inline-block;
|
29 |
+
float: left; }
|
30 |
+
.cherry-radio-item span i {
|
31 |
+
width: 13px;
|
32 |
+
height: 13px;
|
33 |
+
background-color: #298ffc;
|
34 |
+
margin: 6px;
|
35 |
+
border-radius: 20px;
|
36 |
+
display: inline-block;
|
37 |
+
-webkit-transform: scale(0);
|
38 |
+
-ms-transform: scale(0);
|
39 |
+
transform: scale(0);
|
40 |
+
-webkit-transition: all 0.3s cubic-bezier(0.27, 0.63, 0.54, 0.96);
|
41 |
+
transition: all 0.3s cubic-bezier(0.27, 0.63, 0.54, 0.96); }
|
42 |
+
|
43 |
+
.cherry-radio-item.checked span i {
|
44 |
+
-webkit-transform: scale(1);
|
45 |
+
-ms-transform: scale(1);
|
46 |
+
transform: scale(1); }
|
47 |
+
|
48 |
+
.cherry-radio-img {
|
49 |
+
float: left;
|
50 |
+
margin: 10px 5px 0 5px;
|
51 |
+
text-align: center;
|
52 |
+
max-width: 80px;
|
53 |
+
position: relative; }
|
54 |
+
.cherry-radio-img label {
|
55 |
+
display: inline-block; }
|
56 |
+
.cherry-radio-img img {
|
57 |
+
width: 100%;
|
58 |
+
height: auto;
|
59 |
+
margin: 0 0 5px 0;
|
60 |
+
pointer-events: none; }
|
61 |
+
|
62 |
+
.cherry-radio-img.checked {
|
63 |
+
font-weight: bold; }
|
64 |
+
.cherry-radio-img.checked .check {
|
65 |
+
display: block; }
|
66 |
+
.cherry-radio-img.checked img {
|
67 |
+
box-shadow: 0 0 0 2px #fffeff, 0 0 0 5px #298ffc; }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/min/ui-radio.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,i){"use strict";i.utilites.namespace("ui_elements.radio"),i.ui_elements.radio={init:function(){e(window).on("cherry-ui-elements-init",this.render.bind(this))},render:function(i,r){var t=r.target;e(".cherry-radio-group",t).each(function(){e('.cherry-radio-input[type="radio"]',this).each(function(){var i=e(this),r=i.data("slave");i.is(":checked")||e("."+r,t).stop().hide()})}),e('.cherry-radio-input[type="radio"]',t).on("change",function(){var i=e(this),r=i.data("slave"),a=i.parents(".cherry-radio-group"),n=e('.cherry-radio-input[type="radio"]',a);i.parents(".cherry-radio-group").find(".checked").removeClass("checked"),i.parent().addClass("checked"),e("."+r,t).show(),n.each(function(){var i=e(this),a=i.data("slave");a!==r&&e("."+a,t).hide()}),i.trigger("radio_change_event",[r,n])})}},i.ui_elements.radio.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin button_icon( $icon ) {
|
61 |
+
content: $icon;
|
62 |
+
display: inline-block;
|
63 |
+
font-family: dashicons;
|
64 |
+
font-size: 16px;
|
65 |
+
font-style: normal;
|
66 |
+
font-weight: 400;
|
67 |
+
height: 18px;
|
68 |
+
line-height: 18px;
|
69 |
+
text-align: center;
|
70 |
+
text-decoration: inherit;
|
71 |
+
transition: all 200ms linear;
|
72 |
+
vertical-align: middle;
|
73 |
+
}
|
74 |
+
|
75 |
+
@mixin button_icon_before( $icon ) {
|
76 |
+
&:before {
|
77 |
+
@include button_icon( $icon );
|
78 |
+
padding: 0 5px 0 0;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
@mixin button_icon_after( $icon ) {
|
83 |
+
&:after {
|
84 |
+
@include button_icon( $icon );
|
85 |
+
padding: 0 0 0 5px;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
@mixin button_icon_middle( $icon ) {
|
90 |
+
&:before {
|
91 |
+
@include button_icon( $icon );
|
92 |
+
margin: 0 -5px;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
@mixin link() {
|
97 |
+
display: inline-block;
|
98 |
+
text-decoration: none;
|
99 |
+
font-size: 12px;
|
100 |
+
line-height: 20px;
|
101 |
+
font-weight: bold;
|
102 |
+
color: $blue_color;
|
103 |
+
text-transform: uppercase;
|
104 |
+
transition: all 200ms linear;
|
105 |
+
&:hover {
|
106 |
+
color: $dark_color_1;
|
107 |
+
box-shadow: none;
|
108 |
+
}
|
109 |
+
&:focus,
|
110 |
+
&:active {
|
111 |
+
outline: none;
|
112 |
+
box-shadow: none;
|
113 |
+
color: $blue_color;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
@mixin link_icon_before( $icon ) {
|
118 |
+
&:before {
|
119 |
+
@include button_icon( $icon );
|
120 |
+
padding: 0 5px 0 0;
|
121 |
+
color: $grey_color_4;
|
122 |
+
}
|
123 |
+
&:hover {
|
124 |
+
&:before {
|
125 |
+
color: $blue_color;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
@mixin container() {
|
131 |
+
padding: 30px;
|
132 |
+
border: 2px solid $grey_color_2;
|
133 |
+
background: $grey_color_3;
|
134 |
+
border-radius: $border_radius_2x;
|
135 |
+
}
|
136 |
+
|
137 |
+
@mixin container_heading() {
|
138 |
+
margin: -30px -30px 30px -30px;
|
139 |
+
border-radius: $border_radius_2x $border_radius_2x 0 0;
|
140 |
+
border-bottom: 1px solid $grey_color_2;
|
141 |
+
padding: 20px 30px;
|
142 |
+
font-weight: bold;
|
143 |
+
font-size: 16px;
|
144 |
+
line-height: 18px;
|
145 |
+
text-align: center;
|
146 |
+
background: #fff;
|
147 |
+
}
|
148 |
+
|
149 |
+
@mixin box() {
|
150 |
+
margin: 0 0 30px;
|
151 |
+
padding: 20px;
|
152 |
+
background: #fff;
|
153 |
+
box-shadow: $box_shadow_box;
|
154 |
+
border-radius: $border_radius;
|
155 |
+
}
|
156 |
+
|
157 |
+
@mixin box_heading() {
|
158 |
+
margin: -20px -20px 20px -20px;
|
159 |
+
border-radius: $border_radius $border_radius 0 0;
|
160 |
+
border-bottom: 1px solid $grey_color_2;
|
161 |
+
padding: 20px 30px;
|
162 |
+
font-weight: bold;
|
163 |
+
font-size: 16px;
|
164 |
+
line-height: 18px;
|
165 |
+
background: #fff;
|
166 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius: 4px;
|
18 |
+
$border_radius_2x: 8px;
|
19 |
+
|
20 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
21 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-radio.js
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Radio
|
3 |
+
*/
|
4 |
+
( function( $, CherryJsCore ){
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace('ui_elements.radio');
|
8 |
+
CherryJsCore.ui_elements.radio = {
|
9 |
+
init: function () {
|
10 |
+
$( window ).on( 'cherry-ui-elements-init', this.render.bind( this ) );
|
11 |
+
},
|
12 |
+
render: function ( event, data ) {
|
13 |
+
var target = data.target;
|
14 |
+
|
15 |
+
$( '.cherry-radio-group', target ).each( function() {
|
16 |
+
$( '.cherry-radio-input[type="radio"]', this ).each( function() {
|
17 |
+
var $this = $(this),
|
18 |
+
this_slave = $this.data('slave');
|
19 |
+
|
20 |
+
if ( ! $this.is( ':checked' ) ) {
|
21 |
+
$( '.' + this_slave, target ).stop().hide();
|
22 |
+
}
|
23 |
+
} );
|
24 |
+
} );
|
25 |
+
|
26 |
+
$( '.cherry-radio-input[type="radio"]', target ).on( 'change', function() {
|
27 |
+
var $this = $(this),
|
28 |
+
slave = $this.data('slave'),
|
29 |
+
radio_group = $this.parents('.cherry-radio-group'),
|
30 |
+
radio_group_list = $('.cherry-radio-input[type="radio"]', radio_group);
|
31 |
+
|
32 |
+
$this.parents('.cherry-radio-group').find('.checked').removeClass('checked');
|
33 |
+
$this.parent().addClass('checked');
|
34 |
+
|
35 |
+
$('.' + slave, target).show();
|
36 |
+
radio_group_list.each(function(){
|
37 |
+
var $this = $(this),
|
38 |
+
this_slave = $this.data('slave');
|
39 |
+
|
40 |
+
if( this_slave !== slave ){
|
41 |
+
$('.' + this_slave, target).hide();
|
42 |
+
}
|
43 |
+
});
|
44 |
+
|
45 |
+
$this.trigger( 'radio_change_event', [slave, radio_group_list] );
|
46 |
+
});
|
47 |
+
}
|
48 |
+
};
|
49 |
+
|
50 |
+
CherryJsCore.ui_elements.radio.init();
|
51 |
+
|
52 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-radio.scss
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
input.cherry-radio-input{
|
12 |
+
display: none;
|
13 |
+
}
|
14 |
+
.cherry-radio-item{
|
15 |
+
margin-bottom: 10px;
|
16 |
+
&:last-child{
|
17 |
+
margin-bottom: 0;
|
18 |
+
}
|
19 |
+
label{
|
20 |
+
display: inline-block;
|
21 |
+
font-size: 14px;
|
22 |
+
line-height: 22px;
|
23 |
+
color: $dark_color_1;
|
24 |
+
}
|
25 |
+
span{
|
26 |
+
width: 25px;
|
27 |
+
height: 25px;
|
28 |
+
border-radius: 25px;
|
29 |
+
margin-right: 10px;
|
30 |
+
cursor: pointer;
|
31 |
+
position: relative;
|
32 |
+
background-color: $grey_color_3;
|
33 |
+
display: inline-block;
|
34 |
+
float: left;
|
35 |
+
i{
|
36 |
+
width: 13px;
|
37 |
+
height: 13px;
|
38 |
+
background-color: $blue_color;
|
39 |
+
margin: 6px;
|
40 |
+
border-radius: 20px;
|
41 |
+
display: inline-block;
|
42 |
+
transform: scale(0);
|
43 |
+
transition: all 0.3s cubic-bezier(.27,.63,.54,.96);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
.cherry-radio-item.checked{
|
48 |
+
span{
|
49 |
+
i{
|
50 |
+
transform: scale(1);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
.cherry-radio-img {
|
55 |
+
float: left;
|
56 |
+
margin: 10px 5px 0 5px;
|
57 |
+
text-align: center;
|
58 |
+
max-width: 80px;
|
59 |
+
position: relative;
|
60 |
+
label{
|
61 |
+
display: inline-block;
|
62 |
+
}
|
63 |
+
img {
|
64 |
+
width: 100%;
|
65 |
+
height: auto;
|
66 |
+
margin: 0 0 5px 0;
|
67 |
+
pointer-events: none;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
.cherry-radio-img.checked{
|
71 |
+
font-weight: bold;
|
72 |
+
.check{
|
73 |
+
display: block;
|
74 |
+
}
|
75 |
+
img{
|
76 |
+
box-shadow: 0 0 0 2px rgba(255, 254, 255, 1), 0 0 0 5px $blue_color;
|
77 |
+
}
|
78 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/ui-radio.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-radio elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Radio' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Radio elements.
|
22 |
+
*/
|
23 |
+
class UI_Radio extends UI_Element implements I_UI {
|
24 |
+
/**
|
25 |
+
* Default settings
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
private $defaults_settings = array(
|
30 |
+
'id' => 'cherry-ui-radio-id',
|
31 |
+
'name' => 'cherry-ui-radio-name',
|
32 |
+
'value' => 'radio-2',
|
33 |
+
'options' => array(
|
34 |
+
'radio-1' => array(
|
35 |
+
'label' => 'Radio 1',
|
36 |
+
'img_src' => '',
|
37 |
+
'slave' => '',
|
38 |
+
),
|
39 |
+
'radio-2' => array(
|
40 |
+
'label' => 'Radio 2',
|
41 |
+
'img_src' => '',
|
42 |
+
'slave' => '',
|
43 |
+
),
|
44 |
+
'radio-3' => array(
|
45 |
+
'label' => 'Radio 3',
|
46 |
+
'img_src' => '',
|
47 |
+
'slave' => '',
|
48 |
+
),
|
49 |
+
),
|
50 |
+
'slave' => array(),
|
51 |
+
'label' => '',
|
52 |
+
'class' => '',
|
53 |
+
'master' => '',
|
54 |
+
);
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Constructor method for the UI_Radio class.
|
58 |
+
*
|
59 |
+
* @since 4.0.0
|
60 |
+
*/
|
61 |
+
function __construct( $args = array() ) {
|
62 |
+
|
63 |
+
$this->defaults_settings['id'] = 'cherry-ui-radio-'.uniqid();
|
64 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
65 |
+
|
66 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
67 |
+
|
68 |
+
self::enqueue_assets();
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Render html UI_Radio.
|
73 |
+
*
|
74 |
+
* @since 4.0.0
|
75 |
+
*/
|
76 |
+
public function render() {
|
77 |
+
$html = '';
|
78 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
79 |
+
|
80 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
81 |
+
if ( $this->settings['options'] && ! empty( $this->settings['options'] ) && is_array( $this->settings['options'] ) ) {
|
82 |
+
if ( '' !== $this->settings['label'] ) {
|
83 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . $this->settings['label'] . '</label> ';
|
84 |
+
}
|
85 |
+
$html .= '<div class="cherry-radio-group">';
|
86 |
+
foreach ( $this->settings['options'] as $option => $option_value ) {
|
87 |
+
$checked = $option == $this->settings['value'] ? ' checked' : '';
|
88 |
+
$radio_id = $this->settings['id'] . '-' . $option;
|
89 |
+
$img = isset( $option_value['img_src'] ) && ! empty( $option_value['img_src'] ) ? '<img src="' . esc_url( $option_value['img_src'] ) . '" alt="' . esc_html( $option_value['label'] ) . '">' : '<span class="cherry-radio-item"><i></i></span>';
|
90 |
+
$data_slave = isset( $option_value['slave'] ) && ! empty( $option_value['slave'] ) ? ' data-slave="' . $option_value['slave'] . '"' : '';
|
91 |
+
$class_box = isset( $option_value['img_src'] ) && ! empty( $option_value['img_src'] ) ? ' cherry-radio-img' . $checked : ' cherry-radio-item' . $checked;
|
92 |
+
|
93 |
+
$html .= '<div class="' . $class_box . '">';
|
94 |
+
$html .= '<input type="radio" id="' . esc_attr( $radio_id ) . '" class="cherry-radio-input ' . sanitize_html_class( $this->settings['class'] ) . '" name="' . esc_attr( $this->settings['name'] ) . '" ' . checked( $option, $this->settings['value'], false ) . ' value="' . esc_attr( $option ) . '"' . $data_slave . '>';
|
95 |
+
$label_content = $img . $option_value['label'];
|
96 |
+
$html .= '<label for="' . esc_attr( $radio_id ) . '">' . $label_content . '</label> ';
|
97 |
+
$html .= '</div>';
|
98 |
+
}
|
99 |
+
$html .= '<div class="clear"></div>';
|
100 |
+
$html .= '</div>';
|
101 |
+
}
|
102 |
+
$html .= '</div>';
|
103 |
+
|
104 |
+
return $html;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Enqueue javascript and stylesheet UI_Radio
|
109 |
+
*
|
110 |
+
* @since 4.0.0
|
111 |
+
*/
|
112 |
+
public static function enqueue_assets() {
|
113 |
+
wp_enqueue_script(
|
114 |
+
'ui-radio-min',
|
115 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-radio.min.js', __FILE__ ) ),
|
116 |
+
array( 'jquery' ),
|
117 |
+
'1.0.0',
|
118 |
+
true
|
119 |
+
);
|
120 |
+
|
121 |
+
wp_enqueue_style(
|
122 |
+
'ui-radio-min',
|
123 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-radio.min.css', __FILE__ ) ),
|
124 |
+
array(),
|
125 |
+
'1.0.0',
|
126 |
+
'all'
|
127 |
+
);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/min/ui-repeater.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-ui-repeater-container label.cherry-label{margin:0 0 5px 0;display:block}.cherry-ui-repeater-add{display:inline-block;text-decoration:none;font-size:12px;line-height:20px;font-weight:bold;color:#298ffc;text-transform:uppercase;-webkit-transition:all 200ms linear;transition:all 200ms linear}.cherry-ui-repeater-add:hover{color:#23282d;box-shadow:none}.cherry-ui-repeater-add:focus,.cherry-ui-repeater-add:active{outline:none;box-shadow:none;color:#298ffc}.cherry-ui-repeater-add:before{content:"";display:inline-block;font-family:dashicons;font-size:16px;font-style:normal;font-weight:400;height:18px;line-height:18px;text-align:center;text-decoration:inherit;-webkit-transition:all 200ms linear;transition:all 200ms linear;vertical-align:middle;padding:0 5px 0 0;color:#b4b7ba}.cherry-ui-repeater-add:hover:before{color:#298ffc}.cherry-ui-repeater-item{padding:10px 10px 10px 30px;position:relative}.cherry-ui-repeater-remove{position:absolute;width:20px;height:20px;right:18px;top:13px;border-radius:50%;border:1px solid currentColor;color:red;font-size:18px;line-height:20px;text-align:center;cursor:pointer}.cherry-ui-repeater-remove:before{content:"\00D7"}.cherry-ui-repeater-remove:hover{color:black}.cherry-ui-kit.cherry-ui-repeater-container{padding:30px;border:2px solid #e5e5e5;background:#f1f1f1;border-radius:8px}.cherry-ui-kit>label.cherry-label{margin:-30px -30px 30px -30px;border-radius:8px 8px 0 0;border-bottom:1px solid #e5e5e5;padding:20px 30px;font-weight:bold;font-size:16px;line-height:18px;text-align:center;background:#fff}.cherry-ui-kit .cherry-ui-repeater-item{margin:0 0 30px;padding:20px;background:#fff;box-shadow:0 8px 21px rgba(0,0,0,0.1);border-radius:4px}.cherry-ui-kit .cherry-ui-repeater-actions-box{margin:-20px -20px 20px -20px;border-radius:4px 4px 0 0;border-bottom:1px solid #e5e5e5;padding:20px 30px;font-weight:bold;font-size:16px;line-height:18px;background:#fff;padding:15px 20px;cursor:move;position:relative;text-align:center;min-height:18px}.cherry-ui-kit .cherry-ui-repeater-toggle{position:absolute;color:#b4b7ba;width:20px;height:20px;font-size:22px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;text-decoration:none;box-shadow:none;outline:none;top:13px;left:18px}.cherry-ui-kit .cherry-ui-repeater-toggle:before{content:"\f142";-webkit-transition:all 200ms linear;transition:all 200ms linear;font-family:dashicons;vertical-align:middle}.cherry-ui-kit .cherry-ui-repeater-toggle:hover{color:#23282d}.cherry-ui-kit .cherry-ui-repeater-remove{position:absolute;border:none;color:#b4b7ba;font-size:20px;line-height:20px;width:20px;height:20px;text-align:center;vertical-align:middle;text-decoration:none;box-shadow:none;outline:none;top:13px;right:18px}.cherry-ui-kit .cherry-ui-repeater-remove:before{content:"\f158";-webkit-transition:all 200ms linear;transition:all 200ms linear;font-family:dashicons;vertical-align:middle}.cherry-ui-kit .cherry-ui-repeater-remove:hover{color:#23282d}.cherry-ui-kit .cherry-ui-repeater-title{width:70%;overflow:hidden;text-overflow:ellipsis;display:inline-block;font-size:14px}.cherry-ui-kit .cherry-ui-repeater-min{padding-bottom:0}.cherry-ui-kit .cherry-ui-repeater-min>.cheryr-ui-repeater-content-box{display:none}.cherry-ui-kit .cherry-ui-repeater-min>.cherry-ui-repeater-actions-box{margin-bottom:0;border-bottom:none;background:none}.cherry-ui-kit .cherry-ui-repeater-min>.cherry-ui-repeater-actions-box .cherry-ui-repeater-toggle:before{content:"\f140"}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/min/ui-repeater.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,t){"use strict";t.utilites.namespace("ui_elements.repeater"),t.ui_elements.repeater={repeaterContainerClass:".cherry-ui-repeater-container",repeaterListClass:".cherry-ui-repeater-list",repeaterItemClass:".cherry-ui-repeater-item",repeaterItemHandleClass:".cherry-ui-repeater-actions-box",repeaterTitleClass:".cherry-ui-repeater-title",addItemButtonClass:".cherry-ui-repeater-add",removeItemButtonClass:".cherry-ui-repeater-remove",toggleItemButtonClass:".cherry-ui-repeater-toggle",minItemClass:"cherry-ui-repeater-min",sortablePlaceholderClass:"sortable-placeholder",init:function(){e(document).on("ready",this.addEvents.bind(this))},addEvents:function(){e("body").on("click",this.addItemButtonClass,{self:this},this.addItem).on("click",this.removeItemButtonClass,{self:this},this.removeItem).on("click",this.toggleItemButtonClass,{self:this},this.toggleItem).on("change",this.repeaterListClass+" input, "+this.repeaterListClass+" textarea, "+this.repeaterListClass+" select",{self:this},this.changeWrapperLable).on("sortable-init",{self:this},this.sortableItem),e(window).on("cherry-ui-elements-init",{self:this},this.sortableItem),this.triggers()},triggers:function(t){return e("body").trigger("sortable-init"),t&&e(window).trigger("cherry-ui-elements-init",{target:t}),this},addItem:function(t){var s=t.data.self,a=e(this).prev(s.repeaterListClass),r=a.data("index"),i=a.data("name"),l=wp.template(i),n=a.data("widget-id"),o={index:r};n&&(o.widgetId=n),a.append(l(o)),r++,a.data("index",r),s.triggers(e(s.repeaterItemClass,a)).stopDefaultEvent(t)},removeItem:function(t){var s=t.data.self,a=e(this).closest(s.repeaterListClass);s.applyChanges(a),e(this).closest(s.repeaterItemClass).remove(),s.triggers().stopDefaultEvent(t)},toggleItem:function(t){var s=t.data.self,a=e(this).closest(s.repeaterItemClass);a.toggleClass(s.minItemClass),s.stopDefaultEvent(t)},sortableItem:function(t){var s,a,r=t.data.self,i=e(r.repeaterListClass);i.each(function(t,i){s=e(i),a=e(i).data("sortable-init"),s.sortable(a?"refresh":{items:r.repeaterItemClass,handle:r.repeaterItemHandleClass,cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,placeholder:r.sortablePlaceholderClass,create:function(){s.data("sortable-init",!0)},update:function(t){var s=e(t.target);r.applyChanges(s)}})})},changeWrapperLable:function(t){var s,a,r=t.data.self,i=e(r.repeaterListClass),l=i.data("title-field"),n=e(this);l&&n.closest("."+l+"-wrap")[0]&&(s=n.val(),a=n.closest(r.repeaterItemClass),e(r.repeaterTitleClass,a).html(s)),r.stopDefaultEvent(t)},applyChanges:function(t){return void 0!==wp.customize&&e("input[name]:first, select[name]:first",t).change(),this},stopDefaultEvent:function(e){return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),this}},t.ui_elements.repeater.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin button_icon( $icon ) {
|
61 |
+
content: $icon;
|
62 |
+
display: inline-block;
|
63 |
+
font-family: dashicons;
|
64 |
+
font-size: 16px;
|
65 |
+
font-style: normal;
|
66 |
+
font-weight: 400;
|
67 |
+
height: 18px;
|
68 |
+
line-height: 18px;
|
69 |
+
text-align: center;
|
70 |
+
text-decoration: inherit;
|
71 |
+
transition: all 200ms linear;
|
72 |
+
vertical-align: middle;
|
73 |
+
}
|
74 |
+
|
75 |
+
@mixin button_icon_before( $icon ) {
|
76 |
+
&:before {
|
77 |
+
@include button_icon( $icon );
|
78 |
+
padding: 0 5px 0 0;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
@mixin button_icon_after( $icon ) {
|
83 |
+
&:after {
|
84 |
+
@include button_icon( $icon );
|
85 |
+
padding: 0 0 0 5px;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
@mixin button_icon_middle( $icon ) {
|
90 |
+
&:before {
|
91 |
+
@include button_icon( $icon );
|
92 |
+
margin: 0 -5px;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
@mixin link() {
|
97 |
+
display: inline-block;
|
98 |
+
text-decoration: none;
|
99 |
+
font-size: 12px;
|
100 |
+
line-height: 20px;
|
101 |
+
font-weight: bold;
|
102 |
+
color: $blue_color;
|
103 |
+
text-transform: uppercase;
|
104 |
+
transition: all 200ms linear;
|
105 |
+
&:hover {
|
106 |
+
color: $dark_color_1;
|
107 |
+
box-shadow: none;
|
108 |
+
}
|
109 |
+
&:focus,
|
110 |
+
&:active {
|
111 |
+
outline: none;
|
112 |
+
box-shadow: none;
|
113 |
+
color: $blue_color;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
@mixin link_icon_before( $icon ) {
|
118 |
+
&:before {
|
119 |
+
@include button_icon( $icon );
|
120 |
+
padding: 0 5px 0 0;
|
121 |
+
color: $grey_color_4;
|
122 |
+
}
|
123 |
+
&:hover {
|
124 |
+
&:before {
|
125 |
+
color: $blue_color;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
@mixin container() {
|
131 |
+
padding: 30px;
|
132 |
+
border: 2px solid $grey_color_2;
|
133 |
+
background: $grey_color_3;
|
134 |
+
border-radius: $border_radius_2x;
|
135 |
+
}
|
136 |
+
|
137 |
+
@mixin container_heading() {
|
138 |
+
margin: -30px -30px 30px -30px;
|
139 |
+
border-radius: $border_radius_2x $border_radius_2x 0 0;
|
140 |
+
border-bottom: 1px solid $grey_color_2;
|
141 |
+
padding: 20px 30px;
|
142 |
+
font-weight: bold;
|
143 |
+
font-size: 16px;
|
144 |
+
line-height: 18px;
|
145 |
+
text-align: center;
|
146 |
+
background: #fff;
|
147 |
+
}
|
148 |
+
|
149 |
+
@mixin box() {
|
150 |
+
margin: 0 0 30px;
|
151 |
+
padding: 20px;
|
152 |
+
background: #fff;
|
153 |
+
box-shadow: $box_shadow_box;
|
154 |
+
border-radius: $border_radius;
|
155 |
+
}
|
156 |
+
|
157 |
+
@mixin box_heading() {
|
158 |
+
margin: -20px -20px 20px -20px;
|
159 |
+
border-radius: $border_radius $border_radius 0 0;
|
160 |
+
border-bottom: 1px solid $grey_color_2;
|
161 |
+
padding: 20px 30px;
|
162 |
+
font-weight: bold;
|
163 |
+
font-size: 16px;
|
164 |
+
line-height: 18px;
|
165 |
+
background: #fff;
|
166 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius: 4px;
|
18 |
+
$border_radius_2x: 8px;
|
19 |
+
|
20 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
21 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-repeater.js
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Repeater
|
3 |
+
*/
|
4 |
+
(function( $, CherryJsCore ) {
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace( 'ui_elements.repeater' );
|
8 |
+
|
9 |
+
CherryJsCore.ui_elements.repeater = {
|
10 |
+
|
11 |
+
repeaterContainerClass: '.cherry-ui-repeater-container',
|
12 |
+
repeaterListClass: '.cherry-ui-repeater-list',
|
13 |
+
repeaterItemClass: '.cherry-ui-repeater-item',
|
14 |
+
repeaterItemHandleClass: '.cherry-ui-repeater-actions-box',
|
15 |
+
repeaterTitleClass: '.cherry-ui-repeater-title',
|
16 |
+
|
17 |
+
addItemButtonClass: '.cherry-ui-repeater-add',
|
18 |
+
removeItemButtonClass: '.cherry-ui-repeater-remove',
|
19 |
+
toggleItemButtonClass: '.cherry-ui-repeater-toggle',
|
20 |
+
|
21 |
+
minItemClass: 'cherry-ui-repeater-min',
|
22 |
+
sortablePlaceholderClass: 'sortable-placeholder',
|
23 |
+
|
24 |
+
init: function() {
|
25 |
+
$( document ).on( 'ready', this.addEvents.bind( this ) );
|
26 |
+
},
|
27 |
+
|
28 |
+
addEvents: function() {
|
29 |
+
$( 'body' )
|
30 |
+
|
31 |
+
// Delegate events
|
32 |
+
.on( 'click', this.addItemButtonClass, { 'self': this }, this.addItem )
|
33 |
+
.on( 'click', this.removeItemButtonClass, { 'self': this }, this.removeItem )
|
34 |
+
.on( 'click', this.toggleItemButtonClass, { 'self': this }, this.toggleItem )
|
35 |
+
.on( 'change', this.repeaterListClass + ' input, ' + this.repeaterListClass + ' textarea, ' + this.repeaterListClass + ' select', { 'self': this }, this.changeWrapperLable )
|
36 |
+
|
37 |
+
// Custom events
|
38 |
+
.on( 'sortable-init', { 'self': this }, this.sortableItem );
|
39 |
+
|
40 |
+
$( window )
|
41 |
+
.on( 'cherry-ui-elements-init', { 'self': this }, this.sortableItem );
|
42 |
+
|
43 |
+
this.triggers();
|
44 |
+
},
|
45 |
+
|
46 |
+
triggers: function( $target ) {
|
47 |
+
$( 'body' ).trigger( 'sortable-init' );
|
48 |
+
|
49 |
+
if ( $target ) {
|
50 |
+
$( window ).trigger( 'cherry-ui-elements-init', { 'target': $target } );
|
51 |
+
}
|
52 |
+
|
53 |
+
return this;
|
54 |
+
},
|
55 |
+
|
56 |
+
addItem: function( event ) {
|
57 |
+
var self = event.data.self,
|
58 |
+
$list = $( this ).prev( self.repeaterListClass ),
|
59 |
+
index = $list.data( 'index' ),
|
60 |
+
tmplName = $list.data( 'name' ),
|
61 |
+
rowTemplate = wp.template( tmplName ),
|
62 |
+
widgetId = $list.data( 'widget-id' ),
|
63 |
+
data = { index: index };
|
64 |
+
|
65 |
+
if ( widgetId ) {
|
66 |
+
data.widgetId = widgetId;
|
67 |
+
}
|
68 |
+
|
69 |
+
$list.append( rowTemplate( data ) );
|
70 |
+
|
71 |
+
index++;
|
72 |
+
$list.data( 'index', index );
|
73 |
+
|
74 |
+
self
|
75 |
+
.triggers( $( self.repeaterItemClass, $list ) )
|
76 |
+
.stopDefaultEvent( event );
|
77 |
+
},
|
78 |
+
|
79 |
+
removeItem: function( event ) {
|
80 |
+
var self = event.data.self,
|
81 |
+
$list = $( this ).closest( self.repeaterListClass );
|
82 |
+
|
83 |
+
self.applyChanges( $list );
|
84 |
+
|
85 |
+
$( this ).closest( self.repeaterItemClass ).remove();
|
86 |
+
|
87 |
+
self
|
88 |
+
.triggers()
|
89 |
+
.stopDefaultEvent( event );
|
90 |
+
},
|
91 |
+
|
92 |
+
toggleItem: function( event ) {
|
93 |
+
var self = event.data.self,
|
94 |
+
$container = $( this ).closest( self.repeaterItemClass );
|
95 |
+
|
96 |
+
$container.toggleClass( self.minItemClass );
|
97 |
+
|
98 |
+
self.stopDefaultEvent( event );
|
99 |
+
},
|
100 |
+
|
101 |
+
sortableItem: function( event ) {
|
102 |
+
var self = event.data.self,
|
103 |
+
$list = $( self.repeaterListClass ),
|
104 |
+
$this,
|
105 |
+
initFlag;
|
106 |
+
|
107 |
+
$list.each( function( indx, element ) {
|
108 |
+
$this = $( element );
|
109 |
+
initFlag = $( element ).data( 'sortable-init' );
|
110 |
+
|
111 |
+
if ( ! initFlag ) {
|
112 |
+
$this.sortable( {
|
113 |
+
items: self.repeaterItemClass,
|
114 |
+
handle: self.repeaterItemHandleClass,
|
115 |
+
cursor: 'move',
|
116 |
+
scrollSensitivity: 40,
|
117 |
+
forcePlaceholderSize: true,
|
118 |
+
forceHelperSize: false,
|
119 |
+
helper: 'clone',
|
120 |
+
opacity: 0.65,
|
121 |
+
placeholder: self.sortablePlaceholderClass,
|
122 |
+
create: function() {
|
123 |
+
$this.data( 'sortable-init', true );
|
124 |
+
},
|
125 |
+
update: function( event ) {
|
126 |
+
var target = $( event.target );
|
127 |
+
|
128 |
+
self.applyChanges( target );
|
129 |
+
}
|
130 |
+
} );
|
131 |
+
} else {
|
132 |
+
$this.sortable( 'refresh' );
|
133 |
+
}
|
134 |
+
} );
|
135 |
+
},
|
136 |
+
|
137 |
+
changeWrapperLable: function( event ) {
|
138 |
+
var self = event.data.self,
|
139 |
+
$list = $( self.repeaterListClass ),
|
140 |
+
titleFilds = $list.data( 'title-field' ),
|
141 |
+
$this = $( this ),
|
142 |
+
value,
|
143 |
+
parentItem;
|
144 |
+
|
145 |
+
if ( titleFilds && $this.closest( '.' + titleFilds + '-wrap' )[0] ) {
|
146 |
+
value = $this.val(),
|
147 |
+
parentItem = $this.closest( self.repeaterItemClass );
|
148 |
+
|
149 |
+
$( self.repeaterTitleClass, parentItem ).html( value );
|
150 |
+
}
|
151 |
+
|
152 |
+
self.stopDefaultEvent( event );
|
153 |
+
},
|
154 |
+
|
155 |
+
applyChanges: function( target ) {
|
156 |
+
if ( undefined !== wp.customize ) {
|
157 |
+
$( 'input[name]:first, select[name]:first', target ).change();
|
158 |
+
}
|
159 |
+
|
160 |
+
return this;
|
161 |
+
},
|
162 |
+
|
163 |
+
stopDefaultEvent: function( event ) {
|
164 |
+
event.preventDefault();
|
165 |
+
event.stopImmediatePropagation();
|
166 |
+
event.stopPropagation();
|
167 |
+
|
168 |
+
return this;
|
169 |
+
}
|
170 |
+
};
|
171 |
+
|
172 |
+
CherryJsCore.ui_elements.repeater.init();
|
173 |
+
|
174 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-repeater.scss
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-repeater-container {
|
5 |
+
label.cherry-label{
|
6 |
+
margin: 0 0 5px 0;
|
7 |
+
display: block;
|
8 |
+
}
|
9 |
+
}
|
10 |
+
|
11 |
+
.cherry-ui-repeater {
|
12 |
+
&-add {
|
13 |
+
@include link();
|
14 |
+
@include link_icon_before( '\f132' );
|
15 |
+
}
|
16 |
+
&-item {
|
17 |
+
padding: 10px 10px 10px 30px;
|
18 |
+
position: relative;
|
19 |
+
}
|
20 |
+
&-remove {
|
21 |
+
position: absolute;
|
22 |
+
width: 20px;
|
23 |
+
height: 20px;
|
24 |
+
right: 18px;
|
25 |
+
top: 13px;
|
26 |
+
border-radius: 50%;
|
27 |
+
border: 1px solid currentColor;
|
28 |
+
color: red;
|
29 |
+
font-size: 18px;
|
30 |
+
line-height: 20px;
|
31 |
+
text-align: center;
|
32 |
+
cursor: pointer;
|
33 |
+
&:before {
|
34 |
+
content: "\00D7";
|
35 |
+
}
|
36 |
+
&:hover {
|
37 |
+
color: black;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
.cherry-ui-kit {
|
44 |
+
&.cherry-ui-repeater-container {
|
45 |
+
@include container();
|
46 |
+
}
|
47 |
+
> label.cherry-label {
|
48 |
+
@include container_heading();
|
49 |
+
}
|
50 |
+
.cherry-ui-repeater {
|
51 |
+
&-item {
|
52 |
+
@include box();
|
53 |
+
}
|
54 |
+
&-actions-box {
|
55 |
+
@include box_heading();
|
56 |
+
padding: 15px 20px;
|
57 |
+
cursor: move;
|
58 |
+
position: relative;
|
59 |
+
text-align: center;
|
60 |
+
min-height: 18px;
|
61 |
+
}
|
62 |
+
&-toggle {
|
63 |
+
position: absolute;
|
64 |
+
color: $grey_color_4;
|
65 |
+
width: 20px;
|
66 |
+
height: 20px;
|
67 |
+
font-size: 22px;
|
68 |
+
line-height: 20px;
|
69 |
+
text-align: center;
|
70 |
+
vertical-align: middle;
|
71 |
+
cursor: pointer;
|
72 |
+
text-decoration: none;
|
73 |
+
box-shadow: none;
|
74 |
+
outline: none;
|
75 |
+
top: 13px;
|
76 |
+
left: 18px;
|
77 |
+
&:before {
|
78 |
+
content: "\f142";
|
79 |
+
transition: all 200ms linear;
|
80 |
+
font-family: dashicons;
|
81 |
+
vertical-align: middle;
|
82 |
+
}
|
83 |
+
&:hover {
|
84 |
+
color: $dark_color_1;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
&-remove {
|
88 |
+
position: absolute;
|
89 |
+
border: none;
|
90 |
+
color: $grey_color_4;
|
91 |
+
font-size: 20px;
|
92 |
+
line-height: 20px;
|
93 |
+
width: 20px;
|
94 |
+
height: 20px;
|
95 |
+
text-align: center;
|
96 |
+
vertical-align: middle;
|
97 |
+
text-decoration: none;
|
98 |
+
box-shadow: none;
|
99 |
+
outline: none;
|
100 |
+
top: 13px;
|
101 |
+
right: 18px;
|
102 |
+
&:before {
|
103 |
+
content: "\f158";
|
104 |
+
transition: all 200ms linear;
|
105 |
+
font-family: dashicons;
|
106 |
+
vertical-align: middle;
|
107 |
+
}
|
108 |
+
&:hover {
|
109 |
+
color: $dark_color_1;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
&-title{
|
113 |
+
width: 70%;
|
114 |
+
overflow: hidden;
|
115 |
+
text-overflow: ellipsis;
|
116 |
+
display: inline-block;
|
117 |
+
font-size: 14px;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
.cherry-ui-repeater-min {
|
122 |
+
padding-bottom: 0;
|
123 |
+
> .cheryr-ui-repeater-content-box {
|
124 |
+
display: none;
|
125 |
+
}
|
126 |
+
> .cherry-ui-repeater-actions-box {
|
127 |
+
margin-bottom: 0;
|
128 |
+
border-bottom: none;
|
129 |
+
background: none;
|
130 |
+
.cherry-ui-repeater-toggle {
|
131 |
+
&:before {
|
132 |
+
content: "\f140";
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/ui-repeater.php
ADDED
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-repeater elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Repeater' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building ui-repeater elements.
|
22 |
+
*/
|
23 |
+
class UI_Repeater extends UI_Element implements I_UI {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Default settings
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
private $defaults_settings = array(
|
31 |
+
'type' => 'repeater',
|
32 |
+
'id' => 'cherry-ui-repeater-id',
|
33 |
+
'name' => 'cherry-ui-repeater-name',
|
34 |
+
'value' => array(),
|
35 |
+
'fields' => array(),
|
36 |
+
'label' => '',
|
37 |
+
'add_label' => 'Add Item',
|
38 |
+
'class' => '',
|
39 |
+
'master' => '',
|
40 |
+
'ui_kit' => true,
|
41 |
+
'required' => false,
|
42 |
+
'title_field' => '',
|
43 |
+
);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Stored data to process it while renderinr row
|
47 |
+
*
|
48 |
+
* @var array
|
49 |
+
*/
|
50 |
+
public $data = array();
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Repeater instances counter
|
54 |
+
*
|
55 |
+
* @var integer
|
56 |
+
*/
|
57 |
+
public static $instance_id = 0;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Current onstance TMPL name
|
61 |
+
*
|
62 |
+
* @var string
|
63 |
+
*/
|
64 |
+
public $tmpl_name = '';
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Holder for templates to print it in bottom of customizer page
|
68 |
+
*
|
69 |
+
* @var string
|
70 |
+
*/
|
71 |
+
public static $customizer_tmpl_to_print = null;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Is tmpl scripts already printed in customizer
|
75 |
+
*
|
76 |
+
* @var boolean
|
77 |
+
*/
|
78 |
+
public static $customizer_tmpl_printed = false;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Constructor method for the UI_Text class.
|
82 |
+
*
|
83 |
+
* @since 1.0.0
|
84 |
+
*/
|
85 |
+
function __construct( $args = array() ) {
|
86 |
+
|
87 |
+
$this->defaults_settings['id'] = 'cherry-ui-input-text-' . uniqid();
|
88 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
89 |
+
|
90 |
+
$this->set_tmpl_data();
|
91 |
+
|
92 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
93 |
+
add_action( 'admin_footer', array( $this, 'print_js_template' ), 0 );
|
94 |
+
|
95 |
+
add_action( 'customize_controls_print_footer_scripts', array( $this, 'fix_customizer_tmpl' ), 9999 );
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get required attribute
|
101 |
+
*
|
102 |
+
* @return string required attribute
|
103 |
+
*/
|
104 |
+
public function get_required() {
|
105 |
+
if ( $this->settings['required'] ) {
|
106 |
+
return 'required="required"';
|
107 |
+
}
|
108 |
+
return '';
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Render html UI_Repeater.
|
113 |
+
*
|
114 |
+
* @since 1.0.1
|
115 |
+
*/
|
116 |
+
public function render() {
|
117 |
+
|
118 |
+
$html = '';
|
119 |
+
|
120 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
121 |
+
|
122 |
+
$ui_kit = ! empty( $this->settings['ui_kit'] ) ? 'cherry-ui-kit' : '';
|
123 |
+
|
124 |
+
$html .= sprintf( '<div class="cherry-ui-repeater-container cherry-ui-container %1$s %2$s">',
|
125 |
+
$ui_kit,
|
126 |
+
$master_class
|
127 |
+
);
|
128 |
+
if ( '' !== $this->settings['label'] ) {
|
129 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
130 |
+
}
|
131 |
+
|
132 |
+
$html .= sprintf(
|
133 |
+
'<div class="cherry-ui-repeater-list" data-name="%1$s" data-index="%2$s" data-widget-id="__i__" %3$s id="%4$s">',
|
134 |
+
$this->get_tmpl_name(),
|
135 |
+
( ! empty( $this->settings['value'] ) ) ? count( $this->settings['value'] ) : 0,
|
136 |
+
( ! empty( $this->settings['title_field'] ) ) ? 'data-title-field="' . $this->settings['title_field'] . '"': '',
|
137 |
+
esc_attr( $this->settings['id'] )
|
138 |
+
);
|
139 |
+
|
140 |
+
if ( is_array( $this->settings['value'] ) ) {
|
141 |
+
$index = 0;
|
142 |
+
foreach ( $this->settings['value'] as $data ) {
|
143 |
+
$html .= $this->render_row( $index, false, $data );
|
144 |
+
$index++;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
$html .= '</div>';
|
148 |
+
$html .= sprintf(
|
149 |
+
'<a href="#" class="cherry-ui-repeater-add">%1$s</a>',
|
150 |
+
esc_html( $this->settings['add_label'] )
|
151 |
+
);
|
152 |
+
$html .= '</div>';
|
153 |
+
return $html;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Render single row for repeater
|
158 |
+
*
|
159 |
+
* @param string $index Current row index.
|
160 |
+
* @param number $widget_index It contains widget index.
|
161 |
+
* @param array $data Values to paste.
|
162 |
+
* @since 1.0.1
|
163 |
+
*/
|
164 |
+
public function render_row( $index, $widget_index, $data ) {
|
165 |
+
$this->data = $data;
|
166 |
+
|
167 |
+
$html = '<div class="cherry-ui-repeater-item" >';
|
168 |
+
$html .= '<div class="cherry-ui-repeater-actions-box">';
|
169 |
+
|
170 |
+
$html .= '<a href="#" class="cherry-ui-repeater-remove"></a>';
|
171 |
+
$html .= '<span class="cherry-ui-repeater-title">' . $this->get_row_title() . '</span>';
|
172 |
+
$html .= '<a href="#" class="cherry-ui-repeater-toggle"></a>';
|
173 |
+
|
174 |
+
$html .= '</div>';
|
175 |
+
$html .= '<div class="cheryr-ui-repeater-content-box">';
|
176 |
+
foreach ( $this->settings['fields'] as $field ) {
|
177 |
+
$html .= '<div class="' . $field['id'] . '-wrap">';
|
178 |
+
$html .= $this->render_field( $index, $widget_index, $field );
|
179 |
+
$html .= '</div>';
|
180 |
+
}
|
181 |
+
$html .= '</div>';
|
182 |
+
$html .= '</div>';
|
183 |
+
|
184 |
+
$this->data = array();
|
185 |
+
|
186 |
+
return $html;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Get repeater item title
|
191 |
+
*
|
192 |
+
* @return string
|
193 |
+
* @since 1.0.1
|
194 |
+
*/
|
195 |
+
public function get_row_title() {
|
196 |
+
|
197 |
+
if ( empty( $this->settings['title_field'] ) ) {
|
198 |
+
return '';
|
199 |
+
}
|
200 |
+
|
201 |
+
if ( ! empty( $this->data[ $this->settings['title_field'] ] ) ) {
|
202 |
+
return $this->data[ $this->settings['title_field'] ];
|
203 |
+
}
|
204 |
+
|
205 |
+
return '';
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Render single repeater field
|
210 |
+
*
|
211 |
+
* @param string $index Current row index.
|
212 |
+
* @param number $widget_index It contains widget index.
|
213 |
+
* @param array $field Values to paste.
|
214 |
+
* @return string
|
215 |
+
*/
|
216 |
+
public function render_field( $index, $widget_index, $field ) {
|
217 |
+
|
218 |
+
if ( empty( $field['type'] ) || empty( $field['name'] ) ) {
|
219 |
+
return '"type" and "name" are required fields for UI_Repeater items';
|
220 |
+
}
|
221 |
+
|
222 |
+
$field = wp_parse_args( $field, array( 'value' => '' ) );
|
223 |
+
$parent_name = str_replace( '__i__', $widget_index, $this->settings['name'] );
|
224 |
+
|
225 |
+
$field['id'] = sprintf( '%s-%s', $field['id'], $index );
|
226 |
+
$field['value'] = isset( $this->data[ $field['name'] ] ) ? $this->data[ $field['name'] ] : $field['value'];
|
227 |
+
$field['name'] = sprintf( '%1$s[item-%2$s][%3$s]', $parent_name, $index, $field['name'] );
|
228 |
+
|
229 |
+
$ui_class_name = 'UI_' . ucwords( $field['type'] );
|
230 |
+
|
231 |
+
if ( ! class_exists( $ui_class_name ) ) {
|
232 |
+
return '<p>Class <b>' . $ui_class_name . '</b> not exist!</p>';
|
233 |
+
}
|
234 |
+
|
235 |
+
$ui_item = new $ui_class_name( $field );
|
236 |
+
|
237 |
+
return $ui_item->render();
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Enqueue javascript and stylesheet UI_Text
|
242 |
+
*
|
243 |
+
* @since 1.0.0
|
244 |
+
*/
|
245 |
+
public static function enqueue_assets() {
|
246 |
+
|
247 |
+
wp_enqueue_style(
|
248 |
+
'ui-repeater',
|
249 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-repeater.min.css', __FILE__ ) ),
|
250 |
+
array(),
|
251 |
+
'1.0.0',
|
252 |
+
'all'
|
253 |
+
);
|
254 |
+
|
255 |
+
wp_enqueue_script(
|
256 |
+
'ui-repeater',
|
257 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-repeater.min.js', __FILE__ ) ),
|
258 |
+
array( 'wp-util', 'jquery-ui-sortable' ),
|
259 |
+
'1.0.0',
|
260 |
+
true
|
261 |
+
);
|
262 |
+
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Get TMPL name for current repeater instance.
|
267 |
+
*
|
268 |
+
* @return string
|
269 |
+
*/
|
270 |
+
public function get_tmpl_name() {
|
271 |
+
return $this->tmpl_name;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Set current repeater instance ID
|
276 |
+
*
|
277 |
+
* @return void
|
278 |
+
*/
|
279 |
+
public function set_tmpl_data() {
|
280 |
+
self::$instance_id++;
|
281 |
+
$this->tmpl_name = sprintf( 'repeater-template-%s', self::$instance_id );
|
282 |
+
|
283 |
+
global $wp_customize;
|
284 |
+
if ( isset( $wp_customize ) ) {
|
285 |
+
self::$customizer_tmpl_to_print .= $this->get_js_template();
|
286 |
+
}
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Print JS template for current repeater instance
|
292 |
+
*
|
293 |
+
* @return void
|
294 |
+
*/
|
295 |
+
public function print_js_template() {
|
296 |
+
echo $this->get_js_template();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Get JS template to print
|
301 |
+
*
|
302 |
+
* @return string
|
303 |
+
*/
|
304 |
+
public function get_js_template() {
|
305 |
+
|
306 |
+
return sprintf(
|
307 |
+
'<script type="text/html" id="tmpl-%1$s">%2$s</script>',
|
308 |
+
$this->get_tmpl_name(),
|
309 |
+
$this->render_row( '{{{data.index}}}', '{{{data.widgetId}}}', array() )
|
310 |
+
);
|
311 |
+
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Outputs JS templates on customizer page
|
316 |
+
*
|
317 |
+
* @return void
|
318 |
+
*/
|
319 |
+
public function fix_customizer_tmpl() {
|
320 |
+
if ( true === self::$customizer_tmpl_printed ) {
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
self::$customizer_tmpl_printed = true;
|
324 |
+
echo self::$customizer_tmpl_to_print;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/select2.min.css
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}
|
2 |
+
.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}
|
3 |
+
.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
4 |
+
.select2-container .select2-selection--single .select2-selection__clear{position:relative}
|
5 |
+
.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}
|
6 |
+
.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}
|
7 |
+
.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}
|
8 |
+
.select2-container .select2-search--inline{float:left}
|
9 |
+
.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}
|
10 |
+
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}
|
11 |
+
.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}
|
12 |
+
.select2-results{display:block}
|
13 |
+
.select2-results__options{list-style:none;margin:0;padding:0}
|
14 |
+
.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}
|
15 |
+
.select2-results__option[aria-selected]{cursor:pointer}
|
16 |
+
.select2-container--open .select2-dropdown{left:0}
|
17 |
+
.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}
|
18 |
+
.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}
|
19 |
+
.select2-search--dropdown{display:block;padding:4px}
|
20 |
+
.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}
|
21 |
+
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}
|
22 |
+
.select2-search--dropdown.select2-search--hide{display:none}
|
23 |
+
.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}
|
24 |
+
.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}
|
25 |
+
.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}
|
26 |
+
.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}
|
27 |
+
.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}
|
28 |
+
.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}
|
29 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}
|
30 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}
|
31 |
+
.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}
|
32 |
+
.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}
|
33 |
+
.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}
|
34 |
+
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}
|
35 |
+
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}
|
36 |
+
.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}
|
37 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}
|
38 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}
|
39 |
+
.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}
|
40 |
+
.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}
|
41 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}
|
42 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}
|
43 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}
|
44 |
+
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}
|
45 |
+
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}
|
46 |
+
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}
|
47 |
+
.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid #000 1px;outline:0}
|
48 |
+
.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}
|
49 |
+
.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}
|
50 |
+
.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}
|
51 |
+
.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}
|
52 |
+
.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}
|
53 |
+
.select2-container--default .select2-search--inline .select2-search__field{background:0 0;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}
|
54 |
+
.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}
|
55 |
+
.select2-container--default .select2-results__option[role=group]{padding:0}
|
56 |
+
.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}
|
57 |
+
.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}
|
58 |
+
.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}
|
59 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}
|
60 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}
|
61 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}
|
62 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}
|
63 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}
|
64 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}
|
65 |
+
.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}
|
66 |
+
.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}
|
67 |
+
.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top,#fff 50%,#eee 100%);background-image:-o-linear-gradient(top,#fff 50%,#eee 100%);background-image:linear-gradient(to bottom,#fff 50%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}
|
68 |
+
.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}
|
69 |
+
.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}
|
70 |
+
.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}
|
71 |
+
.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}
|
72 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top,#eee 50%,#ccc 100%);background-image:-o-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(to bottom,#eee 50%,#ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}
|
73 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}
|
74 |
+
.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}
|
75 |
+
.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}
|
76 |
+
.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}
|
77 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:0 0;border:none}
|
78 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}
|
79 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top,#fff 0,#eee 50%);background-image:-o-linear-gradient(top,#fff 0,#eee 50%);background-image:linear-gradient(to bottom,#fff 0,#eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}
|
80 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top,#eee 50%,#fff 100%);background-image:-o-linear-gradient(top,#eee 50%,#fff 100%);background-image:linear-gradient(to bottom,#eee 50%,#fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}
|
81 |
+
.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}
|
82 |
+
.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}
|
83 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}
|
84 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}
|
85 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}
|
86 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}
|
87 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}
|
88 |
+
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}
|
89 |
+
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}
|
90 |
+
.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}
|
91 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}
|
92 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}
|
93 |
+
.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}
|
94 |
+
.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}
|
95 |
+
.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}
|
96 |
+
.select2-container--classic .select2-dropdown--above{border-bottom:none}
|
97 |
+
.select2-container--classic .select2-dropdown--below{border-top:none}
|
98 |
+
.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}
|
99 |
+
.select2-container--classic .select2-results__option[role=group]{padding:0}
|
100 |
+
.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}
|
101 |
+
.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}
|
102 |
+
.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}
|
103 |
+
.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/select2.min.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){var t=function(){if(e&&e.fn&&e.fn.select2&&e.fn.select2.amd)var t=e.fn.select2.amd;var t;return function(){if(!t||!t.requirejs){t?n=t:t={};var e,n,r;!function(t){function i(e,t){return $.call(e,t)}function o(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e&&"."===e.charAt(0))if(t){for(e=e.split("/"),s=e.length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),e=h.slice(0,h.length-1).concat(e),u=0;u<e.length;u+=1)if(p=e[u],"."===p)e.splice(u,1),u-=1;else if(".."===p){if(1===u&&(".."===e[2]||".."===e[0]))break;u>0&&(e.splice(u-1,2),u-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((h||g)&&f){for(n=e.split("/"),u=n.length;u>0;u-=1){if(r=n.slice(0,u).join("/"),h)for(d=h.length;d>0;d-=1)if(i=f[h.slice(0,d).join("/")],i&&(i=i[r])){o=i,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],c=u)}!o&&l&&(o=l,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function s(e,n){return function(){var r=w.call(arguments,0);return"string"!=typeof r[0]&&1===r.length&&r.push(null),h.apply(t,r.concat([e,n]))}}function a(e){return function(t){return o(t,e)}}function l(e){return function(t){m[e]=t}}function c(e){if(i(v,e)){var n=v[e];delete v[e],_[e]=!0,p.apply(t,n)}if(!i(m,e)&&!i(_,e))throw new Error("No "+e);return m[e]}function u(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function d(e){return function(){return y&&y.config&&y.config[e]||{}}}var p,h,f,g,m={},v={},y={},_={},$=Object.prototype.hasOwnProperty,w=[].slice,b=/\.js$/;f=function(e,t){var n,r=u(e),i=r[0];return e=r[1],i&&(i=o(i,t),n=c(i)),i?e=n&&n.normalize?n.normalize(e,a(t)):o(e,t):(e=o(e,t),r=u(e),i=r[0],e=r[1],i&&(n=c(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},g={require:function(e){return s(e)},exports:function(e){var t=m[e];return"undefined"!=typeof t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:d(e)}}},p=function(e,n,r,o){var a,u,d,p,h,y,$=[],w=typeof r;if(o=o||e,"undefined"===w||"function"===w){for(n=!n.length&&r.length?["require","exports","module"]:n,h=0;h<n.length;h+=1)if(p=f(n[h],o),u=p.f,"require"===u)$[h]=g.require(e);else if("exports"===u)$[h]=g.exports(e),y=!0;else if("module"===u)a=$[h]=g.module(e);else if(i(m,u)||i(v,u)||i(_,u))$[h]=c(u);else{if(!p.p)throw new Error(e+" missing "+u);p.p.load(p.n,s(o,!0),l(u),{}),$[h]=m[u]}d=r?r.apply(m[e],$):void 0,e&&(a&&a.exports!==t&&a.exports!==m[e]?m[e]=a.exports:d===t&&y||(m[e]=d))}else e&&(m[e]=r)},e=n=h=function(e,n,r,i,o){if("string"==typeof e)return g[e]?g[e](n):c(f(e,n).f);if(!e.splice){if(y=e,y.deps&&h(y.deps,y.callback),!n)return;n.splice?(e=n,n=r,r=null):e=t}return n=n||function(){},"function"==typeof r&&(r=i,i=o),i?p(t,e,n,r):setTimeout(function(){p(t,e,n,r)},4),h},h.config=function(e){return h(e)},e._defined=m,r=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),i(m,e)||i(v,e)||(v[e]=[e,t,n])},r.amd={jQuery:!0}}(),t.requirejs=e,t.require=n,t.define=r}}(),t.define("almond",function(){}),t.define("jquery",[],function(){var t=e||$;return null==t&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),t}),t.define("select2/utils",["jquery"],function(e){function t(e){var t=e.prototype,n=[];for(var r in t){var i=t[r];"function"==typeof i&&"constructor"!==r&&n.push(r)}return n}var n={};n.Extend=function(e,t){function n(){this.constructor=e}var r={}.hasOwnProperty;for(var i in t)r.call(t,i)&&(e[i]=t[i]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},n.Decorate=function(e,n){function r(){var t=Array.prototype.unshift,r=n.prototype.constructor.length,i=e.prototype.constructor;r>0&&(t.call(arguments,e.prototype.constructor),i=n.prototype.constructor),i.apply(this,arguments)}function i(){this.constructor=r}var o=t(n),s=t(e);n.displayName=e.displayName,r.prototype=new i;for(var a=0;a<s.length;a++){var l=s[a];r.prototype[l]=e.prototype[l]}for(var c=(function(e){var t=function(){};e in r.prototype&&(t=r.prototype[e]);var i=n.prototype[e];return function(){var e=Array.prototype.unshift;return e.call(arguments,t),i.apply(this,arguments)}}),u=0;u<o.length;u++){var d=o[u];r.prototype[d]=c(d)}return r};var r=function(){this.listeners={}};return r.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},r.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),n[0]._type=e,e in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},r.prototype.invoke=function(e,t){for(var n=0,r=e.length;r>n;n++)e[n].apply(this,t)},n.Observable=r,n.generateChars=function(e){for(var t="",n=0;e>n;n++){var r=Math.floor(36*Math.random());t+=r.toString(36)}return t},n.bind=function(e,t){return function(){e.apply(t,arguments)}},n._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var i=0;i<n.length;i++){var o=n[i];o=o.substring(0,1).toLowerCase()+o.substring(1),o in r||(r[o]={}),i==n.length-1&&(r[o]=e[t]),r=r[o]}delete e[t]}}return e},n.hasScroll=function(t,n){var r=e(n),i=n.style.overflowX,o=n.style.overflowY;return i!==o||"hidden"!==o&&"visible"!==o?"scroll"===i||"scroll"===o?!0:r.innerHeight()<n.scrollHeight||r.innerWidth()<n.scrollWidth:!1},n.escapeMarkup=function(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},n.appendMany=function(t,n){if("1.7"===e.fn.jquery.substr(0,3)){var r=e();e.map(n,function(e){r=r.add(e)}),n=r}t.append(n)},n}),t.define("select2/results",["jquery","./utils"],function(e,t){function n(e,t,r){this.$element=e,this.data=r,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t,t},n.prototype.clear=function(){this.$results.empty()},n.prototype.displayMessage=function(t){var n=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var r=e('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),i=this.options.get("translations").get(t.message);r.append(n(i(t.args))),r[0].className+=" select2-results__message",this.$results.append(r)},n.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},n.prototype.append=function(e){this.hideLoading();var t=[];if(null==e.results||0===e.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],i=this.option(r);t.push(i)}this.$results.append(t)},n.prototype.position=function(e,t){var n=t.find(".select2-results");n.append(e)},n.prototype.sort=function(e){var t=this.options.get("sorter");return t(e)},n.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");t.length>0?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},n.prototype.setClasses=function(){var t=this;this.data.current(function(n){var r=e.map(n,function(e){return e.id.toString()}),i=t.$results.find(".select2-results__option[aria-selected]");i.each(function(){var t=e(this),n=e.data(this,"data"),i=""+n.id;null!=n.element&&n.element.selected||null==n.element&&e.inArray(i,r)>-1?t.attr("aria-selected","true"):t.attr("aria-selected","false")})})},n.prototype.showLoading=function(e){this.hideLoading();var t=this.options.get("translations").get("searching"),n={disabled:!0,loading:!0,text:t(e)},r=this.option(n);r.className+=" loading-results",this.$results.prepend(r)},n.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},n.prototype.option=function(t){var n=document.createElement("li");n.className="select2-results__option";var r={role:"treeitem","aria-selected":"false"};t.disabled&&(delete r["aria-selected"],r["aria-disabled"]="true"),null==t.id&&delete r["aria-selected"],null!=t._resultId&&(n.id=t._resultId),t.title&&(n.title=t.title),t.children&&(r.role="group",r["aria-label"]=t.text,delete r["aria-selected"]);for(var i in r){var o=r[i];n.setAttribute(i,o)}if(t.children){var s=e(n),a=document.createElement("strong");a.className="select2-results__group";{e(a)}this.template(t,a);for(var l=[],c=0;c<t.children.length;c++){var u=t.children[c],d=this.option(u);l.push(d)}var p=e("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(t,n);return e.data(n,"data",t),n},n.prototype.bind=function(t){var n=this,r=t.id+"-results";this.$results.attr("id",r),t.on("results:all",function(e){n.clear(),n.append(e.data),t.isOpen()&&(n.setClasses(),n.highlightFirstItem())}),t.on("results:append",function(e){n.append(e.data),t.isOpen()&&n.setClasses()}),t.on("query",function(e){n.hideMessages(),n.showLoading(e)}),t.on("select",function(){t.isOpen()&&(n.setClasses(),n.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(n.setClasses(),n.highlightFirstItem())}),t.on("open",function(){n.$results.attr("aria-expanded","true"),n.$results.attr("aria-hidden","false"),n.setClasses(),n.ensureHighlightVisible()}),t.on("close",function(){n.$results.attr("aria-expanded","false"),n.$results.attr("aria-hidden","true"),n.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=n.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=n.getHighlightedResults();if(0!==e.length){var t=e.data("data");"true"==e.attr("aria-selected")?n.trigger("close",{}):n.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=n.getHighlightedResults(),t=n.$results.find("[aria-selected]"),r=t.index(e);if(0!==r){var i=r-1;0===e.length&&(i=0);var o=t.eq(i);o.trigger("mouseenter");var s=n.$results.offset().top,a=o.offset().top,l=n.$results.scrollTop()+(a-s);0===i?n.$results.scrollTop(0):0>a-s&&n.$results.scrollTop(l)}}),t.on("results:next",function(){var e=n.getHighlightedResults(),t=n.$results.find("[aria-selected]"),r=t.index(e),i=r+1;if(!(i>=t.length)){var o=t.eq(i);o.trigger("mouseenter");var s=n.$results.offset().top+n.$results.outerHeight(!1),a=o.offset().top+o.outerHeight(!1),l=n.$results.scrollTop()+a-s;0===i?n.$results.scrollTop(0):a>s&&n.$results.scrollTop(l)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){n.displayMessage(e)}),e.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=n.$results.scrollTop(),r=n.$results.get(0).scrollHeight-t+e.deltaY,i=e.deltaY>0&&t-e.deltaY<=0,o=e.deltaY<0&&r<=n.$results.height();i?(n.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):o&&(n.$results.scrollTop(n.$results.get(0).scrollHeight-n.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(t){var r=e(this),i=r.data("data");return"true"===r.attr("aria-selected")?void(n.options.get("multiple")?n.trigger("unselect",{originalEvent:t,data:i}):n.trigger("close",{})):void n.trigger("select",{originalEvent:t,data:i})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(){var t=e(this).data("data");n.getHighlightedResults().removeClass("select2-results__option--highlighted"),n.trigger("results:focus",{data:t,element:e(this)})})},n.prototype.getHighlightedResults=function(){var e=this.$results.find(".select2-results__option--highlighted");return e},n.prototype.destroy=function(){this.$results.remove()},n.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]"),n=t.index(e),r=this.$results.offset().top,i=e.offset().top,o=this.$results.scrollTop()+(i-r),s=i-r;o-=2*e.outerHeight(!1),2>=n?this.$results.scrollTop(0):(s>this.$results.outerHeight()||0>s)&&this.$results.scrollTop(o)}},n.prototype.template=function(t,n){var r=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),o=r(t,n);null==o?n.style.display="none":"string"==typeof o?n.innerHTML=i(o):e(n).append(o)},n}),t.define("select2/keys",[],function(){var e={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return e}),t.define("select2/selection/base",["jquery","../utils","../keys"],function(e,t,n){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return t.Extend(r,t.Observable),r.prototype.render=function(){var t=e('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),t.attr("title",this.$element.attr("title")),t.attr("tabindex",this._tabindex),this.$selection=t,t},r.prototype.bind=function(e){var t=this,r=(e.id+"-container",e.id+"-results");this.container=e,this.$selection.on("focus",function(e){t.trigger("focus",e)}),this.$selection.on("blur",function(e){t._handleBlur(e)}),this.$selection.on("keydown",function(e){t.trigger("keypress",e),e.which===n.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){t.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){t.update(e.data)}),e.on("open",function(){t.$selection.attr("aria-expanded","true"),t.$selection.attr("aria-owns",r),t._attachCloseHandler(e)}),e.on("close",function(){t.$selection.attr("aria-expanded","false"),t.$selection.removeAttr("aria-activedescendant"),t.$selection.removeAttr("aria-owns"),t.$selection.focus(),t._detachCloseHandler(e)}),e.on("enable",function(){t.$selection.attr("tabindex",t._tabindex)}),e.on("disable",function(){t.$selection.attr("tabindex","-1")})},r.prototype._handleBlur=function(t){var n=this;window.setTimeout(function(){document.activeElement==n.$selection[0]||e.contains(n.$selection[0],document.activeElement)||n.trigger("blur",t)},1)},r.prototype._attachCloseHandler=function(t){e(document.body).on("mousedown.select2."+t.id,function(t){var n=e(t.target),r=n.closest(".select2"),i=e(".select2.select2-container--open");i.each(function(){var t=e(this);if(this!=r[0]){var n=t.data("element");n.select2("close")}})})},r.prototype._detachCloseHandler=function(t){e(document.body).off("mousedown.select2."+t.id)},r.prototype.position=function(e,t){var n=t.find(".selection");n.append(e)},r.prototype.destroy=function(){this._detachCloseHandler(this.container)},r.prototype.update=function(){throw new Error("The `update` method must be defined in child classes.")},r}),t.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n){function r(){r.__super__.constructor.apply(this,arguments)}return n.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},r.prototype.bind=function(e){var t=this;r.__super__.bind.apply(this,arguments);var n=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",n),this.$selection.attr("aria-labelledby",n),this.$selection.on("mousedown",function(e){1===e.which&&t.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(){}),this.$selection.on("blur",function(){}),e.on("focus",function(){e.isOpen()||t.$selection.focus()}),e.on("selection:update",function(e){t.update(e.data)})},r.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},r.prototype.display=function(e,t){var n=this.options.get("templateSelection"),r=this.options.get("escapeMarkup");return r(n(e,t))},r.prototype.selectionContainer=function(){return e("<span></span>")},r.prototype.update=function(e){if(0===e.length)return void this.clear();var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r),n.prop("title",t.title||t.text)},r}),t.define("select2/selection/multiple",["jquery","./base","../utils"],function(e,t,n){function r(){r.__super__.constructor.apply(this,arguments)}return n.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},r.prototype.bind=function(){var t=this;r.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){t.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(n){if(!t.options.get("disabled")){var r=e(this),i=r.parent(),o=i.data("data");t.trigger("unselect",{originalEvent:n,data:o})}})},r.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},r.prototype.display=function(e,t){var n=this.options.get("templateSelection"),r=this.options.get("escapeMarkup");return r(n(e,t))},r.prototype.selectionContainer=function(){var t=e('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>');return t},r.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],r=0;r<e.length;r++){var i=e[r],o=this.selectionContainer(),s=this.display(i,o);o.append(s),o.prop("title",i.title||i.text),o.data("data",i),t.push(o)}var a=this.$selection.find(".select2-selection__rendered");n.appendMany(a,t)}},r}),t.define("select2/selection/placeholder",["../utils"],function(){function e(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),n},e.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id,r=t.length>1;if(r||n)return e.call(this,t);this.clear();var i=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(i)},e}),t.define("select2/selection/allowClear",["jquery","../keys"],function(e,t){function n(){}return n.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(e){r._handleClear(e)}),t.on("keypress",function(e){r._handleKeyboardClear(e,t)})},n.prototype._handleClear=function(e,t){if(!this.options.get("disabled")){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();for(var r=n.data("data"),i=0;i<r.length;i++){var o={data:r[i]};if(this.trigger("unselect",o),o.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},n.prototype._handleKeyboardClear=function(e,n,r){r.isOpen()||(n.which==t.DELETE||n.which==t.BACKSPACE)&&this._handleClear(n)},n.prototype.update=function(t,n){if(t.call(this,n),!(this.$selection.find(".select2-selection__placeholder").length>0||0===n.length)){var r=e('<span class="select2-selection__clear">×</span>');r.data("data",n),this.$selection.find(".select2-selection__rendered").prepend(r)}},n}),t.define("select2/selection/search",["jquery","../utils","../keys"],function(e,t,n){function r(e,t,n){e.call(this,t,n)}return r.prototype.render=function(t){var n=e('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=n,this.$search=n.find("input");var r=t.call(this);return this._transferTabIndex(),r},r.prototype.bind=function(e,t,r){var i=this;e.call(this,t,r),t.on("open",function(){i.$search.trigger("focus")}),t.on("close",function(){i.$search.val(""),i.$search.removeAttr("aria-activedescendant"),i.$search.trigger("focus")}),t.on("enable",function(){i.$search.prop("disabled",!1),i._transferTabIndex()}),t.on("disable",function(){i.$search.prop("disabled",!0)}),t.on("focus",function(){i.$search.trigger("focus")}),t.on("results:focus",function(e){i.$search.attr("aria-activedescendant",e.id)}),this.$selection.on("focusin",".select2-search--inline",function(e){i.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){i._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){e.stopPropagation(),i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented();var t=e.which;if(t===n.BACKSPACE&&""===i.$search.val()){var r=i.$searchContainer.prev(".select2-selection__choice");if(r.length>0){var o=r.data("data");i.searchRemoveChoice(o),e.preventDefault()}}});var o=document.documentMode,s=o&&11>=o;this.$selection.on("input.searchcheck",".select2-search--inline",function(){return s?void i.$selection.off("input.search input.searchcheck"):void i.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(s&&"input"===e.type)return void i.$selection.off("input.search input.searchcheck");var t=e.which;t!=n.SHIFT&&t!=n.CTRL&&t!=n.ALT&&t!=n.TAB&&i.handleSearch(e)})},r.prototype._transferTabIndex=function(){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},r.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},r.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.focus()},r.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},r.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},r.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";if(""!==this.$search.attr("placeholder"))e="100%";else{var t=this.$search.val().length+1;e=.75*t+"em"}this.$search.css("width",e)},r}),t.define("select2/selection/eventRelay",["jquery"],function(e){function t(){}return t.prototype.bind=function(t,n,r){var i=this,o=["open","opening","close","closing","select","selecting","unselect","unselecting"],s=["opening","closing","selecting","unselecting"];t.call(this,n,r),n.on("*",function(t,n){if(-1!==e.inArray(t,o)){n=n||{};var r=e.Event("select2:"+t,{params:n});i.$element.trigger(r),-1!==e.inArray(t,s)&&(n.prevented=r.isDefaultPrevented())}})},t}),t.define("select2/translation",["jquery","require"],function(e,t){function n(e){this.dict=e||{}}return n.prototype.all=function(){return this.dict},n.prototype.get=function(e){return this.dict[e]},n.prototype.extend=function(t){this.dict=e.extend({},t.all(),this.dict)},n._cache={},n.loadPath=function(e){if(!(e in n._cache)){var r=t(e);n._cache[e]=r}return new n(n._cache[e])},n}),t.define("select2/diacritics",[],function(){var e={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return e}),t.define("select2/data/base",["../utils"],function(e){function t(){t.__super__.constructor.call(this)}return e.Extend(t,e.Observable),t.prototype.current=function(){throw new Error("The `current` method must be defined in child classes.")},t.prototype.query=function(){throw new Error("The `query` method must be defined in child classes.")},t.prototype.bind=function(){},t.prototype.destroy=function(){},t.prototype.generateResultId=function(t,n){var r=t.id+"-result-";return r+=e.generateChars(4),r+=null!=n.id?"-"+n.id.toString():"-"+e.generateChars(4)},t}),t.define("select2/data/select",["./base","../utils","jquery"],function(e,t,n){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return t.Extend(r,e),r.prototype.current=function(e){var t=[],r=this;this.$element.find(":selected").each(function(){var e=n(this),i=r.item(e);t.push(i)}),e(t)},r.prototype.select=function(e){var t=this;if(e.selected=!0,n(e.element).is("option"))return e.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(r){var i=[];e=[e],e.push.apply(e,r);
|
2 |
+
for(var o=0;o<e.length;o++){var s=e[o].id;-1===n.inArray(s,i)&&i.push(s)}t.$element.val(i),t.$element.trigger("change")});else{var r=e.id;this.$element.val(r),this.$element.trigger("change")}},r.prototype.unselect=function(e){var t=this;if(this.$element.prop("multiple"))return e.selected=!1,n(e.element).is("option")?(e.element.selected=!1,void this.$element.trigger("change")):void this.current(function(r){for(var i=[],o=0;o<r.length;o++){var s=r[o].id;s!==e.id&&-1===n.inArray(s,i)&&i.push(s)}t.$element.val(i),t.$element.trigger("change")})},r.prototype.bind=function(e){var t=this;this.container=e,e.on("select",function(e){t.select(e.data)}),e.on("unselect",function(e){t.unselect(e.data)})},r.prototype.destroy=function(){this.$element.find("*").each(function(){n.removeData(this,"data")})},r.prototype.query=function(e,t){var r=[],i=this,o=this.$element.children();o.each(function(){var t=n(this);if(t.is("option")||t.is("optgroup")){var o=i.item(t),s=i.matches(e,o);null!==s&&r.push(s)}}),t({results:r})},r.prototype.addOptions=function(e){t.appendMany(this.$element,e)},r.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup"),t.label=e.text):(t=document.createElement("option"),void 0!==t.textContent?t.textContent=e.text:t.innerText=e.text),e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var r=n(t),i=this._normalizeItem(e);return i.element=t,n.data(t,"data",i),r},r.prototype.item=function(e){var t={};if(t=n.data(e[0],"data"),null!=t)return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var r=e.children("option"),i=[],o=0;o<r.length;o++){var s=n(r[o]),a=this.item(s);i.push(a)}t.children=i}return t=this._normalizeItem(t),t.element=e[0],n.data(e[0],"data",t),t},r.prototype._normalizeItem=function(e){n.isPlainObject(e)||(e={id:e,text:e}),e=n.extend({},{text:""},e);var t={selected:!1,disabled:!1};return null!=e.id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),n.extend({},t,e)},r.prototype.matches=function(e,t){var n=this.options.get("matcher");return n(e,t)},r}),t.define("select2/data/array",["./select","../utils","jquery"],function(e,t,n){function r(e,t){var n=t.get("data")||[];r.__super__.constructor.call(this,e,t),this.addOptions(this.convertToOptions(n))}return t.Extend(r,e),r.prototype.select=function(e){var t=this.$element.find("option").filter(function(t,n){return n.value==e.id.toString()});0===t.length&&(t=this.option(e),this.addOptions(t)),r.__super__.select.call(this,e)},r.prototype.convertToOptions=function(e){function r(e){return function(){return n(this).val()==e.id}}for(var i=this,o=this.$element.find("option"),s=o.map(function(){return i.item(n(this)).id}).get(),a=[],l=0;l<e.length;l++){var c=this._normalizeItem(e[l]);if(n.inArray(c.id,s)>=0){var u=o.filter(r(c)),d=this.item(u),p=n.extend(!0,{},c,d),h=this.option(p);u.replaceWith(h)}else{var f=this.option(c);if(c.children){var g=this.convertToOptions(c.children);t.appendMany(f,g)}a.push(f)}}return a},r}),t.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,n){function r(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),r.__super__.constructor.call(this,e,t)}return t.Extend(r,e),r.prototype._applyDefaults=function(e){var t={data:function(e){return n.extend({},e,{q:e.term})},transport:function(e,t,r){var i=n.ajax(e);return i.then(t),i.fail(r),i}};return n.extend({},t,e,!0)},r.prototype.processResults=function(e){return e},r.prototype.query=function(e,t){function r(){var r=o.transport(o,function(r){var o=i.processResults(r,e);i.options.get("debug")&&window.console&&console.error&&(o&&o.results&&n.isArray(o.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),t(o)},function(){r.status&&"0"===r.status||i.trigger("results:message",{message:"errorLoading"})});i._request=r}var i=this;null!=this._request&&(n.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var o=n.extend({type:"GET"},this.ajaxOptions);"function"==typeof o.url&&(o.url=o.url.call(this.$element,e)),"function"==typeof o.data&&(o.data=o.data.call(this.$element,e)),this.ajaxOptions.delay&&null!=e.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(r,this.ajaxOptions.delay)):r()},r}),t.define("select2/data/tags",["jquery"],function(e){function t(t,n,r){var i=r.get("tags"),o=r.get("createTag");void 0!==o&&(this.createTag=o);var s=r.get("insertTag");if(void 0!==s&&(this.insertTag=s),t.call(this,n,r),e.isArray(i))for(var a=0;a<i.length;a++){var l=i[a],c=this._normalizeItem(l),u=this.option(c);this.$element.append(u)}}return t.prototype.query=function(e,t,n){function r(e,o){for(var s=e.results,a=0;a<s.length;a++){var l=s[a],c=null!=l.children&&!r({results:l.children},!0),u=l.text===t.term;if(u||c)return o?!1:(e.data=s,void n(e))}if(o)return!0;var d=i.createTag(t);if(null!=d){var p=i.option(d);p.attr("data-select2-tag",!0),i.addOptions([p]),i.insertTag(s,d)}e.results=s,n(e)}var i=this;return this._removeOldTags(),null==t.term||null!=t.page?void e.call(this,t,n):void e.call(this,t,r)},t.prototype.createTag=function(t,n){var r=e.trim(n.term);return""===r?null:{id:r,text:r}},t.prototype.insertTag=function(e,t,n){t.unshift(n)},t.prototype._removeOldTags=function(){var t=(this._lastTag,this.$element.find("option[data-select2-tag]"));t.each(function(){this.selected||e(this).remove()})},t}),t.define("select2/data/tokenizer",["jquery"],function(e){function t(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return t.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},t.prototype.query=function(t,n,r){function i(t){var n=s._normalizeItem(t),r=s.$element.find("option").filter(function(){return e(this).val()===n.id});if(!r.length){var i=s.option(n);i.attr("data-select2-tag",!0),s._removeOldTags(),s.addOptions([i])}o(n)}function o(e){s.trigger("select",{data:e})}var s=this;n.term=n.term||"";var a=this.tokenizer(n,this.options,i);a.term!==n.term&&(this.$search.length&&(this.$search.val(a.term),this.$search.focus()),n.term=a.term),t.call(this,n,r)},t.prototype.tokenizer=function(t,n,r,i){for(var o=r.get("tokenSeparators")||[],s=n.term,a=0,l=this.createTag||function(e){return{id:e.term,text:e.term}};a<s.length;){var c=s[a];if(-1!==e.inArray(c,o)){var u=s.substr(0,a),d=e.extend({},n,{term:u}),p=l(d);null!=p?(i(p),s=s.substr(a+1)||"",a=0):a++}else a++}return{term:s}},t}),t.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){return t.term=t.term||"",t.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):void e.call(this,t,n)},e}),t.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){return t.term=t.term||"",this.maximumInputLength>0&&t.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):void e.call(this,t,n)},e}),t.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){var r=this;this.current(function(i){var o=null!=i?i.length:0;return r.maximumSelectionLength>0&&o>=r.maximumSelectionLength?void r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):void e.call(r,t,n)})},e}),t.define("select2/dropdown",["jquery","./utils"],function(e,t){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<span class="select2-dropdown"><span class="select2-results"></span></span>');return t.attr("dir",this.options.get("dir")),this.$dropdown=t,t},n.prototype.bind=function(){},n.prototype.position=function(){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),t.define("select2/dropdown/search",["jquery","../utils"],function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),r=e('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=r,this.$search=r.find("input"),n.prepend(r),n},t.prototype.bind=function(t,n,r){var i=this;t.call(this,n,r),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(){e(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),n.on("open",function(){i.$search.attr("tabindex",0),i.$search.focus(),window.setTimeout(function(){i.$search.focus()},0)}),n.on("close",function(){i.$search.attr("tabindex",-1),i.$search.val("")}),n.on("focus",function(){n.isOpen()&&i.$search.focus()}),n.on("results:all",function(e){if(null==e.query.term||""===e.query.term){var t=i.showSearch(e);t?i.$searchContainer.removeClass("select2-search--hide"):i.$searchContainer.addClass("select2-search--hide")}})},t.prototype.handleSearch=function(){if(!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},t.prototype.showSearch=function(){return!0},t}),t.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;r>=0;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),t.define("select2/dropdown/infiniteScroll",["jquery"],function(e){function t(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return t.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},t.prototype.bind=function(t,n,r){var i=this;t.call(this,n,r),n.on("query",function(e){i.lastParams=e,i.loading=!0}),n.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",function(){var t=e.contains(document.documentElement,i.$loadingMore[0]);if(!i.loading&&t){var n=i.$results.offset().top+i.$results.outerHeight(!1),r=i.$loadingMore.offset().top+i.$loadingMore.outerHeight(!1);n+50>=r&&i.loadMore()}})},t.prototype.loadMore=function(){this.loading=!0;var t=e.extend({},{page:1},this.lastParams);t.page++,this.trigger("query:append",t)},t.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},t.prototype.createLoadingMore=function(){var t=e('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),n=this.options.get("translations").get("loadingMore");return t.html(n(this.lastParams)),t},t}),t.define("select2/dropdown/attachBody",["jquery","../utils"],function(e,t){function n(t,n,r){this.$dropdownParent=r.get("dropdownParent")||e(document.body),t.call(this,n,r)}return n.prototype.bind=function(e,t,n){var r=this,i=!1;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),i||(i=!0,t.on("results:all",function(){r._positionDropdown(),r._resizeDropdown()}),t.on("results:append",function(){r._positionDropdown(),r._resizeDropdown()}))}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},n.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},n.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},n.prototype.render=function(t){var n=e("<span></span>"),r=t.call(this);return n.append(r),this.$dropdownContainer=n,n},n.prototype._hideDropdown=function(){this.$dropdownContainer.detach()},n.prototype._attachPositioningHandler=function(n,r){var i=this,o="scroll.select2."+r.id,s="resize.select2."+r.id,a="orientationchange.select2."+r.id,l=this.$container.parents().filter(t.hasScroll);l.each(function(){e(this).data("select2-scroll-position",{x:e(this).scrollLeft(),y:e(this).scrollTop()})}),l.on(o,function(){var t=e(this).data("select2-scroll-position");e(this).scrollTop(t.y)}),e(window).on(o+" "+s+" "+a,function(){i._positionDropdown(),i._resizeDropdown()})},n.prototype._detachPositioningHandler=function(n,r){var i="scroll.select2."+r.id,o="resize.select2."+r.id,s="orientationchange.select2."+r.id,a=this.$container.parents().filter(t.hasScroll);a.off(i),e(window).off(i+" "+o+" "+s)},n.prototype._positionDropdown=function(){var t=e(window),n=this.$dropdown.hasClass("select2-dropdown--above"),r=this.$dropdown.hasClass("select2-dropdown--below"),i=null,o=this.$container.offset();o.bottom=o.top+this.$container.outerHeight(!1);var s={height:this.$container.outerHeight(!1)};s.top=o.top,s.bottom=o.top+s.height;var a={height:this.$dropdown.outerHeight(!1)},l={top:t.scrollTop(),bottom:t.scrollTop()+t.height()},c=l.top<o.top-a.height,u=l.bottom>o.bottom+a.height,d={left:o.left,top:s.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h=p.offset();d.top-=h.top,d.left-=h.left,n||r||(i="below"),u||!c||n?!c&&u&&n&&(i="below"):i="above",("above"==i||n&&"below"!==i)&&(d.top=s.top-h.top-a.height),null!=i&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+i),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+i)),this.$dropdownContainer.css(d)},n.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},n.prototype._showDropdown=function(){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},n}),t.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(t){for(var n=0,r=0;r<t.length;r++){var i=t[r];i.children?n+=e(i.children):n++}return n}function t(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return t.prototype.showSearch=function(t,n){return e(n.data.results)<this.minimumResultsForSearch?!1:t.call(this,n)},t}),t.define("select2/dropdown/selectOnClose",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",function(e){r._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var r=this.getHighlightedResults();if(!(r.length<1)){var i=r.data("data");null!=i.element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})}},e}),t.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(e){r._selectTriggered(e)}),t.on("unselect",function(e){r._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&n.ctrlKey||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),t.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),t.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(e,t,n,r,i,o,s,a,l,c,u,d,p,h,f,g,m,v,y,_,$,w,b,A,x,E,C,O,S){function T(){this.reset()}T.prototype.apply=function(d){if(d=e.extend(!0,{},this.defaults,d),null==d.dataAdapter){if(d.dataAdapter=null!=d.ajax?f:null!=d.data?h:p,d.minimumInputLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,v)),d.maximumInputLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,y)),d.maximumSelectionLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,_)),d.tags&&(d.dataAdapter=c.Decorate(d.dataAdapter,g)),(null!=d.tokenSeparators||null!=d.tokenizer)&&(d.dataAdapter=c.Decorate(d.dataAdapter,m)),null!=d.query){var S=t(d.amdBase+"compat/query");d.dataAdapter=c.Decorate(d.dataAdapter,S)}if(null!=d.initSelection){var T=t(d.amdBase+"compat/initSelection");d.dataAdapter=c.Decorate(d.dataAdapter,T)}}if(null==d.resultsAdapter&&(d.resultsAdapter=n,null!=d.ajax&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,A)),null!=d.placeholder&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,b)),d.selectOnClose&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,C))),null==d.dropdownAdapter){if(d.multiple)d.dropdownAdapter=$;else{var D=c.Decorate($,w);d.dropdownAdapter=D}if(0!==d.minimumResultsForSearch&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,E)),d.closeOnSelect&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,O)),null!=d.dropdownCssClass||null!=d.dropdownCss||null!=d.adaptDropdownCssClass){var q=t(d.amdBase+"compat/dropdownCss");d.dropdownAdapter=c.Decorate(d.dropdownAdapter,q)}d.dropdownAdapter=c.Decorate(d.dropdownAdapter,x)}if(null==d.selectionAdapter){if(d.selectionAdapter=d.multiple?i:r,null!=d.placeholder&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,o)),d.allowClear&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,s)),d.multiple&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,a)),null!=d.containerCssClass||null!=d.containerCss||null!=d.adaptContainerCssClass){var L=t(d.amdBase+"compat/containerCss");d.selectionAdapter=c.Decorate(d.selectionAdapter,L)}d.selectionAdapter=c.Decorate(d.selectionAdapter,l)}if("string"==typeof d.language)if(d.language.indexOf("-")>0){var j=d.language.split("-"),P=j[0];d.language=[d.language,P]}else d.language=[d.language];if(e.isArray(d.language)){var k=new u;d.language.push("en");for(var I=d.language,R=0;R<I.length;R++){var M=I[R],U={};try{U=u.loadPath(M)}catch(H){try{M=this.defaults.amdLanguageBase+M,U=u.loadPath(M)}catch(z){d.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}k.extend(U)}d.translations=k}else{var N=u.loadPath(this.defaults.amdLanguageBase+"en"),B=new u(d.language);B.extend(N),d.translations=B}return d},T.prototype.reset=function(){function t(e){function t(e){return d[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function n(r,i){if(""===e.trim(r.term))return i;if(i.children&&i.children.length>0){for(var o=e.extend(!0,{},i),s=i.children.length-1;s>=0;s--){var a=i.children[s],l=n(r,a);null==l&&o.children.splice(s,1)}return o.children.length>0?o:n(r,o)}var c=t(i.text).toUpperCase(),u=t(r.term).toUpperCase();return c.indexOf(u)>-1?i:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:c.escapeMarkup,language:S,matcher:n,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},T.prototype.set=function(t,n){var r=e.camelCase(t),i={};i[r]=n;var o=c._convertData(i);e.extend(this.defaults,o)};var D=new T;return D}),t.define("select2/options",["require","jquery","./defaults","./utils"],function(e,t,n,r){function i(t,i){if(this.options=t,null!=i&&this.fromElement(i),this.options=n.apply(this.options),i&&i.is("input")){var o=e(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=r.Decorate(this.options.dataAdapter,o)}}return i.prototype.fromElement=function(e){var n=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.language&&(e.prop("lang")?this.options.language=e.prop("lang").toLowerCase():e.closest("[lang]").prop("lang")&&(this.options.language=e.closest("[lang]").prop("lang"))),null==this.options.dir&&(this.options.dir=e.prop("dir")?e.prop("dir"):e.closest("[dir]").prop("dir")?e.closest("[dir]").prop("dir"):"ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),e.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),e.data("data",e.data("select2Tags")),e.data("tags",!0)),e.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),e.attr("ajax--url",e.data("ajaxUrl")),e.data("ajax--url",e.data("ajaxUrl")));var i={};i=t.fn.jquery&&"1."==t.fn.jquery.substr(0,2)&&e[0].dataset?t.extend(!0,{},e[0].dataset,e.data()):e.data();var o=t.extend(!0,{},i);o=r._convertData(o);for(var s in o)t.inArray(s,n)>-1||(t.isPlainObject(this.options[s])?t.extend(this.options[s],o[s]):this.options[s]=o[s]);return this},i.prototype.get=function(e){return this.options[e]},i.prototype.set=function(e,t){this.options[e]=t},i}),t.define("select2/core",["jquery","./options","./utils","./keys"],function(e,t,n,r){var i=function(e,n){null!=e.data("select2")&&e.data("select2").destroy(),this.$element=e,this.id=this._generateId(e),n=n||{},this.options=new t(n,e),i.__super__.constructor.call(this);var r=e.attr("tabindex")||0;e.data("old-tabindex",r),e.attr("tabindex","-1");var o=this.options.get("dataAdapter");this.dataAdapter=new o(e,this.options);var s=this.render();this._placeContainer(s);var a=this.options.get("selectionAdapter");this.selection=new a(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,s);var l=this.options.get("dropdownAdapter");this.dropdown=new l(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,s);var c=this.options.get("resultsAdapter");this.results=new c(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var u=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){u.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),e.data("select2",this)};return n.Extend(i,n.Observable),i.prototype._generateId=function(e){var t="";return t=null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+n.generateChars(2):n.generateChars(4),t=t.replace(/(:|\.|\[|\]|,)/g,""),t="select2-"+t},i.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},i.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var i=e.outerWidth(!1);return 0>=i?"auto":i+"px"}if("style"==t){var o=e.attr("style");if("string"!=typeof o)return null;for(var s=o.split(";"),a=0,l=s.length;l>a;a+=1){var c=s[a].replace(/\s/g,""),u=c.match(n);if(null!==u&&u.length>=1)return u[1]}return null}return t},i.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},i.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=n.bind(this._syncAttributes,this),this._syncS=n.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=r?(this._observer=new r(function(n){e.each(n,t._syncA),e.each(n,t._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},i.prototype._registerDataEvents=function(){var e=this;this.dataAdapter.on("*",function(t,n){e.trigger(t,n)})},i.prototype._registerSelectionEvents=function(){var t=this,n=["toggle","focus"];this.selection.on("toggle",function(){t.toggleDropdown()}),this.selection.on("focus",function(e){t.focus(e)}),this.selection.on("*",function(r,i){-1===e.inArray(r,n)&&t.trigger(r,i)})},i.prototype._registerDropdownEvents=function(){var e=this;this.dropdown.on("*",function(t,n){e.trigger(t,n)})},i.prototype._registerResultsEvents=function(){var e=this;this.results.on("*",function(t,n){e.trigger(t,n)})},i.prototype._registerEvents=function(){var e=this;this.on("open",function(){e.$container.addClass("select2-container--open")}),this.on("close",function(){e.$container.removeClass("select2-container--open")}),this.on("enable",function(){e.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){e.$container.addClass("select2-container--disabled")}),this.on("blur",function(){e.$container.removeClass("select2-container--focus")}),this.on("query",function(t){e.isOpen()||e.trigger("open",{}),this.dataAdapter.query(t,function(n){e.trigger("results:all",{data:n,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(n){e.trigger("results:append",{data:n,query:t})})}),this.on("keypress",function(t){var n=t.which;e.isOpen()?n===r.ESC||n===r.TAB||n===r.UP&&t.altKey?(e.close(),t.preventDefault()):n===r.ENTER?(e.trigger("results:select",{}),t.preventDefault()):n===r.SPACE&&t.ctrlKey?(e.trigger("results:toggle",{}),t.preventDefault()):n===r.UP?(e.trigger("results:previous",{}),t.preventDefault()):n===r.DOWN&&(e.trigger("results:next",{}),t.preventDefault()):(n===r.ENTER||n===r.SPACE||n===r.DOWN&&t.altKey)&&(e.open(),t.preventDefault())})},i.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},i.prototype._syncSubtree=function(e,t){var n=!1,r=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&t.addedNodes.length>0)for(var i=0;i<t.addedNodes.length;i++){var o=t.addedNodes[i];o.selected&&(n=!0)}else t.removedNodes&&t.removedNodes.length>0&&(n=!0);else n=!0;n&&this.dataAdapter.current(function(e){r.trigger("selection:update",{data:e})})}},i.prototype.trigger=function(e,t){var n=i.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===t&&(t={}),e in r){var o=r[e],s={prevented:!1,name:e,args:t};if(n.call(this,o,s),s.prevented)return void(t.prevented=!0)}n.call(this,e,t)},i.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},i.prototype.open=function(){this.isOpen()||this.trigger("query",{})},i.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},i.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},i.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},i.prototype.focus=function(){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},i.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==e||0===e.length)&&(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},i.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var e=[];return this.dataAdapter.current(function(t){e=t}),e},i.prototype.val=function(t){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==t||0===t.length)return this.$element.val();var n=t[0];e.isArray(n)&&(n=e.map(n,function(e){return e.toString()})),this.$element.val(n).trigger("change")},i.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},i.prototype.render=function(){var t=e('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return t.attr("dir",this.options.get("dir")),this.$container=t,this.$container.addClass("select2-container--"+this.options.get("theme")),t.data("element",this.$element),t
|
3 |
+
},i}),t.define("jquery-mousewheel",["jquery"],function(e){return e}),t.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(e,t,n,r){if(null==e.fn.select2){var i=["open","close","destroy"];e.fn.select2=function(t){if(t=t||{},"object"==typeof t)return this.each(function(){{var r=e.extend(!0,{},t);new n(e(this),r)}}),this;if("string"==typeof t){var r,o=Array.prototype.slice.call(arguments,1);return this.each(function(){var n=e(this).data("select2");null==n&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),r=n[t].apply(n,o)}),e.inArray(t,i)>-1?this:r}throw new Error("Invalid arguments for Select2: "+t)}}return null==e.fn.select2.defaults&&(e.fn.select2.defaults=r),n}),{define:t.define,require:t.require}}(),n=t.require("jquery.select2");return e.fn.select2.amd=t,n});
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/ui-select.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-ui-container{margin:10px 0 20px 0}label.cherry-label{margin:0 0 5px 0;display:block}select.cherry-ui-select{width:100%;outline:0 none;color:#23282d;font-size:14px;line-height:20px;color:#23282d;background-color:#f1f1f1;border-radius:2px;padding:10px 20px;height:50px;border:1px solid #f1f1f1;box-shadow:none}select.cherry-ui-select:focus{border-color:rgba(72,197,105,0.6);box-shadow:0 0 2px rgba(72,197,105,0.6)}select.cherry-ui-select:focus{border-color:none;box-shadow:none}select.select2-hidden-accessible{display:none}.select2{color:#23282d;background-color:#f1f1f1;border-radius:2px}.select2 .selection .select2-selection.select2-selection--single{background-color:transparent;border:none;border-radius:2px;height:50px}.select2 .selection .select2-selection.select2-selection--single .select2-selection__rendered{padding:15px 20px;font-size:14px;line-height:20px}.select2 .selection .select2-selection.select2-selection--single .select2-selection__arrow{height:50px}.select2 .selection .select2-selection.select2-selection--multiple{background-color:transparent;border:none;border-radius:2px}.select2 .selection .select2-selection.select2-selection--multiple .select2-selection__rendered{font-size:14px;line-height:20px;padding:0;display:block}.select2 .selection .select2-selection.select2-selection--multiple .select2-selection__rendered .select2-selection__choice{line-height:20px;margin:5px;border:none;background-color:#495159;border-radius:2px;color:#fff;padding:10px}.select2 .selection .select2-selection.select2-selection--multiple .select2-selection__rendered .select2-selection__choice .select2-selection__choice__remove{color:#e54343;margin-right:10px}.select2 .selection .select2-selection.select2-selection--multiple .select2-selection__rendered .select2-search{margin:0}.select2 .selection .select2-selection.select2-selection--multiple .select2-selection__rendered .select2-search .select2-search__field{padding:0;margin:15px 10px;border:none;box-shadow:none;line-height:20px}.select2-container .select2-dropdown{background-color:#b4b7ba;border:none;border-radius:2px;margin:5px 0;z-index:500001}.select2-container .select2-dropdown .select2-results .select2-results__options .select2-results__option{color:#fff}.select2-container .select2-dropdown .select2-results .select2-results__options .select2-results__option[aria-selected=true]{background-color:#48c569}.select2-container .select2-dropdown .select2-results .select2-results__options .select2-results__option--highlighted{background-color:#495159}.select2-container .select2-dropdown .select2-results .select2-results__options .li[aria-disabled=true]{display:none}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/ui-select.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,t){"use strict";t.utilites.namespace("ui_elements.select"),t.ui_elements.select={init:function(){e(window).on("cherry-ui-elements-init",this.render.bind(this))},render:function(t,i){var r=i.target;e('.cherry-ui-select[data-filter="true"], .cherry-ui-select[multiple]',r).each(function(){var t=e(this);t.select2({placeholder:t.attr("placeholder")})})}},t.ui_elements.select.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/select2.css
ADDED
@@ -0,0 +1,484 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.select2-container {
|
2 |
+
box-sizing: border-box;
|
3 |
+
display: inline-block;
|
4 |
+
margin: 0;
|
5 |
+
position: relative;
|
6 |
+
vertical-align: middle; }
|
7 |
+
.select2-container .select2-selection--single {
|
8 |
+
box-sizing: border-box;
|
9 |
+
cursor: pointer;
|
10 |
+
display: block;
|
11 |
+
height: 28px;
|
12 |
+
user-select: none;
|
13 |
+
-webkit-user-select: none; }
|
14 |
+
.select2-container .select2-selection--single .select2-selection__rendered {
|
15 |
+
display: block;
|
16 |
+
padding-left: 8px;
|
17 |
+
padding-right: 20px;
|
18 |
+
overflow: hidden;
|
19 |
+
text-overflow: ellipsis;
|
20 |
+
white-space: nowrap; }
|
21 |
+
.select2-container .select2-selection--single .select2-selection__clear {
|
22 |
+
position: relative; }
|
23 |
+
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
24 |
+
padding-right: 8px;
|
25 |
+
padding-left: 20px; }
|
26 |
+
.select2-container .select2-selection--multiple {
|
27 |
+
box-sizing: border-box;
|
28 |
+
cursor: pointer;
|
29 |
+
display: block;
|
30 |
+
min-height: 32px;
|
31 |
+
user-select: none;
|
32 |
+
-webkit-user-select: none; }
|
33 |
+
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
34 |
+
display: inline-block;
|
35 |
+
overflow: hidden;
|
36 |
+
padding-left: 8px;
|
37 |
+
text-overflow: ellipsis;
|
38 |
+
white-space: nowrap; }
|
39 |
+
.select2-container .select2-search--inline {
|
40 |
+
float: left; }
|
41 |
+
.select2-container .select2-search--inline .select2-search__field {
|
42 |
+
box-sizing: border-box;
|
43 |
+
border: none;
|
44 |
+
font-size: 100%;
|
45 |
+
margin-top: 5px;
|
46 |
+
padding: 0; }
|
47 |
+
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
48 |
+
-webkit-appearance: none; }
|
49 |
+
|
50 |
+
.select2-dropdown {
|
51 |
+
background-color: white;
|
52 |
+
border: 1px solid #aaa;
|
53 |
+
border-radius: 4px;
|
54 |
+
box-sizing: border-box;
|
55 |
+
display: block;
|
56 |
+
position: absolute;
|
57 |
+
left: -100000px;
|
58 |
+
width: 100%;
|
59 |
+
z-index: 1051; }
|
60 |
+
|
61 |
+
.select2-results {
|
62 |
+
display: block; }
|
63 |
+
|
64 |
+
.select2-results__options {
|
65 |
+
list-style: none;
|
66 |
+
margin: 0;
|
67 |
+
padding: 0; }
|
68 |
+
|
69 |
+
.select2-results__option {
|
70 |
+
padding: 6px;
|
71 |
+
user-select: none;
|
72 |
+
-webkit-user-select: none; }
|
73 |
+
.select2-results__option[aria-selected] {
|
74 |
+
cursor: pointer; }
|
75 |
+
|
76 |
+
.select2-container--open .select2-dropdown {
|
77 |
+
left: 0; }
|
78 |
+
|
79 |
+
.select2-container--open .select2-dropdown--above {
|
80 |
+
border-bottom: none;
|
81 |
+
border-bottom-left-radius: 0;
|
82 |
+
border-bottom-right-radius: 0; }
|
83 |
+
|
84 |
+
.select2-container--open .select2-dropdown--below {
|
85 |
+
border-top: none;
|
86 |
+
border-top-left-radius: 0;
|
87 |
+
border-top-right-radius: 0; }
|
88 |
+
|
89 |
+
.select2-search--dropdown {
|
90 |
+
display: block;
|
91 |
+
padding: 4px; }
|
92 |
+
.select2-search--dropdown .select2-search__field {
|
93 |
+
padding: 4px;
|
94 |
+
width: 100%;
|
95 |
+
box-sizing: border-box; }
|
96 |
+
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
97 |
+
-webkit-appearance: none; }
|
98 |
+
.select2-search--dropdown.select2-search--hide {
|
99 |
+
display: none; }
|
100 |
+
|
101 |
+
.select2-close-mask {
|
102 |
+
border: 0;
|
103 |
+
margin: 0;
|
104 |
+
padding: 0;
|
105 |
+
display: block;
|
106 |
+
position: fixed;
|
107 |
+
left: 0;
|
108 |
+
top: 0;
|
109 |
+
min-height: 100%;
|
110 |
+
min-width: 100%;
|
111 |
+
height: auto;
|
112 |
+
width: auto;
|
113 |
+
opacity: 0;
|
114 |
+
z-index: 99;
|
115 |
+
background-color: #fff;
|
116 |
+
filter: alpha(opacity=0); }
|
117 |
+
|
118 |
+
.select2-hidden-accessible {
|
119 |
+
border: 0 !important;
|
120 |
+
clip: rect(0 0 0 0) !important;
|
121 |
+
height: 1px !important;
|
122 |
+
margin: -1px !important;
|
123 |
+
overflow: hidden !important;
|
124 |
+
padding: 0 !important;
|
125 |
+
position: absolute !important;
|
126 |
+
width: 1px !important; }
|
127 |
+
|
128 |
+
.select2-container--default .select2-selection--single {
|
129 |
+
background-color: #fff;
|
130 |
+
border: 1px solid #aaa;
|
131 |
+
border-radius: 4px; }
|
132 |
+
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
133 |
+
color: #444;
|
134 |
+
line-height: 28px; }
|
135 |
+
.select2-container--default .select2-selection--single .select2-selection__clear {
|
136 |
+
cursor: pointer;
|
137 |
+
float: right;
|
138 |
+
font-weight: bold; }
|
139 |
+
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
140 |
+
color: #999; }
|
141 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
142 |
+
height: 26px;
|
143 |
+
position: absolute;
|
144 |
+
top: 1px;
|
145 |
+
right: 1px;
|
146 |
+
width: 20px; }
|
147 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
148 |
+
border-color: #888 transparent transparent transparent;
|
149 |
+
border-style: solid;
|
150 |
+
border-width: 5px 4px 0 4px;
|
151 |
+
height: 0;
|
152 |
+
left: 50%;
|
153 |
+
margin-left: -4px;
|
154 |
+
margin-top: -2px;
|
155 |
+
position: absolute;
|
156 |
+
top: 50%;
|
157 |
+
width: 0; }
|
158 |
+
|
159 |
+
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
160 |
+
float: left; }
|
161 |
+
|
162 |
+
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
163 |
+
left: 1px;
|
164 |
+
right: auto; }
|
165 |
+
|
166 |
+
.select2-container--default.select2-container--disabled .select2-selection--single {
|
167 |
+
background-color: #eee;
|
168 |
+
cursor: default; }
|
169 |
+
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
170 |
+
display: none; }
|
171 |
+
|
172 |
+
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
173 |
+
border-color: transparent transparent #888 transparent;
|
174 |
+
border-width: 0 4px 5px 4px; }
|
175 |
+
|
176 |
+
.select2-container--default .select2-selection--multiple {
|
177 |
+
background-color: white;
|
178 |
+
border: 1px solid #aaa;
|
179 |
+
border-radius: 4px;
|
180 |
+
cursor: text; }
|
181 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
182 |
+
box-sizing: border-box;
|
183 |
+
list-style: none;
|
184 |
+
margin: 0;
|
185 |
+
padding: 0 5px;
|
186 |
+
width: 100%; }
|
187 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
188 |
+
list-style: none; }
|
189 |
+
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
190 |
+
color: #999;
|
191 |
+
margin-top: 5px;
|
192 |
+
float: left; }
|
193 |
+
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
194 |
+
cursor: pointer;
|
195 |
+
float: right;
|
196 |
+
font-weight: bold;
|
197 |
+
margin-top: 5px;
|
198 |
+
margin-right: 10px; }
|
199 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
200 |
+
background-color: #e4e4e4;
|
201 |
+
border: 1px solid #aaa;
|
202 |
+
border-radius: 4px;
|
203 |
+
cursor: default;
|
204 |
+
float: left;
|
205 |
+
margin-right: 5px;
|
206 |
+
margin-top: 5px;
|
207 |
+
padding: 0 5px; }
|
208 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
209 |
+
color: #999;
|
210 |
+
cursor: pointer;
|
211 |
+
display: inline-block;
|
212 |
+
font-weight: bold;
|
213 |
+
margin-right: 2px; }
|
214 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
215 |
+
color: #333; }
|
216 |
+
|
217 |
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
218 |
+
float: right; }
|
219 |
+
|
220 |
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
221 |
+
margin-left: 5px;
|
222 |
+
margin-right: auto; }
|
223 |
+
|
224 |
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
225 |
+
margin-left: 2px;
|
226 |
+
margin-right: auto; }
|
227 |
+
|
228 |
+
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
229 |
+
border: solid black 1px;
|
230 |
+
outline: 0; }
|
231 |
+
|
232 |
+
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
233 |
+
background-color: #eee;
|
234 |
+
cursor: default; }
|
235 |
+
|
236 |
+
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
237 |
+
display: none; }
|
238 |
+
|
239 |
+
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
240 |
+
border-top-left-radius: 0;
|
241 |
+
border-top-right-radius: 0; }
|
242 |
+
|
243 |
+
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
244 |
+
border-bottom-left-radius: 0;
|
245 |
+
border-bottom-right-radius: 0; }
|
246 |
+
|
247 |
+
.select2-container--default .select2-search--dropdown .select2-search__field {
|
248 |
+
border: 1px solid #aaa; }
|
249 |
+
|
250 |
+
.select2-container--default .select2-search--inline .select2-search__field {
|
251 |
+
background: transparent;
|
252 |
+
border: none;
|
253 |
+
outline: 0;
|
254 |
+
box-shadow: none;
|
255 |
+
-webkit-appearance: textfield; }
|
256 |
+
|
257 |
+
.select2-container--default .select2-results > .select2-results__options {
|
258 |
+
max-height: 200px;
|
259 |
+
overflow-y: auto; }
|
260 |
+
|
261 |
+
.select2-container--default .select2-results__option[role=group] {
|
262 |
+
padding: 0; }
|
263 |
+
|
264 |
+
.select2-container--default .select2-results__option[aria-disabled=true] {
|
265 |
+
color: #999; }
|
266 |
+
|
267 |
+
.select2-container--default .select2-results__option[aria-selected=true] {
|
268 |
+
background-color: #ddd; }
|
269 |
+
|
270 |
+
.select2-container--default .select2-results__option .select2-results__option {
|
271 |
+
padding-left: 1em; }
|
272 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
273 |
+
padding-left: 0; }
|
274 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
275 |
+
margin-left: -1em;
|
276 |
+
padding-left: 2em; }
|
277 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
278 |
+
margin-left: -2em;
|
279 |
+
padding-left: 3em; }
|
280 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
281 |
+
margin-left: -3em;
|
282 |
+
padding-left: 4em; }
|
283 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
284 |
+
margin-left: -4em;
|
285 |
+
padding-left: 5em; }
|
286 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
287 |
+
margin-left: -5em;
|
288 |
+
padding-left: 6em; }
|
289 |
+
|
290 |
+
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
291 |
+
background-color: #5897fb;
|
292 |
+
color: white; }
|
293 |
+
|
294 |
+
.select2-container--default .select2-results__group {
|
295 |
+
cursor: default;
|
296 |
+
display: block;
|
297 |
+
padding: 6px; }
|
298 |
+
|
299 |
+
.select2-container--classic .select2-selection--single {
|
300 |
+
background-color: #f7f7f7;
|
301 |
+
border: 1px solid #aaa;
|
302 |
+
border-radius: 4px;
|
303 |
+
outline: 0;
|
304 |
+
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
305 |
+
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
306 |
+
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
307 |
+
background-repeat: repeat-x;
|
308 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
309 |
+
.select2-container--classic .select2-selection--single:focus {
|
310 |
+
border: 1px solid #5897fb; }
|
311 |
+
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
312 |
+
color: #444;
|
313 |
+
line-height: 28px; }
|
314 |
+
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
315 |
+
cursor: pointer;
|
316 |
+
float: right;
|
317 |
+
font-weight: bold;
|
318 |
+
margin-right: 10px; }
|
319 |
+
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
320 |
+
color: #999; }
|
321 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
322 |
+
background-color: #ddd;
|
323 |
+
border: none;
|
324 |
+
border-left: 1px solid #aaa;
|
325 |
+
border-top-right-radius: 4px;
|
326 |
+
border-bottom-right-radius: 4px;
|
327 |
+
height: 26px;
|
328 |
+
position: absolute;
|
329 |
+
top: 1px;
|
330 |
+
right: 1px;
|
331 |
+
width: 20px;
|
332 |
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
333 |
+
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
334 |
+
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
335 |
+
background-repeat: repeat-x;
|
336 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
337 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
338 |
+
border-color: #888 transparent transparent transparent;
|
339 |
+
border-style: solid;
|
340 |
+
border-width: 5px 4px 0 4px;
|
341 |
+
height: 0;
|
342 |
+
left: 50%;
|
343 |
+
margin-left: -4px;
|
344 |
+
margin-top: -2px;
|
345 |
+
position: absolute;
|
346 |
+
top: 50%;
|
347 |
+
width: 0; }
|
348 |
+
|
349 |
+
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
350 |
+
float: left; }
|
351 |
+
|
352 |
+
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
353 |
+
border: none;
|
354 |
+
border-right: 1px solid #aaa;
|
355 |
+
border-radius: 0;
|
356 |
+
border-top-left-radius: 4px;
|
357 |
+
border-bottom-left-radius: 4px;
|
358 |
+
left: 1px;
|
359 |
+
right: auto; }
|
360 |
+
|
361 |
+
.select2-container--classic.select2-container--open .select2-selection--single {
|
362 |
+
border: 1px solid #5897fb; }
|
363 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
364 |
+
background: transparent;
|
365 |
+
border: none; }
|
366 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
367 |
+
border-color: transparent transparent #888 transparent;
|
368 |
+
border-width: 0 4px 5px 4px; }
|
369 |
+
|
370 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
371 |
+
border-top: none;
|
372 |
+
border-top-left-radius: 0;
|
373 |
+
border-top-right-radius: 0;
|
374 |
+
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
375 |
+
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
376 |
+
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
377 |
+
background-repeat: repeat-x;
|
378 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
379 |
+
|
380 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
381 |
+
border-bottom: none;
|
382 |
+
border-bottom-left-radius: 0;
|
383 |
+
border-bottom-right-radius: 0;
|
384 |
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
385 |
+
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
386 |
+
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
387 |
+
background-repeat: repeat-x;
|
388 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
389 |
+
|
390 |
+
.select2-container--classic .select2-selection--multiple {
|
391 |
+
background-color: white;
|
392 |
+
border: 1px solid #aaa;
|
393 |
+
border-radius: 4px;
|
394 |
+
cursor: text;
|
395 |
+
outline: 0; }
|
396 |
+
.select2-container--classic .select2-selection--multiple:focus {
|
397 |
+
border: 1px solid #5897fb; }
|
398 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
399 |
+
list-style: none;
|
400 |
+
margin: 0;
|
401 |
+
padding: 0 5px; }
|
402 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
403 |
+
display: none; }
|
404 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
405 |
+
background-color: #e4e4e4;
|
406 |
+
border: 1px solid #aaa;
|
407 |
+
border-radius: 4px;
|
408 |
+
cursor: default;
|
409 |
+
float: left;
|
410 |
+
margin-right: 5px;
|
411 |
+
margin-top: 5px;
|
412 |
+
padding: 0 5px; }
|
413 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
414 |
+
color: #888;
|
415 |
+
cursor: pointer;
|
416 |
+
display: inline-block;
|
417 |
+
font-weight: bold;
|
418 |
+
margin-right: 2px; }
|
419 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
420 |
+
color: #555; }
|
421 |
+
|
422 |
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
423 |
+
float: right; }
|
424 |
+
|
425 |
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
426 |
+
margin-left: 5px;
|
427 |
+
margin-right: auto; }
|
428 |
+
|
429 |
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
430 |
+
margin-left: 2px;
|
431 |
+
margin-right: auto; }
|
432 |
+
|
433 |
+
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
434 |
+
border: 1px solid #5897fb; }
|
435 |
+
|
436 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
437 |
+
border-top: none;
|
438 |
+
border-top-left-radius: 0;
|
439 |
+
border-top-right-radius: 0; }
|
440 |
+
|
441 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
442 |
+
border-bottom: none;
|
443 |
+
border-bottom-left-radius: 0;
|
444 |
+
border-bottom-right-radius: 0; }
|
445 |
+
|
446 |
+
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
447 |
+
border: 1px solid #aaa;
|
448 |
+
outline: 0; }
|
449 |
+
|
450 |
+
.select2-container--classic .select2-search--inline .select2-search__field {
|
451 |
+
outline: 0;
|
452 |
+
box-shadow: none; }
|
453 |
+
|
454 |
+
.select2-container--classic .select2-dropdown {
|
455 |
+
background-color: white;
|
456 |
+
border: 1px solid transparent; }
|
457 |
+
|
458 |
+
.select2-container--classic .select2-dropdown--above {
|
459 |
+
border-bottom: none; }
|
460 |
+
|
461 |
+
.select2-container--classic .select2-dropdown--below {
|
462 |
+
border-top: none; }
|
463 |
+
|
464 |
+
.select2-container--classic .select2-results > .select2-results__options {
|
465 |
+
max-height: 200px;
|
466 |
+
overflow-y: auto; }
|
467 |
+
|
468 |
+
.select2-container--classic .select2-results__option[role=group] {
|
469 |
+
padding: 0; }
|
470 |
+
|
471 |
+
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
472 |
+
color: grey; }
|
473 |
+
|
474 |
+
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
475 |
+
background-color: #3875d7;
|
476 |
+
color: white; }
|
477 |
+
|
478 |
+
.select2-container--classic .select2-results__group {
|
479 |
+
cursor: default;
|
480 |
+
display: block;
|
481 |
+
padding: 6px; }
|
482 |
+
|
483 |
+
.select2-container--classic.select2-container--open .select2-dropdown {
|
484 |
+
border-color: #5897fb; }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/select2.js
ADDED
@@ -0,0 +1,5725 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Select2 4.0.3
|
3 |
+
* https://select2.github.io
|
4 |
+
*
|
5 |
+
* Released under the MIT license
|
6 |
+
* https://github.com/select2/select2/blob/master/LICENSE.md
|
7 |
+
*/
|
8 |
+
(function (factory) {
|
9 |
+
if (typeof define === 'function' && define.amd) {
|
10 |
+
// AMD. Register as an anonymous module.
|
11 |
+
define(['jquery'], factory);
|
12 |
+
} else if (typeof exports === 'object') {
|
13 |
+
// Node/CommonJS
|
14 |
+
factory(require('jquery'));
|
15 |
+
} else {
|
16 |
+
// Browser globals
|
17 |
+
factory(jQuery);
|
18 |
+
}
|
19 |
+
}(function (jQuery) {
|
20 |
+
// This is needed so we can catch the AMD loader configuration and use it
|
21 |
+
// The inner file should be wrapped (by `banner.start.js`) in a function that
|
22 |
+
// returns the AMD loader references.
|
23 |
+
var S2 =
|
24 |
+
(function () {
|
25 |
+
// Restore the Select2 AMD loader so it can be used
|
26 |
+
// Needed mostly in the language files, where the loader is not inserted
|
27 |
+
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
|
28 |
+
var S2 = jQuery.fn.select2.amd;
|
29 |
+
}
|
30 |
+
var S2;(function () { if (!S2 || !S2.requirejs) {
|
31 |
+
if (!S2) { S2 = {}; } else { require = S2; }
|
32 |
+
/**
|
33 |
+
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
|
34 |
+
* Available via the MIT or new BSD license.
|
35 |
+
* see: http://github.com/jrburke/almond for details
|
36 |
+
*/
|
37 |
+
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
38 |
+
//be followed.
|
39 |
+
/*jslint sloppy: true */
|
40 |
+
/*global setTimeout: false */
|
41 |
+
|
42 |
+
var requirejs, require, define;
|
43 |
+
(function (undef) {
|
44 |
+
var main, req, makeMap, handlers,
|
45 |
+
defined = {},
|
46 |
+
waiting = {},
|
47 |
+
config = {},
|
48 |
+
defining = {},
|
49 |
+
hasOwn = Object.prototype.hasOwnProperty,
|
50 |
+
aps = [].slice,
|
51 |
+
jsSuffixRegExp = /\.js$/;
|
52 |
+
|
53 |
+
function hasProp(obj, prop) {
|
54 |
+
return hasOwn.call(obj, prop);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Given a relative module name, like ./something, normalize it to
|
59 |
+
* a real name that can be mapped to a path.
|
60 |
+
* @param {String} name the relative name
|
61 |
+
* @param {String} baseName a real name that the name arg is relative
|
62 |
+
* to.
|
63 |
+
* @returns {String} normalized name
|
64 |
+
*/
|
65 |
+
function normalize(name, baseName) {
|
66 |
+
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
|
67 |
+
foundI, foundStarMap, starI, i, j, part,
|
68 |
+
baseParts = baseName && baseName.split("/"),
|
69 |
+
map = config.map,
|
70 |
+
starMap = (map && map['*']) || {};
|
71 |
+
|
72 |
+
//Adjust any relative paths.
|
73 |
+
if (name && name.charAt(0) === ".") {
|
74 |
+
//If have a base name, try to normalize against it,
|
75 |
+
//otherwise, assume it is a top-level require that will
|
76 |
+
//be relative to baseUrl in the end.
|
77 |
+
if (baseName) {
|
78 |
+
name = name.split('/');
|
79 |
+
lastIndex = name.length - 1;
|
80 |
+
|
81 |
+
// Node .js allowance:
|
82 |
+
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
83 |
+
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
84 |
+
}
|
85 |
+
|
86 |
+
//Lop off the last part of baseParts, so that . matches the
|
87 |
+
//"directory" and not name of the baseName's module. For instance,
|
88 |
+
//baseName of "one/two/three", maps to "one/two/three.js", but we
|
89 |
+
//want the directory, "one/two" for this normalization.
|
90 |
+
name = baseParts.slice(0, baseParts.length - 1).concat(name);
|
91 |
+
|
92 |
+
//start trimDots
|
93 |
+
for (i = 0; i < name.length; i += 1) {
|
94 |
+
part = name[i];
|
95 |
+
if (part === ".") {
|
96 |
+
name.splice(i, 1);
|
97 |
+
i -= 1;
|
98 |
+
} else if (part === "..") {
|
99 |
+
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
|
100 |
+
//End of the line. Keep at least one non-dot
|
101 |
+
//path segment at the front so it can be mapped
|
102 |
+
//correctly to disk. Otherwise, there is likely
|
103 |
+
//no path mapping for a path starting with '..'.
|
104 |
+
//This can still fail, but catches the most reasonable
|
105 |
+
//uses of ..
|
106 |
+
break;
|
107 |
+
} else if (i > 0) {
|
108 |
+
name.splice(i - 1, 2);
|
109 |
+
i -= 2;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
//end trimDots
|
114 |
+
|
115 |
+
name = name.join("/");
|
116 |
+
} else if (name.indexOf('./') === 0) {
|
117 |
+
// No baseName, so this is ID is resolved relative
|
118 |
+
// to baseUrl, pull off the leading dot.
|
119 |
+
name = name.substring(2);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
//Apply map config if available.
|
124 |
+
if ((baseParts || starMap) && map) {
|
125 |
+
nameParts = name.split('/');
|
126 |
+
|
127 |
+
for (i = nameParts.length; i > 0; i -= 1) {
|
128 |
+
nameSegment = nameParts.slice(0, i).join("/");
|
129 |
+
|
130 |
+
if (baseParts) {
|
131 |
+
//Find the longest baseName segment match in the config.
|
132 |
+
//So, do joins on the biggest to smallest lengths of baseParts.
|
133 |
+
for (j = baseParts.length; j > 0; j -= 1) {
|
134 |
+
mapValue = map[baseParts.slice(0, j).join('/')];
|
135 |
+
|
136 |
+
//baseName segment has config, find if it has one for
|
137 |
+
//this name.
|
138 |
+
if (mapValue) {
|
139 |
+
mapValue = mapValue[nameSegment];
|
140 |
+
if (mapValue) {
|
141 |
+
//Match, update name to the new value.
|
142 |
+
foundMap = mapValue;
|
143 |
+
foundI = i;
|
144 |
+
break;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
if (foundMap) {
|
151 |
+
break;
|
152 |
+
}
|
153 |
+
|
154 |
+
//Check for a star map match, but just hold on to it,
|
155 |
+
//if there is a shorter segment match later in a matching
|
156 |
+
//config, then favor over this star map.
|
157 |
+
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
158 |
+
foundStarMap = starMap[nameSegment];
|
159 |
+
starI = i;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
if (!foundMap && foundStarMap) {
|
164 |
+
foundMap = foundStarMap;
|
165 |
+
foundI = starI;
|
166 |
+
}
|
167 |
+
|
168 |
+
if (foundMap) {
|
169 |
+
nameParts.splice(0, foundI, foundMap);
|
170 |
+
name = nameParts.join('/');
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
return name;
|
175 |
+
}
|
176 |
+
|
177 |
+
function makeRequire(relName, forceSync) {
|
178 |
+
return function () {
|
179 |
+
//A version of a require function that passes a moduleName
|
180 |
+
//value for items that may need to
|
181 |
+
//look up paths relative to the moduleName
|
182 |
+
var args = aps.call(arguments, 0);
|
183 |
+
|
184 |
+
//If first arg is not require('string'), and there is only
|
185 |
+
//one arg, it is the array form without a callback. Insert
|
186 |
+
//a null so that the following concat is correct.
|
187 |
+
if (typeof args[0] !== 'string' && args.length === 1) {
|
188 |
+
args.push(null);
|
189 |
+
}
|
190 |
+
return req.apply(undef, args.concat([relName, forceSync]));
|
191 |
+
};
|
192 |
+
}
|
193 |
+
|
194 |
+
function makeNormalize(relName) {
|
195 |
+
return function (name) {
|
196 |
+
return normalize(name, relName);
|
197 |
+
};
|
198 |
+
}
|
199 |
+
|
200 |
+
function makeLoad(depName) {
|
201 |
+
return function (value) {
|
202 |
+
defined[depName] = value;
|
203 |
+
};
|
204 |
+
}
|
205 |
+
|
206 |
+
function callDep(name) {
|
207 |
+
if (hasProp(waiting, name)) {
|
208 |
+
var args = waiting[name];
|
209 |
+
delete waiting[name];
|
210 |
+
defining[name] = true;
|
211 |
+
main.apply(undef, args);
|
212 |
+
}
|
213 |
+
|
214 |
+
if (!hasProp(defined, name) && !hasProp(defining, name)) {
|
215 |
+
throw new Error('No ' + name);
|
216 |
+
}
|
217 |
+
return defined[name];
|
218 |
+
}
|
219 |
+
|
220 |
+
//Turns a plugin!resource to [plugin, resource]
|
221 |
+
//with the plugin being undefined if the name
|
222 |
+
//did not have a plugin prefix.
|
223 |
+
function splitPrefix(name) {
|
224 |
+
var prefix,
|
225 |
+
index = name ? name.indexOf('!') : -1;
|
226 |
+
if (index > -1) {
|
227 |
+
prefix = name.substring(0, index);
|
228 |
+
name = name.substring(index + 1, name.length);
|
229 |
+
}
|
230 |
+
return [prefix, name];
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Makes a name map, normalizing the name, and using a plugin
|
235 |
+
* for normalization if necessary. Grabs a ref to plugin
|
236 |
+
* too, as an optimization.
|
237 |
+
*/
|
238 |
+
makeMap = function (name, relName) {
|
239 |
+
var plugin,
|
240 |
+
parts = splitPrefix(name),
|
241 |
+
prefix = parts[0];
|
242 |
+
|
243 |
+
name = parts[1];
|
244 |
+
|
245 |
+
if (prefix) {
|
246 |
+
prefix = normalize(prefix, relName);
|
247 |
+
plugin = callDep(prefix);
|
248 |
+
}
|
249 |
+
|
250 |
+
//Normalize according
|
251 |
+
if (prefix) {
|
252 |
+
if (plugin && plugin.normalize) {
|
253 |
+
name = plugin.normalize(name, makeNormalize(relName));
|
254 |
+
} else {
|
255 |
+
name = normalize(name, relName);
|
256 |
+
}
|
257 |
+
} else {
|
258 |
+
name = normalize(name, relName);
|
259 |
+
parts = splitPrefix(name);
|
260 |
+
prefix = parts[0];
|
261 |
+
name = parts[1];
|
262 |
+
if (prefix) {
|
263 |
+
plugin = callDep(prefix);
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
//Using ridiculous property names for space reasons
|
268 |
+
return {
|
269 |
+
f: prefix ? prefix + '!' + name : name, //fullName
|
270 |
+
n: name,
|
271 |
+
pr: prefix,
|
272 |
+
p: plugin
|
273 |
+
};
|
274 |
+
};
|
275 |
+
|
276 |
+
function makeConfig(name) {
|
277 |
+
return function () {
|
278 |
+
return (config && config.config && config.config[name]) || {};
|
279 |
+
};
|
280 |
+
}
|
281 |
+
|
282 |
+
handlers = {
|
283 |
+
require: function (name) {
|
284 |
+
return makeRequire(name);
|
285 |
+
},
|
286 |
+
exports: function (name) {
|
287 |
+
var e = defined[name];
|
288 |
+
if (typeof e !== 'undefined') {
|
289 |
+
return e;
|
290 |
+
} else {
|
291 |
+
return (defined[name] = {});
|
292 |
+
}
|
293 |
+
},
|
294 |
+
module: function (name) {
|
295 |
+
return {
|
296 |
+
id: name,
|
297 |
+
uri: '',
|
298 |
+
exports: defined[name],
|
299 |
+
config: makeConfig(name)
|
300 |
+
};
|
301 |
+
}
|
302 |
+
};
|
303 |
+
|
304 |
+
main = function (name, deps, callback, relName) {
|
305 |
+
var cjsModule, depName, ret, map, i,
|
306 |
+
args = [],
|
307 |
+
callbackType = typeof callback,
|
308 |
+
usingExports;
|
309 |
+
|
310 |
+
//Use name if no relName
|
311 |
+
relName = relName || name;
|
312 |
+
|
313 |
+
//Call the callback to define the module, if necessary.
|
314 |
+
if (callbackType === 'undefined' || callbackType === 'function') {
|
315 |
+
//Pull out the defined dependencies and pass the ordered
|
316 |
+
//values to the callback.
|
317 |
+
//Default to [require, exports, module] if no deps
|
318 |
+
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
319 |
+
for (i = 0; i < deps.length; i += 1) {
|
320 |
+
map = makeMap(deps[i], relName);
|
321 |
+
depName = map.f;
|
322 |
+
|
323 |
+
//Fast path CommonJS standard dependencies.
|
324 |
+
if (depName === "require") {
|
325 |
+
args[i] = handlers.require(name);
|
326 |
+
} else if (depName === "exports") {
|
327 |
+
//CommonJS module spec 1.1
|
328 |
+
args[i] = handlers.exports(name);
|
329 |
+
usingExports = true;
|
330 |
+
} else if (depName === "module") {
|
331 |
+
//CommonJS module spec 1.1
|
332 |
+
cjsModule = args[i] = handlers.module(name);
|
333 |
+
} else if (hasProp(defined, depName) ||
|
334 |
+
hasProp(waiting, depName) ||
|
335 |
+
hasProp(defining, depName)) {
|
336 |
+
args[i] = callDep(depName);
|
337 |
+
} else if (map.p) {
|
338 |
+
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
|
339 |
+
args[i] = defined[depName];
|
340 |
+
} else {
|
341 |
+
throw new Error(name + ' missing ' + depName);
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
ret = callback ? callback.apply(defined[name], args) : undefined;
|
346 |
+
|
347 |
+
if (name) {
|
348 |
+
//If setting exports via "module" is in play,
|
349 |
+
//favor that over return value and exports. After that,
|
350 |
+
//favor a non-undefined return value over exports use.
|
351 |
+
if (cjsModule && cjsModule.exports !== undef &&
|
352 |
+
cjsModule.exports !== defined[name]) {
|
353 |
+
defined[name] = cjsModule.exports;
|
354 |
+
} else if (ret !== undef || !usingExports) {
|
355 |
+
//Use the return value from the function.
|
356 |
+
defined[name] = ret;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
} else if (name) {
|
360 |
+
//May just be an object definition for the module. Only
|
361 |
+
//worry about defining if have a module name.
|
362 |
+
defined[name] = callback;
|
363 |
+
}
|
364 |
+
};
|
365 |
+
|
366 |
+
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
|
367 |
+
if (typeof deps === "string") {
|
368 |
+
if (handlers[deps]) {
|
369 |
+
//callback in this case is really relName
|
370 |
+
return handlers[deps](callback);
|
371 |
+
}
|
372 |
+
//Just return the module wanted. In this scenario, the
|
373 |
+
//deps arg is the module name, and second arg (if passed)
|
374 |
+
//is just the relName.
|
375 |
+
//Normalize module name, if it contains . or ..
|
376 |
+
return callDep(makeMap(deps, callback).f);
|
377 |
+
} else if (!deps.splice) {
|
378 |
+
//deps is a config object, not an array.
|
379 |
+
config = deps;
|
380 |
+
if (config.deps) {
|
381 |
+
req(config.deps, config.callback);
|
382 |
+
}
|
383 |
+
if (!callback) {
|
384 |
+
return;
|
385 |
+
}
|
386 |
+
|
387 |
+
if (callback.splice) {
|
388 |
+
//callback is an array, which means it is a dependency list.
|
389 |
+
//Adjust args if there are dependencies
|
390 |
+
deps = callback;
|
391 |
+
callback = relName;
|
392 |
+
relName = null;
|
393 |
+
} else {
|
394 |
+
deps = undef;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
//Support require(['a'])
|
399 |
+
callback = callback || function () {};
|
400 |
+
|
401 |
+
//If relName is a function, it is an errback handler,
|
402 |
+
//so remove it.
|
403 |
+
if (typeof relName === 'function') {
|
404 |
+
relName = forceSync;
|
405 |
+
forceSync = alt;
|
406 |
+
}
|
407 |
+
|
408 |
+
//Simulate async callback;
|
409 |
+
if (forceSync) {
|
410 |
+
main(undef, deps, callback, relName);
|
411 |
+
} else {
|
412 |
+
//Using a non-zero value because of concern for what old browsers
|
413 |
+
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
414 |
+
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
415 |
+
//If want a value immediately, use require('id') instead -- something
|
416 |
+
//that works in almond on the global level, but not guaranteed and
|
417 |
+
//unlikely to work in other AMD implementations.
|
418 |
+
setTimeout(function () {
|
419 |
+
main(undef, deps, callback, relName);
|
420 |
+
}, 4);
|
421 |
+
}
|
422 |
+
|
423 |
+
return req;
|
424 |
+
};
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Just drops the config on the floor, but returns req in case
|
428 |
+
* the config return value is used.
|
429 |
+
*/
|
430 |
+
req.config = function (cfg) {
|
431 |
+
return req(cfg);
|
432 |
+
};
|
433 |
+
|
434 |
+
/**
|
435 |
+
* Expose module registry for debugging and tooling
|
436 |
+
*/
|
437 |
+
requirejs._defined = defined;
|
438 |
+
|
439 |
+
define = function (name, deps, callback) {
|
440 |
+
if (typeof name !== 'string') {
|
441 |
+
throw new Error('See almond README: incorrect module build, no module name');
|
442 |
+
}
|
443 |
+
|
444 |
+
//This module may not have dependencies
|
445 |
+
if (!deps.splice) {
|
446 |
+
//deps is not an array, so probably means
|
447 |
+
//an object literal or factory function for
|
448 |
+
//the value. Adjust args.
|
449 |
+
callback = deps;
|
450 |
+
deps = [];
|
451 |
+
}
|
452 |
+
|
453 |
+
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
|
454 |
+
waiting[name] = [name, deps, callback];
|
455 |
+
}
|
456 |
+
};
|
457 |
+
|
458 |
+
define.amd = {
|
459 |
+
jQuery: true
|
460 |
+
};
|
461 |
+
}());
|
462 |
+
|
463 |
+
S2.requirejs = requirejs;S2.require = require;S2.define = define;
|
464 |
+
}
|
465 |
+
}());
|
466 |
+
S2.define("almond", function(){});
|
467 |
+
|
468 |
+
/* global jQuery:false, $:false */
|
469 |
+
S2.define('jquery',[],function () {
|
470 |
+
var _$ = jQuery || $;
|
471 |
+
|
472 |
+
if (_$ == null && console && console.error) {
|
473 |
+
console.error(
|
474 |
+
'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
|
475 |
+
'found. Make sure that you are including jQuery before Select2 on your ' +
|
476 |
+
'web page.'
|
477 |
+
);
|
478 |
+
}
|
479 |
+
|
480 |
+
return _$;
|
481 |
+
});
|
482 |
+
|
483 |
+
S2.define('select2/utils',[
|
484 |
+
'jquery'
|
485 |
+
], function ($) {
|
486 |
+
var Utils = {};
|
487 |
+
|
488 |
+
Utils.Extend = function (ChildClass, SuperClass) {
|
489 |
+
var __hasProp = {}.hasOwnProperty;
|
490 |
+
|
491 |
+
function BaseConstructor () {
|
492 |
+
this.constructor = ChildClass;
|
493 |
+
}
|
494 |
+
|
495 |
+
for (var key in SuperClass) {
|
496 |
+
if (__hasProp.call(SuperClass, key)) {
|
497 |
+
ChildClass[key] = SuperClass[key];
|
498 |
+
}
|
499 |
+
}
|
500 |
+
|
501 |
+
BaseConstructor.prototype = SuperClass.prototype;
|
502 |
+
ChildClass.prototype = new BaseConstructor();
|
503 |
+
ChildClass.__super__ = SuperClass.prototype;
|
504 |
+
|
505 |
+
return ChildClass;
|
506 |
+
};
|
507 |
+
|
508 |
+
function getMethods (theClass) {
|
509 |
+
var proto = theClass.prototype;
|
510 |
+
|
511 |
+
var methods = [];
|
512 |
+
|
513 |
+
for (var methodName in proto) {
|
514 |
+
var m = proto[methodName];
|
515 |
+
|
516 |
+
if (typeof m !== 'function') {
|
517 |
+
continue;
|
518 |
+
}
|
519 |
+
|
520 |
+
if (methodName === 'constructor') {
|
521 |
+
continue;
|
522 |
+
}
|
523 |
+
|
524 |
+
methods.push(methodName);
|
525 |
+
}
|
526 |
+
|
527 |
+
return methods;
|
528 |
+
}
|
529 |
+
|
530 |
+
Utils.Decorate = function (SuperClass, DecoratorClass) {
|
531 |
+
var decoratedMethods = getMethods(DecoratorClass);
|
532 |
+
var superMethods = getMethods(SuperClass);
|
533 |
+
|
534 |
+
function DecoratedClass () {
|
535 |
+
var unshift = Array.prototype.unshift;
|
536 |
+
|
537 |
+
var argCount = DecoratorClass.prototype.constructor.length;
|
538 |
+
|
539 |
+
var calledConstructor = SuperClass.prototype.constructor;
|
540 |
+
|
541 |
+
if (argCount > 0) {
|
542 |
+
unshift.call(arguments, SuperClass.prototype.constructor);
|
543 |
+
|
544 |
+
calledConstructor = DecoratorClass.prototype.constructor;
|
545 |
+
}
|
546 |
+
|
547 |
+
calledConstructor.apply(this, arguments);
|
548 |
+
}
|
549 |
+
|
550 |
+
DecoratorClass.displayName = SuperClass.displayName;
|
551 |
+
|
552 |
+
function ctr () {
|
553 |
+
this.constructor = DecoratedClass;
|
554 |
+
}
|
555 |
+
|
556 |
+
DecoratedClass.prototype = new ctr();
|
557 |
+
|
558 |
+
for (var m = 0; m < superMethods.length; m++) {
|
559 |
+
var superMethod = superMethods[m];
|
560 |
+
|
561 |
+
DecoratedClass.prototype[superMethod] =
|
562 |
+
SuperClass.prototype[superMethod];
|
563 |
+
}
|
564 |
+
|
565 |
+
var calledMethod = function (methodName) {
|
566 |
+
// Stub out the original method if it's not decorating an actual method
|
567 |
+
var originalMethod = function () {};
|
568 |
+
|
569 |
+
if (methodName in DecoratedClass.prototype) {
|
570 |
+
originalMethod = DecoratedClass.prototype[methodName];
|
571 |
+
}
|
572 |
+
|
573 |
+
var decoratedMethod = DecoratorClass.prototype[methodName];
|
574 |
+
|
575 |
+
return function () {
|
576 |
+
var unshift = Array.prototype.unshift;
|
577 |
+
|
578 |
+
unshift.call(arguments, originalMethod);
|
579 |
+
|
580 |
+
return decoratedMethod.apply(this, arguments);
|
581 |
+
};
|
582 |
+
};
|
583 |
+
|
584 |
+
for (var d = 0; d < decoratedMethods.length; d++) {
|
585 |
+
var decoratedMethod = decoratedMethods[d];
|
586 |
+
|
587 |
+
DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
|
588 |
+
}
|
589 |
+
|
590 |
+
return DecoratedClass;
|
591 |
+
};
|
592 |
+
|
593 |
+
var Observable = function () {
|
594 |
+
this.listeners = {};
|
595 |
+
};
|
596 |
+
|
597 |
+
Observable.prototype.on = function (event, callback) {
|
598 |
+
this.listeners = this.listeners || {};
|
599 |
+
|
600 |
+
if (event in this.listeners) {
|
601 |
+
this.listeners[event].push(callback);
|
602 |
+
} else {
|
603 |
+
this.listeners[event] = [callback];
|
604 |
+
}
|
605 |
+
};
|
606 |
+
|
607 |
+
Observable.prototype.trigger = function (event) {
|
608 |
+
var slice = Array.prototype.slice;
|
609 |
+
var params = slice.call(arguments, 1);
|
610 |
+
|
611 |
+
this.listeners = this.listeners || {};
|
612 |
+
|
613 |
+
// Params should always come in as an array
|
614 |
+
if (params == null) {
|
615 |
+
params = [];
|
616 |
+
}
|
617 |
+
|
618 |
+
// If there are no arguments to the event, use a temporary object
|
619 |
+
if (params.length === 0) {
|
620 |
+
params.push({});
|
621 |
+
}
|
622 |
+
|
623 |
+
// Set the `_type` of the first object to the event
|
624 |
+
params[0]._type = event;
|
625 |
+
|
626 |
+
if (event in this.listeners) {
|
627 |
+
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
628 |
+
}
|
629 |
+
|
630 |
+
if ('*' in this.listeners) {
|
631 |
+
this.invoke(this.listeners['*'], arguments);
|
632 |
+
}
|
633 |
+
};
|
634 |
+
|
635 |
+
Observable.prototype.invoke = function (listeners, params) {
|
636 |
+
for (var i = 0, len = listeners.length; i < len; i++) {
|
637 |
+
listeners[i].apply(this, params);
|
638 |
+
}
|
639 |
+
};
|
640 |
+
|
641 |
+
Utils.Observable = Observable;
|
642 |
+
|
643 |
+
Utils.generateChars = function (length) {
|
644 |
+
var chars = '';
|
645 |
+
|
646 |
+
for (var i = 0; i < length; i++) {
|
647 |
+
var randomChar = Math.floor(Math.random() * 36);
|
648 |
+
chars += randomChar.toString(36);
|
649 |
+
}
|
650 |
+
|
651 |
+
return chars;
|
652 |
+
};
|
653 |
+
|
654 |
+
Utils.bind = function (func, context) {
|
655 |
+
return function () {
|
656 |
+
func.apply(context, arguments);
|
657 |
+
};
|
658 |
+
};
|
659 |
+
|
660 |
+
Utils._convertData = function (data) {
|
661 |
+
for (var originalKey in data) {
|
662 |
+
var keys = originalKey.split('-');
|
663 |
+
|
664 |
+
var dataLevel = data;
|
665 |
+
|
666 |
+
if (keys.length === 1) {
|
667 |
+
continue;
|
668 |
+
}
|
669 |
+
|
670 |
+
for (var k = 0; k < keys.length; k++) {
|
671 |
+
var key = keys[k];
|
672 |
+
|
673 |
+
// Lowercase the first letter
|
674 |
+
// By default, dash-separated becomes camelCase
|
675 |
+
key = key.substring(0, 1).toLowerCase() + key.substring(1);
|
676 |
+
|
677 |
+
if (!(key in dataLevel)) {
|
678 |
+
dataLevel[key] = {};
|
679 |
+
}
|
680 |
+
|
681 |
+
if (k == keys.length - 1) {
|
682 |
+
dataLevel[key] = data[originalKey];
|
683 |
+
}
|
684 |
+
|
685 |
+
dataLevel = dataLevel[key];
|
686 |
+
}
|
687 |
+
|
688 |
+
delete data[originalKey];
|
689 |
+
}
|
690 |
+
|
691 |
+
return data;
|
692 |
+
};
|
693 |
+
|
694 |
+
Utils.hasScroll = function (index, el) {
|
695 |
+
// Adapted from the function created by @ShadowScripter
|
696 |
+
// and adapted by @BillBarry on the Stack Exchange Code Review website.
|
697 |
+
// The original code can be found at
|
698 |
+
// http://codereview.stackexchange.com/q/13338
|
699 |
+
// and was designed to be used with the Sizzle selector engine.
|
700 |
+
|
701 |
+
var $el = $(el);
|
702 |
+
var overflowX = el.style.overflowX;
|
703 |
+
var overflowY = el.style.overflowY;
|
704 |
+
|
705 |
+
//Check both x and y declarations
|
706 |
+
if (overflowX === overflowY &&
|
707 |
+
(overflowY === 'hidden' || overflowY === 'visible')) {
|
708 |
+
return false;
|
709 |
+
}
|
710 |
+
|
711 |
+
if (overflowX === 'scroll' || overflowY === 'scroll') {
|
712 |
+
return true;
|
713 |
+
}
|
714 |
+
|
715 |
+
return ($el.innerHeight() < el.scrollHeight ||
|
716 |
+
$el.innerWidth() < el.scrollWidth);
|
717 |
+
};
|
718 |
+
|
719 |
+
Utils.escapeMarkup = function (markup) {
|
720 |
+
var replaceMap = {
|
721 |
+
'\\': '\',
|
722 |
+
'&': '&',
|
723 |
+
'<': '<',
|
724 |
+
'>': '>',
|
725 |
+
'"': '"',
|
726 |
+
'\'': ''',
|
727 |
+
'/': '/'
|
728 |
+
};
|
729 |
+
|
730 |
+
// Do not try to escape the markup if it's not a string
|
731 |
+
if (typeof markup !== 'string') {
|
732 |
+
return markup;
|
733 |
+
}
|
734 |
+
|
735 |
+
return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
|
736 |
+
return replaceMap[match];
|
737 |
+
});
|
738 |
+
};
|
739 |
+
|
740 |
+
// Append an array of jQuery nodes to a given element.
|
741 |
+
Utils.appendMany = function ($element, $nodes) {
|
742 |
+
// jQuery 1.7.x does not support $.fn.append() with an array
|
743 |
+
// Fall back to a jQuery object collection using $.fn.add()
|
744 |
+
if ($.fn.jquery.substr(0, 3) === '1.7') {
|
745 |
+
var $jqNodes = $();
|
746 |
+
|
747 |
+
$.map($nodes, function (node) {
|
748 |
+
$jqNodes = $jqNodes.add(node);
|
749 |
+
});
|
750 |
+
|
751 |
+
$nodes = $jqNodes;
|
752 |
+
}
|
753 |
+
|
754 |
+
$element.append($nodes);
|
755 |
+
};
|
756 |
+
|
757 |
+
return Utils;
|
758 |
+
});
|
759 |
+
|
760 |
+
S2.define('select2/results',[
|
761 |
+
'jquery',
|
762 |
+
'./utils'
|
763 |
+
], function ($, Utils) {
|
764 |
+
function Results ($element, options, dataAdapter) {
|
765 |
+
this.$element = $element;
|
766 |
+
this.data = dataAdapter;
|
767 |
+
this.options = options;
|
768 |
+
|
769 |
+
Results.__super__.constructor.call(this);
|
770 |
+
}
|
771 |
+
|
772 |
+
Utils.Extend(Results, Utils.Observable);
|
773 |
+
|
774 |
+
Results.prototype.render = function () {
|
775 |
+
var $results = $(
|
776 |
+
'<ul class="select2-results__options" role="tree"></ul>'
|
777 |
+
);
|
778 |
+
|
779 |
+
if (this.options.get('multiple')) {
|
780 |
+
$results.attr('aria-multiselectable', 'true');
|
781 |
+
}
|
782 |
+
|
783 |
+
this.$results = $results;
|
784 |
+
|
785 |
+
return $results;
|
786 |
+
};
|
787 |
+
|
788 |
+
Results.prototype.clear = function () {
|
789 |
+
this.$results.empty();
|
790 |
+
};
|
791 |
+
|
792 |
+
Results.prototype.displayMessage = function (params) {
|
793 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
794 |
+
|
795 |
+
this.clear();
|
796 |
+
this.hideLoading();
|
797 |
+
|
798 |
+
var $message = $(
|
799 |
+
'<li role="treeitem" aria-live="assertive"' +
|
800 |
+
' class="select2-results__option"></li>'
|
801 |
+
);
|
802 |
+
|
803 |
+
var message = this.options.get('translations').get(params.message);
|
804 |
+
|
805 |
+
$message.append(
|
806 |
+
escapeMarkup(
|
807 |
+
message(params.args)
|
808 |
+
)
|
809 |
+
);
|
810 |
+
|
811 |
+
$message[0].className += ' select2-results__message';
|
812 |
+
|
813 |
+
this.$results.append($message);
|
814 |
+
};
|
815 |
+
|
816 |
+
Results.prototype.hideMessages = function () {
|
817 |
+
this.$results.find('.select2-results__message').remove();
|
818 |
+
};
|
819 |
+
|
820 |
+
Results.prototype.append = function (data) {
|
821 |
+
this.hideLoading();
|
822 |
+
|
823 |
+
var $options = [];
|
824 |
+
|
825 |
+
if (data.results == null || data.results.length === 0) {
|
826 |
+
if (this.$results.children().length === 0) {
|
827 |
+
this.trigger('results:message', {
|
828 |
+
message: 'noResults'
|
829 |
+
});
|
830 |
+
}
|
831 |
+
|
832 |
+
return;
|
833 |
+
}
|
834 |
+
|
835 |
+
data.results = this.sort(data.results);
|
836 |
+
|
837 |
+
for (var d = 0; d < data.results.length; d++) {
|
838 |
+
var item = data.results[d];
|
839 |
+
|
840 |
+
var $option = this.option(item);
|
841 |
+
|
842 |
+
$options.push($option);
|
843 |
+
}
|
844 |
+
|
845 |
+
this.$results.append($options);
|
846 |
+
};
|
847 |
+
|
848 |
+
Results.prototype.position = function ($results, $dropdown) {
|
849 |
+
var $resultsContainer = $dropdown.find('.select2-results');
|
850 |
+
$resultsContainer.append($results);
|
851 |
+
};
|
852 |
+
|
853 |
+
Results.prototype.sort = function (data) {
|
854 |
+
var sorter = this.options.get('sorter');
|
855 |
+
|
856 |
+
return sorter(data);
|
857 |
+
};
|
858 |
+
|
859 |
+
Results.prototype.highlightFirstItem = function () {
|
860 |
+
var $options = this.$results
|
861 |
+
.find('.select2-results__option[aria-selected]');
|
862 |
+
|
863 |
+
var $selected = $options.filter('[aria-selected=true]');
|
864 |
+
|
865 |
+
// Check if there are any selected options
|
866 |
+
if ($selected.length > 0) {
|
867 |
+
// If there are selected options, highlight the first
|
868 |
+
$selected.first().trigger('mouseenter');
|
869 |
+
} else {
|
870 |
+
// If there are no selected options, highlight the first option
|
871 |
+
// in the dropdown
|
872 |
+
$options.first().trigger('mouseenter');
|
873 |
+
}
|
874 |
+
|
875 |
+
this.ensureHighlightVisible();
|
876 |
+
};
|
877 |
+
|
878 |
+
Results.prototype.setClasses = function () {
|
879 |
+
var self = this;
|
880 |
+
|
881 |
+
this.data.current(function (selected) {
|
882 |
+
var selectedIds = $.map(selected, function (s) {
|
883 |
+
return s.id.toString();
|
884 |
+
});
|
885 |
+
|
886 |
+
var $options = self.$results
|
887 |
+
.find('.select2-results__option[aria-selected]');
|
888 |
+
|
889 |
+
$options.each(function () {
|
890 |
+
var $option = $(this);
|
891 |
+
|
892 |
+
var item = $.data(this, 'data');
|
893 |
+
|
894 |
+
// id needs to be converted to a string when comparing
|
895 |
+
var id = '' + item.id;
|
896 |
+
|
897 |
+
if ((item.element != null && item.element.selected) ||
|
898 |
+
(item.element == null && $.inArray(id, selectedIds) > -1)) {
|
899 |
+
$option.attr('aria-selected', 'true');
|
900 |
+
} else {
|
901 |
+
$option.attr('aria-selected', 'false');
|
902 |
+
}
|
903 |
+
});
|
904 |
+
|
905 |
+
});
|
906 |
+
};
|
907 |
+
|
908 |
+
Results.prototype.showLoading = function (params) {
|
909 |
+
this.hideLoading();
|
910 |
+
|
911 |
+
var loadingMore = this.options.get('translations').get('searching');
|
912 |
+
|
913 |
+
var loading = {
|
914 |
+
disabled: true,
|
915 |
+
loading: true,
|
916 |
+
text: loadingMore(params)
|
917 |
+
};
|
918 |
+
var $loading = this.option(loading);
|
919 |
+
$loading.className += ' loading-results';
|
920 |
+
|
921 |
+
this.$results.prepend($loading);
|
922 |
+
};
|
923 |
+
|
924 |
+
Results.prototype.hideLoading = function () {
|
925 |
+
this.$results.find('.loading-results').remove();
|
926 |
+
};
|
927 |
+
|
928 |
+
Results.prototype.option = function (data) {
|
929 |
+
var option = document.createElement('li');
|
930 |
+
option.className = 'select2-results__option';
|
931 |
+
|
932 |
+
var attrs = {
|
933 |
+
'role': 'treeitem',
|
934 |
+
'aria-selected': 'false'
|
935 |
+
};
|
936 |
+
|
937 |
+
if (data.disabled) {
|
938 |
+
delete attrs['aria-selected'];
|
939 |
+
attrs['aria-disabled'] = 'true';
|
940 |
+
}
|
941 |
+
|
942 |
+
if (data.id == null) {
|
943 |
+
delete attrs['aria-selected'];
|
944 |
+
}
|
945 |
+
|
946 |
+
if (data._resultId != null) {
|
947 |
+
option.id = data._resultId;
|
948 |
+
}
|
949 |
+
|
950 |
+
if (data.title) {
|
951 |
+
option.title = data.title;
|
952 |
+
}
|
953 |
+
|
954 |
+
if (data.children) {
|
955 |
+
attrs.role = 'group';
|
956 |
+
attrs['aria-label'] = data.text;
|
957 |
+
delete attrs['aria-selected'];
|
958 |
+
}
|
959 |
+
|
960 |
+
for (var attr in attrs) {
|
961 |
+
var val = attrs[attr];
|
962 |
+
|
963 |
+
option.setAttribute(attr, val);
|
964 |
+
}
|
965 |
+
|
966 |
+
if (data.children) {
|
967 |
+
var $option = $(option);
|
968 |
+
|
969 |
+
var label = document.createElement('strong');
|
970 |
+
label.className = 'select2-results__group';
|
971 |
+
|
972 |
+
var $label = $(label);
|
973 |
+
this.template(data, label);
|
974 |
+
|
975 |
+
var $children = [];
|
976 |
+
|
977 |
+
for (var c = 0; c < data.children.length; c++) {
|
978 |
+
var child = data.children[c];
|
979 |
+
|
980 |
+
var $child = this.option(child);
|
981 |
+
|
982 |
+
$children.push($child);
|
983 |
+
}
|
984 |
+
|
985 |
+
var $childrenContainer = $('<ul></ul>', {
|
986 |
+
'class': 'select2-results__options select2-results__options--nested'
|
987 |
+
});
|
988 |
+
|
989 |
+
$childrenContainer.append($children);
|
990 |
+
|
991 |
+
$option.append(label);
|
992 |
+
$option.append($childrenContainer);
|
993 |
+
} else {
|
994 |
+
this.template(data, option);
|
995 |
+
}
|
996 |
+
|
997 |
+
$.data(option, 'data', data);
|
998 |
+
|
999 |
+
return option;
|
1000 |
+
};
|
1001 |
+
|
1002 |
+
Results.prototype.bind = function (container, $container) {
|
1003 |
+
var self = this;
|
1004 |
+
|
1005 |
+
var id = container.id + '-results';
|
1006 |
+
|
1007 |
+
this.$results.attr('id', id);
|
1008 |
+
|
1009 |
+
container.on('results:all', function (params) {
|
1010 |
+
self.clear();
|
1011 |
+
self.append(params.data);
|
1012 |
+
|
1013 |
+
if (container.isOpen()) {
|
1014 |
+
self.setClasses();
|
1015 |
+
self.highlightFirstItem();
|
1016 |
+
}
|
1017 |
+
});
|
1018 |
+
|
1019 |
+
container.on('results:append', function (params) {
|
1020 |
+
self.append(params.data);
|
1021 |
+
|
1022 |
+
if (container.isOpen()) {
|
1023 |
+
self.setClasses();
|
1024 |
+
}
|
1025 |
+
});
|
1026 |
+
|
1027 |
+
container.on('query', function (params) {
|
1028 |
+
self.hideMessages();
|
1029 |
+
self.showLoading(params);
|
1030 |
+
});
|
1031 |
+
|
1032 |
+
container.on('select', function () {
|
1033 |
+
if (!container.isOpen()) {
|
1034 |
+
return;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
self.setClasses();
|
1038 |
+
self.highlightFirstItem();
|
1039 |
+
});
|
1040 |
+
|
1041 |
+
container.on('unselect', function () {
|
1042 |
+
if (!container.isOpen()) {
|
1043 |
+
return;
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
self.setClasses();
|
1047 |
+
self.highlightFirstItem();
|
1048 |
+
});
|
1049 |
+
|
1050 |
+
container.on('open', function () {
|
1051 |
+
// When the dropdown is open, aria-expended="true"
|
1052 |
+
self.$results.attr('aria-expanded', 'true');
|
1053 |
+
self.$results.attr('aria-hidden', 'false');
|
1054 |
+
|
1055 |
+
self.setClasses();
|
1056 |
+
self.ensureHighlightVisible();
|
1057 |
+
});
|
1058 |
+
|
1059 |
+
container.on('close', function () {
|
1060 |
+
// When the dropdown is closed, aria-expended="false"
|
1061 |
+
self.$results.attr('aria-expanded', 'false');
|
1062 |
+
self.$results.attr('aria-hidden', 'true');
|
1063 |
+
self.$results.removeAttr('aria-activedescendant');
|
1064 |
+
});
|
1065 |
+
|
1066 |
+
container.on('results:toggle', function () {
|
1067 |
+
var $highlighted = self.getHighlightedResults();
|
1068 |
+
|
1069 |
+
if ($highlighted.length === 0) {
|
1070 |
+
return;
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
$highlighted.trigger('mouseup');
|
1074 |
+
});
|
1075 |
+
|
1076 |
+
container.on('results:select', function () {
|
1077 |
+
var $highlighted = self.getHighlightedResults();
|
1078 |
+
|
1079 |
+
if ($highlighted.length === 0) {
|
1080 |
+
return;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
var data = $highlighted.data('data');
|
1084 |
+
|
1085 |
+
if ($highlighted.attr('aria-selected') == 'true') {
|
1086 |
+
self.trigger('close', {});
|
1087 |
+
} else {
|
1088 |
+
self.trigger('select', {
|
1089 |
+
data: data
|
1090 |
+
});
|
1091 |
+
}
|
1092 |
+
});
|
1093 |
+
|
1094 |
+
container.on('results:previous', function () {
|
1095 |
+
var $highlighted = self.getHighlightedResults();
|
1096 |
+
|
1097 |
+
var $options = self.$results.find('[aria-selected]');
|
1098 |
+
|
1099 |
+
var currentIndex = $options.index($highlighted);
|
1100 |
+
|
1101 |
+
// If we are already at te top, don't move further
|
1102 |
+
if (currentIndex === 0) {
|
1103 |
+
return;
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
var nextIndex = currentIndex - 1;
|
1107 |
+
|
1108 |
+
// If none are highlighted, highlight the first
|
1109 |
+
if ($highlighted.length === 0) {
|
1110 |
+
nextIndex = 0;
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
var $next = $options.eq(nextIndex);
|
1114 |
+
|
1115 |
+
$next.trigger('mouseenter');
|
1116 |
+
|
1117 |
+
var currentOffset = self.$results.offset().top;
|
1118 |
+
var nextTop = $next.offset().top;
|
1119 |
+
var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
|
1120 |
+
|
1121 |
+
if (nextIndex === 0) {
|
1122 |
+
self.$results.scrollTop(0);
|
1123 |
+
} else if (nextTop - currentOffset < 0) {
|
1124 |
+
self.$results.scrollTop(nextOffset);
|
1125 |
+
}
|
1126 |
+
});
|
1127 |
+
|
1128 |
+
container.on('results:next', function () {
|
1129 |
+
var $highlighted = self.getHighlightedResults();
|
1130 |
+
|
1131 |
+
var $options = self.$results.find('[aria-selected]');
|
1132 |
+
|
1133 |
+
var currentIndex = $options.index($highlighted);
|
1134 |
+
|
1135 |
+
var nextIndex = currentIndex + 1;
|
1136 |
+
|
1137 |
+
// If we are at the last option, stay there
|
1138 |
+
if (nextIndex >= $options.length) {
|
1139 |
+
return;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
var $next = $options.eq(nextIndex);
|
1143 |
+
|
1144 |
+
$next.trigger('mouseenter');
|
1145 |
+
|
1146 |
+
var currentOffset = self.$results.offset().top +
|
1147 |
+
self.$results.outerHeight(false);
|
1148 |
+
var nextBottom = $next.offset().top + $next.outerHeight(false);
|
1149 |
+
var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
|
1150 |
+
|
1151 |
+
if (nextIndex === 0) {
|
1152 |
+
self.$results.scrollTop(0);
|
1153 |
+
} else if (nextBottom > currentOffset) {
|
1154 |
+
self.$results.scrollTop(nextOffset);
|
1155 |
+
}
|
1156 |
+
});
|
1157 |
+
|
1158 |
+
container.on('results:focus', function (params) {
|
1159 |
+
params.element.addClass('select2-results__option--highlighted');
|
1160 |
+
});
|
1161 |
+
|
1162 |
+
container.on('results:message', function (params) {
|
1163 |
+
self.displayMessage(params);
|
1164 |
+
});
|
1165 |
+
|
1166 |
+
if ($.fn.mousewheel) {
|
1167 |
+
this.$results.on('mousewheel', function (e) {
|
1168 |
+
var top = self.$results.scrollTop();
|
1169 |
+
|
1170 |
+
var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
|
1171 |
+
|
1172 |
+
var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
|
1173 |
+
var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
|
1174 |
+
|
1175 |
+
if (isAtTop) {
|
1176 |
+
self.$results.scrollTop(0);
|
1177 |
+
|
1178 |
+
e.preventDefault();
|
1179 |
+
e.stopPropagation();
|
1180 |
+
} else if (isAtBottom) {
|
1181 |
+
self.$results.scrollTop(
|
1182 |
+
self.$results.get(0).scrollHeight - self.$results.height()
|
1183 |
+
);
|
1184 |
+
|
1185 |
+
e.preventDefault();
|
1186 |
+
e.stopPropagation();
|
1187 |
+
}
|
1188 |
+
});
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
this.$results.on('mouseup', '.select2-results__option[aria-selected]',
|
1192 |
+
function (evt) {
|
1193 |
+
var $this = $(this);
|
1194 |
+
|
1195 |
+
var data = $this.data('data');
|
1196 |
+
|
1197 |
+
if ($this.attr('aria-selected') === 'true') {
|
1198 |
+
if (self.options.get('multiple')) {
|
1199 |
+
self.trigger('unselect', {
|
1200 |
+
originalEvent: evt,
|
1201 |
+
data: data
|
1202 |
+
});
|
1203 |
+
} else {
|
1204 |
+
self.trigger('close', {});
|
1205 |
+
}
|
1206 |
+
|
1207 |
+
return;
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
self.trigger('select', {
|
1211 |
+
originalEvent: evt,
|
1212 |
+
data: data
|
1213 |
+
});
|
1214 |
+
});
|
1215 |
+
|
1216 |
+
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
|
1217 |
+
function (evt) {
|
1218 |
+
var data = $(this).data('data');
|
1219 |
+
|
1220 |
+
self.getHighlightedResults()
|
1221 |
+
.removeClass('select2-results__option--highlighted');
|
1222 |
+
|
1223 |
+
self.trigger('results:focus', {
|
1224 |
+
data: data,
|
1225 |
+
element: $(this)
|
1226 |
+
});
|
1227 |
+
});
|
1228 |
+
};
|
1229 |
+
|
1230 |
+
Results.prototype.getHighlightedResults = function () {
|
1231 |
+
var $highlighted = this.$results
|
1232 |
+
.find('.select2-results__option--highlighted');
|
1233 |
+
|
1234 |
+
return $highlighted;
|
1235 |
+
};
|
1236 |
+
|
1237 |
+
Results.prototype.destroy = function () {
|
1238 |
+
this.$results.remove();
|
1239 |
+
};
|
1240 |
+
|
1241 |
+
Results.prototype.ensureHighlightVisible = function () {
|
1242 |
+
var $highlighted = this.getHighlightedResults();
|
1243 |
+
|
1244 |
+
if ($highlighted.length === 0) {
|
1245 |
+
return;
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
var $options = this.$results.find('[aria-selected]');
|
1249 |
+
|
1250 |
+
var currentIndex = $options.index($highlighted);
|
1251 |
+
|
1252 |
+
var currentOffset = this.$results.offset().top;
|
1253 |
+
var nextTop = $highlighted.offset().top;
|
1254 |
+
var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
|
1255 |
+
|
1256 |
+
var offsetDelta = nextTop - currentOffset;
|
1257 |
+
nextOffset -= $highlighted.outerHeight(false) * 2;
|
1258 |
+
|
1259 |
+
if (currentIndex <= 2) {
|
1260 |
+
this.$results.scrollTop(0);
|
1261 |
+
} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
|
1262 |
+
this.$results.scrollTop(nextOffset);
|
1263 |
+
}
|
1264 |
+
};
|
1265 |
+
|
1266 |
+
Results.prototype.template = function (result, container) {
|
1267 |
+
var template = this.options.get('templateResult');
|
1268 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1269 |
+
|
1270 |
+
var content = template(result, container);
|
1271 |
+
|
1272 |
+
if (content == null) {
|
1273 |
+
container.style.display = 'none';
|
1274 |
+
} else if (typeof content === 'string') {
|
1275 |
+
container.innerHTML = escapeMarkup(content);
|
1276 |
+
} else {
|
1277 |
+
$(container).append(content);
|
1278 |
+
}
|
1279 |
+
};
|
1280 |
+
|
1281 |
+
return Results;
|
1282 |
+
});
|
1283 |
+
|
1284 |
+
S2.define('select2/keys',[
|
1285 |
+
|
1286 |
+
], function () {
|
1287 |
+
var KEYS = {
|
1288 |
+
BACKSPACE: 8,
|
1289 |
+
TAB: 9,
|
1290 |
+
ENTER: 13,
|
1291 |
+
SHIFT: 16,
|
1292 |
+
CTRL: 17,
|
1293 |
+
ALT: 18,
|
1294 |
+
ESC: 27,
|
1295 |
+
SPACE: 32,
|
1296 |
+
PAGE_UP: 33,
|
1297 |
+
PAGE_DOWN: 34,
|
1298 |
+
END: 35,
|
1299 |
+
HOME: 36,
|
1300 |
+
LEFT: 37,
|
1301 |
+
UP: 38,
|
1302 |
+
RIGHT: 39,
|
1303 |
+
DOWN: 40,
|
1304 |
+
DELETE: 46
|
1305 |
+
};
|
1306 |
+
|
1307 |
+
return KEYS;
|
1308 |
+
});
|
1309 |
+
|
1310 |
+
S2.define('select2/selection/base',[
|
1311 |
+
'jquery',
|
1312 |
+
'../utils',
|
1313 |
+
'../keys'
|
1314 |
+
], function ($, Utils, KEYS) {
|
1315 |
+
function BaseSelection ($element, options) {
|
1316 |
+
this.$element = $element;
|
1317 |
+
this.options = options;
|
1318 |
+
|
1319 |
+
BaseSelection.__super__.constructor.call(this);
|
1320 |
+
}
|
1321 |
+
|
1322 |
+
Utils.Extend(BaseSelection, Utils.Observable);
|
1323 |
+
|
1324 |
+
BaseSelection.prototype.render = function () {
|
1325 |
+
var $selection = $(
|
1326 |
+
'<span class="select2-selection" role="combobox" ' +
|
1327 |
+
' aria-haspopup="true" aria-expanded="false">' +
|
1328 |
+
'</span>'
|
1329 |
+
);
|
1330 |
+
|
1331 |
+
this._tabindex = 0;
|
1332 |
+
|
1333 |
+
if (this.$element.data('old-tabindex') != null) {
|
1334 |
+
this._tabindex = this.$element.data('old-tabindex');
|
1335 |
+
} else if (this.$element.attr('tabindex') != null) {
|
1336 |
+
this._tabindex = this.$element.attr('tabindex');
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
$selection.attr('title', this.$element.attr('title'));
|
1340 |
+
$selection.attr('tabindex', this._tabindex);
|
1341 |
+
|
1342 |
+
this.$selection = $selection;
|
1343 |
+
|
1344 |
+
return $selection;
|
1345 |
+
};
|
1346 |
+
|
1347 |
+
BaseSelection.prototype.bind = function (container, $container) {
|
1348 |
+
var self = this;
|
1349 |
+
|
1350 |
+
var id = container.id + '-container';
|
1351 |
+
var resultsId = container.id + '-results';
|
1352 |
+
|
1353 |
+
this.container = container;
|
1354 |
+
|
1355 |
+
this.$selection.on('focus', function (evt) {
|
1356 |
+
self.trigger('focus', evt);
|
1357 |
+
});
|
1358 |
+
|
1359 |
+
this.$selection.on('blur', function (evt) {
|
1360 |
+
self._handleBlur(evt);
|
1361 |
+
});
|
1362 |
+
|
1363 |
+
this.$selection.on('keydown', function (evt) {
|
1364 |
+
self.trigger('keypress', evt);
|
1365 |
+
|
1366 |
+
if (evt.which === KEYS.SPACE) {
|
1367 |
+
evt.preventDefault();
|
1368 |
+
}
|
1369 |
+
});
|
1370 |
+
|
1371 |
+
container.on('results:focus', function (params) {
|
1372 |
+
self.$selection.attr('aria-activedescendant', params.data._resultId);
|
1373 |
+
});
|
1374 |
+
|
1375 |
+
container.on('selection:update', function (params) {
|
1376 |
+
self.update(params.data);
|
1377 |
+
});
|
1378 |
+
|
1379 |
+
container.on('open', function () {
|
1380 |
+
// When the dropdown is open, aria-expanded="true"
|
1381 |
+
self.$selection.attr('aria-expanded', 'true');
|
1382 |
+
self.$selection.attr('aria-owns', resultsId);
|
1383 |
+
|
1384 |
+
self._attachCloseHandler(container);
|
1385 |
+
});
|
1386 |
+
|
1387 |
+
container.on('close', function () {
|
1388 |
+
// When the dropdown is closed, aria-expanded="false"
|
1389 |
+
self.$selection.attr('aria-expanded', 'false');
|
1390 |
+
self.$selection.removeAttr('aria-activedescendant');
|
1391 |
+
self.$selection.removeAttr('aria-owns');
|
1392 |
+
|
1393 |
+
self.$selection.focus();
|
1394 |
+
|
1395 |
+
self._detachCloseHandler(container);
|
1396 |
+
});
|
1397 |
+
|
1398 |
+
container.on('enable', function () {
|
1399 |
+
self.$selection.attr('tabindex', self._tabindex);
|
1400 |
+
});
|
1401 |
+
|
1402 |
+
container.on('disable', function () {
|
1403 |
+
self.$selection.attr('tabindex', '-1');
|
1404 |
+
});
|
1405 |
+
};
|
1406 |
+
|
1407 |
+
BaseSelection.prototype._handleBlur = function (evt) {
|
1408 |
+
var self = this;
|
1409 |
+
|
1410 |
+
// This needs to be delayed as the active element is the body when the tab
|
1411 |
+
// key is pressed, possibly along with others.
|
1412 |
+
window.setTimeout(function () {
|
1413 |
+
// Don't trigger `blur` if the focus is still in the selection
|
1414 |
+
if (
|
1415 |
+
(document.activeElement == self.$selection[0]) ||
|
1416 |
+
($.contains(self.$selection[0], document.activeElement))
|
1417 |
+
) {
|
1418 |
+
return;
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
self.trigger('blur', evt);
|
1422 |
+
}, 1);
|
1423 |
+
};
|
1424 |
+
|
1425 |
+
BaseSelection.prototype._attachCloseHandler = function (container) {
|
1426 |
+
var self = this;
|
1427 |
+
|
1428 |
+
$(document.body).on('mousedown.select2.' + container.id, function (e) {
|
1429 |
+
var $target = $(e.target);
|
1430 |
+
|
1431 |
+
var $select = $target.closest('.select2');
|
1432 |
+
|
1433 |
+
var $all = $('.select2.select2-container--open');
|
1434 |
+
|
1435 |
+
$all.each(function () {
|
1436 |
+
var $this = $(this);
|
1437 |
+
|
1438 |
+
if (this == $select[0]) {
|
1439 |
+
return;
|
1440 |
+
}
|
1441 |
+
|
1442 |
+
var $element = $this.data('element');
|
1443 |
+
|
1444 |
+
$element.select2('close');
|
1445 |
+
});
|
1446 |
+
});
|
1447 |
+
};
|
1448 |
+
|
1449 |
+
BaseSelection.prototype._detachCloseHandler = function (container) {
|
1450 |
+
$(document.body).off('mousedown.select2.' + container.id);
|
1451 |
+
};
|
1452 |
+
|
1453 |
+
BaseSelection.prototype.position = function ($selection, $container) {
|
1454 |
+
var $selectionContainer = $container.find('.selection');
|
1455 |
+
$selectionContainer.append($selection);
|
1456 |
+
};
|
1457 |
+
|
1458 |
+
BaseSelection.prototype.destroy = function () {
|
1459 |
+
this._detachCloseHandler(this.container);
|
1460 |
+
};
|
1461 |
+
|
1462 |
+
BaseSelection.prototype.update = function (data) {
|
1463 |
+
throw new Error('The `update` method must be defined in child classes.');
|
1464 |
+
};
|
1465 |
+
|
1466 |
+
return BaseSelection;
|
1467 |
+
});
|
1468 |
+
|
1469 |
+
S2.define('select2/selection/single',[
|
1470 |
+
'jquery',
|
1471 |
+
'./base',
|
1472 |
+
'../utils',
|
1473 |
+
'../keys'
|
1474 |
+
], function ($, BaseSelection, Utils, KEYS) {
|
1475 |
+
function SingleSelection () {
|
1476 |
+
SingleSelection.__super__.constructor.apply(this, arguments);
|
1477 |
+
}
|
1478 |
+
|
1479 |
+
Utils.Extend(SingleSelection, BaseSelection);
|
1480 |
+
|
1481 |
+
SingleSelection.prototype.render = function () {
|
1482 |
+
var $selection = SingleSelection.__super__.render.call(this);
|
1483 |
+
|
1484 |
+
$selection.addClass('select2-selection--single');
|
1485 |
+
|
1486 |
+
$selection.html(
|
1487 |
+
'<span class="select2-selection__rendered"></span>' +
|
1488 |
+
'<span class="select2-selection__arrow" role="presentation">' +
|
1489 |
+
'<b role="presentation"></b>' +
|
1490 |
+
'</span>'
|
1491 |
+
);
|
1492 |
+
|
1493 |
+
return $selection;
|
1494 |
+
};
|
1495 |
+
|
1496 |
+
SingleSelection.prototype.bind = function (container, $container) {
|
1497 |
+
var self = this;
|
1498 |
+
|
1499 |
+
SingleSelection.__super__.bind.apply(this, arguments);
|
1500 |
+
|
1501 |
+
var id = container.id + '-container';
|
1502 |
+
|
1503 |
+
this.$selection.find('.select2-selection__rendered').attr('id', id);
|
1504 |
+
this.$selection.attr('aria-labelledby', id);
|
1505 |
+
|
1506 |
+
this.$selection.on('mousedown', function (evt) {
|
1507 |
+
// Only respond to left clicks
|
1508 |
+
if (evt.which !== 1) {
|
1509 |
+
return;
|
1510 |
+
}
|
1511 |
+
|
1512 |
+
self.trigger('toggle', {
|
1513 |
+
originalEvent: evt
|
1514 |
+
});
|
1515 |
+
});
|
1516 |
+
|
1517 |
+
this.$selection.on('focus', function (evt) {
|
1518 |
+
// User focuses on the container
|
1519 |
+
});
|
1520 |
+
|
1521 |
+
this.$selection.on('blur', function (evt) {
|
1522 |
+
// User exits the container
|
1523 |
+
});
|
1524 |
+
|
1525 |
+
container.on('focus', function (evt) {
|
1526 |
+
if (!container.isOpen()) {
|
1527 |
+
self.$selection.focus();
|
1528 |
+
}
|
1529 |
+
});
|
1530 |
+
|
1531 |
+
container.on('selection:update', function (params) {
|
1532 |
+
self.update(params.data);
|
1533 |
+
});
|
1534 |
+
};
|
1535 |
+
|
1536 |
+
SingleSelection.prototype.clear = function () {
|
1537 |
+
this.$selection.find('.select2-selection__rendered').empty();
|
1538 |
+
};
|
1539 |
+
|
1540 |
+
SingleSelection.prototype.display = function (data, container) {
|
1541 |
+
var template = this.options.get('templateSelection');
|
1542 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1543 |
+
|
1544 |
+
return escapeMarkup(template(data, container));
|
1545 |
+
};
|
1546 |
+
|
1547 |
+
SingleSelection.prototype.selectionContainer = function () {
|
1548 |
+
return $('<span></span>');
|
1549 |
+
};
|
1550 |
+
|
1551 |
+
SingleSelection.prototype.update = function (data) {
|
1552 |
+
if (data.length === 0) {
|
1553 |
+
this.clear();
|
1554 |
+
return;
|
1555 |
+
}
|
1556 |
+
|
1557 |
+
var selection = data[0];
|
1558 |
+
|
1559 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1560 |
+
var formatted = this.display(selection, $rendered);
|
1561 |
+
|
1562 |
+
$rendered.empty().append(formatted);
|
1563 |
+
$rendered.prop('title', selection.title || selection.text);
|
1564 |
+
};
|
1565 |
+
|
1566 |
+
return SingleSelection;
|
1567 |
+
});
|
1568 |
+
|
1569 |
+
S2.define('select2/selection/multiple',[
|
1570 |
+
'jquery',
|
1571 |
+
'./base',
|
1572 |
+
'../utils'
|
1573 |
+
], function ($, BaseSelection, Utils) {
|
1574 |
+
function MultipleSelection ($element, options) {
|
1575 |
+
MultipleSelection.__super__.constructor.apply(this, arguments);
|
1576 |
+
}
|
1577 |
+
|
1578 |
+
Utils.Extend(MultipleSelection, BaseSelection);
|
1579 |
+
|
1580 |
+
MultipleSelection.prototype.render = function () {
|
1581 |
+
var $selection = MultipleSelection.__super__.render.call(this);
|
1582 |
+
|
1583 |
+
$selection.addClass('select2-selection--multiple');
|
1584 |
+
|
1585 |
+
$selection.html(
|
1586 |
+
'<ul class="select2-selection__rendered"></ul>'
|
1587 |
+
);
|
1588 |
+
|
1589 |
+
return $selection;
|
1590 |
+
};
|
1591 |
+
|
1592 |
+
MultipleSelection.prototype.bind = function (container, $container) {
|
1593 |
+
var self = this;
|
1594 |
+
|
1595 |
+
MultipleSelection.__super__.bind.apply(this, arguments);
|
1596 |
+
|
1597 |
+
this.$selection.on('click', function (evt) {
|
1598 |
+
self.trigger('toggle', {
|
1599 |
+
originalEvent: evt
|
1600 |
+
});
|
1601 |
+
});
|
1602 |
+
|
1603 |
+
this.$selection.on(
|
1604 |
+
'click',
|
1605 |
+
'.select2-selection__choice__remove',
|
1606 |
+
function (evt) {
|
1607 |
+
// Ignore the event if it is disabled
|
1608 |
+
if (self.options.get('disabled')) {
|
1609 |
+
return;
|
1610 |
+
}
|
1611 |
+
|
1612 |
+
var $remove = $(this);
|
1613 |
+
var $selection = $remove.parent();
|
1614 |
+
|
1615 |
+
var data = $selection.data('data');
|
1616 |
+
|
1617 |
+
self.trigger('unselect', {
|
1618 |
+
originalEvent: evt,
|
1619 |
+
data: data
|
1620 |
+
});
|
1621 |
+
}
|
1622 |
+
);
|
1623 |
+
};
|
1624 |
+
|
1625 |
+
MultipleSelection.prototype.clear = function () {
|
1626 |
+
this.$selection.find('.select2-selection__rendered').empty();
|
1627 |
+
};
|
1628 |
+
|
1629 |
+
MultipleSelection.prototype.display = function (data, container) {
|
1630 |
+
var template = this.options.get('templateSelection');
|
1631 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1632 |
+
|
1633 |
+
return escapeMarkup(template(data, container));
|
1634 |
+
};
|
1635 |
+
|
1636 |
+
MultipleSelection.prototype.selectionContainer = function () {
|
1637 |
+
var $container = $(
|
1638 |
+
'<li class="select2-selection__choice">' +
|
1639 |
+
'<span class="select2-selection__choice__remove" role="presentation">' +
|
1640 |
+
'×' +
|
1641 |
+
'</span>' +
|
1642 |
+
'</li>'
|
1643 |
+
);
|
1644 |
+
|
1645 |
+
return $container;
|
1646 |
+
};
|
1647 |
+
|
1648 |
+
MultipleSelection.prototype.update = function (data) {
|
1649 |
+
this.clear();
|
1650 |
+
|
1651 |
+
if (data.length === 0) {
|
1652 |
+
return;
|
1653 |
+
}
|
1654 |
+
|
1655 |
+
var $selections = [];
|
1656 |
+
|
1657 |
+
for (var d = 0; d < data.length; d++) {
|
1658 |
+
var selection = data[d];
|
1659 |
+
|
1660 |
+
var $selection = this.selectionContainer();
|
1661 |
+
var formatted = this.display(selection, $selection);
|
1662 |
+
|
1663 |
+
$selection.append(formatted);
|
1664 |
+
$selection.prop('title', selection.title || selection.text);
|
1665 |
+
|
1666 |
+
$selection.data('data', selection);
|
1667 |
+
|
1668 |
+
$selections.push($selection);
|
1669 |
+
}
|
1670 |
+
|
1671 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1672 |
+
|
1673 |
+
Utils.appendMany($rendered, $selections);
|
1674 |
+
};
|
1675 |
+
|
1676 |
+
return MultipleSelection;
|
1677 |
+
});
|
1678 |
+
|
1679 |
+
S2.define('select2/selection/placeholder',[
|
1680 |
+
'../utils'
|
1681 |
+
], function (Utils) {
|
1682 |
+
function Placeholder (decorated, $element, options) {
|
1683 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
1684 |
+
|
1685 |
+
decorated.call(this, $element, options);
|
1686 |
+
}
|
1687 |
+
|
1688 |
+
Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
1689 |
+
if (typeof placeholder === 'string') {
|
1690 |
+
placeholder = {
|
1691 |
+
id: '',
|
1692 |
+
text: placeholder
|
1693 |
+
};
|
1694 |
+
}
|
1695 |
+
|
1696 |
+
return placeholder;
|
1697 |
+
};
|
1698 |
+
|
1699 |
+
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
|
1700 |
+
var $placeholder = this.selectionContainer();
|
1701 |
+
|
1702 |
+
$placeholder.html(this.display(placeholder));
|
1703 |
+
$placeholder.addClass('select2-selection__placeholder')
|
1704 |
+
.removeClass('select2-selection__choice');
|
1705 |
+
|
1706 |
+
return $placeholder;
|
1707 |
+
};
|
1708 |
+
|
1709 |
+
Placeholder.prototype.update = function (decorated, data) {
|
1710 |
+
var singlePlaceholder = (
|
1711 |
+
data.length == 1 && data[0].id != this.placeholder.id
|
1712 |
+
);
|
1713 |
+
var multipleSelections = data.length > 1;
|
1714 |
+
|
1715 |
+
if (multipleSelections || singlePlaceholder) {
|
1716 |
+
return decorated.call(this, data);
|
1717 |
+
}
|
1718 |
+
|
1719 |
+
this.clear();
|
1720 |
+
|
1721 |
+
var $placeholder = this.createPlaceholder(this.placeholder);
|
1722 |
+
|
1723 |
+
this.$selection.find('.select2-selection__rendered').append($placeholder);
|
1724 |
+
};
|
1725 |
+
|
1726 |
+
return Placeholder;
|
1727 |
+
});
|
1728 |
+
|
1729 |
+
S2.define('select2/selection/allowClear',[
|
1730 |
+
'jquery',
|
1731 |
+
'../keys'
|
1732 |
+
], function ($, KEYS) {
|
1733 |
+
function AllowClear () { }
|
1734 |
+
|
1735 |
+
AllowClear.prototype.bind = function (decorated, container, $container) {
|
1736 |
+
var self = this;
|
1737 |
+
|
1738 |
+
decorated.call(this, container, $container);
|
1739 |
+
|
1740 |
+
if (this.placeholder == null) {
|
1741 |
+
if (this.options.get('debug') && window.console && console.error) {
|
1742 |
+
console.error(
|
1743 |
+
'Select2: The `allowClear` option should be used in combination ' +
|
1744 |
+
'with the `placeholder` option.'
|
1745 |
+
);
|
1746 |
+
}
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
this.$selection.on('mousedown', '.select2-selection__clear',
|
1750 |
+
function (evt) {
|
1751 |
+
self._handleClear(evt);
|
1752 |
+
});
|
1753 |
+
|
1754 |
+
container.on('keypress', function (evt) {
|
1755 |
+
self._handleKeyboardClear(evt, container);
|
1756 |
+
});
|
1757 |
+
};
|
1758 |
+
|
1759 |
+
AllowClear.prototype._handleClear = function (_, evt) {
|
1760 |
+
// Ignore the event if it is disabled
|
1761 |
+
if (this.options.get('disabled')) {
|
1762 |
+
return;
|
1763 |
+
}
|
1764 |
+
|
1765 |
+
var $clear = this.$selection.find('.select2-selection__clear');
|
1766 |
+
|
1767 |
+
// Ignore the event if nothing has been selected
|
1768 |
+
if ($clear.length === 0) {
|
1769 |
+
return;
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
evt.stopPropagation();
|
1773 |
+
|
1774 |
+
var data = $clear.data('data');
|
1775 |
+
|
1776 |
+
for (var d = 0; d < data.length; d++) {
|
1777 |
+
var unselectData = {
|
1778 |
+
data: data[d]
|
1779 |
+
};
|
1780 |
+
|
1781 |
+
// Trigger the `unselect` event, so people can prevent it from being
|
1782 |
+
// cleared.
|
1783 |
+
this.trigger('unselect', unselectData);
|
1784 |
+
|
1785 |
+
// If the event was prevented, don't clear it out.
|
1786 |
+
if (unselectData.prevented) {
|
1787 |
+
return;
|
1788 |
+
}
|
1789 |
+
}
|
1790 |
+
|
1791 |
+
this.$element.val(this.placeholder.id).trigger('change');
|
1792 |
+
|
1793 |
+
this.trigger('toggle', {});
|
1794 |
+
};
|
1795 |
+
|
1796 |
+
AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
|
1797 |
+
if (container.isOpen()) {
|
1798 |
+
return;
|
1799 |
+
}
|
1800 |
+
|
1801 |
+
if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
|
1802 |
+
this._handleClear(evt);
|
1803 |
+
}
|
1804 |
+
};
|
1805 |
+
|
1806 |
+
AllowClear.prototype.update = function (decorated, data) {
|
1807 |
+
decorated.call(this, data);
|
1808 |
+
|
1809 |
+
if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
|
1810 |
+
data.length === 0) {
|
1811 |
+
return;
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
var $remove = $(
|
1815 |
+
'<span class="select2-selection__clear">' +
|
1816 |
+
'×' +
|
1817 |
+
'</span>'
|
1818 |
+
);
|
1819 |
+
$remove.data('data', data);
|
1820 |
+
|
1821 |
+
this.$selection.find('.select2-selection__rendered').prepend($remove);
|
1822 |
+
};
|
1823 |
+
|
1824 |
+
return AllowClear;
|
1825 |
+
});
|
1826 |
+
|
1827 |
+
S2.define('select2/selection/search',[
|
1828 |
+
'jquery',
|
1829 |
+
'../utils',
|
1830 |
+
'../keys'
|
1831 |
+
], function ($, Utils, KEYS) {
|
1832 |
+
function Search (decorated, $element, options) {
|
1833 |
+
decorated.call(this, $element, options);
|
1834 |
+
}
|
1835 |
+
|
1836 |
+
Search.prototype.render = function (decorated) {
|
1837 |
+
var $search = $(
|
1838 |
+
'<li class="select2-search select2-search--inline">' +
|
1839 |
+
'<input class="select2-search__field" type="search" tabindex="-1"' +
|
1840 |
+
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
|
1841 |
+
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
|
1842 |
+
'</li>'
|
1843 |
+
);
|
1844 |
+
|
1845 |
+
this.$searchContainer = $search;
|
1846 |
+
this.$search = $search.find('input');
|
1847 |
+
|
1848 |
+
var $rendered = decorated.call(this);
|
1849 |
+
|
1850 |
+
this._transferTabIndex();
|
1851 |
+
|
1852 |
+
return $rendered;
|
1853 |
+
};
|
1854 |
+
|
1855 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
1856 |
+
var self = this;
|
1857 |
+
|
1858 |
+
decorated.call(this, container, $container);
|
1859 |
+
|
1860 |
+
container.on('open', function () {
|
1861 |
+
self.$search.trigger('focus');
|
1862 |
+
});
|
1863 |
+
|
1864 |
+
container.on('close', function () {
|
1865 |
+
self.$search.val('');
|
1866 |
+
self.$search.removeAttr('aria-activedescendant');
|
1867 |
+
self.$search.trigger('focus');
|
1868 |
+
});
|
1869 |
+
|
1870 |
+
container.on('enable', function () {
|
1871 |
+
self.$search.prop('disabled', false);
|
1872 |
+
|
1873 |
+
self._transferTabIndex();
|
1874 |
+
});
|
1875 |
+
|
1876 |
+
container.on('disable', function () {
|
1877 |
+
self.$search.prop('disabled', true);
|
1878 |
+
});
|
1879 |
+
|
1880 |
+
container.on('focus', function (evt) {
|
1881 |
+
self.$search.trigger('focus');
|
1882 |
+
});
|
1883 |
+
|
1884 |
+
container.on('results:focus', function (params) {
|
1885 |
+
self.$search.attr('aria-activedescendant', params.id);
|
1886 |
+
});
|
1887 |
+
|
1888 |
+
this.$selection.on('focusin', '.select2-search--inline', function (evt) {
|
1889 |
+
self.trigger('focus', evt);
|
1890 |
+
});
|
1891 |
+
|
1892 |
+
this.$selection.on('focusout', '.select2-search--inline', function (evt) {
|
1893 |
+
self._handleBlur(evt);
|
1894 |
+
});
|
1895 |
+
|
1896 |
+
this.$selection.on('keydown', '.select2-search--inline', function (evt) {
|
1897 |
+
evt.stopPropagation();
|
1898 |
+
|
1899 |
+
self.trigger('keypress', evt);
|
1900 |
+
|
1901 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
1902 |
+
|
1903 |
+
var key = evt.which;
|
1904 |
+
|
1905 |
+
if (key === KEYS.BACKSPACE && self.$search.val() === '') {
|
1906 |
+
var $previousChoice = self.$searchContainer
|
1907 |
+
.prev('.select2-selection__choice');
|
1908 |
+
|
1909 |
+
if ($previousChoice.length > 0) {
|
1910 |
+
var item = $previousChoice.data('data');
|
1911 |
+
|
1912 |
+
self.searchRemoveChoice(item);
|
1913 |
+
|
1914 |
+
evt.preventDefault();
|
1915 |
+
}
|
1916 |
+
}
|
1917 |
+
});
|
1918 |
+
|
1919 |
+
// Try to detect the IE version should the `documentMode` property that
|
1920 |
+
// is stored on the document. This is only implemented in IE and is
|
1921 |
+
// slightly cleaner than doing a user agent check.
|
1922 |
+
// This property is not available in Edge, but Edge also doesn't have
|
1923 |
+
// this bug.
|
1924 |
+
var msie = document.documentMode;
|
1925 |
+
var disableInputEvents = msie && msie <= 11;
|
1926 |
+
|
1927 |
+
// Workaround for browsers which do not support the `input` event
|
1928 |
+
// This will prevent double-triggering of events for browsers which support
|
1929 |
+
// both the `keyup` and `input` events.
|
1930 |
+
this.$selection.on(
|
1931 |
+
'input.searchcheck',
|
1932 |
+
'.select2-search--inline',
|
1933 |
+
function (evt) {
|
1934 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
1935 |
+
// search box. To get around this issue, we are forced to ignore all
|
1936 |
+
// `input` events in IE and keep using `keyup`.
|
1937 |
+
if (disableInputEvents) {
|
1938 |
+
self.$selection.off('input.search input.searchcheck');
|
1939 |
+
return;
|
1940 |
+
}
|
1941 |
+
|
1942 |
+
// Unbind the duplicated `keyup` event
|
1943 |
+
self.$selection.off('keyup.search');
|
1944 |
+
}
|
1945 |
+
);
|
1946 |
+
|
1947 |
+
this.$selection.on(
|
1948 |
+
'keyup.search input.search',
|
1949 |
+
'.select2-search--inline',
|
1950 |
+
function (evt) {
|
1951 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
1952 |
+
// search box. To get around this issue, we are forced to ignore all
|
1953 |
+
// `input` events in IE and keep using `keyup`.
|
1954 |
+
if (disableInputEvents && evt.type === 'input') {
|
1955 |
+
self.$selection.off('input.search input.searchcheck');
|
1956 |
+
return;
|
1957 |
+
}
|
1958 |
+
|
1959 |
+
var key = evt.which;
|
1960 |
+
|
1961 |
+
// We can freely ignore events from modifier keys
|
1962 |
+
if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
|
1963 |
+
return;
|
1964 |
+
}
|
1965 |
+
|
1966 |
+
// Tabbing will be handled during the `keydown` phase
|
1967 |
+
if (key == KEYS.TAB) {
|
1968 |
+
return;
|
1969 |
+
}
|
1970 |
+
|
1971 |
+
self.handleSearch(evt);
|
1972 |
+
}
|
1973 |
+
);
|
1974 |
+
};
|
1975 |
+
|
1976 |
+
/**
|
1977 |
+
* This method will transfer the tabindex attribute from the rendered
|
1978 |
+
* selection to the search box. This allows for the search box to be used as
|
1979 |
+
* the primary focus instead of the selection container.
|
1980 |
+
*
|
1981 |
+
* @private
|
1982 |
+
*/
|
1983 |
+
Search.prototype._transferTabIndex = function (decorated) {
|
1984 |
+
this.$search.attr('tabindex', this.$selection.attr('tabindex'));
|
1985 |
+
this.$selection.attr('tabindex', '-1');
|
1986 |
+
};
|
1987 |
+
|
1988 |
+
Search.prototype.createPlaceholder = function (decorated, placeholder) {
|
1989 |
+
this.$search.attr('placeholder', placeholder.text);
|
1990 |
+
};
|
1991 |
+
|
1992 |
+
Search.prototype.update = function (decorated, data) {
|
1993 |
+
var searchHadFocus = this.$search[0] == document.activeElement;
|
1994 |
+
|
1995 |
+
this.$search.attr('placeholder', '');
|
1996 |
+
|
1997 |
+
decorated.call(this, data);
|
1998 |
+
|
1999 |
+
this.$selection.find('.select2-selection__rendered')
|
2000 |
+
.append(this.$searchContainer);
|
2001 |
+
|
2002 |
+
this.resizeSearch();
|
2003 |
+
if (searchHadFocus) {
|
2004 |
+
this.$search.focus();
|
2005 |
+
}
|
2006 |
+
};
|
2007 |
+
|
2008 |
+
Search.prototype.handleSearch = function () {
|
2009 |
+
this.resizeSearch();
|
2010 |
+
|
2011 |
+
if (!this._keyUpPrevented) {
|
2012 |
+
var input = this.$search.val();
|
2013 |
+
|
2014 |
+
this.trigger('query', {
|
2015 |
+
term: input
|
2016 |
+
});
|
2017 |
+
}
|
2018 |
+
|
2019 |
+
this._keyUpPrevented = false;
|
2020 |
+
};
|
2021 |
+
|
2022 |
+
Search.prototype.searchRemoveChoice = function (decorated, item) {
|
2023 |
+
this.trigger('unselect', {
|
2024 |
+
data: item
|
2025 |
+
});
|
2026 |
+
|
2027 |
+
this.$search.val(item.text);
|
2028 |
+
this.handleSearch();
|
2029 |
+
};
|
2030 |
+
|
2031 |
+
Search.prototype.resizeSearch = function () {
|
2032 |
+
this.$search.css('width', '25px');
|
2033 |
+
|
2034 |
+
var width = '';
|
2035 |
+
|
2036 |
+
if (this.$search.attr('placeholder') !== '') {
|
2037 |
+
width = '100%';
|
2038 |
+
} else {
|
2039 |
+
var minimumWidth = this.$search.val().length + 1;
|
2040 |
+
|
2041 |
+
width = (minimumWidth * 0.75) + 'em';
|
2042 |
+
}
|
2043 |
+
|
2044 |
+
this.$search.css('width', width);
|
2045 |
+
};
|
2046 |
+
|
2047 |
+
return Search;
|
2048 |
+
});
|
2049 |
+
|
2050 |
+
S2.define('select2/selection/eventRelay',[
|
2051 |
+
'jquery'
|
2052 |
+
], function ($) {
|
2053 |
+
function EventRelay () { }
|
2054 |
+
|
2055 |
+
EventRelay.prototype.bind = function (decorated, container, $container) {
|
2056 |
+
var self = this;
|
2057 |
+
var relayEvents = [
|
2058 |
+
'open', 'opening',
|
2059 |
+
'close', 'closing',
|
2060 |
+
'select', 'selecting',
|
2061 |
+
'unselect', 'unselecting'
|
2062 |
+
];
|
2063 |
+
|
2064 |
+
var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
|
2065 |
+
|
2066 |
+
decorated.call(this, container, $container);
|
2067 |
+
|
2068 |
+
container.on('*', function (name, params) {
|
2069 |
+
// Ignore events that should not be relayed
|
2070 |
+
if ($.inArray(name, relayEvents) === -1) {
|
2071 |
+
return;
|
2072 |
+
}
|
2073 |
+
|
2074 |
+
// The parameters should always be an object
|
2075 |
+
params = params || {};
|
2076 |
+
|
2077 |
+
// Generate the jQuery event for the Select2 event
|
2078 |
+
var evt = $.Event('select2:' + name, {
|
2079 |
+
params: params
|
2080 |
+
});
|
2081 |
+
|
2082 |
+
self.$element.trigger(evt);
|
2083 |
+
|
2084 |
+
// Only handle preventable events if it was one
|
2085 |
+
if ($.inArray(name, preventableEvents) === -1) {
|
2086 |
+
return;
|
2087 |
+
}
|
2088 |
+
|
2089 |
+
params.prevented = evt.isDefaultPrevented();
|
2090 |
+
});
|
2091 |
+
};
|
2092 |
+
|
2093 |
+
return EventRelay;
|
2094 |
+
});
|
2095 |
+
|
2096 |
+
S2.define('select2/translation',[
|
2097 |
+
'jquery',
|
2098 |
+
'require'
|
2099 |
+
], function ($, require) {
|
2100 |
+
function Translation (dict) {
|
2101 |
+
this.dict = dict || {};
|
2102 |
+
}
|
2103 |
+
|
2104 |
+
Translation.prototype.all = function () {
|
2105 |
+
return this.dict;
|
2106 |
+
};
|
2107 |
+
|
2108 |
+
Translation.prototype.get = function (key) {
|
2109 |
+
return this.dict[key];
|
2110 |
+
};
|
2111 |
+
|
2112 |
+
Translation.prototype.extend = function (translation) {
|
2113 |
+
this.dict = $.extend({}, translation.all(), this.dict);
|
2114 |
+
};
|
2115 |
+
|
2116 |
+
// Static functions
|
2117 |
+
|
2118 |
+
Translation._cache = {};
|
2119 |
+
|
2120 |
+
Translation.loadPath = function (path) {
|
2121 |
+
if (!(path in Translation._cache)) {
|
2122 |
+
var translations = require(path);
|
2123 |
+
|
2124 |
+
Translation._cache[path] = translations;
|
2125 |
+
}
|
2126 |
+
|
2127 |
+
return new Translation(Translation._cache[path]);
|
2128 |
+
};
|
2129 |
+
|
2130 |
+
return Translation;
|
2131 |
+
});
|
2132 |
+
|
2133 |
+
S2.define('select2/diacritics',[
|
2134 |
+
|
2135 |
+
], function () {
|
2136 |
+
var diacritics = {
|
2137 |
+
'\u24B6': 'A',
|
2138 |
+
'\uFF21': 'A',
|
2139 |
+
'\u00C0': 'A',
|
2140 |
+
'\u00C1': 'A',
|
2141 |
+
'\u00C2': 'A',
|
2142 |
+
'\u1EA6': 'A',
|
2143 |
+
'\u1EA4': 'A',
|
2144 |
+
'\u1EAA': 'A',
|
2145 |
+
'\u1EA8': 'A',
|
2146 |
+
'\u00C3': 'A',
|
2147 |
+
'\u0100': 'A',
|
2148 |
+
'\u0102': 'A',
|
2149 |
+
'\u1EB0': 'A',
|
2150 |
+
'\u1EAE': 'A',
|
2151 |
+
'\u1EB4': 'A',
|
2152 |
+
'\u1EB2': 'A',
|
2153 |
+
'\u0226': 'A',
|
2154 |
+
'\u01E0': 'A',
|
2155 |
+
'\u00C4': 'A',
|
2156 |
+
'\u01DE': 'A',
|
2157 |
+
'\u1EA2': 'A',
|
2158 |
+
'\u00C5': 'A',
|
2159 |
+
'\u01FA': 'A',
|
2160 |
+
'\u01CD': 'A',
|
2161 |
+
'\u0200': 'A',
|
2162 |
+
'\u0202': 'A',
|
2163 |
+
'\u1EA0': 'A',
|
2164 |
+
'\u1EAC': 'A',
|
2165 |
+
'\u1EB6': 'A',
|
2166 |
+
'\u1E00': 'A',
|
2167 |
+
'\u0104': 'A',
|
2168 |
+
'\u023A': 'A',
|
2169 |
+
'\u2C6F': 'A',
|
2170 |
+
'\uA732': 'AA',
|
2171 |
+
'\u00C6': 'AE',
|
2172 |
+
'\u01FC': 'AE',
|
2173 |
+
'\u01E2': 'AE',
|
2174 |
+
'\uA734': 'AO',
|
2175 |
+
'\uA736': 'AU',
|
2176 |
+
'\uA738': 'AV',
|
2177 |
+
'\uA73A': 'AV',
|
2178 |
+
'\uA73C': 'AY',
|
2179 |
+
'\u24B7': 'B',
|
2180 |
+
'\uFF22': 'B',
|
2181 |
+
'\u1E02': 'B',
|
2182 |
+
'\u1E04': 'B',
|
2183 |
+
'\u1E06': 'B',
|
2184 |
+
'\u0243': 'B',
|
2185 |
+
'\u0182': 'B',
|
2186 |
+
'\u0181': 'B',
|
2187 |
+
'\u24B8': 'C',
|
2188 |
+
'\uFF23': 'C',
|
2189 |
+
'\u0106': 'C',
|
2190 |
+
'\u0108': 'C',
|
2191 |
+
'\u010A': 'C',
|
2192 |
+
'\u010C': 'C',
|
2193 |
+
'\u00C7': 'C',
|
2194 |
+
'\u1E08': 'C',
|
2195 |
+
'\u0187': 'C',
|
2196 |
+
'\u023B': 'C',
|
2197 |
+
'\uA73E': 'C',
|
2198 |
+
'\u24B9': 'D',
|
2199 |
+
'\uFF24': 'D',
|
2200 |
+
'\u1E0A': 'D',
|
2201 |
+
'\u010E': 'D',
|
2202 |
+
'\u1E0C': 'D',
|
2203 |
+
'\u1E10': 'D',
|
2204 |
+
'\u1E12': 'D',
|
2205 |
+
'\u1E0E': 'D',
|
2206 |
+
'\u0110': 'D',
|
2207 |
+
'\u018B': 'D',
|
2208 |
+
'\u018A': 'D',
|
2209 |
+
'\u0189': 'D',
|
2210 |
+
'\uA779': 'D',
|
2211 |
+
'\u01F1': 'DZ',
|
2212 |
+
'\u01C4': 'DZ',
|
2213 |
+
'\u01F2': 'Dz',
|
2214 |
+
'\u01C5': 'Dz',
|
2215 |
+
'\u24BA': 'E',
|
2216 |
+
'\uFF25': 'E',
|
2217 |
+
'\u00C8': 'E',
|
2218 |
+
'\u00C9': 'E',
|
2219 |
+
'\u00CA': 'E',
|
2220 |
+
'\u1EC0': 'E',
|
2221 |
+
'\u1EBE': 'E',
|
2222 |
+
'\u1EC4': 'E',
|
2223 |
+
'\u1EC2': 'E',
|
2224 |
+
'\u1EBC': 'E',
|
2225 |
+
'\u0112': 'E',
|
2226 |
+
'\u1E14': 'E',
|
2227 |
+
'\u1E16': 'E',
|
2228 |
+
'\u0114': 'E',
|
2229 |
+
'\u0116': 'E',
|
2230 |
+
'\u00CB': 'E',
|
2231 |
+
'\u1EBA': 'E',
|
2232 |
+
'\u011A': 'E',
|
2233 |
+
'\u0204': 'E',
|
2234 |
+
'\u0206': 'E',
|
2235 |
+
'\u1EB8': 'E',
|
2236 |
+
'\u1EC6': 'E',
|
2237 |
+
'\u0228': 'E',
|
2238 |
+
'\u1E1C': 'E',
|
2239 |
+
'\u0118': 'E',
|
2240 |
+
'\u1E18': 'E',
|
2241 |
+
'\u1E1A': 'E',
|
2242 |
+
'\u0190': 'E',
|
2243 |
+
'\u018E': 'E',
|
2244 |
+
'\u24BB': 'F',
|
2245 |
+
'\uFF26': 'F',
|
2246 |
+
'\u1E1E': 'F',
|
2247 |
+
'\u0191': 'F',
|
2248 |
+
'\uA77B': 'F',
|
2249 |
+
'\u24BC': 'G',
|
2250 |
+
'\uFF27': 'G',
|
2251 |
+
'\u01F4': 'G',
|
2252 |
+
'\u011C': 'G',
|
2253 |
+
'\u1E20': 'G',
|
2254 |
+
'\u011E': 'G',
|
2255 |
+
'\u0120': 'G',
|
2256 |
+
'\u01E6': 'G',
|
2257 |
+
'\u0122': 'G',
|
2258 |
+
'\u01E4': 'G',
|
2259 |
+
'\u0193': 'G',
|
2260 |
+
'\uA7A0': 'G',
|
2261 |
+
'\uA77D': 'G',
|
2262 |
+
'\uA77E': 'G',
|
2263 |
+
'\u24BD': 'H',
|
2264 |
+
'\uFF28': 'H',
|
2265 |
+
'\u0124': 'H',
|
2266 |
+
'\u1E22': 'H',
|
2267 |
+
'\u1E26': 'H',
|
2268 |
+
'\u021E': 'H',
|
2269 |
+
'\u1E24': 'H',
|
2270 |
+
'\u1E28': 'H',
|
2271 |
+
'\u1E2A': 'H',
|
2272 |
+
'\u0126': 'H',
|
2273 |
+
'\u2C67': 'H',
|
2274 |
+
'\u2C75': 'H',
|
2275 |
+
'\uA78D': 'H',
|
2276 |
+
'\u24BE': 'I',
|
2277 |
+
'\uFF29': 'I',
|
2278 |
+
'\u00CC': 'I',
|
2279 |
+
'\u00CD': 'I',
|
2280 |
+
'\u00CE': 'I',
|
2281 |
+
'\u0128': 'I',
|
2282 |
+
'\u012A': 'I',
|
2283 |
+
'\u012C': 'I',
|
2284 |
+
'\u0130': 'I',
|
2285 |
+
'\u00CF': 'I',
|
2286 |
+
'\u1E2E': 'I',
|
2287 |
+
'\u1EC8': 'I',
|
2288 |
+
'\u01CF': 'I',
|
2289 |
+
'\u0208': 'I',
|
2290 |
+
'\u020A': 'I',
|
2291 |
+
'\u1ECA': 'I',
|
2292 |
+
'\u012E': 'I',
|
2293 |
+
'\u1E2C': 'I',
|
2294 |
+
'\u0197': 'I',
|
2295 |
+
'\u24BF': 'J',
|
2296 |
+
'\uFF2A': 'J',
|
2297 |
+
'\u0134': 'J',
|
2298 |
+
'\u0248': 'J',
|
2299 |
+
'\u24C0': 'K',
|
2300 |
+
'\uFF2B': 'K',
|
2301 |
+
'\u1E30': 'K',
|
2302 |
+
'\u01E8': 'K',
|
2303 |
+
'\u1E32': 'K',
|
2304 |
+
'\u0136': 'K',
|
2305 |
+
'\u1E34': 'K',
|
2306 |
+
'\u0198': 'K',
|
2307 |
+
'\u2C69': 'K',
|
2308 |
+
'\uA740': 'K',
|
2309 |
+
'\uA742': 'K',
|
2310 |
+
'\uA744': 'K',
|
2311 |
+
'\uA7A2': 'K',
|
2312 |
+
'\u24C1': 'L',
|
2313 |
+
'\uFF2C': 'L',
|
2314 |
+
'\u013F': 'L',
|
2315 |
+
'\u0139': 'L',
|
2316 |
+
'\u013D': 'L',
|
2317 |
+
'\u1E36': 'L',
|
2318 |
+
'\u1E38': 'L',
|
2319 |
+
'\u013B': 'L',
|
2320 |
+
'\u1E3C': 'L',
|
2321 |
+
'\u1E3A': 'L',
|
2322 |
+
'\u0141': 'L',
|
2323 |
+
'\u023D': 'L',
|
2324 |
+
'\u2C62': 'L',
|
2325 |
+
'\u2C60': 'L',
|
2326 |
+
'\uA748': 'L',
|
2327 |
+
'\uA746': 'L',
|
2328 |
+
'\uA780': 'L',
|
2329 |
+
'\u01C7': 'LJ',
|
2330 |
+
'\u01C8': 'Lj',
|
2331 |
+
'\u24C2': 'M',
|
2332 |
+
'\uFF2D': 'M',
|
2333 |
+
'\u1E3E': 'M',
|
2334 |
+
'\u1E40': 'M',
|
2335 |
+
'\u1E42': 'M',
|
2336 |
+
'\u2C6E': 'M',
|
2337 |
+
'\u019C': 'M',
|
2338 |
+
'\u24C3': 'N',
|
2339 |
+
'\uFF2E': 'N',
|
2340 |
+
'\u01F8': 'N',
|
2341 |
+
'\u0143': 'N',
|
2342 |
+
'\u00D1': 'N',
|
2343 |
+
'\u1E44': 'N',
|
2344 |
+
'\u0147': 'N',
|
2345 |
+
'\u1E46': 'N',
|
2346 |
+
'\u0145': 'N',
|
2347 |
+
'\u1E4A': 'N',
|
2348 |
+
'\u1E48': 'N',
|
2349 |
+
'\u0220': 'N',
|
2350 |
+
'\u019D': 'N',
|
2351 |
+
'\uA790': 'N',
|
2352 |
+
'\uA7A4': 'N',
|
2353 |
+
'\u01CA': 'NJ',
|
2354 |
+
'\u01CB': 'Nj',
|
2355 |
+
'\u24C4': 'O',
|
2356 |
+
'\uFF2F': 'O',
|
2357 |
+
'\u00D2': 'O',
|
2358 |
+
'\u00D3': 'O',
|
2359 |
+
'\u00D4': 'O',
|
2360 |
+
'\u1ED2': 'O',
|
2361 |
+
'\u1ED0': 'O',
|
2362 |
+
'\u1ED6': 'O',
|
2363 |
+
'\u1ED4': 'O',
|
2364 |
+
'\u00D5': 'O',
|
2365 |
+
'\u1E4C': 'O',
|
2366 |
+
'\u022C': 'O',
|
2367 |
+
'\u1E4E': 'O',
|
2368 |
+
'\u014C': 'O',
|
2369 |
+
'\u1E50': 'O',
|
2370 |
+
'\u1E52': 'O',
|
2371 |
+
'\u014E': 'O',
|
2372 |
+
'\u022E': 'O',
|
2373 |
+
'\u0230': 'O',
|
2374 |
+
'\u00D6': 'O',
|
2375 |
+
'\u022A': 'O',
|
2376 |
+
'\u1ECE': 'O',
|
2377 |
+
'\u0150': 'O',
|
2378 |
+
'\u01D1': 'O',
|
2379 |
+
'\u020C': 'O',
|
2380 |
+
'\u020E': 'O',
|
2381 |
+
'\u01A0': 'O',
|
2382 |
+
'\u1EDC': 'O',
|
2383 |
+
'\u1EDA': 'O',
|
2384 |
+
'\u1EE0': 'O',
|
2385 |
+
'\u1EDE': 'O',
|
2386 |
+
'\u1EE2': 'O',
|
2387 |
+
'\u1ECC': 'O',
|
2388 |
+
'\u1ED8': 'O',
|
2389 |
+
'\u01EA': 'O',
|
2390 |
+
'\u01EC': 'O',
|
2391 |
+
'\u00D8': 'O',
|
2392 |
+
'\u01FE': 'O',
|
2393 |
+
'\u0186': 'O',
|
2394 |
+
'\u019F': 'O',
|
2395 |
+
'\uA74A': 'O',
|
2396 |
+
'\uA74C': 'O',
|
2397 |
+
'\u01A2': 'OI',
|
2398 |
+
'\uA74E': 'OO',
|
2399 |
+
'\u0222': 'OU',
|
2400 |
+
'\u24C5': 'P',
|
2401 |
+
'\uFF30': 'P',
|
2402 |
+
'\u1E54': 'P',
|
2403 |
+
'\u1E56': 'P',
|
2404 |
+
'\u01A4': 'P',
|
2405 |
+
'\u2C63': 'P',
|
2406 |
+
'\uA750': 'P',
|
2407 |
+
'\uA752': 'P',
|
2408 |
+
'\uA754': 'P',
|
2409 |
+
'\u24C6': 'Q',
|
2410 |
+
'\uFF31': 'Q',
|
2411 |
+
'\uA756': 'Q',
|
2412 |
+
'\uA758': 'Q',
|
2413 |
+
'\u024A': 'Q',
|
2414 |
+
'\u24C7': 'R',
|
2415 |
+
'\uFF32': 'R',
|
2416 |
+
'\u0154': 'R',
|
2417 |
+
'\u1E58': 'R',
|
2418 |
+
'\u0158': 'R',
|
2419 |
+
'\u0210': 'R',
|
2420 |
+
'\u0212': 'R',
|
2421 |
+
'\u1E5A': 'R',
|
2422 |
+
'\u1E5C': 'R',
|
2423 |
+
'\u0156': 'R',
|
2424 |
+
'\u1E5E': 'R',
|
2425 |
+
'\u024C': 'R',
|
2426 |
+
'\u2C64': 'R',
|
2427 |
+
'\uA75A': 'R',
|
2428 |
+
'\uA7A6': 'R',
|
2429 |
+
'\uA782': 'R',
|
2430 |
+
'\u24C8': 'S',
|
2431 |
+
'\uFF33': 'S',
|
2432 |
+
'\u1E9E': 'S',
|
2433 |
+
'\u015A': 'S',
|
2434 |
+
'\u1E64': 'S',
|
2435 |
+
'\u015C': 'S',
|
2436 |
+
'\u1E60': 'S',
|
2437 |
+
'\u0160': 'S',
|
2438 |
+
'\u1E66': 'S',
|
2439 |
+
'\u1E62': 'S',
|
2440 |
+
'\u1E68': 'S',
|
2441 |
+
'\u0218': 'S',
|
2442 |
+
'\u015E': 'S',
|
2443 |
+
'\u2C7E': 'S',
|
2444 |
+
'\uA7A8': 'S',
|
2445 |
+
'\uA784': 'S',
|
2446 |
+
'\u24C9': 'T',
|
2447 |
+
'\uFF34': 'T',
|
2448 |
+
'\u1E6A': 'T',
|
2449 |
+
'\u0164': 'T',
|
2450 |
+
'\u1E6C': 'T',
|
2451 |
+
'\u021A': 'T',
|
2452 |
+
'\u0162': 'T',
|
2453 |
+
'\u1E70': 'T',
|
2454 |
+
'\u1E6E': 'T',
|
2455 |
+
'\u0166': 'T',
|
2456 |
+
'\u01AC': 'T',
|
2457 |
+
'\u01AE': 'T',
|
2458 |
+
'\u023E': 'T',
|
2459 |
+
'\uA786': 'T',
|
2460 |
+
'\uA728': 'TZ',
|
2461 |
+
'\u24CA': 'U',
|
2462 |
+
'\uFF35': 'U',
|
2463 |
+
'\u00D9': 'U',
|
2464 |
+
'\u00DA': 'U',
|
2465 |
+
'\u00DB': 'U',
|
2466 |
+
'\u0168': 'U',
|
2467 |
+
'\u1E78': 'U',
|
2468 |
+
'\u016A': 'U',
|
2469 |
+
'\u1E7A': 'U',
|
2470 |
+
'\u016C': 'U',
|
2471 |
+
'\u00DC': 'U',
|
2472 |
+
'\u01DB': 'U',
|
2473 |
+
'\u01D7': 'U',
|
2474 |
+
'\u01D5': 'U',
|
2475 |
+
'\u01D9': 'U',
|
2476 |
+
'\u1EE6': 'U',
|
2477 |
+
'\u016E': 'U',
|
2478 |
+
'\u0170': 'U',
|
2479 |
+
'\u01D3': 'U',
|
2480 |
+
'\u0214': 'U',
|
2481 |
+
'\u0216': 'U',
|
2482 |
+
'\u01AF': 'U',
|
2483 |
+
'\u1EEA': 'U',
|
2484 |
+
'\u1EE8': 'U',
|
2485 |
+
'\u1EEE': 'U',
|
2486 |
+
'\u1EEC': 'U',
|
2487 |
+
'\u1EF0': 'U',
|
2488 |
+
'\u1EE4': 'U',
|
2489 |
+
'\u1E72': 'U',
|
2490 |
+
'\u0172': 'U',
|
2491 |
+
'\u1E76': 'U',
|
2492 |
+
'\u1E74': 'U',
|
2493 |
+
'\u0244': 'U',
|
2494 |
+
'\u24CB': 'V',
|
2495 |
+
'\uFF36': 'V',
|
2496 |
+
'\u1E7C': 'V',
|
2497 |
+
'\u1E7E': 'V',
|
2498 |
+
'\u01B2': 'V',
|
2499 |
+
'\uA75E': 'V',
|
2500 |
+
'\u0245': 'V',
|
2501 |
+
'\uA760': 'VY',
|
2502 |
+
'\u24CC': 'W',
|
2503 |
+
'\uFF37': 'W',
|
2504 |
+
'\u1E80': 'W',
|
2505 |
+
'\u1E82': 'W',
|
2506 |
+
'\u0174': 'W',
|
2507 |
+
'\u1E86': 'W',
|
2508 |
+
'\u1E84': 'W',
|
2509 |
+
'\u1E88': 'W',
|
2510 |
+
'\u2C72': 'W',
|
2511 |
+
'\u24CD': 'X',
|
2512 |
+
'\uFF38': 'X',
|
2513 |
+
'\u1E8A': 'X',
|
2514 |
+
'\u1E8C': 'X',
|
2515 |
+
'\u24CE': 'Y',
|
2516 |
+
'\uFF39': 'Y',
|
2517 |
+
'\u1EF2': 'Y',
|
2518 |
+
'\u00DD': 'Y',
|
2519 |
+
'\u0176': 'Y',
|
2520 |
+
'\u1EF8': 'Y',
|
2521 |
+
'\u0232': 'Y',
|
2522 |
+
'\u1E8E': 'Y',
|
2523 |
+
'\u0178': 'Y',
|
2524 |
+
'\u1EF6': 'Y',
|
2525 |
+
'\u1EF4': 'Y',
|
2526 |
+
'\u01B3': 'Y',
|
2527 |
+
'\u024E': 'Y',
|
2528 |
+
'\u1EFE': 'Y',
|
2529 |
+
'\u24CF': 'Z',
|
2530 |
+
'\uFF3A': 'Z',
|
2531 |
+
'\u0179': 'Z',
|
2532 |
+
'\u1E90': 'Z',
|
2533 |
+
'\u017B': 'Z',
|
2534 |
+
'\u017D': 'Z',
|
2535 |
+
'\u1E92': 'Z',
|
2536 |
+
'\u1E94': 'Z',
|
2537 |
+
'\u01B5': 'Z',
|
2538 |
+
'\u0224': 'Z',
|
2539 |
+
'\u2C7F': 'Z',
|
2540 |
+
'\u2C6B': 'Z',
|
2541 |
+
'\uA762': 'Z',
|
2542 |
+
'\u24D0': 'a',
|
2543 |
+
'\uFF41': 'a',
|
2544 |
+
'\u1E9A': 'a',
|
2545 |
+
'\u00E0': 'a',
|
2546 |
+
'\u00E1': 'a',
|
2547 |
+
'\u00E2': 'a',
|
2548 |
+
'\u1EA7': 'a',
|
2549 |
+
'\u1EA5': 'a',
|
2550 |
+
'\u1EAB': 'a',
|
2551 |
+
'\u1EA9': 'a',
|
2552 |
+
'\u00E3': 'a',
|
2553 |
+
'\u0101': 'a',
|
2554 |
+
'\u0103': 'a',
|
2555 |
+
'\u1EB1': 'a',
|
2556 |
+
'\u1EAF': 'a',
|
2557 |
+
'\u1EB5': 'a',
|
2558 |
+
'\u1EB3': 'a',
|
2559 |
+
'\u0227': 'a',
|
2560 |
+
'\u01E1': 'a',
|
2561 |
+
'\u00E4': 'a',
|
2562 |
+
'\u01DF': 'a',
|
2563 |
+
'\u1EA3': 'a',
|
2564 |
+
'\u00E5': 'a',
|
2565 |
+
'\u01FB': 'a',
|
2566 |
+
'\u01CE': 'a',
|
2567 |
+
'\u0201': 'a',
|
2568 |
+
'\u0203': 'a',
|
2569 |
+
'\u1EA1': 'a',
|
2570 |
+
'\u1EAD': 'a',
|
2571 |
+
'\u1EB7': 'a',
|
2572 |
+
'\u1E01': 'a',
|
2573 |
+
'\u0105': 'a',
|
2574 |
+
'\u2C65': 'a',
|
2575 |
+
'\u0250': 'a',
|
2576 |
+
'\uA733': 'aa',
|
2577 |
+
'\u00E6': 'ae',
|
2578 |
+
'\u01FD': 'ae',
|
2579 |
+
'\u01E3': 'ae',
|
2580 |
+
'\uA735': 'ao',
|
2581 |
+
'\uA737': 'au',
|
2582 |
+
'\uA739': 'av',
|
2583 |
+
'\uA73B': 'av',
|
2584 |
+
'\uA73D': 'ay',
|
2585 |
+
'\u24D1': 'b',
|
2586 |
+
'\uFF42': 'b',
|
2587 |
+
'\u1E03': 'b',
|
2588 |
+
'\u1E05': 'b',
|
2589 |
+
'\u1E07': 'b',
|
2590 |
+
'\u0180': 'b',
|
2591 |
+
'\u0183': 'b',
|
2592 |
+
'\u0253': 'b',
|
2593 |
+
'\u24D2': 'c',
|
2594 |
+
'\uFF43': 'c',
|
2595 |
+
'\u0107': 'c',
|
2596 |
+
'\u0109': 'c',
|
2597 |
+
'\u010B': 'c',
|
2598 |
+
'\u010D': 'c',
|
2599 |
+
'\u00E7': 'c',
|
2600 |
+
'\u1E09': 'c',
|
2601 |
+
'\u0188': 'c',
|
2602 |
+
'\u023C': 'c',
|
2603 |
+
'\uA73F': 'c',
|
2604 |
+
'\u2184': 'c',
|
2605 |
+
'\u24D3': 'd',
|
2606 |
+
'\uFF44': 'd',
|
2607 |
+
'\u1E0B': 'd',
|
2608 |
+
'\u010F': 'd',
|
2609 |
+
'\u1E0D': 'd',
|
2610 |
+
'\u1E11': 'd',
|
2611 |
+
'\u1E13': 'd',
|
2612 |
+
'\u1E0F': 'd',
|
2613 |
+
'\u0111': 'd',
|
2614 |
+
'\u018C': 'd',
|
2615 |
+
'\u0256': 'd',
|
2616 |
+
'\u0257': 'd',
|
2617 |
+
'\uA77A': 'd',
|
2618 |
+
'\u01F3': 'dz',
|
2619 |
+
'\u01C6': 'dz',
|
2620 |
+
'\u24D4': 'e',
|
2621 |
+
'\uFF45': 'e',
|
2622 |
+
'\u00E8': 'e',
|
2623 |
+
'\u00E9': 'e',
|
2624 |
+
'\u00EA': 'e',
|
2625 |
+
'\u1EC1': 'e',
|
2626 |
+
'\u1EBF': 'e',
|
2627 |
+
'\u1EC5': 'e',
|
2628 |
+
'\u1EC3': 'e',
|
2629 |
+
'\u1EBD': 'e',
|
2630 |
+
'\u0113': 'e',
|
2631 |
+
'\u1E15': 'e',
|
2632 |
+
'\u1E17': 'e',
|
2633 |
+
'\u0115': 'e',
|
2634 |
+
'\u0117': 'e',
|
2635 |
+
'\u00EB': 'e',
|
2636 |
+
'\u1EBB': 'e',
|
2637 |
+
'\u011B': 'e',
|
2638 |
+
'\u0205': 'e',
|
2639 |
+
'\u0207': 'e',
|
2640 |
+
'\u1EB9': 'e',
|
2641 |
+
'\u1EC7': 'e',
|
2642 |
+
'\u0229': 'e',
|
2643 |
+
'\u1E1D': 'e',
|
2644 |
+
'\u0119': 'e',
|
2645 |
+
'\u1E19': 'e',
|
2646 |
+
'\u1E1B': 'e',
|
2647 |
+
'\u0247': 'e',
|
2648 |
+
'\u025B': 'e',
|
2649 |
+
'\u01DD': 'e',
|
2650 |
+
'\u24D5': 'f',
|
2651 |
+
'\uFF46': 'f',
|
2652 |
+
'\u1E1F': 'f',
|
2653 |
+
'\u0192': 'f',
|
2654 |
+
'\uA77C': 'f',
|
2655 |
+
'\u24D6': 'g',
|
2656 |
+
'\uFF47': 'g',
|
2657 |
+
'\u01F5': 'g',
|
2658 |
+
'\u011D': 'g',
|
2659 |
+
'\u1E21': 'g',
|
2660 |
+
'\u011F': 'g',
|
2661 |
+
'\u0121': 'g',
|
2662 |
+
'\u01E7': 'g',
|
2663 |
+
'\u0123': 'g',
|
2664 |
+
'\u01E5': 'g',
|
2665 |
+
'\u0260': 'g',
|
2666 |
+
'\uA7A1': 'g',
|
2667 |
+
'\u1D79': 'g',
|
2668 |
+
'\uA77F': 'g',
|
2669 |
+
'\u24D7': 'h',
|
2670 |
+
'\uFF48': 'h',
|
2671 |
+
'\u0125': 'h',
|
2672 |
+
'\u1E23': 'h',
|
2673 |
+
'\u1E27': 'h',
|
2674 |
+
'\u021F': 'h',
|
2675 |
+
'\u1E25': 'h',
|
2676 |
+
'\u1E29': 'h',
|
2677 |
+
'\u1E2B': 'h',
|
2678 |
+
'\u1E96': 'h',
|
2679 |
+
'\u0127': 'h',
|
2680 |
+
'\u2C68': 'h',
|
2681 |
+
'\u2C76': 'h',
|
2682 |
+
'\u0265': 'h',
|
2683 |
+
'\u0195': 'hv',
|
2684 |
+
'\u24D8': 'i',
|
2685 |
+
'\uFF49': 'i',
|
2686 |
+
'\u00EC': 'i',
|
2687 |
+
'\u00ED': 'i',
|
2688 |
+
'\u00EE': 'i',
|
2689 |
+
'\u0129': 'i',
|
2690 |
+
'\u012B': 'i',
|
2691 |
+
'\u012D': 'i',
|
2692 |
+
'\u00EF': 'i',
|
2693 |
+
'\u1E2F': 'i',
|
2694 |
+
'\u1EC9': 'i',
|
2695 |
+
'\u01D0': 'i',
|
2696 |
+
'\u0209': 'i',
|
2697 |
+
'\u020B': 'i',
|
2698 |
+
'\u1ECB': 'i',
|
2699 |
+
'\u012F': 'i',
|
2700 |
+
'\u1E2D': 'i',
|
2701 |
+
'\u0268': 'i',
|
2702 |
+
'\u0131': 'i',
|
2703 |
+
'\u24D9': 'j',
|
2704 |
+
'\uFF4A': 'j',
|
2705 |
+
'\u0135': 'j',
|
2706 |
+
'\u01F0': 'j',
|
2707 |
+
'\u0249': 'j',
|
2708 |
+
'\u24DA': 'k',
|
2709 |
+
'\uFF4B': 'k',
|
2710 |
+
'\u1E31': 'k',
|
2711 |
+
'\u01E9': 'k',
|
2712 |
+
'\u1E33': 'k',
|
2713 |
+
'\u0137': 'k',
|
2714 |
+
'\u1E35': 'k',
|
2715 |
+
'\u0199': 'k',
|
2716 |
+
'\u2C6A': 'k',
|
2717 |
+
'\uA741': 'k',
|
2718 |
+
'\uA743': 'k',
|
2719 |
+
'\uA745': 'k',
|
2720 |
+
'\uA7A3': 'k',
|
2721 |
+
'\u24DB': 'l',
|
2722 |
+
'\uFF4C': 'l',
|
2723 |
+
'\u0140': 'l',
|
2724 |
+
'\u013A': 'l',
|
2725 |
+
'\u013E': 'l',
|
2726 |
+
'\u1E37': 'l',
|
2727 |
+
'\u1E39': 'l',
|
2728 |
+
'\u013C': 'l',
|
2729 |
+
'\u1E3D': 'l',
|
2730 |
+
'\u1E3B': 'l',
|
2731 |
+
'\u017F': 'l',
|
2732 |
+
'\u0142': 'l',
|
2733 |
+
'\u019A': 'l',
|
2734 |
+
'\u026B': 'l',
|
2735 |
+
'\u2C61': 'l',
|
2736 |
+
'\uA749': 'l',
|
2737 |
+
'\uA781': 'l',
|
2738 |
+
'\uA747': 'l',
|
2739 |
+
'\u01C9': 'lj',
|
2740 |
+
'\u24DC': 'm',
|
2741 |
+
'\uFF4D': 'm',
|
2742 |
+
'\u1E3F': 'm',
|
2743 |
+
'\u1E41': 'm',
|
2744 |
+
'\u1E43': 'm',
|
2745 |
+
'\u0271': 'm',
|
2746 |
+
'\u026F': 'm',
|
2747 |
+
'\u24DD': 'n',
|
2748 |
+
'\uFF4E': 'n',
|
2749 |
+
'\u01F9': 'n',
|
2750 |
+
'\u0144': 'n',
|
2751 |
+
'\u00F1': 'n',
|
2752 |
+
'\u1E45': 'n',
|
2753 |
+
'\u0148': 'n',
|
2754 |
+
'\u1E47': 'n',
|
2755 |
+
'\u0146': 'n',
|
2756 |
+
'\u1E4B': 'n',
|
2757 |
+
'\u1E49': 'n',
|
2758 |
+
'\u019E': 'n',
|
2759 |
+
'\u0272': 'n',
|
2760 |
+
'\u0149': 'n',
|
2761 |
+
'\uA791': 'n',
|
2762 |
+
'\uA7A5': 'n',
|
2763 |
+
'\u01CC': 'nj',
|
2764 |
+
'\u24DE': 'o',
|
2765 |
+
'\uFF4F': 'o',
|
2766 |
+
'\u00F2': 'o',
|
2767 |
+
'\u00F3': 'o',
|
2768 |
+
'\u00F4': 'o',
|
2769 |
+
'\u1ED3': 'o',
|
2770 |
+
'\u1ED1': 'o',
|
2771 |
+
'\u1ED7': 'o',
|
2772 |
+
'\u1ED5': 'o',
|
2773 |
+
'\u00F5': 'o',
|
2774 |
+
'\u1E4D': 'o',
|
2775 |
+
'\u022D': 'o',
|
2776 |
+
'\u1E4F': 'o',
|
2777 |
+
'\u014D': 'o',
|
2778 |
+
'\u1E51': 'o',
|
2779 |
+
'\u1E53': 'o',
|
2780 |
+
'\u014F': 'o',
|
2781 |
+
'\u022F': 'o',
|
2782 |
+
'\u0231': 'o',
|
2783 |
+
'\u00F6': 'o',
|
2784 |
+
'\u022B': 'o',
|
2785 |
+
'\u1ECF': 'o',
|
2786 |
+
'\u0151': 'o',
|
2787 |
+
'\u01D2': 'o',
|
2788 |
+
'\u020D': 'o',
|
2789 |
+
'\u020F': 'o',
|
2790 |
+
'\u01A1': 'o',
|
2791 |
+
'\u1EDD': 'o',
|
2792 |
+
'\u1EDB': 'o',
|
2793 |
+
'\u1EE1': 'o',
|
2794 |
+
'\u1EDF': 'o',
|
2795 |
+
'\u1EE3': 'o',
|
2796 |
+
'\u1ECD': 'o',
|
2797 |
+
'\u1ED9': 'o',
|
2798 |
+
'\u01EB': 'o',
|
2799 |
+
'\u01ED': 'o',
|
2800 |
+
'\u00F8': 'o',
|
2801 |
+
'\u01FF': 'o',
|
2802 |
+
'\u0254': 'o',
|
2803 |
+
'\uA74B': 'o',
|
2804 |
+
'\uA74D': 'o',
|
2805 |
+
'\u0275': 'o',
|
2806 |
+
'\u01A3': 'oi',
|
2807 |
+
'\u0223': 'ou',
|
2808 |
+
'\uA74F': 'oo',
|
2809 |
+
'\u24DF': 'p',
|
2810 |
+
'\uFF50': 'p',
|
2811 |
+
'\u1E55': 'p',
|
2812 |
+
'\u1E57': 'p',
|
2813 |
+
'\u01A5': 'p',
|
2814 |
+
'\u1D7D': 'p',
|
2815 |
+
'\uA751': 'p',
|
2816 |
+
'\uA753': 'p',
|
2817 |
+
'\uA755': 'p',
|
2818 |
+
'\u24E0': 'q',
|
2819 |
+
'\uFF51': 'q',
|
2820 |
+
'\u024B': 'q',
|
2821 |
+
'\uA757': 'q',
|
2822 |
+
'\uA759': 'q',
|
2823 |
+
'\u24E1': 'r',
|
2824 |
+
'\uFF52': 'r',
|
2825 |
+
'\u0155': 'r',
|
2826 |
+
'\u1E59': 'r',
|
2827 |
+
'\u0159': 'r',
|
2828 |
+
'\u0211': 'r',
|
2829 |
+
'\u0213': 'r',
|
2830 |
+
'\u1E5B': 'r',
|
2831 |
+
'\u1E5D': 'r',
|
2832 |
+
'\u0157': 'r',
|
2833 |
+
'\u1E5F': 'r',
|
2834 |
+
'\u024D': 'r',
|
2835 |
+
'\u027D': 'r',
|
2836 |
+
'\uA75B': 'r',
|
2837 |
+
'\uA7A7': 'r',
|
2838 |
+
'\uA783': 'r',
|
2839 |
+
'\u24E2': 's',
|
2840 |
+
'\uFF53': 's',
|
2841 |
+
'\u00DF': 's',
|
2842 |
+
'\u015B': 's',
|
2843 |
+
'\u1E65': 's',
|
2844 |
+
'\u015D': 's',
|
2845 |
+
'\u1E61': 's',
|
2846 |
+
'\u0161': 's',
|
2847 |
+
'\u1E67': 's',
|
2848 |
+
'\u1E63': 's',
|
2849 |
+
'\u1E69': 's',
|
2850 |
+
'\u0219': 's',
|
2851 |
+
'\u015F': 's',
|
2852 |
+
'\u023F': 's',
|
2853 |
+
'\uA7A9': 's',
|
2854 |
+
'\uA785': 's',
|
2855 |
+
'\u1E9B': 's',
|
2856 |
+
'\u24E3': 't',
|
2857 |
+
'\uFF54': 't',
|
2858 |
+
'\u1E6B': 't',
|
2859 |
+
'\u1E97': 't',
|
2860 |
+
'\u0165': 't',
|
2861 |
+
'\u1E6D': 't',
|
2862 |
+
'\u021B': 't',
|
2863 |
+
'\u0163': 't',
|
2864 |
+
'\u1E71': 't',
|
2865 |
+
'\u1E6F': 't',
|
2866 |
+
'\u0167': 't',
|
2867 |
+
'\u01AD': 't',
|
2868 |
+
'\u0288': 't',
|
2869 |
+
'\u2C66': 't',
|
2870 |
+
'\uA787': 't',
|
2871 |
+
'\uA729': 'tz',
|
2872 |
+
'\u24E4': 'u',
|
2873 |
+
'\uFF55': 'u',
|
2874 |
+
'\u00F9': 'u',
|
2875 |
+
'\u00FA': 'u',
|
2876 |
+
'\u00FB': 'u',
|
2877 |
+
'\u0169': 'u',
|
2878 |
+
'\u1E79': 'u',
|
2879 |
+
'\u016B': 'u',
|
2880 |
+
'\u1E7B': 'u',
|
2881 |
+
'\u016D': 'u',
|
2882 |
+
'\u00FC': 'u',
|
2883 |
+
'\u01DC': 'u',
|
2884 |
+
'\u01D8': 'u',
|
2885 |
+
'\u01D6': 'u',
|
2886 |
+
'\u01DA': 'u',
|
2887 |
+
'\u1EE7': 'u',
|
2888 |
+
'\u016F': 'u',
|
2889 |
+
'\u0171': 'u',
|
2890 |
+
'\u01D4': 'u',
|
2891 |
+
'\u0215': 'u',
|
2892 |
+
'\u0217': 'u',
|
2893 |
+
'\u01B0': 'u',
|
2894 |
+
'\u1EEB': 'u',
|
2895 |
+
'\u1EE9': 'u',
|
2896 |
+
'\u1EEF': 'u',
|
2897 |
+
'\u1EED': 'u',
|
2898 |
+
'\u1EF1': 'u',
|
2899 |
+
'\u1EE5': 'u',
|
2900 |
+
'\u1E73': 'u',
|
2901 |
+
'\u0173': 'u',
|
2902 |
+
'\u1E77': 'u',
|
2903 |
+
'\u1E75': 'u',
|
2904 |
+
'\u0289': 'u',
|
2905 |
+
'\u24E5': 'v',
|
2906 |
+
'\uFF56': 'v',
|
2907 |
+
'\u1E7D': 'v',
|
2908 |
+
'\u1E7F': 'v',
|
2909 |
+
'\u028B': 'v',
|
2910 |
+
'\uA75F': 'v',
|
2911 |
+
'\u028C': 'v',
|
2912 |
+
'\uA761': 'vy',
|
2913 |
+
'\u24E6': 'w',
|
2914 |
+
'\uFF57': 'w',
|
2915 |
+
'\u1E81': 'w',
|
2916 |
+
'\u1E83': 'w',
|
2917 |
+
'\u0175': 'w',
|
2918 |
+
'\u1E87': 'w',
|
2919 |
+
'\u1E85': 'w',
|
2920 |
+
'\u1E98': 'w',
|
2921 |
+
'\u1E89': 'w',
|
2922 |
+
'\u2C73': 'w',
|
2923 |
+
'\u24E7': 'x',
|
2924 |
+
'\uFF58': 'x',
|
2925 |
+
'\u1E8B': 'x',
|
2926 |
+
'\u1E8D': 'x',
|
2927 |
+
'\u24E8': 'y',
|
2928 |
+
'\uFF59': 'y',
|
2929 |
+
'\u1EF3': 'y',
|
2930 |
+
'\u00FD': 'y',
|
2931 |
+
'\u0177': 'y',
|
2932 |
+
'\u1EF9': 'y',
|
2933 |
+
'\u0233': 'y',
|
2934 |
+
'\u1E8F': 'y',
|
2935 |
+
'\u00FF': 'y',
|
2936 |
+
'\u1EF7': 'y',
|
2937 |
+
'\u1E99': 'y',
|
2938 |
+
'\u1EF5': 'y',
|
2939 |
+
'\u01B4': 'y',
|
2940 |
+
'\u024F': 'y',
|
2941 |
+
'\u1EFF': 'y',
|
2942 |
+
'\u24E9': 'z',
|
2943 |
+
'\uFF5A': 'z',
|
2944 |
+
'\u017A': 'z',
|
2945 |
+
'\u1E91': 'z',
|
2946 |
+
'\u017C': 'z',
|
2947 |
+
'\u017E': 'z',
|
2948 |
+
'\u1E93': 'z',
|
2949 |
+
'\u1E95': 'z',
|
2950 |
+
'\u01B6': 'z',
|
2951 |
+
'\u0225': 'z',
|
2952 |
+
'\u0240': 'z',
|
2953 |
+
'\u2C6C': 'z',
|
2954 |
+
'\uA763': 'z',
|
2955 |
+
'\u0386': '\u0391',
|
2956 |
+
'\u0388': '\u0395',
|
2957 |
+
'\u0389': '\u0397',
|
2958 |
+
'\u038A': '\u0399',
|
2959 |
+
'\u03AA': '\u0399',
|
2960 |
+
'\u038C': '\u039F',
|
2961 |
+
'\u038E': '\u03A5',
|
2962 |
+
'\u03AB': '\u03A5',
|
2963 |
+
'\u038F': '\u03A9',
|
2964 |
+
'\u03AC': '\u03B1',
|
2965 |
+
'\u03AD': '\u03B5',
|
2966 |
+
'\u03AE': '\u03B7',
|
2967 |
+
'\u03AF': '\u03B9',
|
2968 |
+
'\u03CA': '\u03B9',
|
2969 |
+
'\u0390': '\u03B9',
|
2970 |
+
'\u03CC': '\u03BF',
|
2971 |
+
'\u03CD': '\u03C5',
|
2972 |
+
'\u03CB': '\u03C5',
|
2973 |
+
'\u03B0': '\u03C5',
|
2974 |
+
'\u03C9': '\u03C9',
|
2975 |
+
'\u03C2': '\u03C3'
|
2976 |
+
};
|
2977 |
+
|
2978 |
+
return diacritics;
|
2979 |
+
});
|
2980 |
+
|
2981 |
+
S2.define('select2/data/base',[
|
2982 |
+
'../utils'
|
2983 |
+
], function (Utils) {
|
2984 |
+
function BaseAdapter ($element, options) {
|
2985 |
+
BaseAdapter.__super__.constructor.call(this);
|
2986 |
+
}
|
2987 |
+
|
2988 |
+
Utils.Extend(BaseAdapter, Utils.Observable);
|
2989 |
+
|
2990 |
+
BaseAdapter.prototype.current = function (callback) {
|
2991 |
+
throw new Error('The `current` method must be defined in child classes.');
|
2992 |
+
};
|
2993 |
+
|
2994 |
+
BaseAdapter.prototype.query = function (params, callback) {
|
2995 |
+
throw new Error('The `query` method must be defined in child classes.');
|
2996 |
+
};
|
2997 |
+
|
2998 |
+
BaseAdapter.prototype.bind = function (container, $container) {
|
2999 |
+
// Can be implemented in subclasses
|
3000 |
+
};
|
3001 |
+
|
3002 |
+
BaseAdapter.prototype.destroy = function () {
|
3003 |
+
// Can be implemented in subclasses
|
3004 |
+
};
|
3005 |
+
|
3006 |
+
BaseAdapter.prototype.generateResultId = function (container, data) {
|
3007 |
+
var id = container.id + '-result-';
|
3008 |
+
|
3009 |
+
id += Utils.generateChars(4);
|
3010 |
+
|
3011 |
+
if (data.id != null) {
|
3012 |
+
id += '-' + data.id.toString();
|
3013 |
+
} else {
|
3014 |
+
id += '-' + Utils.generateChars(4);
|
3015 |
+
}
|
3016 |
+
return id;
|
3017 |
+
};
|
3018 |
+
|
3019 |
+
return BaseAdapter;
|
3020 |
+
});
|
3021 |
+
|
3022 |
+
S2.define('select2/data/select',[
|
3023 |
+
'./base',
|
3024 |
+
'../utils',
|
3025 |
+
'jquery'
|
3026 |
+
], function (BaseAdapter, Utils, $) {
|
3027 |
+
function SelectAdapter ($element, options) {
|
3028 |
+
this.$element = $element;
|
3029 |
+
this.options = options;
|
3030 |
+
|
3031 |
+
SelectAdapter.__super__.constructor.call(this);
|
3032 |
+
}
|
3033 |
+
|
3034 |
+
Utils.Extend(SelectAdapter, BaseAdapter);
|
3035 |
+
|
3036 |
+
SelectAdapter.prototype.current = function (callback) {
|
3037 |
+
var data = [];
|
3038 |
+
var self = this;
|
3039 |
+
|
3040 |
+
this.$element.find(':selected').each(function () {
|
3041 |
+
var $option = $(this);
|
3042 |
+
|
3043 |
+
var option = self.item($option);
|
3044 |
+
|
3045 |
+
data.push(option);
|
3046 |
+
});
|
3047 |
+
|
3048 |
+
callback(data);
|
3049 |
+
};
|
3050 |
+
|
3051 |
+
SelectAdapter.prototype.select = function (data) {
|
3052 |
+
var self = this;
|
3053 |
+
|
3054 |
+
data.selected = true;
|
3055 |
+
|
3056 |
+
// If data.element is a DOM node, use it instead
|
3057 |
+
if ($(data.element).is('option')) {
|
3058 |
+
data.element.selected = true;
|
3059 |
+
|
3060 |
+
this.$element.trigger('change');
|
3061 |
+
|
3062 |
+
return;
|
3063 |
+
}
|
3064 |
+
|
3065 |
+
if (this.$element.prop('multiple')) {
|
3066 |
+
this.current(function (currentData) {
|
3067 |
+
var val = [];
|
3068 |
+
|
3069 |
+
data = [data];
|
3070 |
+
data.push.apply(data, currentData);
|
3071 |
+
|
3072 |
+
for (var d = 0; d < data.length; d++) {
|
3073 |
+
var id = data[d].id;
|
3074 |
+
|
3075 |
+
if ($.inArray(id, val) === -1) {
|
3076 |
+
val.push(id);
|
3077 |
+
}
|
3078 |
+
}
|
3079 |
+
|
3080 |
+
self.$element.val(val);
|
3081 |
+
self.$element.trigger('change');
|
3082 |
+
});
|
3083 |
+
} else {
|
3084 |
+
var val = data.id;
|
3085 |
+
|
3086 |
+
this.$element.val(val);
|
3087 |
+
this.$element.trigger('change');
|
3088 |
+
}
|
3089 |
+
};
|
3090 |
+
|
3091 |
+
SelectAdapter.prototype.unselect = function (data) {
|
3092 |
+
var self = this;
|
3093 |
+
|
3094 |
+
if (!this.$element.prop('multiple')) {
|
3095 |
+
return;
|
3096 |
+
}
|
3097 |
+
|
3098 |
+
data.selected = false;
|
3099 |
+
|
3100 |
+
if ($(data.element).is('option')) {
|
3101 |
+
data.element.selected = false;
|
3102 |
+
|
3103 |
+
this.$element.trigger('change');
|
3104 |
+
|
3105 |
+
return;
|
3106 |
+
}
|
3107 |
+
|
3108 |
+
this.current(function (currentData) {
|
3109 |
+
var val = [];
|
3110 |
+
|
3111 |
+
for (var d = 0; d < currentData.length; d++) {
|
3112 |
+
var id = currentData[d].id;
|
3113 |
+
|
3114 |
+
if (id !== data.id && $.inArray(id, val) === -1) {
|
3115 |
+
val.push(id);
|
3116 |
+
}
|
3117 |
+
}
|
3118 |
+
|
3119 |
+
self.$element.val(val);
|
3120 |
+
|
3121 |
+
self.$element.trigger('change');
|
3122 |
+
});
|
3123 |
+
};
|
3124 |
+
|
3125 |
+
SelectAdapter.prototype.bind = function (container, $container) {
|
3126 |
+
var self = this;
|
3127 |
+
|
3128 |
+
this.container = container;
|
3129 |
+
|
3130 |
+
container.on('select', function (params) {
|
3131 |
+
self.select(params.data);
|
3132 |
+
});
|
3133 |
+
|
3134 |
+
container.on('unselect', function (params) {
|
3135 |
+
self.unselect(params.data);
|
3136 |
+
});
|
3137 |
+
};
|
3138 |
+
|
3139 |
+
SelectAdapter.prototype.destroy = function () {
|
3140 |
+
// Remove anything added to child elements
|
3141 |
+
this.$element.find('*').each(function () {
|
3142 |
+
// Remove any custom data set by Select2
|
3143 |
+
$.removeData(this, 'data');
|
3144 |
+
});
|
3145 |
+
};
|
3146 |
+
|
3147 |
+
SelectAdapter.prototype.query = function (params, callback) {
|
3148 |
+
var data = [];
|
3149 |
+
var self = this;
|
3150 |
+
|
3151 |
+
var $options = this.$element.children();
|
3152 |
+
|
3153 |
+
$options.each(function () {
|
3154 |
+
var $option = $(this);
|
3155 |
+
|
3156 |
+
if (!$option.is('option') && !$option.is('optgroup')) {
|
3157 |
+
return;
|
3158 |
+
}
|
3159 |
+
|
3160 |
+
var option = self.item($option);
|
3161 |
+
|
3162 |
+
var matches = self.matches(params, option);
|
3163 |
+
|
3164 |
+
if (matches !== null) {
|
3165 |
+
data.push(matches);
|
3166 |
+
}
|
3167 |
+
});
|
3168 |
+
|
3169 |
+
callback({
|
3170 |
+
results: data
|
3171 |
+
});
|
3172 |
+
};
|
3173 |
+
|
3174 |
+
SelectAdapter.prototype.addOptions = function ($options) {
|
3175 |
+
Utils.appendMany(this.$element, $options);
|
3176 |
+
};
|
3177 |
+
|
3178 |
+
SelectAdapter.prototype.option = function (data) {
|
3179 |
+
var option;
|
3180 |
+
|
3181 |
+
if (data.children) {
|
3182 |
+
option = document.createElement('optgroup');
|
3183 |
+
option.label = data.text;
|
3184 |
+
} else {
|
3185 |
+
option = document.createElement('option');
|
3186 |
+
|
3187 |
+
if (option.textContent !== undefined) {
|
3188 |
+
option.textContent = data.text;
|
3189 |
+
} else {
|
3190 |
+
option.innerText = data.text;
|
3191 |
+
}
|
3192 |
+
}
|
3193 |
+
|
3194 |
+
if (data.id) {
|
3195 |
+
option.value = data.id;
|
3196 |
+
}
|
3197 |
+
|
3198 |
+
if (data.disabled) {
|
3199 |
+
option.disabled = true;
|
3200 |
+
}
|
3201 |
+
|
3202 |
+
if (data.selected) {
|
3203 |
+
option.selected = true;
|
3204 |
+
}
|
3205 |
+
|
3206 |
+
if (data.title) {
|
3207 |
+
option.title = data.title;
|
3208 |
+
}
|
3209 |
+
|
3210 |
+
var $option = $(option);
|
3211 |
+
|
3212 |
+
var normalizedData = this._normalizeItem(data);
|
3213 |
+
normalizedData.element = option;
|
3214 |
+
|
3215 |
+
// Override the option's data with the combined data
|
3216 |
+
$.data(option, 'data', normalizedData);
|
3217 |
+
|
3218 |
+
return $option;
|
3219 |
+
};
|
3220 |
+
|
3221 |
+
SelectAdapter.prototype.item = function ($option) {
|
3222 |
+
var data = {};
|
3223 |
+
|
3224 |
+
data = $.data($option[0], 'data');
|
3225 |
+
|
3226 |
+
if (data != null) {
|
3227 |
+
return data;
|
3228 |
+
}
|
3229 |
+
|
3230 |
+
if ($option.is('option')) {
|
3231 |
+
data = {
|
3232 |
+
id: $option.val(),
|
3233 |
+
text: $option.text(),
|
3234 |
+
disabled: $option.prop('disabled'),
|
3235 |
+
selected: $option.prop('selected'),
|
3236 |
+
title: $option.prop('title')
|
3237 |
+
};
|
3238 |
+
} else if ($option.is('optgroup')) {
|
3239 |
+
data = {
|
3240 |
+
text: $option.prop('label'),
|
3241 |
+
children: [],
|
3242 |
+
title: $option.prop('title')
|
3243 |
+
};
|
3244 |
+
|
3245 |
+
var $children = $option.children('option');
|
3246 |
+
var children = [];
|
3247 |
+
|
3248 |
+
for (var c = 0; c < $children.length; c++) {
|
3249 |
+
var $child = $($children[c]);
|
3250 |
+
|
3251 |
+
var child = this.item($child);
|
3252 |
+
|
3253 |
+
children.push(child);
|
3254 |
+
}
|
3255 |
+
|
3256 |
+
data.children = children;
|
3257 |
+
}
|
3258 |
+
|
3259 |
+
data = this._normalizeItem(data);
|
3260 |
+
data.element = $option[0];
|
3261 |
+
|
3262 |
+
$.data($option[0], 'data', data);
|
3263 |
+
|
3264 |
+
return data;
|
3265 |
+
};
|
3266 |
+
|
3267 |
+
SelectAdapter.prototype._normalizeItem = function (item) {
|
3268 |
+
if (!$.isPlainObject(item)) {
|
3269 |
+
item = {
|
3270 |
+
id: item,
|
3271 |
+
text: item
|
3272 |
+
};
|
3273 |
+
}
|
3274 |
+
|
3275 |
+
item = $.extend({}, {
|
3276 |
+
text: ''
|
3277 |
+
}, item);
|
3278 |
+
|
3279 |
+
var defaults = {
|
3280 |
+
selected: false,
|
3281 |
+
disabled: false
|
3282 |
+
};
|
3283 |
+
|
3284 |
+
if (item.id != null) {
|
3285 |
+
item.id = item.id.toString();
|
3286 |
+
}
|
3287 |
+
|
3288 |
+
if (item.text != null) {
|
3289 |
+
item.text = item.text.toString();
|
3290 |
+
}
|
3291 |
+
|
3292 |
+
if (item._resultId == null && item.id && this.container != null) {
|
3293 |
+
item._resultId = this.generateResultId(this.container, item);
|
3294 |
+
}
|
3295 |
+
|
3296 |
+
return $.extend({}, defaults, item);
|
3297 |
+
};
|
3298 |
+
|
3299 |
+
SelectAdapter.prototype.matches = function (params, data) {
|
3300 |
+
var matcher = this.options.get('matcher');
|
3301 |
+
|
3302 |
+
return matcher(params, data);
|
3303 |
+
};
|
3304 |
+
|
3305 |
+
return SelectAdapter;
|
3306 |
+
});
|
3307 |
+
|
3308 |
+
S2.define('select2/data/array',[
|
3309 |
+
'./select',
|
3310 |
+
'../utils',
|
3311 |
+
'jquery'
|
3312 |
+
], function (SelectAdapter, Utils, $) {
|
3313 |
+
function ArrayAdapter ($element, options) {
|
3314 |
+
var data = options.get('data') || [];
|
3315 |
+
|
3316 |
+
ArrayAdapter.__super__.constructor.call(this, $element, options);
|
3317 |
+
|
3318 |
+
this.addOptions(this.convertToOptions(data));
|
3319 |
+
}
|
3320 |
+
|
3321 |
+
Utils.Extend(ArrayAdapter, SelectAdapter);
|
3322 |
+
|
3323 |
+
ArrayAdapter.prototype.select = function (data) {
|
3324 |
+
var $option = this.$element.find('option').filter(function (i, elm) {
|
3325 |
+
return elm.value == data.id.toString();
|
3326 |
+
});
|
3327 |
+
|
3328 |
+
if ($option.length === 0) {
|
3329 |
+
$option = this.option(data);
|
3330 |
+
|
3331 |
+
this.addOptions($option);
|
3332 |
+
}
|
3333 |
+
|
3334 |
+
ArrayAdapter.__super__.select.call(this, data);
|
3335 |
+
};
|
3336 |
+
|
3337 |
+
ArrayAdapter.prototype.convertToOptions = function (data) {
|
3338 |
+
var self = this;
|
3339 |
+
|
3340 |
+
var $existing = this.$element.find('option');
|
3341 |
+
var existingIds = $existing.map(function () {
|
3342 |
+
return self.item($(this)).id;
|
3343 |
+
}).get();
|
3344 |
+
|
3345 |
+
var $options = [];
|
3346 |
+
|
3347 |
+
// Filter out all items except for the one passed in the argument
|
3348 |
+
function onlyItem (item) {
|
3349 |
+
return function () {
|
3350 |
+
return $(this).val() == item.id;
|
3351 |
+
};
|
3352 |
+
}
|
3353 |
+
|
3354 |
+
for (var d = 0; d < data.length; d++) {
|
3355 |
+
var item = this._normalizeItem(data[d]);
|
3356 |
+
|
3357 |
+
// Skip items which were pre-loaded, only merge the data
|
3358 |
+
if ($.inArray(item.id, existingIds) >= 0) {
|
3359 |
+
var $existingOption = $existing.filter(onlyItem(item));
|
3360 |
+
|
3361 |
+
var existingData = this.item($existingOption);
|
3362 |
+
var newData = $.extend(true, {}, item, existingData);
|
3363 |
+
|
3364 |
+
var $newOption = this.option(newData);
|
3365 |
+
|
3366 |
+
$existingOption.replaceWith($newOption);
|
3367 |
+
|
3368 |
+
continue;
|
3369 |
+
}
|
3370 |
+
|
3371 |
+
var $option = this.option(item);
|
3372 |
+
|
3373 |
+
if (item.children) {
|
3374 |
+
var $children = this.convertToOptions(item.children);
|
3375 |
+
|
3376 |
+
Utils.appendMany($option, $children);
|
3377 |
+
}
|
3378 |
+
|
3379 |
+
$options.push($option);
|
3380 |
+
}
|
3381 |
+
|
3382 |
+
return $options;
|
3383 |
+
};
|
3384 |
+
|
3385 |
+
return ArrayAdapter;
|
3386 |
+
});
|
3387 |
+
|
3388 |
+
S2.define('select2/data/ajax',[
|
3389 |
+
'./array',
|
3390 |
+
'../utils',
|
3391 |
+
'jquery'
|
3392 |
+
], function (ArrayAdapter, Utils, $) {
|
3393 |
+
function AjaxAdapter ($element, options) {
|
3394 |
+
this.ajaxOptions = this._applyDefaults(options.get('ajax'));
|
3395 |
+
|
3396 |
+
if (this.ajaxOptions.processResults != null) {
|
3397 |
+
this.processResults = this.ajaxOptions.processResults;
|
3398 |
+
}
|
3399 |
+
|
3400 |
+
AjaxAdapter.__super__.constructor.call(this, $element, options);
|
3401 |
+
}
|
3402 |
+
|
3403 |
+
Utils.Extend(AjaxAdapter, ArrayAdapter);
|
3404 |
+
|
3405 |
+
AjaxAdapter.prototype._applyDefaults = function (options) {
|
3406 |
+
var defaults = {
|
3407 |
+
data: function (params) {
|
3408 |
+
return $.extend({}, params, {
|
3409 |
+
q: params.term
|
3410 |
+
});
|
3411 |
+
},
|
3412 |
+
transport: function (params, success, failure) {
|
3413 |
+
var $request = $.ajax(params);
|
3414 |
+
|
3415 |
+
$request.then(success);
|
3416 |
+
$request.fail(failure);
|
3417 |
+
|
3418 |
+
return $request;
|
3419 |
+
}
|
3420 |
+
};
|
3421 |
+
|
3422 |
+
return $.extend({}, defaults, options, true);
|
3423 |
+
};
|
3424 |
+
|
3425 |
+
AjaxAdapter.prototype.processResults = function (results) {
|
3426 |
+
return results;
|
3427 |
+
};
|
3428 |
+
|
3429 |
+
AjaxAdapter.prototype.query = function (params, callback) {
|
3430 |
+
var matches = [];
|
3431 |
+
var self = this;
|
3432 |
+
|
3433 |
+
if (this._request != null) {
|
3434 |
+
// JSONP requests cannot always be aborted
|
3435 |
+
if ($.isFunction(this._request.abort)) {
|
3436 |
+
this._request.abort();
|
3437 |
+
}
|
3438 |
+
|
3439 |
+
this._request = null;
|
3440 |
+
}
|
3441 |
+
|
3442 |
+
var options = $.extend({
|
3443 |
+
type: 'GET'
|
3444 |
+
}, this.ajaxOptions);
|
3445 |
+
|
3446 |
+
if (typeof options.url === 'function') {
|
3447 |
+
options.url = options.url.call(this.$element, params);
|
3448 |
+
}
|
3449 |
+
|
3450 |
+
if (typeof options.data === 'function') {
|
3451 |
+
options.data = options.data.call(this.$element, params);
|
3452 |
+
}
|
3453 |
+
|
3454 |
+
function request () {
|
3455 |
+
var $request = options.transport(options, function (data) {
|
3456 |
+
var results = self.processResults(data, params);
|
3457 |
+
|
3458 |
+
if (self.options.get('debug') && window.console && console.error) {
|
3459 |
+
// Check to make sure that the response included a `results` key.
|
3460 |
+
if (!results || !results.results || !$.isArray(results.results)) {
|
3461 |
+
console.error(
|
3462 |
+
'Select2: The AJAX results did not return an array in the ' +
|
3463 |
+
'`results` key of the response.'
|
3464 |
+
);
|
3465 |
+
}
|
3466 |
+
}
|
3467 |
+
|
3468 |
+
callback(results);
|
3469 |
+
}, function () {
|
3470 |
+
// Attempt to detect if a request was aborted
|
3471 |
+
// Only works if the transport exposes a status property
|
3472 |
+
if ($request.status && $request.status === '0') {
|
3473 |
+
return;
|
3474 |
+
}
|
3475 |
+
|
3476 |
+
self.trigger('results:message', {
|
3477 |
+
message: 'errorLoading'
|
3478 |
+
});
|
3479 |
+
});
|
3480 |
+
|
3481 |
+
self._request = $request;
|
3482 |
+
}
|
3483 |
+
|
3484 |
+
if (this.ajaxOptions.delay && params.term != null) {
|
3485 |
+
if (this._queryTimeout) {
|
3486 |
+
window.clearTimeout(this._queryTimeout);
|
3487 |
+
}
|
3488 |
+
|
3489 |
+
this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
|
3490 |
+
} else {
|
3491 |
+
request();
|
3492 |
+
}
|
3493 |
+
};
|
3494 |
+
|
3495 |
+
return AjaxAdapter;
|
3496 |
+
});
|
3497 |
+
|
3498 |
+
S2.define('select2/data/tags',[
|
3499 |
+
'jquery'
|
3500 |
+
], function ($) {
|
3501 |
+
function Tags (decorated, $element, options) {
|
3502 |
+
var tags = options.get('tags');
|
3503 |
+
|
3504 |
+
var createTag = options.get('createTag');
|
3505 |
+
|
3506 |
+
if (createTag !== undefined) {
|
3507 |
+
this.createTag = createTag;
|
3508 |
+
}
|
3509 |
+
|
3510 |
+
var insertTag = options.get('insertTag');
|
3511 |
+
|
3512 |
+
if (insertTag !== undefined) {
|
3513 |
+
this.insertTag = insertTag;
|
3514 |
+
}
|
3515 |
+
|
3516 |
+
decorated.call(this, $element, options);
|
3517 |
+
|
3518 |
+
if ($.isArray(tags)) {
|
3519 |
+
for (var t = 0; t < tags.length; t++) {
|
3520 |
+
var tag = tags[t];
|
3521 |
+
var item = this._normalizeItem(tag);
|
3522 |
+
|
3523 |
+
var $option = this.option(item);
|
3524 |
+
|
3525 |
+
this.$element.append($option);
|
3526 |
+
}
|
3527 |
+
}
|
3528 |
+
}
|
3529 |
+
|
3530 |
+
Tags.prototype.query = function (decorated, params, callback) {
|
3531 |
+
var self = this;
|
3532 |
+
|
3533 |
+
this._removeOldTags();
|
3534 |
+
|
3535 |
+
if (params.term == null || params.page != null) {
|
3536 |
+
decorated.call(this, params, callback);
|
3537 |
+
return;
|
3538 |
+
}
|
3539 |
+
|
3540 |
+
function wrapper (obj, child) {
|
3541 |
+
var data = obj.results;
|
3542 |
+
|
3543 |
+
for (var i = 0; i < data.length; i++) {
|
3544 |
+
var option = data[i];
|
3545 |
+
|
3546 |
+
var checkChildren = (
|
3547 |
+
option.children != null &&
|
3548 |
+
!wrapper({
|
3549 |
+
results: option.children
|
3550 |
+
}, true)
|
3551 |
+
);
|
3552 |
+
|
3553 |
+
var checkText = option.text === params.term;
|
3554 |
+
|
3555 |
+
if (checkText || checkChildren) {
|
3556 |
+
if (child) {
|
3557 |
+
return false;
|
3558 |
+
}
|
3559 |
+
|
3560 |
+
obj.data = data;
|
3561 |
+
callback(obj);
|
3562 |
+
|
3563 |
+
return;
|
3564 |
+
}
|
3565 |
+
}
|
3566 |
+
|
3567 |
+
if (child) {
|
3568 |
+
return true;
|
3569 |
+
}
|
3570 |
+
|
3571 |
+
var tag = self.createTag(params);
|
3572 |
+
|
3573 |
+
if (tag != null) {
|
3574 |
+
var $option = self.option(tag);
|
3575 |
+
$option.attr('data-select2-tag', true);
|
3576 |
+
|
3577 |
+
self.addOptions([$option]);
|
3578 |
+
|
3579 |
+
self.insertTag(data, tag);
|
3580 |
+
}
|
3581 |
+
|
3582 |
+
obj.results = data;
|
3583 |
+
|
3584 |
+
callback(obj);
|
3585 |
+
}
|
3586 |
+
|
3587 |
+
decorated.call(this, params, wrapper);
|
3588 |
+
};
|
3589 |
+
|
3590 |
+
Tags.prototype.createTag = function (decorated, params) {
|
3591 |
+
var term = $.trim(params.term);
|
3592 |
+
|
3593 |
+
if (term === '') {
|
3594 |
+
return null;
|
3595 |
+
}
|
3596 |
+
|
3597 |
+
return {
|
3598 |
+
id: term,
|
3599 |
+
text: term
|
3600 |
+
};
|
3601 |
+
};
|
3602 |
+
|
3603 |
+
Tags.prototype.insertTag = function (_, data, tag) {
|
3604 |
+
data.unshift(tag);
|
3605 |
+
};
|
3606 |
+
|
3607 |
+
Tags.prototype._removeOldTags = function (_) {
|
3608 |
+
var tag = this._lastTag;
|
3609 |
+
|
3610 |
+
var $options = this.$element.find('option[data-select2-tag]');
|
3611 |
+
|
3612 |
+
$options.each(function () {
|
3613 |
+
if (this.selected) {
|
3614 |
+
return;
|
3615 |
+
}
|
3616 |
+
|
3617 |
+
$(this).remove();
|
3618 |
+
});
|
3619 |
+
};
|
3620 |
+
|
3621 |
+
return Tags;
|
3622 |
+
});
|
3623 |
+
|
3624 |
+
S2.define('select2/data/tokenizer',[
|
3625 |
+
'jquery'
|
3626 |
+
], function ($) {
|
3627 |
+
function Tokenizer (decorated, $element, options) {
|
3628 |
+
var tokenizer = options.get('tokenizer');
|
3629 |
+
|
3630 |
+
if (tokenizer !== undefined) {
|
3631 |
+
this.tokenizer = tokenizer;
|
3632 |
+
}
|
3633 |
+
|
3634 |
+
decorated.call(this, $element, options);
|
3635 |
+
}
|
3636 |
+
|
3637 |
+
Tokenizer.prototype.bind = function (decorated, container, $container) {
|
3638 |
+
decorated.call(this, container, $container);
|
3639 |
+
|
3640 |
+
this.$search = container.dropdown.$search || container.selection.$search ||
|
3641 |
+
$container.find('.select2-search__field');
|
3642 |
+
};
|
3643 |
+
|
3644 |
+
Tokenizer.prototype.query = function (decorated, params, callback) {
|
3645 |
+
var self = this;
|
3646 |
+
|
3647 |
+
function createAndSelect (data) {
|
3648 |
+
// Normalize the data object so we can use it for checks
|
3649 |
+
var item = self._normalizeItem(data);
|
3650 |
+
|
3651 |
+
// Check if the data object already exists as a tag
|
3652 |
+
// Select it if it doesn't
|
3653 |
+
var $existingOptions = self.$element.find('option').filter(function () {
|
3654 |
+
return $(this).val() === item.id;
|
3655 |
+
});
|
3656 |
+
|
3657 |
+
// If an existing option wasn't found for it, create the option
|
3658 |
+
if (!$existingOptions.length) {
|
3659 |
+
var $option = self.option(item);
|
3660 |
+
$option.attr('data-select2-tag', true);
|
3661 |
+
|
3662 |
+
self._removeOldTags();
|
3663 |
+
self.addOptions([$option]);
|
3664 |
+
}
|
3665 |
+
|
3666 |
+
// Select the item, now that we know there is an option for it
|
3667 |
+
select(item);
|
3668 |
+
}
|
3669 |
+
|
3670 |
+
function select (data) {
|
3671 |
+
self.trigger('select', {
|
3672 |
+
data: data
|
3673 |
+
});
|
3674 |
+
}
|
3675 |
+
|
3676 |
+
params.term = params.term || '';
|
3677 |
+
|
3678 |
+
var tokenData = this.tokenizer(params, this.options, createAndSelect);
|
3679 |
+
|
3680 |
+
if (tokenData.term !== params.term) {
|
3681 |
+
// Replace the search term if we have the search box
|
3682 |
+
if (this.$search.length) {
|
3683 |
+
this.$search.val(tokenData.term);
|
3684 |
+
this.$search.focus();
|
3685 |
+
}
|
3686 |
+
|
3687 |
+
params.term = tokenData.term;
|
3688 |
+
}
|
3689 |
+
|
3690 |
+
decorated.call(this, params, callback);
|
3691 |
+
};
|
3692 |
+
|
3693 |
+
Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
|
3694 |
+
var separators = options.get('tokenSeparators') || [];
|
3695 |
+
var term = params.term;
|
3696 |
+
var i = 0;
|
3697 |
+
|
3698 |
+
var createTag = this.createTag || function (params) {
|
3699 |
+
return {
|
3700 |
+
id: params.term,
|
3701 |
+
text: params.term
|
3702 |
+
};
|
3703 |
+
};
|
3704 |
+
|
3705 |
+
while (i < term.length) {
|
3706 |
+
var termChar = term[i];
|
3707 |
+
|
3708 |
+
if ($.inArray(termChar, separators) === -1) {
|
3709 |
+
i++;
|
3710 |
+
|
3711 |
+
continue;
|
3712 |
+
}
|
3713 |
+
|
3714 |
+
var part = term.substr(0, i);
|
3715 |
+
var partParams = $.extend({}, params, {
|
3716 |
+
term: part
|
3717 |
+
});
|
3718 |
+
|
3719 |
+
var data = createTag(partParams);
|
3720 |
+
|
3721 |
+
if (data == null) {
|
3722 |
+
i++;
|
3723 |
+
continue;
|
3724 |
+
}
|
3725 |
+
|
3726 |
+
callback(data);
|
3727 |
+
|
3728 |
+
// Reset the term to not include the tokenized portion
|
3729 |
+
term = term.substr(i + 1) || '';
|
3730 |
+
i = 0;
|
3731 |
+
}
|
3732 |
+
|
3733 |
+
return {
|
3734 |
+
term: term
|
3735 |
+
};
|
3736 |
+
};
|
3737 |
+
|
3738 |
+
return Tokenizer;
|
3739 |
+
});
|
3740 |
+
|
3741 |
+
S2.define('select2/data/minimumInputLength',[
|
3742 |
+
|
3743 |
+
], function () {
|
3744 |
+
function MinimumInputLength (decorated, $e, options) {
|
3745 |
+
this.minimumInputLength = options.get('minimumInputLength');
|
3746 |
+
|
3747 |
+
decorated.call(this, $e, options);
|
3748 |
+
}
|
3749 |
+
|
3750 |
+
MinimumInputLength.prototype.query = function (decorated, params, callback) {
|
3751 |
+
params.term = params.term || '';
|
3752 |
+
|
3753 |
+
if (params.term.length < this.minimumInputLength) {
|
3754 |
+
this.trigger('results:message', {
|
3755 |
+
message: 'inputTooShort',
|
3756 |
+
args: {
|
3757 |
+
minimum: this.minimumInputLength,
|
3758 |
+
input: params.term,
|
3759 |
+
params: params
|
3760 |
+
}
|
3761 |
+
});
|
3762 |
+
|
3763 |
+
return;
|
3764 |
+
}
|
3765 |
+
|
3766 |
+
decorated.call(this, params, callback);
|
3767 |
+
};
|
3768 |
+
|
3769 |
+
return MinimumInputLength;
|
3770 |
+
});
|
3771 |
+
|
3772 |
+
S2.define('select2/data/maximumInputLength',[
|
3773 |
+
|
3774 |
+
], function () {
|
3775 |
+
function MaximumInputLength (decorated, $e, options) {
|
3776 |
+
this.maximumInputLength = options.get('maximumInputLength');
|
3777 |
+
|
3778 |
+
decorated.call(this, $e, options);
|
3779 |
+
}
|
3780 |
+
|
3781 |
+
MaximumInputLength.prototype.query = function (decorated, params, callback) {
|
3782 |
+
params.term = params.term || '';
|
3783 |
+
|
3784 |
+
if (this.maximumInputLength > 0 &&
|
3785 |
+
params.term.length > this.maximumInputLength) {
|
3786 |
+
this.trigger('results:message', {
|
3787 |
+
message: 'inputTooLong',
|
3788 |
+
args: {
|
3789 |
+
maximum: this.maximumInputLength,
|
3790 |
+
input: params.term,
|
3791 |
+
params: params
|
3792 |
+
}
|
3793 |
+
});
|
3794 |
+
|
3795 |
+
return;
|
3796 |
+
}
|
3797 |
+
|
3798 |
+
decorated.call(this, params, callback);
|
3799 |
+
};
|
3800 |
+
|
3801 |
+
return MaximumInputLength;
|
3802 |
+
});
|
3803 |
+
|
3804 |
+
S2.define('select2/data/maximumSelectionLength',[
|
3805 |
+
|
3806 |
+
], function (){
|
3807 |
+
function MaximumSelectionLength (decorated, $e, options) {
|
3808 |
+
this.maximumSelectionLength = options.get('maximumSelectionLength');
|
3809 |
+
|
3810 |
+
decorated.call(this, $e, options);
|
3811 |
+
}
|
3812 |
+
|
3813 |
+
MaximumSelectionLength.prototype.query =
|
3814 |
+
function (decorated, params, callback) {
|
3815 |
+
var self = this;
|
3816 |
+
|
3817 |
+
this.current(function (currentData) {
|
3818 |
+
var count = currentData != null ? currentData.length : 0;
|
3819 |
+
if (self.maximumSelectionLength > 0 &&
|
3820 |
+
count >= self.maximumSelectionLength) {
|
3821 |
+
self.trigger('results:message', {
|
3822 |
+
message: 'maximumSelected',
|
3823 |
+
args: {
|
3824 |
+
maximum: self.maximumSelectionLength
|
3825 |
+
}
|
3826 |
+
});
|
3827 |
+
return;
|
3828 |
+
}
|
3829 |
+
decorated.call(self, params, callback);
|
3830 |
+
});
|
3831 |
+
};
|
3832 |
+
|
3833 |
+
return MaximumSelectionLength;
|
3834 |
+
});
|
3835 |
+
|
3836 |
+
S2.define('select2/dropdown',[
|
3837 |
+
'jquery',
|
3838 |
+
'./utils'
|
3839 |
+
], function ($, Utils) {
|
3840 |
+
function Dropdown ($element, options) {
|
3841 |
+
this.$element = $element;
|
3842 |
+
this.options = options;
|
3843 |
+
|
3844 |
+
Dropdown.__super__.constructor.call(this);
|
3845 |
+
}
|
3846 |
+
|
3847 |
+
Utils.Extend(Dropdown, Utils.Observable);
|
3848 |
+
|
3849 |
+
Dropdown.prototype.render = function () {
|
3850 |
+
var $dropdown = $(
|
3851 |
+
'<span class="select2-dropdown">' +
|
3852 |
+
'<span class="select2-results"></span>' +
|
3853 |
+
'</span>'
|
3854 |
+
);
|
3855 |
+
|
3856 |
+
$dropdown.attr('dir', this.options.get('dir'));
|
3857 |
+
|
3858 |
+
this.$dropdown = $dropdown;
|
3859 |
+
|
3860 |
+
return $dropdown;
|
3861 |
+
};
|
3862 |
+
|
3863 |
+
Dropdown.prototype.bind = function () {
|
3864 |
+
// Should be implemented in subclasses
|
3865 |
+
};
|
3866 |
+
|
3867 |
+
Dropdown.prototype.position = function ($dropdown, $container) {
|
3868 |
+
// Should be implmented in subclasses
|
3869 |
+
};
|
3870 |
+
|
3871 |
+
Dropdown.prototype.destroy = function () {
|
3872 |
+
// Remove the dropdown from the DOM
|
3873 |
+
this.$dropdown.remove();
|
3874 |
+
};
|
3875 |
+
|
3876 |
+
return Dropdown;
|
3877 |
+
});
|
3878 |
+
|
3879 |
+
S2.define('select2/dropdown/search',[
|
3880 |
+
'jquery',
|
3881 |
+
'../utils'
|
3882 |
+
], function ($, Utils) {
|
3883 |
+
function Search () { }
|
3884 |
+
|
3885 |
+
Search.prototype.render = function (decorated) {
|
3886 |
+
var $rendered = decorated.call(this);
|
3887 |
+
|
3888 |
+
var $search = $(
|
3889 |
+
'<span class="select2-search select2-search--dropdown">' +
|
3890 |
+
'<input class="select2-search__field" type="search" tabindex="-1"' +
|
3891 |
+
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
|
3892 |
+
' spellcheck="false" role="textbox" />' +
|
3893 |
+
'</span>'
|
3894 |
+
);
|
3895 |
+
|
3896 |
+
this.$searchContainer = $search;
|
3897 |
+
this.$search = $search.find('input');
|
3898 |
+
|
3899 |
+
$rendered.prepend($search);
|
3900 |
+
|
3901 |
+
return $rendered;
|
3902 |
+
};
|
3903 |
+
|
3904 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
3905 |
+
var self = this;
|
3906 |
+
|
3907 |
+
decorated.call(this, container, $container);
|
3908 |
+
|
3909 |
+
this.$search.on('keydown', function (evt) {
|
3910 |
+
self.trigger('keypress', evt);
|
3911 |
+
|
3912 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
3913 |
+
});
|
3914 |
+
|
3915 |
+
// Workaround for browsers which do not support the `input` event
|
3916 |
+
// This will prevent double-triggering of events for browsers which support
|
3917 |
+
// both the `keyup` and `input` events.
|
3918 |
+
this.$search.on('input', function (evt) {
|
3919 |
+
// Unbind the duplicated `keyup` event
|
3920 |
+
$(this).off('keyup');
|
3921 |
+
});
|
3922 |
+
|
3923 |
+
this.$search.on('keyup input', function (evt) {
|
3924 |
+
self.handleSearch(evt);
|
3925 |
+
});
|
3926 |
+
|
3927 |
+
container.on('open', function () {
|
3928 |
+
self.$search.attr('tabindex', 0);
|
3929 |
+
|
3930 |
+
self.$search.focus();
|
3931 |
+
|
3932 |
+
window.setTimeout(function () {
|
3933 |
+
self.$search.focus();
|
3934 |
+
}, 0);
|
3935 |
+
});
|
3936 |
+
|
3937 |
+
container.on('close', function () {
|
3938 |
+
self.$search.attr('tabindex', -1);
|
3939 |
+
|
3940 |
+
self.$search.val('');
|
3941 |
+
});
|
3942 |
+
|
3943 |
+
container.on('focus', function () {
|
3944 |
+
if (container.isOpen()) {
|
3945 |
+
self.$search.focus();
|
3946 |
+
}
|
3947 |
+
});
|
3948 |
+
|
3949 |
+
container.on('results:all', function (params) {
|
3950 |
+
if (params.query.term == null || params.query.term === '') {
|
3951 |
+
var showSearch = self.showSearch(params);
|
3952 |
+
|
3953 |
+
if (showSearch) {
|
3954 |
+
self.$searchContainer.removeClass('select2-search--hide');
|
3955 |
+
} else {
|
3956 |
+
self.$searchContainer.addClass('select2-search--hide');
|
3957 |
+
}
|
3958 |
+
}
|
3959 |
+
});
|
3960 |
+
};
|
3961 |
+
|
3962 |
+
Search.prototype.handleSearch = function (evt) {
|
3963 |
+
if (!this._keyUpPrevented) {
|
3964 |
+
var input = this.$search.val();
|
3965 |
+
|
3966 |
+
this.trigger('query', {
|
3967 |
+
term: input
|
3968 |
+
});
|
3969 |
+
}
|
3970 |
+
|
3971 |
+
this._keyUpPrevented = false;
|
3972 |
+
};
|
3973 |
+
|
3974 |
+
Search.prototype.showSearch = function (_, params) {
|
3975 |
+
return true;
|
3976 |
+
};
|
3977 |
+
|
3978 |
+
return Search;
|
3979 |
+
});
|
3980 |
+
|
3981 |
+
S2.define('select2/dropdown/hidePlaceholder',[
|
3982 |
+
|
3983 |
+
], function () {
|
3984 |
+
function HidePlaceholder (decorated, $element, options, dataAdapter) {
|
3985 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
3986 |
+
|
3987 |
+
decorated.call(this, $element, options, dataAdapter);
|
3988 |
+
}
|
3989 |
+
|
3990 |
+
HidePlaceholder.prototype.append = function (decorated, data) {
|
3991 |
+
data.results = this.removePlaceholder(data.results);
|
3992 |
+
|
3993 |
+
decorated.call(this, data);
|
3994 |
+
};
|
3995 |
+
|
3996 |
+
HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
3997 |
+
if (typeof placeholder === 'string') {
|
3998 |
+
placeholder = {
|
3999 |
+
id: '',
|
4000 |
+
text: placeholder
|
4001 |
+
};
|
4002 |
+
}
|
4003 |
+
|
4004 |
+
return placeholder;
|
4005 |
+
};
|
4006 |
+
|
4007 |
+
HidePlaceholder.prototype.removePlaceholder = function (_, data) {
|
4008 |
+
var modifiedData = data.slice(0);
|
4009 |
+
|
4010 |
+
for (var d = data.length - 1; d >= 0; d--) {
|
4011 |
+
var item = data[d];
|
4012 |
+
|
4013 |
+
if (this.placeholder.id === item.id) {
|
4014 |
+
modifiedData.splice(d, 1);
|
4015 |
+
}
|
4016 |
+
}
|
4017 |
+
|
4018 |
+
return modifiedData;
|
4019 |
+
};
|
4020 |
+
|
4021 |
+
return HidePlaceholder;
|
4022 |
+
});
|
4023 |
+
|
4024 |
+
S2.define('select2/dropdown/infiniteScroll',[
|
4025 |
+
'jquery'
|
4026 |
+
], function ($) {
|
4027 |
+
function InfiniteScroll (decorated, $element, options, dataAdapter) {
|
4028 |
+
this.lastParams = {};
|
4029 |
+
|
4030 |
+
decorated.call(this, $element, options, dataAdapter);
|
4031 |
+
|
4032 |
+
this.$loadingMore = this.createLoadingMore();
|
4033 |
+
this.loading = false;
|
4034 |
+
}
|
4035 |
+
|
4036 |
+
InfiniteScroll.prototype.append = function (decorated, data) {
|
4037 |
+
this.$loadingMore.remove();
|
4038 |
+
this.loading = false;
|
4039 |
+
|
4040 |
+
decorated.call(this, data);
|
4041 |
+
|
4042 |
+
if (this.showLoadingMore(data)) {
|
4043 |
+
this.$results.append(this.$loadingMore);
|
4044 |
+
}
|
4045 |
+
};
|
4046 |
+
|
4047 |
+
InfiniteScroll.prototype.bind = function (decorated, container, $container) {
|
4048 |
+
var self = this;
|
4049 |
+
|
4050 |
+
decorated.call(this, container, $container);
|
4051 |
+
|
4052 |
+
container.on('query', function (params) {
|
4053 |
+
self.lastParams = params;
|
4054 |
+
self.loading = true;
|
4055 |
+
});
|
4056 |
+
|
4057 |
+
container.on('query:append', function (params) {
|
4058 |
+
self.lastParams = params;
|
4059 |
+
self.loading = true;
|
4060 |
+
});
|
4061 |
+
|
4062 |
+
this.$results.on('scroll', function () {
|
4063 |
+
var isLoadMoreVisible = $.contains(
|
4064 |
+
document.documentElement,
|
4065 |
+
self.$loadingMore[0]
|
4066 |
+
);
|
4067 |
+
|
4068 |
+
if (self.loading || !isLoadMoreVisible) {
|
4069 |
+
return;
|
4070 |
+
}
|
4071 |
+
|
4072 |
+
var currentOffset = self.$results.offset().top +
|
4073 |
+
self.$results.outerHeight(false);
|
4074 |
+
var loadingMoreOffset = self.$loadingMore.offset().top +
|
4075 |
+
self.$loadingMore.outerHeight(false);
|
4076 |
+
|
4077 |
+
if (currentOffset + 50 >= loadingMoreOffset) {
|
4078 |
+
self.loadMore();
|
4079 |
+
}
|
4080 |
+
});
|
4081 |
+
};
|
4082 |
+
|
4083 |
+
InfiniteScroll.prototype.loadMore = function () {
|
4084 |
+
this.loading = true;
|
4085 |
+
|
4086 |
+
var params = $.extend({}, {page: 1}, this.lastParams);
|
4087 |
+
|
4088 |
+
params.page++;
|
4089 |
+
|
4090 |
+
this.trigger('query:append', params);
|
4091 |
+
};
|
4092 |
+
|
4093 |
+
InfiniteScroll.prototype.showLoadingMore = function (_, data) {
|
4094 |
+
return data.pagination && data.pagination.more;
|
4095 |
+
};
|
4096 |
+
|
4097 |
+
InfiniteScroll.prototype.createLoadingMore = function () {
|
4098 |
+
var $option = $(
|
4099 |
+
'<li ' +
|
4100 |
+
'class="select2-results__option select2-results__option--load-more"' +
|
4101 |
+
'role="treeitem" aria-disabled="true"></li>'
|
4102 |
+
);
|
4103 |
+
|
4104 |
+
var message = this.options.get('translations').get('loadingMore');
|
4105 |
+
|
4106 |
+
$option.html(message(this.lastParams));
|
4107 |
+
|
4108 |
+
return $option;
|
4109 |
+
};
|
4110 |
+
|
4111 |
+
return InfiniteScroll;
|
4112 |
+
});
|
4113 |
+
|
4114 |
+
S2.define('select2/dropdown/attachBody',[
|
4115 |
+
'jquery',
|
4116 |
+
'../utils'
|
4117 |
+
], function ($, Utils) {
|
4118 |
+
function AttachBody (decorated, $element, options) {
|
4119 |
+
this.$dropdownParent = options.get('dropdownParent') || $(document.body);
|
4120 |
+
|
4121 |
+
decorated.call(this, $element, options);
|
4122 |
+
}
|
4123 |
+
|
4124 |
+
AttachBody.prototype.bind = function (decorated, container, $container) {
|
4125 |
+
var self = this;
|
4126 |
+
|
4127 |
+
var setupResultsEvents = false;
|
4128 |
+
|
4129 |
+
decorated.call(this, container, $container);
|
4130 |
+
|
4131 |
+
container.on('open', function () {
|
4132 |
+
self._showDropdown();
|
4133 |
+
self._attachPositioningHandler(container);
|
4134 |
+
|
4135 |
+
if (!setupResultsEvents) {
|
4136 |
+
setupResultsEvents = true;
|
4137 |
+
|
4138 |
+
container.on('results:all', function () {
|
4139 |
+
self._positionDropdown();
|
4140 |
+
self._resizeDropdown();
|
4141 |
+
});
|
4142 |
+
|
4143 |
+
container.on('results:append', function () {
|
4144 |
+
self._positionDropdown();
|
4145 |
+
self._resizeDropdown();
|
4146 |
+
});
|
4147 |
+
}
|
4148 |
+
});
|
4149 |
+
|
4150 |
+
container.on('close', function () {
|
4151 |
+
self._hideDropdown();
|
4152 |
+
self._detachPositioningHandler(container);
|
4153 |
+
});
|
4154 |
+
|
4155 |
+
this.$dropdownContainer.on('mousedown', function (evt) {
|
4156 |
+
evt.stopPropagation();
|
4157 |
+
});
|
4158 |
+
};
|
4159 |
+
|
4160 |
+
AttachBody.prototype.destroy = function (decorated) {
|
4161 |
+
decorated.call(this);
|
4162 |
+
|
4163 |
+
this.$dropdownContainer.remove();
|
4164 |
+
};
|
4165 |
+
|
4166 |
+
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
|
4167 |
+
// Clone all of the container classes
|
4168 |
+
$dropdown.attr('class', $container.attr('class'));
|
4169 |
+
|
4170 |
+
$dropdown.removeClass('select2');
|
4171 |
+
$dropdown.addClass('select2-container--open');
|
4172 |
+
|
4173 |
+
$dropdown.css({
|
4174 |
+
position: 'absolute',
|
4175 |
+
top: -999999
|
4176 |
+
});
|
4177 |
+
|
4178 |
+
this.$container = $container;
|
4179 |
+
};
|
4180 |
+
|
4181 |
+
AttachBody.prototype.render = function (decorated) {
|
4182 |
+
var $container = $('<span></span>');
|
4183 |
+
|
4184 |
+
var $dropdown = decorated.call(this);
|
4185 |
+
$container.append($dropdown);
|
4186 |
+
|
4187 |
+
this.$dropdownContainer = $container;
|
4188 |
+
|
4189 |
+
return $container;
|
4190 |
+
};
|
4191 |
+
|
4192 |
+
AttachBody.prototype._hideDropdown = function (decorated) {
|
4193 |
+
this.$dropdownContainer.detach();
|
4194 |
+
};
|
4195 |
+
|
4196 |
+
AttachBody.prototype._attachPositioningHandler =
|
4197 |
+
function (decorated, container) {
|
4198 |
+
var self = this;
|
4199 |
+
|
4200 |
+
var scrollEvent = 'scroll.select2.' + container.id;
|
4201 |
+
var resizeEvent = 'resize.select2.' + container.id;
|
4202 |
+
var orientationEvent = 'orientationchange.select2.' + container.id;
|
4203 |
+
|
4204 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
4205 |
+
$watchers.each(function () {
|
4206 |
+
$(this).data('select2-scroll-position', {
|
4207 |
+
x: $(this).scrollLeft(),
|
4208 |
+
y: $(this).scrollTop()
|
4209 |
+
});
|
4210 |
+
});
|
4211 |
+
|
4212 |
+
$watchers.on(scrollEvent, function (ev) {
|
4213 |
+
var position = $(this).data('select2-scroll-position');
|
4214 |
+
$(this).scrollTop(position.y);
|
4215 |
+
});
|
4216 |
+
|
4217 |
+
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
|
4218 |
+
function (e) {
|
4219 |
+
self._positionDropdown();
|
4220 |
+
self._resizeDropdown();
|
4221 |
+
});
|
4222 |
+
};
|
4223 |
+
|
4224 |
+
AttachBody.prototype._detachPositioningHandler =
|
4225 |
+
function (decorated, container) {
|
4226 |
+
var scrollEvent = 'scroll.select2.' + container.id;
|
4227 |
+
var resizeEvent = 'resize.select2.' + container.id;
|
4228 |
+
var orientationEvent = 'orientationchange.select2.' + container.id;
|
4229 |
+
|
4230 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
4231 |
+
$watchers.off(scrollEvent);
|
4232 |
+
|
4233 |
+
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
|
4234 |
+
};
|
4235 |
+
|
4236 |
+
AttachBody.prototype._positionDropdown = function () {
|
4237 |
+
var $window = $(window);
|
4238 |
+
|
4239 |
+
var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
|
4240 |
+
var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
|
4241 |
+
|
4242 |
+
var newDirection = null;
|
4243 |
+
|
4244 |
+
var offset = this.$container.offset();
|
4245 |
+
|
4246 |
+
offset.bottom = offset.top + this.$container.outerHeight(false);
|
4247 |
+
|
4248 |
+
var container = {
|
4249 |
+
height: this.$container.outerHeight(false)
|
4250 |
+
};
|
4251 |
+
|
4252 |
+
container.top = offset.top;
|
4253 |
+
container.bottom = offset.top + container.height;
|
4254 |
+
|
4255 |
+
var dropdown = {
|
4256 |
+
height: this.$dropdown.outerHeight(false)
|
4257 |
+
};
|
4258 |
+
|
4259 |
+
var viewport = {
|
4260 |
+
top: $window.scrollTop(),
|
4261 |
+
bottom: $window.scrollTop() + $window.height()
|
4262 |
+
};
|
4263 |
+
|
4264 |
+
var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
|
4265 |
+
var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
|
4266 |
+
|
4267 |
+
var css = {
|
4268 |
+
left: offset.left,
|
4269 |
+
top: container.bottom
|
4270 |
+
};
|
4271 |
+
|
4272 |
+
// Determine what the parent element is to use for calciulating the offset
|
4273 |
+
var $offsetParent = this.$dropdownParent;
|
4274 |
+
|
4275 |
+
// For statically positoned elements, we need to get the element
|
4276 |
+
// that is determining the offset
|
4277 |
+
if ($offsetParent.css('position') === 'static') {
|
4278 |
+
$offsetParent = $offsetParent.offsetParent();
|
4279 |
+
}
|
4280 |
+
|
4281 |
+
var parentOffset = $offsetParent.offset();
|
4282 |
+
|
4283 |
+
css.top -= parentOffset.top;
|
4284 |
+
css.left -= parentOffset.left;
|
4285 |
+
|
4286 |
+
if (!isCurrentlyAbove && !isCurrentlyBelow) {
|
4287 |
+
newDirection = 'below';
|
4288 |
+
}
|
4289 |
+
|
4290 |
+
if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
|
4291 |
+
newDirection = 'above';
|
4292 |
+
} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
|
4293 |
+
newDirection = 'below';
|
4294 |
+
}
|
4295 |
+
|
4296 |
+
if (newDirection == 'above' ||
|
4297 |
+
(isCurrentlyAbove && newDirection !== 'below')) {
|
4298 |
+
css.top = container.top - parentOffset.top - dropdown.height;
|
4299 |
+
}
|
4300 |
+
|
4301 |
+
if (newDirection != null) {
|
4302 |
+
this.$dropdown
|
4303 |
+
.removeClass('select2-dropdown--below select2-dropdown--above')
|
4304 |
+
.addClass('select2-dropdown--' + newDirection);
|
4305 |
+
this.$container
|
4306 |
+
.removeClass('select2-container--below select2-container--above')
|
4307 |
+
.addClass('select2-container--' + newDirection);
|
4308 |
+
}
|
4309 |
+
|
4310 |
+
this.$dropdownContainer.css(css);
|
4311 |
+
};
|
4312 |
+
|
4313 |
+
AttachBody.prototype._resizeDropdown = function () {
|
4314 |
+
var css = {
|
4315 |
+
width: this.$container.outerWidth(false) + 'px'
|
4316 |
+
};
|
4317 |
+
|
4318 |
+
if (this.options.get('dropdownAutoWidth')) {
|
4319 |
+
css.minWidth = css.width;
|
4320 |
+
css.position = 'relative';
|
4321 |
+
css.width = 'auto';
|
4322 |
+
}
|
4323 |
+
|
4324 |
+
this.$dropdown.css(css);
|
4325 |
+
};
|
4326 |
+
|
4327 |
+
AttachBody.prototype._showDropdown = function (decorated) {
|
4328 |
+
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
4329 |
+
|
4330 |
+
this._positionDropdown();
|
4331 |
+
this._resizeDropdown();
|
4332 |
+
};
|
4333 |
+
|
4334 |
+
return AttachBody;
|
4335 |
+
});
|
4336 |
+
|
4337 |
+
S2.define('select2/dropdown/minimumResultsForSearch',[
|
4338 |
+
|
4339 |
+
], function () {
|
4340 |
+
function countResults (data) {
|
4341 |
+
var count = 0;
|
4342 |
+
|
4343 |
+
for (var d = 0; d < data.length; d++) {
|
4344 |
+
var item = data[d];
|
4345 |
+
|
4346 |
+
if (item.children) {
|
4347 |
+
count += countResults(item.children);
|
4348 |
+
} else {
|
4349 |
+
count++;
|
4350 |
+
}
|
4351 |
+
}
|
4352 |
+
|
4353 |
+
return count;
|
4354 |
+
}
|
4355 |
+
|
4356 |
+
function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
|
4357 |
+
this.minimumResultsForSearch = options.get('minimumResultsForSearch');
|
4358 |
+
|
4359 |
+
if (this.minimumResultsForSearch < 0) {
|
4360 |
+
this.minimumResultsForSearch = Infinity;
|
4361 |
+
}
|
4362 |
+
|
4363 |
+
decorated.call(this, $element, options, dataAdapter);
|
4364 |
+
}
|
4365 |
+
|
4366 |
+
MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
|
4367 |
+
if (countResults(params.data.results) < this.minimumResultsForSearch) {
|
4368 |
+
return false;
|
4369 |
+
}
|
4370 |
+
|
4371 |
+
return decorated.call(this, params);
|
4372 |
+
};
|
4373 |
+
|
4374 |
+
return MinimumResultsForSearch;
|
4375 |
+
});
|
4376 |
+
|
4377 |
+
S2.define('select2/dropdown/selectOnClose',[
|
4378 |
+
|
4379 |
+
], function () {
|
4380 |
+
function SelectOnClose () { }
|
4381 |
+
|
4382 |
+
SelectOnClose.prototype.bind = function (decorated, container, $container) {
|
4383 |
+
var self = this;
|
4384 |
+
|
4385 |
+
decorated.call(this, container, $container);
|
4386 |
+
|
4387 |
+
container.on('close', function (params) {
|
4388 |
+
self._handleSelectOnClose(params);
|
4389 |
+
});
|
4390 |
+
};
|
4391 |
+
|
4392 |
+
SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
|
4393 |
+
if (params && params.originalSelect2Event != null) {
|
4394 |
+
var event = params.originalSelect2Event;
|
4395 |
+
|
4396 |
+
// Don't select an item if the close event was triggered from a select or
|
4397 |
+
// unselect event
|
4398 |
+
if (event._type === 'select' || event._type === 'unselect') {
|
4399 |
+
return;
|
4400 |
+
}
|
4401 |
+
}
|
4402 |
+
|
4403 |
+
var $highlightedResults = this.getHighlightedResults();
|
4404 |
+
|
4405 |
+
// Only select highlighted results
|
4406 |
+
if ($highlightedResults.length < 1) {
|
4407 |
+
return;
|
4408 |
+
}
|
4409 |
+
|
4410 |
+
var data = $highlightedResults.data('data');
|
4411 |
+
|
4412 |
+
// Don't re-select already selected resulte
|
4413 |
+
if (
|
4414 |
+
(data.element != null && data.element.selected) ||
|
4415 |
+
(data.element == null && data.selected)
|
4416 |
+
) {
|
4417 |
+
return;
|
4418 |
+
}
|
4419 |
+
|
4420 |
+
this.trigger('select', {
|
4421 |
+
data: data
|
4422 |
+
});
|
4423 |
+
};
|
4424 |
+
|
4425 |
+
return SelectOnClose;
|
4426 |
+
});
|
4427 |
+
|
4428 |
+
S2.define('select2/dropdown/closeOnSelect',[
|
4429 |
+
|
4430 |
+
], function () {
|
4431 |
+
function CloseOnSelect () { }
|
4432 |
+
|
4433 |
+
CloseOnSelect.prototype.bind = function (decorated, container, $container) {
|
4434 |
+
var self = this;
|
4435 |
+
|
4436 |
+
decorated.call(this, container, $container);
|
4437 |
+
|
4438 |
+
container.on('select', function (evt) {
|
4439 |
+
self._selectTriggered(evt);
|
4440 |
+
});
|
4441 |
+
|
4442 |
+
container.on('unselect', function (evt) {
|
4443 |
+
self._selectTriggered(evt);
|
4444 |
+
});
|
4445 |
+
};
|
4446 |
+
|
4447 |
+
CloseOnSelect.prototype._selectTriggered = function (_, evt) {
|
4448 |
+
var originalEvent = evt.originalEvent;
|
4449 |
+
|
4450 |
+
// Don't close if the control key is being held
|
4451 |
+
if (originalEvent && originalEvent.ctrlKey) {
|
4452 |
+
return;
|
4453 |
+
}
|
4454 |
+
|
4455 |
+
this.trigger('close', {
|
4456 |
+
originalEvent: originalEvent,
|
4457 |
+
originalSelect2Event: evt
|
4458 |
+
});
|
4459 |
+
};
|
4460 |
+
|
4461 |
+
return CloseOnSelect;
|
4462 |
+
});
|
4463 |
+
|
4464 |
+
S2.define('select2/i18n/en',[],function () {
|
4465 |
+
// English
|
4466 |
+
return {
|
4467 |
+
errorLoading: function () {
|
4468 |
+
return 'The results could not be loaded.';
|
4469 |
+
},
|
4470 |
+
inputTooLong: function (args) {
|
4471 |
+
var overChars = args.input.length - args.maximum;
|
4472 |
+
|
4473 |
+
var message = 'Please delete ' + overChars + ' character';
|
4474 |
+
|
4475 |
+
if (overChars != 1) {
|
4476 |
+
message += 's';
|
4477 |
+
}
|
4478 |
+
|
4479 |
+
return message;
|
4480 |
+
},
|
4481 |
+
inputTooShort: function (args) {
|
4482 |
+
var remainingChars = args.minimum - args.input.length;
|
4483 |
+
|
4484 |
+
var message = 'Please enter ' + remainingChars + ' or more characters';
|
4485 |
+
|
4486 |
+
return message;
|
4487 |
+
},
|
4488 |
+
loadingMore: function () {
|
4489 |
+
return 'Loading more results…';
|
4490 |
+
},
|
4491 |
+
maximumSelected: function (args) {
|
4492 |
+
var message = 'You can only select ' + args.maximum + ' item';
|
4493 |
+
|
4494 |
+
if (args.maximum != 1) {
|
4495 |
+
message += 's';
|
4496 |
+
}
|
4497 |
+
|
4498 |
+
return message;
|
4499 |
+
},
|
4500 |
+
noResults: function () {
|
4501 |
+
return 'No results found';
|
4502 |
+
},
|
4503 |
+
searching: function () {
|
4504 |
+
return 'Searching…';
|
4505 |
+
}
|
4506 |
+
};
|
4507 |
+
});
|
4508 |
+
|
4509 |
+
S2.define('select2/defaults',[
|
4510 |
+
'jquery',
|
4511 |
+
'require',
|
4512 |
+
|
4513 |
+
'./results',
|
4514 |
+
|
4515 |
+
'./selection/single',
|
4516 |
+
'./selection/multiple',
|
4517 |
+
'./selection/placeholder',
|
4518 |
+
'./selection/allowClear',
|
4519 |
+
'./selection/search',
|
4520 |
+
'./selection/eventRelay',
|
4521 |
+
|
4522 |
+
'./utils',
|
4523 |
+
'./translation',
|
4524 |
+
'./diacritics',
|
4525 |
+
|
4526 |
+
'./data/select',
|
4527 |
+
'./data/array',
|
4528 |
+
'./data/ajax',
|
4529 |
+
'./data/tags',
|
4530 |
+
'./data/tokenizer',
|
4531 |
+
'./data/minimumInputLength',
|
4532 |
+
'./data/maximumInputLength',
|
4533 |
+
'./data/maximumSelectionLength',
|
4534 |
+
|
4535 |
+
'./dropdown',
|
4536 |
+
'./dropdown/search',
|
4537 |
+
'./dropdown/hidePlaceholder',
|
4538 |
+
'./dropdown/infiniteScroll',
|
4539 |
+
'./dropdown/attachBody',
|
4540 |
+
'./dropdown/minimumResultsForSearch',
|
4541 |
+
'./dropdown/selectOnClose',
|
4542 |
+
'./dropdown/closeOnSelect',
|
4543 |
+
|
4544 |
+
'./i18n/en'
|
4545 |
+
], function ($, require,
|
4546 |
+
|
4547 |
+
ResultsList,
|
4548 |
+
|
4549 |
+
SingleSelection, MultipleSelection, Placeholder, AllowClear,
|
4550 |
+
SelectionSearch, EventRelay,
|
4551 |
+
|
4552 |
+
Utils, Translation, DIACRITICS,
|
4553 |
+
|
4554 |
+
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
|
4555 |
+
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
|
4556 |
+
|
4557 |
+
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
4558 |
+
AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
|
4559 |
+
|
4560 |
+
EnglishTranslation) {
|
4561 |
+
function Defaults () {
|
4562 |
+
this.reset();
|
4563 |
+
}
|
4564 |
+
|
4565 |
+
Defaults.prototype.apply = function (options) {
|
4566 |
+
options = $.extend(true, {}, this.defaults, options);
|
4567 |
+
|
4568 |
+
if (options.dataAdapter == null) {
|
4569 |
+
if (options.ajax != null) {
|
4570 |
+
options.dataAdapter = AjaxData;
|
4571 |
+
} else if (options.data != null) {
|
4572 |
+
options.dataAdapter = ArrayData;
|
4573 |
+
} else {
|
4574 |
+
options.dataAdapter = SelectData;
|
4575 |
+
}
|
4576 |
+
|
4577 |
+
if (options.minimumInputLength > 0) {
|
4578 |
+
options.dataAdapter = Utils.Decorate(
|
4579 |
+
options.dataAdapter,
|
4580 |
+
MinimumInputLength
|
4581 |
+
);
|
4582 |
+
}
|
4583 |
+
|
4584 |
+
if (options.maximumInputLength > 0) {
|
4585 |
+
options.dataAdapter = Utils.Decorate(
|
4586 |
+
options.dataAdapter,
|
4587 |
+
MaximumInputLength
|
4588 |
+
);
|
4589 |
+
}
|
4590 |
+
|
4591 |
+
if (options.maximumSelectionLength > 0) {
|
4592 |
+
options.dataAdapter = Utils.Decorate(
|
4593 |
+
options.dataAdapter,
|
4594 |
+
MaximumSelectionLength
|
4595 |
+
);
|
4596 |
+
}
|
4597 |
+
|
4598 |
+
if (options.tags) {
|
4599 |
+
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
|
4600 |
+
}
|
4601 |
+
|
4602 |
+
if (options.tokenSeparators != null || options.tokenizer != null) {
|
4603 |
+
options.dataAdapter = Utils.Decorate(
|
4604 |
+
options.dataAdapter,
|
4605 |
+
Tokenizer
|
4606 |
+
);
|
4607 |
+
}
|
4608 |
+
|
4609 |
+
if (options.query != null) {
|
4610 |
+
var Query = require(options.amdBase + 'compat/query');
|
4611 |
+
|
4612 |
+
options.dataAdapter = Utils.Decorate(
|
4613 |
+
options.dataAdapter,
|
4614 |
+
Query
|
4615 |
+
);
|
4616 |
+
}
|
4617 |
+
|
4618 |
+
if (options.initSelection != null) {
|
4619 |
+
var InitSelection = require(options.amdBase + 'compat/initSelection');
|
4620 |
+
|
4621 |
+
options.dataAdapter = Utils.Decorate(
|
4622 |
+
options.dataAdapter,
|
4623 |
+
InitSelection
|
4624 |
+
);
|
4625 |
+
}
|
4626 |
+
}
|
4627 |
+
|
4628 |
+
if (options.resultsAdapter == null) {
|
4629 |
+
options.resultsAdapter = ResultsList;
|
4630 |
+
|
4631 |
+
if (options.ajax != null) {
|
4632 |
+
options.resultsAdapter = Utils.Decorate(
|
4633 |
+
options.resultsAdapter,
|
4634 |
+
InfiniteScroll
|
4635 |
+
);
|
4636 |
+
}
|
4637 |
+
|
4638 |
+
if (options.placeholder != null) {
|
4639 |
+
options.resultsAdapter = Utils.Decorate(
|
4640 |
+
options.resultsAdapter,
|
4641 |
+
HidePlaceholder
|
4642 |
+
);
|
4643 |
+
}
|
4644 |
+
|
4645 |
+
if (options.selectOnClose) {
|
4646 |
+
options.resultsAdapter = Utils.Decorate(
|
4647 |
+
options.resultsAdapter,
|
4648 |
+
SelectOnClose
|
4649 |
+
);
|
4650 |
+
}
|
4651 |
+
}
|
4652 |
+
|
4653 |
+
if (options.dropdownAdapter == null) {
|
4654 |
+
if (options.multiple) {
|
4655 |
+
options.dropdownAdapter = Dropdown;
|
4656 |
+
} else {
|
4657 |
+
var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
|
4658 |
+
|
4659 |
+
options.dropdownAdapter = SearchableDropdown;
|
4660 |
+
}
|
4661 |
+
|
4662 |
+
if (options.minimumResultsForSearch !== 0) {
|
4663 |
+
options.dropdownAdapter = Utils.Decorate(
|
4664 |
+
options.dropdownAdapter,
|
4665 |
+
MinimumResultsForSearch
|
4666 |
+
);
|
4667 |
+
}
|
4668 |
+
|
4669 |
+
if (options.closeOnSelect) {
|
4670 |
+
options.dropdownAdapter = Utils.Decorate(
|
4671 |
+
options.dropdownAdapter,
|
4672 |
+
CloseOnSelect
|
4673 |
+
);
|
4674 |
+
}
|
4675 |
+
|
4676 |
+
if (
|
4677 |
+
options.dropdownCssClass != null ||
|
4678 |
+
options.dropdownCss != null ||
|
4679 |
+
options.adaptDropdownCssClass != null
|
4680 |
+
) {
|
4681 |
+
var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
|
4682 |
+
|
4683 |
+
options.dropdownAdapter = Utils.Decorate(
|
4684 |
+
options.dropdownAdapter,
|
4685 |
+
DropdownCSS
|
4686 |
+
);
|
4687 |
+
}
|
4688 |
+
|
4689 |
+
options.dropdownAdapter = Utils.Decorate(
|
4690 |
+
options.dropdownAdapter,
|
4691 |
+
AttachBody
|
4692 |
+
);
|
4693 |
+
}
|
4694 |
+
|
4695 |
+
if (options.selectionAdapter == null) {
|
4696 |
+
if (options.multiple) {
|
4697 |
+
options.selectionAdapter = MultipleSelection;
|
4698 |
+
} else {
|
4699 |
+
options.selectionAdapter = SingleSelection;
|
4700 |
+
}
|
4701 |
+
|
4702 |
+
// Add the placeholder mixin if a placeholder was specified
|
4703 |
+
if (options.placeholder != null) {
|
4704 |
+
options.selectionAdapter = Utils.Decorate(
|
4705 |
+
options.selectionAdapter,
|
4706 |
+
Placeholder
|
4707 |
+
);
|
4708 |
+
}
|
4709 |
+
|
4710 |
+
if (options.allowClear) {
|
4711 |
+
options.selectionAdapter = Utils.Decorate(
|
4712 |
+
options.selectionAdapter,
|
4713 |
+
AllowClear
|
4714 |
+
);
|
4715 |
+
}
|
4716 |
+
|
4717 |
+
if (options.multiple) {
|
4718 |
+
options.selectionAdapter = Utils.Decorate(
|
4719 |
+
options.selectionAdapter,
|
4720 |
+
SelectionSearch
|
4721 |
+
);
|
4722 |
+
}
|
4723 |
+
|
4724 |
+
if (
|
4725 |
+
options.containerCssClass != null ||
|
4726 |
+
options.containerCss != null ||
|
4727 |
+
options.adaptContainerCssClass != null
|
4728 |
+
) {
|
4729 |
+
var ContainerCSS = require(options.amdBase + 'compat/containerCss');
|
4730 |
+
|
4731 |
+
options.selectionAdapter = Utils.Decorate(
|
4732 |
+
options.selectionAdapter,
|
4733 |
+
ContainerCSS
|
4734 |
+
);
|
4735 |
+
}
|
4736 |
+
|
4737 |
+
options.selectionAdapter = Utils.Decorate(
|
4738 |
+
options.selectionAdapter,
|
4739 |
+
EventRelay
|
4740 |
+
);
|
4741 |
+
}
|
4742 |
+
|
4743 |
+
if (typeof options.language === 'string') {
|
4744 |
+
// Check if the language is specified with a region
|
4745 |
+
if (options.language.indexOf('-') > 0) {
|
4746 |
+
// Extract the region information if it is included
|
4747 |
+
var languageParts = options.language.split('-');
|
4748 |
+
var baseLanguage = languageParts[0];
|
4749 |
+
|
4750 |
+
options.language = [options.language, baseLanguage];
|
4751 |
+
} else {
|
4752 |
+
options.language = [options.language];
|
4753 |
+
}
|
4754 |
+
}
|
4755 |
+
|
4756 |
+
if ($.isArray(options.language)) {
|
4757 |
+
var languages = new Translation();
|
4758 |
+
options.language.push('en');
|
4759 |
+
|
4760 |
+
var languageNames = options.language;
|
4761 |
+
|
4762 |
+
for (var l = 0; l < languageNames.length; l++) {
|
4763 |
+
var name = languageNames[l];
|
4764 |
+
var language = {};
|
4765 |
+
|
4766 |
+
try {
|
4767 |
+
// Try to load it with the original name
|
4768 |
+
language = Translation.loadPath(name);
|
4769 |
+
} catch (e) {
|
4770 |
+
try {
|
4771 |
+
// If we couldn't load it, check if it wasn't the full path
|
4772 |
+
name = this.defaults.amdLanguageBase + name;
|
4773 |
+
language = Translation.loadPath(name);
|
4774 |
+
} catch (ex) {
|
4775 |
+
// The translation could not be loaded at all. Sometimes this is
|
4776 |
+
// because of a configuration problem, other times this can be
|
4777 |
+
// because of how Select2 helps load all possible translation files.
|
4778 |
+
if (options.debug && window.console && console.warn) {
|
4779 |
+
console.warn(
|
4780 |
+
'Select2: The language file for "' + name + '" could not be ' +
|
4781 |
+
'automatically loaded. A fallback will be used instead.'
|
4782 |
+
);
|
4783 |
+
}
|
4784 |
+
|
4785 |
+
continue;
|
4786 |
+
}
|
4787 |
+
}
|
4788 |
+
|
4789 |
+
languages.extend(language);
|
4790 |
+
}
|
4791 |
+
|
4792 |
+
options.translations = languages;
|
4793 |
+
} else {
|
4794 |
+
var baseTranslation = Translation.loadPath(
|
4795 |
+
this.defaults.amdLanguageBase + 'en'
|
4796 |
+
);
|
4797 |
+
var customTranslation = new Translation(options.language);
|
4798 |
+
|
4799 |
+
customTranslation.extend(baseTranslation);
|
4800 |
+
|
4801 |
+
options.translations = customTranslation;
|
4802 |
+
}
|
4803 |
+
|
4804 |
+
return options;
|
4805 |
+
};
|
4806 |
+
|
4807 |
+
Defaults.prototype.reset = function () {
|
4808 |
+
function stripDiacritics (text) {
|
4809 |
+
// Used 'uni range + named function' from http://jsperf.com/diacritics/18
|
4810 |
+
function match(a) {
|
4811 |
+
return DIACRITICS[a] || a;
|
4812 |
+
}
|
4813 |
+
|
4814 |
+
return text.replace(/[^\u0000-\u007E]/g, match);
|
4815 |
+
}
|
4816 |
+
|
4817 |
+
function matcher (params, data) {
|
4818 |
+
// Always return the object if there is nothing to compare
|
4819 |
+
if ($.trim(params.term) === '') {
|
4820 |
+
return data;
|
4821 |
+
}
|
4822 |
+
|
4823 |
+
// Do a recursive check for options with children
|
4824 |
+
if (data.children && data.children.length > 0) {
|
4825 |
+
// Clone the data object if there are children
|
4826 |
+
// This is required as we modify the object to remove any non-matches
|
4827 |
+
var match = $.extend(true, {}, data);
|
4828 |
+
|
4829 |
+
// Check each child of the option
|
4830 |
+
for (var c = data.children.length - 1; c >= 0; c--) {
|
4831 |
+
var child = data.children[c];
|
4832 |
+
|
4833 |
+
var matches = matcher(params, child);
|
4834 |
+
|
4835 |
+
// If there wasn't a match, remove the object in the array
|
4836 |
+
if (matches == null) {
|
4837 |
+
match.children.splice(c, 1);
|
4838 |
+
}
|
4839 |
+
}
|
4840 |
+
|
4841 |
+
// If any children matched, return the new object
|
4842 |
+
if (match.children.length > 0) {
|
4843 |
+
return match;
|
4844 |
+
}
|
4845 |
+
|
4846 |
+
// If there were no matching children, check just the plain object
|
4847 |
+
return matcher(params, match);
|
4848 |
+
}
|
4849 |
+
|
4850 |
+
var original = stripDiacritics(data.text).toUpperCase();
|
4851 |
+
var term = stripDiacritics(params.term).toUpperCase();
|
4852 |
+
|
4853 |
+
// Check if the text contains the term
|
4854 |
+
if (original.indexOf(term) > -1) {
|
4855 |
+
return data;
|
4856 |
+
}
|
4857 |
+
|
4858 |
+
// If it doesn't contain the term, don't return anything
|
4859 |
+
return null;
|
4860 |
+
}
|
4861 |
+
|
4862 |
+
this.defaults = {
|
4863 |
+
amdBase: './',
|
4864 |
+
amdLanguageBase: './i18n/',
|
4865 |
+
closeOnSelect: true,
|
4866 |
+
debug: false,
|
4867 |
+
dropdownAutoWidth: false,
|
4868 |
+
escapeMarkup: Utils.escapeMarkup,
|
4869 |
+
language: EnglishTranslation,
|
4870 |
+
matcher: matcher,
|
4871 |
+
minimumInputLength: 0,
|
4872 |
+
maximumInputLength: 0,
|
4873 |
+
maximumSelectionLength: 0,
|
4874 |
+
minimumResultsForSearch: 0,
|
4875 |
+
selectOnClose: false,
|
4876 |
+
sorter: function (data) {
|
4877 |
+
return data;
|
4878 |
+
},
|
4879 |
+
templateResult: function (result) {
|
4880 |
+
return result.text;
|
4881 |
+
},
|
4882 |
+
templateSelection: function (selection) {
|
4883 |
+
return selection.text;
|
4884 |
+
},
|
4885 |
+
theme: 'default',
|
4886 |
+
width: 'resolve'
|
4887 |
+
};
|
4888 |
+
};
|
4889 |
+
|
4890 |
+
Defaults.prototype.set = function (key, value) {
|
4891 |
+
var camelKey = $.camelCase(key);
|
4892 |
+
|
4893 |
+
var data = {};
|
4894 |
+
data[camelKey] = value;
|
4895 |
+
|
4896 |
+
var convertedData = Utils._convertData(data);
|
4897 |
+
|
4898 |
+
$.extend(this.defaults, convertedData);
|
4899 |
+
};
|
4900 |
+
|
4901 |
+
var defaults = new Defaults();
|
4902 |
+
|
4903 |
+
return defaults;
|
4904 |
+
});
|
4905 |
+
|
4906 |
+
S2.define('select2/options',[
|
4907 |
+
'require',
|
4908 |
+
'jquery',
|
4909 |
+
'./defaults',
|
4910 |
+
'./utils'
|
4911 |
+
], function (require, $, Defaults, Utils) {
|
4912 |
+
function Options (options, $element) {
|
4913 |
+
this.options = options;
|
4914 |
+
|
4915 |
+
if ($element != null) {
|
4916 |
+
this.fromElement($element);
|
4917 |
+
}
|
4918 |
+
|
4919 |
+
this.options = Defaults.apply(this.options);
|
4920 |
+
|
4921 |
+
if ($element && $element.is('input')) {
|
4922 |
+
var InputCompat = require(this.get('amdBase') + 'compat/inputData');
|
4923 |
+
|
4924 |
+
this.options.dataAdapter = Utils.Decorate(
|
4925 |
+
this.options.dataAdapter,
|
4926 |
+
InputCompat
|
4927 |
+
);
|
4928 |
+
}
|
4929 |
+
}
|
4930 |
+
|
4931 |
+
Options.prototype.fromElement = function ($e) {
|
4932 |
+
var excludedData = ['select2'];
|
4933 |
+
|
4934 |
+
if (this.options.multiple == null) {
|
4935 |
+
this.options.multiple = $e.prop('multiple');
|
4936 |
+
}
|
4937 |
+
|
4938 |
+
if (this.options.disabled == null) {
|
4939 |
+
this.options.disabled = $e.prop('disabled');
|
4940 |
+
}
|
4941 |
+
|
4942 |
+
if (this.options.language == null) {
|
4943 |
+
if ($e.prop('lang')) {
|
4944 |
+
this.options.language = $e.prop('lang').toLowerCase();
|
4945 |
+
} else if ($e.closest('[lang]').prop('lang')) {
|
4946 |
+
this.options.language = $e.closest('[lang]').prop('lang');
|
4947 |
+
}
|
4948 |
+
}
|
4949 |
+
|
4950 |
+
if (this.options.dir == null) {
|
4951 |
+
if ($e.prop('dir')) {
|
4952 |
+
this.options.dir = $e.prop('dir');
|
4953 |
+
} else if ($e.closest('[dir]').prop('dir')) {
|
4954 |
+
this.options.dir = $e.closest('[dir]').prop('dir');
|
4955 |
+
} else {
|
4956 |
+
this.options.dir = 'ltr';
|
4957 |
+
}
|
4958 |
+
}
|
4959 |
+
|
4960 |
+
$e.prop('disabled', this.options.disabled);
|
4961 |
+
$e.prop('multiple', this.options.multiple);
|
4962 |
+
|
4963 |
+
if ($e.data('select2Tags')) {
|
4964 |
+
if (this.options.debug && window.console && console.warn) {
|
4965 |
+
console.warn(
|
4966 |
+
'Select2: The `data-select2-tags` attribute has been changed to ' +
|
4967 |
+
'use the `data-data` and `data-tags="true"` attributes and will be ' +
|
4968 |
+
'removed in future versions of Select2.'
|
4969 |
+
);
|
4970 |
+
}
|
4971 |
+
|
4972 |
+
$e.data('data', $e.data('select2Tags'));
|
4973 |
+
$e.data('tags', true);
|
4974 |
+
}
|
4975 |
+
|
4976 |
+
if ($e.data('ajaxUrl')) {
|
4977 |
+
if (this.options.debug && window.console && console.warn) {
|
4978 |
+
console.warn(
|
4979 |
+
'Select2: The `data-ajax-url` attribute has been changed to ' +
|
4980 |
+
'`data-ajax--url` and support for the old attribute will be removed' +
|
4981 |
+
' in future versions of Select2.'
|
4982 |
+
);
|
4983 |
+
}
|
4984 |
+
|
4985 |
+
$e.attr('ajax--url', $e.data('ajaxUrl'));
|
4986 |
+
$e.data('ajax--url', $e.data('ajaxUrl'));
|
4987 |
+
}
|
4988 |
+
|
4989 |
+
var dataset = {};
|
4990 |
+
|
4991 |
+
// Prefer the element's `dataset` attribute if it exists
|
4992 |
+
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
4993 |
+
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
|
4994 |
+
dataset = $.extend(true, {}, $e[0].dataset, $e.data());
|
4995 |
+
} else {
|
4996 |
+
dataset = $e.data();
|
4997 |
+
}
|
4998 |
+
|
4999 |
+
var data = $.extend(true, {}, dataset);
|
5000 |
+
|
5001 |
+
data = Utils._convertData(data);
|
5002 |
+
|
5003 |
+
for (var key in data) {
|
5004 |
+
if ($.inArray(key, excludedData) > -1) {
|
5005 |
+
continue;
|
5006 |
+
}
|
5007 |
+
|
5008 |
+
if ($.isPlainObject(this.options[key])) {
|
5009 |
+
$.extend(this.options[key], data[key]);
|
5010 |
+
} else {
|
5011 |
+
this.options[key] = data[key];
|
5012 |
+
}
|
5013 |
+
}
|
5014 |
+
|
5015 |
+
return this;
|
5016 |
+
};
|
5017 |
+
|
5018 |
+
Options.prototype.get = function (key) {
|
5019 |
+
return this.options[key];
|
5020 |
+
};
|
5021 |
+
|
5022 |
+
Options.prototype.set = function (key, val) {
|
5023 |
+
this.options[key] = val;
|
5024 |
+
};
|
5025 |
+
|
5026 |
+
return Options;
|
5027 |
+
});
|
5028 |
+
|
5029 |
+
S2.define('select2/core',[
|
5030 |
+
'jquery',
|
5031 |
+
'./options',
|
5032 |
+
'./utils',
|
5033 |
+
'./keys'
|
5034 |
+
], function ($, Options, Utils, KEYS) {
|
5035 |
+
var Select2 = function ($element, options) {
|
5036 |
+
if ($element.data('select2') != null) {
|
5037 |
+
$element.data('select2').destroy();
|
5038 |
+
}
|
5039 |
+
|
5040 |
+
this.$element = $element;
|
5041 |
+
|
5042 |
+
this.id = this._generateId($element);
|
5043 |
+
|
5044 |
+
options = options || {};
|
5045 |
+
|
5046 |
+
this.options = new Options(options, $element);
|
5047 |
+
|
5048 |
+
Select2.__super__.constructor.call(this);
|
5049 |
+
|
5050 |
+
// Set up the tabindex
|
5051 |
+
|
5052 |
+
var tabindex = $element.attr('tabindex') || 0;
|
5053 |
+
$element.data('old-tabindex', tabindex);
|
5054 |
+
$element.attr('tabindex', '-1');
|
5055 |
+
|
5056 |
+
// Set up containers and adapters
|
5057 |
+
|
5058 |
+
var DataAdapter = this.options.get('dataAdapter');
|
5059 |
+
this.dataAdapter = new DataAdapter($element, this.options);
|
5060 |
+
|
5061 |
+
var $container = this.render();
|
5062 |
+
|
5063 |
+
this._placeContainer($container);
|
5064 |
+
|
5065 |
+
var SelectionAdapter = this.options.get('selectionAdapter');
|
5066 |
+
this.selection = new SelectionAdapter($element, this.options);
|
5067 |
+
this.$selection = this.selection.render();
|
5068 |
+
|
5069 |
+
this.selection.position(this.$selection, $container);
|
5070 |
+
|
5071 |
+
var DropdownAdapter = this.options.get('dropdownAdapter');
|
5072 |
+
this.dropdown = new DropdownAdapter($element, this.options);
|
5073 |
+
this.$dropdown = this.dropdown.render();
|
5074 |
+
|
5075 |
+
this.dropdown.position(this.$dropdown, $container);
|
5076 |
+
|
5077 |
+
var ResultsAdapter = this.options.get('resultsAdapter');
|
5078 |
+
this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
|
5079 |
+
this.$results = this.results.render();
|
5080 |
+
|
5081 |
+
this.results.position(this.$results, this.$dropdown);
|
5082 |
+
|
5083 |
+
// Bind events
|
5084 |
+
|
5085 |
+
var self = this;
|
5086 |
+
|
5087 |
+
// Bind the container to all of the adapters
|
5088 |
+
this._bindAdapters();
|
5089 |
+
|
5090 |
+
// Register any DOM event handlers
|
5091 |
+
this._registerDomEvents();
|
5092 |
+
|
5093 |
+
// Register any internal event handlers
|
5094 |
+
this._registerDataEvents();
|
5095 |
+
this._registerSelectionEvents();
|
5096 |
+
this._registerDropdownEvents();
|
5097 |
+
this._registerResultsEvents();
|
5098 |
+
this._registerEvents();
|
5099 |
+
|
5100 |
+
// Set the initial state
|
5101 |
+
this.dataAdapter.current(function (initialData) {
|
5102 |
+
self.trigger('selection:update', {
|
5103 |
+
data: initialData
|
5104 |
+
});
|
5105 |
+
});
|
5106 |
+
|
5107 |
+
// Hide the original select
|
5108 |
+
$element.addClass('select2-hidden-accessible');
|
5109 |
+
$element.attr('aria-hidden', 'true');
|
5110 |
+
|
5111 |
+
// Synchronize any monitored attributes
|
5112 |
+
this._syncAttributes();
|
5113 |
+
|
5114 |
+
$element.data('select2', this);
|
5115 |
+
};
|
5116 |
+
|
5117 |
+
Utils.Extend(Select2, Utils.Observable);
|
5118 |
+
|
5119 |
+
Select2.prototype._generateId = function ($element) {
|
5120 |
+
var id = '';
|
5121 |
+
|
5122 |
+
if ($element.attr('id') != null) {
|
5123 |
+
id = $element.attr('id');
|
5124 |
+
} else if ($element.attr('name') != null) {
|
5125 |
+
id = $element.attr('name') + '-' + Utils.generateChars(2);
|
5126 |
+
} else {
|
5127 |
+
id = Utils.generateChars(4);
|
5128 |
+
}
|
5129 |
+
|
5130 |
+
id = id.replace(/(:|\.|\[|\]|,)/g, '');
|
5131 |
+
id = 'select2-' + id;
|
5132 |
+
|
5133 |
+
return id;
|
5134 |
+
};
|
5135 |
+
|
5136 |
+
Select2.prototype._placeContainer = function ($container) {
|
5137 |
+
$container.insertAfter(this.$element);
|
5138 |
+
|
5139 |
+
var width = this._resolveWidth(this.$element, this.options.get('width'));
|
5140 |
+
|
5141 |
+
if (width != null) {
|
5142 |
+
$container.css('width', width);
|
5143 |
+
}
|
5144 |
+
};
|
5145 |
+
|
5146 |
+
Select2.prototype._resolveWidth = function ($element, method) {
|
5147 |
+
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
|
5148 |
+
|
5149 |
+
if (method == 'resolve') {
|
5150 |
+
var styleWidth = this._resolveWidth($element, 'style');
|
5151 |
+
|
5152 |
+
if (styleWidth != null) {
|
5153 |
+
return styleWidth;
|
5154 |
+
}
|
5155 |
+
|
5156 |
+
return this._resolveWidth($element, 'element');
|
5157 |
+
}
|
5158 |
+
|
5159 |
+
if (method == 'element') {
|
5160 |
+
var elementWidth = $element.outerWidth(false);
|
5161 |
+
|
5162 |
+
if (elementWidth <= 0) {
|
5163 |
+
return 'auto';
|
5164 |
+
}
|
5165 |
+
|
5166 |
+
return elementWidth + 'px';
|
5167 |
+
}
|
5168 |
+
|
5169 |
+
if (method == 'style') {
|
5170 |
+
var style = $element.attr('style');
|
5171 |
+
|
5172 |
+
if (typeof(style) !== 'string') {
|
5173 |
+
return null;
|
5174 |
+
}
|
5175 |
+
|
5176 |
+
var attrs = style.split(';');
|
5177 |
+
|
5178 |
+
for (var i = 0, l = attrs.length; i < l; i = i + 1) {
|
5179 |
+
var attr = attrs[i].replace(/\s/g, '');
|
5180 |
+
var matches = attr.match(WIDTH);
|
5181 |
+
|
5182 |
+
if (matches !== null && matches.length >= 1) {
|
5183 |
+
return matches[1];
|
5184 |
+
}
|
5185 |
+
}
|
5186 |
+
|
5187 |
+
return null;
|
5188 |
+
}
|
5189 |
+
|
5190 |
+
return method;
|
5191 |
+
};
|
5192 |
+
|
5193 |
+
Select2.prototype._bindAdapters = function () {
|
5194 |
+
this.dataAdapter.bind(this, this.$container);
|
5195 |
+
this.selection.bind(this, this.$container);
|
5196 |
+
|
5197 |
+
this.dropdown.bind(this, this.$container);
|
5198 |
+
this.results.bind(this, this.$container);
|
5199 |
+
};
|
5200 |
+
|
5201 |
+
Select2.prototype._registerDomEvents = function () {
|
5202 |
+
var self = this;
|
5203 |
+
|
5204 |
+
this.$element.on('change.select2', function () {
|
5205 |
+
self.dataAdapter.current(function (data) {
|
5206 |
+
self.trigger('selection:update', {
|
5207 |
+
data: data
|
5208 |
+
});
|
5209 |
+
});
|
5210 |
+
});
|
5211 |
+
|
5212 |
+
this.$element.on('focus.select2', function (evt) {
|
5213 |
+
self.trigger('focus', evt);
|
5214 |
+
});
|
5215 |
+
|
5216 |
+
this._syncA = Utils.bind(this._syncAttributes, this);
|
5217 |
+
this._syncS = Utils.bind(this._syncSubtree, this);
|
5218 |
+
|
5219 |
+
if (this.$element[0].attachEvent) {
|
5220 |
+
this.$element[0].attachEvent('onpropertychange', this._syncA);
|
5221 |
+
}
|
5222 |
+
|
5223 |
+
var observer = window.MutationObserver ||
|
5224 |
+
window.WebKitMutationObserver ||
|
5225 |
+
window.MozMutationObserver
|
5226 |
+
;
|
5227 |
+
|
5228 |
+
if (observer != null) {
|
5229 |
+
this._observer = new observer(function (mutations) {
|
5230 |
+
$.each(mutations, self._syncA);
|
5231 |
+
$.each(mutations, self._syncS);
|
5232 |
+
});
|
5233 |
+
this._observer.observe(this.$element[0], {
|
5234 |
+
attributes: true,
|
5235 |
+
childList: true,
|
5236 |
+
subtree: false
|
5237 |
+
});
|
5238 |
+
} else if (this.$element[0].addEventListener) {
|
5239 |
+
this.$element[0].addEventListener(
|
5240 |
+
'DOMAttrModified',
|
5241 |
+
self._syncA,
|
5242 |
+
false
|
5243 |
+
);
|
5244 |
+
this.$element[0].addEventListener(
|
5245 |
+
'DOMNodeInserted',
|
5246 |
+
self._syncS,
|
5247 |
+
false
|
5248 |
+
);
|
5249 |
+
this.$element[0].addEventListener(
|
5250 |
+
'DOMNodeRemoved',
|
5251 |
+
self._syncS,
|
5252 |
+
false
|
5253 |
+
);
|
5254 |
+
}
|
5255 |
+
};
|
5256 |
+
|
5257 |
+
Select2.prototype._registerDataEvents = function () {
|
5258 |
+
var self = this;
|
5259 |
+
|
5260 |
+
this.dataAdapter.on('*', function (name, params) {
|
5261 |
+
self.trigger(name, params);
|
5262 |
+
});
|
5263 |
+
};
|
5264 |
+
|
5265 |
+
Select2.prototype._registerSelectionEvents = function () {
|
5266 |
+
var self = this;
|
5267 |
+
var nonRelayEvents = ['toggle', 'focus'];
|
5268 |
+
|
5269 |
+
this.selection.on('toggle', function () {
|
5270 |
+
self.toggleDropdown();
|
5271 |
+
});
|
5272 |
+
|
5273 |
+
this.selection.on('focus', function (params) {
|
5274 |
+
self.focus(params);
|
5275 |
+
});
|
5276 |
+
|
5277 |
+
this.selection.on('*', function (name, params) {
|
5278 |
+
if ($.inArray(name, nonRelayEvents) !== -1) {
|
5279 |
+
return;
|
5280 |
+
}
|
5281 |
+
|
5282 |
+
self.trigger(name, params);
|
5283 |
+
});
|
5284 |
+
};
|
5285 |
+
|
5286 |
+
Select2.prototype._registerDropdownEvents = function () {
|
5287 |
+
var self = this;
|
5288 |
+
|
5289 |
+
this.dropdown.on('*', function (name, params) {
|
5290 |
+
self.trigger(name, params);
|
5291 |
+
});
|
5292 |
+
};
|
5293 |
+
|
5294 |
+
Select2.prototype._registerResultsEvents = function () {
|
5295 |
+
var self = this;
|
5296 |
+
|
5297 |
+
this.results.on('*', function (name, params) {
|
5298 |
+
self.trigger(name, params);
|
5299 |
+
});
|
5300 |
+
};
|
5301 |
+
|
5302 |
+
Select2.prototype._registerEvents = function () {
|
5303 |
+
var self = this;
|
5304 |
+
|
5305 |
+
this.on('open', function () {
|
5306 |
+
self.$container.addClass('select2-container--open');
|
5307 |
+
});
|
5308 |
+
|
5309 |
+
this.on('close', function () {
|
5310 |
+
self.$container.removeClass('select2-container--open');
|
5311 |
+
});
|
5312 |
+
|
5313 |
+
this.on('enable', function () {
|
5314 |
+
self.$container.removeClass('select2-container--disabled');
|
5315 |
+
});
|
5316 |
+
|
5317 |
+
this.on('disable', function () {
|
5318 |
+
self.$container.addClass('select2-container--disabled');
|
5319 |
+
});
|
5320 |
+
|
5321 |
+
this.on('blur', function () {
|
5322 |
+
self.$container.removeClass('select2-container--focus');
|
5323 |
+
});
|
5324 |
+
|
5325 |
+
this.on('query', function (params) {
|
5326 |
+
if (!self.isOpen()) {
|
5327 |
+
self.trigger('open', {});
|
5328 |
+
}
|
5329 |
+
|
5330 |
+
this.dataAdapter.query(params, function (data) {
|
5331 |
+
self.trigger('results:all', {
|
5332 |
+
data: data,
|
5333 |
+
query: params
|
5334 |
+
});
|
5335 |
+
});
|
5336 |
+
});
|
5337 |
+
|
5338 |
+
this.on('query:append', function (params) {
|
5339 |
+
this.dataAdapter.query(params, function (data) {
|
5340 |
+
self.trigger('results:append', {
|
5341 |
+
data: data,
|
5342 |
+
query: params
|
5343 |
+
});
|
5344 |
+
});
|
5345 |
+
});
|
5346 |
+
|
5347 |
+
this.on('keypress', function (evt) {
|
5348 |
+
var key = evt.which;
|
5349 |
+
|
5350 |
+
if (self.isOpen()) {
|
5351 |
+
if (key === KEYS.ESC || key === KEYS.TAB ||
|
5352 |
+
(key === KEYS.UP && evt.altKey)) {
|
5353 |
+
self.close();
|
5354 |
+
|
5355 |
+
evt.preventDefault();
|
5356 |
+
} else if (key === KEYS.ENTER) {
|
5357 |
+
self.trigger('results:select', {});
|
5358 |
+
|
5359 |
+
evt.preventDefault();
|
5360 |
+
} else if ((key === KEYS.SPACE && evt.ctrlKey)) {
|
5361 |
+
self.trigger('results:toggle', {});
|
5362 |
+
|
5363 |
+
evt.preventDefault();
|
5364 |
+
} else if (key === KEYS.UP) {
|
5365 |
+
self.trigger('results:previous', {});
|
5366 |
+
|
5367 |
+
evt.preventDefault();
|
5368 |
+
} else if (key === KEYS.DOWN) {
|
5369 |
+
self.trigger('results:next', {});
|
5370 |
+
|
5371 |
+
evt.preventDefault();
|
5372 |
+
}
|
5373 |
+
} else {
|
5374 |
+
if (key === KEYS.ENTER || key === KEYS.SPACE ||
|
5375 |
+
(key === KEYS.DOWN && evt.altKey)) {
|
5376 |
+
self.open();
|
5377 |
+
|
5378 |
+
evt.preventDefault();
|
5379 |
+
}
|
5380 |
+
}
|
5381 |
+
});
|
5382 |
+
};
|
5383 |
+
|
5384 |
+
Select2.prototype._syncAttributes = function () {
|
5385 |
+
this.options.set('disabled', this.$element.prop('disabled'));
|
5386 |
+
|
5387 |
+
if (this.options.get('disabled')) {
|
5388 |
+
if (this.isOpen()) {
|
5389 |
+
this.close();
|
5390 |
+
}
|
5391 |
+
|
5392 |
+
this.trigger('disable', {});
|
5393 |
+
} else {
|
5394 |
+
this.trigger('enable', {});
|
5395 |
+
}
|
5396 |
+
};
|
5397 |
+
|
5398 |
+
Select2.prototype._syncSubtree = function (evt, mutations) {
|
5399 |
+
var changed = false;
|
5400 |
+
var self = this;
|
5401 |
+
|
5402 |
+
// Ignore any mutation events raised for elements that aren't options or
|
5403 |
+
// optgroups. This handles the case when the select element is destroyed
|
5404 |
+
if (
|
5405 |
+
evt && evt.target && (
|
5406 |
+
evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
|
5407 |
+
)
|
5408 |
+
) {
|
5409 |
+
return;
|
5410 |
+
}
|
5411 |
+
|
5412 |
+
if (!mutations) {
|
5413 |
+
// If mutation events aren't supported, then we can only assume that the
|
5414 |
+
// change affected the selections
|
5415 |
+
changed = true;
|
5416 |
+
} else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
|
5417 |
+
for (var n = 0; n < mutations.addedNodes.length; n++) {
|
5418 |
+
var node = mutations.addedNodes[n];
|
5419 |
+
|
5420 |
+
if (node.selected) {
|
5421 |
+
changed = true;
|
5422 |
+
}
|
5423 |
+
}
|
5424 |
+
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
|
5425 |
+
changed = true;
|
5426 |
+
}
|
5427 |
+
|
5428 |
+
// Only re-pull the data if we think there is a change
|
5429 |
+
if (changed) {
|
5430 |
+
this.dataAdapter.current(function (currentData) {
|
5431 |
+
self.trigger('selection:update', {
|
5432 |
+
data: currentData
|
5433 |
+
});
|
5434 |
+
});
|
5435 |
+
}
|
5436 |
+
};
|
5437 |
+
|
5438 |
+
/**
|
5439 |
+
* Override the trigger method to automatically trigger pre-events when
|
5440 |
+
* there are events that can be prevented.
|
5441 |
+
*/
|
5442 |
+
Select2.prototype.trigger = function (name, args) {
|
5443 |
+
var actualTrigger = Select2.__super__.trigger;
|
5444 |
+
var preTriggerMap = {
|
5445 |
+
'open': 'opening',
|
5446 |
+
'close': 'closing',
|
5447 |
+
'select': 'selecting',
|
5448 |
+
'unselect': 'unselecting'
|
5449 |
+
};
|
5450 |
+
|
5451 |
+
if (args === undefined) {
|
5452 |
+
args = {};
|
5453 |
+
}
|
5454 |
+
|
5455 |
+
if (name in preTriggerMap) {
|
5456 |
+
var preTriggerName = preTriggerMap[name];
|
5457 |
+
var preTriggerArgs = {
|
5458 |
+
prevented: false,
|
5459 |
+
name: name,
|
5460 |
+
args: args
|
5461 |
+
};
|
5462 |
+
|
5463 |
+
actualTrigger.call(this, preTriggerName, preTriggerArgs);
|
5464 |
+
|
5465 |
+
if (preTriggerArgs.prevented) {
|
5466 |
+
args.prevented = true;
|
5467 |
+
|
5468 |
+
return;
|
5469 |
+
}
|
5470 |
+
}
|
5471 |
+
|
5472 |
+
actualTrigger.call(this, name, args);
|
5473 |
+
};
|
5474 |
+
|
5475 |
+
Select2.prototype.toggleDropdown = function () {
|
5476 |
+
if (this.options.get('disabled')) {
|
5477 |
+
return;
|
5478 |
+
}
|
5479 |
+
|
5480 |
+
if (this.isOpen()) {
|
5481 |
+
this.close();
|
5482 |
+
} else {
|
5483 |
+
this.open();
|
5484 |
+
}
|
5485 |
+
};
|
5486 |
+
|
5487 |
+
Select2.prototype.open = function () {
|
5488 |
+
if (this.isOpen()) {
|
5489 |
+
return;
|
5490 |
+
}
|
5491 |
+
|
5492 |
+
this.trigger('query', {});
|
5493 |
+
};
|
5494 |
+
|
5495 |
+
Select2.prototype.close = function () {
|
5496 |
+
if (!this.isOpen()) {
|
5497 |
+
return;
|
5498 |
+
}
|
5499 |
+
|
5500 |
+
this.trigger('close', {});
|
5501 |
+
};
|
5502 |
+
|
5503 |
+
Select2.prototype.isOpen = function () {
|
5504 |
+
return this.$container.hasClass('select2-container--open');
|
5505 |
+
};
|
5506 |
+
|
5507 |
+
Select2.prototype.hasFocus = function () {
|
5508 |
+
return this.$container.hasClass('select2-container--focus');
|
5509 |
+
};
|
5510 |
+
|
5511 |
+
Select2.prototype.focus = function (data) {
|
5512 |
+
// No need to re-trigger focus events if we are already focused
|
5513 |
+
if (this.hasFocus()) {
|
5514 |
+
return;
|
5515 |
+
}
|
5516 |
+
|
5517 |
+
this.$container.addClass('select2-container--focus');
|
5518 |
+
this.trigger('focus', {});
|
5519 |
+
};
|
5520 |
+
|
5521 |
+
Select2.prototype.enable = function (args) {
|
5522 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
5523 |
+
console.warn(
|
5524 |
+
'Select2: The `select2("enable")` method has been deprecated and will' +
|
5525 |
+
' be removed in later Select2 versions. Use $element.prop("disabled")' +
|
5526 |
+
' instead.'
|
5527 |
+
);
|
5528 |
+
}
|
5529 |
+
|
5530 |
+
if (args == null || args.length === 0) {
|
5531 |
+
args = [true];
|
5532 |
+
}
|
5533 |
+
|
5534 |
+
var disabled = !args[0];
|
5535 |
+
|
5536 |
+
this.$element.prop('disabled', disabled);
|
5537 |
+
};
|
5538 |
+
|
5539 |
+
Select2.prototype.data = function () {
|
5540 |
+
if (this.options.get('debug') &&
|
5541 |
+
arguments.length > 0 && window.console && console.warn) {
|
5542 |
+
console.warn(
|
5543 |
+
'Select2: Data can no longer be set using `select2("data")`. You ' +
|
5544 |
+
'should consider setting the value instead using `$element.val()`.'
|
5545 |
+
);
|
5546 |
+
}
|
5547 |
+
|
5548 |
+
var data = [];
|
5549 |
+
|
5550 |
+
this.dataAdapter.current(function (currentData) {
|
5551 |
+
data = currentData;
|
5552 |
+
});
|
5553 |
+
|
5554 |
+
return data;
|
5555 |
+
};
|
5556 |
+
|
5557 |
+
Select2.prototype.val = function (args) {
|
5558 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
5559 |
+
console.warn(
|
5560 |
+
'Select2: The `select2("val")` method has been deprecated and will be' +
|
5561 |
+
' removed in later Select2 versions. Use $element.val() instead.'
|
5562 |
+
);
|
5563 |
+
}
|
5564 |
+
|
5565 |
+
if (args == null || args.length === 0) {
|
5566 |
+
return this.$element.val();
|
5567 |
+
}
|
5568 |
+
|
5569 |
+
var newVal = args[0];
|
5570 |
+
|
5571 |
+
if ($.isArray(newVal)) {
|
5572 |
+
newVal = $.map(newVal, function (obj) {
|
5573 |
+
return obj.toString();
|
5574 |
+
});
|
5575 |
+
}
|
5576 |
+
|
5577 |
+
this.$element.val(newVal).trigger('change');
|
5578 |
+
};
|
5579 |
+
|
5580 |
+
Select2.prototype.destroy = function () {
|
5581 |
+
this.$container.remove();
|
5582 |
+
|
5583 |
+
if (this.$element[0].detachEvent) {
|
5584 |
+
this.$element[0].detachEvent('onpropertychange', this._syncA);
|
5585 |
+
}
|
5586 |
+
|
5587 |
+
if (this._observer != null) {
|
5588 |
+
this._observer.disconnect();
|
5589 |
+
this._observer = null;
|
5590 |
+
} else if (this.$element[0].removeEventListener) {
|
5591 |
+
this.$element[0]
|
5592 |
+
.removeEventListener('DOMAttrModified', this._syncA, false);
|
5593 |
+
this.$element[0]
|
5594 |
+
.removeEventListener('DOMNodeInserted', this._syncS, false);
|
5595 |
+
this.$element[0]
|
5596 |
+
.removeEventListener('DOMNodeRemoved', this._syncS, false);
|
5597 |
+
}
|
5598 |
+
|
5599 |
+
this._syncA = null;
|
5600 |
+
this._syncS = null;
|
5601 |
+
|
5602 |
+
this.$element.off('.select2');
|
5603 |
+
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
|
5604 |
+
|
5605 |
+
this.$element.removeClass('select2-hidden-accessible');
|
5606 |
+
this.$element.attr('aria-hidden', 'false');
|
5607 |
+
this.$element.removeData('select2');
|
5608 |
+
|
5609 |
+
this.dataAdapter.destroy();
|
5610 |
+
this.selection.destroy();
|
5611 |
+
this.dropdown.destroy();
|
5612 |
+
this.results.destroy();
|
5613 |
+
|
5614 |
+
this.dataAdapter = null;
|
5615 |
+
this.selection = null;
|
5616 |
+
this.dropdown = null;
|
5617 |
+
this.results = null;
|
5618 |
+
};
|
5619 |
+
|
5620 |
+
Select2.prototype.render = function () {
|
5621 |
+
var $container = $(
|
5622 |
+
'<span class="select2 select2-container">' +
|
5623 |
+
'<span class="selection"></span>' +
|
5624 |
+
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
|
5625 |
+
'</span>'
|
5626 |
+
);
|
5627 |
+
|
5628 |
+
$container.attr('dir', this.options.get('dir'));
|
5629 |
+
|
5630 |
+
this.$container = $container;
|
5631 |
+
|
5632 |
+
this.$container.addClass('select2-container--' + this.options.get('theme'));
|
5633 |
+
|
5634 |
+
$container.data('element', this.$element);
|
5635 |
+
|
5636 |
+
return $container;
|
5637 |
+
};
|
5638 |
+
|
5639 |
+
return Select2;
|
5640 |
+
});
|
5641 |
+
|
5642 |
+
S2.define('jquery-mousewheel',[
|
5643 |
+
'jquery'
|
5644 |
+
], function ($) {
|
5645 |
+
// Used to shim jQuery.mousewheel for non-full builds.
|
5646 |
+
return $;
|
5647 |
+
});
|
5648 |
+
|
5649 |
+
S2.define('jquery.select2',[
|
5650 |
+
'jquery',
|
5651 |
+
'jquery-mousewheel',
|
5652 |
+
|
5653 |
+
'./select2/core',
|
5654 |
+
'./select2/defaults'
|
5655 |
+
], function ($, _, Select2, Defaults) {
|
5656 |
+
if ($.fn.select2 == null) {
|
5657 |
+
// All methods that should return the element
|
5658 |
+
var thisMethods = ['open', 'close', 'destroy'];
|
5659 |
+
|
5660 |
+
$.fn.select2 = function (options) {
|
5661 |
+
options = options || {};
|
5662 |
+
|
5663 |
+
if (typeof options === 'object') {
|
5664 |
+
this.each(function () {
|
5665 |
+
var instanceOptions = $.extend(true, {}, options);
|
5666 |
+
|
5667 |
+
var instance = new Select2($(this), instanceOptions);
|
5668 |
+
});
|
5669 |
+
|
5670 |
+
return this;
|
5671 |
+
} else if (typeof options === 'string') {
|
5672 |
+
var ret;
|
5673 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
5674 |
+
|
5675 |
+
this.each(function () {
|
5676 |
+
var instance = $(this).data('select2');
|
5677 |
+
|
5678 |
+
if (instance == null && window.console && console.error) {
|
5679 |
+
console.error(
|
5680 |
+
'The select2(\'' + options + '\') method was called on an ' +
|
5681 |
+
'element that is not using Select2.'
|
5682 |
+
);
|
5683 |
+
}
|
5684 |
+
|
5685 |
+
ret = instance[options].apply(instance, args);
|
5686 |
+
});
|
5687 |
+
|
5688 |
+
// Check if we should be returning `this`
|
5689 |
+
if ($.inArray(options, thisMethods) > -1) {
|
5690 |
+
return this;
|
5691 |
+
}
|
5692 |
+
|
5693 |
+
return ret;
|
5694 |
+
} else {
|
5695 |
+
throw new Error('Invalid arguments for Select2: ' + options);
|
5696 |
+
}
|
5697 |
+
};
|
5698 |
+
}
|
5699 |
+
|
5700 |
+
if ($.fn.select2.defaults == null) {
|
5701 |
+
$.fn.select2.defaults = Defaults;
|
5702 |
+
}
|
5703 |
+
|
5704 |
+
return Select2;
|
5705 |
+
});
|
5706 |
+
|
5707 |
+
// Return the AMD loader configuration so it can be used outside of this file
|
5708 |
+
return {
|
5709 |
+
define: S2.define,
|
5710 |
+
require: S2.require
|
5711 |
+
};
|
5712 |
+
}());
|
5713 |
+
|
5714 |
+
// Autoload the jQuery bindings
|
5715 |
+
// We know that all of the modules exist above this, so we're safe
|
5716 |
+
var select2 = S2.require('jquery.select2');
|
5717 |
+
|
5718 |
+
// Hold the AMD module references on the jQuery function that was just loaded
|
5719 |
+
// This allows Select2 to use the internal loader outside of this file, such
|
5720 |
+
// as in the language files.
|
5721 |
+
jQuery.fn.select2.amd = S2;
|
5722 |
+
|
5723 |
+
// Return the Select2 instance for anyone who is importing it.
|
5724 |
+
return select2;
|
5725 |
+
}));
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-select.js
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Select
|
3 |
+
*/
|
4 |
+
( function( $, CherryJsCore ){
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace('ui_elements.select');
|
8 |
+
CherryJsCore.ui_elements.select = {
|
9 |
+
init: function () {
|
10 |
+
$( window ).on( 'cherry-ui-elements-init', this.render.bind( this ) );
|
11 |
+
},
|
12 |
+
render: function ( event, data ) {
|
13 |
+
var target = data.target;
|
14 |
+
|
15 |
+
// init filter-select
|
16 |
+
$( '.cherry-ui-select[data-filter="true"], .cherry-ui-select[multiple]', target ).each( function() {
|
17 |
+
var $this = $( this );
|
18 |
+
|
19 |
+
$this.select2( {
|
20 |
+
placeholder: $this.attr('placeholder')
|
21 |
+
} );
|
22 |
+
} );
|
23 |
+
}
|
24 |
+
};
|
25 |
+
|
26 |
+
CherryJsCore.ui_elements.select.init();
|
27 |
+
|
28 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-select.scss
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
select.cherry-ui-select{
|
12 |
+
width: 100%;
|
13 |
+
outline: 0 none;
|
14 |
+
color: $dark_color_1;
|
15 |
+
@include input();
|
16 |
+
&:focus{
|
17 |
+
border-color: none;
|
18 |
+
box-shadow: none;
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
select.select2-hidden-accessible{
|
23 |
+
display: none;
|
24 |
+
}
|
25 |
+
.select2{
|
26 |
+
color: $dark_color_1;
|
27 |
+
background-color: $grey_color_3;
|
28 |
+
border-radius: $border_radius_extra_small;
|
29 |
+
.selection{
|
30 |
+
.select2-selection{
|
31 |
+
&.select2-selection--single{
|
32 |
+
background-color: transparent;
|
33 |
+
border: none;
|
34 |
+
border-radius: $border_radius_extra_small;
|
35 |
+
height: 50px;
|
36 |
+
.select2-selection__rendered{
|
37 |
+
padding: 15px 20px;
|
38 |
+
font-size: 14px;
|
39 |
+
line-height: 20px;
|
40 |
+
}
|
41 |
+
.select2-selection__arrow{
|
42 |
+
height: 50px;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
&.select2-selection--multiple{
|
46 |
+
background-color: transparent;
|
47 |
+
border: none;
|
48 |
+
border-radius: $border_radius_extra_small;
|
49 |
+
.select2-selection__rendered{
|
50 |
+
font-size: 14px;
|
51 |
+
line-height: 20px;
|
52 |
+
padding: 0;
|
53 |
+
display: block;
|
54 |
+
.select2-selection__choice{
|
55 |
+
line-height: 20px;
|
56 |
+
margin: 5px;
|
57 |
+
border: none;
|
58 |
+
background-color: $dark_color_2;
|
59 |
+
border-radius: $border_radius_extra_small;
|
60 |
+
color: #fff;
|
61 |
+
padding: 10px;
|
62 |
+
.select2-selection__choice__remove{
|
63 |
+
color: $red_color;
|
64 |
+
margin-right: 10px;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
.select2-selection__clear{
|
68 |
+
|
69 |
+
}
|
70 |
+
.select2-search{
|
71 |
+
margin: 0;
|
72 |
+
.select2-search__field{
|
73 |
+
padding: 0;
|
74 |
+
margin: 15px 10px;
|
75 |
+
border: none;
|
76 |
+
box-shadow: none;
|
77 |
+
line-height: 20px;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
.select2-container{
|
86 |
+
.select2-dropdown{
|
87 |
+
background-color: $grey_color_4;
|
88 |
+
border: none;
|
89 |
+
border-radius: $border_radius_extra_small;
|
90 |
+
margin: 5px 0;
|
91 |
+
z-index: 500001;
|
92 |
+
&.select2-container--open, &.select2-dropdown--below{
|
93 |
+
|
94 |
+
}
|
95 |
+
.select2-results{
|
96 |
+
.select2-results__options{
|
97 |
+
.select2-results__option{
|
98 |
+
color: #fff;
|
99 |
+
&[aria-selected=true]{
|
100 |
+
background-color: $green_color;
|
101 |
+
}
|
102 |
+
&--highlighted{
|
103 |
+
background-color: $dark_color_2;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
.li[aria-disabled=true]{
|
107 |
+
display: none;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/ui-select.php
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-select elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Select' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Select elements.
|
22 |
+
*/
|
23 |
+
class UI_Select extends UI_Element implements I_UI {
|
24 |
+
/**
|
25 |
+
* Default settings
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
private $defaults_settings = array(
|
30 |
+
'id' => 'cherry-ui-select-id',
|
31 |
+
'name' => 'cherry-ui-select-name',
|
32 |
+
'multiple' => false,
|
33 |
+
'filter' => false,
|
34 |
+
'size' => 1,
|
35 |
+
'inline_style' => 'width: 100%',
|
36 |
+
'value' => 'select-8',
|
37 |
+
'options' => array(
|
38 |
+
'select-1' => 'select 1',
|
39 |
+
'select-2' => 'select 2',
|
40 |
+
'select-3' => 'select 3',
|
41 |
+
'select-4' => 'select 4',
|
42 |
+
'select-5' => 'select 5',
|
43 |
+
'optgroup-1' => array(
|
44 |
+
'label' => 'Group 1',
|
45 |
+
'group_options' => array(
|
46 |
+
'select-6' => 'select 6',
|
47 |
+
'select-7' => 'select 7',
|
48 |
+
'select-8' => 'select 8',
|
49 |
+
),
|
50 |
+
),
|
51 |
+
'optgroup-2' => array(
|
52 |
+
'label' => 'Group 2',
|
53 |
+
'group_options' => array(
|
54 |
+
'select-9' => 'select 9',
|
55 |
+
'select-10' => 'select 10',
|
56 |
+
'select-11' => 'select 11',
|
57 |
+
),
|
58 |
+
),
|
59 |
+
),
|
60 |
+
'placeholder' => 'Select',
|
61 |
+
'label' => '',
|
62 |
+
'class' => '',
|
63 |
+
'master' => '',
|
64 |
+
);
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Constructor method for the UI_Select class.
|
68 |
+
*
|
69 |
+
* @since 4.0.0
|
70 |
+
*/
|
71 |
+
function __construct( $args = array() ) {
|
72 |
+
|
73 |
+
$this->defaults_settings['id'] = 'cherry-ui-select-'.uniqid();
|
74 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
75 |
+
|
76 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Render html UI_Select.
|
82 |
+
*
|
83 |
+
* @since 4.0.0
|
84 |
+
*/
|
85 |
+
public function render() {
|
86 |
+
|
87 |
+
$html = '';
|
88 |
+
|
89 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
90 |
+
|
91 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
92 |
+
|
93 |
+
( $this->settings['filter'] ) ? $filter_state = 'data-filter="true"' : $filter_state = 'data-filter="false"' ;
|
94 |
+
|
95 |
+
( $this->settings['multiple'] ) ? $multi_state = 'multiple="multiple"' : $multi_state = '' ;
|
96 |
+
( $this->settings['multiple'] ) ? $name = $this->settings['name'] . '[]' : $name = $this->settings['name'] ;
|
97 |
+
|
98 |
+
if ( '' !== $this->settings['label'] ) {
|
99 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . $this->settings['label'] . '</label> ';
|
100 |
+
}
|
101 |
+
|
102 |
+
$inline_style = $this->settings['inline_style'] ? 'style="' . esc_attr( $this->settings['inline_style'] ) . '"' : '' ;
|
103 |
+
|
104 |
+
$html .= '<select id="' . esc_attr( $this->settings['id'] ) . '" class="cherry-ui-select ' . esc_attr( $this->settings['class'] ) . '" name="' . esc_attr( $name ) . '" size="' . esc_attr( $this->settings['size'] ) . '" ' . $multi_state . ' ' . $filter_state . ' placeholder="' . $this->settings['placeholder'] . '" ' . $inline_style . ' >';
|
105 |
+
if ( $this->settings['options'] && ! empty( $this->settings['options'] ) && is_array( $this->settings['options'] ) ) {
|
106 |
+
foreach ( $this->settings['options'] as $option => $option_value ) {
|
107 |
+
if ( ! is_array( $this->settings['value'] ) ) {
|
108 |
+
$this->settings['value'] = array( $this->settings['value'] );
|
109 |
+
}
|
110 |
+
if ( false === strpos( $option, 'optgroup' ) ) {
|
111 |
+
$selected_state = '';
|
112 |
+
if ( $this->settings['value'] && ! empty( $this->settings['value'] ) ) {
|
113 |
+
foreach ( $this->settings['value'] as $key => $value ) {
|
114 |
+
$selected_state = selected( $value, $option, false );
|
115 |
+
if ( " selected='selected'" == $selected_state ) {
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected_state . '>'. esc_html( $option_value ) .'</option>';
|
121 |
+
} else {
|
122 |
+
$html .= '<optgroup label="' . esc_attr( $option_value['label'] ) . '">';
|
123 |
+
$selected_state = '';
|
124 |
+
foreach ( $option_value['group_options'] as $group_item => $group_value ) {
|
125 |
+
foreach ( $this->settings['value'] as $key => $value ) {
|
126 |
+
$selected_state = selected( $value, $group_item, false );
|
127 |
+
if ( " selected='selected'" == $selected_state ) {
|
128 |
+
break;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
$html .= '<option value="' . esc_attr( $group_item ) . '" ' . $selected_state . '>'. esc_html( $group_value ) .'</option>';
|
132 |
+
}
|
133 |
+
$html .= '</optgroup>';
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
$html .= '</select>';
|
138 |
+
$html .= '</div>';
|
139 |
+
|
140 |
+
return $html;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Enqueue javascript and stylesheet UI_Select
|
145 |
+
*
|
146 |
+
* @since 4.0.0
|
147 |
+
*/
|
148 |
+
public static function enqueue_assets() {
|
149 |
+
wp_enqueue_script(
|
150 |
+
'ui-select-select2',
|
151 |
+
esc_url( Cherry_Core::base_url( 'assets/min/select2.min.js', __FILE__ ) ),
|
152 |
+
array( 'jquery' ),
|
153 |
+
'4.0.3',
|
154 |
+
true
|
155 |
+
);
|
156 |
+
wp_enqueue_script(
|
157 |
+
'ui-select-min',
|
158 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-select.min.js', __FILE__ ) ),
|
159 |
+
array( 'jquery' ),
|
160 |
+
'1.0.0',
|
161 |
+
true
|
162 |
+
);
|
163 |
+
wp_enqueue_style(
|
164 |
+
'ui-select-select2',
|
165 |
+
esc_url( Cherry_Core::base_url( 'assets/min/select2.min.css', __FILE__ ) ),
|
166 |
+
array(),
|
167 |
+
'4.0.3',
|
168 |
+
'all'
|
169 |
+
);
|
170 |
+
wp_enqueue_style(
|
171 |
+
'ui-select-min',
|
172 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-select.min.css', __FILE__ ) ),
|
173 |
+
array(),
|
174 |
+
'1.0.0',
|
175 |
+
'all'
|
176 |
+
);
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/min/ui-slider.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-ui-container{margin:10px 0 20px 0}.cherry-ui-container .cherry-ui-container{margin:0}label.cherry-label{margin:0 0 5px 0;display:block}.cherry-slider-wrap{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.cherry-slider-wrap .cherry-slider-input{-webkit-box-flex:0;-webkit-flex:0 1 10%;-ms-flex:0 1 10%;flex:0 1 10%;min-width:100px;max-width:200px}.cherry-slider-wrap .cherry-slider-holder{-webkit-box-flex:0;-webkit-flex:0 1 90%;-ms-flex:0 1 90%;flex:0 1 90%;min-width:200px;max-width:300px;margin-right:20px}.cherry-slider-wrap .cherry-slider-holder input[type=range]{-webkit-appearance:none;width:100%;margin:20px 0}.cherry-slider-wrap .cherry-slider-holder input[type=range]:focus{outline:none}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-webkit-slider-runnable-track{width:100%;height:5px;cursor:pointer;box-shadow:none;background:#48c569;border-radius:25px;border:none}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-webkit-slider-thumb{box-shadow:5px 5px 13px rgba(0,0,0,0.18);border:5px solid #48c569;height:28px;width:28px;border-radius:15px;background:#48c569;cursor:pointer;-webkit-appearance:none;margin-top:-11.5px}.cherry-slider-wrap .cherry-slider-holder input[type=range]:focus::-webkit-slider-thumb{background:#f1f1f1}.cherry-slider-wrap .cherry-slider-holder input[type=range]:hover::-webkit-slider-thumb{background:#f1f1f1}.cherry-slider-wrap .cherry-slider-holder input[type=range]:focus::-webkit-slider-runnable-track{background:#48c569}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-moz-range-track{width:100%;height:5px;cursor:pointer;box-shadow:none;background:#48c569;border-radius:25px;border:none}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-moz-range-thumb{box-shadow:none;border:none;height:28px;width:28px;border-radius:15px;background:#48c569;cursor:pointer}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-ms-track{width:100%;height:10px;cursor:pointer;background:#f1f1f1;border-color:transparent;color:transparent}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-ms-fill-lower{background:#f1f1f1;border:none;border-radius:50px;box-shadow:none}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-ms-fill-upper{background:#48c569;border:none;border-radius:50px;box-shadow:none}.cherry-slider-wrap .cherry-slider-holder input[type=range]::-ms-thumb{box-shadow:none;border:none;height:10px;width:10px;border-radius:15px;background:#495159;cursor:pointer}.cherry-slider-wrap .cherry-slider-holder input[type=range]:focus::-ms-fill-lower{background:#f1f1f1}.cherry-slider-wrap .cherry-slider-holder input[type=range]:focus::-ms-fill-upper{background:#48c569}.cherry-slider-wrap .cherry-input{margin:0;width:100%}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/min/ui-slider.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,r){"use strict";r.utilites.namespace("ui_elements.slider"),r.ui_elements.slider={init:function(){e(document).on("ready",this.render.bind(this,{target:e("body")}))},render:function(r,i){e(i.target).on("input change",".cherry-slider-unit, .cherry-ui-stepper-input",this.changeHandler)},changeHandler:function(){var r=e(this),i=r.hasClass("cherry-slider-unit")?".cherry-ui-stepper-input":".cherry-slider-unit",n=r.closest(".cherry-slider-wrap");e(i,n).val(r.val())}},r.ui_elements.slider.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-slider.js
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Slider
|
3 |
+
*/
|
4 |
+
( function( $, CherryJsCore ) {
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace('ui_elements.slider');
|
8 |
+
CherryJsCore.ui_elements.slider = {
|
9 |
+
init: function () {
|
10 |
+
$( document ).on('ready', this.render.bind( this, { target: $( 'body' ) } ) );
|
11 |
+
},
|
12 |
+
render: function ( event, data ) {
|
13 |
+
$( data.target ).on( 'input change', '.cherry-slider-unit, .cherry-ui-stepper-input', this.changeHandler );
|
14 |
+
},
|
15 |
+
changeHandler: function () {
|
16 |
+
var $this = $( this ),
|
17 |
+
targetClass = ( ! $this.hasClass('cherry-slider-unit') ) ? '.cherry-slider-unit' : '.cherry-ui-stepper-input' ,
|
18 |
+
$sliderWrapper = $this.closest('.cherry-slider-wrap');
|
19 |
+
|
20 |
+
$( targetClass, $sliderWrapper ).val( $this.val() );
|
21 |
+
}
|
22 |
+
};
|
23 |
+
|
24 |
+
CherryJsCore.ui_elements.slider.init();
|
25 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-slider.scss
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
.cherry-ui-container{
|
7 |
+
margin: 0;
|
8 |
+
}
|
9 |
+
}
|
10 |
+
label.cherry-label{
|
11 |
+
margin: 0 0 5px 0;
|
12 |
+
display: block;
|
13 |
+
}
|
14 |
+
.cherry-slider-wrap{
|
15 |
+
display: flex;
|
16 |
+
flex-wrap: wrap;
|
17 |
+
.cherry-slider-input{
|
18 |
+
flex: 0 1 10%;
|
19 |
+
min-width: 100px;
|
20 |
+
max-width: 200px;
|
21 |
+
}
|
22 |
+
.cherry-slider-holder{
|
23 |
+
flex: 0 1 90%;
|
24 |
+
min-width: 200px;
|
25 |
+
max-width: 300px;
|
26 |
+
margin-right: 20px;
|
27 |
+
input[type=range] {
|
28 |
+
-webkit-appearance: none;
|
29 |
+
width: 100%;
|
30 |
+
margin: 20px 0;
|
31 |
+
}
|
32 |
+
input[type=range]:focus {
|
33 |
+
outline: none;
|
34 |
+
}
|
35 |
+
input[type=range]::-webkit-slider-runnable-track {
|
36 |
+
width: 100%;
|
37 |
+
height: 5px;
|
38 |
+
cursor: pointer;
|
39 |
+
box-shadow: none;
|
40 |
+
background: $green_color;
|
41 |
+
border-radius: 25px;
|
42 |
+
border: none;
|
43 |
+
}
|
44 |
+
input[type=range]::-webkit-slider-thumb {
|
45 |
+
box-shadow: 5px 5px 13px rgba(0, 0, 0, 0.18);
|
46 |
+
border: 5px solid $green_color;
|
47 |
+
height: 28px;
|
48 |
+
width: 28px;
|
49 |
+
border-radius: 15px;
|
50 |
+
background: $green_color;
|
51 |
+
cursor: pointer;
|
52 |
+
-webkit-appearance: none;
|
53 |
+
margin-top: -11.5px;
|
54 |
+
}
|
55 |
+
input[type=range]:focus::-webkit-slider-thumb {
|
56 |
+
background: $grey_color_3;
|
57 |
+
}
|
58 |
+
input[type=range]:hover::-webkit-slider-thumb {
|
59 |
+
background: $grey_color_3;
|
60 |
+
}
|
61 |
+
input[type=range]:focus::-webkit-slider-runnable-track {
|
62 |
+
background: $green_color;
|
63 |
+
}
|
64 |
+
input[type=range]::-moz-range-track {
|
65 |
+
width: 100%;
|
66 |
+
height: 5px;
|
67 |
+
cursor: pointer;
|
68 |
+
box-shadow: none;
|
69 |
+
background: $green_color;
|
70 |
+
border-radius: 25px;
|
71 |
+
border: none;
|
72 |
+
}
|
73 |
+
input[type=range]::-moz-range-thumb {
|
74 |
+
box-shadow: none;
|
75 |
+
border: none;
|
76 |
+
height: 28px;
|
77 |
+
width: 28px;
|
78 |
+
border-radius: 15px;
|
79 |
+
background: $green_color;
|
80 |
+
cursor: pointer;
|
81 |
+
}
|
82 |
+
input[type=range]::-ms-track {
|
83 |
+
width: 100%;
|
84 |
+
height: 10px;
|
85 |
+
cursor: pointer;
|
86 |
+
background: $grey_color_3;
|
87 |
+
border-color: transparent;
|
88 |
+
color: transparent;
|
89 |
+
}
|
90 |
+
input[type=range]::-ms-fill-lower {
|
91 |
+
background: $grey_color_3;
|
92 |
+
border: none;
|
93 |
+
border-radius: 50px;
|
94 |
+
box-shadow: none;
|
95 |
+
}
|
96 |
+
input[type=range]::-ms-fill-upper {
|
97 |
+
background: $green_color;
|
98 |
+
border: none;
|
99 |
+
border-radius: 50px;
|
100 |
+
box-shadow: none;
|
101 |
+
}
|
102 |
+
input[type=range]::-ms-thumb {
|
103 |
+
box-shadow: none;
|
104 |
+
border: none;
|
105 |
+
height: 10px;
|
106 |
+
width: 10px;
|
107 |
+
border-radius: 15px;
|
108 |
+
background: #495159;
|
109 |
+
cursor: pointer;
|
110 |
+
}
|
111 |
+
input[type=range]:focus::-ms-fill-lower {
|
112 |
+
background: $grey_color_3;
|
113 |
+
}
|
114 |
+
input[type=range]:focus::-ms-fill-upper {
|
115 |
+
background: $green_color;
|
116 |
+
}
|
117 |
+
|
118 |
+
.cherry-slider-unit{
|
119 |
+
|
120 |
+
}
|
121 |
+
}
|
122 |
+
.cherry-input{
|
123 |
+
margin: 0;
|
124 |
+
width: 100%;
|
125 |
+
}
|
126 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/ui-slider.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui slider elements .
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Slider' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Slider elements.
|
22 |
+
*/
|
23 |
+
class UI_Slider extends UI_Element implements I_UI {
|
24 |
+
/**
|
25 |
+
* Default settings
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
private $defaults_settings = array(
|
30 |
+
'id' => 'cherry-ui-slider-id',
|
31 |
+
'name' => 'cherry-ui-slider-name',
|
32 |
+
'max_value' => 100,
|
33 |
+
'min_value' => 0,
|
34 |
+
'value' => 50,
|
35 |
+
'step_value' => 1,
|
36 |
+
'label' => '',
|
37 |
+
'class' => '',
|
38 |
+
'master' => '',
|
39 |
+
);
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Constructor method for the UI_Slider class.
|
43 |
+
*
|
44 |
+
* @since 4.0.0
|
45 |
+
*/
|
46 |
+
function __construct( $args = array() ) {
|
47 |
+
$this->defaults_settings['id'] = 'cherry-ui-slider-'.uniqid();
|
48 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
49 |
+
|
50 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Render html UI_Slider.
|
55 |
+
*
|
56 |
+
* @since 4.0.0
|
57 |
+
*/
|
58 |
+
public function render() {
|
59 |
+
$html = '';
|
60 |
+
|
61 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
62 |
+
|
63 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
64 |
+
|
65 |
+
$ui_stepper = new UI_Stepper(
|
66 |
+
array(
|
67 |
+
'id' => $this->settings['id'] . '-stepper',
|
68 |
+
'name' => $this->settings['name'],
|
69 |
+
'max_value' => $this->settings['max_value'],
|
70 |
+
'min_value' => $this->settings['min_value'],
|
71 |
+
'value' => $this->settings['value'],
|
72 |
+
'step_value' => $this->settings['step_value'],
|
73 |
+
)
|
74 |
+
);
|
75 |
+
$ui_stepper_html = $ui_stepper->render();
|
76 |
+
|
77 |
+
if ( '' !== $this->settings['label'] ) {
|
78 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
79 |
+
}
|
80 |
+
$html .= '<div class="cherry-slider-wrap">';
|
81 |
+
$html .= '<div class="cherry-slider-holder">';
|
82 |
+
$html .= '<input type="range" class="cherry-slider-unit" step="' . esc_attr( $this->settings['step_value'] ) . '" min="' . esc_attr( $this->settings['min_value'] ) . '" max="' . esc_attr( $this->settings['max_value'] ) . '" value="' . esc_attr( $this->settings['value'] ) . '">';
|
83 |
+
$html .= '</div>';
|
84 |
+
$html .= '<div class="cherry-slider-input">';
|
85 |
+
$html .= $ui_stepper_html;
|
86 |
+
$html .= '</div>';
|
87 |
+
$html .= '</div>';
|
88 |
+
$html .= '</div>';
|
89 |
+
|
90 |
+
return $html;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Enqueue javascript and stylesheet UI_Slider.
|
95 |
+
*
|
96 |
+
* @since 4.0.0
|
97 |
+
*/
|
98 |
+
public static function enqueue_assets() {
|
99 |
+
|
100 |
+
wp_enqueue_script(
|
101 |
+
'ui-slider-min',
|
102 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-slider.min.js', __FILE__ ) ),
|
103 |
+
array( 'jquery' ),
|
104 |
+
'1.0.0',
|
105 |
+
true
|
106 |
+
);
|
107 |
+
|
108 |
+
wp_enqueue_style(
|
109 |
+
'ui-slider-min',
|
110 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-slider.min.css', __FILE__ ) ),
|
111 |
+
array(),
|
112 |
+
'1.0.0',
|
113 |
+
'all'
|
114 |
+
);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/min/ui-stepper.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-ui-container{margin:10px 0 20px 0}label.cherry-label{margin:0 0 5px 0;display:block}.cherry-ui-stepper{position:relative;max-width:100px}.cherry-ui-stepper input[type=number]{font-size:14px;line-height:20px;color:#23282d;background-color:#f1f1f1;border-radius:2px;padding:10px 20px;height:50px;border:1px solid #f1f1f1;box-shadow:none;padding:10px 10px 10px 20px}.cherry-ui-stepper input[type=number]:focus{border-color:rgba(72,197,105,0.6);box-shadow:0 0 2px rgba(72,197,105,0.6)}.cherry-ui-stepper-input{min-width:90px;max-width:90px;text-align:center}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/assets/ui-stepper.scss
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
.cherry-ui-stepper{
|
12 |
+
position: relative;
|
13 |
+
max-width: 100px;
|
14 |
+
input[type=number]{
|
15 |
+
@include input();
|
16 |
+
padding: 10px 10px 10px 20px;
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
20 |
+
.cherry-ui-stepper-input{
|
21 |
+
min-width: 90px;
|
22 |
+
max-width: 90px;
|
23 |
+
text-align: center;
|
24 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/ui-stepper.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui stepper elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Stepper' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Stepper elements.
|
22 |
+
*/
|
23 |
+
class UI_Stepper extends UI_Element implements I_UI {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Default settings
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
private $defaults_settings = array(
|
31 |
+
'id' => 'cherry-ui-stepper-id',
|
32 |
+
'name' => 'cherry-ui-stepper-name',
|
33 |
+
'value' => '0',
|
34 |
+
'max_value' => '100',
|
35 |
+
'min_value' => '0',
|
36 |
+
'step_value' => '1',
|
37 |
+
'label' => '',
|
38 |
+
'class' => '',
|
39 |
+
'master' => '',
|
40 |
+
'placeholder' => '',
|
41 |
+
);
|
42 |
+
/**
|
43 |
+
* Constructor method for the UI_Stepper class.
|
44 |
+
*
|
45 |
+
* @since 4.0.0
|
46 |
+
*/
|
47 |
+
function __construct( $args = array() ) {
|
48 |
+
$this->defaults_settings['id'] = 'cherry-ui-stepper-'.uniqid();
|
49 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
50 |
+
|
51 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Render html UI_Stepper.
|
57 |
+
*
|
58 |
+
* @since 4.0.0
|
59 |
+
*/
|
60 |
+
public function render() {
|
61 |
+
$html = '';
|
62 |
+
|
63 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
64 |
+
|
65 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
66 |
+
|
67 |
+
if ( '' !== $this->settings['label'] ) {
|
68 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
69 |
+
}
|
70 |
+
$html .= '<div class="cherry-ui-stepper ' . esc_attr( $this->settings['class'] ) . '">';
|
71 |
+
$html .= '<input type="number" id="' . esc_attr( $this->settings['id'] ) . '" class="cherry-ui-stepper-input" pattern="[0-5]+([\.,][0-5]+)?" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '" min="' . esc_html( $this->settings['min_value'] ) . '" max="' . esc_html( $this->settings['max_value'] ) . '" step="' . esc_html( $this->settings['step_value'] ) . '" placeholder="' . esc_attr( $this->settings['placeholder'] ) . '">';
|
72 |
+
$html .= '</div>';
|
73 |
+
$html .= '</div>';
|
74 |
+
|
75 |
+
return $html;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Enqueue javascript and stylesheet UI_Stepper.
|
80 |
+
*
|
81 |
+
* @since 4.0.0
|
82 |
+
*/
|
83 |
+
public static function enqueue_assets() {
|
84 |
+
wp_enqueue_style(
|
85 |
+
'ui-stepper-min',
|
86 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-stepper.min.css', __FILE__ ) ),
|
87 |
+
array(),
|
88 |
+
'1.0.0',
|
89 |
+
'all'
|
90 |
+
);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/min/ui-switcher.min.css
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-container {
|
2 |
+
margin: 10px 0 20px 0; }
|
3 |
+
|
4 |
+
label.cherry-label {
|
5 |
+
margin: 0 0 5px 0;
|
6 |
+
display: block; }
|
7 |
+
|
8 |
+
.cherry-switcher-wrap {
|
9 |
+
height: 49px;
|
10 |
+
border-radius: 25px;
|
11 |
+
display: inline-block;
|
12 |
+
overflow: hidden;
|
13 |
+
position: relative;
|
14 |
+
cursor: pointer;
|
15 |
+
-webkit-user-select: none;
|
16 |
+
-moz-user-select: none;
|
17 |
+
-ms-user-select: none;
|
18 |
+
user-select: none; }
|
19 |
+
.cherry-switcher-wrap label {
|
20 |
+
height: 49px;
|
21 |
+
background-color: #e54343;
|
22 |
+
display: block;
|
23 |
+
float: left;
|
24 |
+
-webkit-transition: all 0.2s ease-in-out;
|
25 |
+
transition: all 0.2s ease-in-out; }
|
26 |
+
.cherry-switcher-wrap label span {
|
27 |
+
font-size: 12px;
|
28 |
+
line-height: 19px;
|
29 |
+
font-weight: 800;
|
30 |
+
text-transform: uppercase;
|
31 |
+
color: #fff;
|
32 |
+
padding: 15px;
|
33 |
+
text-align: center;
|
34 |
+
display: block;
|
35 |
+
opacity: 1;
|
36 |
+
-webkit-transition: all 0.2s ease-in-out;
|
37 |
+
transition: all 0.2s ease-in-out; }
|
38 |
+
.cherry-switcher-wrap .sw-enable span {
|
39 |
+
opacity: 0; }
|
40 |
+
.cherry-switcher-wrap .sw-disable span {
|
41 |
+
opacity: 1; }
|
42 |
+
.cherry-switcher-wrap .state-marker {
|
43 |
+
background-color: #fff;
|
44 |
+
display: block;
|
45 |
+
position: absolute;
|
46 |
+
width: 41px;
|
47 |
+
height: 41px;
|
48 |
+
margin: 4px;
|
49 |
+
top: 0;
|
50 |
+
left: 0;
|
51 |
+
margin-left: 4px;
|
52 |
+
border-radius: 25px;
|
53 |
+
-webkit-transition: all 0.2s ease-in-out;
|
54 |
+
transition: all 0.2s ease-in-out; }
|
55 |
+
.cherry-switcher-wrap.selected .sw-enable {
|
56 |
+
background-color: #48c569; }
|
57 |
+
.cherry-switcher-wrap.selected .sw-enable span {
|
58 |
+
opacity: 1; }
|
59 |
+
.cherry-switcher-wrap.selected .sw-disable {
|
60 |
+
background-color: #48c569; }
|
61 |
+
.cherry-switcher-wrap.selected .sw-disable span {
|
62 |
+
opacity: 0; }
|
63 |
+
.cherry-switcher-wrap.selected .state-marker {
|
64 |
+
left: 100%;
|
65 |
+
margin-left: -45px; }
|
66 |
+
.cherry-switcher-wrap.size-small {
|
67 |
+
height: 25px; }
|
68 |
+
.cherry-switcher-wrap.size-small label {
|
69 |
+
height: 25px; }
|
70 |
+
.cherry-switcher-wrap.size-small label span {
|
71 |
+
font-size: 10px;
|
72 |
+
line-height: 15px;
|
73 |
+
padding: 5px; }
|
74 |
+
.cherry-switcher-wrap.size-small .state-marker {
|
75 |
+
width: 17px;
|
76 |
+
height: 17px;
|
77 |
+
margin-left: 4px; }
|
78 |
+
.cherry-switcher-wrap.size-small.selected .state-marker {
|
79 |
+
left: 0;
|
80 |
+
margin-left: 33px; }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/min/ui-switcher.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,t){"use strict";t.utilites.namespace("ui_elements.switcher"),t.ui_elements.switcher={init:function(){e(window).on("cherry-ui-elements-init",this.render.bind(this))},render:function(t,r){var a=r.target;e(".cherry-switcher-wrap",a).each(function(){var t=e(this),r=e(".cherry-input-switcher",t),i="true"===r.val(),s="undefined"!=typeof r.data("true-slave")?r.data("true-slave"):null,n="undefined"!=typeof r.data("false-slave")?r.data("false-slave"):null;i?(t.addClass("selected"),e("."+n,a)[0]&&e("."+n,a).hide()):(t.removeClass("selected"),e("."+s,a)[0]&&e("."+s,a).hide())}),e(".cherry-switcher-wrap",a).on("click",{target:a},this.swiperHandler)},swiperHandler:function(t){var r=e(this),a=e(".cherry-input-switcher",r),i=a.data("true-slave"),s=a.data("false-slave"),n=t.data.target;r.toggleClass("selected"),a.attr("value","true"===a.val()?!1:!0).trigger("change").trigger("switcher_disabled_event",[i,s]),e("."+i,n).toggle(),e("."+s,n).toggle()}},t.ui_elements.switcher.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-switcher.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Switcher
|
3 |
+
*/
|
4 |
+
( function( $, CherryJsCore ){
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace('ui_elements.switcher');
|
8 |
+
CherryJsCore.ui_elements.switcher = {
|
9 |
+
init: function () {
|
10 |
+
$( window ).on( 'cherry-ui-elements-init', this.render.bind( this ) );
|
11 |
+
},
|
12 |
+
render: function ( event, data ) {
|
13 |
+
var target = data.target;
|
14 |
+
|
15 |
+
$( '.cherry-switcher-wrap', target ).each( function() {
|
16 |
+
var $this = $( this ),
|
17 |
+
$input = $( '.cherry-input-switcher', $this ),
|
18 |
+
inputValue = ( $input.val() === 'true' ),
|
19 |
+
true_slave = ( typeof $input.data('true-slave') !== 'undefined' ) ? $input.data( 'true-slave' ) : null,
|
20 |
+
false_slave = ( typeof $input.data('false-slave') !== 'undefined' ) ? $input.data( 'false-slave' ) : null;
|
21 |
+
|
22 |
+
if ( ! inputValue ) {
|
23 |
+
$this.removeClass('selected');
|
24 |
+
|
25 |
+
if ( $( '.' + true_slave, target )[0] ) {
|
26 |
+
$( '.' + true_slave, target ).hide();
|
27 |
+
}
|
28 |
+
} else {
|
29 |
+
$this.addClass('selected');
|
30 |
+
|
31 |
+
if ( $( '.' + false_slave, target )[0] ) {
|
32 |
+
$( '.' + false_slave, target ).hide();
|
33 |
+
}
|
34 |
+
}
|
35 |
+
});
|
36 |
+
|
37 |
+
$( '.cherry-switcher-wrap', target ).on( 'click', { target: target }, this.swiperHandler );
|
38 |
+
},
|
39 |
+
swiperHandler: function ( event ) {
|
40 |
+
var $this = $( this ),
|
41 |
+
$input = $( '.cherry-input-switcher', $this ),
|
42 |
+
true_slave = $input.data('true-slave'),
|
43 |
+
false_slave = $input.data('false-slave'),
|
44 |
+
target = event.data.target;
|
45 |
+
|
46 |
+
$this.toggleClass('selected');
|
47 |
+
|
48 |
+
$input
|
49 |
+
.attr( 'value', ( $input.val() === 'true' ) ? false : true )
|
50 |
+
.trigger( 'change' )
|
51 |
+
.trigger( 'switcher_disabled_event', [ true_slave, false_slave ] );
|
52 |
+
|
53 |
+
|
54 |
+
$( '.' + true_slave , target ).toggle();
|
55 |
+
$( '.' + false_slave, target ).toggle();
|
56 |
+
}
|
57 |
+
};
|
58 |
+
|
59 |
+
CherryJsCore.ui_elements.switcher.init();
|
60 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-switcher.scss
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
.cherry-switcher-wrap{
|
12 |
+
height: 49px;
|
13 |
+
border-radius: 25px;
|
14 |
+
display: inline-block;
|
15 |
+
overflow: hidden;
|
16 |
+
position: relative;
|
17 |
+
cursor: pointer;
|
18 |
+
user-select: none;
|
19 |
+
label{
|
20 |
+
height: 49px;
|
21 |
+
background-color: $red_color;
|
22 |
+
display: block;
|
23 |
+
float: left;
|
24 |
+
transition: all 0.2s ease-in-out;
|
25 |
+
span{
|
26 |
+
font-size: 12px;
|
27 |
+
line-height: 19px;
|
28 |
+
font-weight: 800;
|
29 |
+
text-transform: uppercase;
|
30 |
+
color: #fff;
|
31 |
+
padding: 15px;
|
32 |
+
text-align: center;
|
33 |
+
display: block;
|
34 |
+
opacity: 1;
|
35 |
+
transition: all 0.2s ease-in-out;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
.sw-enable{
|
39 |
+
span{
|
40 |
+
opacity: 0;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
.sw-disable{
|
44 |
+
span{
|
45 |
+
opacity: 1;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
.state-marker{
|
49 |
+
background-color: #fff;
|
50 |
+
display: block;
|
51 |
+
position: absolute;
|
52 |
+
width: 41px;
|
53 |
+
height: 41px;
|
54 |
+
margin: 4px;
|
55 |
+
top: 0;
|
56 |
+
left: 0;
|
57 |
+
margin-left: 4px;
|
58 |
+
border-radius: 25px;
|
59 |
+
transition: all 0.2s ease-in-out;
|
60 |
+
}
|
61 |
+
&.selected{
|
62 |
+
.sw-enable{
|
63 |
+
background-color: $green_color;
|
64 |
+
span{
|
65 |
+
opacity: 1;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
.sw-disable{
|
69 |
+
background-color: $green_color;
|
70 |
+
span{
|
71 |
+
opacity: 0;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
.state-marker{
|
75 |
+
left: 100%;
|
76 |
+
margin-left: -45px;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
&.size-small{
|
80 |
+
height: 25px;
|
81 |
+
label{
|
82 |
+
height: 25px;
|
83 |
+
span{
|
84 |
+
font-size: 10px;
|
85 |
+
line-height: 15px;
|
86 |
+
padding: 5px;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
.state-marker{
|
90 |
+
width: 17px;
|
91 |
+
height: 17px;
|
92 |
+
margin-left: 4px;
|
93 |
+
}
|
94 |
+
&.selected{
|
95 |
+
.state-marker{
|
96 |
+
left: 0;
|
97 |
+
margin-left: 33px;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/ui-switcher.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui swither elements .
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Switcher' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Switcher elements.
|
22 |
+
*/
|
23 |
+
class UI_Switcher extends UI_Element implements I_UI {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Default settings
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
private $defaults_settings = array(
|
31 |
+
'id' => 'cherry-ui-swither-id',
|
32 |
+
'name' => 'cherry-ui-swither-name',
|
33 |
+
'value' => 'true',
|
34 |
+
'toggle' => array(
|
35 |
+
'true_toggle' => 'On',
|
36 |
+
'false_toggle' => 'Off',
|
37 |
+
'true_slave' => '',
|
38 |
+
'false_slave' => '',
|
39 |
+
),
|
40 |
+
'style' => 'normal',
|
41 |
+
'label' => '',
|
42 |
+
'class' => '',
|
43 |
+
'master' => '',
|
44 |
+
);
|
45 |
+
/**
|
46 |
+
* Constructor method for the UI_Switcher class.
|
47 |
+
*
|
48 |
+
* @since 4.0.0
|
49 |
+
*/
|
50 |
+
function __construct( $args = array() ) {
|
51 |
+
$this->defaults_settings['id'] = 'cherry-ui-swither-'.uniqid();
|
52 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
53 |
+
|
54 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Render html UI_Switcher.
|
59 |
+
*
|
60 |
+
* @since 4.0.0
|
61 |
+
*/
|
62 |
+
public function render() {
|
63 |
+
$data_attr_line = ( ! empty( $this->settings['toggle']['true_slave'] ) ) ? 'data-true-slave="' . $this->settings['toggle']['true_slave'] . '"' : '';
|
64 |
+
$data_attr_line .= ( ! empty( $this->settings['toggle']['false_slave'] ) ) ? ' data-false-slave="' . $this->settings['toggle']['false_slave'] . '"' : '';
|
65 |
+
|
66 |
+
$html = '';
|
67 |
+
|
68 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
69 |
+
|
70 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
71 |
+
if ( '' !== $this->settings['label'] ) {
|
72 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
73 |
+
}
|
74 |
+
$html .= '<div class="cherry-switcher-wrap size-' . esc_attr( $this->settings['style'] ) . ' ' . esc_attr( $this->settings['class'] ) . '">';
|
75 |
+
$html .= '<label class="sw-enable"><span>' . esc_html( $this->settings['toggle']['true_toggle'] ) . '</span></label>';
|
76 |
+
$html .= '<label class="sw-disable"><span>' . esc_html( $this->settings['toggle']['false_toggle'] ) . '</span></label>';
|
77 |
+
$html .= '<span class="state-marker"></span>';
|
78 |
+
$html .= '<input id="' . esc_attr( $this->settings['id'] ) . '" type="hidden" class="cherry-input-switcher" name="' . esc_attr( $this->settings['name'] ) . '" ' . checked( 'true', $this->settings['value'], false ) . ' value="' . esc_html( $this->settings['value'] ) . '" ' . $data_attr_line . '>';
|
79 |
+
$html .= '</div>';
|
80 |
+
$html .= '</div>';
|
81 |
+
|
82 |
+
return $html;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Enqueue javascript and stylesheet UI_Switcher.
|
87 |
+
*
|
88 |
+
* @since 4.0.0
|
89 |
+
*/
|
90 |
+
public static function enqueue_assets() {
|
91 |
+
wp_enqueue_script(
|
92 |
+
'ui-switcher-min',
|
93 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-switcher.min.js', __FILE__ ) ),
|
94 |
+
array( 'jquery' ),
|
95 |
+
'1.0.0',
|
96 |
+
true
|
97 |
+
);
|
98 |
+
wp_enqueue_style(
|
99 |
+
'ui-switcher-min',
|
100 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-switcher.min.css', __FILE__ ) ),
|
101 |
+
array(),
|
102 |
+
'1.0.0',
|
103 |
+
'all'
|
104 |
+
);
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/min/ui-text.min.css
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-container {
|
2 |
+
margin: 10px 0 20px 0; }
|
3 |
+
|
4 |
+
label.cherry-label {
|
5 |
+
margin: 0 0 5px 0;
|
6 |
+
display: block; }
|
7 |
+
|
8 |
+
input.cherry-ui-text {
|
9 |
+
font-size: 14px;
|
10 |
+
line-height: 20px;
|
11 |
+
color: #23282d;
|
12 |
+
background-color: #f1f1f1;
|
13 |
+
border-radius: 2px;
|
14 |
+
padding: 10px 20px;
|
15 |
+
min-height: 50px;
|
16 |
+
border: 1px solid #f1f1f1;
|
17 |
+
box-shadow: none; }
|
18 |
+
input.cherry-ui-text:focus {
|
19 |
+
border-color: rgba(72, 197, 105, 0.6);
|
20 |
+
box-shadow: 0 0 2px rgba(72, 197, 105, 0.6); }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
min-height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/assets/ui-text.scss
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
input.cherry-ui-text{
|
12 |
+
@include input();
|
13 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/ui-text.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-text elements.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Text' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building ui-text elements.
|
22 |
+
*/
|
23 |
+
class UI_Text extends UI_Element implements I_UI {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Default settings
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
private $defaults_settings = array(
|
31 |
+
'type' => 'text',
|
32 |
+
'id' => 'cherry-ui-input-id',
|
33 |
+
'name' => 'cherry-ui-input-name',
|
34 |
+
'value' => '',
|
35 |
+
'placeholder' => '',
|
36 |
+
'label' => '',
|
37 |
+
'class' => '',
|
38 |
+
'master' => '',
|
39 |
+
'required' => false,
|
40 |
+
);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Constructor method for the UI_Text class.
|
44 |
+
*
|
45 |
+
* @since 4.0.0
|
46 |
+
*/
|
47 |
+
function __construct( $args = array() ) {
|
48 |
+
$this->defaults_settings['id'] = 'cherry-ui-input-text-'.uniqid();
|
49 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
50 |
+
|
51 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get required attribute
|
56 |
+
*
|
57 |
+
* @return string required attribute
|
58 |
+
*/
|
59 |
+
public function get_required() {
|
60 |
+
if ( $this->settings['required'] ) {
|
61 |
+
return 'required="required"';
|
62 |
+
}
|
63 |
+
return '';
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Render html UI_Text.
|
68 |
+
*
|
69 |
+
* @since 4.0.0
|
70 |
+
*/
|
71 |
+
public function render() {
|
72 |
+
$html = '';
|
73 |
+
|
74 |
+
$html .= '<div class="cherry-ui-container ' . esc_attr( $this->settings['master'] ) . '">';
|
75 |
+
if ( '' !== $this->settings['label'] ) {
|
76 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
|
77 |
+
}
|
78 |
+
$html .= '<input type="' . esc_attr( $this->settings['type'] ) . '" id="' . esc_attr( $this->settings['id'] ) . '" class="widefat cherry-ui-text ' . esc_attr( $this->settings['class'] ) . '" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '" placeholder="' . esc_attr( $this->settings['placeholder'] ) . '" '.$this->get_required().'>';
|
79 |
+
$html .= '</div>';
|
80 |
+
return $html;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Enqueue javascript and stylesheet UI_Text
|
85 |
+
*
|
86 |
+
* @since 4.0.0
|
87 |
+
*/
|
88 |
+
public static function enqueue_assets() {
|
89 |
+
|
90 |
+
wp_enqueue_style(
|
91 |
+
'ui-text',
|
92 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-text.min.css', __FILE__ ) ),
|
93 |
+
array(),
|
94 |
+
'1.0.0',
|
95 |
+
'all'
|
96 |
+
);
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/min/ui-textarea.min.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-container {
|
2 |
+
margin: 10px 0 20px 0; }
|
3 |
+
|
4 |
+
label.cherry-label {
|
5 |
+
margin: 0 0 5px 0;
|
6 |
+
display: block; }
|
7 |
+
|
8 |
+
textarea.cherry-ui-textarea {
|
9 |
+
width: 100%;
|
10 |
+
font-size: 14px;
|
11 |
+
line-height: 20px;
|
12 |
+
color: #23282d;
|
13 |
+
background-color: #f1f1f1;
|
14 |
+
border-radius: 2px;
|
15 |
+
padding: 10px 20px;
|
16 |
+
min-height: 50px;
|
17 |
+
border: 1px solid #f1f1f1;
|
18 |
+
box-shadow: none;
|
19 |
+
height: 200px; }
|
20 |
+
textarea.cherry-ui-textarea:focus {
|
21 |
+
border-color: rgba(72, 197, 105, 0.6);
|
22 |
+
box-shadow: 0 0 2px rgba(72, 197, 105, 0.6); }
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
min-height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$blue_color: #298ffc;
|
9 |
+
$blue_color_h: #206ff4;
|
10 |
+
$green_color: #48c569;
|
11 |
+
$green_color_h: #3ba956;
|
12 |
+
$red_color: #e54343;
|
13 |
+
$red_color_h: #c73434;
|
14 |
+
$orange_color: #faa730;
|
15 |
+
$orange_color_h: #ee8425;
|
16 |
+
|
17 |
+
$border_radius_extra_small: 2px;
|
18 |
+
$border_radius_small: 4px;
|
19 |
+
$border_radius_medium: 6px;
|
20 |
+
$border_radius_large: 8px;
|
21 |
+
|
22 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
23 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/assets/ui-textarea.scss
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.cherry-ui-container{
|
5 |
+
margin: 10px 0 20px 0;
|
6 |
+
}
|
7 |
+
label.cherry-label{
|
8 |
+
margin: 0 0 5px 0;
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
textarea.cherry-ui-textarea{
|
12 |
+
width: 100%;
|
13 |
+
@include input();
|
14 |
+
height: 200px;
|
15 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/ui-textarea.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for the building ui-textarea elements
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Class
|
7 |
+
* @author Cherry Team <support@cherryframework.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2015, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! class_exists( 'UI_Textarea' ) ) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class for the building UI_Textarea elements.
|
22 |
+
*/
|
23 |
+
class UI_Textarea extends UI_Element implements I_UI {
|
24 |
+
/**
|
25 |
+
* Default settings
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
private $defaults_settings = array(
|
30 |
+
'id' => 'cherry-ui-textarea-id',
|
31 |
+
'name' => 'cherry-ui-textarea-name',
|
32 |
+
'value' => '',
|
33 |
+
'placeholder' => '',
|
34 |
+
'rows' => '10',
|
35 |
+
'cols' => '20',
|
36 |
+
'label' => '',
|
37 |
+
'class' => '',
|
38 |
+
'master' => '',
|
39 |
+
);
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Constructor method for the UI_Textarea class.
|
43 |
+
*
|
44 |
+
* @since 4.0.0
|
45 |
+
*/
|
46 |
+
function __construct( $args = array() ) {
|
47 |
+
$this->defaults_settings['id'] = 'cherry-ui-textarea-'.uniqid();
|
48 |
+
$this->settings = wp_parse_args( $args, $this->defaults_settings );
|
49 |
+
|
50 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Render html UI_Textarea.
|
55 |
+
*
|
56 |
+
* @since 4.0.0
|
57 |
+
*/
|
58 |
+
public function render() {
|
59 |
+
$html = '';
|
60 |
+
|
61 |
+
$master_class = ! empty( $this->settings['master'] ) && isset( $this->settings['master'] ) ? esc_html( $this->settings['master'] ) : '';
|
62 |
+
|
63 |
+
$html .= '<div class="cherry-ui-container ' . $master_class . '">';
|
64 |
+
if ( '' !== $this->settings['label'] ) {
|
65 |
+
$html .= '<label class="cherry-label" for="' . esc_attr( $this->settings['id'] ) . '">' . $this->settings['label'] . '</label> ';
|
66 |
+
}
|
67 |
+
$html .= '<textarea id="' . esc_attr( $this->settings['id'] ) . '" class="cherry-ui-textarea ' . esc_attr( $this->settings['class'] ) . '" name="' . esc_attr( $this->settings['name'] ) . '" rows="' . esc_attr( $this->settings['rows'] ) . '" cols="' . esc_attr( $this->settings['cols'] ) . '" placeholder="' . esc_attr( $this->settings['placeholder'] ) . '">' . esc_html( $this->settings['value'] ) . '</textarea>';
|
68 |
+
$html .= '</div>';
|
69 |
+
|
70 |
+
return $html;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Enqueue javascript and stylesheet UI_Textarea
|
75 |
+
*
|
76 |
+
* @since 4.0.0
|
77 |
+
*/
|
78 |
+
public static function enqueue_assets() {
|
79 |
+
wp_enqueue_style(
|
80 |
+
'ui-textarea',
|
81 |
+
esc_url( Cherry_Core::base_url( 'assets/min/ui-textarea.min.css', __FILE__ ) ),
|
82 |
+
array(),
|
83 |
+
'1.0.0',
|
84 |
+
'all'
|
85 |
+
);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
cherry-framework/modules/cherry-ui-elements/ui-element.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* UI_Element
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @subpackage Abstract Class
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* UI_Element abstract class
|
15 |
+
*/
|
16 |
+
if ( ! class_exists( 'UI_Element' ) ) {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* UI_Element Abstract Class
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
*/
|
23 |
+
abstract class UI_Element {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Settings list
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
protected $settings = array();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get current file URL
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
* @deprecated 1.0.3 Use `Cherry_Core::base_url()` method
|
38 |
+
*/
|
39 |
+
public static function get_current_file_url( $file ) {
|
40 |
+
$assets_url = dirname( $file );
|
41 |
+
$site_url = site_url();
|
42 |
+
$assets_url = str_replace( untrailingslashit( ABSPATH ), $site_url, $assets_url );
|
43 |
+
$assets_url = str_replace( '\\', '/', $assets_url );
|
44 |
+
|
45 |
+
return $assets_url;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get control value
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
* @return string control value.
|
53 |
+
*/
|
54 |
+
public function get_value() {
|
55 |
+
return $this->settings['value'];
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Set control value
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
* @param [type] $value new.
|
63 |
+
*/
|
64 |
+
public function set_value( $value ) {
|
65 |
+
$this->settings['value'] = $value;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get control name
|
70 |
+
*
|
71 |
+
* @since 1.0.0
|
72 |
+
* @return string control name.
|
73 |
+
*/
|
74 |
+
public function get_name() {
|
75 |
+
return $this->settings['name'];
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Set control name
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
* @param [type] $name new control name.
|
83 |
+
* @throws Exception Invalid control name.
|
84 |
+
*/
|
85 |
+
public function set_name( $name ) {
|
86 |
+
$name = (string) $name;
|
87 |
+
if ( '' !== $name ) {
|
88 |
+
$this->settings['name'] = $name;
|
89 |
+
} else {
|
90 |
+
throw new Exception( "Invalid control name '".$name."'. Name can't be empty." );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
cherry-framework/setup.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Setup function that used for checking latest version of the core.
|
4 |
+
* It creates `$chery_core_version` global variable and writes the latest core version
|
5 |
+
* and it's path into it.
|
6 |
+
*
|
7 |
+
* @package Cherry_Framework
|
8 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
9 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
10 |
+
* @link http://www.cherryframework.com/
|
11 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
|
12 |
+
*/
|
13 |
+
|
14 |
+
return create_function( '', '
|
15 |
+
global $chery_core_version;
|
16 |
+
|
17 |
+
$path = trailingslashit( __DIR__ ) . \'cherry-core.php\';
|
18 |
+
|
19 |
+
$data = get_file_data( $path, array(
|
20 |
+
\'version\' => \'Version\'
|
21 |
+
) );
|
22 |
+
|
23 |
+
if ( isset( $data[\'version\'] ) ) {
|
24 |
+
$version = $data[\'version\'];
|
25 |
+
}
|
26 |
+
|
27 |
+
$old_versions = null;
|
28 |
+
|
29 |
+
if ( null !== $chery_core_version ) {
|
30 |
+
$old_versions = array_keys( $chery_core_version );
|
31 |
+
}
|
32 |
+
|
33 |
+
if ( is_array( $old_versions ) && isset( $old_versions[0] ) ) {
|
34 |
+
$compare = version_compare( $old_versions[0], $version, \'<\' );
|
35 |
+
|
36 |
+
if ( $compare ) {
|
37 |
+
$chery_core_version = array();
|
38 |
+
$chery_core_version[ $version ] = $path;
|
39 |
+
}
|
40 |
+
} else {
|
41 |
+
$chery_core_version = array();
|
42 |
+
$chery_core_version[ $version ] = $path;
|
43 |
+
}
|
44 |
+
' );
|
cherry-sidebars.php
ADDED
@@ -0,0 +1,245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Cherry Sidebars
|
4 |
+
* Plugin URI:
|
5 |
+
* Description: Plugin for creating and managing sidebars in WordPress.
|
6 |
+
* Version: 1.0.0
|
7 |
+
* Author: Template Monster
|
8 |
+
* Author URI: http://www.templatemonster.com/
|
9 |
+
* Text Domain: cherry-sidebars
|
10 |
+
* License: GPL-3.0+
|
11 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
12 |
+
* Domain Path: /languages
|
13 |
+
*
|
14 |
+
* @package Cherry_Sidebars
|
15 |
+
* @author Template Monster
|
16 |
+
* @license GPL-3.0+
|
17 |
+
* @copyright 2002-2016, Template Monster
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
// If class 'Cherry_Sidebars' not exists.
|
26 |
+
if ( ! class_exists( 'Cherry_Sidebars' ) ) {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Sets up and initializes the Cherry Sidebars plugin.
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Cherry_Sidebars {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* A reference to an instance of this class.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @var object
|
40 |
+
*/
|
41 |
+
private static $instance = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* A reference to an instance of cherry framework core class.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @var object
|
48 |
+
*/
|
49 |
+
private $core = null;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Sets up needed actions/filters for the plugin to initialize.
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
*/
|
56 |
+
public function __construct() {
|
57 |
+
|
58 |
+
// Set the constants needed by the plugin.
|
59 |
+
add_action( 'plugins_loaded', array( $this, 'constants' ), 0 );
|
60 |
+
|
61 |
+
// Load the installer core.
|
62 |
+
add_action( 'after_setup_theme', require( trailingslashit( __DIR__ ) . 'cherry-framework/setup.php' ), 0 );
|
63 |
+
|
64 |
+
// Load the core functions/classes required by the rest of the theme.
|
65 |
+
add_action( 'after_setup_theme', array( $this, 'get_core' ), 1 );
|
66 |
+
add_action( 'after_setup_theme', array( 'Cherry_Core', 'load_all_modules' ), 2 );
|
67 |
+
add_action( 'after_setup_theme', array( $this, 'init_modules' ), 3 );
|
68 |
+
|
69 |
+
// Internationalize the text strings used.
|
70 |
+
add_action( 'plugins_loaded', array( $this, 'lang' ), 3 );
|
71 |
+
|
72 |
+
// Load the functions files.
|
73 |
+
add_action( 'plugins_loaded', array( $this, 'includes' ), 4 );
|
74 |
+
|
75 |
+
// Load the admin files.
|
76 |
+
add_action( 'plugins_loaded', array( $this, 'admin' ), 5 );
|
77 |
+
|
78 |
+
// Register activation and deactivation hook.
|
79 |
+
register_activation_hook( __FILE__, array( $this, 'activation' ) );
|
80 |
+
register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Defines constants for the plugin.
|
85 |
+
*
|
86 |
+
* @since 1.0.0
|
87 |
+
*/
|
88 |
+
function constants() {
|
89 |
+
|
90 |
+
if ( ! function_exists( 'get_plugin_data' ) ) {
|
91 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
92 |
+
}
|
93 |
+
|
94 |
+
$plugin_data = get_plugin_data( plugin_dir_path( __FILE__ ) . basename( __FILE__ ) );
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Set constant name for the post type name.
|
98 |
+
*
|
99 |
+
* @since 1.0.0
|
100 |
+
*/
|
101 |
+
define( 'CHERRY_SIDEBARS_SLUG', basename( dirname( __FILE__ ) ) );
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Set the version number of the plugin.
|
105 |
+
*
|
106 |
+
* @since 1.0.0
|
107 |
+
*/
|
108 |
+
define( 'CHERRY_SIDEBARS_VERSION', $plugin_data['Version'] );
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Set constant path to the plugin directory.
|
112 |
+
*
|
113 |
+
* @since 1.0.0
|
114 |
+
*/
|
115 |
+
define( 'CHERRY_SIDEBARS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Set constant path to the plugin URI.
|
119 |
+
*
|
120 |
+
* @since 1.0.0
|
121 |
+
*/
|
122 |
+
define( 'CHERRY_SIDEBARS_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Loads files from the '/includes' folder.
|
127 |
+
*
|
128 |
+
* @since 1.0.0
|
129 |
+
*/
|
130 |
+
function includes() {
|
131 |
+
require_once( CHERRY_SIDEBARS_DIR . 'admin/includes/class-cherry-sidebar-utils.php' );
|
132 |
+
require_once( CHERRY_SIDEBARS_DIR . 'admin/includes/class-cherry-sidebars-admin.php' );
|
133 |
+
require_once( CHERRY_SIDEBARS_DIR . 'includes/class-cherry-include-sidebars.php' );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Loads the translation files.
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
*/
|
141 |
+
function lang() {
|
142 |
+
load_plugin_textdomain( 'cherry-sidebars', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Loads admin files.
|
147 |
+
*
|
148 |
+
* @since 1.0.0
|
149 |
+
*/
|
150 |
+
function admin() {
|
151 |
+
if ( is_admin() ) {
|
152 |
+
require_once( CHERRY_SIDEBARS_DIR . 'admin/includes/class-cherry-custom-sidebar.php' );
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Loads the core functions. These files are needed before loading anything else in the
|
158 |
+
* theme because they have required functions for use.
|
159 |
+
*
|
160 |
+
* @since 1.1.0
|
161 |
+
*/
|
162 |
+
public function get_core() {
|
163 |
+
/**
|
164 |
+
* Fires before loads the core theme functions.
|
165 |
+
*
|
166 |
+
* @since 1.1.0
|
167 |
+
*/
|
168 |
+
do_action( 'cherry_core_before' );
|
169 |
+
|
170 |
+
if ( null !== $this->core ) {
|
171 |
+
return $this->core;
|
172 |
+
}
|
173 |
+
|
174 |
+
if ( ! class_exists( 'Cherry_Core' ) ) {
|
175 |
+
require_once( CHERRY_SIDEBARS_DIR . '/cherry-framework/cherry-core.php' );
|
176 |
+
}
|
177 |
+
|
178 |
+
$this->core = new Cherry_Core( array(
|
179 |
+
'base_dir' => CHERRY_SIDEBARS_DIR . 'cherry-framework',
|
180 |
+
'base_url' => CHERRY_SIDEBARS_URI . 'cherry-framework',
|
181 |
+
'modules' => array(
|
182 |
+
'cherry-js-core' => array(
|
183 |
+
'autoload' => false,
|
184 |
+
),
|
185 |
+
'cherry-ui-elements' => array(
|
186 |
+
'autoload' => false,
|
187 |
+
),
|
188 |
+
),
|
189 |
+
));
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Run initialization of modules.
|
194 |
+
*
|
195 |
+
* @since 1.2.0
|
196 |
+
*/
|
197 |
+
public function init_modules() {
|
198 |
+
if ( is_admin() ) {
|
199 |
+
$this->get_core()->init_module( 'cherry-js-core' );
|
200 |
+
$this->get_core()->init_module( 'cherry-ui-elements', array(
|
201 |
+
'ui_elements' => array(
|
202 |
+
'text',
|
203 |
+
'select',
|
204 |
+
),
|
205 |
+
) );
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* On plugin activation.
|
211 |
+
*
|
212 |
+
* @since 1.0.0
|
213 |
+
*/
|
214 |
+
function activation() {
|
215 |
+
flush_rewrite_rules();
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* On plugin deactivation.
|
220 |
+
*
|
221 |
+
* @since 1.0.0
|
222 |
+
*/
|
223 |
+
function deactivation() {
|
224 |
+
flush_rewrite_rules();
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Returns the instance.
|
229 |
+
*
|
230 |
+
* @since 1.0.0
|
231 |
+
* @return object
|
232 |
+
*/
|
233 |
+
public static function get_instance() {
|
234 |
+
|
235 |
+
// If the single instance hasn't been set, set it now.
|
236 |
+
if ( null == self::$instance ) {
|
237 |
+
self::$instance = new self;
|
238 |
+
}
|
239 |
+
|
240 |
+
return self::$instance;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
Cherry_Sidebars::get_instance();
|
245 |
+
}
|
includes/class-cherry-include-sidebars.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for including custom sidebars.
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'Cherry_Include_Sidebars' ) ) {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class for including custom sidebars.
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class Cherry_Include_Sidebars {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Holds the instances of this class.
|
22 |
+
*
|
23 |
+
* @since 1.0.0
|
24 |
+
* @var object
|
25 |
+
*/
|
26 |
+
private static $instance = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Sets up our actions/filters.
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function __construct() {
|
35 |
+
add_filter( 'sidebars_widgets', array( $this, 'set_custom_sidebar' ), 10, 1 );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Set custom sidebar in global array $wp_registered_sidebars.
|
40 |
+
*
|
41 |
+
* @since 1.0.0
|
42 |
+
* @param array $widgets Sidebar widgets.
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
public function set_custom_sidebar( $widgets ) {
|
46 |
+
global $wp_registered_sidebars;
|
47 |
+
|
48 |
+
$object_id = get_queried_object_id();
|
49 |
+
|
50 |
+
if ( function_exists( 'is_shop' ) ) {
|
51 |
+
if ( is_shop() || is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) {
|
52 |
+
$object_id = wc_get_page_id( 'shop' );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
$post_sidebars = get_post_meta( apply_filters( 'cherry_sidebar_manager_object_id', $object_id ), 'post_sidebar', true );
|
57 |
+
|
58 |
+
if ( $post_sidebars && ! empty( $post_sidebars ) ) {
|
59 |
+
|
60 |
+
$instance = new Cherry_Sidebar_Utils();
|
61 |
+
$custom_sidebar = $instance->get_custom_sidebar_array();
|
62 |
+
|
63 |
+
foreach ( $post_sidebars as $sidebar => $sidebar_value ) {
|
64 |
+
if ( ! empty( $sidebar_value ) &&
|
65 |
+
( array_key_exists( $sidebar_value, $wp_registered_sidebars ) || array_key_exists( $sidebar_value, $custom_sidebar ) ) &&
|
66 |
+
isset( $widgets[ $sidebar ] ) ) {
|
67 |
+
$widgets[ $sidebar ] = $widgets[ $sidebar_value ];
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
return $widgets;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Returns the instance.
|
77 |
+
*
|
78 |
+
* @since 1.0.0
|
79 |
+
* @return object
|
80 |
+
*/
|
81 |
+
public static function get_instance() {
|
82 |
+
|
83 |
+
// If the single instance hasn't been set, set it now.
|
84 |
+
if ( null == self::$instance ) {
|
85 |
+
self::$instance = new self;
|
86 |
+
}
|
87 |
+
|
88 |
+
return self::$instance;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
Cherry_Include_Sidebars::get_instance();
|
93 |
+
}
|
includes/index.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
index.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Cherry_Sidebars
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
languages/cherry-sidebars.pot
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Project-Id-Version: blank\n"
|
5 |
+
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2016-07-08 11:05+0300\n"
|
7 |
+
"PO-Revision-Date: 2015-10-23 11:35+0200\n"
|
8 |
+
"Last-Translator: Vladimir Anokhin <ano.vladimir@gmail.com>\n"
|
9 |
+
"Language-Team: Cherry Team <support@cherryframework.com>\n"
|
10 |
+
"Language: su\n"
|
11 |
+
"MIME-Version: 1.0\n"
|
12 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
13 |
+
"Content-Transfer-Encoding: 8bit\n"
|
14 |
+
"X-Poedit-KeywordsList: _e;__;__;_x;esc_html_e;esc_html__;esc_attr_e;"
|
15 |
+
"esc_attr__;_x:1,2c;_n:1,2\n"
|
16 |
+
"X-Poedit-Basepath: ..\n"
|
17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Generator: Poedit 1.8.8\n"
|
19 |
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
|
22 |
+
#: admin/includes/class-cherry-custom-sidebar.php:87
|
23 |
+
msgid "Post Sidebars"
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: admin/includes/class-cherry-custom-sidebar.php:126
|
27 |
+
msgid "Sidebar not selected"
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: admin/includes/class-cherry-custom-sidebar.php:163
|
31 |
+
#, php-format
|
32 |
+
msgid ""
|
33 |
+
"You can choose page sidebars or create a new sidebar on %swidgets page%s ."
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: admin/includes/class-cherry-custom-sidebar.php:164
|
37 |
+
msgid "Widgets Page"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: admin/views/cherry-widgets-page.php:21
|
41 |
+
msgid "Create a new custom sidebar"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: admin/views/cherry-widgets-page.php:30
|
45 |
+
msgid "Sidebar name:"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: admin/views/cherry-widgets-page.php:43
|
49 |
+
msgid "Sidebar description:"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: admin/views/cherry-widgets-page.php:51
|
53 |
+
msgid "Create Sidebar"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: admin/views/cherry-widgets-page.php:55
|
57 |
+
msgid "Cannot add new custom sidebar"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: admin/views/cherry-widgets-page.php:63
|
61 |
+
msgid "Default Sidebars"
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: admin/views/cherry-widgets-page.php:66
|
65 |
+
msgid "Default sidebars created in child theme code itself."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: admin/views/cherry-widgets-page.php:72
|
69 |
+
msgid "Cherry Sidebars"
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: admin/views/cherry-widgets-page.php:75
|
73 |
+
msgid ""
|
74 |
+
"You can create a custom sidebar and enable it for any page or post. This can "
|
75 |
+
"be done on page editing stage."
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: admin/views/cherry-widgets-page.php:76
|
79 |
+
msgid "Create a new sidebar"
|
80 |
+
msgstr ""
|
readme.txt
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Cherry Sidebars ===
|
2 |
+
|
3 |
+
Contributors: TemplateMonster 2002
|
4 |
+
Tags: sidebar, sidebar manager, cherry framework, custom sidebars, widget area, group widgets, page custom sidebar, post custom sidebar
|
5 |
+
Requires at least: 4.4
|
6 |
+
Tested up to: 4.5.3
|
7 |
+
Stable tag: 1.0
|
8 |
+
License: GPLv3 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
|
11 |
+
Cherry Sidebars allows to create and manage your own dynamic sidebars.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
Cherry Sidebars is a lightweight plugin for creating multiple widget areas, and outputting them on posts or pages of your choosing. Now you don't have to limit yourself to one widget area, instead you can create as many as you like. Group your widgets into multiple areas, and pick which one you want to display for a certain post or page.
|
16 |
+
The plugin can be useful for certain posts or pages, where you want your content to be different, for example you need to add a banner ad to your popular post, or a bio section to the 'About' page. Cherry Sidebars would be a perfect tool for this task.
|
17 |
+
|
18 |
+
== Installation ==
|
19 |
+
|
20 |
+
1. Upload "Cherry Sidebars" folder to the "/wp-content/plugins/" directory
|
21 |
+
2. Activate the plugin through the "Plugins" menu in WordPress
|
22 |
+
3. Navigate to the "Widgets" section to start customizing (Please notice! Some themes that do not support widgets may not have such page)
|
23 |
+
|
24 |
+
== Screenshots ==
|
25 |
+
|
26 |
+
1. An example of two custom sidebars with the widgets.
|
27 |
+
2. The form for creating a sidebar. Simply specify name and description for your new sidebar.
|
28 |
+
3. This is the sidebar manager panel that allows you to assign one of the sidebars to the current page.
|
29 |
+
|
30 |
+
== Configuration ==
|
31 |
+
|
32 |
+
= Creating a new sidebar =
|
33 |
+
1. Navigate to "Widgets" section (Please notice! Some themes that do not support widgets may not have such page).
|
34 |
+
2. Click on "Create a new sidebar" button.
|
35 |
+
3. Fill in all required form fields and click the "Create Sidebar" button.
|
36 |
+
4. After that you will be able to drag'n'drop your widgets into the new sidebar.
|
37 |
+
|
38 |
+
= Managing sidebars on pages =
|
39 |
+
* Open your page or post in editing mode.
|
40 |
+
* In the right bottom corner of the page you will see sidebar manager panel that allows you to assign one of the sidebars to the current page.
|
41 |
+
* For instance you can display widgets from the sidebar you've created in Primary Sidebar area.
|
42 |
+
|
43 |
+
== Changelog ==
|
44 |
+
|
45 |
+
= 1.0.0 =
|
46 |
+
|
47 |
+
* Initial release
|
wpml-config.xml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<wpml-config>
|
2 |
+
<custom-fields>
|
3 |
+
<custom-field action="copy">post_sidebar</custom-field>
|
4 |
+
</custom-fields>
|
5 |
+
</wpml-config>
|