Version Description
See: https://calderaforms.com/updates/caldera-forms-1-4-9.1/
Download this release
Release Info
Developer | Shelob9 |
Plugin | Caldera Forms – More Than Contact Forms |
Version | 1.4.9.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.4.9.1
- README.md +4 -3
- assets/css/admin.css +155 -11
- assets/css/caldera-forms-front.css +1 -0
- assets/css/caldera-forms-front.min.css +1 -0
- assets/images/caldera-globe-logo-sm.png +0 -0
- assets/images/new-icon.png +0 -0
- assets/js/admin.js +20 -7
- assets/js/admin.min.js +1 -1
- assets/js/caldera-clippy.js +117 -0
- assets/js/edit.js +2503 -2498
- assets/js/edit.min.js +2 -2
- assets/js/fields.js +3192 -3174
- assets/js/fields.min.js +4 -4
- caldera-core.php +15 -8
- classes/admin.php +110 -22
- classes/admin/apeasypods.php +51 -0
- classes/admin/apeasyqueries.php +51 -0
- classes/admin/apsetup.php +44 -0
- classes/admin/apsetupinterface.php +34 -0
- classes/admin/clippy.php +204 -0
- classes/admin/extend.php +26 -0
- classes/admin/feed.php +133 -0
- classes/api/crud.php +317 -0
- classes/api/error.php +16 -0
- classes/api/load.php +89 -0
- classes/api/response.php +36 -0
- classes/api/response_factory.php +33 -0
- classes/api/route.php +25 -0
- classes/api/util.php +38 -0
- classes/autoloader.php +3 -1
- classes/caldera-grid.php +36 -3
- classes/core.php +565 -463
- classes/csv/util.php +38 -0
- classes/db/base.php +18 -0
- classes/db/track.php +48 -0
- classes/email/preview.php +2 -70
- classes/email/save.php +155 -0
- classes/email/sendgrid.php +14 -1
- classes/email/settings.php +16 -16
- classes/email/trackdata.php +128 -0
- classes/entry/entries.php +9 -6
- classes/field/util.php +76 -0
- classes/files.php +323 -0
- classes/forms.php +71 -4
- classes/magic/parser.php +85 -0
- classes/magic/summary.php +221 -0
- classes/render/assets.php +228 -0
- classes/render/autopopulation.php +127 -0
- classes/save.php +21 -3
- classes/tracking.php +63 -7
- classes/transient.php +32 -0
- fields/advanced_file/uploader.js +0 -1
- fields/advanced_file/uploader.min.js +1 -1
- fields/button/field.php +3 -3
- fields/calculation/config.php +11 -2
- fields/calculation/field.php +19 -8
- fields/checkbox/field.php +1 -1
- fields/date_picker/datepicker.php +1 -1
- fields/dropdown/field.php +3 -1
- fields/email/field.php +3 -1
- fields/file/config_template.php +32 -8
- fields/gravatar/field.php +9 -9
- fields/hidden/field.php +1 -1
- fields/html/field.php +9 -9
- fields/paragraph/field.php +4 -2
- fields/phone/config.php +3 -3
- fields/phone/field.php +2 -2
- fields/radio/field.php +1 -1
- fields/range_slider/field.php +5 -5
- fields/recaptcha/preview.php +1 -1
- fields/select2/css/select2.css +1 -1
- fields/select2/field/field.php +1 -1
- fields/select2/js/select2.js +1 -1
- fields/select2/js/select2.min.js +0 -0
README.md
CHANGED
@@ -14,6 +14,7 @@ Caldera-Forms
|
|
14 |
|
15 |
|
16 |
### Contributing/ Using This Repo, Etc.
|
17 |
-
* The default branch is "
|
18 |
-
*
|
19 |
-
*
|
|
14 |
|
15 |
|
16 |
### Contributing/ Using This Repo, Etc.
|
17 |
+
* The default branch is "master" that should be the same as WordPress.org
|
18 |
+
* The current version of Caldera Forms is 1.4.1. We are currently developing 1.4.2 and 1.5.0.
|
19 |
+
* Development for version 1.4 point releases uses "1.4.x" branch. Please submit bug fixes pull requests again 1.4.x branch.
|
20 |
+
* Development for version 1.5 uses "1.5.x" branch. Please submit new feature pull requests against 1.5.x branch.
|
assets/css/admin.css
CHANGED
@@ -553,7 +553,7 @@ h3.caldera-editor-field-title {
|
|
553 |
display: block;
|
554 |
margin: 4px 0 0;
|
555 |
}
|
556 |
-
.caldera-config-group > label {
|
557 |
float: left;
|
558 |
margin: -2px 0 0 -140px;
|
559 |
padding: 6px 0;
|
@@ -562,7 +562,7 @@ h3.caldera-editor-field-title {
|
|
562 |
.form-extend-page-wrap.spinner {
|
563 |
float: none;
|
564 |
}
|
565 |
-
.form-extend-page-wrap .caldera-config-group > label {
|
566 |
margin-left: -340px;
|
567 |
width: 330px;
|
568 |
}
|
@@ -1907,12 +1907,20 @@ input.cf-shortcode-preview {
|
|
1907 |
width: 260px;
|
1908 |
}
|
1909 |
span.cf-form-shortcode-preview {
|
1910 |
-
|
|
|
|
|
1911 |
cursor: pointer;
|
1912 |
-
display:
|
1913 |
-
|
1914 |
-
|
|
|
|
|
|
|
|
|
1915 |
}
|
|
|
|
|
1916 |
@media screen and ( max-width: 782px ) {
|
1917 |
/* smaller */
|
1918 |
.caldera-editor-header {
|
@@ -1981,11 +1989,147 @@ span.cf-form-shortcode-preview {
|
|
1981 |
@media screen and ( max-width: 450px ) {
|
1982 |
.form-panel-wrap {
|
1983 |
width: 290px;
|
1984 |
-
}
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1989 |
}
|
1990 |
|
|
|
|
|
1991 |
}
|
553 |
display: block;
|
554 |
margin: 4px 0 0;
|
555 |
}
|
556 |
+
.caldera-config-group > label, .caldera-config-group fieldset > legend {
|
557 |
float: left;
|
558 |
margin: -2px 0 0 -140px;
|
559 |
padding: 6px 0;
|
562 |
.form-extend-page-wrap.spinner {
|
563 |
float: none;
|
564 |
}
|
565 |
+
.form-extend-page-wrap .caldera-config-group > label, .form-extend-page-wrap .caldera-config-group fieldset > legend {
|
566 |
margin-left: -340px;
|
567 |
width: 330px;
|
568 |
}
|
1907 |
width: 260px;
|
1908 |
}
|
1909 |
span.cf-form-shortcode-preview {
|
1910 |
+
background: #fff;
|
1911 |
+
color: #000;
|
1912 |
+
border: 1px solid #a3bf61;
|
1913 |
cursor: pointer;
|
1914 |
+
display: block;
|
1915 |
+
padding: 2px;
|
1916 |
+
border-radius: 2px;
|
1917 |
+
}
|
1918 |
+
span.cf-form-shortcode-preview:hover {
|
1919 |
+
color: #fff;
|
1920 |
+
background-color: #ff7e30;
|
1921 |
}
|
1922 |
+
|
1923 |
+
|
1924 |
@media screen and ( max-width: 782px ) {
|
1925 |
/* smaller */
|
1926 |
.caldera-editor-header {
|
1989 |
@media screen and ( max-width: 450px ) {
|
1990 |
.form-panel-wrap {
|
1991 |
width: 290px;
|
1992 |
+
}
|
1993 |
+
|
1994 |
+
.screen-per-page {
|
1995 |
+
display: block;
|
1996 |
+
margin: 0 auto 10px;
|
1997 |
+
width: 68px;
|
1998 |
+
}
|
1999 |
+
|
2000 |
+
}
|
2001 |
+
|
2002 |
+
/** Clippy */
|
2003 |
+
@media screen and ( max-width: 1000px ) {
|
2004 |
+
#caldera-forms-clippy {
|
2005 |
+
display: none;
|
2006 |
+
visibility: hidden;
|
2007 |
+
}
|
2008 |
+
}
|
2009 |
+
|
2010 |
+
@media screen and ( min-width: 1000px ) {
|
2011 |
+
|
2012 |
+
#caldera-forms-clippy {
|
2013 |
+
display: block;
|
2014 |
+
visibility: visible;
|
2015 |
+
}
|
2016 |
+
|
2017 |
+
|
2018 |
+
.caldera-forms-clippy-zone {
|
2019 |
+
width: 100%;
|
2020 |
+
max-width: 400px;
|
2021 |
+
min-width: 200px;
|
2022 |
+
background-position-x: 105%;
|
2023 |
+
background-repeat: no-repeat;
|
2024 |
+
margin-bottom: 20px;
|
2025 |
+
}
|
2026 |
+
|
2027 |
+
.caldera-forms-clippy-zone-inner-wrap {
|
2028 |
+
margin-left: 25px;
|
2029 |
+
border-right: 35px solid #f9f9f9;
|
2030 |
+
background-color: #f9f9f9;
|
2031 |
+
opacity:0.9;
|
2032 |
+
}
|
2033 |
+
.caldera-forms-clippy {
|
2034 |
+
opacity: 1;
|
2035 |
+
padding: 8px;
|
2036 |
+
border: 0;
|
2037 |
+
border-radius: 4px;
|
2038 |
+
width: 100%;
|
2039 |
+
}
|
2040 |
+
|
2041 |
+
.caldera-forms-clippy h2, .caldera-forms-clippy a.btn {
|
2042 |
+
text-align: center;
|
2043 |
+
}
|
2044 |
+
|
2045 |
+
.caldera-forms-clippy a.btn {
|
2046 |
+
width: 100%;
|
2047 |
+
padding-right: 4px;
|
2048 |
+
}
|
2049 |
+
|
2050 |
+
.caldera-forms-clippy .btn-green:hover, .caldera-forms-clippy .caldera-grid button:hover, .caldera-forms-clippy .caldera-grid html input[type=button]:hover, .caldera-forms-clippy .caldera-grid input[type=reset]:hover, .caldera-forms-clippy .caldera-grid input[type=submit]:hover {
|
2051 |
+
background: #ff7e30;
|
2052 |
+
}
|
2053 |
+
|
2054 |
+
.caldera-forms-clippy .btn {
|
2055 |
+
-moz-appearance: none;
|
2056 |
+
-webkit-appearance: none;
|
2057 |
+
-ms-appearance: none;
|
2058 |
+
appearance: none;
|
2059 |
+
-moz-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
2060 |
+
-webkit-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
2061 |
+
-ms-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
2062 |
+
transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
2063 |
+
background-color: transparent;
|
2064 |
+
border-radius: 4px;
|
2065 |
+
border: 0;
|
2066 |
+
box-shadow: inset 0 0 0 2px #ffffff;
|
2067 |
+
color: #ffffff;
|
2068 |
+
cursor: pointer;
|
2069 |
+
display: inline-block;
|
2070 |
+
font-size: 0.8em;
|
2071 |
+
font-weight: 900;
|
2072 |
+
height: 3.5em;
|
2073 |
+
letter-spacing: 0.35em;
|
2074 |
+
line-height: 3.45em;
|
2075 |
+
overflow: hidden;
|
2076 |
+
padding: 0 1.25em 0 1.6em;
|
2077 |
+
text-align: center;
|
2078 |
+
text-decoration: none;
|
2079 |
+
text-overflow: ellipsis;
|
2080 |
+
text-transform: uppercase;
|
2081 |
+
white-space: nowrap;
|
2082 |
+
}
|
2083 |
+
|
2084 |
+
.caldera-forms-clippy .btn.btn-sm {
|
2085 |
+
font-size: 0.6em;
|
2086 |
+
}
|
2087 |
+
|
2088 |
+
.caldera-forms-clippy .diff-btn li {
|
2089 |
+
padding: 1em 0 0 0;
|
2090 |
+
}
|
2091 |
+
|
2092 |
+
/** Green is default **/
|
2093 |
+
.caldera-forms-clippy a.btn.btn-green, .caldera-forms-clippy a.btn {
|
2094 |
+
background-color: #a3bf61;
|
2095 |
+
}
|
2096 |
+
|
2097 |
+
.caldera-forms-clippy a.btn.btn-orange {
|
2098 |
+
background-color: #ff7e30;
|
2099 |
+
}
|
2100 |
+
.caldera-forms-clippy a.btn.btn-grey {
|
2101 |
+
background-color: #3a3a3c;
|
2102 |
+
}
|
2103 |
+
|
2104 |
+
.caldera-forms-clippy a:focus, .caldera-forms-clippy .btn:focus, .caldera-forms-clippy .btn:active:focus,
|
2105 |
+
.caldera-forms-clippy button:focus, .caldera-forms-clippy input[type="file"]:focus,
|
2106 |
+
.caldera-forms-clippy input[type="radio"]:focus,
|
2107 |
+
.caldera-forms-clippy input[type="checkbox"]:focus {
|
2108 |
+
outline: none;
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
.caldera-forms-clippy a.btn:hover {
|
2112 |
+
background-color: #ff7e30;
|
2113 |
+
}
|
2114 |
+
.caldera-forms-clippy a.btn.btn-orange:hover {
|
2115 |
+
background-color: #a3bf61;
|
2116 |
+
}
|
2117 |
+
|
2118 |
+
|
2119 |
+
}
|
2120 |
+
|
2121 |
+
.caldera-config-group p.description.help-block {
|
2122 |
+
margin-top: -12px;
|
2123 |
+
margin-bottom: 12px;
|
2124 |
+
}
|
2125 |
+
|
2126 |
+
li.caldera-editor-logo {
|
2127 |
+
background-image: url( '../images/caldera-globe-logo-sm.png' );
|
2128 |
+
background-repeat: no-repeat;
|
2129 |
+
background-position-y: 10%;
|
2130 |
+
background-size: 40px;
|
2131 |
}
|
2132 |
|
2133 |
+
.caldera-forms-name {
|
2134 |
+
margin-left: 44px;
|
2135 |
}
|
assets/css/caldera-forms-front.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
/*! Caldera-Forms - v1.5.0-b-1 - 2016-11-20 */
|
assets/css/caldera-forms-front.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
@media (min-width:768px){.caldera-grid .container{width:750px}}@media (min-width:992px){.caldera-grid .container{width:970px}}@media (min-width:1200px){.caldera-grid .container{width:1170px}}.caldera-grid article,.caldera-grid aside,.caldera-grid details,.caldera-grid figcaption,.caldera-grid figure,.caldera-grid footer,.caldera-grid header,.caldera-grid hgroup,.caldera-grid main,.caldera-grid nav,.caldera-grid section,.caldera-grid summary{display:block}.caldera-grid a{background:0 0;text-decoration:none}.caldera-grid button,.caldera-grid html input[type=button],.caldera-grid input[type=reset],.caldera-grid input[type=submit]{-webkit-appearance:button;cursor:pointer}.caldera-grid input[type=checkbox],.caldera-grid input[type=radio]{box-sizing:border-box;padding:0}.caldera-grid input[type=number]::-webkit-inner-spin-button,.caldera-grid input[type=number]::-webkit-outer-spin-button{height:auto}.caldera-grid input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.caldera-grid input[type=search]::-webkit-search-cancel-button,.caldera-grid input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.caldera-grid *,.caldera-grid :after,.caldera-grid :before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.caldera-grid html{font-size:62.5%;-webkit-tap-highlight-color:transparent}.caldera-grid body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}.caldera-grid button,.caldera-grid input,.caldera-grid select,.caldera-grid textarea{font-family:inherit;font-size:inherit;line-height:inherit}.caldera-grid a:focus,.caldera-grid a:hover{color:#2a6496;text-decoration:underline}.caldera-grid a:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.caldera-grid img{vertical-align:middle}.caldera-grid .img-responsive{display:block;max-width:100%;height:auto}.caldera-grid .img-rounded{border-radius:6px}.caldera-grid .img-thumbnail{padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.caldera-grid .img-circle{border-radius:50%}.caldera-grid hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.caldera-grid .sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0}.caldera-grid .container,.caldera-grid .container-fluid{margin-right:auto;margin-left:auto;padding-left:7.5px;padding-right:7.5px}@media (min-width:768px){.caldera-grid .container{width:735px}}@media (min-width:992px){.caldera-grid .container{width:955px}}@media (min-width:1200px){.caldera-grid .container{width:1155px}}.caldera-grid .row{margin-left:-7.5px;margin-right:-7.5px}.caldera-grid .col-lg-1,.caldera-grid .col-lg-10,.caldera-grid .col-lg-11,.caldera-grid .col-lg-12,.caldera-grid .col-lg-2,.caldera-grid .col-lg-3,.caldera-grid .col-lg-4,.caldera-grid .col-lg-5,.caldera-grid .col-lg-6,.caldera-grid .col-lg-7,.caldera-grid .col-lg-8,.caldera-grid .col-lg-9,.caldera-grid .col-md-1,.caldera-grid .col-md-10,.caldera-grid .col-md-11,.caldera-grid .col-md-12,.caldera-grid .col-md-2,.caldera-grid .col-md-3,.caldera-grid .col-md-4,.caldera-grid .col-md-5,.caldera-grid .col-md-6,.caldera-grid .col-md-7,.caldera-grid .col-md-8,.caldera-grid .col-md-9,.caldera-grid .col-sm-1,.caldera-grid .col-sm-10,.caldera-grid .col-sm-11,.caldera-grid .col-sm-12,.caldera-grid .col-sm-2,.caldera-grid .col-sm-3,.caldera-grid .col-sm-4,.caldera-grid .col-sm-5,.caldera-grid .col-sm-6,.caldera-grid .col-sm-7,.caldera-grid .col-sm-8,.caldera-grid .col-sm-9,.caldera-grid .col-xs-1,.caldera-grid .col-xs-10,.caldera-grid .col-xs-11,.caldera-grid .col-xs-12,.caldera-grid .col-xs-2,.caldera-grid .col-xs-3,.caldera-grid .col-xs-4,.caldera-grid .col-xs-5,.caldera-grid .col-xs-6,.caldera-grid .col-xs-7,.caldera-grid .col-xs-8,.caldera-grid .col-xs-9{position:relative;min-height:1px;padding-left:7.5px;padding-right:7.5px}.caldera-grid .col-xs-1,.caldera-grid .col-xs-10,.caldera-grid .col-xs-11,.caldera-grid .col-xs-12,.caldera-grid .col-xs-2,.caldera-grid .col-xs-3,.caldera-grid .col-xs-4,.caldera-grid .col-xs-5,.caldera-grid .col-xs-6,.caldera-grid .col-xs-7,.caldera-grid .col-xs-8,.caldera-grid .col-xs-9{float:left}.caldera-grid .col-xs-12{width:100%}.caldera-grid .col-xs-11{width:91.66666667%}.caldera-grid .col-xs-10{width:83.33333333%}.caldera-grid .col-xs-9{width:75%}.caldera-grid .col-xs-8{width:66.66666667%}.caldera-grid .col-xs-7{width:58.33333333%}.caldera-grid .col-xs-6{width:50%}.caldera-grid .col-xs-5{width:41.66666667%}.caldera-grid .col-xs-4{width:33.33333333%}.caldera-grid .col-xs-3{width:25%}.caldera-grid .col-xs-2{width:16.66666667%}.caldera-grid .col-xs-1{width:8.33333333%}.caldera-grid .col-xs-pull-12{right:100%}.caldera-grid .col-xs-pull-11{right:91.66666667%}.caldera-grid .col-xs-pull-10{right:83.33333333%}.caldera-grid .col-xs-pull-9{right:75%}.caldera-grid .col-xs-pull-8{right:66.66666667%}.caldera-grid .col-xs-pull-7{right:58.33333333%}.caldera-grid .col-xs-pull-6{right:50%}.caldera-grid .col-xs-pull-5{right:41.66666667%}.caldera-grid .col-xs-pull-4{right:33.33333333%}.caldera-grid .col-xs-pull-3{right:25%}.caldera-grid .col-xs-pull-2{right:16.66666667%}.caldera-grid .col-xs-pull-1{right:8.33333333%}.caldera-grid .col-xs-pull-0{right:0}.caldera-grid .col-xs-push-12{left:100%}.caldera-grid .col-xs-push-11{left:91.66666667%}.caldera-grid .col-xs-push-10{left:83.33333333%}.caldera-grid .col-xs-push-9{left:75%}.caldera-grid .col-xs-push-8{left:66.66666667%}.caldera-grid .col-xs-push-7{left:58.33333333%}.caldera-grid .col-xs-push-6{left:50%}.caldera-grid .col-xs-push-5{left:41.66666667%}.caldera-grid .col-xs-push-4{left:33.33333333%}.caldera-grid .col-xs-push-3{left:25%}.caldera-grid .col-xs-push-2{left:16.66666667%}.caldera-grid .col-xs-push-1{left:8.33333333%}.caldera-grid .col-xs-push-0{left:0}.caldera-grid .col-xs-offset-12{margin-left:100%}.caldera-grid .col-xs-offset-11{margin-left:91.66666667%}.caldera-grid .col-xs-offset-10{margin-left:83.33333333%}.caldera-grid .col-xs-offset-9{margin-left:75%}.caldera-grid .col-xs-offset-8{margin-left:66.66666667%}.caldera-grid .col-xs-offset-7{margin-left:58.33333333%}.caldera-grid .col-xs-offset-6{margin-left:50%}.caldera-grid .col-xs-offset-5{margin-left:41.66666667%}.caldera-grid .col-xs-offset-4{margin-left:33.33333333%}.caldera-grid .col-xs-offset-3{margin-left:25%}.caldera-grid .col-xs-offset-2{margin-left:16.66666667%}.caldera-grid .col-xs-offset-1{margin-left:8.33333333%}.caldera-grid .col-xs-offset-0{margin-left:0}@media (min-width:768px){.caldera-grid .col-sm-1,.caldera-grid .col-sm-10,.caldera-grid .col-sm-11,.caldera-grid .col-sm-12,.caldera-grid .col-sm-2,.caldera-grid .col-sm-3,.caldera-grid .col-sm-4,.caldera-grid .col-sm-5,.caldera-grid .col-sm-6,.caldera-grid .col-sm-7,.caldera-grid .col-sm-8,.caldera-grid .col-sm-9{float:left}.caldera-grid .col-sm-12{width:100%}.caldera-grid .col-sm-11{width:91.66666667%}.caldera-grid .col-sm-10{width:83.33333333%}.caldera-grid .col-sm-9{width:75%}.caldera-grid .col-sm-8{width:66.66666667%}.caldera-grid .col-sm-7{width:58.33333333%}.caldera-grid .col-sm-6{width:50%}.caldera-grid .col-sm-5{width:41.66666667%}.caldera-grid .col-sm-4{width:33.33333333%}.caldera-grid .col-sm-3{width:25%}.caldera-grid .col-sm-2{width:16.66666667%}.caldera-grid .col-sm-1{width:8.33333333%}.caldera-grid .col-sm-pull-12{right:100%}.caldera-grid .col-sm-pull-11{right:91.66666667%}.caldera-grid .col-sm-pull-10{right:83.33333333%}.caldera-grid .col-sm-pull-9{right:75%}.caldera-grid .col-sm-pull-8{right:66.66666667%}.caldera-grid .col-sm-pull-7{right:58.33333333%}.caldera-grid .col-sm-pull-6{right:50%}.caldera-grid .col-sm-pull-5{right:41.66666667%}.caldera-grid .col-sm-pull-4{right:33.33333333%}.caldera-grid .col-sm-pull-3{right:25%}.caldera-grid .col-sm-pull-2{right:16.66666667%}.caldera-grid .col-sm-pull-1{right:8.33333333%}.caldera-grid .col-sm-pull-0{right:0}.caldera-grid .col-sm-push-12{left:100%}.caldera-grid .col-sm-push-11{left:91.66666667%}.caldera-grid .col-sm-push-10{left:83.33333333%}.caldera-grid .col-sm-push-9{left:75%}.caldera-grid .col-sm-push-8{left:66.66666667%}.caldera-grid .col-sm-push-7{left:58.33333333%}.caldera-grid .col-sm-push-6{left:50%}.caldera-grid .col-sm-push-5{left:41.66666667%}.caldera-grid .col-sm-push-4{left:33.33333333%}.caldera-grid .col-sm-push-3{left:25%}.caldera-grid .col-sm-push-2{left:16.66666667%}.caldera-grid .col-sm-push-1{left:8.33333333%}.caldera-grid .col-sm-push-0{left:0}.caldera-grid .col-sm-offset-12{margin-left:100%}.caldera-grid .col-sm-offset-11{margin-left:91.66666667%}.caldera-grid .col-sm-offset-10{margin-left:83.33333333%}.caldera-grid .col-sm-offset-9{margin-left:75%}.caldera-grid .col-sm-offset-8{margin-left:66.66666667%}.caldera-grid .col-sm-offset-7{margin-left:58.33333333%}.caldera-grid .col-sm-offset-6{margin-left:50%}.caldera-grid .col-sm-offset-5{margin-left:41.66666667%}.caldera-grid .col-sm-offset-4{margin-left:33.33333333%}.caldera-grid .col-sm-offset-3{margin-left:25%}.caldera-grid .col-sm-offset-2{margin-left:16.66666667%}.caldera-grid .col-sm-offset-1{margin-left:8.33333333%}.caldera-grid .col-sm-offset-0{margin-left:0}}@media (min-width:992px){.caldera-grid .col-md-1,.caldera-grid .col-md-10,.caldera-grid .col-md-11,.caldera-grid .col-md-12,.caldera-grid .col-md-2,.caldera-grid .col-md-3,.caldera-grid .col-md-4,.caldera-grid .col-md-5,.caldera-grid .col-md-6,.caldera-grid .col-md-7,.caldera-grid .col-md-8,.caldera-grid .col-md-9{float:left}.caldera-grid .col-md-12{width:100%}.caldera-grid .col-md-11{width:91.66666667%}.caldera-grid .col-md-10{width:83.33333333%}.caldera-grid .col-md-9{width:75%}.caldera-grid .col-md-8{width:66.66666667%}.caldera-grid .col-md-7{width:58.33333333%}.caldera-grid .col-md-6{width:50%}.caldera-grid .col-md-5{width:41.66666667%}.caldera-grid .col-md-4{width:33.33333333%}.caldera-grid .col-md-3{width:25%}.caldera-grid .col-md-2{width:16.66666667%}.caldera-grid .col-md-1{width:8.33333333%}.caldera-grid .col-md-pull-12{right:100%}.caldera-grid .col-md-pull-11{right:91.66666667%}.caldera-grid .col-md-pull-10{right:83.33333333%}.caldera-grid .col-md-pull-9{right:75%}.caldera-grid .col-md-pull-8{right:66.66666667%}.caldera-grid .col-md-pull-7{right:58.33333333%}.caldera-grid .col-md-pull-6{right:50%}.caldera-grid .col-md-pull-5{right:41.66666667%}.caldera-grid .col-md-pull-4{right:33.33333333%}.caldera-grid .col-md-pull-3{right:25%}.caldera-grid .col-md-pull-2{right:16.66666667%}.caldera-grid .col-md-pull-1{right:8.33333333%}.caldera-grid .col-md-pull-0{right:0}.caldera-grid .col-md-push-12{left:100%}.caldera-grid .col-md-push-11{left:91.66666667%}.caldera-grid .col-md-push-10{left:83.33333333%}.caldera-grid .col-md-push-9{left:75%}.caldera-grid .col-md-push-8{left:66.66666667%}.caldera-grid .col-md-push-7{left:58.33333333%}.caldera-grid .col-md-push-6{left:50%}.caldera-grid .col-md-push-5{left:41.66666667%}.caldera-grid .col-md-push-4{left:33.33333333%}.caldera-grid .col-md-push-3{left:25%}.caldera-grid .col-md-push-2{left:16.66666667%}.caldera-grid .col-md-push-1{left:8.33333333%}.caldera-grid .col-md-push-0{left:0}.caldera-grid .col-md-offset-12{margin-left:100%}.caldera-grid .col-md-offset-11{margin-left:91.66666667%}.caldera-grid .col-md-offset-10{margin-left:83.33333333%}.caldera-grid .col-md-offset-9{margin-left:75%}.caldera-grid .col-md-offset-8{margin-left:66.66666667%}.caldera-grid .col-md-offset-7{margin-left:58.33333333%}.caldera-grid .col-md-offset-6{margin-left:50%}.caldera-grid .col-md-offset-5{margin-left:41.66666667%}.caldera-grid .col-md-offset-4{margin-left:33.33333333%}.caldera-grid .col-md-offset-3{margin-left:25%}.caldera-grid .col-md-offset-2{margin-left:16.66666667%}.caldera-grid .col-md-offset-1{margin-left:8.33333333%}.caldera-grid .col-md-offset-0{margin-left:0}}@-ms-viewport{width:device-width}@media (min-width:1200px){.caldera-grid .col-lg-1,.caldera-grid .col-lg-10,.caldera-grid .col-lg-11,.caldera-grid .col-lg-12,.caldera-grid .col-lg-2,.caldera-grid .col-lg-3,.caldera-grid .col-lg-4,.caldera-grid .col-lg-5,.caldera-grid .col-lg-6,.caldera-grid .col-lg-7,.caldera-grid .col-lg-8,.caldera-grid .col-lg-9{float:left}.caldera-grid .col-lg-12{width:100%}.caldera-grid .col-lg-11{width:91.66666667%}.caldera-grid .col-lg-10{width:83.33333333%}.caldera-grid .col-lg-9{width:75%}.caldera-grid .col-lg-8{width:66.66666667%}.caldera-grid .col-lg-7{width:58.33333333%}.caldera-grid .col-lg-6{width:50%}.caldera-grid .col-lg-5{width:41.66666667%}.caldera-grid .col-lg-4{width:33.33333333%}.caldera-grid .col-lg-3{width:25%}.caldera-grid .col-lg-2{width:16.66666667%}.caldera-grid .col-lg-1{width:8.33333333%}.caldera-grid .col-lg-pull-12{right:100%}.caldera-grid .col-lg-pull-11{right:91.66666667%}.caldera-grid .col-lg-pull-10{right:83.33333333%}.caldera-grid .col-lg-pull-9{right:75%}.caldera-grid .col-lg-pull-8{right:66.66666667%}.caldera-grid .col-lg-pull-7{right:58.33333333%}.caldera-grid .col-lg-pull-6{right:50%}.caldera-grid .col-lg-pull-5{right:41.66666667%}.caldera-grid .col-lg-pull-4{right:33.33333333%}.caldera-grid .col-lg-pull-3{right:25%}.caldera-grid .col-lg-pull-2{right:16.66666667%}.caldera-grid .col-lg-pull-1{right:8.33333333%}.caldera-grid .col-lg-pull-0{right:0}.caldera-grid .col-lg-push-12{left:100%}.caldera-grid .col-lg-push-11{left:91.66666667%}.caldera-grid .col-lg-push-10{left:83.33333333%}.caldera-grid .col-lg-push-9{left:75%}.caldera-grid .col-lg-push-8{left:66.66666667%}.caldera-grid .col-lg-push-7{left:58.33333333%}.caldera-grid .col-lg-push-6{left:50%}.caldera-grid .col-lg-push-5{left:41.66666667%}.caldera-grid .col-lg-push-4{left:33.33333333%}.caldera-grid .col-lg-push-3{left:25%}.caldera-grid .col-lg-push-2{left:16.66666667%}.caldera-grid .col-lg-push-1{left:8.33333333%}.caldera-grid .col-lg-push-0{left:0}.caldera-grid .col-lg-offset-12{margin-left:100%}.caldera-grid .col-lg-offset-11{margin-left:91.66666667%}.caldera-grid .col-lg-offset-10{margin-left:83.33333333%}.caldera-grid .col-lg-offset-9{margin-left:75%}.caldera-grid .col-lg-offset-8{margin-left:66.66666667%}.caldera-grid .col-lg-offset-7{margin-left:58.33333333%}.caldera-grid .col-lg-offset-6{margin-left:50%}.caldera-grid .col-lg-offset-5{margin-left:41.66666667%}.caldera-grid .col-lg-offset-4{margin-left:33.33333333%}.caldera-grid .col-lg-offset-3{margin-left:25%}.caldera-grid .col-lg-offset-2{margin-left:16.66666667%}.caldera-grid .col-lg-offset-1{margin-left:8.33333333%}.caldera-grid .col-lg-offset-0{margin-left:0}}.caldera-grid .clearfix:after,.caldera-grid .clearfix:before,.caldera-grid .container-fluid:after,.caldera-grid .container-fluid:before,.caldera-grid .container:after,.caldera-grid .container:before,.caldera-grid .row:after,.caldera-grid .row:before{content:" ";display:table}.caldera-grid .clearfix:after,.caldera-grid .container-fluid:after,.caldera-grid .container:after,.caldera-grid .row:after{clear:both}.caldera-grid .center-block{display:block;margin-left:auto;margin-right:auto}.caldera-grid .pull-right{float:right!important}.caldera-grid .pull-left{float:left!important}.caldera-grid .hide{display:none!important}.caldera-grid .show{display:block!important}.caldera-grid .hidden,.caldera-grid .visible-lg,.caldera-grid .visible-md,.caldera-grid .visible-sm,.caldera-grid .visible-xs{display:none!important}.caldera-grid .invisible{visibility:hidden}.caldera-grid .text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.caldera-grid .hidden{visibility:hidden!important}.caldera-grid .affix{position:fixed}@-ms-viewport{width:device-width}@media (max-width:767px){.caldera-grid .visible-xs{display:block!important}.caldera-grid table.visible-xs{display:table}.caldera-grid tr.visible-xs{display:table-row!important}.caldera-grid td.visible-xs,.caldera-grid th.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.caldera-grid .visible-sm{display:block!important}.caldera-grid table.visible-sm{display:table}.caldera-grid tr.visible-sm{display:table-row!important}.caldera-grid td.visible-sm,.caldera-grid th.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.caldera-grid .visible-md{display:block!important}.caldera-grid table.visible-md{display:table}.caldera-grid tr.visible-md{display:table-row!important}.caldera-grid td.visible-md,.caldera-grid th.visible-md{display:table-cell!important}}@media (min-width:1200px){.caldera-grid .visible-lg{display:block!important}.caldera-grid table.visible-lg{display:table}.caldera-grid tr.visible-lg{display:table-row!important}.caldera-grid td.visible-lg,.caldera-grid th.visible-lg{display:table-cell!important}.caldera-grid .hidden-lg{display:none!important}}@media (max-width:767px){.caldera-grid .hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.caldera-grid .hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.caldera-grid .hidden-md{display:none!important}}.caldera-grid .visible-print{display:none!important}@media print{.caldera-grid .visible-print{display:block!important}.caldera-grid table.visible-print{display:table}.caldera-grid tr.visible-print{display:table-row!important}.caldera-grid td.visible-print,.caldera-grid th.visible-print{display:table-cell!important}.caldera-grid .hidden-print{display:none!important}}input.parsley-success,select.parsley-success,textarea.parsley-success{color:#468847;background-color:#DFF0D8;border:1px solid #D6E9C6}input.parsley-error,select.parsley-error,textarea.parsley-error{color:#B94A48;background-color:#F2DEDE;border:1px solid #EED3D7}.parsley-errors-list{margin:2px 0 3px;padding:0;list-style-type:none;font-size:.9em;line-height:.9em;opacity:0;transition:all .3s ease-in;-o-transition:all .3s ease-in;-moz-transition:all .3s ease-in;-webkit-transition:all .3s ease-in}.parsley-errors-list.filled{opacity:1}.caldera-grid html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.caldera-grid body{margin:0}.caldera-grid article,.caldera-grid aside,.caldera-grid details,.caldera-grid figcaption,.caldera-grid figure,.caldera-grid footer,.caldera-grid header,.caldera-grid hgroup,.caldera-grid main,.caldera-grid menu,.caldera-grid nav,.caldera-grid section,.caldera-grid summary{display:block}.caldera-grid audio,.caldera-grid canvas,.caldera-grid progress,.caldera-grid video{display:inline-block;vertical-align:baseline}.caldera-grid audio:not([controls]){display:none;height:0}.caldera-grid [hidden],.caldera-grid template{display:none}.caldera-grid a{background-color:transparent}.caldera-grid a:active,.caldera-grid a:hover{outline:0}.caldera-grid abbr[title]{border-bottom:1px dotted}.caldera-grid b,.caldera-grid strong{font-weight:700}.caldera-grid dfn{font-style:italic}.caldera-grid h1{font-size:2em;margin:.67em 0}.caldera-grid mark{background:#ff0;color:#000}.caldera-grid small{font-size:80%}.caldera-grid sub,.caldera-grid sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.caldera-grid sup{top:-.5em}.caldera-grid sub{bottom:-.25em}.caldera-grid img{border:0}.caldera-grid svg:not(:root){overflow:hidden}.caldera-grid figure{margin:1em 40px}.caldera-grid hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}.caldera-grid pre{overflow:auto}.caldera-grid code,.caldera-grid kbd,.caldera-grid pre,.caldera-grid samp{font-family:monospace,monospace;font-size:1em}.caldera-grid button,.caldera-grid input,.caldera-grid optgroup,.caldera-grid select,.caldera-grid textarea{font:inherit;margin:0}.caldera-grid button{overflow:visible}.caldera-grid button,.caldera-grid select{text-transform:none}.caldera-grid button,.caldera-grid html input[type=button],.caldera-grid input[type=reset],.caldera-grid input[type=submit]{-webkit-appearance:button;cursor:pointer}.caldera-grid button[disabled],.caldera-grid html input[disabled]{cursor:default}.caldera-grid button::-moz-focus-inner,.caldera-grid input::-moz-focus-inner{border:0;padding:0}.caldera-grid input{line-height:normal}.caldera-grid input[type=checkbox],.caldera-grid input[type=radio]{box-sizing:border-box;padding:0}.caldera-grid input[type=number]::-webkit-inner-spin-button,.caldera-grid input[type=number]::-webkit-outer-spin-button{height:auto}.caldera-grid input[type=search]{-webkit-appearance:textfield;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.caldera-grid input[type=search]::-webkit-search-cancel-button,.caldera-grid input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.caldera-grid textarea{overflow:auto}.caldera-grid optgroup{font-weight:700}.caldera-grid table{border-collapse:collapse;border-spacing:0}.caldera-grid td,.caldera-grid th{padding:0}@media print{.caldera-grid *,.caldera-grid :after,.caldera-grid :before{background:0 0!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}.caldera-grid a,.caldera-grid a:visited{text-decoration:underline}.caldera-grid a[href]:after{content:" (" attr(href) ")"}.caldera-grid abbr[title]:after{content:" (" attr(title) ")"}.caldera-grid a[href^="#"]:after,.caldera-grid a[href^="javascript:"]:after{content:""}.caldera-grid blockquote,.caldera-grid pre{border:1px solid #999;page-break-inside:avoid}.caldera-grid thead{display:table-header-group}.caldera-grid img,.caldera-grid tr{page-break-inside:avoid}.caldera-grid img{max-width:100%!important}.caldera-grid h2,.caldera-grid h3,.caldera-grid p{orphans:3;widows:3}.caldera-grid h2,.caldera-grid h3{page-break-after:avoid}.caldera-grid select{background:#fff!important}.caldera-grid .navbar{display:none}.caldera-grid .btn>.caret,.caldera-grid .dropup>.btn>.caret{border-top-color:#000!important}.caldera-grid .label{border:1px solid #000}.caldera-grid .table{border-collapse:collapse!important}.caldera-grid .table td,.caldera-grid .table th{background-color:#fff!important}.caldera-grid .table-bordered td,.caldera-grid .table-bordered th{border:1px solid #ddd!important}}.caldera-grid .btn,.caldera-grid .btn-danger.active,.caldera-grid .btn-danger:active,.caldera-grid .btn-default.active,.caldera-grid .btn-default:active,.caldera-grid .btn-info.active,.caldera-grid .btn-info:active,.caldera-grid .btn-primary.active,.caldera-grid .btn-primary:active,.caldera-grid .btn-success.active,.caldera-grid .btn-success:active,.caldera-grid .btn-warning.active,.caldera-grid .btn-warning:active,.caldera-grid .form-control,.open>.dropdown-toggle.caldera-grid .btn-danger,.open>.dropdown-toggle.caldera-grid .btn-default,.open>.dropdown-toggle.caldera-grid .btn-info,.open>.dropdown-toggle.caldera-grid .btn-primary,.open>.dropdown-toggle.caldera-grid .btn-success,.open>.dropdown-toggle.caldera-grid .btn-warning{background-image:none}.caldera-grid fieldset{padding:0;margin:0;border:0;min-width:0}.caldera-grid legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}.caldera-grid label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.caldera-grid input[type=checkbox],.caldera-grid input[type=radio]{margin:0;line-height:normal}.caldera-grid .form-control,.caldera-grid output{font-size:14px;line-height:1.42857143;color:#555;display:block}.caldera-grid input[type=file]{display:block}.caldera-grid input[type=range]{display:block;width:100%}.caldera-grid select[multiple],.caldera-grid select[size]{height:auto}.caldera-grid input[type=checkbox]:focus,.caldera-grid input[type=file]:focus,.caldera-grid input[type=radio]:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.caldera-grid input[type=checkbox]{-webkit-appearance:checkbox}.caldera-grid input[type=radio]{-webkit-appearance:radio}.caldera-grid output{padding-top:7px}.caldera-grid .form-control{width:100%;height:34px;padding:6px 12px;background-color:#fff;border:1px solid #ccc;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.caldera-grid .form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.caldera-grid .form-control::-moz-placeholder{color:#999;opacity:1}.caldera-grid .form-control:-ms-input-placeholder{color:#999}.caldera-grid .form-control::-webkit-input-placeholder{color:#999}.caldera-grid .has-success .checkbox,.caldera-grid .has-success .checkbox-inline,.caldera-grid .has-success .control-label,.caldera-grid .has-success .form-control-feedback,.caldera-grid .has-success .help-block,.caldera-grid .has-success .radio,.caldera-grid .has-success .radio-inline,.caldera-grid .has-success.checkbox label,.caldera-grid .has-success.checkbox-inline label,.caldera-grid .has-success.radio label,.caldera-grid .has-success.radio-inline label{color:#3c763d}.caldera-grid .form-control[disabled],.caldera-grid .form-control[readonly],fieldset[disabled] .caldera-grid .form-control{background-color:#eee;opacity:1}.caldera-grid .form-control[disabled],fieldset[disabled] .caldera-grid .form-control{cursor:not-allowed}textarea .caldera-grid .form-control{height:auto}@media screen and (-webkit-min-device-pixel-ratio:0){.caldera-grid input[type=date],.caldera-grid input[type=datetime-local],.caldera-grid input[type=month],.caldera-grid input[type=time]{line-height:34px}.caldera-grid input[type=date].input-sm,.caldera-grid input[type=datetime-local].input-sm,.caldera-grid input[type=month].input-sm,.caldera-grid input[type=time].input-sm,.input-group-sm .caldera-grid input[type=date],.input-group-sm .caldera-grid input[type=datetime-local],.input-group-sm .caldera-grid input[type=month],.input-group-sm .caldera-grid input[type=time]{line-height:30px}.caldera-grid input[type=date].input-lg,.caldera-grid input[type=datetime-local].input-lg,.caldera-grid input[type=month].input-lg,.caldera-grid input[type=time].input-lg,.input-group-lg .caldera-grid input[type=date],.input-group-lg .caldera-grid input[type=datetime-local],.input-group-lg .caldera-grid input[type=month],.input-group-lg .caldera-grid input[type=time]{line-height:46px}}.caldera-grid .form-group{margin-bottom:15px}.caldera-grid .checkbox,.caldera-grid .radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.caldera-grid .checkbox label,.caldera-grid .radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.caldera-grid .checkbox input[type=checkbox],.caldera-grid .checkbox-inline input[type=checkbox],.caldera-grid .radio input[type=radio],.caldera-grid .radio-inline input[type=radio]{margin-left:-20px}.caldera-grid .checkbox+.checkbox,.caldera-grid .radio+.radio{margin-top:-5px}.caldera-grid .checkbox-inline,.caldera-grid .radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.caldera-grid .checkbox-inline+.checkbox-inline,.caldera-grid .radio-inline+.radio-inline{margin-top:0;margin-left:10px}.caldera-grid .checkbox-inline.disabled,.caldera-grid .checkbox.disabled label,.caldera-grid .radio-inline.disabled,.caldera-grid .radio.disabled label,.caldera-grid input[type=checkbox].disabled,.caldera-grid input[type=checkbox][disabled],.caldera-grid input[type=radio].disabled,.caldera-grid input[type=radio][disabled],fieldset[disabled] .caldera-grid .checkbox label,fieldset[disabled] .caldera-grid .checkbox-inline,fieldset[disabled] .caldera-grid .radio label,fieldset[disabled] .caldera-grid .radio-inline,fieldset[disabled] .caldera-grid input[type=checkbox],fieldset[disabled] .caldera-grid input[type=radio]{cursor:not-allowed}.caldera-grid .form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0;min-height:34px}.caldera-grid .form-control-static.input-lg,.caldera-grid .form-control-static.input-sm{padding-left:0;padding-right:0}.caldera-grid .input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.caldera-grid .input-sm{height:30px;line-height:30px}select[multiple].caldera-grid .input-sm,textarea.caldera-grid .input-sm{height:auto}.caldera-grid .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.caldera-grid .form-group-sm .form-control{height:30px;line-height:30px}select[multiple].caldera-grid .form-group-sm .form-control,textarea.caldera-grid .form-group-sm .form-control{height:auto}.caldera-grid .form-group-sm .form-control-static{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;min-height:32px}.caldera-grid .input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}select.caldera-grid .input-lg{height:46px;line-height:46px}select[multiple].caldera-grid .input-lg,textarea.caldera-grid .input-lg{height:auto}.caldera-grid .form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}select.caldera-grid .form-group-lg .form-control{height:46px;line-height:46px}select[multiple].caldera-grid .form-group-lg .form-control,textarea.caldera-grid .form-group-lg .form-control{height:auto}.caldera-grid .form-group-lg .form-control-static{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;min-height:38px}.caldera-grid .has-feedback{position:relative}.caldera-grid .has-feedback .form-control{padding-right:42.5px}.caldera-grid .form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.caldera-grid .input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.caldera-grid .input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.caldera-grid .has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.caldera-grid .has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.caldera-grid .has-warning .checkbox,.caldera-grid .has-warning .checkbox-inline,.caldera-grid .has-warning .control-label,.caldera-grid .has-warning .form-control-feedback,.caldera-grid .has-warning .help-block,.caldera-grid .has-warning .radio,.caldera-grid .has-warning .radio-inline,.caldera-grid .has-warning.checkbox label,.caldera-grid .has-warning.checkbox-inline label,.caldera-grid .has-warning.radio label,.caldera-grid .has-warning.radio-inline label{color:#8a6d3b}.caldera-grid .has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.caldera-grid .has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.caldera-grid .has-error .checkbox,.caldera-grid .has-error .checkbox-inline,.caldera-grid .has-error .control-label,.caldera-grid .has-error .help-block,.caldera-grid .has-error .radio,.caldera-grid .has-error .radio-inline,.caldera-grid .has-error.checkbox label,.caldera-grid .has-error.checkbox-inline label,.caldera-grid .has-error.radio label,.caldera-grid .has-error.radio-inline label{color:#a94442}.caldera-grid .has-error .form-control:focus{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.caldera-grid .has-feedback label~.form-control-feedback{top:25px}.caldera-grid .has-feedback label.sr-only~.form-control-feedback{top:0}.caldera-grid .help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.caldera-grid .form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.caldera-grid .form-inline .form-control-static{display:inline-block}.caldera-grid .form-inline .input-group{display:inline-table;vertical-align:middle}.caldera-grid .form-inline .input-group .form-control,.caldera-grid .form-inline .input-group .input-group-addon,.caldera-grid .form-inline .input-group .input-group-btn{width:auto}.caldera-grid .form-inline .input-group>.form-control{width:100%}.caldera-grid .form-inline .control-label{margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .checkbox,.caldera-grid .form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .checkbox label,.caldera-grid .form-inline .radio label{padding-left:0}.caldera-grid .form-inline .checkbox input[type=checkbox],.caldera-grid .form-inline .radio input[type=radio]{position:relative;margin-left:0}.caldera-grid .form-inline .has-feedback .form-control-feedback{top:0}.caldera-grid .form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:7px}}.caldera-grid .form-horizontal .checkbox,.caldera-grid .form-horizontal .checkbox-inline,.caldera-grid .form-horizontal .radio,.caldera-grid .form-horizontal .radio-inline{margin-top:0;margin-bottom:0;padding-top:7px}.caldera-grid .form-horizontal .checkbox,.caldera-grid .form-horizontal .radio{min-height:27px}.caldera-grid .form-horizontal .form-group{margin-left:-15px;margin-right:-15px}.caldera-grid .form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.caldera-grid .form-horizontal .form-group-lg .control-label{padding-top:14.33px}.caldera-grid .form-horizontal .form-group-sm .control-label{padding-top:6px}}.caldera-grid .btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.caldera-grid .btn.active.focus,.caldera-grid .btn.active:focus,.caldera-grid .btn.focus,.caldera-grid .btn:active.focus,.caldera-grid .btn:active:focus,.caldera-grid .btn:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.caldera-grid .btn.focus,.caldera-grid .btn:focus,.caldera-grid .btn:hover{color:#333;text-decoration:none}.caldera-grid .btn.active,.caldera-grid .btn:active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.caldera-grid .btn.disabled,.caldera-grid .btn[disabled],fieldset[disabled] .caldera-grid .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.caldera-grid .btn-default{color:#333;background-color:#fff;border-color:#ccc}.caldera-grid .btn-default.active,.caldera-grid .btn-default.focus,.caldera-grid .btn-default:active,.caldera-grid .btn-default:focus,.caldera-grid .btn-default:hover,.open>.dropdown-toggle.caldera-grid .btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.caldera-grid .btn-default.disabled,.caldera-grid .btn-default.disabled.active,.caldera-grid .btn-default.disabled.focus,.caldera-grid .btn-default.disabled:active,.caldera-grid .btn-default.disabled:focus,.caldera-grid .btn-default.disabled:hover,.caldera-grid .btn-default[disabled],.caldera-grid .btn-default[disabled].active,.caldera-grid .btn-default[disabled].focus,.caldera-grid .btn-default[disabled]:active,.caldera-grid .btn-default[disabled]:focus,.caldera-grid .btn-default[disabled]:hover,fieldset[disabled] .caldera-grid .btn-default,fieldset[disabled] .caldera-grid .btn-default.active,fieldset[disabled] .caldera-grid .btn-default.focus,fieldset[disabled] .caldera-grid .btn-default:active,fieldset[disabled] .caldera-grid .btn-default:focus,fieldset[disabled] .caldera-grid .btn-default:hover{background-color:#fff;border-color:#ccc}.caldera-grid .btn-default .badge{color:#fff;background-color:#333}.caldera-grid .btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.caldera-grid .btn-primary.active,.caldera-grid .btn-primary.focus,.caldera-grid .btn-primary:active,.caldera-grid .btn-primary:focus,.caldera-grid .btn-primary:hover,.open>.dropdown-toggle.caldera-grid .btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.caldera-grid .btn-primary.disabled,.caldera-grid .btn-primary.disabled.active,.caldera-grid .btn-primary.disabled.focus,.caldera-grid .btn-primary.disabled:active,.caldera-grid .btn-primary.disabled:focus,.caldera-grid .btn-primary.disabled:hover,.caldera-grid .btn-primary[disabled],.caldera-grid .btn-primary[disabled].active,.caldera-grid .btn-primary[disabled].focus,.caldera-grid .btn-primary[disabled]:active,.caldera-grid .btn-primary[disabled]:focus,.caldera-grid .btn-primary[disabled]:hover,fieldset[disabled] .caldera-grid .btn-primary,fieldset[disabled] .caldera-grid .btn-primary.active,fieldset[disabled] .caldera-grid .btn-primary.focus,fieldset[disabled] .caldera-grid .btn-primary:active,fieldset[disabled] .caldera-grid .btn-primary:focus,fieldset[disabled] .caldera-grid .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.caldera-grid .btn-primary .badge{color:#337ab7;background-color:#fff}.caldera-grid .btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.caldera-grid .btn-success.active,.caldera-grid .btn-success.focus,.caldera-grid .btn-success:active,.caldera-grid .btn-success:focus,.caldera-grid .btn-success:hover,.open>.dropdown-toggle.caldera-grid .btn-success{color:#fff;background-color:#449d44;border-color:#398439}.caldera-grid .btn-success.disabled,.caldera-grid .btn-success.disabled.active,.caldera-grid .btn-success.disabled.focus,.caldera-grid .btn-success.disabled:active,.caldera-grid .btn-success.disabled:focus,.caldera-grid .btn-success.disabled:hover,.caldera-grid .btn-success[disabled],.caldera-grid .btn-success[disabled].active,.caldera-grid .btn-success[disabled].focus,.caldera-grid .btn-success[disabled]:active,.caldera-grid .btn-success[disabled]:focus,.caldera-grid .btn-success[disabled]:hover,fieldset[disabled] .caldera-grid .btn-success,fieldset[disabled] .caldera-grid .btn-success.active,fieldset[disabled] .caldera-grid .btn-success.focus,fieldset[disabled] .caldera-grid .btn-success:active,fieldset[disabled] .caldera-grid .btn-success:focus,fieldset[disabled] .caldera-grid .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.caldera-grid .btn-success .badge{color:#5cb85c;background-color:#fff}.caldera-grid .btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.caldera-grid .btn-info.active,.caldera-grid .btn-info.focus,.caldera-grid .btn-info:active,.caldera-grid .btn-info:focus,.caldera-grid .btn-info:hover,.open>.dropdown-toggle.caldera-grid .btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.caldera-grid .btn-info.disabled,.caldera-grid .btn-info.disabled.active,.caldera-grid .btn-info.disabled.focus,.caldera-grid .btn-info.disabled:active,.caldera-grid .btn-info.disabled:focus,.caldera-grid .btn-info.disabled:hover,.caldera-grid .btn-info[disabled],.caldera-grid .btn-info[disabled].active,.caldera-grid .btn-info[disabled].focus,.caldera-grid .btn-info[disabled]:active,.caldera-grid .btn-info[disabled]:focus,.caldera-grid .btn-info[disabled]:hover,fieldset[disabled] .caldera-grid .btn-info,fieldset[disabled] .caldera-grid .btn-info.active,fieldset[disabled] .caldera-grid .btn-info.focus,fieldset[disabled] .caldera-grid .btn-info:active,fieldset[disabled] .caldera-grid .btn-info:focus,fieldset[disabled] .caldera-grid .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.caldera-grid .btn-info .badge{color:#5bc0de;background-color:#fff}.caldera-grid .btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.caldera-grid .btn-warning.active,.caldera-grid .btn-warning.focus,.caldera-grid .btn-warning:active,.caldera-grid .btn-warning:focus,.caldera-grid .btn-warning:hover,.open>.dropdown-toggle.caldera-grid .btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.caldera-grid .btn-warning.disabled,.caldera-grid .btn-warning.disabled.active,.caldera-grid .btn-warning.disabled.focus,.caldera-grid .btn-warning.disabled:active,.caldera-grid .btn-warning.disabled:focus,.caldera-grid .btn-warning.disabled:hover,.caldera-grid .btn-warning[disabled],.caldera-grid .btn-warning[disabled].active,.caldera-grid .btn-warning[disabled].focus,.caldera-grid .btn-warning[disabled]:active,.caldera-grid .btn-warning[disabled]:focus,.caldera-grid .btn-warning[disabled]:hover,fieldset[disabled] .caldera-grid .btn-warning,fieldset[disabled] .caldera-grid .btn-warning.active,fieldset[disabled] .caldera-grid .btn-warning.focus,fieldset[disabled] .caldera-grid .btn-warning:active,fieldset[disabled] .caldera-grid .btn-warning:focus,fieldset[disabled] .caldera-grid .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.caldera-grid .btn-warning .badge{color:#f0ad4e;background-color:#fff}.caldera-grid .btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.caldera-grid .btn-danger.active,.caldera-grid .btn-danger.focus,.caldera-grid .btn-danger:active,.caldera-grid .btn-danger:focus,.caldera-grid .btn-danger:hover,.open>.dropdown-toggle.caldera-grid .btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.caldera-grid .btn-danger.disabled,.caldera-grid .btn-danger.disabled.active,.caldera-grid .btn-danger.disabled.focus,.caldera-grid .btn-danger.disabled:active,.caldera-grid .btn-danger.disabled:focus,.caldera-grid .btn-danger.disabled:hover,.caldera-grid .btn-danger[disabled],.caldera-grid .btn-danger[disabled].active,.caldera-grid .btn-danger[disabled].focus,.caldera-grid .btn-danger[disabled]:active,.caldera-grid .btn-danger[disabled]:focus,.caldera-grid .btn-danger[disabled]:hover,fieldset[disabled] .caldera-grid .btn-danger,fieldset[disabled] .caldera-grid .btn-danger.active,fieldset[disabled] .caldera-grid .btn-danger.focus,fieldset[disabled] .caldera-grid .btn-danger:active,fieldset[disabled] .caldera-grid .btn-danger:focus,fieldset[disabled] .caldera-grid .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.caldera-grid .btn-danger .badge{color:#d9534f;background-color:#fff}.caldera-grid .btn-link{color:#337ab7;font-weight:400;border-radius:0}.caldera-grid .btn-link,.caldera-grid .btn-link.active,.caldera-grid .btn-link:active,.caldera-grid .btn-link[disabled],fieldset[disabled] .caldera-grid .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.caldera-grid .btn-link,.caldera-grid .btn-link:active,.caldera-grid .btn-link:focus,.caldera-grid .btn-link:hover{border-color:transparent}.caldera-grid .btn-link:focus,.caldera-grid .btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.caldera-grid .btn-link[disabled]:focus,.caldera-grid .btn-link[disabled]:hover,fieldset[disabled] .caldera-grid .btn-link:focus,fieldset[disabled] .caldera-grid .btn-link:hover{color:#777;text-decoration:none}.caldera-grid .btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}.caldera-grid .btn-sm,.caldera-grid .btn-xs{font-size:12px;line-height:1.5;border-radius:1px}.caldera-grid .btn-sm{padding:5px 10px}.caldera-grid .btn-xs{padding:1px 5px}.caldera-grid .btn-block{display:block;width:100%}.caldera-grid .btn-block+.btn-block{margin-top:5px}.caldera-grid input[type=button].btn-block,.caldera-grid input[type=reset].btn-block,.caldera-grid input[type=submit].btn-block{width:100%}.caldera-grid textarea.form-control{padding-right:4px;height:auto}.caldera-grid .breadcrumb{padding:6px 12px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.caldera-grid .breadcrumb>li{display:inline-block;margin:0}.caldera-grid .breadcrumb>li+li:before{content:"/\00a0";padding:0 5px;color:#ccc}.caldera-grid .breadcrumb>.active,.caldera-grid .breadcrumb>.active>a{color:#777}.breadcrumb>li.active.error>a,.breadcrumb>li.error>a{color:red}.caldera-grid .alert{padding:8px;margin-bottom:18px;border-radius:2px}.caldera-grid .alert .alert-link{font-weight:700}.caldera-grid .alert-dismissable{padding-right:28px}.caldera-grid .alert-success{background-color:#dff0d8;border-color:#a3d48e;color:#3c763d}.caldera-grid .alert-success hr{border-top-color:#93cd7c}.caldera-grid .alert-success .alert-link{color:#2b542c}.caldera-grid .alert-info{background-color:#d9edf7;border-color:#85c5e5;color:#31708f}.caldera-grid .alert-info hr{border-top-color:#70bbe1}.caldera-grid .alert-info .alert-link{color:#245269}.caldera-grid .alert-warning{background-color:#f9edbe;border-color:#f0c36d;color:#333}.caldera-grid .alert-warning hr{border-top-color:#eeb956}.caldera-grid .alert-warning .alert-link{color:#1a1a1a}.caldera-grid .alert-danger,.caldera-grid .alert-error{background-color:#f2dede;border-color:#d59595;color:#a94442}.caldera-grid .alert-danger hr,.caldera-grid .alert-error hr{border-top-color:#ce8383}.caldera-grid .alert-danger .alert-link,.caldera-grid .alert-error .alert-link{color:#843534}.caldera-grid .has-error .checkbox,.caldera-grid .has-error .checkbox-inline,.caldera-grid .has-error .control-label,.caldera-grid .has-error .form-control-feedback,.caldera-grid .has-error .help-block,.caldera-grid .has-error .radio,.caldera-grid .has-error .radio-inline{color:#dd4b39}.caldera-grid .alert-danger,.caldera-grid .alert-error,.caldera-grid .alert-info,.caldera-grid .alert-success,.caldera-grid .alert-warning{text-shadow:0 1px 0 rgba(255,255,255,.5)}.caldera-grid .has-error .form-control{border-color:#dd4b39;-webkit-box-shadow:none;box-shadow:none}.caldera-grid .has-error .input-group-addon{color:#dd4b39;border-color:#dd4b39;background-color:#f2dede}.caldera-grid .has-error .form-control:focus,.caldera-grid .has-error .form-control:hover{border-color:#dd4b39}.caldera-grid.cf_processing{background:url(../images/loading.gif) center center/30px auto no-repeat rgba(0,0,0,0)}.caldera-grid.cf_processing>*{opacity:.5}
|
assets/images/caldera-globe-logo-sm.png
ADDED
Binary file
|
assets/images/new-icon.png
ADDED
Binary file
|
assets/js/admin.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
var baldrickTriggers, loop_loader;
|
2 |
|
3 |
jQuery(document).ready(function($){
|
4 |
-
|
5 |
// admin stuff!
|
6 |
// Baldrick Bindings
|
7 |
baldrickTriggers = function(){
|
@@ -14,7 +14,7 @@ jQuery(document).ready(function($){
|
|
14 |
|
15 |
var nonce = $('#cf_toolbar_actions'),
|
16 |
referer = nonce.parent().find('[name="_wp_http_referer"]');
|
17 |
-
|
18 |
if( nonce.length && referer.length ){
|
19 |
clicked.data('cf_toolbar_actions', nonce.val() );
|
20 |
clicked.data('_wp_http_referer', referer.val() );
|
@@ -68,13 +68,13 @@ jQuery(document).ready(function($){
|
|
68 |
$('body').on('click', '.caldera-group-remover', function(e){
|
69 |
|
70 |
e.preventDefault();
|
71 |
-
|
72 |
var clicked = $(this),
|
73 |
parent = clicked.closest('.caldera-repeater-group');
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
|
80 |
});
|
@@ -109,4 +109,17 @@ jQuery(document).ready(function($){
|
|
109 |
}
|
110 |
});
|
111 |
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
var baldrickTriggers, loop_loader;
|
2 |
|
3 |
jQuery(document).ready(function($){
|
4 |
+
|
5 |
// admin stuff!
|
6 |
// Baldrick Bindings
|
7 |
baldrickTriggers = function(){
|
14 |
|
15 |
var nonce = $('#cf_toolbar_actions'),
|
16 |
referer = nonce.parent().find('[name="_wp_http_referer"]');
|
17 |
+
|
18 |
if( nonce.length && referer.length ){
|
19 |
clicked.data('cf_toolbar_actions', nonce.val() );
|
20 |
clicked.data('_wp_http_referer', referer.val() );
|
68 |
$('body').on('click', '.caldera-group-remover', function(e){
|
69 |
|
70 |
e.preventDefault();
|
71 |
+
|
72 |
var clicked = $(this),
|
73 |
parent = clicked.closest('.caldera-repeater-group');
|
74 |
|
75 |
+
parent.slideUp(200, function(){
|
76 |
+
parent.remove();
|
77 |
+
});
|
78 |
|
79 |
|
80 |
});
|
109 |
}
|
110 |
});
|
111 |
|
112 |
+
|
113 |
+
//setup clippy on admin, not edit
|
114 |
+
var CFclippy;
|
115 |
+
if( undefined != typeof CF_CLIPPY && 'object' == typeof CF_CLIPPY ){
|
116 |
+
CFclippy = new CalderaFormsAdminClippys( $( document.getElementById( 'caldera-forms-clippy' ) ), CF_CLIPPY, $ );
|
117 |
+
CFclippy.init();
|
118 |
+
}
|
119 |
+
$( '.cf-entry-viewer-link' ).on( 'click', function(){
|
120 |
+
if ( 'object' == typeof CFclippy ){
|
121 |
+
CFclippy.remove();
|
122 |
+
}
|
123 |
+
});
|
124 |
+
|
125 |
+
});
|
assets/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var baldrickTriggers,loop_loader;jQuery(document).ready(function(
|
1 |
+
var baldrickTriggers,loop_loader;jQuery(document).ready(function(a){baldrickTriggers=function(){a(".ajax-trigger").baldrick({request:ajaxurl,method:"POST",before:function(b,c){var d=a(b),e=a("#cf_toolbar_actions"),f=e.parent().find('[name="_wp_http_referer"]');if(e.length&&f.length&&(d.data("cf_toolbar_actions",e.val()),d.data("_wp_http_referer",f.val())),d.data("trigger")){c.preventDefault();var g=a(d.data("trigger"));return g.trigger(g.data("event")?g.data("event"):"click"),!1}},complete:function(){a(".init_field_type[data-type]").each(function(b,c){var d=a(c);"function"==typeof window[d.data("type")+"_init"]&&window[d.data("type")+"_init"](d.prop("id"),d[0])})}})},loop_loader=function(a,b){var c=Math.round(1e7*Math.random());return{__id__:c}},baldrickTriggers(),a("body").on("click",".modal-side-tab",function(b){b.preventDefault();var c=a(this),d=c.closest(".caldera-modal-body"),e=d.find(".tab-detail-panel"),f=a(c.attr("href"));d.find(".modal-side-tab.active").removeClass("active"),c.addClass("active"),e.hide(),f.show()}),a("body").on("click",".caldera-group-remover",function(b){b.preventDefault();var c=a(this),d=c.closest(".caldera-repeater-group");d.slideUp(200,function(){d.remove()})}),a("body").on("click",".form-delete a.form-control",function(b){var c=a(this);confirm(c.data("confirm"))||b.preventDefault()}),a("body").on("keyup change",'[data-format="key"]',function(a){this.value=this.value.replace(/[^a-z0-9]/gi,"-").toLowerCase()}),a("body").on("keyup change",'[data-format="slug"]',function(a){this.value=this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase()}),a(window).on("resize",function(){var b=a("#cf_forms_toggle"),c=a(".form-panel-wrap");window.innerWidth<=1420&&b.is(":visible")&&c.is(":visible")&&b.trigger("click")});var b;void 0!=typeof CF_CLIPPY&&"object"==typeof CF_CLIPPY&&(b=new CalderaFormsAdminClippys(a(document.getElementById("caldera-forms-clippy")),CF_CLIPPY,a),b.init()),a(".cf-entry-viewer-link").on("click",function(){"object"==typeof b&&b.remove()})});
|
assets/js/caldera-clippy.js
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
function CalderaFormsAdminClippys( $zone, config, $ ){
|
3 |
+
|
4 |
+
var removed = false, self = this, template;
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
this.init = function () {
|
9 |
+
template = Handlebars.compile(config.template);
|
10 |
+
|
11 |
+
|
12 |
+
if( 'object' == typeof config.no_forms ){
|
13 |
+
$( document.getElementById( 'cf-you-have-no-forms' ) ).append( '<div id="cf-no-forms-clippy"></div>' );
|
14 |
+
addClippyToDOM( config.no_forms, 'cf-no-forms-clippy' );
|
15 |
+
window.setTimeout( pulseNewFormButton, 500 );
|
16 |
+
}else{
|
17 |
+
$.when( get() ).done( function( d ) {
|
18 |
+
if( 'object' == typeof d && undefined != typeof d.p ){
|
19 |
+
$.each( d.p, function( i, p ){
|
20 |
+
if( 3 > i && 'object' == typeof p ){
|
21 |
+
populateClippy(p,i);
|
22 |
+
}
|
23 |
+
});
|
24 |
+
|
25 |
+
}else {
|
26 |
+
populateClippy( config.fallback, 1 );
|
27 |
+
}
|
28 |
+
});
|
29 |
+
populateClippy( config.email_clippy, 3 );
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
$( '.bt-btn' ).on( 'click', function (e) {
|
37 |
+
var $this = $( this );
|
38 |
+
if( 0 != $this.data( '/cf/bt' ) ){
|
39 |
+
e.preventDefault();
|
40 |
+
$.get( config.api + '/bt?' + $.param({
|
41 |
+
url: config.url,
|
42 |
+
bt: $this.data('bt')
|
43 |
+
}) ).always( function(){
|
44 |
+
window.open(e.target.href);
|
45 |
+
});
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
});
|
50 |
+
|
51 |
+
};
|
52 |
+
|
53 |
+
this.remove = function(){
|
54 |
+
if ( false === removed ) {
|
55 |
+
$zone.fadeOut( 100, function() {
|
56 |
+
$zone.remove();
|
57 |
+
removed = true;
|
58 |
+
});
|
59 |
+
|
60 |
+
}
|
61 |
+
};
|
62 |
+
|
63 |
+
function populateClippy( p, i ){
|
64 |
+
if( undefined == p.link.bt ){
|
65 |
+
p.link.bt = 0;
|
66 |
+
}
|
67 |
+
addClippyToDOM( p,'caldera-forms-clippy-p' + i );
|
68 |
+
|
69 |
+
};
|
70 |
+
|
71 |
+
function addClippyToDOM( clippy, elId ) {
|
72 |
+
var el = document.getElementById( elId );
|
73 |
+
if( null != el ){
|
74 |
+
el.innerHTML = template(clippy);
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
function get( ) {
|
82 |
+
return $.get( url(), {
|
83 |
+
crossDomain: true
|
84 |
+
} ).done( function(r){
|
85 |
+
return r;
|
86 |
+
}).error( function(){
|
87 |
+
return false;
|
88 |
+
});
|
89 |
+
}
|
90 |
+
|
91 |
+
function url( ) {
|
92 |
+
var params = $.param({
|
93 |
+
p1: config.p1,
|
94 |
+
p2: config.p2,
|
95 |
+
p3: config.p3,
|
96 |
+
url: config.url
|
97 |
+
});
|
98 |
+
|
99 |
+
return config.api + '/cf/get?' + params;
|
100 |
+
}
|
101 |
+
|
102 |
+
function pulseNewFormButton() {
|
103 |
+
|
104 |
+
$( '.button-primary' ).animate({
|
105 |
+
opacity: 0.25
|
106 |
+
}, 500 , function() {
|
107 |
+
$( this ).animate({
|
108 |
+
opacity: 1
|
109 |
+
}, 500 );
|
110 |
+
});
|
111 |
+
|
112 |
+
window.setTimeout( pulseNewFormButton, 1000 );
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
+
}
|
assets/js/edit.js
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
/* contains edit.js, layout-grid.js, processors.js */
|
2 |
function new_conditional_group(obj){
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
}
|
22 |
function new_conditional_line(obj){
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
}
|
38 |
|
39 |
function build_conditions_config(obj){
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
|
45 |
}
|
46 |
|
@@ -48,2526 +48,2531 @@ function build_conditions_config(obj){
|
|
48 |
jQuery(document).ready(function($){
|
49 |
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
$(
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1197 |
|
1198 |
});//
|
1199 |
|
1200 |
-
var rebuild_field_binding,
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
|
1210 |
init_magic_tags = function(){
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
|
1248 |
}
|
1249 |
|
1250 |
rebuild_field_binding = function(){
|
1251 |
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
|
|
1304 |
|
1305 |
};
|
1306 |
|
1307 |
rebind_field_bindings = function(){
|
1308 |
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
};
|
1462 |
|
1463 |
function setup_field_type(obj){
|
1464 |
-
|
1465 |
-
|
1466 |
}
|
1467 |
|
1468 |
|
1469 |
|
1470 |
function check_required_bindings(el){
|
1471 |
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
}
|
1580 |
|
1581 |
jQuery(document).ready(function($) {
|
1582 |
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
|
1601 |
// bind pages tab
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
-
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
title_line.html( title );
|
2410 |
-
activeline.html( title + ' <span class="processor-line-number"></span>' ).parent().addClass( 'processor_type_' + selected.val() );
|
2411 |
-
|
2412 |
-
// get config
|
2413 |
-
build_processor_config(this);
|
2414 |
-
|
2415 |
-
rebuild_field_binding();
|
2416 |
-
|
2417 |
-
});
|
2418 |
-
$( document ).on('click', '#cf-shortcode-preview', function(){
|
2419 |
-
$(this).focus().select();
|
2420 |
-
} );
|
2421 |
-
$( document ).on('change', '.cf-email-preview-toggle', function(){
|
2422 |
-
var clicked = $(this),
|
2423 |
-
preview_button = $('.caldera-header-email-preview-button');
|
2424 |
-
if( clicked.is(':checked') ){
|
2425 |
-
preview_button.show().attr( 'aria-hidden', 'false' ).css( 'visibility', 'visible' );
|
2426 |
-
}else{
|
2427 |
-
preview_button.hide().attr( 'aria-hidden', 'true' ).css( 'visibility', 'hidden' );
|
2428 |
-
}
|
2429 |
-
|
2430 |
-
} );
|
2431 |
|
|
|
|
|
2432 |
|
2433 |
-
|
2434 |
-
|
2435 |
|
2436 |
-
|
2437 |
-
templ = $('#' + select.val() + '-tmpl').length ? $('#' + select.val() + '-tmpl').html() : '',
|
2438 |
-
parent = select.closest('.caldera-editor-processor-config-wrapper'),
|
2439 |
-
target = parent.find('.caldera-config-processor-setup'),
|
2440 |
-
template = Handlebars.compile(templ),
|
2441 |
-
config = parent.find('.processor_config_string').val(),
|
2442 |
-
current_type = select.data('type');
|
2443 |
-
|
2444 |
-
// Be sure to load the processors preset when switching back to the initial processor type.
|
2445 |
-
if(config.length && current_type === select.val() ){
|
2446 |
-
config = JSON.parse(config);
|
2447 |
-
}else{
|
2448 |
-
// default config
|
2449 |
-
config = processor_defaults[select.val() + '_cfg'];
|
2450 |
-
}
|
2451 |
-
|
2452 |
-
// build template
|
2453 |
-
if(!config){
|
2454 |
-
config = {};
|
2455 |
-
}
|
2456 |
-
|
2457 |
-
config._id = parent.prop('id');
|
2458 |
-
config._name = 'config[processors][' + parent.prop('id') + '][config]';
|
2459 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2460 |
|
2461 |
-
|
2462 |
|
2463 |
-
template = $('<div>').html( template( config ) );
|
2464 |
|
2465 |
-
|
2466 |
-
|
2467 |
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
-
|
|
|
|
|
|
|
2472 |
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
|
|
|
|
2478 |
|
|
|
|
|
|
|
|
|
2479 |
|
2480 |
-
|
2481 |
-
|
2482 |
|
2483 |
-
// initialise baldrick triggers
|
2484 |
-
$('.wp-baldrick').baldrick({
|
2485 |
-
request : ajaxurl,
|
2486 |
-
method : 'POST',
|
2487 |
-
before : function(el){
|
2488 |
-
|
2489 |
-
var tr = $(el);
|
2490 |
|
2491 |
-
if( tr.data('addNode') && !tr.data('request') ){
|
2492 |
-
tr.data('request', 'cf_get_default_setting');
|
2493 |
-
}
|
2494 |
-
}
|
2495 |
-
});
|
2496 |
-
|
2497 |
-
}
|
2498 |
-
|
2499 |
-
// build configs on load:
|
2500 |
-
// allows us to keep changes on reload as not to loose settings on accedental navigation
|
2501 |
-
rebuild_field_binding();
|
2502 |
|
2503 |
-
$('.caldera-select-processor-type').each(function(k,v){
|
2504 |
-
build_processor_config(v);
|
2505 |
-
});
|
2506 |
|
|
|
2507 |
|
2508 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2509 |
});//
|
2510 |
|
2511 |
|
2512 |
// field binding helper
|
2513 |
Handlebars.registerHelper('_field', function(args) {
|
2514 |
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
|
2525 |
-
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
|
2530 |
-
|
2531 |
-
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
-
|
2544 |
-
|
2545 |
-
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
});
|
2566 |
|
2567 |
Handlebars.registerHelper('console', function(context, options) {
|
2568 |
-
|
2569 |
});
|
2570 |
|
2571 |
|
2572 |
-
|
2573 |
-
|
1 |
/* contains edit.js, layout-grid.js, processors.js */
|
2 |
function new_conditional_group(obj){
|
3 |
|
4 |
+
var id = obj.trigger.data('id'),
|
5 |
+
lineid = 'cl' + Math.round(Math.random() * 18746582734),
|
6 |
+
rowid = 'rw' + Math.round(Math.random() * 98347598345),
|
7 |
+
group = [
|
8 |
+
{
|
9 |
+
id : rowid,
|
10 |
+
type : obj.trigger.data('type'),
|
11 |
+
lines : [
|
12 |
+
{
|
13 |
+
id : lineid
|
14 |
+
}
|
15 |
+
]
|
16 |
+
}
|
17 |
+
];
|
18 |
+
|
19 |
+
|
20 |
+
return {group : group, id: id};
|
21 |
}
|
22 |
function new_conditional_line(obj){
|
23 |
|
24 |
+
var id = obj.trigger.data('id'),
|
25 |
+
rowid = obj.trigger.data('group'),
|
26 |
+
type = obj.trigger.data('type'),
|
27 |
+
lineid = 'cl' + Math.round(Math.random() * 18746582734),
|
28 |
+
line = {
|
29 |
+
id : id,
|
30 |
+
type : type,
|
31 |
+
lineid : lineid,
|
32 |
+
rowid : rowid,
|
33 |
+
name : "config[" + type + "][" + id + "][conditions][group][" + rowid + "][" + lineid + "]"
|
34 |
+
};
|
35 |
+
|
36 |
+
return line;
|
37 |
}
|
38 |
|
39 |
function build_conditions_config(obj){
|
40 |
+
var config = JSON.parse(obj.trigger.val());
|
41 |
+
config.id = obj.trigger.data('id');
|
42 |
|
43 |
+
return config;
|
44 |
|
45 |
}
|
46 |
|
48 |
jQuery(document).ready(function($){
|
49 |
|
50 |
|
51 |
+
$('.caldera-header-save-button').baldrick({
|
52 |
+
method : 'POST',
|
53 |
+
request : 'admin.php?page=caldera-forms',
|
54 |
+
before : function(el, e){
|
55 |
+
e.preventDefault();
|
56 |
+
|
57 |
+
if(!check_required_bindings()){
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
$('#save_indicator').addClass('loading');
|
62 |
+
if( typeof tinyMCE !== 'undefined'){
|
63 |
+
tinyMCE.triggerSave();
|
64 |
+
}
|
65 |
+
|
66 |
+
var data_fields = $('.caldera-forms-options-form').formJSON();
|
67 |
+
if( data_fields.conditions ){
|
68 |
+
data_fields.config.conditional_groups = { conditions : data_fields.conditions };
|
69 |
+
}
|
70 |
+
$(el).data('cf_edit_nonce', data_fields.cf_edit_nonce);
|
71 |
+
$(el).data('_wp_http_referer', data_fields._wp_http_referer);
|
72 |
+
$(el).data('sender', 'ajax');
|
73 |
+
$(el).data('config', JSON.stringify(data_fields.config));
|
74 |
+
|
75 |
+
return true;
|
76 |
+
|
77 |
+
},
|
78 |
+
callback: function( obj ){
|
79 |
+
|
80 |
+
if( false === obj.data ){
|
81 |
+
var notice = $('.updated_notice_box');
|
82 |
+
|
83 |
+
notice.stop().animate({top: 0}, 200, function(){
|
84 |
+
setTimeout( function(){
|
85 |
+
notice.stop().animate({top: -75}, 200);
|
86 |
+
}, 2000);
|
87 |
+
});
|
88 |
+
}
|
89 |
+
},
|
90 |
+
complete: function( obj ){
|
91 |
+
|
92 |
+
$('.wrapper-instance-pane .field-config').prop('disabled', false);
|
93 |
+
|
94 |
+
}
|
95 |
+
});
|
96 |
+
|
97 |
+
/*
|
98 |
+
* Build the fieltypes config
|
99 |
+
* configs are stored in the .caldera-config-field-setup field within the parent wrapper
|
100 |
+
*
|
101 |
+
*/
|
102 |
+
function build_fieldtype_config(el){
|
103 |
+
|
104 |
+
|
105 |
+
var select = $(el),
|
106 |
+
parent = select.closest('.caldera-editor-field-config-wrapper'),
|
107 |
+
target = parent.find('.caldera-config-field-setup'),
|
108 |
+
template = ( compiled_templates[select.val() + '_tmpl'] ? compiled_templates[select.val() + '_tmpl'] : compiled_templates.noconfig_field_templ ),//Handlebars.compile(templ),
|
109 |
+
config = parent.find('.field_config_string').val(),
|
110 |
+
current_type = select.data('type');
|
111 |
+
|
112 |
+
|
113 |
+
parent.find('.caldera-config-group').show();
|
114 |
+
|
115 |
+
select.addClass('field-initialized');
|
116 |
+
|
117 |
+
// Be sure to load the fields preset when switching back to the initial field type.
|
118 |
+
if(config.length && current_type === select.val() ){
|
119 |
+
config = JSON.parse(config);
|
120 |
+
}else{
|
121 |
+
// default config
|
122 |
+
config = fieldtype_defaults[select.val() + '_cfg'];
|
123 |
+
}
|
124 |
+
|
125 |
+
// build template
|
126 |
+
if(!config){
|
127 |
+
config = {};
|
128 |
+
}
|
129 |
+
|
130 |
+
config._id = select.data('field');
|
131 |
+
config._name = 'config[fields][' + select.data('field') + '][config]';
|
132 |
+
|
133 |
+
|
134 |
+
template = $('<div>').html( template( config ) );
|
135 |
+
|
136 |
+
// send to target
|
137 |
+
target.html( template.html() );
|
138 |
+
|
139 |
+
// check for init function
|
140 |
+
if( typeof window[select.val() + '_init'] === 'function' ){
|
141 |
+
window[select.val() + '_init'](select.data('field'), target);
|
142 |
+
}
|
143 |
+
|
144 |
+
// remove not supported stuff
|
145 |
+
if(fieldtype_defaults[select.val() + '_nosupport']){
|
146 |
+
|
147 |
+
if(fieldtype_defaults[select.val() + '_nosupport'].indexOf('hide_label') >= 0){
|
148 |
+
parent.find('.hide-label-field').hide().find('.field-config').prop('checked', false);
|
149 |
+
}
|
150 |
+
if(fieldtype_defaults[select.val() + '_nosupport'].indexOf('caption') >= 0){
|
151 |
+
parent.find('.caption-field').hide().find('.field-config').val('');
|
152 |
+
}
|
153 |
+
if(fieldtype_defaults[select.val() + '_nosupport'].indexOf('required') >= 0){
|
154 |
+
parent.find('.required-field').hide().find('.field-config').prop('checked', false);
|
155 |
+
}
|
156 |
+
if(fieldtype_defaults[select.val() + '_nosupport'].indexOf('custom_class') >= 0){
|
157 |
+
parent.find('.customclass-field').hide().find('.field-config').val('');
|
158 |
+
}
|
159 |
+
if(fieldtype_defaults[select.val() + '_nosupport'].indexOf('entry_list') >= 0){
|
160 |
+
parent.find('.entrylist-field').hide().find('.field-config').prop('checked', false);
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
// seup options
|
165 |
+
parent.find('.toggle_show_values').trigger('change');
|
166 |
+
|
167 |
+
if( !$('.caldera-select-field-type').not('.field-initialized').length){
|
168 |
+
if(!core_form){
|
169 |
+
core_form = jQuery('.caldera-forms-options-form');
|
170 |
+
}
|
171 |
+
|
172 |
+
// build previews
|
173 |
+
if(!core_form.hasClass('builder-loaded')){
|
174 |
+
|
175 |
+
var fields = $('.caldera-select-field-type.field-initialized');
|
176 |
+
for( var f = 0; f < fields.length; f++){
|
177 |
+
build_field_preview( $(fields[f]).data('field') );
|
178 |
+
}
|
179 |
+
core_form.addClass('builder-loaded');
|
180 |
+
}else{
|
181 |
+
build_field_preview( select.data('field') );
|
182 |
+
}
|
183 |
+
$('.caldera-header-save-button').prop('disabled', false);
|
184 |
+
rebuild_field_binding();
|
185 |
+
baldrickTriggers();
|
186 |
+
}
|
187 |
+
if( $('.color-field').length ){
|
188 |
+
$('.color-field').wpColorPicker({
|
189 |
+
change: function(obj){
|
190 |
+
|
191 |
+
var trigger = $(this);
|
192 |
+
|
193 |
+
|
194 |
+
if( trigger.data('ev') ){
|
195 |
+
clearTimeout( trigger.data('ev') );
|
196 |
+
}
|
197 |
+
trigger.data('ev', setTimeout( function(){
|
198 |
+
trigger.trigger('record');
|
199 |
+
},200) );
|
200 |
+
if( trigger.data('target') ){
|
201 |
+
$( trigger.data('target') ).css( trigger.data('style'), trigger.val() );
|
202 |
+
$( trigger.data('target') ).val( trigger.val() );
|
203 |
+
}
|
204 |
+
|
205 |
+
}
|
206 |
+
});
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
function build_field_preview(id){
|
211 |
+
|
212 |
+
var panel = $('#' + id),
|
213 |
+
select = panel.find('.caldera-select-field-type'),
|
214 |
+
preview_parent = $('.layout-form-field[data-config="' + id + '"]'),
|
215 |
+
preview_target = preview_parent.find('.field_preview'),
|
216 |
+
preview = $('#preview-' + select.val() + '_tmpl').html(),
|
217 |
+
template = compiled_templates['preview-' + select.val() + '_tmpl'],// Handlebars.compile(preview),
|
218 |
+
config = {'id': id},
|
219 |
+
data_fields = panel.find('.field-config'),
|
220 |
+
objects = [];
|
221 |
+
|
222 |
+
data_fields.each(function(k,v){
|
223 |
+
var field = $(v),
|
224 |
+
basename = field.prop('name').split('[' + id + ']')[1].substr(1),
|
225 |
+
name = basename.substr(0, basename.length-1).split(']['),
|
226 |
+
value = ( field.is(':checkbox,:radio') ? field.filter(':checked').val() : field.val() ),
|
227 |
+
lineconf = {};
|
228 |
+
|
229 |
+
for(var i = name.length-1; i >= 0; i--){
|
230 |
+
|
231 |
+
if(i === name.length-1){
|
232 |
+
lineconf[name[i]] = value;
|
233 |
+
}else{
|
234 |
+
var newobj = lineconf;
|
235 |
+
lineconf = {};
|
236 |
+
lineconf[name[i]] = newobj;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
$.extend(true, config, lineconf);
|
240 |
+
});
|
241 |
+
|
242 |
+
preview_target.html( template(config) );
|
243 |
+
preview_parent.removeClass('button');
|
244 |
+
|
245 |
+
$('.preview-field-config').prop('disabled', true);
|
246 |
+
}
|
247 |
+
|
248 |
+
// switch active group
|
249 |
+
function switch_active_group(id){
|
250 |
+
var fields_panel = $('.caldera-editor-fields-panel'),
|
251 |
+
groups_panel = $('.caldera-editor-groups-panel'),
|
252 |
+
group_navs = $('.caldera-group-nav'),
|
253 |
+
group_line = $('[data-group="'+ id +'"]'),
|
254 |
+
group_name = group_line.find('.caldera-config-group-name'),
|
255 |
+
group_slug = group_line.find('.caldera-config-group-slug'),
|
256 |
+
group_desc = group_line.find('.caldera-config-group-desc'),
|
257 |
+
group_admin = group_line.find('.caldera-config-group-admin'),
|
258 |
+
group_name_edit = $('.active-group-name'),
|
259 |
+
group_slug_edit = $('.active-group-slug'),
|
260 |
+
group_desc_edit = $('.active-group-desc'),
|
261 |
+
group_admin_edit= $('.active-group-admin'),
|
262 |
+
field_lists = $('.caldera-editor-fields-list ul'),
|
263 |
+
group_repeat = group_line.find('.caldera-config-group-repeat'),
|
264 |
+
repeat_button = $('.repeat-config-button'),
|
265 |
+
group_settings = $('.caldera-editor-group-settings'),
|
266 |
+
deleter = $('.caldera-config-group-remove'),
|
267 |
+
group_field_lists;
|
268 |
+
|
269 |
+
// remove any hdden fields
|
270 |
+
$('.new-group-input').remove();
|
271 |
+
$('.new-field-input').remove();
|
272 |
+
|
273 |
+
|
274 |
+
// remove current active group
|
275 |
+
group_navs.removeClass('active');
|
276 |
+
|
277 |
+
// show fields panel
|
278 |
+
fields_panel.show();
|
279 |
+
|
280 |
+
// hide all groups
|
281 |
+
field_lists.hide();
|
282 |
+
|
283 |
+
// remove active field
|
284 |
+
field_lists.removeClass('active').find('li.active').removeClass('active');
|
285 |
+
field_lists.hide();
|
286 |
+
|
287 |
+
// set active group
|
288 |
+
group_line.addClass('active');
|
289 |
+
|
290 |
+
// hide delete button or show
|
291 |
+
group_field_lists = $('.caldera-editor-fields-list ul.active li');
|
292 |
+
|
293 |
+
if(group_field_lists.length){
|
294 |
+
// has fields
|
295 |
+
deleter.hide();
|
296 |
+
}else{
|
297 |
+
deleter.show();
|
298 |
+
}
|
299 |
+
|
300 |
+
|
301 |
+
// hide all field configs
|
302 |
+
$('.caldera-editor-field-config-wrapper').hide();
|
303 |
+
|
304 |
+
// show groups fields
|
305 |
+
group_line.show();
|
306 |
+
|
307 |
+
// set group name edit field
|
308 |
+
group_name_edit.val(group_name.val());
|
309 |
+
|
310 |
+
// set group slug edit field
|
311 |
+
group_slug_edit.val(group_slug.val());
|
312 |
+
|
313 |
+
// set group slug edit field
|
314 |
+
group_desc_edit.val(group_desc.val());
|
315 |
+
|
316 |
+
// set group admin edit field
|
317 |
+
if(group_admin.val() === '1'){
|
318 |
+
group_admin_edit.prop('checked', true);
|
319 |
+
}else{
|
320 |
+
group_admin_edit.prop('checked', false);
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
+
|
325 |
+
|
326 |
+
// is repeatable
|
327 |
+
if(group_repeat.val() === '1'){
|
328 |
+
repeat_button.addClass('field-edit-open');
|
329 |
+
}else{
|
330 |
+
repeat_button.removeClass('field-edit-open');
|
331 |
+
}
|
332 |
+
|
333 |
+
|
334 |
+
}
|
335 |
+
|
336 |
+
// tabs button
|
337 |
+
$('body').on('click', '.toggle_processor_event input', function(e){
|
338 |
+
var clicked = $(this),
|
339 |
+
parent = clicked.closest( '.wrapper-instance-pane' ),
|
340 |
+
settings = parent.find('.caldera-config-processor-setup'),
|
341 |
+
notice = parent.find('.caldera-config-processor-notice');
|
342 |
+
|
343 |
+
|
344 |
+
if( clicked.is(':checked') ){
|
345 |
+
clicked.parent().addClass('activated');
|
346 |
+
clicked.parent().find('.is_active').show().attr( 'aria-hidden', false ).css( 'visibility', 'visible' );
|
347 |
+
clicked.parent().find('.not_active').hide().attr( 'aria-hidden', true ).css( 'visibility', 'hidden' );
|
348 |
+
}else{
|
349 |
+
clicked.parent().removeClass('activated');
|
350 |
+
clicked.parent().find('.is_active').hide().attr( 'aria-hidden', true ).css( 'visibility', 'hidden' );
|
351 |
+
clicked.parent().find('.not_active').show().attr( 'aria-hidden', false ).css( 'visibility', 'visible' );
|
352 |
+
}
|
353 |
+
|
354 |
+
// check if all are selected
|
355 |
+
if( parent.find('.toggle_processor_event .activated').length ){
|
356 |
+
settings.slideDown(100);
|
357 |
+
notice.slideUp(100);
|
358 |
+
}else{
|
359 |
+
settings.slideUp(100);
|
360 |
+
notice.slideDown(100);
|
361 |
+
}
|
362 |
+
|
363 |
+
});
|
364 |
+
$('body').on('click', '.toggle_option_tab > a', function(e){
|
365 |
+
|
366 |
+
e.preventDefault();
|
367 |
+
var clicked = $(this),
|
368 |
+
panel = $(clicked.attr('href')),
|
369 |
+
tabs = clicked.parent().find('a'),
|
370 |
+
panels = clicked.closest('.caldera-editor-config-wrapper').find('.wrapper-instance-pane');
|
371 |
+
|
372 |
+
tabs.removeClass('button-primary');
|
373 |
+
|
374 |
+
panels.hide();
|
375 |
+
panel.show();
|
376 |
+
clicked.addClass('button-primary');
|
377 |
+
$('.caldera-conditionals-usetype').trigger('change');
|
378 |
+
});
|
379 |
+
|
380 |
+
|
381 |
+
// Change Field Type
|
382 |
+
$('.caldera-editor-body').on('change', '.caldera-select-field-type', function(e){
|
383 |
+
// push element to config function
|
384 |
+
build_fieldtype_config(this);
|
385 |
+
});
|
386 |
+
|
387 |
+
// build group navigation
|
388 |
+
$('.caldera-editor-body').on('click', '.caldera-group-nav a', function(e){
|
389 |
+
|
390 |
+
// stop link
|
391 |
+
e.preventDefault();
|
392 |
+
|
393 |
+
//switch group
|
394 |
+
switch_active_group( $(this).attr('href').substr(1) );
|
395 |
+
|
396 |
+
});
|
397 |
+
|
398 |
+
// build field navigation
|
399 |
+
$('.caldera-editor-body').on('click', '.caldera-editor-fields-list a', function(e){
|
400 |
+
|
401 |
+
// stop link
|
402 |
+
e.preventDefault();
|
403 |
+
|
404 |
+
var clicked = $(this),
|
405 |
+
field_config = $( clicked.attr('href') );
|
406 |
+
|
407 |
+
// remove any hdden fields
|
408 |
+
$('.new-group-input').remove();
|
409 |
+
$('.new-field-input').remove();
|
410 |
+
|
411 |
+
|
412 |
+
// remove active field
|
413 |
+
$('.caldera-editor-fields-list li.active').removeClass('active');
|
414 |
+
|
415 |
+
// mark active
|
416 |
+
clicked.parent().addClass('active');
|
417 |
+
|
418 |
+
// hide all field configs
|
419 |
+
$('.caldera-editor-field-config-wrapper').hide();
|
420 |
+
|
421 |
+
// show field config
|
422 |
+
field_config.show();
|
423 |
+
|
424 |
+
});
|
425 |
+
|
426 |
+
// bind show group config panel
|
427 |
+
$('.caldera-editor-body').on('click', '.group-config-button', function(e){
|
428 |
+
var clicked = $(this),
|
429 |
+
group_settings = $('.caldera-editor-group-settings'),
|
430 |
+
parent = clicked.closest('.caldera-editor-fields-panel'),
|
431 |
+
deleter = $('.caldera-config-group-remove');
|
432 |
+
|
433 |
+
// check if children
|
434 |
+
if(parent.find('.caldera-field-line').length){
|
435 |
+
// has fields
|
436 |
+
deleter.hide();
|
437 |
+
}else{
|
438 |
+
deleter.show();
|
439 |
+
}
|
440 |
+
|
441 |
+
if(clicked.hasClass('field-edit-open')){
|
442 |
+
// show config
|
443 |
+
group_settings.slideUp(100);
|
444 |
+
clicked.removeClass('field-edit-open');
|
445 |
+
}else{
|
446 |
+
// hide config
|
447 |
+
group_settings.slideDown(100);
|
448 |
+
clicked.addClass('field-edit-open');
|
449 |
+
}
|
450 |
+
|
451 |
+
|
452 |
+
});
|
453 |
+
$('.caldera-editor-body').on('keydown', '.field-config', function(e){
|
454 |
+
if($(this).is('textarea')){
|
455 |
+
return;
|
456 |
+
}
|
457 |
+
if(e.which === 13){
|
458 |
+
e.preventDefault();
|
459 |
+
}
|
460 |
+
});
|
461 |
+
// field label bind
|
462 |
+
$('.caldera-editor-body').on('change', '.field-label', function(e){
|
463 |
+
var field = $(this).closest('.caldera-editor-field-config-wrapper').prop('id');
|
464 |
+
field_line = $('[data-field="' + field + '"]'),
|
465 |
+
field_title = $('#' + field + ' .caldera-editor-field-title, .layout-form-field.field-edit-open .layout_field_name'),
|
466 |
+
slug = $('#' + field + ' .field-slug');
|
467 |
+
|
468 |
+
field_line.find('a').html( '<i class="icn-field"></i> ' + this.value );
|
469 |
+
field_title.text( this.value );
|
470 |
+
if(e.type === 'change'){
|
471 |
+
slug.trigger('change');
|
472 |
+
}
|
473 |
+
rebuild_field_binding();
|
474 |
+
});
|
475 |
+
|
476 |
+
|
477 |
+
// rename group
|
478 |
+
$('.caldera-editor-body').on('change', '.active-group-name', function(e){
|
479 |
+
e.preventDefault();
|
480 |
+
var active_group = $('.caldera-group-nav.active'),
|
481 |
+
group = active_group.data('group'),
|
482 |
+
group_name = active_group.find('.caldera-config-group-name'),
|
483 |
+
group_label = active_group.find('span');
|
484 |
+
|
485 |
+
// check its not blank
|
486 |
+
if(e.type === 'focusout' && !this.value.length){
|
487 |
+
this.value = 'Group ' + ( parseInt( active_group.index() ) + 1 );
|
488 |
+
}
|
489 |
+
|
490 |
+
|
491 |
+
group_name.val(this.value);
|
492 |
+
group_label.text(this.value);
|
493 |
+
|
494 |
+
});
|
495 |
+
// rename group slug
|
496 |
+
$('.caldera-editor-body').on('change', '.active-group-slug', function(e){
|
497 |
+
e.preventDefault();
|
498 |
+
|
499 |
+
var active_group = $('.caldera-group-nav.active'),
|
500 |
+
group = active_group.data('group'),
|
501 |
+
group_name = active_group.find('.caldera-config-group-name').val(),
|
502 |
+
group_slug = active_group.find('.caldera-config-group-slug'),
|
503 |
+
group_label = active_group.find('span'),
|
504 |
+
slug_sanitized = this.value.split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase();
|
505 |
+
|
506 |
+
// check its not blank
|
507 |
+
if(e.type === 'focusout' && !this.value.length){
|
508 |
+
slug_sanitized = group_name.split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase();
|
509 |
+
}
|
510 |
+
|
511 |
+
group_slug.val(slug_sanitized);
|
512 |
+
this.value = slug_sanitized;
|
513 |
+
|
514 |
+
});
|
515 |
+
// rename group description
|
516 |
+
$('.caldera-editor-body').on('change', '.active-group-desc', function(e){
|
517 |
+
e.preventDefault();
|
518 |
+
|
519 |
+
var active_group = $('.caldera-group-nav.active'),
|
520 |
+
group = active_group.data('group'),
|
521 |
+
group_desc = active_group.find('.caldera-config-group-desc');
|
522 |
+
|
523 |
+
group_desc.val(this.value);
|
524 |
+
|
525 |
+
});
|
526 |
+
|
527 |
+
// set group admin
|
528 |
+
$('.caldera-editor-body').on('change', '.active-group-admin', function(e){
|
529 |
+
e.preventDefault();
|
530 |
+
|
531 |
+
var active_group = $('.caldera-group-nav.active'),
|
532 |
+
group = active_group.data('group'),
|
533 |
+
group_name = active_group.find('.caldera-config-group-name').val(),
|
534 |
+
group_admin = active_group.find('.caldera-config-group-admin'),
|
535 |
+
group_label = active_group.find('span'),
|
536 |
+
slug_sanitized = this.value.split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase();
|
537 |
+
|
538 |
+
// check its not blank
|
539 |
+
if($(this).prop('checked')){
|
540 |
+
group_admin.val(1);
|
541 |
+
active_group.addClass('is-admin');
|
542 |
+
}else{
|
543 |
+
group_admin.val(0);
|
544 |
+
active_group.removeClass('is-admin');
|
545 |
+
}
|
546 |
+
|
547 |
+
});
|
548 |
+
|
549 |
+
// set repeatable
|
550 |
+
$('.caldera-editor-body').on('click', '.repeat-config-button', function(e){
|
551 |
+
e.preventDefault();
|
552 |
+
var active_group = $('.caldera-group-nav.active'),
|
553 |
+
group = active_group.data('group'),
|
554 |
+
icon = active_group.find('a .group-type'),
|
555 |
+
group_repeat = active_group.find('.caldera-config-group-repeat'),
|
556 |
+
clicked = $(this);
|
557 |
+
|
558 |
+
if(clicked.hasClass('field-edit-open')){
|
559 |
+
// set static
|
560 |
+
group_repeat.val('0');
|
561 |
+
icon.removeClass('icn-repeat').addClass('icn-folder');
|
562 |
+
clicked.removeClass('field-edit-open');
|
563 |
+
}else{
|
564 |
+
// set repeat
|
565 |
+
group_repeat.val('1');
|
566 |
+
icon.addClass('icn-repeat').removeClass('icn-folder');
|
567 |
+
clicked.addClass('field-edit-open');
|
568 |
+
}
|
569 |
+
|
570 |
+
});
|
571 |
+
|
572 |
+
// bind delete field
|
573 |
+
$('.caldera-editor-body').on('click', '.delete-field', function(){
|
574 |
+
var clicked = $(this),
|
575 |
+
field = clicked.closest('.caldera-editor-field-config-wrapper').prop('id');
|
576 |
+
|
577 |
+
if(!confirm(clicked.data('confirm'))){
|
578 |
+
return;
|
579 |
+
}
|
580 |
+
// remove config
|
581 |
+
$('#' + field).remove();
|
582 |
+
// remove options
|
583 |
+
$('option[value="' + field + '"]').remove();
|
584 |
+
$('[data-bind="' + field + '"]').remove();
|
585 |
+
|
586 |
+
// remove field
|
587 |
+
delete current_form_fields[field];
|
588 |
+
|
589 |
+
$('[data-config="' + field + '"]').slideUp(200, function(){
|
590 |
+
var line = $(this);
|
591 |
+
|
592 |
+
// remove line
|
593 |
+
line.remove();
|
594 |
+
rebuild_field_binding();
|
595 |
+
$(document).trigger('field.removed');
|
596 |
+
});
|
597 |
+
|
598 |
+
});
|
599 |
+
|
600 |
+
|
601 |
+
// bind add new group button
|
602 |
+
$('.caldera-editor-body').on('click', '.add-new-group,.add-field', function(){
|
603 |
+
|
604 |
+
var clicked = $(this);
|
605 |
+
|
606 |
+
// remove any hdden fields
|
607 |
+
$('.new-group-input').remove();
|
608 |
+
$('.new-field-input').remove();
|
609 |
+
|
610 |
+
if( clicked.hasClass( 'add-field' ) ){
|
611 |
+
var field_input = $('<input type="text" class="new-field-input block-input">');
|
612 |
+
field_input.appendTo( $('.caldera-editor-fields-list ul.active') ).focus();
|
613 |
+
}else{
|
614 |
+
var group_input = $('<input type="text" class="new-group-input block-input">');
|
615 |
+
group_input.appendTo( $('.caldera-editor-groups-panel') ).focus();
|
616 |
+
}
|
617 |
+
|
618 |
+
});
|
619 |
+
|
620 |
+
// dynamic group creation
|
621 |
+
$('.caldera-editor-body').on('change keypress', '.new-group-input', function(e){
|
622 |
+
|
623 |
+
if(e.type === 'keypress'){
|
624 |
+
if(e.which === 13){
|
625 |
+
e.preventDefault();
|
626 |
+
}else{
|
627 |
+
return;
|
628 |
+
}
|
629 |
+
}
|
630 |
+
|
631 |
+
|
632 |
+
var group_name = this.value,
|
633 |
+
input = $(this),
|
634 |
+
wrap = $('.caldera-editor-groups-panel ul'),
|
635 |
+
field_list = $('.caldera-editor-fields-list'),
|
636 |
+
new_templ,
|
637 |
+
new_group;
|
638 |
+
|
639 |
+
if( !group_name.length ){
|
640 |
+
// no name- just remove the input
|
641 |
+
input.remove();
|
642 |
+
}else{
|
643 |
+
new_templ = Handlebars.compile( $('#caldera_group_line_templ').html() );
|
644 |
+
new_group = {
|
645 |
+
"id" : group_name.split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase(),
|
646 |
+
"name" : group_name,
|
647 |
+
};
|
648 |
+
|
649 |
+
// place new group line
|
650 |
+
wrap.append( new_templ( new_group ) );
|
651 |
+
|
652 |
+
// create field list
|
653 |
+
var new_list = $('<ul data-group="' + new_group.id + '">').hide();
|
654 |
+
|
655 |
+
// place list in fields list
|
656 |
+
new_list.appendTo( field_list );
|
657 |
+
|
658 |
+
// init sorting
|
659 |
+
|
660 |
+
|
661 |
+
// remove input
|
662 |
+
input.remove();
|
663 |
+
|
664 |
+
// swtich to new group
|
665 |
+
switch_active_group( new_group.id );
|
666 |
+
}
|
667 |
+
|
668 |
+
});
|
669 |
+
|
670 |
+
// dynamic field creation
|
671 |
+
$('.caldera-editor-body').on('change keypress', '.new-field-input', function(e){
|
672 |
+
|
673 |
+
if(e.type === 'keypress'){
|
674 |
+
if(e.which === 13){
|
675 |
+
e.preventDefault();
|
676 |
+
}else{
|
677 |
+
return;
|
678 |
+
}
|
679 |
+
}
|
680 |
+
|
681 |
+
|
682 |
+
var new_name = this.value,
|
683 |
+
input = $(this),
|
684 |
+
wrap = input.parent(),
|
685 |
+
field_conf = $('.caldera-editor-field-config'),
|
686 |
+
new_templ,
|
687 |
+
new_conf_templ,
|
688 |
+
new_field,
|
689 |
+
deleter = $('.caldera-config-group-remove');
|
690 |
+
|
691 |
+
if( !new_name.length ){
|
692 |
+
// no name- just remove the input
|
693 |
+
input.remove();
|
694 |
+
}else{
|
695 |
+
// hide delete group
|
696 |
+
deleter.hide();
|
697 |
+
// field line template
|
698 |
+
new_templ = Handlebars.compile( $('#caldera_field_line_templ').html() );
|
699 |
+
// field conf template
|
700 |
+
new_conf_templ = Handlebars.compile( $('#caldera_field_config_wrapper_templ').html() );
|
701 |
+
|
702 |
+
new_field = {
|
703 |
+
"id" : new_name.split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase(),
|
704 |
+
"label" : new_name,
|
705 |
+
"slug" : new_name.split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase(),
|
706 |
+
"group" : $('.caldera-group-nav.active').data('group')
|
707 |
+
};
|
708 |
+
|
709 |
+
var field = $(new_templ( new_field ));
|
710 |
+
|
711 |
+
// place new field line
|
712 |
+
field.appendTo( wrap );
|
713 |
+
// pance new conf template
|
714 |
+
field_conf.append( new_conf_templ( new_field ) );
|
715 |
+
|
716 |
+
// load field
|
717 |
+
field.find('a').trigger('click');
|
718 |
+
|
719 |
+
// remove input
|
720 |
+
input.remove();
|
721 |
+
|
722 |
+
}
|
723 |
+
|
724 |
+
});
|
725 |
+
|
726 |
+
// bind slug editing to keep clean
|
727 |
+
$('.caldera-editor-body').on('change', '.field-slug', function(e){
|
728 |
+
if(this.value.length){
|
729 |
+
this.value = this.value.split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase();
|
730 |
+
}else{
|
731 |
+
if(e.type === 'change'){
|
732 |
+
this.value = $(this).closest('.caldera-editor-field-config-wrapper').find('.field-label').val().split(' ').join('_').split('-').join('_').replace(/[^a-z0-9_]/gi, '').toLowerCase();
|
733 |
+
}
|
734 |
+
}
|
735 |
+
});
|
736 |
+
|
737 |
+
// bind add group button
|
738 |
+
$('.caldera-editor-body').on('click', '.caldera-add-group', function(e){
|
739 |
+
|
740 |
+
var clicked = $(this),
|
741 |
+
group = clicked.data('group'),
|
742 |
+
template = $('#' + group + '_panel_tmpl').html();
|
743 |
+
|
744 |
+
clicked.parent().parent().append(template);
|
745 |
+
|
746 |
+
});
|
747 |
+
// bind remove group button
|
748 |
+
$('.caldera-editor-body').on('click', '.caldera-config-group-remove', function(e){
|
749 |
+
|
750 |
+
var group = $('.active-group-slug').val();
|
751 |
+
|
752 |
+
$('[data-group="' + group + '"]').hide(0, function(){
|
753 |
+
$(this).remove();
|
754 |
+
var navs = $('.caldera-group-nav');
|
755 |
+
|
756 |
+
if(navs.length){
|
757 |
+
navs.first().find('a').trigger('click');
|
758 |
+
}else{
|
759 |
+
$('.caldera-editor-fields-panel').hide();
|
760 |
+
}
|
761 |
+
});
|
762 |
+
|
763 |
+
});
|
764 |
+
|
765 |
+
$('body').on('click', '.set-current-field', function(e){
|
766 |
+
|
767 |
+
e.preventDefault();
|
768 |
+
|
769 |
+
var clicked = $(this);
|
770 |
+
|
771 |
+
$('#' + clicked.data('field') + '_type').val(clicked.data('type')).trigger('change');
|
772 |
+
|
773 |
+
$('#' + clicked.data('field') + '_lable').focus()
|
774 |
+
|
775 |
+
$('#field_setup_baldrickModalCloser').trigger('click');
|
776 |
+
|
777 |
+
|
778 |
+
});
|
779 |
+
|
780 |
+
$('.caldera-editor-body').on('change record', '.field-config', function(e){
|
781 |
+
|
782 |
+
var field = $(this),
|
783 |
+
parent = field.closest('.caldera-editor-field-config-wrapper');
|
784 |
+
|
785 |
+
if(!current_form_fields){
|
786 |
+
return;
|
787 |
+
}
|
788 |
+
//
|
789 |
+
if(field.prop('id') === parent.prop('id') + '_lable'){
|
790 |
+
// update field bind label
|
791 |
+
current_form_fields[parent.prop('id')].label = this.value;
|
792 |
+
}
|
793 |
+
if(field.prop('id') === parent.prop('id') + '_slug'){
|
794 |
+
// update field bind slug
|
795 |
+
current_form_fields[parent.prop('id')].slug = this.value;
|
796 |
+
}
|
797 |
+
if(field.prop('id') === parent.prop('id') + '_type'){
|
798 |
+
// update field bind type
|
799 |
+
current_form_fields[parent.prop('id')].type = this.value;
|
800 |
+
}
|
801 |
+
|
802 |
+
if(parent.length){
|
803 |
+
build_field_preview(parent.prop('id'));
|
804 |
+
}
|
805 |
+
|
806 |
+
});
|
807 |
+
|
808 |
+
$('.caldera-editor-body').on('focus', '.caldera-field-bind', function(e){
|
809 |
+
var field = $(this),
|
810 |
+
value = this.value;
|
811 |
+
|
812 |
+
if(e.type && e.type === 'focusin'){
|
813 |
+
field.removeClass('bound_field').addClass('reload-binding');
|
814 |
+
rebind_field_bindings();
|
815 |
+
this.value = value;
|
816 |
+
return;
|
817 |
+
}
|
818 |
+
});
|
819 |
+
|
820 |
+
$('.caldera-editor-body').on('change', '.caldera-conditional-field-set', function(e){
|
821 |
+
|
822 |
+
var field = $(this),
|
823 |
+
field_compare = field.parent().find('.compare-type'),
|
824 |
+
type = field.data('condition'),
|
825 |
+
pid = field.data('id'),
|
826 |
+
name = "config[" + type + "][" + pid + "][conditions][group][" + field.data('row') + "][" + field.data('line') + "]",
|
827 |
+
lineid = field.data('line'),
|
828 |
+
target = $('#' + lineid + "_value"),
|
829 |
+
curval = target.find('.caldera-conditional-value-field').first(),
|
830 |
+
field_wrapper,
|
831 |
+
is_button,
|
832 |
+
options_wrap = [];
|
833 |
+
|
834 |
+
var field_id = this.value;
|
835 |
+
if( field_id.substr(0,1) !== '{' ){
|
836 |
+
field_wrapper = $('#' + field_id);
|
837 |
+
is_button = field_wrapper.find( '.field-button-type' );
|
838 |
+
options_wrap = field_wrapper.find('.caldera-config-group-toggle-options');
|
839 |
+
}
|
840 |
+
if(field.hasClass('.bind_init')){
|
841 |
+
field.addClass('bound_triggered');
|
842 |
+
}
|
843 |
+
// check if a value is present
|
844 |
+
if(curval.length){
|
845 |
+
if(curval.val().length){
|
846 |
+
target.data('value', curval.val());
|
847 |
+
|
848 |
+
}
|
849 |
+
}
|
850 |
+
field_compare.show();
|
851 |
+
if(options_wrap.length){
|
852 |
+
var options_rows = options_wrap.find('.toggle_option_row'),
|
853 |
+
out = '<select name="' + name + '[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="' + field_id + '" style="max-width: 220px; width: 220px;">';
|
854 |
+
out += '<option value=""></option>';
|
855 |
+
|
856 |
+
options_rows.each(function(k,v){
|
857 |
+
var label = $(v).find('.toggle_label_field'),
|
858 |
+
value = label.data('option'),
|
859 |
+
sel = '';
|
860 |
+
|
861 |
+
if(target.data('value')){
|
862 |
+
if(target.data('value').toString() === value || target.data('value').toString() === $(v).find('.toggle_value_field').val() ){
|
863 |
+
sel = ' selected="selected"';
|
864 |
+
}
|
865 |
+
}
|
866 |
+
|
867 |
+
out += '<option value="' + value + '"' + sel + '>' + label.val() + '</option>';
|
868 |
+
})
|
869 |
+
|
870 |
+
out += '</select>';
|
871 |
+
|
872 |
+
}else if( is_button && is_button.val() == 'button' ) {
|
873 |
+
|
874 |
+
field_compare.val('is').hide();
|
875 |
+
|
876 |
+
|
877 |
+
out = '<select name="' + name + '[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="' + field_id + '" style="max-width: 220px; width: 220px;">';
|
878 |
+
out += '<option value="click" ' + ( target.data( 'value' ) === 'click' ? 'selected="selected"' : '' ) + '>Click</option>';
|
879 |
+
out += '<option value="dblclick" ' + ( target.data( 'value' ) === 'dblclick' ? 'selected="selected"' : '' ) + '>Double Click</option>';
|
880 |
+
out += '</select>';
|
881 |
+
|
882 |
+
}else{
|
883 |
+
out = '<input name="' + name + '[value]" type="text" class="caldera-conditional-value-field magic-tag-enabled" value="' + (target.data('value') ? target.data('value') : '') + '" style="max-width: 205px;">';
|
884 |
+
}
|
885 |
+
|
886 |
+
|
887 |
+
target.html(out);
|
888 |
+
init_magic_tags();
|
889 |
+
|
890 |
+
});
|
891 |
+
|
892 |
+
|
893 |
+
$('.caldera-editor-body').on('change', '.caldera-conditionals-usetype', function(e){
|
894 |
+
|
895 |
+
var select = $(this);
|
896 |
+
|
897 |
+
if( this.value === 'show' || this.value === 'hide' || this.value === 'disable' || this.value === 'use' || this.value === 'not' ){
|
898 |
+
$('#' + select.data('id') + '_condition_group_add').show();
|
899 |
+
$('#' + select.data('id') + '_conditional_wrap').show();
|
900 |
+
}else{
|
901 |
+
$('#' + select.data('id') + '_condition_group_add').hide();
|
902 |
+
$('#' + select.data('id') + '_conditional_wrap').hide();
|
903 |
+
}
|
904 |
+
|
905 |
+
});
|
906 |
+
// conditionals
|
907 |
+
$('.caldera-editor-body').on('click', '.remove-conditional-line', function(e){
|
908 |
+
e.preventDefault();
|
909 |
+
var clicked = $(this),
|
910 |
+
line = clicked.closest('.caldera-condition-line'),
|
911 |
+
group = clicked.closest('.caldera-condition-group');
|
912 |
+
|
913 |
+
line.remove();
|
914 |
+
if(!group.find('.caldera-condition-line').length){
|
915 |
+
group.remove();
|
916 |
+
}
|
917 |
+
|
918 |
+
});
|
919 |
+
|
920 |
+
|
921 |
+
// load fist group
|
922 |
+
$('.caldera-group-nav').first().find('a').trigger('click');
|
923 |
+
|
924 |
+
// toggle set values
|
925 |
+
$('.caldera-editor-body').on('change', '.toggle_show_values', function(e){
|
926 |
+
var clicked = $(this),
|
927 |
+
wrap = clicked.closest('.caldera-config-group-toggle-options');
|
928 |
+
values = wrap.find('.toggle_value_field'),
|
929 |
+
lables = wrap.find('.toggle_label_field'),
|
930 |
+
field_lables = wrap.find('.caldera-config-group-option-labels');
|
931 |
+
|
932 |
+
if(!clicked.prop('checked')){
|
933 |
+
values.hide().parent().hide();
|
934 |
+
lables.css('width', 245);
|
935 |
+
field_lables.hide();
|
936 |
+
}else{
|
937 |
+
values.show().parent().show();
|
938 |
+
values.show().parent().parent().show();
|
939 |
+
lables.css('width', '');
|
940 |
+
field_lables.show();
|
941 |
+
}
|
942 |
+
|
943 |
+
lables.trigger('toggle.values');
|
944 |
+
init_magic_tags();
|
945 |
+
|
946 |
+
});
|
947 |
+
|
948 |
+
// autopopulate
|
949 |
+
$('.caldera-editor-body').on('change', '.auto-populate-type', function(){
|
950 |
+
$(this).closest('.wrapper-instance-pane').find('.auto-populate-options').trigger('change');
|
951 |
+
});
|
952 |
+
$('.caldera-editor-body').on('change', '.auto-populate-options', function(){
|
953 |
+
var clicked = $(this),
|
954 |
+
wrap = clicked.closest('.wrapper-instance-pane'),
|
955 |
+
manual = wrap.find('.caldera-config-group-toggle-options'),
|
956 |
+
autotype_wrap = wrap.find('.caldera-config-group-auto-options'),
|
957 |
+
autotype = autotype_wrap.find('.auto-populate-type');
|
958 |
+
|
959 |
+
autotype_wrap.find('.auto-populate-type-panel').hide();
|
960 |
+
|
961 |
+
if(clicked.prop('checked')){
|
962 |
+
manual.hide();
|
963 |
+
autotype_wrap.show();
|
964 |
+
}else{
|
965 |
+
manual.show();
|
966 |
+
autotype_wrap.hide();
|
967 |
+
}
|
968 |
+
|
969 |
+
autotype_wrap.find('.caldera-config-group-auto-' + autotype.val()).show();
|
970 |
+
|
971 |
+
});
|
972 |
+
|
973 |
+
$('body').on('change', '.pin-toggle-roles', function(){
|
974 |
+
|
975 |
+
var clicked = $(this),
|
976 |
+
roles = $('#caldera-pin-rules');
|
977 |
+
|
978 |
+
if( clicked.val() === '1' ){
|
979 |
+
roles.show();
|
980 |
+
}else{
|
981 |
+
roles.hide();
|
982 |
+
}
|
983 |
+
|
984 |
+
});
|
985 |
+
|
986 |
+
$('body').on('click', '.magic-tag-init', function(e){
|
987 |
+
var clicked = $(this),
|
988 |
+
input = clicked.prev();
|
989 |
+
|
990 |
+
input.focus().trigger('init.magic');
|
991 |
+
|
992 |
+
});
|
993 |
+
// show magic tag autocompletes
|
994 |
+
$('body').on('keyup focus select click init.magic', '.magic-tag-enabled', function(e){
|
995 |
+
|
996 |
+
init_magic_tags();
|
997 |
+
var input = $(this),
|
998 |
+
wrap = input.parent(),
|
999 |
+
fieldtype = ( wrap.closest('.wrapper-instance-pane').find('.caldera-select-field-type').val() ? wrap.closest('.wrapper-instance-pane').find('.caldera-select-field-type').val() : 'hidden' ),
|
1000 |
+
tags = wrap.find('.magic-tags-autocomplete'),
|
1001 |
+
list = tags.find('ul'),
|
1002 |
+
stream = this.value,
|
1003 |
+
tag = [],
|
1004 |
+
type_instances = [],
|
1005 |
+
current_tag = '',
|
1006 |
+
start = this.selectionStart,
|
1007 |
+
end = this.selectionEnd;
|
1008 |
+
|
1009 |
+
if( tags.length && tags.data('focus') ){
|
1010 |
+
e.preventDefault();
|
1011 |
+
return;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
//reset typed tag
|
1015 |
+
input.data('tag','');
|
1016 |
+
if(this.selectionEnd > this.selectionStart){
|
1017 |
+
current_tag = this.value.substr(this.selectionStart, ( this.selectionEnd - this.selectionStart) );
|
1018 |
+
}else{
|
1019 |
+
|
1020 |
+
if( ( e.type === 'select' || e.type === 'keyup' ) && ( e.which !== 40 && e.which !== 38 && e.which !== 39 && e.which !== 37 ) ){
|
1021 |
+
|
1022 |
+
for( start=this.selectionStart; start > 0; start--){
|
1023 |
+
|
1024 |
+
var ch = stream.substr(start-1,1);
|
1025 |
+
|
1026 |
+
if(ch === ' ' || ch === "\n" || ( ( ch === '%' || ch === '}' ) && this.selectionStart === start ) ){
|
1027 |
+
break;
|
1028 |
+
}
|
1029 |
+
}
|
1030 |
+
for( end=this.selectionStart; end < stream.length; end++){
|
1031 |
+
|
1032 |
+
var ch = stream.substr(end,1);
|
1033 |
+
|
1034 |
+
if(ch === ' ' || ch === "\n" || ( ( ch === '%' || ch === '{' ) && this.selectionStart === end ) ){
|
1035 |
+
break;
|
1036 |
+
}
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
current_tag = stream.substr(start, ( end - start ) );
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
// start matching
|
1045 |
+
if( e.type !== 'focusout' ){
|
1046 |
+
|
1047 |
+
if( e.type !== 'init' && current_tag.length < 3 ){
|
1048 |
+
if(tags.length){
|
1049 |
+
tags.remove();
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
}
|
1053 |
+
if(!tags.length){
|
1054 |
+
tags = $('<div class="magic-tags-autocomplete"></div>');
|
1055 |
+
list = $('<ul></ul>');
|
1056 |
+
list.appendTo(tags);
|
1057 |
+
tags.insertAfter(input);
|
1058 |
+
tags.on('mouseenter', function(){
|
1059 |
+
$(this).data('focus', true);
|
1060 |
+
});
|
1061 |
+
tags.on('mouseleave', function(){
|
1062 |
+
$(this).data('focus', false);
|
1063 |
+
|
1064 |
+
setTimeout(function(){
|
1065 |
+
tags.remove();
|
1066 |
+
}, 200);
|
1067 |
+
if( !input.is(':focus') ){
|
1068 |
+
input.trigger('focusout');
|
1069 |
+
}
|
1070 |
+
});
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
//populate
|
1074 |
+
list.empty();
|
1075 |
+
// compatibility
|
1076 |
+
var tagtypes = 'system';
|
1077 |
+
var is_static = false;
|
1078 |
+
if(fieldtype === 'hidden' || fieldtype === 'dropdown' || fieldtype === 'radio' || fieldtype === 'toggle_switch' || fieldtype === 'checkbox'){
|
1079 |
+
is_static = true;
|
1080 |
+
fieldtype = 'text';
|
1081 |
+
tagtypes = 'all';
|
1082 |
+
}else if(fieldtype === 'paragraph' || fieldtype === 'html'){
|
1083 |
+
fieldtype = 'text';
|
1084 |
+
}
|
1085 |
+
// type set
|
1086 |
+
if(input.data('type')){
|
1087 |
+
fieldtype = input.data('type');
|
1088 |
+
}
|
1089 |
+
// search em!
|
1090 |
+
fieldtype = fieldtype.split(',');
|
1091 |
+
fieldtype.push('vars');
|
1092 |
+
for( var ft = 0; ft < fieldtype.length; ft++){
|
1093 |
+
for( var tp in system_values ){
|
1094 |
+
if(typeof system_values[tp].tags === 'undefined' || typeof system_values[tp].tags[fieldtype[ft]] === 'undefined'){
|
1095 |
+
continue;
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
type_instances = [tp];
|
1099 |
+
if(tp !== 'system' && tp !== 'variable' && tp !== 'field'){
|
1100 |
+
var type_instance_confs = jQuery(".processor-" + tp),
|
1101 |
+
wrapper = input.closest('.caldera-editor-processor-config-wrapper'),
|
1102 |
+
wrapper_id = wrapper.prop('id');
|
1103 |
+
type_instances = [];
|
1104 |
+
// processor based - orderd
|
1105 |
+
for(var c = 0; c<type_instance_confs.length; c++){
|
1106 |
+
if(!wrapper.length && is_static === true ){
|
1107 |
+
// static non processor - can be used
|
1108 |
+
type_instances.push(type_instance_confs[c].id);
|
1109 |
+
}else{
|
1110 |
+
if(wrapper_id === type_instance_confs[c].id){
|
1111 |
+
continue;
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
// check index order is valid
|
1115 |
+
if(jQuery('li.'+type_instance_confs[c].id).index() < jQuery('li.'+wrapper_id).index()){
|
1116 |
+
type_instances.push(type_instance_confs[c].id);
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
}
|
1123 |
+
// all instances of tag
|
1124 |
+
for( var instance = 0; instance < type_instances.length; instance++){
|
1125 |
+
if(tagtypes === 'all' || tagtypes === tp || tp === 'variable'){
|
1126 |
+
|
1127 |
+
var heading = $('<li class="header">' + system_values[tp].type + ( instance > 0 ? ' ['+(instance+1)+']' : '' ) +'</li>'),
|
1128 |
+
matches = 0;
|
1129 |
+
heading.appendTo(list);
|
1130 |
+
|
1131 |
+
for( var i = 0; i < system_values[tp].tags[fieldtype[ft]].length; i++){
|
1132 |
+
|
1133 |
+
if(input.data('parent')){
|
1134 |
+
if('variable:'+input.data('parent') === system_values[tp].tags[fieldtype[ft]][i]){
|
1135 |
+
continue;
|
1136 |
+
}
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
var this_tag = system_values[tp].wrap[0] + system_values[tp].tags[fieldtype[ft]][i]+system_values[tp].wrap[1];
|
1140 |
+
if(type_instances[instance] !== tp && type_instances.length > 1){
|
1141 |
+
this_tag = system_values[tp].wrap[0] + system_values[tp].tags[fieldtype[ft]][i]+':'+type_instances[instance]+system_values[tp].wrap[1];
|
1142 |
+
}
|
1143 |
+
if( this_tag.indexOf(current_tag) >= 0 || e.type === 'init'){
|
1144 |
+
|
1145 |
+
matches += 1;
|
1146 |
+
var view_tag = this_tag.replace(current_tag, '<strong>' + current_tag + '</strong>');
|
1147 |
+
|
1148 |
+
var linetag = $('<li class="tag" data-tag="'+this_tag+'">' + view_tag + '</li>');
|
1149 |
+
|
1150 |
+
|
1151 |
+
linetag.on('click', function(){
|
1152 |
+
|
1153 |
+
var selected = $(this).data('tag');
|
1154 |
+
|
1155 |
+
|
1156 |
+
input.val( stream.substr(0, start ) + selected + stream.substr( end ) ).trigger('change').focus();
|
1157 |
+
input[0].selectionStart = start + selected.length - ( selected.indexOf('*') > 0 ? 2 : 0 );
|
1158 |
+
input[0].selectionEnd = start + selected.length - ( selected.indexOf('*') > 0 ? 1 : 0 );
|
1159 |
+
end = start = input[0].selectionEnd;
|
1160 |
+
stream += selected;
|
1161 |
+
input.trigger('init.magic');
|
1162 |
+
});
|
1163 |
+
|
1164 |
+
linetag.appendTo(list);
|
1165 |
+
}
|
1166 |
+
}
|
1167 |
+
if(matches === 0){
|
1168 |
+
heading.remove();
|
1169 |
+
}
|
1170 |
+
}
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
}
|
1174 |
+
}
|
1175 |
+
// count results found
|
1176 |
+
if(!list.children().length){
|
1177 |
+
tags.remove();
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
// focus out - remove
|
1181 |
+
if(e.type === 'focusout'){
|
1182 |
+
|
1183 |
+
setTimeout(function(){
|
1184 |
+
tags.remove();
|
1185 |
+
}, 200);
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
});
|
1189 |
+
|
1190 |
+
// precompile tempaltes
|
1191 |
+
var pretemplates = $('.cf-editor-template');
|
1192 |
+
for( var t = 0; t < pretemplates.length; t++){
|
1193 |
+
compiled_templates[pretemplates[t].id] = Handlebars.compile( pretemplates[t].innerHTML );
|
1194 |
+
//compiled_templates
|
1195 |
+
}
|
1196 |
+
//compiled_templates
|
1197 |
+
|
1198 |
+
// build configs on load:
|
1199 |
+
// allows us to keep changes on reload as not to loose settings on accedental navigation
|
1200 |
+
$('.caldera-select-field-type').not('.field-initialized').each(function(k,v){
|
1201 |
+
build_fieldtype_config(v);
|
1202 |
+
});
|
1203 |
|
1204 |
});//
|
1205 |
|
1206 |
+
var rebuild_field_binding,
|
1207 |
+
rebind_field_bindings,
|
1208 |
+
current_form_fields = {},
|
1209 |
+
required_errors = {},
|
1210 |
+
add_new_grid_page,
|
1211 |
+
add_page_grid,
|
1212 |
+
init_magic_tags,
|
1213 |
+
core_form,
|
1214 |
+
compiled_templates = {};
|
1215 |
|
1216 |
init_magic_tags = function(){
|
1217 |
+
//init magic tags
|
1218 |
+
var magicfields = jQuery('.magic-tag-enabled');
|
1219 |
+
|
1220 |
+
magicfields.each(function(k,v){
|
1221 |
+
var input = jQuery(v);
|
1222 |
+
|
1223 |
+
if(input.hasClass('magic-tag-init-bound')){
|
1224 |
+
var currentwrapper = input.parent().find('.magic-tag-init');
|
1225 |
+
if(!input.is(':visible')){
|
1226 |
+
currentwrapper.hide();
|
1227 |
+
}else{
|
1228 |
+
currentwrapper.show();
|
1229 |
+
}
|
1230 |
+
return;
|
1231 |
+
}else{
|
1232 |
+
var magictag = jQuery('<span class=""></span>'),
|
1233 |
+
wrapper = jQuery('<span style="position:relative;display:inline-block; width:100%;"></span>');
|
1234 |
+
|
1235 |
+
if(input.is('input')){
|
1236 |
+
magictag.css('borderBottom', 'none');
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
if(input.hasClass('caldera-conditional-value-field')){
|
1240 |
+
wrapper.width('auto');
|
1241 |
+
}
|
1242 |
+
|
1243 |
+
input.wrap(wrapper);
|
1244 |
+
magictag.insertAfter(input);
|
1245 |
+
input.addClass('magic-tag-init-bound');
|
1246 |
+
if(!input.is(':visible')){
|
1247 |
+
magictag.hide();
|
1248 |
+
}else{
|
1249 |
+
magictag.show();
|
1250 |
+
}
|
1251 |
+
}
|
1252 |
+
});
|
1253 |
|
1254 |
}
|
1255 |
|
1256 |
rebuild_field_binding = function(){
|
1257 |
|
1258 |
+
// check form is loaded first
|
1259 |
+
if(!core_form){
|
1260 |
+
core_form = jQuery('.caldera-forms-options-form');
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
|
1264 |
+
if(!core_form.hasClass('builder-loaded')){
|
1265 |
+
return;
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
var fields = jQuery('.caldera-editor-field-config-wrapper');//.not('.bound_field');
|
1269 |
+
|
1270 |
+
// set object
|
1271 |
+
system_values.field = {
|
1272 |
+
tags : {
|
1273 |
+
text : []
|
1274 |
+
},
|
1275 |
+
type : "Fields",
|
1276 |
+
wrap : ['%','%']
|
1277 |
+
};
|
1278 |
+
|
1279 |
+
// each field
|
1280 |
+
for(var f = 0; f < fields.length; f++){
|
1281 |
+
var field_id = fields[f].id,
|
1282 |
+
label = jQuery('#' + field_id + '_lable').val(),
|
1283 |
+
slug = jQuery('#' + field_id + '_slug').val(),
|
1284 |
+
type = jQuery('#' + field_id + '_type').val();
|
1285 |
+
|
1286 |
+
|
1287 |
+
if(typeof system_values.field.tags[type] === 'undefined'){
|
1288 |
+
system_values.field.tags[type] = [];
|
1289 |
+
}
|
1290 |
+
system_values.field.tags[type].push( slug );
|
1291 |
+
if(type !== 'text'){
|
1292 |
+
system_values.field.tags.text.push( slug );
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
current_form_fields[field_id] = {
|
1296 |
+
label: label,
|
1297 |
+
slug: slug,
|
1298 |
+
type: type
|
1299 |
+
};
|
1300 |
+
|
1301 |
+
// bind names
|
1302 |
+
jQuery('option.bound-field').trigger('change').each(function(k,v){
|
1303 |
+
var bind = jQuery(v);
|
1304 |
+
if(bind.prop('value').indexOf('{') !== 0){
|
1305 |
+
bind.text( jQuery('#' + bind.prop('value') + '_lable').val() + ' ['+jQuery('#' + bind.prop('value') + '_lable').val() +']');
|
1306 |
+
}else{
|
1307 |
+
bind.text(bind.prop('value').replace('{','').replace('}',''));
|
1308 |
+
}
|
1309 |
+
}).removeClass('bound-field');
|
1310 |
+
};
|
1311 |
|
1312 |
};
|
1313 |
|
1314 |
rebind_field_bindings = function(){
|
1315 |
|
1316 |
+
//return;
|
1317 |
+
var bindings = jQuery('.caldera-field-bind').not('.bound_field'),
|
1318 |
+
type_instances,
|
1319 |
+
processor_li;
|
1320 |
+
|
1321 |
+
|
1322 |
+
|
1323 |
+
if(!bindings.length){
|
1324 |
+
return;
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
bindings.addClass('bound_field');
|
1328 |
+
|
1329 |
+
|
1330 |
+
for(var v = 0; v < bindings.length; v++){
|
1331 |
+
|
1332 |
+
var field = jQuery(bindings[v]),
|
1333 |
+
current = field.val(),
|
1334 |
+
default_sel = field.data('default'),
|
1335 |
+
excludes = field.data('exclude'),
|
1336 |
+
count = 0,
|
1337 |
+
wrapper = field.closest('.caldera-editor-processor-config-wrapper'),
|
1338 |
+
wrapper_id = wrapper.prop('id'),
|
1339 |
+
valid = '';
|
1340 |
+
|
1341 |
+
if(default_sel && !field.hasClass('reload-binding')){
|
1342 |
+
current = default_sel;
|
1343 |
+
}
|
1344 |
+
|
1345 |
+
if(field.is('select')){
|
1346 |
+
field.empty();
|
1347 |
+
|
1348 |
+
var optgroup = jQuery('<optgroup label="Fields">');
|
1349 |
+
for(var fid in current_form_fields){
|
1350 |
+
if(field.data('type')){
|
1351 |
+
if(field.data('type').split(',').indexOf(current_form_fields[fid].type) < 0){
|
1352 |
+
continue;
|
1353 |
+
}
|
1354 |
+
|
1355 |
+
}
|
1356 |
+
// check this field is not the same
|
1357 |
+
if( field.data('id') !== fid ){
|
1358 |
+
optgroup.append('<option value="' + fid + '"' + ( current === fid ? 'selected="selected"' : '' ) + '>' + current_form_fields[fid].label + ' [' + current_form_fields[fid].slug + ']</option>');
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
count += 1;
|
1362 |
+
}
|
1363 |
+
optgroup.appendTo(field);
|
1364 |
+
// system values
|
1365 |
+
if(count === 0){
|
1366 |
+
field.empty();
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
for(var type in system_values){
|
1370 |
+
type_instances = [];
|
1371 |
+
|
1372 |
+
if(excludes){
|
1373 |
+
if( excludes.split(',').indexOf(type) >= 0 ){
|
1374 |
+
continue;
|
1375 |
+
}
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
if(type !== 'system' && type !== 'variable'){
|
1379 |
+
|
1380 |
+
var type_instance_confs = jQuery(".processor-" + type);
|
1381 |
+
|
1382 |
+
for(var c = 0; c<type_instance_confs.length; c++){
|
1383 |
+
if(wrapper_id === type_instance_confs[c].id){
|
1384 |
+
continue;
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
type_instances.push(type_instance_confs[c].id);
|
1388 |
+
if(type_instance_confs.length > 1){
|
1389 |
+
if(processor_li = jQuery('li.'+type_instance_confs[c].id + ' .processor-line-number')){
|
1390 |
+
processor_li.html('[' + ( c + 1 ) + ']');
|
1391 |
+
}
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
}
|
1395 |
+
}else{
|
1396 |
+
type_instances.push('__system__');
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
var types = [];
|
1400 |
+
if(field.data('type')){
|
1401 |
+
types = field.data('type').split(',');
|
1402 |
+
types.push('vars');
|
1403 |
+
}else{
|
1404 |
+
types = ['text','vars'];
|
1405 |
+
}
|
1406 |
+
|
1407 |
+
for(var t = 0; t<types.length; t++){
|
1408 |
+
if( system_values[type].tags && system_values[type].tags[types[t]]){
|
1409 |
+
|
1410 |
+
for( var instance = 0; instance < type_instances.length; instance++){
|
1411 |
+
|
1412 |
+
// check index order is valid
|
1413 |
+
if(jQuery('li.'+type_instances[instance]).index() > jQuery('li.'+wrapper_id).index() && type_instances[instance] !== '__system__'){
|
1414 |
+
if( field.closest('.caldera-editor-processors-panel-wrap').length ){
|
1415 |
+
valid = ' disabled="disabled"';
|
1416 |
+
}
|
1417 |
+
}else{
|
1418 |
+
valid = '';
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
|
1422 |
+
var optgroup = jQuery('<optgroup label="' + system_values[type].type + ( type_instances[instance] !== '__system__' ? ' ' + ( jQuery('li.'+type_instances[instance]).find('.processor-line-number').html() ) : '' ) + '"' + valid + '>');
|
1423 |
+
|
1424 |
+
for( var i = 0; i < system_values[type].tags[types[t]].length; i++){
|
1425 |
+
|
1426 |
+
var bind_value = system_values[type].tags[types[t]][i];
|
1427 |
+
// update labels on multiple
|
1428 |
+
if(type_instances[instance] !== '__system__'){
|
1429 |
+
bind_value = bind_value.replace(type ,type_instances[instance]);
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
optgroup.append('<option value="\{' + bind_value + '\}"' + ( current === '{'+bind_value+'}' ? 'selected="selected"' : '' ) + valid + '>' + system_values[type].tags[types[t]][i] + '</option>');
|
1433 |
+
|
1434 |
+
count += 1;
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
if(optgroup.children().length){
|
1438 |
+
optgroup.appendTo(field);
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
}
|
1442 |
+
|
1443 |
+
}
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
}
|
1447 |
+
if(count === 0){
|
1448 |
+
field.empty();
|
1449 |
+
if(field.data('type')){
|
1450 |
+
field.append('<option value="">No ' + field.data('type').split(',').join(' or ') + ' in form</option>');
|
1451 |
+
var no_options = true;
|
1452 |
+
}
|
1453 |
+
}else{
|
1454 |
+
field.prop('disabled', false);
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
if(!field.hasClass('required') && typeof no_options === 'undefined'){
|
1458 |
+
field.prepend('<option value=""></option>');
|
1459 |
+
}
|
1460 |
+
field.val(current);
|
1461 |
+
}
|
1462 |
+
|
1463 |
+
};
|
1464 |
+
|
1465 |
+
init_magic_tags();
|
1466 |
+
jQuery(document).trigger('bound.fields');
|
1467 |
+
jQuery('.caldera-header-save-button').prop("disabled", false);
|
1468 |
};
|
1469 |
|
1470 |
function setup_field_type(obj){
|
1471 |
+
|
1472 |
+
return {'id' : obj.trigger.prop('id')};
|
1473 |
}
|
1474 |
|
1475 |
|
1476 |
|
1477 |
function check_required_bindings(el){
|
1478 |
|
1479 |
+
var fields,
|
1480 |
+
savebutton = jQuery('.caldera-header-save-button'),
|
1481 |
+
field_elements = jQuery('.layout-form-field'),
|
1482 |
+
nav_elements = jQuery('.caldera-processor-nav'),
|
1483 |
+
all_clear = true;
|
1484 |
+
|
1485 |
+
if(el){
|
1486 |
+
fields = jQuery(el);
|
1487 |
+
}else{
|
1488 |
+
fields = jQuery('.caldera-config-field .required');
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
fields.removeClass('has-error');
|
1492 |
+
field_elements.removeClass('has-error');
|
1493 |
+
nav_elements.removeClass('has-error');
|
1494 |
+
|
1495 |
+
jQuery('.error-tag').remove();
|
1496 |
+
//reset list
|
1497 |
+
required_errors = {};
|
1498 |
+
|
1499 |
+
fields.each(function(k,v){
|
1500 |
+
var field = jQuery(v),
|
1501 |
+
panel = field.closest('.caldera-config-editor-panel');
|
1502 |
+
|
1503 |
+
if(!v.value.length){
|
1504 |
+
if(!required_errors[panel.prop('id')]){
|
1505 |
+
required_errors[panel.prop('id')] = 0;
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
var is_field = field.closest('.caldera-editor-field-config-wrapper'),
|
1509 |
+
is_process = field.closest('.caldera-editor-processor-config-wrapper');
|
1510 |
+
|
1511 |
+
if(is_field.length){
|
1512 |
+
jQuery('.layout-form-field[data-config="'+is_field.prop('id')+'"]').addClass('has-error');
|
1513 |
+
}
|
1514 |
+
if(is_process.length){
|
1515 |
+
jQuery('.'+is_process.prop('id')).addClass('has-error');
|
1516 |
+
}
|
1517 |
+
required_errors[panel.prop('id')] += 1;
|
1518 |
+
field.addClass('has-error');
|
1519 |
+
|
1520 |
+
all_clear = false;
|
1521 |
+
|
1522 |
+
}else{
|
1523 |
+
//unique
|
1524 |
+
if( field.hasClass('field-slug') ){
|
1525 |
+
var slugs = jQuery('.field-slug').not(field);
|
1526 |
+
|
1527 |
+
for(var s = 0; s < slugs.length; s++){
|
1528 |
+
if( slugs[s].value === v.value ){
|
1529 |
+
var field = jQuery(slugs[s]);
|
1530 |
+
|
1531 |
+
if(!required_errors[panel.prop('id')]){
|
1532 |
+
required_errors[panel.prop('id')] = 0;
|
1533 |
+
}
|
1534 |
+
var is_field = field.closest('.caldera-editor-field-config-wrapper'),
|
1535 |
+
is_process = field.closest('.caldera-editor-processor-config-wrapper');
|
1536 |
+
|
1537 |
+
if(is_field.length){
|
1538 |
+
jQuery('.layout-form-field[data-config="'+is_field.prop('id')+'"]').addClass('has-error');
|
1539 |
+
}
|
1540 |
+
if(is_process.length){
|
1541 |
+
jQuery('.'+is_process.prop('id')).addClass('has-error');
|
1542 |
+
}
|
1543 |
+
required_errors[panel.prop('id')] += 1;
|
1544 |
+
field.addClass('has-error');
|
1545 |
+
all_clear = false;
|
1546 |
+
break;
|
1547 |
+
}
|
1548 |
+
};
|
1549 |
+
}
|
1550 |
+
if( field.hasClass('toggle_value_field') ){
|
1551 |
+
var vals = field.closest('.caldera-config-group').find('.toggle_value_field').not(field);
|
1552 |
+
|
1553 |
+
for(var s = 0; s < vals.length; s++){
|
1554 |
+
if( vals[s].value === v.value ){
|
1555 |
+
var field = jQuery(vals[s]);
|
1556 |
+
|
1557 |
+
if(!required_errors[panel.prop('id')]){
|
1558 |
+
required_errors[panel.prop('id')] = 0;
|
1559 |
+
}
|
1560 |
+
var is_field = field.closest('.caldera-editor-field-config-wrapper'),
|
1561 |
+
is_process = field.closest('.caldera-editor-processor-config-wrapper');
|
1562 |
+
|
1563 |
+
if(is_field.length){
|
1564 |
+
jQuery('.layout-form-field[data-config="'+is_field.prop('id')+'"]').addClass('has-error');
|
1565 |
+
}
|
1566 |
+
if(is_process.length){
|
1567 |
+
jQuery('.'+is_process.prop('id')).addClass('has-error');
|
1568 |
+
}
|
1569 |
+
required_errors[panel.prop('id')] += 1;
|
1570 |
+
field.addClass('has-error');
|
1571 |
+
all_clear = false;
|
1572 |
+
break;
|
1573 |
+
}
|
1574 |
+
};
|
1575 |
+
}
|
1576 |
+
}
|
1577 |
+
});
|
1578 |
+
|
1579 |
+
for(var t in required_errors){
|
1580 |
+
jQuery('.caldera-forms-options-form').find('a[href="#' + t + '"]').append('<span class="error-tag">' + required_errors[t] + '</span>');
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
jQuery('.caldera-conditional-field-set').trigger('change');
|
1584 |
+
|
1585 |
+
return all_clear;
|
1586 |
}
|
1587 |
|
1588 |
jQuery(document).ready(function($) {
|
1589 |
|
1590 |
+
add_new_grid_page = function(obj){
|
1591 |
+
return { "page_no" : "pg_" + Math.round( Math.random() * 10000000 ) };
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
add_page_grid = function(obj){
|
1595 |
+
var btn_count = $('.page-toggle').length + 1,
|
1596 |
+
button = $('<button type="button" data-name="Page ' + btn_count + '" data-page="' + obj.rawData.page_no + '" class="page-toggle button">' + obj.params.trigger.data('addtitle') + ' ' + btn_count + '</button> '),
|
1597 |
+
option_tab = $('#page-toggles');
|
1598 |
+
button.appendTo( option_tab );
|
1599 |
+
option_tab.show();
|
1600 |
+
buildSortables();
|
1601 |
+
button.trigger('click');
|
1602 |
+
if( btn_count === 1){
|
1603 |
+
option_tab.hide();
|
1604 |
+
}
|
1605 |
+
$(document).trigger('add.page');
|
1606 |
+
}
|
1607 |
|
1608 |
// bind pages tab
|
1609 |
+
$(document).on('remove.page add.page load.page', function(e){
|
1610 |
+
var btn_count = $('.page-toggle').length,
|
1611 |
+
pages_tab = $('#tab_pages');
|
1612 |
+
|
1613 |
+
if(btn_count <= 1){
|
1614 |
+
pages_tab.hide();
|
1615 |
+
}else{
|
1616 |
+
pages_tab.show();
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
|
1620 |
+
});
|
1621 |
+
|
1622 |
+
function buildLayoutString(){
|
1623 |
+
var grid_panels = $('.layout-grid-panel'),
|
1624 |
+
row_index = 0;
|
1625 |
+
|
1626 |
+
grid_panels.each(function(pk,pv){
|
1627 |
+
|
1628 |
+
var panel= $(pv),
|
1629 |
+
capt = panel.find('.layout-structure'),
|
1630 |
+
rows = panel.find('.row'),
|
1631 |
+
struct = [];
|
1632 |
+
|
1633 |
+
rows.each(function(k,v){
|
1634 |
+
var row = $(v),
|
1635 |
+
cols = row.children().not('.column-merge'),
|
1636 |
+
rowcols = [];
|
1637 |
+
row_index += 1;
|
1638 |
+
cols.each(function(p, c){
|
1639 |
+
span = $(c).attr('class').split('-');
|
1640 |
+
rowcols.push(span[2]);
|
1641 |
+
var fields = $(c).find('.field-location');
|
1642 |
+
if(fields.length){
|
1643 |
+
fields.each(function(x,f){
|
1644 |
+
var field = $(f);
|
1645 |
+
field.val( row_index + ':' + (p+1) ).removeAttr('disabled');
|
1646 |
+
});
|
1647 |
+
}
|
1648 |
+
// set name
|
1649 |
+
|
1650 |
+
});
|
1651 |
+
struct.push(rowcols.join(':'));
|
1652 |
+
});
|
1653 |
+
capt.val(struct.join('|'));
|
1654 |
+
});
|
1655 |
+
}
|
1656 |
+
|
1657 |
+
function insert_new_field(newfield, target, field_default){
|
1658 |
+
var name = "fld_" + Math.round( Math.random() * 10000000 ),
|
1659 |
+
new_name = name,
|
1660 |
+
field_conf = $('#field_config_panels'),
|
1661 |
+
new_conf_templ,
|
1662 |
+
field_set;
|
1663 |
+
|
1664 |
+
newfield.prop('id', '').prop('title', '');
|
1665 |
+
|
1666 |
+
// field conf template
|
1667 |
+
new_conf_templ = Handlebars.compile( $('#caldera_field_config_wrapper_templ').html() );
|
1668 |
+
|
1669 |
+
field_set = $.extend({},{
|
1670 |
+
"id" : new_name,
|
1671 |
+
"label" : '',
|
1672 |
+
"slug" : ''
|
1673 |
+
}, field_default );
|
1674 |
+
// reset slug to blank
|
1675 |
+
field_set.slug = '';
|
1676 |
+
// pance new conf template
|
1677 |
+
field_conf.append( new_conf_templ( field_set ) );
|
1678 |
+
|
1679 |
+
newfield.
|
1680 |
+
removeClass('button-small').
|
1681 |
+
removeClass('button').
|
1682 |
+
removeClass('button-primary').
|
1683 |
+
removeClass('ui-draggable').
|
1684 |
+
removeClass('layout-new-form-field').
|
1685 |
+
addClass('layout-form-field').
|
1686 |
+
attr('data-config', name).css({ 'display' : '', 'opacity' : '' });
|
1687 |
+
|
1688 |
+
newfield.find('.layout_field_name').remove();
|
1689 |
+
newfield.find('.field-location').prop('name', 'config[layout_grid][fields][' + name + ']');
|
1690 |
+
newfield.find('.settings-panel').show();
|
1691 |
+
newfield.appendTo( target );
|
1692 |
+
buildSortables();
|
1693 |
+
newfield.find('.icon-edit').trigger('click');
|
1694 |
+
|
1695 |
+
|
1696 |
+
$('#' + name + '_lable').focus().select();
|
1697 |
+
baldrickTriggers();
|
1698 |
+
$(document).trigger('field.added');
|
1699 |
+
if( field_default ){
|
1700 |
+
$('#' + new_name + '_type' ).data('type', field_set.type ).trigger('change');
|
1701 |
+
}else{
|
1702 |
+
$('#' + name).trigger('field.drop');
|
1703 |
+
}
|
1704 |
+
rebuild_field_binding();
|
1705 |
+
|
1706 |
+
}
|
1707 |
+
|
1708 |
+
function buildSortables(){
|
1709 |
+
|
1710 |
+
// Sortables
|
1711 |
+
$('.toggle-options').sortable({
|
1712 |
+
handle: ".dashicons-sort",
|
1713 |
+
});
|
1714 |
+
|
1715 |
+
|
1716 |
+
$( "#grid-pages-panel" ).sortable({
|
1717 |
+
placeholder: "row-drop-helper",
|
1718 |
+
handle: ".sort-handle",
|
1719 |
+
items: ".first-row-level",
|
1720 |
+
axis: "y",
|
1721 |
+
stop: function(){
|
1722 |
+
buildLayoutString();
|
1723 |
+
}
|
1724 |
+
});
|
1725 |
+
$( ".layout-column" ).sortable({
|
1726 |
+
connectWith: ".layout-column",
|
1727 |
+
appendTo: "#grid-pages-panel",
|
1728 |
+
helper: "clone",
|
1729 |
+
items: ".layout-form-field",
|
1730 |
+
handle: ".drag-handle",
|
1731 |
+
cursor: "move",
|
1732 |
+
opacity: 0.7,
|
1733 |
+
cursorAt: {left: 100, top: 15},
|
1734 |
+
start: function(e,ui){
|
1735 |
+
ui.helper.css({width: '200px', height: '35px', paddingTop: '20px'});
|
1736 |
+
},
|
1737 |
+
stop: function(e,ui){
|
1738 |
+
ui.item.removeAttr('style');
|
1739 |
+
buildLayoutString();
|
1740 |
+
}
|
1741 |
+
});
|
1742 |
+
|
1743 |
+
// Draggables
|
1744 |
+
$( "h3 .layout-new-form-field" ).draggable({
|
1745 |
+
helper: "clone",
|
1746 |
+
appendTo: "body"
|
1747 |
+
});
|
1748 |
+
$('.page-toggle.button').droppable({
|
1749 |
+
accept: ".layout-form-field",
|
1750 |
+
over: function(e, ui){
|
1751 |
+
$(this).trigger('click');
|
1752 |
+
$( ".layout-column" ).sortable("refresh");
|
1753 |
+
}
|
1754 |
+
});
|
1755 |
+
// Tools Bar Items
|
1756 |
+
$( ".layout-column" ).droppable({
|
1757 |
+
greedy: true,
|
1758 |
+
activeClass: "ui-state-dropper",
|
1759 |
+
hoverClass: "ui-state-hoverable",
|
1760 |
+
accept: ".layout-new-form-field",
|
1761 |
+
drop: function( event, ui ) {
|
1762 |
+
var newfield= ui.draggable.clone(),
|
1763 |
+
target = $(this);
|
1764 |
+
|
1765 |
+
insert_new_field(newfield, target);
|
1766 |
+
}
|
1767 |
+
});
|
1768 |
+
|
1769 |
+
|
1770 |
+
buildLayoutString();
|
1771 |
+
};
|
1772 |
+
buildSortables();
|
1773 |
+
|
1774 |
+
$('#grid-pages-panel').on('click','.column-fieldinsert .dashicons-plus-alt', function(e){
|
1775 |
+
//newfield-tool
|
1776 |
+
var target = $(this).closest('.column-container'),
|
1777 |
+
newfield = $('#newfield-tool').clone().css('display', '');
|
1778 |
+
|
1779 |
+
insert_new_field(newfield, target);
|
1780 |
+
|
1781 |
+
});
|
1782 |
+
|
1783 |
+
$('#grid-pages-panel').on('click','.column-split', function(e){
|
1784 |
+
var column = $(this).parent().parent(),
|
1785 |
+
size = column.attr('class').split('-'),
|
1786 |
+
newcol = $('<div>').insertAfter(column);
|
1787 |
+
|
1788 |
+
var left = Math.ceil(size[2]/2),
|
1789 |
+
right = Math.floor(size[2]/2);
|
1790 |
+
|
1791 |
+
|
1792 |
+
size[2] = left;
|
1793 |
+
column.attr('class', size.join('-'));
|
1794 |
+
size[2] = right;
|
1795 |
+
newcol.addClass(size.join('-')).append('<div class="layout-column column-container">');
|
1796 |
+
$(this).remove();
|
1797 |
+
buildSortables();
|
1798 |
+
|
1799 |
+
jQuery('.column-tools').remove();
|
1800 |
+
jQuery('.column-merge').remove();
|
1801 |
+
|
1802 |
+
});
|
1803 |
+
$( "#grid-pages-panel" ).on('click', '.column-remove', function(e){
|
1804 |
+
var row = $(this).closest('.row'),
|
1805 |
+
fields = row.find('.layout-form-field'),
|
1806 |
+
wrap = row.closest('.layout-grid-panel');
|
1807 |
+
|
1808 |
+
//find fields
|
1809 |
+
if(fields.length){
|
1810 |
+
if(!confirm($('#row-remove-fields-message').text())){
|
1811 |
+
return;
|
1812 |
+
}
|
1813 |
+
fields.each(function(k,v){
|
1814 |
+
var field_id = $(v).data('config');
|
1815 |
+
$('#' + field_id ).remove();
|
1816 |
+
// remove options
|
1817 |
+
$('option[value="' + field_id + '"]').remove();
|
1818 |
+
$('[data-bind="' + field_id + '"]').remove();
|
1819 |
+
|
1820 |
+
// remove field
|
1821 |
+
delete current_form_fields[field_id];
|
1822 |
+
|
1823 |
+
});
|
1824 |
+
}
|
1825 |
+
//return;
|
1826 |
+
|
1827 |
+
row.slideUp(200, function(){
|
1828 |
+
$(this).remove();
|
1829 |
+
buildLayoutString();
|
1830 |
+
rebuild_field_binding();
|
1831 |
+
if(!wrap.find('.row').length){
|
1832 |
+
wrap.remove();
|
1833 |
+
var btn = $('#page-toggles .button-primary'),
|
1834 |
+
prev = btn.prev(),
|
1835 |
+
next = btn.next();
|
1836 |
+
|
1837 |
+
btn.remove();
|
1838 |
+
if(prev.length){
|
1839 |
+
prev.trigger('click');
|
1840 |
+
}else{
|
1841 |
+
next.trigger('click');
|
1842 |
+
}
|
1843 |
+
}
|
1844 |
+
$(document).trigger('remove.page');
|
1845 |
+
});
|
1846 |
+
|
1847 |
+
jQuery('.column-tools').remove();
|
1848 |
+
jQuery('.column-merge').remove();
|
1849 |
+
|
1850 |
+
});
|
1851 |
+
|
1852 |
+
$( ".caldera-config-editor-main-panel" ).on('click', '.caldera-add-row', function(e){
|
1853 |
+
e.preventDefault();
|
1854 |
+
var wrap = $('.page-active');
|
1855 |
+
if(!wrap.length){
|
1856 |
+
$('.caldera-add-page').trigger('click');
|
1857 |
+
return;
|
1858 |
+
}
|
1859 |
+
var new_row = $( '<div style="display:none;" class="first-row-level row"><div class="col-xs-12"><div class="layout-column column-container"></div></div></div>' );
|
1860 |
+
|
1861 |
+
$('.page-active').append( new_row );
|
1862 |
+
new_row.slideDown( 200 );
|
1863 |
+
buildSortables();
|
1864 |
+
buildLayoutString();
|
1865 |
+
});
|
1866 |
+
|
1867 |
+
$( "#grid-pages-panel" ).on('click', '.column-join', function(e){
|
1868 |
+
|
1869 |
+
var column = $(this).parent().parent().parent();
|
1870 |
+
|
1871 |
+
var prev = column.prev(),
|
1872 |
+
left = prev.attr('class').split('-'),
|
1873 |
+
right = column.attr('class').split('-');
|
1874 |
+
left[2] = parseFloat(left[2])+parseFloat(right[2]);
|
1875 |
+
|
1876 |
+
|
1877 |
+
column.find('.layout-column').contents().appendTo(prev.find('.layout-column'));
|
1878 |
+
prev.attr('class', left.join('-'));
|
1879 |
+
column.remove();
|
1880 |
+
buildLayoutString();
|
1881 |
+
jQuery('.column-tools').remove();
|
1882 |
+
jQuery('.column-merge').remove();
|
1883 |
+
});
|
1884 |
+
|
1885 |
+
$('#grid-pages-panel').on('mouseenter','.row', function(e){
|
1886 |
+
var setrow = jQuery(this);
|
1887 |
+
jQuery('.column-tools,.column-merge').remove();
|
1888 |
+
setrow.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>');
|
1889 |
+
setrow.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>');
|
1890 |
+
|
1891 |
+
setrow.children().children().not(':first').prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');
|
1892 |
+
var single = setrow.parent().parent().parent().width()/12-1;
|
1893 |
+
setrow.children().children().each(function(k,v){
|
1894 |
+
var column = $(v)
|
1895 |
+
var width = column.width()/2-5;
|
1896 |
+
column.prepend('<div class="column-fieldinsert column-tools"><i class="dashicons dashicons-plus-alt"></i></div>');
|
1897 |
+
if(!column.parent().hasClass('col-xs-1')){
|
1898 |
+
column.prepend('<div class="column-split column-tools"><i class="dashicons dashicons-leftright"></i></div>');
|
1899 |
+
column.find('.column-split').css('left', width);
|
1900 |
+
}
|
1901 |
+
});
|
1902 |
+
|
1903 |
+
jQuery( ".column-merge" ).draggable({
|
1904 |
+
axis: "x",
|
1905 |
+
helper: "clone",
|
1906 |
+
appendTo: setrow,
|
1907 |
+
grid: [single, 0],
|
1908 |
+
drag: function(e, ui){
|
1909 |
+
$(this).addClass('dragging');
|
1910 |
+
$('.column-tools').remove();
|
1911 |
+
$('.column-split').remove();
|
1912 |
+
var column = $(this).parent().parent(),
|
1913 |
+
dragged = ui.helper,
|
1914 |
+
direction = (ui.originalPosition.left > dragged.position().left) ? 'left' : 'right',
|
1915 |
+
step = 0,
|
1916 |
+
prev = column.prev(),
|
1917 |
+
single = Math.round(column.parent().width()/12-10),
|
1918 |
+
distance = Math.abs(ui.originalPosition.left - dragged.position().left);
|
1919 |
+
|
1920 |
+
column.parent().addClass('sizing');
|
1921 |
+
|
1922 |
+
if(distance >= single){
|
1923 |
+
var left = prev.attr('class').split('-'),
|
1924 |
+
right = column.attr('class').split('-');
|
1925 |
+
|
1926 |
+
left[2] = parseFloat(left[2]);
|
1927 |
+
right[2] = parseFloat(right[2]);
|
1928 |
+
|
1929 |
+
if(direction === 'left'){
|
1930 |
+
left[2]--;
|
1931 |
+
right[2]++;
|
1932 |
+
if(left[2] > 0 && left[2] < (left[2]+right[2]) ){
|
1933 |
+
prev.attr('class', left.join('-'));
|
1934 |
+
column.attr('class', right.join('-'));
|
1935 |
+
ui.originalPosition.left = dragged.position().left;
|
1936 |
+
}else{
|
1937 |
+
$(this).draggable( "option", "disabled", true );
|
1938 |
+
}
|
1939 |
+
}else{
|
1940 |
+
left[2]++;
|
1941 |
+
right[2]--;
|
1942 |
+
if(right[2] > 0 && right[2] < (right[2]+right[2]) ){
|
1943 |
+
prev.attr('class', left.join('-'));
|
1944 |
+
column.attr('class', right.join('-'));
|
1945 |
+
ui.originalPosition.left = dragged.position().left;
|
1946 |
+
}else{
|
1947 |
+
$(this).draggable( "option", "disabled", true );
|
1948 |
+
}
|
1949 |
+
|
1950 |
+
}
|
1951 |
+
buildLayoutString();
|
1952 |
+
}
|
1953 |
+
|
1954 |
+
|
1955 |
+
},
|
1956 |
+
stop: function(){
|
1957 |
+
$(this).removeClass('dragging').parent().parent().parent().removeClass('sizing');
|
1958 |
+
}
|
1959 |
+
});
|
1960 |
+
});
|
1961 |
+
$('#grid-pages-panel').on('mouseleave','.row', function(e){
|
1962 |
+
jQuery('.column-tools').remove();
|
1963 |
+
jQuery('.column-merge').remove();
|
1964 |
+
});
|
1965 |
+
|
1966 |
+
$('#grid-pages-panel').on('click', '.layout-form-field .icon-remove', function(){
|
1967 |
+
var clicked = $(this),
|
1968 |
+
panel = clicked.parent(),
|
1969 |
+
config = $('#' + panel.data('config'));
|
1970 |
+
|
1971 |
+
panel.slideUp(100, function(){
|
1972 |
+
$(this).remove();
|
1973 |
+
});
|
1974 |
+
config.slideUp(100, function(){
|
1975 |
+
$(this).remove();
|
1976 |
+
});
|
1977 |
+
});
|
1978 |
+
$( document ).on('click', '.layout-form-field .dashicons-admin-page', function(){
|
1979 |
+
var clicked = $( this ),
|
1980 |
+
wrap = clicked.parent(),
|
1981 |
+
clone_id = wrap.data('config'),
|
1982 |
+
clone = $('#' + clone_id ).formJSON(),
|
1983 |
+
target = clicked.closest('.column-container'),
|
1984 |
+
newfield = wrap.clone().css('display', ''),
|
1985 |
+
new_params = {};
|
1986 |
+
|
1987 |
+
if( wrap.hasClass('field-edit-open') ){
|
1988 |
+
wrap.removeClass('field-edit-open');
|
1989 |
+
newfield.removeClass('field-edit-open');
|
1990 |
+
$('.caldera-editor-field-config-wrapper').hide();
|
1991 |
+
}
|
1992 |
+
|
1993 |
+
if( clone.config.fields[ clone_id ] ){
|
1994 |
+
new_params = clone.config.fields[ clone_id ];
|
1995 |
+
delete new_params.ID;
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
insert_new_field(newfield, target, new_params);
|
1999 |
+
})
|
2000 |
+
$( document ).on('click', '.layout-form-field .icon-edit', function(){
|
2001 |
+
var clicked = $(this),
|
2002 |
+
panel = clicked.parent(),
|
2003 |
+
type = $('#' + panel.data('config') +'_type').val();
|
2004 |
+
|
2005 |
+
$('.caldera-editor-field-config-wrapper').hide();
|
2006 |
+
|
2007 |
+
if(panel.hasClass('field-edit-open')){
|
2008 |
+
panel.removeClass('field-edit-open');
|
2009 |
+
}else{
|
2010 |
+
$('.layout-form-field').removeClass('field-edit-open');
|
2011 |
+
panel.addClass('field-edit-open');
|
2012 |
+
$('#' + panel.data('config')).show();
|
2013 |
+
}
|
2014 |
+
|
2015 |
+
$(document).trigger('show.' + panel.data('config'));
|
2016 |
+
$(document).trigger('show.fieldedit');
|
2017 |
+
|
2018 |
+
if( type === 'radio' || type === 'checkbox' || type === 'dropdown' || type === 'toggle_switch' ){
|
2019 |
+
$('#' + panel.data('config') + '_auto').trigger('change');
|
2020 |
+
}
|
2021 |
+
});
|
2022 |
+
$('body').on('click', '.layout-modal-edit-closer,.layout-modal-save-action', function(e){
|
2023 |
+
|
2024 |
+
e.preventDefault();
|
2025 |
+
|
2026 |
+
var clicked = $(this),
|
2027 |
+
panel = $('.layout-form-field.edit-open'),
|
2028 |
+
modal = clicked.closest('.layout-modal-container');
|
2029 |
+
settings = modal.find('.settings-panel').first();
|
2030 |
+
|
2031 |
+
$('.edit-open').removeClass('edit-open');
|
2032 |
+
settings.appendTo(panel.find('.settings-wrapper')).hide();
|
2033 |
+
|
2034 |
+
modal.hide();
|
2035 |
+
|
2036 |
+
});
|
2037 |
+
|
2038 |
+
// clear params
|
2039 |
+
$('.layout-editor-body').on('change', '.layout-core-pod-query', function(){
|
2040 |
+
$(this).parent().find('.settings-panel-row').remove();
|
2041 |
+
$('.edit-open').find('.drag-handle .set-pod').html(' - ' + $(this).val());
|
2042 |
+
});
|
2043 |
+
$('.layout-editor-body').on('click', '.remove-where', function(){
|
2044 |
+
$(this).closest('.settings-panel-row').remove();
|
2045 |
+
});
|
2046 |
+
// load pod fields
|
2047 |
+
$('.layout-editor-body').on('click', '.use-pod-container', function(){
|
2048 |
+
var clicked = $(this),
|
2049 |
+
podselect = clicked.prev(),
|
2050 |
+
pod = podselect.val(),
|
2051 |
+
container = '';
|
2052 |
+
|
2053 |
+
if(!pod.length){
|
2054 |
+
return;
|
2055 |
+
}
|
2056 |
+
|
2057 |
+
$('.edit-open').find('.drag-handle .set-pod').html(' - ' + podselect.val());
|
2058 |
+
|
2059 |
+
clicked.parent().parent().find('.spinner').css('display', 'inline-block');
|
2060 |
+
|
2061 |
+
var data = {
|
2062 |
+
'action' : 'pq_loadpod',
|
2063 |
+
'pod_reference' : {
|
2064 |
+
'pod' : pod
|
2065 |
+
}
|
2066 |
+
};
|
2067 |
+
|
2068 |
+
$.post(ajaxurl, data, function(res){
|
2069 |
+
|
2070 |
+
clicked.parent().find('.spinner').css('display', 'none');
|
2071 |
+
|
2072 |
+
var template = $('#where-line-tmpl').html(),
|
2073 |
+
fields = '',
|
2074 |
+
container = clicked.closest('.settings-panel').data('container');
|
2075 |
+
|
2076 |
+
|
2077 |
+
|
2078 |
+
for(var i in res){
|
2079 |
+
fields += '<option value="' + res[i] + '">' + res[i] + '</option>';
|
2080 |
+
}
|
2081 |
+
template = template.replace(/{{fields}}/g, fields).replace(/{{container_id}}/g, container);
|
2082 |
+
|
2083 |
+
clicked.parent().append( template );
|
2084 |
+
|
2085 |
+
});
|
2086 |
+
|
2087 |
+
});
|
2088 |
+
|
2089 |
+
// edit row
|
2090 |
+
$('.caldera-editor-header').on('click', '.column-sort .icon-edit', function(e){
|
2091 |
+
|
2092 |
+
});
|
2093 |
+
// bind tray stuff
|
2094 |
+
$('.layout-editor-body').on('tray_loaded', '.layout-template-tray', function(){
|
2095 |
+
buildSortables();
|
2096 |
+
});
|
2097 |
+
// build panel navigation
|
2098 |
+
$('.caldera-editor-header').on('click', '.caldera-editor-header-nav a', function(e){
|
2099 |
+
e.preventDefault();
|
2100 |
+
|
2101 |
+
var clicked = $(this);
|
2102 |
+
|
2103 |
+
// remove active tab
|
2104 |
+
$('.caldera-editor-header-nav li').removeClass('active');
|
2105 |
+
|
2106 |
+
// hide all tabs
|
2107 |
+
$('.caldera-editor-body').hide();
|
2108 |
+
|
2109 |
+
// show new tab
|
2110 |
+
$( clicked.attr('href') ).show();
|
2111 |
+
|
2112 |
+
// set active tab
|
2113 |
+
clicked.parent().addClass('active');
|
2114 |
+
rebind_field_bindings();
|
2115 |
+
});
|
2116 |
+
|
2117 |
+
$('body').on('change', '.required', function(){
|
2118 |
+
check_required_bindings(this);
|
2119 |
+
});
|
2120 |
+
|
2121 |
+
// prevent error forms from submiting
|
2122 |
+
$('body').on('submit', '.caldera-forms-options-form', function(e){
|
2123 |
+
var errors = $('.required.has-error');
|
2124 |
+
if(errors.length){
|
2125 |
+
e.preventDefault();
|
2126 |
+
}
|
2127 |
+
});
|
2128 |
+
|
2129 |
+
|
2130 |
+
//toggle_option_row
|
2131 |
+
$('.caldera-editor-body').on('click', '.add-toggle-option', function(e){
|
2132 |
+
|
2133 |
+
var clicked = $(this);
|
2134 |
+
|
2135 |
+
if(clicked.data('bulk')){
|
2136 |
+
$(clicked.data('bulk')).toggle();
|
2137 |
+
$(clicked.data('bulk')).find('textarea').focus();
|
2138 |
+
return;
|
2139 |
+
}
|
2140 |
+
|
2141 |
+
var wrapper = clicked.closest('.caldera-editor-field-config-wrapper'),
|
2142 |
+
toggle_rows = wrapper.find('.toggle-options'),
|
2143 |
+
row = $('#field-option-row-tmpl').html(),
|
2144 |
+
template = Handlebars.compile( row ),
|
2145 |
+
key = "opt" + parseInt( ( Math.random() + 1 ) * 0x100000 ),
|
2146 |
+
config = {
|
2147 |
+
_name : 'config[fields][' + wrapper.prop('id') + '][config]',
|
2148 |
+
option : {}
|
2149 |
+
};
|
2150 |
+
|
2151 |
+
if(clicked.data('options')){
|
2152 |
+
var batchinput = $(clicked.data('options')),
|
2153 |
+
batch = batchinput.val().split("\n"),
|
2154 |
+
has_vals = false;
|
2155 |
+
for( var i = 0; i < batch.length; i ++){
|
2156 |
+
var label = batch[i],
|
2157 |
+
val = label,
|
2158 |
+
parts = val.split('|');
|
2159 |
+
if( parts.length > 1 ){
|
2160 |
+
val = parts[0];
|
2161 |
+
label = parts[1];
|
2162 |
+
has_vals = true;
|
2163 |
+
}
|
2164 |
+
config.option["opt" + parseInt( ( Math.random() + i ) * 0x100000 )] = {
|
2165 |
+
value : val,
|
2166 |
+
label : label,
|
2167 |
+
default : false
|
2168 |
+
}
|
2169 |
+
}
|
2170 |
+
$(clicked.data('options')).parent().hide();
|
2171 |
+
batchinput.val('');
|
2172 |
+
if( true === has_vals ){
|
2173 |
+
wrapper.find('.toggle_show_values').prop( 'checked', true );
|
2174 |
+
}else{
|
2175 |
+
wrapper.find('.toggle_show_values').prop( 'checked', false );
|
2176 |
+
}
|
2177 |
+
toggle_rows.empty();
|
2178 |
+
}else{
|
2179 |
+
// add new option
|
2180 |
+
config.option[key] = {
|
2181 |
+
value : '',
|
2182 |
+
label : '',
|
2183 |
+
default : false
|
2184 |
+
};
|
2185 |
+
}
|
2186 |
+
$('.preset_options').val('');
|
2187 |
+
// place new row
|
2188 |
+
toggle_rows.append( template( config ) );
|
2189 |
+
wrapper.find('.toggle_show_values').trigger('change');
|
2190 |
+
|
2191 |
+
|
2192 |
+
$('.toggle-options').sortable({
|
2193 |
+
handle: ".dashicons-sort"
|
2194 |
+
});
|
2195 |
+
if(!batch){
|
2196 |
+
toggle_rows.find('.toggle_label_field').last().focus();
|
2197 |
+
}
|
2198 |
+
});
|
2199 |
+
// presets
|
2200 |
+
$('.caldera-editor-body').on('change', '.preset_options', function(e){
|
2201 |
+
var select = $( this ),
|
2202 |
+
preset = select.val(),
|
2203 |
+
batch = $( select.data('bulk') );
|
2204 |
+
|
2205 |
+
if( preset_options && preset_options[ preset ] && preset_options[ preset ].data ){
|
2206 |
+
if( typeof preset_options[ preset ].data === 'object' ){
|
2207 |
+
if( preset_options[ preset ].data.length ){
|
2208 |
+
preset_options[ preset ].data = preset_options[ preset ].data.join("\n");
|
2209 |
+
}else{
|
2210 |
+
|
2211 |
+
}
|
2212 |
+
}
|
2213 |
+
batch.val( preset_options[ preset ].data );
|
2214 |
+
}
|
2215 |
+
});
|
2216 |
+
// remove an option row
|
2217 |
+
$('.caldera-editor-body').on('click', '.toggle-remove-option', function(e){
|
2218 |
+
var triggerfield = $(this).closest('.caldera-editor-field-config-wrapper').find('.field-config').first();
|
2219 |
+
$(this).parent().remove();
|
2220 |
+
triggerfield.trigger('change');
|
2221 |
+
$(document).trigger('option.remove');
|
2222 |
+
});
|
2223 |
+
|
2224 |
+
$('.caldera-editor-body').on('click', '.page-toggle', function(e){
|
2225 |
+
var clicked = $(this),
|
2226 |
+
wrap = clicked.parent(),
|
2227 |
+
btns = wrap.find('.button');
|
2228 |
+
|
2229 |
+
btns.removeClass('button-primary');
|
2230 |
+
$('.layout-grid-panel').hide().removeClass('page-active');
|
2231 |
+
$('#' + clicked.data('page')).show().addClass('page-active');
|
2232 |
+
clicked.addClass('button-primary');
|
2233 |
+
//reindex
|
2234 |
+
btns.each(function(k,v){
|
2235 |
+
$(v).html(wrap.data('title') + ' ' + (k+1) );
|
2236 |
+
});
|
2237 |
+
if(btns.length === 1){
|
2238 |
+
wrap.hide();
|
2239 |
+
}
|
2240 |
+
|
2241 |
+
});
|
2242 |
+
|
2243 |
+
$('.caldera-editor-body').on('blur toggle.values', '.toggle_label_field', function(e){
|
2244 |
+
|
2245 |
+
var label = $(this),
|
2246 |
+
value = label.prev();
|
2247 |
+
|
2248 |
+
if(value.val().length){
|
2249 |
+
return;
|
2250 |
+
}
|
2251 |
+
|
2252 |
+
value.val(label.val());
|
2253 |
+
});
|
2254 |
+
|
2255 |
+
|
2256 |
+
$( document ).on('change focusout', '.toggle_value_field', function(){
|
2257 |
+
$( document ).trigger('show.fieldedit');
|
2258 |
+
});
|
2259 |
+
|
2260 |
+
$( document ).on('show.fieldedit option.remove', function(e){
|
2261 |
+
$('.toggle_value_field.has-error').removeClass('has-error');
|
2262 |
+
var field = $( '#' + $('.layout-form-field.field-edit-open').data('config') ),
|
2263 |
+
options = field.find('.toggle_value_field'),
|
2264 |
+
notice = field.find('.notice'),
|
2265 |
+
count = 0;
|
2266 |
+
|
2267 |
+
for( var i = 0; i < options.length; i++ ){
|
2268 |
+
var option = options[ i ].value,
|
2269 |
+
repeats = 0;
|
2270 |
+
for( var f = 0; f < options.length; f++ ){
|
2271 |
+
if( options[ i ] === options[ f ] ){ continue; }
|
2272 |
+
|
2273 |
+
if( options[ i ].value === options[ f ].value ){
|
2274 |
+
$( options[ f ] ).addClass('has-error');
|
2275 |
+
repeats++;
|
2276 |
+
}
|
2277 |
+
}
|
2278 |
+
if( repeats > 0 ){
|
2279 |
+
$( options[ i ] ).addClass('has-error');
|
2280 |
+
count++;
|
2281 |
+
}
|
2282 |
+
}
|
2283 |
+
|
2284 |
+
if( count > 0 ){
|
2285 |
+
notice.slideDown();
|
2286 |
+
e.preventDefault();
|
2287 |
+
}else{
|
2288 |
+
notice.slideUp();
|
2289 |
+
}
|
2290 |
+
|
2291 |
+
})
|
2292 |
+
var is_pulsating = false, pulsing_adders;
|
2293 |
+
|
2294 |
+
focus_initial_field = function(e){
|
2295 |
+
var field = $('.layout-grid-panel .icon-edit').first();
|
2296 |
+
if( field.length ){
|
2297 |
+
field.trigger('click');
|
2298 |
+
}else{
|
2299 |
+
$('.layout-column.column-container').first().trigger('mouseover');
|
2300 |
+
is_pulsating = setInterval( pulsate_adders, 500 );
|
2301 |
+
}
|
2302 |
+
$( document ).off('load.page', focus_initial_field );
|
2303 |
+
};
|
2304 |
+
$( document ).on('load.page', focus_initial_field );
|
2305 |
+
function pulsate_adders(){
|
2306 |
+
|
2307 |
+
if( is_pulsating ){
|
2308 |
+
var adders = $('.column-fieldinsert');
|
2309 |
+
if( adders.length ){
|
2310 |
+
adders.stop().fadeToggle(700);
|
2311 |
+
$('.layout-new-form-field').stop().fadeToggle(700);
|
2312 |
+
}else{
|
2313 |
+
cf_clear_puler();
|
2314 |
+
}
|
2315 |
+
}
|
2316 |
+
}
|
2317 |
+
|
2318 |
+
cf_clear_puler = function(){
|
2319 |
+
if( is_pulsating ){
|
2320 |
+
clearTimeout( is_pulsating );
|
2321 |
+
$(document).off('mouseover', '.layout-new-form-field, .column-fieldinsert', cf_clear_puler);
|
2322 |
+
}
|
2323 |
+
$('.layout-new-form-field, .column-fieldinsert').fadeIn();
|
2324 |
+
};
|
2325 |
+
$(document).on('mouseover', '.layout-new-form-field, .column-fieldinsert', cf_clear_puler );
|
2326 |
+
// build fild bindings
|
2327 |
+
rebuild_field_binding();
|
2328 |
+
$(document).trigger('load.page');
|
2329 |
+
|
2330 |
+
// build processor sortables
|
2331 |
+
function build_processor_sortables(){
|
2332 |
+
// set sortable groups
|
2333 |
+
$( ".caldera-editor-processors-panel ul" ).sortable({
|
2334 |
+
update: function(){
|
2335 |
+
rebuild_field_binding();
|
2336 |
+
}
|
2337 |
+
});
|
2338 |
+
|
2339 |
+
}
|
2340 |
+
|
2341 |
+
// set active processor editor
|
2342 |
+
$('body').on('click', '.caldera-processor-nav a', function(e){
|
2343 |
+
|
2344 |
+
e.preventDefault();
|
2345 |
+
|
2346 |
+
var clicked = $(this);
|
2347 |
+
|
2348 |
+
$('.caldera-processor-nav').removeClass('active');
|
2349 |
+
$('.caldera-editor-processor-config-wrapper').hide();
|
2350 |
+
$( clicked.attr('href') ).show();
|
2351 |
+
clicked.parent().addClass('active');
|
2352 |
+
|
2353 |
+
});
|
2354 |
+
|
2355 |
+
$('body').on('click', '.add-new-processor', function(e){
|
2356 |
+
|
2357 |
+
var clicked = $(this),
|
2358 |
+
new_conf_templ = Handlebars.compile( $('#processor-wrapper-tmpl').html() );
|
2359 |
+
wrap = $('.active-processors-list'),
|
2360 |
+
process_conf = $('.caldera-editor-processor-config'),
|
2361 |
+
processid = Math.round(Math.random() * 100000000);
|
2362 |
+
|
2363 |
+
new_templ = Handlebars.compile( $('#processor-line-tmpl').html() );
|
2364 |
+
new_proc = {
|
2365 |
+
"id" : "fp_" + processid,
|
2366 |
+
"type" : clicked.data('type')
|
2367 |
+
};
|
2368 |
+
|
2369 |
+
// place new group line
|
2370 |
+
wrap.append( new_templ( new_proc ) );
|
2371 |
+
|
2372 |
+
// place config
|
2373 |
+
process_conf.append( new_conf_templ( new_proc ) );
|
2374 |
+
|
2375 |
+
// reset sortable
|
2376 |
+
$('#form_processor_baldrickModalCloser').trigger('click');
|
2377 |
+
$('.caldera-processor-nav a').last().trigger('click');
|
2378 |
+
$('#fp_' + processid + '_type').val(clicked.data('type')).trigger('change');
|
2379 |
+
build_processor_sortables();
|
2380 |
+
|
2381 |
+
baldrickTriggers();
|
2382 |
+
});
|
2383 |
+
|
2384 |
+
// remove processor
|
2385 |
+
$('body').on('click', '.delete-processor', function(e){
|
2386 |
+
|
2387 |
+
var clicked = $(this),
|
2388 |
+
parent = clicked.closest('.caldera-editor-processor-config-wrapper'),
|
2389 |
+
type = parent.data('type');
|
2390 |
+
|
2391 |
+
if(!confirm(clicked.data('confirm'))){
|
2392 |
+
return;
|
2393 |
+
}
|
2394 |
+
|
2395 |
+
$('.' + parent.prop('id')).remove();
|
2396 |
+
parent.remove();
|
2397 |
+
|
2398 |
+
$('.caldera-processor-nav a').first().trigger('click');
|
2399 |
+
|
2400 |
+
rebuild_field_binding();
|
2401 |
+
|
2402 |
+
});
|
2403 |
+
|
2404 |
+
// set title & config of selected processor
|
2405 |
+
$('body').on('change', '.caldera-select-processor-type', function(e){
|
2406 |
+
var selected = $(this),
|
2407 |
+
parent = selected.closest('.caldera-editor-processor-config-wrapper'),
|
2408 |
+
title = selected.find('option[value="'+selected.val()+'"]').text(),
|
2409 |
+
title_line = parent.find('.caldera-editor-processor-title'),
|
2410 |
+
activeline = $('.caldera-processor-nav.active a');
|
2411 |
+
|
2412 |
+
if(title === ''){
|
2413 |
+
title = title_line.data('title');
|
2414 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2415 |
|
2416 |
+
title_line.html( title );
|
2417 |
+
activeline.html( title + ' <span class="processor-line-number"></span>' ).parent().addClass( 'processor_type_' + selected.val() );
|
2418 |
|
2419 |
+
// get config
|
2420 |
+
build_processor_config(this);
|
2421 |
|
2422 |
+
rebuild_field_binding();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2423 |
|
2424 |
+
});
|
2425 |
+
$( document ).on('click', '#cf-shortcode-preview', function(){
|
2426 |
+
$(this).focus().select();
|
2427 |
+
} );
|
2428 |
+
$( document ).on('change', '.cf-email-preview-toggle', function(){
|
2429 |
+
var clicked = $(this),
|
2430 |
+
preview_button = $('.caldera-header-email-preview-button');
|
2431 |
+
if( clicked.is(':checked') ){
|
2432 |
+
preview_button.show().attr( 'aria-hidden', 'false' ).css( 'visibility', 'visible' );
|
2433 |
+
}else{
|
2434 |
+
preview_button.hide().attr( 'aria-hidden', 'true' ).css( 'visibility', 'hidden' );
|
2435 |
+
}
|
2436 |
|
2437 |
+
} );
|
2438 |
|
|
|
2439 |
|
2440 |
+
// build processor type config
|
2441 |
+
function build_processor_config(el){
|
2442 |
|
2443 |
+
var select = $(el),
|
2444 |
+
templ = $('#' + select.val() + '-tmpl').length ? $('#' + select.val() + '-tmpl').html() : '',
|
2445 |
+
parent = select.closest('.caldera-editor-processor-config-wrapper'),
|
2446 |
+
target = parent.find('.caldera-config-processor-setup'),
|
2447 |
+
template = Handlebars.compile(templ),
|
2448 |
+
config = parent.find('.processor_config_string').val(),
|
2449 |
+
current_type = select.data('type');
|
2450 |
|
2451 |
+
// Be sure to load the processors preset when switching back to the initial processor type.
|
2452 |
+
if(config.length && current_type === select.val() ){
|
2453 |
+
config = JSON.parse(config);
|
2454 |
+
}else{
|
2455 |
+
// default config
|
2456 |
+
config = processor_defaults[select.val() + '_cfg'];
|
2457 |
+
}
|
2458 |
|
2459 |
+
// build template
|
2460 |
+
if(!config){
|
2461 |
+
config = {};
|
2462 |
+
}
|
2463 |
|
2464 |
+
config._id = parent.prop('id');
|
2465 |
+
config._name = 'config[processors][' + parent.prop('id') + '][config]';
|
2466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2468 |
|
|
|
|
|
|
|
2469 |
|
2470 |
+
template = $('<div>').html( template( config ) );
|
2471 |
|
2472 |
+
// send to target
|
2473 |
+
target.html( template.html() );
|
2474 |
+
|
2475 |
+
// check for init function
|
2476 |
+
if( typeof window[select.val() + '_init'] === 'function' ){
|
2477 |
+
window[select.val() + '_init'](parent.prop('id'), target);
|
2478 |
+
}
|
2479 |
+
|
2480 |
+
// check if conditions are allowed
|
2481 |
+
if(parent.find('.no-conditions').length){
|
2482 |
+
// conditions are not supported - remove them
|
2483 |
+
parent.find('.toggle_option_tab').remove();
|
2484 |
+
}
|
2485 |
+
|
2486 |
+
|
2487 |
+
rebuild_field_binding();
|
2488 |
+
baldrickTriggers();
|
2489 |
+
|
2490 |
+
// initialise baldrick triggers
|
2491 |
+
$('.wp-baldrick').baldrick({
|
2492 |
+
request : ajaxurl,
|
2493 |
+
method : 'POST',
|
2494 |
+
before : function(el){
|
2495 |
+
|
2496 |
+
var tr = $(el);
|
2497 |
+
|
2498 |
+
if( tr.data('addNode') && !tr.data('request') ){
|
2499 |
+
tr.data('request', 'cf_get_default_setting');
|
2500 |
+
}
|
2501 |
+
}
|
2502 |
+
});
|
2503 |
+
|
2504 |
+
}
|
2505 |
+
|
2506 |
+
// build configs on load:
|
2507 |
+
// allows us to keep changes on reload as not to loose settings on accedental navigation
|
2508 |
+
rebuild_field_binding();
|
2509 |
+
|
2510 |
+
$('.caldera-select-processor-type').each(function(k,v){
|
2511 |
+
build_processor_config(v);
|
2512 |
+
});
|
2513 |
+
|
2514 |
+
|
2515 |
+
build_processor_sortables();
|
2516 |
});//
|
2517 |
|
2518 |
|
2519 |
// field binding helper
|
2520 |
Handlebars.registerHelper('_field', function(args) {
|
2521 |
|
2522 |
+
var config = this,required="", is_array = "", exclude="";
|
2523 |
+
|
2524 |
+
var default_val = this[args.hash.slug] ? ' data-default="' + this[args.hash.slug] + '"' : '';
|
2525 |
+
|
2526 |
+
if(args.hash.required){
|
2527 |
+
required = " required";
|
2528 |
+
}
|
2529 |
+
if(args.hash.exclude){
|
2530 |
+
exclude = 'data-exclude="'+args.hash.exclude+'"';
|
2531 |
+
}
|
2532 |
+
if(args.hash.array){
|
2533 |
+
is_array = "[]";
|
2534 |
+
if(args.hash.array !== 'true'){
|
2535 |
+
default_val = 'value="' + args.hash.array + '"';
|
2536 |
+
}
|
2537 |
+
}
|
2538 |
+
|
2539 |
+
out = '<select ' + ( args.hash.type ? 'data-type="' + args.hash.type + '"' : '' ) + default_val +' ' + exclude + ' name="' + this._name + '[' + args.hash.slug + ']' + is_array + '" id="' + this._id + '_' + args.hash.slug + '" class="block-input field-config caldera-field-bind' + required + '">';
|
2540 |
+
if(this[args.hash.slug]){
|
2541 |
+
out += '<option class="bound-field" value="' + this[args.hash.slug] + '" class="bound-field"></option>';
|
2542 |
+
}else{
|
2543 |
+
if(!args.hash.required){
|
2544 |
+
out += '<option value=""></option>';
|
2545 |
+
}
|
2546 |
+
}
|
2547 |
+
for(var fid in current_form_fields){
|
2548 |
+
|
2549 |
+
var sel = '';
|
2550 |
+
|
2551 |
+
if(args.hash.type){
|
2552 |
+
if(current_form_fields[fid].type !== args.hash.type){
|
2553 |
+
continue;
|
2554 |
+
}
|
2555 |
+
}
|
2556 |
+
|
2557 |
+
if(config[args.hash.slug]){
|
2558 |
+
if(config[args.hash.slug] === fid){
|
2559 |
+
sel = ' selected="selected"';
|
2560 |
+
}
|
2561 |
+
}
|
2562 |
+
|
2563 |
+
|
2564 |
+
out += '<option value="' + fid + '"' + sel + '>' + current_form_fields[fid].label + ' [' + current_form_fields[fid].slug + ']</option>';
|
2565 |
+
};
|
2566 |
+
|
2567 |
+
out += '</select>';
|
2568 |
+
if(args.hash.required){
|
2569 |
+
out += '<input class="field-config" name="' + this._name + '[_required_bounds][]" type="hidden" value="' + args.hash.slug + '">';
|
2570 |
+
}
|
2571 |
+
return out;
|
2572 |
});
|
2573 |
|
2574 |
Handlebars.registerHelper('console', function(context, options) {
|
2575 |
+
console.log(this);
|
2576 |
});
|
2577 |
|
2578 |
|
|
|
|
assets/js/edit.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function new_conditional_group(e){var a=e.trigger.data("id"),i="cl"+Math.round(18746582734*Math.random()),t="rw"+Math.round(98347598345*Math.random()),o=[{id:t,type:e.trigger.data("type"),lines:[{id:i}]}];return{group:o,id:a}}function new_conditional_line(e){var a=e.trigger.data("id"),i=e.trigger.data("group"),t=e.trigger.data("type"),o="cl"+Math.round(18746582734*Math.random()),r={id:a,type:t,lineid:o,rowid:i,name:"config["+t+"]["+a+"][conditions][group]["+i+"]["+o+"]"};return r}function build_conditions_config(e){var a=JSON.parse(e.trigger.val());return a.id=e.trigger.data("id"),a}function setup_field_type(e){return{id:e.trigger.prop("id")}}function check_required_bindings(e){var a,i=(jQuery(".caldera-header-save-button"),jQuery(".layout-form-field")),t=jQuery(".caldera-processor-nav"),o=!0;a=e?jQuery(e):jQuery(".caldera-config-field .required"),a.removeClass("has-error"),i.removeClass("has-error"),t.removeClass("has-error"),jQuery(".error-tag").remove(),required_errors={},a.each(function(e,a){var i=jQuery(a),t=i.closest(".caldera-config-editor-panel");if(a.value.length){if(i.hasClass("field-slug"))for(var r=jQuery(".field-slug").not(i),l=0;l<r.length;l++)if(r[l].value===a.value){var i=jQuery(r[l]);required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error"),o=!1;break}if(i.hasClass("toggle_value_field"))for(var s=i.closest(".caldera-config-group").find(".toggle_value_field").not(i),l=0;l<s.length;l++)if(s[l].value===a.value){var i=jQuery(s[l]);required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error"),o=!1;break}}else{required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error"),o=!1}});for(var r in required_errors)jQuery(".caldera-forms-options-form").find('a[href="#'+r+'"]').append('<span class="error-tag">'+required_errors[r]+"</span>");return jQuery(".caldera-conditional-field-set").trigger("change"),o}jQuery(document).ready(function(e){function a(a){var t=e(a),o=t.closest(".caldera-editor-field-config-wrapper"),r=o.find(".caldera-config-field-setup"),l=compiled_templates[t.val()+"_tmpl"]?compiled_templates[t.val()+"_tmpl"]:compiled_templates.noconfig_field_templ,n=o.find(".field_config_string").val(),d=t.data("type");if(o.find(".caldera-config-group").show(),t.addClass("field-initialized"),n=n.length&&d===t.val()?JSON.parse(n):fieldtype_defaults[t.val()+"_cfg"],n||(n={}),n._id=t.data("field"),n._name="config[fields]["+t.data("field")+"][config]",l=e("<div>").html(l(n)),r.html(l.html()),"function"==typeof window[t.val()+"_init"]&&window[t.val()+"_init"](t.data("field"),r),fieldtype_defaults[t.val()+"_nosupport"]&&(fieldtype_defaults[t.val()+"_nosupport"].indexOf("hide_label")>=0&&o.find(".hide-label-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[t.val()+"_nosupport"].indexOf("caption")>=0&&o.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[t.val()+"_nosupport"].indexOf("required")>=0&&o.find(".required-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[t.val()+"_nosupport"].indexOf("custom_class")>=0&&o.find(".customclass-field").hide().find(".field-config").val(""),fieldtype_defaults[t.val()+"_nosupport"].indexOf("entry_list")>=0&&o.find(".entrylist-field").hide().find(".field-config").prop("checked",!1)),o.find(".toggle_show_values").trigger("change"),!e(".caldera-select-field-type").not(".field-initialized").length){if(core_form.hasClass("builder-loaded"))i(t.data("field"));else{for(var s=e(".caldera-select-field-type.field-initialized"),c=0;c<s.length;c++)i(e(s[c]).data("field"));core_form.addClass("builder-loaded")}e(".caldera-header-save-button").prop("disabled",!1),rebuild_field_binding(),baldrickTriggers()}e(".color-field").length&&e(".color-field").wpColorPicker({change:function(a){var i=e(this);i.data("ev")&&clearTimeout(i.data("ev")),i.data("ev",setTimeout(function(){i.trigger("record")},200)),i.data("target")&&(e(i.data("target")).css(i.data("style"),i.val()),e(i.data("target")).val(i.val()))}})}function i(a){var i=e("#"+a),t=i.find(".caldera-select-field-type"),o=e('.layout-form-field[data-config="'+a+'"]'),r=o.find(".field_preview"),l=(e("#preview-"+t.val()+"_tmpl").html(),compiled_templates["preview-"+t.val()+"_tmpl"]),n={id:a},d=i.find(".field-config");d.each(function(i,t){for(var o=e(t),r=o.prop("name").split("["+a+"]")[1].substr(1),l=r.substr(0,r.length-1).split("]["),d=o.is(":checkbox,:radio")?o.filter(":checked").val():o.val(),s={},c=l.length-1;c>=0;c--)if(c===l.length-1)s[l[c]]=d;else{var p=s;s={},s[l[c]]=p}e.extend(!0,n,s)}),r.html(l(n)),o.removeClass("button"),e(".preview-field-config").prop("disabled",!0)}function t(a){var i,t=e(".caldera-editor-fields-panel"),o=(e(".caldera-editor-groups-panel"),e(".caldera-group-nav")),r=e('[data-group="'+a+'"]'),l=r.find(".caldera-config-group-name"),n=r.find(".caldera-config-group-slug"),d=r.find(".caldera-config-group-desc"),s=r.find(".caldera-config-group-admin"),c=e(".active-group-name"),p=e(".active-group-slug"),f=e(".active-group-desc"),u=e(".active-group-admin"),g=e(".caldera-editor-fields-list ul"),v=r.find(".caldera-config-group-repeat"),h=e(".repeat-config-button"),m=(e(".caldera-editor-group-settings"),e(".caldera-config-group-remove"));e(".new-group-input").remove(),e(".new-field-input").remove(),o.removeClass("active"),t.show(),g.hide(),g.removeClass("active").find("li.active").removeClass("active"),g.hide(),r.addClass("active"),i=e(".caldera-editor-fields-list ul.active li"),i.length?m.hide():m.show(),e(".caldera-editor-field-config-wrapper").hide(),r.show(),c.val(l.val()),p.val(n.val()),f.val(d.val()),"1"===s.val()?u.prop("checked",!0):u.prop("checked",!1),"1"===v.val()?h.addClass("field-edit-open"):h.removeClass("field-edit-open")}e(".caldera-header-save-button").baldrick({method:"POST",request:"admin.php?page=caldera-forms",before:function(a,i){if(i.preventDefault(),!check_required_bindings())return!1;e("#save_indicator").addClass("loading"),"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();var t=e(".caldera-forms-options-form").formJSON();return t.conditions&&(t.config.conditional_groups={conditions:t.conditions}),e(a).data("cf_edit_nonce",t.cf_edit_nonce),e(a).data("_wp_http_referer",t._wp_http_referer),e(a).data("sender","ajax"),e(a).data("config",JSON.stringify(t.config)),!0},callback:function(a){if(!1===a.data){var i=e(".updated_notice_box");i.stop().animate({top:0},200,function(){setTimeout(function(){i.stop().animate({top:-75},200)},2e3)})}},complete:function(a){e(".wrapper-instance-pane .field-config").prop("disabled",!1)}}),e("body").on("click",".toggle_processor_event input",function(a){var i=e(this),t=i.closest(".wrapper-instance-pane"),o=t.find(".caldera-config-processor-setup"),r=t.find(".caldera-config-processor-notice");i.is(":checked")?(i.parent().addClass("activated"),i.parent().find(".is_active").show(),i.parent().find(".not_active").hide()):(i.parent().removeClass("activated"),i.parent().find(".is_active").hide(),i.parent().find(".not_active").show()),t.find(".toggle_processor_event .activated").length?(o.slideDown(100),r.slideUp(100)):(o.slideUp(100),r.slideDown(100))}),e("body").on("click",".toggle_option_tab > a",function(a){a.preventDefault();var i=e(this),t=e(i.attr("href")),o=i.parent().find("a"),r=i.closest(".caldera-editor-config-wrapper").find(".wrapper-instance-pane");o.removeClass("button-primary"),r.hide(),t.show(),i.addClass("button-primary"),e(".caldera-conditionals-usetype").trigger("change")}),e(".caldera-editor-body").on("change",".caldera-select-field-type",function(e){a(this)}),e(".caldera-editor-body").on("click",".caldera-group-nav a",function(a){a.preventDefault(),t(e(this).attr("href").substr(1))}),e(".caldera-editor-body").on("click",".caldera-editor-fields-list a",function(a){a.preventDefault();var i=e(this),t=e(i.attr("href"));e(".new-group-input").remove(),e(".new-field-input").remove(),e(".caldera-editor-fields-list li.active").removeClass("active"),i.parent().addClass("active"),e(".caldera-editor-field-config-wrapper").hide(),t.show()}),e(".caldera-editor-body").on("click",".group-config-button",function(a){var i=e(this),t=e(".caldera-editor-group-settings"),o=i.closest(".caldera-editor-fields-panel"),r=e(".caldera-config-group-remove");o.find(".caldera-field-line").length?r.hide():r.show(),i.hasClass("field-edit-open")?(t.slideUp(100),i.removeClass("field-edit-open")):(t.slideDown(100),i.addClass("field-edit-open"))}),e(".caldera-editor-body").on("keydown",".field-config",function(a){e(this).is("textarea")||13===a.which&&a.preventDefault()}),e(".caldera-editor-body").on("change",".field-label",function(a){var i=e(this).closest(".caldera-editor-field-config-wrapper").prop("id");field_line=e('[data-field="'+i+'"]'),field_title=e("#"+i+" .caldera-editor-field-title, .layout-form-field.field-edit-open .layout_field_name"),slug=e("#"+i+" .field-slug"),field_line.find("a").html('<i class="icn-field"></i> '+this.value),field_title.text(this.value),"change"===a.type&&slug.trigger("change"),rebuild_field_binding()}),e(".caldera-editor-body").on("change",".active-group-name",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name")),o=i.find("span");"focusout"!==a.type||this.value.length||(this.value="Group "+(parseInt(i.index())+1)),t.val(this.value),o.text(this.value)}),e(".caldera-editor-body").on("change",".active-group-slug",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name").val()),o=i.find(".caldera-config-group-slug"),r=(i.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase());"focusout"!==a.type||this.value.length||(r=t.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase()),o.val(r),this.value=r}),e(".caldera-editor-body").on("change",".active-group-desc",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-desc"));t.val(this.value)}),e(".caldera-editor-body").on("change",".active-group-admin",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name").val(),i.find(".caldera-config-group-admin"));i.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase();e(this).prop("checked")?(t.val(1),i.addClass("is-admin")):(t.val(0),i.removeClass("is-admin"))}),e(".caldera-editor-body").on("click",".repeat-config-button",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find("a .group-type")),o=i.find(".caldera-config-group-repeat"),r=e(this);r.hasClass("field-edit-open")?(o.val("0"),t.removeClass("icn-repeat").addClass("icn-folder"),r.removeClass("field-edit-open")):(o.val("1"),t.addClass("icn-repeat").removeClass("icn-folder"),r.addClass("field-edit-open"))}),e(".caldera-editor-body").on("click",".delete-field",function(){var a=e(this),i=a.closest(".caldera-editor-field-config-wrapper").prop("id");confirm(a.data("confirm"))&&(e("#"+i).remove(),e('option[value="'+i+'"]').remove(),e('[data-bind="'+i+'"]').remove(),delete current_form_fields[i],e('[data-config="'+i+'"]').slideUp(200,function(){var a=e(this);a.remove(),rebuild_field_binding(),e(document).trigger("field.removed")}))}),e(".caldera-editor-body").on("click",".add-new-group,.add-field",function(){var a=e(this);if(e(".new-group-input").remove(),e(".new-field-input").remove(),a.hasClass("add-field")){var i=e('<input type="text" class="new-field-input block-input">');i.appendTo(e(".caldera-editor-fields-list ul.active")).focus()}else{var t=e('<input type="text" class="new-group-input block-input">');t.appendTo(e(".caldera-editor-groups-panel")).focus()}}),e(".caldera-editor-body").on("change keypress",".new-group-input",function(a){if("keypress"===a.type){if(13!==a.which)return;a.preventDefault()}var i,o,r=this.value,l=e(this),n=e(".caldera-editor-groups-panel ul"),d=e(".caldera-editor-fields-list");if(r.length){i=Handlebars.compile(e("#caldera_group_line_templ").html()),o={id:r.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),name:r},n.append(i(o));var s=e('<ul data-group="'+o.id+'">').hide();s.appendTo(d),l.remove(),t(o.id)}else l.remove()}),e(".caldera-editor-body").on("change keypress",".new-field-input",function(a){if("keypress"===a.type){if(13!==a.which)return;a.preventDefault()}var i,t,o,r=this.value,l=e(this),n=l.parent(),d=e(".caldera-editor-field-config"),s=e(".caldera-config-group-remove");if(r.length){s.hide(),i=Handlebars.compile(e("#caldera_field_line_templ").html()),t=Handlebars.compile(e("#caldera_field_config_wrapper_templ").html()),o={id:r.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),label:r,slug:r.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),group:e(".caldera-group-nav.active").data("group")};var c=e(i(o));c.appendTo(n),d.append(t(o)),c.find("a").trigger("click"),l.remove()}else l.remove()}),e(".caldera-editor-body").on("change",".field-slug",function(a){this.value.length?this.value=this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase():"change"===a.type&&(this.value=e(this).closest(".caldera-editor-field-config-wrapper").find(".field-label").val().split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase())}),e(".caldera-editor-body").on("click",".caldera-add-group",function(a){var i=e(this),t=i.data("group"),o=e("#"+t+"_panel_tmpl").html();i.parent().parent().append(o)}),e(".caldera-editor-body").on("click",".caldera-config-group-remove",function(a){var i=e(".active-group-slug").val();e('[data-group="'+i+'"]').hide(0,function(){e(this).remove();var a=e(".caldera-group-nav");a.length?a.first().find("a").trigger("click"):e(".caldera-editor-fields-panel").hide()})}),e("body").on("click",".set-current-field",function(a){a.preventDefault();var i=e(this);e("#"+i.data("field")+"_type").val(i.data("type")).trigger("change"),e("#"+i.data("field")+"_lable").focus(),e("#field_setup_baldrickModalCloser").trigger("click")}),e(".caldera-editor-body").on("change record",".field-config",function(a){var t=e(this),o=t.closest(".caldera-editor-field-config-wrapper");current_form_fields&&(t.prop("id")===o.prop("id")+"_lable"&&(current_form_fields[o.prop("id")].label=this.value),t.prop("id")===o.prop("id")+"_slug"&&(current_form_fields[o.prop("id")].slug=this.value),t.prop("id")===o.prop("id")+"_type"&&(current_form_fields[o.prop("id")].type=this.value),o.length&&i(o.prop("id")))}),e(".caldera-editor-body").on("focus",".caldera-field-bind",function(a){var i=e(this),t=this.value;return a.type&&"focusin"===a.type?(i.removeClass("bound_field").addClass("reload-binding"),rebind_field_bindings(),void(this.value=t)):void 0}),e(".caldera-editor-body").on("change",".caldera-conditional-field-set",function(a){var i,t,o=e(this),r=o.parent().find(".compare-type"),l=o.data("condition"),n=o.data("id"),d="config["+l+"]["+n+"][conditions][group]["+o.data("row")+"]["+o.data("line")+"]",s=o.data("line"),c=e("#"+s+"_value"),p=c.find(".caldera-conditional-value-field").first(),f=[],u=this.value;if("{"!==u.substr(0,1)&&(i=e("#"+u),t=i.find(".field-button-type"),f=i.find(".caldera-config-group-toggle-options")),o.hasClass(".bind_init")&&o.addClass("bound_triggered"),p.length&&p.val().length&&c.data("value",p.val()),r.show(),f.length){var g=f.find(".toggle_option_row"),v='<select name="'+d+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+u+'" style="max-width: 220px; width: 220px;">';v+='<option value=""></option>',g.each(function(a,i){var t=e(i).find(".toggle_label_field"),o=t.data("option"),r="";c.data("value")&&(c.data("value").toString()!==o&&c.data("value").toString()!==e(i).find(".toggle_value_field").val()||(r=' selected="selected"')),v+='<option value="'+o+'"'+r+">"+t.val()+"</option>"}),v+="</select>"}else t&&"button"==t.val()?(r.val("is").hide(),v='<select name="'+d+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+u+'" style="max-width: 220px; width: 220px;">',v+='<option value="click" '+("click"===c.data("value")?'selected="selected"':"")+">Click</option>",v+='<option value="dblclick" '+("dblclick"===c.data("value")?'selected="selected"':"")+">Double Click</option>",v+="</select>"):v='<input name="'+d+'[value]" type="text" class="caldera-conditional-value-field magic-tag-enabled" value="'+(c.data("value")?c.data("value"):"")+'" style="max-width: 205px;">';c.html(v),init_magic_tags()}),e(".caldera-editor-body").on("change",".caldera-conditionals-usetype",function(a){var i=e(this);"show"===this.value||"hide"===this.value||"disable"===this.value||"use"===this.value||"not"===this.value?(e("#"+i.data("id")+"_condition_group_add").show(),e("#"+i.data("id")+"_conditional_wrap").show()):(e("#"+i.data("id")+"_condition_group_add").hide(),e("#"+i.data("id")+"_conditional_wrap").hide())}),e(".caldera-editor-body").on("click",".remove-conditional-line",function(a){a.preventDefault();var i=e(this),t=i.closest(".caldera-condition-line"),o=i.closest(".caldera-condition-group");t.remove(),o.find(".caldera-condition-line").length||o.remove()}),e(".caldera-group-nav").first().find("a").trigger("click"),e(".caldera-editor-body").on("change",".toggle_show_values",function(a){var i=e(this),t=i.closest(".caldera-config-group-toggle-options");values=t.find(".toggle_value_field"),lables=t.find(".toggle_label_field"),field_lables=t.find(".caldera-config-group-option-labels"),i.prop("checked")?(values.show().parent().show(),values.show().parent().parent().show(),lables.css("width",""),field_lables.show()):(values.hide().parent().hide(),lables.css("width",245),field_lables.hide()),lables.trigger("toggle.values"),init_magic_tags()}),e(".caldera-editor-body").on("change",".auto-populate-type",function(){e(this).closest(".wrapper-instance-pane").find(".auto-populate-options").trigger("change")}),e(".caldera-editor-body").on("change",".auto-populate-options",function(){var a=e(this),i=a.closest(".wrapper-instance-pane"),t=i.find(".caldera-config-group-toggle-options"),o=i.find(".caldera-config-group-auto-options"),r=o.find(".auto-populate-type");o.find(".auto-populate-type-panel").hide(),a.prop("checked")?(t.hide(),o.show()):(t.show(),o.hide()),o.find(".caldera-config-group-auto-"+r.val()).show()}),e("body").on("change",".pin-toggle-roles",function(){var a=e(this),i=e("#caldera-pin-rules");"1"===a.val()?i.show():i.hide()}),e("body").on("click",".magic-tag-init",function(a){var i=e(this),t=i.prev();t.focus().trigger("init.magic")}),e("body").on("keyup blur focus select click init.magic",".magic-tag-enabled",function(a){init_magic_tags();var i=e(this),t=i.parent(),o=t.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val()?t.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val():"hidden",r=t.find(".magic-tags-autocomplete"),l=r.find("ul"),n=this.value,d=[],s="",c=this.selectionStart,p=this.selectionEnd;if(r.length&&r.data("focus"))return void a.preventDefault();if(i.data("tag",""),this.selectionEnd>this.selectionStart)s=this.value.substr(this.selectionStart,this.selectionEnd-this.selectionStart);else if(("select"===a.type||"keyup"===a.type)&&40!==a.which&&38!==a.which&&39!==a.which&&37!==a.which){for(c=this.selectionStart;c>0;c--){var f=n.substr(c-1,1);if(" "===f||"\n"===f||("%"===f||"}"===f)&&this.selectionStart===c)break}for(p=this.selectionStart;p<n.length;p++){var f=n.substr(p,1);if(" "===f||"\n"===f||("%"===f||"{"===f)&&this.selectionStart===p)break}s=n.substr(c,p-c)}if("focusout"!==a.type){if("init"!==a.type&&s.length<3)return void(r.length&&r.remove());r.length||(r=e('<div class="magic-tags-autocomplete"></div>'),l=e("<ul></ul>"),l.appendTo(r),r.insertAfter(i),r.on("mouseenter",function(){e(this).data("focus",!0)}),r.on("mouseleave",function(){e(this).data("focus",!1),i.is(":focus")||i.trigger("focusout")})),l.empty();var u="system",g=!1;"hidden"===o||"dropdown"===o||"radio"===o||"toggle_switch"===o||"checkbox"===o?(g=!0,o="text",u="all"):"paragraph"!==o&&"html"!==o||(o="text"),i.data("type")&&(o=i.data("type")),o=o.split(","),o.push("vars");for(var v=0;v<o.length;v++)for(var h in system_values)if("undefined"!=typeof system_values[h].tags[o[v]]){if(d=[h],"system"!==h&&"variable"!==h&&"field"!==h){var m=jQuery(".processor-"+h),_=i.closest(".caldera-editor-processor-config-wrapper"),y=_.prop("id");d=[];for(var b=0;b<m.length;b++)if(_.length||g!==!0){if(y===m[b].id)continue;jQuery("li."+m[b].id).index()<jQuery("li."+y).index()&&d.push(m[b].id)}else d.push(m[b].id)}for(var w=0;w<d.length;w++)if("all"===u||u===h||"variable"===h){var k=e('<li class="header">'+system_values[h].type+(w>0?" ["+(w+1)+"]":"")+"</li>"),C=0;k.appendTo(l);for(var j=0;j<system_values[h].tags[o[v]].length;j++)if(!i.data("parent")||"variable:"+i.data("parent")!==system_values[h].tags[o[v]][j]){var x=system_values[h].wrap[0]+system_values[h].tags[o[v]][j]+system_values[h].wrap[1];if(d[w]!==h&&d.length>1&&(x=system_values[h].wrap[0]+system_values[h].tags[o[v]][j]+":"+d[w]+system_values[h].wrap[1]),x.indexOf(s)>=0||"init"===a.type){C+=1;var Q=x.replace(s,"<strong>"+s+"</strong>"),q=e('<li class="tag" data-tag="'+x+'">'+Q+"</li>");q.on("click",function(){var a=e(this).data("tag");i.val(n.substr(0,c)+a+n.substr(p)).trigger("change").focus(),i[0].selectionStart=c+a.length-(a.indexOf("*")>0?2:0),i[0].selectionEnd=c+a.length-(a.indexOf("*")>0?1:0),p=c=i[0].selectionEnd,n+=a,i.trigger("init.magic")}),q.appendTo(l)}}0===C&&k.remove()}}}l.children().length||r.remove(),"focusout"===a.type&&setTimeout(function(){r.remove()},200)});for(var o=e(".cf-editor-template"),r=0;r<o.length;r++)compiled_templates[o[r].id]=Handlebars.compile(o[r].innerHTML);e(".caldera-select-field-type").not(".field-initialized").each(function(e,i){a(i)})});var rebuild_field_binding,rebind_field_bindings,current_form_fields={},required_errors={},add_new_grid_page,add_page_grid,init_magic_tags,core_form,compiled_templates={};init_magic_tags=function(){var e=jQuery(".magic-tag-enabled");e.each(function(e,a){var i=jQuery(a);if(i.hasClass("magic-tag-init-bound")){var t=i.parent().find(".magic-tag-init");return void(i.is(":visible")?t.show():t.hide())}var o=jQuery('<span class="icn-code magic-tag-init"></span>'),r=jQuery('<span style="position:relative;display:inline-block; width:100%;"></span>');i.is("input")&&o.css("borderBottom","none"),i.hasClass("caldera-conditional-value-field")&&r.width("auto"),i.wrap(r),o.insertAfter(i),i.addClass("magic-tag-init-bound"),i.is(":visible")?o.show():o.hide()})},rebuild_field_binding=function(){if(core_form||(core_form=jQuery(".caldera-forms-options-form")),core_form.hasClass("builder-loaded")){var e=jQuery(".caldera-editor-field-config-wrapper");system_values.field={tags:{text:[]},type:"Fields",wrap:["%","%"]};for(var a=0;a<e.length;a++){var i=e[a].id,t=jQuery("#"+i+"_lable").val(),o=jQuery("#"+i+"_slug").val(),r=jQuery("#"+i+"_type").val();"undefined"==typeof system_values.field.tags[r]&&(system_values.field.tags[r]=[]),system_values.field.tags[r].push(o),"text"!==r&&system_values.field.tags.text.push(o),current_form_fields[i]={label:t,slug:o,type:r},jQuery("option.bound-field").trigger("change").each(function(e,a){var i=jQuery(a);0!==i.prop("value").indexOf("{")?i.text(jQuery("#"+i.prop("value")+"_lable").val()+" ["+jQuery("#"+i.prop("value")+"_lable").val()+"]"):i.text(i.prop("value").replace("{","").replace("}",""))}).removeClass("bound-field")}}},rebind_field_bindings=function(){var e,a,i=jQuery(".caldera-field-bind").not(".bound_field");if(i.length){i.addClass("bound_field");for(var t=0;t<i.length;t++){var o=jQuery(i[t]),r=o.val(),l=o.data("default"),n=o.data("exclude"),d=0,s=o.closest(".caldera-editor-processor-config-wrapper"),c=s.prop("id"),p="";if(l&&!o.hasClass("reload-binding")&&(r=l),o.is("select")){o.empty();var f=jQuery('<optgroup label="Fields">');for(var u in current_form_fields)o.data("type")&&o.data("type").split(",").indexOf(current_form_fields[u].type)<0||(o.data("id")!==u&&f.append('<option value="'+u+'"'+(r===u?'selected="selected"':"")+">"+current_form_fields[u].label+" ["+current_form_fields[u].slug+"]</option>"),d+=1);f.appendTo(o),0===d&&o.empty();for(var g in system_values)if(e=[],!(n&&n.split(",").indexOf(g)>=0)){if("system"!==g&&"variable"!==g)for(var v=jQuery(".processor-"+g),h=0;h<v.length;h++)c!==v[h].id&&(e.push(v[h].id),v.length>1&&(a=jQuery("li."+v[h].id+" .processor-line-number"))&&a.html("["+(h+1)+"]"));else e.push("__system__");var m=[];o.data("type")?(m=o.data("type").split(","),m.push("vars")):m=["text","vars"];for(var _=0;_<m.length;_++)if(system_values[g].tags&&system_values[g].tags[m[_]])for(var y=0;y<e.length;y++){jQuery("li."+e[y]).index()>jQuery("li."+c).index()&&"__system__"!==e[y]?o.closest(".caldera-editor-processors-panel-wrap").length&&(p=' disabled="disabled"'):p="";for(var f=jQuery('<optgroup label="'+system_values[g].type+("__system__"!==e[y]?" "+jQuery("li."+e[y]).find(".processor-line-number").html():"")+'"'+p+">"),b=0;b<system_values[g].tags[m[_]].length;b++){var w=system_values[g].tags[m[_]][b];"__system__"!==e[y]&&(w=w.replace(g,e[y])),f.append('<option value="{'+w+'}"'+(r==="{"+w+"}"?'selected="selected"':"")+p+">"+system_values[g].tags[m[_]][b]+"</option>"),d+=1}f.children().length&&f.appendTo(o)}}if(0===d){if(o.empty(),o.data("type")){o.append('<option value="">No '+o.data("type").split(",").join(" or ")+" in form</option>");var k=!0}}else o.prop("disabled",!1);o.hasClass("required")||"undefined"!=typeof k||o.prepend('<option value=""></option>'),o.val(r)}}init_magic_tags(),jQuery(document).trigger("bound.fields"),jQuery(".caldera-header-save-button").prop("disabled",!1)}},jQuery(document).ready(function(e){function a(){var a=e(".layout-grid-panel"),i=0;a.each(function(a,t){var o=e(t),r=o.find(".layout-structure"),l=o.find(".row"),n=[];l.each(function(a,t){var o=e(t),r=o.children().not(".column-merge"),l=[];i+=1,r.each(function(a,t){span=e(t).attr("class").split("-"),l.push(span[2]);var o=e(t).find(".field-location");o.length&&o.each(function(t,o){var r=e(o);r.val(i+":"+(a+1)).removeAttr("disabled")})}),n.push(l.join(":"))}),r.val(n.join("|"))})}function i(a,i,o){var r,l,n="fld_"+Math.round(1e7*Math.random()),d=n,s=e("#field_config_panels");a.prop("id","").prop("title",""),r=Handlebars.compile(e("#caldera_field_config_wrapper_templ").html()),l=e.extend({},{id:d,label:"",slug:""},o),l.slug="",s.append(r(l)),a.removeClass("button-small").removeClass("button").removeClass("button-primary").removeClass("ui-draggable").removeClass("layout-new-form-field").addClass("layout-form-field").attr("data-config",n).css({display:"",opacity:""}),a.find(".layout_field_name").remove(),a.find(".field-location").prop("name","config[layout_grid][fields]["+n+"]"),a.find(".settings-panel").show(),a.appendTo(i),t(),a.find(".icon-edit").trigger("click"),e("#"+n+"_lable").focus().select(),baldrickTriggers(),e(document).trigger("field.added"),o?e("#"+d+"_type").data("type",l.type).trigger("change"):e("#"+n).trigger("field.drop"),rebuild_field_binding()}function t(){e(".toggle-options").sortable({handle:".dashicons-sort"}),e("#grid-pages-panel").sortable({placeholder:"row-drop-helper",handle:".sort-handle",items:".first-row-level",axis:"y",stop:function(){a()}}),e(".layout-column").sortable({connectWith:".layout-column",appendTo:"#grid-pages-panel",helper:"clone",items:".layout-form-field",handle:".drag-handle",cursor:"move",opacity:.7,cursorAt:{left:100,top:15},start:function(e,a){a.helper.css({width:"200px",height:"35px",paddingTop:"20px"})},stop:function(e,i){i.item.removeAttr("style"),a()}}),e("h3 .layout-new-form-field").draggable({helper:"clone",appendTo:"body"}),e(".page-toggle.button").droppable({accept:".layout-form-field",over:function(a,i){e(this).trigger("click"),e(".layout-column").sortable("refresh")}}),e(".layout-column").droppable({greedy:!0,activeClass:"ui-state-dropper",hoverClass:"ui-state-hoverable",accept:".layout-new-form-field",drop:function(a,t){var o=t.draggable.clone(),r=e(this);i(o,r)}}),a()}function o(){if(n){var a=e(".column-fieldinsert");a.length?(a.stop().fadeToggle(700),e(".layout-new-form-field").stop().fadeToggle(700)):cf_clear_puler()}}function r(){e(".caldera-editor-processors-panel ul").sortable({update:function(){rebuild_field_binding()}})}function l(a){var i=e(a),t=e("#"+i.val()+"-tmpl").length?e("#"+i.val()+"-tmpl").html():"",o=i.closest(".caldera-editor-processor-config-wrapper"),r=o.find(".caldera-config-processor-setup"),l=Handlebars.compile(t),n=o.find(".processor_config_string").val(),d=i.data("type");n=n.length&&d===i.val()?JSON.parse(n):processor_defaults[i.val()+"_cfg"],n||(n={}),n._id=o.prop("id"),n._name="config[processors]["+o.prop("id")+"][config]",l=e("<div>").html(l(n)),r.html(l.html()),"function"==typeof window[i.val()+"_init"]&&window[i.val()+"_init"](o.prop("id"),r),o.find(".no-conditions").length&&o.find(".toggle_option_tab").remove(),rebuild_field_binding(),baldrickTriggers(),e(".wp-baldrick").baldrick({request:ajaxurl,method:"POST",before:function(a){var i=e(a);i.data("addNode")&&!i.data("request")&&i.data("request","cf_get_default_setting")}})}add_new_grid_page=function(e){return{page_no:"pg_"+Math.round(1e7*Math.random())}},add_page_grid=function(a){var i=e(".page-toggle").length+1,o=e('<button type="button" data-name="Page '+i+'" data-page="'+a.rawData.page_no+'" class="page-toggle button">'+a.params.trigger.data("addtitle")+" "+i+"</button> "),r=e("#page-toggles");o.appendTo(r),r.show(),t(),o.trigger("click"),1===i&&r.hide(),e(document).trigger("add.page")},e(document).on("remove.page add.page load.page",function(a){var i=e(".page-toggle").length,t=e("#tab_pages");1>=i?t.hide():t.show()}),t(),e("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-plus-alt",function(a){var t=e(this).closest(".column-container"),o=e("#newfield-tool").clone().css("display","");i(o,t)}),e("#grid-pages-panel").on("click",".column-split",function(a){var i=e(this).parent().parent(),o=i.attr("class").split("-"),r=e("<div>").insertAfter(i),l=Math.ceil(o[2]/2),n=Math.floor(o[2]/2);o[2]=l,i.attr("class",o.join("-")),o[2]=n,r.addClass(o.join("-")).append('<div class="layout-column column-container">'),e(this).remove(),t(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("click",".column-remove",function(i){var t=e(this).closest(".row"),o=t.find(".layout-form-field"),r=t.closest(".layout-grid-panel");if(o.length){if(!confirm(e("#row-remove-fields-message").text()))return;o.each(function(a,i){var t=e(i).data("config");e("#"+t).remove(),e('option[value="'+t+'"]').remove(),e('[data-bind="'+t+'"]').remove(),delete current_form_fields[t]})}t.slideUp(200,function(){if(e(this).remove(),a(),rebuild_field_binding(),!r.find(".row").length){r.remove();var i=e("#page-toggles .button-primary"),t=i.prev(),o=i.next();i.remove(),
|
2 |
-
t.length?t.trigger("click"):o.trigger("click")}e(document).trigger("remove.page")}),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e(".caldera-config-editor-main-panel").on("click",".caldera-add-row",function(i){i.preventDefault();var o=e(".page-active");if(!o.length)return void e(".caldera-add-page").trigger("click");var r=e('<div style="display:none;" class="first-row-level row"><div class="col-xs-12"><div class="layout-column column-container"></div></div></div>');e(".page-active").append(r),r.slideDown(200),t(),a()}),e("#grid-pages-panel").on("click",".column-join",function(i){var t=e(this).parent().parent().parent(),o=t.prev(),r=o.attr("class").split("-"),l=t.attr("class").split("-");r[2]=parseFloat(r[2])+parseFloat(l[2]),t.find(".layout-column").contents().appendTo(o.find(".layout-column")),o.attr("class",r.join("-")),t.remove(),a(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("mouseenter",".row",function(i){var t=jQuery(this);jQuery(".column-tools,.column-merge").remove(),t.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>'),t.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>'),t.children().children().not(":first").prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');var o=t.parent().parent().parent().width()/12-1;t.children().children().each(function(a,i){var t=e(i),o=t.width()/2-5;t.prepend('<div class="column-fieldinsert column-tools"><i class="dashicons dashicons-plus-alt"></i></div>'),t.parent().hasClass("col-xs-1")||(t.prepend('<div class="column-split column-tools"><i class="dashicons dashicons-leftright"></i></div>'),t.find(".column-split").css("left",o))}),jQuery(".column-merge").draggable({axis:"x",helper:"clone",appendTo:t,grid:[o,0],drag:function(i,t){e(this).addClass("dragging"),e(".column-tools").remove(),e(".column-split").remove();var o=e(this).parent().parent(),r=t.helper,l=t.originalPosition.left>r.position().left?"left":"right",n=o.prev(),d=Math.round(o.parent().width()/12-10),s=Math.abs(t.originalPosition.left-r.position().left);if(o.parent().addClass("sizing"),s>=d){var c=n.attr("class").split("-"),p=o.attr("class").split("-");c[2]=parseFloat(c[2]),p[2]=parseFloat(p[2]),"left"===l?(c[2]--,p[2]++,c[2]>0&&c[2]<c[2]+p[2]?(n.attr("class",c.join("-")),o.attr("class",p.join("-")),t.originalPosition.left=r.position().left):e(this).draggable("option","disabled",!0)):(c[2]++,p[2]--,p[2]>0&&p[2]<p[2]+p[2]?(n.attr("class",c.join("-")),o.attr("class",p.join("-")),t.originalPosition.left=r.position().left):e(this).draggable("option","disabled",!0)),a()}},stop:function(){e(this).removeClass("dragging").parent().parent().parent().removeClass("sizing")}})}),e("#grid-pages-panel").on("mouseleave",".row",function(e){jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("click",".layout-form-field .icon-remove",function(){var a=e(this),i=a.parent(),t=e("#"+i.data("config"));i.slideUp(100,function(){e(this).remove()}),t.slideUp(100,function(){e(this).remove()})}),e(document).on("click",".layout-form-field .dashicons-admin-page",function(){var a=e(this),t=a.parent(),o=t.data("config"),r=e("#"+o).formJSON(),l=a.closest(".column-container"),n=t.clone().css("display",""),d={};t.hasClass("field-edit-open")&&(t.removeClass("field-edit-open"),n.removeClass("field-edit-open"),e(".caldera-editor-field-config-wrapper").hide()),r.config.fields[o]&&(d=r.config.fields[o],delete d.ID),i(n,l,d)}),e(document).on("click",".layout-form-field .icon-edit",function(){var a=e(this),i=a.parent(),t=e("#"+i.data("config")+"_type").val();e(".caldera-editor-field-config-wrapper").hide(),i.hasClass("field-edit-open")?i.removeClass("field-edit-open"):(e(".layout-form-field").removeClass("field-edit-open"),i.addClass("field-edit-open"),e("#"+i.data("config")).show()),e(document).trigger("show."+i.data("config")),e(document).trigger("show.fieldedit"),"radio"!==t&&"checkbox"!==t&&"dropdown"!==t&&"toggle_switch"!==t||e("#"+i.data("config")+"_auto").trigger("change")}),e("body").on("click",".layout-modal-edit-closer,.layout-modal-save-action",function(a){a.preventDefault();var i=e(this),t=e(".layout-form-field.edit-open"),o=i.closest(".layout-modal-container");settings=o.find(".settings-panel").first(),e(".edit-open").removeClass("edit-open"),settings.appendTo(t.find(".settings-wrapper")).hide(),o.hide()}),e(".layout-editor-body").on("change",".layout-core-pod-query",function(){e(this).parent().find(".settings-panel-row").remove(),e(".edit-open").find(".drag-handle .set-pod").html(" - "+e(this).val())}),e(".layout-editor-body").on("click",".remove-where",function(){e(this).closest(".settings-panel-row").remove()}),e(".layout-editor-body").on("click",".use-pod-container",function(){var a=e(this),i=a.prev(),t=i.val();if(t.length){e(".edit-open").find(".drag-handle .set-pod").html(" - "+i.val()),a.parent().parent().find(".spinner").css("display","inline-block");var o={action:"pq_loadpod",pod_reference:{pod:t}};e.post(ajaxurl,o,function(i){a.parent().find(".spinner").css("display","none");var t=e("#where-line-tmpl").html(),o="",r=a.closest(".settings-panel").data("container");for(var l in i)o+='<option value="'+i[l]+'">'+i[l]+"</option>";t=t.replace(/{{fields}}/g,o).replace(/{{container_id}}/g,r),a.parent().append(t)})}}),e(".caldera-editor-header").on("click",".column-sort .icon-edit",function(e){}),e(".layout-editor-body").on("tray_loaded",".layout-template-tray",function(){t()}),e(".caldera-editor-header").on("click",".caldera-editor-header-nav a",function(a){a.preventDefault();var i=e(this);e(".caldera-editor-header-nav li").removeClass("active"),e(".caldera-editor-body").hide(),e(i.attr("href")).show(),i.parent().addClass("active"),rebind_field_bindings()}),e("body").on("change",".required",function(){check_required_bindings(this)}),e("body").on("submit",".caldera-forms-options-form",function(a){var i=e(".required.has-error");i.length&&a.preventDefault()}),e(".caldera-editor-body").on("click",".add-toggle-option",function(a){var i=e(this);if(i.data("bulk"))return e(i.data("bulk")).toggle(),void e(i.data("bulk")).find("textarea").focus();var t=i.closest(".caldera-editor-field-config-wrapper"),o=t.find(".toggle-options"),r=e("#field-option-row-tmpl").html(),l=Handlebars.compile(r),n="opt"+parseInt(1048576*(Math.random()+1)),d={_name:"config[fields]["+t.prop("id")+"][config]",option:{}};if(i.data("options")){for(var s=e(i.data("options")),c=s.val().split("\n"),p=!1,f=0;f<c.length;f++){var u=c[f],g=u,v=g.split("|");v.length>1&&(g=v[0],u=v[1],p=!0),d.option["opt"+parseInt(1048576*(Math.random()+f))]={value:g,label:u,"default":!1}}e(i.data("options")).parent().hide(),s.val(""),!0===p?t.find(".toggle_show_values").prop("checked",!0):t.find(".toggle_show_values").prop("checked",!1),o.empty()}else d.option[n]={value:"",label:"","default":!1};e(".preset_options").val(""),o.append(l(d)),t.find(".toggle_show_values").trigger("change"),e(".toggle-options").sortable({handle:".dashicons-sort"}),c||o.find(".toggle_label_field").last().focus()}),e(".caldera-editor-body").on("change",".preset_options",function(a){var i=e(this),t=i.val(),o=e(i.data("bulk"));preset_options&&preset_options[t]&&preset_options[t].data&&("object"==typeof preset_options[t].data&&preset_options[t].data.length&&(preset_options[t].data=preset_options[t].data.join("\n")),o.val(preset_options[t].data))}),e(".caldera-editor-body").on("click",".toggle-remove-option",function(a){var i=e(this).closest(".caldera-editor-field-config-wrapper").find(".field-config").first();e(this).parent().remove(),i.trigger("change"),e(document).trigger("option.remove")}),e(".caldera-editor-body").on("click",".page-toggle",function(a){var i=e(this),t=i.parent(),o=t.find(".button");o.removeClass("button-primary"),e(".layout-grid-panel").hide().removeClass("page-active"),e("#"+i.data("page")).show().addClass("page-active"),i.addClass("button-primary"),o.each(function(a,i){e(i).html(t.data("title")+" "+(a+1))}),1===o.length&&t.hide()}),e(".caldera-editor-body").on("blur toggle.values",".toggle_label_field",function(a){var i=e(this),t=i.prev();t.val().length||t.val(i.val())}),e(document).on("change focusout",".toggle_value_field",function(){e(document).trigger("show.fieldedit")}),e(document).on("show.fieldedit option.remove",function(a){e(".toggle_value_field.has-error").removeClass("has-error");for(var i=e("#"+e(".layout-form-field.field-edit-open").data("config")),t=i.find(".toggle_value_field"),o=i.find(".notice"),r=0,l=0;l<t.length;l++){for(var n=(t[l].value,0),d=0;d<t.length;d++)t[l]!==t[d]&&t[l].value===t[d].value&&(e(t[d]).addClass("has-error"),n++);n>0&&(e(t[l]).addClass("has-error"),r++)}r>0?(o.slideDown(),a.preventDefault()):o.slideUp()});var n=!1;focus_initial_field=function(a){var i=e(".layout-grid-panel .icon-edit").first();i.length?i.trigger("click"):(e(".layout-column.column-container").first().trigger("mouseover"),n=setInterval(o,500)),e(document).off("load.page",focus_initial_field)},e(document).on("load.page",focus_initial_field),cf_clear_puler=function(){n&&(clearTimeout(n),e(document).off("mouseover",".layout-new-form-field, .column-fieldinsert",cf_clear_puler)),e(".layout-new-form-field, .column-fieldinsert").fadeIn()},e(document).on("mouseover",".layout-new-form-field, .column-fieldinsert",cf_clear_puler),rebuild_field_binding(),e(document).trigger("load.page"),e("body").on("click",".caldera-processor-nav a",function(a){a.preventDefault();var i=e(this);e(".caldera-processor-nav").removeClass("active"),e(".caldera-editor-processor-config-wrapper").hide(),e(i.attr("href")).show(),i.parent().addClass("active")}),e("body").on("click",".add-new-processor",function(a){var i=e(this),t=Handlebars.compile(e("#processor-wrapper-tmpl").html());wrap=e(".active-processors-list"),process_conf=e(".caldera-editor-processor-config"),processid=Math.round(1e8*Math.random()),new_templ=Handlebars.compile(e("#processor-line-tmpl").html()),new_proc={id:"fp_"+processid,type:i.data("type")},wrap.append(new_templ(new_proc)),process_conf.append(t(new_proc)),e("#form_processor_baldrickModalCloser").trigger("click"),e(".caldera-processor-nav a").last().trigger("click"),e("#fp_"+processid+"_type").val(i.data("type")).trigger("change"),r(),baldrickTriggers()}),e("body").on("click",".delete-processor",function(a){var i=e(this),t=i.closest(".caldera-editor-processor-config-wrapper");t.data("type");confirm(i.data("confirm"))&&(e("."+t.prop("id")).remove(),t.remove(),e(".caldera-processor-nav a").first().trigger("click"),rebuild_field_binding())}),e("body").on("change",".caldera-select-processor-type",function(a){var i=e(this),t=i.closest(".caldera-editor-processor-config-wrapper"),o=i.find('option[value="'+i.val()+'"]').text(),r=t.find(".caldera-editor-processor-title"),n=e(".caldera-processor-nav.active a");""===o&&(o=r.data("title")),r.html(o),n.html(o+' <span class="processor-line-number"></span>').parent().addClass("processor_type_"+i.val()),l(this),rebuild_field_binding()}),e(document).on("click","#cf-shortcode-preview",function(){e(this).focus().select()}),e(document).on("change",".cf-email-preview-toggle",function(){var a=e(this),i=e(".caldera-header-email-preview-button");a.is(":checked")?i.show().attr("aria-hidden","false").css("visibility","visible"):i.hide().attr("aria-hidden","true").css("visibility","hidden")}),rebuild_field_binding(),e(".caldera-select-processor-type").each(function(e,a){l(a)}),r()}),Handlebars.registerHelper("_field",function(e){var a=this,i="",t="",o="",r=this[e.hash.slug]?' data-default="'+this[e.hash.slug]+'"':"";e.hash.required&&(i=" required"),e.hash.exclude&&(o='data-exclude="'+e.hash.exclude+'"'),e.hash.array&&(t="[]","true"!==e.hash.array&&(r='value="'+e.hash.array+'"')),out="<select "+(e.hash.type?'data-type="'+e.hash.type+'"':"")+r+" "+o+' name="'+this._name+"["+e.hash.slug+"]"+t+'" id="'+this._id+"_"+e.hash.slug+'" class="block-input field-config caldera-field-bind'+i+'">',this[e.hash.slug]?out+='<option class="bound-field" value="'+this[e.hash.slug]+'" class="bound-field"></option>':e.hash.required||(out+='<option value=""></option>');for(var l in current_form_fields){var n="";e.hash.type&¤t_form_fields[l].type!==e.hash.type||(a[e.hash.slug]&&a[e.hash.slug]===l&&(n=' selected="selected"'),out+='<option value="'+l+'"'+n+">"+current_form_fields[l].label+" ["+current_form_fields[l].slug+"]</option>")}return out+="</select>",e.hash.required&&(out+='<input class="field-config" name="'+this._name+'[_required_bounds][]" type="hidden" value="'+e.hash.slug+'">'),out}),Handlebars.registerHelper("console",function(e,a){console.log(this)});
|
1 |
+
function new_conditional_group(a){var b=a.trigger.data("id"),c="cl"+Math.round(18746582734*Math.random()),d="rw"+Math.round(98347598345*Math.random()),e=[{id:d,type:a.trigger.data("type"),lines:[{id:c}]}];return{group:e,id:b}}function new_conditional_line(a){var b=a.trigger.data("id"),c=a.trigger.data("group"),d=a.trigger.data("type"),e="cl"+Math.round(18746582734*Math.random()),f={id:b,type:d,lineid:e,rowid:c,name:"config["+d+"]["+b+"][conditions][group]["+c+"]["+e+"]"};return f}function build_conditions_config(a){var b=JSON.parse(a.trigger.val());return b.id=a.trigger.data("id"),b}function setup_field_type(a){return{id:a.trigger.prop("id")}}function check_required_bindings(a){var b,d=(jQuery(".caldera-header-save-button"),jQuery(".layout-form-field")),e=jQuery(".caldera-processor-nav"),f=!0;b=a?jQuery(a):jQuery(".caldera-config-field .required"),b.removeClass("has-error"),d.removeClass("has-error"),e.removeClass("has-error"),jQuery(".error-tag").remove(),required_errors={},b.each(function(a,b){var c=jQuery(b),d=c.closest(".caldera-config-editor-panel");if(b.value.length){if(c.hasClass("field-slug"))for(var h=jQuery(".field-slug").not(c),i=0;i<h.length;i++)if(h[i].value===b.value){var c=jQuery(h[i]);required_errors[d.prop("id")]||(required_errors[d.prop("id")]=0);var e=c.closest(".caldera-editor-field-config-wrapper"),g=c.closest(".caldera-editor-processor-config-wrapper");e.length&&jQuery('.layout-form-field[data-config="'+e.prop("id")+'"]').addClass("has-error"),g.length&&jQuery("."+g.prop("id")).addClass("has-error"),required_errors[d.prop("id")]+=1,c.addClass("has-error"),f=!1;break}if(c.hasClass("toggle_value_field"))for(var j=c.closest(".caldera-config-group").find(".toggle_value_field").not(c),i=0;i<j.length;i++)if(j[i].value===b.value){var c=jQuery(j[i]);required_errors[d.prop("id")]||(required_errors[d.prop("id")]=0);var e=c.closest(".caldera-editor-field-config-wrapper"),g=c.closest(".caldera-editor-processor-config-wrapper");e.length&&jQuery('.layout-form-field[data-config="'+e.prop("id")+'"]').addClass("has-error"),g.length&&jQuery("."+g.prop("id")).addClass("has-error"),required_errors[d.prop("id")]+=1,c.addClass("has-error"),f=!1;break}}else{required_errors[d.prop("id")]||(required_errors[d.prop("id")]=0);var e=c.closest(".caldera-editor-field-config-wrapper"),g=c.closest(".caldera-editor-processor-config-wrapper");e.length&&jQuery('.layout-form-field[data-config="'+e.prop("id")+'"]').addClass("has-error"),g.length&&jQuery("."+g.prop("id")).addClass("has-error"),required_errors[d.prop("id")]+=1,c.addClass("has-error"),f=!1}});for(var g in required_errors)jQuery(".caldera-forms-options-form").find('a[href="#'+g+'"]').append('<span class="error-tag">'+required_errors[g]+"</span>");return jQuery(".caldera-conditional-field-set").trigger("change"),f}jQuery(document).ready(function(a){function b(b){var d=a(b),e=d.closest(".caldera-editor-field-config-wrapper"),f=e.find(".caldera-config-field-setup"),g=compiled_templates[d.val()+"_tmpl"]?compiled_templates[d.val()+"_tmpl"]:compiled_templates.noconfig_field_templ,h=e.find(".field_config_string").val(),i=d.data("type");if(e.find(".caldera-config-group").show(),d.addClass("field-initialized"),h=h.length&&i===d.val()?JSON.parse(h):fieldtype_defaults[d.val()+"_cfg"],h||(h={}),h._id=d.data("field"),h._name="config[fields]["+d.data("field")+"][config]",g=a("<div>").html(g(h)),f.html(g.html()),"function"==typeof window[d.val()+"_init"]&&window[d.val()+"_init"](d.data("field"),f),fieldtype_defaults[d.val()+"_nosupport"]&&(fieldtype_defaults[d.val()+"_nosupport"].indexOf("hide_label")>=0&&e.find(".hide-label-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[d.val()+"_nosupport"].indexOf("caption")>=0&&e.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("required")>=0&&e.find(".required-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[d.val()+"_nosupport"].indexOf("custom_class")>=0&&e.find(".customclass-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("entry_list")>=0&&e.find(".entrylist-field").hide().find(".field-config").prop("checked",!1)),e.find(".toggle_show_values").trigger("change"),!a(".caldera-select-field-type").not(".field-initialized").length){if(core_form||(core_form=jQuery(".caldera-forms-options-form")),core_form.hasClass("builder-loaded"))c(d.data("field"));else{for(var j=a(".caldera-select-field-type.field-initialized"),k=0;k<j.length;k++)c(a(j[k]).data("field"));core_form.addClass("builder-loaded")}a(".caldera-header-save-button").prop("disabled",!1),rebuild_field_binding(),baldrickTriggers()}a(".color-field").length&&a(".color-field").wpColorPicker({change:function(b){var c=a(this);c.data("ev")&&clearTimeout(c.data("ev")),c.data("ev",setTimeout(function(){c.trigger("record")},200)),c.data("target")&&(a(c.data("target")).css(c.data("style"),c.val()),a(c.data("target")).val(c.val()))}})}function c(b){var c=a("#"+b),d=c.find(".caldera-select-field-type"),e=a('.layout-form-field[data-config="'+b+'"]'),f=e.find(".field_preview"),h=(a("#preview-"+d.val()+"_tmpl").html(),compiled_templates["preview-"+d.val()+"_tmpl"]),i={id:b},j=c.find(".field-config");j.each(function(c,d){for(var e=a(d),f=e.prop("name").split("["+b+"]")[1].substr(1),g=f.substr(0,f.length-1).split("]["),h=e.is(":checkbox,:radio")?e.filter(":checked").val():e.val(),j={},k=g.length-1;k>=0;k--)if(k===g.length-1)j[g[k]]=h;else{var l=j;j={},j[g[k]]=l}a.extend(!0,i,j)}),f.html(h(i)),e.removeClass("button"),a(".preview-field-config").prop("disabled",!0)}function d(b){var t,c=a(".caldera-editor-fields-panel"),e=(a(".caldera-editor-groups-panel"),a(".caldera-group-nav")),f=a('[data-group="'+b+'"]'),g=f.find(".caldera-config-group-name"),h=f.find(".caldera-config-group-slug"),i=f.find(".caldera-config-group-desc"),j=f.find(".caldera-config-group-admin"),k=a(".active-group-name"),l=a(".active-group-slug"),m=a(".active-group-desc"),n=a(".active-group-admin"),o=a(".caldera-editor-fields-list ul"),p=f.find(".caldera-config-group-repeat"),q=a(".repeat-config-button"),s=(a(".caldera-editor-group-settings"),a(".caldera-config-group-remove"));a(".new-group-input").remove(),a(".new-field-input").remove(),e.removeClass("active"),c.show(),o.hide(),o.removeClass("active").find("li.active").removeClass("active"),o.hide(),f.addClass("active"),t=a(".caldera-editor-fields-list ul.active li"),t.length?s.hide():s.show(),a(".caldera-editor-field-config-wrapper").hide(),f.show(),k.val(g.val()),l.val(h.val()),m.val(i.val()),"1"===j.val()?n.prop("checked",!0):n.prop("checked",!1),"1"===p.val()?q.addClass("field-edit-open"):q.removeClass("field-edit-open")}a(".caldera-header-save-button").baldrick({method:"POST",request:"admin.php?page=caldera-forms",before:function(b,c){if(c.preventDefault(),!check_required_bindings())return!1;a("#save_indicator").addClass("loading"),"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();var d=a(".caldera-forms-options-form").formJSON();return d.conditions&&(d.config.conditional_groups={conditions:d.conditions}),a(b).data("cf_edit_nonce",d.cf_edit_nonce),a(b).data("_wp_http_referer",d._wp_http_referer),a(b).data("sender","ajax"),a(b).data("config",JSON.stringify(d.config)),!0},callback:function(b){if(!1===b.data){var c=a(".updated_notice_box");c.stop().animate({top:0},200,function(){setTimeout(function(){c.stop().animate({top:-75},200)},2e3)})}},complete:function(b){a(".wrapper-instance-pane .field-config").prop("disabled",!1)}}),a("body").on("click",".toggle_processor_event input",function(b){var c=a(this),d=c.closest(".wrapper-instance-pane"),e=d.find(".caldera-config-processor-setup"),f=d.find(".caldera-config-processor-notice");c.is(":checked")?(c.parent().addClass("activated"),c.parent().find(".is_active").show().attr("aria-hidden",!1).css("visibility","visible"),c.parent().find(".not_active").hide().attr("aria-hidden",!0).css("visibility","hidden")):(c.parent().removeClass("activated"),c.parent().find(".is_active").hide().attr("aria-hidden",!0).css("visibility","hidden"),c.parent().find(".not_active").show().attr("aria-hidden",!1).css("visibility","visible")),d.find(".toggle_processor_event .activated").length?(e.slideDown(100),f.slideUp(100)):(e.slideUp(100),f.slideDown(100))}),a("body").on("click",".toggle_option_tab > a",function(b){b.preventDefault();var c=a(this),d=a(c.attr("href")),e=c.parent().find("a"),f=c.closest(".caldera-editor-config-wrapper").find(".wrapper-instance-pane");e.removeClass("button-primary"),f.hide(),d.show(),c.addClass("button-primary"),a(".caldera-conditionals-usetype").trigger("change")}),a(".caldera-editor-body").on("change",".caldera-select-field-type",function(a){b(this)}),a(".caldera-editor-body").on("click",".caldera-group-nav a",function(b){b.preventDefault(),d(a(this).attr("href").substr(1))}),a(".caldera-editor-body").on("click",".caldera-editor-fields-list a",function(b){b.preventDefault();var c=a(this),d=a(c.attr("href"));a(".new-group-input").remove(),a(".new-field-input").remove(),a(".caldera-editor-fields-list li.active").removeClass("active"),c.parent().addClass("active"),a(".caldera-editor-field-config-wrapper").hide(),d.show()}),a(".caldera-editor-body").on("click",".group-config-button",function(b){var c=a(this),d=a(".caldera-editor-group-settings"),e=c.closest(".caldera-editor-fields-panel"),f=a(".caldera-config-group-remove");e.find(".caldera-field-line").length?f.hide():f.show(),c.hasClass("field-edit-open")?(d.slideUp(100),c.removeClass("field-edit-open")):(d.slideDown(100),c.addClass("field-edit-open"))}),a(".caldera-editor-body").on("keydown",".field-config",function(b){a(this).is("textarea")||13===b.which&&b.preventDefault()}),a(".caldera-editor-body").on("change",".field-label",function(b){var c=a(this).closest(".caldera-editor-field-config-wrapper").prop("id");field_line=a('[data-field="'+c+'"]'),field_title=a("#"+c+" .caldera-editor-field-title, .layout-form-field.field-edit-open .layout_field_name"),slug=a("#"+c+" .field-slug"),field_line.find("a").html('<i class="icn-field"></i> '+this.value),field_title.text(this.value),"change"===b.type&&slug.trigger("change"),rebuild_field_binding()}),a(".caldera-editor-body").on("change",".active-group-name",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-name")),f=c.find("span");"focusout"!==b.type||this.value.length||(this.value="Group "+(parseInt(c.index())+1)),e.val(this.value),f.text(this.value)}),a(".caldera-editor-body").on("change",".active-group-slug",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-name").val()),f=c.find(".caldera-config-group-slug"),h=(c.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase());"focusout"!==b.type||this.value.length||(h=e.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase()),f.val(h),this.value=h}),a(".caldera-editor-body").on("change",".active-group-desc",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-desc"));e.val(this.value)}),a(".caldera-editor-body").on("change",".active-group-admin",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),f=(c.data("group"),c.find(".caldera-config-group-name").val(),c.find(".caldera-config-group-admin"));c.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase();a(this).prop("checked")?(f.val(1),c.addClass("is-admin")):(f.val(0),c.removeClass("is-admin"))}),a(".caldera-editor-body").on("click",".repeat-config-button",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find("a .group-type")),f=c.find(".caldera-config-group-repeat"),g=a(this);g.hasClass("field-edit-open")?(f.val("0"),e.removeClass("icn-repeat").addClass("icn-folder"),g.removeClass("field-edit-open")):(f.val("1"),e.addClass("icn-repeat").removeClass("icn-folder"),g.addClass("field-edit-open"))}),a(".caldera-editor-body").on("click",".delete-field",function(){var b=a(this),c=b.closest(".caldera-editor-field-config-wrapper").prop("id");confirm(b.data("confirm"))&&(a("#"+c).remove(),a('option[value="'+c+'"]').remove(),a('[data-bind="'+c+'"]').remove(),delete current_form_fields[c],a('[data-config="'+c+'"]').slideUp(200,function(){var b=a(this);b.remove(),rebuild_field_binding(),a(document).trigger("field.removed")}))}),a(".caldera-editor-body").on("click",".add-new-group,.add-field",function(){var b=a(this);if(a(".new-group-input").remove(),a(".new-field-input").remove(),b.hasClass("add-field")){var c=a('<input type="text" class="new-field-input block-input">');c.appendTo(a(".caldera-editor-fields-list ul.active")).focus()}else{var d=a('<input type="text" class="new-group-input block-input">');d.appendTo(a(".caldera-editor-groups-panel")).focus()}}),a(".caldera-editor-body").on("change keypress",".new-group-input",function(b){if("keypress"===b.type){if(13!==b.which)return;b.preventDefault()}var h,i,c=this.value,e=a(this),f=a(".caldera-editor-groups-panel ul"),g=a(".caldera-editor-fields-list");if(c.length){h=Handlebars.compile(a("#caldera_group_line_templ").html()),i={id:c.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),name:c},f.append(h(i));var j=a('<ul data-group="'+i.id+'">').hide();j.appendTo(g),e.remove(),d(i.id)}else e.remove()}),a(".caldera-editor-body").on("change keypress",".new-field-input",function(b){if("keypress"===b.type){if(13!==b.which)return;b.preventDefault()}var g,h,i,c=this.value,d=a(this),e=d.parent(),f=a(".caldera-editor-field-config"),j=a(".caldera-config-group-remove");if(c.length){j.hide(),g=Handlebars.compile(a("#caldera_field_line_templ").html()),h=Handlebars.compile(a("#caldera_field_config_wrapper_templ").html()),i={id:c.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),label:c,slug:c.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),group:a(".caldera-group-nav.active").data("group")};var k=a(g(i));k.appendTo(e),f.append(h(i)),k.find("a").trigger("click"),d.remove()}else d.remove()}),a(".caldera-editor-body").on("change",".field-slug",function(b){this.value.length?this.value=this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase():"change"===b.type&&(this.value=a(this).closest(".caldera-editor-field-config-wrapper").find(".field-label").val().split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase())}),a(".caldera-editor-body").on("click",".caldera-add-group",function(b){var c=a(this),d=c.data("group"),e=a("#"+d+"_panel_tmpl").html();c.parent().parent().append(e)}),a(".caldera-editor-body").on("click",".caldera-config-group-remove",function(b){var c=a(".active-group-slug").val();a('[data-group="'+c+'"]').hide(0,function(){a(this).remove();var b=a(".caldera-group-nav");b.length?b.first().find("a").trigger("click"):a(".caldera-editor-fields-panel").hide()})}),a("body").on("click",".set-current-field",function(b){b.preventDefault();var c=a(this);a("#"+c.data("field")+"_type").val(c.data("type")).trigger("change"),a("#"+c.data("field")+"_lable").focus(),a("#field_setup_baldrickModalCloser").trigger("click")}),a(".caldera-editor-body").on("change record",".field-config",function(b){var d=a(this),e=d.closest(".caldera-editor-field-config-wrapper");current_form_fields&&(d.prop("id")===e.prop("id")+"_lable"&&(current_form_fields[e.prop("id")].label=this.value),d.prop("id")===e.prop("id")+"_slug"&&(current_form_fields[e.prop("id")].slug=this.value),d.prop("id")===e.prop("id")+"_type"&&(current_form_fields[e.prop("id")].type=this.value),e.length&&c(e.prop("id")))}),a(".caldera-editor-body").on("focus",".caldera-field-bind",function(b){var c=a(this),d=this.value;if(b.type&&"focusin"===b.type)return c.removeClass("bound_field").addClass("reload-binding"),rebind_field_bindings(),void(this.value=d)}),a(".caldera-editor-body").on("change",".caldera-conditional-field-set",function(b){var k,l,c=a(this),d=c.parent().find(".compare-type"),e=c.data("condition"),f=c.data("id"),g="config["+e+"]["+f+"][conditions][group]["+c.data("row")+"]["+c.data("line")+"]",h=c.data("line"),i=a("#"+h+"_value"),j=i.find(".caldera-conditional-value-field").first(),m=[],n=this.value;if("{"!==n.substr(0,1)&&(k=a("#"+n),l=k.find(".field-button-type"),m=k.find(".caldera-config-group-toggle-options")),c.hasClass(".bind_init")&&c.addClass("bound_triggered"),j.length&&j.val().length&&i.data("value",j.val()),d.show(),m.length){var o=m.find(".toggle_option_row"),p='<select name="'+g+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+n+'" style="max-width: 220px; width: 220px;">';p+='<option value=""></option>',o.each(function(b,c){var d=a(c).find(".toggle_label_field"),e=d.data("option"),f="";i.data("value")&&(i.data("value").toString()!==e&&i.data("value").toString()!==a(c).find(".toggle_value_field").val()||(f=' selected="selected"')),p+='<option value="'+e+'"'+f+">"+d.val()+"</option>"}),p+="</select>"}else l&&"button"==l.val()?(d.val("is").hide(),p='<select name="'+g+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+n+'" style="max-width: 220px; width: 220px;">',p+='<option value="click" '+("click"===i.data("value")?'selected="selected"':"")+">Click</option>",p+='<option value="dblclick" '+("dblclick"===i.data("value")?'selected="selected"':"")+">Double Click</option>",p+="</select>"):p='<input name="'+g+'[value]" type="text" class="caldera-conditional-value-field magic-tag-enabled" value="'+(i.data("value")?i.data("value"):"")+'" style="max-width: 205px;">';i.html(p),init_magic_tags()}),a(".caldera-editor-body").on("change",".caldera-conditionals-usetype",function(b){var c=a(this);"show"===this.value||"hide"===this.value||"disable"===this.value||"use"===this.value||"not"===this.value?(a("#"+c.data("id")+"_condition_group_add").show(),a("#"+c.data("id")+"_conditional_wrap").show()):(a("#"+c.data("id")+"_condition_group_add").hide(),a("#"+c.data("id")+"_conditional_wrap").hide())}),a(".caldera-editor-body").on("click",".remove-conditional-line",function(b){b.preventDefault();var c=a(this),d=c.closest(".caldera-condition-line"),e=c.closest(".caldera-condition-group");d.remove(),e.find(".caldera-condition-line").length||e.remove()}),a(".caldera-group-nav").first().find("a").trigger("click"),a(".caldera-editor-body").on("change",".toggle_show_values",function(b){var c=a(this),d=c.closest(".caldera-config-group-toggle-options");values=d.find(".toggle_value_field"),lables=d.find(".toggle_label_field"),field_lables=d.find(".caldera-config-group-option-labels"),c.prop("checked")?(values.show().parent().show(),values.show().parent().parent().show(),lables.css("width",""),field_lables.show()):(values.hide().parent().hide(),lables.css("width",245),field_lables.hide()),lables.trigger("toggle.values"),init_magic_tags()}),a(".caldera-editor-body").on("change",".auto-populate-type",function(){a(this).closest(".wrapper-instance-pane").find(".auto-populate-options").trigger("change")}),a(".caldera-editor-body").on("change",".auto-populate-options",function(){var b=a(this),c=b.closest(".wrapper-instance-pane"),d=c.find(".caldera-config-group-toggle-options"),e=c.find(".caldera-config-group-auto-options"),f=e.find(".auto-populate-type");e.find(".auto-populate-type-panel").hide(),b.prop("checked")?(d.hide(),e.show()):(d.show(),e.hide()),e.find(".caldera-config-group-auto-"+f.val()).show()}),a("body").on("change",".pin-toggle-roles",function(){var b=a(this),c=a("#caldera-pin-rules");"1"===b.val()?c.show():c.hide()}),a("body").on("click",".magic-tag-init",function(b){var c=a(this),d=c.prev();d.focus().trigger("init.magic")}),a("body").on("keyup focus select click init.magic",".magic-tag-enabled",function(b){init_magic_tags();var c=a(this),d=c.parent(),e=d.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val()?d.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val():"hidden",f=d.find(".magic-tags-autocomplete"),g=f.find("ul"),h=this.value,j=[],k="",l=this.selectionStart,m=this.selectionEnd;if(f.length&&f.data("focus"))return void b.preventDefault();if(c.data("tag",""),this.selectionEnd>this.selectionStart)k=this.value.substr(this.selectionStart,this.selectionEnd-this.selectionStart);else if(("select"===b.type||"keyup"===b.type)&&40!==b.which&&38!==b.which&&39!==b.which&&37!==b.which){for(l=this.selectionStart;l>0;l--){var n=h.substr(l-1,1);if(" "===n||"\n"===n||("%"===n||"}"===n)&&this.selectionStart===l)break}for(m=this.selectionStart;m<h.length;m++){var n=h.substr(m,1);if(" "===n||"\n"===n||("%"===n||"{"===n)&&this.selectionStart===m)break}k=h.substr(l,m-l)}if("focusout"!==b.type){"init"!==b.type&&k.length<3&&f.length&&f.remove(),f.length||(f=a('<div class="magic-tags-autocomplete"></div>'),g=a("<ul></ul>"),g.appendTo(f),f.insertAfter(c),f.on("mouseenter",function(){a(this).data("focus",!0)}),f.on("mouseleave",function(){a(this).data("focus",!1),setTimeout(function(){f.remove()},200),c.is(":focus")||c.trigger("focusout")})),g.empty();var o="system",p=!1;"hidden"===e||"dropdown"===e||"radio"===e||"toggle_switch"===e||"checkbox"===e?(p=!0,e="text",o="all"):"paragraph"!==e&&"html"!==e||(e="text"),c.data("type")&&(e=c.data("type")),e=e.split(","),e.push("vars");for(var q=0;q<e.length;q++)for(var r in system_values)if("undefined"!=typeof system_values[r].tags&&"undefined"!=typeof system_values[r].tags[e[q]]){if(j=[r],"system"!==r&&"variable"!==r&&"field"!==r){var s=jQuery(".processor-"+r),t=c.closest(".caldera-editor-processor-config-wrapper"),u=t.prop("id");j=[];for(var v=0;v<s.length;v++)if(t.length||p!==!0){if(u===s[v].id)continue;jQuery("li."+s[v].id).index()<jQuery("li."+u).index()&&j.push(s[v].id)}else j.push(s[v].id)}for(var w=0;w<j.length;w++)if("all"===o||o===r||"variable"===r){var x=a('<li class="header">'+system_values[r].type+(w>0?" ["+(w+1)+"]":"")+"</li>"),y=0;x.appendTo(g);for(var z=0;z<system_values[r].tags[e[q]].length;z++)if(!c.data("parent")||"variable:"+c.data("parent")!==system_values[r].tags[e[q]][z]){var A=system_values[r].wrap[0]+system_values[r].tags[e[q]][z]+system_values[r].wrap[1];if(j[w]!==r&&j.length>1&&(A=system_values[r].wrap[0]+system_values[r].tags[e[q]][z]+":"+j[w]+system_values[r].wrap[1]),A.indexOf(k)>=0||"init"===b.type){y+=1;var B=A.replace(k,"<strong>"+k+"</strong>"),C=a('<li class="tag" data-tag="'+A+'">'+B+"</li>");C.on("click",function(){var b=a(this).data("tag");c.val(h.substr(0,l)+b+h.substr(m)).trigger("change").focus(),c[0].selectionStart=l+b.length-(b.indexOf("*")>0?2:0),c[0].selectionEnd=l+b.length-(b.indexOf("*")>0?1:0),m=l=c[0].selectionEnd,h+=b,c.trigger("init.magic")}),C.appendTo(g)}}0===y&&x.remove()}}}g.children().length||f.remove(),"focusout"===b.type&&setTimeout(function(){f.remove()},200)});for(var e=a(".cf-editor-template"),f=0;f<e.length;f++)compiled_templates[e[f].id]=Handlebars.compile(e[f].innerHTML);a(".caldera-select-field-type").not(".field-initialized").each(function(a,c){b(c)})});var rebuild_field_binding,rebind_field_bindings,current_form_fields={},required_errors={},add_new_grid_page,add_page_grid,init_magic_tags,core_form,compiled_templates={};init_magic_tags=function(){var a=jQuery(".magic-tag-enabled");a.each(function(a,b){var c=jQuery(b);if(c.hasClass("magic-tag-init-bound")){var d=c.parent().find(".magic-tag-init");return void(c.is(":visible")?d.show():d.hide())}var e=jQuery('<span class=""></span>'),f=jQuery('<span style="position:relative;display:inline-block; width:100%;"></span>');c.is("input")&&e.css("borderBottom","none"),c.hasClass("caldera-conditional-value-field")&&f.width("auto"),c.wrap(f),e.insertAfter(c),c.addClass("magic-tag-init-bound"),c.is(":visible")?e.show():e.hide()})},rebuild_field_binding=function(){if(core_form||(core_form=jQuery(".caldera-forms-options-form")),core_form.hasClass("builder-loaded")){var a=jQuery(".caldera-editor-field-config-wrapper");system_values.field={tags:{text:[]},type:"Fields",wrap:["%","%"]};for(var b=0;b<a.length;b++){var c=a[b].id,d=jQuery("#"+c+"_lable").val(),e=jQuery("#"+c+"_slug").val(),f=jQuery("#"+c+"_type").val();"undefined"==typeof system_values.field.tags[f]&&(system_values.field.tags[f]=[]),system_values.field.tags[f].push(e),"text"!==f&&system_values.field.tags.text.push(e),current_form_fields[c]={label:d,slug:e,type:f},jQuery("option.bound-field").trigger("change").each(function(a,b){var c=jQuery(b);0!==c.prop("value").indexOf("{")?c.text(jQuery("#"+c.prop("value")+"_lable").val()+" ["+jQuery("#"+c.prop("value")+"_lable").val()+"]"):c.text(c.prop("value").replace("{","").replace("}",""))}).removeClass("bound-field")}}},rebind_field_bindings=function(){var b,c,a=jQuery(".caldera-field-bind").not(".bound_field");if(a.length){a.addClass("bound_field");for(var d=0;d<a.length;d++){var e=jQuery(a[d]),f=e.val(),g=e.data("default"),h=e.data("exclude"),i=0,j=e.closest(".caldera-editor-processor-config-wrapper"),k=j.prop("id"),l="";if(g&&!e.hasClass("reload-binding")&&(f=g),e.is("select")){e.empty();var m=jQuery('<optgroup label="Fields">');for(var n in current_form_fields)e.data("type")&&e.data("type").split(",").indexOf(current_form_fields[n].type)<0||(e.data("id")!==n&&m.append('<option value="'+n+'"'+(f===n?'selected="selected"':"")+">"+current_form_fields[n].label+" ["+current_form_fields[n].slug+"]</option>"),i+=1);m.appendTo(e),0===i&&e.empty();for(var o in system_values)if(b=[],!(h&&h.split(",").indexOf(o)>=0)){if("system"!==o&&"variable"!==o)for(var p=jQuery(".processor-"+o),q=0;q<p.length;q++)k!==p[q].id&&(b.push(p[q].id),p.length>1&&(c=jQuery("li."+p[q].id+" .processor-line-number"))&&c.html("["+(q+1)+"]"));else b.push("__system__");var r=[];e.data("type")?(r=e.data("type").split(","),r.push("vars")):r=["text","vars"];for(var s=0;s<r.length;s++)if(system_values[o].tags&&system_values[o].tags[r[s]])for(var t=0;t<b.length;t++){jQuery("li."+b[t]).index()>jQuery("li."+k).index()&&"__system__"!==b[t]?e.closest(".caldera-editor-processors-panel-wrap").length&&(l=' disabled="disabled"'):l="";for(var m=jQuery('<optgroup label="'+system_values[o].type+("__system__"!==b[t]?" "+jQuery("li."+b[t]).find(".processor-line-number").html():"")+'"'+l+">"),u=0;u<system_values[o].tags[r[s]].length;u++){var v=system_values[o].tags[r[s]][u];"__system__"!==b[t]&&(v=v.replace(o,b[t])),m.append('<option value="{'+v+'}"'+(f==="{"+v+"}"?'selected="selected"':"")+l+">"+system_values[o].tags[r[s]][u]+"</option>"),i+=1}m.children().length&&m.appendTo(e)}}if(0===i){if(e.empty(),e.data("type")){e.append('<option value="">No '+e.data("type").split(",").join(" or ")+" in form</option>");var w=!0}}else e.prop("disabled",!1);e.hasClass("required")||"undefined"!=typeof w||e.prepend('<option value=""></option>'),e.val(f)}}init_magic_tags(),jQuery(document).trigger("bound.fields"),jQuery(".caldera-header-save-button").prop("disabled",!1)}},jQuery(document).ready(function(a){function b(){var b=a(".layout-grid-panel"),c=0;b.each(function(b,d){var e=a(d),f=e.find(".layout-structure"),g=e.find(".row"),h=[];g.each(function(b,d){var e=a(d),f=e.children().not(".column-merge"),g=[];c+=1,f.each(function(b,d){span=a(d).attr("class").split("-"),g.push(span[2]);var e=a(d).find(".field-location");e.length&&e.each(function(d,e){var f=a(e);f.val(c+":"+(b+1)).removeAttr("disabled")})}),h.push(g.join(":"))}),f.val(h.join("|"))})}function c(b,c,e){var i,j,f="fld_"+Math.round(1e7*Math.random()),g=f,h=a("#field_config_panels");b.prop("id","").prop("title",""),i=Handlebars.compile(a("#caldera_field_config_wrapper_templ").html()),j=a.extend({},{id:g,label:"",slug:""},e),j.slug="",h.append(i(j)),b.removeClass("button-small").removeClass("button").removeClass("button-primary").removeClass("ui-draggable").removeClass("layout-new-form-field").addClass("layout-form-field").attr("data-config",f).css({display:"",opacity:""}),b.find(".layout_field_name").remove(),b.find(".field-location").prop("name","config[layout_grid][fields]["+f+"]"),b.find(".settings-panel").show(),b.appendTo(c),d(),b.find(".icon-edit").trigger("click"),a("#"+f+"_lable").focus().select(),baldrickTriggers(),a(document).trigger("field.added"),e?a("#"+g+"_type").data("type",j.type).trigger("change"):a("#"+f).trigger("field.drop"),rebuild_field_binding()}function d(){a(".toggle-options").sortable({handle:".dashicons-sort"}),a("#grid-pages-panel").sortable({placeholder:"row-drop-helper",handle:".sort-handle",items:".first-row-level",axis:"y",stop:function(){b()}}),a(".layout-column").sortable({connectWith:".layout-column",appendTo:"#grid-pages-panel",helper:"clone",items:".layout-form-field",handle:".drag-handle",cursor:"move",opacity:.7,cursorAt:{left:100,top:15},start:function(a,b){b.helper.css({width:"200px",height:"35px",paddingTop:"20px"})},stop:function(a,c){c.item.removeAttr("style"),b()}}),a("h3 .layout-new-form-field").draggable({helper:"clone",appendTo:"body"}),a(".page-toggle.button").droppable({accept:".layout-form-field",over:function(b,c){a(this).trigger("click"),a(".layout-column").sortable("refresh")}}),a(".layout-column").droppable({greedy:!0,activeClass:"ui-state-dropper",hoverClass:"ui-state-hoverable",accept:".layout-new-form-field",drop:function(b,d){var e=d.draggable.clone(),f=a(this);c(e,f)}}),b()}function g(){if(e){var b=a(".column-fieldinsert");b.length?(b.stop().fadeToggle(700),a(".layout-new-form-field").stop().fadeToggle(700)):cf_clear_puler()}}function h(){a(".caldera-editor-processors-panel ul").sortable({update:function(){rebuild_field_binding()}})}function i(b){var c=a(b),d=a("#"+c.val()+"-tmpl").length?a("#"+c.val()+"-tmpl").html():"",e=c.closest(".caldera-editor-processor-config-wrapper"),f=e.find(".caldera-config-processor-setup"),g=Handlebars.compile(d),h=e.find(".processor_config_string").val(),i=c.data("type");h=h.length&&i===c.val()?JSON.parse(h):processor_defaults[c.val()+"_cfg"],h||(h={}),h._id=e.prop("id"),h._name="config[processors]["+e.prop("id")+"][config]",g=a("<div>").html(g(h)),f.html(g.html()),"function"==typeof window[c.val()+"_init"]&&window[c.val()+"_init"](e.prop("id"),f),e.find(".no-conditions").length&&e.find(".toggle_option_tab").remove(),rebuild_field_binding(),baldrickTriggers(),a(".wp-baldrick").baldrick({request:ajaxurl,method:"POST",before:function(b){var c=a(b);c.data("addNode")&&!c.data("request")&&c.data("request","cf_get_default_setting")}})}add_new_grid_page=function(a){return{page_no:"pg_"+Math.round(1e7*Math.random())}},add_page_grid=function(b){var c=a(".page-toggle").length+1,e=a('<button type="button" data-name="Page '+c+'" data-page="'+b.rawData.page_no+'" class="page-toggle button">'+b.params.trigger.data("addtitle")+" "+c+"</button> "),f=a("#page-toggles");e.appendTo(f),f.show(),d(),e.trigger("click"),1===c&&f.hide(),a(document).trigger("add.page")},a(document).on("remove.page add.page load.page",function(b){var c=a(".page-toggle").length,d=a("#tab_pages");c<=1?d.hide():d.show()}),d(),a("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-plus-alt",function(b){var d=a(this).closest(".column-container"),e=a("#newfield-tool").clone().css("display","");c(e,d)}),a("#grid-pages-panel").on("click",".column-split",function(b){var c=a(this).parent().parent(),e=c.attr("class").split("-"),f=a("<div>").insertAfter(c),g=Math.ceil(e[2]/2),h=Math.floor(e[2]/2);e[2]=g,c.attr("class",e.join("-")),e[2]=h,f.addClass(e.join("-")).append('<div class="layout-column column-container">'),a(this).remove(),d(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("click",".column-remove",function(c){var d=a(this).closest(".row"),e=d.find(".layout-form-field"),f=d.closest(".layout-grid-panel");if(e.length){if(!confirm(a("#row-remove-fields-message").text()))return;e.each(function(b,c){var d=a(c).data("config");
|
2 |
+
a("#"+d).remove(),a('option[value="'+d+'"]').remove(),a('[data-bind="'+d+'"]').remove(),delete current_form_fields[d]})}d.slideUp(200,function(){if(a(this).remove(),b(),rebuild_field_binding(),!f.find(".row").length){f.remove();var c=a("#page-toggles .button-primary"),d=c.prev(),e=c.next();c.remove(),d.length?d.trigger("click"):e.trigger("click")}a(document).trigger("remove.page")}),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a(".caldera-config-editor-main-panel").on("click",".caldera-add-row",function(c){c.preventDefault();var e=a(".page-active");if(!e.length)return void a(".caldera-add-page").trigger("click");var f=a('<div style="display:none;" class="first-row-level row"><div class="col-xs-12"><div class="layout-column column-container"></div></div></div>');a(".page-active").append(f),f.slideDown(200),d(),b()}),a("#grid-pages-panel").on("click",".column-join",function(c){var d=a(this).parent().parent().parent(),e=d.prev(),f=e.attr("class").split("-"),g=d.attr("class").split("-");f[2]=parseFloat(f[2])+parseFloat(g[2]),d.find(".layout-column").contents().appendTo(e.find(".layout-column")),e.attr("class",f.join("-")),d.remove(),b(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("mouseenter",".row",function(c){var d=jQuery(this);jQuery(".column-tools,.column-merge").remove(),d.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>'),d.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>'),d.children().children().not(":first").prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');var e=d.parent().parent().parent().width()/12-1;d.children().children().each(function(b,c){var d=a(c),e=d.width()/2-5;d.prepend('<div class="column-fieldinsert column-tools"><i class="dashicons dashicons-plus-alt"></i></div>'),d.parent().hasClass("col-xs-1")||(d.prepend('<div class="column-split column-tools"><i class="dashicons dashicons-leftright"></i></div>'),d.find(".column-split").css("left",e))}),jQuery(".column-merge").draggable({axis:"x",helper:"clone",appendTo:d,grid:[e,0],drag:function(c,d){a(this).addClass("dragging"),a(".column-tools").remove(),a(".column-split").remove();var e=a(this).parent().parent(),f=d.helper,g=d.originalPosition.left>f.position().left?"left":"right",i=e.prev(),j=Math.round(e.parent().width()/12-10),k=Math.abs(d.originalPosition.left-f.position().left);if(e.parent().addClass("sizing"),k>=j){var l=i.attr("class").split("-"),m=e.attr("class").split("-");l[2]=parseFloat(l[2]),m[2]=parseFloat(m[2]),"left"===g?(l[2]--,m[2]++,l[2]>0&&l[2]<l[2]+m[2]?(i.attr("class",l.join("-")),e.attr("class",m.join("-")),d.originalPosition.left=f.position().left):a(this).draggable("option","disabled",!0)):(l[2]++,m[2]--,m[2]>0&&m[2]<m[2]+m[2]?(i.attr("class",l.join("-")),e.attr("class",m.join("-")),d.originalPosition.left=f.position().left):a(this).draggable("option","disabled",!0)),b()}},stop:function(){a(this).removeClass("dragging").parent().parent().parent().removeClass("sizing")}})}),a("#grid-pages-panel").on("mouseleave",".row",function(a){jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("click",".layout-form-field .icon-remove",function(){var b=a(this),c=b.parent(),d=a("#"+c.data("config"));c.slideUp(100,function(){a(this).remove()}),d.slideUp(100,function(){a(this).remove()})}),a(document).on("click",".layout-form-field .dashicons-admin-page",function(){var b=a(this),d=b.parent(),e=d.data("config"),f=a("#"+e).formJSON(),g=b.closest(".column-container"),h=d.clone().css("display",""),i={};d.hasClass("field-edit-open")&&(d.removeClass("field-edit-open"),h.removeClass("field-edit-open"),a(".caldera-editor-field-config-wrapper").hide()),f.config.fields[e]&&(i=f.config.fields[e],delete i.ID),c(h,g,i)}),a(document).on("click",".layout-form-field .icon-edit",function(){var b=a(this),c=b.parent(),d=a("#"+c.data("config")+"_type").val();a(".caldera-editor-field-config-wrapper").hide(),c.hasClass("field-edit-open")?c.removeClass("field-edit-open"):(a(".layout-form-field").removeClass("field-edit-open"),c.addClass("field-edit-open"),a("#"+c.data("config")).show()),a(document).trigger("show."+c.data("config")),a(document).trigger("show.fieldedit"),"radio"!==d&&"checkbox"!==d&&"dropdown"!==d&&"toggle_switch"!==d||a("#"+c.data("config")+"_auto").trigger("change")}),a("body").on("click",".layout-modal-edit-closer,.layout-modal-save-action",function(b){b.preventDefault();var c=a(this),d=a(".layout-form-field.edit-open"),e=c.closest(".layout-modal-container");settings=e.find(".settings-panel").first(),a(".edit-open").removeClass("edit-open"),settings.appendTo(d.find(".settings-wrapper")).hide(),e.hide()}),a(".layout-editor-body").on("change",".layout-core-pod-query",function(){a(this).parent().find(".settings-panel-row").remove(),a(".edit-open").find(".drag-handle .set-pod").html(" - "+a(this).val())}),a(".layout-editor-body").on("click",".remove-where",function(){a(this).closest(".settings-panel-row").remove()}),a(".layout-editor-body").on("click",".use-pod-container",function(){var b=a(this),c=b.prev(),d=c.val();if(d.length){a(".edit-open").find(".drag-handle .set-pod").html(" - "+c.val()),b.parent().parent().find(".spinner").css("display","inline-block");var f={action:"pq_loadpod",pod_reference:{pod:d}};a.post(ajaxurl,f,function(c){b.parent().find(".spinner").css("display","none");var d=a("#where-line-tmpl").html(),e="",f=b.closest(".settings-panel").data("container");for(var g in c)e+='<option value="'+c[g]+'">'+c[g]+"</option>";d=d.replace(/{{fields}}/g,e).replace(/{{container_id}}/g,f),b.parent().append(d)})}}),a(".caldera-editor-header").on("click",".column-sort .icon-edit",function(a){}),a(".layout-editor-body").on("tray_loaded",".layout-template-tray",function(){d()}),a(".caldera-editor-header").on("click",".caldera-editor-header-nav a",function(b){b.preventDefault();var c=a(this);a(".caldera-editor-header-nav li").removeClass("active"),a(".caldera-editor-body").hide(),a(c.attr("href")).show(),c.parent().addClass("active"),rebind_field_bindings()}),a("body").on("change",".required",function(){check_required_bindings(this)}),a("body").on("submit",".caldera-forms-options-form",function(b){var c=a(".required.has-error");c.length&&b.preventDefault()}),a(".caldera-editor-body").on("click",".add-toggle-option",function(b){var c=a(this);if(c.data("bulk"))return a(c.data("bulk")).toggle(),void a(c.data("bulk")).find("textarea").focus();var d=c.closest(".caldera-editor-field-config-wrapper"),e=d.find(".toggle-options"),f=a("#field-option-row-tmpl").html(),g=Handlebars.compile(f),h="opt"+parseInt(1048576*(Math.random()+1)),i={_name:"config[fields]["+d.prop("id")+"][config]",option:{}};if(c.data("options")){for(var j=a(c.data("options")),k=j.val().split("\n"),l=!1,m=0;m<k.length;m++){var n=k[m],o=n,p=o.split("|");p.length>1&&(o=p[0],n=p[1],l=!0),i.option["opt"+parseInt(1048576*(Math.random()+m))]={value:o,label:n,default:!1}}a(c.data("options")).parent().hide(),j.val(""),!0===l?d.find(".toggle_show_values").prop("checked",!0):d.find(".toggle_show_values").prop("checked",!1),e.empty()}else i.option[h]={value:"",label:"",default:!1};a(".preset_options").val(""),e.append(g(i)),d.find(".toggle_show_values").trigger("change"),a(".toggle-options").sortable({handle:".dashicons-sort"}),k||e.find(".toggle_label_field").last().focus()}),a(".caldera-editor-body").on("change",".preset_options",function(b){var c=a(this),d=c.val(),e=a(c.data("bulk"));preset_options&&preset_options[d]&&preset_options[d].data&&("object"==typeof preset_options[d].data&&preset_options[d].data.length&&(preset_options[d].data=preset_options[d].data.join("\n")),e.val(preset_options[d].data))}),a(".caldera-editor-body").on("click",".toggle-remove-option",function(b){var c=a(this).closest(".caldera-editor-field-config-wrapper").find(".field-config").first();a(this).parent().remove(),c.trigger("change"),a(document).trigger("option.remove")}),a(".caldera-editor-body").on("click",".page-toggle",function(b){var c=a(this),d=c.parent(),e=d.find(".button");e.removeClass("button-primary"),a(".layout-grid-panel").hide().removeClass("page-active"),a("#"+c.data("page")).show().addClass("page-active"),c.addClass("button-primary"),e.each(function(b,c){a(c).html(d.data("title")+" "+(b+1))}),1===e.length&&d.hide()}),a(".caldera-editor-body").on("blur toggle.values",".toggle_label_field",function(b){var c=a(this),d=c.prev();d.val().length||d.val(c.val())}),a(document).on("change focusout",".toggle_value_field",function(){a(document).trigger("show.fieldedit")}),a(document).on("show.fieldedit option.remove",function(b){a(".toggle_value_field.has-error").removeClass("has-error");for(var c=a("#"+a(".layout-form-field.field-edit-open").data("config")),d=c.find(".toggle_value_field"),e=c.find(".notice"),f=0,g=0;g<d.length;g++){for(var i=(d[g].value,0),j=0;j<d.length;j++)d[g]!==d[j]&&d[g].value===d[j].value&&(a(d[j]).addClass("has-error"),i++);i>0&&(a(d[g]).addClass("has-error"),f++)}f>0?(e.slideDown(),b.preventDefault()):e.slideUp()});var e=!1;focus_initial_field=function(b){var c=a(".layout-grid-panel .icon-edit").first();c.length?c.trigger("click"):(a(".layout-column.column-container").first().trigger("mouseover"),e=setInterval(g,500)),a(document).off("load.page",focus_initial_field)},a(document).on("load.page",focus_initial_field),cf_clear_puler=function(){e&&(clearTimeout(e),a(document).off("mouseover",".layout-new-form-field, .column-fieldinsert",cf_clear_puler)),a(".layout-new-form-field, .column-fieldinsert").fadeIn()},a(document).on("mouseover",".layout-new-form-field, .column-fieldinsert",cf_clear_puler),rebuild_field_binding(),a(document).trigger("load.page"),a("body").on("click",".caldera-processor-nav a",function(b){b.preventDefault();var c=a(this);a(".caldera-processor-nav").removeClass("active"),a(".caldera-editor-processor-config-wrapper").hide(),a(c.attr("href")).show(),c.parent().addClass("active")}),a("body").on("click",".add-new-processor",function(b){var c=a(this),d=Handlebars.compile(a("#processor-wrapper-tmpl").html());wrap=a(".active-processors-list"),process_conf=a(".caldera-editor-processor-config"),processid=Math.round(1e8*Math.random()),new_templ=Handlebars.compile(a("#processor-line-tmpl").html()),new_proc={id:"fp_"+processid,type:c.data("type")},wrap.append(new_templ(new_proc)),process_conf.append(d(new_proc)),a("#form_processor_baldrickModalCloser").trigger("click"),a(".caldera-processor-nav a").last().trigger("click"),a("#fp_"+processid+"_type").val(c.data("type")).trigger("change"),h(),baldrickTriggers()}),a("body").on("click",".delete-processor",function(b){var c=a(this),d=c.closest(".caldera-editor-processor-config-wrapper");d.data("type");confirm(c.data("confirm"))&&(a("."+d.prop("id")).remove(),d.remove(),a(".caldera-processor-nav a").first().trigger("click"),rebuild_field_binding())}),a("body").on("change",".caldera-select-processor-type",function(b){var c=a(this),d=c.closest(".caldera-editor-processor-config-wrapper"),e=c.find('option[value="'+c.val()+'"]').text(),f=d.find(".caldera-editor-processor-title"),g=a(".caldera-processor-nav.active a");""===e&&(e=f.data("title")),f.html(e),g.html(e+' <span class="processor-line-number"></span>').parent().addClass("processor_type_"+c.val()),i(this),rebuild_field_binding()}),a(document).on("click","#cf-shortcode-preview",function(){a(this).focus().select()}),a(document).on("change",".cf-email-preview-toggle",function(){var b=a(this),c=a(".caldera-header-email-preview-button");b.is(":checked")?c.show().attr("aria-hidden","false").css("visibility","visible"):c.hide().attr("aria-hidden","true").css("visibility","hidden")}),rebuild_field_binding(),a(".caldera-select-processor-type").each(function(a,b){i(b)}),h()}),Handlebars.registerHelper("_field",function(a){var b=this,c="",d="",e="",f=this[a.hash.slug]?' data-default="'+this[a.hash.slug]+'"':"";a.hash.required&&(c=" required"),a.hash.exclude&&(e='data-exclude="'+a.hash.exclude+'"'),a.hash.array&&(d="[]","true"!==a.hash.array&&(f='value="'+a.hash.array+'"')),out="<select "+(a.hash.type?'data-type="'+a.hash.type+'"':"")+f+" "+e+' name="'+this._name+"["+a.hash.slug+"]"+d+'" id="'+this._id+"_"+a.hash.slug+'" class="block-input field-config caldera-field-bind'+c+'">',this[a.hash.slug]?out+='<option class="bound-field" value="'+this[a.hash.slug]+'" class="bound-field"></option>':a.hash.required||(out+='<option value=""></option>');for(var g in current_form_fields){var h="";a.hash.type&¤t_form_fields[g].type!==a.hash.type||(b[a.hash.slug]&&b[a.hash.slug]===g&&(h=' selected="selected"'),out+='<option value="'+g+'"'+h+">"+current_form_fields[g].label+" ["+current_form_fields[g].slug+"]</option>")}return out+="</select>",a.hash.required&&(out+='<input class="field-config" name="'+this._name+'[_required_bounds][]" type="hidden" value="'+a.hash.slug+'">'),out}),Handlebars.registerHelper("console",function(a,b){console.log(this)});
|
assets/js/fields.js
CHANGED
@@ -5,12 +5,20 @@
|
|
5 |
*
|
6 |
* Dual licensed under the MIT or GPL Version 2 licenses
|
7 |
*
|
8 |
-
*/
|
9 |
if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val());if(!color)color='ffffff';var hsb=hex2hsb(color);var trigger=$('<span class="input-group-addon" style="background-color: #'+color+'" href="#"></span>');trigger.insertAfter(input);input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase',o.letterCase?o.letterCase:'uppercase').data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).data('close',o.close?o.close:null).data('open',o.open?o.open:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase)).trigger('change');if(o.readonly)input.prop('readonly',true);if(o.disabled)disable(input);trigger.on('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#').trigger('change');show(input)});input.on('focus.miniColors',function(event){if(input.val()==='')input.val('#').trigger('change');show(input)});input.on('blur.miniColors',function(event){var hex=expandHex(hsb2hex(input.data('hsb')));input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'').trigger('change')});input.on('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.on('keyup.miniColors',function(event){setColorFromInput(input)});input.on('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').off('.miniColors');$(document).off('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').css('opacity',1)};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').css('opacity',0.5)};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('<div class="miniColors-selector"></div>');selector.append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').css('display','none').addClass(input.attr('class')).removeClass('form-control');var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition.y+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);var trigger=input.data('trigger'),hidden=!input.is(':visible'),top=hidden?trigger.offset().top+trigger.outerHeight():input.offset().top+input.outerHeight(),left=hidden?trigger.offset().left:input.offset().left,selectorWidth=selector.outerWidth(),selectorHeight=selector.outerHeight(),triggerWidth=trigger.outerWidth(),triggerHeight=trigger.outerHeight(),windowHeight=$(window).height(),windowWidth=$(window).width(),scrollTop=$(window).scrollTop(),scrollLeft=$(window).scrollLeft();if((top+selectorHeight)>windowHeight+scrollTop)top=top-selectorHeight-triggerHeight;if((left+selectorWidth)>windowWidth+scrollLeft)left=left-selectorWidth+triggerWidth;selector.css({top:top,left:left}).fadeIn(100);selector.on('selectstart',function(){return false});if(!$.browser.msie||($.browser.msie&&$.browser.version>=9)){$(window).on('resize.miniColors',function(event){hide(input)})}$(document).on('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);var testSubject=$(event.target).parents().andSelf();if(testSubject.hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if(testSubject.hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if(testSubject.hasClass('miniColors-selector')){event.preventDefault();return}if(testSubject.hasClass('miniColors'))return;hide(input)});$(document).on('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).on('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event)}});if(input.data('open')){input.data('open').call(input.get(0),'#'+hsb2hex(hsb),hsb2rgb(hsb))}};var hide=function(input){if(!input)input=$('.miniColors');input.each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){if(input.data('close')){var hsb=input.data('hsb'),hex=hsb2hex(hsb);input.data('close').call(input.get(0),'#'+hex,hsb2rgb(hsb))}$(this).remove()})});$(document).off('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-5;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-5;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position={y:event.pageY};if(event.originalEvent.changedTouches){position.y=event.originalEvent.changedTouches[0].pageY}position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-1;if(position.y<=-1)position.y=-1;if(position.y>=149)position.y=149;input.data('huePosition',position);huePicker.css('top',position.y).show();var h=Math.round((150-position.y-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb);if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase'))).trigger('change');input.data('trigger').css('backgroundColor','#'+hex);if(input.data('selector'))input.data('selector').find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));if(input.data('change')){if(hex===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,hsb2rgb(hsb));input.data('lastChange',hex)}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val())).trigger('change');var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var currentHSB=input.data('hsb');if(hsb.h===currentHSB.h&&hsb.s===currentHSB.s&&hsb.b===currentHSB.b)return true;var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition.y+'px');input.data('huePosition',huePosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='lowercase')return string.toLowerCase();if(letterCase==='uppercase')return string.toUpperCase();return string};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return{y:y-1}};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data).trigger('change');setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery);
|
|
|
|
|
10 |
function color_picker_init(){
|
11 |
jQuery('.minicolor-picker').miniColors();
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
/* =========================================================
|
15 |
* bootstrap-cfdatepicker.js
|
16 |
* Repo: https://github.com/eternicode/bootstrap-cfdatepicker/
|
@@ -130,9 +138,9 @@ function color_picker_init(){
|
|
130 |
|
131 |
if (this.o.calendarWeeks)
|
132 |
this.picker.find('tfoot th.today')
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
|
137 |
this._allow_update = false;
|
138 |
|
@@ -371,11 +379,11 @@ function color_picker_init(){
|
|
371 |
'mousedown touchstart': $.proxy(function(e){
|
372 |
// Clicked outside the cfdatepicker, hide it
|
373 |
if (!(
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
this.hide();
|
380 |
}
|
381 |
}, this)
|
@@ -560,9 +568,19 @@ function color_picker_init(){
|
|
560 |
windowHeight = $window.height(),
|
561 |
scrollTop = $window.scrollTop();
|
562 |
|
563 |
-
|
564 |
-
|
565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
var offset = this.component ? this.component.parent().offset() : this.element.offset();
|
567 |
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
|
568 |
var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
|
@@ -633,8 +651,8 @@ function color_picker_init(){
|
|
633 |
}
|
634 |
else {
|
635 |
dates = this.isInput
|
636 |
-
|
637 |
-
|
638 |
if (dates && this.o.multidate)
|
639 |
dates = dates.split(this.o.multidateSeparator);
|
640 |
else
|
@@ -693,7 +711,7 @@ function color_picker_init(){
|
|
693 |
|
694 |
fillMonths: function(){
|
695 |
var html = '',
|
696 |
-
|
697 |
while (i < 12){
|
698 |
html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
|
699 |
}
|
@@ -759,13 +777,13 @@ function color_picker_init(){
|
|
759 |
cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
|
760 |
tooltip;
|
761 |
this.picker.find('.cfdatepicker-days thead th.cfdatepicker-switch')
|
762 |
-
|
763 |
this.picker.find('tfoot th.today')
|
764 |
-
|
765 |
-
|
766 |
this.picker.find('tfoot th.clear')
|
767 |
-
|
768 |
-
|
769 |
this.updateNavArrows();
|
770 |
this.fillMonths();
|
771 |
var prevMonth = UTCDate(year, month-1, 28),
|
@@ -825,10 +843,10 @@ function color_picker_init(){
|
|
825 |
this.picker.find('.cfdatepicker-days tbody').empty().append(html.join(''));
|
826 |
|
827 |
var months = this.picker.find('.cfdatepicker-months')
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
|
833 |
$.each(this.dates, function(i, d){
|
834 |
if (d.getUTCFullYear() === year)
|
@@ -848,10 +866,10 @@ function color_picker_init(){
|
|
848 |
html = '';
|
849 |
year = parseInt(year/10, 10) * 10;
|
850 |
var yearCont = this.picker.find('.cfdatepicker-years')
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
year -= 1;
|
856 |
var years = $.map(this.dates, function(d){
|
857 |
return d.getUTCFullYear();
|
@@ -1081,13 +1099,13 @@ function color_picker_init(){
|
|
1081 |
// If going back one month, make sure month is not current month
|
1082 |
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
|
1083 |
? function(){
|
1084 |
-
|
1085 |
-
|
1086 |
// If going forward one month, make sure month is as expected
|
1087 |
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
|
1088 |
: function(){
|
1089 |
-
|
1090 |
-
|
1091 |
new_month = month + dir;
|
1092 |
new_date.setUTCMonth(new_month);
|
1093 |
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
|
@@ -1250,7 +1268,7 @@ function color_picker_init(){
|
|
1250 |
.find('>div')
|
1251 |
.hide()
|
1252 |
.filter('.cfdatepicker-'+DPGlobal.modes[this.viewMode].clsName)
|
1253 |
-
|
1254 |
this.updateNavArrows();
|
1255 |
}
|
1256 |
};
|
@@ -1457,7 +1475,7 @@ function color_picker_init(){
|
|
1457 |
clsName: 'years',
|
1458 |
navFnc: 'FullYear',
|
1459 |
navStep: 10
|
1460 |
-
|
1461 |
isLeapYear: function(year){
|
1462 |
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
|
1463 |
},
|
@@ -1610,51 +1628,51 @@ function color_picker_init(){
|
|
1610 |
return date.join('');
|
1611 |
},
|
1612 |
headTemplate: '<thead>'+
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
1620 |
footTemplate: '<tfoot>'+
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
};
|
1629 |
DPGlobal.template = '<div class="cfdatepicker">'+
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
|
1653 |
$.fn.cfdatepicker.DPGlobal = DPGlobal;
|
1654 |
|
1655 |
|
1656 |
/* DATEPICKER NO CONFLICT
|
1657 |
-
|
1658 |
|
1659 |
$.fn.cfdatepicker.noConflict = function(){
|
1660 |
$.fn.cfdatepicker = old;
|
@@ -1662,7 +1680,7 @@ function color_picker_init(){
|
|
1662 |
};
|
1663 |
|
1664 |
/* DATEPICKER DATA-API
|
1665 |
-
|
1666 |
$(document).on(
|
1667 |
'focus.cfdatepicker.data-api click.cfdatepicker.data-api',
|
1668 |
'[data-provide="cfdatepicker"]',
|
@@ -1670,12 +1688,12 @@ function color_picker_init(){
|
|
1670 |
var $this = $(this);
|
1671 |
if ($this.data('cfdatepicker'))
|
1672 |
return;
|
1673 |
-
|
1674 |
// component click requires us to explicitly show it
|
1675 |
e.preventDefault();
|
1676 |
$this.cfdatepicker('show')
|
1677 |
-
|
1678 |
-
|
1679 |
}
|
1680 |
);
|
1681 |
|
@@ -1683,3126 +1701,3126 @@ function color_picker_init(){
|
|
1683 |
|
1684 |
|
1685 |
/*
|
1686 |
-
* jquery.inputmask.bundle
|
1687 |
-
* http://github.com/RobinHerbots/jquery.inputmask
|
1688 |
-
* Copyright (c) 2010 - 2014 Robin Herbots
|
1689 |
-
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
1690 |
-
* Version: 3.1.27
|
1691 |
-
*/
|
1692 |
-
!function($) {
|
1693 |
-
function isInputEventSupported(eventName) {
|
1694 |
-
var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
|
1695 |
-
return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
|
1696 |
-
el = null, isSupported;
|
1697 |
-
}
|
1698 |
-
function isInputTypeSupported(inputType) {
|
1699 |
-
var isSupported = "text" == inputType || "tel" == inputType;
|
1700 |
-
if (!isSupported) {
|
1701 |
-
var el = document.createElement("input");
|
1702 |
-
el.setAttribute("type", inputType), isSupported = "text" === el.type, el = null;
|
1703 |
-
}
|
1704 |
-
return isSupported;
|
1705 |
-
}
|
1706 |
-
function resolveAlias(aliasStr, options, opts) {
|
1707 |
-
var aliasDefinition = opts.aliases[aliasStr];
|
1708 |
-
return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts),
|
1709 |
-
$.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : !1;
|
1710 |
-
}
|
1711 |
-
function generateMaskSet(opts, multi) {
|
1712 |
-
function analyseMask(mask) {
|
1713 |
-
function maskToken(isGroup, isOptional, isQuantifier, isAlternator) {
|
1714 |
-
this.matches = [], this.isGroup = isGroup || !1, this.isOptional = isOptional || !1,
|
1715 |
-
this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
|
1716 |
-
this.quantifier = {
|
1717 |
-
min: 1,
|
1718 |
-
max: 1
|
1719 |
-
};
|
1720 |
-
}
|
1721 |
-
function insertTestDefinition(mtoken, element, position) {
|
1722 |
-
var maskdef = opts.definitions[element], newBlockMarker = 0 == mtoken.matches.length;
|
1723 |
-
if (position = void 0 != position ? position : mtoken.matches.length, maskdef && !escaped) {
|
1724 |
-
for (var precheck = maskdef.prevalidator, precheckL = precheck ? precheck.length : 0, i = 1; i < maskdef.cardinality; i++) {
|
1725 |
-
var prevalidator = precheckL >= i ? precheck[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality;
|
1726 |
-
mtoken.matches.splice(position++, 0, {
|
1727 |
-
fn: validator ? "string" == typeof validator ? new RegExp(validator) : new function() {
|
1728 |
-
this.test = validator;
|
1729 |
-
}() : new RegExp("."),
|
1730 |
-
cardinality: cardinality ? cardinality : 1,
|
1731 |
-
optionality: mtoken.isOptional,
|
1732 |
-
newBlockMarker: newBlockMarker,
|
1733 |
-
casing: maskdef.casing,
|
1734 |
-
def: maskdef.definitionSymbol || element,
|
1735 |
-
placeholder: maskdef.placeholder,
|
1736 |
-
mask: element
|
1737 |
-
});
|
1738 |
-
}
|
1739 |
-
mtoken.matches.splice(position++, 0, {
|
1740 |
-
fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator) : new function() {
|
1741 |
-
this.test = maskdef.validator;
|
1742 |
-
}() : new RegExp("."),
|
1743 |
-
cardinality: maskdef.cardinality,
|
1744 |
-
optionality: mtoken.isOptional,
|
1745 |
-
newBlockMarker: newBlockMarker,
|
1746 |
-
casing: maskdef.casing,
|
1747 |
-
def: maskdef.definitionSymbol || element,
|
1748 |
-
placeholder: maskdef.placeholder,
|
1749 |
-
mask: element
|
1750 |
-
});
|
1751 |
-
} else mtoken.matches.splice(position++, 0, {
|
1752 |
-
fn: null,
|
1753 |
-
cardinality: 0,
|
1754 |
-
optionality: mtoken.isOptional,
|
1755 |
-
newBlockMarker: newBlockMarker,
|
1756 |
-
casing: null,
|
1757 |
-
def: element,
|
1758 |
-
placeholder: void 0,
|
1759 |
-
mask: element
|
1760 |
-
}), escaped = !1;
|
1761 |
-
}
|
1762 |
-
for (var match, m, openingToken, currentOpeningToken, alternator, lastMatch, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g, escaped = !1, currentToken = new maskToken(), openenings = [], maskTokens = []; match = tokenizer.exec(mask); ) switch (m = match[0],
|
1763 |
-
m.charAt(0)) {
|
1764 |
-
case opts.optionalmarker.end:
|
1765 |
-
case opts.groupmarker.end:
|
1766 |
-
if (openingToken = openenings.pop(), openenings.length > 0) {
|
1767 |
-
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
|
1768 |
-
currentOpeningToken.isAlternator) {
|
1769 |
-
alternator = openenings.pop();
|
1770 |
-
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
|
1771 |
-
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1772 |
-
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1773 |
-
}
|
1774 |
-
} else currentToken.matches.push(openingToken);
|
1775 |
-
break;
|
1776 |
-
|
1777 |
-
case opts.optionalmarker.start:
|
1778 |
-
openenings.push(new maskToken(!1, !0));
|
1779 |
-
break;
|
1780 |
-
|
1781 |
-
case opts.groupmarker.start:
|
1782 |
-
openenings.push(new maskToken(!0));
|
1783 |
-
break;
|
1784 |
-
|
1785 |
-
case opts.quantifiermarker.start:
|
1786 |
-
var quantifier = new maskToken(!1, !1, !0);
|
1787 |
-
m = m.replace(/[{}]/g, "");
|
1788 |
-
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
1789 |
-
if (("*" == mq1 || "+" == mq1) && (mq0 = "*" == mq1 ? 0 : 1), quantifier.quantifier = {
|
1790 |
-
min: mq0,
|
1791 |
-
max: mq1
|
1792 |
-
}, openenings.length > 0) {
|
1793 |
-
var matches = openenings[openenings.length - 1].matches;
|
1794 |
-
if (match = matches.pop(), !match.isGroup) {
|
1795 |
-
var groupToken = new maskToken(!0);
|
1796 |
-
groupToken.matches.push(match), match = groupToken;
|
1797 |
-
}
|
1798 |
-
matches.push(match), matches.push(quantifier);
|
1799 |
-
} else {
|
1800 |
-
if (match = currentToken.matches.pop(), !match.isGroup) {
|
1801 |
-
var groupToken = new maskToken(!0);
|
1802 |
-
groupToken.matches.push(match), match = groupToken;
|
1803 |
-
}
|
1804 |
-
currentToken.matches.push(match), currentToken.matches.push(quantifier);
|
1805 |
-
}
|
1806 |
-
break;
|
1807 |
-
|
1808 |
-
case opts.escapeChar:
|
1809 |
-
escaped = !0;
|
1810 |
-
break;
|
1811 |
-
|
1812 |
-
case opts.alternatormarker:
|
1813 |
-
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1814 |
-
lastMatch = currentOpeningToken.matches.pop()) : lastMatch = currentToken.matches.pop(),
|
1815 |
-
lastMatch.isAlternator ? openenings.push(lastMatch) : (alternator = new maskToken(!1, !1, !1, !0),
|
1816 |
-
alternator.matches.push(lastMatch), openenings.push(alternator));
|
1817 |
-
break;
|
1818 |
-
|
1819 |
-
default:
|
1820 |
-
if (openenings.length > 0) {
|
1821 |
-
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.length > 0 && (lastMatch = currentOpeningToken.matches[currentOpeningToken.matches.length - 1],
|
1822 |
-
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1823 |
-
insertTestDefinition(lastMatch, opts.groupmarker.end))), insertTestDefinition(currentOpeningToken, m),
|
1824 |
-
currentOpeningToken.isAlternator) {
|
1825 |
-
alternator = openenings.pop();
|
1826 |
-
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
|
1827 |
-
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1828 |
-
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1829 |
-
}
|
1830 |
-
} else currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
|
1831 |
-
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1832 |
-
insertTestDefinition(lastMatch, opts.groupmarker.end))), insertTestDefinition(currentToken, m);
|
1833 |
-
}
|
1834 |
-
return currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
|
1835 |
-
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1836 |
-
insertTestDefinition(lastMatch, opts.groupmarker.end)), maskTokens.push(currentToken)),
|
1837 |
-
maskTokens;
|
1838 |
-
}
|
1839 |
-
function generateMask(mask, metadata) {
|
1840 |
-
if (opts.numericInput && opts.multi !== !0) {
|
1841 |
-
mask = mask.split("").reverse();
|
1842 |
-
for (var ndx = 0; ndx < mask.length; ndx++) mask[ndx] == opts.optionalmarker.start ? mask[ndx] = opts.optionalmarker.end : mask[ndx] == opts.optionalmarker.end ? mask[ndx] = opts.optionalmarker.start : mask[ndx] == opts.groupmarker.start ? mask[ndx] = opts.groupmarker.end : mask[ndx] == opts.groupmarker.end && (mask[ndx] = opts.groupmarker.start);
|
1843 |
-
mask = mask.join("");
|
1844 |
-
}
|
1845 |
-
if (void 0 == mask || "" == mask) return void 0;
|
1846 |
-
if (1 == mask.length && 0 == opts.greedy && 0 != opts.repeat && (opts.placeholder = ""),
|
1847 |
-
opts.repeat > 0 || "*" == opts.repeat || "+" == opts.repeat) {
|
1848 |
-
var repeatStart = "*" == opts.repeat ? 0 : "+" == opts.repeat ? 1 : opts.repeat;
|
1849 |
-
mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end;
|
1850 |
-
}
|
1851 |
-
return void 0 == $.inputmask.masksCache[mask] && ($.inputmask.masksCache[mask] = {
|
1852 |
-
mask: mask,
|
1853 |
-
maskToken: analyseMask(mask),
|
1854 |
-
validPositions: {},
|
1855 |
-
_buffer: void 0,
|
1856 |
-
buffer: void 0,
|
1857 |
-
tests: {},
|
1858 |
-
metadata: metadata
|
1859 |
-
}), $.extend(!0, {}, $.inputmask.masksCache[mask]);
|
1860 |
-
}
|
1861 |
-
var ms = void 0;
|
1862 |
-
if ($.isFunction(opts.mask) && (opts.mask = opts.mask.call(this, opts)), $.isArray(opts.mask)) if (multi) ms = [],
|
1863 |
-
$.each(opts.mask, function(ndx, msk) {
|
1864 |
-
ms.push(void 0 == msk.mask || $.isFunction(msk.mask) ? generateMask(msk.toString(), msk) : generateMask(msk.mask.toString(), msk));
|
1865 |
-
}); else {
|
1866 |
-
opts.keepStatic = void 0 == opts.keepStatic ? !0 : opts.keepStatic;
|
1867 |
-
var altMask = "(";
|
1868 |
-
$.each(opts.mask, function(ndx, msk) {
|
1869 |
-
altMask.length > 1 && (altMask += ")|("), altMask += void 0 == msk.mask || $.isFunction(msk.mask) ? msk.toString() : msk.mask.toString();
|
1870 |
-
}), altMask += ")", ms = generateMask(altMask, opts.mask);
|
1871 |
-
} else opts.mask && (ms = void 0 == opts.mask.mask || $.isFunction(opts.mask.mask) ? generateMask(opts.mask.toString(), opts.mask) : generateMask(opts.mask.mask.toString(), opts.mask));
|
1872 |
-
return ms;
|
1873 |
-
}
|
1874 |
-
function maskScope(actionObj, maskset, opts) {
|
1875 |
-
function getMaskTemplate(baseOnInput, minimalPos, includeInput) {
|
1876 |
-
minimalPos = minimalPos || 0;
|
1877 |
-
var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0;
|
1878 |
-
do {
|
1879 |
-
if (baseOnInput === !0 && getMaskSet().validPositions[pos]) {
|
1880 |
-
var validPos = getMaskSet().validPositions[pos];
|
1881 |
-
test = validPos.match, ndxIntlzr = validPos.locator.slice(), maskTemplate.push(includeInput === !0 ? validPos.input : getPlaceholder(pos, test));
|
1882 |
-
} else {
|
1883 |
-
if (minimalPos > pos) {
|
1884 |
-
var testPositions = getTests(pos, ndxIntlzr, pos - 1);
|
1885 |
-
testPos = testPositions[0];
|
1886 |
-
} else testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
|
1887 |
-
test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(getPlaceholder(pos, test));
|
1888 |
-
}
|
1889 |
-
pos++;
|
1890 |
-
} while ((void 0 == maxLength || maxLength > pos - 1) && null != test.fn || null == test.fn && "" != test.def || minimalPos >= pos);
|
1891 |
-
return maskTemplate.pop(), maskTemplate;
|
1892 |
-
}
|
1893 |
-
function getMaskSet() {
|
1894 |
-
return maskset;
|
1895 |
-
}
|
1896 |
-
function resetMaskSet(soft) {
|
1897 |
-
var maskset = getMaskSet();
|
1898 |
-
maskset.buffer = void 0, maskset.tests = {}, soft !== !0 && (maskset._buffer = void 0,
|
1899 |
-
maskset.validPositions = {}, maskset.p = 0);
|
1900 |
-
}
|
1901 |
-
function getLastValidPosition(closestTo) {
|
1902 |
-
var maskset = getMaskSet(), lastValidPosition = -1, valids = maskset.validPositions;
|
1903 |
-
void 0 == closestTo && (closestTo = -1);
|
1904 |
-
var before = lastValidPosition, after = lastValidPosition;
|
1905 |
-
for (var posNdx in valids) {
|
1906 |
-
var psNdx = parseInt(posNdx);
|
1907 |
-
(-1 == closestTo || null != valids[psNdx].match.fn) && (closestTo > psNdx && (before = psNdx),
|
1908 |
-
psNdx >= closestTo && (after = psNdx));
|
1909 |
-
}
|
1910 |
-
return lastValidPosition = closestTo - before > 1 || closestTo > after ? before : after;
|
1911 |
-
}
|
1912 |
-
function setValidPosition(pos, validTest, fromSetValid) {
|
1913 |
-
if (opts.insertMode && void 0 != getMaskSet().validPositions[pos] && void 0 == fromSetValid) {
|
1914 |
-
var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
|
1915 |
-
for (i = pos; lvp >= i; i++) delete getMaskSet().validPositions[i];
|
1916 |
-
getMaskSet().validPositions[pos] = validTest;
|
1917 |
-
var j, valid = !0;
|
1918 |
-
for (i = pos; lvp >= i; i++) {
|
1919 |
-
var t = positionsClone[i];
|
1920 |
-
if (void 0 != t) {
|
1921 |
-
var vps = getMaskSet().validPositions;
|
1922 |
-
j = !opts.keepStatic && (void 0 != vps[i + 1] && getTests(i + 1, vps[i].locator.slice(), i).length > 1 || vps[i] && void 0 != vps[i].alternation) ? i + 1 : seekNext(i),
|
1923 |
-
valid = positionCanMatchDefinition(j, t.match.def) ? valid && isValid(j, t.input, !0, !0) !== !1 : null == t.match.fn;
|
1924 |
-
}
|
1925 |
-
if (!valid) break;
|
1926 |
-
}
|
1927 |
-
if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone),
|
1928 |
-
!1;
|
1929 |
-
} else getMaskSet().validPositions[pos] = validTest;
|
1930 |
-
return !0;
|
1931 |
-
}
|
1932 |
-
function stripValidPositions(start, end) {
|
1933 |
-
var i, startPos = start;
|
1934 |
-
for (void 0 != getMaskSet().validPositions[start] && getMaskSet().validPositions[start].input == opts.radixPoint && (end++,
|
1935 |
-
startPos++), i = startPos; end > i; i++) void 0 == getMaskSet().validPositions[i] || getMaskSet().validPositions[i].input == opts.radixPoint && i != getLastValidPosition() || delete getMaskSet().validPositions[i];
|
1936 |
-
for (i = end; i <= getLastValidPosition(); ) {
|
1937 |
-
var t = getMaskSet().validPositions[i], s = getMaskSet().validPositions[startPos];
|
1938 |
-
void 0 != t && void 0 == s ? (positionCanMatchDefinition(startPos, t.match.def) && isValid(startPos, t.input, !0) !== !1 && (delete getMaskSet().validPositions[i],
|
1939 |
-
i++), startPos++) : i++;
|
1940 |
-
}
|
1941 |
-
var lvp = getLastValidPosition();
|
1942 |
-
lvp >= start && void 0 != getMaskSet().validPositions[lvp] && getMaskSet().validPositions[lvp].input == opts.radixPoint && delete getMaskSet().validPositions[lvp],
|
1943 |
-
resetMaskSet(!0);
|
1944 |
-
}
|
1945 |
-
function getTestTemplate(pos, ndxIntlzr, tstPs) {
|
1946 |
-
function checkAlternationMatch(test, altNdx, altArr) {
|
1947 |
-
for (var isMatch = !1, altLocArr = test.locator[altNdx].toString().split(","), alndx = 0; alndx < altLocArr.length; alndx++) if (-1 != $.inArray(altLocArr[alndx], altArr)) {
|
1948 |
-
isMatch = !0;
|
1949 |
-
break;
|
1950 |
-
}
|
1951 |
-
return isMatch;
|
1952 |
-
}
|
1953 |
-
for (var testPos, testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
|
1954 |
-
!(opts.greedy || testPos.match && (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0 && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos, lvTest.alternation, lvTestAltArr)))); ndx++) ;
|
1955 |
-
return testPos;
|
1956 |
-
}
|
1957 |
-
function getTest(pos) {
|
1958 |
-
return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
|
1959 |
-
}
|
1960 |
-
function positionCanMatchDefinition(pos, def) {
|
1961 |
-
for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def == def) {
|
1962 |
-
valid = !0;
|
1963 |
-
break;
|
1964 |
-
}
|
1965 |
-
return valid;
|
1966 |
-
}
|
1967 |
-
function getTests(pos, ndxIntlzr, tstPs) {
|
1968 |
-
function ResolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
|
1969 |
-
function handleMatch(match, loopNdx, quantifierRecurse) {
|
1970 |
-
if (testPos > 1e4) return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask),
|
1971 |
-
!0;
|
1972 |
-
if (testPos == pos && void 0 == match.matches) return matches.push({
|
1973 |
-
match: match,
|
1974 |
-
locator: loopNdx.reverse()
|
1975 |
-
}), !0;
|
1976 |
-
if (void 0 != match.matches) {
|
1977 |
-
if (match.isGroup && quantifierRecurse !== !0) {
|
1978 |
-
if (match = handleMatch(maskToken.matches[tndx + 1], loopNdx)) return !0;
|
1979 |
-
} else if (match.isOptional) {
|
1980 |
-
var optionalToken = match;
|
1981 |
-
if (match = ResolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
|
1982 |
-
var latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 == $.inArray(latestMatch, optionalToken.matches);
|
1983 |
-
isFirstMatch && (insertStop = !0), testPos = pos;
|
1984 |
-
}
|
1985 |
-
} else if (match.isAlternator) {
|
1986 |
-
var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
|
1987 |
-
if (-1 == altIndex || "string" == typeof altIndex) {
|
1988 |
-
var altIndexArr, currentPos = testPos, ndxInitializerClone = ndxInitializer.slice();
|
1989 |
-
"string" == typeof altIndex && (altIndexArr = altIndex.split(","));
|
1990 |
-
for (var amndx = 0; amndx < alternateToken.matches.length; amndx++) {
|
1991 |
-
matches = [], match = handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match,
|
1992 |
-
maltMatches = matches.slice(), testPos = currentPos, matches = [];
|
1993 |
-
for (var i = 0; i < ndxInitializerClone.length; i++) ndxInitializer[i] = ndxInitializerClone[i];
|
1994 |
-
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) for (var altMatch = maltMatches[ndx1], ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
|
1995 |
-
var altMatch2 = malternateMatches[ndx2];
|
1996 |
-
if (altMatch.match.mask == altMatch2.match.mask && ("string" != typeof altIndex || -1 != $.inArray(altMatch.locator[loopNdxCnt].toString(), altIndexArr))) {
|
1997 |
-
maltMatches.splice(ndx1, 1), altMatch2.locator[loopNdxCnt] = altMatch2.locator[loopNdxCnt] + "," + altMatch.locator[loopNdxCnt],
|
1998 |
-
altMatch2.alternation = loopNdxCnt;
|
1999 |
-
break;
|
2000 |
-
}
|
2001 |
-
}
|
2002 |
-
malternateMatches = malternateMatches.concat(maltMatches);
|
2003 |
-
}
|
2004 |
-
"string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) {
|
2005 |
-
if (isFinite(ndx)) {
|
2006 |
-
var mamatch, altLocArr = lmnt.locator[loopNdxCnt].toString().split(",");
|
2007 |
-
lmnt.locator[loopNdxCnt] = void 0, lmnt.alternation = void 0;
|
2008 |
-
for (var alndx = 0; alndx < altLocArr.length; alndx++) mamatch = -1 != $.inArray(altLocArr[alndx], altIndexArr),
|
2009 |
-
mamatch && (void 0 != lmnt.locator[loopNdxCnt] ? (lmnt.locator[loopNdxCnt] += ",",
|
2010 |
-
lmnt.alternation = loopNdxCnt, lmnt.locator[loopNdxCnt] += altLocArr[alndx]) : lmnt.locator[loopNdxCnt] = parseInt(altLocArr[alndx]));
|
2011 |
-
if (void 0 != lmnt.locator[loopNdxCnt]) return lmnt;
|
2012 |
-
}
|
2013 |
-
})), matches = currentMatches.concat(malternateMatches), insertStop = !0;
|
2014 |
-
} else match = handleMatch(alternateToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
|
2015 |
-
if (match) return !0;
|
2016 |
-
} else if (match.isQuantifier && quantifierRecurse !== !0) {
|
2017 |
-
var qt = match;
|
2018 |
-
opts.greedy = opts.greedy && isFinite(qt.quantifier.max);
|
2019 |
-
for (var qndx = ndxInitializer.length > 0 && quantifierRecurse !== !0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && pos >= testPos; qndx++) {
|
2020 |
-
var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
|
2021 |
-
if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), !0)) {
|
2022 |
-
var latestMatch = matches[matches.length - 1].match;
|
2023 |
-
latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1;
|
2024 |
-
var isFirstMatch = 0 == $.inArray(latestMatch, tokenGroup.matches);
|
2025 |
-
if (isFirstMatch) {
|
2026 |
-
if (qndx > qt.quantifier.min - 1) {
|
2027 |
-
insertStop = !0, testPos = pos;
|
2028 |
-
break;
|
2029 |
-
}
|
2030 |
-
return !0;
|
2031 |
-
}
|
2032 |
-
return !0;
|
2033 |
-
}
|
2034 |
-
}
|
2035 |
-
} else if (match = ResolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0;
|
2036 |
-
} else testPos++;
|
2037 |
-
}
|
2038 |
-
for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (maskToken.matches[tndx].isQuantifier !== !0) {
|
2039 |
-
var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
|
2040 |
-
if (match && testPos == pos) return match;
|
2041 |
-
if (testPos > pos) break;
|
2042 |
-
}
|
2043 |
-
}
|
2044 |
-
var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
|
2045 |
-
if (void 0 == ndxIntlzr) {
|
2046 |
-
for (var test, previousPos = pos - 1; void 0 == (test = getMaskSet().validPositions[previousPos]) && previousPos > -1; ) previousPos--;
|
2047 |
-
if (void 0 != test && previousPos > -1) testPos = previousPos, ndxInitializer = test.locator.slice(); else {
|
2048 |
-
for (previousPos = pos - 1; void 0 == (test = getMaskSet().tests[previousPos]) && previousPos > -1; ) previousPos--;
|
2049 |
-
void 0 != test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test[0].locator.slice());
|
2050 |
-
}
|
2051 |
-
}
|
2052 |
-
for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
|
2053 |
-
var match = ResolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]);
|
2054 |
-
if (match && testPos == pos || testPos > pos) break;
|
2055 |
-
}
|
2056 |
-
return (0 == matches.length || insertStop) && matches.push({
|
2057 |
-
match: {
|
2058 |
-
fn: null,
|
2059 |
-
cardinality: 0,
|
2060 |
-
optionality: !0,
|
2061 |
-
casing: null,
|
2062 |
-
def: ""
|
2063 |
-
},
|
2064 |
-
locator: []
|
2065 |
-
}), getMaskSet().tests[pos] = $.extend(!0, [], matches), getMaskSet().tests[pos];
|
2066 |
-
}
|
2067 |
-
function getBufferTemplate() {
|
2068 |
-
return void 0 == getMaskSet()._buffer && (getMaskSet()._buffer = getMaskTemplate(!1, 1)),
|
2069 |
-
getMaskSet()._buffer;
|
2070 |
-
}
|
2071 |
-
function getBuffer() {
|
2072 |
-
return void 0 == getMaskSet().buffer && (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0)),
|
2073 |
-
getMaskSet().buffer;
|
2074 |
-
}
|
2075 |
-
function refreshFromBuffer(start, end) {
|
2076 |
-
var buffer = getBuffer().slice();
|
2077 |
-
if (start === !0) resetMaskSet(), start = 0, end = buffer.length; else for (var i = start; end > i; i++) delete getMaskSet().validPositions[i],
|
2078 |
-
delete getMaskSet().tests[i];
|
2079 |
-
for (var i = start; end > i; i++) buffer[i] != opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
|
2080 |
-
}
|
2081 |
-
function casing(elem, test) {
|
2082 |
-
switch (test.casing) {
|
2083 |
-
case "upper":
|
2084 |
-
elem = elem.toUpperCase();
|
2085 |
-
break;
|
2086 |
-
|
2087 |
-
case "lower":
|
2088 |
-
elem = elem.toLowerCase();
|
2089 |
-
}
|
2090 |
-
return elem;
|
2091 |
-
}
|
2092 |
-
function isValid(pos, c, strict, fromSetValid) {
|
2093 |
-
function _isValid(position, c, strict, fromSetValid) {
|
2094 |
-
var rslt = !1;
|
2095 |
-
return $.each(getTests(position), function(ndx, tst) {
|
2096 |
-
for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = (getBuffer(), test.cardinality); i > loopend; i--) chrs += getBufferElement(position - (i - 1));
|
2097 |
-
if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c != test.def && c != opts.skipOptionalPartCharacter || "" == test.def ? !1 : {
|
2098 |
-
c: test.def,
|
2099 |
-
pos: position
|
2100 |
-
}, rslt !== !1) {
|
2101 |
-
var elem = void 0 != rslt.c ? rslt.c : c;
|
2102 |
-
elem = elem == opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
|
2103 |
-
var validatedPos = position;
|
2104 |
-
if (void 0 != rslt.remove && stripValidPositions(rslt.remove, rslt.remove + 1),
|
2105 |
-
rslt.refreshFromBuffer) {
|
2106 |
-
var refresh = rslt.refreshFromBuffer;
|
2107 |
-
if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end),
|
2108 |
-
void 0 == rslt.pos && void 0 == rslt.c) return rslt.pos = getLastValidPosition(),
|
2109 |
-
!1;
|
2110 |
-
if (validatedPos = void 0 != rslt.pos ? rslt.pos : position, validatedPos != position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
2111 |
-
!1;
|
2112 |
-
} else if (rslt !== !0 && void 0 != rslt.pos && rslt.pos != position && (validatedPos = rslt.pos,
|
2113 |
-
refreshFromBuffer(position, validatedPos), validatedPos != position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
2114 |
-
!1;
|
2115 |
-
return 1 != rslt && void 0 == rslt.pos && void 0 == rslt.c ? !1 : (ndx > 0 && resetMaskSet(!0),
|
2116 |
-
setValidPosition(validatedPos, $.extend({}, tst, {
|
2117 |
-
input: casing(elem, test)
|
2118 |
-
}), fromSetValid) || (rslt = !1), !1);
|
2119 |
-
}
|
2120 |
-
}), rslt;
|
2121 |
-
}
|
2122 |
-
function alternate(pos, c, strict, fromSetValid) {
|
2123 |
-
var lastAlt, alternation, validPsClone = $.extend(!0, {}, getMaskSet().validPositions);
|
2124 |
-
for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) if (getMaskSet().validPositions[lastAlt] && void 0 != getMaskSet().validPositions[lastAlt].alternation) {
|
2125 |
-
alternation = getMaskSet().validPositions[lastAlt].alternation;
|
2126 |
-
break;
|
2127 |
-
}
|
2128 |
-
if (void 0 != alternation) for (var decisionPos in getMaskSet().validPositions) if (parseInt(decisionPos) > parseInt(lastAlt) && void 0 === getMaskSet().validPositions[decisionPos].alternation) {
|
2129 |
-
for (var altPos = getMaskSet().validPositions[decisionPos], decisionTaker = altPos.locator[alternation], altNdxs = getMaskSet().validPositions[lastAlt].locator[alternation].split(","), mndx = 0; mndx < altNdxs.length; mndx++) if (decisionTaker < altNdxs[mndx]) {
|
2130 |
-
for (var possibilityPos, possibilities, dp = decisionPos - 1; dp >= 0; dp--) if (possibilityPos = getMaskSet().validPositions[dp],
|
2131 |
-
void 0 != possibilityPos) {
|
2132 |
-
possibilities = possibilityPos.locator[alternation], possibilityPos.locator[alternation] = altNdxs[mndx];
|
2133 |
-
break;
|
2134 |
-
}
|
2135 |
-
if (decisionTaker != possibilityPos.locator[alternation]) {
|
2136 |
-
for (var buffer = getBuffer().slice(), i = decisionPos; i < getLastValidPosition() + 1; i++) delete getMaskSet().validPositions[i],
|
2137 |
-
delete getMaskSet().tests[i];
|
2138 |
-
resetMaskSet(!0), opts.keepStatic = !opts.keepStatic;
|
2139 |
-
for (var i = decisionPos; i < buffer.length; i++) buffer[i] != opts.skipOptionalPartCharacter && isValid(getLastValidPosition() + 1, buffer[i], !1, !0);
|
2140 |
-
possibilityPos.locator[alternation] = possibilities;
|
2141 |
-
var isValidRslt = isValid(pos, c, strict, fromSetValid);
|
2142 |
-
if (opts.keepStatic = !opts.keepStatic, isValidRslt) return isValidRslt;
|
2143 |
-
resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone);
|
2144 |
-
}
|
2145 |
-
}
|
2146 |
-
break;
|
2147 |
-
}
|
2148 |
-
return !1;
|
2149 |
-
}
|
2150 |
-
strict = strict === !0;
|
2151 |
-
for (var buffer = getBuffer(), pndx = pos - 1; pndx > -1 && (!getMaskSet().validPositions[pndx] || null != getMaskSet().validPositions[pndx].match.fn); pndx--) void 0 == getMaskSet().validPositions[pndx] && (!isMask(pndx) || buffer[pndx] != getPlaceholder(pndx)) && getTests(pndx).length > 1 && _isValid(pndx, buffer[pndx], !0);
|
2152 |
-
var maskPos = pos, result = !1;
|
2153 |
-
if (fromSetValid && maskPos >= getMaskLength() && resetMaskSet(!0), maskPos < getMaskLength() && (result = _isValid(maskPos, c, strict, fromSetValid),
|
2154 |
-
!strict && result === !1)) {
|
2155 |
-
var currentPosValid = getMaskSet().validPositions[maskPos];
|
2156 |
-
if (!currentPosValid || null != currentPosValid.match.fn || currentPosValid.match.def != c && c != opts.skipOptionalPartCharacter) {
|
2157 |
-
if ((opts.insertMode || void 0 == getMaskSet().validPositions[seekNext(maskPos)]) && !isMask(maskPos)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); snPos >= nPos; nPos++) if (result = _isValid(nPos, c, strict, fromSetValid),
|
2158 |
-
result !== !1) {
|
2159 |
-
maskPos = nPos;
|
2160 |
-
break;
|
2161 |
-
}
|
2162 |
-
} else result = {
|
2163 |
-
caret: seekNext(maskPos)
|
2164 |
-
};
|
2165 |
-
}
|
2166 |
-
return result === !1 && opts.keepStatic && isComplete(buffer) && (result = alternate(pos, c, strict, fromSetValid)),
|
2167 |
-
result === !0 && (result = {
|
2168 |
-
pos: maskPos
|
2169 |
-
}), result;
|
2170 |
-
}
|
2171 |
-
function isMask(pos) {
|
2172 |
-
var test = getTest(pos);
|
2173 |
-
return null != test.fn ? test.fn : !1;
|
2174 |
-
}
|
2175 |
-
function getMaskLength() {
|
2176 |
-
var maskLength;
|
2177 |
-
if (maxLength = $el.prop("maxLength"), -1 == maxLength && (maxLength = void 0),
|
2178 |
-
0 == opts.greedy) {
|
2179 |
-
var pos, lvp = getLastValidPosition(), testPos = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 != testPos ? testPos.locator.slice() : void 0;
|
2180 |
-
for (pos = lvp + 1; void 0 == testPos || null != testPos.match.fn || null == testPos.match.fn && "" != testPos.match.def; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
2181 |
-
ndxIntlzr = testPos.locator.slice();
|
2182 |
-
maskLength = pos;
|
2183 |
-
} else maskLength = getBuffer().length;
|
2184 |
-
return void 0 == maxLength || maxLength > maskLength ? maskLength : maxLength;
|
2185 |
-
}
|
2186 |
-
function seekNext(pos) {
|
2187 |
-
var maskL = getMaskLength();
|
2188 |
-
if (pos >= maskL) return maskL;
|
2189 |
-
for (var position = pos; ++position < maskL && !isMask(position) && (opts.nojumps !== !0 || opts.nojumpsThreshold > position); ) ;
|
2190 |
-
return position;
|
2191 |
-
}
|
2192 |
-
function seekPrevious(pos) {
|
2193 |
-
var position = pos;
|
2194 |
-
if (0 >= position) return 0;
|
2195 |
-
for (;--position > 0 && !isMask(position); ) ;
|
2196 |
-
return position;
|
2197 |
-
}
|
2198 |
-
function getBufferElement(position) {
|
2199 |
-
return void 0 == getMaskSet().validPositions[position] ? getPlaceholder(position) : getMaskSet().validPositions[position].input;
|
2200 |
-
}
|
2201 |
-
function writeBuffer(input, buffer, caretPos) {
|
2202 |
-
input._valueSet(buffer.join("")), void 0 != caretPos && caret(input, caretPos);
|
2203 |
-
}
|
2204 |
-
function getPlaceholder(pos, test) {
|
2205 |
-
test = test || getTest(pos);
|
2206 |
-
var placeholder = $.isFunction(test.placeholder) ? test.placeholder.call(this, opts) : test.placeholder;
|
2207 |
-
return void 0 != placeholder ? placeholder : null == test.fn ? test.def : opts.placeholder.charAt(pos % opts.placeholder.length);
|
2208 |
-
}
|
2209 |
-
function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
|
2210 |
-
var inputValue = void 0 != nptvl ? nptvl.slice() : truncateInput(input._valueGet()).split("");
|
2211 |
-
if (resetMaskSet(), writeOut && input._valueSet(""), $.each(inputValue, function(ndx, charCode) {
|
2212 |
-
if (intelliCheck === !0) {
|
2213 |
-
var lvp = getLastValidPosition(), pos = -1 == lvp ? ndx : seekNext(lvp);
|
2214 |
-
-1 == $.inArray(charCode, getBufferTemplate().slice(lvp + 1, pos)) && keypressEvent.call(input, void 0, !0, charCode.charCodeAt(0), !1, strict, strict ? ndx : getMaskSet().p);
|
2215 |
-
} else keypressEvent.call(input, void 0, !0, charCode.charCodeAt(0), !1, strict, strict ? ndx : getMaskSet().p),
|
2216 |
-
strict = strict || ndx > 0 && ndx > getMaskSet().p;
|
2217 |
-
}), writeOut) {
|
2218 |
-
var keypressResult = opts.onKeyPress.call(this, void 0, getBuffer(), 0, opts);
|
2219 |
-
handleOnKeyResult(input, keypressResult), writeBuffer(input, getBuffer(), $(input).is(":focus") ? seekNext(getLastValidPosition(0)) : void 0);
|
2220 |
-
}
|
2221 |
-
}
|
2222 |
-
function escapeRegex(str) {
|
2223 |
-
return $.inputmask.escapeRegex.call(this, str);
|
2224 |
-
}
|
2225 |
-
function truncateInput(inputValue) {
|
2226 |
-
return inputValue.replace(new RegExp("(" + escapeRegex(getBufferTemplate().join("")) + ")*$"), "");
|
2227 |
-
}
|
2228 |
-
function unmaskedvalue($input) {
|
2229 |
-
if ($input.data("_inputmask") && !$input.hasClass("hasDatepicker")) {
|
2230 |
-
var umValue = [], vps = getMaskSet().validPositions;
|
2231 |
-
for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
|
2232 |
-
var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
|
2233 |
-
return $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue),
|
2234 |
-
unmaskedValue;
|
2235 |
-
}
|
2236 |
-
return $input[0]._valueGet();
|
2237 |
-
}
|
2238 |
-
function TranslatePosition(pos) {
|
2239 |
-
if (isRTL && "number" == typeof pos && (!opts.greedy || "" != opts.placeholder)) {
|
2240 |
-
var bffrLght = getBuffer().length;
|
2241 |
-
pos = bffrLght - pos;
|
2242 |
-
}
|
2243 |
-
return pos;
|
2244 |
-
}
|
2245 |
-
function caret(input, begin, end) {
|
2246 |
-
var range, npt = input.jquery && input.length > 0 ? input[0] : input;
|
2247 |
-
if ("number" != typeof begin) {
|
2248 |
-
var data = $(npt).data("_inputmask");
|
2249 |
-
return !$(npt).is(":visible") && data && void 0 != data.caret ? (begin = data.caret.begin,
|
2250 |
-
end = data.caret.end) : npt.setSelectionRange ? (begin = npt.selectionStart, end = npt.selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
|
2251 |
-
begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
|
2252 |
-
begin = TranslatePosition(begin), end = TranslatePosition(end), {
|
2253 |
-
begin: begin,
|
2254 |
-
end: end
|
2255 |
-
};
|
2256 |
-
}
|
2257 |
-
begin = TranslatePosition(begin), end = TranslatePosition(end), end = "number" == typeof end ? end : begin;
|
2258 |
-
var data = $(npt).data("_inputmask") || {};
|
2259 |
-
data.caret = {
|
2260 |
-
begin: begin,
|
2261 |
-
end: end
|
2262 |
-
}, $(npt).data("_inputmask", data), $(npt).is(":visible") && (npt.scrollLeft = npt.scrollWidth,
|
2263 |
-
0 == opts.insertMode && begin == end && end++, npt.setSelectionRange ? (npt.selectionStart = begin,
|
2264 |
-
npt.selectionEnd = end) : npt.createTextRange && (range = npt.createTextRange(),
|
2265 |
-
range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
|
2266 |
-
range.select()));
|
2267 |
-
}
|
2268 |
-
function determineLastRequiredPosition(returnDefinition) {
|
2269 |
-
var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 != lvTest ? lvTest.locator.slice() : void 0;
|
2270 |
-
for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
2271 |
-
ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
|
2272 |
-
var lvTestAltArr = lvTest && void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [];
|
2273 |
-
for (pos = bl - 1; pos > lvp && (testPos = positions[pos].match, (testPos.optionality || testPos.optionalQuantifier || lvTest && void 0 != lvTest.alternation && void 0 != positions[pos].locator[lvTest.alternation] && -1 != $.inArray(positions[pos].locator[lvTest.alternation].toString(), lvTestAltArr)) && buffer[pos] == getPlaceholder(pos, testPos)); pos--) bl--;
|
2274 |
-
return returnDefinition ? {
|
2275 |
-
l: bl,
|
2276 |
-
def: positions[bl] ? positions[bl].match : void 0
|
2277 |
-
} : bl;
|
2278 |
-
}
|
2279 |
-
function clearOptionalTail(input) {
|
2280 |
-
for (var buffer = getBuffer(), tmpBuffer = buffer.slice(), rl = determineLastRequiredPosition(), lmib = tmpBuffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
2281 |
-
tmpBuffer.splice(rl, lmib + 1 - rl), writeBuffer(input, tmpBuffer);
|
2282 |
-
}
|
2283 |
-
function isComplete(buffer) {
|
2284 |
-
if ($.isFunction(opts.isComplete)) return opts.isComplete.call($el, buffer, opts);
|
2285 |
-
if ("*" == opts.repeat) return void 0;
|
2286 |
-
var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l), lvp = getLastValidPosition();
|
2287 |
-
if (lvp == aml && (void 0 == lrp.def || lrp.def.newBlockMarker || lrp.def.optionalQuantifier)) {
|
2288 |
-
complete = !0;
|
2289 |
-
for (var i = 0; aml >= i; i++) {
|
2290 |
-
var mask = isMask(i);
|
2291 |
-
if (mask && (void 0 == buffer[i] || buffer[i] == getPlaceholder(i)) || !mask && buffer[i] != getPlaceholder(i)) {
|
2292 |
-
complete = !1;
|
2293 |
-
break;
|
2294 |
-
}
|
2295 |
-
}
|
2296 |
-
}
|
2297 |
-
return complete;
|
2298 |
-
}
|
2299 |
-
function isSelection(begin, end) {
|
2300 |
-
return isRTL ? begin - end > 1 || begin - end == 1 && opts.insertMode : end - begin > 1 || end - begin == 1 && opts.insertMode;
|
2301 |
-
}
|
2302 |
-
function installEventRuler(npt) {
|
2303 |
-
var events = $._data(npt).events;
|
2304 |
-
$.each(events, function(eventType, eventHandlers) {
|
2305 |
-
$.each(eventHandlers, function(ndx, eventHandler) {
|
2306 |
-
if ("inputmask" == eventHandler.namespace && "setvalue" != eventHandler.type) {
|
2307 |
-
var handler = eventHandler.handler;
|
2308 |
-
eventHandler.handler = function(e) {
|
2309 |
-
return this.readOnly || this.disabled ? void e.preventDefault : handler.apply(this, arguments);
|
2310 |
-
};
|
2311 |
-
}
|
2312 |
-
});
|
2313 |
-
});
|
2314 |
-
}
|
2315 |
-
function patchValueProperty(npt) {
|
2316 |
-
function PatchValhook(type) {
|
2317 |
-
if (void 0 == $.valHooks[type] || 1 != $.valHooks[type].inputmaskpatch) {
|
2318 |
-
var valueGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
|
2319 |
-
return elem.value;
|
2320 |
-
}, valueSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
|
2321 |
-
return elem.value = value, elem;
|
2322 |
-
};
|
2323 |
-
$.valHooks[type] = {
|
2324 |
-
get: function(elem) {
|
2325 |
-
var $elem = $(elem);
|
2326 |
-
if ($elem.data("_inputmask")) {
|
2327 |
-
if ($elem.data("_inputmask").opts.autoUnmask) return $elem.inputmask("unmaskedvalue");
|
2328 |
-
var result = valueGet(elem), inputData = $elem.data("_inputmask"), maskset = inputData.maskset, bufferTemplate = maskset._buffer;
|
2329 |
-
return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result != bufferTemplate ? result : "";
|
2330 |
-
}
|
2331 |
-
return valueGet(elem);
|
2332 |
-
},
|
2333 |
-
set: function(elem, value) {
|
2334 |
-
var result, $elem = $(elem), inputData = $elem.data("_inputmask");
|
2335 |
-
return inputData ? (result = valueSet(elem, $.isFunction(inputData.opts.onBeforeMask) ? inputData.opts.onBeforeMask.call(el, value, inputData.opts) || value : value),
|
2336 |
-
$elem.triggerHandler("setvalue.inputmask")) : result = valueSet(elem, value), result;
|
2337 |
-
},
|
2338 |
-
inputmaskpatch: !0
|
2339 |
-
};
|
2340 |
-
}
|
2341 |
-
}
|
2342 |
-
function getter() {
|
2343 |
-
var $self = $(this), inputData = $(this).data("_inputmask");
|
2344 |
-
return inputData ? inputData.opts.autoUnmask ? $self.inputmask("unmaskedvalue") : valueGet.call(this) != getBufferTemplate().join("") ? valueGet.call(this) : "" : valueGet.call(this);
|
2345 |
-
}
|
2346 |
-
function setter(value) {
|
2347 |
-
var inputData = $(this).data("_inputmask");
|
2348 |
-
inputData ? (valueSet.call(this, $.isFunction(inputData.opts.onBeforeMask) ? inputData.opts.onBeforeMask.call(el, value, inputData.opts) || value : value),
|
2349 |
-
$(this).triggerHandler("setvalue.inputmask")) : valueSet.call(this, value);
|
2350 |
-
}
|
2351 |
-
function InstallNativeValueSetFallback(npt) {
|
2352 |
-
$(npt).bind("mouseenter.inputmask", function() {
|
2353 |
-
var $input = $(this), input = this, value = input._valueGet();
|
2354 |
-
"" != value && value != getBuffer().join("") && $input.trigger("setvalue");
|
2355 |
-
});
|
2356 |
-
var events = $._data(npt).events, handlers = events.mouseover;
|
2357 |
-
if (handlers) {
|
2358 |
-
for (var ourHandler = handlers[handlers.length - 1], i = handlers.length - 1; i > 0; i--) handlers[i] = handlers[i - 1];
|
2359 |
-
handlers[0] = ourHandler;
|
2360 |
-
}
|
2361 |
-
}
|
2362 |
-
var valueGet, valueSet;
|
2363 |
-
if (!npt._valueGet) {
|
2364 |
-
if (Object.getOwnPropertyDescriptor) {
|
2365 |
-
Object.getOwnPropertyDescriptor(npt, "value");
|
2366 |
-
}
|
2367 |
-
document.__lookupGetter__ && npt.__lookupGetter__("value") ? (valueGet = npt.__lookupGetter__("value"),
|
2368 |
-
valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
|
2369 |
-
npt.__defineSetter__("value", setter)) : (valueGet = function() {
|
2370 |
-
return npt.value;
|
2371 |
-
}, valueSet = function(value) {
|
2372 |
-
npt.value = value;
|
2373 |
-
}, PatchValhook(npt.type), InstallNativeValueSetFallback(npt)), npt._valueGet = function() {
|
2374 |
-
return isRTL ? valueGet.call(this).split("").reverse().join("") : valueGet.call(this);
|
2375 |
-
}, npt._valueSet = function(value) {
|
2376 |
-
valueSet.call(this, isRTL ? value.split("").reverse().join("") : value);
|
2377 |
-
};
|
2378 |
-
}
|
2379 |
-
}
|
2380 |
-
function handleRemove(input, k, pos) {
|
2381 |
-
function generalize() {
|
2382 |
-
if (opts.keepStatic) {
|
2383 |
-
resetMaskSet(!0);
|
2384 |
-
var lastAlt, validInputs = [];
|
2385 |
-
for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) if (getMaskSet().validPositions[lastAlt]) {
|
2386 |
-
if (void 0 != getMaskSet().validPositions[lastAlt].alternation) break;
|
2387 |
-
validInputs.push(getMaskSet().validPositions[lastAlt].input), delete getMaskSet().validPositions[lastAlt];
|
2388 |
-
}
|
2389 |
-
if (lastAlt > 0) for (;validInputs.length > 0; ) getMaskSet().p = seekNext(getLastValidPosition()),
|
2390 |
-
keypressEvent.call(input, void 0, !0, validInputs.pop().charCodeAt(0), !1, !1, getMaskSet().p);
|
2391 |
-
}
|
2392 |
-
}
|
2393 |
-
if ((opts.numericInput || isRTL) && (k == $.inputmask.keyCode.BACKSPACE ? k = $.inputmask.keyCode.DELETE : k == $.inputmask.keyCode.DELETE && (k = $.inputmask.keyCode.BACKSPACE),
|
2394 |
-
isRTL)) {
|
2395 |
-
var pend = pos.end;
|
2396 |
-
pos.end = pos.begin, pos.begin = pend;
|
2397 |
-
}
|
2398 |
-
k == $.inputmask.keyCode.BACKSPACE && pos.end - pos.begin <= 1 ? pos.begin = seekPrevious(pos.begin) : k == $.inputmask.keyCode.DELETE && pos.begin == pos.end && pos.end++,
|
2399 |
-
stripValidPositions(pos.begin, pos.end), generalize();
|
2400 |
-
var firstMaskedPos = getLastValidPosition(pos.begin);
|
2401 |
-
firstMaskedPos < pos.begin ? (-1 == firstMaskedPos && resetMaskSet(), getMaskSet().p = seekNext(firstMaskedPos)) : getMaskSet().p = pos.begin;
|
2402 |
-
}
|
2403 |
-
function handleOnKeyResult(input, keyResult, caretPos) {
|
2404 |
-
if (keyResult && keyResult.refreshFromBuffer) {
|
2405 |
-
var refresh = keyResult.refreshFromBuffer;
|
2406 |
-
refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end), resetMaskSet(!0),
|
2407 |
-
void 0 != caretPos && (writeBuffer(input, getBuffer()), caret(input, keyResult.caret || caretPos.begin, keyResult.caret || caretPos.end));
|
2408 |
-
}
|
2409 |
-
}
|
2410 |
-
function keydownEvent(e) {
|
2411 |
-
skipKeyPressEvent = !1;
|
2412 |
-
var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
|
2413 |
-
k == $.inputmask.keyCode.BACKSPACE || k == $.inputmask.keyCode.DELETE || iphone && 127 == k || e.ctrlKey && 88 == k && !isInputEventSupported("cut") ? (e.preventDefault(),
|
2414 |
-
88 == k && (valueOnFocus = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p),
|
2415 |
-
input._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"),
|
2416 |
-
opts.showTooltip && $input.prop("title", getMaskSet().mask)) : k == $.inputmask.keyCode.END || k == $.inputmask.keyCode.PAGE_DOWN ? setTimeout(function() {
|
2417 |
-
var caretPos = seekNext(getLastValidPosition());
|
2418 |
-
opts.insertMode || caretPos != getMaskLength() || e.shiftKey || caretPos--, caret(input, e.shiftKey ? pos.begin : caretPos, caretPos);
|
2419 |
-
}, 0) : k == $.inputmask.keyCode.HOME && !e.shiftKey || k == $.inputmask.keyCode.PAGE_UP ? caret(input, 0, e.shiftKey ? pos.begin : 0) : k == $.inputmask.keyCode.ESCAPE || 90 == k && e.ctrlKey ? (checkVal(input, !0, !1, valueOnFocus.split("")),
|
2420 |
-
$input.click()) : k != $.inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? 0 != opts.insertMode || e.shiftKey || (k == $.inputmask.keyCode.RIGHT ? setTimeout(function() {
|
2421 |
-
var caretPos = caret(input);
|
2422 |
-
caret(input, caretPos.begin);
|
2423 |
-
}, 0) : k == $.inputmask.keyCode.LEFT && setTimeout(function() {
|
2424 |
-
var caretPos = caret(input);
|
2425 |
-
caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1);
|
2426 |
-
}, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin != getMaskLength() ? pos.begin : pos.begin - 1));
|
2427 |
-
var currentCaretPos = caret(input), keydownResult = opts.onKeyDown.call(this, e, getBuffer(), currentCaretPos.begin, opts);
|
2428 |
-
handleOnKeyResult(input, keydownResult, currentCaretPos), ignorable = -1 != $.inArray(k, opts.ignorables);
|
2429 |
-
}
|
2430 |
-
function keypressEvent(e, checkval, k, writeOut, strict, ndx) {
|
2431 |
-
if (void 0 == k && skipKeyPressEvent) return !1;
|
2432 |
-
skipKeyPressEvent = !0;
|
2433 |
-
var input = this, $input = $(input);
|
2434 |
-
e = e || window.event;
|
2435 |
-
var k = checkval ? k : e.which || e.charCode || e.keyCode;
|
2436 |
-
if (!(checkval === !0 || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return !0;
|
2437 |
-
if (k) {
|
2438 |
-
checkval !== !0 && 46 == k && 0 == e.shiftKey && "," == opts.radixPoint && (k = 44);
|
2439 |
-
var forwardPosition, pos = checkval ? {
|
2440 |
-
begin: ndx,
|
2441 |
-
end: ndx
|
2442 |
-
} : caret(input), c = String.fromCharCode(k), isSlctn = isSelection(pos.begin, pos.end);
|
2443 |
-
isSlctn && (getMaskSet().undoPositions = $.extend(!0, {}, getMaskSet().validPositions),
|
2444 |
-
handleRemove(input, $.inputmask.keyCode.DELETE, pos), opts.insertMode || (opts.insertMode = !opts.insertMode,
|
2445 |
-
setValidPosition(pos.begin, strict), opts.insertMode = !opts.insertMode), isSlctn = !opts.multi),
|
2446 |
-
getMaskSet().writeOutBuffer = !0;
|
2447 |
-
var p = isRTL && !isSlctn ? pos.end : pos.begin, valResult = isValid(p, c, strict);
|
2448 |
-
if (valResult !== !1) {
|
2449 |
-
if (valResult !== !0 && (p = void 0 != valResult.pos ? valResult.pos : p, c = void 0 != valResult.c ? valResult.c : c),
|
2450 |
-
resetMaskSet(!0), void 0 != valResult.caret) forwardPosition = valResult.caret; else {
|
2451 |
-
var vps = getMaskSet().validPositions;
|
2452 |
-
forwardPosition = !opts.keepStatic && (void 0 != vps[p + 1] && getTests(p + 1, vps[p].locator.slice(), p).length > 1 || void 0 != vps[p].alternation) ? p + 1 : seekNext(p);
|
2453 |
-
}
|
2454 |
-
getMaskSet().p = forwardPosition;
|
2455 |
-
}
|
2456 |
-
if (writeOut !== !1) {
|
2457 |
-
var self = this;
|
2458 |
-
if (setTimeout(function() {
|
2459 |
-
opts.onKeyValidation.call(self, valResult, opts);
|
2460 |
-
}, 0), getMaskSet().writeOutBuffer && valResult !== !1) {
|
2461 |
-
var buffer = getBuffer();
|
2462 |
-
writeBuffer(input, buffer, checkval ? void 0 : opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition),
|
2463 |
-
checkval !== !0 && setTimeout(function() {
|
2464 |
-
isComplete(buffer) === !0 && $input.trigger("complete"), skipInputEvent = !0, $input.trigger("input");
|
2465 |
-
}, 0);
|
2466 |
-
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
2467 |
-
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
2468 |
-
if (opts.showTooltip && $input.prop("title", getMaskSet().mask), e && 1 != checkval) {
|
2469 |
-
e.preventDefault();
|
2470 |
-
var currentCaretPos = caret(input), keypressResult = opts.onKeyPress.call(this, e, getBuffer(), currentCaretPos.begin, opts);
|
2471 |
-
handleOnKeyResult(input, keypressResult, currentCaretPos);
|
2472 |
-
}
|
2473 |
-
}
|
2474 |
-
}
|
2475 |
-
function keyupEvent(e) {
|
2476 |
-
var $input = $(this), input = this, k = e.keyCode, buffer = getBuffer(), currentCaretPos = caret(input), keyupResult = opts.onKeyUp.call(this, e, buffer, currentCaretPos.begin, opts);
|
2477 |
-
handleOnKeyResult(input, keyupResult, currentCaretPos), k == $.inputmask.keyCode.TAB && opts.showMaskOnFocus && ($input.hasClass("focus-inputmask") && 0 == input._valueGet().length ? (resetMaskSet(),
|
2478 |
-
buffer = getBuffer(), writeBuffer(input, buffer), caret(input, 0), valueOnFocus = getBuffer().join("")) : (writeBuffer(input, buffer),
|
2479 |
-
caret(input, TranslatePosition(0), TranslatePosition(getMaskLength()))));
|
2480 |
-
}
|
2481 |
-
function pasteEvent(e) {
|
2482 |
-
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2483 |
-
var input = this, $input = $(input), inputValue = input._valueGet(), caretPos = caret(input);
|
2484 |
-
if ("propertychange" == e.type && input._valueGet().length <= getMaskLength()) return !0;
|
2485 |
-
"paste" == e.type && (window.clipboardData && window.clipboardData.getData ? inputValue = inputValue.substr(0, caretPos.begin) + window.clipboardData.getData("Text") + inputValue.substr(caretPos.end, inputValue.length) : e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData && (inputValue = inputValue.substr(0, caretPos.begin) + e.originalEvent.clipboardData.getData("text/plain") + inputValue.substr(caretPos.end, inputValue.length)));
|
2486 |
-
var pasteValue = $.isFunction(opts.onBeforePaste) ? opts.onBeforePaste.call(input, inputValue, opts) || inputValue : inputValue;
|
2487 |
-
return checkVal(input, !0, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.split(""), !0),
|
2488 |
-
$input.click(), isComplete(getBuffer()) === !0 && $input.trigger("complete"), !1;
|
2489 |
-
}
|
2490 |
-
function mobileInputEvent(e) {
|
2491 |
-
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2492 |
-
var input = this, caretPos = caret(input), currentValue = input._valueGet();
|
2493 |
-
currentValue = currentValue.replace(new RegExp("(" + escapeRegex(getBufferTemplate().join("")) + ")*"), ""),
|
2494 |
-
caretPos.begin > currentValue.length && (caret(input, currentValue.length), caretPos = caret(input)),
|
2495 |
-
getBuffer().length - currentValue.length != 1 || currentValue.charAt(caretPos.begin) == getBuffer()[caretPos.begin] || currentValue.charAt(caretPos.begin + 1) == getBuffer()[caretPos.begin] || isMask(caretPos.begin) || (e.keyCode = $.inputmask.keyCode.BACKSPACE,
|
2496 |
-
keydownEvent.call(input, e)), e.preventDefault();
|
2497 |
-
}
|
2498 |
-
function inputFallBackEvent(e) {
|
2499 |
-
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2500 |
-
var input = this, caretPos = caret(input), currentValue = input._valueGet();
|
2501 |
-
caret(input, caretPos.begin - 1);
|
2502 |
-
var keypress = $.Event("keypress");
|
2503 |
-
keypress.which = currentValue.charCodeAt(caretPos.begin - 1), skipKeyPressEvent = !1,
|
2504 |
-
ignorable = !1, keypressEvent.call(input, keypress, void 0, void 0, !1);
|
2505 |
-
var forwardPosition = getMaskSet().p;
|
2506 |
-
writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition),
|
2507 |
-
e.preventDefault();
|
2508 |
-
}
|
2509 |
-
function compositionupdateEvent(e) {
|
2510 |
-
skipInputEvent = !0;
|
2511 |
-
var input = this;
|
2512 |
-
return setTimeout(function() {
|
2513 |
-
caret(input, caret(input).begin - 1);
|
2514 |
-
var keypress = $.Event("keypress");
|
2515 |
-
keypress.which = e.originalEvent.data.charCodeAt(0), skipKeyPressEvent = !1, ignorable = !1,
|
2516 |
-
keypressEvent.call(input, keypress, void 0, void 0, !1);
|
2517 |
-
var forwardPosition = getMaskSet().p;
|
2518 |
-
writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition);
|
2519 |
-
}, 0), !1;
|
2520 |
-
}
|
2521 |
-
function mask(el) {
|
2522 |
-
if ($el = $(el), $el.is(":input") && isInputTypeSupported($el.attr("type"))) {
|
2523 |
-
if ($el.data("_inputmask", {
|
2524 |
-
maskset: maskset,
|
2525 |
-
opts: opts,
|
2526 |
-
isRTL: !1
|
2527 |
-
}), opts.showTooltip && $el.prop("title", getMaskSet().mask), ("rtl" == el.dir || opts.rightAlign) && $el.css("text-align", "right"),
|
2528 |
-
"rtl" == el.dir || opts.numericInput) {
|
2529 |
-
el.dir = "ltr", $el.removeAttr("dir");
|
2530 |
-
var inputData = $el.data("_inputmask");
|
2531 |
-
inputData.isRTL = !0, $el.data("_inputmask", inputData), isRTL = !0;
|
2532 |
-
}
|
2533 |
-
$el.unbind(".inputmask"), $el.removeClass("focus-inputmask"), $el.closest("form").bind("submit", function() {
|
2534 |
-
valueOnFocus != getBuffer().join("") && $el.change(), $el[0]._valueGet && $el[0]._valueGet() == getBufferTemplate().join("") && $el[0]._valueSet(""),
|
2535 |
-
opts.autoUnmask && opts.removeMaskOnSubmit && $el.inputmask("remove");
|
2536 |
-
}).bind("reset", function() {
|
2537 |
-
setTimeout(function() {
|
2538 |
-
$el.trigger("setvalue");
|
2539 |
-
}, 0);
|
2540 |
-
}), $el.bind("mouseenter.inputmask", function() {
|
2541 |
-
var $input = $(this), input = this;
|
2542 |
-
!$input.hasClass("focus-inputmask") && opts.showMaskOnHover && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer());
|
2543 |
-
}).bind("blur.inputmask", function() {
|
2544 |
-
var $input = $(this), input = this;
|
2545 |
-
if ($input.data("_inputmask")) {
|
2546 |
-
var nptValue = input._valueGet(), buffer = getBuffer();
|
2547 |
-
$input.removeClass("focus-inputmask"), valueOnFocus != getBuffer().join("") && $input.change(),
|
2548 |
-
opts.clearMaskOnLostFocus && "" != nptValue && (nptValue == getBufferTemplate().join("") ? input._valueSet("") : clearOptionalTail(input)),
|
2549 |
-
isComplete(buffer) === !1 && ($input.trigger("incomplete"), opts.clearIncomplete && (resetMaskSet(),
|
2550 |
-
opts.clearMaskOnLostFocus ? input._valueSet("") : (buffer = getBufferTemplate().slice(),
|
2551 |
-
writeBuffer(input, buffer))));
|
2552 |
-
}
|
2553 |
-
}).bind("focus.inputmask", function() {
|
2554 |
-
var $input = $(this), input = this, nptValue = input._valueGet();
|
2555 |
-
opts.showMaskOnFocus && !$input.hasClass("focus-inputmask") && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())),
|
2556 |
-
$input.addClass("focus-inputmask"), valueOnFocus = getBuffer().join("");
|
2557 |
-
}).bind("mouseleave.inputmask", function() {
|
2558 |
-
var $input = $(this), input = this;
|
2559 |
-
opts.clearMaskOnLostFocus && ($input.hasClass("focus-inputmask") || input._valueGet() == $input.attr("placeholder") || (input._valueGet() == getBufferTemplate().join("") || "" == input._valueGet() ? input._valueSet("") : clearOptionalTail(input)));
|
2560 |
-
}).bind("click.inputmask", function() {
|
2561 |
-
var input = this;
|
2562 |
-
$(input).is(":focus") && setTimeout(function() {
|
2563 |
-
var selectedCaret = caret(input);
|
2564 |
-
if (selectedCaret.begin == selectedCaret.end) if (opts.radixFocus && "" != opts.radixPoint && -1 != $.inArray(opts.radixPoint, getBuffer()) && getBuffer().join("") == getBufferTemplate().join("")) caret(input, $.inArray(opts.radixPoint, getBuffer())); else {
|
2565 |
-
var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin, lastPosition = seekNext(getLastValidPosition(clickPosition));
|
2566 |
-
lastPosition > clickPosition ? caret(input, isMask(clickPosition) ? clickPosition : seekNext(clickPosition)) : caret(input, lastPosition);
|
2567 |
-
}
|
2568 |
-
}, 0);
|
2569 |
-
}).bind("dblclick.inputmask", function() {
|
2570 |
-
var input = this;
|
2571 |
-
setTimeout(function() {
|
2572 |
-
caret(input, 0, seekNext(getLastValidPosition()));
|
2573 |
-
}, 0);
|
2574 |
-
}).bind(PasteEventType + ".inputmask dragdrop.inputmask drop.inputmask", pasteEvent).bind("setvalue.inputmask", function() {
|
2575 |
-
var input = this;
|
2576 |
-
checkVal(input, !0, !1, void 0, !0), valueOnFocus = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input._valueGet() == getBufferTemplate().join("") && input._valueSet("");
|
2577 |
-
}).bind("cut.inputmask", function(e) {
|
2578 |
-
skipInputEvent = !0;
|
2579 |
-
var input = this, $input = $(input), pos = caret(input);
|
2580 |
-
handleRemove(input, $.inputmask.keyCode.DELETE, pos);
|
2581 |
-
var keypressResult = opts.onKeyPress.call(this, e, getBuffer(), getMaskSet().p, opts);
|
2582 |
-
handleOnKeyResult(input, keypressResult, {
|
2583 |
-
begin: getMaskSet().p,
|
2584 |
-
end: getMaskSet().p
|
2585 |
-
}), input._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"),
|
2586 |
-
opts.showTooltip && $input.prop("title", getMaskSet().mask);
|
2587 |
-
}).bind("complete.inputmask", opts.oncomplete).bind("incomplete.inputmask", opts.onincomplete).bind("cleared.inputmask", opts.oncleared),
|
2588 |
-
$el.bind("keydown.inputmask", keydownEvent).bind("keypress.inputmask", keypressEvent).bind("keyup.inputmask", keyupEvent).bind("compositionupdate.inputmask", compositionupdateEvent),
|
2589 |
-
"paste" !== PasteEventType || msie1x || $el.bind("input.inputmask", inputFallBackEvent),
|
2590 |
-
msie1x && $el.bind("input.inputmask", pasteEvent), (android || androidfirefox || androidchrome || kindle) && ("input" == PasteEventType && $el.unbind(PasteEventType + ".inputmask"),
|
2591 |
-
$el.bind("input.inputmask", mobileInputEvent)), patchValueProperty(el);
|
2592 |
-
var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(el, el._valueGet(), opts) || el._valueGet() : el._valueGet();
|
2593 |
-
checkVal(el, !0, !1, initialValue.split(""), !0), valueOnFocus = getBuffer().join("");
|
2594 |
-
var activeElement;
|
2595 |
-
try {
|
2596 |
-
activeElement = document.activeElement;
|
2597 |
-
} catch (e) {}
|
2598 |
-
isComplete(getBuffer()) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus ? getBuffer().join("") == getBufferTemplate().join("") ? el._valueSet("") : clearOptionalTail(el) : writeBuffer(el, getBuffer()),
|
2599 |
-
activeElement === el && ($el.addClass("focus-inputmask"), caret(el, seekNext(getLastValidPosition()))),
|
2600 |
-
installEventRuler(el);
|
2601 |
-
}
|
2602 |
-
}
|
2603 |
-
var valueOnFocus, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1;
|
2604 |
-
if (void 0 != actionObj) switch (actionObj.action) {
|
2605 |
-
case "isComplete":
|
2606 |
-
return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2607 |
-
isComplete(actionObj.buffer);
|
2608 |
-
|
2609 |
-
case "unmaskedvalue":
|
2610 |
-
return $el = actionObj.$input, maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2611 |
-
isRTL = actionObj.$input.data("_inputmask").isRTL, unmaskedvalue(actionObj.$input);
|
2612 |
-
|
2613 |
-
case "mask":
|
2614 |
-
valueOnFocus = getBuffer().join(""), mask(actionObj.el);
|
2615 |
-
break;
|
2616 |
-
|
2617 |
-
case "format":
|
2618 |
-
$el = $({}), $el.data("_inputmask", {
|
2619 |
-
maskset: maskset,
|
2620 |
-
opts: opts,
|
2621 |
-
isRTL: opts.numericInput
|
2622 |
-
}), opts.numericInput && (isRTL = !0);
|
2623 |
-
var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
|
2624 |
-
return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer, !0), opts.onKeyPress.call(this, void 0, getBuffer(), 0, opts),
|
2625 |
-
actionObj.metadata ? {
|
2626 |
-
value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
|
2627 |
-
metadata: $el.inputmask("getmetadata")
|
2628 |
-
} : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
|
2629 |
-
|
2630 |
-
case "isValid":
|
2631 |
-
$el = $({}), $el.data("_inputmask", {
|
2632 |
-
maskset: maskset,
|
2633 |
-
opts: opts,
|
2634 |
-
isRTL: opts.numericInput
|
2635 |
-
}), opts.numericInput && (isRTL = !0);
|
2636 |
-
var valueBuffer = actionObj.value.split("");
|
2637 |
-
checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
|
2638 |
-
for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
2639 |
-
return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
|
2640 |
-
|
2641 |
-
case "getemptymask":
|
2642 |
-
return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2643 |
-
getBufferTemplate();
|
2644 |
-
|
2645 |
-
case "remove":
|
2646 |
-
var el = actionObj.el;
|
2647 |
-
$el = $(el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2648 |
-
el._valueSet(unmaskedvalue($el)), $el.unbind(".inputmask"), $el.removeClass("focus-inputmask"),
|
2649 |
-
$el.removeData("_inputmask");
|
2650 |
-
var valueProperty;
|
2651 |
-
Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")),
|
2652 |
-
valueProperty && valueProperty.get ? el._valueGet && Object.defineProperty(el, "value", {
|
2653 |
-
get: el._valueGet,
|
2654 |
-
set: el._valueSet
|
2655 |
-
}) : document.__lookupGetter__ && el.__lookupGetter__("value") && el._valueGet && (el.__defineGetter__("value", el._valueGet),
|
2656 |
-
el.__defineSetter__("value", el._valueSet));
|
2657 |
-
try {
|
2658 |
-
delete el._valueGet, delete el._valueSet;
|
2659 |
-
} catch (e) {
|
2660 |
-
el._valueGet = void 0, el._valueSet = void 0;
|
2661 |
-
}
|
2662 |
-
break;
|
2663 |
-
|
2664 |
-
case "getmetadata":
|
2665 |
-
if ($el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2666 |
-
$.isArray(maskset.metadata)) {
|
2667 |
-
for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 != getMaskSet().validPositions[firstAlt].alternation) {
|
2668 |
-
alternation = getMaskSet().validPositions[firstAlt].alternation;
|
2669 |
-
break;
|
2670 |
-
}
|
2671 |
-
return void 0 != alternation ? maskset.metadata[getMaskSet().validPositions[lvp].locator[alternation]] : maskset.metadata[0];
|
2672 |
-
}
|
2673 |
-
return maskset.metadata;
|
2674 |
-
}
|
2675 |
-
}
|
2676 |
-
if (void 0 === $.fn.inputmask) {
|
2677 |
-
var msie1x = "function" == typeof ScriptEngineMajorVersion ? ScriptEngineMajorVersion() : new Function("/*@cc_on return @_jscript_version; @*/")() >= 10, ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), android = null !== ua.match(new RegExp("android.*safari.*", "i")), androidchrome = null !== ua.match(new RegExp("android.*chrome.*", "i")), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), kindle = /Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
|
2678 |
-
$.inputmask = {
|
2679 |
-
defaults: {
|
2680 |
-
placeholder: "_",
|
2681 |
-
optionalmarker: {
|
2682 |
-
start: "[",
|
2683 |
-
end: "]"
|
2684 |
-
},
|
2685 |
-
quantifiermarker: {
|
2686 |
-
start: "{",
|
2687 |
-
end: "}"
|
2688 |
-
},
|
2689 |
-
groupmarker: {
|
2690 |
-
start: "(",
|
2691 |
-
end: ")"
|
2692 |
-
},
|
2693 |
-
alternatormarker: "|",
|
2694 |
-
escapeChar: "\\",
|
2695 |
-
mask: null,
|
2696 |
-
oncomplete: $.noop,
|
2697 |
-
onincomplete: $.noop,
|
2698 |
-
oncleared: $.noop,
|
2699 |
-
repeat: 0,
|
2700 |
-
greedy: !0,
|
2701 |
-
autoUnmask: !1,
|
2702 |
-
removeMaskOnSubmit: !0,
|
2703 |
-
clearMaskOnLostFocus: !0,
|
2704 |
-
insertMode: !0,
|
2705 |
-
clearIncomplete: !1,
|
2706 |
-
aliases: {},
|
2707 |
-
alias: null,
|
2708 |
-
onKeyUp: $.noop,
|
2709 |
-
onKeyPress: $.noop,
|
2710 |
-
onKeyDown: $.noop,
|
2711 |
-
onBeforeMask: void 0,
|
2712 |
-
onBeforePaste: void 0,
|
2713 |
-
onUnMask: void 0,
|
2714 |
-
showMaskOnFocus: !0,
|
2715 |
-
showMaskOnHover: !0,
|
2716 |
-
onKeyValidation: $.noop,
|
2717 |
-
skipOptionalPartCharacter: " ",
|
2718 |
-
showTooltip: !1,
|
2719 |
-
numericInput: !1,
|
2720 |
-
rightAlign: !1,
|
2721 |
-
radixPoint: "",
|
2722 |
-
radixFocus: !1,
|
2723 |
-
nojumps: !1,
|
2724 |
-
nojumpsThreshold: 0,
|
2725 |
-
keepStatic: void 0,
|
2726 |
-
definitions: {
|
2727 |
-
"9": {
|
2728 |
-
validator: "[0-9]",
|
2729 |
-
cardinality: 1,
|
2730 |
-
definitionSymbol: "*"
|
2731 |
-
},
|
2732 |
-
a: {
|
2733 |
-
validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
2734 |
-
cardinality: 1,
|
2735 |
-
definitionSymbol: "*"
|
2736 |
-
},
|
2737 |
-
"*": {
|
2738 |
-
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
2739 |
-
cardinality: 1
|
2740 |
-
}
|
2741 |
-
},
|
2742 |
-
ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123 ],
|
2743 |
-
isComplete: void 0
|
2744 |
-
},
|
2745 |
-
keyCode: {
|
2746 |
-
ALT: 18,
|
2747 |
-
BACKSPACE: 8,
|
2748 |
-
CAPS_LOCK: 20,
|
2749 |
-
COMMA: 188,
|
2750 |
-
COMMAND: 91,
|
2751 |
-
COMMAND_LEFT: 91,
|
2752 |
-
COMMAND_RIGHT: 93,
|
2753 |
-
CONTROL: 17,
|
2754 |
-
DELETE: 46,
|
2755 |
-
DOWN: 40,
|
2756 |
-
END: 35,
|
2757 |
-
ENTER: 13,
|
2758 |
-
ESCAPE: 27,
|
2759 |
-
HOME: 36,
|
2760 |
-
INSERT: 45,
|
2761 |
-
LEFT: 37,
|
2762 |
-
MENU: 93,
|
2763 |
-
NUMPAD_ADD: 107,
|
2764 |
-
NUMPAD_DECIMAL: 110,
|
2765 |
-
NUMPAD_DIVIDE: 111,
|
2766 |
-
NUMPAD_ENTER: 108,
|
2767 |
-
NUMPAD_MULTIPLY: 106,
|
2768 |
-
NUMPAD_SUBTRACT: 109,
|
2769 |
-
PAGE_DOWN: 34,
|
2770 |
-
PAGE_UP: 33,
|
2771 |
-
PERIOD: 190,
|
2772 |
-
RIGHT: 39,
|
2773 |
-
SHIFT: 16,
|
2774 |
-
SPACE: 32,
|
2775 |
-
TAB: 9,
|
2776 |
-
UP: 38,
|
2777 |
-
WINDOWS: 91
|
2778 |
-
},
|
2779 |
-
masksCache: {},
|
2780 |
-
escapeRegex: function(str) {
|
2781 |
-
var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\" ];
|
2782 |
-
return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
|
2783 |
-
},
|
2784 |
-
format: function(value, options, metadata) {
|
2785 |
-
var opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2786 |
-
return resolveAlias(opts.alias, options, opts), maskScope({
|
2787 |
-
action: "format",
|
2788 |
-
value: value,
|
2789 |
-
metadata: metadata
|
2790 |
-
}, generateMaskSet(opts), opts);
|
2791 |
-
},
|
2792 |
-
isValid: function(value, options) {
|
2793 |
-
var opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2794 |
-
return resolveAlias(opts.alias, options, opts), maskScope({
|
2795 |
-
action: "isValid",
|
2796 |
-
value: value
|
2797 |
-
}, generateMaskSet(opts), opts);
|
2798 |
-
}
|
2799 |
-
}, $.fn.inputmask = function(fn, options, targetScope, targetData, msk) {
|
2800 |
-
function importAttributeOptions(npt, opts, importedOptionsContainer) {
|
2801 |
-
var $npt = $(npt);
|
2802 |
-
$npt.data("inputmask-alias") && resolveAlias($npt.data("inputmask-alias"), {}, opts);
|
2803 |
-
for (var option in opts) {
|
2804 |
-
var optionData = $npt.data("inputmask-" + option.toLowerCase());
|
2805 |
-
void 0 != optionData && ("mask" == option && 0 == optionData.indexOf("[") ? (opts[option] = optionData.replace(/[\s[\]]/g, "").split("','"),
|
2806 |
-
opts[option][0] = opts[option][0].replace("'", ""), opts[option][opts[option].length - 1] = opts[option][opts[option].length - 1].replace("'", "")) : opts[option] = "boolean" == typeof optionData ? optionData : optionData.toString(),
|
2807 |
-
importedOptionsContainer && (importedOptionsContainer[option] = opts[option]));
|
2808 |
-
}
|
2809 |
-
return opts;
|
2810 |
-
}
|
2811 |
-
targetScope = targetScope || maskScope, targetData = targetData || "_inputmask";
|
2812 |
-
var maskset, opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2813 |
-
if ("string" == typeof fn) switch (fn) {
|
2814 |
-
case "mask":
|
2815 |
-
return resolveAlias(opts.alias, options, opts), maskset = generateMaskSet(opts, targetScope !== maskScope),
|
2816 |
-
void 0 == maskset ? this : this.each(function() {
|
2817 |
-
targetScope({
|
2818 |
-
action: "mask",
|
2819 |
-
el: this
|
2820 |
-
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2821 |
-
});
|
2822 |
-
|
2823 |
-
case "unmaskedvalue":
|
2824 |
-
var $input = $(this);
|
2825 |
-
return $input.data(targetData) ? targetScope({
|
2826 |
-
action: "unmaskedvalue",
|
2827 |
-
$input: $input
|
2828 |
-
}) : $input.val();
|
2829 |
-
|
2830 |
-
case "remove":
|
2831 |
-
return this.each(function() {
|
2832 |
-
var $input = $(this);
|
2833 |
-
$input.data(targetData) && targetScope({
|
2834 |
-
action: "remove",
|
2835 |
-
el: this
|
2836 |
-
});
|
2837 |
-
});
|
2838 |
-
|
2839 |
-
case "getemptymask":
|
2840 |
-
return this.data(targetData) ? targetScope({
|
2841 |
-
action: "getemptymask",
|
2842 |
-
el: this
|
2843 |
-
}) : "";
|
2844 |
-
|
2845 |
-
case "hasMaskedValue":
|
2846 |
-
return this.data(targetData) ? !this.data(targetData).opts.autoUnmask : !1;
|
2847 |
-
|
2848 |
-
case "isComplete":
|
2849 |
-
return this.data(targetData) ? targetScope({
|
2850 |
-
action: "isComplete",
|
2851 |
-
buffer: this[0]._valueGet().split(""),
|
2852 |
-
el: this
|
2853 |
-
}) : !0;
|
2854 |
-
|
2855 |
-
case "getmetadata":
|
2856 |
-
return this.data(targetData) ? targetScope({
|
2857 |
-
action: "getmetadata",
|
2858 |
-
el: this
|
2859 |
-
}) : void 0;
|
2860 |
-
|
2861 |
-
case "_detectScope":
|
2862 |
-
return resolveAlias(opts.alias, options, opts), void 0 == msk || resolveAlias(msk, options, opts) || -1 != $.inArray(msk, [ "mask", "unmaskedvalue", "remove", "getemptymask", "hasMaskedValue", "isComplete", "getmetadata", "_detectScope" ]) || (opts.mask = msk),
|
2863 |
-
$.isFunction(opts.mask) && (opts.mask = opts.mask.call(this, opts)), $.isArray(opts.mask);
|
2864 |
-
|
2865 |
-
default:
|
2866 |
-
return resolveAlias(opts.alias, options, opts), resolveAlias(fn, options, opts) || (opts.mask = fn),
|
2867 |
-
maskset = generateMaskSet(opts, targetScope !== maskScope), void 0 == maskset ? this : this.each(function() {
|
2868 |
-
targetScope({
|
2869 |
-
action: "mask",
|
2870 |
-
el: this
|
2871 |
-
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2872 |
-
});
|
2873 |
-
} else {
|
2874 |
-
if ("object" == typeof fn) return opts = $.extend(!0, {}, $.inputmask.defaults, fn),
|
2875 |
-
resolveAlias(opts.alias, fn, opts), maskset = generateMaskSet(opts, targetScope !== maskScope),
|
2876 |
-
void 0 == maskset ? this : this.each(function() {
|
2877 |
-
targetScope({
|
2878 |
-
action: "mask",
|
2879 |
-
el: this
|
2880 |
-
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2881 |
-
});
|
2882 |
-
if (void 0 == fn) return this.each(function() {
|
2883 |
-
var attrOptions = $(this).attr("data-inputmask");
|
2884 |
-
if (attrOptions && "" != attrOptions) try {
|
2885 |
-
attrOptions = attrOptions.replace(new RegExp("'", "g"), '"');
|
2886 |
-
var dataoptions = $.parseJSON("{" + attrOptions + "}");
|
2887 |
-
$.extend(!0, dataoptions, options), opts = $.extend(!0, {}, $.inputmask.defaults, dataoptions),
|
2888 |
-
opts = importAttributeOptions(this, opts), resolveAlias(opts.alias, dataoptions, opts),
|
2889 |
-
opts.alias = void 0, $(this).inputmask("mask", opts, targetScope);
|
2890 |
-
} catch (ex) {}
|
2891 |
-
if ($(this).attr("data-inputmask-mask") || $(this).attr("data-inputmask-alias")) {
|
2892 |
-
opts = $.extend(!0, {}, $.inputmask.defaults, {});
|
2893 |
-
var dataOptions = {};
|
2894 |
-
opts = importAttributeOptions(this, opts, dataOptions), resolveAlias(opts.alias, dataOptions, opts),
|
2895 |
-
opts.alias = void 0, $(this).inputmask("mask", opts, targetScope);
|
2896 |
-
}
|
2897 |
-
});
|
2898 |
-
}
|
2899 |
-
};
|
2900 |
-
}
|
2901 |
-
return $.fn.inputmask;
|
2902 |
-
}(jQuery), function($) {
|
2903 |
-
return $.extend($.inputmask.defaults.definitions, {
|
2904 |
-
h: {
|
2905 |
-
validator: "[01][0-9]|2[0-3]",
|
2906 |
-
cardinality: 2,
|
2907 |
-
prevalidator: [ {
|
2908 |
-
validator: "[0-2]",
|
2909 |
-
cardinality: 1
|
2910 |
-
} ]
|
2911 |
-
},
|
2912 |
-
s: {
|
2913 |
-
validator: "[0-5][0-9]",
|
2914 |
-
cardinality: 2,
|
2915 |
-
prevalidator: [ {
|
2916 |
-
validator: "[0-5]",
|
2917 |
-
cardinality: 1
|
2918 |
-
} ]
|
2919 |
-
},
|
2920 |
-
d: {
|
2921 |
-
validator: "0[1-9]|[12][0-9]|3[01]",
|
2922 |
-
cardinality: 2,
|
2923 |
-
prevalidator: [ {
|
2924 |
-
validator: "[0-3]",
|
2925 |
-
cardinality: 1
|
2926 |
-
} ]
|
2927 |
-
},
|
2928 |
-
m: {
|
2929 |
-
validator: "0[1-9]|1[012]",
|
2930 |
-
cardinality: 2,
|
2931 |
-
prevalidator: [ {
|
2932 |
-
validator: "[01]",
|
2933 |
-
cardinality: 1
|
2934 |
-
} ]
|
2935 |
-
},
|
2936 |
-
y: {
|
2937 |
-
validator: "(19|20)\\d{2}",
|
2938 |
-
cardinality: 4,
|
2939 |
-
prevalidator: [ {
|
2940 |
-
validator: "[12]",
|
2941 |
-
cardinality: 1
|
2942 |
-
}, {
|
2943 |
-
validator: "(19|20)",
|
2944 |
-
cardinality: 2
|
2945 |
-
}, {
|
2946 |
-
validator: "(19|20)\\d",
|
2947 |
-
cardinality: 3
|
2948 |
-
} ]
|
2949 |
-
}
|
2950 |
-
}), $.extend($.inputmask.defaults.aliases, {
|
2951 |
-
"dd/mm/yyyy": {
|
2952 |
-
mask: "1/2/y",
|
2953 |
-
placeholder: "dd/mm/yyyy",
|
2954 |
-
regex: {
|
2955 |
-
val1pre: new RegExp("[0-3]"),
|
2956 |
-
val1: new RegExp("0[1-9]|[12][0-9]|3[01]"),
|
2957 |
-
val2pre: function(separator) {
|
2958 |
-
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
2959 |
-
return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
|
2960 |
-
},
|
2961 |
-
val2: function(separator) {
|
2962 |
-
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
2963 |
-
return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
|
2964 |
-
}
|
2965 |
-
},
|
2966 |
-
leapday: "29/02/",
|
2967 |
-
separator: "/",
|
2968 |
-
yearrange: {
|
2969 |
-
minyear: 1900,
|
2970 |
-
maxyear: 2099
|
2971 |
-
},
|
2972 |
-
isInYearRange: function(chrs, minyear, maxyear) {
|
2973 |
-
if (isNaN(chrs)) return !1;
|
2974 |
-
var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
|
2975 |
-
return (isNaN(enteredyear) ? !1 : enteredyear >= minyear && maxyear >= enteredyear) || (isNaN(enteredyear2) ? !1 : enteredyear2 >= minyear && maxyear >= enteredyear2);
|
2976 |
-
},
|
2977 |
-
determinebaseyear: function(minyear, maxyear, hint) {
|
2978 |
-
var currentyear = new Date().getFullYear();
|
2979 |
-
if (minyear > currentyear) return minyear;
|
2980 |
-
if (currentyear > maxyear) {
|
2981 |
-
for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxYearPrefix + hint > maxyear; ) maxYearPrefix--;
|
2982 |
-
var maxxYear = maxYearPrefix + maxYearPostfix;
|
2983 |
-
return minyear > maxxYear ? minyear : maxxYear;
|
2984 |
-
}
|
2985 |
-
return currentyear;
|
2986 |
-
},
|
2987 |
-
onKeyUp: function(e) {
|
2988 |
-
var $input = $(this);
|
2989 |
-
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
2990 |
-
var today = new Date();
|
2991 |
-
$input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString());
|
2992 |
-
}
|
2993 |
-
},
|
2994 |
-
definitions: {
|
2995 |
-
"1": {
|
2996 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
2997 |
-
var isValid = opts.regex.val1.test(chrs);
|
2998 |
-
return strict || isValid || chrs.charAt(1) != opts.separator && -1 == "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0",
|
2999 |
-
{
|
3000 |
-
refreshFromBuffer: {
|
3001 |
-
start: pos - 1,
|
3002 |
-
end: pos
|
3003 |
-
},
|
3004 |
-
pos: pos,
|
3005 |
-
c: chrs.charAt(0)
|
3006 |
-
});
|
3007 |
-
},
|
3008 |
-
cardinality: 2,
|
3009 |
-
prevalidator: [ {
|
3010 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3011 |
-
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
3012 |
-
var isValid = 1 == chrs.length ? opts.regex.val1pre.test(chrs) : opts.regex.val1.test(chrs);
|
3013 |
-
return strict || isValid || !(isValid = opts.regex.val1.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3014 |
-
pos++, {
|
3015 |
-
pos: pos
|
3016 |
-
});
|
3017 |
-
},
|
3018 |
-
cardinality: 1
|
3019 |
-
} ]
|
3020 |
-
},
|
3021 |
-
"2": {
|
3022 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3023 |
-
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
3024 |
-
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
3025 |
-
var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
|
3026 |
-
if (!strict && !isValid && (chrs.charAt(1) == opts.separator || -1 != "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
3027 |
-
{
|
3028 |
-
refreshFromBuffer: {
|
3029 |
-
start: pos - 1,
|
3030 |
-
end: pos
|
3031 |
-
},
|
3032 |
-
pos: pos,
|
3033 |
-
c: chrs.charAt(0)
|
3034 |
-
};
|
3035 |
-
if (opts.mask.indexOf("2") == opts.mask.length - 1 && isValid) {
|
3036 |
-
var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
|
3037 |
-
if (dayMonthValue != opts.leapday) return !0;
|
3038 |
-
var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
|
3039 |
-
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3040 |
-
}
|
3041 |
-
return isValid;
|
3042 |
-
},
|
3043 |
-
cardinality: 2,
|
3044 |
-
prevalidator: [ {
|
3045 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3046 |
-
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
3047 |
-
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
3048 |
-
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
3049 |
-
var isValid = 1 == chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
|
3050 |
-
return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3051 |
-
pos++, {
|
3052 |
-
pos: pos
|
3053 |
-
});
|
3054 |
-
},
|
3055 |
-
cardinality: 1
|
3056 |
-
} ]
|
3057 |
-
},
|
3058 |
-
y: {
|
3059 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3060 |
-
if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
3061 |
-
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
3062 |
-
if (dayMonthValue != opts.leapday) return !0;
|
3063 |
-
var year = parseInt(chrs, 10);
|
3064 |
-
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3065 |
-
}
|
3066 |
-
return !1;
|
3067 |
-
},
|
3068 |
-
cardinality: 4,
|
3069 |
-
prevalidator: [ {
|
3070 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3071 |
-
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3072 |
-
if (!strict && !isValid) {
|
3073 |
-
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
|
3074 |
-
if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
3075 |
-
{
|
3076 |
-
pos: pos
|
3077 |
-
};
|
3078 |
-
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2),
|
3079 |
-
isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
3080 |
-
maskset.buffer[pos++] = yearPrefix.charAt(1), {
|
3081 |
-
pos: pos
|
3082 |
-
};
|
3083 |
-
}
|
3084 |
-
return isValid;
|
3085 |
-
},
|
3086 |
-
cardinality: 1
|
3087 |
-
}, {
|
3088 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3089 |
-
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3090 |
-
if (!strict && !isValid) {
|
3091 |
-
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
|
3092 |
-
if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1),
|
3093 |
-
{
|
3094 |
-
pos: pos
|
3095 |
-
};
|
3096 |
-
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2),
|
3097 |
-
opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
3098 |
-
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
3099 |
-
if (dayMonthValue != opts.leapday) isValid = !0; else {
|
3100 |
-
var year = parseInt(chrs, 10);
|
3101 |
-
isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3102 |
-
}
|
3103 |
-
} else isValid = !1;
|
3104 |
-
if (isValid) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), maskset.buffer[pos++] = yearPrefix.charAt(1),
|
3105 |
-
maskset.buffer[pos++] = chrs.charAt(0), {
|
3106 |
-
refreshFromBuffer: {
|
3107 |
-
start: pos - 3,
|
3108 |
-
end: pos
|
3109 |
-
},
|
3110 |
-
pos: pos
|
3111 |
-
};
|
3112 |
-
}
|
3113 |
-
return isValid;
|
3114 |
-
},
|
3115 |
-
cardinality: 2
|
3116 |
-
}, {
|
3117 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3118 |
-
return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3119 |
-
},
|
3120 |
-
cardinality: 3
|
3121 |
-
} ]
|
3122 |
-
}
|
3123 |
-
},
|
3124 |
-
insertMode: !1,
|
3125 |
-
autoUnmask: !1
|
3126 |
-
},
|
3127 |
-
"mm/dd/yyyy": {
|
3128 |
-
placeholder: "mm/dd/yyyy",
|
3129 |
-
alias: "dd/mm/yyyy",
|
3130 |
-
regex: {
|
3131 |
-
val2pre: function(separator) {
|
3132 |
-
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
3133 |
-
return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
|
3134 |
-
},
|
3135 |
-
val2: function(separator) {
|
3136 |
-
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
3137 |
-
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
|
3138 |
-
},
|
3139 |
-
val1pre: new RegExp("[01]"),
|
3140 |
-
val1: new RegExp("0[1-9]|1[012]")
|
3141 |
-
},
|
3142 |
-
leapday: "02/29/",
|
3143 |
-
onKeyUp: function(e) {
|
3144 |
-
var $input = $(this);
|
3145 |
-
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
3146 |
-
var today = new Date();
|
3147 |
-
$input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString());
|
3148 |
-
}
|
3149 |
-
}
|
3150 |
-
},
|
3151 |
-
"yyyy/mm/dd": {
|
3152 |
-
mask: "y/1/2",
|
3153 |
-
placeholder: "yyyy/mm/dd",
|
3154 |
-
alias: "mm/dd/yyyy",
|
3155 |
-
leapday: "/02/29",
|
3156 |
-
onKeyUp: function(e) {
|
3157 |
-
var $input = $(this);
|
3158 |
-
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
3159 |
-
var today = new Date();
|
3160 |
-
$input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString());
|
3161 |
-
}
|
3162 |
-
}
|
3163 |
-
},
|
3164 |
-
"dd.mm.yyyy": {
|
3165 |
-
mask: "1.2.y",
|
3166 |
-
placeholder: "dd.mm.yyyy",
|
3167 |
-
leapday: "29.02.",
|
3168 |
-
separator: ".",
|
3169 |
-
alias: "dd/mm/yyyy"
|
3170 |
-
},
|
3171 |
-
"dd-mm-yyyy": {
|
3172 |
-
mask: "1-2-y",
|
3173 |
-
placeholder: "dd-mm-yyyy",
|
3174 |
-
leapday: "29-02-",
|
3175 |
-
separator: "-",
|
3176 |
-
alias: "dd/mm/yyyy"
|
3177 |
-
},
|
3178 |
-
"mm.dd.yyyy": {
|
3179 |
-
mask: "1.2.y",
|
3180 |
-
placeholder: "mm.dd.yyyy",
|
3181 |
-
leapday: "02.29.",
|
3182 |
-
separator: ".",
|
3183 |
-
alias: "mm/dd/yyyy"
|
3184 |
-
},
|
3185 |
-
"mm-dd-yyyy": {
|
3186 |
-
mask: "1-2-y",
|
3187 |
-
placeholder: "mm-dd-yyyy",
|
3188 |
-
leapday: "02-29-",
|
3189 |
-
separator: "-",
|
3190 |
-
alias: "mm/dd/yyyy"
|
3191 |
-
},
|
3192 |
-
"yyyy.mm.dd": {
|
3193 |
-
mask: "y.1.2",
|
3194 |
-
placeholder: "yyyy.mm.dd",
|
3195 |
-
leapday: ".02.29",
|
3196 |
-
separator: ".",
|
3197 |
-
alias: "yyyy/mm/dd"
|
3198 |
-
},
|
3199 |
-
"yyyy-mm-dd": {
|
3200 |
-
mask: "y-1-2",
|
3201 |
-
placeholder: "yyyy-mm-dd",
|
3202 |
-
leapday: "-02-29",
|
3203 |
-
separator: "-",
|
3204 |
-
alias: "yyyy/mm/dd"
|
3205 |
-
},
|
3206 |
-
datetime: {
|
3207 |
-
mask: "1/2/y h:s",
|
3208 |
-
placeholder: "dd/mm/yyyy hh:mm",
|
3209 |
-
alias: "dd/mm/yyyy",
|
3210 |
-
regex: {
|
3211 |
-
hrspre: new RegExp("[012]"),
|
3212 |
-
hrs24: new RegExp("2[0-4]|1[3-9]"),
|
3213 |
-
hrs: new RegExp("[01][0-9]|2[0-4]"),
|
3214 |
-
ampm: new RegExp("^[a|p|A|P][m|M]"),
|
3215 |
-
mspre: new RegExp("[0-5]"),
|
3216 |
-
ms: new RegExp("[0-5][0-9]")
|
3217 |
-
},
|
3218 |
-
timeseparator: ":",
|
3219 |
-
hourFormat: "24",
|
3220 |
-
definitions: {
|
3221 |
-
h: {
|
3222 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3223 |
-
if ("24" == opts.hourFormat && 24 == parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0",
|
3224 |
-
maskset.buffer[pos] = "0", {
|
3225 |
-
refreshFromBuffer: {
|
3226 |
-
start: pos - 1,
|
3227 |
-
end: pos
|
3228 |
-
},
|
3229 |
-
c: "0"
|
3230 |
-
};
|
3231 |
-
var isValid = opts.regex.hrs.test(chrs);
|
3232 |
-
if (!strict && !isValid && (chrs.charAt(1) == opts.timeseparator || -1 != "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
3233 |
-
maskset.buffer[pos] = chrs.charAt(0), pos++, {
|
3234 |
-
refreshFromBuffer: {
|
3235 |
-
start: pos - 2,
|
3236 |
-
end: pos
|
3237 |
-
},
|
3238 |
-
pos: pos,
|
3239 |
-
c: opts.timeseparator
|
3240 |
-
};
|
3241 |
-
if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
|
3242 |
-
var tmp = parseInt(chrs, 10);
|
3243 |
-
return 24 == tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p",
|
3244 |
-
maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(),
|
3245 |
-
maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1),
|
3246 |
-
maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
|
3247 |
-
refreshFromBuffer: {
|
3248 |
-
start: pos - 1,
|
3249 |
-
end: pos + 6
|
3250 |
-
},
|
3251 |
-
c: maskset.buffer[pos]
|
3252 |
-
};
|
3253 |
-
}
|
3254 |
-
return isValid;
|
3255 |
-
},
|
3256 |
-
cardinality: 2,
|
3257 |
-
prevalidator: [ {
|
3258 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3259 |
-
var isValid = opts.regex.hrspre.test(chrs);
|
3260 |
-
return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3261 |
-
pos++, {
|
3262 |
-
pos: pos
|
3263 |
-
});
|
3264 |
-
},
|
3265 |
-
cardinality: 1
|
3266 |
-
} ]
|
3267 |
-
},
|
3268 |
-
s: {
|
3269 |
-
validator: "[0-5][0-9]",
|
3270 |
-
cardinality: 2,
|
3271 |
-
prevalidator: [ {
|
3272 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3273 |
-
var isValid = opts.regex.mspre.test(chrs);
|
3274 |
-
return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3275 |
-
pos++, {
|
3276 |
-
pos: pos
|
3277 |
-
});
|
3278 |
-
},
|
3279 |
-
cardinality: 1
|
3280 |
-
} ]
|
3281 |
-
},
|
3282 |
-
t: {
|
3283 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3284 |
-
return opts.regex.ampm.test(chrs + "m");
|
3285 |
-
},
|
3286 |
-
casing: "lower",
|
3287 |
-
cardinality: 1
|
3288 |
-
}
|
3289 |
-
},
|
3290 |
-
insertMode: !1,
|
3291 |
-
autoUnmask: !1
|
3292 |
-
},
|
3293 |
-
datetime12: {
|
3294 |
-
mask: "1/2/y h:s t\\m",
|
3295 |
-
placeholder: "dd/mm/yyyy hh:mm xm",
|
3296 |
-
alias: "datetime",
|
3297 |
-
hourFormat: "12"
|
3298 |
-
},
|
3299 |
-
"hh:mm t": {
|
3300 |
-
mask: "h:s t\\m",
|
3301 |
-
placeholder: "hh:mm xm",
|
3302 |
-
alias: "datetime",
|
3303 |
-
hourFormat: "12"
|
3304 |
-
},
|
3305 |
-
"h:s t": {
|
3306 |
-
mask: "h:s t\\m",
|
3307 |
-
placeholder: "hh:mm xm",
|
3308 |
-
alias: "datetime",
|
3309 |
-
hourFormat: "12"
|
3310 |
-
},
|
3311 |
-
"hh:mm:ss": {
|
3312 |
-
mask: "h:s:s",
|
3313 |
-
placeholder: "hh:mm:ss",
|
3314 |
-
alias: "datetime",
|
3315 |
-
autoUnmask: !1
|
3316 |
-
},
|
3317 |
-
"hh:mm": {
|
3318 |
-
mask: "h:s",
|
3319 |
-
placeholder: "hh:mm",
|
3320 |
-
alias: "datetime",
|
3321 |
-
autoUnmask: !1
|
3322 |
-
},
|
3323 |
-
date: {
|
3324 |
-
alias: "dd/mm/yyyy"
|
3325 |
-
},
|
3326 |
-
"mm/yyyy": {
|
3327 |
-
mask: "1/y",
|
3328 |
-
placeholder: "mm/yyyy",
|
3329 |
-
leapday: "donotuse",
|
3330 |
-
separator: "/",
|
3331 |
-
alias: "mm/dd/yyyy"
|
3332 |
-
}
|
3333 |
-
}), $.fn.inputmask;
|
3334 |
-
}(jQuery), function($) {
|
3335 |
-
return $.extend($.inputmask.defaults.definitions, {
|
3336 |
-
A: {
|
3337 |
-
validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
3338 |
-
cardinality: 1,
|
3339 |
-
casing: "upper"
|
3340 |
-
},
|
3341 |
-
"#": {
|
3342 |
-
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
3343 |
-
cardinality: 1,
|
3344 |
-
casing: "upper"
|
3345 |
-
}
|
3346 |
-
}), $.extend($.inputmask.defaults.aliases, {
|
3347 |
-
url: {
|
3348 |
-
mask: "ir",
|
3349 |
-
placeholder: "",
|
3350 |
-
separator: "",
|
3351 |
-
defaultPrefix: "http://",
|
3352 |
-
regex: {
|
3353 |
-
urlpre1: new RegExp("[fh]"),
|
3354 |
-
urlpre2: new RegExp("(ft|ht)"),
|
3355 |
-
urlpre3: new RegExp("(ftp|htt)"),
|
3356 |
-
urlpre4: new RegExp("(ftp:|http|ftps)"),
|
3357 |
-
urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
|
3358 |
-
urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
|
3359 |
-
urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
|
3360 |
-
urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
|
3361 |
-
},
|
3362 |
-
definitions: {
|
3363 |
-
i: {
|
3364 |
-
validator: function() {
|
3365 |
-
return !0;
|
3366 |
-
},
|
3367 |
-
cardinality: 8,
|
3368 |
-
prevalidator: function() {
|
3369 |
-
for (var result = [], prefixLimit = 8, i = 0; prefixLimit > i; i++) result[i] = function() {
|
3370 |
-
var j = i;
|
3371 |
-
return {
|
3372 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3373 |
-
if (opts.regex["urlpre" + (j + 1)]) {
|
3374 |
-
var k, tmp = chrs;
|
3375 |
-
j + 1 - chrs.length > 0 && (tmp = maskset.buffer.join("").substring(0, j + 1 - chrs.length) + "" + tmp);
|
3376 |
-
var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
|
3377 |
-
if (!strict && !isValid) {
|
3378 |
-
for (pos -= j, k = 0; k < opts.defaultPrefix.length; k++) maskset.buffer[pos] = opts.defaultPrefix[k],
|
3379 |
-
pos++;
|
3380 |
-
for (k = 0; k < tmp.length - 1; k++) maskset.buffer[pos] = tmp[k], pos++;
|
3381 |
-
return {
|
3382 |
-
pos: pos
|
3383 |
-
};
|
3384 |
-
}
|
3385 |
-
return isValid;
|
3386 |
-
}
|
3387 |
-
return !1;
|
3388 |
-
},
|
3389 |
-
cardinality: j
|
3390 |
-
};
|
3391 |
-
}();
|
3392 |
-
return result;
|
3393 |
-
}()
|
3394 |
-
},
|
3395 |
-
r: {
|
3396 |
-
validator: ".",
|
3397 |
-
cardinality: 50
|
3398 |
-
}
|
3399 |
-
},
|
3400 |
-
insertMode: !1,
|
3401 |
-
autoUnmask: !1
|
3402 |
-
},
|
3403 |
-
ip: {
|
3404 |
-
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
3405 |
-
definitions: {
|
3406 |
-
i: {
|
3407 |
-
validator: function(chrs, maskset, pos) {
|
3408 |
-
return pos - 1 > -1 && "." != maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
3409 |
-
chrs = pos - 2 > -1 && "." != maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
|
3410 |
-
new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
3411 |
-
},
|
3412 |
-
cardinality: 1
|
3413 |
-
}
|
3414 |
-
}
|
3415 |
-
},
|
3416 |
-
email: {
|
3417 |
-
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
|
3418 |
-
greedy: !1,
|
3419 |
-
onBeforePaste: function(pastedValue) {
|
3420 |
-
return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
|
3421 |
-
},
|
3422 |
-
definitions: {
|
3423 |
-
"*": {
|
3424 |
-
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
|
3425 |
-
cardinality: 1,
|
3426 |
-
casing: "lower"
|
3427 |
-
}
|
3428 |
-
}
|
3429 |
-
}
|
3430 |
-
}), $.fn.inputmask;
|
3431 |
-
}(jQuery), function($) {
|
3432 |
-
return $.extend($.inputmask.defaults.aliases, {
|
3433 |
-
numeric: {
|
3434 |
-
mask: function(opts) {
|
3435 |
-
if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
|
3436 |
-
opts.repeat = 0, opts.groupSeparator == opts.radixPoint && (opts.groupSeparator = "." == opts.radixPoint ? "," : "," == opts.radixPoint ? "." : ""),
|
3437 |
-
" " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" != opts.groupSeparator,
|
3438 |
-
opts.autoGroup && isFinite(opts.integerDigits)) {
|
3439 |
-
var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
|
3440 |
-
opts.integerDigits += 0 == mod ? seps - 1 : seps;
|
3441 |
-
}
|
3442 |
-
opts.definitions[";"] = opts.definitions["~"];
|
3443 |
-
var mask = opts.prefix;
|
3444 |
-
return mask += "[+]", mask += "~{1," + opts.integerDigits + "}", void 0 != opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"),
|
3445 |
-
mask += opts.suffix;
|
3446 |
-
},
|
3447 |
-
placeholder: "",
|
3448 |
-
greedy: !1,
|
3449 |
-
digits: "*",
|
3450 |
-
digitsOptional: !0,
|
3451 |
-
groupSeparator: "",
|
3452 |
-
radixPoint: ".",
|
3453 |
-
radixFocus: !0,
|
3454 |
-
groupSize: 3,
|
3455 |
-
autoGroup: !1,
|
3456 |
-
allowPlus: !0,
|
3457 |
-
allowMinus: !0,
|
3458 |
-
integerDigits: "+",
|
3459 |
-
prefix: "",
|
3460 |
-
suffix: "",
|
3461 |
-
rightAlign: !0,
|
3462 |
-
decimalProtect: !0,
|
3463 |
-
postFormat: function(buffer, pos, reformatOnly, opts) {
|
3464 |
-
var needsRefresh = !1, charAtPos = buffer[pos];
|
3465 |
-
if ("" == opts.groupSeparator || -1 != $.inArray(opts.radixPoint, buffer) && pos >= $.inArray(opts.radixPoint, buffer) || new RegExp("[-+]").test(charAtPos)) return {
|
3466 |
-
pos: pos
|
3467 |
-
};
|
3468 |
-
var cbuf = buffer.slice();
|
3469 |
-
charAtPos == opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
|
3470 |
-
reformatOnly ? cbuf[pos] = "?" : cbuf.splice(pos, 0, "?");
|
3471 |
-
var bufVal = cbuf.join("");
|
3472 |
-
if (opts.autoGroup || reformatOnly && -1 != bufVal.indexOf(opts.groupSeparator)) {
|
3473 |
-
var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
|
3474 |
-
needsRefresh = 0 == bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
|
3475 |
-
var radixSplit = bufVal.split(opts.radixPoint);
|
3476 |
-
if (bufVal = radixSplit[0], bufVal != opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) {
|
3477 |
-
needsRefresh = !0;
|
3478 |
-
for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal); ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
|
3479 |
-
bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
|
3480 |
-
}
|
3481 |
-
radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
|
3482 |
-
}
|
3483 |
-
buffer.length = bufVal.length;
|
3484 |
-
for (var i = 0, l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
|
3485 |
-
var newPos = $.inArray("?", buffer);
|
3486 |
-
return reformatOnly ? buffer[newPos] = charAtPos : buffer.splice(newPos, 1), {
|
3487 |
-
pos: newPos,
|
3488 |
-
refreshFromBuffer: needsRefresh
|
3489 |
-
};
|
3490 |
-
},
|
3491 |
-
onKeyDown: function(e, buffer, caretPos, opts) {
|
3492 |
-
if (e.keyCode == $.inputmask.keyCode.TAB && "0" != opts.placeholder.charAt(0)) {
|
3493 |
-
var radixPosition = $.inArray(opts.radixPoint, buffer);
|
3494 |
-
if (-1 != radixPosition && isFinite(opts.digits)) {
|
3495 |
-
for (var i = 1; i <= opts.digits; i++) (void 0 == buffer[radixPosition + i] || buffer[radixPosition + i] == opts.placeholder.charAt(0)) && (buffer[radixPosition + i] = "0");
|
3496 |
-
return {
|
3497 |
-
refreshFromBuffer: {
|
3498 |
-
start: ++radixPosition,
|
3499 |
-
end: radixPosition + opts.digits
|
3500 |
-
}
|
3501 |
-
};
|
3502 |
-
}
|
3503 |
-
} else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
|
3504 |
-
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
3505 |
-
return rslt.caret = rslt.pos + 1, rslt;
|
3506 |
-
}
|
3507 |
-
},
|
3508 |
-
onKeyPress: function(e, buffer, caretPos, opts) {
|
3509 |
-
if (opts.autoGroup) {
|
3510 |
-
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
3511 |
-
return rslt.caret = rslt.pos + 1, rslt;
|
3512 |
-
}
|
3513 |
-
},
|
3514 |
-
regex: {
|
3515 |
-
integerPart: function() {
|
3516 |
-
return new RegExp("[-+]?\\d+");
|
3517 |
-
},
|
3518 |
-
integerNPart: function() {
|
3519 |
-
return new RegExp("\\d+");
|
3520 |
-
}
|
3521 |
-
},
|
3522 |
-
signHandler: function(chrs, buffer, pos, strict, opts) {
|
3523 |
-
if (!strict && (opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs)) {
|
3524 |
-
var matchRslt = buffer.join("").match(opts.regex.integerPart(opts));
|
3525 |
-
if (matchRslt && matchRslt.length > 0 && "0" !== matchRslt[matchRslt.index]) return buffer[matchRslt.index] == ("-" === chrs ? "+" : "-") ? {
|
3526 |
-
pos: matchRslt.index,
|
3527 |
-
c: chrs,
|
3528 |
-
remove: matchRslt.index,
|
3529 |
-
caret: pos
|
3530 |
-
} : buffer[matchRslt.index] == ("-" === chrs ? "-" : "+") ? {
|
3531 |
-
remove: matchRslt.index,
|
3532 |
-
caret: pos - 1
|
3533 |
-
} : {
|
3534 |
-
pos: matchRslt.index,
|
3535 |
-
c: chrs,
|
3536 |
-
caret: pos + 1
|
3537 |
-
};
|
3538 |
-
}
|
3539 |
-
return !1;
|
3540 |
-
},
|
3541 |
-
radixHandler: function(chrs, maskset, pos, strict, opts) {
|
3542 |
-
if (!strict && chrs === opts.radixPoint) {
|
3543 |
-
var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts));
|
3544 |
-
if (-1 != radixPos) return maskset.validPositions[radixPos - 1] ? {
|
3545 |
-
caret: radixPos + 1
|
3546 |
-
} : {
|
3547 |
-
pos: integerValue.index,
|
3548 |
-
c: integerValue[0],
|
3549 |
-
caret: radixPos + 1
|
3550 |
-
};
|
3551 |
-
}
|
3552 |
-
return !1;
|
3553 |
-
},
|
3554 |
-
leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
|
3555 |
-
var matchRslt = maskset.buffer.join("").match(opts.regex.integerNPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
3556 |
-
if (matchRslt && !strict && (-1 == radixPosition || matchRslt.index < radixPosition)) if (0 == matchRslt[0].indexOf("0") && pos >= opts.prefix.length) {
|
3557 |
-
if (-1 == radixPosition || radixPosition >= pos && void 0 == maskset.validPositions[radixPosition]) return maskset.buffer.splice(matchRslt.index, 1),
|
3558 |
-
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
3559 |
-
pos: pos,
|
3560 |
-
remove: matchRslt.index
|
3561 |
-
};
|
3562 |
-
if (pos > matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1),
|
3563 |
-
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
3564 |
-
pos: pos,
|
3565 |
-
remove: matchRslt.index
|
3566 |
-
};
|
3567 |
-
} else if ("0" == chrs && pos <= matchRslt.index) return !1;
|
3568 |
-
return !0;
|
3569 |
-
},
|
3570 |
-
definitions: {
|
3571 |
-
"~": {
|
3572 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3573 |
-
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3574 |
-
if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts),
|
3575 |
-
!isValid && (isValid = strict ? new RegExp("[0-9" + $.inputmask.escapeRegex.call(this, opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs),
|
3576 |
-
isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts),
|
3577 |
-
isValid === !0)))) {
|
3578 |
-
var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
3579 |
-
opts.digitsOptional === !1 && pos > radixPosition && !strict && (isValid = {
|
3580 |
-
pos: pos,
|
3581 |
-
remove: pos
|
3582 |
-
}), isValid = {
|
3583 |
-
pos: pos
|
3584 |
-
};
|
3585 |
-
}
|
3586 |
-
return isValid;
|
3587 |
-
},
|
3588 |
-
cardinality: 1,
|
3589 |
-
prevalidator: null
|
3590 |
-
},
|
3591 |
-
"+": {
|
3592 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3593 |
-
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3594 |
-
return isValid || (isValid = opts.allowMinus && "-" == chrs || opts.allowPlus && "+" == chrs),
|
3595 |
-
isValid;
|
3596 |
-
},
|
3597 |
-
cardinality: 1,
|
3598 |
-
prevalidator: null,
|
3599 |
-
placeholder: ""
|
3600 |
-
},
|
3601 |
-
":": {
|
3602 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3603 |
-
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3604 |
-
if (!isValid) {
|
3605 |
-
var radix = "[" + $.inputmask.escapeRegex.call(this, opts.radixPoint) + "]";
|
3606 |
-
isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder == opts.radixPoint && (isValid = {
|
3607 |
-
pos: pos,
|
3608 |
-
remove: pos
|
3609 |
-
});
|
3610 |
-
}
|
3611 |
-
return isValid;
|
3612 |
-
},
|
3613 |
-
cardinality: 1,
|
3614 |
-
prevalidator: null,
|
3615 |
-
placeholder: function(opts) {
|
3616 |
-
return opts.radixPoint;
|
3617 |
-
}
|
3618 |
-
}
|
3619 |
-
},
|
3620 |
-
insertMode: !0,
|
3621 |
-
autoUnmask: !1,
|
3622 |
-
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
3623 |
-
var processValue = maskedValue.replace(opts.prefix, "");
|
3624 |
-
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), "");
|
3625 |
-
},
|
3626 |
-
isComplete: function(buffer, opts) {
|
3627 |
-
var maskedValue = buffer.join(""), bufClone = buffer.slice();
|
3628 |
-
if (opts.postFormat(bufClone, 0, !0, opts), bufClone.join("") != maskedValue) return !1;
|
3629 |
-
var processValue = maskedValue.replace(opts.prefix, "");
|
3630 |
-
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
3631 |
-
processValue = processValue.replace($.inputmask.escapeRegex.call(this, opts.radixPoint), "."),
|
3632 |
-
isFinite(processValue);
|
3633 |
-
},
|
3634 |
-
onBeforeMask: function(initialValue, opts) {
|
3635 |
-
if (isFinite(initialValue)) return initialValue.toString().replace(".", opts.radixPoint);
|
3636 |
-
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
3637 |
-
return dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
3638 |
-
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length && (initialValue = initialValue.replace(/,/g, ""),
|
3639 |
-
initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
3640 |
-
initialValue;
|
3641 |
-
}
|
3642 |
-
},
|
3643 |
-
currency: {
|
3644 |
-
prefix: "$ ",
|
3645 |
-
groupSeparator: ",",
|
3646 |
-
radixPoint: ".",
|
3647 |
-
alias: "numeric",
|
3648 |
-
placeholder: "0",
|
3649 |
-
autoGroup: !0,
|
3650 |
-
digits: 2,
|
3651 |
-
digitsOptional: !1,
|
3652 |
-
clearMaskOnLostFocus: !1,
|
3653 |
-
decimalProtect: !0
|
3654 |
-
},
|
3655 |
-
decimal: {
|
3656 |
-
alias: "numeric"
|
3657 |
-
},
|
3658 |
-
integer: {
|
3659 |
-
alias: "numeric",
|
3660 |
-
digits: "0"
|
3661 |
-
}
|
3662 |
-
}), $.fn.inputmask;
|
3663 |
-
}(jQuery), function($) {
|
3664 |
-
return $.extend($.inputmask.defaults.aliases, {
|
3665 |
-
phone: {
|
3666 |
-
url: "phone-codes/phone-codes.js",
|
3667 |
-
maskInit: "+pp(pp)pppppppp",
|
3668 |
-
mask: function(opts) {
|
3669 |
-
opts.definitions = {
|
3670 |
-
p: {
|
3671 |
-
validator: function() {
|
3672 |
-
return !1;
|
3673 |
-
},
|
3674 |
-
cardinality: 1
|
3675 |
-
},
|
3676 |
-
"#": {
|
3677 |
-
validator: "[0-9]",
|
3678 |
-
cardinality: 1
|
3679 |
-
}
|
3680 |
-
};
|
3681 |
-
var maskList = [];
|
3682 |
-
return $.ajax({
|
3683 |
-
url: opts.url,
|
3684 |
-
async: !1,
|
3685 |
-
dataType: "json",
|
3686 |
-
success: function(response) {
|
3687 |
-
maskList = response;
|
3688 |
-
}
|
3689 |
-
}), maskList = maskList.sort(function(a, b) {
|
3690 |
-
return (a.mask || a) < (b.mask || b) ? -1 : 1;
|
3691 |
-
}), maskList.splice(0, 0, opts.maskInit), maskList;
|
3692 |
-
},
|
3693 |
-
nojumps: !0,
|
3694 |
-
nojumpsThreshold: 1
|
3695 |
-
},
|
3696 |
-
phonebe: {
|
3697 |
-
alias: "phone",
|
3698 |
-
url: "phone-codes/phone-be.js",
|
3699 |
-
maskInit: "+32(pp)pppppppp",
|
3700 |
-
nojumpsThreshold: 4
|
3701 |
-
}
|
3702 |
-
}), $.fn.inputmask;
|
3703 |
-
}(jQuery), function($) {
|
3704 |
-
return $.extend($.inputmask.defaults.aliases, {
|
3705 |
-
Regex: {
|
3706 |
-
mask: "r",
|
3707 |
-
greedy: !1,
|
3708 |
-
repeat: "*",
|
3709 |
-
regex: null,
|
3710 |
-
regexTokens: null,
|
3711 |
-
tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
|
3712 |
-
quantifierFilter: /[0-9]+[^,]/,
|
3713 |
-
isComplete: function(buffer, opts) {
|
3714 |
-
return new RegExp(opts.regex).test(buffer.join(""));
|
3715 |
-
},
|
3716 |
-
definitions: {
|
3717 |
-
r: {
|
3718 |
-
validator: function(chrs, maskset, pos, strict, opts) {
|
3719 |
-
function regexToken(isGroup, isQuantifier) {
|
3720 |
-
this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
|
3721 |
-
this.quantifier = {
|
3722 |
-
min: 1,
|
3723 |
-
max: 1
|
3724 |
-
}, this.repeaterPart = void 0;
|
3725 |
-
}
|
3726 |
-
function analyseRegex() {
|
3727 |
-
var match, m, currentToken = new regexToken(), opengroups = [];
|
3728 |
-
for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0],
|
3729 |
-
m.charAt(0)) {
|
3730 |
-
case "(":
|
3731 |
-
opengroups.push(new regexToken(!0));
|
3732 |
-
break;
|
3733 |
-
|
3734 |
-
case ")":
|
3735 |
-
var groupToken = opengroups.pop();
|
3736 |
-
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
|
3737 |
-
break;
|
3738 |
-
|
3739 |
-
case "{":
|
3740 |
-
case "+":
|
3741 |
-
case "*":
|
3742 |
-
var quantifierToken = new regexToken(!1, !0);
|
3743 |
-
m = m.replace(/[{}]/g, "");
|
3744 |
-
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
3745 |
-
if (quantifierToken.quantifier = {
|
3746 |
-
min: mq0,
|
3747 |
-
max: mq1
|
3748 |
-
}, opengroups.length > 0) {
|
3749 |
-
var matches = opengroups[opengroups.length - 1].matches;
|
3750 |
-
if (match = matches.pop(), !match.isGroup) {
|
3751 |
-
var groupToken = new regexToken(!0);
|
3752 |
-
groupToken.matches.push(match), match = groupToken;
|
3753 |
-
}
|
3754 |
-
matches.push(match), matches.push(quantifierToken);
|
3755 |
-
} else {
|
3756 |
-
if (match = currentToken.matches.pop(), !match.isGroup) {
|
3757 |
-
var groupToken = new regexToken(!0);
|
3758 |
-
groupToken.matches.push(match), match = groupToken;
|
3759 |
-
}
|
3760 |
-
currentToken.matches.push(match), currentToken.matches.push(quantifierToken);
|
3761 |
-
}
|
3762 |
-
break;
|
3763 |
-
|
3764 |
-
default:
|
3765 |
-
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
|
3766 |
-
}
|
3767 |
-
currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
|
3768 |
-
}
|
3769 |
-
function validateRegexToken(token, fromGroup) {
|
3770 |
-
var isvalid = !1;
|
3771 |
-
fromGroup && (regexPart += "(", openGroupCount++);
|
3772 |
-
for (var mndx = 0; mndx < token.matches.length; mndx++) {
|
3773 |
-
var matchToken = token.matches[mndx];
|
3774 |
-
if (1 == matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (1 == matchToken.isQuantifier) {
|
3775 |
-
var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
|
3776 |
-
if (isNaN(matchToken.quantifier.max)) {
|
3777 |
-
for (;matchToken.repeaterPart && matchToken.repeaterPart != regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
|
3778 |
-
isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart),
|
3779 |
-
regexPart = regexPartBak + matchToken.quantifier.max;
|
3780 |
-
} else {
|
3781 |
-
for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
|
3782 |
-
regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
|
3783 |
-
}
|
3784 |
-
} else if (void 0 != matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
|
3785 |
-
var testExp;
|
3786 |
-
if ("[" == matchToken.charAt(0)) {
|
3787 |
-
testExp = regexPart, testExp += matchToken;
|
3788 |
-
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
3789 |
-
var exp = new RegExp("^(" + testExp + ")$");
|
3790 |
-
isvalid = exp.test(bufferStr);
|
3791 |
-
} else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" != matchToken.charAt(l)) {
|
3792 |
-
testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
|
3793 |
-
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
3794 |
-
var exp = new RegExp("^(" + testExp + ")$");
|
3795 |
-
if (isvalid = exp.test(bufferStr)) break;
|
3796 |
-
}
|
3797 |
-
regexPart += matchToken;
|
3798 |
-
}
|
3799 |
-
if (isvalid) break;
|
3800 |
-
}
|
3801 |
-
return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
|
3802 |
-
}
|
3803 |
-
null == opts.regexTokens && analyseRegex();
|
3804 |
-
var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
|
3805 |
-
cbuffer.splice(pos, 0, chrs);
|
3806 |
-
for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
|
3807 |
-
var regexToken = opts.regexTokens[i];
|
3808 |
-
if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
|
3809 |
-
}
|
3810 |
-
return isValid;
|
3811 |
-
},
|
3812 |
-
cardinality: 1
|
3813 |
-
}
|
3814 |
-
}
|
3815 |
-
}
|
3816 |
-
}), $.fn.inputmask;
|
3817 |
-
}(jQuery);
|
3818 |
-
|
3819 |
-
jQuery(document).ready(function($){
|
3820 |
-
jQuery(document).on('cf.add', function(){
|
3821 |
-
$("[data-inputmask]").inputmask();
|
3822 |
-
});
|
3823 |
-
jQuery(document).trigger('cf.add');
|
3824 |
-
});
|
3825 |
-
|
3826 |
-
|
3827 |
-
/*! rangeslider.js - v0.3.1 | (c) 2014 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
|
3828 |
-
'use strict';
|
3829 |
-
|
3830 |
-
(function(factory) {
|
3831 |
-
if (typeof define === 'function' && define.amd) {
|
3832 |
-
// AMD. Register as an anonymous module.
|
3833 |
-
define(['jquery'], factory);
|
3834 |
-
}
|
3835 |
-
else if (typeof exports === 'object') {
|
3836 |
-
// CommonJS
|
3837 |
-
factory(require('jquery'));
|
3838 |
-
} else {
|
3839 |
-
// Browser globals
|
3840 |
-
factory(jQuery);
|
3841 |
-
}
|
3842 |
-
}(function($) {
|
3843 |
-
|
3844 |
-
/**
|
3845 |
-
* Range feature detection
|
3846 |
-
* @return {Boolean}
|
3847 |
-
*/
|
3848 |
-
function supportsRange() {
|
3849 |
-
var input = document.createElement('input');
|
3850 |
-
input.setAttribute('type', 'range');
|
3851 |
-
return input.type !== 'text';
|
3852 |
-
}
|
3853 |
-
|
3854 |
-
var pluginName = 'rangeslider',
|
3855 |
-
pluginInstances = [],
|
3856 |
-
inputrange = supportsRange(),
|
3857 |
-
defaults = {
|
3858 |
-
polyfill: true,
|
3859 |
-
rangeClass: 'rangeslider',
|
3860 |
-
disabledClass: 'rangeslider--disabled',
|
3861 |
-
fillClass: 'rangeslider__fill',
|
3862 |
-
handleClass: 'rangeslider__handle',
|
3863 |
-
startEvent: ['mousedown', 'touchstart', 'pointerdown'],
|
3864 |
-
moveEvent: ['mousemove', 'touchmove', 'pointermove'],
|
3865 |
-
endEvent: ['mouseup', 'touchend', 'pointerup']
|
3866 |
-
};
|
3867 |
-
|
3868 |
-
/**
|
3869 |
-
* Delays a function for the given number of milliseconds, and then calls
|
3870 |
-
* it with the arguments supplied.
|
3871 |
-
*
|
3872 |
-
* @param {Function} fn [description]
|
3873 |
-
* @param {Number} wait [description]
|
3874 |
-
* @return {Function}
|
3875 |
-
*/
|
3876 |
-
function delay(fn, wait) {
|
3877 |
-
var args = Array.prototype.slice.call(arguments, 2);
|
3878 |
-
return setTimeout(function(){ return fn.apply(null, args); }, wait);
|
3879 |
-
}
|
3880 |
-
|
3881 |
-
/**
|
3882 |
-
* Returns a debounced function that will make sure the given
|
3883 |
-
* function is not triggered too much.
|
3884 |
-
*
|
3885 |
-
* @param {Function} fn Function to debounce.
|
3886 |
-
* @param {Number} debounceDuration OPTIONAL. The amount of time in milliseconds for which we will debounce the function. (defaults to 100ms)
|
3887 |
-
* @return {Function}
|
3888 |
-
*/
|
3889 |
-
function debounce(fn, debounceDuration) {
|
3890 |
-
debounceDuration = debounceDuration || 100;
|
3891 |
-
return function() {
|
3892 |
-
if (!fn.debouncing) {
|
3893 |
-
var args = Array.prototype.slice.apply(arguments);
|
3894 |
-
fn.lastReturnVal = fn.apply(window, args);
|
3895 |
-
fn.debouncing = true;
|
3896 |
-
}
|
3897 |
-
clearTimeout(fn.debounceTimeout);
|
3898 |
-
fn.debounceTimeout = setTimeout(function(){
|
3899 |
-
fn.debouncing = false;
|
3900 |
-
}, debounceDuration);
|
3901 |
-
return fn.lastReturnVal;
|
3902 |
-
};
|
3903 |
-
}
|
3904 |
-
|
3905 |
-
/**
|
3906 |
-
* Plugin
|
3907 |
-
* @param {String} element
|
3908 |
-
* @param {Object} options
|
3909 |
-
*/
|
3910 |
-
function Plugin(element, options) {
|
3911 |
-
this.$window = $(window);
|
3912 |
-
this.$document = $(document);
|
3913 |
-
this.$element = $(element);
|
3914 |
-
this.options = $.extend( {}, defaults, options );
|
3915 |
-
this._defaults = defaults;
|
3916 |
-
this._name = pluginName;
|
3917 |
-
this.startEvent = this.options.startEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3918 |
-
this.moveEvent = this.options.moveEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3919 |
-
this.endEvent = this.options.endEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3920 |
-
this.polyfill = this.options.polyfill;
|
3921 |
-
this.onInit = this.options.onInit;
|
3922 |
-
this.onSlide = this.options.onSlide;
|
3923 |
-
this.onSlideEnd = this.options.onSlideEnd;
|
3924 |
-
|
3925 |
-
// Plugin should only be used as a polyfill
|
3926 |
-
if (this.polyfill) {
|
3927 |
-
// Input range support?
|
3928 |
-
if (inputrange) { return false; }
|
3929 |
-
}
|
3930 |
-
|
3931 |
-
this.identifier = 'js-' + pluginName + '-' +(+new Date());
|
3932 |
-
this.min = parseFloat(this.$element[0].getAttribute('min') || 0);
|
3933 |
-
this.max = parseFloat(this.$element[0].getAttribute('max') || 100);
|
3934 |
-
this.value = parseFloat(this.$element[0].value || this.min + (this.max-this.min)/2);
|
3935 |
-
this.step = parseFloat(this.$element[0].getAttribute('step') || 1);
|
3936 |
-
this.$fill = $('<div class="' + this.options.fillClass + '" />');
|
3937 |
-
this.$handle = $('<div class="' + this.options.handleClass + '" />');
|
3938 |
-
this.$range = $('<div class="' + this.options.rangeClass + '" id="' + this.identifier + '" />').insertAfter(this.$element).prepend(this.$fill, this.$handle);
|
3939 |
-
|
3940 |
-
// visually hide the input
|
3941 |
-
this.$element.css({
|
3942 |
-
'position': 'absolute',
|
3943 |
-
'width': '1px',
|
3944 |
-
'height': '1px',
|
3945 |
-
'overflow': 'hidden',
|
3946 |
-
'opacity': '0'
|
3947 |
-
});
|
3948 |
-
|
3949 |
-
// Store context
|
3950 |
-
this.handleDown = $.proxy(this.handleDown, this);
|
3951 |
-
this.handleMove = $.proxy(this.handleMove, this);
|
3952 |
-
this.handleEnd = $.proxy(this.handleEnd, this);
|
3953 |
-
|
3954 |
-
this.init();
|
3955 |
-
|
3956 |
-
// Attach Events
|
3957 |
-
var _this = this;
|
3958 |
-
this.$window.on('resize' + '.' + pluginName, debounce(function() {
|
3959 |
-
// Simulate resizeEnd event.
|
3960 |
-
delay(function() { _this.update(); }, 300);
|
3961 |
-
}, 20));
|
3962 |
-
|
3963 |
-
this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown);
|
3964 |
-
|
3965 |
-
// Listen to programmatic value changes
|
3966 |
-
this.$element.on('change' + '.' + pluginName, function(e, data) {
|
3967 |
-
if (data && data.origin === pluginName) {
|
3968 |
-
return;
|
3969 |
-
}
|
3970 |
-
|
3971 |
-
var value = e.target.value,
|
3972 |
-
pos = _this.getPositionFromValue(value);
|
3973 |
-
_this.setPosition(pos);
|
3974 |
-
});
|
3975 |
-
}
|
3976 |
-
|
3977 |
-
Plugin.prototype.init = function() {
|
3978 |
-
if (this.onInit && typeof this.onInit === 'function') {
|
3979 |
-
this.onInit();
|
3980 |
-
}
|
3981 |
-
this.update();
|
3982 |
-
};
|
3983 |
-
|
3984 |
-
Plugin.prototype.update = function() {
|
3985 |
-
this.handleWidth = this.$handle[0].offsetWidth;
|
3986 |
-
this.rangeWidth = this.$range[0].offsetWidth;
|
3987 |
-
this.maxHandleX = this.rangeWidth - this.handleWidth;
|
3988 |
-
this.grabX = this.handleWidth / 2;
|
3989 |
-
this.position = this.getPositionFromValue(this.value);
|
3990 |
-
|
3991 |
-
// Consider disabled state
|
3992 |
-
if (this.$element[0].disabled) {
|
3993 |
-
this.$range.addClass(this.options.disabledClass);
|
3994 |
-
} else {
|
3995 |
-
this.$range.removeClass(this.options.disabledClass);
|
3996 |
-
}
|
3997 |
-
|
3998 |
-
this.setPosition(this.position);
|
3999 |
-
};
|
4000 |
-
|
4001 |
-
Plugin.prototype.handleDown = function(e) {
|
4002 |
-
e.preventDefault();
|
4003 |
-
this.$document.on(this.moveEvent, this.handleMove);
|
4004 |
-
this.$document.on(this.endEvent, this.handleEnd);
|
4005 |
-
|
4006 |
-
// If we click on the handle don't set the new position
|
4007 |
-
if ((' ' + e.target.className + ' ').replace(/[\n\t]/g, ' ').indexOf(this.options.handleClass) > -1) {
|
4008 |
-
return;
|
4009 |
-
}
|
4010 |
-
|
4011 |
-
var posX = this.getRelativePosition(this.$range[0], e),
|
4012 |
-
handleX = this.getPositionFromNode(this.$handle[0]) - this.getPositionFromNode(this.$range[0]);
|
4013 |
-
|
4014 |
-
this.setPosition(posX - this.grabX);
|
4015 |
-
|
4016 |
-
if (posX >= handleX && posX < handleX + this.handleWidth) {
|
4017 |
-
this.grabX = posX - handleX;
|
4018 |
-
}
|
4019 |
-
};
|
4020 |
-
|
4021 |
-
Plugin.prototype.handleMove = function(e) {
|
4022 |
-
e.preventDefault();
|
4023 |
-
var posX = this.getRelativePosition(this.$range[0], e);
|
4024 |
-
this.setPosition(posX - this.grabX);
|
4025 |
-
};
|
4026 |
-
|
4027 |
-
Plugin.prototype.handleEnd = function(e) {
|
4028 |
-
e.preventDefault();
|
4029 |
-
this.$document.off(this.moveEvent, this.handleMove);
|
4030 |
-
this.$document.off(this.endEvent, this.handleEnd);
|
4031 |
-
|
4032 |
-
var posX = this.getRelativePosition(this.$range[0], e);
|
4033 |
-
if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
|
4034 |
-
this.onSlideEnd(posX - this.grabX, this.value);
|
4035 |
-
}
|
4036 |
-
};
|
4037 |
-
|
4038 |
-
Plugin.prototype.cap = function(pos, min, max) {
|
4039 |
-
if (pos < min) { return min; }
|
4040 |
-
if (pos > max) { return max; }
|
4041 |
-
return pos;
|
4042 |
-
};
|
4043 |
-
|
4044 |
-
Plugin.prototype.setPosition = function(pos) {
|
4045 |
-
var value, left;
|
4046 |
-
|
4047 |
-
// Snapping steps
|
4048 |
-
value = (this.getValueFromPosition(this.cap(pos, 0, this.maxHandleX)) / this.step) * this.step;
|
4049 |
-
left = this.getPositionFromValue(value);
|
4050 |
-
|
4051 |
-
// Update ui
|
4052 |
-
this.$fill[0].style.width = (left + this.grabX) + 'px';
|
4053 |
-
this.$handle[0].style.left = left + 'px';
|
4054 |
-
this.setValue(value);
|
4055 |
-
|
4056 |
-
// Update globals
|
4057 |
-
this.position = left;
|
4058 |
-
this.value = value;
|
4059 |
-
|
4060 |
-
if (this.onSlide && typeof this.onSlide === 'function') {
|
4061 |
-
this.onSlide(left, value);
|
4062 |
-
}
|
4063 |
-
};
|
4064 |
-
|
4065 |
-
Plugin.prototype.getPositionFromNode = function(node) {
|
4066 |
-
var i = 0;
|
4067 |
-
while (node !== null) {
|
4068 |
-
i += node.offsetLeft;
|
4069 |
-
node = node.offsetParent;
|
4070 |
-
}
|
4071 |
-
return i;
|
4072 |
-
};
|
4073 |
-
|
4074 |
-
Plugin.prototype.getRelativePosition = function(node, e) {
|
4075 |
-
return (e.pageX || e.originalEvent.clientX || e.originalEvent.touches[0].clientX || e.currentPoint.x) - this.getPositionFromNode(node);
|
4076 |
-
};
|
4077 |
-
|
4078 |
-
Plugin.prototype.getPositionFromValue = function(value) {
|
4079 |
-
var percentage, pos;
|
4080 |
-
percentage = (value - this.min)/(this.max - this.min);
|
4081 |
-
pos = percentage * this.maxHandleX;
|
4082 |
-
return pos;
|
4083 |
-
};
|
4084 |
-
|
4085 |
-
Plugin.prototype.getValueFromPosition = function(pos) {
|
4086 |
-
var percentage, value;
|
4087 |
-
percentage = ((pos) / (this.maxHandleX || 1));
|
4088 |
-
value = this.step * Math.ceil((((percentage) * (this.max - this.min)) + this.min) / this.step);
|
4089 |
-
return Number((value).toFixed(2));
|
4090 |
-
};
|
4091 |
-
|
4092 |
-
Plugin.prototype.setValue = function(value) {
|
4093 |
-
if (value !== this.value) {
|
4094 |
-
this.$element.val(value).trigger('change', {origin: pluginName});
|
4095 |
-
}
|
4096 |
-
};
|
4097 |
-
|
4098 |
-
Plugin.prototype.destroy = function() {
|
4099 |
-
this.$document.off(this.startEvent, '#' + this.identifier, this.handleDown);
|
4100 |
-
this.$element
|
4101 |
-
.off('.' + pluginName)
|
4102 |
-
.removeAttr('style')
|
4103 |
-
.removeData('plugin_' + pluginName);
|
4104 |
-
|
4105 |
-
// Remove the generated markup
|
4106 |
-
if (this.$range && this.$range.length) {
|
4107 |
-
this.$range[0].parentNode.removeChild(this.$range[0]);
|
4108 |
-
}
|
4109 |
-
|
4110 |
-
// Remove global events if there isn't any instance anymore.
|
4111 |
-
pluginInstances.splice(pluginInstances.indexOf(this.$element[0]),1);
|
4112 |
-
if (!pluginInstances.length) {
|
4113 |
-
this.$window.off('.' + pluginName);
|
4114 |
-
}
|
4115 |
-
};
|
4116 |
-
|
4117 |
-
// A really lightweight plugin wrapper around the constructor,
|
4118 |
-
// preventing against multiple instantiations
|
4119 |
-
$.fn[pluginName] = function(options) {
|
4120 |
-
return this.each(function() {
|
4121 |
-
var $this = $(this),
|
4122 |
-
data = $this.data('plugin_' + pluginName);
|
4123 |
-
|
4124 |
-
// Create a new instance.
|
4125 |
-
if (!data) {
|
4126 |
-
$this.data('plugin_' + pluginName, (data = new Plugin(this, options)));
|
4127 |
-
pluginInstances.push(this);
|
4128 |
-
}
|
4129 |
-
|
4130 |
-
// Make it possible to access methods from public.
|
4131 |
-
// e.g `$element.rangeslider('method');`
|
4132 |
-
if (typeof options === 'string') {
|
4133 |
-
data[options]();
|
4134 |
-
}
|
4135 |
-
});
|
4136 |
-
};
|
4137 |
-
|
4138 |
-
}));
|
4139 |
-
|
4140 |
-
/*!
|
4141 |
-
* jQuery Raty - A Star Rating Plugin
|
4142 |
-
*
|
4143 |
-
* The MIT License
|
4144 |
-
*
|
4145 |
-
* @author : Washington Botelho
|
4146 |
-
* @doc : http://wbotelhos.com/raty
|
4147 |
-
* @version : 2.6.0
|
4148 |
-
*
|
4149 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4150 |
|
4151 |
-
|
4152 |
-
|
4153 |
-
|
4154 |
-
var methods = {
|
4155 |
-
init: function(options) {
|
4156 |
-
return this.each(function() {
|
4157 |
-
this.self = $(this);
|
4158 |
-
|
4159 |
-
methods.destroy.call(this.self);
|
4160 |
-
|
4161 |
-
this.opt = $.extend(true, {}, $.fn.raty.defaults, options);
|
4162 |
-
|
4163 |
-
methods._adjustCallback.call(this);
|
4164 |
-
|
4165 |
-
methods._adjustNumber.call(this);
|
4166 |
-
|
4167 |
-
if (this.opt.starType !== 'img') {
|
4168 |
-
methods._adjustStarType.call(this);
|
4169 |
-
}
|
4170 |
-
|
4171 |
-
methods._adjustPath.call(this);
|
4172 |
-
methods._createStars.call(this);
|
4173 |
-
|
4174 |
-
if (this.opt.cancel) {
|
4175 |
-
methods._createCancel.call(this);
|
4176 |
-
}
|
4177 |
-
|
4178 |
-
if (this.opt.precision) {
|
4179 |
-
methods._adjustPrecision.call(this);
|
4180 |
-
}
|
4181 |
-
|
4182 |
-
methods._createScore.call(this);
|
4183 |
-
methods._apply.call(this, this.opt.score);
|
4184 |
-
methods._target.call(this, this.opt.score);
|
4185 |
-
|
4186 |
-
if (this.opt.readOnly) {
|
4187 |
-
methods._lock.call(this);
|
4188 |
-
} else {
|
4189 |
-
this.style.cursor = 'pointer';
|
4190 |
-
|
4191 |
-
methods._binds.call(this);
|
4192 |
-
}
|
4193 |
-
|
4194 |
-
this.self.data('options', this.opt);
|
4195 |
-
});
|
4196 |
-
},
|
4197 |
-
|
4198 |
-
_adjustCallback: function() {
|
4199 |
-
var options = ['number', 'readOnly', 'score', 'scoreName'];
|
4200 |
-
|
4201 |
-
for (var i = 0; i < options.length; i++) {
|
4202 |
-
if (typeof this.opt[options[i]] === 'function') {
|
4203 |
-
this.opt[options[i]] = this.opt[options[i]].call(this);
|
4204 |
-
}
|
4205 |
-
}
|
4206 |
-
},
|
4207 |
-
|
4208 |
-
_adjustNumber: function() {
|
4209 |
-
this.opt.number = methods._between(this.opt.number, 1, this.opt.numberMax);
|
4210 |
-
},
|
4211 |
-
|
4212 |
-
_adjustPath: function() {
|
4213 |
-
this.opt.path = this.opt.path || '';
|
4214 |
-
|
4215 |
-
if (this.opt.path && this.opt.path.charAt(this.opt.path.length - 1) !== '/') {
|
4216 |
-
this.opt.path += '/';
|
4217 |
-
}
|
4218 |
-
},
|
4219 |
-
|
4220 |
-
_adjustPrecision: function() {
|
4221 |
-
this.opt.half = true;
|
4222 |
-
this.opt.targetType = 'score';
|
4223 |
-
},
|
4224 |
-
|
4225 |
-
_adjustStarType: function() {
|
4226 |
-
this.opt.path = '';
|
4227 |
-
|
4228 |
-
var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn'];
|
4229 |
-
|
4230 |
-
for (var i = 0; i < replaces.length; i++) {
|
4231 |
-
this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
|
4232 |
-
}
|
4233 |
-
},
|
4234 |
-
|
4235 |
-
_apply: function(score) {
|
4236 |
-
methods._fill.call(this, score);
|
4237 |
-
|
4238 |
-
if (score) {
|
4239 |
-
if (score > 0) {
|
4240 |
-
this.score.val(methods._between(score, 0, this.opt.number));
|
4241 |
-
}
|
4242 |
-
|
4243 |
-
methods._roundStars.call(this, score);
|
4244 |
-
}
|
4245 |
-
},
|
4246 |
-
|
4247 |
-
_between: function(value, min, max) {
|
4248 |
-
return Math.min(Math.max(parseFloat(value), min), max);
|
4249 |
-
},
|
4250 |
-
|
4251 |
-
_binds: function() {
|
4252 |
-
if (this.cancel) {
|
4253 |
-
methods._bindOverCancel.call(this);
|
4254 |
-
methods._bindClickCancel.call(this);
|
4255 |
-
methods._bindOutCancel.call(this);
|
4256 |
-
}
|
4257 |
-
|
4258 |
-
methods._bindOver.call(this);
|
4259 |
-
methods._bindClick.call(this);
|
4260 |
-
methods._bindOut.call(this);
|
4261 |
-
},
|
4262 |
-
|
4263 |
-
_bindClick: function() {
|
4264 |
-
var that = this;
|
4265 |
-
|
4266 |
-
that.stars.on('click.raty', function(evt) {
|
4267 |
-
var star = $(this);
|
4268 |
-
|
4269 |
-
that.score.val((that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || star.data('alt')));
|
4270 |
-
|
4271 |
-
if (that.opt.click) {
|
4272 |
-
that.opt.click.call(that, +that.score.val(), evt);
|
4273 |
-
}
|
4274 |
-
});
|
4275 |
-
},
|
4276 |
-
|
4277 |
-
_bindClickCancel: function() {
|
4278 |
-
var that = this;
|
4279 |
-
|
4280 |
-
that.cancel.on('click.raty', function(evt) {
|
4281 |
-
that.score.removeAttr('value');
|
4282 |
-
|
4283 |
-
if (that.opt.click) {
|
4284 |
-
that.opt.click.call(that, null, evt);
|
4285 |
-
}
|
4286 |
-
});
|
4287 |
-
},
|
4288 |
-
|
4289 |
-
_bindOut: function() {
|
4290 |
-
var that = this;
|
4291 |
-
|
4292 |
-
that.self.on('mouseleave.raty', function(evt) {
|
4293 |
-
var score = +that.score.val() || undefined;
|
4294 |
-
|
4295 |
-
methods._apply.call(that, score);
|
4296 |
-
methods._target.call(that, score, evt);
|
4297 |
|
4298 |
-
|
4299 |
-
|
4300 |
-
|
4301 |
-
});
|
4302 |
-
},
|
4303 |
|
4304 |
-
|
4305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4306 |
|
4307 |
-
|
4308 |
-
|
4309 |
-
|
4310 |
-
cancelOff = that.opt.path + that.opt.cancelOff;
|
4311 |
|
4312 |
-
|
4313 |
-
|
4314 |
-
|
4315 |
-
|
|
|
|
|
4316 |
|
4317 |
-
|
4318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4319 |
|
4320 |
-
|
4321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4322 |
|
4323 |
-
|
4324 |
-
|
4325 |
-
|
4326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4327 |
|
4328 |
-
|
4329 |
-
|
4330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4331 |
|
4332 |
-
|
4333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4334 |
|
4335 |
-
|
|
|
|
|
4336 |
|
4337 |
-
|
4338 |
-
|
|
|
|
|
4339 |
|
4340 |
-
|
4341 |
-
|
|
|
4342 |
|
4343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4344 |
|
4345 |
-
|
4346 |
-
|
4347 |
-
|
4348 |
-
});
|
4349 |
-
},
|
4350 |
|
4351 |
-
|
4352 |
-
|
|
|
|
|
|
|
|
|
4353 |
|
4354 |
-
|
4355 |
-
|
4356 |
-
|
4357 |
-
|
4358 |
-
|
|
|
4359 |
|
4360 |
-
|
4361 |
-
|
4362 |
-
|
4363 |
-
|
4364 |
-
|
4365 |
|
4366 |
-
|
|
|
|
|
|
|
|
|
|
|
4367 |
|
4368 |
-
|
4369 |
-
|
|
|
|
|
4370 |
|
4371 |
-
|
4372 |
-
|
4373 |
-
|
4374 |
-
|
4375 |
-
|
4376 |
-
|
4377 |
-
|
4378 |
-
|
4379 |
-
|
4380 |
-
|
4381 |
-
|
4382 |
-
|
4383 |
-
|
4384 |
-
|
4385 |
-
|
4386 |
-
|
4387 |
-
|
4388 |
-
|
4389 |
-
|
4390 |
-
|
4391 |
-
|
4392 |
-
|
4393 |
-
|
4394 |
-
|
4395 |
-
|
4396 |
-
|
4397 |
-
|
4398 |
-
|
4399 |
-
|
4400 |
-
|
4401 |
-
|
4402 |
-
|
4403 |
-
|
4404 |
-
|
4405 |
-
|
4406 |
-
|
4407 |
-
|
4408 |
-
|
4409 |
-
|
4410 |
-
|
4411 |
-
|
4412 |
-
|
4413 |
-
|
4414 |
-
|
4415 |
-
|
4416 |
-
|
4417 |
-
|
4418 |
-
|
4419 |
-
|
4420 |
-
|
4421 |
-
|
4422 |
-
|
4423 |
-
|
4424 |
-
|
4425 |
-
|
4426 |
-
|
4427 |
-
|
4428 |
-
|
4429 |
-
|
4430 |
-
|
4431 |
-
|
4432 |
-
|
4433 |
-
|
4434 |
-
|
4435 |
-
|
4436 |
-
|
4437 |
-
|
4438 |
-
|
4439 |
-
|
4440 |
-
|
4441 |
-
|
4442 |
-
|
4443 |
-
|
4444 |
-
|
4445 |
-
|
4446 |
-
|
4447 |
-
|
4448 |
-
|
4449 |
-
|
4450 |
-
|
4451 |
-
|
4452 |
-
|
4453 |
-
|
4454 |
-
|
4455 |
-
|
4456 |
-
|
4457 |
-
|
4458 |
-
|
4459 |
-
|
4460 |
-
|
4461 |
-
|
4462 |
-
|
4463 |
-
|
4464 |
-
|
4465 |
-
|
4466 |
-
|
4467 |
-
|
4468 |
-
|
4469 |
-
|
4470 |
-
|
4471 |
-
|
4472 |
-
|
4473 |
-
|
4474 |
-
|
4475 |
-
|
4476 |
-
|
4477 |
-
|
4478 |
-
|
4479 |
-
|
4480 |
-
|
4481 |
-
|
4482 |
-
|
4483 |
-
|
4484 |
-
|
4485 |
-
|
4486 |
-
|
4487 |
-
|
4488 |
-
|
4489 |
-
|
4490 |
-
|
4491 |
-
|
4492 |
-
|
4493 |
-
|
4494 |
-
|
4495 |
-
|
4496 |
-
|
4497 |
-
|
4498 |
-
|
4499 |
-
|
4500 |
-
|
4501 |
-
|
4502 |
-
|
4503 |
-
|
4504 |
-
|
4505 |
-
|
4506 |
-
|
4507 |
-
|
4508 |
-
|
4509 |
-
|
4510 |
-
|
4511 |
-
|
4512 |
-
|
4513 |
-
|
4514 |
-
|
4515 |
-
|
4516 |
-
|
4517 |
-
|
4518 |
-
|
4519 |
-
|
4520 |
-
|
4521 |
-
|
4522 |
-
|
4523 |
-
|
4524 |
-
|
4525 |
-
|
4526 |
-
|
4527 |
-
|
4528 |
-
|
4529 |
-
|
4530 |
-
|
4531 |
-
|
4532 |
-
|
4533 |
-
|
4534 |
-
|
4535 |
-
|
4536 |
-
|
4537 |
-
|
4538 |
-
|
4539 |
-
|
4540 |
-
|
4541 |
-
|
4542 |
-
|
4543 |
-
|
4544 |
-
|
4545 |
-
|
4546 |
-
|
4547 |
-
|
4548 |
-
|
4549 |
-
|
4550 |
-
|
4551 |
-
|
4552 |
-
|
4553 |
-
|
4554 |
-
|
4555 |
-
|
4556 |
-
|
4557 |
-
|
4558 |
-
|
4559 |
-
|
4560 |
-
|
4561 |
-
|
4562 |
-
|
4563 |
-
|
4564 |
-
|
4565 |
-
|
4566 |
-
|
4567 |
-
|
4568 |
-
|
4569 |
-
|
4570 |
-
|
4571 |
-
|
4572 |
-
|
4573 |
-
|
4574 |
-
|
4575 |
-
|
4576 |
-
|
4577 |
-
|
4578 |
-
|
4579 |
-
|
4580 |
-
|
4581 |
-
|
4582 |
-
|
4583 |
-
|
4584 |
-
|
4585 |
-
|
4586 |
-
|
4587 |
-
|
4588 |
-
|
4589 |
-
|
4590 |
-
|
4591 |
-
|
4592 |
-
|
4593 |
-
|
4594 |
-
|
4595 |
-
|
4596 |
-
|
4597 |
-
|
4598 |
-
|
4599 |
-
|
4600 |
-
|
4601 |
-
|
4602 |
-
|
4603 |
-
|
4604 |
-
|
4605 |
-
|
4606 |
-
|
4607 |
-
|
4608 |
-
|
4609 |
-
|
4610 |
-
|
4611 |
-
|
4612 |
-
|
4613 |
-
|
4614 |
-
|
4615 |
-
|
4616 |
-
|
4617 |
-
|
4618 |
-
|
4619 |
-
|
4620 |
-
|
4621 |
-
|
4622 |
-
|
4623 |
-
|
4624 |
-
|
4625 |
-
|
4626 |
-
|
4627 |
-
|
4628 |
-
|
4629 |
-
|
4630 |
-
|
4631 |
-
|
4632 |
-
|
4633 |
-
|
4634 |
-
|
4635 |
-
|
4636 |
-
|
4637 |
-
|
4638 |
-
|
4639 |
-
|
4640 |
-
|
4641 |
-
|
4642 |
-
|
4643 |
-
|
4644 |
-
|
4645 |
-
|
4646 |
-
|
4647 |
-
|
4648 |
-
|
4649 |
-
|
4650 |
-
|
4651 |
-
|
4652 |
-
|
4653 |
-
|
4654 |
-
|
4655 |
-
|
4656 |
-
|
4657 |
-
|
4658 |
-
|
4659 |
-
|
4660 |
-
|
4661 |
-
|
4662 |
-
|
4663 |
-
|
4664 |
-
|
4665 |
-
|
4666 |
-
|
4667 |
-
|
4668 |
-
|
4669 |
-
|
4670 |
-
|
4671 |
-
|
4672 |
-
|
4673 |
-
|
4674 |
-
|
4675 |
-
|
4676 |
-
|
4677 |
-
|
4678 |
-
|
4679 |
-
|
4680 |
-
|
4681 |
-
|
4682 |
-
|
4683 |
-
|
4684 |
-
|
4685 |
-
|
4686 |
-
|
4687 |
-
|
4688 |
-
|
4689 |
-
|
4690 |
-
|
4691 |
-
|
4692 |
-
|
4693 |
-
|
4694 |
-
|
4695 |
-
|
4696 |
-
|
4697 |
-
|
4698 |
-
|
4699 |
-
|
4700 |
-
|
4701 |
-
|
4702 |
-
|
4703 |
-
|
4704 |
-
|
4705 |
-
|
4706 |
-
|
4707 |
-
|
4708 |
-
|
4709 |
-
|
4710 |
-
|
4711 |
-
|
4712 |
-
|
4713 |
-
|
4714 |
-
|
4715 |
-
|
4716 |
-
|
4717 |
-
|
4718 |
-
|
4719 |
-
|
4720 |
-
|
4721 |
-
|
4722 |
-
|
4723 |
-
|
4724 |
-
|
4725 |
-
|
4726 |
-
|
4727 |
-
|
4728 |
-
|
4729 |
-
|
4730 |
-
|
4731 |
-
|
4732 |
-
|
4733 |
-
|
4734 |
-
|
4735 |
-
|
4736 |
-
|
4737 |
-
|
4738 |
-
|
4739 |
-
|
4740 |
-
|
4741 |
-
|
4742 |
-
|
4743 |
-
|
4744 |
-
|
4745 |
-
|
4746 |
-
|
4747 |
-
|
4748 |
-
|
4749 |
-
|
4750 |
-
|
4751 |
-
|
4752 |
-
|
4753 |
-
|
4754 |
-
|
4755 |
-
|
4756 |
-
|
4757 |
-
|
4758 |
-
|
4759 |
-
|
4760 |
-
|
4761 |
-
|
4762 |
-
|
4763 |
-
|
4764 |
-
|
4765 |
-
|
4766 |
-
|
4767 |
-
|
4768 |
-
|
4769 |
-
|
4770 |
-
|
4771 |
-
|
4772 |
-
|
4773 |
-
|
4774 |
-
|
4775 |
-
|
4776 |
-
|
4777 |
-
|
4778 |
-
|
4779 |
-
|
4780 |
-
|
4781 |
-
|
4782 |
-
|
4783 |
-
|
4784 |
-
|
4785 |
-
|
4786 |
-
|
4787 |
-
|
4788 |
-
|
4789 |
-
|
4790 |
-
|
4791 |
-
|
4792 |
-
|
4793 |
-
|
4794 |
-
|
4795 |
-
|
4796 |
-
|
4797 |
-
|
4798 |
-
|
4799 |
-
|
4800 |
-
|
4801 |
-
|
4802 |
-
|
4803 |
-
|
4804 |
-
|
4805 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4806 |
|
4807 |
})(jQuery);
|
4808 |
|
@@ -4821,7 +4839,7 @@ jQuery(function($){
|
|
4821 |
});
|
4822 |
});
|
4823 |
|
4824 |
-
function toggle_button_init(id, el){
|
4825 |
|
4826 |
var field = jQuery(el),
|
4827 |
checked = field.find('.cf-toggle-group-radio:checked');
|
@@ -4829,5 +4847,5 @@ function toggle_button_init(id, el){
|
|
4829 |
if(checked.length){
|
4830 |
jQuery('#' + checked.data('ref') ).trigger('click');
|
4831 |
}
|
4832 |
-
|
4833 |
}
|
5 |
*
|
6 |
* Dual licensed under the MIT or GPL Version 2 licenses
|
7 |
*
|
8 |
+
*/
|
9 |
if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val());if(!color)color='ffffff';var hsb=hex2hsb(color);var trigger=$('<span class="input-group-addon" style="background-color: #'+color+'" href="#"></span>');trigger.insertAfter(input);input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase',o.letterCase?o.letterCase:'uppercase').data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).data('close',o.close?o.close:null).data('open',o.open?o.open:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase)).trigger('change');if(o.readonly)input.prop('readonly',true);if(o.disabled)disable(input);trigger.on('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#').trigger('change');show(input)});input.on('focus.miniColors',function(event){if(input.val()==='')input.val('#').trigger('change');show(input)});input.on('blur.miniColors',function(event){var hex=expandHex(hsb2hex(input.data('hsb')));input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'').trigger('change')});input.on('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.on('keyup.miniColors',function(event){setColorFromInput(input)});input.on('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').off('.miniColors');$(document).off('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').css('opacity',1)};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').css('opacity',0.5)};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('<div class="miniColors-selector"></div>');selector.append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').css('display','none').addClass(input.attr('class')).removeClass('form-control');var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition.y+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);var trigger=input.data('trigger'),hidden=!input.is(':visible'),top=hidden?trigger.offset().top+trigger.outerHeight():input.offset().top+input.outerHeight(),left=hidden?trigger.offset().left:input.offset().left,selectorWidth=selector.outerWidth(),selectorHeight=selector.outerHeight(),triggerWidth=trigger.outerWidth(),triggerHeight=trigger.outerHeight(),windowHeight=$(window).height(),windowWidth=$(window).width(),scrollTop=$(window).scrollTop(),scrollLeft=$(window).scrollLeft();if((top+selectorHeight)>windowHeight+scrollTop)top=top-selectorHeight-triggerHeight;if((left+selectorWidth)>windowWidth+scrollLeft)left=left-selectorWidth+triggerWidth;selector.css({top:top,left:left}).fadeIn(100);selector.on('selectstart',function(){return false});if(!$.browser.msie||($.browser.msie&&$.browser.version>=9)){$(window).on('resize.miniColors',function(event){hide(input)})}$(document).on('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);var testSubject=$(event.target).parents().andSelf();if(testSubject.hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if(testSubject.hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if(testSubject.hasClass('miniColors-selector')){event.preventDefault();return}if(testSubject.hasClass('miniColors'))return;hide(input)});$(document).on('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).on('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event)}});if(input.data('open')){input.data('open').call(input.get(0),'#'+hsb2hex(hsb),hsb2rgb(hsb))}};var hide=function(input){if(!input)input=$('.miniColors');input.each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){if(input.data('close')){var hsb=input.data('hsb'),hex=hsb2hex(hsb);input.data('close').call(input.get(0),'#'+hex,hsb2rgb(hsb))}$(this).remove()})});$(document).off('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-5;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-5;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position={y:event.pageY};if(event.originalEvent.changedTouches){position.y=event.originalEvent.changedTouches[0].pageY}position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-1;if(position.y<=-1)position.y=-1;if(position.y>=149)position.y=149;input.data('huePosition',position);huePicker.css('top',position.y).show();var h=Math.round((150-position.y-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb);if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase'))).trigger('change');input.data('trigger').css('backgroundColor','#'+hex);if(input.data('selector'))input.data('selector').find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));if(input.data('change')){if(hex===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,hsb2rgb(hsb));input.data('lastChange',hex)}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val())).trigger('change');var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var currentHSB=input.data('hsb');if(hsb.h===currentHSB.h&&hsb.s===currentHSB.s&&hsb.b===currentHSB.b)return true;var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition.y+'px');input.data('huePosition',huePosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='lowercase')return string.toLowerCase();if(letterCase==='uppercase')return string.toUpperCase();return string};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return{y:y-1}};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data).trigger('change');setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery);
|
10 |
+
|
11 |
+
|
12 |
function color_picker_init(){
|
13 |
jQuery('.minicolor-picker').miniColors();
|
14 |
}
|
15 |
|
16 |
+
document.addEventListener('load', color_picker_init , false);
|
17 |
+
|
18 |
+
jQuery( document ).ajaxComplete(function() {
|
19 |
+
color_picker_init();
|
20 |
+
});
|
21 |
+
|
22 |
/* =========================================================
|
23 |
* bootstrap-cfdatepicker.js
|
24 |
* Repo: https://github.com/eternicode/bootstrap-cfdatepicker/
|
138 |
|
139 |
if (this.o.calendarWeeks)
|
140 |
this.picker.find('tfoot th.today')
|
141 |
+
.attr('colspan', function(i, val){
|
142 |
+
return parseInt(val) + 1;
|
143 |
+
});
|
144 |
|
145 |
this._allow_update = false;
|
146 |
|
379 |
'mousedown touchstart': $.proxy(function(e){
|
380 |
// Clicked outside the cfdatepicker, hide it
|
381 |
if (!(
|
382 |
+
this.element.is(e.target) ||
|
383 |
+
this.element.find(e.target).length ||
|
384 |
+
this.picker.is(e.target) ||
|
385 |
+
this.picker.find(e.target).length
|
386 |
+
)){
|
387 |
this.hide();
|
388 |
}
|
389 |
}, this)
|
568 |
windowHeight = $window.height(),
|
569 |
scrollTop = $window.scrollTop();
|
570 |
|
571 |
+
|
572 |
+
var formID = jQuery( this.element ).data( 'form-id' );
|
573 |
+
var maybeModal = document.getElementById( 'modal-' + formID + '-content' );
|
574 |
+
var zIndex;
|
575 |
+
|
576 |
+
if( null !== maybeModal ){
|
577 |
+
zIndex = 10000;
|
578 |
+
}else{
|
579 |
+
zIndex = parseInt(this.element.parents().filter(function(){
|
580 |
+
return $(this).css('z-index') !== 'auto';
|
581 |
+
}).first().css('z-index'))+10;
|
582 |
+
}
|
583 |
+
|
584 |
var offset = this.component ? this.component.parent().offset() : this.element.offset();
|
585 |
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
|
586 |
var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
|
651 |
}
|
652 |
else {
|
653 |
dates = this.isInput
|
654 |
+
? this.element.val()
|
655 |
+
: this.element.data('date') || this.element.find('input').val();
|
656 |
if (dates && this.o.multidate)
|
657 |
dates = dates.split(this.o.multidateSeparator);
|
658 |
else
|
711 |
|
712 |
fillMonths: function(){
|
713 |
var html = '',
|
714 |
+
i = 0;
|
715 |
while (i < 12){
|
716 |
html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
|
717 |
}
|
777 |
cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
|
778 |
tooltip;
|
779 |
this.picker.find('.cfdatepicker-days thead th.cfdatepicker-switch')
|
780 |
+
.text(dates[this.o.language].months[month]+' '+year);
|
781 |
this.picker.find('tfoot th.today')
|
782 |
+
.text(todaytxt)
|
783 |
+
.toggle(this.o.todayBtn !== false);
|
784 |
this.picker.find('tfoot th.clear')
|
785 |
+
.text(cleartxt)
|
786 |
+
.toggle(this.o.clearBtn !== false);
|
787 |
this.updateNavArrows();
|
788 |
this.fillMonths();
|
789 |
var prevMonth = UTCDate(year, month-1, 28),
|
843 |
this.picker.find('.cfdatepicker-days tbody').empty().append(html.join(''));
|
844 |
|
845 |
var months = this.picker.find('.cfdatepicker-months')
|
846 |
+
.find('th:eq(1)')
|
847 |
+
.text(year)
|
848 |
+
.end()
|
849 |
+
.find('span').removeClass('active');
|
850 |
|
851 |
$.each(this.dates, function(i, d){
|
852 |
if (d.getUTCFullYear() === year)
|
866 |
html = '';
|
867 |
year = parseInt(year/10, 10) * 10;
|
868 |
var yearCont = this.picker.find('.cfdatepicker-years')
|
869 |
+
.find('th:eq(1)')
|
870 |
+
.text(year + '-' + (year + 9))
|
871 |
+
.end()
|
872 |
+
.find('td');
|
873 |
year -= 1;
|
874 |
var years = $.map(this.dates, function(d){
|
875 |
return d.getUTCFullYear();
|
1099 |
// If going back one month, make sure month is not current month
|
1100 |
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
|
1101 |
? function(){
|
1102 |
+
return new_date.getUTCMonth() === month;
|
1103 |
+
}
|
1104 |
// If going forward one month, make sure month is as expected
|
1105 |
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
|
1106 |
: function(){
|
1107 |
+
return new_date.getUTCMonth() !== new_month;
|
1108 |
+
};
|
1109 |
new_month = month + dir;
|
1110 |
new_date.setUTCMonth(new_month);
|
1111 |
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
|
1268 |
.find('>div')
|
1269 |
.hide()
|
1270 |
.filter('.cfdatepicker-'+DPGlobal.modes[this.viewMode].clsName)
|
1271 |
+
.css('display', 'block');
|
1272 |
this.updateNavArrows();
|
1273 |
}
|
1274 |
};
|
1475 |
clsName: 'years',
|
1476 |
navFnc: 'FullYear',
|
1477 |
navStep: 10
|
1478 |
+
}],
|
1479 |
isLeapYear: function(year){
|
1480 |
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
|
1481 |
},
|
1628 |
return date.join('');
|
1629 |
},
|
1630 |
headTemplate: '<thead>'+
|
1631 |
+
'<tr>'+
|
1632 |
+
'<th class="prev">«</th>'+
|
1633 |
+
'<th colspan="5" class="cfdatepicker-switch"></th>'+
|
1634 |
+
'<th class="next">»</th>'+
|
1635 |
+
'</tr>'+
|
1636 |
+
'</thead>',
|
1637 |
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
1638 |
footTemplate: '<tfoot>'+
|
1639 |
+
'<tr>'+
|
1640 |
+
'<th colspan="7" class="today"></th>'+
|
1641 |
+
'</tr>'+
|
1642 |
+
'<tr>'+
|
1643 |
+
'<th colspan="7" class="clear"></th>'+
|
1644 |
+
'</tr>'+
|
1645 |
+
'</tfoot>'
|
1646 |
};
|
1647 |
DPGlobal.template = '<div class="cfdatepicker">'+
|
1648 |
+
'<div class="cfdatepicker-days">'+
|
1649 |
+
'<table class=" table-condensed">'+
|
1650 |
+
DPGlobal.headTemplate+
|
1651 |
+
'<tbody></tbody>'+
|
1652 |
+
DPGlobal.footTemplate+
|
1653 |
+
'</table>'+
|
1654 |
+
'</div>'+
|
1655 |
+
'<div class="cfdatepicker-months">'+
|
1656 |
+
'<table class="table-condensed">'+
|
1657 |
+
DPGlobal.headTemplate+
|
1658 |
+
DPGlobal.contTemplate+
|
1659 |
+
DPGlobal.footTemplate+
|
1660 |
+
'</table>'+
|
1661 |
+
'</div>'+
|
1662 |
+
'<div class="cfdatepicker-years">'+
|
1663 |
+
'<table class="table-condensed">'+
|
1664 |
+
DPGlobal.headTemplate+
|
1665 |
+
DPGlobal.contTemplate+
|
1666 |
+
DPGlobal.footTemplate+
|
1667 |
+
'</table>'+
|
1668 |
+
'</div>'+
|
1669 |
+
'</div>';
|
1670 |
|
1671 |
$.fn.cfdatepicker.DPGlobal = DPGlobal;
|
1672 |
|
1673 |
|
1674 |
/* DATEPICKER NO CONFLICT
|
1675 |
+
* =================== */
|
1676 |
|
1677 |
$.fn.cfdatepicker.noConflict = function(){
|
1678 |
$.fn.cfdatepicker = old;
|
1680 |
};
|
1681 |
|
1682 |
/* DATEPICKER DATA-API
|
1683 |
+
* ================== */
|
1684 |
$(document).on(
|
1685 |
'focus.cfdatepicker.data-api click.cfdatepicker.data-api',
|
1686 |
'[data-provide="cfdatepicker"]',
|
1688 |
var $this = $(this);
|
1689 |
if ($this.data('cfdatepicker'))
|
1690 |
return;
|
1691 |
+
|
1692 |
// component click requires us to explicitly show it
|
1693 |
e.preventDefault();
|
1694 |
$this.cfdatepicker('show')
|
1695 |
+
.on('show', function(){ $(this).trigger('blur'); })
|
1696 |
+
.on('hide', function(){ $(this).attr("disabled", false); })
|
1697 |
}
|
1698 |
);
|
1699 |
|
1701 |
|
1702 |
|
1703 |
/*
|
1704 |
+
* jquery.inputmask.bundle
|
1705 |
+
* http://github.com/RobinHerbots/jquery.inputmask
|
1706 |
+
* Copyright (c) 2010 - 2014 Robin Herbots
|
1707 |
+
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
1708 |
+
* Version: 3.1.27
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1709 |
*/
|
1710 |
+
!function($) {
|
1711 |
+
function isInputEventSupported(eventName) {
|
1712 |
+
var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
|
1713 |
+
return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
|
1714 |
+
el = null, isSupported;
|
1715 |
+
}
|
1716 |
+
function isInputTypeSupported(inputType) {
|
1717 |
+
var isSupported = "text" == inputType || "tel" == inputType;
|
1718 |
+
if (!isSupported) {
|
1719 |
+
var el = document.createElement("input");
|
1720 |
+
el.setAttribute("type", inputType), isSupported = "text" === el.type, el = null;
|
1721 |
+
}
|
1722 |
+
return isSupported;
|
1723 |
+
}
|
1724 |
+
function resolveAlias(aliasStr, options, opts) {
|
1725 |
+
var aliasDefinition = opts.aliases[aliasStr];
|
1726 |
+
return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts),
|
1727 |
+
$.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : !1;
|
1728 |
+
}
|
1729 |
+
function generateMaskSet(opts, multi) {
|
1730 |
+
function analyseMask(mask) {
|
1731 |
+
function maskToken(isGroup, isOptional, isQuantifier, isAlternator) {
|
1732 |
+
this.matches = [], this.isGroup = isGroup || !1, this.isOptional = isOptional || !1,
|
1733 |
+
this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
|
1734 |
+
this.quantifier = {
|
1735 |
+
min: 1,
|
1736 |
+
max: 1
|
1737 |
+
};
|
1738 |
+
}
|
1739 |
+
function insertTestDefinition(mtoken, element, position) {
|
1740 |
+
var maskdef = opts.definitions[element], newBlockMarker = 0 == mtoken.matches.length;
|
1741 |
+
if (position = void 0 != position ? position : mtoken.matches.length, maskdef && !escaped) {
|
1742 |
+
for (var precheck = maskdef.prevalidator, precheckL = precheck ? precheck.length : 0, i = 1; i < maskdef.cardinality; i++) {
|
1743 |
+
var prevalidator = precheckL >= i ? precheck[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality;
|
1744 |
+
mtoken.matches.splice(position++, 0, {
|
1745 |
+
fn: validator ? "string" == typeof validator ? new RegExp(validator) : new function() {
|
1746 |
+
this.test = validator;
|
1747 |
+
}() : new RegExp("."),
|
1748 |
+
cardinality: cardinality ? cardinality : 1,
|
1749 |
+
optionality: mtoken.isOptional,
|
1750 |
+
newBlockMarker: newBlockMarker,
|
1751 |
+
casing: maskdef.casing,
|
1752 |
+
def: maskdef.definitionSymbol || element,
|
1753 |
+
placeholder: maskdef.placeholder,
|
1754 |
+
mask: element
|
1755 |
+
});
|
1756 |
+
}
|
1757 |
+
mtoken.matches.splice(position++, 0, {
|
1758 |
+
fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator) : new function() {
|
1759 |
+
this.test = maskdef.validator;
|
1760 |
+
}() : new RegExp("."),
|
1761 |
+
cardinality: maskdef.cardinality,
|
1762 |
+
optionality: mtoken.isOptional,
|
1763 |
+
newBlockMarker: newBlockMarker,
|
1764 |
+
casing: maskdef.casing,
|
1765 |
+
def: maskdef.definitionSymbol || element,
|
1766 |
+
placeholder: maskdef.placeholder,
|
1767 |
+
mask: element
|
1768 |
+
});
|
1769 |
+
} else mtoken.matches.splice(position++, 0, {
|
1770 |
+
fn: null,
|
1771 |
+
cardinality: 0,
|
1772 |
+
optionality: mtoken.isOptional,
|
1773 |
+
newBlockMarker: newBlockMarker,
|
1774 |
+
casing: null,
|
1775 |
+
def: element,
|
1776 |
+
placeholder: void 0,
|
1777 |
+
mask: element
|
1778 |
+
}), escaped = !1;
|
1779 |
+
}
|
1780 |
+
for (var match, m, openingToken, currentOpeningToken, alternator, lastMatch, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g, escaped = !1, currentToken = new maskToken(), openenings = [], maskTokens = []; match = tokenizer.exec(mask); ) switch (m = match[0],
|
1781 |
+
m.charAt(0)) {
|
1782 |
+
case opts.optionalmarker.end:
|
1783 |
+
case opts.groupmarker.end:
|
1784 |
+
if (openingToken = openenings.pop(), openenings.length > 0) {
|
1785 |
+
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
|
1786 |
+
currentOpeningToken.isAlternator) {
|
1787 |
+
alternator = openenings.pop();
|
1788 |
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
|
1789 |
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1790 |
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1791 |
+
}
|
1792 |
+
} else currentToken.matches.push(openingToken);
|
1793 |
+
break;
|
1794 |
|
1795 |
+
case opts.optionalmarker.start:
|
1796 |
+
openenings.push(new maskToken(!1, !0));
|
1797 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1798 |
|
1799 |
+
case opts.groupmarker.start:
|
1800 |
+
openenings.push(new maskToken(!0));
|
1801 |
+
break;
|
|
|
|
|
1802 |
|
1803 |
+
case opts.quantifiermarker.start:
|
1804 |
+
var quantifier = new maskToken(!1, !1, !0);
|
1805 |
+
m = m.replace(/[{}]/g, "");
|
1806 |
+
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
1807 |
+
if (("*" == mq1 || "+" == mq1) && (mq0 = "*" == mq1 ? 0 : 1), quantifier.quantifier = {
|
1808 |
+
min: mq0,
|
1809 |
+
max: mq1
|
1810 |
+
}, openenings.length > 0) {
|
1811 |
+
var matches = openenings[openenings.length - 1].matches;
|
1812 |
+
if (match = matches.pop(), !match.isGroup) {
|
1813 |
+
var groupToken = new maskToken(!0);
|
1814 |
+
groupToken.matches.push(match), match = groupToken;
|
1815 |
+
}
|
1816 |
+
matches.push(match), matches.push(quantifier);
|
1817 |
+
} else {
|
1818 |
+
if (match = currentToken.matches.pop(), !match.isGroup) {
|
1819 |
+
var groupToken = new maskToken(!0);
|
1820 |
+
groupToken.matches.push(match), match = groupToken;
|
1821 |
+
}
|
1822 |
+
currentToken.matches.push(match), currentToken.matches.push(quantifier);
|
1823 |
+
}
|
1824 |
+
break;
|
1825 |
|
1826 |
+
case opts.escapeChar:
|
1827 |
+
escaped = !0;
|
1828 |
+
break;
|
|
|
1829 |
|
1830 |
+
case opts.alternatormarker:
|
1831 |
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1832 |
+
lastMatch = currentOpeningToken.matches.pop()) : lastMatch = currentToken.matches.pop(),
|
1833 |
+
lastMatch.isAlternator ? openenings.push(lastMatch) : (alternator = new maskToken(!1, !1, !1, !0),
|
1834 |
+
alternator.matches.push(lastMatch), openenings.push(alternator));
|
1835 |
+
break;
|
1836 |
|
1837 |
+
default:
|
1838 |
+
if (openenings.length > 0) {
|
1839 |
+
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.length > 0 && (lastMatch = currentOpeningToken.matches[currentOpeningToken.matches.length - 1],
|
1840 |
+
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1841 |
+
insertTestDefinition(lastMatch, opts.groupmarker.end))), insertTestDefinition(currentOpeningToken, m),
|
1842 |
+
currentOpeningToken.isAlternator) {
|
1843 |
+
alternator = openenings.pop();
|
1844 |
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
|
1845 |
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1846 |
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1847 |
+
}
|
1848 |
+
} else currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
|
1849 |
+
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1850 |
+
insertTestDefinition(lastMatch, opts.groupmarker.end))), insertTestDefinition(currentToken, m);
|
1851 |
+
}
|
1852 |
+
return currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
|
1853 |
+
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1854 |
+
insertTestDefinition(lastMatch, opts.groupmarker.end)), maskTokens.push(currentToken)),
|
1855 |
+
maskTokens;
|
1856 |
+
}
|
1857 |
+
function generateMask(mask, metadata) {
|
1858 |
+
if (opts.numericInput && opts.multi !== !0) {
|
1859 |
+
mask = mask.split("").reverse();
|
1860 |
+
for (var ndx = 0; ndx < mask.length; ndx++) mask[ndx] == opts.optionalmarker.start ? mask[ndx] = opts.optionalmarker.end : mask[ndx] == opts.optionalmarker.end ? mask[ndx] = opts.optionalmarker.start : mask[ndx] == opts.groupmarker.start ? mask[ndx] = opts.groupmarker.end : mask[ndx] == opts.groupmarker.end && (mask[ndx] = opts.groupmarker.start);
|
1861 |
+
mask = mask.join("");
|
1862 |
+
}
|
1863 |
+
if (void 0 == mask || "" == mask) return void 0;
|
1864 |
+
if (1 == mask.length && 0 == opts.greedy && 0 != opts.repeat && (opts.placeholder = ""),
|
1865 |
+
opts.repeat > 0 || "*" == opts.repeat || "+" == opts.repeat) {
|
1866 |
+
var repeatStart = "*" == opts.repeat ? 0 : "+" == opts.repeat ? 1 : opts.repeat;
|
1867 |
+
mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end;
|
1868 |
+
}
|
1869 |
+
return void 0 == $.inputmask.masksCache[mask] && ($.inputmask.masksCache[mask] = {
|
1870 |
+
mask: mask,
|
1871 |
+
maskToken: analyseMask(mask),
|
1872 |
+
validPositions: {},
|
1873 |
+
_buffer: void 0,
|
1874 |
+
buffer: void 0,
|
1875 |
+
tests: {},
|
1876 |
+
metadata: metadata
|
1877 |
+
}), $.extend(!0, {}, $.inputmask.masksCache[mask]);
|
1878 |
+
}
|
1879 |
+
var ms = void 0;
|
1880 |
+
if ($.isFunction(opts.mask) && (opts.mask = opts.mask.call(this, opts)), $.isArray(opts.mask)) if (multi) ms = [],
|
1881 |
+
$.each(opts.mask, function(ndx, msk) {
|
1882 |
+
ms.push(void 0 == msk.mask || $.isFunction(msk.mask) ? generateMask(msk.toString(), msk) : generateMask(msk.mask.toString(), msk));
|
1883 |
+
}); else {
|
1884 |
+
opts.keepStatic = void 0 == opts.keepStatic ? !0 : opts.keepStatic;
|
1885 |
+
var altMask = "(";
|
1886 |
+
$.each(opts.mask, function(ndx, msk) {
|
1887 |
+
altMask.length > 1 && (altMask += ")|("), altMask += void 0 == msk.mask || $.isFunction(msk.mask) ? msk.toString() : msk.mask.toString();
|
1888 |
+
}), altMask += ")", ms = generateMask(altMask, opts.mask);
|
1889 |
+
} else opts.mask && (ms = void 0 == opts.mask.mask || $.isFunction(opts.mask.mask) ? generateMask(opts.mask.toString(), opts.mask) : generateMask(opts.mask.mask.toString(), opts.mask));
|
1890 |
+
return ms;
|
1891 |
+
}
|
1892 |
+
function maskScope(actionObj, maskset, opts) {
|
1893 |
+
function getMaskTemplate(baseOnInput, minimalPos, includeInput) {
|
1894 |
+
minimalPos = minimalPos || 0;
|
1895 |
+
var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0;
|
1896 |
+
do {
|
1897 |
+
if (baseOnInput === !0 && getMaskSet().validPositions[pos]) {
|
1898 |
+
var validPos = getMaskSet().validPositions[pos];
|
1899 |
+
test = validPos.match, ndxIntlzr = validPos.locator.slice(), maskTemplate.push(includeInput === !0 ? validPos.input : getPlaceholder(pos, test));
|
1900 |
+
} else {
|
1901 |
+
if (minimalPos > pos) {
|
1902 |
+
var testPositions = getTests(pos, ndxIntlzr, pos - 1);
|
1903 |
+
testPos = testPositions[0];
|
1904 |
+
} else testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
|
1905 |
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(getPlaceholder(pos, test));
|
1906 |
+
}
|
1907 |
+
pos++;
|
1908 |
+
} while ((void 0 == maxLength || maxLength > pos - 1) && null != test.fn || null == test.fn && "" != test.def || minimalPos >= pos);
|
1909 |
+
return maskTemplate.pop(), maskTemplate;
|
1910 |
+
}
|
1911 |
+
function getMaskSet() {
|
1912 |
+
return maskset;
|
1913 |
+
}
|
1914 |
+
function resetMaskSet(soft) {
|
1915 |
+
var maskset = getMaskSet();
|
1916 |
+
maskset.buffer = void 0, maskset.tests = {}, soft !== !0 && (maskset._buffer = void 0,
|
1917 |
+
maskset.validPositions = {}, maskset.p = 0);
|
1918 |
+
}
|
1919 |
+
function getLastValidPosition(closestTo) {
|
1920 |
+
var maskset = getMaskSet(), lastValidPosition = -1, valids = maskset.validPositions;
|
1921 |
+
void 0 == closestTo && (closestTo = -1);
|
1922 |
+
var before = lastValidPosition, after = lastValidPosition;
|
1923 |
+
for (var posNdx in valids) {
|
1924 |
+
var psNdx = parseInt(posNdx);
|
1925 |
+
(-1 == closestTo || null != valids[psNdx].match.fn) && (closestTo > psNdx && (before = psNdx),
|
1926 |
+
psNdx >= closestTo && (after = psNdx));
|
1927 |
+
}
|
1928 |
+
return lastValidPosition = closestTo - before > 1 || closestTo > after ? before : after;
|
1929 |
+
}
|
1930 |
+
function setValidPosition(pos, validTest, fromSetValid) {
|
1931 |
+
if (opts.insertMode && void 0 != getMaskSet().validPositions[pos] && void 0 == fromSetValid) {
|
1932 |
+
var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
|
1933 |
+
for (i = pos; lvp >= i; i++) delete getMaskSet().validPositions[i];
|
1934 |
+
getMaskSet().validPositions[pos] = validTest;
|
1935 |
+
var j, valid = !0;
|
1936 |
+
for (i = pos; lvp >= i; i++) {
|
1937 |
+
var t = positionsClone[i];
|
1938 |
+
if (void 0 != t) {
|
1939 |
+
var vps = getMaskSet().validPositions;
|
1940 |
+
j = !opts.keepStatic && (void 0 != vps[i + 1] && getTests(i + 1, vps[i].locator.slice(), i).length > 1 || vps[i] && void 0 != vps[i].alternation) ? i + 1 : seekNext(i),
|
1941 |
+
valid = positionCanMatchDefinition(j, t.match.def) ? valid && isValid(j, t.input, !0, !0) !== !1 : null == t.match.fn;
|
1942 |
+
}
|
1943 |
+
if (!valid) break;
|
1944 |
+
}
|
1945 |
+
if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone),
|
1946 |
+
!1;
|
1947 |
+
} else getMaskSet().validPositions[pos] = validTest;
|
1948 |
+
return !0;
|
1949 |
+
}
|
1950 |
+
function stripValidPositions(start, end) {
|
1951 |
+
var i, startPos = start;
|
1952 |
+
for (void 0 != getMaskSet().validPositions[start] && getMaskSet().validPositions[start].input == opts.radixPoint && (end++,
|
1953 |
+
startPos++), i = startPos; end > i; i++) void 0 == getMaskSet().validPositions[i] || getMaskSet().validPositions[i].input == opts.radixPoint && i != getLastValidPosition() || delete getMaskSet().validPositions[i];
|
1954 |
+
for (i = end; i <= getLastValidPosition(); ) {
|
1955 |
+
var t = getMaskSet().validPositions[i], s = getMaskSet().validPositions[startPos];
|
1956 |
+
void 0 != t && void 0 == s ? (positionCanMatchDefinition(startPos, t.match.def) && isValid(startPos, t.input, !0) !== !1 && (delete getMaskSet().validPositions[i],
|
1957 |
+
i++), startPos++) : i++;
|
1958 |
+
}
|
1959 |
+
var lvp = getLastValidPosition();
|
1960 |
+
lvp >= start && void 0 != getMaskSet().validPositions[lvp] && getMaskSet().validPositions[lvp].input == opts.radixPoint && delete getMaskSet().validPositions[lvp],
|
1961 |
+
resetMaskSet(!0);
|
1962 |
+
}
|
1963 |
+
function getTestTemplate(pos, ndxIntlzr, tstPs) {
|
1964 |
+
function checkAlternationMatch(test, altNdx, altArr) {
|
1965 |
+
for (var isMatch = !1, altLocArr = test.locator[altNdx].toString().split(","), alndx = 0; alndx < altLocArr.length; alndx++) if (-1 != $.inArray(altLocArr[alndx], altArr)) {
|
1966 |
+
isMatch = !0;
|
1967 |
+
break;
|
1968 |
+
}
|
1969 |
+
return isMatch;
|
1970 |
+
}
|
1971 |
+
for (var testPos, testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
|
1972 |
+
!(opts.greedy || testPos.match && (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0 && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos, lvTest.alternation, lvTestAltArr)))); ndx++) ;
|
1973 |
+
return testPos;
|
1974 |
+
}
|
1975 |
+
function getTest(pos) {
|
1976 |
+
return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
|
1977 |
+
}
|
1978 |
+
function positionCanMatchDefinition(pos, def) {
|
1979 |
+
for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def == def) {
|
1980 |
+
valid = !0;
|
1981 |
+
break;
|
1982 |
+
}
|
1983 |
+
return valid;
|
1984 |
+
}
|
1985 |
+
function getTests(pos, ndxIntlzr, tstPs) {
|
1986 |
+
function ResolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
|
1987 |
+
function handleMatch(match, loopNdx, quantifierRecurse) {
|
1988 |
+
if (testPos > 1e4) return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask),
|
1989 |
+
!0;
|
1990 |
+
if (testPos == pos && void 0 == match.matches) return matches.push({
|
1991 |
+
match: match,
|
1992 |
+
locator: loopNdx.reverse()
|
1993 |
+
}), !0;
|
1994 |
+
if (void 0 != match.matches) {
|
1995 |
+
if (match.isGroup && quantifierRecurse !== !0) {
|
1996 |
+
if (match = handleMatch(maskToken.matches[tndx + 1], loopNdx)) return !0;
|
1997 |
+
} else if (match.isOptional) {
|
1998 |
+
var optionalToken = match;
|
1999 |
+
if (match = ResolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
|
2000 |
+
var latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 == $.inArray(latestMatch, optionalToken.matches);
|
2001 |
+
isFirstMatch && (insertStop = !0), testPos = pos;
|
2002 |
+
}
|
2003 |
+
} else if (match.isAlternator) {
|
2004 |
+
var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
|
2005 |
+
if (-1 == altIndex || "string" == typeof altIndex) {
|
2006 |
+
var altIndexArr, currentPos = testPos, ndxInitializerClone = ndxInitializer.slice();
|
2007 |
+
"string" == typeof altIndex && (altIndexArr = altIndex.split(","));
|
2008 |
+
for (var amndx = 0; amndx < alternateToken.matches.length; amndx++) {
|
2009 |
+
matches = [], match = handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match,
|
2010 |
+
maltMatches = matches.slice(), testPos = currentPos, matches = [];
|
2011 |
+
for (var i = 0; i < ndxInitializerClone.length; i++) ndxInitializer[i] = ndxInitializerClone[i];
|
2012 |
+
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) for (var altMatch = maltMatches[ndx1], ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
|
2013 |
+
var altMatch2 = malternateMatches[ndx2];
|
2014 |
+
if (altMatch.match.mask == altMatch2.match.mask && ("string" != typeof altIndex || -1 != $.inArray(altMatch.locator[loopNdxCnt].toString(), altIndexArr))) {
|
2015 |
+
maltMatches.splice(ndx1, 1), altMatch2.locator[loopNdxCnt] = altMatch2.locator[loopNdxCnt] + "," + altMatch.locator[loopNdxCnt],
|
2016 |
+
altMatch2.alternation = loopNdxCnt;
|
2017 |
+
break;
|
2018 |
+
}
|
2019 |
+
}
|
2020 |
+
malternateMatches = malternateMatches.concat(maltMatches);
|
2021 |
+
}
|
2022 |
+
"string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) {
|
2023 |
+
if (isFinite(ndx)) {
|
2024 |
+
var mamatch, altLocArr = lmnt.locator[loopNdxCnt].toString().split(",");
|
2025 |
+
lmnt.locator[loopNdxCnt] = void 0, lmnt.alternation = void 0;
|
2026 |
+
for (var alndx = 0; alndx < altLocArr.length; alndx++) mamatch = -1 != $.inArray(altLocArr[alndx], altIndexArr),
|
2027 |
+
mamatch && (void 0 != lmnt.locator[loopNdxCnt] ? (lmnt.locator[loopNdxCnt] += ",",
|
2028 |
+
lmnt.alternation = loopNdxCnt, lmnt.locator[loopNdxCnt] += altLocArr[alndx]) : lmnt.locator[loopNdxCnt] = parseInt(altLocArr[alndx]));
|
2029 |
+
if (void 0 != lmnt.locator[loopNdxCnt]) return lmnt;
|
2030 |
+
}
|
2031 |
+
})), matches = currentMatches.concat(malternateMatches), insertStop = !0;
|
2032 |
+
} else match = handleMatch(alternateToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
|
2033 |
+
if (match) return !0;
|
2034 |
+
} else if (match.isQuantifier && quantifierRecurse !== !0) {
|
2035 |
+
var qt = match;
|
2036 |
+
opts.greedy = opts.greedy && isFinite(qt.quantifier.max);
|
2037 |
+
for (var qndx = ndxInitializer.length > 0 && quantifierRecurse !== !0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && pos >= testPos; qndx++) {
|
2038 |
+
var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
|
2039 |
+
if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), !0)) {
|
2040 |
+
var latestMatch = matches[matches.length - 1].match;
|
2041 |
+
latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1;
|
2042 |
+
var isFirstMatch = 0 == $.inArray(latestMatch, tokenGroup.matches);
|
2043 |
+
if (isFirstMatch) {
|
2044 |
+
if (qndx > qt.quantifier.min - 1) {
|
2045 |
+
insertStop = !0, testPos = pos;
|
2046 |
+
break;
|
2047 |
+
}
|
2048 |
+
return !0;
|
2049 |
+
}
|
2050 |
+
return !0;
|
2051 |
+
}
|
2052 |
+
}
|
2053 |
+
} else if (match = ResolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0;
|
2054 |
+
} else testPos++;
|
2055 |
+
}
|
2056 |
+
for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (maskToken.matches[tndx].isQuantifier !== !0) {
|
2057 |
+
var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
|
2058 |
+
if (match && testPos == pos) return match;
|
2059 |
+
if (testPos > pos) break;
|
2060 |
+
}
|
2061 |
+
}
|
2062 |
+
var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
|
2063 |
+
if (void 0 == ndxIntlzr) {
|
2064 |
+
for (var test, previousPos = pos - 1; void 0 == (test = getMaskSet().validPositions[previousPos]) && previousPos > -1; ) previousPos--;
|
2065 |
+
if (void 0 != test && previousPos > -1) testPos = previousPos, ndxInitializer = test.locator.slice(); else {
|
2066 |
+
for (previousPos = pos - 1; void 0 == (test = getMaskSet().tests[previousPos]) && previousPos > -1; ) previousPos--;
|
2067 |
+
void 0 != test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test[0].locator.slice());
|
2068 |
+
}
|
2069 |
+
}
|
2070 |
+
for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
|
2071 |
+
var match = ResolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]);
|
2072 |
+
if (match && testPos == pos || testPos > pos) break;
|
2073 |
+
}
|
2074 |
+
return (0 == matches.length || insertStop) && matches.push({
|
2075 |
+
match: {
|
2076 |
+
fn: null,
|
2077 |
+
cardinality: 0,
|
2078 |
+
optionality: !0,
|
2079 |
+
casing: null,
|
2080 |
+
def: ""
|
2081 |
+
},
|
2082 |
+
locator: []
|
2083 |
+
}), getMaskSet().tests[pos] = $.extend(!0, [], matches), getMaskSet().tests[pos];
|
2084 |
+
}
|
2085 |
+
function getBufferTemplate() {
|
2086 |
+
return void 0 == getMaskSet()._buffer && (getMaskSet()._buffer = getMaskTemplate(!1, 1)),
|
2087 |
+
getMaskSet()._buffer;
|
2088 |
+
}
|
2089 |
+
function getBuffer() {
|
2090 |
+
return void 0 == getMaskSet().buffer && (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0)),
|
2091 |
+
getMaskSet().buffer;
|
2092 |
+
}
|
2093 |
+
function refreshFromBuffer(start, end) {
|
2094 |
+
var buffer = getBuffer().slice();
|
2095 |
+
if (start === !0) resetMaskSet(), start = 0, end = buffer.length; else for (var i = start; end > i; i++) delete getMaskSet().validPositions[i],
|
2096 |
+
delete getMaskSet().tests[i];
|
2097 |
+
for (var i = start; end > i; i++) buffer[i] != opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
|
2098 |
+
}
|
2099 |
+
function casing(elem, test) {
|
2100 |
+
switch (test.casing) {
|
2101 |
+
case "upper":
|
2102 |
+
elem = elem.toUpperCase();
|
2103 |
+
break;
|
2104 |
|
2105 |
+
case "lower":
|
2106 |
+
elem = elem.toLowerCase();
|
2107 |
+
}
|
2108 |
+
return elem;
|
2109 |
+
}
|
2110 |
+
function isValid(pos, c, strict, fromSetValid) {
|
2111 |
+
function _isValid(position, c, strict, fromSetValid) {
|
2112 |
+
var rslt = !1;
|
2113 |
+
return $.each(getTests(position), function(ndx, tst) {
|
2114 |
+
for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = (getBuffer(), test.cardinality); i > loopend; i--) chrs += getBufferElement(position - (i - 1));
|
2115 |
+
if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c != test.def && c != opts.skipOptionalPartCharacter || "" == test.def ? !1 : {
|
2116 |
+
c: test.def,
|
2117 |
+
pos: position
|
2118 |
+
}, rslt !== !1) {
|
2119 |
+
var elem = void 0 != rslt.c ? rslt.c : c;
|
2120 |
+
elem = elem == opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
|
2121 |
+
var validatedPos = position;
|
2122 |
+
if (void 0 != rslt.remove && stripValidPositions(rslt.remove, rslt.remove + 1),
|
2123 |
+
rslt.refreshFromBuffer) {
|
2124 |
+
var refresh = rslt.refreshFromBuffer;
|
2125 |
+
if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end),
|
2126 |
+
void 0 == rslt.pos && void 0 == rslt.c) return rslt.pos = getLastValidPosition(),
|
2127 |
+
!1;
|
2128 |
+
if (validatedPos = void 0 != rslt.pos ? rslt.pos : position, validatedPos != position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
2129 |
+
!1;
|
2130 |
+
} else if (rslt !== !0 && void 0 != rslt.pos && rslt.pos != position && (validatedPos = rslt.pos,
|
2131 |
+
refreshFromBuffer(position, validatedPos), validatedPos != position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
2132 |
+
!1;
|
2133 |
+
return 1 != rslt && void 0 == rslt.pos && void 0 == rslt.c ? !1 : (ndx > 0 && resetMaskSet(!0),
|
2134 |
+
setValidPosition(validatedPos, $.extend({}, tst, {
|
2135 |
+
input: casing(elem, test)
|
2136 |
+
}), fromSetValid) || (rslt = !1), !1);
|
2137 |
+
}
|
2138 |
+
}), rslt;
|
2139 |
+
}
|
2140 |
+
function alternate(pos, c, strict, fromSetValid) {
|
2141 |
+
var lastAlt, alternation, validPsClone = $.extend(!0, {}, getMaskSet().validPositions);
|
2142 |
+
for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) if (getMaskSet().validPositions[lastAlt] && void 0 != getMaskSet().validPositions[lastAlt].alternation) {
|
2143 |
+
alternation = getMaskSet().validPositions[lastAlt].alternation;
|
2144 |
+
break;
|
2145 |
+
}
|
2146 |
+
if (void 0 != alternation) for (var decisionPos in getMaskSet().validPositions) if (parseInt(decisionPos) > parseInt(lastAlt) && void 0 === getMaskSet().validPositions[decisionPos].alternation) {
|
2147 |
+
for (var altPos = getMaskSet().validPositions[decisionPos], decisionTaker = altPos.locator[alternation], altNdxs = getMaskSet().validPositions[lastAlt].locator[alternation].split(","), mndx = 0; mndx < altNdxs.length; mndx++) if (decisionTaker < altNdxs[mndx]) {
|
2148 |
+
for (var possibilityPos, possibilities, dp = decisionPos - 1; dp >= 0; dp--) if (possibilityPos = getMaskSet().validPositions[dp],
|
2149 |
+
void 0 != possibilityPos) {
|
2150 |
+
possibilities = possibilityPos.locator[alternation], possibilityPos.locator[alternation] = altNdxs[mndx];
|
2151 |
+
break;
|
2152 |
+
}
|
2153 |
+
if (decisionTaker != possibilityPos.locator[alternation]) {
|
2154 |
+
for (var buffer = getBuffer().slice(), i = decisionPos; i < getLastValidPosition() + 1; i++) delete getMaskSet().validPositions[i],
|
2155 |
+
delete getMaskSet().tests[i];
|
2156 |
+
resetMaskSet(!0), opts.keepStatic = !opts.keepStatic;
|
2157 |
+
for (var i = decisionPos; i < buffer.length; i++) buffer[i] != opts.skipOptionalPartCharacter && isValid(getLastValidPosition() + 1, buffer[i], !1, !0);
|
2158 |
+
possibilityPos.locator[alternation] = possibilities;
|
2159 |
+
var isValidRslt = isValid(pos, c, strict, fromSetValid);
|
2160 |
+
if (opts.keepStatic = !opts.keepStatic, isValidRslt) return isValidRslt;
|
2161 |
+
resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone);
|
2162 |
+
}
|
2163 |
+
}
|
2164 |
+
break;
|
2165 |
+
}
|
2166 |
+
return !1;
|
2167 |
+
}
|
2168 |
+
strict = strict === !0;
|
2169 |
+
for (var buffer = getBuffer(), pndx = pos - 1; pndx > -1 && (!getMaskSet().validPositions[pndx] || null != getMaskSet().validPositions[pndx].match.fn); pndx--) void 0 == getMaskSet().validPositions[pndx] && (!isMask(pndx) || buffer[pndx] != getPlaceholder(pndx)) && getTests(pndx).length > 1 && _isValid(pndx, buffer[pndx], !0);
|
2170 |
+
var maskPos = pos, result = !1;
|
2171 |
+
if (fromSetValid && maskPos >= getMaskLength() && resetMaskSet(!0), maskPos < getMaskLength() && (result = _isValid(maskPos, c, strict, fromSetValid),
|
2172 |
+
!strict && result === !1)) {
|
2173 |
+
var currentPosValid = getMaskSet().validPositions[maskPos];
|
2174 |
+
if (!currentPosValid || null != currentPosValid.match.fn || currentPosValid.match.def != c && c != opts.skipOptionalPartCharacter) {
|
2175 |
+
if ((opts.insertMode || void 0 == getMaskSet().validPositions[seekNext(maskPos)]) && !isMask(maskPos)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); snPos >= nPos; nPos++) if (result = _isValid(nPos, c, strict, fromSetValid),
|
2176 |
+
result !== !1) {
|
2177 |
+
maskPos = nPos;
|
2178 |
+
break;
|
2179 |
+
}
|
2180 |
+
} else result = {
|
2181 |
+
caret: seekNext(maskPos)
|
2182 |
+
};
|
2183 |
+
}
|
2184 |
+
return result === !1 && opts.keepStatic && isComplete(buffer) && (result = alternate(pos, c, strict, fromSetValid)),
|
2185 |
+
result === !0 && (result = {
|
2186 |
+
pos: maskPos
|
2187 |
+
}), result;
|
2188 |
+
}
|
2189 |
+
function isMask(pos) {
|
2190 |
+
var test = getTest(pos);
|
2191 |
+
return null != test.fn ? test.fn : !1;
|
2192 |
+
}
|
2193 |
+
function getMaskLength() {
|
2194 |
+
var maskLength;
|
2195 |
+
if (maxLength = $el.prop("maxLength"), -1 == maxLength && (maxLength = void 0),
|
2196 |
+
0 == opts.greedy) {
|
2197 |
+
var pos, lvp = getLastValidPosition(), testPos = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 != testPos ? testPos.locator.slice() : void 0;
|
2198 |
+
for (pos = lvp + 1; void 0 == testPos || null != testPos.match.fn || null == testPos.match.fn && "" != testPos.match.def; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
2199 |
+
ndxIntlzr = testPos.locator.slice();
|
2200 |
+
maskLength = pos;
|
2201 |
+
} else maskLength = getBuffer().length;
|
2202 |
+
return void 0 == maxLength || maxLength > maskLength ? maskLength : maxLength;
|
2203 |
+
}
|
2204 |
+
function seekNext(pos) {
|
2205 |
+
var maskL = getMaskLength();
|
2206 |
+
if (pos >= maskL) return maskL;
|
2207 |
+
for (var position = pos; ++position < maskL && !isMask(position) && (opts.nojumps !== !0 || opts.nojumpsThreshold > position); ) ;
|
2208 |
+
return position;
|
2209 |
+
}
|
2210 |
+
function seekPrevious(pos) {
|
2211 |
+
var position = pos;
|
2212 |
+
if (0 >= position) return 0;
|
2213 |
+
for (;--position > 0 && !isMask(position); ) ;
|
2214 |
+
return position;
|
2215 |
+
}
|
2216 |
+
function getBufferElement(position) {
|
2217 |
+
return void 0 == getMaskSet().validPositions[position] ? getPlaceholder(position) : getMaskSet().validPositions[position].input;
|
2218 |
+
}
|
2219 |
+
function writeBuffer(input, buffer, caretPos) {
|
2220 |
+
input._valueSet(buffer.join("")), void 0 != caretPos && caret(input, caretPos);
|
2221 |
+
}
|
2222 |
+
function getPlaceholder(pos, test) {
|
2223 |
+
test = test || getTest(pos);
|
2224 |
+
var placeholder = $.isFunction(test.placeholder) ? test.placeholder.call(this, opts) : test.placeholder;
|
2225 |
+
return void 0 != placeholder ? placeholder : null == test.fn ? test.def : opts.placeholder.charAt(pos % opts.placeholder.length);
|
2226 |
+
}
|
2227 |
+
function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
|
2228 |
+
var inputValue = void 0 != nptvl ? nptvl.slice() : truncateInput(input._valueGet()).split("");
|
2229 |
+
if (resetMaskSet(), writeOut && input._valueSet(""), $.each(inputValue, function(ndx, charCode) {
|
2230 |
+
if (intelliCheck === !0) {
|
2231 |
+
var lvp = getLastValidPosition(), pos = -1 == lvp ? ndx : seekNext(lvp);
|
2232 |
+
-1 == $.inArray(charCode, getBufferTemplate().slice(lvp + 1, pos)) && keypressEvent.call(input, void 0, !0, charCode.charCodeAt(0), !1, strict, strict ? ndx : getMaskSet().p);
|
2233 |
+
} else keypressEvent.call(input, void 0, !0, charCode.charCodeAt(0), !1, strict, strict ? ndx : getMaskSet().p),
|
2234 |
+
strict = strict || ndx > 0 && ndx > getMaskSet().p;
|
2235 |
+
}), writeOut) {
|
2236 |
+
var keypressResult = opts.onKeyPress.call(this, void 0, getBuffer(), 0, opts);
|
2237 |
+
handleOnKeyResult(input, keypressResult), writeBuffer(input, getBuffer(), $(input).is(":focus") ? seekNext(getLastValidPosition(0)) : void 0);
|
2238 |
+
}
|
2239 |
+
}
|
2240 |
+
function escapeRegex(str) {
|
2241 |
+
return $.inputmask.escapeRegex.call(this, str);
|
2242 |
+
}
|
2243 |
+
function truncateInput(inputValue) {
|
2244 |
+
return inputValue.replace(new RegExp("(" + escapeRegex(getBufferTemplate().join("")) + ")*$"), "");
|
2245 |
+
}
|
2246 |
+
function unmaskedvalue($input) {
|
2247 |
+
if ($input.data("_inputmask") && !$input.hasClass("hasDatepicker")) {
|
2248 |
+
var umValue = [], vps = getMaskSet().validPositions;
|
2249 |
+
for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
|
2250 |
+
var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
|
2251 |
+
return $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue),
|
2252 |
+
unmaskedValue;
|
2253 |
+
}
|
2254 |
+
return $input[0]._valueGet();
|
2255 |
+
}
|
2256 |
+
function TranslatePosition(pos) {
|
2257 |
+
if (isRTL && "number" == typeof pos && (!opts.greedy || "" != opts.placeholder)) {
|
2258 |
+
var bffrLght = getBuffer().length;
|
2259 |
+
pos = bffrLght - pos;
|
2260 |
+
}
|
2261 |
+
return pos;
|
2262 |
+
}
|
2263 |
+
function caret(input, begin, end) {
|
2264 |
+
var range, npt = input.jquery && input.length > 0 ? input[0] : input;
|
2265 |
+
if ("number" != typeof begin) {
|
2266 |
+
var data = $(npt).data("_inputmask");
|
2267 |
+
return !$(npt).is(":visible") && data && void 0 != data.caret ? (begin = data.caret.begin,
|
2268 |
+
end = data.caret.end) : npt.setSelectionRange ? (begin = npt.selectionStart, end = npt.selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
|
2269 |
+
begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
|
2270 |
+
begin = TranslatePosition(begin), end = TranslatePosition(end), {
|
2271 |
+
begin: begin,
|
2272 |
+
end: end
|
2273 |
+
};
|
2274 |
+
}
|
2275 |
+
begin = TranslatePosition(begin), end = TranslatePosition(end), end = "number" == typeof end ? end : begin;
|
2276 |
+
var data = $(npt).data("_inputmask") || {};
|
2277 |
+
data.caret = {
|
2278 |
+
begin: begin,
|
2279 |
+
end: end
|
2280 |
+
}, $(npt).data("_inputmask", data), $(npt).is(":visible") && (npt.scrollLeft = npt.scrollWidth,
|
2281 |
+
0 == opts.insertMode && begin == end && end++, npt.setSelectionRange ? (npt.selectionStart = begin,
|
2282 |
+
npt.selectionEnd = end) : npt.createTextRange && (range = npt.createTextRange(),
|
2283 |
+
range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
|
2284 |
+
range.select()));
|
2285 |
+
}
|
2286 |
+
function determineLastRequiredPosition(returnDefinition) {
|
2287 |
+
var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 != lvTest ? lvTest.locator.slice() : void 0;
|
2288 |
+
for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
2289 |
+
ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
|
2290 |
+
var lvTestAltArr = lvTest && void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [];
|
2291 |
+
for (pos = bl - 1; pos > lvp && (testPos = positions[pos].match, (testPos.optionality || testPos.optionalQuantifier || lvTest && void 0 != lvTest.alternation && void 0 != positions[pos].locator[lvTest.alternation] && -1 != $.inArray(positions[pos].locator[lvTest.alternation].toString(), lvTestAltArr)) && buffer[pos] == getPlaceholder(pos, testPos)); pos--) bl--;
|
2292 |
+
return returnDefinition ? {
|
2293 |
+
l: bl,
|
2294 |
+
def: positions[bl] ? positions[bl].match : void 0
|
2295 |
+
} : bl;
|
2296 |
+
}
|
2297 |
+
function clearOptionalTail(input) {
|
2298 |
+
for (var buffer = getBuffer(), tmpBuffer = buffer.slice(), rl = determineLastRequiredPosition(), lmib = tmpBuffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
2299 |
+
tmpBuffer.splice(rl, lmib + 1 - rl), writeBuffer(input, tmpBuffer);
|
2300 |
+
}
|
2301 |
+
function isComplete(buffer) {
|
2302 |
+
if ($.isFunction(opts.isComplete)) return opts.isComplete.call($el, buffer, opts);
|
2303 |
+
if ("*" == opts.repeat) return void 0;
|
2304 |
+
var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l), lvp = getLastValidPosition();
|
2305 |
+
if (lvp == aml && (void 0 == lrp.def || lrp.def.newBlockMarker || lrp.def.optionalQuantifier)) {
|
2306 |
+
complete = !0;
|
2307 |
+
for (var i = 0; aml >= i; i++) {
|
2308 |
+
var mask = isMask(i);
|
2309 |
+
if (mask && (void 0 == buffer[i] || buffer[i] == getPlaceholder(i)) || !mask && buffer[i] != getPlaceholder(i)) {
|
2310 |
+
complete = !1;
|
2311 |
+
break;
|
2312 |
+
}
|
2313 |
+
}
|
2314 |
+
}
|
2315 |
+
return complete;
|
2316 |
+
}
|
2317 |
+
function isSelection(begin, end) {
|
2318 |
+
return isRTL ? begin - end > 1 || begin - end == 1 && opts.insertMode : end - begin > 1 || end - begin == 1 && opts.insertMode;
|
2319 |
+
}
|
2320 |
+
function installEventRuler(npt) {
|
2321 |
+
var events = $._data(npt).events;
|
2322 |
+
$.each(events, function(eventType, eventHandlers) {
|
2323 |
+
$.each(eventHandlers, function(ndx, eventHandler) {
|
2324 |
+
if ("inputmask" == eventHandler.namespace && "setvalue" != eventHandler.type) {
|
2325 |
+
var handler = eventHandler.handler;
|
2326 |
+
eventHandler.handler = function(e) {
|
2327 |
+
return this.readOnly || this.disabled ? void e.preventDefault : handler.apply(this, arguments);
|
2328 |
+
};
|
2329 |
+
}
|
2330 |
+
});
|
2331 |
+
});
|
2332 |
+
}
|
2333 |
+
function patchValueProperty(npt) {
|
2334 |
+
function PatchValhook(type) {
|
2335 |
+
if (void 0 == $.valHooks[type] || 1 != $.valHooks[type].inputmaskpatch) {
|
2336 |
+
var valueGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
|
2337 |
+
return elem.value;
|
2338 |
+
}, valueSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
|
2339 |
+
return elem.value = value, elem;
|
2340 |
+
};
|
2341 |
+
$.valHooks[type] = {
|
2342 |
+
get: function(elem) {
|
2343 |
+
var $elem = $(elem);
|
2344 |
+
if ($elem.data("_inputmask")) {
|
2345 |
+
if ($elem.data("_inputmask").opts.autoUnmask) return $elem.inputmask("unmaskedvalue");
|
2346 |
+
var result = valueGet(elem), inputData = $elem.data("_inputmask"), maskset = inputData.maskset, bufferTemplate = maskset._buffer;
|
2347 |
+
return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result != bufferTemplate ? result : "";
|
2348 |
+
}
|
2349 |
+
return valueGet(elem);
|
2350 |
+
},
|
2351 |
+
set: function(elem, value) {
|
2352 |
+
var result, $elem = $(elem), inputData = $elem.data("_inputmask");
|
2353 |
+
return inputData ? (result = valueSet(elem, $.isFunction(inputData.opts.onBeforeMask) ? inputData.opts.onBeforeMask.call(el, value, inputData.opts) || value : value),
|
2354 |
+
$elem.triggerHandler("setvalue.inputmask")) : result = valueSet(elem, value), result;
|
2355 |
+
},
|
2356 |
+
inputmaskpatch: !0
|
2357 |
+
};
|
2358 |
+
}
|
2359 |
+
}
|
2360 |
+
function getter() {
|
2361 |
+
var $self = $(this), inputData = $(this).data("_inputmask");
|
2362 |
+
return inputData ? inputData.opts.autoUnmask ? $self.inputmask("unmaskedvalue") : valueGet.call(this) != getBufferTemplate().join("") ? valueGet.call(this) : "" : valueGet.call(this);
|
2363 |
+
}
|
2364 |
+
function setter(value) {
|
2365 |
+
var inputData = $(this).data("_inputmask");
|
2366 |
+
inputData ? (valueSet.call(this, $.isFunction(inputData.opts.onBeforeMask) ? inputData.opts.onBeforeMask.call(el, value, inputData.opts) || value : value),
|
2367 |
+
$(this).triggerHandler("setvalue.inputmask")) : valueSet.call(this, value);
|
2368 |
+
}
|
2369 |
+
function InstallNativeValueSetFallback(npt) {
|
2370 |
+
$(npt).bind("mouseenter.inputmask", function() {
|
2371 |
+
var $input = $(this), input = this, value = input._valueGet();
|
2372 |
+
"" != value && value != getBuffer().join("") && $input.trigger("setvalue");
|
2373 |
+
});
|
2374 |
+
var events = $._data(npt).events, handlers = events.mouseover;
|
2375 |
+
if (handlers) {
|
2376 |
+
for (var ourHandler = handlers[handlers.length - 1], i = handlers.length - 1; i > 0; i--) handlers[i] = handlers[i - 1];
|
2377 |
+
handlers[0] = ourHandler;
|
2378 |
+
}
|
2379 |
+
}
|
2380 |
+
var valueGet, valueSet;
|
2381 |
+
if (!npt._valueGet) {
|
2382 |
+
if (Object.getOwnPropertyDescriptor) {
|
2383 |
+
Object.getOwnPropertyDescriptor(npt, "value");
|
2384 |
+
}
|
2385 |
+
document.__lookupGetter__ && npt.__lookupGetter__("value") ? (valueGet = npt.__lookupGetter__("value"),
|
2386 |
+
valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
|
2387 |
+
npt.__defineSetter__("value", setter)) : (valueGet = function() {
|
2388 |
+
return npt.value;
|
2389 |
+
}, valueSet = function(value) {
|
2390 |
+
npt.value = value;
|
2391 |
+
}, PatchValhook(npt.type), InstallNativeValueSetFallback(npt)), npt._valueGet = function() {
|
2392 |
+
return isRTL ? valueGet.call(this).split("").reverse().join("") : valueGet.call(this);
|
2393 |
+
}, npt._valueSet = function(value) {
|
2394 |
+
valueSet.call(this, isRTL ? value.split("").reverse().join("") : value);
|
2395 |
+
};
|
2396 |
+
}
|
2397 |
+
}
|
2398 |
+
function handleRemove(input, k, pos) {
|
2399 |
+
function generalize() {
|
2400 |
+
if (opts.keepStatic) {
|
2401 |
+
resetMaskSet(!0);
|
2402 |
+
var lastAlt, validInputs = [];
|
2403 |
+
for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) if (getMaskSet().validPositions[lastAlt]) {
|
2404 |
+
if (void 0 != getMaskSet().validPositions[lastAlt].alternation) break;
|
2405 |
+
validInputs.push(getMaskSet().validPositions[lastAlt].input), delete getMaskSet().validPositions[lastAlt];
|
2406 |
+
}
|
2407 |
+
if (lastAlt > 0) for (;validInputs.length > 0; ) getMaskSet().p = seekNext(getLastValidPosition()),
|
2408 |
+
keypressEvent.call(input, void 0, !0, validInputs.pop().charCodeAt(0), !1, !1, getMaskSet().p);
|
2409 |
+
}
|
2410 |
+
}
|
2411 |
+
if ((opts.numericInput || isRTL) && (k == $.inputmask.keyCode.BACKSPACE ? k = $.inputmask.keyCode.DELETE : k == $.inputmask.keyCode.DELETE && (k = $.inputmask.keyCode.BACKSPACE),
|
2412 |
+
isRTL)) {
|
2413 |
+
var pend = pos.end;
|
2414 |
+
pos.end = pos.begin, pos.begin = pend;
|
2415 |
+
}
|
2416 |
+
k == $.inputmask.keyCode.BACKSPACE && pos.end - pos.begin <= 1 ? pos.begin = seekPrevious(pos.begin) : k == $.inputmask.keyCode.DELETE && pos.begin == pos.end && pos.end++,
|
2417 |
+
stripValidPositions(pos.begin, pos.end), generalize();
|
2418 |
+
var firstMaskedPos = getLastValidPosition(pos.begin);
|
2419 |
+
firstMaskedPos < pos.begin ? (-1 == firstMaskedPos && resetMaskSet(), getMaskSet().p = seekNext(firstMaskedPos)) : getMaskSet().p = pos.begin;
|
2420 |
+
}
|
2421 |
+
function handleOnKeyResult(input, keyResult, caretPos) {
|
2422 |
+
if (keyResult && keyResult.refreshFromBuffer) {
|
2423 |
+
var refresh = keyResult.refreshFromBuffer;
|
2424 |
+
refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end), resetMaskSet(!0),
|
2425 |
+
void 0 != caretPos && (writeBuffer(input, getBuffer()), caret(input, keyResult.caret || caretPos.begin, keyResult.caret || caretPos.end));
|
2426 |
+
}
|
2427 |
+
}
|
2428 |
+
function keydownEvent(e) {
|
2429 |
+
skipKeyPressEvent = !1;
|
2430 |
+
var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
|
2431 |
+
k == $.inputmask.keyCode.BACKSPACE || k == $.inputmask.keyCode.DELETE || iphone && 127 == k || e.ctrlKey && 88 == k && !isInputEventSupported("cut") ? (e.preventDefault(),
|
2432 |
+
88 == k && (valueOnFocus = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p),
|
2433 |
+
input._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"),
|
2434 |
+
opts.showTooltip && $input.prop("title", getMaskSet().mask)) : k == $.inputmask.keyCode.END || k == $.inputmask.keyCode.PAGE_DOWN ? setTimeout(function() {
|
2435 |
+
var caretPos = seekNext(getLastValidPosition());
|
2436 |
+
opts.insertMode || caretPos != getMaskLength() || e.shiftKey || caretPos--, caret(input, e.shiftKey ? pos.begin : caretPos, caretPos);
|
2437 |
+
}, 0) : k == $.inputmask.keyCode.HOME && !e.shiftKey || k == $.inputmask.keyCode.PAGE_UP ? caret(input, 0, e.shiftKey ? pos.begin : 0) : k == $.inputmask.keyCode.ESCAPE || 90 == k && e.ctrlKey ? (checkVal(input, !0, !1, valueOnFocus.split("")),
|
2438 |
+
$input.click()) : k != $.inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? 0 != opts.insertMode || e.shiftKey || (k == $.inputmask.keyCode.RIGHT ? setTimeout(function() {
|
2439 |
+
var caretPos = caret(input);
|
2440 |
+
caret(input, caretPos.begin);
|
2441 |
+
}, 0) : k == $.inputmask.keyCode.LEFT && setTimeout(function() {
|
2442 |
+
var caretPos = caret(input);
|
2443 |
+
caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1);
|
2444 |
+
}, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin != getMaskLength() ? pos.begin : pos.begin - 1));
|
2445 |
+
var currentCaretPos = caret(input), keydownResult = opts.onKeyDown.call(this, e, getBuffer(), currentCaretPos.begin, opts);
|
2446 |
+
handleOnKeyResult(input, keydownResult, currentCaretPos), ignorable = -1 != $.inArray(k, opts.ignorables);
|
2447 |
+
}
|
2448 |
+
function keypressEvent(e, checkval, k, writeOut, strict, ndx) {
|
2449 |
+
if (void 0 == k && skipKeyPressEvent) return !1;
|
2450 |
+
skipKeyPressEvent = !0;
|
2451 |
+
var input = this, $input = $(input);
|
2452 |
+
e = e || window.event;
|
2453 |
+
var k = checkval ? k : e.which || e.charCode || e.keyCode;
|
2454 |
+
if (!(checkval === !0 || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return !0;
|
2455 |
+
if (k) {
|
2456 |
+
checkval !== !0 && 46 == k && 0 == e.shiftKey && "," == opts.radixPoint && (k = 44);
|
2457 |
+
var forwardPosition, pos = checkval ? {
|
2458 |
+
begin: ndx,
|
2459 |
+
end: ndx
|
2460 |
+
} : caret(input), c = String.fromCharCode(k), isSlctn = isSelection(pos.begin, pos.end);
|
2461 |
+
isSlctn && (getMaskSet().undoPositions = $.extend(!0, {}, getMaskSet().validPositions),
|
2462 |
+
handleRemove(input, $.inputmask.keyCode.DELETE, pos), opts.insertMode || (opts.insertMode = !opts.insertMode,
|
2463 |
+
setValidPosition(pos.begin, strict), opts.insertMode = !opts.insertMode), isSlctn = !opts.multi),
|
2464 |
+
getMaskSet().writeOutBuffer = !0;
|
2465 |
+
var p = isRTL && !isSlctn ? pos.end : pos.begin, valResult = isValid(p, c, strict);
|
2466 |
+
if (valResult !== !1) {
|
2467 |
+
if (valResult !== !0 && (p = void 0 != valResult.pos ? valResult.pos : p, c = void 0 != valResult.c ? valResult.c : c),
|
2468 |
+
resetMaskSet(!0), void 0 != valResult.caret) forwardPosition = valResult.caret; else {
|
2469 |
+
var vps = getMaskSet().validPositions;
|
2470 |
+
forwardPosition = !opts.keepStatic && (void 0 != vps[p + 1] && getTests(p + 1, vps[p].locator.slice(), p).length > 1 || void 0 != vps[p].alternation) ? p + 1 : seekNext(p);
|
2471 |
+
}
|
2472 |
+
getMaskSet().p = forwardPosition;
|
2473 |
+
}
|
2474 |
+
if (writeOut !== !1) {
|
2475 |
+
var self = this;
|
2476 |
+
if (setTimeout(function() {
|
2477 |
+
opts.onKeyValidation.call(self, valResult, opts);
|
2478 |
+
}, 0), getMaskSet().writeOutBuffer && valResult !== !1) {
|
2479 |
+
var buffer = getBuffer();
|
2480 |
+
writeBuffer(input, buffer, checkval ? void 0 : opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition),
|
2481 |
+
checkval !== !0 && setTimeout(function() {
|
2482 |
+
isComplete(buffer) === !0 && $input.trigger("complete"), skipInputEvent = !0, $input.trigger("input");
|
2483 |
+
}, 0);
|
2484 |
+
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
2485 |
+
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
2486 |
+
if (opts.showTooltip && $input.prop("title", getMaskSet().mask), e && 1 != checkval) {
|
2487 |
+
e.preventDefault();
|
2488 |
+
var currentCaretPos = caret(input), keypressResult = opts.onKeyPress.call(this, e, getBuffer(), currentCaretPos.begin, opts);
|
2489 |
+
handleOnKeyResult(input, keypressResult, currentCaretPos);
|
2490 |
+
}
|
2491 |
+
}
|
2492 |
+
}
|
2493 |
+
function keyupEvent(e) {
|
2494 |
+
var $input = $(this), input = this, k = e.keyCode, buffer = getBuffer(), currentCaretPos = caret(input), keyupResult = opts.onKeyUp.call(this, e, buffer, currentCaretPos.begin, opts);
|
2495 |
+
handleOnKeyResult(input, keyupResult, currentCaretPos), k == $.inputmask.keyCode.TAB && opts.showMaskOnFocus && ($input.hasClass("focus-inputmask") && 0 == input._valueGet().length ? (resetMaskSet(),
|
2496 |
+
buffer = getBuffer(), writeBuffer(input, buffer), caret(input, 0), valueOnFocus = getBuffer().join("")) : (writeBuffer(input, buffer),
|
2497 |
+
caret(input, TranslatePosition(0), TranslatePosition(getMaskLength()))));
|
2498 |
+
}
|
2499 |
+
function pasteEvent(e) {
|
2500 |
+
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2501 |
+
var input = this, $input = $(input), inputValue = input._valueGet(), caretPos = caret(input);
|
2502 |
+
if ("propertychange" == e.type && input._valueGet().length <= getMaskLength()) return !0;
|
2503 |
+
"paste" == e.type && (window.clipboardData && window.clipboardData.getData ? inputValue = inputValue.substr(0, caretPos.begin) + window.clipboardData.getData("Text") + inputValue.substr(caretPos.end, inputValue.length) : e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData && (inputValue = inputValue.substr(0, caretPos.begin) + e.originalEvent.clipboardData.getData("text/plain") + inputValue.substr(caretPos.end, inputValue.length)));
|
2504 |
+
var pasteValue = $.isFunction(opts.onBeforePaste) ? opts.onBeforePaste.call(input, inputValue, opts) || inputValue : inputValue;
|
2505 |
+
return checkVal(input, !0, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.split(""), !0),
|
2506 |
+
$input.click(), isComplete(getBuffer()) === !0 && $input.trigger("complete"), !1;
|
2507 |
+
}
|
2508 |
+
function mobileInputEvent(e) {
|
2509 |
+
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2510 |
+
var input = this, caretPos = caret(input), currentValue = input._valueGet();
|
2511 |
+
currentValue = currentValue.replace(new RegExp("(" + escapeRegex(getBufferTemplate().join("")) + ")*"), ""),
|
2512 |
+
caretPos.begin > currentValue.length && (caret(input, currentValue.length), caretPos = caret(input)),
|
2513 |
+
getBuffer().length - currentValue.length != 1 || currentValue.charAt(caretPos.begin) == getBuffer()[caretPos.begin] || currentValue.charAt(caretPos.begin + 1) == getBuffer()[caretPos.begin] || isMask(caretPos.begin) || (e.keyCode = $.inputmask.keyCode.BACKSPACE,
|
2514 |
+
keydownEvent.call(input, e)), e.preventDefault();
|
2515 |
+
}
|
2516 |
+
function inputFallBackEvent(e) {
|
2517 |
+
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2518 |
+
var input = this, caretPos = caret(input), currentValue = input._valueGet();
|
2519 |
+
caret(input, caretPos.begin - 1);
|
2520 |
+
var keypress = $.Event("keypress");
|
2521 |
+
keypress.which = currentValue.charCodeAt(caretPos.begin - 1), skipKeyPressEvent = !1,
|
2522 |
+
ignorable = !1, keypressEvent.call(input, keypress, void 0, void 0, !1);
|
2523 |
+
var forwardPosition = getMaskSet().p;
|
2524 |
+
writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition),
|
2525 |
+
e.preventDefault();
|
2526 |
+
}
|
2527 |
+
function compositionupdateEvent(e) {
|
2528 |
+
skipInputEvent = !0;
|
2529 |
+
var input = this;
|
2530 |
+
return setTimeout(function() {
|
2531 |
+
caret(input, caret(input).begin - 1);
|
2532 |
+
var keypress = $.Event("keypress");
|
2533 |
+
keypress.which = e.originalEvent.data.charCodeAt(0), skipKeyPressEvent = !1, ignorable = !1,
|
2534 |
+
keypressEvent.call(input, keypress, void 0, void 0, !1);
|
2535 |
+
var forwardPosition = getMaskSet().p;
|
2536 |
+
writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition);
|
2537 |
+
}, 0), !1;
|
2538 |
+
}
|
2539 |
+
function mask(el) {
|
2540 |
+
if ($el = $(el), $el.is(":input") && isInputTypeSupported($el.attr("type"))) {
|
2541 |
+
if ($el.data("_inputmask", {
|
2542 |
+
maskset: maskset,
|
2543 |
+
opts: opts,
|
2544 |
+
isRTL: !1
|
2545 |
+
}), opts.showTooltip && $el.prop("title", getMaskSet().mask), ("rtl" == el.dir || opts.rightAlign) && $el.css("text-align", "right"),
|
2546 |
+
"rtl" == el.dir || opts.numericInput) {
|
2547 |
+
el.dir = "ltr", $el.removeAttr("dir");
|
2548 |
+
var inputData = $el.data("_inputmask");
|
2549 |
+
inputData.isRTL = !0, $el.data("_inputmask", inputData), isRTL = !0;
|
2550 |
+
}
|
2551 |
+
$el.unbind(".inputmask"), $el.removeClass("focus-inputmask"), $el.closest("form").bind("submit", function() {
|
2552 |
+
valueOnFocus != getBuffer().join("") && $el.change(), $el[0]._valueGet && $el[0]._valueGet() == getBufferTemplate().join("") && $el[0]._valueSet(""),
|
2553 |
+
opts.autoUnmask && opts.removeMaskOnSubmit && $el.inputmask("remove");
|
2554 |
+
}).bind("reset", function() {
|
2555 |
+
setTimeout(function() {
|
2556 |
+
$el.trigger("setvalue");
|
2557 |
+
}, 0);
|
2558 |
+
}), $el.bind("mouseenter.inputmask", function() {
|
2559 |
+
var $input = $(this), input = this;
|
2560 |
+
!$input.hasClass("focus-inputmask") && opts.showMaskOnHover && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer());
|
2561 |
+
}).bind("blur.inputmask", function() {
|
2562 |
+
var $input = $(this), input = this;
|
2563 |
+
if ($input.data("_inputmask")) {
|
2564 |
+
var nptValue = input._valueGet(), buffer = getBuffer();
|
2565 |
+
$input.removeClass("focus-inputmask"), valueOnFocus != getBuffer().join("") && $input.change(),
|
2566 |
+
opts.clearMaskOnLostFocus && "" != nptValue && (nptValue == getBufferTemplate().join("") ? input._valueSet("") : clearOptionalTail(input)),
|
2567 |
+
isComplete(buffer) === !1 && ($input.trigger("incomplete"), opts.clearIncomplete && (resetMaskSet(),
|
2568 |
+
opts.clearMaskOnLostFocus ? input._valueSet("") : (buffer = getBufferTemplate().slice(),
|
2569 |
+
writeBuffer(input, buffer))));
|
2570 |
+
}
|
2571 |
+
}).bind("focus.inputmask", function() {
|
2572 |
+
var $input = $(this), input = this, nptValue = input._valueGet();
|
2573 |
+
opts.showMaskOnFocus && !$input.hasClass("focus-inputmask") && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())),
|
2574 |
+
$input.addClass("focus-inputmask"), valueOnFocus = getBuffer().join("");
|
2575 |
+
}).bind("mouseleave.inputmask", function() {
|
2576 |
+
var $input = $(this), input = this;
|
2577 |
+
opts.clearMaskOnLostFocus && ($input.hasClass("focus-inputmask") || input._valueGet() == $input.attr("placeholder") || (input._valueGet() == getBufferTemplate().join("") || "" == input._valueGet() ? input._valueSet("") : clearOptionalTail(input)));
|
2578 |
+
}).bind("click.inputmask", function() {
|
2579 |
+
var input = this;
|
2580 |
+
$(input).is(":focus") && setTimeout(function() {
|
2581 |
+
var selectedCaret = caret(input);
|
2582 |
+
if (selectedCaret.begin == selectedCaret.end) if (opts.radixFocus && "" != opts.radixPoint && -1 != $.inArray(opts.radixPoint, getBuffer()) && getBuffer().join("") == getBufferTemplate().join("")) caret(input, $.inArray(opts.radixPoint, getBuffer())); else {
|
2583 |
+
var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin, lastPosition = seekNext(getLastValidPosition(clickPosition));
|
2584 |
+
lastPosition > clickPosition ? caret(input, isMask(clickPosition) ? clickPosition : seekNext(clickPosition)) : caret(input, lastPosition);
|
2585 |
+
}
|
2586 |
+
}, 0);
|
2587 |
+
}).bind("dblclick.inputmask", function() {
|
2588 |
+
var input = this;
|
2589 |
+
setTimeout(function() {
|
2590 |
+
caret(input, 0, seekNext(getLastValidPosition()));
|
2591 |
+
}, 0);
|
2592 |
+
}).bind(PasteEventType + ".inputmask dragdrop.inputmask drop.inputmask", pasteEvent).bind("setvalue.inputmask", function() {
|
2593 |
+
var input = this;
|
2594 |
+
checkVal(input, !0, !1, void 0, !0), valueOnFocus = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input._valueGet() == getBufferTemplate().join("") && input._valueSet("");
|
2595 |
+
}).bind("cut.inputmask", function(e) {
|
2596 |
+
skipInputEvent = !0;
|
2597 |
+
var input = this, $input = $(input), pos = caret(input);
|
2598 |
+
handleRemove(input, $.inputmask.keyCode.DELETE, pos);
|
2599 |
+
var keypressResult = opts.onKeyPress.call(this, e, getBuffer(), getMaskSet().p, opts);
|
2600 |
+
handleOnKeyResult(input, keypressResult, {
|
2601 |
+
begin: getMaskSet().p,
|
2602 |
+
end: getMaskSet().p
|
2603 |
+
}), input._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"),
|
2604 |
+
opts.showTooltip && $input.prop("title", getMaskSet().mask);
|
2605 |
+
}).bind("complete.inputmask", opts.oncomplete).bind("incomplete.inputmask", opts.onincomplete).bind("cleared.inputmask", opts.oncleared),
|
2606 |
+
$el.bind("keydown.inputmask", keydownEvent).bind("keypress.inputmask", keypressEvent).bind("keyup.inputmask", keyupEvent).bind("compositionupdate.inputmask", compositionupdateEvent),
|
2607 |
+
"paste" !== PasteEventType || msie1x || $el.bind("input.inputmask", inputFallBackEvent),
|
2608 |
+
msie1x && $el.bind("input.inputmask", pasteEvent), (android || androidfirefox || androidchrome || kindle) && ("input" == PasteEventType && $el.unbind(PasteEventType + ".inputmask"),
|
2609 |
+
$el.bind("input.inputmask", mobileInputEvent)), patchValueProperty(el);
|
2610 |
+
var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(el, el._valueGet(), opts) || el._valueGet() : el._valueGet();
|
2611 |
+
checkVal(el, !0, !1, initialValue.split(""), !0), valueOnFocus = getBuffer().join("");
|
2612 |
+
var activeElement;
|
2613 |
+
try {
|
2614 |
+
activeElement = document.activeElement;
|
2615 |
+
} catch (e) {}
|
2616 |
+
isComplete(getBuffer()) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus ? getBuffer().join("") == getBufferTemplate().join("") ? el._valueSet("") : clearOptionalTail(el) : writeBuffer(el, getBuffer()),
|
2617 |
+
activeElement === el && ($el.addClass("focus-inputmask"), caret(el, seekNext(getLastValidPosition()))),
|
2618 |
+
installEventRuler(el);
|
2619 |
+
}
|
2620 |
+
}
|
2621 |
+
var valueOnFocus, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1;
|
2622 |
+
if (void 0 != actionObj) switch (actionObj.action) {
|
2623 |
+
case "isComplete":
|
2624 |
+
return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2625 |
+
isComplete(actionObj.buffer);
|
2626 |
+
|
2627 |
+
case "unmaskedvalue":
|
2628 |
+
return $el = actionObj.$input, maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2629 |
+
isRTL = actionObj.$input.data("_inputmask").isRTL, unmaskedvalue(actionObj.$input);
|
2630 |
+
|
2631 |
+
case "mask":
|
2632 |
+
valueOnFocus = getBuffer().join(""), mask(actionObj.el);
|
2633 |
+
break;
|
2634 |
+
|
2635 |
+
case "format":
|
2636 |
+
$el = $({}), $el.data("_inputmask", {
|
2637 |
+
maskset: maskset,
|
2638 |
+
opts: opts,
|
2639 |
+
isRTL: opts.numericInput
|
2640 |
+
}), opts.numericInput && (isRTL = !0);
|
2641 |
+
var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
|
2642 |
+
return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer, !0), opts.onKeyPress.call(this, void 0, getBuffer(), 0, opts),
|
2643 |
+
actionObj.metadata ? {
|
2644 |
+
value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
|
2645 |
+
metadata: $el.inputmask("getmetadata")
|
2646 |
+
} : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
|
2647 |
+
|
2648 |
+
case "isValid":
|
2649 |
+
$el = $({}), $el.data("_inputmask", {
|
2650 |
+
maskset: maskset,
|
2651 |
+
opts: opts,
|
2652 |
+
isRTL: opts.numericInput
|
2653 |
+
}), opts.numericInput && (isRTL = !0);
|
2654 |
+
var valueBuffer = actionObj.value.split("");
|
2655 |
+
checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
|
2656 |
+
for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
2657 |
+
return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
|
2658 |
+
|
2659 |
+
case "getemptymask":
|
2660 |
+
return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2661 |
+
getBufferTemplate();
|
2662 |
+
|
2663 |
+
case "remove":
|
2664 |
+
var el = actionObj.el;
|
2665 |
+
$el = $(el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2666 |
+
el._valueSet(unmaskedvalue($el)), $el.unbind(".inputmask"), $el.removeClass("focus-inputmask"),
|
2667 |
+
$el.removeData("_inputmask");
|
2668 |
+
var valueProperty;
|
2669 |
+
Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")),
|
2670 |
+
valueProperty && valueProperty.get ? el._valueGet && Object.defineProperty(el, "value", {
|
2671 |
+
get: el._valueGet,
|
2672 |
+
set: el._valueSet
|
2673 |
+
}) : document.__lookupGetter__ && el.__lookupGetter__("value") && el._valueGet && (el.__defineGetter__("value", el._valueGet),
|
2674 |
+
el.__defineSetter__("value", el._valueSet));
|
2675 |
+
try {
|
2676 |
+
delete el._valueGet, delete el._valueSet;
|
2677 |
+
} catch (e) {
|
2678 |
+
el._valueGet = void 0, el._valueSet = void 0;
|
2679 |
+
}
|
2680 |
+
break;
|
2681 |
|
2682 |
+
case "getmetadata":
|
2683 |
+
if ($el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2684 |
+
$.isArray(maskset.metadata)) {
|
2685 |
+
for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 != getMaskSet().validPositions[firstAlt].alternation) {
|
2686 |
+
alternation = getMaskSet().validPositions[firstAlt].alternation;
|
2687 |
+
break;
|
2688 |
+
}
|
2689 |
+
return void 0 != alternation ? maskset.metadata[getMaskSet().validPositions[lvp].locator[alternation]] : maskset.metadata[0];
|
2690 |
+
}
|
2691 |
+
return maskset.metadata;
|
2692 |
+
}
|
2693 |
+
}
|
2694 |
+
if (void 0 === $.fn.inputmask) {
|
2695 |
+
var msie1x = "function" == typeof ScriptEngineMajorVersion ? ScriptEngineMajorVersion() : new Function("/*@cc_on return @_jscript_version; @*/")() >= 10, ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), android = null !== ua.match(new RegExp("android.*safari.*", "i")), androidchrome = null !== ua.match(new RegExp("android.*chrome.*", "i")), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), kindle = /Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
|
2696 |
+
$.inputmask = {
|
2697 |
+
defaults: {
|
2698 |
+
placeholder: "_",
|
2699 |
+
optionalmarker: {
|
2700 |
+
start: "[",
|
2701 |
+
end: "]"
|
2702 |
+
},
|
2703 |
+
quantifiermarker: {
|
2704 |
+
start: "{",
|
2705 |
+
end: "}"
|
2706 |
+
},
|
2707 |
+
groupmarker: {
|
2708 |
+
start: "(",
|
2709 |
+
end: ")"
|
2710 |
+
},
|
2711 |
+
alternatormarker: "|",
|
2712 |
+
escapeChar: "\\",
|
2713 |
+
mask: null,
|
2714 |
+
oncomplete: $.noop,
|
2715 |
+
onincomplete: $.noop,
|
2716 |
+
oncleared: $.noop,
|
2717 |
+
repeat: 0,
|
2718 |
+
greedy: !0,
|
2719 |
+
autoUnmask: !1,
|
2720 |
+
removeMaskOnSubmit: !0,
|
2721 |
+
clearMaskOnLostFocus: !0,
|
2722 |
+
insertMode: !0,
|
2723 |
+
clearIncomplete: !1,
|
2724 |
+
aliases: {},
|
2725 |
+
alias: null,
|
2726 |
+
onKeyUp: $.noop,
|
2727 |
+
onKeyPress: $.noop,
|
2728 |
+
onKeyDown: $.noop,
|
2729 |
+
onBeforeMask: void 0,
|
2730 |
+
onBeforePaste: void 0,
|
2731 |
+
onUnMask: void 0,
|
2732 |
+
showMaskOnFocus: !0,
|
2733 |
+
showMaskOnHover: !0,
|
2734 |
+
onKeyValidation: $.noop,
|
2735 |
+
skipOptionalPartCharacter: " ",
|
2736 |
+
showTooltip: !1,
|
2737 |
+
numericInput: !1,
|
2738 |
+
rightAlign: !1,
|
2739 |
+
radixPoint: "",
|
2740 |
+
radixFocus: !1,
|
2741 |
+
nojumps: !1,
|
2742 |
+
nojumpsThreshold: 0,
|
2743 |
+
keepStatic: void 0,
|
2744 |
+
definitions: {
|
2745 |
+
"9": {
|
2746 |
+
validator: "[0-9]",
|
2747 |
+
cardinality: 1,
|
2748 |
+
definitionSymbol: "*"
|
2749 |
+
},
|
2750 |
+
a: {
|
2751 |
+
validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
2752 |
+
cardinality: 1,
|
2753 |
+
definitionSymbol: "*"
|
2754 |
+
},
|
2755 |
+
"*": {
|
2756 |
+
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
2757 |
+
cardinality: 1
|
2758 |
+
}
|
2759 |
+
},
|
2760 |
+
ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123 ],
|
2761 |
+
isComplete: void 0
|
2762 |
+
},
|
2763 |
+
keyCode: {
|
2764 |
+
ALT: 18,
|
2765 |
+
BACKSPACE: 8,
|
2766 |
+
CAPS_LOCK: 20,
|
2767 |
+
COMMA: 188,
|
2768 |
+
COMMAND: 91,
|
2769 |
+
COMMAND_LEFT: 91,
|
2770 |
+
COMMAND_RIGHT: 93,
|
2771 |
+
CONTROL: 17,
|
2772 |
+
DELETE: 46,
|
2773 |
+
DOWN: 40,
|
2774 |
+
END: 35,
|
2775 |
+
ENTER: 13,
|
2776 |
+
ESCAPE: 27,
|
2777 |
+
HOME: 36,
|
2778 |
+
INSERT: 45,
|
2779 |
+
LEFT: 37,
|
2780 |
+
MENU: 93,
|
2781 |
+
NUMPAD_ADD: 107,
|
2782 |
+
NUMPAD_DECIMAL: 110,
|
2783 |
+
NUMPAD_DIVIDE: 111,
|
2784 |
+
NUMPAD_ENTER: 108,
|
2785 |
+
NUMPAD_MULTIPLY: 106,
|
2786 |
+
NUMPAD_SUBTRACT: 109,
|
2787 |
+
PAGE_DOWN: 34,
|
2788 |
+
PAGE_UP: 33,
|
2789 |
+
PERIOD: 190,
|
2790 |
+
RIGHT: 39,
|
2791 |
+
SHIFT: 16,
|
2792 |
+
SPACE: 32,
|
2793 |
+
TAB: 9,
|
2794 |
+
UP: 38,
|
2795 |
+
WINDOWS: 91
|
2796 |
+
},
|
2797 |
+
masksCache: {},
|
2798 |
+
escapeRegex: function(str) {
|
2799 |
+
var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\" ];
|
2800 |
+
return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
|
2801 |
+
},
|
2802 |
+
format: function(value, options, metadata) {
|
2803 |
+
var opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2804 |
+
return resolveAlias(opts.alias, options, opts), maskScope({
|
2805 |
+
action: "format",
|
2806 |
+
value: value,
|
2807 |
+
metadata: metadata
|
2808 |
+
}, generateMaskSet(opts), opts);
|
2809 |
+
},
|
2810 |
+
isValid: function(value, options) {
|
2811 |
+
var opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2812 |
+
return resolveAlias(opts.alias, options, opts), maskScope({
|
2813 |
+
action: "isValid",
|
2814 |
+
value: value
|
2815 |
+
}, generateMaskSet(opts), opts);
|
2816 |
+
}
|
2817 |
+
}, $.fn.inputmask = function(fn, options, targetScope, targetData, msk) {
|
2818 |
+
function importAttributeOptions(npt, opts, importedOptionsContainer) {
|
2819 |
+
var $npt = $(npt);
|
2820 |
+
$npt.data("inputmask-alias") && resolveAlias($npt.data("inputmask-alias"), {}, opts);
|
2821 |
+
for (var option in opts) {
|
2822 |
+
var optionData = $npt.data("inputmask-" + option.toLowerCase());
|
2823 |
+
void 0 != optionData && ("mask" == option && 0 == optionData.indexOf("[") ? (opts[option] = optionData.replace(/[\s[\]]/g, "").split("','"),
|
2824 |
+
opts[option][0] = opts[option][0].replace("'", ""), opts[option][opts[option].length - 1] = opts[option][opts[option].length - 1].replace("'", "")) : opts[option] = "boolean" == typeof optionData ? optionData : optionData.toString(),
|
2825 |
+
importedOptionsContainer && (importedOptionsContainer[option] = opts[option]));
|
2826 |
+
}
|
2827 |
+
return opts;
|
2828 |
+
}
|
2829 |
+
targetScope = targetScope || maskScope, targetData = targetData || "_inputmask";
|
2830 |
+
var maskset, opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2831 |
+
if ("string" == typeof fn) switch (fn) {
|
2832 |
+
case "mask":
|
2833 |
+
return resolveAlias(opts.alias, options, opts), maskset = generateMaskSet(opts, targetScope !== maskScope),
|
2834 |
+
void 0 == maskset ? this : this.each(function() {
|
2835 |
+
targetScope({
|
2836 |
+
action: "mask",
|
2837 |
+
el: this
|
2838 |
+
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2839 |
+
});
|
2840 |
|
2841 |
+
case "unmaskedvalue":
|
2842 |
+
var $input = $(this);
|
2843 |
+
return $input.data(targetData) ? targetScope({
|
2844 |
+
action: "unmaskedvalue",
|
2845 |
+
$input: $input
|
2846 |
+
}) : $input.val();
|
2847 |
+
|
2848 |
+
case "remove":
|
2849 |
+
return this.each(function() {
|
2850 |
+
var $input = $(this);
|
2851 |
+
$input.data(targetData) && targetScope({
|
2852 |
+
action: "remove",
|
2853 |
+
el: this
|
2854 |
+
});
|
2855 |
+
});
|
2856 |
+
|
2857 |
+
case "getemptymask":
|
2858 |
+
return this.data(targetData) ? targetScope({
|
2859 |
+
action: "getemptymask",
|
2860 |
+
el: this
|
2861 |
+
}) : "";
|
2862 |
+
|
2863 |
+
case "hasMaskedValue":
|
2864 |
+
return this.data(targetData) ? !this.data(targetData).opts.autoUnmask : !1;
|
2865 |
+
|
2866 |
+
case "isComplete":
|
2867 |
+
return this.data(targetData) ? targetScope({
|
2868 |
+
action: "isComplete",
|
2869 |
+
buffer: this[0]._valueGet().split(""),
|
2870 |
+
el: this
|
2871 |
+
}) : !0;
|
2872 |
+
|
2873 |
+
case "getmetadata":
|
2874 |
+
return this.data(targetData) ? targetScope({
|
2875 |
+
action: "getmetadata",
|
2876 |
+
el: this
|
2877 |
+
}) : void 0;
|
2878 |
+
|
2879 |
+
case "_detectScope":
|
2880 |
+
return resolveAlias(opts.alias, options, opts), void 0 == msk || resolveAlias(msk, options, opts) || -1 != $.inArray(msk, [ "mask", "unmaskedvalue", "remove", "getemptymask", "hasMaskedValue", "isComplete", "getmetadata", "_detectScope" ]) || (opts.mask = msk),
|
2881 |
+
$.isFunction(opts.mask) && (opts.mask = opts.mask.call(this, opts)), $.isArray(opts.mask);
|
2882 |
|
2883 |
+
default:
|
2884 |
+
return resolveAlias(opts.alias, options, opts), resolveAlias(fn, options, opts) || (opts.mask = fn),
|
2885 |
+
maskset = generateMaskSet(opts, targetScope !== maskScope), void 0 == maskset ? this : this.each(function() {
|
2886 |
+
targetScope({
|
2887 |
+
action: "mask",
|
2888 |
+
el: this
|
2889 |
+
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2890 |
+
});
|
2891 |
+
} else {
|
2892 |
+
if ("object" == typeof fn) return opts = $.extend(!0, {}, $.inputmask.defaults, fn),
|
2893 |
+
resolveAlias(opts.alias, fn, opts), maskset = generateMaskSet(opts, targetScope !== maskScope),
|
2894 |
+
void 0 == maskset ? this : this.each(function() {
|
2895 |
+
targetScope({
|
2896 |
+
action: "mask",
|
2897 |
+
el: this
|
2898 |
+
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2899 |
+
});
|
2900 |
+
if (void 0 == fn) return this.each(function() {
|
2901 |
+
var attrOptions = $(this).attr("data-inputmask");
|
2902 |
+
if (attrOptions && "" != attrOptions) try {
|
2903 |
+
attrOptions = attrOptions.replace(new RegExp("'", "g"), '"');
|
2904 |
+
var dataoptions = $.parseJSON("{" + attrOptions + "}");
|
2905 |
+
$.extend(!0, dataoptions, options), opts = $.extend(!0, {}, $.inputmask.defaults, dataoptions),
|
2906 |
+
opts = importAttributeOptions(this, opts), resolveAlias(opts.alias, dataoptions, opts),
|
2907 |
+
opts.alias = void 0, $(this).inputmask("mask", opts, targetScope);
|
2908 |
+
} catch (ex) {}
|
2909 |
+
if ($(this).attr("data-inputmask-mask") || $(this).attr("data-inputmask-alias")) {
|
2910 |
+
opts = $.extend(!0, {}, $.inputmask.defaults, {});
|
2911 |
+
var dataOptions = {};
|
2912 |
+
opts = importAttributeOptions(this, opts, dataOptions), resolveAlias(opts.alias, dataOptions, opts),
|
2913 |
+
opts.alias = void 0, $(this).inputmask("mask", opts, targetScope);
|
2914 |
+
}
|
2915 |
+
});
|
2916 |
+
}
|
2917 |
+
};
|
2918 |
+
}
|
2919 |
+
return $.fn.inputmask;
|
2920 |
+
}(jQuery), function($) {
|
2921 |
+
return $.extend($.inputmask.defaults.definitions, {
|
2922 |
+
h: {
|
2923 |
+
validator: "[01][0-9]|2[0-3]",
|
2924 |
+
cardinality: 2,
|
2925 |
+
prevalidator: [ {
|
2926 |
+
validator: "[0-2]",
|
2927 |
+
cardinality: 1
|
2928 |
+
} ]
|
2929 |
+
},
|
2930 |
+
s: {
|
2931 |
+
validator: "[0-5][0-9]",
|
2932 |
+
cardinality: 2,
|
2933 |
+
prevalidator: [ {
|
2934 |
+
validator: "[0-5]",
|
2935 |
+
cardinality: 1
|
2936 |
+
} ]
|
2937 |
+
},
|
2938 |
+
d: {
|
2939 |
+
validator: "0[1-9]|[12][0-9]|3[01]",
|
2940 |
+
cardinality: 2,
|
2941 |
+
prevalidator: [ {
|
2942 |
+
validator: "[0-3]",
|
2943 |
+
cardinality: 1
|
2944 |
+
} ]
|
2945 |
+
},
|
2946 |
+
m: {
|
2947 |
+
validator: "0[1-9]|1[012]",
|
2948 |
+
cardinality: 2,
|
2949 |
+
prevalidator: [ {
|
2950 |
+
validator: "[01]",
|
2951 |
+
cardinality: 1
|
2952 |
+
} ]
|
2953 |
+
},
|
2954 |
+
y: {
|
2955 |
+
validator: "(19|20)\\d{2}",
|
2956 |
+
cardinality: 4,
|
2957 |
+
prevalidator: [ {
|
2958 |
+
validator: "[12]",
|
2959 |
+
cardinality: 1
|
2960 |
+
}, {
|
2961 |
+
validator: "(19|20)",
|
2962 |
+
cardinality: 2
|
2963 |
+
}, {
|
2964 |
+
validator: "(19|20)\\d",
|
2965 |
+
cardinality: 3
|
2966 |
+
} ]
|
2967 |
+
}
|
2968 |
+
}), $.extend($.inputmask.defaults.aliases, {
|
2969 |
+
"dd/mm/yyyy": {
|
2970 |
+
mask: "1/2/y",
|
2971 |
+
placeholder: "dd/mm/yyyy",
|
2972 |
+
regex: {
|
2973 |
+
val1pre: new RegExp("[0-3]"),
|
2974 |
+
val1: new RegExp("0[1-9]|[12][0-9]|3[01]"),
|
2975 |
+
val2pre: function(separator) {
|
2976 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
2977 |
+
return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
|
2978 |
+
},
|
2979 |
+
val2: function(separator) {
|
2980 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
2981 |
+
return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
|
2982 |
+
}
|
2983 |
+
},
|
2984 |
+
leapday: "29/02/",
|
2985 |
+
separator: "/",
|
2986 |
+
yearrange: {
|
2987 |
+
minyear: 1900,
|
2988 |
+
maxyear: 2099
|
2989 |
+
},
|
2990 |
+
isInYearRange: function(chrs, minyear, maxyear) {
|
2991 |
+
if (isNaN(chrs)) return !1;
|
2992 |
+
var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
|
2993 |
+
return (isNaN(enteredyear) ? !1 : enteredyear >= minyear && maxyear >= enteredyear) || (isNaN(enteredyear2) ? !1 : enteredyear2 >= minyear && maxyear >= enteredyear2);
|
2994 |
+
},
|
2995 |
+
determinebaseyear: function(minyear, maxyear, hint) {
|
2996 |
+
var currentyear = new Date().getFullYear();
|
2997 |
+
if (minyear > currentyear) return minyear;
|
2998 |
+
if (currentyear > maxyear) {
|
2999 |
+
for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxYearPrefix + hint > maxyear; ) maxYearPrefix--;
|
3000 |
+
var maxxYear = maxYearPrefix + maxYearPostfix;
|
3001 |
+
return minyear > maxxYear ? minyear : maxxYear;
|
3002 |
+
}
|
3003 |
+
return currentyear;
|
3004 |
+
},
|
3005 |
+
onKeyUp: function(e) {
|
3006 |
+
var $input = $(this);
|
3007 |
+
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
3008 |
+
var today = new Date();
|
3009 |
+
$input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString());
|
3010 |
+
}
|
3011 |
+
},
|
3012 |
+
definitions: {
|
3013 |
+
"1": {
|
3014 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3015 |
+
var isValid = opts.regex.val1.test(chrs);
|
3016 |
+
return strict || isValid || chrs.charAt(1) != opts.separator && -1 == "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0",
|
3017 |
+
{
|
3018 |
+
refreshFromBuffer: {
|
3019 |
+
start: pos - 1,
|
3020 |
+
end: pos
|
3021 |
+
},
|
3022 |
+
pos: pos,
|
3023 |
+
c: chrs.charAt(0)
|
3024 |
+
});
|
3025 |
+
},
|
3026 |
+
cardinality: 2,
|
3027 |
+
prevalidator: [ {
|
3028 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3029 |
+
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
3030 |
+
var isValid = 1 == chrs.length ? opts.regex.val1pre.test(chrs) : opts.regex.val1.test(chrs);
|
3031 |
+
return strict || isValid || !(isValid = opts.regex.val1.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3032 |
+
pos++, {
|
3033 |
+
pos: pos
|
3034 |
+
});
|
3035 |
+
},
|
3036 |
+
cardinality: 1
|
3037 |
+
} ]
|
3038 |
+
},
|
3039 |
+
"2": {
|
3040 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3041 |
+
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
3042 |
+
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
3043 |
+
var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
|
3044 |
+
if (!strict && !isValid && (chrs.charAt(1) == opts.separator || -1 != "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
3045 |
+
{
|
3046 |
+
refreshFromBuffer: {
|
3047 |
+
start: pos - 1,
|
3048 |
+
end: pos
|
3049 |
+
},
|
3050 |
+
pos: pos,
|
3051 |
+
c: chrs.charAt(0)
|
3052 |
+
};
|
3053 |
+
if (opts.mask.indexOf("2") == opts.mask.length - 1 && isValid) {
|
3054 |
+
var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
|
3055 |
+
if (dayMonthValue != opts.leapday) return !0;
|
3056 |
+
var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
|
3057 |
+
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3058 |
+
}
|
3059 |
+
return isValid;
|
3060 |
+
},
|
3061 |
+
cardinality: 2,
|
3062 |
+
prevalidator: [ {
|
3063 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3064 |
+
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
3065 |
+
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
3066 |
+
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
3067 |
+
var isValid = 1 == chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
|
3068 |
+
return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3069 |
+
pos++, {
|
3070 |
+
pos: pos
|
3071 |
+
});
|
3072 |
+
},
|
3073 |
+
cardinality: 1
|
3074 |
+
} ]
|
3075 |
+
},
|
3076 |
+
y: {
|
3077 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3078 |
+
if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
3079 |
+
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
3080 |
+
if (dayMonthValue != opts.leapday) return !0;
|
3081 |
+
var year = parseInt(chrs, 10);
|
3082 |
+
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3083 |
+
}
|
3084 |
+
return !1;
|
3085 |
+
},
|
3086 |
+
cardinality: 4,
|
3087 |
+
prevalidator: [ {
|
3088 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3089 |
+
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3090 |
+
if (!strict && !isValid) {
|
3091 |
+
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
|
3092 |
+
if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
3093 |
+
{
|
3094 |
+
pos: pos
|
3095 |
+
};
|
3096 |
+
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2),
|
3097 |
+
isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
3098 |
+
maskset.buffer[pos++] = yearPrefix.charAt(1), {
|
3099 |
+
pos: pos
|
3100 |
+
};
|
3101 |
+
}
|
3102 |
+
return isValid;
|
3103 |
+
},
|
3104 |
+
cardinality: 1
|
3105 |
+
}, {
|
3106 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3107 |
+
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3108 |
+
if (!strict && !isValid) {
|
3109 |
+
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
|
3110 |
+
if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1),
|
3111 |
+
{
|
3112 |
+
pos: pos
|
3113 |
+
};
|
3114 |
+
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2),
|
3115 |
+
opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
3116 |
+
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
3117 |
+
if (dayMonthValue != opts.leapday) isValid = !0; else {
|
3118 |
+
var year = parseInt(chrs, 10);
|
3119 |
+
isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3120 |
+
}
|
3121 |
+
} else isValid = !1;
|
3122 |
+
if (isValid) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), maskset.buffer[pos++] = yearPrefix.charAt(1),
|
3123 |
+
maskset.buffer[pos++] = chrs.charAt(0), {
|
3124 |
+
refreshFromBuffer: {
|
3125 |
+
start: pos - 3,
|
3126 |
+
end: pos
|
3127 |
+
},
|
3128 |
+
pos: pos
|
3129 |
+
};
|
3130 |
+
}
|
3131 |
+
return isValid;
|
3132 |
+
},
|
3133 |
+
cardinality: 2
|
3134 |
+
}, {
|
3135 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3136 |
+
return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3137 |
+
},
|
3138 |
+
cardinality: 3
|
3139 |
+
} ]
|
3140 |
+
}
|
3141 |
+
},
|
3142 |
+
insertMode: !1,
|
3143 |
+
autoUnmask: !1
|
3144 |
+
},
|
3145 |
+
"mm/dd/yyyy": {
|
3146 |
+
placeholder: "mm/dd/yyyy",
|
3147 |
+
alias: "dd/mm/yyyy",
|
3148 |
+
regex: {
|
3149 |
+
val2pre: function(separator) {
|
3150 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
3151 |
+
return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
|
3152 |
+
},
|
3153 |
+
val2: function(separator) {
|
3154 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
3155 |
+
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
|
3156 |
+
},
|
3157 |
+
val1pre: new RegExp("[01]"),
|
3158 |
+
val1: new RegExp("0[1-9]|1[012]")
|
3159 |
+
},
|
3160 |
+
leapday: "02/29/",
|
3161 |
+
onKeyUp: function(e) {
|
3162 |
+
var $input = $(this);
|
3163 |
+
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
3164 |
+
var today = new Date();
|
3165 |
+
$input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString());
|
3166 |
+
}
|
3167 |
+
}
|
3168 |
+
},
|
3169 |
+
"yyyy/mm/dd": {
|
3170 |
+
mask: "y/1/2",
|
3171 |
+
placeholder: "yyyy/mm/dd",
|
3172 |
+
alias: "mm/dd/yyyy",
|
3173 |
+
leapday: "/02/29",
|
3174 |
+
onKeyUp: function(e) {
|
3175 |
+
var $input = $(this);
|
3176 |
+
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
3177 |
+
var today = new Date();
|
3178 |
+
$input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString());
|
3179 |
+
}
|
3180 |
+
}
|
3181 |
+
},
|
3182 |
+
"dd.mm.yyyy": {
|
3183 |
+
mask: "1.2.y",
|
3184 |
+
placeholder: "dd.mm.yyyy",
|
3185 |
+
leapday: "29.02.",
|
3186 |
+
separator: ".",
|
3187 |
+
alias: "dd/mm/yyyy"
|
3188 |
+
},
|
3189 |
+
"dd-mm-yyyy": {
|
3190 |
+
mask: "1-2-y",
|
3191 |
+
placeholder: "dd-mm-yyyy",
|
3192 |
+
leapday: "29-02-",
|
3193 |
+
separator: "-",
|
3194 |
+
alias: "dd/mm/yyyy"
|
3195 |
+
},
|
3196 |
+
"mm.dd.yyyy": {
|
3197 |
+
mask: "1.2.y",
|
3198 |
+
placeholder: "mm.dd.yyyy",
|
3199 |
+
leapday: "02.29.",
|
3200 |
+
separator: ".",
|
3201 |
+
alias: "mm/dd/yyyy"
|
3202 |
+
},
|
3203 |
+
"mm-dd-yyyy": {
|
3204 |
+
mask: "1-2-y",
|
3205 |
+
placeholder: "mm-dd-yyyy",
|
3206 |
+
leapday: "02-29-",
|
3207 |
+
separator: "-",
|
3208 |
+
alias: "mm/dd/yyyy"
|
3209 |
+
},
|
3210 |
+
"yyyy.mm.dd": {
|
3211 |
+
mask: "y.1.2",
|
3212 |
+
placeholder: "yyyy.mm.dd",
|
3213 |
+
leapday: ".02.29",
|
3214 |
+
separator: ".",
|
3215 |
+
alias: "yyyy/mm/dd"
|
3216 |
+
},
|
3217 |
+
"yyyy-mm-dd": {
|
3218 |
+
mask: "y-1-2",
|
3219 |
+
placeholder: "yyyy-mm-dd",
|
3220 |
+
leapday: "-02-29",
|
3221 |
+
separator: "-",
|
3222 |
+
alias: "yyyy/mm/dd"
|
3223 |
+
},
|
3224 |
+
datetime: {
|
3225 |
+
mask: "1/2/y h:s",
|
3226 |
+
placeholder: "dd/mm/yyyy hh:mm",
|
3227 |
+
alias: "dd/mm/yyyy",
|
3228 |
+
regex: {
|
3229 |
+
hrspre: new RegExp("[012]"),
|
3230 |
+
hrs24: new RegExp("2[0-4]|1[3-9]"),
|
3231 |
+
hrs: new RegExp("[01][0-9]|2[0-4]"),
|
3232 |
+
ampm: new RegExp("^[a|p|A|P][m|M]"),
|
3233 |
+
mspre: new RegExp("[0-5]"),
|
3234 |
+
ms: new RegExp("[0-5][0-9]")
|
3235 |
+
},
|
3236 |
+
timeseparator: ":",
|
3237 |
+
hourFormat: "24",
|
3238 |
+
definitions: {
|
3239 |
+
h: {
|
3240 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3241 |
+
if ("24" == opts.hourFormat && 24 == parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0",
|
3242 |
+
maskset.buffer[pos] = "0", {
|
3243 |
+
refreshFromBuffer: {
|
3244 |
+
start: pos - 1,
|
3245 |
+
end: pos
|
3246 |
+
},
|
3247 |
+
c: "0"
|
3248 |
+
};
|
3249 |
+
var isValid = opts.regex.hrs.test(chrs);
|
3250 |
+
if (!strict && !isValid && (chrs.charAt(1) == opts.timeseparator || -1 != "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
3251 |
+
maskset.buffer[pos] = chrs.charAt(0), pos++, {
|
3252 |
+
refreshFromBuffer: {
|
3253 |
+
start: pos - 2,
|
3254 |
+
end: pos
|
3255 |
+
},
|
3256 |
+
pos: pos,
|
3257 |
+
c: opts.timeseparator
|
3258 |
+
};
|
3259 |
+
if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
|
3260 |
+
var tmp = parseInt(chrs, 10);
|
3261 |
+
return 24 == tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p",
|
3262 |
+
maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(),
|
3263 |
+
maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1),
|
3264 |
+
maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
|
3265 |
+
refreshFromBuffer: {
|
3266 |
+
start: pos - 1,
|
3267 |
+
end: pos + 6
|
3268 |
+
},
|
3269 |
+
c: maskset.buffer[pos]
|
3270 |
+
};
|
3271 |
+
}
|
3272 |
+
return isValid;
|
3273 |
+
},
|
3274 |
+
cardinality: 2,
|
3275 |
+
prevalidator: [ {
|
3276 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3277 |
+
var isValid = opts.regex.hrspre.test(chrs);
|
3278 |
+
return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3279 |
+
pos++, {
|
3280 |
+
pos: pos
|
3281 |
+
});
|
3282 |
+
},
|
3283 |
+
cardinality: 1
|
3284 |
+
} ]
|
3285 |
+
},
|
3286 |
+
s: {
|
3287 |
+
validator: "[0-5][0-9]",
|
3288 |
+
cardinality: 2,
|
3289 |
+
prevalidator: [ {
|
3290 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3291 |
+
var isValid = opts.regex.mspre.test(chrs);
|
3292 |
+
return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3293 |
+
pos++, {
|
3294 |
+
pos: pos
|
3295 |
+
});
|
3296 |
+
},
|
3297 |
+
cardinality: 1
|
3298 |
+
} ]
|
3299 |
+
},
|
3300 |
+
t: {
|
3301 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3302 |
+
return opts.regex.ampm.test(chrs + "m");
|
3303 |
+
},
|
3304 |
+
casing: "lower",
|
3305 |
+
cardinality: 1
|
3306 |
+
}
|
3307 |
+
},
|
3308 |
+
insertMode: !1,
|
3309 |
+
autoUnmask: !1
|
3310 |
+
},
|
3311 |
+
datetime12: {
|
3312 |
+
mask: "1/2/y h:s t\\m",
|
3313 |
+
placeholder: "dd/mm/yyyy hh:mm xm",
|
3314 |
+
alias: "datetime",
|
3315 |
+
hourFormat: "12"
|
3316 |
+
},
|
3317 |
+
"hh:mm t": {
|
3318 |
+
mask: "h:s t\\m",
|
3319 |
+
placeholder: "hh:mm xm",
|
3320 |
+
alias: "datetime",
|
3321 |
+
hourFormat: "12"
|
3322 |
+
},
|
3323 |
+
"h:s t": {
|
3324 |
+
mask: "h:s t\\m",
|
3325 |
+
placeholder: "hh:mm xm",
|
3326 |
+
alias: "datetime",
|
3327 |
+
hourFormat: "12"
|
3328 |
+
},
|
3329 |
+
"hh:mm:ss": {
|
3330 |
+
mask: "h:s:s",
|
3331 |
+
placeholder: "hh:mm:ss",
|
3332 |
+
alias: "datetime",
|
3333 |
+
autoUnmask: !1
|
3334 |
+
},
|
3335 |
+
"hh:mm": {
|
3336 |
+
mask: "h:s",
|
3337 |
+
placeholder: "hh:mm",
|
3338 |
+
alias: "datetime",
|
3339 |
+
autoUnmask: !1
|
3340 |
+
},
|
3341 |
+
date: {
|
3342 |
+
alias: "dd/mm/yyyy"
|
3343 |
+
},
|
3344 |
+
"mm/yyyy": {
|
3345 |
+
mask: "1/y",
|
3346 |
+
placeholder: "mm/yyyy",
|
3347 |
+
leapday: "donotuse",
|
3348 |
+
separator: "/",
|
3349 |
+
alias: "mm/dd/yyyy"
|
3350 |
+
}
|
3351 |
+
}), $.fn.inputmask;
|
3352 |
+
}(jQuery), function($) {
|
3353 |
+
return $.extend($.inputmask.defaults.definitions, {
|
3354 |
+
A: {
|
3355 |
+
validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
3356 |
+
cardinality: 1,
|
3357 |
+
casing: "upper"
|
3358 |
+
},
|
3359 |
+
"#": {
|
3360 |
+
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
3361 |
+
cardinality: 1,
|
3362 |
+
casing: "upper"
|
3363 |
+
}
|
3364 |
+
}), $.extend($.inputmask.defaults.aliases, {
|
3365 |
+
url: {
|
3366 |
+
mask: "ir",
|
3367 |
+
placeholder: "",
|
3368 |
+
separator: "",
|
3369 |
+
defaultPrefix: "http://",
|
3370 |
+
regex: {
|
3371 |
+
urlpre1: new RegExp("[fh]"),
|
3372 |
+
urlpre2: new RegExp("(ft|ht)"),
|
3373 |
+
urlpre3: new RegExp("(ftp|htt)"),
|
3374 |
+
urlpre4: new RegExp("(ftp:|http|ftps)"),
|
3375 |
+
urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
|
3376 |
+
urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
|
3377 |
+
urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
|
3378 |
+
urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
|
3379 |
+
},
|
3380 |
+
definitions: {
|
3381 |
+
i: {
|
3382 |
+
validator: function() {
|
3383 |
+
return !0;
|
3384 |
+
},
|
3385 |
+
cardinality: 8,
|
3386 |
+
prevalidator: function() {
|
3387 |
+
for (var result = [], prefixLimit = 8, i = 0; prefixLimit > i; i++) result[i] = function() {
|
3388 |
+
var j = i;
|
3389 |
+
return {
|
3390 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3391 |
+
if (opts.regex["urlpre" + (j + 1)]) {
|
3392 |
+
var k, tmp = chrs;
|
3393 |
+
j + 1 - chrs.length > 0 && (tmp = maskset.buffer.join("").substring(0, j + 1 - chrs.length) + "" + tmp);
|
3394 |
+
var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
|
3395 |
+
if (!strict && !isValid) {
|
3396 |
+
for (pos -= j, k = 0; k < opts.defaultPrefix.length; k++) maskset.buffer[pos] = opts.defaultPrefix[k],
|
3397 |
+
pos++;
|
3398 |
+
for (k = 0; k < tmp.length - 1; k++) maskset.buffer[pos] = tmp[k], pos++;
|
3399 |
+
return {
|
3400 |
+
pos: pos
|
3401 |
+
};
|
3402 |
+
}
|
3403 |
+
return isValid;
|
3404 |
+
}
|
3405 |
+
return !1;
|
3406 |
+
},
|
3407 |
+
cardinality: j
|
3408 |
+
};
|
3409 |
+
}();
|
3410 |
+
return result;
|
3411 |
+
}()
|
3412 |
+
},
|
3413 |
+
r: {
|
3414 |
+
validator: ".",
|
3415 |
+
cardinality: 50
|
3416 |
+
}
|
3417 |
+
},
|
3418 |
+
insertMode: !1,
|
3419 |
+
autoUnmask: !1
|
3420 |
+
},
|
3421 |
+
ip: {
|
3422 |
+
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
3423 |
+
definitions: {
|
3424 |
+
i: {
|
3425 |
+
validator: function(chrs, maskset, pos) {
|
3426 |
+
return pos - 1 > -1 && "." != maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
3427 |
+
chrs = pos - 2 > -1 && "." != maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
|
3428 |
+
new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
3429 |
+
},
|
3430 |
+
cardinality: 1
|
3431 |
+
}
|
3432 |
+
}
|
3433 |
+
},
|
3434 |
+
email: {
|
3435 |
+
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
|
3436 |
+
greedy: !1,
|
3437 |
+
onBeforePaste: function(pastedValue) {
|
3438 |
+
return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
|
3439 |
+
},
|
3440 |
+
definitions: {
|
3441 |
+
"*": {
|
3442 |
+
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
|
3443 |
+
cardinality: 1,
|
3444 |
+
casing: "lower"
|
3445 |
+
}
|
3446 |
+
}
|
3447 |
+
}
|
3448 |
+
}), $.fn.inputmask;
|
3449 |
+
}(jQuery), function($) {
|
3450 |
+
return $.extend($.inputmask.defaults.aliases, {
|
3451 |
+
numeric: {
|
3452 |
+
mask: function(opts) {
|
3453 |
+
if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
|
3454 |
+
opts.repeat = 0, opts.groupSeparator == opts.radixPoint && (opts.groupSeparator = "." == opts.radixPoint ? "," : "," == opts.radixPoint ? "." : ""),
|
3455 |
+
" " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" != opts.groupSeparator,
|
3456 |
+
opts.autoGroup && isFinite(opts.integerDigits)) {
|
3457 |
+
var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
|
3458 |
+
opts.integerDigits += 0 == mod ? seps - 1 : seps;
|
3459 |
+
}
|
3460 |
+
opts.definitions[";"] = opts.definitions["~"];
|
3461 |
+
var mask = opts.prefix;
|
3462 |
+
return mask += "[+]", mask += "~{1," + opts.integerDigits + "}", void 0 != opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"),
|
3463 |
+
mask += opts.suffix;
|
3464 |
+
},
|
3465 |
+
placeholder: "",
|
3466 |
+
greedy: !1,
|
3467 |
+
digits: "*",
|
3468 |
+
digitsOptional: !0,
|
3469 |
+
groupSeparator: "",
|
3470 |
+
radixPoint: ".",
|
3471 |
+
radixFocus: !0,
|
3472 |
+
groupSize: 3,
|
3473 |
+
autoGroup: !1,
|
3474 |
+
allowPlus: !0,
|
3475 |
+
allowMinus: !0,
|
3476 |
+
integerDigits: "+",
|
3477 |
+
prefix: "",
|
3478 |
+
suffix: "",
|
3479 |
+
rightAlign: !0,
|
3480 |
+
decimalProtect: !0,
|
3481 |
+
postFormat: function(buffer, pos, reformatOnly, opts) {
|
3482 |
+
var needsRefresh = !1, charAtPos = buffer[pos];
|
3483 |
+
if ("" == opts.groupSeparator || -1 != $.inArray(opts.radixPoint, buffer) && pos >= $.inArray(opts.radixPoint, buffer) || new RegExp("[-+]").test(charAtPos)) return {
|
3484 |
+
pos: pos
|
3485 |
+
};
|
3486 |
+
var cbuf = buffer.slice();
|
3487 |
+
charAtPos == opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
|
3488 |
+
reformatOnly ? cbuf[pos] = "?" : cbuf.splice(pos, 0, "?");
|
3489 |
+
var bufVal = cbuf.join("");
|
3490 |
+
if (opts.autoGroup || reformatOnly && -1 != bufVal.indexOf(opts.groupSeparator)) {
|
3491 |
+
var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
|
3492 |
+
needsRefresh = 0 == bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
|
3493 |
+
var radixSplit = bufVal.split(opts.radixPoint);
|
3494 |
+
if (bufVal = radixSplit[0], bufVal != opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) {
|
3495 |
+
needsRefresh = !0;
|
3496 |
+
for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal); ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
|
3497 |
+
bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
|
3498 |
+
}
|
3499 |
+
radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
|
3500 |
+
}
|
3501 |
+
buffer.length = bufVal.length;
|
3502 |
+
for (var i = 0, l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
|
3503 |
+
var newPos = $.inArray("?", buffer);
|
3504 |
+
return reformatOnly ? buffer[newPos] = charAtPos : buffer.splice(newPos, 1), {
|
3505 |
+
pos: newPos,
|
3506 |
+
refreshFromBuffer: needsRefresh
|
3507 |
+
};
|
3508 |
+
},
|
3509 |
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
3510 |
+
if (e.keyCode == $.inputmask.keyCode.TAB && "0" != opts.placeholder.charAt(0)) {
|
3511 |
+
var radixPosition = $.inArray(opts.radixPoint, buffer);
|
3512 |
+
if (-1 != radixPosition && isFinite(opts.digits)) {
|
3513 |
+
for (var i = 1; i <= opts.digits; i++) (void 0 == buffer[radixPosition + i] || buffer[radixPosition + i] == opts.placeholder.charAt(0)) && (buffer[radixPosition + i] = "0");
|
3514 |
+
return {
|
3515 |
+
refreshFromBuffer: {
|
3516 |
+
start: ++radixPosition,
|
3517 |
+
end: radixPosition + opts.digits
|
3518 |
+
}
|
3519 |
+
};
|
3520 |
+
}
|
3521 |
+
} else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
|
3522 |
+
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
3523 |
+
return rslt.caret = rslt.pos + 1, rslt;
|
3524 |
+
}
|
3525 |
+
},
|
3526 |
+
onKeyPress: function(e, buffer, caretPos, opts) {
|
3527 |
+
if (opts.autoGroup) {
|
3528 |
+
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
3529 |
+
return rslt.caret = rslt.pos + 1, rslt;
|
3530 |
+
}
|
3531 |
+
},
|
3532 |
+
regex: {
|
3533 |
+
integerPart: function() {
|
3534 |
+
return new RegExp("[-+]?\\d+");
|
3535 |
+
},
|
3536 |
+
integerNPart: function() {
|
3537 |
+
return new RegExp("\\d+");
|
3538 |
+
}
|
3539 |
+
},
|
3540 |
+
signHandler: function(chrs, buffer, pos, strict, opts) {
|
3541 |
+
if (!strict && (opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs)) {
|
3542 |
+
var matchRslt = buffer.join("").match(opts.regex.integerPart(opts));
|
3543 |
+
if (matchRslt && matchRslt.length > 0 && "0" !== matchRslt[matchRslt.index]) return buffer[matchRslt.index] == ("-" === chrs ? "+" : "-") ? {
|
3544 |
+
pos: matchRslt.index,
|
3545 |
+
c: chrs,
|
3546 |
+
remove: matchRslt.index,
|
3547 |
+
caret: pos
|
3548 |
+
} : buffer[matchRslt.index] == ("-" === chrs ? "-" : "+") ? {
|
3549 |
+
remove: matchRslt.index,
|
3550 |
+
caret: pos - 1
|
3551 |
+
} : {
|
3552 |
+
pos: matchRslt.index,
|
3553 |
+
c: chrs,
|
3554 |
+
caret: pos + 1
|
3555 |
+
};
|
3556 |
+
}
|
3557 |
+
return !1;
|
3558 |
+
},
|
3559 |
+
radixHandler: function(chrs, maskset, pos, strict, opts) {
|
3560 |
+
if (!strict && chrs === opts.radixPoint) {
|
3561 |
+
var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts));
|
3562 |
+
if (-1 != radixPos) return maskset.validPositions[radixPos - 1] ? {
|
3563 |
+
caret: radixPos + 1
|
3564 |
+
} : {
|
3565 |
+
pos: integerValue.index,
|
3566 |
+
c: integerValue[0],
|
3567 |
+
caret: radixPos + 1
|
3568 |
+
};
|
3569 |
+
}
|
3570 |
+
return !1;
|
3571 |
+
},
|
3572 |
+
leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
|
3573 |
+
var matchRslt = maskset.buffer.join("").match(opts.regex.integerNPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
3574 |
+
if (matchRslt && !strict && (-1 == radixPosition || matchRslt.index < radixPosition)) if (0 == matchRslt[0].indexOf("0") && pos >= opts.prefix.length) {
|
3575 |
+
if (-1 == radixPosition || radixPosition >= pos && void 0 == maskset.validPositions[radixPosition]) return maskset.buffer.splice(matchRslt.index, 1),
|
3576 |
+
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
3577 |
+
pos: pos,
|
3578 |
+
remove: matchRslt.index
|
3579 |
+
};
|
3580 |
+
if (pos > matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1),
|
3581 |
+
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
3582 |
+
pos: pos,
|
3583 |
+
remove: matchRslt.index
|
3584 |
+
};
|
3585 |
+
} else if ("0" == chrs && pos <= matchRslt.index) return !1;
|
3586 |
+
return !0;
|
3587 |
+
},
|
3588 |
+
definitions: {
|
3589 |
+
"~": {
|
3590 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3591 |
+
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3592 |
+
if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts),
|
3593 |
+
!isValid && (isValid = strict ? new RegExp("[0-9" + $.inputmask.escapeRegex.call(this, opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs),
|
3594 |
+
isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts),
|
3595 |
+
isValid === !0)))) {
|
3596 |
+
var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
3597 |
+
opts.digitsOptional === !1 && pos > radixPosition && !strict && (isValid = {
|
3598 |
+
pos: pos,
|
3599 |
+
remove: pos
|
3600 |
+
}), isValid = {
|
3601 |
+
pos: pos
|
3602 |
+
};
|
3603 |
+
}
|
3604 |
+
return isValid;
|
3605 |
+
},
|
3606 |
+
cardinality: 1,
|
3607 |
+
prevalidator: null
|
3608 |
+
},
|
3609 |
+
"+": {
|
3610 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3611 |
+
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3612 |
+
return isValid || (isValid = opts.allowMinus && "-" == chrs || opts.allowPlus && "+" == chrs),
|
3613 |
+
isValid;
|
3614 |
+
},
|
3615 |
+
cardinality: 1,
|
3616 |
+
prevalidator: null,
|
3617 |
+
placeholder: ""
|
3618 |
+
},
|
3619 |
+
":": {
|
3620 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3621 |
+
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3622 |
+
if (!isValid) {
|
3623 |
+
var radix = "[" + $.inputmask.escapeRegex.call(this, opts.radixPoint) + "]";
|
3624 |
+
isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder == opts.radixPoint && (isValid = {
|
3625 |
+
pos: pos,
|
3626 |
+
remove: pos
|
3627 |
+
});
|
3628 |
+
}
|
3629 |
+
return isValid;
|
3630 |
+
},
|
3631 |
+
cardinality: 1,
|
3632 |
+
prevalidator: null,
|
3633 |
+
placeholder: function(opts) {
|
3634 |
+
return opts.radixPoint;
|
3635 |
+
}
|
3636 |
+
}
|
3637 |
+
},
|
3638 |
+
insertMode: !0,
|
3639 |
+
autoUnmask: !1,
|
3640 |
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
3641 |
+
var processValue = maskedValue.replace(opts.prefix, "");
|
3642 |
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), "");
|
3643 |
+
},
|
3644 |
+
isComplete: function(buffer, opts) {
|
3645 |
+
var maskedValue = buffer.join(""), bufClone = buffer.slice();
|
3646 |
+
if (opts.postFormat(bufClone, 0, !0, opts), bufClone.join("") != maskedValue) return !1;
|
3647 |
+
var processValue = maskedValue.replace(opts.prefix, "");
|
3648 |
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
3649 |
+
processValue = processValue.replace($.inputmask.escapeRegex.call(this, opts.radixPoint), "."),
|
3650 |
+
isFinite(processValue);
|
3651 |
+
},
|
3652 |
+
onBeforeMask: function(initialValue, opts) {
|
3653 |
+
if (isFinite(initialValue)) return initialValue.toString().replace(".", opts.radixPoint);
|
3654 |
+
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
3655 |
+
return dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
3656 |
+
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length && (initialValue = initialValue.replace(/,/g, ""),
|
3657 |
+
initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
3658 |
+
initialValue;
|
3659 |
+
}
|
3660 |
+
},
|
3661 |
+
currency: {
|
3662 |
+
prefix: "$ ",
|
3663 |
+
groupSeparator: ",",
|
3664 |
+
radixPoint: ".",
|
3665 |
+
alias: "numeric",
|
3666 |
+
placeholder: "0",
|
3667 |
+
autoGroup: !0,
|
3668 |
+
digits: 2,
|
3669 |
+
digitsOptional: !1,
|
3670 |
+
clearMaskOnLostFocus: !1,
|
3671 |
+
decimalProtect: !0
|
3672 |
+
},
|
3673 |
+
decimal: {
|
3674 |
+
alias: "numeric"
|
3675 |
+
},
|
3676 |
+
integer: {
|
3677 |
+
alias: "numeric",
|
3678 |
+
digits: "0"
|
3679 |
+
}
|
3680 |
+
}), $.fn.inputmask;
|
3681 |
+
}(jQuery), function($) {
|
3682 |
+
return $.extend($.inputmask.defaults.aliases, {
|
3683 |
+
phone: {
|
3684 |
+
url: "phone-codes/phone-codes.js",
|
3685 |
+
maskInit: "+pp(pp)pppppppp",
|
3686 |
+
mask: function(opts) {
|
3687 |
+
opts.definitions = {
|
3688 |
+
p: {
|
3689 |
+
validator: function() {
|
3690 |
+
return !1;
|
3691 |
+
},
|
3692 |
+
cardinality: 1
|
3693 |
+
},
|
3694 |
+
"#": {
|
3695 |
+
validator: "[0-9]",
|
3696 |
+
cardinality: 1
|
3697 |
+
}
|
3698 |
+
};
|
3699 |
+
var maskList = [];
|
3700 |
+
return $.ajax({
|
3701 |
+
url: opts.url,
|
3702 |
+
async: !1,
|
3703 |
+
dataType: "json",
|
3704 |
+
success: function(response) {
|
3705 |
+
maskList = response;
|
3706 |
+
}
|
3707 |
+
}), maskList = maskList.sort(function(a, b) {
|
3708 |
+
return (a.mask || a) < (b.mask || b) ? -1 : 1;
|
3709 |
+
}), maskList.splice(0, 0, opts.maskInit), maskList;
|
3710 |
+
},
|
3711 |
+
nojumps: !0,
|
3712 |
+
nojumpsThreshold: 1
|
3713 |
+
},
|
3714 |
+
phonebe: {
|
3715 |
+
alias: "phone",
|
3716 |
+
url: "phone-codes/phone-be.js",
|
3717 |
+
maskInit: "+32(pp)pppppppp",
|
3718 |
+
nojumpsThreshold: 4
|
3719 |
+
}
|
3720 |
+
}), $.fn.inputmask;
|
3721 |
+
}(jQuery), function($) {
|
3722 |
+
return $.extend($.inputmask.defaults.aliases, {
|
3723 |
+
Regex: {
|
3724 |
+
mask: "r",
|
3725 |
+
greedy: !1,
|
3726 |
+
repeat: "*",
|
3727 |
+
regex: null,
|
3728 |
+
regexTokens: null,
|
3729 |
+
tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
|
3730 |
+
quantifierFilter: /[0-9]+[^,]/,
|
3731 |
+
isComplete: function(buffer, opts) {
|
3732 |
+
return new RegExp(opts.regex).test(buffer.join(""));
|
3733 |
+
},
|
3734 |
+
definitions: {
|
3735 |
+
r: {
|
3736 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3737 |
+
function regexToken(isGroup, isQuantifier) {
|
3738 |
+
this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
|
3739 |
+
this.quantifier = {
|
3740 |
+
min: 1,
|
3741 |
+
max: 1
|
3742 |
+
}, this.repeaterPart = void 0;
|
3743 |
+
}
|
3744 |
+
function analyseRegex() {
|
3745 |
+
var match, m, currentToken = new regexToken(), opengroups = [];
|
3746 |
+
for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0],
|
3747 |
+
m.charAt(0)) {
|
3748 |
+
case "(":
|
3749 |
+
opengroups.push(new regexToken(!0));
|
3750 |
+
break;
|
3751 |
+
|
3752 |
+
case ")":
|
3753 |
+
var groupToken = opengroups.pop();
|
3754 |
+
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
|
3755 |
+
break;
|
3756 |
+
|
3757 |
+
case "{":
|
3758 |
+
case "+":
|
3759 |
+
case "*":
|
3760 |
+
var quantifierToken = new regexToken(!1, !0);
|
3761 |
+
m = m.replace(/[{}]/g, "");
|
3762 |
+
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
3763 |
+
if (quantifierToken.quantifier = {
|
3764 |
+
min: mq0,
|
3765 |
+
max: mq1
|
3766 |
+
}, opengroups.length > 0) {
|
3767 |
+
var matches = opengroups[opengroups.length - 1].matches;
|
3768 |
+
if (match = matches.pop(), !match.isGroup) {
|
3769 |
+
var groupToken = new regexToken(!0);
|
3770 |
+
groupToken.matches.push(match), match = groupToken;
|
3771 |
+
}
|
3772 |
+
matches.push(match), matches.push(quantifierToken);
|
3773 |
+
} else {
|
3774 |
+
if (match = currentToken.matches.pop(), !match.isGroup) {
|
3775 |
+
var groupToken = new regexToken(!0);
|
3776 |
+
groupToken.matches.push(match), match = groupToken;
|
3777 |
+
}
|
3778 |
+
currentToken.matches.push(match), currentToken.matches.push(quantifierToken);
|
3779 |
+
}
|
3780 |
+
break;
|
3781 |
+
|
3782 |
+
default:
|
3783 |
+
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
|
3784 |
+
}
|
3785 |
+
currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
|
3786 |
+
}
|
3787 |
+
function validateRegexToken(token, fromGroup) {
|
3788 |
+
var isvalid = !1;
|
3789 |
+
fromGroup && (regexPart += "(", openGroupCount++);
|
3790 |
+
for (var mndx = 0; mndx < token.matches.length; mndx++) {
|
3791 |
+
var matchToken = token.matches[mndx];
|
3792 |
+
if (1 == matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (1 == matchToken.isQuantifier) {
|
3793 |
+
var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
|
3794 |
+
if (isNaN(matchToken.quantifier.max)) {
|
3795 |
+
for (;matchToken.repeaterPart && matchToken.repeaterPart != regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
|
3796 |
+
isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart),
|
3797 |
+
regexPart = regexPartBak + matchToken.quantifier.max;
|
3798 |
+
} else {
|
3799 |
+
for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
|
3800 |
+
regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
|
3801 |
+
}
|
3802 |
+
} else if (void 0 != matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
|
3803 |
+
var testExp;
|
3804 |
+
if ("[" == matchToken.charAt(0)) {
|
3805 |
+
testExp = regexPart, testExp += matchToken;
|
3806 |
+
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
3807 |
+
var exp = new RegExp("^(" + testExp + ")$");
|
3808 |
+
isvalid = exp.test(bufferStr);
|
3809 |
+
} else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" != matchToken.charAt(l)) {
|
3810 |
+
testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
|
3811 |
+
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
3812 |
+
var exp = new RegExp("^(" + testExp + ")$");
|
3813 |
+
if (isvalid = exp.test(bufferStr)) break;
|
3814 |
+
}
|
3815 |
+
regexPart += matchToken;
|
3816 |
+
}
|
3817 |
+
if (isvalid) break;
|
3818 |
+
}
|
3819 |
+
return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
|
3820 |
+
}
|
3821 |
+
null == opts.regexTokens && analyseRegex();
|
3822 |
+
var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
|
3823 |
+
cbuffer.splice(pos, 0, chrs);
|
3824 |
+
for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
|
3825 |
+
var regexToken = opts.regexTokens[i];
|
3826 |
+
if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
|
3827 |
+
}
|
3828 |
+
return isValid;
|
3829 |
+
},
|
3830 |
+
cardinality: 1
|
3831 |
+
}
|
3832 |
+
}
|
3833 |
+
}
|
3834 |
+
}), $.fn.inputmask;
|
3835 |
+
}(jQuery);
|
3836 |
+
|
3837 |
+
jQuery(document).ready(function($){
|
3838 |
+
jQuery(document).on('cf.add', function(){
|
3839 |
+
$("[data-inputmask]").inputmask();
|
3840 |
+
});
|
3841 |
+
jQuery(document).trigger('cf.add');
|
3842 |
+
});
|
3843 |
+
|
3844 |
+
|
3845 |
+
/*! rangeslider.js - v0.3.1 | (c) 2014 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
|
3846 |
+
'use strict';
|
3847 |
+
|
3848 |
+
(function(factory) {
|
3849 |
+
if (typeof define === 'function' && define.amd) {
|
3850 |
+
// AMD. Register as an anonymous module.
|
3851 |
+
define(['jquery'], factory);
|
3852 |
+
}
|
3853 |
+
else if (typeof exports === 'object') {
|
3854 |
+
// CommonJS
|
3855 |
+
factory(require('jquery'));
|
3856 |
+
} else {
|
3857 |
+
// Browser globals
|
3858 |
+
factory(jQuery);
|
3859 |
+
}
|
3860 |
+
}(function($) {
|
3861 |
+
|
3862 |
+
/**
|
3863 |
+
* Range feature detection
|
3864 |
+
* @return {Boolean}
|
3865 |
+
*/
|
3866 |
+
function supportsRange() {
|
3867 |
+
var input = document.createElement('input');
|
3868 |
+
input.setAttribute('type', 'range');
|
3869 |
+
return input.type !== 'text';
|
3870 |
+
}
|
3871 |
+
|
3872 |
+
var pluginName = 'rangeslider',
|
3873 |
+
pluginInstances = [],
|
3874 |
+
inputrange = supportsRange(),
|
3875 |
+
defaults = {
|
3876 |
+
polyfill: true,
|
3877 |
+
rangeClass: 'rangeslider',
|
3878 |
+
disabledClass: 'rangeslider--disabled',
|
3879 |
+
fillClass: 'rangeslider__fill',
|
3880 |
+
handleClass: 'rangeslider__handle',
|
3881 |
+
startEvent: ['mousedown', 'touchstart', 'pointerdown'],
|
3882 |
+
moveEvent: ['mousemove', 'touchmove', 'pointermove'],
|
3883 |
+
endEvent: ['mouseup', 'touchend', 'pointerup']
|
3884 |
+
};
|
3885 |
+
|
3886 |
+
/**
|
3887 |
+
* Delays a function for the given number of milliseconds, and then calls
|
3888 |
+
* it with the arguments supplied.
|
3889 |
+
*
|
3890 |
+
* @param {Function} fn [description]
|
3891 |
+
* @param {Number} wait [description]
|
3892 |
+
* @return {Function}
|
3893 |
+
*/
|
3894 |
+
function delay(fn, wait) {
|
3895 |
+
var args = Array.prototype.slice.call(arguments, 2);
|
3896 |
+
return setTimeout(function(){ return fn.apply(null, args); }, wait);
|
3897 |
+
}
|
3898 |
+
|
3899 |
+
/**
|
3900 |
+
* Returns a debounced function that will make sure the given
|
3901 |
+
* function is not triggered too much.
|
3902 |
+
*
|
3903 |
+
* @param {Function} fn Function to debounce.
|
3904 |
+
* @param {Number} debounceDuration OPTIONAL. The amount of time in milliseconds for which we will debounce the function. (defaults to 100ms)
|
3905 |
+
* @return {Function}
|
3906 |
+
*/
|
3907 |
+
function debounce(fn, debounceDuration) {
|
3908 |
+
debounceDuration = debounceDuration || 100;
|
3909 |
+
return function() {
|
3910 |
+
if (!fn.debouncing) {
|
3911 |
+
var args = Array.prototype.slice.apply(arguments);
|
3912 |
+
fn.lastReturnVal = fn.apply(window, args);
|
3913 |
+
fn.debouncing = true;
|
3914 |
+
}
|
3915 |
+
clearTimeout(fn.debounceTimeout);
|
3916 |
+
fn.debounceTimeout = setTimeout(function(){
|
3917 |
+
fn.debouncing = false;
|
3918 |
+
}, debounceDuration);
|
3919 |
+
return fn.lastReturnVal;
|
3920 |
+
};
|
3921 |
+
}
|
3922 |
+
|
3923 |
+
/**
|
3924 |
+
* Plugin
|
3925 |
+
* @param {String} element
|
3926 |
+
* @param {Object} options
|
3927 |
+
*/
|
3928 |
+
function Plugin(element, options) {
|
3929 |
+
this.$window = $(window);
|
3930 |
+
this.$document = $(document);
|
3931 |
+
this.$element = $(element);
|
3932 |
+
this.options = $.extend( {}, defaults, options );
|
3933 |
+
this._defaults = defaults;
|
3934 |
+
this._name = pluginName;
|
3935 |
+
this.startEvent = this.options.startEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3936 |
+
this.moveEvent = this.options.moveEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3937 |
+
this.endEvent = this.options.endEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3938 |
+
this.polyfill = this.options.polyfill;
|
3939 |
+
this.onInit = this.options.onInit;
|
3940 |
+
this.onSlide = this.options.onSlide;
|
3941 |
+
this.onSlideEnd = this.options.onSlideEnd;
|
3942 |
+
|
3943 |
+
// Plugin should only be used as a polyfill
|
3944 |
+
if (this.polyfill) {
|
3945 |
+
// Input range support?
|
3946 |
+
if (inputrange) { return false; }
|
3947 |
+
}
|
3948 |
+
|
3949 |
+
this.identifier = 'js-' + pluginName + '-' +(+new Date());
|
3950 |
+
this.min = parseFloat(this.$element[0].getAttribute('min') || 0);
|
3951 |
+
this.max = parseFloat(this.$element[0].getAttribute('max') || 100);
|
3952 |
+
this.value = parseFloat(this.$element[0].value || this.min + (this.max-this.min)/2);
|
3953 |
+
this.step = parseFloat(this.$element[0].getAttribute('step') || 1);
|
3954 |
+
this.$fill = $('<div class="' + this.options.fillClass + '" />');
|
3955 |
+
this.$handle = $('<div class="' + this.options.handleClass + '" />');
|
3956 |
+
this.$range = $('<div class="' + this.options.rangeClass + '" id="' + this.identifier + '" />').insertAfter(this.$element).prepend(this.$fill, this.$handle);
|
3957 |
+
|
3958 |
+
// visually hide the input
|
3959 |
+
this.$element.css({
|
3960 |
+
'position': 'absolute',
|
3961 |
+
'width': '1px',
|
3962 |
+
'height': '1px',
|
3963 |
+
'overflow': 'hidden',
|
3964 |
+
'opacity': '0'
|
3965 |
+
});
|
3966 |
+
|
3967 |
+
// Store context
|
3968 |
+
this.handleDown = $.proxy(this.handleDown, this);
|
3969 |
+
this.handleMove = $.proxy(this.handleMove, this);
|
3970 |
+
this.handleEnd = $.proxy(this.handleEnd, this);
|
3971 |
+
|
3972 |
+
this.init();
|
3973 |
+
|
3974 |
+
// Attach Events
|
3975 |
+
var _this = this;
|
3976 |
+
this.$window.on('resize' + '.' + pluginName, debounce(function() {
|
3977 |
+
// Simulate resizeEnd event.
|
3978 |
+
delay(function() { _this.update(); }, 300);
|
3979 |
+
}, 20));
|
3980 |
+
|
3981 |
+
this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown);
|
3982 |
+
|
3983 |
+
// Listen to programmatic value changes
|
3984 |
+
this.$element.on('change' + '.' + pluginName, function(e, data) {
|
3985 |
+
if (data && data.origin === pluginName) {
|
3986 |
+
return;
|
3987 |
+
}
|
3988 |
+
|
3989 |
+
var value = e.target.value,
|
3990 |
+
pos = _this.getPositionFromValue(value);
|
3991 |
+
_this.setPosition(pos);
|
3992 |
+
});
|
3993 |
+
}
|
3994 |
+
|
3995 |
+
Plugin.prototype.init = function() {
|
3996 |
+
if (this.onInit && typeof this.onInit === 'function') {
|
3997 |
+
this.onInit();
|
3998 |
+
}
|
3999 |
+
this.update();
|
4000 |
+
};
|
4001 |
+
|
4002 |
+
Plugin.prototype.update = function() {
|
4003 |
+
this.handleWidth = this.$handle[0].offsetWidth;
|
4004 |
+
this.rangeWidth = this.$range[0].offsetWidth;
|
4005 |
+
this.maxHandleX = this.rangeWidth - this.handleWidth;
|
4006 |
+
this.grabX = this.handleWidth / 2;
|
4007 |
+
this.position = this.getPositionFromValue(this.value);
|
4008 |
+
|
4009 |
+
// Consider disabled state
|
4010 |
+
if (this.$element[0].disabled) {
|
4011 |
+
this.$range.addClass(this.options.disabledClass);
|
4012 |
+
} else {
|
4013 |
+
this.$range.removeClass(this.options.disabledClass);
|
4014 |
+
}
|
4015 |
+
|
4016 |
+
this.setPosition(this.position);
|
4017 |
+
};
|
4018 |
+
|
4019 |
+
Plugin.prototype.handleDown = function(e) {
|
4020 |
+
e.preventDefault();
|
4021 |
+
this.$document.on(this.moveEvent, this.handleMove);
|
4022 |
+
this.$document.on(this.endEvent, this.handleEnd);
|
4023 |
+
|
4024 |
+
// If we click on the handle don't set the new position
|
4025 |
+
if ((' ' + e.target.className + ' ').replace(/[\n\t]/g, ' ').indexOf(this.options.handleClass) > -1) {
|
4026 |
+
return;
|
4027 |
+
}
|
4028 |
+
|
4029 |
+
var posX = this.getRelativePosition(this.$range[0], e),
|
4030 |
+
handleX = this.getPositionFromNode(this.$handle[0]) - this.getPositionFromNode(this.$range[0]);
|
4031 |
+
|
4032 |
+
this.setPosition(posX - this.grabX);
|
4033 |
+
|
4034 |
+
if (posX >= handleX && posX < handleX + this.handleWidth) {
|
4035 |
+
this.grabX = posX - handleX;
|
4036 |
+
}
|
4037 |
+
};
|
4038 |
+
|
4039 |
+
Plugin.prototype.handleMove = function(e) {
|
4040 |
+
e.preventDefault();
|
4041 |
+
var posX = this.getRelativePosition(this.$range[0], e);
|
4042 |
+
this.setPosition(posX - this.grabX);
|
4043 |
+
};
|
4044 |
+
|
4045 |
+
Plugin.prototype.handleEnd = function(e) {
|
4046 |
+
e.preventDefault();
|
4047 |
+
this.$document.off(this.moveEvent, this.handleMove);
|
4048 |
+
this.$document.off(this.endEvent, this.handleEnd);
|
4049 |
+
|
4050 |
+
var posX = this.getRelativePosition(this.$range[0], e);
|
4051 |
+
if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
|
4052 |
+
this.onSlideEnd(posX - this.grabX, this.value);
|
4053 |
+
}
|
4054 |
+
};
|
4055 |
+
|
4056 |
+
Plugin.prototype.cap = function(pos, min, max) {
|
4057 |
+
if (pos < min) { return min; }
|
4058 |
+
if (pos > max) { return max; }
|
4059 |
+
return pos;
|
4060 |
+
};
|
4061 |
+
|
4062 |
+
Plugin.prototype.setPosition = function(pos) {
|
4063 |
+
var value, left;
|
4064 |
|
4065 |
+
// Snapping steps
|
4066 |
+
value = (this.getValueFromPosition(this.cap(pos, 0, this.maxHandleX)) / this.step) * this.step;
|
4067 |
+
left = this.getPositionFromValue(value);
|
4068 |
|
4069 |
+
// Update ui
|
4070 |
+
this.$fill[0].style.width = (left + this.grabX) + 'px';
|
4071 |
+
this.$handle[0].style.left = left + 'px';
|
4072 |
+
this.setValue(value);
|
4073 |
|
4074 |
+
// Update globals
|
4075 |
+
this.position = left;
|
4076 |
+
this.value = value;
|
4077 |
|
4078 |
+
if (this.onSlide && typeof this.onSlide === 'function') {
|
4079 |
+
this.onSlide(left, value);
|
4080 |
+
}
|
4081 |
+
};
|
4082 |
+
|
4083 |
+
Plugin.prototype.getPositionFromNode = function(node) {
|
4084 |
+
var i = 0;
|
4085 |
+
while (node !== null) {
|
4086 |
+
i += node.offsetLeft;
|
4087 |
+
node = node.offsetParent;
|
4088 |
+
}
|
4089 |
+
return i;
|
4090 |
+
};
|
4091 |
|
4092 |
+
Plugin.prototype.getRelativePosition = function(node, e) {
|
4093 |
+
return (e.pageX || e.originalEvent.clientX || e.originalEvent.touches[0].clientX || e.currentPoint.x) - this.getPositionFromNode(node);
|
4094 |
+
};
|
|
|
|
|
4095 |
|
4096 |
+
Plugin.prototype.getPositionFromValue = function(value) {
|
4097 |
+
var percentage, pos;
|
4098 |
+
percentage = (value - this.min)/(this.max - this.min);
|
4099 |
+
pos = percentage * this.maxHandleX;
|
4100 |
+
return pos;
|
4101 |
+
};
|
4102 |
|
4103 |
+
Plugin.prototype.getValueFromPosition = function(pos) {
|
4104 |
+
var percentage, value;
|
4105 |
+
percentage = ((pos) / (this.maxHandleX || 1));
|
4106 |
+
value = this.step * Math.ceil((((percentage) * (this.max - this.min)) + this.min) / this.step);
|
4107 |
+
return Number((value).toFixed(2));
|
4108 |
+
};
|
4109 |
|
4110 |
+
Plugin.prototype.setValue = function(value) {
|
4111 |
+
if (value !== this.value) {
|
4112 |
+
this.$element.val(value).trigger('change', {origin: pluginName});
|
4113 |
+
}
|
4114 |
+
};
|
4115 |
|
4116 |
+
Plugin.prototype.destroy = function() {
|
4117 |
+
this.$document.off(this.startEvent, '#' + this.identifier, this.handleDown);
|
4118 |
+
this.$element
|
4119 |
+
.off('.' + pluginName)
|
4120 |
+
.removeAttr('style')
|
4121 |
+
.removeData('plugin_' + pluginName);
|
4122 |
|
4123 |
+
// Remove the generated markup
|
4124 |
+
if (this.$range && this.$range.length) {
|
4125 |
+
this.$range[0].parentNode.removeChild(this.$range[0]);
|
4126 |
+
}
|
4127 |
|
4128 |
+
// Remove global events if there isn't any instance anymore.
|
4129 |
+
pluginInstances.splice(pluginInstances.indexOf(this.$element[0]),1);
|
4130 |
+
if (!pluginInstances.length) {
|
4131 |
+
this.$window.off('.' + pluginName);
|
4132 |
+
}
|
4133 |
+
};
|
4134 |
+
|
4135 |
+
// A really lightweight plugin wrapper around the constructor,
|
4136 |
+
// preventing against multiple instantiations
|
4137 |
+
$.fn[pluginName] = function(options) {
|
4138 |
+
return this.each(function() {
|
4139 |
+
var $this = $(this),
|
4140 |
+
data = $this.data('plugin_' + pluginName);
|
4141 |
+
|
4142 |
+
// Create a new instance.
|
4143 |
+
if (!data) {
|
4144 |
+
$this.data('plugin_' + pluginName, (data = new Plugin(this, options)));
|
4145 |
+
pluginInstances.push(this);
|
4146 |
+
}
|
4147 |
+
|
4148 |
+
// Make it possible to access methods from public.
|
4149 |
+
// e.g `$element.rangeslider('method');`
|
4150 |
+
if (typeof options === 'string') {
|
4151 |
+
data[options]();
|
4152 |
+
}
|
4153 |
+
});
|
4154 |
+
};
|
4155 |
+
|
4156 |
+
}));
|
4157 |
+
|
4158 |
+
/*!
|
4159 |
+
* jQuery Raty - A Star Rating Plugin
|
4160 |
+
*
|
4161 |
+
* The MIT License
|
4162 |
+
*
|
4163 |
+
* @author : Washington Botelho
|
4164 |
+
* @doc : http://wbotelhos.com/raty
|
4165 |
+
* @version : 2.6.0
|
4166 |
+
*
|
4167 |
+
*/
|
4168 |
+
|
4169 |
+
;(function($) {
|
4170 |
+
'use strict';
|
4171 |
+
|
4172 |
+
var methods = {
|
4173 |
+
init: function(options) {
|
4174 |
+
return this.each(function() {
|
4175 |
+
this.self = $(this);
|
4176 |
+
|
4177 |
+
methods.destroy.call(this.self);
|
4178 |
+
|
4179 |
+
this.opt = $.extend(true, {}, $.fn.raty.defaults, options);
|
4180 |
+
|
4181 |
+
methods._adjustCallback.call(this);
|
4182 |
+
|
4183 |
+
methods._adjustNumber.call(this);
|
4184 |
+
|
4185 |
+
if (this.opt.starType !== 'img') {
|
4186 |
+
methods._adjustStarType.call(this);
|
4187 |
+
}
|
4188 |
+
|
4189 |
+
methods._adjustPath.call(this);
|
4190 |
+
methods._createStars.call(this);
|
4191 |
+
|
4192 |
+
if (this.opt.cancel) {
|
4193 |
+
methods._createCancel.call(this);
|
4194 |
+
}
|
4195 |
+
|
4196 |
+
if (this.opt.precision) {
|
4197 |
+
methods._adjustPrecision.call(this);
|
4198 |
+
}
|
4199 |
+
|
4200 |
+
methods._createScore.call(this);
|
4201 |
+
methods._apply.call(this, this.opt.score);
|
4202 |
+
methods._target.call(this, this.opt.score);
|
4203 |
+
|
4204 |
+
if (this.opt.readOnly) {
|
4205 |
+
methods._lock.call(this);
|
4206 |
+
} else {
|
4207 |
+
this.style.cursor = 'pointer';
|
4208 |
+
|
4209 |
+
methods._binds.call(this);
|
4210 |
+
}
|
4211 |
+
|
4212 |
+
this.self.data('options', this.opt);
|
4213 |
+
});
|
4214 |
+
},
|
4215 |
+
|
4216 |
+
_adjustCallback: function() {
|
4217 |
+
var options = ['number', 'readOnly', 'score', 'scoreName'];
|
4218 |
+
|
4219 |
+
for (var i = 0; i < options.length; i++) {
|
4220 |
+
if (typeof this.opt[options[i]] === 'function') {
|
4221 |
+
this.opt[options[i]] = this.opt[options[i]].call(this);
|
4222 |
+
}
|
4223 |
+
}
|
4224 |
+
},
|
4225 |
+
|
4226 |
+
_adjustNumber: function() {
|
4227 |
+
this.opt.number = methods._between(this.opt.number, 1, this.opt.numberMax);
|
4228 |
+
},
|
4229 |
+
|
4230 |
+
_adjustPath: function() {
|
4231 |
+
this.opt.path = this.opt.path || '';
|
4232 |
+
|
4233 |
+
if (this.opt.path && this.opt.path.charAt(this.opt.path.length - 1) !== '/') {
|
4234 |
+
this.opt.path += '/';
|
4235 |
+
}
|
4236 |
+
},
|
4237 |
+
|
4238 |
+
_adjustPrecision: function() {
|
4239 |
+
this.opt.half = true;
|
4240 |
+
this.opt.targetType = 'score';
|
4241 |
+
},
|
4242 |
+
|
4243 |
+
_adjustStarType: function() {
|
4244 |
+
this.opt.path = '';
|
4245 |
+
|
4246 |
+
var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn'];
|
4247 |
+
|
4248 |
+
for (var i = 0; i < replaces.length; i++) {
|
4249 |
+
this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
|
4250 |
+
}
|
4251 |
+
},
|
4252 |
+
|
4253 |
+
_apply: function(score) {
|
4254 |
+
methods._fill.call(this, score);
|
4255 |
+
|
4256 |
+
if (score) {
|
4257 |
+
if (score > 0) {
|
4258 |
+
this.score.val(methods._between(score, 0, this.opt.number));
|
4259 |
+
}
|
4260 |
+
|
4261 |
+
methods._roundStars.call(this, score);
|
4262 |
+
}
|
4263 |
+
},
|
4264 |
+
|
4265 |
+
_between: function(value, min, max) {
|
4266 |
+
return Math.min(Math.max(parseFloat(value), min), max);
|
4267 |
+
},
|
4268 |
+
|
4269 |
+
_binds: function() {
|
4270 |
+
if (this.cancel) {
|
4271 |
+
methods._bindOverCancel.call(this);
|
4272 |
+
methods._bindClickCancel.call(this);
|
4273 |
+
methods._bindOutCancel.call(this);
|
4274 |
+
}
|
4275 |
+
|
4276 |
+
methods._bindOver.call(this);
|
4277 |
+
methods._bindClick.call(this);
|
4278 |
+
methods._bindOut.call(this);
|
4279 |
+
},
|
4280 |
+
|
4281 |
+
_bindClick: function() {
|
4282 |
+
var that = this;
|
4283 |
+
|
4284 |
+
that.stars.on('click.raty', function(evt) {
|
4285 |
+
var star = $(this);
|
4286 |
+
|
4287 |
+
that.score.val((that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || star.data('alt')));
|
4288 |
+
|
4289 |
+
if (that.opt.click) {
|
4290 |
+
that.opt.click.call(that, +that.score.val(), evt);
|
4291 |
+
}
|
4292 |
+
});
|
4293 |
+
},
|
4294 |
+
|
4295 |
+
_bindClickCancel: function() {
|
4296 |
+
var that = this;
|
4297 |
+
|
4298 |
+
that.cancel.on('click.raty', function(evt) {
|
4299 |
+
that.score.removeAttr('value');
|
4300 |
+
|
4301 |
+
if (that.opt.click) {
|
4302 |
+
that.opt.click.call(that, null, evt);
|
4303 |
+
}
|
4304 |
+
});
|
4305 |
+
},
|
4306 |
+
|
4307 |
+
_bindOut: function() {
|
4308 |
+
var that = this;
|
4309 |
+
|
4310 |
+
that.self.on('mouseleave.raty', function(evt) {
|
4311 |
+
var score = +that.score.val() || undefined;
|
4312 |
+
|
4313 |
+
methods._apply.call(that, score);
|
4314 |
+
methods._target.call(that, score, evt);
|
4315 |
+
|
4316 |
+
if (that.opt.mouseout) {
|
4317 |
+
that.opt.mouseout.call(that, score, evt);
|
4318 |
+
}
|
4319 |
+
});
|
4320 |
+
},
|
4321 |
+
|
4322 |
+
_bindOutCancel: function() {
|
4323 |
+
var that = this;
|
4324 |
+
|
4325 |
+
that.cancel.on('mouseleave.raty', function(evt) {
|
4326 |
+
var
|
4327 |
+
cancel = $(this),
|
4328 |
+
cancelOff = that.opt.path + that.opt.cancelOff;
|
4329 |
+
|
4330 |
+
if (that.opt.starType === 'img') {
|
4331 |
+
cancel.attr('src', cancelOff);
|
4332 |
+
} else {
|
4333 |
+
var cancelOn = that.opt.path + that.opt.cancelOn;
|
4334 |
+
|
4335 |
+
cancel.removeClass(cancelOn).addClass(cancelOff);
|
4336 |
+
}
|
4337 |
+
|
4338 |
+
if (that.opt.mouseout) {
|
4339 |
+
var score = +that.score.val() || undefined;
|
4340 |
+
|
4341 |
+
that.opt.mouseout.call(that, score, evt);
|
4342 |
+
}
|
4343 |
+
});
|
4344 |
+
},
|
4345 |
+
|
4346 |
+
_bindOver: function() {
|
4347 |
+
var that = this,
|
4348 |
+
action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty';
|
4349 |
+
|
4350 |
+
that.stars.on(action, function(evt) {
|
4351 |
+
var score = methods._getScoreByPosition.call(that, evt, this);
|
4352 |
+
|
4353 |
+
methods._fill.call(that, score);
|
4354 |
+
|
4355 |
+
if (that.opt.half) {
|
4356 |
+
methods._roundStars.call(that, score);
|
4357 |
+
|
4358 |
+
that.self.data('score', score);
|
4359 |
+
}
|
4360 |
+
|
4361 |
+
methods._target.call(that, score, evt);
|
4362 |
+
|
4363 |
+
if (that.opt.mouseover) {
|
4364 |
+
that.opt.mouseover.call(that, score, evt);
|
4365 |
+
}
|
4366 |
+
});
|
4367 |
+
},
|
4368 |
+
|
4369 |
+
_bindOverCancel: function() {
|
4370 |
+
var that = this;
|
4371 |
+
|
4372 |
+
that.cancel.on('mouseover.raty', function(evt) {
|
4373 |
+
var
|
4374 |
+
cancelOn = that.opt.path + that.opt.cancelOn,
|
4375 |
+
star = $(this),
|
4376 |
+
starOff = that.opt.path + that.opt.starOff;
|
4377 |
+
|
4378 |
+
if (that.opt.starType === 'img') {
|
4379 |
+
star.attr('src', cancelOn);
|
4380 |
+
that.stars.attr('src', starOff);
|
4381 |
+
} else {
|
4382 |
+
that.stars.attr('class', starOff);
|
4383 |
+
|
4384 |
+
var cancelOff = that.opt.path + that.opt.cancelOff;
|
4385 |
+
|
4386 |
+
star.removeClass(cancelOff).addClass(cancelOn).css('color', that.opt.starColor);
|
4387 |
+
}
|
4388 |
+
|
4389 |
+
methods._target.call(that, null, evt);
|
4390 |
+
|
4391 |
+
if (that.opt.mouseover) {
|
4392 |
+
that.opt.mouseover.call(that, null);
|
4393 |
+
}
|
4394 |
+
});
|
4395 |
+
},
|
4396 |
+
|
4397 |
+
_buildScoreField: function() {
|
4398 |
+
return $('<input />', { name: this.opt.scoreName, type: 'hidden' }).appendTo(this);
|
4399 |
+
},
|
4400 |
+
|
4401 |
+
_createCancel: function() {
|
4402 |
+
var icon = this.opt.path + this.opt.cancelOff,
|
4403 |
+
cancel = $('<' + this.opt.starType + ' />', { title: this.opt.cancelHint, 'class': 'raty-cancel' }).css('marginRight', this.opt.space ? this.opt.spaceWidth + 'px' : '0');
|
4404 |
+
|
4405 |
+
if (this.opt.starType === 'img') {
|
4406 |
+
cancel.attr({ src: icon, alt: 'x' });
|
4407 |
+
} else {
|
4408 |
+
// TODO: use $.data
|
4409 |
+
cancel.attr('data-alt', 'x').addClass(icon);
|
4410 |
+
}
|
4411 |
+
|
4412 |
+
if (this.opt.cancelPlace === 'left') {
|
4413 |
+
this.self.prepend(' ').prepend(cancel);
|
4414 |
+
} else {
|
4415 |
+
this.self.append(' ').append(cancel);
|
4416 |
+
}
|
4417 |
+
|
4418 |
+
this.cancel = cancel;
|
4419 |
+
},
|
4420 |
+
|
4421 |
+
_createScore: function() {
|
4422 |
+
var score = $(this.opt.targetScore);
|
4423 |
+
|
4424 |
+
this.score = score.length ? score : methods._buildScoreField.call(this);
|
4425 |
+
},
|
4426 |
+
|
4427 |
+
_createStars: function() {
|
4428 |
+
for (var i = 1; i <= this.opt.number; i++) {
|
4429 |
+
var
|
4430 |
+
attrs ,
|
4431 |
+
icon = (this.opt.score && this.opt.score >= i) ? 'starOn' : 'starOff',
|
4432 |
+
title = methods._getHint.call(this, i);
|
4433 |
+
|
4434 |
+
// TODO: extract as icon: && alt:
|
4435 |
+
icon = this.opt.path + this.opt[icon];
|
4436 |
+
|
4437 |
+
if (this.opt.starType !== 'img') {
|
4438 |
+
// TODO: use $.data.
|
4439 |
+
attrs = { 'data-alt': i, 'class': icon };
|
4440 |
+
} else {
|
4441 |
+
attrs = { src: icon, alt: i };
|
4442 |
+
}
|
4443 |
+
|
4444 |
+
attrs.title = title;
|
4445 |
+
|
4446 |
+
$('<' + this.opt.starType + ' />', attrs).css('marginRight', i < this.opt.number && this.opt.space ? this.opt.spaceWidth + 'px' : '0').appendTo(this);
|
4447 |
+
|
4448 |
+
if (this.opt.space) {
|
4449 |
+
// this.self.append(i < this.opt.number ? ' ' : '');
|
4450 |
+
}
|
4451 |
+
}
|
4452 |
+
|
4453 |
+
this.stars = this.self.children(this.opt.starType);
|
4454 |
+
},
|
4455 |
+
|
4456 |
+
_error: function(message) {
|
4457 |
+
$(this).text(message);
|
4458 |
+
|
4459 |
+
$.error(message);
|
4460 |
+
},
|
4461 |
+
|
4462 |
+
_fill: function(score) {
|
4463 |
+
var hash = 0;
|
4464 |
+
|
4465 |
+
for (var i = 1; i <= this.stars.length; i++) {
|
4466 |
+
var
|
4467 |
+
icon,
|
4468 |
+
star = this.stars.eq(i - 1),
|
4469 |
+
turnOn = methods._turnOn.call(this, i, score);
|
4470 |
+
|
4471 |
+
if (this.opt.iconRange && this.opt.iconRange.length > hash) {
|
4472 |
+
var irange = this.opt.iconRange[hash];
|
4473 |
+
|
4474 |
+
icon = methods._getIconRange.call(this, irange, turnOn);
|
4475 |
+
|
4476 |
+
if (i <= irange.range) {
|
4477 |
+
// TODO: extract.
|
4478 |
+
if (this.opt.starType === 'img') {
|
4479 |
+
star.attr('src', icon);
|
4480 |
+
} else {
|
4481 |
+
star.attr('class', icon);
|
4482 |
+
}
|
4483 |
+
}
|
4484 |
+
|
4485 |
+
if (i === irange.range) {
|
4486 |
+
hash++;
|
4487 |
+
}
|
4488 |
+
} else {
|
4489 |
+
icon = this.opt.path + this.opt[turnOn ? 'starOn' : 'starOff'];
|
4490 |
+
// TODO: extract.
|
4491 |
+
if (this.opt.starType === 'img') {
|
4492 |
+
star.attr('src', icon);
|
4493 |
+
} else {
|
4494 |
+
star.attr('class', icon);
|
4495 |
+
}
|
4496 |
+
// Set Color
|
4497 |
+
if (turnOn) {
|
4498 |
+
star.css('color', this.opt.starColor);
|
4499 |
+
}else{
|
4500 |
+
star.css('color', '');
|
4501 |
+
}
|
4502 |
+
}
|
4503 |
+
}
|
4504 |
+
},
|
4505 |
+
|
4506 |
+
_getIconRange: function(irange, turnOn) {
|
4507 |
+
return this.opt.path + (turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff);
|
4508 |
+
},
|
4509 |
+
|
4510 |
+
_getScoreByPosition: function(evt, icon) {
|
4511 |
+
var
|
4512 |
+
star = $(icon),
|
4513 |
+
score = parseInt(icon.alt || star.data('alt'), 10);
|
4514 |
+
|
4515 |
+
if (this.opt.half) {
|
4516 |
+
var
|
4517 |
+
size = methods._getSize.call(this),
|
4518 |
+
percent = parseFloat((evt.pageX - star.offset().left) / size);
|
4519 |
+
|
4520 |
+
if (this.opt.precision) {
|
4521 |
+
score = score - 1 + percent;
|
4522 |
+
} else {
|
4523 |
+
score = score - 1 + (percent > 0.5 ? 1 : 0.5);
|
4524 |
+
}
|
4525 |
+
}
|
4526 |
+
|
4527 |
+
|
4528 |
+
return score;
|
4529 |
+
},
|
4530 |
+
|
4531 |
+
_getSize: function() {
|
4532 |
+
var size;
|
4533 |
+
|
4534 |
+
if (this.opt.starType === 'img') {
|
4535 |
+
size = this.stars[0].width;
|
4536 |
+
} else {
|
4537 |
+
size = parseFloat(this.stars.eq(0).css('font-size'));
|
4538 |
+
}
|
4539 |
+
|
4540 |
+
if (!size) {
|
4541 |
+
methods._error.call(this, 'Could not be possible get the icon size!');
|
4542 |
+
}
|
4543 |
+
|
4544 |
+
return size;
|
4545 |
+
},
|
4546 |
+
|
4547 |
+
_turnOn: function(i, score) {
|
4548 |
+
return this.opt.single ? (i === score) : (i <= score);
|
4549 |
+
},
|
4550 |
+
|
4551 |
+
_getHint: function(score) {
|
4552 |
+
var hint = this.opt.hints[score - 1];
|
4553 |
+
|
4554 |
+
return hint === '' ? '' : hint || score;
|
4555 |
+
},
|
4556 |
+
|
4557 |
+
_lock: function() {
|
4558 |
+
var score = parseInt(this.score.val(), 10), // TODO: 3.1 >> [['1'], ['2'], ['3', '.1', '.2']]
|
4559 |
+
hint = score ? methods._getHint.call(this, score) : this.opt.noRatedMsg;
|
4560 |
+
|
4561 |
+
this.style.cursor = '';
|
4562 |
+
this.title = hint;
|
4563 |
+
|
4564 |
+
this.score.prop('readonly', true);
|
4565 |
+
this.stars.prop('title', hint);
|
4566 |
+
|
4567 |
+
if (this.cancel) {
|
4568 |
+
this.cancel.hide();
|
4569 |
+
}
|
4570 |
+
|
4571 |
+
this.self.data('readonly', true);
|
4572 |
+
},
|
4573 |
+
|
4574 |
+
_roundStars: function(score) {
|
4575 |
+
var rest = (score % 1).toFixed(2);
|
4576 |
+
|
4577 |
+
if (rest > this.opt.round.down) { // Up: [x.76 .. x.99]
|
4578 |
+
var icon = 'starOn';
|
4579 |
+
|
4580 |
+
if (this.opt.halfShow && rest < this.opt.round.up) { // Half: [x.26 .. x.75]
|
4581 |
+
icon = 'starHalf';
|
4582 |
+
} else if (rest < this.opt.round.full) { // Down: [x.00 .. x.5]
|
4583 |
+
icon = 'starOff';
|
4584 |
+
}
|
4585 |
+
|
4586 |
+
var star = this.stars[Math.ceil(score) - 1];
|
4587 |
+
|
4588 |
+
if (this.opt.starType === 'img') {
|
4589 |
+
star.src = this.opt.path + this.opt[icon];
|
4590 |
+
} else {
|
4591 |
+
star.style.className = this.opt[icon];
|
4592 |
+
}
|
4593 |
+
} // Full down: [x.00 .. x.25]
|
4594 |
+
},
|
4595 |
+
|
4596 |
+
_target: function(score, evt) {
|
4597 |
+
if (this.opt.target) {
|
4598 |
+
var target = $(this.opt.target);
|
4599 |
+
|
4600 |
+
if (!target.length) {
|
4601 |
+
methods._error.call(this, 'Target selector invalid or missing!');
|
4602 |
+
}
|
4603 |
+
|
4604 |
+
var mouseover = evt && evt.type === 'mouseover';
|
4605 |
+
|
4606 |
+
if (score === undefined) {
|
4607 |
+
score = this.opt.targetText;
|
4608 |
+
} else if (score === null) {
|
4609 |
+
score = mouseover ? this.opt.cancelHint : this.opt.targetText;
|
4610 |
+
} else {
|
4611 |
+
if (this.opt.targetType === 'hint') {
|
4612 |
+
score = methods._getHint.call(this, Math.ceil(score));
|
4613 |
+
} else if (this.opt.precision) {
|
4614 |
+
score = parseFloat(score).toFixed(1);
|
4615 |
+
}
|
4616 |
+
|
4617 |
+
var mousemove = evt && evt.type === 'mousemove';
|
4618 |
+
|
4619 |
+
if (!mouseover && !mousemove && !this.opt.targetKeep) {
|
4620 |
+
score = this.opt.targetText;
|
4621 |
+
}
|
4622 |
+
}
|
4623 |
+
|
4624 |
+
if (score) {
|
4625 |
+
score = this.opt.targetFormat.toString().replace('{score}', score);
|
4626 |
+
}
|
4627 |
+
|
4628 |
+
if (target.is(':input')) {
|
4629 |
+
target.val(score);
|
4630 |
+
} else {
|
4631 |
+
target.html(score);
|
4632 |
+
}
|
4633 |
+
}
|
4634 |
+
},
|
4635 |
+
|
4636 |
+
_unlock: function() {
|
4637 |
+
this.style.cursor = 'pointer';
|
4638 |
+
this.removeAttribute('title');
|
4639 |
+
|
4640 |
+
this.score.removeAttr('readonly');
|
4641 |
+
|
4642 |
+
this.self.data('readonly', false);
|
4643 |
+
|
4644 |
+
for (var i = 0; i < this.opt.number; i++) {
|
4645 |
+
this.stars[i].title = methods._getHint.call(this, i + 1);
|
4646 |
+
}
|
4647 |
+
|
4648 |
+
if (this.cancel) {
|
4649 |
+
this.cancel.css('display', '');
|
4650 |
+
}
|
4651 |
+
},
|
4652 |
+
|
4653 |
+
cancel: function(click) {
|
4654 |
+
return this.each(function() {
|
4655 |
+
var el = $(this);
|
4656 |
+
|
4657 |
+
if (el.data('readonly') !== true) {
|
4658 |
+
methods[click ? 'click' : 'score'].call(el, null);
|
4659 |
+
|
4660 |
+
this.score.removeAttr('value');
|
4661 |
+
}
|
4662 |
+
});
|
4663 |
+
},
|
4664 |
+
|
4665 |
+
click: function(score) {
|
4666 |
+
return this.each(function() {
|
4667 |
+
if ($(this).data('readonly') !== true) {
|
4668 |
+
methods._apply.call(this, score);
|
4669 |
+
|
4670 |
+
if (this.opt.click) {
|
4671 |
+
this.opt.click.call(this, score, $.Event('click'));
|
4672 |
+
}
|
4673 |
+
|
4674 |
+
methods._target.call(this, score);
|
4675 |
+
}
|
4676 |
+
});
|
4677 |
+
},
|
4678 |
+
|
4679 |
+
destroy: function() {
|
4680 |
+
return this.each(function() {
|
4681 |
+
var self = $(this),
|
4682 |
+
raw = self.data('raw');
|
4683 |
+
|
4684 |
+
if (raw) {
|
4685 |
+
self.off('.raty').empty().css({ cursor: raw.style.cursor }).removeData('readonly');
|
4686 |
+
} else {
|
4687 |
+
self.data('raw', self.clone()[0]);
|
4688 |
+
}
|
4689 |
+
});
|
4690 |
+
},
|
4691 |
+
|
4692 |
+
getScore: function() {
|
4693 |
+
var score = [],
|
4694 |
+
value ;
|
4695 |
+
|
4696 |
+
this.each(function() {
|
4697 |
+
value = this.score.val();
|
4698 |
+
|
4699 |
+
score.push(value ? +value : undefined);
|
4700 |
+
});
|
4701 |
+
|
4702 |
+
return (score.length > 1) ? score : score[0];
|
4703 |
+
},
|
4704 |
+
|
4705 |
+
move: function(score) {
|
4706 |
+
return this.each(function() {
|
4707 |
+
var
|
4708 |
+
integer = parseInt(score, 10),
|
4709 |
+
opt = $(this).data('options'),
|
4710 |
+
decimal = (+score).toFixed(1).split('.')[1];
|
4711 |
+
|
4712 |
+
if (integer >= opt.number) {
|
4713 |
+
integer = opt.number - 1;
|
4714 |
+
decimal = 10;
|
4715 |
+
}
|
4716 |
+
|
4717 |
+
var
|
4718 |
+
size = methods._getSize.call(this),
|
4719 |
+
point = size / 10,
|
4720 |
+
star = $(this.stars[integer]),
|
4721 |
+
percent = star.offset().left + point * parseInt(decimal, 10),
|
4722 |
+
evt = $.Event('mousemove', { pageX: percent });
|
4723 |
+
|
4724 |
+
star.trigger(evt);
|
4725 |
+
});
|
4726 |
+
},
|
4727 |
+
|
4728 |
+
readOnly: function(readonly) {
|
4729 |
+
return this.each(function() {
|
4730 |
+
var self = $(this);
|
4731 |
+
|
4732 |
+
if (self.data('readonly') !== readonly) {
|
4733 |
+
if (readonly) {
|
4734 |
+
self.off('.raty').children('img').off('.raty');
|
4735 |
+
|
4736 |
+
methods._lock.call(this);
|
4737 |
+
} else {
|
4738 |
+
methods._binds.call(this);
|
4739 |
+
methods._unlock.call(this);
|
4740 |
+
}
|
4741 |
+
|
4742 |
+
self.data('readonly', readonly);
|
4743 |
+
}
|
4744 |
+
});
|
4745 |
+
},
|
4746 |
+
|
4747 |
+
reload: function() {
|
4748 |
+
return methods.set.call(this, {});
|
4749 |
+
},
|
4750 |
+
|
4751 |
+
score: function() {
|
4752 |
+
var self = $(this);
|
4753 |
+
|
4754 |
+
return arguments.length ? methods.setScore.apply(self, arguments) : methods.getScore.call(self);
|
4755 |
+
},
|
4756 |
+
|
4757 |
+
set: function(options) {
|
4758 |
+
return this.each(function() {
|
4759 |
+
var self = $(this),
|
4760 |
+
actual = self.data('options'),
|
4761 |
+
news = $.extend({}, actual, options);
|
4762 |
+
|
4763 |
+
self.raty(news);
|
4764 |
+
});
|
4765 |
+
},
|
4766 |
+
|
4767 |
+
setScore: function(score) {
|
4768 |
+
return this.each(function() {
|
4769 |
+
if ($(this).data('readonly') !== true) {
|
4770 |
+
methods._apply.call(this, score);
|
4771 |
+
methods._target.call(this, score);
|
4772 |
+
}
|
4773 |
+
});
|
4774 |
+
}
|
4775 |
+
};
|
4776 |
+
|
4777 |
+
$.fn.raty = function(method) {
|
4778 |
+
if (methods[method]) {
|
4779 |
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
4780 |
+
} else if (typeof method === 'object' || !method) {
|
4781 |
+
return methods.init.apply(this, arguments);
|
4782 |
+
} else {
|
4783 |
+
$.error('Method ' + method + ' does not exist!');
|
4784 |
+
}
|
4785 |
+
};
|
4786 |
+
|
4787 |
+
$.fn.raty.defaults = {
|
4788 |
+
cancel : false,
|
4789 |
+
cancelHint : 'Cancel this rating!',
|
4790 |
+
cancelOff : 'raty-cancel-off',
|
4791 |
+
cancelOn : 'raty-cancel-on',
|
4792 |
+
cancelPlace : 'left',
|
4793 |
+
click : undefined,
|
4794 |
+
half : false,
|
4795 |
+
halfShow : true,
|
4796 |
+
hints : ['1'],
|
4797 |
+
iconRange : undefined,
|
4798 |
+
mouseout : undefined,
|
4799 |
+
mouseover : undefined,
|
4800 |
+
noRatedMsg : 'Not rated yet!',
|
4801 |
+
number : 5,
|
4802 |
+
numberMax : 20,
|
4803 |
+
path : undefined,
|
4804 |
+
precision : false,
|
4805 |
+
readOnly : false,
|
4806 |
+
round : { down: 0.25, full: 0.6, up: 0.76 },
|
4807 |
+
score : undefined,
|
4808 |
+
scoreName : 'score',
|
4809 |
+
single : false,
|
4810 |
+
space : true,
|
4811 |
+
spaceWidth : 3,
|
4812 |
+
starColor : '#ff00aa',
|
4813 |
+
starHalf : 'star-half.png',
|
4814 |
+
starOff : 'raty-dot-off',
|
4815 |
+
starOn : 'raty-dot-on',
|
4816 |
+
starType : 'img',
|
4817 |
+
target : undefined,
|
4818 |
+
targetFormat : '{score}',
|
4819 |
+
targetKeep : false,
|
4820 |
+
targetScore : undefined,
|
4821 |
+
targetText : '',
|
4822 |
+
targetType : 'hint'
|
4823 |
+
};
|
4824 |
|
4825 |
})(jQuery);
|
4826 |
|
4839 |
});
|
4840 |
});
|
4841 |
|
4842 |
+
function toggle_button_init(id, el){
|
4843 |
|
4844 |
var field = jQuery(el),
|
4845 |
checked = field.find('.cf-toggle-group-radio:checked');
|
4847 |
if(checked.length){
|
4848 |
jQuery('#' + checked.data('ref') ).trigger('click');
|
4849 |
}
|
4850 |
+
|
4851 |
}
|
assets/js/fields.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
function color_picker_init(){jQuery(".minicolor-picker").miniColors()}function toggle_button_init(t,e){var a=jQuery(e),i=a.find(".cf-toggle-group-radio:checked");i.length&&jQuery("#"+i.data("ref")).trigger("click")}jQuery&&function(t){t.extend(t.fn,{miniColors:function(e,a){var i=function(e,a,i){var n=y(e.val());n||(n="ffffff");var r=_(n),c=t('<span class="input-group-addon" style="background-color: #'+n+'" href="#"></span>');c.insertAfter(e),e.addClass("miniColors").data("original-maxlength",e.attr("maxlength")||null).data("original-autocomplete",e.attr("autocomplete")||null).data("letterCase",a.letterCase?a.letterCase:"uppercase").data("trigger",c).data("hsb",r).data("change",a.change?a.change:null).data("close",a.close?a.close:null).data("open",a.open?a.open:null).attr("maxlength",7).attr("autocomplete","off").val("#"+f(n,a.letterCase)).trigger("change"),a.readonly&&e.prop("readonly",!0),a.disabled&&s(e),c.on("click.miniColors",function(t){t.preventDefault(),""===e.val()&&e.val("#").trigger("change"),o(e)}),e.on("focus.miniColors",function(t){""===e.val()&&e.val("#").trigger("change"),o(e)}),e.on("blur.miniColors",function(t){var a=y(C(e.data("hsb")));e.val(a?"#"+f(a,e.data("letterCase")):"").trigger("change")}),e.on("keydown.miniColors",function(t){9===t.keyCode&&l(e)}),e.on("keyup.miniColors",function(t){p(e)}),e.on("paste.miniColors",function(t){setTimeout(function(){p(e)},5)})},n=function(e){l(),e=t(e),e.data("trigger").remove(),e.attr("autocomplete",e.data("original-autocomplete")).attr("maxlength",e.data("original-maxlength")).removeData().removeClass("miniColors").off(".miniColors"),t(document).off(".miniColors")},r=function(t){t.prop("disabled",!1).data("trigger").css("opacity",1)},s=function(t){l(t),t.prop("disabled",!0).data("trigger").css("opacity",.5)},o=function(e){if(e.prop("disabled"))return!1;l();var a=t('<div class="miniColors-selector"></div>');a.append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').css("display","none").addClass(e.attr("class")).removeClass("form-control");var i=e.data("hsb");a.find(".miniColors-colors").css("backgroundColor","#"+C({h:i.h,s:100,b:100}));var n=e.data("colorPosition");n||(n=v(i)),a.find(".miniColors-colorPicker").css("top",n.y+"px").css("left",n.x+"px");var r=e.data("huePosition");r||(r=m(i)),a.find(".miniColors-huePicker").css("top",r.y+"px"),e.data("selector",a).data("huePicker",a.find(".miniColors-huePicker")).data("colorPicker",a.find(".miniColors-colorPicker")).data("mousebutton",0),t("BODY").append(a);var s=e.data("trigger"),o=!e.is(":visible"),h=o?s.offset().top+s.outerHeight():e.offset().top+e.outerHeight(),d=o?s.offset().left:e.offset().left,p=a.outerWidth(),f=a.outerHeight(),g=s.outerWidth(),y=s.outerHeight(),b=t(window).height(),x=t(window).width(),w=t(window).scrollTop(),_=t(window).scrollLeft();h+f>b+w&&(h=h-f-y),d+p>x+_&&(d=d-p+g),a.css({top:h,left:d}).fadeIn(100),a.on("selectstart",function(){return!1}),(!t.browser.msie||t.browser.msie&&t.browser.version>=9)&&t(window).on("resize.miniColors",function(t){l(e)}),t(document).on("mousedown.miniColors touchstart.miniColors",function(a){e.data("mousebutton",1);var i=t(a.target).parents().andSelf();return i.hasClass("miniColors-colors")&&(a.preventDefault(),e.data("moving","colors"),c(e,a)),i.hasClass("miniColors-hues")&&(a.preventDefault(),e.data("moving","hues"),u(e,a)),i.hasClass("miniColors-selector")?void a.preventDefault():void(i.hasClass("miniColors")||l(e))}),t(document).on("mouseup.miniColors touchend.miniColors",function(t){t.preventDefault(),e.data("mousebutton",0).removeData("moving")}).on("mousemove.miniColors touchmove.miniColors",function(t){t.preventDefault(),1===e.data("mousebutton")&&("colors"===e.data("moving")&&c(e,t),"hues"===e.data("moving")&&u(e,t))}),e.data("open")&&e.data("open").call(e.get(0),"#"+C(i),k(i))},l=function(e){e||(e=t(".miniColors")),e.each(function(){var a=t(this).data("selector");t(this).removeData("selector"),t(a).fadeOut(100,function(){if(e.data("close")){var a=e.data("hsb"),i=C(a);e.data("close").call(e.get(0),"#"+i,k(a))}t(this).remove()})}),t(document).off(".miniColors")},c=function(t,e){var a=t.data("colorPicker");a.hide();var i={x:e.pageX,y:e.pageY};e.originalEvent.changedTouches&&(i.x=e.originalEvent.changedTouches[0].pageX,i.y=e.originalEvent.changedTouches[0].pageY),i.x=i.x-t.data("selector").find(".miniColors-colors").offset().left-5,i.y=i.y-t.data("selector").find(".miniColors-colors").offset().top-5,i.x<=-5&&(i.x=-5),i.x>=144&&(i.x=144),i.y<=-5&&(i.y=-5),i.y>=144&&(i.y=144),t.data("colorPosition",i),a.css("left",i.x).css("top",i.y).show();var n=Math.round(.67*(i.x+5));0>n&&(n=0),n>100&&(n=100);var r=100-Math.round(.67*(i.y+5));0>r&&(r=0),r>100&&(r=100);var s=t.data("hsb");s.s=n,s.b=r,d(t,s,!0)},u=function(t,e){var a=t.data("huePicker");a.hide();var i={y:e.pageY};e.originalEvent.changedTouches&&(i.y=e.originalEvent.changedTouches[0].pageY),i.y=i.y-t.data("selector").find(".miniColors-colors").offset().top-1,i.y<=-1&&(i.y=-1),i.y>=149&&(i.y=149),t.data("huePosition",i),a.css("top",i.y).show();var n=Math.round(2.4*(150-i.y-1));0>n&&(n=0),n>360&&(n=360);var r=t.data("hsb");r.h=n,d(t,r,!0)},d=function(t,e,a){t.data("hsb",e);var i=C(e);if(a&&t.val("#"+f(i,t.data("letterCase"))).trigger("change"),t.data("trigger").css("backgroundColor","#"+i),t.data("selector")&&t.data("selector").find(".miniColors-colors").css("backgroundColor","#"+C({h:e.h,s:100,b:100})),t.data("change")){if(i===t.data("lastChange"))return;t.data("change").call(t.get(0),"#"+i,k(e)),t.data("lastChange",i)}},p=function(e){e.val("#"+g(e.val())).trigger("change");var a=y(e.val());if(!a)return!1;var i=_(a),n=e.data("hsb");if(i.h===n.h&&i.s===n.s&&i.b===n.b)return!0;var r=v(i),s=t(e.data("colorPicker"));s.css("top",r.y+"px").css("left",r.x+"px"),e.data("colorPosition",r);var o=m(i),l=t(e.data("huePicker"));return l.css("top",o.y+"px"),e.data("huePosition",o),d(e,i),!0},f=function(t,e){return"lowercase"===e?t.toLowerCase():"uppercase"===e?t.toUpperCase():t},v=function(t){var e=Math.ceil(t.s/.67);0>e&&(e=0),e>150&&(e=150);var a=150-Math.ceil(t.b/.67);return 0>a&&(a=0),a>150&&(a=150),{x:e-5,y:a-5}},m=function(t){var e=150-t.h/2.4;return 0>e&&(h=0),e>150&&(h=150),{y:e-1}},g=function(t){return t.replace(/[^A-F0-9]/gi,"")},y=function(t){return(t=g(t))?(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length?t:null):null},k=function(t){var e={},a=Math.round(t.h),i=Math.round(255*t.s/100),n=Math.round(255*t.b/100);if(0===i)e.r=e.g=e.b=n;else{var r=n,s=(255-i)*n/255,o=(r-s)*(a%60)/60;360===a&&(a=0),60>a?(e.r=r,e.b=s,e.g=s+o):120>a?(e.g=r,e.b=s,e.r=r-o):180>a?(e.g=r,e.r=s,e.b=s+o):240>a?(e.b=r,e.r=s,e.g=r-o):300>a?(e.b=r,e.g=s,e.r=s+o):360>a?(e.r=r,e.g=s,e.b=r-o):(e.r=0,e.g=0,e.b=0)}return{r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)}},b=function(e){var a=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];return t.each(a,function(t,e){1===e.length&&(a[t]="0"+e)}),a.join("")},x=function(t){return t=parseInt(t.indexOf("#")>-1?t.substring(1):t,16),{r:t>>16,g:(65280&t)>>8,b:255&t}},w=function(t){var e={h:0,s:0,b:0},a=Math.min(t.r,t.g,t.b),i=Math.max(t.r,t.g,t.b),n=i-a;return e.b=i,e.s=0!==i?255*n/i:0,0!==e.s?t.r===i?e.h=(t.g-t.b)/n:t.g===i?e.h=2+(t.b-t.r)/n:e.h=4+(t.r-t.g)/n:e.h=-1,e.h*=60,e.h<0&&(e.h+=360),e.s*=100/255,e.b*=100/255,e},_=function(t){var e=w(x(t));return 0===e.s&&(e.h=360),e},C=function(t){return b(k(t))};switch(e){case"readonly":return t(this).each(function(){t(this).hasClass("miniColors")&&t(this).prop("readonly",a)}),t(this);case"disabled":return t(this).each(function(){t(this).hasClass("miniColors")&&(a?s(t(this)):r(t(this)))}),t(this);case"value":if(void 0===a){if(!t(this).hasClass("miniColors"))return;var D=t(this),T=y(D.val());return T?"#"+f(T,D.data("letterCase")):null}return t(this).each(function(){t(this).hasClass("miniColors")&&(t(this).val(a).trigger("change"),p(t(this)))}),t(this);case"destroy":return t(this).each(function(){t(this).hasClass("miniColors")&&n(t(this))}),t(this);default:return e||(e={}),t(this).each(function(){"input"===t(this)[0].tagName.toLowerCase()&&(t(this).data("trigger")||i(t(this),e,a))}),t(this)}}})}(jQuery),function(t,e){function a(){return new Date(Date.UTC.apply(Date,arguments))}function i(){var t=new Date;return a(t.getFullYear(),t.getMonth(),t.getDate())}function n(t){return function(){return this[t].apply(this,arguments)}}function r(e,a){function i(t,e){return e.toLowerCase()}var n,r=t(e).data(),s={},o=new RegExp("^"+a.toLowerCase()+"([A-Z])");a=new RegExp("^"+a.toLowerCase());for(var l in r)a.test(l)&&(n=l.replace(o,i),s[n]=r[l]);return s}function s(e){var a={};if(f[e]||(e=e.split("-")[0],f[e])){var i=f[e];return t.each(p,function(t,e){e in i&&(a[e]=i[e])}),a}}var o=t(window),l=function(){var e={get:function(t){return this.slice(t)[0]},contains:function(t){for(var e=t&&t.valueOf(),a=0,i=this.length;i>a;a++)if(this[a].valueOf()===e)return a;return-1},remove:function(t){this.splice(t,1)},replace:function(e){e&&(t.isArray(e)||(e=[e]),this.clear(),this.push.apply(this,e))},clear:function(){this.splice(0)},copy:function(){var t=new l;return t.replace(this),t}};return function(){var a=[];return a.push.apply(a,arguments),t.extend(a,e),a}}(),c=function(e,a){this.dates=new l,this.viewDate=i(),this.focusDate=null,this._process_options(a),this.element=t(e),this.isInline=!1,this.isInput=this.element.is("input"),this.component=this.element.is(".date")?this.element.find(".add-on, .input-group-addon, .btn"):!1,this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=t(v.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("cfdatepicker-inline").appendTo(this.element):this.picker.addClass("cfdatepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("cfdatepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("tfoot th.today").attr("colspan",function(t,e){return parseInt(e)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};c.prototype={constructor:c,_process_options:function(e){this._o=t.extend({},this._o,e);var a=this.o=t.extend({},this._o),i=a.language;switch(f[i]||(i=i.split("-")[0],f[i]||(i=d.language)),a.language=i,a.startView){case 2:case"decade":a.startView=2;break;case 1:case"year":a.startView=1;break;default:a.startView=0}switch(a.minViewMode){case 1:case"months":a.minViewMode=1;break;case 2:case"years":a.minViewMode=2;break;default:a.minViewMode=0}a.startView=Math.max(a.startView,a.minViewMode),a.multidate!==!0&&(a.multidate=Number(a.multidate)||!1,a.multidate!==!1?a.multidate=Math.max(0,a.multidate):a.multidate=1),a.multidateSeparator=String(a.multidateSeparator),a.weekStart%=7,a.weekEnd=(a.weekStart+6)%7;var n=v.parseFormat(a.format);a.startDate!==-(1/0)&&(a.startDate?a.startDate instanceof Date?a.startDate=this._local_to_utc(this._zero_time(a.startDate)):a.startDate=v.parseDate(a.startDate,n,a.language):a.startDate=-(1/0)),a.endDate!==1/0&&(a.endDate?a.endDate instanceof Date?a.endDate=this._local_to_utc(this._zero_time(a.endDate)):a.endDate=v.parseDate(a.endDate,n,a.language):a.endDate=1/0),a.daysOfWeekDisabled=a.daysOfWeekDisabled||[],t.isArray(a.daysOfWeekDisabled)||(a.daysOfWeekDisabled=a.daysOfWeekDisabled.split(/[,\s]*/)),a.daysOfWeekDisabled=t.map(a.daysOfWeekDisabled,function(t){return parseInt(t,10)});var r=String(a.orientation).toLowerCase().split(/\s+/g),s=a.orientation.toLowerCase();if(r=t.grep(r,function(t){return/^auto|left|right|top|bottom$/.test(t)}),a.orientation={x:"auto",y:"auto"},s&&"auto"!==s)if(1===r.length)switch(r[0]){case"top":case"bottom":a.orientation.y=r[0];break;case"left":case"right":a.orientation.x=r[0]}else s=t.grep(r,function(t){return/^left|right$/.test(t)}),a.orientation.x=s[0]||"auto",s=t.grep(r,function(t){return/^top|bottom$/.test(t)}),a.orientation.y=s[0]||"auto";else;},_events:[],_secondaryEvents:[],_applyEvents:function(t){for(var a,i,n,r=0;r<t.length;r++)a=t[r][0],2===t[r].length?(i=e,n=t[r][1]):3===t[r].length&&(i=t[r][1],n=t[r][2]),a.on(n,i)},_unapplyEvents:function(t){for(var a,i,n,r=0;r<t.length;r++)a=t[r][0],2===t[r].length?(n=e,i=t[r][1]):3===t[r].length&&(n=t[r][1],i=t[r][2]),a.off(i,n)},_buildEvents:function(){this.isInput?this._events=[[this.element,{focus:t.proxy(this.show,this),keyup:t.proxy(function(e){-1===t.inArray(e.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:t.proxy(this.keydown,this)}]]:this.component&&this.hasInput?this._events=[[this.element.find("input"),{focus:t.proxy(this.show,this),keyup:t.proxy(function(e){-1===t.inArray(e.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:t.proxy(this.keydown,this)}],[this.component,{click:t.proxy(this.show,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:t.proxy(this.show,this)}]],this._events.push([this.element,"*",{blur:t.proxy(function(t){this._focused_from=t.target},this)}],[this.element,{blur:t.proxy(function(t){this._focused_from=t.target},this)}]),this._secondaryEvents=[[this.picker,{click:t.proxy(this.click,this)}],[t(window),{resize:t.proxy(this.place,this)}],[t(document),{"mousedown touchstart":t.proxy(function(t){this.element.is(t.target)||this.element.find(t.target).length||this.picker.is(t.target)||this.picker.find(t.target).length||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(e,a){var i=a||this.dates.get(-1),n=this._utc_to_local(i);this.element.trigger({type:e,date:n,dates:t.map(this.dates,this._utc_to_local),format:t.proxy(function(t,e){0===arguments.length?(t=this.dates.length-1,e=this.o.format):"string"==typeof t&&(e=t,t=this.dates.length-1),e=e||this.o.format;var a=this.dates.get(t);return v.formatDate(a,e,this.o.language)},this)})},show:function(){this.isInline||this.picker.appendTo("body"),this.picker.show(),this.place(),this._attachSecondaryEvents(),this._trigger("show")},hide:function(){this.isInline||this.picker.is(":visible")&&(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this._trigger("hide"))},remove:function(){this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().cfdatepicker,this.isInput||delete this.element.data().date},_utc_to_local:function(t){return t&&new Date(t.getTime()+6e4*t.getTimezoneOffset())},_local_to_utc:function(t){return t&&new Date(t.getTime()-6e4*t.getTimezoneOffset())},_zero_time:function(t){return t&&new Date(t.getFullYear(),t.getMonth(),t.getDate())},_zero_utc_time:function(t){return t&&new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()))},getDates:function(){return t.map(this.dates,this._utc_to_local)},getUTCDates:function(){return t.map(this.dates,function(t){return new Date(t)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){return new Date(this.dates.get(-1))},setDates:function(){var e=t.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,e),this._trigger("changeDate"),this.setValue()},setUTCDates:function(){var e=t.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,t.map(e,this._utc_to_local)),this._trigger("changeDate"),this.setValue()},setDate:n("setDates"),setUTCDate:n("setUTCDates"),setValue:function(){var t=this.getFormattedDate();this.isInput?this.element.val(t).change():this.component&&this.element.find("input").val(t).change()},getFormattedDate:function(a){a===e&&(a=this.o.format);var i=this.o.language;return t.map(this.dates,function(t){return v.formatDate(t,a,i)}).join(this.o.multidateSeparator)},setStartDate:function(t){this._process_options({startDate:t}),this.update(),this.updateNavArrows()},setEndDate:function(t){this._process_options({endDate:t}),this.update(),this.updateNavArrows()},setDaysOfWeekDisabled:function(t){this._process_options({daysOfWeekDisabled:t}),this.update(),this.updateNavArrows()},place:function(){if(!this.isInline){var e=this.picker.outerWidth(),a=this.picker.outerHeight(),i=10,n=o.width(),r=o.height(),s=o.scrollTop(),l=parseInt(this.element.parents().filter(function(){return"auto"!==t(this).css("z-index")}).first().css("z-index"))+10,c=this.component?this.component.parent().offset():this.element.offset(),h=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),u=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),d=c.left,p=c.top;this.picker.removeClass("cfdatepicker-orient-top cfdatepicker-orient-bottom cfdatepicker-orient-right cfdatepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("cfdatepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(d-=e-u)):(this.picker.addClass("cfdatepicker-orient-left"),c.left<0?d-=c.left-i:c.left+e>n&&(d=n-e-i));var f,v,m=this.o.orientation.y;"auto"===m&&(f=-s+c.top-a,v=s+r-(c.top+h+a),m=Math.max(f,v)===v?"top":"bottom"),this.picker.addClass("cfdatepicker-orient-"+m),"top"===m?p+=h:p-=a+parseInt(this.picker.css("padding-top")),this.picker.css({top:p,left:d,zIndex:l})}},_allow_update:!0,update:function(){if(this._allow_update){var e=this.dates.copy(),a=[],i=!1;arguments.length?(t.each(arguments,t.proxy(function(t,e){e instanceof Date&&(e=this._local_to_utc(e)),a.push(e)},this)),i=!0):(a=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),a=a&&this.o.multidate?a.split(this.o.multidateSeparator):[a],delete this.element.data().date),a=t.map(a,t.proxy(function(t){return v.parseDate(t,this.o.format,this.o.language)},this)),a=t.grep(a,t.proxy(function(t){return t<this.o.startDate||t>this.o.endDate||!t},this),!0),this.dates.replace(a),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate&&(this.viewDate=new Date(this.o.endDate)),i?this.setValue():a.length&&String(e)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&e.length&&this._trigger("clearDate"),this.fill()}},fillDow:function(){var t=this.o.weekStart,e="<tr>";if(this.o.calendarWeeks){var a='<th class="cw"> </th>';e+=a,this.picker.find(".cfdatepicker-days thead tr:first-child").prepend(a)}for(;t<this.o.weekStart+7;)e+='<th class="dow">'+f[this.o.language].daysMin[t++%7]+"</th>";e+="</tr>",this.picker.find(".cfdatepicker-days thead").append(e)},fillMonths:function(){for(var t="",e=0;12>e;)t+='<span class="month">'+f[this.o.language].monthsShort[e++]+"</span>";this.picker.find(".cfdatepicker-months td").html(t)},setRange:function(e){e&&e.length?this.range=t.map(e,function(t){return t.valueOf()}):delete this.range,this.fill()},getClassNames:function(e){var a=[],i=this.viewDate.getUTCFullYear(),n=this.viewDate.getUTCMonth(),r=new Date;return e.getUTCFullYear()<i||e.getUTCFullYear()===i&&e.getUTCMonth()<n?a.push("old"):(e.getUTCFullYear()>i||e.getUTCFullYear()===i&&e.getUTCMonth()>n)&&a.push("new"),this.focusDate&&e.valueOf()===this.focusDate.valueOf()&&a.push("focused"),this.o.todayHighlight&&e.getUTCFullYear()===r.getFullYear()&&e.getUTCMonth()===r.getMonth()&&e.getUTCDate()===r.getDate()&&a.push("today"),-1!==this.dates.contains(e)&&a.push("active"),(e.valueOf()<this.o.startDate||e.valueOf()>this.o.endDate||-1!==t.inArray(e.getUTCDay(),this.o.daysOfWeekDisabled))&&a.push("disabled"),this.range&&(e>this.range[0]&&e<this.range[this.range.length-1]&&a.push("range"),-1!==t.inArray(e.valueOf(),this.range)&&a.push("selected")),a},fill:function(){var i,n=new Date(this.viewDate),r=n.getUTCFullYear(),s=n.getUTCMonth(),o=this.o.startDate!==-(1/0)?this.o.startDate.getUTCFullYear():-(1/0),l=this.o.startDate!==-(1/0)?this.o.startDate.getUTCMonth():-(1/0),c=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,h=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,u=f[this.o.language].today||f.en.today||"",d=f[this.o.language].clear||f.en.clear||"";this.picker.find(".cfdatepicker-days thead th.cfdatepicker-switch").text(f[this.o.language].months[s]+" "+r),this.picker.find("tfoot th.today").text(u).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot th.clear").text(d).toggle(this.o.clearBtn!==!1),this.updateNavArrows(),this.fillMonths();var p=a(r,s-1,28),m=v.getDaysInMonth(p.getUTCFullYear(),p.getUTCMonth());p.setUTCDate(m),p.setUTCDate(m-(p.getUTCDay()-this.o.weekStart+7)%7);var g=new Date(p);g.setUTCDate(g.getUTCDate()+42),g=g.valueOf();for(var y,k=[];p.valueOf()<g;){if(p.getUTCDay()===this.o.weekStart&&(k.push("<tr>"),this.o.calendarWeeks)){var b=new Date(+p+(this.o.weekStart-p.getUTCDay()-7)%7*864e5),x=new Date(Number(b)+(11-b.getUTCDay())%7*864e5),w=new Date(Number(w=a(x.getUTCFullYear(),0,1))+(11-w.getUTCDay())%7*864e5),_=(x-w)/864e5/7+1;k.push('<td class="cw">'+_+"</td>")}if(y=this.getClassNames(p),y.push("day"),this.o.beforeShowDay!==t.noop){var C=this.o.beforeShowDay(this._utc_to_local(p));C===e?C={}:"boolean"==typeof C?C={enabled:C}:"string"==typeof C&&(C={classes:C}),C.enabled===!1&&y.push("disabled"),C.classes&&(y=y.concat(C.classes.split(/\s+/))),C.tooltip&&(i=C.tooltip)}y=t.unique(y),k.push('<td class="'+y.join(" ")+'"'+(i?' title="'+i+'"':"")+">"+p.getUTCDate()+"</td>"),p.getUTCDay()===this.o.weekEnd&&k.push("</tr>"),p.setUTCDate(p.getUTCDate()+1)}this.picker.find(".cfdatepicker-days tbody").empty().append(k.join(""));var D=this.picker.find(".cfdatepicker-months").find("th:eq(1)").text(r).end().find("span").removeClass("active");t.each(this.dates,function(t,e){e.getUTCFullYear()===r&&D.eq(e.getUTCMonth()).addClass("active")}),(o>r||r>c)&&D.addClass("disabled"),r===o&&D.slice(0,l).addClass("disabled"),r===c&&D.slice(h+1).addClass("disabled"),k="",r=10*parseInt(r/10,10);var T=this.picker.find(".cfdatepicker-years").find("th:eq(1)").text(r+"-"+(r+9)).end().find("td");r-=1;for(var P,M=t.map(this.dates,function(t){return t.getUTCFullYear()}),S=-1;11>S;S++)P=["year"],-1===S?P.push("old"):10===S&&P.push("new"),-1!==t.inArray(r,M)&&P.push("active"),(o>r||r>c)&&P.push("disabled"),k+='<span class="'+P.join(" ")+'">'+r+"</span>",r+=1;T.html(k)},updateNavArrows:function(){if(this._allow_update){var t=new Date(this.viewDate),e=t.getUTCFullYear(),a=t.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-(1/0)&&e<=this.o.startDate.getUTCFullYear()&&a<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&e>=this.o.endDate.getUTCFullYear()&&a>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-(1/0)&&e<=this.o.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&e>=this.o.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(e){e.preventDefault();var i,n,r,s=t(e.target).closest("span, td, th");if(1===s.length)switch(s[0].nodeName.toLowerCase()){case"th":switch(s[0].className){case"cfdatepicker-switch":this.showMode(1);break;case"prev":case"next":var o=v.modes[this.viewMode].navStep*("prev"===s[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,o),this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,o),1===this.viewMode&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":var l=new Date;l=a(l.getFullYear(),l.getMonth(),l.getDate(),0,0,0),this.showMode(-2);var c="linked"===this.o.todayBtn?null:"view";this._setDate(l,c);break;case"clear":var h;this.isInput?h=this.element:this.component&&(h=this.element.find("input")),h&&h.val("").change(),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()}break;case"span":s.is(".disabled")||(this.viewDate.setUTCDate(1),s.is(".month")?(r=1,n=s.parent().find("span").index(s),i=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(n),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(a(i,n,r))):(r=1,n=0,i=parseInt(s.text(),10)||0,this.viewDate.setUTCFullYear(i),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(a(i,n,r))),this.showMode(-1),this.fill());break;case"td":s.is(".day")&&!s.is(".disabled")&&(r=parseInt(s.text(),10)||1,i=this.viewDate.getUTCFullYear(),n=this.viewDate.getUTCMonth(),s.is(".old")?0===n?(n=11,i-=1):n-=1:s.is(".new")&&(11===n?(n=0,i+=1):n+=1),this._setDate(a(i,n,r)))}this.picker.is(":visible")&&this._focused_from&&t(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(t){var e=this.dates.contains(t);if(t?-1!==e?this.dates.remove(e):this.dates.push(t):this.dates.clear(),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(t,e){e&&"date"!==e||this._toggle_multidate(t&&new Date(t)),e&&"view"!==e||(this.viewDate=t&&new Date(t)),this.fill(),this.setValue(),this._trigger("changeDate");var a;this.isInput?a=this.element:this.component&&(a=this.element.find("input")),a&&a.change(),!this.o.autoclose||e&&"date"!==e||this.hide()},moveMonth:function(t,a){if(!t)return e;if(!a)return t;var i,n,r=new Date(t.valueOf()),s=r.getUTCDate(),o=r.getUTCMonth(),l=Math.abs(a);if(a=a>0?1:-1,1===l)n=-1===a?function(){return r.getUTCMonth()===o}:function(){return r.getUTCMonth()!==i},i=o+a,r.setUTCMonth(i),(0>i||i>11)&&(i=(i+12)%12);else{for(var c=0;l>c;c++)r=this.moveMonth(r,a);i=r.getUTCMonth(),r.setUTCDate(s),n=function(){return i!==r.getUTCMonth()}}for(;n();)r.setUTCDate(--s),r.setUTCMonth(i);return r},moveYear:function(t,e){return this.moveMonth(t,12*e)},dateWithinRange:function(t){return t>=this.o.startDate&&t<=this.o.endDate},keydown:function(t){if(this.picker.is(":not(:visible)"))return void(27===t.keyCode&&this.show());var e,a,n,r=!1,s=this.focusDate||this.viewDate;switch(t.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),t.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;e=37===t.keyCode?-1:1,t.ctrlKey?(a=this.moveYear(this.dates.get(-1)||i(),e),n=this.moveYear(s,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(a=this.moveMonth(this.dates.get(-1)||i(),e),n=this.moveMonth(s,e),this._trigger("changeMonth",this.viewDate)):(a=new Date(this.dates.get(-1)||i()),a.setUTCDate(a.getUTCDate()+e),n=new Date(s),n.setUTCDate(s.getUTCDate()+e)),this.dateWithinRange(a)&&(this.focusDate=this.viewDate=n,this.setValue(),this.fill(),t.preventDefault());break;case 38:case 40:if(!this.o.keyboardNavigation)break;e=38===t.keyCode?-1:1,t.ctrlKey?(a=this.moveYear(this.dates.get(-1)||i(),e),n=this.moveYear(s,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(a=this.moveMonth(this.dates.get(-1)||i(),e),n=this.moveMonth(s,e),this._trigger("changeMonth",this.viewDate)):(a=new Date(this.dates.get(-1)||i()),a.setUTCDate(a.getUTCDate()+7*e),n=new Date(s),n.setUTCDate(s.getUTCDate()+7*e)),this.dateWithinRange(a)&&(this.focusDate=this.viewDate=n,this.setValue(),this.fill(),t.preventDefault());break;case 32:break;case 13:s=this.focusDate||this.dates.get(-1)||this.viewDate,this._toggle_multidate(s),r=!0,this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(t.preventDefault(),this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}if(r){this.dates.length?this._trigger("changeDate"):this._trigger("clearDate");var o;this.isInput?o=this.element:this.component&&(o=this.element.find("input")),o&&o.change()}},showMode:function(t){t&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+t))),this.picker.find(">div").hide().filter(".cfdatepicker-"+v.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var h=function(e,a){this.element=t(e),this.inputs=t.map(a.inputs,function(t){return t.jquery?t[0]:t}),delete a.inputs,t(this.inputs).cfdatepicker(a).bind("changeDate",t.proxy(this.dateUpdated,this)),this.pickers=t.map(this.inputs,function(e){return t(e).data("cfdatepicker")}),this.updateDates()};h.prototype={updateDates:function(){this.dates=t.map(this.pickers,function(t){return t.getUTCDate()}),this.updateRanges()},updateRanges:function(){var e=t.map(this.dates,function(t){return t.valueOf()});t.each(this.pickers,function(t,a){a.setRange(e)})},dateUpdated:function(e){if(!this.updating){this.updating=!0;var a=t(e.target).data("cfdatepicker"),i=a.getUTCDate(),n=t.inArray(e.target,this.inputs),r=this.inputs.length;if(-1!==n){if(t.each(this.pickers,function(t,e){e.getUTCDate()||e.setUTCDate(i)}),i<this.dates[n])for(;n>=0&&i<this.dates[n];)this.pickers[n--].setUTCDate(i);else if(i>this.dates[n])for(;r>n&&i>this.dates[n];)this.pickers[n++].setUTCDate(i);this.updateDates(),delete this.updating}}},remove:function(){t.map(this.pickers,function(t){t.remove()}),delete this.element.data().cfdatepicker}};var u=t.fn.cfdatepicker;t.fn.cfdatepicker=function(a){var i=Array.apply(null,arguments);i.shift();var n;return this.each(function(){var o=t(this),l=o.data("cfdatepicker"),u="object"==typeof a&&a;if(!l){var p=r(this,"date"),f=t.extend({},d,p,u),v=s(f.language),m=t.extend({},d,v,p,u);if(o.is(".input-daterange")||m.inputs){var g={inputs:m.inputs||o.find("input").toArray()};o.data("cfdatepicker",l=new h(this,t.extend(m,g)))}else o.data("cfdatepicker",l=new c(this,m))}return"string"==typeof a&&"function"==typeof l[a]&&(n=l[a].apply(l,i),n!==e)?!1:void 0}),n!==e?n:this};var d=t.fn.cfdatepicker.defaults={autoclose:!1,beforeShowDay:t.noop,calendarWeeks:!1,clearBtn:!1,daysOfWeekDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-(1/0),startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0},p=t.fn.cfdatepicker.locale_opts=["format","rtl","weekStart"];t.fn.cfdatepicker.Constructor=c;var f=t.fn.cfdatepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}},v={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(t){return t%4===0&&t%100!==0||t%400===0},getDaysInMonth:function(t,e){return[31,v.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(t){var e=t.replace(this.validParts,"\x00").split("\x00"),a=t.match(this.validParts);if(!e||!e.length||!a||0===a.length)throw new Error("Invalid date format.");return{separators:e,
|
2 |
-
parts:a}},parseDate:function(i,n,r){function s(){var t=this.slice(0,d[h].length),e=d[h].slice(0,t.length);return t===e}if(!i)return e;if(i instanceof Date)return i;"string"==typeof n&&(n=v.parseFormat(n));var o,l,h,u=/([\-+]\d+)([dmwy])/,d=i.match(/([\-+]\d+)([dmwy])/g);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(i)){for(i=new Date,h=0;h<d.length;h++)switch(o=u.exec(d[h]),l=parseInt(o[1]),o[2]){case"d":i.setUTCDate(i.getUTCDate()+l);break;case"m":i=c.prototype.moveMonth.call(c.prototype,i,l);break;case"w":i.setUTCDate(i.getUTCDate()+7*l);break;case"y":i=c.prototype.moveYear.call(c.prototype,i,l)}return a(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),0,0,0)}d=i&&i.match(this.nonpunctuation)||[],i=new Date;var p,m,g={},y=["yyyy","yy","M","MM","m","mm","d","dd"],k={yyyy:function(t,e){return t.setUTCFullYear(e)},yy:function(t,e){return t.setUTCFullYear(2e3+e)},m:function(t,e){if(isNaN(t))return t;for(e-=1;0>e;)e+=12;for(e%=12,t.setUTCMonth(e);t.getUTCMonth()!==e;)t.setUTCDate(t.getUTCDate()-1);return t},d:function(t,e){return t.setUTCDate(e)}};k.M=k.MM=k.mm=k.m,k.dd=k.d,i=a(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0);var b=n.parts.slice();if(d.length!==b.length&&(b=t(b).filter(function(e,a){return-1!==t.inArray(a,y)}).toArray()),d.length===b.length){var x;for(h=0,x=b.length;x>h;h++){if(p=parseInt(d[h],10),o=b[h],isNaN(p))switch(o){case"MM":m=t(f[r].months).filter(s),p=t.inArray(m[0],f[r].months)+1;break;case"M":m=t(f[r].monthsShort).filter(s),p=t.inArray(m[0],f[r].monthsShort)+1}g[o]=p}var w,_;for(h=0;h<y.length;h++)_=y[h],_ in g&&!isNaN(g[_])&&(w=new Date(i),k[_](w,g[_]),isNaN(w)||(i=w))}return i},formatDate:function(e,a,i){if(!e)return"";"string"==typeof a&&(a=v.parseFormat(a));var n={d:e.getUTCDate(),D:f[i].daysShort[e.getUTCDay()],DD:f[i].days[e.getUTCDay()],m:e.getUTCMonth()+1,M:f[i].monthsShort[e.getUTCMonth()],MM:f[i].months[e.getUTCMonth()],yy:e.getUTCFullYear().toString().substring(2),yyyy:e.getUTCFullYear()};n.dd=(n.d<10?"0":"")+n.d,n.mm=(n.m<10?"0":"")+n.m,e=[];for(var r=t.extend([],a.separators),s=0,o=a.parts.length;o>=s;s++)r.length&&e.push(r.shift()),e.push(n[a.parts[s]]);return e.join("")},headTemplate:'<thead><tr><th class="prev">«</th><th colspan="5" class="cfdatepicker-switch"></th><th class="next">»</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};v.template='<div class="cfdatepicker"><div class="cfdatepicker-days"><table class=" table-condensed">'+v.headTemplate+"<tbody></tbody>"+v.footTemplate+'</table></div><div class="cfdatepicker-months"><table class="table-condensed">'+v.headTemplate+v.contTemplate+v.footTemplate+'</table></div><div class="cfdatepicker-years"><table class="table-condensed">'+v.headTemplate+v.contTemplate+v.footTemplate+"</table></div></div>",t.fn.cfdatepicker.DPGlobal=v,t.fn.cfdatepicker.noConflict=function(){return t.fn.cfdatepicker=u,this},t(document).on("focus.cfdatepicker.data-api click.cfdatepicker.data-api",'[data-provide="cfdatepicker"]',function(e){var a=t(this);a.data("cfdatepicker")||(e.preventDefault(),a.cfdatepicker("show").on("show",function(){t(this).trigger("blur")}).on("hide",function(){t(this).attr("disabled",!1)}))})}(window.jQuery),!function(t){function e(t){var e=document.createElement("input"),a="on"+t,i=a in e;return i||(e.setAttribute(a,"return;"),i="function"==typeof e[a]),e=null,i}function a(t){var e="text"==t||"tel"==t;if(!e){var a=document.createElement("input");a.setAttribute("type",t),e="text"===a.type,a=null}return e}function i(e,a,n){var r=n.aliases[e];return r?(r.alias&&i(r.alias,void 0,n),t.extend(!0,n,r),t.extend(!0,n,a),!0):!1}function n(e,a){function i(t){function a(t,e,a,i){this.matches=[],this.isGroup=t||!1,this.isOptional=e||!1,this.isQuantifier=a||!1,this.isAlternator=i||!1,this.quantifier={min:1,max:1}}function i(t,a,i){var n=e.definitions[a],r=0==t.matches.length;if(i=void 0!=i?i:t.matches.length,n&&!u){for(var s=n.prevalidator,o=s?s.length:0,l=1;l<n.cardinality;l++){var c=o>=l?s[l-1]:[],h=c.validator,d=c.cardinality;t.matches.splice(i++,0,{fn:h?"string"==typeof h?new RegExp(h):new function(){this.test=h}:new RegExp("."),cardinality:d?d:1,optionality:t.isOptional,newBlockMarker:r,casing:n.casing,def:n.definitionSymbol||a,placeholder:n.placeholder,mask:a})}t.matches.splice(i++,0,{fn:n.validator?"string"==typeof n.validator?new RegExp(n.validator):new function(){this.test=n.validator}:new RegExp("."),cardinality:n.cardinality,optionality:t.isOptional,newBlockMarker:r,casing:n.casing,def:n.definitionSymbol||a,placeholder:n.placeholder,mask:a})}else t.matches.splice(i++,0,{fn:null,cardinality:0,optionality:t.isOptional,newBlockMarker:r,casing:null,def:a,placeholder:void 0,mask:a}),u=!1}for(var n,r,s,o,l,c,h=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,u=!1,d=new a,p=[],f=[];n=h.exec(t);)switch(r=n[0],r.charAt(0)){case e.optionalmarker.end:case e.groupmarker.end:if(s=p.pop(),p.length>0){if(o=p[p.length-1],o.matches.push(s),o.isAlternator){l=p.pop();for(var v=0;v<l.matches.length;v++)l.matches[v].isGroup=!1;p.length>0?(o=p[p.length-1],o.matches.push(l)):d.matches.push(l)}}else d.matches.push(s);break;case e.optionalmarker.start:p.push(new a(!1,!0));break;case e.groupmarker.start:p.push(new a(!0));break;case e.quantifiermarker.start:var m=new a(!1,!1,!0);r=r.replace(/[{}]/g,"");var g=r.split(","),y=isNaN(g[0])?g[0]:parseInt(g[0]),k=1==g.length?y:isNaN(g[1])?g[1]:parseInt(g[1]);if(("*"==k||"+"==k)&&(y="*"==k?0:1),m.quantifier={min:y,max:k},p.length>0){var b=p[p.length-1].matches;if(n=b.pop(),!n.isGroup){var x=new a(!0);x.matches.push(n),n=x}b.push(n),b.push(m)}else{if(n=d.matches.pop(),!n.isGroup){var x=new a(!0);x.matches.push(n),n=x}d.matches.push(n),d.matches.push(m)}break;case e.escapeChar:u=!0;break;case e.alternatormarker:p.length>0?(o=p[p.length-1],c=o.matches.pop()):c=d.matches.pop(),c.isAlternator?p.push(c):(l=new a(!1,!1,!1,!0),l.matches.push(c),p.push(l));break;default:if(p.length>0){if(o=p[p.length-1],o.matches.length>0&&(c=o.matches[o.matches.length-1],c.isGroup&&(c.isGroup=!1,i(c,e.groupmarker.start,0),i(c,e.groupmarker.end))),i(o,r),o.isAlternator){l=p.pop();for(var v=0;v<l.matches.length;v++)l.matches[v].isGroup=!1;p.length>0?(o=p[p.length-1],o.matches.push(l)):d.matches.push(l)}}else d.matches.length>0&&(c=d.matches[d.matches.length-1],c.isGroup&&(c.isGroup=!1,i(c,e.groupmarker.start,0),i(c,e.groupmarker.end))),i(d,r)}return d.matches.length>0&&(c=d.matches[d.matches.length-1],c.isGroup&&(c.isGroup=!1,i(c,e.groupmarker.start,0),i(c,e.groupmarker.end)),f.push(d)),f}function n(a,n){if(e.numericInput&&e.multi!==!0){a=a.split("").reverse();for(var r=0;r<a.length;r++)a[r]==e.optionalmarker.start?a[r]=e.optionalmarker.end:a[r]==e.optionalmarker.end?a[r]=e.optionalmarker.start:a[r]==e.groupmarker.start?a[r]=e.groupmarker.end:a[r]==e.groupmarker.end&&(a[r]=e.groupmarker.start);a=a.join("")}if(void 0!=a&&""!=a){if(1==a.length&&0==e.greedy&&0!=e.repeat&&(e.placeholder=""),e.repeat>0||"*"==e.repeat||"+"==e.repeat){var s="*"==e.repeat?0:"+"==e.repeat?1:e.repeat;a=e.groupmarker.start+a+e.groupmarker.end+e.quantifiermarker.start+s+","+e.repeat+e.quantifiermarker.end}return void 0==t.inputmask.masksCache[a]&&(t.inputmask.masksCache[a]={mask:a,maskToken:i(a),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:n}),t.extend(!0,{},t.inputmask.masksCache[a])}}var r=void 0;if(t.isFunction(e.mask)&&(e.mask=e.mask.call(this,e)),t.isArray(e.mask))if(a)r=[],t.each(e.mask,function(e,a){r.push(void 0==a.mask||t.isFunction(a.mask)?n(a.toString(),a):n(a.mask.toString(),a))});else{e.keepStatic=void 0==e.keepStatic?!0:e.keepStatic;var s="(";t.each(e.mask,function(e,a){s.length>1&&(s+=")|("),s+=void 0==a.mask||t.isFunction(a.mask)?a.toString():a.mask.toString()}),s+=")",r=n(s,e.mask)}else e.mask&&(r=void 0==e.mask.mask||t.isFunction(e.mask.mask)?n(e.mask.toString(),e.mask):n(e.mask.mask.toString(),e.mask));return r}function r(i,n,r){function o(t,e,a){e=e||0;var i,n,r,s=[],o=0;do{if(t===!0&&f().validPositions[o]){var l=f().validPositions[o];n=l.match,i=l.locator.slice(),s.push(a===!0?l.input:O(o,n))}else{if(e>o){var c=w(o,i,o-1);r=c[0]}else r=k(o,i,o-1);n=r.match,i=r.locator.slice(),s.push(O(o,n))}o++}while((void 0==rt||rt>o-1)&&null!=n.fn||null==n.fn&&""!=n.def||e>=o);return s.pop(),s}function f(){return n}function v(t){var e=f();e.buffer=void 0,e.tests={},t!==!0&&(e._buffer=void 0,e.validPositions={},e.p=0)}function m(t){var e=f(),a=-1,i=e.validPositions;void 0==t&&(t=-1);var n=a,r=a;for(var s in i){var o=parseInt(s);(-1==t||null!=i[o].match.fn)&&(t>o&&(n=o),o>=t&&(r=o))}return a=t-n>1||t>r?n:r}function g(e,a,i){if(r.insertMode&&void 0!=f().validPositions[e]&&void 0==i){var n,s=t.extend(!0,{},f().validPositions),o=m();for(n=e;o>=n;n++)delete f().validPositions[n];f().validPositions[e]=a;var l,c=!0;for(n=e;o>=n;n++){var h=s[n];if(void 0!=h){var u=f().validPositions;l=!r.keepStatic&&(void 0!=u[n+1]&&w(n+1,u[n].locator.slice(),n).length>1||u[n]&&void 0!=u[n].alternation)?n+1:E(n),c=x(l,h.match.def)?c&&P(l,h.input,!0,!0)!==!1:null==h.match.fn}if(!c)break}if(!c)return f().validPositions=t.extend(!0,{},s),!1}else f().validPositions[e]=a;return!0}function y(t,e){var a,i=t;for(void 0!=f().validPositions[t]&&f().validPositions[t].input==r.radixPoint&&(e++,i++),a=i;e>a;a++)void 0==f().validPositions[a]||f().validPositions[a].input==r.radixPoint&&a!=m()||delete f().validPositions[a];for(a=e;a<=m();){var n=f().validPositions[a],s=f().validPositions[i];void 0!=n&&void 0==s?(x(i,n.match.def)&&P(i,n.input,!0)!==!1&&(delete f().validPositions[a],a++),i++):a++}var o=m();o>=t&&void 0!=f().validPositions[o]&&f().validPositions[o].input==r.radixPoint&&delete f().validPositions[o],v(!0)}function k(e,a,i){function n(e,a,i){for(var n=!1,r=e.locator[a].toString().split(","),s=0;s<r.length;s++)if(-1!=t.inArray(r[s],i)){n=!0;break}return n}for(var s,o=w(e,a,i),l=m(),c=f().validPositions[l]||w(0)[0],h=void 0!=c.alternation?c.locator[c.alternation].split(","):[],u=0;u<o.length&&(s=o[u],!(r.greedy||s.match&&(s.match.optionality===!1||s.match.newBlockMarker===!1)&&s.match.optionalQuantifier!==!0&&(void 0==c.alternation||void 0!=s.locator[c.alternation]&&n(s,c.alternation,h))));u++);return s}function b(t){return f().validPositions[t]?f().validPositions[t].match:w(t)[0].match}function x(t,e){for(var a=!1,i=w(t),n=0;n<i.length;n++)if(i[n].match&&i[n].match.def==e){a=!0;break}return a}function w(e,a,i){function n(a,i,s,l){function u(s,l,p){if(o>1e4)return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+f().mask),!0;if(o==e&&void 0==s.matches)return c.push({match:s,locator:l.reverse()}),!0;if(void 0!=s.matches){if(s.isGroup&&p!==!0){if(s=u(a.matches[d+1],l))return!0}else if(s.isOptional){var v=s;if(s=n(s,i,l,p)){var m=c[c.length-1].match,g=0==t.inArray(m,v.matches);g&&(h=!0),o=e}}else if(s.isAlternator){var y,k=s,b=[],x=c.slice(),w=l.length,_=i.length>0?i.shift():-1;if(-1==_||"string"==typeof _){var C,D=o,T=i.slice();"string"==typeof _&&(C=_.split(","));for(var P=0;P<k.matches.length;P++){c=[],s=u(k.matches[P],[P].concat(l),p)||s,y=c.slice(),o=D,c=[];for(var M=0;M<T.length;M++)i[M]=T[M];for(var S=0;S<y.length;S++)for(var E=y[S],A=0;A<b.length;A++){var F=b[A];if(E.match.mask==F.match.mask&&("string"!=typeof _||-1!=t.inArray(E.locator[w].toString(),C))){y.splice(S,1),F.locator[w]=F.locator[w]+","+E.locator[w],F.alternation=w;break}}b=b.concat(y)}"string"==typeof _&&(b=t.map(b,function(e,a){if(isFinite(a)){var i,n=e.locator[w].toString().split(",");e.locator[w]=void 0,e.alternation=void 0;for(var r=0;r<n.length;r++)i=-1!=t.inArray(n[r],C),i&&(void 0!=e.locator[w]?(e.locator[w]+=",",e.alternation=w,e.locator[w]+=n[r]):e.locator[w]=parseInt(n[r]));if(void 0!=e.locator[w])return e}})),c=x.concat(b),h=!0}else s=u(k.matches[_],[_].concat(l),p);if(s)return!0}else if(s.isQuantifier&&p!==!0){var U=s;r.greedy=r.greedy&&isFinite(U.quantifier.max);for(var O=i.length>0&&p!==!0?i.shift():0;O<(isNaN(U.quantifier.max)?O+1:U.quantifier.max)&&e>=o;O++){var R=a.matches[t.inArray(U,a.matches)-1];if(s=u(R,[O].concat(l),!0)){var m=c[c.length-1].match;m.optionalQuantifier=O>U.quantifier.min-1;var g=0==t.inArray(m,R.matches);if(g){if(O>U.quantifier.min-1){h=!0,o=e;break}return!0}return!0}}}else if(s=n(s,i,l,p))return!0}else o++}for(var d=i.length>0?i.shift():0;d<a.matches.length;d++)if(a.matches[d].isQuantifier!==!0){var p=u(a.matches[d],[d].concat(s),l);if(p&&o==e)return p;if(o>e)break}}var s=f().maskToken,o=a?i:0,l=a||[0],c=[],h=!1;if(void 0==a){for(var u,d=e-1;void 0==(u=f().validPositions[d])&&d>-1;)d--;if(void 0!=u&&d>-1)o=d,l=u.locator.slice();else{for(d=e-1;void 0==(u=f().tests[d])&&d>-1;)d--;void 0!=u&&d>-1&&(o=d,l=u[0].locator.slice())}}for(var p=l.shift();p<s.length;p++){var v=n(s[p],l,[p]);if(v&&o==e||o>e)break}return(0==c.length||h)&&c.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]}),f().tests[e]=t.extend(!0,[],c),f().tests[e]}function _(){return void 0==f()._buffer&&(f()._buffer=o(!1,1)),f()._buffer}function C(){return void 0==f().buffer&&(f().buffer=o(!0,m(),!0)),f().buffer}function D(t,e){var a=C().slice();if(t===!0)v(),t=0,e=a.length;else for(var i=t;e>i;i++)delete f().validPositions[i],delete f().tests[i];for(var i=t;e>i;i++)a[i]!=r.skipOptionalPartCharacter&&P(i,a[i],!0,!0)}function T(t,e){switch(e.casing){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t}function P(e,a,i,n){function s(e,a,i,n){var s=!1;return t.each(w(e),function(o,l){for(var c=l.match,h=a?1:0,u="",d=(C(),c.cardinality);d>h;d--)u+=F(e-(d-1));if(a&&(u+=a),s=null!=c.fn?c.fn.test(u,f(),e,i,r):a!=c.def&&a!=r.skipOptionalPartCharacter||""==c.def?!1:{c:c.def,pos:e},s!==!1){var p=void 0!=s.c?s.c:a;p=p==r.skipOptionalPartCharacter&&null===c.fn?c.def:p;var k=e;if(void 0!=s.remove&&y(s.remove,s.remove+1),s.refreshFromBuffer){var b=s.refreshFromBuffer;if(i=!0,D(b===!0?b:b.start,b.end),void 0==s.pos&&void 0==s.c)return s.pos=m(),!1;if(k=void 0!=s.pos?s.pos:e,k!=e)return s=t.extend(s,P(k,p,!0)),!1}else if(s!==!0&&void 0!=s.pos&&s.pos!=e&&(k=s.pos,D(e,k),k!=e))return s=t.extend(s,P(k,p,!0)),!1;return 1!=s&&void 0==s.pos&&void 0==s.c?!1:(o>0&&v(!0),g(k,t.extend({},l,{input:T(p,c)}),n)||(s=!1),!1)}}),s}function o(e,a,i,n){var s,o,l=t.extend(!0,{},f().validPositions);for(s=m();s>=0;s--)if(f().validPositions[s]&&void 0!=f().validPositions[s].alternation){o=f().validPositions[s].alternation;break}if(void 0!=o)for(var c in f().validPositions)if(parseInt(c)>parseInt(s)&&void 0===f().validPositions[c].alternation){for(var h=f().validPositions[c],u=h.locator[o],d=f().validPositions[s].locator[o].split(","),p=0;p<d.length;p++)if(u<d[p]){for(var g,y,k=c-1;k>=0;k--)if(g=f().validPositions[k],void 0!=g){y=g.locator[o],g.locator[o]=d[p];break}if(u!=g.locator[o]){for(var b=C().slice(),x=c;x<m()+1;x++)delete f().validPositions[x],delete f().tests[x];v(!0),r.keepStatic=!r.keepStatic;for(var x=c;x<b.length;x++)b[x]!=r.skipOptionalPartCharacter&&P(m()+1,b[x],!1,!0);g.locator[o]=y;var w=P(e,a,i,n);if(r.keepStatic=!r.keepStatic,w)return w;v(),f().validPositions=t.extend(!0,{},l)}}break}return!1}i=i===!0;for(var l=C(),c=e-1;c>-1&&(!f().validPositions[c]||null!=f().validPositions[c].match.fn);c--)void 0==f().validPositions[c]&&(!M(c)||l[c]!=O(c))&&w(c).length>1&&s(c,l[c],!0);var h=e,u=!1;if(n&&h>=S()&&v(!0),h<S()&&(u=s(h,a,i,n),!i&&u===!1)){var d=f().validPositions[h];if(!d||null!=d.match.fn||d.match.def!=a&&a!=r.skipOptionalPartCharacter){if((r.insertMode||void 0==f().validPositions[E(h)])&&!M(h))for(var p=h+1,k=E(h);k>=p;p++)if(u=s(p,a,i,n),u!==!1){h=p;break}}else u={caret:E(h)}}return u===!1&&r.keepStatic&&K(l)&&(u=o(e,a,i,n)),u===!0&&(u={pos:h}),u}function M(t){var e=b(t);return null!=e.fn?e.fn:!1}function S(){var t;if(rt=nt.prop("maxLength"),-1==rt&&(rt=void 0),0==r.greedy){var e,a=m(),i=f().validPositions[a],n=void 0!=i?i.locator.slice():void 0;for(e=a+1;void 0==i||null!=i.match.fn||null==i.match.fn&&""!=i.match.def;e++)i=k(e,n,e-1),n=i.locator.slice();t=e}else t=C().length;return void 0==rt||rt>t?t:rt}function E(t){var e=S();if(t>=e)return e;for(var a=t;++a<e&&!M(a)&&(r.nojumps!==!0||r.nojumpsThreshold>a););return a}function A(t){var e=t;if(0>=e)return 0;for(;--e>0&&!M(e););return e}function F(t){return void 0==f().validPositions[t]?O(t):f().validPositions[t].input}function U(t,e,a){t._valueSet(e.join("")),void 0!=a&&Y(t,a)}function O(e,a){a=a||b(e);var i=t.isFunction(a.placeholder)?a.placeholder.call(this,r):a.placeholder;return void 0!=i?i:null==a.fn?a.def:r.placeholder.charAt(e%r.placeholder.length)}function R(e,a,i,n,s){var o=void 0!=n?n.slice():I(e._valueGet()).split("");if(v(),a&&e._valueSet(""),t.each(o,function(a,n){if(s===!0){var r=m(),o=-1==r?a:E(r);-1==t.inArray(n,_().slice(r+1,o))&&Q.call(e,void 0,!0,n.charCodeAt(0),!1,i,i?a:f().p)}else Q.call(e,void 0,!0,n.charCodeAt(0),!1,i,i?a:f().p),i=i||a>0&&a>f().p}),a){var l=r.onKeyPress.call(this,void 0,C(),0,r);q(e,l),U(e,C(),t(e).is(":focus")?E(m(0)):void 0)}}function j(e){return t.inputmask.escapeRegex.call(this,e)}function I(t){return t.replace(new RegExp("("+j(_().join(""))+")*$"),"")}function N(e){if(e.data("_inputmask")&&!e.hasClass("hasDatepicker")){var a=[],i=f().validPositions;for(var n in i)i[n].match&&null!=i[n].match.fn&&a.push(i[n].input);var s=(st?a.reverse():a).join(""),o=(st?C().slice().reverse():C()).join("");return t.isFunction(r.onUnMask)&&(s=r.onUnMask.call(e,o,s,r)||s),s}return e[0]._valueGet()}function G(t){if(st&&"number"==typeof t&&(!r.greedy||""!=r.placeholder)){var e=C().length;t=e-t}return t}function Y(e,a,i){var n,s=e.jquery&&e.length>0?e[0]:e;if("number"!=typeof a){var o=t(s).data("_inputmask");return!t(s).is(":visible")&&o&&void 0!=o.caret?(a=o.caret.begin,i=o.caret.end):s.setSelectionRange?(a=s.selectionStart,i=s.selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),a=0-n.duplicate().moveStart("character",-1e5),i=a+n.text.length),a=G(a),i=G(i),{begin:a,end:i}}a=G(a),i=G(i),i="number"==typeof i?i:a;var o=t(s).data("_inputmask")||{};o.caret={begin:a,end:i},t(s).data("_inputmask",o),t(s).is(":visible")&&(s.scrollLeft=s.scrollWidth,0==r.insertMode&&a==i&&i++,s.setSelectionRange?(s.selectionStart=a,s.selectionEnd=i):s.createTextRange&&(n=s.createTextRange(),n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",a),n.select()))}function $(e){var a,i,n=C(),r=n.length,s=m(),o={},l=f().validPositions[s],c=void 0!=l?l.locator.slice():void 0;for(a=s+1;a<n.length;a++)i=k(a,c,a-1),c=i.locator.slice(),o[a]=t.extend(!0,{},i);var h=l&&void 0!=l.alternation?l.locator[l.alternation].split(","):[];for(a=r-1;a>s&&(i=o[a].match,(i.optionality||i.optionalQuantifier||l&&void 0!=l.alternation&&void 0!=o[a].locator[l.alternation]&&-1!=t.inArray(o[a].locator[l.alternation].toString(),h))&&n[a]==O(a,i));a--)r--;return e?{l:r,def:o[r]?o[r].match:void 0}:r}function H(t){for(var e=C(),a=e.slice(),i=$(),n=a.length-1;n>i&&!M(n);n--);a.splice(i,n+1-i),U(t,a)}function K(e){if(t.isFunction(r.isComplete))return r.isComplete.call(nt,e,r);if("*"!=r.repeat){var a=!1,i=$(!0),n=A(i.l),s=m();if(s==n&&(void 0==i.def||i.def.newBlockMarker||i.def.optionalQuantifier)){a=!0;for(var o=0;n>=o;o++){var l=M(o);if(l&&(void 0==e[o]||e[o]==O(o))||!l&&e[o]!=O(o)){a=!1;break}}}return a}}function B(t,e){return st?t-e>1||t-e==1&&r.insertMode:e-t>1||e-t==1&&r.insertMode}function W(e){var a=t._data(e).events;t.each(a,function(e,a){t.each(a,function(t,e){if("inputmask"==e.namespace&&"setvalue"!=e.type){var a=e.handler;e.handler=function(t){return this.readOnly||this.disabled?void t.preventDefault:a.apply(this,arguments)}}})})}function V(e){function a(e){if(void 0==t.valHooks[e]||1!=t.valHooks[e].inputmaskpatch){var a=t.valHooks[e]&&t.valHooks[e].get?t.valHooks[e].get:function(t){return t.value},i=t.valHooks[e]&&t.valHooks[e].set?t.valHooks[e].set:function(t,e){return t.value=e,t};t.valHooks[e]={get:function(e){var i=t(e);if(i.data("_inputmask")){if(i.data("_inputmask").opts.autoUnmask)return i.inputmask("unmaskedvalue");var n=a(e),r=i.data("_inputmask"),s=r.maskset,o=s._buffer;return o=o?o.join(""):"",n!=o?n:""}return a(e)},set:function(e,a){var n,r=t(e),s=r.data("_inputmask");return s?(n=i(e,t.isFunction(s.opts.onBeforeMask)?s.opts.onBeforeMask.call(ft,a,s.opts)||a:a),r.triggerHandler("setvalue.inputmask")):n=i(e,a),n},inputmaskpatch:!0}}}function i(){var e=t(this),a=t(this).data("_inputmask");return a?a.opts.autoUnmask?e.inputmask("unmaskedvalue"):s.call(this)!=_().join("")?s.call(this):"":s.call(this)}function n(e){var a=t(this).data("_inputmask");a?(o.call(this,t.isFunction(a.opts.onBeforeMask)?a.opts.onBeforeMask.call(ft,e,a.opts)||e:e),t(this).triggerHandler("setvalue.inputmask")):o.call(this,e)}function r(e){t(e).bind("mouseenter.inputmask",function(){var e=t(this),a=this,i=a._valueGet();""!=i&&i!=C().join("")&&e.trigger("setvalue")});var a=t._data(e).events,i=a.mouseover;if(i){for(var n=i[i.length-1],r=i.length-1;r>0;r--)i[r]=i[r-1];i[0]=n}}var s,o;e._valueGet||(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(e,"value"),document.__lookupGetter__&&e.__lookupGetter__("value")?(s=e.__lookupGetter__("value"),o=e.__lookupSetter__("value"),e.__defineGetter__("value",i),e.__defineSetter__("value",n)):(s=function(){return e.value},o=function(t){e.value=t},a(e.type),r(e)),e._valueGet=function(){return st?s.call(this).split("").reverse().join(""):s.call(this)},e._valueSet=function(t){o.call(this,st?t.split("").reverse().join(""):t)})}function L(e,a,i){function n(){if(r.keepStatic){v(!0);var t,a=[];for(t=m();t>=0;t--)if(f().validPositions[t]){if(void 0!=f().validPositions[t].alternation)break;a.push(f().validPositions[t].input),delete f().validPositions[t]}if(t>0)for(;a.length>0;)f().p=E(m()),Q.call(e,void 0,!0,a.pop().charCodeAt(0),!1,!1,f().p)}}if((r.numericInput||st)&&(a==t.inputmask.keyCode.BACKSPACE?a=t.inputmask.keyCode.DELETE:a==t.inputmask.keyCode.DELETE&&(a=t.inputmask.keyCode.BACKSPACE),st)){var s=i.end;i.end=i.begin,i.begin=s}a==t.inputmask.keyCode.BACKSPACE&&i.end-i.begin<=1?i.begin=A(i.begin):a==t.inputmask.keyCode.DELETE&&i.begin==i.end&&i.end++,y(i.begin,i.end),n();var o=m(i.begin);o<i.begin?(-1==o&&v(),f().p=E(o)):f().p=i.begin}function q(t,e,a){if(e&&e.refreshFromBuffer){var i=e.refreshFromBuffer;D(i===!0?i:i.start,i.end),v(!0),void 0!=a&&(U(t,C()),Y(t,e.caret||a.begin,e.caret||a.end))}}function z(a){ot=!1;var i=this,n=t(i),s=a.keyCode,o=Y(i);s==t.inputmask.keyCode.BACKSPACE||s==t.inputmask.keyCode.DELETE||l&&127==s||a.ctrlKey&&88==s&&!e("cut")?(a.preventDefault(),88==s&&(it=C().join("")),L(i,s,o),U(i,C(),f().p),i._valueGet()==_().join("")&&n.trigger("cleared"),r.showTooltip&&n.prop("title",f().mask)):s==t.inputmask.keyCode.END||s==t.inputmask.keyCode.PAGE_DOWN?setTimeout(function(){var t=E(m());r.insertMode||t!=S()||a.shiftKey||t--,Y(i,a.shiftKey?o.begin:t,t)},0):s==t.inputmask.keyCode.HOME&&!a.shiftKey||s==t.inputmask.keyCode.PAGE_UP?Y(i,0,a.shiftKey?o.begin:0):s==t.inputmask.keyCode.ESCAPE||90==s&&a.ctrlKey?(R(i,!0,!1,it.split("")),n.click()):s!=t.inputmask.keyCode.INSERT||a.shiftKey||a.ctrlKey?0!=r.insertMode||a.shiftKey||(s==t.inputmask.keyCode.RIGHT?setTimeout(function(){var t=Y(i);Y(i,t.begin)},0):s==t.inputmask.keyCode.LEFT&&setTimeout(function(){var t=Y(i);Y(i,st?t.begin+1:t.begin-1)},0)):(r.insertMode=!r.insertMode,Y(i,r.insertMode||o.begin!=S()?o.begin:o.begin-1));var c=Y(i),h=r.onKeyDown.call(this,a,C(),c.begin,r);q(i,h,c),ct=-1!=t.inArray(s,r.ignorables)}function Q(e,a,i,n,s,o){if(void 0==i&&ot)return!1;ot=!0;var l=this,c=t(l);e=e||window.event;var i=a?i:e.which||e.charCode||e.keyCode;if(!(a===!0||e.ctrlKey&&e.altKey)&&(e.ctrlKey||e.metaKey||ct))return!0;if(i){a!==!0&&46==i&&0==e.shiftKey&&","==r.radixPoint&&(i=44);var h,u=a?{begin:o,end:o}:Y(l),d=String.fromCharCode(i),p=B(u.begin,u.end);p&&(f().undoPositions=t.extend(!0,{},f().validPositions),L(l,t.inputmask.keyCode.DELETE,u),r.insertMode||(r.insertMode=!r.insertMode,g(u.begin,s),r.insertMode=!r.insertMode),p=!r.multi),f().writeOutBuffer=!0;var m=st&&!p?u.end:u.begin,y=P(m,d,s);if(y!==!1){if(y!==!0&&(m=void 0!=y.pos?y.pos:m,d=void 0!=y.c?y.c:d),v(!0),void 0!=y.caret)h=y.caret;else{var k=f().validPositions;h=!r.keepStatic&&(void 0!=k[m+1]&&w(m+1,k[m].locator.slice(),m).length>1||void 0!=k[m].alternation)?m+1:E(m)}f().p=h}if(n!==!1){var b=this;if(setTimeout(function(){r.onKeyValidation.call(b,y,r)},0),f().writeOutBuffer&&y!==!1){var x=C();U(l,x,a?void 0:r.numericInput?A(h):h),a!==!0&&setTimeout(function(){K(x)===!0&&c.trigger("complete"),lt=!0,c.trigger("input")},0)}else p&&(f().buffer=void 0,f().validPositions=f().undoPositions)}else p&&(f().buffer=void 0,f().validPositions=f().undoPositions);if(r.showTooltip&&c.prop("title",f().mask),e&&1!=a){e.preventDefault();var _=Y(l),D=r.onKeyPress.call(this,e,C(),_.begin,r);q(l,D,_)}}}function X(e){var a=t(this),i=this,n=e.keyCode,s=C(),o=Y(i),l=r.onKeyUp.call(this,e,s,o.begin,r);q(i,l,o),n==t.inputmask.keyCode.TAB&&r.showMaskOnFocus&&(a.hasClass("focus-inputmask")&&0==i._valueGet().length?(v(),s=C(),U(i,s),Y(i,0),it=C().join("")):(U(i,s),Y(i,G(0),G(S()))))}function J(e){if(lt===!0&&"input"==e.type)return lt=!1,!0;var a=this,i=t(a),n=a._valueGet(),s=Y(a);if("propertychange"==e.type&&a._valueGet().length<=S())return!0;"paste"==e.type&&(window.clipboardData&&window.clipboardData.getData?n=n.substr(0,s.begin)+window.clipboardData.getData("Text")+n.substr(s.end,n.length):e.originalEvent&&e.originalEvent.clipboardData&&e.originalEvent.clipboardData.getData&&(n=n.substr(0,s.begin)+e.originalEvent.clipboardData.getData("text/plain")+n.substr(s.end,n.length)));var o=t.isFunction(r.onBeforePaste)?r.onBeforePaste.call(a,n,r)||n:n;return R(a,!0,!1,st?o.split("").reverse():o.split(""),!0),i.click(),K(C())===!0&&i.trigger("complete"),!1}function Z(e){if(lt===!0&&"input"==e.type)return lt=!1,!0;var a=this,i=Y(a),n=a._valueGet();n=n.replace(new RegExp("("+j(_().join(""))+")*"),""),i.begin>n.length&&(Y(a,n.length),i=Y(a)),C().length-n.length!=1||n.charAt(i.begin)==C()[i.begin]||n.charAt(i.begin+1)==C()[i.begin]||M(i.begin)||(e.keyCode=t.inputmask.keyCode.BACKSPACE,z.call(a,e)),e.preventDefault()}function tt(e){if(lt===!0&&"input"==e.type)return lt=!1,!0;var a=this,i=Y(a),n=a._valueGet();Y(a,i.begin-1);var s=t.Event("keypress");s.which=n.charCodeAt(i.begin-1),ot=!1,ct=!1,Q.call(a,s,void 0,void 0,!1);var o=f().p;U(a,C(),r.numericInput?A(o):o),e.preventDefault()}function et(e){lt=!0;var a=this;return setTimeout(function(){Y(a,Y(a).begin-1);var i=t.Event("keypress");i.which=e.originalEvent.data.charCodeAt(0),ot=!1,ct=!1,Q.call(a,i,void 0,void 0,!1);var n=f().p;U(a,C(),r.numericInput?A(n):n)},0),!1}function at(e){if(nt=t(e),nt.is(":input")&&a(nt.attr("type"))){if(nt.data("_inputmask",{maskset:n,opts:r,isRTL:!1}),r.showTooltip&&nt.prop("title",f().mask),("rtl"==e.dir||r.rightAlign)&&nt.css("text-align","right"),"rtl"==e.dir||r.numericInput){e.dir="ltr",nt.removeAttr("dir");var i=nt.data("_inputmask");i.isRTL=!0,nt.data("_inputmask",i),st=!0}nt.unbind(".inputmask"),nt.removeClass("focus-inputmask"),nt.closest("form").bind("submit",function(){it!=C().join("")&&nt.change(),nt[0]._valueGet&&nt[0]._valueGet()==_().join("")&&nt[0]._valueSet(""),r.autoUnmask&&r.removeMaskOnSubmit&&nt.inputmask("remove")}).bind("reset",function(){setTimeout(function(){nt.trigger("setvalue")},0)}),nt.bind("mouseenter.inputmask",function(){var e=t(this),a=this;!e.hasClass("focus-inputmask")&&r.showMaskOnHover&&a._valueGet()!=C().join("")&&U(a,C())}).bind("blur.inputmask",function(){var e=t(this),a=this;if(e.data("_inputmask")){var i=a._valueGet(),n=C();e.removeClass("focus-inputmask"),it!=C().join("")&&e.change(),r.clearMaskOnLostFocus&&""!=i&&(i==_().join("")?a._valueSet(""):H(a)),K(n)===!1&&(e.trigger("incomplete"),r.clearIncomplete&&(v(),r.clearMaskOnLostFocus?a._valueSet(""):(n=_().slice(),U(a,n))))}}).bind("focus.inputmask",function(){var e=t(this),a=this,i=a._valueGet();r.showMaskOnFocus&&!e.hasClass("focus-inputmask")&&(!r.showMaskOnHover||r.showMaskOnHover&&""==i)&&a._valueGet()!=C().join("")&&U(a,C(),E(m())),e.addClass("focus-inputmask"),it=C().join("")}).bind("mouseleave.inputmask",function(){var e=t(this),a=this;r.clearMaskOnLostFocus&&(e.hasClass("focus-inputmask")||a._valueGet()==e.attr("placeholder")||(a._valueGet()==_().join("")||""==a._valueGet()?a._valueSet(""):H(a)))}).bind("click.inputmask",function(){var e=this;t(e).is(":focus")&&setTimeout(function(){var a=Y(e);if(a.begin==a.end)if(r.radixFocus&&""!=r.radixPoint&&-1!=t.inArray(r.radixPoint,C())&&C().join("")==_().join(""))Y(e,t.inArray(r.radixPoint,C()));else{var i=st?G(a.begin):a.begin,n=E(m(i));n>i?Y(e,M(i)?i:E(i)):Y(e,n)}},0)}).bind("dblclick.inputmask",function(){var t=this;setTimeout(function(){Y(t,0,E(m()))},0)}).bind(p+".inputmask dragdrop.inputmask drop.inputmask",J).bind("setvalue.inputmask",function(){var t=this;R(t,!0,!1,void 0,!0),it=C().join(""),(r.clearMaskOnLostFocus||r.clearIncomplete)&&t._valueGet()==_().join("")&&t._valueSet("")}).bind("cut.inputmask",function(e){lt=!0;var a=this,i=t(a),n=Y(a);L(a,t.inputmask.keyCode.DELETE,n);var s=r.onKeyPress.call(this,e,C(),f().p,r);q(a,s,{begin:f().p,end:f().p}),a._valueGet()==_().join("")&&i.trigger("cleared"),r.showTooltip&&i.prop("title",f().mask)}).bind("complete.inputmask",r.oncomplete).bind("incomplete.inputmask",r.onincomplete).bind("cleared.inputmask",r.oncleared),nt.bind("keydown.inputmask",z).bind("keypress.inputmask",Q).bind("keyup.inputmask",X).bind("compositionupdate.inputmask",et),"paste"!==p||s||nt.bind("input.inputmask",tt),s&&nt.bind("input.inputmask",J),(c||u||h||d)&&("input"==p&&nt.unbind(p+".inputmask"),nt.bind("input.inputmask",Z)),V(e);var o=t.isFunction(r.onBeforeMask)?r.onBeforeMask.call(e,e._valueGet(),r)||e._valueGet():e._valueGet();R(e,!0,!1,o.split(""),!0),it=C().join("");var l;try{l=document.activeElement}catch(g){}K(C())===!1&&r.clearIncomplete&&v(),r.clearMaskOnLostFocus?C().join("")==_().join("")?e._valueSet(""):H(e):U(e,C()),l===e&&(nt.addClass("focus-inputmask"),Y(e,E(m()))),W(e)}}var it,nt,rt,st=!1,ot=!1,lt=!1,ct=!1;if(void 0!=i)switch(i.action){case"isComplete":return nt=t(i.el),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,K(i.buffer);case"unmaskedvalue":return nt=i.$input,n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,st=i.$input.data("_inputmask").isRTL,N(i.$input);case"mask":it=C().join(""),at(i.el);break;case"format":nt=t({}),nt.data("_inputmask",{maskset:n,opts:r,isRTL:r.numericInput}),r.numericInput&&(st=!0);var ht=(t.isFunction(r.onBeforeMask)?r.onBeforeMask.call(nt,i.value,r)||i.value:i.value).split("");return R(nt,!1,!1,st?ht.reverse():ht,!0),r.onKeyPress.call(this,void 0,C(),0,r),i.metadata?{value:st?C().slice().reverse().join(""):C().join(""),metadata:nt.inputmask("getmetadata")}:st?C().slice().reverse().join(""):C().join("");case"isValid":nt=t({}),nt.data("_inputmask",{maskset:n,opts:r,isRTL:r.numericInput}),r.numericInput&&(st=!0);var ht=i.value.split("");R(nt,!1,!0,st?ht.reverse():ht);for(var ut=C(),dt=$(),pt=ut.length-1;pt>dt&&!M(pt);pt--);return ut.splice(dt,pt+1-dt),K(ut)&&i.value==ut.join("");case"getemptymask":return nt=t(i.el),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,_();case"remove":var ft=i.el;nt=t(ft),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,ft._valueSet(N(nt)),nt.unbind(".inputmask"),nt.removeClass("focus-inputmask"),nt.removeData("_inputmask");var vt;Object.getOwnPropertyDescriptor&&(vt=Object.getOwnPropertyDescriptor(ft,"value")),vt&&vt.get?ft._valueGet&&Object.defineProperty(ft,"value",{get:ft._valueGet,set:ft._valueSet}):document.__lookupGetter__&&ft.__lookupGetter__("value")&&ft._valueGet&&(ft.__defineGetter__("value",ft._valueGet),ft.__defineSetter__("value",ft._valueSet));try{delete ft._valueGet,delete ft._valueSet}catch(mt){
|
3 |
-
ft._valueGet=void 0,ft._valueSet=void 0}break;case"getmetadata":if(nt=t(i.el),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,t.isArray(n.metadata)){for(var gt,yt=m(),kt=yt;kt>=0;kt--)if(f().validPositions[kt]&&void 0!=f().validPositions[kt].alternation){gt=f().validPositions[kt].alternation;break}return void 0!=gt?n.metadata[f().validPositions[yt].locator[gt]]:n.metadata[0]}return n.metadata}}if(void 0===t.fn.inputmask){var s="function"==typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion():new Function("/*@cc_on return @_jscript_version; @*/")()>=10,o=navigator.userAgent,l=null!==o.match(new RegExp("iphone","i")),c=null!==o.match(new RegExp("android.*safari.*","i")),h=null!==o.match(new RegExp("android.*chrome.*","i")),u=null!==o.match(new RegExp("android.*firefox.*","i")),d=/Kindle/i.test(o)||/Silk/i.test(o)||/KFTT/i.test(o)||/KFOT/i.test(o)||/KFJWA/i.test(o)||/KFJWI/i.test(o)||/KFSOWI/i.test(o)||/KFTHWA/i.test(o)||/KFTHWI/i.test(o)||/KFAPWA/i.test(o)||/KFAPWI/i.test(o),p=e("paste")?"paste":e("input")?"input":"propertychange";t.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:t.noop,onincomplete:t.noop,oncleared:t.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!0,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyUp:t.noop,onKeyPress:t.noop,onKeyDown:t.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:t.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,rightAlign:!1,radixPoint:"",radixFocus:!1,nojumps:!1,nojumpsThreshold:0,keepStatic:void 0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-zА-яЁёÀ-ÿµ]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:void 0},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},masksCache:{},escapeRegex:function(t){var e=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];return t.replace(new RegExp("(\\"+e.join("|\\")+")","gim"),"\\$1")},format:function(e,a,s){var o=t.extend(!0,{},t.inputmask.defaults,a);return i(o.alias,a,o),r({action:"format",value:e,metadata:s},n(o),o)},isValid:function(e,a){var s=t.extend(!0,{},t.inputmask.defaults,a);return i(s.alias,a,s),r({action:"isValid",value:e},n(s),s)}},t.fn.inputmask=function(e,a,s,o,l){function c(e,a,n){var r=t(e);r.data("inputmask-alias")&&i(r.data("inputmask-alias"),{},a);for(var s in a){var o=r.data("inputmask-"+s.toLowerCase());void 0!=o&&("mask"==s&&0==o.indexOf("[")?(a[s]=o.replace(/[\s[\]]/g,"").split("','"),a[s][0]=a[s][0].replace("'",""),a[s][a[s].length-1]=a[s][a[s].length-1].replace("'","")):a[s]="boolean"==typeof o?o:o.toString(),n&&(n[s]=a[s]))}return a}s=s||r,o=o||"_inputmask";var h,u=t.extend(!0,{},t.inputmask.defaults,a);if("string"==typeof e)switch(e){case"mask":return i(u.alias,a,u),h=n(u,s!==r),void 0==h?this:this.each(function(){s({action:"mask",el:this},t.extend(!0,{},h),c(this,u))});case"unmaskedvalue":var d=t(this);return d.data(o)?s({action:"unmaskedvalue",$input:d}):d.val();case"remove":return this.each(function(){var e=t(this);e.data(o)&&s({action:"remove",el:this})});case"getemptymask":return this.data(o)?s({action:"getemptymask",el:this}):"";case"hasMaskedValue":return this.data(o)?!this.data(o).opts.autoUnmask:!1;case"isComplete":return this.data(o)?s({action:"isComplete",buffer:this[0]._valueGet().split(""),el:this}):!0;case"getmetadata":return this.data(o)?s({action:"getmetadata",el:this}):void 0;case"_detectScope":return i(u.alias,a,u),void 0==l||i(l,a,u)||-1!=t.inArray(l,["mask","unmaskedvalue","remove","getemptymask","hasMaskedValue","isComplete","getmetadata","_detectScope"])||(u.mask=l),t.isFunction(u.mask)&&(u.mask=u.mask.call(this,u)),t.isArray(u.mask);default:return i(u.alias,a,u),i(e,a,u)||(u.mask=e),h=n(u,s!==r),void 0==h?this:this.each(function(){s({action:"mask",el:this},t.extend(!0,{},h),c(this,u))})}else{if("object"==typeof e)return u=t.extend(!0,{},t.inputmask.defaults,e),i(u.alias,e,u),h=n(u,s!==r),void 0==h?this:this.each(function(){s({action:"mask",el:this},t.extend(!0,{},h),c(this,u))});if(void 0==e)return this.each(function(){var e=t(this).attr("data-inputmask");if(e&&""!=e)try{e=e.replace(new RegExp("'","g"),'"');var n=t.parseJSON("{"+e+"}");t.extend(!0,n,a),u=t.extend(!0,{},t.inputmask.defaults,n),u=c(this,u),i(u.alias,n,u),u.alias=void 0,t(this).inputmask("mask",u,s)}catch(r){}if(t(this).attr("data-inputmask-mask")||t(this).attr("data-inputmask-alias")){u=t.extend(!0,{},t.inputmask.defaults,{});var o={};u=c(this,u,o),i(u.alias,o,u),u.alias=void 0,t(this).inputmask("mask",u,s)}})}}}return t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}}),t.extend(t.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[1-9]|[12][0-9]|3[01]"),val2pre:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+a+"[01])")},val2:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[1-9]|[12][0-9])"+a+"(0[1-9]|1[012]))|(30"+a+"(0[13-9]|1[012]))|(31"+a+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(t,e,a){if(isNaN(t))return!1;var i=parseInt(t.concat(e.toString().slice(t.length))),n=parseInt(t.concat(a.toString().slice(t.length)));return(isNaN(i)?!1:i>=e&&a>=i)||(isNaN(n)?!1:n>=e&&a>=n)},determinebaseyear:function(t,e,a){var i=(new Date).getFullYear();if(t>i)return t;if(i>e){for(var n=e.toString().slice(0,2),r=e.toString().slice(2,4);n+a>e;)n--;var s=n+r;return t>s?t:s}return i},onKeyUp:function(e){var a=t(this);if(e.ctrlKey&&e.keyCode==t.inputmask.keyCode.RIGHT){var i=new Date;a.val(i.getDate().toString()+(i.getMonth()+1).toString()+i.getFullYear().toString())}},definitions:{1:{validator:function(t,e,a,i,n){var r=n.regex.val1.test(t);return i||r||t.charAt(1)!=n.separator&&-1=="-./".indexOf(t.charAt(1))||!(r=n.regex.val1.test("0"+t.charAt(0)))?r:(e.buffer[a-1]="0",{refreshFromBuffer:{start:a-1,end:a},pos:a,c:t.charAt(0)})},cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){isNaN(e.buffer[a+1])||(t+=e.buffer[a+1]);var r=1==t.length?n.regex.val1pre.test(t):n.regex.val1.test(t);return i||r||!(r=n.regex.val1.test("0"+t))?r:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},2:{validator:function(t,e,a,i,n){var r=n.mask.indexOf("2")==n.mask.length-1?e.buffer.join("").substr(5,3):e.buffer.join("").substr(0,3);-1!=r.indexOf(n.placeholder[0])&&(r="01"+n.separator);var s=n.regex.val2(n.separator).test(r+t);if(!i&&!s&&(t.charAt(1)==n.separator||-1!="-./".indexOf(t.charAt(1)))&&(s=n.regex.val2(n.separator).test(r+"0"+t.charAt(0))))return e.buffer[a-1]="0",{refreshFromBuffer:{start:a-1,end:a},pos:a,c:t.charAt(0)};if(n.mask.indexOf("2")==n.mask.length-1&&s){var o=e.buffer.join("").substr(4,4)+t;if(o!=n.leapday)return!0;var l=parseInt(e.buffer.join("").substr(0,4),10);return l%4===0?l%100===0?l%400===0:!0:!1}return s},cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){isNaN(e.buffer[a+1])||(t+=e.buffer[a+1]);var r=n.mask.indexOf("2")==n.mask.length-1?e.buffer.join("").substr(5,3):e.buffer.join("").substr(0,3);-1!=r.indexOf(n.placeholder[0])&&(r="01"+n.separator);var s=1==t.length?n.regex.val2pre(n.separator).test(r+t):n.regex.val2(n.separator).test(r+t);return i||s||!(s=n.regex.val2(n.separator).test(r+"0"+t))?s:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},y:{validator:function(t,e,a,i,n){if(n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear)){var r=e.buffer.join("").substr(0,6);if(r!=n.leapday)return!0;var s=parseInt(t,10);return s%4===0?s%100===0?s%400===0:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(t,e,a,i,n){var r=n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear);if(!i&&!r){var s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t+"0").toString().slice(0,1);if(r=n.isInYearRange(s+t,n.yearrange.minyear,n.yearrange.maxyear))return e.buffer[a++]=s.charAt(0),{pos:a};if(s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t+"0").toString().slice(0,2),r=n.isInYearRange(s+t,n.yearrange.minyear,n.yearrange.maxyear))return e.buffer[a++]=s.charAt(0),e.buffer[a++]=s.charAt(1),{pos:a}}return r},cardinality:1},{validator:function(t,e,a,i,n){var r=n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear);if(!i&&!r){var s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t).toString().slice(0,2);if(r=n.isInYearRange(t[0]+s[1]+t[1],n.yearrange.minyear,n.yearrange.maxyear))return e.buffer[a++]=s.charAt(1),{pos:a};if(s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t).toString().slice(0,2),n.isInYearRange(s+t,n.yearrange.minyear,n.yearrange.maxyear)){var o=e.buffer.join("").substr(0,6);if(o!=n.leapday)r=!0;else{var l=parseInt(t,10);r=l%4===0?l%100===0?l%400===0:!0:!1}}else r=!1;if(r)return e.buffer[a-1]=s.charAt(0),e.buffer[a++]=s.charAt(1),e.buffer[a++]=t.charAt(0),{refreshFromBuffer:{start:a-3,end:a},pos:a}}return r},cardinality:2},{validator:function(t,e,a,i,n){return n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[13-9]|1[012])"+a+"[0-3])|(02"+a+"[0-2])")},val2:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[1-9]|1[012])"+a+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+a+"30)|((0[13578]|1[02])"+a+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyUp:function(e){var a=t(this);if(e.ctrlKey&&e.keyCode==t.inputmask.keyCode.RIGHT){var i=new Date;a.val((i.getMonth()+1).toString()+i.getDate().toString()+i.getFullYear().toString())}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(e){var a=t(this);if(e.ctrlKey&&e.keyCode==t.inputmask.keyCode.RIGHT){var i=new Date;a.val(i.getFullYear().toString()+(i.getMonth()+1).toString()+i.getDate().toString())}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:new RegExp("[012]"),hrs24:new RegExp("2[0-4]|1[3-9]"),hrs:new RegExp("[01][0-9]|2[0-4]"),ampm:new RegExp("^[a|p|A|P][m|M]"),mspre:new RegExp("[0-5]"),ms:new RegExp("[0-5][0-9]")},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(t,e,a,i,n){if("24"==n.hourFormat&&24==parseInt(t,10))return e.buffer[a-1]="0",e.buffer[a]="0",{refreshFromBuffer:{start:a-1,end:a},c:"0"};var r=n.regex.hrs.test(t);if(!i&&!r&&(t.charAt(1)==n.timeseparator||-1!="-.:".indexOf(t.charAt(1)))&&(r=n.regex.hrs.test("0"+t.charAt(0))))return e.buffer[a-1]="0",e.buffer[a]=t.charAt(0),a++,{refreshFromBuffer:{start:a-2,end:a},pos:a,c:n.timeseparator};if(r&&"24"!==n.hourFormat&&n.regex.hrs24.test(t)){var s=parseInt(t,10);return 24==s?(e.buffer[a+5]="a",e.buffer[a+6]="m"):(e.buffer[a+5]="p",e.buffer[a+6]="m"),s-=12,10>s?(e.buffer[a]=s.toString(),e.buffer[a-1]="0"):(e.buffer[a]=s.toString().charAt(1),e.buffer[a-1]=s.toString().charAt(0)),{refreshFromBuffer:{start:a-1,end:a+6},c:e.buffer[a]}}return r},cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){var r=n.regex.hrspre.test(t);return i||r||!(r=n.regex.hrs.test("0"+t))?r:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){var r=n.regex.mspre.test(t);return i||r||!(r=n.regex.ms.test("0"+t))?r:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},t:{validator:function(t,e,a,i,n){return n.regex.ampm.test(t+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.definitions,{A:{validator:"[A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"}}),t.extend(t.inputmask.defaults.aliases,{url:{mask:"ir",placeholder:"",separator:"",defaultPrefix:"http://",regex:{urlpre1:new RegExp("[fh]"),urlpre2:new RegExp("(ft|ht)"),urlpre3:new RegExp("(ftp|htt)"),urlpre4:new RegExp("(ftp:|http|ftps)"),urlpre5:new RegExp("(ftp:/|ftps:|http:|https)"),urlpre6:new RegExp("(ftp://|ftps:/|http:/|https:)"),urlpre7:new RegExp("(ftp://|ftps://|http://|https:/)"),urlpre8:new RegExp("(ftp://|ftps://|http://|https://)")},definitions:{i:{validator:function(){return!0},cardinality:8,prevalidator:function(){for(var t=[],e=8,a=0;e>a;a++)t[a]=function(){var t=a;return{validator:function(e,a,i,n,r){if(r.regex["urlpre"+(t+1)]){var s,o=e;t+1-e.length>0&&(o=a.buffer.join("").substring(0,t+1-e.length)+""+o);var l=r.regex["urlpre"+(t+1)].test(o);if(!n&&!l){for(i-=t,s=0;s<r.defaultPrefix.length;s++)a.buffer[i]=r.defaultPrefix[s],i++;for(s=0;s<o.length-1;s++)a.buffer[i]=o[s],i++;return{pos:i}}return l}return!1},cardinality:t}}();return t}()},r:{validator:".",cardinality:50}},insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(t,e,a){return a-1>-1&&"."!=e.buffer[a-1]?(t=e.buffer[a-1]+t,t=a-2>-1&&"."!=e.buffer[a-2]?e.buffer[a-2]+t:"0"+t):t="00"+t,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(t)},cardinality:1}}},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",greedy:!1,onBeforePaste:function(t){return t=t.toLowerCase(),t.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"}}}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.aliases,{numeric:{mask:function(t){if(0!==t.repeat&&isNaN(t.integerDigits)&&(t.integerDigits=t.repeat),t.repeat=0,t.groupSeparator==t.radixPoint&&(t.groupSeparator="."==t.radixPoint?",":","==t.radixPoint?".":"")," "===t.groupSeparator&&(t.skipOptionalPartCharacter=void 0),t.autoGroup=t.autoGroup&&""!=t.groupSeparator,t.autoGroup&&isFinite(t.integerDigits)){var e=Math.floor(t.integerDigits/t.groupSize),a=t.integerDigits%t.groupSize;t.integerDigits+=0==a?e-1:e}t.definitions[";"]=t.definitions["~"];var i=t.prefix;return i+="[+]",i+="~{1,"+t.integerDigits+"}",void 0!=t.digits&&(isNaN(t.digits)||parseInt(t.digits)>0)&&(i+=t.digitsOptional?"["+(t.decimalProtect?":":t.radixPoint)+";{"+t.digits+"}]":(t.decimalProtect?":":t.radixPoint)+";{"+t.digits+"}"),i+=t.suffix},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,groupSeparator:"",radixPoint:".",radixFocus:!0,groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"+",prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,postFormat:function(e,a,i,n){var r=!1,s=e[a];if(""==n.groupSeparator||-1!=t.inArray(n.radixPoint,e)&&a>=t.inArray(n.radixPoint,e)||new RegExp("[-+]").test(s))return{pos:a};var o=e.slice();s==n.groupSeparator&&(o.splice(a--,1),s=o[a]),i?o[a]="?":o.splice(a,0,"?");var l=o.join("");if(n.autoGroup||i&&-1!=l.indexOf(n.groupSeparator)){var c=t.inputmask.escapeRegex.call(this,n.groupSeparator);r=0==l.indexOf(n.groupSeparator),l=l.replace(new RegExp(c,"g"),"");var h=l.split(n.radixPoint);if(l=h[0],l!=n.prefix+"?0"&&l.length>=n.groupSize+n.prefix.length){r=!0;for(var u=new RegExp("([-+]?[\\d?]+)([\\d?]{"+n.groupSize+"})");u.test(l);)l=l.replace(u,"$1"+n.groupSeparator+"$2"),l=l.replace(n.groupSeparator+n.groupSeparator,n.groupSeparator)}h.length>1&&(l+=n.radixPoint+h[1])}e.length=l.length;for(var d=0,p=l.length;p>d;d++)e[d]=l.charAt(d);var f=t.inArray("?",e);return i?e[f]=s:e.splice(f,1),{pos:f,refreshFromBuffer:r}},onKeyDown:function(e,a,i,n){if(e.keyCode==t.inputmask.keyCode.TAB&&"0"!=n.placeholder.charAt(0)){var r=t.inArray(n.radixPoint,a);if(-1!=r&&isFinite(n.digits)){for(var s=1;s<=n.digits;s++)(void 0==a[r+s]||a[r+s]==n.placeholder.charAt(0))&&(a[r+s]="0");return{refreshFromBuffer:{start:++r,end:r+n.digits}}}}else if(n.autoGroup&&(e.keyCode==t.inputmask.keyCode.DELETE||e.keyCode==t.inputmask.keyCode.BACKSPACE)){var o=n.postFormat(a,i-1,!0,n);return o.caret=o.pos+1,o}},onKeyPress:function(t,e,a,i){if(i.autoGroup){var n=i.postFormat(e,a-1,!0,i);return n.caret=n.pos+1,n}},regex:{integerPart:function(){return new RegExp("[-+]?\\d+")},integerNPart:function(){return new RegExp("\\d+")}},signHandler:function(t,e,a,i,n){if(!i&&(n.allowMinus&&"-"===t||n.allowPlus&&"+"===t)){var r=e.join("").match(n.regex.integerPart(n));if(r&&r.length>0&&"0"!==r[r.index])return e[r.index]==("-"===t?"+":"-")?{pos:r.index,c:t,remove:r.index,caret:a}:e[r.index]==("-"===t?"-":"+")?{remove:r.index,caret:a-1}:{pos:r.index,c:t,caret:a+1}}return!1},radixHandler:function(e,a,i,n,r){if(!n&&e===r.radixPoint){var s=t.inArray(r.radixPoint,a.buffer),o=a.buffer.join("").match(r.regex.integerPart(r));if(-1!=s)return a.validPositions[s-1]?{caret:s+1}:{pos:o.index,c:o[0],caret:s+1}}return!1},leadingZeroHandler:function(e,a,i,n,r){var s=a.buffer.join("").match(r.regex.integerNPart(r)),o=t.inArray(r.radixPoint,a.buffer);if(s&&!n&&(-1==o||s.index<o))if(0==s[0].indexOf("0")&&i>=r.prefix.length){if(-1==o||o>=i&&void 0==a.validPositions[o])return a.buffer.splice(s.index,1),i=i>s.index?i-1:s.index,{pos:i,remove:s.index};if(i>s.index&&o>=i)return a.buffer.splice(s.index,1),i=i>s.index?i-1:s.index,{pos:i,remove:s.index}}else if("0"==e&&i<=s.index)return!1;return!0},definitions:{"~":{validator:function(e,a,i,n,r){var s=r.signHandler(e,a.buffer,i,n,r);if(!s&&(s=r.radixHandler(e,a,i,n,r),!s&&(s=n?new RegExp("[0-9"+t.inputmask.escapeRegex.call(this,r.groupSeparator)+"]").test(e):new RegExp("[0-9]").test(e),s===!0&&(s=r.leadingZeroHandler(e,a,i,n,r),s===!0)))){var o=t.inArray(r.radixPoint,a.buffer);r.digitsOptional===!1&&i>o&&!n&&(s={pos:i,remove:i}),s={pos:i}}return s},cardinality:1,prevalidator:null},"+":{validator:function(t,e,a,i,n){var r=n.signHandler(t,e.buffer,a,i,n);return r||(r=n.allowMinus&&"-"==t||n.allowPlus&&"+"==t),r},cardinality:1,prevalidator:null,placeholder:""},":":{validator:function(e,a,i,n,r){var s=r.signHandler(e,a.buffer,i,n,r);if(!s){var o="["+t.inputmask.escapeRegex.call(this,r.radixPoint)+"]";s=new RegExp(o).test(e),s&&a.validPositions[i]&&a.validPositions[i].match.placeholder==r.radixPoint&&(s={pos:i,remove:i})}return s},cardinality:1,prevalidator:null,placeholder:function(t){return t.radixPoint}}},insertMode:!0,autoUnmask:!1,onUnMask:function(e,a,i){var n=e.replace(i.prefix,"");return n=n.replace(i.suffix,""),n=n.replace(new RegExp(t.inputmask.escapeRegex.call(this,i.groupSeparator),"g"),"")},isComplete:function(e,a){var i=e.join(""),n=e.slice();if(a.postFormat(n,0,!0,a),n.join("")!=i)return!1;var r=i.replace(a.prefix,"");return r=r.replace(a.suffix,""),r=r.replace(new RegExp(t.inputmask.escapeRegex.call(this,a.groupSeparator),"g"),""),r=r.replace(t.inputmask.escapeRegex.call(this,a.radixPoint),"."),isFinite(r)},onBeforeMask:function(e,a){if(isFinite(e))return e.toString().replace(".",a.radixPoint);var i=e.match(/,/g),n=e.match(/\./g);return n&&i?n.length>i.length?(e=e.replace(/\./g,""),e=e.replace(",",a.radixPoint)):i.length>n.length&&(e=e.replace(/,/g,""),e=e.replace(".",a.radixPoint)):e=e.replace(new RegExp(t.inputmask.escapeRegex.call(this,a.groupSeparator),"g"),""),e}},currency:{prefix:"$ ",groupSeparator:",",radixPoint:".",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1,decimalProtect:!0},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:"0"}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.js",maskInit:"+pp(pp)pppppppp",mask:function(e){e.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var a=[];return t.ajax({url:e.url,async:!1,dataType:"json",success:function(t){a=t}}),a=a.sort(function(t,e){return(t.mask||t)<(e.mask||e)?-1:1}),a.splice(0,0,e.maskInit),a},nojumps:!0,nojumpsThreshold:1},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",maskInit:"+32(pp)pppppppp",nojumpsThreshold:4}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(t,e){return new RegExp(e.regex).test(t.join(""))},definitions:{r:{validator:function(e,a,i,n,r){function s(t,e){this.matches=[],this.isGroup=t||!1,this.isQuantifier=e||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function o(){var t,e,a=new s,i=[];for(r.regexTokens=[];t=r.tokenizer.exec(r.regex);)switch(e=t[0],e.charAt(0)){case"(":i.push(new s(!0));break;case")":var n=i.pop();i.length>0?i[i.length-1].matches.push(n):a.matches.push(n);break;case"{":case"+":case"*":var o=new s(!1,!0);e=e.replace(/[{}]/g,"");var l=e.split(","),c=isNaN(l[0])?l[0]:parseInt(l[0]),h=1==l.length?c:isNaN(l[1])?l[1]:parseInt(l[1]);if(o.quantifier={min:c,max:h},i.length>0){var u=i[i.length-1].matches;if(t=u.pop(),!t.isGroup){var n=new s(!0);n.matches.push(t),t=n}u.push(t),u.push(o)}else{if(t=a.matches.pop(),!t.isGroup){var n=new s(!0);n.matches.push(t),t=n}a.matches.push(t),a.matches.push(o)}break;default:i.length>0?i[i.length-1].matches.push(e):a.matches.push(e)}a.matches.length>0&&r.regexTokens.push(a)}function l(e,a){var i=!1;a&&(h+="(",d++);for(var n=0;n<e.matches.length;n++){var r=e.matches[n];if(1==r.isGroup)i=l(r,!0);else if(1==r.isQuantifier){var s=t.inArray(r,e.matches),o=e.matches[s-1],c=h;if(isNaN(r.quantifier.max)){for(;r.repeaterPart&&r.repeaterPart!=h&&r.repeaterPart.length>h.length&&!(i=l(o,!0)););i=i||l(o,!0),i&&(r.repeaterPart=h),h=c+r.quantifier.max}else{for(var u=0,f=r.quantifier.max-1;f>u&&!(i=l(o,!0));u++);h=c+"{"+r.quantifier.min+","+r.quantifier.max+"}"}}else if(void 0!=r.matches)for(var v=0;v<r.length&&!(i=l(r[v],a));v++);else{var m;if("["==r.charAt(0)){m=h,m+=r;for(var g=0;d>g;g++)m+=")";var y=new RegExp("^("+m+")$");i=y.test(p)}else for(var k=0,b=r.length;b>k;k++)if("\\"!=r.charAt(k)){m=h,m+=r.substr(0,k+1),m=m.replace(/\|$/,"");for(var g=0;d>g;g++)m+=")";var y=new RegExp("^("+m+")$");if(i=y.test(p))break}h+=r}if(i)break}return a&&(h+=")",d--),i}null==r.regexTokens&&o();var c=a.buffer.slice(),h="",u=!1,d=0;c.splice(i,0,e);for(var p=c.join(""),f=0;f<r.regexTokens.length;f++){var s=r.regexTokens[f];if(u=l(s,s.isGroup))break}return u},cardinality:1}}}}),t.fn.inputmask}(jQuery),jQuery(document).ready(function(t){jQuery(document).on("cf.add",function(){t("[data-inputmask]").inputmask()}),jQuery(document).trigger("cf.add")}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){function e(){var t=document.createElement("input");return t.setAttribute("type","range"),"text"!==t.type}function a(t,e){var a=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return t.apply(null,a)},e)}function i(t,e){return e=e||100,function(){if(!t.debouncing){var a=Array.prototype.slice.apply(arguments);t.lastReturnVal=t.apply(window,a),t.debouncing=!0}return clearTimeout(t.debounceTimeout),t.debounceTimeout=setTimeout(function(){t.debouncing=!1},e),t.lastReturnVal}}function n(e,n){if(this.$window=t(window),this.$document=t(document),this.$element=t(e),this.options=t.extend({},l,n),this._defaults=l,this._name=r,this.startEvent=this.options.startEvent.join("."+r+" ")+"."+r,this.moveEvent=this.options.moveEvent.join("."+r+" ")+"."+r,this.endEvent=this.options.endEvent.join("."+r+" ")+"."+r,this.polyfill=this.options.polyfill,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.polyfill&&o)return!1;this.identifier="js-"+r+"-"+ +new Date,this.min=parseFloat(this.$element[0].getAttribute("min")||0),this.max=parseFloat(this.$element[0].getAttribute("max")||100),this.value=parseFloat(this.$element[0].value||this.min+(this.max-this.min)/2),this.step=parseFloat(this.$element[0].getAttribute("step")||1),this.$fill=t('<div class="'+this.options.fillClass+'" />'),this.$handle=t('<div class="'+this.options.handleClass+'" />'),this.$range=t('<div class="'+this.options.rangeClass+'" id="'+this.identifier+'" />').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=t.proxy(this.handleDown,this),this.handleMove=t.proxy(this.handleMove,this),this.handleEnd=t.proxy(this.handleEnd,this),this.init();var s=this;this.$window.on("resize."+r,i(function(){a(function(){s.update()},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+r,function(t,e){if(!e||e.origin!==r){var a=t.target.value,i=s.getPositionFromValue(a);s.setPosition(i)}})}var r="rangeslider",s=[],o=e(),l={polyfill:!0,rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]};n.prototype.init=function(){this.onInit&&"function"==typeof this.onInit&&this.onInit(),this.update()},n.prototype.update=function(){this.handleWidth=this.$handle[0].offsetWidth,this.rangeWidth=this.$range[0].offsetWidth,this.maxHandleX=this.rangeWidth-this.handleWidth,this.grabX=this.handleWidth/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position)},n.prototype.handleDown=function(t){if(t.preventDefault(),this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+t.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var e=this.getRelativePosition(this.$range[0],t),a=this.getPositionFromNode(this.$handle[0])-this.getPositionFromNode(this.$range[0]);this.setPosition(e-this.grabX),e>=a&&e<a+this.handleWidth&&(this.grabX=e-a)}},n.prototype.handleMove=function(t){t.preventDefault();var e=this.getRelativePosition(this.$range[0],t);this.setPosition(e-this.grabX)},n.prototype.handleEnd=function(t){t.preventDefault(),this.$document.off(this.moveEvent,this.handleMove),this.$document.off(this.endEvent,this.handleEnd);var e=this.getRelativePosition(this.$range[0],t);this.onSlideEnd&&"function"==typeof this.onSlideEnd&&this.onSlideEnd(e-this.grabX,this.value)},n.prototype.cap=function(t,e,a){return e>t?e:t>a?a:t},n.prototype.setPosition=function(t){var e,a;e=this.getValueFromPosition(this.cap(t,0,this.maxHandleX))/this.step*this.step,a=this.getPositionFromValue(e),this.$fill[0].style.width=a+this.grabX+"px",this.$handle[0].style.left=a+"px",this.setValue(e),this.position=a,this.value=e,this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(a,e)},n.prototype.getPositionFromNode=function(t){for(var e=0;null!==t;)e+=t.offsetLeft,t=t.offsetParent;return e},n.prototype.getRelativePosition=function(t,e){return(e.pageX||e.originalEvent.clientX||e.originalEvent.touches[0].clientX||e.currentPoint.x)-this.getPositionFromNode(t)},n.prototype.getPositionFromValue=function(t){var e,a;return e=(t-this.min)/(this.max-this.min),a=e*this.maxHandleX},n.prototype.getValueFromPosition=function(t){var e,a;return e=t/(this.maxHandleX||1),a=this.step*Math.ceil((e*(this.max-this.min)+this.min)/this.step),Number(a.toFixed(2))},n.prototype.setValue=function(t){t!==this.value&&this.$element.val(t).trigger("change",{origin:r})},n.prototype.destroy=function(){this.$document.off(this.startEvent,"#"+this.identifier,this.handleDown),this.$element.off("."+r).removeAttr("style").removeData("plugin_"+r),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0]),s.splice(s.indexOf(this.$element[0]),1),s.length||this.$window.off("."+r)},t.fn[r]=function(e){return this.each(function(){var a=t(this),i=a.data("plugin_"+r);i||(a.data("plugin_"+r,i=new n(this,e)),s.push(this)),"string"==typeof e&&i[e]()})}}),function(t){"use strict";var e={init:function(a){return this.each(function(){this.self=t(this),e.destroy.call(this.self),this.opt=t.extend(!0,{},t.fn.raty.defaults,a),e._adjustCallback.call(this),e._adjustNumber.call(this),"img"!==this.opt.starType&&e._adjustStarType.call(this),e._adjustPath.call(this),e._createStars.call(this),this.opt.cancel&&e._createCancel.call(this),this.opt.precision&&e._adjustPrecision.call(this),e._createScore.call(this),e._apply.call(this,this.opt.score),e._target.call(this,this.opt.score),this.opt.readOnly?e._lock.call(this):(this.style.cursor="pointer",e._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName"],e=0;e<t.length;e++)"function"==typeof this.opt[t[e]]&&(this.opt[t[e]]=this.opt[t[e]].call(this))},_adjustNumber:function(){this.opt.number=e._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var t=["cancelOff","cancelOn","starHalf","starOff","starOn"],e=0;e<t.length;e++)this.opt[t[e]]=this.opt[t[e]].replace(".","-")},_apply:function(t){e._fill.call(this,t),t&&(t>0&&this.score.val(e._between(t,0,this.opt.number)),e._roundStars.call(this,t))},_between:function(t,e,a){return Math.min(Math.max(parseFloat(t),e),a)},_binds:function(){this.cancel&&(e._bindOverCancel.call(this),
|
4 |
-
|
1 |
+
function color_picker_init(){jQuery(".minicolor-picker").miniColors()}function toggle_button_init(a,b){var c=jQuery(b),d=c.find(".cf-toggle-group-radio:checked");d.length&&jQuery("#"+d.data("ref")).trigger("click")}jQuery&&function(a){a.extend(a.fn,{miniColors:function(b,c){var d=function(b,c,d){var e=s(b.val());e||(e="ffffff");var f=x(e),h=a('<span class="input-group-addon" style="background-color: #'+e+'" href="#"></span>');h.insertAfter(b),b.addClass("miniColors").data("original-maxlength",b.attr("maxlength")||null).data("original-autocomplete",b.attr("autocomplete")||null).data("letterCase",c.letterCase?c.letterCase:"uppercase").data("trigger",h).data("hsb",f).data("change",c.change?c.change:null).data("close",c.close?c.close:null).data("open",c.open?c.open:null).attr("maxlength",7).attr("autocomplete","off").val("#"+o(e,c.letterCase)).trigger("change"),c.readonly&&b.prop("readonly",!0),c.disabled&&g(b),h.on("click.miniColors",function(a){a.preventDefault(),""===b.val()&&b.val("#").trigger("change"),i(b)}),b.on("focus.miniColors",function(a){""===b.val()&&b.val("#").trigger("change"),i(b)}),b.on("blur.miniColors",function(a){var c=s(y(b.data("hsb")));b.val(c?"#"+o(c,b.data("letterCase")):"").trigger("change")}),b.on("keydown.miniColors",function(a){9===a.keyCode&&j(b)}),b.on("keyup.miniColors",function(a){n(b)}),b.on("paste.miniColors",function(a){setTimeout(function(){n(b)},5)})},e=function(b){j(),b=a(b),b.data("trigger").remove(),b.attr("autocomplete",b.data("original-autocomplete")).attr("maxlength",b.data("original-maxlength")).removeData().removeClass("miniColors").off(".miniColors"),a(document).off(".miniColors")},f=function(a){a.prop("disabled",!1).data("trigger").css("opacity",1)},g=function(a){j(a),a.prop("disabled",!0).data("trigger").css("opacity",.5)},i=function(b){if(b.prop("disabled"))return!1;j();var c=a('<div class="miniColors-selector"></div>');c.append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').css("display","none").addClass(b.attr("class")).removeClass("form-control");var d=b.data("hsb");c.find(".miniColors-colors").css("backgroundColor","#"+y({h:d.h,s:100,b:100}));var e=b.data("colorPosition");e||(e=p(d)),c.find(".miniColors-colorPicker").css("top",e.y+"px").css("left",e.x+"px");var f=b.data("huePosition");f||(f=q(d)),c.find(".miniColors-huePicker").css("top",f.y+"px"),b.data("selector",c).data("huePicker",c.find(".miniColors-huePicker")).data("colorPicker",c.find(".miniColors-colorPicker")).data("mousebutton",0),a("BODY").append(c);var g=b.data("trigger"),h=!b.is(":visible"),i=h?g.offset().top+g.outerHeight():b.offset().top+b.outerHeight(),m=h?g.offset().left:b.offset().left,n=c.outerWidth(),o=c.outerHeight(),r=g.outerWidth(),s=g.outerHeight(),u=a(window).height(),v=a(window).width(),w=a(window).scrollTop(),x=a(window).scrollLeft();i+o>u+w&&(i=i-o-s),m+n>v+x&&(m=m-n+r),c.css({top:i,left:m}).fadeIn(100),c.on("selectstart",function(){return!1}),(!a.browser.msie||a.browser.msie&&a.browser.version>=9)&&a(window).on("resize.miniColors",function(a){j(b)}),a(document).on("mousedown.miniColors touchstart.miniColors",function(c){b.data("mousebutton",1);var d=a(c.target).parents().andSelf();return d.hasClass("miniColors-colors")&&(c.preventDefault(),b.data("moving","colors"),k(b,c)),d.hasClass("miniColors-hues")&&(c.preventDefault(),b.data("moving","hues"),l(b,c)),d.hasClass("miniColors-selector")?void c.preventDefault():void(d.hasClass("miniColors")||j(b))}),a(document).on("mouseup.miniColors touchend.miniColors",function(a){a.preventDefault(),b.data("mousebutton",0).removeData("moving")}).on("mousemove.miniColors touchmove.miniColors",function(a){a.preventDefault(),1===b.data("mousebutton")&&("colors"===b.data("moving")&&k(b,a),"hues"===b.data("moving")&&l(b,a))}),b.data("open")&&b.data("open").call(b.get(0),"#"+y(d),t(d))},j=function(b){b||(b=a(".miniColors")),b.each(function(){var c=a(this).data("selector");a(this).removeData("selector"),a(c).fadeOut(100,function(){if(b.data("close")){var c=b.data("hsb"),d=y(c);b.data("close").call(b.get(0),"#"+d,t(c))}a(this).remove()})}),a(document).off(".miniColors")},k=function(a,b){var c=a.data("colorPicker");c.hide();var d={x:b.pageX,y:b.pageY};b.originalEvent.changedTouches&&(d.x=b.originalEvent.changedTouches[0].pageX,d.y=b.originalEvent.changedTouches[0].pageY),d.x=d.x-a.data("selector").find(".miniColors-colors").offset().left-5,d.y=d.y-a.data("selector").find(".miniColors-colors").offset().top-5,d.x<=-5&&(d.x=-5),d.x>=144&&(d.x=144),d.y<=-5&&(d.y=-5),d.y>=144&&(d.y=144),a.data("colorPosition",d),c.css("left",d.x).css("top",d.y).show();var e=Math.round(.67*(d.x+5));e<0&&(e=0),e>100&&(e=100);var f=100-Math.round(.67*(d.y+5));f<0&&(f=0),f>100&&(f=100);var g=a.data("hsb");g.s=e,g.b=f,m(a,g,!0)},l=function(a,b){var c=a.data("huePicker");c.hide();var d={y:b.pageY};b.originalEvent.changedTouches&&(d.y=b.originalEvent.changedTouches[0].pageY),d.y=d.y-a.data("selector").find(".miniColors-colors").offset().top-1,d.y<=-1&&(d.y=-1),d.y>=149&&(d.y=149),a.data("huePosition",d),c.css("top",d.y).show();var e=Math.round(2.4*(150-d.y-1));e<0&&(e=0),e>360&&(e=360);var f=a.data("hsb");f.h=e,m(a,f,!0)},m=function(a,b,c){a.data("hsb",b);var d=y(b);if(c&&a.val("#"+o(d,a.data("letterCase"))).trigger("change"),a.data("trigger").css("backgroundColor","#"+d),a.data("selector")&&a.data("selector").find(".miniColors-colors").css("backgroundColor","#"+y({h:b.h,s:100,b:100})),a.data("change")){if(d===a.data("lastChange"))return;a.data("change").call(a.get(0),"#"+d,t(b)),a.data("lastChange",d)}},n=function(b){b.val("#"+r(b.val())).trigger("change");var c=s(b.val());if(!c)return!1;var d=x(c),e=b.data("hsb");if(d.h===e.h&&d.s===e.s&&d.b===e.b)return!0;var f=p(d),g=a(b.data("colorPicker"));g.css("top",f.y+"px").css("left",f.x+"px"),b.data("colorPosition",f);var h=q(d),i=a(b.data("huePicker"));return i.css("top",h.y+"px"),b.data("huePosition",h),m(b,d),!0},o=function(a,b){return"lowercase"===b?a.toLowerCase():"uppercase"===b?a.toUpperCase():a},p=function(a){var b=Math.ceil(a.s/.67);b<0&&(b=0),b>150&&(b=150);var c=150-Math.ceil(a.b/.67);return c<0&&(c=0),c>150&&(c=150),{x:b-5,y:c-5}},q=function(a){var b=150-a.h/2.4;return b<0&&(h=0),b>150&&(h=150),{y:b-1}},r=function(a){return a.replace(/[^A-F0-9]/gi,"")},s=function(a){return(a=r(a))?(3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),6===a.length?a:null):null},t=function(a){var b={},c=Math.round(a.h),d=Math.round(255*a.s/100),e=Math.round(255*a.b/100);if(0===d)b.r=b.g=b.b=e;else{var f=e,g=(255-d)*e/255,h=(f-g)*(c%60)/60;360===c&&(c=0),c<60?(b.r=f,b.b=g,b.g=g+h):c<120?(b.g=f,b.b=g,b.r=f-h):c<180?(b.g=f,b.r=g,b.b=g+h):c<240?(b.b=f,b.r=g,b.g=f-h):c<300?(b.b=f,b.g=g,b.r=g+h):c<360?(b.r=f,b.g=g,b.b=f-h):(b.r=0,b.g=0,b.b=0)}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}},u=function(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];return a.each(c,function(a,b){1===b.length&&(c[a]="0"+b)}),c.join("")},v=function(a){return a=parseInt(a.indexOf("#")>-1?a.substring(1):a,16),{r:a>>16,g:(65280&a)>>8,b:255&a}},w=function(a){var b={h:0,s:0,b:0},c=Math.min(a.r,a.g,a.b),d=Math.max(a.r,a.g,a.b),e=d-c;return b.b=d,b.s=0!==d?255*e/d:0,0!==b.s?a.r===d?b.h=(a.g-a.b)/e:a.g===d?b.h=2+(a.b-a.r)/e:b.h=4+(a.r-a.g)/e:b.h=-1,b.h*=60,b.h<0&&(b.h+=360),b.s*=100/255,b.b*=100/255,b},x=function(a){var b=w(v(a));return 0===b.s&&(b.h=360),b},y=function(a){return u(t(a))};switch(b){case"readonly":return a(this).each(function(){a(this).hasClass("miniColors")&&a(this).prop("readonly",c)}),a(this);case"disabled":return a(this).each(function(){a(this).hasClass("miniColors")&&(c?g(a(this)):f(a(this)))}),a(this);case"value":if(void 0===c){if(!a(this).hasClass("miniColors"))return;var z=a(this),A=s(z.val());return A?"#"+o(A,z.data("letterCase")):null}return a(this).each(function(){a(this).hasClass("miniColors")&&(a(this).val(c).trigger("change"),n(a(this)))}),a(this);case"destroy":return a(this).each(function(){a(this).hasClass("miniColors")&&e(a(this))}),a(this);default:return b||(b={}),a(this).each(function(){"input"===a(this)[0].tagName.toLowerCase()&&(a(this).data("trigger")||d(a(this),b,c))}),a(this)}}})}(jQuery),document.addEventListener("load",color_picker_init,!1),jQuery(document).ajaxComplete(function(){color_picker_init()}),function(a,b){function d(){return new Date(Date.UTC.apply(Date,arguments))}function e(){var a=new Date;return d(a.getFullYear(),a.getMonth(),a.getDate())}function f(a){return function(){return this[a].apply(this,arguments)}}function j(b,c){function h(a,b){return b.toLowerCase()}var f,d=a(b).data(),e={},g=new RegExp("^"+c.toLowerCase()+"([A-Z])");c=new RegExp("^"+c.toLowerCase());for(var i in d)c.test(i)&&(f=i.replace(g,h),e[f]=d[i]);return e}function k(b){var c={};if(o[b]||(b=b.split("-")[0],o[b])){var d=o[b];return a.each(n,function(a,b){b in d&&(c[b]=d[b])}),c}}var c=a(window),g=function(){var b={get:function(a){return this.slice(a)[0]},contains:function(a){for(var b=a&&a.valueOf(),c=0,d=this.length;c<d;c++)if(this[c].valueOf()===b)return c;return-1},remove:function(a){this.splice(a,1)},replace:function(b){b&&(a.isArray(b)||(b=[b]),this.clear(),this.push.apply(this,b))},clear:function(){this.splice(0)},copy:function(){var a=new g;return a.replace(this),a}};return function(){var c=[];return c.push.apply(c,arguments),a.extend(c,b),c}}(),h=function(b,c){this.dates=new g,this.viewDate=e(),this.focusDate=null,this._process_options(c),this.element=a(b),this.isInline=!1,this.isInput=this.element.is("input"),this.component=!!this.element.is(".date")&&this.element.find(".add-on, .input-group-addon, .btn"),this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=a(p.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("cfdatepicker-inline").appendTo(this.element):this.picker.addClass("cfdatepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("cfdatepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("tfoot th.today").attr("colspan",function(a,b){return parseInt(b)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};h.prototype={constructor:h,_process_options:function(b){this._o=a.extend({},this._o,b);var c=this.o=a.extend({},this._o),d=c.language;switch(o[d]||(d=d.split("-")[0],o[d]||(d=m.language)),c.language=d,c.startView){case 2:case"decade":c.startView=2;break;case 1:case"year":c.startView=1;break;default:c.startView=0}switch(c.minViewMode){case 1:case"months":c.minViewMode=1;break;case 2:case"years":c.minViewMode=2;break;default:c.minViewMode=0}c.startView=Math.max(c.startView,c.minViewMode),c.multidate!==!0&&(c.multidate=Number(c.multidate)||!1,c.multidate!==!1?c.multidate=Math.max(0,c.multidate):c.multidate=1),c.multidateSeparator=String(c.multidateSeparator),c.weekStart%=7,c.weekEnd=(c.weekStart+6)%7;var e=p.parseFormat(c.format);c.startDate!==-(1/0)&&(c.startDate?c.startDate instanceof Date?c.startDate=this._local_to_utc(this._zero_time(c.startDate)):c.startDate=p.parseDate(c.startDate,e,c.language):c.startDate=-(1/0)),c.endDate!==1/0&&(c.endDate?c.endDate instanceof Date?c.endDate=this._local_to_utc(this._zero_time(c.endDate)):c.endDate=p.parseDate(c.endDate,e,c.language):c.endDate=1/0),c.daysOfWeekDisabled=c.daysOfWeekDisabled||[],a.isArray(c.daysOfWeekDisabled)||(c.daysOfWeekDisabled=c.daysOfWeekDisabled.split(/[,\s]*/)),c.daysOfWeekDisabled=a.map(c.daysOfWeekDisabled,function(a){return parseInt(a,10)});var f=String(c.orientation).toLowerCase().split(/\s+/g),g=c.orientation.toLowerCase();if(f=a.grep(f,function(a){return/^auto|left|right|top|bottom$/.test(a)}),c.orientation={x:"auto",y:"auto"},g&&"auto"!==g)if(1===f.length)switch(f[0]){case"top":case"bottom":c.orientation.y=f[0];break;case"left":case"right":c.orientation.x=f[0]}else g=a.grep(f,function(a){return/^left|right$/.test(a)}),c.orientation.x=g[0]||"auto",g=a.grep(f,function(a){return/^top|bottom$/.test(a)}),c.orientation.y=g[0]||"auto";else;},_events:[],_secondaryEvents:[],_applyEvents:function(a){for(var d,e,f,c=0;c<a.length;c++)d=a[c][0],2===a[c].length?(e=b,f=a[c][1]):3===a[c].length&&(e=a[c][1],f=a[c][2]),d.on(f,e)},_unapplyEvents:function(a){for(var d,e,f,c=0;c<a.length;c++)d=a[c][0],2===a[c].length?(f=b,e=a[c][1]):3===a[c].length&&(f=a[c][1],e=a[c][2]),d.off(e,f)},_buildEvents:function(){this.isInput?this._events=[[this.element,{focus:a.proxy(this.show,this),keyup:a.proxy(function(b){a.inArray(b.keyCode,[27,37,39,38,40,32,13,9])===-1&&this.update()},this),keydown:a.proxy(this.keydown,this)}]]:this.component&&this.hasInput?this._events=[[this.element.find("input"),{focus:a.proxy(this.show,this),keyup:a.proxy(function(b){a.inArray(b.keyCode,[27,37,39,38,40,32,13,9])===-1&&this.update()},this),keydown:a.proxy(this.keydown,this)}],[this.component,{click:a.proxy(this.show,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:a.proxy(this.show,this)}]],this._events.push([this.element,"*",{blur:a.proxy(function(a){this._focused_from=a.target},this)}],[this.element,{blur:a.proxy(function(a){this._focused_from=a.target},this)}]),this._secondaryEvents=[[this.picker,{click:a.proxy(this.click,this)}],[a(window),{resize:a.proxy(this.place,this)}],[a(document),{"mousedown touchstart":a.proxy(function(a){this.element.is(a.target)||this.element.find(a.target).length||this.picker.is(a.target)||this.picker.find(a.target).length||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(b,c){var d=c||this.dates.get(-1),e=this._utc_to_local(d);this.element.trigger({type:b,date:e,dates:a.map(this.dates,this._utc_to_local),format:a.proxy(function(a,b){0===arguments.length?(a=this.dates.length-1,b=this.o.format):"string"==typeof a&&(b=a,a=this.dates.length-1),b=b||this.o.format;var c=this.dates.get(a);return p.formatDate(c,b,this.o.language)},this)})},show:function(){this.isInline||this.picker.appendTo("body"),this.picker.show(),this.place(),this._attachSecondaryEvents(),this._trigger("show")},hide:function(){this.isInline||this.picker.is(":visible")&&(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this._trigger("hide"))},remove:function(){this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().cfdatepicker,this.isInput||delete this.element.data().date},_utc_to_local:function(a){return a&&new Date(a.getTime()+6e4*a.getTimezoneOffset())},_local_to_utc:function(a){return a&&new Date(a.getTime()-6e4*a.getTimezoneOffset())},_zero_time:function(a){return a&&new Date(a.getFullYear(),a.getMonth(),a.getDate())},_zero_utc_time:function(a){return a&&new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))},getDates:function(){return a.map(this.dates,this._utc_to_local)},getUTCDates:function(){return a.map(this.dates,function(a){return new Date(a)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){return new Date(this.dates.get(-1))},setDates:function(){var b=a.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,b),this._trigger("changeDate"),this.setValue()},setUTCDates:function(){var b=a.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,a.map(b,this._utc_to_local)),this._trigger("changeDate"),this.setValue()},setDate:f("setDates"),setUTCDate:f("setUTCDates"),setValue:function(){var a=this.getFormattedDate();this.isInput?this.element.val(a).change():this.component&&this.element.find("input").val(a).change()},getFormattedDate:function(c){c===b&&(c=this.o.format);var d=this.o.language;return a.map(this.dates,function(a){return p.formatDate(a,c,d)}).join(this.o.multidateSeparator)},setStartDate:function(a){this._process_options({startDate:a}),this.update(),this.updateNavArrows()},setEndDate:function(a){this._process_options({endDate:a}),this.update(),this.updateNavArrows()},setDaysOfWeekDisabled:function(a){this._process_options({daysOfWeekDisabled:a}),this.update(),this.updateNavArrows()},place:function(){if(!this.isInline){var k,b=this.picker.outerWidth(),d=this.picker.outerHeight(),e=10,f=c.width(),g=c.height(),h=c.scrollTop(),i=jQuery(this.element).data("form-id"),j=document.getElementById("modal-"+i+"-content");k=null!==j?1e4:parseInt(this.element.parents().filter(function(){return"auto"!==a(this).css("z-index")}).first().css("z-index"))+10;var l=this.component?this.component.parent().offset():this.element.offset(),m=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),n=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),o=l.left,p=l.top;this.picker.removeClass("cfdatepicker-orient-top cfdatepicker-orient-bottom cfdatepicker-orient-right cfdatepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("cfdatepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(o-=b-n)):(this.picker.addClass("cfdatepicker-orient-left"),l.left<0?o-=l.left-e:l.left+b>f&&(o=f-b-e));var r,s,q=this.o.orientation.y;"auto"===q&&(r=-h+l.top-d,s=h+g-(l.top+m+d),q=Math.max(r,s)===s?"top":"bottom"),this.picker.addClass("cfdatepicker-orient-"+q),"top"===q?p+=m:p-=d+parseInt(this.picker.css("padding-top")),this.picker.css({top:p,left:o,zIndex:k})}},_allow_update:!0,update:function(){if(this._allow_update){var b=this.dates.copy(),c=[],d=!1;arguments.length?(a.each(arguments,a.proxy(function(a,b){b instanceof Date&&(b=this._local_to_utc(b)),c.push(b)},this)),d=!0):(c=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),c=c&&this.o.multidate?c.split(this.o.multidateSeparator):[c],delete this.element.data().date),c=a.map(c,a.proxy(function(a){return p.parseDate(a,this.o.format,this.o.language)},this)),c=a.grep(c,a.proxy(function(a){return a<this.o.startDate||a>this.o.endDate||!a},this),!0),this.dates.replace(c),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate&&(this.viewDate=new Date(this.o.endDate)),d?this.setValue():c.length&&String(b)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&b.length&&this._trigger("clearDate"),this.fill()}},fillDow:function(){var a=this.o.weekStart,b="<tr>";if(this.o.calendarWeeks){var c='<th class="cw"> </th>';b+=c,this.picker.find(".cfdatepicker-days thead tr:first-child").prepend(c)}for(;a<this.o.weekStart+7;)b+='<th class="dow">'+o[this.o.language].daysMin[a++%7]+"</th>";b+="</tr>",this.picker.find(".cfdatepicker-days thead").append(b)},fillMonths:function(){for(var a="",b=0;b<12;)a+='<span class="month">'+o[this.o.language].monthsShort[b++]+"</span>";this.picker.find(".cfdatepicker-months td").html(a)},setRange:function(b){b&&b.length?this.range=a.map(b,function(a){return a.valueOf()}):delete this.range,this.fill()},getClassNames:function(b){var c=[],d=this.viewDate.getUTCFullYear(),e=this.viewDate.getUTCMonth(),f=new Date;return b.getUTCFullYear()<d||b.getUTCFullYear()===d&&b.getUTCMonth()<e?c.push("old"):(b.getUTCFullYear()>d||b.getUTCFullYear()===d&&b.getUTCMonth()>e)&&c.push("new"),this.focusDate&&b.valueOf()===this.focusDate.valueOf()&&c.push("focused"),this.o.todayHighlight&&b.getUTCFullYear()===f.getFullYear()&&b.getUTCMonth()===f.getMonth()&&b.getUTCDate()===f.getDate()&&c.push("today"),this.dates.contains(b)!==-1&&c.push("active"),(b.valueOf()<this.o.startDate||b.valueOf()>this.o.endDate||a.inArray(b.getUTCDay(),this.o.daysOfWeekDisabled)!==-1)&&c.push("disabled"),this.range&&(b>this.range[0]&&b<this.range[this.range.length-1]&&c.push("range"),a.inArray(b.valueOf(),this.range)!==-1&&c.push("selected")),c},fill:function(){var m,c=new Date(this.viewDate),e=c.getUTCFullYear(),f=c.getUTCMonth(),g=this.o.startDate!==-(1/0)?this.o.startDate.getUTCFullYear():-(1/0),h=this.o.startDate!==-(1/0)?this.o.startDate.getUTCMonth():-(1/0),i=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,j=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,k=o[this.o.language].today||o.en.today||"",l=o[this.o.language].clear||o.en.clear||"";this.picker.find(".cfdatepicker-days thead th.cfdatepicker-switch").text(o[this.o.language].months[f]+" "+e),this.picker.find("tfoot th.today").text(k).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot th.clear").text(l).toggle(this.o.clearBtn!==!1),this.updateNavArrows(),this.fillMonths();var n=d(e,f-1,28),q=p.getDaysInMonth(n.getUTCFullYear(),n.getUTCMonth());n.setUTCDate(q),n.setUTCDate(q-(n.getUTCDay()-this.o.weekStart+7)%7);var r=new Date(n);r.setUTCDate(r.getUTCDate()+42),r=r.valueOf();for(var t,s=[];n.valueOf()<r;){if(n.getUTCDay()===this.o.weekStart&&(s.push("<tr>"),this.o.calendarWeeks)){var u=new Date(+n+(this.o.weekStart-n.getUTCDay()-7)%7*864e5),v=new Date(Number(u)+(11-u.getUTCDay())%7*864e5),w=new Date(Number(w=d(v.getUTCFullYear(),0,1))+(11-w.getUTCDay())%7*864e5),x=(v-w)/864e5/7+1;s.push('<td class="cw">'+x+"</td>")}if(t=this.getClassNames(n),t.push("day"),this.o.beforeShowDay!==a.noop){var y=this.o.beforeShowDay(this._utc_to_local(n));y===b?y={}:"boolean"==typeof y?y={enabled:y}:"string"==typeof y&&(y={classes:y}),y.enabled===!1&&t.push("disabled"),y.classes&&(t=t.concat(y.classes.split(/\s+/))),y.tooltip&&(m=y.tooltip)}t=a.unique(t),s.push('<td class="'+t.join(" ")+'"'+(m?' title="'+m+'"':"")+">"+n.getUTCDate()+"</td>"),n.getUTCDay()===this.o.weekEnd&&s.push("</tr>"),n.setUTCDate(n.getUTCDate()+1)}this.picker.find(".cfdatepicker-days tbody").empty().append(s.join(""));var z=this.picker.find(".cfdatepicker-months").find("th:eq(1)").text(e).end().find("span").removeClass("active");a.each(this.dates,function(a,b){b.getUTCFullYear()===e&&z.eq(b.getUTCMonth()).addClass("active")}),(e<g||e>i)&&z.addClass("disabled"),e===g&&z.slice(0,h).addClass("disabled"),e===i&&z.slice(j+1).addClass("disabled"),s="",e=10*parseInt(e/10,10);var A=this.picker.find(".cfdatepicker-years").find("th:eq(1)").text(e+"-"+(e+9)).end().find("td");e-=1;for(var C,B=a.map(this.dates,function(a){return a.getUTCFullYear()}),D=-1;D<11;D++)C=["year"],D===-1?C.push("old"):10===D&&C.push("new"),a.inArray(e,B)!==-1&&C.push("active"),(e<g||e>i)&&C.push("disabled"),s+='<span class="'+C.join(" ")+'">'+e+"</span>",e+=1;A.html(s)},updateNavArrows:function(){if(this._allow_update){var a=new Date(this.viewDate),b=a.getUTCFullYear(),c=a.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-(1/0)&&b<=this.o.startDate.getUTCFullYear()&&c<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&b>=this.o.endDate.getUTCFullYear()&&c>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-(1/0)&&b<=this.o.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&b>=this.o.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(b){b.preventDefault();var e,f,g,c=a(b.target).closest("span, td, th");if(1===c.length)switch(c[0].nodeName.toLowerCase()){case"th":switch(c[0].className){case"cfdatepicker-switch":this.showMode(1);break;case"prev":case"next":var h=p.modes[this.viewMode].navStep*("prev"===c[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,h),this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,h),1===this.viewMode&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":var i=new Date;i=d(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0),this.showMode(-2);var j="linked"===this.o.todayBtn?null:"view";this._setDate(i,j);break;case"clear":var k;this.isInput?k=this.element:this.component&&(k=this.element.find("input")),k&&k.val("").change(),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()}break;case"span":c.is(".disabled")||(this.viewDate.setUTCDate(1),c.is(".month")?(g=1,f=c.parent().find("span").index(c),e=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(f),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(d(e,f,g))):(g=1,f=0,e=parseInt(c.text(),10)||0,this.viewDate.setUTCFullYear(e),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(d(e,f,g))),this.showMode(-1),this.fill());break;case"td":c.is(".day")&&!c.is(".disabled")&&(g=parseInt(c.text(),10)||1,e=this.viewDate.getUTCFullYear(),f=this.viewDate.getUTCMonth(),c.is(".old")?0===f?(f=11,e-=1):f-=1:c.is(".new")&&(11===f?(f=0,e+=1):f+=1),this._setDate(d(e,f,g)))}this.picker.is(":visible")&&this._focused_from&&a(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(a){var b=this.dates.contains(a);if(a?b!==-1?this.dates.remove(b):this.dates.push(a):this.dates.clear(),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(a,b){b&&"date"!==b||this._toggle_multidate(a&&new Date(a)),b&&"view"!==b||(this.viewDate=a&&new Date(a)),this.fill(),this.setValue(),this._trigger("changeDate");var c;this.isInput?c=this.element:this.component&&(c=this.element.find("input")),c&&c.change(),!this.o.autoclose||b&&"date"!==b||this.hide()},moveMonth:function(a,c){if(!a)return b;if(!c)return a;var h,i,d=new Date(a.valueOf()),e=d.getUTCDate(),f=d.getUTCMonth(),g=Math.abs(c);if(c=c>0?1:-1,1===g)i=c===-1?function(){return d.getUTCMonth()===f}:function(){return d.getUTCMonth()!==h},h=f+c,d.setUTCMonth(h),(h<0||h>11)&&(h=(h+12)%12);else{for(var j=0;j<g;j++)d=this.moveMonth(d,c);h=d.getUTCMonth(),d.setUTCDate(e),i=function(){return h!==d.getUTCMonth()}}for(;i();)d.setUTCDate(--e),d.setUTCMonth(h);return d},moveYear:function(a,b){return this.moveMonth(a,12*b)},dateWithinRange:function(a){return a>=this.o.startDate&&a<=this.o.endDate},keydown:function(a){if(this.picker.is(":not(:visible)"))return void(27===a.keyCode&&this.show());var c,d,f,b=!1,g=this.focusDate||this.viewDate;switch(a.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),a.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;c=37===a.keyCode?-1:1,a.ctrlKey?(d=this.moveYear(this.dates.get(-1)||e(),c),f=this.moveYear(g,c),this._trigger("changeYear",this.viewDate)):a.shiftKey?(d=this.moveMonth(this.dates.get(-1)||e(),c),f=this.moveMonth(g,c),this._trigger("changeMonth",this.viewDate)):(d=new Date(this.dates.get(-1)||e()),d.setUTCDate(d.getUTCDate()+c),f=new Date(g),f.setUTCDate(g.getUTCDate()+c)),this.dateWithinRange(d)&&(this.focusDate=this.viewDate=f,this.setValue(),this.fill(),a.preventDefault());break;case 38:case 40:if(!this.o.keyboardNavigation)break;c=38===a.keyCode?-1:1,a.ctrlKey?(d=this.moveYear(this.dates.get(-1)||e(),c),f=this.moveYear(g,c),this._trigger("changeYear",this.viewDate)):a.shiftKey?(d=this.moveMonth(this.dates.get(-1)||e(),c),f=this.moveMonth(g,c),this._trigger("changeMonth",this.viewDate)):(d=new Date(this.dates.get(-1)||e()),d.setUTCDate(d.getUTCDate()+7*c),f=new Date(g),f.setUTCDate(g.getUTCDate()+7*c)),this.dateWithinRange(d)&&(this.focusDate=this.viewDate=f,this.setValue(),this.fill(),a.preventDefault());break;case 32:break;case 13:g=this.focusDate||this.dates.get(-1)||this.viewDate,this._toggle_multidate(g),b=!0,this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(a.preventDefault(),this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}if(b){this.dates.length?this._trigger("changeDate"):this._trigger("clearDate");var h;this.isInput?h=this.element:this.component&&(h=this.element.find("input")),h&&h.change()}},showMode:function(a){a&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+a))),this.picker.find(">div").hide().filter(".cfdatepicker-"+p.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var i=function(b,c){this.element=a(b),this.inputs=a.map(c.inputs,function(a){return a.jquery?a[0]:a}),delete c.inputs,a(this.inputs).cfdatepicker(c).bind("changeDate",a.proxy(this.dateUpdated,this)),this.pickers=a.map(this.inputs,function(b){return a(b).data("cfdatepicker")}),this.updateDates()};i.prototype={updateDates:function(){this.dates=a.map(this.pickers,function(a){return a.getUTCDate()}),this.updateRanges()},updateRanges:function(){var b=a.map(this.dates,function(a){return a.valueOf()});a.each(this.pickers,function(a,c){c.setRange(b)})},dateUpdated:function(b){if(!this.updating){this.updating=!0;var c=a(b.target).data("cfdatepicker"),d=c.getUTCDate(),e=a.inArray(b.target,this.inputs),f=this.inputs.length;if(e!==-1){if(a.each(this.pickers,function(a,b){b.getUTCDate()||b.setUTCDate(d)}),d<this.dates[e])for(;e>=0&&d<this.dates[e];)this.pickers[e--].setUTCDate(d);else if(d>this.dates[e])for(;e<f&&d>this.dates[e];)this.pickers[e++].setUTCDate(d);this.updateDates(),delete this.updating}}},remove:function(){a.map(this.pickers,function(a){a.remove()}),delete this.element.data().cfdatepicker}};var l=a.fn.cfdatepicker;a.fn.cfdatepicker=function(c){var d=Array.apply(null,arguments);d.shift();var e;return this.each(function(){var f=a(this),g=f.data("cfdatepicker"),l="object"==typeof c&&c;if(!g){var n=j(this,"date"),o=a.extend({},m,n,l),p=k(o.language),q=a.extend({},m,p,n,l);if(f.is(".input-daterange")||q.inputs){var r={inputs:q.inputs||f.find("input").toArray()};f.data("cfdatepicker",g=new i(this,a.extend(q,r)))}else f.data("cfdatepicker",g=new h(this,q))}if("string"==typeof c&&"function"==typeof g[c]&&(e=g[c].apply(g,d),e!==b))return!1}),e!==b?e:this};var m=a.fn.cfdatepicker.defaults={autoclose:!1,beforeShowDay:a.noop,calendarWeeks:!1,clearBtn:!1,daysOfWeekDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-(1/0),startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0},n=a.fn.cfdatepicker.locale_opts=["format","rtl","weekStart"];a.fn.cfdatepicker.Constructor=h;var o=a.fn.cfdatepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}},p={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(a){return a%4===0&&a%100!==0||a%400===0},getDaysInMonth:function(a,b){return[31,p.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
|
2 |
+
parseFormat:function(a){var b=a.replace(this.validParts,"\0").split("\0"),c=a.match(this.validParts);if(!b||!b.length||!c||0===c.length)throw new Error("Invalid date format.");return{separators:b,parts:c}},parseDate:function(c,e,f){function u(){var a=this.slice(0,i[l].length),b=i[l].slice(0,a.length);return a===b}if(!c)return b;if(c instanceof Date)return c;"string"==typeof e&&(e=p.parseFormat(e));var j,k,l,g=/([\-+]\d+)([dmwy])/,i=c.match(/([\-+]\d+)([dmwy])/g);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(c)){for(c=new Date,l=0;l<i.length;l++)switch(j=g.exec(i[l]),k=parseInt(j[1]),j[2]){case"d":c.setUTCDate(c.getUTCDate()+k);break;case"m":c=h.prototype.moveMonth.call(h.prototype,c,k);break;case"w":c.setUTCDate(c.getUTCDate()+7*k);break;case"y":c=h.prototype.moveYear.call(h.prototype,c,k)}return d(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),0,0,0)}i=c&&c.match(this.nonpunctuation)||[],c=new Date;var r,s,m={},n=["yyyy","yy","M","MM","m","mm","d","dd"],q={yyyy:function(a,b){return a.setUTCFullYear(b)},yy:function(a,b){return a.setUTCFullYear(2e3+b)},m:function(a,b){if(isNaN(a))return a;for(b-=1;b<0;)b+=12;for(b%=12,a.setUTCMonth(b);a.getUTCMonth()!==b;)a.setUTCDate(a.getUTCDate()-1);return a},d:function(a,b){return a.setUTCDate(b)}};q.M=q.MM=q.mm=q.m,q.dd=q.d,c=d(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0);var t=e.parts.slice();if(i.length!==t.length&&(t=a(t).filter(function(b,c){return a.inArray(c,n)!==-1}).toArray()),i.length===t.length){var v;for(l=0,v=t.length;l<v;l++){if(r=parseInt(i[l],10),j=t[l],isNaN(r))switch(j){case"MM":s=a(o[f].months).filter(u),r=a.inArray(s[0],o[f].months)+1;break;case"M":s=a(o[f].monthsShort).filter(u),r=a.inArray(s[0],o[f].monthsShort)+1}m[j]=r}var w,x;for(l=0;l<n.length;l++)x=n[l],x in m&&!isNaN(m[x])&&(w=new Date(c),q[x](w,m[x]),isNaN(w)||(c=w))}return c},formatDate:function(b,c,d){if(!b)return"";"string"==typeof c&&(c=p.parseFormat(c));var e={d:b.getUTCDate(),D:o[d].daysShort[b.getUTCDay()],DD:o[d].days[b.getUTCDay()],m:b.getUTCMonth()+1,M:o[d].monthsShort[b.getUTCMonth()],MM:o[d].months[b.getUTCMonth()],yy:b.getUTCFullYear().toString().substring(2),yyyy:b.getUTCFullYear()};e.dd=(e.d<10?"0":"")+e.d,e.mm=(e.m<10?"0":"")+e.m,b=[];for(var f=a.extend([],c.separators),g=0,h=c.parts.length;g<=h;g++)f.length&&b.push(f.shift()),b.push(e[c.parts[g]]);return b.join("")},headTemplate:'<thead><tr><th class="prev">«</th><th colspan="5" class="cfdatepicker-switch"></th><th class="next">»</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};p.template='<div class="cfdatepicker"><div class="cfdatepicker-days"><table class=" table-condensed">'+p.headTemplate+"<tbody></tbody>"+p.footTemplate+'</table></div><div class="cfdatepicker-months"><table class="table-condensed">'+p.headTemplate+p.contTemplate+p.footTemplate+'</table></div><div class="cfdatepicker-years"><table class="table-condensed">'+p.headTemplate+p.contTemplate+p.footTemplate+"</table></div></div>",a.fn.cfdatepicker.DPGlobal=p,a.fn.cfdatepicker.noConflict=function(){return a.fn.cfdatepicker=l,this},a(document).on("focus.cfdatepicker.data-api click.cfdatepicker.data-api",'[data-provide="cfdatepicker"]',function(b){var c=a(this);c.data("cfdatepicker")||(b.preventDefault(),c.cfdatepicker("show").on("show",function(){a(this).trigger("blur")}).on("hide",function(){a(this).attr("disabled",!1)}))})}(window.jQuery),!function(a){function b(a){var b=document.createElement("input"),c="on"+a,d=c in b;return d||(b.setAttribute(c,"return;"),d="function"==typeof b[c]),b=null,d}function c(a){var b="text"==a||"tel"==a;if(!b){var c=document.createElement("input");c.setAttribute("type",a),b="text"===c.type,c=null}return b}function d(b,c,e){var f=e.aliases[b];return!!f&&(f.alias&&d(f.alias,void 0,e),a.extend(!0,e,f),a.extend(!0,e,c),!0)}function e(b,c){function d(a){function c(a,b,c,d){this.matches=[],this.isGroup=a||!1,this.isOptional=b||!1,this.isQuantifier=c||!1,this.isAlternator=d||!1,this.quantifier={min:1,max:1}}function d(a,c,d){var e=b.definitions[c],f=0==a.matches.length;if(d=void 0!=d?d:a.matches.length,e&&!l){for(var g=e.prevalidator,h=g?g.length:0,i=1;i<e.cardinality;i++){var j=h>=i?g[i-1]:[],k=j.validator,m=j.cardinality;a.matches.splice(d++,0,{fn:k?"string"==typeof k?new RegExp(k):new function(){this.test=k}:new RegExp("."),cardinality:m?m:1,optionality:a.isOptional,newBlockMarker:f,casing:e.casing,def:e.definitionSymbol||c,placeholder:e.placeholder,mask:c})}a.matches.splice(d++,0,{fn:e.validator?"string"==typeof e.validator?new RegExp(e.validator):new function(){this.test=e.validator}:new RegExp("."),cardinality:e.cardinality,optionality:a.isOptional,newBlockMarker:f,casing:e.casing,def:e.definitionSymbol||c,placeholder:e.placeholder,mask:c})}else a.matches.splice(d++,0,{fn:null,cardinality:0,optionality:a.isOptional,newBlockMarker:f,casing:null,def:c,placeholder:void 0,mask:c}),l=!1}for(var e,f,g,h,i,j,k=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,l=!1,m=new c,n=[],o=[];e=k.exec(a);)switch(f=e[0],f.charAt(0)){case b.optionalmarker.end:case b.groupmarker.end:if(g=n.pop(),n.length>0){if(h=n[n.length-1],h.matches.push(g),h.isAlternator){i=n.pop();for(var p=0;p<i.matches.length;p++)i.matches[p].isGroup=!1;n.length>0?(h=n[n.length-1],h.matches.push(i)):m.matches.push(i)}}else m.matches.push(g);break;case b.optionalmarker.start:n.push(new c(!1,!0));break;case b.groupmarker.start:n.push(new c(!0));break;case b.quantifiermarker.start:var q=new c(!1,!1,!0);f=f.replace(/[{}]/g,"");var r=f.split(","),s=isNaN(r[0])?r[0]:parseInt(r[0]),t=1==r.length?s:isNaN(r[1])?r[1]:parseInt(r[1]);if(("*"==t||"+"==t)&&(s="*"==t?0:1),q.quantifier={min:s,max:t},n.length>0){var u=n[n.length-1].matches;if(e=u.pop(),!e.isGroup){var v=new c(!0);v.matches.push(e),e=v}u.push(e),u.push(q)}else{if(e=m.matches.pop(),!e.isGroup){var v=new c(!0);v.matches.push(e),e=v}m.matches.push(e),m.matches.push(q)}break;case b.escapeChar:l=!0;break;case b.alternatormarker:n.length>0?(h=n[n.length-1],j=h.matches.pop()):j=m.matches.pop(),j.isAlternator?n.push(j):(i=new c(!1,!1,!1,!0),i.matches.push(j),n.push(i));break;default:if(n.length>0){if(h=n[n.length-1],h.matches.length>0&&(j=h.matches[h.matches.length-1],j.isGroup&&(j.isGroup=!1,d(j,b.groupmarker.start,0),d(j,b.groupmarker.end))),d(h,f),h.isAlternator){i=n.pop();for(var p=0;p<i.matches.length;p++)i.matches[p].isGroup=!1;n.length>0?(h=n[n.length-1],h.matches.push(i)):m.matches.push(i)}}else m.matches.length>0&&(j=m.matches[m.matches.length-1],j.isGroup&&(j.isGroup=!1,d(j,b.groupmarker.start,0),d(j,b.groupmarker.end))),d(m,f)}return m.matches.length>0&&(j=m.matches[m.matches.length-1],j.isGroup&&(j.isGroup=!1,d(j,b.groupmarker.start,0),d(j,b.groupmarker.end)),o.push(m)),o}function e(c,e){if(b.numericInput&&b.multi!==!0){c=c.split("").reverse();for(var f=0;f<c.length;f++)c[f]==b.optionalmarker.start?c[f]=b.optionalmarker.end:c[f]==b.optionalmarker.end?c[f]=b.optionalmarker.start:c[f]==b.groupmarker.start?c[f]=b.groupmarker.end:c[f]==b.groupmarker.end&&(c[f]=b.groupmarker.start);c=c.join("")}if(void 0!=c&&""!=c){if(1==c.length&&0==b.greedy&&0!=b.repeat&&(b.placeholder=""),b.repeat>0||"*"==b.repeat||"+"==b.repeat){var g="*"==b.repeat?0:"+"==b.repeat?1:b.repeat;c=b.groupmarker.start+c+b.groupmarker.end+b.quantifiermarker.start+g+","+b.repeat+b.quantifiermarker.end}return void 0==a.inputmask.masksCache[c]&&(a.inputmask.masksCache[c]={mask:c,maskToken:d(c),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:e}),a.extend(!0,{},a.inputmask.masksCache[c])}}var f=void 0;if(a.isFunction(b.mask)&&(b.mask=b.mask.call(this,b)),a.isArray(b.mask))if(c)f=[],a.each(b.mask,function(b,c){f.push(void 0==c.mask||a.isFunction(c.mask)?e(c.toString(),c):e(c.mask.toString(),c))});else{b.keepStatic=void 0==b.keepStatic||b.keepStatic;var g="(";a.each(b.mask,function(b,c){g.length>1&&(g+=")|("),g+=void 0==c.mask||a.isFunction(c.mask)?c.toString():c.mask.toString()}),g+=")",f=e(g,b.mask)}else b.mask&&(f=void 0==b.mask.mask||a.isFunction(b.mask.mask)?e(b.mask.toString(),b.mask):e(b.mask.mask.toString(),b.mask));return f}function f(d,e,f){function h(a,b,c){b=b||0;var d,e,f,g=[],h=0;do{if(a===!0&&o().validPositions[h]){var i=o().validPositions[h];e=i.match,d=i.locator.slice(),g.push(c===!0?i.input:I(h,e))}else{if(b>h){var j=w(h,d,h-1);f=j[0]}else f=t(h,d,h-1);e=f.match,d=f.locator.slice(),g.push(I(h,e))}h++}while((void 0==fa||fa>h-1)&&null!=e.fn||null==e.fn&&""!=e.def||b>=h);return g.pop(),g}function o(){return e}function p(a){var b=o();b.buffer=void 0,b.tests={},a!==!0&&(b._buffer=void 0,b.validPositions={},b.p=0)}function q(a){var b=o(),c=-1,d=b.validPositions;void 0==a&&(a=-1);var e=c,f=c;for(var g in d){var h=parseInt(g);(-1==a||null!=d[h].match.fn)&&(a>h&&(e=h),h>=a&&(f=h))}return c=a-e>1||a>f?e:f}function r(b,c,d){if(f.insertMode&&void 0!=o().validPositions[b]&&void 0==d){var e,g=a.extend(!0,{},o().validPositions),h=q();for(e=b;h>=e;e++)delete o().validPositions[e];o().validPositions[b]=c;var i,j=!0;for(e=b;h>=e;e++){var k=g[e];if(void 0!=k){var l=o().validPositions;i=!f.keepStatic&&(void 0!=l[e+1]&&w(e+1,l[e].locator.slice(),e).length>1||l[e]&&void 0!=l[e].alternation)?e+1:E(e),j=v(i,k.match.def)?j&&B(i,k.input,!0,!0)!==!1:null==k.match.fn}if(!j)break}if(!j)return o().validPositions=a.extend(!0,{},g),!1}else o().validPositions[b]=c;return!0}function s(a,b){var c,d=a;for(void 0!=o().validPositions[a]&&o().validPositions[a].input==f.radixPoint&&(b++,d++),c=d;b>c;c++)void 0==o().validPositions[c]||o().validPositions[c].input==f.radixPoint&&c!=q()||delete o().validPositions[c];for(c=b;c<=q();){var e=o().validPositions[c],g=o().validPositions[d];void 0!=e&&void 0==g?(v(d,e.match.def)&&B(d,e.input,!0)!==!1&&(delete o().validPositions[c],c++),d++):c++}var h=q();h>=a&&void 0!=o().validPositions[h]&&o().validPositions[h].input==f.radixPoint&&delete o().validPositions[h],p(!0)}function t(b,c,d){function e(b,c,d){for(var e=!1,f=b.locator[c].toString().split(","),g=0;g<f.length;g++)if(-1!=a.inArray(f[g],d)){e=!0;break}return e}for(var g,h=w(b,c,d),i=q(),j=o().validPositions[i]||w(0)[0],k=void 0!=j.alternation?j.locator[j.alternation].split(","):[],l=0;l<h.length&&(g=h[l],!(f.greedy||g.match&&(g.match.optionality===!1||g.match.newBlockMarker===!1)&&g.match.optionalQuantifier!==!0&&(void 0==j.alternation||void 0!=g.locator[j.alternation]&&e(g,j.alternation,k))));l++);return g}function u(a){return o().validPositions[a]?o().validPositions[a].match:w(a)[0].match}function v(a,b){for(var c=!1,d=w(a),e=0;e<d.length;e++)if(d[e].match&&d[e].match.def==b){c=!0;break}return c}function w(b,c,d){function e(c,d,g,i){function l(g,i,n){if(h>1e4)return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+o().mask),!0;if(h==b&&void 0==g.matches)return j.push({match:g,locator:i.reverse()}),!0;if(void 0!=g.matches){if(g.isGroup&&n!==!0){if(g=l(c.matches[m+1],i))return!0}else if(g.isOptional){var p=g;if(g=e(g,d,i,n)){var q=j[j.length-1].match,r=0==a.inArray(q,p.matches);r&&(k=!0),h=b}}else if(g.isAlternator){var s,t=g,u=[],v=j.slice(),w=i.length,x=d.length>0?d.shift():-1;if(-1==x||"string"==typeof x){var y,z=h,A=d.slice();"string"==typeof x&&(y=x.split(","));for(var B=0;B<t.matches.length;B++){j=[],g=l(t.matches[B],[B].concat(i),n)||g,s=j.slice(),h=z,j=[];for(var C=0;C<A.length;C++)d[C]=A[C];for(var D=0;D<s.length;D++)for(var E=s[D],F=0;F<u.length;F++){var G=u[F];if(E.match.mask==G.match.mask&&("string"!=typeof x||-1!=a.inArray(E.locator[w].toString(),y))){s.splice(D,1),G.locator[w]=G.locator[w]+","+E.locator[w],G.alternation=w;break}}u=u.concat(s)}"string"==typeof x&&(u=a.map(u,function(b,c){if(isFinite(c)){var d,e=b.locator[w].toString().split(",");b.locator[w]=void 0,b.alternation=void 0;for(var f=0;f<e.length;f++)d=-1!=a.inArray(e[f],y),d&&(void 0!=b.locator[w]?(b.locator[w]+=",",b.alternation=w,b.locator[w]+=e[f]):b.locator[w]=parseInt(e[f]));if(void 0!=b.locator[w])return b}})),j=v.concat(u),k=!0}else g=l(t.matches[x],[x].concat(i),n);if(g)return!0}else if(g.isQuantifier&&n!==!0){var H=g;f.greedy=f.greedy&&isFinite(H.quantifier.max);for(var I=d.length>0&&n!==!0?d.shift():0;I<(isNaN(H.quantifier.max)?I+1:H.quantifier.max)&&b>=h;I++){var J=c.matches[a.inArray(H,c.matches)-1];if(g=l(J,[I].concat(i),!0)){var q=j[j.length-1].match;q.optionalQuantifier=I>H.quantifier.min-1;var r=0==a.inArray(q,J.matches);if(r){if(I>H.quantifier.min-1){k=!0,h=b;break}return!0}return!0}}}else if(g=e(g,d,i,n))return!0}else h++}for(var m=d.length>0?d.shift():0;m<c.matches.length;m++)if(c.matches[m].isQuantifier!==!0){var n=l(c.matches[m],[m].concat(g),i);if(n&&h==b)return n;if(h>b)break}}var g=o().maskToken,h=c?d:0,i=c||[0],j=[],k=!1;if(void 0==c){for(var l,m=b-1;void 0==(l=o().validPositions[m])&&m>-1;)m--;if(void 0!=l&&m>-1)h=m,i=l.locator.slice();else{for(m=b-1;void 0==(l=o().tests[m])&&m>-1;)m--;void 0!=l&&m>-1&&(h=m,i=l[0].locator.slice())}}for(var n=i.shift();n<g.length;n++){var p=e(g[n],i,[n]);if(p&&h==b||h>b)break}return(0==j.length||k)&&j.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]}),o().tests[b]=a.extend(!0,[],j),o().tests[b]}function x(){return void 0==o()._buffer&&(o()._buffer=h(!1,1)),o()._buffer}function y(){return void 0==o().buffer&&(o().buffer=h(!0,q(),!0)),o().buffer}function z(a,b){var c=y().slice();if(a===!0)p(),a=0,b=c.length;else for(var d=a;b>d;d++)delete o().validPositions[d],delete o().tests[d];for(var d=a;b>d;d++)c[d]!=f.skipOptionalPartCharacter&&B(d,c[d],!0,!0)}function A(a,b){switch(b.casing){case"upper":a=a.toUpperCase();break;case"lower":a=a.toLowerCase()}return a}function B(b,c,d,e){function g(b,c,d,e){var g=!1;return a.each(w(b),function(h,i){for(var j=i.match,k=c?1:0,l="",m=(y(),j.cardinality);m>k;m--)l+=G(b-(m-1));if(c&&(l+=c),g=null!=j.fn?j.fn.test(l,o(),b,d,f):(c==j.def||c==f.skipOptionalPartCharacter)&&""!=j.def&&{c:j.def,pos:b},g!==!1){var n=void 0!=g.c?g.c:c;n=n==f.skipOptionalPartCharacter&&null===j.fn?j.def:n;var t=b;if(void 0!=g.remove&&s(g.remove,g.remove+1),g.refreshFromBuffer){var u=g.refreshFromBuffer;if(d=!0,z(u===!0?u:u.start,u.end),void 0==g.pos&&void 0==g.c)return g.pos=q(),!1;if(t=void 0!=g.pos?g.pos:b,t!=b)return g=a.extend(g,B(t,n,!0)),!1}else if(g!==!0&&void 0!=g.pos&&g.pos!=b&&(t=g.pos,z(b,t),t!=b))return g=a.extend(g,B(t,n,!0)),!1;return(1==g||void 0!=g.pos||void 0!=g.c)&&(h>0&&p(!0),r(t,a.extend({},i,{input:A(n,j)}),e)||(g=!1),!1)}}),g}function h(b,c,d,e){var g,h,i=a.extend(!0,{},o().validPositions);for(g=q();g>=0;g--)if(o().validPositions[g]&&void 0!=o().validPositions[g].alternation){h=o().validPositions[g].alternation;break}if(void 0!=h)for(var j in o().validPositions)if(parseInt(j)>parseInt(g)&&void 0===o().validPositions[j].alternation){for(var k=o().validPositions[j],l=k.locator[h],m=o().validPositions[g].locator[h].split(","),n=0;n<m.length;n++)if(l<m[n]){for(var r,s,t=j-1;t>=0;t--)if(r=o().validPositions[t],void 0!=r){s=r.locator[h],r.locator[h]=m[n];break}if(l!=r.locator[h]){for(var u=y().slice(),v=j;v<q()+1;v++)delete o().validPositions[v],delete o().tests[v];p(!0),f.keepStatic=!f.keepStatic;for(var v=j;v<u.length;v++)u[v]!=f.skipOptionalPartCharacter&&B(q()+1,u[v],!1,!0);r.locator[h]=s;var w=B(b,c,d,e);if(f.keepStatic=!f.keepStatic,w)return w;p(),o().validPositions=a.extend(!0,{},i)}}break}return!1}d=d===!0;for(var i=y(),j=b-1;j>-1&&(!o().validPositions[j]||null!=o().validPositions[j].match.fn);j--)void 0==o().validPositions[j]&&(!C(j)||i[j]!=I(j))&&w(j).length>1&&g(j,i[j],!0);var k=b,l=!1;if(e&&k>=D()&&p(!0),k<D()&&(l=g(k,c,d,e),!d&&l===!1)){var m=o().validPositions[k];if(!m||null!=m.match.fn||m.match.def!=c&&c!=f.skipOptionalPartCharacter){if((f.insertMode||void 0==o().validPositions[E(k)])&&!C(k))for(var n=k+1,t=E(k);t>=n;n++)if(l=g(n,c,d,e),l!==!1){k=n;break}}else l={caret:E(k)}}return l===!1&&f.keepStatic&&R(i)&&(l=h(b,c,d,e)),l===!0&&(l={pos:k}),l}function C(a){var b=u(a);return null!=b.fn&&b.fn}function D(){var a;if(fa=ea.prop("maxLength"),-1==fa&&(fa=void 0),0==f.greedy){var b,c=q(),d=o().validPositions[c],e=void 0!=d?d.locator.slice():void 0;for(b=c+1;void 0==d||null!=d.match.fn||null==d.match.fn&&""!=d.match.def;b++)d=t(b,e,b-1),e=d.locator.slice();a=b}else a=y().length;return void 0==fa||fa>a?a:fa}function E(a){var b=D();if(a>=b)return b;for(var c=a;++c<b&&!C(c)&&(f.nojumps!==!0||f.nojumpsThreshold>c););return c}function F(a){var b=a;if(0>=b)return 0;for(;--b>0&&!C(b););return b}function G(a){return void 0==o().validPositions[a]?I(a):o().validPositions[a].input}function H(a,b,c){a._valueSet(b.join("")),void 0!=c&&O(a,c)}function I(b,c){c=c||u(b);var d=a.isFunction(c.placeholder)?c.placeholder.call(this,f):c.placeholder;return void 0!=d?d:null==c.fn?c.def:f.placeholder.charAt(b%f.placeholder.length)}function J(b,c,d,e,g){var h=void 0!=e?e.slice():L(b._valueGet()).split("");if(p(),c&&b._valueSet(""),a.each(h,function(c,e){if(g===!0){var f=q(),h=-1==f?c:E(f);-1==a.inArray(e,x().slice(f+1,h))&&Y.call(b,void 0,!0,e.charCodeAt(0),!1,d,d?c:o().p)}else Y.call(b,void 0,!0,e.charCodeAt(0),!1,d,d?c:o().p),d=d||c>0&&c>o().p}),c){var i=f.onKeyPress.call(this,void 0,y(),0,f);W(b,i),H(b,y(),a(b).is(":focus")?E(q(0)):void 0)}}function K(b){return a.inputmask.escapeRegex.call(this,b)}function L(a){return a.replace(new RegExp("("+K(x().join(""))+")*$"),"")}function M(b){if(b.data("_inputmask")&&!b.hasClass("hasDatepicker")){var c=[],d=o().validPositions;for(var e in d)d[e].match&&null!=d[e].match.fn&&c.push(d[e].input);var g=(ga?c.reverse():c).join(""),h=(ga?y().slice().reverse():y()).join("");return a.isFunction(f.onUnMask)&&(g=f.onUnMask.call(b,h,g,f)||g),g}return b[0]._valueGet()}function N(a){if(ga&&"number"==typeof a&&(!f.greedy||""!=f.placeholder)){var b=y().length;a=b-a}return a}function O(b,c,d){var e,g=b.jquery&&b.length>0?b[0]:b;if("number"!=typeof c){var h=a(g).data("_inputmask");return!a(g).is(":visible")&&h&&void 0!=h.caret?(c=h.caret.begin,d=h.caret.end):g.setSelectionRange?(c=g.selectionStart,d=g.selectionEnd):document.selection&&document.selection.createRange&&(e=document.selection.createRange(),c=0-e.duplicate().moveStart("character",-1e5),d=c+e.text.length),c=N(c),d=N(d),{begin:c,end:d}}c=N(c),d=N(d),d="number"==typeof d?d:c;var h=a(g).data("_inputmask")||{};h.caret={begin:c,end:d},a(g).data("_inputmask",h),a(g).is(":visible")&&(g.scrollLeft=g.scrollWidth,0==f.insertMode&&c==d&&d++,g.setSelectionRange?(g.selectionStart=c,g.selectionEnd=d):g.createTextRange&&(e=g.createTextRange(),e.collapse(!0),e.moveEnd("character",d),e.moveStart("character",c),e.select()))}function P(b){var c,d,e=y(),f=e.length,g=q(),h={},i=o().validPositions[g],j=void 0!=i?i.locator.slice():void 0;for(c=g+1;c<e.length;c++)d=t(c,j,c-1),j=d.locator.slice(),h[c]=a.extend(!0,{},d);var k=i&&void 0!=i.alternation?i.locator[i.alternation].split(","):[];for(c=f-1;c>g&&(d=h[c].match,(d.optionality||d.optionalQuantifier||i&&void 0!=i.alternation&&void 0!=h[c].locator[i.alternation]&&-1!=a.inArray(h[c].locator[i.alternation].toString(),k))&&e[c]==I(c,d));c--)f--;return b?{l:f,def:h[f]?h[f].match:void 0}:f}function Q(a){for(var b=y(),c=b.slice(),d=P(),e=c.length-1;e>d&&!C(e);e--);c.splice(d,e+1-d),H(a,c)}function R(b){if(a.isFunction(f.isComplete))return f.isComplete.call(ea,b,f);if("*"!=f.repeat){var c=!1,d=P(!0),e=F(d.l),g=q();if(g==e&&(void 0==d.def||d.def.newBlockMarker||d.def.optionalQuantifier)){c=!0;for(var h=0;e>=h;h++){var i=C(h);if(i&&(void 0==b[h]||b[h]==I(h))||!i&&b[h]!=I(h)){c=!1;break}}}return c}}function S(a,b){return ga?a-b>1||a-b==1&&f.insertMode:b-a>1||b-a==1&&f.insertMode}function T(b){var c=a._data(b).events;a.each(c,function(b,c){a.each(c,function(a,b){if("inputmask"==b.namespace&&"setvalue"!=b.type){var c=b.handler;b.handler=function(a){return this.readOnly||this.disabled?void a.preventDefault:c.apply(this,arguments)}}})})}function U(b){function c(b){if(void 0==a.valHooks[b]||1!=a.valHooks[b].inputmaskpatch){var c=a.valHooks[b]&&a.valHooks[b].get?a.valHooks[b].get:function(a){return a.value},d=a.valHooks[b]&&a.valHooks[b].set?a.valHooks[b].set:function(a,b){return a.value=b,a};a.valHooks[b]={get:function(b){var d=a(b);if(d.data("_inputmask")){if(d.data("_inputmask").opts.autoUnmask)return d.inputmask("unmaskedvalue");var e=c(b),f=d.data("_inputmask"),g=f.maskset,h=g._buffer;return h=h?h.join(""):"",e!=h?e:""}return c(b)},set:function(b,c){var e,f=a(b),g=f.data("_inputmask");return g?(e=d(b,a.isFunction(g.opts.onBeforeMask)?g.opts.onBeforeMask.call(oa,c,g.opts)||c:c),f.triggerHandler("setvalue.inputmask")):e=d(b,c),e},inputmaskpatch:!0}}}function d(){var b=a(this),c=a(this).data("_inputmask");return c?c.opts.autoUnmask?b.inputmask("unmaskedvalue"):g.call(this)!=x().join("")?g.call(this):"":g.call(this)}function e(b){var c=a(this).data("_inputmask");c?(h.call(this,a.isFunction(c.opts.onBeforeMask)?c.opts.onBeforeMask.call(oa,b,c.opts)||b:b),a(this).triggerHandler("setvalue.inputmask")):h.call(this,b)}function f(b){a(b).bind("mouseenter.inputmask",function(){var b=a(this),c=this,d=c._valueGet();""!=d&&d!=y().join("")&&b.trigger("setvalue")});var c=a._data(b).events,d=c.mouseover;if(d){for(var e=d[d.length-1],f=d.length-1;f>0;f--)d[f]=d[f-1];d[0]=e}}var g,h;b._valueGet||(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(b,"value"),document.__lookupGetter__&&b.__lookupGetter__("value")?(g=b.__lookupGetter__("value"),h=b.__lookupSetter__("value"),b.__defineGetter__("value",d),b.__defineSetter__("value",e)):(g=function(){return b.value},h=function(a){b.value=a},c(b.type),f(b)),b._valueGet=function(){return ga?g.call(this).split("").reverse().join(""):g.call(this)},b._valueSet=function(a){h.call(this,ga?a.split("").reverse().join(""):a)})}function V(b,c,d){function e(){if(f.keepStatic){p(!0);var a,c=[];for(a=q();a>=0;a--)if(o().validPositions[a]){if(void 0!=o().validPositions[a].alternation)break;c.push(o().validPositions[a].input),delete o().validPositions[a]}if(a>0)for(;c.length>0;)o().p=E(q()),Y.call(b,void 0,!0,c.pop().charCodeAt(0),!1,!1,o().p)}}if((f.numericInput||ga)&&(c==a.inputmask.keyCode.BACKSPACE?c=a.inputmask.keyCode.DELETE:c==a.inputmask.keyCode.DELETE&&(c=a.inputmask.keyCode.BACKSPACE),ga)){var g=d.end;d.end=d.begin,d.begin=g}c==a.inputmask.keyCode.BACKSPACE&&d.end-d.begin<=1?d.begin=F(d.begin):c==a.inputmask.keyCode.DELETE&&d.begin==d.end&&d.end++,s(d.begin,d.end),e();var h=q(d.begin);h<d.begin?(-1==h&&p(),o().p=E(h)):o().p=d.begin}function W(a,b,c){if(b&&b.refreshFromBuffer){var d=b.refreshFromBuffer;z(d===!0?d:d.start,d.end),p(!0),void 0!=c&&(H(a,y()),O(a,b.caret||c.begin,b.caret||c.end))}}function X(c){ha=!1;var d=this,e=a(d),g=c.keyCode,h=O(d);g==a.inputmask.keyCode.BACKSPACE||g==a.inputmask.keyCode.DELETE||i&&127==g||c.ctrlKey&&88==g&&!b("cut")?(c.preventDefault(),88==g&&(da=y().join("")),V(d,g,h),H(d,y(),o().p),d._valueGet()==x().join("")&&e.trigger("cleared"),f.showTooltip&&e.prop("title",o().mask)):g==a.inputmask.keyCode.END||g==a.inputmask.keyCode.PAGE_DOWN?setTimeout(function(){var a=E(q());f.insertMode||a!=D()||c.shiftKey||a--,O(d,c.shiftKey?h.begin:a,a)},0):g==a.inputmask.keyCode.HOME&&!c.shiftKey||g==a.inputmask.keyCode.PAGE_UP?O(d,0,c.shiftKey?h.begin:0):g==a.inputmask.keyCode.ESCAPE||90==g&&c.ctrlKey?(J(d,!0,!1,da.split("")),e.click()):g!=a.inputmask.keyCode.INSERT||c.shiftKey||c.ctrlKey?0!=f.insertMode||c.shiftKey||(g==a.inputmask.keyCode.RIGHT?setTimeout(function(){var a=O(d);O(d,a.begin)},0):g==a.inputmask.keyCode.LEFT&&setTimeout(function(){var a=O(d);O(d,ga?a.begin+1:a.begin-1)},0)):(f.insertMode=!f.insertMode,O(d,f.insertMode||h.begin!=D()?h.begin:h.begin-1));var j=O(d),k=f.onKeyDown.call(this,c,y(),j.begin,f);W(d,k,j),ja=-1!=a.inArray(g,f.ignorables)}function Y(b,c,d,e,g,h){if(void 0==d&&ha)return!1;ha=!0;var i=this,j=a(i);b=b||window.event;var d=c?d:b.which||b.charCode||b.keyCode;if(!(c===!0||b.ctrlKey&&b.altKey)&&(b.ctrlKey||b.metaKey||ja))return!0;if(d){c!==!0&&46==d&&0==b.shiftKey&&","==f.radixPoint&&(d=44);var k,l=c?{begin:h,end:h}:O(i),m=String.fromCharCode(d),n=S(l.begin,l.end);n&&(o().undoPositions=a.extend(!0,{},o().validPositions),V(i,a.inputmask.keyCode.DELETE,l),f.insertMode||(f.insertMode=!f.insertMode,r(l.begin,g),f.insertMode=!f.insertMode),n=!f.multi),o().writeOutBuffer=!0;var q=ga&&!n?l.end:l.begin,s=B(q,m,g);if(s!==!1){if(s!==!0&&(q=void 0!=s.pos?s.pos:q,m=void 0!=s.c?s.c:m),p(!0),void 0!=s.caret)k=s.caret;else{var t=o().validPositions;k=!f.keepStatic&&(void 0!=t[q+1]&&w(q+1,t[q].locator.slice(),q).length>1||void 0!=t[q].alternation)?q+1:E(q)}o().p=k}if(e!==!1){var u=this;if(setTimeout(function(){f.onKeyValidation.call(u,s,f)},0),o().writeOutBuffer&&s!==!1){var v=y();H(i,v,c?void 0:f.numericInput?F(k):k),c!==!0&&setTimeout(function(){R(v)===!0&&j.trigger("complete"),ia=!0,j.trigger("input")},0)}else n&&(o().buffer=void 0,o().validPositions=o().undoPositions)}else n&&(o().buffer=void 0,o().validPositions=o().undoPositions);if(f.showTooltip&&j.prop("title",o().mask),b&&1!=c){b.preventDefault();var x=O(i),z=f.onKeyPress.call(this,b,y(),x.begin,f);W(i,z,x)}}}function Z(b){var c=a(this),d=this,e=b.keyCode,g=y(),h=O(d),i=f.onKeyUp.call(this,b,g,h.begin,f);W(d,i,h),e==a.inputmask.keyCode.TAB&&f.showMaskOnFocus&&(c.hasClass("focus-inputmask")&&0==d._valueGet().length?(p(),g=y(),H(d,g),O(d,0),da=y().join("")):(H(d,g),O(d,N(0),N(D()))))}function $(b){if(ia===!0&&"input"==b.type)return ia=!1,!0;var c=this,d=a(c),e=c._valueGet(),g=O(c);if("propertychange"==b.type&&c._valueGet().length<=D())return!0;"paste"==b.type&&(window.clipboardData&&window.clipboardData.getData?e=e.substr(0,g.begin)+window.clipboardData.getData("Text")+e.substr(g.end,e.length):b.originalEvent&&b.originalEvent.clipboardData&&b.originalEvent.clipboardData.getData&&(e=e.substr(0,g.begin)+b.originalEvent.clipboardData.getData("text/plain")+e.substr(g.end,e.length)));var h=a.isFunction(f.onBeforePaste)?f.onBeforePaste.call(c,e,f)||e:e;return J(c,!0,!1,ga?h.split("").reverse():h.split(""),!0),d.click(),R(y())===!0&&d.trigger("complete"),!1}function _(b){if(ia===!0&&"input"==b.type)return ia=!1,!0;var c=this,d=O(c),e=c._valueGet();e=e.replace(new RegExp("("+K(x().join(""))+")*"),""),d.begin>e.length&&(O(c,e.length),d=O(c)),y().length-e.length!=1||e.charAt(d.begin)==y()[d.begin]||e.charAt(d.begin+1)==y()[d.begin]||C(d.begin)||(b.keyCode=a.inputmask.keyCode.BACKSPACE,X.call(c,b)),b.preventDefault()}function aa(b){if(ia===!0&&"input"==b.type)return ia=!1,!0;var c=this,d=O(c),e=c._valueGet();O(c,d.begin-1);var g=a.Event("keypress");g.which=e.charCodeAt(d.begin-1),ha=!1,ja=!1,Y.call(c,g,void 0,void 0,!1);var h=o().p;H(c,y(),f.numericInput?F(h):h),b.preventDefault()}function ba(b){ia=!0;var c=this;return setTimeout(function(){O(c,O(c).begin-1);var d=a.Event("keypress");d.which=b.originalEvent.data.charCodeAt(0),ha=!1,ja=!1,Y.call(c,d,void 0,void 0,!1);var e=o().p;H(c,y(),f.numericInput?F(e):e)},0),!1}function ca(b){if(ea=a(b),ea.is(":input")&&c(ea.attr("type"))){if(ea.data("_inputmask",{maskset:e,opts:f,isRTL:!1}),f.showTooltip&&ea.prop("title",o().mask),("rtl"==b.dir||f.rightAlign)&&ea.css("text-align","right"),"rtl"==b.dir||f.numericInput){b.dir="ltr",ea.removeAttr("dir");var d=ea.data("_inputmask");d.isRTL=!0,ea.data("_inputmask",d),ga=!0}ea.unbind(".inputmask"),ea.removeClass("focus-inputmask"),ea.closest("form").bind("submit",function(){da!=y().join("")&&ea.change(),ea[0]._valueGet&&ea[0]._valueGet()==x().join("")&&ea[0]._valueSet(""),f.autoUnmask&&f.removeMaskOnSubmit&&ea.inputmask("remove")}).bind("reset",function(){setTimeout(function(){ea.trigger("setvalue")},0)}),ea.bind("mouseenter.inputmask",function(){var b=a(this),c=this;!b.hasClass("focus-inputmask")&&f.showMaskOnHover&&c._valueGet()!=y().join("")&&H(c,y())}).bind("blur.inputmask",function(){var b=a(this),c=this;if(b.data("_inputmask")){var d=c._valueGet(),e=y();b.removeClass("focus-inputmask"),da!=y().join("")&&b.change(),f.clearMaskOnLostFocus&&""!=d&&(d==x().join("")?c._valueSet(""):Q(c)),R(e)===!1&&(b.trigger("incomplete"),f.clearIncomplete&&(p(),f.clearMaskOnLostFocus?c._valueSet(""):(e=x().slice(),H(c,e))))}}).bind("focus.inputmask",function(){var b=a(this),c=this,d=c._valueGet();f.showMaskOnFocus&&!b.hasClass("focus-inputmask")&&(!f.showMaskOnHover||f.showMaskOnHover&&""==d)&&c._valueGet()!=y().join("")&&H(c,y(),E(q())),b.addClass("focus-inputmask"),da=y().join("")}).bind("mouseleave.inputmask",function(){var b=a(this),c=this;f.clearMaskOnLostFocus&&(b.hasClass("focus-inputmask")||c._valueGet()==b.attr("placeholder")||(c._valueGet()==x().join("")||""==c._valueGet()?c._valueSet(""):Q(c)))}).bind("click.inputmask",function(){var b=this;a(b).is(":focus")&&setTimeout(function(){var c=O(b);if(c.begin==c.end)if(f.radixFocus&&""!=f.radixPoint&&-1!=a.inArray(f.radixPoint,y())&&y().join("")==x().join(""))O(b,a.inArray(f.radixPoint,y()));else{var d=ga?N(c.begin):c.begin,e=E(q(d));e>d?O(b,C(d)?d:E(d)):O(b,e)}},0)}).bind("dblclick.inputmask",function(){var a=this;setTimeout(function(){O(a,0,E(q()))},0)}).bind(n+".inputmask dragdrop.inputmask drop.inputmask",$).bind("setvalue.inputmask",function(){var a=this;J(a,!0,!1,void 0,!0),da=y().join(""),(f.clearMaskOnLostFocus||f.clearIncomplete)&&a._valueGet()==x().join("")&&a._valueSet("")}).bind("cut.inputmask",function(b){ia=!0;var c=this,d=a(c),e=O(c);V(c,a.inputmask.keyCode.DELETE,e);var g=f.onKeyPress.call(this,b,y(),o().p,f);W(c,g,{begin:o().p,end:o().p}),c._valueGet()==x().join("")&&d.trigger("cleared"),f.showTooltip&&d.prop("title",o().mask)}).bind("complete.inputmask",f.oncomplete).bind("incomplete.inputmask",f.onincomplete).bind("cleared.inputmask",f.oncleared),ea.bind("keydown.inputmask",X).bind("keypress.inputmask",Y).bind("keyup.inputmask",Z).bind("compositionupdate.inputmask",ba),"paste"!==n||g||ea.bind("input.inputmask",aa),g&&ea.bind("input.inputmask",$),(j||l||k||m)&&("input"==n&&ea.unbind(n+".inputmask"),ea.bind("input.inputmask",_)),U(b);var h=a.isFunction(f.onBeforeMask)?f.onBeforeMask.call(b,b._valueGet(),f)||b._valueGet():b._valueGet();J(b,!0,!1,h.split(""),!0),da=y().join("");var i;try{i=document.activeElement}catch(a){}R(y())===!1&&f.clearIncomplete&&p(),f.clearMaskOnLostFocus?y().join("")==x().join("")?b._valueSet(""):Q(b):H(b,y()),i===b&&(ea.addClass("focus-inputmask"),O(b,E(q()))),T(b)}}var da,ea,fa,ga=!1,ha=!1,ia=!1,ja=!1;if(void 0!=d)switch(d.action){case"isComplete":return ea=a(d.el),e=ea.data("_inputmask").maskset,f=ea.data("_inputmask").opts,R(d.buffer);case"unmaskedvalue":return ea=d.$input,e=ea.data("_inputmask").maskset,f=ea.data("_inputmask").opts,ga=d.$input.data("_inputmask").isRTL,M(d.$input);case"mask":da=y().join(""),ca(d.el);break;case"format":ea=a({}),ea.data("_inputmask",{maskset:e,opts:f,isRTL:f.numericInput}),f.numericInput&&(ga=!0);var ka=(a.isFunction(f.onBeforeMask)?f.onBeforeMask.call(ea,d.value,f)||d.value:d.value).split("");return J(ea,!1,!1,ga?ka.reverse():ka,!0),f.onKeyPress.call(this,void 0,y(),0,f),d.metadata?{value:ga?y().slice().reverse().join(""):y().join(""),metadata:ea.inputmask("getmetadata")}:ga?y().slice().reverse().join(""):y().join("");case"isValid":ea=a({}),ea.data("_inputmask",{maskset:e,opts:f,isRTL:f.numericInput}),f.numericInput&&(ga=!0);var ka=d.value.split("");J(ea,!1,!0,ga?ka.reverse():ka);for(var la=y(),ma=P(),na=la.length-1;na>ma&&!C(na);na--);return la.splice(ma,na+1-ma),R(la)&&d.value==la.join("");case"getemptymask":return ea=a(d.el),e=ea.data("_inputmask").maskset,f=ea.data("_inputmask").opts,x();case"remove":var oa=d.el;ea=a(oa),e=ea.data("_inputmask").maskset,f=ea.data("_inputmask").opts,oa._valueSet(M(ea)),ea.unbind(".inputmask"),ea.removeClass("focus-inputmask"),ea.removeData("_inputmask");var pa;Object.getOwnPropertyDescriptor&&(pa=Object.getOwnPropertyDescriptor(oa,"value")),pa&&pa.get?oa._valueGet&&Object.defineProperty(oa,"value",{get:oa._valueGet,set:oa._valueSet}):document.__lookupGetter__&&oa.__lookupGetter__("value")&&oa._valueGet&&(oa.__defineGetter__("value",oa._valueGet),
|
3 |
+
oa.__defineSetter__("value",oa._valueSet));try{delete oa._valueGet,delete oa._valueSet}catch(a){oa._valueGet=void 0,oa._valueSet=void 0}break;case"getmetadata":if(ea=a(d.el),e=ea.data("_inputmask").maskset,f=ea.data("_inputmask").opts,a.isArray(e.metadata)){for(var qa,ra=q(),sa=ra;sa>=0;sa--)if(o().validPositions[sa]&&void 0!=o().validPositions[sa].alternation){qa=o().validPositions[sa].alternation;break}return void 0!=qa?e.metadata[o().validPositions[ra].locator[qa]]:e.metadata[0]}return e.metadata}}if(void 0===a.fn.inputmask){var g="function"==typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion():new Function("/*@cc_on return @_jscript_version; @*/")()>=10,h=navigator.userAgent,i=null!==h.match(new RegExp("iphone","i")),j=null!==h.match(new RegExp("android.*safari.*","i")),k=null!==h.match(new RegExp("android.*chrome.*","i")),l=null!==h.match(new RegExp("android.*firefox.*","i")),m=/Kindle/i.test(h)||/Silk/i.test(h)||/KFTT/i.test(h)||/KFOT/i.test(h)||/KFJWA/i.test(h)||/KFJWI/i.test(h)||/KFSOWI/i.test(h)||/KFTHWA/i.test(h)||/KFTHWI/i.test(h)||/KFAPWA/i.test(h)||/KFAPWI/i.test(h),n=b("paste")?"paste":b("input")?"input":"propertychange";a.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:a.noop,onincomplete:a.noop,oncleared:a.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!0,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyUp:a.noop,onKeyPress:a.noop,onKeyDown:a.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:a.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,rightAlign:!1,radixPoint:"",radixFocus:!1,nojumps:!1,nojumpsThreshold:0,keepStatic:void 0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-zА-яЁёÀ-ÿµ]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:void 0},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},masksCache:{},escapeRegex:function(a){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];return a.replace(new RegExp("(\\"+b.join("|\\")+")","gim"),"\\$1")},format:function(b,c,g){var h=a.extend(!0,{},a.inputmask.defaults,c);return d(h.alias,c,h),f({action:"format",value:b,metadata:g},e(h),h)},isValid:function(b,c){var g=a.extend(!0,{},a.inputmask.defaults,c);return d(g.alias,c,g),f({action:"isValid",value:b},e(g),g)}},a.fn.inputmask=function(b,c,g,h,i){function j(b,c,e){var f=a(b);f.data("inputmask-alias")&&d(f.data("inputmask-alias"),{},c);for(var g in c){var h=f.data("inputmask-"+g.toLowerCase());void 0!=h&&("mask"==g&&0==h.indexOf("[")?(c[g]=h.replace(/[\s[\]]/g,"").split("','"),c[g][0]=c[g][0].replace("'",""),c[g][c[g].length-1]=c[g][c[g].length-1].replace("'","")):c[g]="boolean"==typeof h?h:h.toString(),e&&(e[g]=c[g]))}return c}g=g||f,h=h||"_inputmask";var k,l=a.extend(!0,{},a.inputmask.defaults,c);if("string"==typeof b)switch(b){case"mask":return d(l.alias,c,l),k=e(l,g!==f),void 0==k?this:this.each(function(){g({action:"mask",el:this},a.extend(!0,{},k),j(this,l))});case"unmaskedvalue":var m=a(this);return m.data(h)?g({action:"unmaskedvalue",$input:m}):m.val();case"remove":return this.each(function(){var b=a(this);b.data(h)&&g({action:"remove",el:this})});case"getemptymask":return this.data(h)?g({action:"getemptymask",el:this}):"";case"hasMaskedValue":return!!this.data(h)&&!this.data(h).opts.autoUnmask;case"isComplete":return!this.data(h)||g({action:"isComplete",buffer:this[0]._valueGet().split(""),el:this});case"getmetadata":return this.data(h)?g({action:"getmetadata",el:this}):void 0;case"_detectScope":return d(l.alias,c,l),void 0==i||d(i,c,l)||-1!=a.inArray(i,["mask","unmaskedvalue","remove","getemptymask","hasMaskedValue","isComplete","getmetadata","_detectScope"])||(l.mask=i),a.isFunction(l.mask)&&(l.mask=l.mask.call(this,l)),a.isArray(l.mask);default:return d(l.alias,c,l),d(b,c,l)||(l.mask=b),k=e(l,g!==f),void 0==k?this:this.each(function(){g({action:"mask",el:this},a.extend(!0,{},k),j(this,l))})}else{if("object"==typeof b)return l=a.extend(!0,{},a.inputmask.defaults,b),d(l.alias,b,l),k=e(l,g!==f),void 0==k?this:this.each(function(){g({action:"mask",el:this},a.extend(!0,{},k),j(this,l))});if(void 0==b)return this.each(function(){var b=a(this).attr("data-inputmask");if(b&&""!=b)try{b=b.replace(new RegExp("'","g"),'"');var e=a.parseJSON("{"+b+"}");a.extend(!0,e,c),l=a.extend(!0,{},a.inputmask.defaults,e),l=j(this,l),d(l.alias,e,l),l.alias=void 0,a(this).inputmask("mask",l,g)}catch(a){}if(a(this).attr("data-inputmask-mask")||a(this).attr("data-inputmask-alias")){l=a.extend(!0,{},a.inputmask.defaults,{});var f={};l=j(this,l,f),d(l.alias,f,l),l.alias=void 0,a(this).inputmask("mask",l,g)}})}}}return a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}}),a.extend(a.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[1-9]|[12][0-9]|3[01]"),val2pre:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+c+"[01])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9])"+c+"(0[1-9]|1[012]))|(30"+c+"(0[13-9]|1[012]))|(31"+c+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,b,c){if(isNaN(a))return!1;var d=parseInt(a.concat(b.toString().slice(a.length))),e=parseInt(a.concat(c.toString().slice(a.length)));return!isNaN(d)&&(d>=b&&c>=d)||!isNaN(e)&&(e>=b&&c>=e)},determinebaseyear:function(a,b,c){var d=(new Date).getFullYear();if(a>d)return a;if(d>b){for(var e=b.toString().slice(0,2),f=b.toString().slice(2,4);e+c>b;)e--;var g=e+f;return a>g?a:g}return d},onKeyUp:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val(d.getDate().toString()+(d.getMonth()+1).toString()+d.getFullYear().toString())}},definitions:{1:{validator:function(a,b,c,d,e){var f=e.regex.val1.test(a);return d||f||a.charAt(1)!=e.separator&&-1=="-./".indexOf(a.charAt(1))||!(f=e.regex.val1.test("0"+a.charAt(0)))?f:(b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=1==a.length?e.regex.val1pre.test(a):e.regex.val1.test(a);return d||f||!(f=e.regex.val1.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},2:{validator:function(a,b,c,d,e){var f=e.mask.indexOf("2")==e.mask.length-1?b.buffer.join("").substr(5,3):b.buffer.join("").substr(0,3);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=e.regex.val2(e.separator).test(f+a);if(!d&&!g&&(a.charAt(1)==e.separator||-1!="-./".indexOf(a.charAt(1)))&&(g=e.regex.val2(e.separator).test(f+"0"+a.charAt(0))))return b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)};if(e.mask.indexOf("2")==e.mask.length-1&&g){var h=b.buffer.join("").substr(4,4)+a;if(h!=e.leapday)return!0;var i=parseInt(b.buffer.join("").substr(0,4),10);return i%4===0&&(i%100!==0||i%400===0)}return g},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=e.mask.indexOf("2")==e.mask.length-1?b.buffer.join("").substr(5,3):b.buffer.join("").substr(0,3);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=1==a.length?e.regex.val2pre(e.separator).test(f+a):e.regex.val2(e.separator).test(f+a);return d||g||!(g=e.regex.val2(e.separator).test(f+"0"+a))?g:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},y:{validator:function(a,b,c,d,e){if(e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)){var f=b.buffer.join("").substr(0,6);if(f!=e.leapday)return!0;var g=parseInt(a,10);return g%4===0&&(g%100!==0||g%400===0)}return!1},cardinality:4,prevalidator:[{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,1);if(f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,2),f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),b.buffer[c++]=g.charAt(1),{pos:c}}return f},cardinality:1},{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2);if(f=e.isInYearRange(a[0]+g[1]+a[1],e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(1),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2),e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear)){var h=b.buffer.join("").substr(0,6);if(h!=e.leapday)f=!0;else{var i=parseInt(a,10);f=i%4===0&&(i%100!==0||i%400===0)}}else f=!1;if(f)return b.buffer[c-1]=g.charAt(0),b.buffer[c++]=g.charAt(1),b.buffer[c++]=a.charAt(0),{refreshFromBuffer:{start:c-3,end:c},pos:c}}return f},cardinality:2},{validator:function(a,b,c,d,e){return e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[13-9]|1[012])"+c+"[0-3])|(02"+c+"[0-2])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+c+"30)|((0[13578]|1[02])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyUp:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val((d.getMonth()+1).toString()+d.getDate().toString()+d.getFullYear().toString())}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val(d.getFullYear().toString()+(d.getMonth()+1).toString()+d.getDate().toString())}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:new RegExp("[012]"),hrs24:new RegExp("2[0-4]|1[3-9]"),hrs:new RegExp("[01][0-9]|2[0-4]"),ampm:new RegExp("^[a|p|A|P][m|M]"),mspre:new RegExp("[0-5]"),ms:new RegExp("[0-5][0-9]")},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,b,c,d,e){if("24"==e.hourFormat&&24==parseInt(a,10))return b.buffer[c-1]="0",b.buffer[c]="0",{refreshFromBuffer:{start:c-1,end:c},c:"0"};var f=e.regex.hrs.test(a);if(!d&&!f&&(a.charAt(1)==e.timeseparator||-1!="-.:".indexOf(a.charAt(1)))&&(f=e.regex.hrs.test("0"+a.charAt(0))))return b.buffer[c-1]="0",b.buffer[c]=a.charAt(0),c++,{refreshFromBuffer:{start:c-2,end:c},pos:c,c:e.timeseparator};if(f&&"24"!==e.hourFormat&&e.regex.hrs24.test(a)){var g=parseInt(a,10);return 24==g?(b.buffer[c+5]="a",b.buffer[c+6]="m"):(b.buffer[c+5]="p",b.buffer[c+6]="m"),g-=12,10>g?(b.buffer[c]=g.toString(),b.buffer[c-1]="0"):(b.buffer[c]=g.toString().charAt(1),b.buffer[c-1]=g.toString().charAt(0)),{refreshFromBuffer:{start:c-1,end:c+6},c:b.buffer[c]}}return f},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.hrspre.test(a);return d||f||!(f=e.regex.hrs.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.mspre.test(a);return d||f||!(f=e.regex.ms.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},t:{validator:function(a,b,c,d,e){return e.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.definitions,{A:{validator:"[A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"}}),a.extend(a.inputmask.defaults.aliases,{url:{mask:"ir",placeholder:"",separator:"",defaultPrefix:"http://",regex:{urlpre1:new RegExp("[fh]"),urlpre2:new RegExp("(ft|ht)"),urlpre3:new RegExp("(ftp|htt)"),urlpre4:new RegExp("(ftp:|http|ftps)"),urlpre5:new RegExp("(ftp:/|ftps:|http:|https)"),urlpre6:new RegExp("(ftp://|ftps:/|http:/|https:)"),urlpre7:new RegExp("(ftp://|ftps://|http://|https:/)"),urlpre8:new RegExp("(ftp://|ftps://|http://|https://)")},definitions:{i:{validator:function(){return!0},cardinality:8,prevalidator:function(){for(var a=[],b=8,c=0;b>c;c++)a[c]=function(){var a=c;return{validator:function(b,c,d,e,f){if(f.regex["urlpre"+(a+1)]){var g,h=b;a+1-b.length>0&&(h=c.buffer.join("").substring(0,a+1-b.length)+""+h);var i=f.regex["urlpre"+(a+1)].test(h);if(!e&&!i){for(d-=a,g=0;g<f.defaultPrefix.length;g++)c.buffer[d]=f.defaultPrefix[g],d++;for(g=0;g<h.length-1;g++)c.buffer[d]=h[g],d++;return{pos:d}}return i}return!1},cardinality:a}}();return a}()},r:{validator:".",cardinality:50}},insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(a,b,c){return c-1>-1&&"."!=b.buffer[c-1]?(a=b.buffer[c-1]+a,a=c-2>-1&&"."!=b.buffer[c-2]?b.buffer[c-2]+a:"0"+a):a="00"+a,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(a)},cardinality:1}}},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",greedy:!1,onBeforePaste:function(a){return a=a.toLowerCase(),a.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"}}}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{numeric:{mask:function(a){if(0!==a.repeat&&isNaN(a.integerDigits)&&(a.integerDigits=a.repeat),a.repeat=0,a.groupSeparator==a.radixPoint&&(a.groupSeparator="."==a.radixPoint?",":","==a.radixPoint?".":"")," "===a.groupSeparator&&(a.skipOptionalPartCharacter=void 0),a.autoGroup=a.autoGroup&&""!=a.groupSeparator,a.autoGroup&&isFinite(a.integerDigits)){var b=Math.floor(a.integerDigits/a.groupSize),c=a.integerDigits%a.groupSize;a.integerDigits+=0==c?b-1:b}a.definitions[";"]=a.definitions["~"];var d=a.prefix;return d+="[+]",d+="~{1,"+a.integerDigits+"}",void 0!=a.digits&&(isNaN(a.digits)||parseInt(a.digits)>0)&&(d+=a.digitsOptional?"["+(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}]":(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}"),d+=a.suffix},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,groupSeparator:"",radixPoint:".",radixFocus:!0,groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"+",prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,postFormat:function(b,c,d,e){var f=!1,g=b[c];if(""==e.groupSeparator||-1!=a.inArray(e.radixPoint,b)&&c>=a.inArray(e.radixPoint,b)||new RegExp("[-+]").test(g))return{pos:c};var h=b.slice();g==e.groupSeparator&&(h.splice(c--,1),g=h[c]),d?h[c]="?":h.splice(c,0,"?");var i=h.join("");if(e.autoGroup||d&&-1!=i.indexOf(e.groupSeparator)){var j=a.inputmask.escapeRegex.call(this,e.groupSeparator);f=0==i.indexOf(e.groupSeparator),i=i.replace(new RegExp(j,"g"),"");var k=i.split(e.radixPoint);if(i=k[0],i!=e.prefix+"?0"&&i.length>=e.groupSize+e.prefix.length){f=!0;for(var l=new RegExp("([-+]?[\\d?]+)([\\d?]{"+e.groupSize+"})");l.test(i);)i=i.replace(l,"$1"+e.groupSeparator+"$2"),i=i.replace(e.groupSeparator+e.groupSeparator,e.groupSeparator)}k.length>1&&(i+=e.radixPoint+k[1])}b.length=i.length;for(var m=0,n=i.length;n>m;m++)b[m]=i.charAt(m);var o=a.inArray("?",b);return d?b[o]=g:b.splice(o,1),{pos:o,refreshFromBuffer:f}},onKeyDown:function(b,c,d,e){if(b.keyCode==a.inputmask.keyCode.TAB&&"0"!=e.placeholder.charAt(0)){var f=a.inArray(e.radixPoint,c);if(-1!=f&&isFinite(e.digits)){for(var g=1;g<=e.digits;g++)(void 0==c[f+g]||c[f+g]==e.placeholder.charAt(0))&&(c[f+g]="0");return{refreshFromBuffer:{start:++f,end:f+e.digits}}}}else if(e.autoGroup&&(b.keyCode==a.inputmask.keyCode.DELETE||b.keyCode==a.inputmask.keyCode.BACKSPACE)){var h=e.postFormat(c,d-1,!0,e);return h.caret=h.pos+1,h}},onKeyPress:function(a,b,c,d){if(d.autoGroup){var e=d.postFormat(b,c-1,!0,d);return e.caret=e.pos+1,e}},regex:{integerPart:function(){return new RegExp("[-+]?\\d+")},integerNPart:function(){return new RegExp("\\d+")}},signHandler:function(a,b,c,d,e){if(!d&&(e.allowMinus&&"-"===a||e.allowPlus&&"+"===a)){var f=b.join("").match(e.regex.integerPart(e));if(f&&f.length>0&&"0"!==f[f.index])return b[f.index]==("-"===a?"+":"-")?{pos:f.index,c:a,remove:f.index,caret:c}:b[f.index]==("-"===a?"-":"+")?{remove:f.index,caret:c-1}:{pos:f.index,c:a,caret:c+1}}return!1},radixHandler:function(b,c,d,e,f){if(!e&&b===f.radixPoint){var g=a.inArray(f.radixPoint,c.buffer),h=c.buffer.join("").match(f.regex.integerPart(f));if(-1!=g)return c.validPositions[g-1]?{caret:g+1}:{pos:h.index,c:h[0],caret:g+1}}return!1},leadingZeroHandler:function(b,c,d,e,f){var g=c.buffer.join("").match(f.regex.integerNPart(f)),h=a.inArray(f.radixPoint,c.buffer);if(g&&!e&&(-1==h||g.index<h))if(0==g[0].indexOf("0")&&d>=f.prefix.length){if(-1==h||h>=d&&void 0==c.validPositions[h])return c.buffer.splice(g.index,1),d=d>g.index?d-1:g.index,{pos:d,remove:g.index};if(d>g.index&&h>=d)return c.buffer.splice(g.index,1),d=d>g.index?d-1:g.index,{pos:d,remove:g.index}}else if("0"==b&&d<=g.index)return!1;return!0},definitions:{"~":{validator:function(b,c,d,e,f){var g=f.signHandler(b,c.buffer,d,e,f);if(!g&&(g=f.radixHandler(b,c,d,e,f),!g&&(g=e?new RegExp("[0-9"+a.inputmask.escapeRegex.call(this,f.groupSeparator)+"]").test(b):new RegExp("[0-9]").test(b),g===!0&&(g=f.leadingZeroHandler(b,c,d,e,f),g===!0)))){var h=a.inArray(f.radixPoint,c.buffer);f.digitsOptional===!1&&d>h&&!e&&(g={pos:d,remove:d}),g={pos:d}}return g},cardinality:1,prevalidator:null},"+":{validator:function(a,b,c,d,e){var f=e.signHandler(a,b.buffer,c,d,e);return f||(f=e.allowMinus&&"-"==a||e.allowPlus&&"+"==a),f},cardinality:1,prevalidator:null,placeholder:""},":":{validator:function(b,c,d,e,f){var g=f.signHandler(b,c.buffer,d,e,f);if(!g){var h="["+a.inputmask.escapeRegex.call(this,f.radixPoint)+"]";g=new RegExp(h).test(b),g&&c.validPositions[d]&&c.validPositions[d].match.placeholder==f.radixPoint&&(g={pos:d,remove:d})}return g},cardinality:1,prevalidator:null,placeholder:function(a){return a.radixPoint}}},insertMode:!0,autoUnmask:!1,onUnMask:function(b,c,d){var e=b.replace(d.prefix,"");return e=e.replace(d.suffix,""),e=e.replace(new RegExp(a.inputmask.escapeRegex.call(this,d.groupSeparator),"g"),"")},isComplete:function(b,c){var d=b.join(""),e=b.slice();if(c.postFormat(e,0,!0,c),e.join("")!=d)return!1;var f=d.replace(c.prefix,"");return f=f.replace(c.suffix,""),f=f.replace(new RegExp(a.inputmask.escapeRegex.call(this,c.groupSeparator),"g"),""),f=f.replace(a.inputmask.escapeRegex.call(this,c.radixPoint),"."),isFinite(f)},onBeforeMask:function(b,c){if(isFinite(b))return b.toString().replace(".",c.radixPoint);var d=b.match(/,/g),e=b.match(/\./g);return e&&d?e.length>d.length?(b=b.replace(/\./g,""),b=b.replace(",",c.radixPoint)):d.length>e.length&&(b=b.replace(/,/g,""),b=b.replace(".",c.radixPoint)):b=b.replace(new RegExp(a.inputmask.escapeRegex.call(this,c.groupSeparator),"g"),""),b}},currency:{prefix:"$ ",groupSeparator:",",radixPoint:".",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1,decimalProtect:!0},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:"0"}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.js",maskInit:"+pp(pp)pppppppp",mask:function(b){b.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var c=[];return a.ajax({url:b.url,async:!1,dataType:"json",success:function(a){c=a}}),c=c.sort(function(a,b){return(a.mask||a)<(b.mask||b)?-1:1}),c.splice(0,0,b.maskInit),c},nojumps:!0,nojumpsThreshold:1},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",maskInit:"+32(pp)pppppppp",nojumpsThreshold:4}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(a,b){return new RegExp(b.regex).test(a.join(""))},definitions:{r:{validator:function(b,c,d,e,f){function g(a,b){this.matches=[],this.isGroup=a||!1,this.isQuantifier=b||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function h(){var a,b,c=new g,d=[];for(f.regexTokens=[];a=f.tokenizer.exec(f.regex);)switch(b=a[0],b.charAt(0)){case"(":d.push(new g(!0));break;case")":var e=d.pop();d.length>0?d[d.length-1].matches.push(e):c.matches.push(e);break;case"{":case"+":case"*":var h=new g(!1,!0);b=b.replace(/[{}]/g,"");var i=b.split(","),j=isNaN(i[0])?i[0]:parseInt(i[0]),k=1==i.length?j:isNaN(i[1])?i[1]:parseInt(i[1]);if(h.quantifier={min:j,max:k},d.length>0){var l=d[d.length-1].matches;if(a=l.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}l.push(a),l.push(h)}else{if(a=c.matches.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}c.matches.push(a),c.matches.push(h)}break;default:d.length>0?d[d.length-1].matches.push(b):c.matches.push(b)}c.matches.length>0&&f.regexTokens.push(c)}function i(b,c){var d=!1;c&&(k+="(",m++);for(var e=0;e<b.matches.length;e++){var f=b.matches[e];if(1==f.isGroup)d=i(f,!0);else if(1==f.isQuantifier){var g=a.inArray(f,b.matches),h=b.matches[g-1],j=k;if(isNaN(f.quantifier.max)){for(;f.repeaterPart&&f.repeaterPart!=k&&f.repeaterPart.length>k.length&&!(d=i(h,!0)););d=d||i(h,!0),d&&(f.repeaterPart=k),k=j+f.quantifier.max}else{for(var l=0,o=f.quantifier.max-1;o>l&&!(d=i(h,!0));l++);k=j+"{"+f.quantifier.min+","+f.quantifier.max+"}"}}else if(void 0!=f.matches)for(var p=0;p<f.length&&!(d=i(f[p],c));p++);else{var q;if("["==f.charAt(0)){q=k,q+=f;for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");d=s.test(n)}else for(var t=0,u=f.length;u>t;t++)if("\\"!=f.charAt(t)){q=k,q+=f.substr(0,t+1),q=q.replace(/\|$/,"");for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");if(d=s.test(n))break}k+=f}if(d)break}return c&&(k+=")",m--),d}null==f.regexTokens&&h();var j=c.buffer.slice(),k="",l=!1,m=0;j.splice(d,0,b);for(var n=j.join(""),o=0;o<f.regexTokens.length;o++){var g=f.regexTokens[o];if(l=i(g,g.isGroup))break}return l},cardinality:1}}}}),a.fn.inputmask}(jQuery),jQuery(document).ready(function(a){jQuery(document).on("cf.add",function(){a("[data-inputmask]").inputmask()}),jQuery(document).trigger("cf.add")}),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(){var a=document.createElement("input");return a.setAttribute("type","range"),"text"!==a.type}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}function h(a,b){return b=b||100,function(){if(!a.debouncing){var c=Array.prototype.slice.apply(arguments);a.lastReturnVal=a.apply(window,c),a.debouncing=!0}return clearTimeout(a.debounceTimeout),a.debounceTimeout=setTimeout(function(){a.debouncing=!1},b),a.lastReturnVal}}function i(b,d){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},f,d),this._defaults=f,this._name=c,this.startEvent=this.options.startEvent.join("."+c+" ")+"."+c,this.moveEvent=this.options.moveEvent.join("."+c+" ")+"."+c,this.endEvent=this.options.endEvent.join("."+c+" ")+"."+c,this.polyfill=this.options.polyfill,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.polyfill&&e)return!1;this.identifier="js-"+c+"-"+ +new Date,this.min=parseFloat(this.$element[0].getAttribute("min")||0),this.max=parseFloat(this.$element[0].getAttribute("max")||100),this.value=parseFloat(this.$element[0].value||this.min+(this.max-this.min)/2),this.step=parseFloat(this.$element[0].getAttribute("step")||1),this.$fill=a('<div class="'+this.options.fillClass+'" />'),this.$handle=a('<div class="'+this.options.handleClass+'" />'),this.$range=a('<div class="'+this.options.rangeClass+'" id="'+this.identifier+'" />').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var i=this;this.$window.on("resize."+c,h(function(){g(function(){i.update()},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+c,function(a,b){if(!b||b.origin!==c){var d=a.target.value,e=i.getPositionFromValue(d);i.setPosition(e)}})}var c="rangeslider",d=[],e=b(),f={polyfill:!0,rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]};i.prototype.init=function(){this.onInit&&"function"==typeof this.onInit&&this.onInit(),this.update()},i.prototype.update=function(){this.handleWidth=this.$handle[0].offsetWidth,this.rangeWidth=this.$range[0].offsetWidth,this.maxHandleX=this.rangeWidth-this.handleWidth,this.grabX=this.handleWidth/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position)},i.prototype.handleDown=function(a){if(a.preventDefault(),this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(this.$range[0],a),c=this.getPositionFromNode(this.$handle[0])-this.getPositionFromNode(this.$range[0]);this.setPosition(b-this.grabX),b>=c&&b<c+this.handleWidth&&(this.grabX=b-c)}},i.prototype.handleMove=function(a){a.preventDefault();var b=this.getRelativePosition(this.$range[0],a);this.setPosition(b-this.grabX)},i.prototype.handleEnd=function(a){a.preventDefault(),this.$document.off(this.moveEvent,this.handleMove),this.$document.off(this.endEvent,this.handleEnd);var b=this.getRelativePosition(this.$range[0],a);this.onSlideEnd&&"function"==typeof this.onSlideEnd&&this.onSlideEnd(b-this.grabX,this.value)},i.prototype.cap=function(a,b,c){return a<b?b:a>c?c:a},i.prototype.setPosition=function(a){var b,c;b=this.getValueFromPosition(this.cap(a,0,this.maxHandleX))/this.step*this.step,c=this.getPositionFromValue(b),this.$fill[0].style.width=c+this.grabX+"px",this.$handle[0].style.left=c+"px",this.setValue(b),this.position=c,this.value=b,this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(c,b)},i.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},i.prototype.getRelativePosition=function(a,b){return(b.pageX||b.originalEvent.clientX||b.originalEvent.touches[0].clientX||b.currentPoint.x)-this.getPositionFromNode(a)},i.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=b*this.maxHandleX},i.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandleX||1),c=this.step*Math.ceil((b*(this.max-this.min)+this.min)/this.step),Number(c.toFixed(2))},i.prototype.setValue=function(a){a!==this.value&&this.$element.val(a).trigger("change",{origin:c})},i.prototype.destroy=function(){this.$document.off(this.startEvent,"#"+this.identifier,this.handleDown),this.$element.off("."+c).removeAttr("style").removeData("plugin_"+c),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0]),d.splice(d.indexOf(this.$element[0]),1),d.length||this.$window.off("."+c)},a.fn[c]=function(b){return this.each(function(){var e=a(this),f=e.data("plugin_"+c);f||(e.data("plugin_"+c,f=new i(this,b)),d.push(this)),"string"==typeof b&&f[b]()})}}),function(a){"use strict";var b={init:function(c){return this.each(function(){this.self=a(this),b.destroy.call(this.self),this.opt=a.extend(!0,{},a.fn.raty.defaults,c),b._adjustCallback.call(this),b._adjustNumber.call(this),"img"!==this.opt.starType&&b._adjustStarType.call(this),b._adjustPath.call(this),b._createStars.call(this),this.opt.cancel&&b._createCancel.call(this),this.opt.precision&&b._adjustPrecision.call(this),b._createScore.call(this),b._apply.call(this,this.opt.score),b._target.call(this,this.opt.score),this.opt.readOnly?b._lock.call(this):(this.style.cursor="pointer",b._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var a=["number","readOnly","score","scoreName"],b=0;b<a.length;b++)"function"==typeof this.opt[a[b]]&&(this.opt[a[b]]=this.opt[a[b]].call(this))},_adjustNumber:function(){this.opt.number=b._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var a=["cancelOff","cancelOn","starHalf","starOff","starOn"],b=0;b<a.length;b++)this.opt[a[b]]=this.opt[a[b]].replace(".","-")},_apply:function(a){b._fill.call(this,a),a&&(a>0&&this.score.val(b._between(a,0,this.opt.number)),b._roundStars.call(this,a))},_between:function(a,b,c){
|
4 |
+
return Math.min(Math.max(parseFloat(a),b),c)},_binds:function(){this.cancel&&(b._bindOverCancel.call(this),b._bindClickCancel.call(this),b._bindOutCancel.call(this)),b._bindOver.call(this),b._bindClick.call(this),b._bindOut.call(this)},_bindClick:function(){var b=this;b.stars.on("click.raty",function(c){var d=a(this);b.score.val(b.opt.half||b.opt.precision?b.self.data("score"):this.alt||d.data("alt")),b.opt.click&&b.opt.click.call(b,+b.score.val(),c)})},_bindClickCancel:function(){var a=this;a.cancel.on("click.raty",function(b){a.score.removeAttr("value"),a.opt.click&&a.opt.click.call(a,null,b)})},_bindOut:function(){var a=this;a.self.on("mouseleave.raty",function(c){var d=+a.score.val()||void 0;b._apply.call(a,d),b._target.call(a,d,c),a.opt.mouseout&&a.opt.mouseout.call(a,d,c)})},_bindOutCancel:function(){var b=this;b.cancel.on("mouseleave.raty",function(c){var d=a(this),e=b.opt.path+b.opt.cancelOff;if("img"===b.opt.starType)d.attr("src",e);else{var f=b.opt.path+b.opt.cancelOn;d.removeClass(f).addClass(e)}if(b.opt.mouseout){var g=+b.score.val()||void 0;b.opt.mouseout.call(b,g,c)}})},_bindOver:function(){var a=this,c=a.opt.half?"mousemove.raty":"mouseover.raty";a.stars.on(c,function(c){var d=b._getScoreByPosition.call(a,c,this);b._fill.call(a,d),a.opt.half&&(b._roundStars.call(a,d),a.self.data("score",d)),b._target.call(a,d,c),a.opt.mouseover&&a.opt.mouseover.call(a,d,c)})},_bindOverCancel:function(){var c=this;c.cancel.on("mouseover.raty",function(d){var e=c.opt.path+c.opt.cancelOn,f=a(this),g=c.opt.path+c.opt.starOff;if("img"===c.opt.starType)f.attr("src",e),c.stars.attr("src",g);else{c.stars.attr("class",g);var h=c.opt.path+c.opt.cancelOff;f.removeClass(h).addClass(e).css("color",c.opt.starColor)}b._target.call(c,null,d),c.opt.mouseover&&c.opt.mouseover.call(c,null)})},_buildScoreField:function(){return a("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var b=this.opt.path+this.opt.cancelOff,c=a("<"+this.opt.starType+" />",{title:this.opt.cancelHint,class:"raty-cancel"}).css("marginRight",this.opt.space?this.opt.spaceWidth+"px":"0");"img"===this.opt.starType?c.attr({src:b,alt:"x"}):c.attr("data-alt","x").addClass(b),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(c):this.self.append(" ").append(c),this.cancel=c},_createScore:function(){var c=a(this.opt.targetScore);this.score=c.length?c:b._buildScoreField.call(this)},_createStars:function(){for(var c=1;c<=this.opt.number;c++){var d,e=this.opt.score&&this.opt.score>=c?"starOn":"starOff",f=b._getHint.call(this,c);e=this.opt.path+this.opt[e],d="img"!==this.opt.starType?{"data-alt":c,class:e}:{src:e,alt:c},d.title=f,a("<"+this.opt.starType+" />",d).css("marginRight",c<this.opt.number&&this.opt.space?this.opt.spaceWidth+"px":"0").appendTo(this),this.opt.space}this.stars=this.self.children(this.opt.starType)},_error:function(b){a(this).text(b),a.error(b)},_fill:function(a){for(var c=0,d=1;d<=this.stars.length;d++){var e,f=this.stars.eq(d-1),g=b._turnOn.call(this,d,a);if(this.opt.iconRange&&this.opt.iconRange.length>c){var h=this.opt.iconRange[c];e=b._getIconRange.call(this,h,g),d<=h.range&&("img"===this.opt.starType?f.attr("src",e):f.attr("class",e)),d===h.range&&c++}else e=this.opt.path+this.opt[g?"starOn":"starOff"],"img"===this.opt.starType?f.attr("src",e):f.attr("class",e),g?f.css("color",this.opt.starColor):f.css("color","")}},_getIconRange:function(a,b){return this.opt.path+(b?a.on||this.opt.starOn:a.off||this.opt.starOff)},_getScoreByPosition:function(c,d){var e=a(d),f=parseInt(d.alt||e.data("alt"),10);if(this.opt.half){var g=b._getSize.call(this),h=parseFloat((c.pageX-e.offset().left)/g);f=this.opt.precision?f-1+h:f-1+(h>.5?1:.5)}return f},_getSize:function(){var a;return a="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),a||b._error.call(this,"Could not be possible get the icon size!"),a},_turnOn:function(a,b){return this.opt.single?a===b:a<=b},_getHint:function(a){var b=this.opt.hints[a-1];return""===b?"":b||a},_lock:function(){var a=parseInt(this.score.val(),10),c=a?b._getHint.call(this,a):this.opt.noRatedMsg;this.style.cursor="",this.title=c,this.score.prop("readonly",!0),this.stars.prop("title",c),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_roundStars:function(a){var b=(a%1).toFixed(2);if(b>this.opt.round.down){var c="starOn";this.opt.halfShow&&b<this.opt.round.up?c="starHalf":b<this.opt.round.full&&(c="starOff");var d=this.stars[Math.ceil(a)-1];"img"===this.opt.starType?d.src=this.opt.path+this.opt[c]:d.style.className=this.opt[c]}},_target:function(c,d){if(this.opt.target){var e=a(this.opt.target);e.length||b._error.call(this,"Target selector invalid or missing!");var f=d&&"mouseover"===d.type;if(void 0===c)c=this.opt.targetText;else if(null===c)c=f?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?c=b._getHint.call(this,Math.ceil(c)):this.opt.precision&&(c=parseFloat(c).toFixed(1));var g=d&&"mousemove"===d.type;f||g||this.opt.targetKeep||(c=this.opt.targetText)}c&&(c=this.opt.targetFormat.toString().replace("{score}",c)),e.is(":input")?e.val(c):e.html(c)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var a=0;a<this.opt.number;a++)this.stars[a].title=b._getHint.call(this,a+1);this.cancel&&this.cancel.css("display","")},cancel:function(c){return this.each(function(){var d=a(this);d.data("readonly")!==!0&&(b[c?"click":"score"].call(d,null),this.score.removeAttr("value"))})},click:function(c){return this.each(function(){a(this).data("readonly")!==!0&&(b._apply.call(this,c),this.opt.click&&this.opt.click.call(this,c,a.Event("click")),b._target.call(this,c))})},destroy:function(){return this.each(function(){var b=a(this),c=b.data("raw");c?b.off(".raty").empty().css({cursor:c.style.cursor}).removeData("readonly"):b.data("raw",b.clone()[0])})},getScore:function(){var b,a=[];return this.each(function(){b=this.score.val(),a.push(b?+b:void 0)}),a.length>1?a:a[0]},move:function(c){return this.each(function(){var d=parseInt(c,10),e=a(this).data("options"),f=(+c).toFixed(1).split(".")[1];d>=e.number&&(d=e.number-1,f=10);var g=b._getSize.call(this),h=g/10,i=a(this.stars[d]),j=i.offset().left+h*parseInt(f,10),k=a.Event("mousemove",{pageX:j});i.trigger(k)})},readOnly:function(c){return this.each(function(){var d=a(this);d.data("readonly")!==c&&(c?(d.off(".raty").children("img").off(".raty"),b._lock.call(this)):(b._binds.call(this),b._unlock.call(this)),d.data("readonly",c))})},reload:function(){return b.set.call(this,{})},score:function(){var c=a(this);return arguments.length?b.setScore.apply(c,arguments):b.getScore.call(c)},set:function(b){return this.each(function(){var c=a(this),d=c.data("options"),e=a.extend({},d,b);c.raty(e)})},setScore:function(c){return this.each(function(){a(this).data("readonly")!==!0&&(b._apply.call(this,c),b._target.call(this,c))})}};a.fn.raty=function(c){return b[c]?b[c].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof c&&c?void a.error("Method "+c+" does not exist!"):b.init.apply(this,arguments)},a.fn.raty.defaults={cancel:!1,cancelHint:"Cancel this rating!",cancelOff:"raty-cancel-off",cancelOn:"raty-cancel-on",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["1"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,spaceWidth:3,starColor:"#ff00aa",starHalf:"star-half.png",starOff:"raty-dot-off",starOn:"raty-dot-on",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),jQuery(function(a){a("body").on("click",".cf-toggle-group-buttons a",function(){var b=a(this),c=b.closest(".caldera-config-field"),d=c.find('[data-ref="'+b.attr("id")+'"]');c.find(".btn").removeClass(b.data("active")).addClass(b.data("default")),b.addClass(b.data("active")).removeClass(b.data("default")),d.prop("checked",!0).trigger("change")})});
|
caldera-core.php
CHANGED
@@ -1,17 +1,16 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Caldera Forms
|
4 |
-
Plugin URI: https://
|
5 |
Description: Easy to use, grid based responsive form builder for creating simple to complex forms.
|
6 |
-
Author:
|
7 |
-
Version: 1.4.
|
8 |
-
Author URI:
|
9 |
Text Domain: caldera-forms
|
10 |
GitHub Plugin URI: https://github.com/CalderaWP/Caldera-Forms/
|
11 |
-
GitHub Branch:
|
12 |
*/
|
13 |
|
14 |
-
//initilize plugin
|
15 |
|
16 |
// If this file is called directly, abort.
|
17 |
if ( ! defined( 'WPINC' ) ) {
|
@@ -20,7 +19,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
20 |
|
21 |
define('CFCORE_PATH', plugin_dir_path(__FILE__));
|
22 |
define('CFCORE_URL', plugin_dir_url(__FILE__));
|
23 |
-
define('CFCORE_VER', '1.4.
|
24 |
define('CFCORE_EXTEND_URL', 'https://api.calderaforms.com/1.0/');
|
25 |
define('CFCORE_BASENAME', plugin_basename( __FILE__ ));
|
26 |
|
@@ -34,7 +33,7 @@ define('CFCORE_BASENAME', plugin_basename( __FILE__ ));
|
|
34 |
define( 'CF_DB', 4 );
|
35 |
|
36 |
// init internals of CF
|
37 |
-
include_once CFCORE_PATH . 'classes/core.php'; //
|
38 |
add_action( 'init', array( 'Caldera_Forms', 'init_cf_internal' ) );
|
39 |
// table builder
|
40 |
register_activation_hook( __FILE__, array( 'Caldera_Forms', 'activate_caldera_forms' ) );
|
@@ -48,7 +47,13 @@ function caldera_forms_load(){
|
|
48 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_DB', CFCORE_PATH . 'classes/db' );
|
49 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Entry', CFCORE_PATH . 'classes/entry' );
|
50 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Email', CFCORE_PATH . 'classes/email' );
|
|
|
|
|
|
|
51 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor_Interface', CFCORE_PATH . 'processors/classes/interfaces' );
|
|
|
|
|
|
|
52 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor', CFCORE_PATH . 'processors/classes' );
|
53 |
|
54 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms', CFCORE_PATH . 'classes' );
|
@@ -61,6 +66,7 @@ function caldera_forms_load(){
|
|
61 |
include_once CFCORE_PATH . 'includes/filter_addon_plugins.php';
|
62 |
include_once CFCORE_PATH . 'includes/compat.php';
|
63 |
include_once CFCORE_PATH . 'processors/functions.php';
|
|
|
64 |
|
65 |
/**
|
66 |
* Runs after all of the includes and autoload setup is done in Caldera Forms core
|
@@ -79,4 +85,5 @@ add_action( 'plugins_loaded', array( 'Caldera_Forms_Tracking', 'get_instance' )
|
|
79 |
if ( is_admin() || defined( 'DOING_AJAX' ) ) {
|
80 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Admin', 'get_instance' ) );
|
81 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Support', 'get_instance' ) );
|
|
|
82 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Caldera Forms
|
4 |
+
Plugin URI: https://CalderaForms.com
|
5 |
Description: Easy to use, grid based responsive form builder for creating simple to complex forms.
|
6 |
+
Author: CalderaWP
|
7 |
+
Version: 1.4.9.1
|
8 |
+
Author URI: http://CalderaLabs.org
|
9 |
Text Domain: caldera-forms
|
10 |
GitHub Plugin URI: https://github.com/CalderaWP/Caldera-Forms/
|
11 |
+
GitHub Branch: 1.4.x
|
12 |
*/
|
13 |
|
|
|
14 |
|
15 |
// If this file is called directly, abort.
|
16 |
if ( ! defined( 'WPINC' ) ) {
|
19 |
|
20 |
define('CFCORE_PATH', plugin_dir_path(__FILE__));
|
21 |
define('CFCORE_URL', plugin_dir_url(__FILE__));
|
22 |
+
define('CFCORE_VER', '1.4.9.1');
|
23 |
define('CFCORE_EXTEND_URL', 'https://api.calderaforms.com/1.0/');
|
24 |
define('CFCORE_BASENAME', plugin_basename( __FILE__ ));
|
25 |
|
33 |
define( 'CF_DB', 4 );
|
34 |
|
35 |
// init internals of CF
|
36 |
+
include_once CFCORE_PATH . 'classes/core.php'; // needs the core at the very least before plugins loaded
|
37 |
add_action( 'init', array( 'Caldera_Forms', 'init_cf_internal' ) );
|
38 |
// table builder
|
39 |
register_activation_hook( __FILE__, array( 'Caldera_Forms', 'activate_caldera_forms' ) );
|
47 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_DB', CFCORE_PATH . 'classes/db' );
|
48 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Entry', CFCORE_PATH . 'classes/entry' );
|
49 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Email', CFCORE_PATH . 'classes/email' );
|
50 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Admin', CFCORE_PATH . 'classes/admin' );
|
51 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Render', CFCORE_PATH . 'classes/render' );
|
52 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_CSV', CFCORE_PATH . 'classes/csv' );
|
53 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor_Interface', CFCORE_PATH . 'processors/classes/interfaces' );
|
54 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_API', CFCORE_PATH . 'classes/api' );
|
55 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Field', CFCORE_PATH . 'classes/field' );
|
56 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Magic', CFCORE_PATH . 'classes/magic' );
|
57 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor', CFCORE_PATH . 'processors/classes' );
|
58 |
|
59 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms', CFCORE_PATH . 'classes' );
|
66 |
include_once CFCORE_PATH . 'includes/filter_addon_plugins.php';
|
67 |
include_once CFCORE_PATH . 'includes/compat.php';
|
68 |
include_once CFCORE_PATH . 'processors/functions.php';
|
69 |
+
include_once CFCORE_PATH . 'includes/functions.php';
|
70 |
|
71 |
/**
|
72 |
* Runs after all of the includes and autoload setup is done in Caldera Forms core
|
85 |
if ( is_admin() || defined( 'DOING_AJAX' ) ) {
|
86 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Admin', 'get_instance' ) );
|
87 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Support', 'get_instance' ) );
|
88 |
+
include_once CFCORE_PATH . 'includes/plugin-page-banner.php';
|
89 |
}
|
classes/admin.php
CHANGED
@@ -27,6 +27,7 @@ class Caldera_Forms_Admin {
|
|
27 |
*/
|
28 |
protected $plugin_slug = 'caldera-forms';
|
29 |
|
|
|
30 |
/**
|
31 |
* @var string
|
32 |
*/
|
@@ -124,6 +125,8 @@ class Caldera_Forms_Admin {
|
|
124 |
|
125 |
add_filter( 'caldera_forms_manage_cap', array( __CLASS__ , 'save_form_cap_filter' ), 9, 3 );
|
126 |
|
|
|
|
|
127 |
/**
|
128 |
* Runs after Caldera Forms admin is initialized
|
129 |
*
|
@@ -328,10 +331,21 @@ class Caldera_Forms_Admin {
|
|
328 |
data-callback="new_form_redirect"
|
329 |
data-before="serialize_modal_form"
|
330 |
data-modal-autoclose="new_form"
|
|
|
331 |
><?php echo esc_html__( 'Create Form', 'caldera-forms' ); ?> <span class="dashicons dashicons-yes"></span><span class="spinner"></span></button>
|
|
|
332 |
</div>
|
|
|
333 |
</div>
|
334 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
}
|
336 |
|
337 |
public function get_form_preview(){
|
@@ -478,7 +492,7 @@ class Caldera_Forms_Admin {
|
|
478 |
}
|
479 |
|
480 |
if ( ! empty( $_POST[ 'pointer' ] ) ) {
|
481 |
-
add_user_meta( get_current_user_id(), 'cf_pointer_' . $_POST[ 'pointer' ] );
|
482 |
}
|
483 |
exit;
|
484 |
}
|
@@ -666,7 +680,7 @@ class Caldera_Forms_Admin {
|
|
666 |
global $post;
|
667 |
if(!empty($post)){
|
668 |
echo "<a id=\"caldera-forms-form-insert\" title=\"". esc_attr__( 'Add Form to Page', 'caldera-forms' ) . "\" class=\"button caldera-forms-insert-button\" href=\"#inst\">\n";
|
669 |
-
echo " <img src=\"". CFCORE_URL . "assets/images/
|
670 |
echo "</a>\n";
|
671 |
}
|
672 |
}
|
@@ -1009,8 +1023,7 @@ class Caldera_Forms_Admin {
|
|
1009 |
}
|
1010 |
|
1011 |
|
1012 |
-
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms' ) .' - '. __('
|
1013 |
-
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms' ) . ' - ' . __('Extend', 'caldera-forms' ), __('Extend', 'caldera-forms' ), Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-exend', array( $this, 'render_admin' ) );
|
1014 |
}else{
|
1015 |
// not an admin - pin for user
|
1016 |
if( ! empty( $forms ) ){
|
@@ -1081,16 +1094,23 @@ class Caldera_Forms_Admin {
|
|
1081 |
wp_enqueue_style( $this->plugin_slug . '-admin-icon-styles', CFCORE_URL . 'assets/css/dashicon.css', array(), self::VERSION );
|
1082 |
|
1083 |
if ( $screen->base === 'post' ) {
|
1084 |
-
wp_enqueue_style( $this->plugin_slug . '-modal-styles', CFCORE_URL . 'assets/css/modals.css', array(), self::VERSION );
|
1085 |
-
wp_enqueue_script( $this->plugin_slug . '-shortcode-insert', CFCORE_URL . 'assets/js/shortcode-insert.min.js', array( 'jquery' ), self::VERSION );
|
1086 |
wp_enqueue_style( 'wp-color-picker' );
|
1087 |
wp_enqueue_script( 'wp-color-picker' );
|
|
|
|
|
|
|
1088 |
}
|
1089 |
|
1090 |
if ( ! in_array( $screen->base, $this->screen_prefix ) ) {
|
1091 |
return;
|
1092 |
}
|
1093 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1094 |
wp_enqueue_media();
|
1095 |
wp_enqueue_script( 'wp-pointer' );
|
1096 |
wp_enqueue_style( 'wp-pointer' );
|
@@ -1124,9 +1144,8 @@ class Caldera_Forms_Admin {
|
|
1124 |
|
1125 |
$field_types = apply_filters( 'caldera_forms_get_field_types', array() );
|
1126 |
|
1127 |
-
|
1128 |
-
|
1129 |
-
wp_enqueue_style( 'cf-alert-styles' );
|
1130 |
wp_enqueue_style( 'cf-field-styles' );
|
1131 |
|
1132 |
wp_enqueue_script( 'cf-field' );
|
@@ -1269,10 +1288,8 @@ class Caldera_Forms_Admin {
|
|
1269 |
echo "<form method=\"POST\" action=\"admin.php?page=" . $this->plugin_slug . "\" data-load-element=\"#save_indicator\" data-sender=\"ajax\" class=\"caldera-forms-options-form edit-update-trigger\">\r\n";
|
1270 |
include CFCORE_PATH . 'ui/edit.php';
|
1271 |
echo "</form>\r\n";
|
1272 |
-
}elseif(!empty($_GET['page']) && $_GET['page'] == 'caldera-forms-
|
1273 |
include CFCORE_PATH . 'ui/extend.php';
|
1274 |
-
}elseif(!empty($_GET['page']) && $_GET['page'] == 'caldera-forms-community'){
|
1275 |
-
include CFCORE_PATH . 'ui/community.php';
|
1276 |
}elseif(!empty($_GET['page']) && false !== strpos($_GET['page'], 'caldera-forms-pin-')){
|
1277 |
$formID = substr($_GET['page'], 18);
|
1278 |
$form = Caldera_Forms_Forms::get_form( $formID );
|
@@ -1434,7 +1451,7 @@ class Caldera_Forms_Admin {
|
|
1434 |
$filter = null;
|
1435 |
// export set - transient
|
1436 |
if(!empty($_GET['tid'])){
|
1437 |
-
$items = get_transient( $_GET['tid'] );
|
1438 |
if(!empty($items)){
|
1439 |
$filter = ' AND `entry`.`id` IN (' . implode(',', $items) . ') ';
|
1440 |
}else{
|
@@ -1472,12 +1489,13 @@ class Caldera_Forms_Admin {
|
|
1472 |
if( empty( $headers ) ){
|
1473 |
wp_die( esc_html_e( 'Could not process export. This is most likely due to a problem with the form configuration.', 'caldera-forms' ) );
|
1474 |
}
|
|
|
1475 |
|
1476 |
header("Pragma: public");
|
1477 |
header("Expires: 0");
|
1478 |
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
1479 |
header("Cache-Control: private",false);
|
1480 |
-
header("Content-Type: text/csv charset
|
1481 |
header("Content-Disposition: attachment; filename=\"" . sanitize_file_name( $form['name'] ) . ".csv\";" );
|
1482 |
header("Content-Transfer-Encoding: binary");
|
1483 |
$df = fopen("php://output", 'w');
|
@@ -1543,11 +1561,35 @@ class Caldera_Forms_Admin {
|
|
1543 |
Caldera_Forms_Forms::save_form( $data );
|
1544 |
}
|
1545 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1546 |
public static function create_form(){
|
|
|
|
|
|
|
|
|
1547 |
|
1548 |
parse_str( $_POST['data'], $newform );
|
1549 |
|
1550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1551 |
$newform = Caldera_Forms_Forms::create_form( $newform );
|
1552 |
echo $newform['ID'];
|
1553 |
exit;
|
@@ -1720,15 +1762,14 @@ class Caldera_Forms_Admin {
|
|
1720 |
public static function admin_alerts(){
|
1721 |
$optin_status = Caldera_Forms_Tracking::tracking_optin_status();
|
1722 |
if( 'dismiss' !== $optin_status && 0 == $optin_status ){
|
1723 |
-
|
1724 |
-
$
|
1725 |
-
$
|
1726 |
-
$dismiss = add_query_arg( 'cal_tracking', 'dismiss', $base_url );
|
1727 |
$message[] = __( 'Allow us to track basic usage data and receive a 10% discount at CalderaWP.com.', 'caldera-forms' );
|
1728 |
$message[] = __( 'No form entries, or sensitive data will be saved.', 'caldera-forms' );
|
1729 |
$message[] = __( 'This data is used to help improve Caldera Forms and it will never be shared with a third-party.', 'caldera-forms' );
|
1730 |
$message[] = __( 'If you choose to allow us to track data, a 10% discount code for CalderaWP.com will be sent to the admin email for this site.', 'caldera-forms' );
|
1731 |
-
$message[] = sprintf( '<em><a href="https://
|
1732 |
esc_html__( 'Information on CalderaWP site about usage tracking', 'caldera-forms' ),
|
1733 |
esc_html__( 'Learn more about what is tracked here.', 'caldera-forms' )
|
1734 |
);
|
@@ -1807,8 +1848,18 @@ class Caldera_Forms_Admin {
|
|
1807 |
$url = Caldera_Forms_Tracking::api_url( 'notices' );
|
1808 |
$r_notices = Caldera_Forms_Tracking::send_to_api( $url );
|
1809 |
if ( ! empty( $r_notices ) ) {
|
1810 |
-
|
1811 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1812 |
}
|
1813 |
|
1814 |
}
|
@@ -1844,7 +1895,7 @@ class Caldera_Forms_Admin {
|
|
1844 |
*
|
1845 |
* @param array|WP_Error Response data or WP_Error
|
1846 |
*/
|
1847 |
-
|
1848 |
}
|
1849 |
}elseif( 'dismiss' == trim( $value ) ){
|
1850 |
update_option( '_caldera_forms_tracking_allowed', trim( $value ) );
|
@@ -1892,6 +1943,43 @@ class Caldera_Forms_Admin {
|
|
1892 |
return $cap;
|
1893 |
|
1894 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1895 |
|
1896 |
|
1897 |
|
27 |
*/
|
28 |
protected $plugin_slug = 'caldera-forms';
|
29 |
|
30 |
+
|
31 |
/**
|
32 |
* @var string
|
33 |
*/
|
125 |
|
126 |
add_filter( 'caldera_forms_manage_cap', array( __CLASS__ , 'save_form_cap_filter' ), 9, 3 );
|
127 |
|
128 |
+
add_action( 'caldera_forms_prerender_edit', array( __CLASS__, 'easy_pods_auto_populate' ) );
|
129 |
+
|
130 |
/**
|
131 |
* Runs after Caldera Forms admin is initialized
|
132 |
*
|
331 |
data-callback="new_form_redirect"
|
332 |
data-before="serialize_modal_form"
|
333 |
data-modal-autoclose="new_form"
|
334 |
+
data-nonce=<?php echo wp_create_nonce( 'cf_create_form' ); ?>
|
335 |
><?php echo esc_html__( 'Create Form', 'caldera-forms' ); ?> <span class="dashicons dashicons-yes"></span><span class="spinner"></span></button>
|
336 |
+
|
337 |
</div>
|
338 |
+
|
339 |
</div>
|
340 |
<?php
|
341 |
+
/**
|
342 |
+
* Runs at the bottom of the new form modal
|
343 |
+
*
|
344 |
+
* Use to add extra buttons, etc.
|
345 |
+
*
|
346 |
+
* @since 1.4.2
|
347 |
+
*/
|
348 |
+
do_action( 'caldera_forms_new_form_modal_bottom' );
|
349 |
}
|
350 |
|
351 |
public function get_form_preview(){
|
492 |
}
|
493 |
|
494 |
if ( ! empty( $_POST[ 'pointer' ] ) ) {
|
495 |
+
add_user_meta( get_current_user_id(), 'cf_pointer_' . $_POST[ 'pointer' ], array( 0 => NULL ) );
|
496 |
}
|
497 |
exit;
|
498 |
}
|
680 |
global $post;
|
681 |
if(!empty($post)){
|
682 |
echo "<a id=\"caldera-forms-form-insert\" title=\"". esc_attr__( 'Add Form to Page', 'caldera-forms' ) . "\" class=\"button caldera-forms-insert-button\" href=\"#inst\">\n";
|
683 |
+
echo " <img src=\"". CFCORE_URL . "assets/images/caldera-globe-logo-sm.png\" alt=\"". esc_attr__( 'Insert Form Shortcode' , 'caldera-forms') . "\" style=\"padding: 0px 2px 0px 0px; width: 16px; margin: -2px 0px 0px;\" /> ".__('Caldera Form', 'caldera-forms' )."\n";
|
684 |
echo "</a>\n";
|
685 |
}
|
686 |
}
|
1023 |
}
|
1024 |
|
1025 |
|
1026 |
+
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms' ) . ' - ' . __('Extend', 'caldera-forms' ), __('Extend', 'caldera-forms' ), Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-extend', array( $this, 'render_admin' ) );
|
|
|
1027 |
}else{
|
1028 |
// not an admin - pin for user
|
1029 |
if( ! empty( $forms ) ){
|
1094 |
wp_enqueue_style( $this->plugin_slug . '-admin-icon-styles', CFCORE_URL . 'assets/css/dashicon.css', array(), self::VERSION );
|
1095 |
|
1096 |
if ( $screen->base === 'post' ) {
|
|
|
|
|
1097 |
wp_enqueue_style( 'wp-color-picker' );
|
1098 |
wp_enqueue_script( 'wp-color-picker' );
|
1099 |
+
wp_enqueue_style( $this->plugin_slug . '-modal-styles', CFCORE_URL . 'assets/css/modals.css', array( 'wp-color-picker' ), self::VERSION );
|
1100 |
+
wp_enqueue_script( $this->plugin_slug . '-shortcode-insert', CFCORE_URL . 'assets/js/shortcode-insert.min.js', array( 'jquery', 'wp-color-picker' ), self::VERSION );
|
1101 |
+
|
1102 |
}
|
1103 |
|
1104 |
if ( ! in_array( $screen->base, $this->screen_prefix ) ) {
|
1105 |
return;
|
1106 |
}
|
1107 |
|
1108 |
+
add_action( 'admin_head', array( __CLASS__, 'remove_notice_actions' ) );
|
1109 |
+
if( 'caldera-forms_page_caldera-forms-extend' == $screen->base ){
|
1110 |
+
add_action( 'admin_enqueue_scripts', array( 'Caldera_Forms_Admin_Extend', 'scripts' ), 55 );
|
1111 |
+
return;
|
1112 |
+
}
|
1113 |
+
|
1114 |
wp_enqueue_media();
|
1115 |
wp_enqueue_script( 'wp-pointer' );
|
1116 |
wp_enqueue_style( 'wp-pointer' );
|
1144 |
|
1145 |
$field_types = apply_filters( 'caldera_forms_get_field_types', array() );
|
1146 |
|
1147 |
+
$clippy = new Caldera_Forms_Admin_Clippy( $this->plugin_slug, site_url() );
|
1148 |
+
$clippy->assets();
|
|
|
1149 |
wp_enqueue_style( 'cf-field-styles' );
|
1150 |
|
1151 |
wp_enqueue_script( 'cf-field' );
|
1288 |
echo "<form method=\"POST\" action=\"admin.php?page=" . $this->plugin_slug . "\" data-load-element=\"#save_indicator\" data-sender=\"ajax\" class=\"caldera-forms-options-form edit-update-trigger\">\r\n";
|
1289 |
include CFCORE_PATH . 'ui/edit.php';
|
1290 |
echo "</form>\r\n";
|
1291 |
+
}elseif(!empty($_GET['page']) && $_GET['page'] == 'caldera-forms-extend'){
|
1292 |
include CFCORE_PATH . 'ui/extend.php';
|
|
|
|
|
1293 |
}elseif(!empty($_GET['page']) && false !== strpos($_GET['page'], 'caldera-forms-pin-')){
|
1294 |
$formID = substr($_GET['page'], 18);
|
1295 |
$form = Caldera_Forms_Forms::get_form( $formID );
|
1451 |
$filter = null;
|
1452 |
// export set - transient
|
1453 |
if(!empty($_GET['tid'])){
|
1454 |
+
$items = Caldera_Forms_Transient::get_transient( $_GET['tid'] );
|
1455 |
if(!empty($items)){
|
1456 |
$filter = ' AND `entry`.`id` IN (' . implode(',', $items) . ') ';
|
1457 |
}else{
|
1489 |
if( empty( $headers ) ){
|
1490 |
wp_die( esc_html_e( 'Could not process export. This is most likely due to a problem with the form configuration.', 'caldera-forms' ) );
|
1491 |
}
|
1492 |
+
$encoding = Caldera_Forms_CSV_Util::character_encoding( $form );
|
1493 |
|
1494 |
header("Pragma: public");
|
1495 |
header("Expires: 0");
|
1496 |
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
1497 |
header("Cache-Control: private",false);
|
1498 |
+
header("Content-Type: text/csv charset=$encoding;");
|
1499 |
header("Content-Disposition: attachment; filename=\"" . sanitize_file_name( $form['name'] ) . ".csv\";" );
|
1500 |
header("Content-Transfer-Encoding: binary");
|
1501 |
$df = fopen("php://output", 'w');
|
1561 |
Caldera_Forms_Forms::save_form( $data );
|
1562 |
}
|
1563 |
|
1564 |
+
/**
|
1565 |
+
* AJAX callback for new form creation
|
1566 |
+
*
|
1567 |
+
* @since unknown
|
1568 |
+
*
|
1569 |
+
* @uses "wp_ajax_create_form" action
|
1570 |
+
*/
|
1571 |
public static function create_form(){
|
1572 |
+
$nonce_validated = false;
|
1573 |
+
if( isset( $_POST[ 'nonce' ] ) && wp_verify_nonce( $_POST[ 'nonce'], 'cf_create_form' ) ){
|
1574 |
+
$nonce_validated = true;
|
1575 |
+
}
|
1576 |
|
1577 |
parse_str( $_POST['data'], $newform );
|
1578 |
|
1579 |
|
1580 |
+
if( ! $nonce_validated ){
|
1581 |
+
if( isset( $newform, $newform[ 'nonce' ] ) ) {
|
1582 |
+
if( wp_verify_nonce( $newform[ 'nonce' ], 'cf_create_form' ) ){
|
1583 |
+
$nonce_validated = true;
|
1584 |
+
}
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
}
|
1588 |
+
|
1589 |
+
if( ! $nonce_validated ){
|
1590 |
+
status_header(500);
|
1591 |
+
wp_send_json_error( );
|
1592 |
+
}
|
1593 |
$newform = Caldera_Forms_Forms::create_form( $newform );
|
1594 |
echo $newform['ID'];
|
1595 |
exit;
|
1762 |
public static function admin_alerts(){
|
1763 |
$optin_status = Caldera_Forms_Tracking::tracking_optin_status();
|
1764 |
if( 'dismiss' !== $optin_status && 0 == $optin_status ){
|
1765 |
+
|
1766 |
+
$allow = Caldera_Forms_Tracking::allow_url();
|
1767 |
+
$dismiss = Caldera_Forms_Tracking::dismiss();
|
|
|
1768 |
$message[] = __( 'Allow us to track basic usage data and receive a 10% discount at CalderaWP.com.', 'caldera-forms' );
|
1769 |
$message[] = __( 'No form entries, or sensitive data will be saved.', 'caldera-forms' );
|
1770 |
$message[] = __( 'This data is used to help improve Caldera Forms and it will never be shared with a third-party.', 'caldera-forms' );
|
1771 |
$message[] = __( 'If you choose to allow us to track data, a 10% discount code for CalderaWP.com will be sent to the admin email for this site.', 'caldera-forms' );
|
1772 |
+
$message[] = sprintf( '<em><a href="https://calderaforms.com/?post_type=doc&p=17228" target="_blank" title="%s">%s</a></em>',
|
1773 |
esc_html__( 'Information on CalderaWP site about usage tracking', 'caldera-forms' ),
|
1774 |
esc_html__( 'Learn more about what is tracked here.', 'caldera-forms' )
|
1775 |
);
|
1848 |
$url = Caldera_Forms_Tracking::api_url( 'notices' );
|
1849 |
$r_notices = Caldera_Forms_Tracking::send_to_api( $url );
|
1850 |
if ( ! empty( $r_notices ) ) {
|
1851 |
+
if( is_string( $r_notices ) ){
|
1852 |
+
$r_notices = json_decode( $r_notices );
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
if( is_object( $r_notices ) ){
|
1856 |
+
$r_notices = (array) $r_notices;
|
1857 |
+
}
|
1858 |
+
|
1859 |
+
if ( is_array( $r_notices ) ) {
|
1860 |
+
$notices = array_merge($notices, $r_notices);
|
1861 |
+
update_option('_cf_admin_alerts', $notices);
|
1862 |
+
}
|
1863 |
}
|
1864 |
|
1865 |
}
|
1895 |
*
|
1896 |
* @param array|WP_Error Response data or WP_Error
|
1897 |
*/
|
1898 |
+
do_action( 'caldera_form_after_tracking_optin', $response );
|
1899 |
}
|
1900 |
}elseif( 'dismiss' == trim( $value ) ){
|
1901 |
update_option( '_caldera_forms_tracking_allowed', trim( $value ) );
|
1943 |
return $cap;
|
1944 |
|
1945 |
}
|
1946 |
+
|
1947 |
+
/**
|
1948 |
+
* Add Easy Pods as an auto-populate option in admin
|
1949 |
+
*
|
1950 |
+
* @since 1.4.3
|
1951 |
+
*
|
1952 |
+
* @uses "caldera_forms_prerender_edit" action
|
1953 |
+
*/
|
1954 |
+
public static function easy_pods_auto_populate(){
|
1955 |
+
if( version_compare( phpversion(), '5.3.0', '>=' ) ){
|
1956 |
+
if( class_exists( 'Caldera_Easy_Pods' ) ){
|
1957 |
+
new Caldera_Forms_Admin_APEasyPods;
|
1958 |
+
}
|
1959 |
+
|
1960 |
+
if( defined( 'CAEQ_PATH' ) ){
|
1961 |
+
new Caldera_Forms_Admin_APEasyQueries;
|
1962 |
+
}
|
1963 |
+
}
|
1964 |
+
|
1965 |
+
}
|
1966 |
+
|
1967 |
+
/**
|
1968 |
+
* Remove hooks for admin notices while in Caldera Forms admin
|
1969 |
+
*
|
1970 |
+
* Caldera Forms admin does not play nice with admin notices, so we use a series of steps to remove most of them, sadly can not beat them all.
|
1971 |
+
*
|
1972 |
+
* @since 1.4.7
|
1973 |
+
* @uses "admin_head" action
|
1974 |
+
*/
|
1975 |
+
public static function remove_notice_actions(){
|
1976 |
+
remove_all_actions( 'admin_notices' );
|
1977 |
+
remove_all_actions( 'network_admin_notices' );
|
1978 |
+
remove_all_actions( 'user_admin_notices' );
|
1979 |
+
remove_all_actions( 'all_admin_notices' );
|
1980 |
+
}
|
1981 |
+
|
1982 |
+
|
1983 |
|
1984 |
|
1985 |
|
classes/admin/apeasypods.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Add auto-populate option for Easy Pods to select fields
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Admin_APEasyPods extends Caldera_Forms_Admin_APSetup {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @inheritdoc
|
16 |
+
*/
|
17 |
+
public function add_type() {
|
18 |
+
if( class_exists( 'Caldera_Easy_Pods' ) ){
|
19 |
+
printf( '<option value="easy-pod"{{#is auto_type value="easy-pod"}} selected="selected"{{/is}}>%s</option>', esc_html__( 'Easy Pod', 'caldera-forms' ) );
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @inheritdoc
|
25 |
+
*/
|
26 |
+
public function add_options() {
|
27 |
+
if( ! function_exists( 'cep_get_registry' ) ){
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
$easy_pods = cep_get_registry();
|
31 |
+
?>
|
32 |
+
<div class="caldera-config-group caldera-config-group-auto-easy-pod auto-populate-type-panel" style="display:none;">
|
33 |
+
<label for="cf-auto-populate-easy-pods">
|
34 |
+
<?php esc_html_e( 'Easy Pod', 'caldera-forms' ); ?>
|
35 |
+
</label>
|
36 |
+
<div class="caldera-config-field">
|
37 |
+
<select id="cf-auto-populate-easy-pods" class="block-input field-config" name="{{_name}}[easy-pod]">";
|
38 |
+
<?php
|
39 |
+
foreach($easy_pods as $easy_pod ){
|
40 |
+
printf( '<option value="%s" {{#is easy-pod value="%s"}}selected="selected"{{/is}}>%s</option>',
|
41 |
+
esc_attr( $easy_pod[ 'id' ] ), esc_attr( $easy_pod[ 'id' ] ), esc_html__( $easy_pod[ 'name' ] ));
|
42 |
+
}
|
43 |
+
|
44 |
+
?></select>
|
45 |
+
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<?php
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
classes/admin/apeasyqueries.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Add auto-populate option for Easy Queries to select fields
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Admin_APEasyQueries extends Caldera_Forms_Admin_APSetup {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @inheritdoc
|
16 |
+
*/
|
17 |
+
public function add_type() {
|
18 |
+
if( defined( 'CAEQ_PATH' ) ){
|
19 |
+
printf( '<option value="easy-query"{{#is auto_type value="easy-query"}} selected="selected"{{/is}}>%s</option>', esc_html__( 'Easy Query', 'caldera-forms' ) );
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @inheritdoc
|
25 |
+
*/
|
26 |
+
public function add_options() {
|
27 |
+
if( ! defined( 'CAEQ_PATH' ) ){
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
$easy_queries = \calderawp\caeq\options::get_registry();
|
31 |
+
?>
|
32 |
+
<div class="caldera-config-group caldera-config-group-auto-easy-query auto-populate-type-panel" style="display:none;">
|
33 |
+
<label for="cf-auto-populate-easy-queries">
|
34 |
+
<?php esc_html_e( 'Easy Queries', 'caldera-forms' ); ?>
|
35 |
+
</label>
|
36 |
+
<div class="caldera-config-field">
|
37 |
+
<select id="cf-auto-populate-easy-queries" class="block-input field-config" name="{{_name}}[easy-query]">";
|
38 |
+
<?php
|
39 |
+
foreach( $easy_queries as $easy_query ){
|
40 |
+
printf( '<option value="%s" {{#is easy-query value="%s"}}selected="selected"{{/is}}>%s</option>',
|
41 |
+
esc_attr( $easy_query[ 'id' ] ), esc_attr( $easy_query[ 'id' ] ), esc_html__( $easy_query[ 'name' ] ));
|
42 |
+
}
|
43 |
+
|
44 |
+
?></select>
|
45 |
+
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<?php
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
classes/admin/apsetup.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Base class for adding auto-populate options to select fields
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
abstract class Caldera_Forms_Admin_APSetup implements Caldera_Forms_Admin_APSetupInterface {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Caldera_Forms_Admin_APSetup constructor.
|
16 |
+
*
|
17 |
+
* @since 1.4.3
|
18 |
+
*/
|
19 |
+
public function __construct() {
|
20 |
+
$this->add_hooks();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add hooks
|
25 |
+
*
|
26 |
+
* @since 1.4.3
|
27 |
+
*/
|
28 |
+
protected function add_hooks(){
|
29 |
+
add_action( 'caldera_forms_autopopulate_types', array( $this, 'add_type' ) );
|
30 |
+
add_action( 'caldera_forms_autopopulate_type_config', array( $this, 'add_options' ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Remove hooks
|
35 |
+
*
|
36 |
+
* @since 1.4.3
|
37 |
+
*/
|
38 |
+
public function remove_hooks(){
|
39 |
+
remove_action( 'caldera_forms_autopopulate_types', array( $this, 'add_type' ) );
|
40 |
+
remove_action( 'caldera_forms_autopopulate_type_config', array( $this, 'add_options' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
}
|
classes/admin/apsetupinterface.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Interface for adding auto-populate options to select fields
|
5 |
+
*
|
6 |
+
* Both methods are hook callbacks
|
7 |
+
*
|
8 |
+
* @package Caldera_Forms
|
9 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
10 |
+
* @license GPL-2.0+
|
11 |
+
* @link
|
12 |
+
* @copyright 2016 CalderaWP LLC
|
13 |
+
*/
|
14 |
+
interface Caldera_Forms_Admin_APSetupInterface {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Add the type option element
|
18 |
+
*
|
19 |
+
* @uses "caldera_forms_autopopulate_types" action
|
20 |
+
*
|
21 |
+
* @since 1.4.3
|
22 |
+
*/
|
23 |
+
public function add_type();
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Add the options for what to aut-populate by
|
27 |
+
*
|
28 |
+
* @uses "caldera_forms_autopopulate_type_config" action
|
29 |
+
*
|
30 |
+
* @since 1.4.3
|
31 |
+
*/
|
32 |
+
public function add_options();
|
33 |
+
|
34 |
+
}
|
classes/admin/clippy.php
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Sets up admin helpful messages
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Admin_Clippy {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Handle for Javascript
|
16 |
+
*
|
17 |
+
* @since 1.4.5
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
protected $script_handle;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Hashed version of URL to send
|
25 |
+
*
|
26 |
+
* @since 1.4.5
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
protected $url_hash;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Caldera_Forms_Admin_Clippy constructor.
|
34 |
+
*
|
35 |
+
* @since 1.4.5
|
36 |
+
*
|
37 |
+
* @param string $plugin_slug Plugin slug
|
38 |
+
* @param string $url Current site URL
|
39 |
+
*/
|
40 |
+
public function __construct( $plugin_slug, $url ) {
|
41 |
+
$this->script_handle = $plugin_slug . '-clippy';
|
42 |
+
$this->url_hash = md5( $url );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Setup JavaScript
|
47 |
+
*
|
48 |
+
* @since 1.4.5
|
49 |
+
*/
|
50 |
+
public function assets(){
|
51 |
+
|
52 |
+
wp_enqueue_script( $this->script_handle, CFCORE_URL . 'assets/js/caldera-clippy.js', array( 'jquery' ), Caldera_Forms::VERSION );
|
53 |
+
wp_localize_script( $this->script_handle, 'CF_CLIPPY', $this->localizer() );
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Prepare data to localize
|
58 |
+
*
|
59 |
+
* @since 1.4.5
|
60 |
+
*
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
protected function localizer(){
|
64 |
+
$data = array(
|
65 |
+
'api' => 'https://octaviabutler.caldera.space',
|
66 |
+
'p1' => $this->randoms(),
|
67 |
+
'p2' => $this->randoms(),
|
68 |
+
'p3' => $this->randoms(),
|
69 |
+
'url' => $this->url_hash,
|
70 |
+
'l' => get_locale(),
|
71 |
+
'fallback' => $this->fallback_clippy(),
|
72 |
+
'template' => $this->template(),
|
73 |
+
'email_clippy' => $this->email_clippy()
|
74 |
+
);
|
75 |
+
|
76 |
+
$forms = Caldera_Forms_Forms::get_forms();
|
77 |
+
if( empty( $forms ) ){
|
78 |
+
$data[ 'no_forms' ] = $this->create_form_clippy();
|
79 |
+
unset( $data[ 'email_clippy' ] );
|
80 |
+
}
|
81 |
+
|
82 |
+
return $data;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Create random string of digits for p tag
|
87 |
+
*
|
88 |
+
* @since 1.4.5
|
89 |
+
*
|
90 |
+
* @param int $length Optional. Length of string. Default is 4.
|
91 |
+
*
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
protected function randoms( $length = 4 ){
|
95 |
+
$str = '';
|
96 |
+
for( $i = 0; $i <= $length; $i++ ){
|
97 |
+
$str .= rand( 1,9 );
|
98 |
+
}
|
99 |
+
|
100 |
+
return $str;
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Handlebars template for a clippy
|
106 |
+
*
|
107 |
+
* @since 1.4.5
|
108 |
+
*
|
109 |
+
* @return string
|
110 |
+
*/
|
111 |
+
protected function template(){
|
112 |
+
/** Don't unmifiy this!! */
|
113 |
+
return '<div class="caldera-forms-clippy-zone-inner-wrap"><div class="caldera-forms-clippy" ><h2>{{title.content}}</h2><p>{{content.content}}</p><a href="{{link.url}}" data-bt={{link.bt}} target="_blank" class="bt-btn btn btn-{{btn.color}}">{{ btn.content }}</a></div></div>';
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Email stats clippy
|
119 |
+
*
|
120 |
+
* @since 1.4.5
|
121 |
+
*
|
122 |
+
* @return array
|
123 |
+
*/
|
124 |
+
protected function email_clippy(){
|
125 |
+
$clippy = array(
|
126 |
+
'title' => array(
|
127 |
+
'content' => __( 'Email Stats', 'caldera-forms' ),
|
128 |
+
),
|
129 |
+
'content' => array(
|
130 |
+
'content' => '',
|
131 |
+
),
|
132 |
+
'btn' => array(
|
133 |
+
'content' => __( 'Email Resources', 'caldera-forms' ),
|
134 |
+
'grey' => 'orange'
|
135 |
+
),
|
136 |
+
'link' => array(
|
137 |
+
'url' => 'https://calderaforms.com/caldera-forms-emails?utm_source=obs&utm_campaign=admin-page&utm_medium=caldera-forms&utm_term=fallback',
|
138 |
+
'bt' => 'email-stats'
|
139 |
+
)
|
140 |
+
);
|
141 |
+
|
142 |
+
if( Caldera_Forms_Tracking::tracking_allowed() ){
|
143 |
+
$stats = new Caldera_Forms_Email_TrackData();
|
144 |
+
$stats = $stats->get_stats( );
|
145 |
+
$clippy[ 'content' ][ 'content' ] = __( sprintf( 'Success rate for emails is %d percent of %s total emails', 100 * $stats[ 'success_rate' ], $stats[ 'total' ] ), 'caldera-forms' );
|
146 |
+
}else{
|
147 |
+
$url = Caldera_Forms_Tracking::allow_url();
|
148 |
+
$clippy[ 'content' ][ 'content' ] = __( 'Enable usage tracking to get email stats.', 'caldera-forms' );
|
149 |
+
$clippy[ 'link' ][ 'url' ] = add_query_arg( 'clippy', 1, $url );
|
150 |
+
$clippy[ 'link' ][ 'bt' ] = 'tracking-optin';
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
return $clippy;
|
155 |
+
}
|
156 |
+
|
157 |
+
protected function create_form_clippy()
|
158 |
+
{
|
159 |
+
$clippy = array(
|
160 |
+
'title' => array(
|
161 |
+
'content' => __( 'Need Help Creating A Form?', 'caldera-forms' ),
|
162 |
+
),
|
163 |
+
'content' => array(
|
164 |
+
'content' => 'Click the "New Form" button at the top of the page, or read or getting started guide for creating forms.',
|
165 |
+
),
|
166 |
+
'btn' => array(
|
167 |
+
'content' => __( 'Read The Guide', 'caldera-forms' ),
|
168 |
+
'color' => 'orange'
|
169 |
+
),
|
170 |
+
'link' => array(
|
171 |
+
'url' => 'https://calderaforms.com/doc/creating-new-form?utm_source=obs&utm_campaign=admin-page&utm_medium=caldera-forms&utm_term=no_forms',
|
172 |
+
'bt' => 'email-stats'
|
173 |
+
)
|
174 |
+
);
|
175 |
+
|
176 |
+
return $clippy;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Fallback clippy with link to getting started guide for when the API can't br reached
|
181 |
+
*
|
182 |
+
* @since 1.4.5
|
183 |
+
*
|
184 |
+
* @return array
|
185 |
+
*/
|
186 |
+
protected function fallback_clippy(){
|
187 |
+
return array(
|
188 |
+
'title' => array(
|
189 |
+
'content' => __( 'New To Caldera Forms?', 'caldera-forms' ),
|
190 |
+
),
|
191 |
+
'content' => array(
|
192 |
+
'content' => __( 'We have a complete getting started guide for new users.', 'caldera-forms' ),
|
193 |
+
),
|
194 |
+
'btn' => array(
|
195 |
+
'content' => __( 'Read Now', 'caldera-forms' ),
|
196 |
+
'color' => 'orange'
|
197 |
+
),
|
198 |
+
'link' => array(
|
199 |
+
'url' => 'https://calderaforms.com/getting-started?utm_source=obs&utm_campaign=admin-page&utm_medium=caldera-forms&utm_term=fallback'
|
200 |
+
)
|
201 |
+
);
|
202 |
+
}
|
203 |
+
|
204 |
+
}
|
classes/admin/extend.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Manage extend sub-menu
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Admin_Extend {
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Enqueue scripts for the admin extend sub menu
|
17 |
+
*
|
18 |
+
* @uses "admin_enqueue_scripts" action
|
19 |
+
*
|
20 |
+
* @since 1.4.2
|
21 |
+
*/
|
22 |
+
public static function scripts(){
|
23 |
+
wp_enqueue_script( Caldera_Forms::PLUGIN_SLUG . '-handlebars', CFCORE_URL . 'assets/js/handlebars.js', array( 'jquery' ) );
|
24 |
+
wp_enqueue_style( Caldera_Forms::PLUGIN_SLUG . '-admin-styles', CFCORE_URL . 'assets/css/admin.css', array(), Caldera_Forms::VERSION );
|
25 |
+
}
|
26 |
+
}
|
classes/admin/feed.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Mini CalderaWP.com API client for feeds to admin
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Admin_Feed {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* URL for the API
|
16 |
+
*
|
17 |
+
* @since 1.4.2
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
protected static $api_url = 'https://calderaforms.com/wp-json/calderawp_api/v2/';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get the data for the request from remote site
|
25 |
+
*
|
26 |
+
* @since 1.4.2
|
27 |
+
*
|
28 |
+
* @param string $endpoint Endpoint for request.
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
protected static function request_data( $endpoint ) {
|
33 |
+
$url = self::$api_url . $endpoint;
|
34 |
+
|
35 |
+
$request = wp_remote_get( $url );
|
36 |
+
$data = '';
|
37 |
+
if ( ! is_wp_error( $request ) ) {
|
38 |
+
$data = wp_remote_retrieve_body( $request );
|
39 |
+
$data = json_decode( $data );
|
40 |
+
}
|
41 |
+
|
42 |
+
return $data;
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get the data for the request from remote site or cache
|
48 |
+
*
|
49 |
+
* @since 1.4.2
|
50 |
+
*
|
51 |
+
* @param string $endpoint Endpoint for request.
|
52 |
+
* @param null|array $args Optional. Additional query vars to add to request.
|
53 |
+
*
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
protected static function get_data( $endpoint, $args = null ){
|
57 |
+
if ( is_array( $args ) ) {
|
58 |
+
$endpoint = add_query_arg( $args, $endpoint );
|
59 |
+
}
|
60 |
+
|
61 |
+
$key = md5( 'cf_feed' . $endpoint . CFCORE_VER );
|
62 |
+
|
63 |
+
if ( false == ( $data = get_transient( $key ) ) ) {
|
64 |
+
$data = self::request_data( $endpoint );
|
65 |
+
foreach ( $data as &$datum ){
|
66 |
+
$datum = self::prepare_item( $datum );
|
67 |
+
}
|
68 |
+
|
69 |
+
set_transient( $key, $data, HOUR_IN_SECONDS );
|
70 |
+
}
|
71 |
+
|
72 |
+
return $data;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get featured plugins
|
77 |
+
*
|
78 |
+
* @since 1.4.2
|
79 |
+
*
|
80 |
+
* @return array|string
|
81 |
+
*/
|
82 |
+
public static function get_featured(){
|
83 |
+
return self::get_data( 'products/featured' );
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get Caldera Forms add-on
|
89 |
+
*
|
90 |
+
* @since 1.4.2
|
91 |
+
*
|
92 |
+
* @return array|string
|
93 |
+
*/
|
94 |
+
public static function get_cf_addons(){
|
95 |
+
return self::get_data( 'products/cf-addons', array( 'per_page' => 50 ) );
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Setup each item
|
100 |
+
*
|
101 |
+
* @since 1.4.8
|
102 |
+
*
|
103 |
+
* @param stdClass $data API response item
|
104 |
+
*
|
105 |
+
* @return stdClass
|
106 |
+
*/
|
107 |
+
protected static function prepare_item( $data ){
|
108 |
+
if ( isset( $data->link ) ) {
|
109 |
+
$data->link = add_query_arg( array(
|
110 |
+
'utm_source' => 'wordpress',
|
111 |
+
'utm_medium' => 'extend-page',
|
112 |
+
'utm_term' => 'v' . CFCORE_VER,
|
113 |
+
'utm_campaign' => $data->slug
|
114 |
+
), $data->link );
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Specify an Affiliate ID to add to items in extend tab
|
118 |
+
*
|
119 |
+
* @since 1.4.8
|
120 |
+
*
|
121 |
+
* @param int|null ID of affiliate
|
122 |
+
*/
|
123 |
+
$affiliate_id = apply_filters( 'caldera_forms_affiliate_id', null );
|
124 |
+
if ( 0 < absint( $affiliate_id ) ) {
|
125 |
+
add_query_arg( 'thnx', $affiliate_id, $data->link );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
return $data;
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
classes/api/crud.php
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Abstract class the all REST API route collections that follow CRUD pattern should extend
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
abstract class Caldera_Forms_API_CRUD implements Caldera_Forms_API_Route {
|
13 |
+
|
14 |
+
protected $namespace;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @inheritdoc
|
18 |
+
*
|
19 |
+
@since 1.4.4
|
20 |
+
*/
|
21 |
+
public function add_routes( $namespace ) {
|
22 |
+
$this->namespace = $namespace;
|
23 |
+
register_rest_route( $namespace, $this->non_id_endpoint_url(), array(
|
24 |
+
array(
|
25 |
+
'methods' => \WP_REST_Server::READABLE,
|
26 |
+
'callback' => array( $this, 'get_items' ),
|
27 |
+
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
28 |
+
'args' => $this->get_items_args(),
|
29 |
+
),
|
30 |
+
array(
|
31 |
+
'methods' => \WP_REST_Server::CREATABLE,
|
32 |
+
'callback' => array( $this, 'create_item' ),
|
33 |
+
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
34 |
+
'args' => $this->request_args()
|
35 |
+
),
|
36 |
+
)
|
37 |
+
);
|
38 |
+
register_rest_route( $namespace, $this->id_endpoint_url(), array(
|
39 |
+
array(
|
40 |
+
'methods' => \WP_REST_Server::READABLE,
|
41 |
+
'callback' => array( $this, 'get_item' ),
|
42 |
+
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
43 |
+
'args' => array(
|
44 |
+
'context' => array(
|
45 |
+
'default' => 'view',
|
46 |
+
)
|
47 |
+
),
|
48 |
+
),
|
49 |
+
array(
|
50 |
+
'methods' => \WP_REST_Server::EDITABLE,
|
51 |
+
'callback' => array( $this, 'update_item' ),
|
52 |
+
'permission_callback' => array( $this, 'update_item_permissions_check' ),
|
53 |
+
'args' => $this->request_args( )
|
54 |
+
),
|
55 |
+
array(
|
56 |
+
'methods' => \WP_REST_Server::DELETABLE,
|
57 |
+
'callback' => array( $this, 'delete_item' ),
|
58 |
+
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
59 |
+
'args' => array(
|
60 |
+
'force' => array(
|
61 |
+
'default' => false,
|
62 |
+
'required' => false,
|
63 |
+
),
|
64 |
+
'all' => array(
|
65 |
+
'default' => false,
|
66 |
+
'required' => false,
|
67 |
+
),
|
68 |
+
'id' => array(
|
69 |
+
'default' => 0,
|
70 |
+
'sanatization_callback' => 'absint'
|
71 |
+
)
|
72 |
+
),
|
73 |
+
),
|
74 |
+
)
|
75 |
+
);
|
76 |
+
|
77 |
+
register_rest_route( $namespace, '/' . $this->route_base(), array(
|
78 |
+
'methods' => 'GET',
|
79 |
+
'callback' => array( $this, 'index' ),
|
80 |
+
) );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Callback for the index of this collection
|
85 |
+
*
|
86 |
+
* @since 1.4.4
|
87 |
+
*
|
88 |
+
* @param WP_REST_Request $request
|
89 |
+
*
|
90 |
+
* @return Caldera_Forms_API_Response
|
91 |
+
*/
|
92 |
+
public function index( WP_REST_Request $request ){
|
93 |
+
/** @var WP_REST_Server $wp_rest_server */
|
94 |
+
global $wp_rest_server;
|
95 |
+
$routes = $wp_rest_server->get_routes();
|
96 |
+
$endpoints = array();
|
97 |
+
foreach ( $routes as $route => $route_endpoints ){
|
98 |
+
if( false !== strpos( $route, $this->namespace . '/' . $this->route_base() ) ){
|
99 |
+
$endpoints[ $route ] = $route_endpoints;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
$data = array(
|
104 |
+
'namespace' => $this->namespace,
|
105 |
+
'routes' => $wp_rest_server->get_data_for_routes( $endpoints, $request['context'] ),
|
106 |
+
);
|
107 |
+
|
108 |
+
return new Caldera_Forms_API_Response( $data, 200, array() );
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Define query arguments
|
114 |
+
*
|
115 |
+
@since 1.4.4
|
116 |
+
*
|
117 |
+
* @return array(
|
118 |
+
*/
|
119 |
+
public function request_args(){
|
120 |
+
//must ovveride, should be abstract but PHP5.2
|
121 |
+
_doing_it_wrong( __FUNCTION__, '', '1.5.0' );
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Check if a given request has access to get items
|
126 |
+
*
|
127 |
+
@since 1.4.4
|
128 |
+
*
|
129 |
+
* @param WP_REST_Request $request Full data about the request.
|
130 |
+
* @return \WP_Error|bool
|
131 |
+
*/
|
132 |
+
public function get_items_permissions_check( WP_REST_Request $request ){
|
133 |
+
//must ovveride, should be abstract but PHP5.2
|
134 |
+
_doing_it_wrong( __FUNCTION__, '', '1.5.0' );
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Check if a given request has access to get a specific item
|
139 |
+
*
|
140 |
+
@since 1.4.4
|
141 |
+
*
|
142 |
+
* @param WP_REST_Request $request Full data about the request.
|
143 |
+
* @return \WP_Error|bool
|
144 |
+
*/
|
145 |
+
public function get_item_permissions_check( WP_REST_Request $request ) {
|
146 |
+
return $this->get_items_permissions_check( $request );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Check if a given request has access to create items
|
151 |
+
*
|
152 |
+
@since 1.4.4
|
153 |
+
*
|
154 |
+
* @param WP_REST_Request $request Full data about the request.
|
155 |
+
* @return \WP_Error|bool
|
156 |
+
*/
|
157 |
+
public function create_item_permissions_check( WP_REST_Request $request ){
|
158 |
+
//must ovveride, should be abstract but PHP5.2
|
159 |
+
_doing_it_wrong( __FUNCTION__, '', '1.5.0' );
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Check if a given request has access to update a specific item
|
164 |
+
*
|
165 |
+
@since 1.4.4
|
166 |
+
*
|
167 |
+
* @param WP_REST_Request $request Full data about the request.
|
168 |
+
* @return \WP_Error|bool
|
169 |
+
*/
|
170 |
+
public function update_item_permissions_check( WP_REST_Request $request ) {
|
171 |
+
return $this->create_item_permissions_check( $request );
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Check if a given request has access to delete a specific item
|
176 |
+
*
|
177 |
+
@since 1.4.4
|
178 |
+
*
|
179 |
+
* @param WP_REST_Request $request Full data about the request.
|
180 |
+
* @return \WP_Error|bool
|
181 |
+
*/
|
182 |
+
public function delete_item_permissions_check( WP_REST_Request $request ) {
|
183 |
+
return $this->create_item_permissions_check( $request );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Get a collection of items
|
188 |
+
*
|
189 |
+
@since 1.4.4
|
190 |
+
*
|
191 |
+
* @param WP_REST_Request $request Full data about the request.
|
192 |
+
* @return \WP_Error|\WP_REST_Response
|
193 |
+
*/
|
194 |
+
public function get_items( WP_REST_Request $request ) {
|
195 |
+
return $this->not_yet_response();
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Get one item from the collection
|
200 |
+
*
|
201 |
+
@since 1.4.4
|
202 |
+
*
|
203 |
+
* @param WP_REST_Request $request Full data about the request.
|
204 |
+
* @return \WP_Error|\WP_REST_Response
|
205 |
+
*/
|
206 |
+
public function get_item( WP_REST_Request $request ) {
|
207 |
+
return $this->not_yet_response();
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Create one item from the collection
|
212 |
+
*
|
213 |
+
@since 1.4.4
|
214 |
+
*
|
215 |
+
* @param WP_REST_Request $request Full data about the request.
|
216 |
+
* @return Caldera_Forms_API_Response|Caldera_Forms_API_Error
|
217 |
+
*/
|
218 |
+
public function create_item( WP_REST_Request $request ) {
|
219 |
+
return $this->not_yet_response();
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Update one item from the collection
|
224 |
+
*
|
225 |
+
@since 1.4.4
|
226 |
+
*
|
227 |
+
* @param WP_REST_Request $request Full data about the request.
|
228 |
+
* @return Caldera_Forms_API_Response|Caldera_Forms_API_Error
|
229 |
+
*/
|
230 |
+
public function update_item( WP_REST_Request $request ) {
|
231 |
+
return $this->not_yet_response();
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Delete one item from the collection
|
236 |
+
*
|
237 |
+
@since 1.4.4
|
238 |
+
*
|
239 |
+
* @param WP_REST_Request $request Full data about the request.
|
240 |
+
* @return Caldera_Forms_API_Response|Caldera_Forms_API_Error
|
241 |
+
*/
|
242 |
+
public function delete_item( WP_REST_Request $request ) {
|
243 |
+
return $this->not_yet_response();
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Return a 501 error for non-existant route
|
248 |
+
*
|
249 |
+
@since 1.4.4
|
250 |
+
*
|
251 |
+
* @return Caldera_Forms_API_Response
|
252 |
+
*/
|
253 |
+
protected function not_yet_response() {
|
254 |
+
$error = new Caldera_Forms_API_Error( 'not-implemented-yet', __( 'Route Not Yet Implemented :(', 'caldera-forms' ) );
|
255 |
+
return new Caldera_Forms_API_Response( $error, 501, [] );
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Get class shortname and use as base
|
260 |
+
*
|
261 |
+
@since 1.4.4
|
262 |
+
*
|
263 |
+
* MUST ovveride in subclass with a hardcoded string.
|
264 |
+
*/
|
265 |
+
protected function route_base() {
|
266 |
+
//must ovveride, should be abstract but PHP5.2
|
267 |
+
_doing_it_wrong( __FUNCTION__, '', '1.5.0' );
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Form the endpoint URL that deos not include item ID
|
272 |
+
*
|
273 |
+
* Used by for get_items() and create_items()
|
274 |
+
*
|
275 |
+
@since 1.4.4
|
276 |
+
*
|
277 |
+
* @return string
|
278 |
+
*/
|
279 |
+
protected function non_id_endpoint_url() {
|
280 |
+
return '/' . $this->route_base();
|
281 |
+
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Form the endpoint URL that includes item ID
|
286 |
+
*
|
287 |
+
* Used by for get_item() and update_time() and delete_item()
|
288 |
+
*
|
289 |
+
@since 1.4.4
|
290 |
+
*
|
291 |
+
* @return string
|
292 |
+
*/
|
293 |
+
public function id_endpoint_url() {
|
294 |
+
return '/' . $this->route_base() . '/(?P<id>[\w-]+)';
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* @return array
|
299 |
+
*/
|
300 |
+
public function get_items_args() {
|
301 |
+
return array(
|
302 |
+
'page' => array(
|
303 |
+
'default' => 1,
|
304 |
+
'sanitize_callback' => 'absint',
|
305 |
+
),
|
306 |
+
'per_page' => array(
|
307 |
+
'default' => 20,
|
308 |
+
'sanitize_callback' => 'absint',
|
309 |
+
),
|
310 |
+
'limit' => array(
|
311 |
+
'default' => 10,
|
312 |
+
'sanitize_callback' => 'absint',
|
313 |
+
)
|
314 |
+
);
|
315 |
+
}
|
316 |
+
|
317 |
+
}
|
classes/api/error.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Response object all errorful REST API requests should return
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_API_Error extends \WP_Error {
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
}
|
classes/api/load.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Loads the Caldera Forms REST API
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_API_Load {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Array of route objects for this collection
|
16 |
+
*
|
17 |
+
* @since 1.4.4
|
18 |
+
*
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
protected $routes;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Namespace for this route collection
|
25 |
+
*
|
26 |
+
* @since 1.4.4
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
protected $namespace;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Caldera_Forms_API_Load constructor.
|
34 |
+
*
|
35 |
+
* @since 1.4.4
|
36 |
+
*
|
37 |
+
* @param string $namespace Namespace for this route collection
|
38 |
+
*/
|
39 |
+
public function __construct( $namespace ) {
|
40 |
+
$this->namespace = $namespace;
|
41 |
+
$this->routes = array();
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Add a route to this collection
|
47 |
+
*
|
48 |
+
* @since 1.4.4
|
49 |
+
*
|
50 |
+
* @param Caldera_Forms_API_Route $route
|
51 |
+
*/
|
52 |
+
public function add_route( Caldera_Forms_API_Route $route ){
|
53 |
+
$this->routes[] = $route;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Initialize routes for this namespace
|
58 |
+
*
|
59 |
+
* @since 1.4.4
|
60 |
+
*
|
61 |
+
* @return bool True if loading happened, false if not
|
62 |
+
*/
|
63 |
+
public function init_routes(){
|
64 |
+
if( ! empty( $this->routes ) && ! did_action( "caldera_forms_rest_api_init_$this->namespace" ) ){
|
65 |
+
/** @var Caldera_Forms_API_Route $route */
|
66 |
+
foreach ( $this->routes as $route ){
|
67 |
+
$route->add_routes( $this->namespace );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Runs after Caldera Forms REST API is loaded
|
72 |
+
*
|
73 |
+
* Dynamic part of hook is the namespace, so may run for each version
|
74 |
+
*
|
75 |
+
* @since 1.4.4
|
76 |
+
*
|
77 |
+
* @param array $routes Route objects that were added.
|
78 |
+
*/
|
79 |
+
do_action( "caldera_forms_rest_api_init_$this->namespace", $this->routes );
|
80 |
+
|
81 |
+
return true;
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
return false;
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
classes/api/response.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Response object all non-error REST API requests should return
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_API_Response extends \WP_REST_Response {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @inheritdoc
|
16 |
+
*
|
17 |
+
* @since 1.4.4
|
18 |
+
*/
|
19 |
+
public function __construct( $data = null, $status = 200, $headers = array() ) {
|
20 |
+
parent::__construct( $data, $status, $headers );
|
21 |
+
if ( empty( $data ) ) {
|
22 |
+
$this->set_status( 404 );
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
public function set_total_header( $total ){
|
28 |
+
$this->header( 'X-CF-API-TOTAL', (int) $total );
|
29 |
+
}
|
30 |
+
|
31 |
+
public function set_total_pages_header( $total_pages ){
|
32 |
+
$this->header( 'X-CF-API-TOTAL-PAGES', (int) $total_pages );
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
}
|
classes/api/response_factory.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: josh
|
6 |
+
* Date: 10/1/16
|
7 |
+
* Time: 4:57 PM
|
8 |
+
*/
|
9 |
+
class Caldera_Forms_API_Response_Factory {
|
10 |
+
|
11 |
+
public static function error_form_not_found(){
|
12 |
+
return new Caldera_Forms_API_Error( 'form-not-found', __( 'Form not found', 'caldera-forms' ) );
|
13 |
+
}
|
14 |
+
|
15 |
+
public static function error_entry_not_found(){
|
16 |
+
return new Caldera_Forms_API_Error( 'form-entry-not-found', __( 'Form entry not found', 'caldera-forms' ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
public static function entry_data( $data, $total = null, $total_pages = false ){
|
20 |
+
if( null === $total ){
|
21 |
+
$total = count( $data );
|
22 |
+
}
|
23 |
+
|
24 |
+
$response = new Caldera_Forms_API_Response( $data, 200, array() );
|
25 |
+
$response->set_total_header( $total );
|
26 |
+
if ( is_numeric( $total_pages ) ) {
|
27 |
+
$response->set_total_pages_header( $total_pages );
|
28 |
+
}
|
29 |
+
|
30 |
+
return $response;
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
classes/api/route.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Interface all REST API routes should use
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
interface Caldera_Forms_API_Route {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Add the routes for this set of endpoints
|
16 |
+
*
|
17 |
+
* @since 1.4.4
|
18 |
+
*
|
19 |
+
* @param string $namespace API namespace
|
20 |
+
*
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
public function add_routes( $namespace );
|
24 |
+
|
25 |
+
}
|
classes/api/util.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Utility functions for Caldera Forms REST API
|
6 |
+
*
|
7 |
+
* @package Caldera_Forms
|
8 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
9 |
+
* @license GPL-2.0+
|
10 |
+
* @link
|
11 |
+
* @copyright 2016 CalderaWP LLC
|
12 |
+
*/
|
13 |
+
class Caldera_Forms_API_Util {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* The namespace for Caldera Forms REST API
|
17 |
+
*
|
18 |
+
* @since 1.4.4
|
19 |
+
*
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public static function api_namespace(){
|
23 |
+
return 'cf-api/v2';
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The URL for Caldera Forms REST API
|
28 |
+
*
|
29 |
+
* @since 1.4.4
|
30 |
+
*
|
31 |
+
* @param string $endpoint Optional. Endpoint.
|
32 |
+
* @return string
|
33 |
+
*/
|
34 |
+
public static function url( $endpoint = '' ){
|
35 |
+
return rest_url( self::api_namespace() . '/' . $endpoint );
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
classes/autoloader.php
CHANGED
@@ -64,7 +64,9 @@ class Caldera_Forms_Autoloader {
|
|
64 |
$file = CFCORE_PATH . 'classes/entry.php';
|
65 |
} elseif ( 'Caldera_Forms_Save_Final' == $class ){
|
66 |
$file = CFCORE_PATH . 'classes/save.php';
|
67 |
-
}
|
|
|
|
|
68 |
$file = $dir . self::get_base( $class, $root );
|
69 |
}
|
70 |
|
64 |
$file = CFCORE_PATH . 'classes/entry.php';
|
65 |
} elseif ( 'Caldera_Forms_Save_Final' == $class ){
|
66 |
$file = CFCORE_PATH . 'classes/save.php';
|
67 |
+
} elseif( 'Caldera_Forms_Admin' == $class ){
|
68 |
+
$file = CFCORE_PATH . 'classes/admin.php';
|
69 |
+
}else {
|
70 |
$file = $dir . self::get_base( $class, $root );
|
71 |
}
|
72 |
|
classes/caldera-grid.php
CHANGED
@@ -161,10 +161,31 @@ if( !class_exists( 'Caldera_Form_Grid' )){
|
|
161 |
$rowAfter = '';
|
162 |
|
163 |
if(isset($cols['id'])){
|
164 |
-
$rowID =
|
165 |
unset($cols['id']);
|
166 |
}
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
if(isset($cols['class'])){
|
169 |
$rowClass = $cols['class'];
|
170 |
unset($cols['class']);
|
@@ -187,7 +208,19 @@ if( !class_exists( 'Caldera_Form_Grid' )){
|
|
187 |
unset($cols['before']);
|
188 |
}
|
189 |
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
if(!is_array($cols)){
|
193 |
echo $cols;
|
161 |
$rowAfter = '';
|
162 |
|
163 |
if(isset($cols['id'])){
|
164 |
+
$rowID = $cols['id'];
|
165 |
unset($cols['id']);
|
166 |
}
|
167 |
+
|
168 |
+
if( empty( $rowID ) ){
|
169 |
+
$rowID = $row;
|
170 |
+
}
|
171 |
+
|
172 |
+
if( ! empty( $this->config[ 'form_id_attr' ] ) ){
|
173 |
+
$rowID = $this->config[ 'form_id_attr' ] . '-row-' . $rowID;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Alter row ID attribute in Caldera Grid
|
178 |
+
*
|
179 |
+
* @since 1.4.9
|
180 |
+
*
|
181 |
+
* @param string $rowID The row's ID attribute
|
182 |
+
* @param int $row Row number
|
183 |
+
* @param array $config Grid config. Contains form ID in form_id key.
|
184 |
+
*/
|
185 |
+
$rowID = apply_filters( 'caldera_forms_grid_row_id', $rowID, $row, $this->config );
|
186 |
+
|
187 |
+
$rowID = 'id="'.$rowID.'" ';
|
188 |
+
|
189 |
if(isset($cols['class'])){
|
190 |
$rowClass = $cols['class'];
|
191 |
unset($cols['class']);
|
208 |
unset($cols['before']);
|
209 |
}
|
210 |
|
211 |
+
/**
|
212 |
+
* Alter row class attribute in Caldera Grid
|
213 |
+
*
|
214 |
+
* STRONGLY recommended you use this to add, but not subtract classes.
|
215 |
+
*
|
216 |
+
* @since 1.4.9
|
217 |
+
*
|
218 |
+
* @param string $rowClass The row's classes
|
219 |
+
* @param int $row Row number
|
220 |
+
* @param array $config Grid config. Contains form ID in form_id key.
|
221 |
+
*/
|
222 |
+
$rowClass = apply_filters( 'caldera_forms_grid_row_class', $rowClass, $row, $this->config );
|
223 |
+
$this->output .= sprintf($this->config['before'], $rowID, $rowClass);
|
224 |
|
225 |
if(!is_array($cols)){
|
226 |
echo $cols;
|
classes/core.php
CHANGED
@@ -22,6 +22,12 @@ class Caldera_Forms {
|
|
22 |
* @var string
|
23 |
*/
|
24 |
const VERSION = CFCORE_VER;
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* @var string
|
27 |
*/
|
@@ -44,6 +50,23 @@ class Caldera_Forms {
|
|
44 |
*/
|
45 |
private static $internal_init = false;
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
/**
|
49 |
* Initialize the plugin by setting localization, filters, and administration functions.
|
@@ -63,21 +86,15 @@ class Caldera_Forms {
|
|
63 |
add_action('caldera_forms_edit_end', array($this, 'calculations_templates') );
|
64 |
add_filter('caldera_forms_render_get_field', array( $this, 'auto_populate_options_field' ), 10, 2);
|
65 |
add_filter('caldera_forms_render_get_field', array( $this, 'apply_conditional_groups' ), 10, 2);
|
66 |
-
//add_filter('caldera_forms_render_get_field_type-radio', array( $this, 'auto_populate_options_field' ), 10, 2);
|
67 |
-
//add_filter('caldera_forms_render_get_field_type-checkbox', array( $this, 'auto_populate_options_field' ), 10, 2);
|
68 |
-
//add_filter('caldera_forms_render_get_field_type-dropdown', array( $this, 'auto_populate_options_field' ), 10, 2);
|
69 |
-
//add_filter('caldera_forms_render_get_field_type-toggle_switch', array( $this, 'auto_populate_options_field' ), 10, 2);
|
70 |
add_filter('caldera_forms_view_field_paragraph', 'wpautop' );
|
71 |
|
72 |
-
// magic
|
73 |
-
//add_filter('caldera_forms_render_magic_tag', array( $this, 'do_magic_tags'));
|
74 |
-
// mailser
|
75 |
add_filter('caldera_forms_get_magic_tags', array( $this, 'set_magic_tags'),1);
|
76 |
add_filter('caldera_forms_mailer', array( $this, 'mail_attachment_check'),10, 3);
|
77 |
|
78 |
// action
|
79 |
add_action('caldera_forms_submit_complete', array( $this, 'save_final_form'),50);
|
80 |
-
|
81 |
// find if profile is loaded
|
82 |
add_action('wp_loaded', array( $this, 'cf_init_system'), 25 );
|
83 |
add_action('wp', array( $this, 'cf_init_preview'));
|
@@ -96,6 +113,15 @@ class Caldera_Forms {
|
|
96 |
add_action( 'wp_ajax_cf_email_save', array( 'Caldera_Forms_Email_Settings', 'save' ) );
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
if( current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
101 |
$id = null;
|
@@ -110,7 +136,7 @@ class Caldera_Forms {
|
|
110 |
new Caldera_Forms_Email_Previews( $id, $view );
|
111 |
|
112 |
}
|
113 |
-
|
114 |
|
115 |
/**
|
116 |
* Runs after Caldera Forms core is initialized
|
@@ -146,6 +172,30 @@ class Caldera_Forms {
|
|
146 |
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
/**
|
150 |
* Load the plugin text domain for translation.
|
151 |
*
|
@@ -228,7 +278,7 @@ class Caldera_Forms {
|
|
228 |
if ( ! empty( $wpdb->collate ) ) {
|
229 |
$charset_collate .= " COLLATE $wpdb->collate";
|
230 |
}
|
231 |
-
|
232 |
/*
|
233 |
* Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
|
234 |
* As of WordPress 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which
|
@@ -300,7 +350,7 @@ class Caldera_Forms {
|
|
300 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
301 |
|
302 |
if( !in_array($wpdb->prefix.'cf_form_entries', $alltables) ){
|
303 |
-
|
304 |
$entry_table = "CREATE TABLE `" . $wpdb->prefix . "cf_form_entries` (
|
305 |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
306 |
`form_id` varchar(18) NOT NULL DEFAULT '',
|
@@ -319,7 +369,7 @@ class Caldera_Forms {
|
|
319 |
}
|
320 |
|
321 |
if( !in_array($wpdb->prefix.'cf_form_entry_values', $alltables) ){
|
322 |
-
|
323 |
$values_table = "CREATE TABLE `" . $wpdb->prefix . "cf_form_entry_values` (
|
324 |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
325 |
`entry_id` int(11) NOT NULL,
|
@@ -437,30 +487,58 @@ class Caldera_Forms {
|
|
437 |
*
|
438 |
* @return array
|
439 |
*/
|
440 |
-
public static function mail_attachment_check($mail, $data, $form){
|
441 |
-
foreach ( $form
|
442 |
-
if ( ( $field
|
443 |
-
$
|
444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
if ( is_array( $file ) ) {
|
446 |
foreach ( $file as $a_file ) {
|
|
|
447 |
if ( is_string( $a_file ) && file_exists( $a_file ) ) {
|
448 |
$mail[ 'attachments' ][] = $a_file;
|
449 |
|
450 |
}
|
451 |
}
|
452 |
|
453 |
-
|
454 |
-
$mail[ 'attachments' ][] = $file;
|
455 |
-
} else {
|
456 |
-
if ( isset( $data[ $field_id ] ) && filter_var( $data[ $field_id ], FILTER_VALIDATE_URL ) ) {
|
457 |
-
$mail[ 'attachments' ][] = $data[ $field_id ];
|
458 |
-
} elseif ( isset( $_POST[ $field_id ] ) && filter_var( $_POST[ $field_id ], FILTER_VALIDATE_URL ) && 0 === strpos( $_POST[ $field_id ], $dir[ 'url' ] ) ) {
|
459 |
-
$mail[ 'attachments' ][] = $_POST[ $field_id ];
|
460 |
|
|
|
|
|
|
|
|
|
|
|
461 |
} else {
|
462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
|
|
|
464 |
}
|
465 |
}
|
466 |
|
@@ -569,9 +647,13 @@ class Caldera_Forms {
|
|
569 |
}
|
570 |
}
|
571 |
|
|
|
|
|
|
|
|
|
572 |
$data = self::get_field_data($field['ID'], $form );
|
573 |
|
574 |
-
if(empty($data)){
|
575 |
return;
|
576 |
}
|
577 |
|
@@ -672,24 +754,15 @@ class Caldera_Forms {
|
|
672 |
}
|
673 |
|
674 |
}
|
675 |
-
|
676 |
if(! empty( $form[ 'db_support' ] ) ) {
|
677 |
Caldera_Forms_Save_Final::save_in_db( $form, $entryid );
|
678 |
}
|
679 |
|
680 |
-
if( !empty( $transdata['edit'] ) ){
|
681 |
-
// update
|
682 |
-
if( empty($form['mailer']['on_update'] ) ){
|
683 |
-
return;
|
684 |
-
}
|
685 |
-
}else{
|
686 |
-
// insert
|
687 |
-
if( empty( $form['mailer']['enable_mailer'] ) && empty($form['mailer']['on_insert'] ) ){
|
688 |
-
return;
|
689 |
-
}
|
690 |
-
}
|
691 |
|
692 |
-
|
|
|
|
|
693 |
|
694 |
|
695 |
}
|
@@ -874,6 +947,10 @@ class Caldera_Forms {
|
|
874 |
'attachments' => array()
|
875 |
);
|
876 |
|
|
|
|
|
|
|
|
|
877 |
$email_message = apply_filters( 'caldera_forms_autoresponse_mail', $email_message, $config, $form);
|
878 |
|
879 |
if( 'wp' !== Caldera_Forms_Email_Settings::get_method() ){
|
@@ -969,7 +1046,9 @@ class Caldera_Forms {
|
|
969 |
}
|
970 |
|
971 |
/**
|
972 |
-
* Increment
|
|
|
|
|
973 |
*
|
974 |
* @param array $config Processor config
|
975 |
* @param array $form Form config
|
@@ -977,17 +1056,44 @@ class Caldera_Forms {
|
|
977 |
* @return array Key is new value.
|
978 |
*/
|
979 |
public function increment_value( $config, $form ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
980 |
|
981 |
-
|
982 |
-
$increment_value = get_option('_increment_' . $config['processor_id'], $config['start'] );
|
983 |
|
984 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
985 |
|
986 |
-
if(
|
987 |
-
self::set_field_data( $
|
988 |
}
|
989 |
|
990 |
-
return array(
|
|
|
|
|
991 |
|
992 |
}
|
993 |
|
@@ -1342,7 +1448,7 @@ class Caldera_Forms {
|
|
1342 |
"template" => CFCORE_PATH . "fields/advanced_file/config_template.php"
|
1343 |
),
|
1344 |
"scripts" => array(
|
1345 |
-
CFCORE_URL . 'fields/advanced_file/uploader.js'
|
1346 |
),
|
1347 |
|
1348 |
),
|
@@ -1592,8 +1698,9 @@ class Caldera_Forms {
|
|
1592 |
$field['config']['option'] = array();
|
1593 |
switch($field['config']['auto_type']){
|
1594 |
case 'post_type':
|
|
|
1595 |
|
1596 |
-
if( ! isset( $field[ 'config' ][ '
|
1597 |
$field[ 'config' ][ 'orderby_post' ] = 'date';
|
1598 |
}
|
1599 |
|
@@ -1617,9 +1724,10 @@ class Caldera_Forms {
|
|
1617 |
* @param array $args Args for WP_Query
|
1618 |
* @param array $form Form config
|
1619 |
*/
|
1620 |
-
$args = apply_filters( 'caldera_forms_autopopulate_post_type_args', $args );
|
1621 |
|
1622 |
$posts = get_posts( $args );
|
|
|
1623 |
if( $field[ 'config' ][ 'value_field' ] === 'id' ){
|
1624 |
$field[ 'config' ][ 'value_field' ] = 'ID';
|
1625 |
}elseif( $field[ 'config' ][ 'value_field' ] === 'name' ){
|
@@ -2071,335 +2179,286 @@ class Caldera_Forms {
|
|
2071 |
}
|
2072 |
}
|
2073 |
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
|
|
2078 |
|
2079 |
-
|
2080 |
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2091 |
$magic_tag = null;
|
2092 |
}
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
foreach($this_form['variables']['keys'] as $var_index=>$var_key){
|
2112 |
-
if( $var_key == $magic[1] ){
|
2113 |
-
if( !in_array($magic_tag, $magic_caller) ){
|
2114 |
-
$magic_caller[] = $magic_tag;
|
2115 |
-
$magic_tag = self::do_magic_tags( $this_form['variables']['values'][$var_index], $entry_id, $magic_caller );
|
2116 |
-
}else{
|
2117 |
-
$magic_tag = $this_form['variables']['values'][$var_index];
|
2118 |
}
|
2119 |
}
|
2120 |
}
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
}
|
|
|
|
|
2137 |
}
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
break;
|
2142 |
-
case 'embed_post':
|
2143 |
-
global $post;
|
2144 |
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
|
2156 |
-
|
2157 |
|
2158 |
-
|
2159 |
-
|
2160 |
-
$magic_tag = null;
|
2161 |
-
}
|
2162 |
-
break;
|
2163 |
-
case 'post_meta':
|
2164 |
-
global $post;
|
2165 |
-
|
2166 |
-
if(is_object($post)){
|
2167 |
-
$post_metavalue = get_post_meta( $post->ID, $magic[1] );
|
2168 |
-
if( false !== strpos($magic[1], ':') ){
|
2169 |
-
$magic[3] = explode(':', $magic[1]);
|
2170 |
-
}
|
2171 |
-
if(empty($post_metavalue)){
|
2172 |
$magic_tag = null;
|
2173 |
-
}
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2182 |
}
|
2183 |
}
|
|
|
2184 |
}
|
2185 |
-
$magic_tag = implode(', ', $outmagic);
|
2186 |
}
|
|
|
|
|
2187 |
}
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
if( !empty( $entry ) ){
|
2202 |
-
$magic_tag = $entry['id'];
|
2203 |
}
|
2204 |
}
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
2217 |
-
}
|
2218 |
-
|
2219 |
-
$magic_tag = $ip;
|
2220 |
-
|
2221 |
-
break;
|
2222 |
-
case 'ua':
|
2223 |
-
$magic_tag = $_SERVER['HTTP_USER_AGENT'];
|
2224 |
-
break;
|
2225 |
-
case 'summary':
|
2226 |
-
if(!empty($this_form['fields'])){
|
2227 |
-
if ( ! isset( $this_form[ 'mailer' ]['email_type' ] ) || $this_form[ 'mailer' ][ 'email_type' ] == 'html' ) {
|
2228 |
-
$html = true;
|
2229 |
-
$pattern = '<strong>%s</strong><div style="margin-bottom:20px;">%s</div>';
|
2230 |
-
|
2231 |
-
}else{
|
2232 |
-
$html = false;
|
2233 |
}
|
2234 |
|
2235 |
-
$
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2240 |
}
|
2241 |
-
// filter the field to get field data
|
2242 |
-
$field = apply_filters( 'caldera_forms_render_get_field', $field, $this_form);
|
2243 |
-
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field['type'], $field, $this_form);
|
2244 |
-
$field = apply_filters( 'caldera_forms_render_get_field_slug-' . $field['slug'], $field, $this_form);
|
2245 |
-
|
2246 |
-
$field_values = (array) self::get_field_data($field_id, $this_form);
|
2247 |
-
|
2248 |
-
if( isset( $field_values['label'] ) ){
|
2249 |
-
$field_values = $field_values['value'];
|
2250 |
-
}else{
|
2251 |
-
foreach( $field_values as $field_key=>$field_value ){
|
2252 |
-
if( isset( $field_value['label'] ) && isset( $field_value['value'] ) ){
|
2253 |
-
$field_value[$field_key] = $field_value['value'];
|
2254 |
-
}
|
2255 |
-
|
2256 |
-
}
|
2257 |
-
}
|
2258 |
-
|
2259 |
-
$field_value = implode(', ', (array) $field_values);
|
2260 |
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
} else {
|
2265 |
-
$out[] = $field[ 'label' ] . ': ' . $field_value;
|
2266 |
-
}
|
2267 |
-
}
|
2268 |
-
}
|
2269 |
|
2270 |
-
// vars
|
2271 |
-
if( !empty( $this_form['variables'] ) ){
|
2272 |
-
foreach( $this_form['variables']['keys'] as $var_key=>$var_label ){
|
2273 |
-
if( $this_form['variables']['types'][ $var_key ] == 'entryitem' ){
|
2274 |
-
$label = ucfirst( str_replace('_', ' ', $var_label ) );
|
2275 |
-
if ( $html ) {
|
2276 |
-
$out[] = sprintf( $pattern, $label, $this_form[ 'variables' ][ 'values' ][ $var_key ] );
|
2277 |
-
} else {
|
2278 |
-
$out[] = $label . ': ' . $this_form['variables']['values'][ $var_key ];
|
2279 |
-
}
|
2280 |
-
}
|
2281 |
-
}
|
2282 |
-
}
|
2283 |
-
if(!empty($out)){
|
2284 |
-
$magic_tag = implode("\r\n", $out);
|
2285 |
-
}else{
|
2286 |
-
$magic_tag = '';
|
2287 |
}
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
break;
|
2302 |
|
2303 |
|
|
|
2304 |
}
|
2305 |
-
}
|
2306 |
|
2307 |
-
|
2308 |
|
2309 |
-
|
2310 |
|
2311 |
-
|
2312 |
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
|
|
2316 |
}
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
}
|
2328 |
}
|
2329 |
}
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
2340 |
-
|
2341 |
}
|
2342 |
}
|
2343 |
}
|
2344 |
}
|
2345 |
}
|
2346 |
-
}
|
2347 |
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
|
|
|
2352 |
}
|
2353 |
-
}
|
2354 |
|
2355 |
-
|
2356 |
-
|
2357 |
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
|
2372 |
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
|
|
2382 |
}
|
2383 |
}
|
2384 |
}
|
2385 |
}
|
2386 |
-
}
|
2387 |
|
2388 |
-
|
2389 |
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
|
|
2399 |
}
|
2400 |
-
}
|
2401 |
|
2402 |
-
|
|
|
2403 |
}
|
2404 |
}
|
2405 |
|
@@ -2688,7 +2747,11 @@ class Caldera_Forms {
|
|
2688 |
}
|
2689 |
}
|
2690 |
}else{
|
2691 |
-
|
|
|
|
|
|
|
|
|
2692 |
}
|
2693 |
}else{
|
2694 |
// dynamic
|
@@ -3086,7 +3149,7 @@ class Caldera_Forms {
|
|
3086 |
|
3087 |
|
3088 |
if(isset($_POST['_cf_frm_tr'])){
|
3089 |
-
$pretransient = get_transient( $_POST['_cf_frm_tr'] );
|
3090 |
if( !empty( $pretransient['transient'] ) && $pretransient['transient'] === $_POST['_cf_frm_tr']){
|
3091 |
$transdata = $pretransient;
|
3092 |
$process_id = $transdata['transient'];
|
@@ -3115,20 +3178,19 @@ class Caldera_Forms {
|
|
3115 |
if(isset($_POST['_cf_frm_edt'])){
|
3116 |
$entry_id = (int) $_POST['_cf_frm_edt'];
|
3117 |
}
|
3118 |
-
|
3119 |
-
//$data = self::get_submission_data($form, $entry_id);
|
3120 |
$data = self::get_submission_data($form);
|
3121 |
-
|
3122 |
-
//
|
3123 |
-
// set transient for returns submittions
|
3124 |
if(empty($transdata)){
|
3125 |
$transdata = array(
|
3126 |
'transient' => $process_id,
|
3127 |
'form_instance' => $form_instance_number,
|
3128 |
-
'expire' =>
|
3129 |
'data' => array_merge($_POST, $data),
|
3130 |
);
|
3131 |
}
|
|
|
3132 |
// remove AJAX value for tp_
|
3133 |
if(isset($transdata['data']['cfajax'])){
|
3134 |
unset($transdata['data']['cfajax']);
|
@@ -3267,7 +3329,7 @@ class Caldera_Forms {
|
|
3267 |
$referrer = apply_filters( 'caldera_forms_submit_return_redirect', $referrer, $form, $process_id);
|
3268 |
$referrer = apply_filters( 'caldera_forms_submit_return_redirect_required', $referrer, $form, $process_id);
|
3269 |
|
3270 |
-
set_transient( $process_id, $transdata, $transdata['expire']);
|
3271 |
|
3272 |
return self::form_redirect('error', $referrer, $form, $process_id );
|
3273 |
}
|
@@ -3397,7 +3459,7 @@ class Caldera_Forms {
|
|
3397 |
$referrer = apply_filters( 'caldera_forms_submit_return_redirect-'.$processor['type'], $referrer, $config, $form, $process_id);
|
3398 |
|
3399 |
// set transient data
|
3400 |
-
set_transient( $process_id, $transdata, $transdata['expire']);
|
3401 |
|
3402 |
return self::form_redirect('preprocess', $referrer, $form, $process_id );
|
3403 |
}
|
@@ -3543,7 +3605,7 @@ class Caldera_Forms {
|
|
3543 |
$referrer = apply_filters( 'caldera_forms_submit_error_redirect_pre_process', $referrer, $form, $process_id);
|
3544 |
|
3545 |
// set transient data
|
3546 |
-
set_transient( $process_id, $transdata, $transdata['expire']);
|
3547 |
|
3548 |
return self::form_redirect('error', $referrer, $form, $process_id );
|
3549 |
}
|
@@ -3677,16 +3739,19 @@ class Caldera_Forms {
|
|
3677 |
* Makes Caldera Forms load the preview
|
3678 |
*/
|
3679 |
static public function cf_init_preview(){
|
3680 |
-
|
|
|
|
|
3681 |
global $post, $form;
|
3682 |
|
3683 |
-
|
3684 |
-
|
|
|
3685 |
|
3686 |
$userid = get_current_user_id();
|
3687 |
if( !empty( $userid ) ){
|
3688 |
|
3689 |
-
if(empty($form['ID']) || $form['ID'] !== $
|
3690 |
return;
|
3691 |
}
|
3692 |
if( empty($post) || $post->post_title !== 'Caldera Forms Preview' ){
|
@@ -3703,13 +3768,13 @@ class Caldera_Forms {
|
|
3703 |
'comment_status' => 'closed'
|
3704 |
);
|
3705 |
$page_id = wp_insert_post( $post );
|
3706 |
-
wp_redirect( trailingslashit( get_home_url() ) . '?page_id='.$page_id.'&preview=true&cf_preview='.$
|
3707 |
exit;
|
3708 |
}
|
3709 |
if( $temp_page->post_status !== 'draft'){
|
3710 |
wp_update_post( array( 'ID' => $temp_page->ID, 'post_status' => 'draft' ) );
|
3711 |
}
|
3712 |
-
wp_redirect( trailingslashit( get_home_url() ) . '?page_id='.$temp_page->ID.'&preview=true&cf_preview='.$
|
3713 |
exit;
|
3714 |
}
|
3715 |
$post->post_title = $form['name'];
|
@@ -3765,21 +3830,7 @@ class Caldera_Forms {
|
|
3765 |
return;
|
3766 |
}
|
3767 |
|
3768 |
-
|
3769 |
-
wp_enqueue_style( 'cf-field-styles' );
|
3770 |
-
|
3771 |
-
$style_includes = get_option( '_caldera_forms_styleincludes' );
|
3772 |
-
$style_includes = apply_filters( 'caldera_forms_get_style_includes', $style_includes);
|
3773 |
-
|
3774 |
-
if(!empty($style_includes['grid'])){
|
3775 |
-
wp_enqueue_style( 'cf-grid-styles' );
|
3776 |
-
}
|
3777 |
-
if(!empty($style_includes['form'])){
|
3778 |
-
wp_enqueue_style( 'cf-form-styles' );
|
3779 |
-
}
|
3780 |
-
if(!empty($style_includes['alert'])){
|
3781 |
-
wp_enqueue_style( 'cf-alert-styles' );
|
3782 |
-
}
|
3783 |
|
3784 |
foreach( $page_forms as $form_id ){
|
3785 |
// has form get stuff for it
|
@@ -3838,6 +3889,7 @@ class Caldera_Forms {
|
|
3838 |
if ( ! isset( $wp_query->query_vars['cf_api'] ) ){
|
3839 |
return;
|
3840 |
}
|
|
|
3841 |
// check if form exists
|
3842 |
$form = Caldera_Forms_Forms::get_form( $wp_query->query_vars['cf_api'] );
|
3843 |
$atts = array(
|
@@ -3863,7 +3915,7 @@ class Caldera_Forms {
|
|
3863 |
|
3864 |
if( !empty( $_POST['control'] ) ){
|
3865 |
$transient_name = sanitize_key( $_POST['control'] );
|
3866 |
-
$transdata = get_transient( $transient_name );
|
3867 |
if( false === $transdata ){
|
3868 |
$transdata = array();
|
3869 |
}
|
@@ -3878,7 +3930,7 @@ class Caldera_Forms {
|
|
3878 |
|
3879 |
$transdata[] = $data;
|
3880 |
//set
|
3881 |
-
set_transient( $transient_name, $transdata, DAY_IN_SECONDS );
|
3882 |
// maybe put in some checks on file then can say yea or nei
|
3883 |
wp_send_json_success( array(
|
3884 |
|
@@ -3933,7 +3985,7 @@ class Caldera_Forms {
|
|
3933 |
* @param string $form_id ID of form.
|
3934 |
*/
|
3935 |
return apply_filters( 'caldera_forms_submission_url', $url, $form_id );
|
3936 |
-
|
3937 |
}
|
3938 |
|
3939 |
/**
|
@@ -3944,27 +3996,8 @@ class Caldera_Forms {
|
|
3944 |
global $post, $wp_query, $process_id, $form;
|
3945 |
|
3946 |
// setup script and style urls
|
3947 |
-
$style_urls =
|
3948 |
-
|
3949 |
-
'modals-theme' => CFCORE_URL . 'assets/css/remodal-default-theme.min.css',
|
3950 |
-
'grid' => CFCORE_URL . 'assets/css/caldera-grid.css',
|
3951 |
-
'form' => CFCORE_URL . 'assets/css/caldera-form.css',
|
3952 |
-
'alert' => CFCORE_URL . 'assets/css/caldera-alert.css',
|
3953 |
-
'field' => CFCORE_URL . 'assets/css/fields.min.css',
|
3954 |
-
);
|
3955 |
-
$script_urls = array(
|
3956 |
-
'dynamic' => CFCORE_URL . 'assets/js/formobject.min.js',
|
3957 |
-
'modals' => CFCORE_URL . 'assets/js/remodal.min.js',
|
3958 |
-
'baldrick' => CFCORE_URL . 'assets/js/jquery.baldrick.min.js',
|
3959 |
-
'ajax' => CFCORE_URL . 'assets/js/ajax-core.min.js',
|
3960 |
-
'field' => CFCORE_URL . 'assets/js/fields.min.js',
|
3961 |
-
'conditionals' => CFCORE_URL . 'assets/js/conditionals.min.js',
|
3962 |
-
'validator-i18n' => null,
|
3963 |
-
'validator' => CFCORE_URL . 'assets/js/parsley.min.js',
|
3964 |
-
//'polyfiller' => CFCORE_URL . 'assets/js/polyfiller.min.js',
|
3965 |
-
'init' => CFCORE_URL . 'assets/js/frontend-script-init.min.js',
|
3966 |
-
);
|
3967 |
-
|
3968 |
$script_style_urls = array();
|
3969 |
|
3970 |
// check to see language and include the language add on
|
@@ -4015,6 +4048,8 @@ class Caldera_Forms {
|
|
4015 |
}
|
4016 |
wp_register_style( 'cf-' . $style_key . '-styles', $style_url, array(), CFCORE_VER );
|
4017 |
}
|
|
|
|
|
4018 |
// register scripts
|
4019 |
foreach( $script_style_urls['script'] as $script_key => $script_url ){
|
4020 |
if( empty( $script_url ) ){
|
@@ -4030,7 +4065,7 @@ class Caldera_Forms {
|
|
4030 |
if(!empty($_GET['cf_tp'])){
|
4031 |
|
4032 |
// process a transient stored entry
|
4033 |
-
$data = get_transient( $_GET['cf_tp'] );
|
4034 |
if(!empty($data) && $data['transient'] === $_GET['cf_tp'] && isset($data['data'])){
|
4035 |
// create post values
|
4036 |
$_POST = array_merge( $_POST, $data['data']);
|
@@ -4252,7 +4287,7 @@ class Caldera_Forms {
|
|
4252 |
// allow plugins to alter the entry
|
4253 |
$data = apply_filters( 'caldera_forms_get_entry', $data, $entry_id, $form);
|
4254 |
|
4255 |
-
|
4256 |
return $data;
|
4257 |
}
|
4258 |
|
@@ -4269,8 +4304,6 @@ class Caldera_Forms {
|
|
4269 |
* @return string
|
4270 |
*/
|
4271 |
static public function render_modal_form($atts, $content){
|
4272 |
-
_deprecated_function( __FUNCTION__, '1.3.1', __( 'Use [caldera_forms id="cf.." modal="true"]Click Me[/caldera_forms]', 'caldera-forms' ) );
|
4273 |
-
global $footer_modals;
|
4274 |
|
4275 |
if(empty($atts['id'])){
|
4276 |
return $content;
|
@@ -4298,7 +4331,7 @@ class Caldera_Forms {
|
|
4298 |
|
4299 |
$current_state = 'style="display:none;"';
|
4300 |
if(!empty($_GET['cf_er'])){
|
4301 |
-
$transdata = get_transient( $_GET['cf_er'] );
|
4302 |
if($transdata['transient'] == $_GET['cf_er']){
|
4303 |
$current_state = 'style="display:block;"';
|
4304 |
}
|
@@ -4313,10 +4346,9 @@ class Caldera_Forms {
|
|
4313 |
$width = ' width: ' . floatval( $atts['width'] ).'px; margin-left: -' . ( floatval( $atts['width'] ) / 2 ) . 'px;';
|
4314 |
}
|
4315 |
|
4316 |
-
|
4317 |
ob_start();
|
4318 |
?>
|
4319 |
-
<div id="<?php echo $modal_id; ?>" class="caldera-front-modal-container" <?php echo $current_state;
|
4320 |
<div class="caldera-backdrop"></div>
|
4321 |
<div id="<?php echo $modal_id; ?>_modal_wrap" tabindex="-1" arialabelled-by="<?php echo $modal_id; ?>_modal_label" class="caldera-modal-wrap caldera-front-modal-wrap" style="display: block; <?php echo $width; ?>">
|
4322 |
<div class="caldera-modal-title" id="<?php echo $modal_id; ?>_modal_title" style="display: block;">
|
@@ -4329,27 +4361,32 @@ class Caldera_Forms {
|
|
4329 |
</div>
|
4330 |
</div>
|
4331 |
<?php
|
4332 |
-
|
4333 |
return $out;
|
4334 |
}
|
4335 |
|
4336 |
/**
|
4337 |
* Print modal content in footer.
|
|
|
|
|
|
|
|
|
4338 |
*/
|
4339 |
static public function render_footer_modals(){
|
4340 |
-
|
4341 |
-
if(!empty($footer_modals)){
|
4342 |
echo $footer_modals;
|
4343 |
}
|
|
|
4344 |
}
|
4345 |
|
4346 |
/**
|
4347 |
-
* Create HTML markup for a
|
4348 |
*
|
4349 |
* @since unknown
|
4350 |
*
|
4351 |
* @param array|string $field Form ID or shortcode atts or form config array
|
4352 |
-
* @param array|null $form Optional Form to
|
4353 |
* @param array $entry_data Optional. Entry data to populate field with. Null, the default, loads form for creating a new entry.
|
4354 |
*
|
4355 |
* @return void|string HTML for form, if it was able to be loaded,
|
@@ -4390,7 +4427,7 @@ class Caldera_Forms {
|
|
4390 |
"field_before" => "<div class=\"" . $field_input_class ."\">\r\n",
|
4391 |
"label_before" => ( empty($field['hide_label']) ? "<label id=\"" . $field['ID'] ."Label\" for=\"" . $field['ID'].'_'.$current_form_count . "\" class=\"" . implode(' ', $field_classes['field_label'] ) . "\">" : null ),
|
4392 |
"label" => ( empty($field['hide_label']) ? $field['label'] : null ),
|
4393 |
-
"label_required" => ( empty($field['hide_label']) ? ( !empty($field['required']) ? " <span aria-hidden=\"true\" role=\"presentation\" class=\"" . implode(' ', $field_classes['field_required_tag'] ) . "\" style=\"color:#
|
4394 |
"label_after" => ( empty($field['hide_label']) ? "</label>" : null ),
|
4395 |
"field_placeholder" => ( !empty($field['hide_label']) ? 'placeholder="' . htmlentities( $field['label'] ) .'"' : null),
|
4396 |
"field_required" => ( !empty($field['required']) ? 'required="required"' : null),
|
@@ -4412,7 +4449,7 @@ class Caldera_Forms {
|
|
4412 |
if( !empty( $field['caption'] ) ){
|
4413 |
$field_structure['aria']['describedby'] = $field['ID'] . 'Caption';
|
4414 |
}
|
4415 |
-
|
4416 |
// add error
|
4417 |
if ( ! empty( $field_errors ) ) {
|
4418 |
if( is_string( $field_errors ) ){
|
@@ -4610,28 +4647,30 @@ class Caldera_Forms {
|
|
4610 |
|
4611 |
do_action('caldera_forms_render_start', $form);
|
4612 |
|
4613 |
-
|
4614 |
|
4615 |
-
|
4616 |
-
|
4617 |
-
|
4618 |
-
|
4619 |
-
|
4620 |
-
|
4621 |
|
4622 |
-
|
4623 |
-
|
4624 |
-
|
4625 |
-
if(!empty($style_includes['form'])){
|
4626 |
-
wp_enqueue_style( 'cf-form-styles' );
|
4627 |
-
}
|
4628 |
-
if(!empty($style_includes['alert'])){
|
4629 |
-
wp_enqueue_style( 'cf-alert-styles' );
|
4630 |
-
}
|
4631 |
|
4632 |
-
|
4633 |
-
wp_enqueue_style( 'cf-field-styles' );
|
4634 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4635 |
|
4636 |
|
4637 |
include_once CFCORE_PATH . "classes/caldera-grid.php";
|
@@ -4660,12 +4699,17 @@ class Caldera_Forms {
|
|
4660 |
"column_single" => 'single',
|
4661 |
"column_before" => '<div %1$s class="col-'.$gridsize.'-%2$d %3$s">',
|
4662 |
"column_after" => '</div>',
|
|
|
|
|
4663 |
);
|
4664 |
|
4665 |
// filter settings
|
4666 |
$grid_settings = apply_filters( 'caldera_forms_render_grid_settings', $grid_settings, $form);
|
4667 |
|
4668 |
$form['grid_object'] = new Caldera_Form_Grid($grid_settings);
|
|
|
|
|
|
|
4669 |
|
4670 |
// Build Pages Breaks
|
4671 |
if( false !== strpos($form['layout_grid']['structure'], '#')){
|
@@ -4782,7 +4826,7 @@ class Caldera_Forms {
|
|
4782 |
}
|
4783 |
|
4784 |
if(!empty($_GET['cf_er'])){
|
4785 |
-
$prev_post = get_transient( $_GET['cf_er'] );
|
4786 |
if(!empty($prev_post['transient'])){
|
4787 |
|
4788 |
if($prev_post['transient'] === $_GET['cf_er']){
|
@@ -4825,6 +4869,7 @@ class Caldera_Forms {
|
|
4825 |
}
|
4826 |
}
|
4827 |
|
|
|
4828 |
// build grid & pages
|
4829 |
$form['grid_object']->setLayout($form['layout_grid']['structure']);
|
4830 |
|
@@ -4906,20 +4951,10 @@ class Caldera_Forms {
|
|
4906 |
if(!empty($form['layout_grid']['fields'])){
|
4907 |
|
4908 |
foreach($form['layout_grid']['fields'] as $field_base_id=>$location){
|
4909 |
-
// instance base
|
4910 |
-
if(isset($form['fields'][$field_base_id])){
|
4911 |
-
|
4912 |
|
|
|
|
|
4913 |
|
4914 |
-
/**
|
4915 |
-
* Filter the field setup before render
|
4916 |
-
*
|
4917 |
-
* @since unknown
|
4918 |
-
*
|
4919 |
-
* @param string $notice Notices HTML
|
4920 |
-
* @param array $config Form config
|
4921 |
-
*/
|
4922 |
-
$field = apply_filters( 'caldera_forms_render_setup_field', $form['fields'][$field_base_id], $form);
|
4923 |
|
4924 |
if(empty($field) || !isset($field_types[$field['type']]['file']) || !file_exists($field_types[$field['type']]['file'])){
|
4925 |
continue;
|
@@ -4927,28 +4962,9 @@ class Caldera_Forms {
|
|
4927 |
|
4928 |
$field['grid_location'] = $location;
|
4929 |
|
4930 |
-
if( !empty( $field_types[$field['type']]['styles'])){
|
4931 |
-
foreach($field_types[$field['type']]['styles'] as $style){
|
4932 |
-
if( false !== strpos($style, '//')){
|
4933 |
-
wp_enqueue_style( 'cf-' . sanitize_key( basename( $style ) ), $style, array(), self::VERSION );
|
4934 |
-
}else{
|
4935 |
-
wp_enqueue_style( $style );
|
4936 |
-
}
|
4937 |
-
}
|
4938 |
-
}
|
4939 |
|
4940 |
-
|
4941 |
-
|
4942 |
-
// check for jquery deps
|
4943 |
-
$depts[] = 'jquery';
|
4944 |
-
foreach($field_types[$field['type']]['scripts'] as $script){
|
4945 |
-
if( false !== strpos($script, '//')){
|
4946 |
-
wp_enqueue_script( 'cf-' . sanitize_key( basename( $script ) ), $script, $depts, self::VERSION );
|
4947 |
-
}else{
|
4948 |
-
wp_enqueue_script( $script );
|
4949 |
-
}
|
4950 |
-
}
|
4951 |
-
}
|
4952 |
|
4953 |
$field_base_id = $field['ID'] . '_' . $current_form_count;
|
4954 |
|
@@ -4960,10 +4976,7 @@ class Caldera_Forms {
|
|
4960 |
$field_html = self::render_field( $field, $form, $prev_data, $field_error );
|
4961 |
// conditional wrapper
|
4962 |
if(!empty($field['conditions']['group']) && !empty($field['conditions']['type']) ){
|
4963 |
-
|
4964 |
-
//if(!self::check_condition($field['conditions'], $form)){
|
4965 |
-
// dump($field['conditions'],0);
|
4966 |
-
//}
|
4967 |
$conditions_configs[$field_base_id] = $field['conditions'];
|
4968 |
|
4969 |
if( $field['conditions']['type'] !== 'disable' ){
|
@@ -4992,7 +5005,9 @@ class Caldera_Forms {
|
|
4992 |
|
4993 |
}
|
4994 |
}
|
|
|
4995 |
}
|
|
|
4996 |
// form object strings
|
4997 |
wp_localize_script( 'cf-dynamic', $form['ID'] . '_' . $current_form_count, $form_field_strings );
|
4998 |
|
@@ -5060,13 +5075,6 @@ class Caldera_Forms {
|
|
5060 |
'caldera_forms_form',
|
5061 |
);
|
5062 |
|
5063 |
-
$form_attributes = array(
|
5064 |
-
'method' => 'POST',
|
5065 |
-
'enctype' => 'multipart/form-data',
|
5066 |
-
'role' => 'form',
|
5067 |
-
'id' => $form['ID'] . '_' . $current_form_count
|
5068 |
-
);
|
5069 |
-
|
5070 |
/**
|
5071 |
* Change what type of element form is in.
|
5072 |
*
|
@@ -5089,15 +5097,7 @@ class Caldera_Forms {
|
|
5089 |
*/
|
5090 |
$form_classes = apply_filters( 'caldera_forms_render_form_classes', $form_classes, $form);
|
5091 |
|
5092 |
-
|
5093 |
-
* Modify HTML attributes applied to form element
|
5094 |
-
*
|
5095 |
-
* @since unknown
|
5096 |
-
*
|
5097 |
-
* @param array $form_attributes Array of HTML attributes
|
5098 |
-
* @param array $config Form config
|
5099 |
-
*/
|
5100 |
-
$form_attributes = apply_filters( 'caldera_forms_render_form_attributes', $form_attributes, $form);
|
5101 |
|
5102 |
$attributes = array();
|
5103 |
foreach($form_attributes as $attribute=>$value){
|
@@ -5151,7 +5151,7 @@ class Caldera_Forms {
|
|
5151 |
}
|
5152 |
|
5153 |
$qurystr['cf_pg'] = $page_key + 1;
|
5154 |
-
$out .= "<li" . $tabclass . "><a aria-controls=\"form_page_" . $current_form_count ."_pg_" . ( $page_key + 1 ) . "\" aria-expanded=\"" . $expanded . "\" id=\"breadcrumb_" . $current_form_count ."_pg_" . ( $page_key + 1 ) . "\" href=\"?". http_build_query($qurystr) . "\" data-page=\"" . ( $page_key + 1 ) ."\" data-pagenav=\"caldera_form_" . $current_form_count ."\">". $page_name . "</a></li>\r\n";
|
5155 |
}
|
5156 |
$out .= "</ol></span>\r\n";
|
5157 |
}
|
@@ -5253,8 +5253,8 @@ class Caldera_Forms {
|
|
5253 |
*/
|
5254 |
do_action('caldera_forms_render_end', $form);
|
5255 |
|
|
|
5256 |
wp_enqueue_script( 'cf-field' );
|
5257 |
-
//wp_enqueue_script( 'cf-polyfiller' );
|
5258 |
wp_enqueue_script( 'cf-validator' );
|
5259 |
wp_enqueue_script( 'cf-validator-i18n' );
|
5260 |
|
@@ -5377,4 +5377,106 @@ class Caldera_Forms {
|
|
5377 |
return $time;
|
5378 |
}
|
5379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5380 |
}
|
22 |
* @var string
|
23 |
*/
|
24 |
const VERSION = CFCORE_VER;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @since 1.4.2
|
28 |
+
*/
|
29 |
+
const PLUGIN_SLUG = 'caldera-forms';
|
30 |
+
|
31 |
/**
|
32 |
* @var string
|
33 |
*/
|
50 |
*/
|
51 |
private static $internal_init = false;
|
52 |
|
53 |
+
/**
|
54 |
+
* Holds modal HTML to be loaded in footer
|
55 |
+
*
|
56 |
+
* @since 1.4.2
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected static $footer_modals;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* CF-API v2
|
64 |
+
*
|
65 |
+
* @since 1.4.4
|
66 |
+
*
|
67 |
+
* @var Caldera_Forms_API_Load
|
68 |
+
*/
|
69 |
+
protected static $api;
|
70 |
|
71 |
/**
|
72 |
* Initialize the plugin by setting localization, filters, and administration functions.
|
86 |
add_action('caldera_forms_edit_end', array($this, 'calculations_templates') );
|
87 |
add_filter('caldera_forms_render_get_field', array( $this, 'auto_populate_options_field' ), 10, 2);
|
88 |
add_filter('caldera_forms_render_get_field', array( $this, 'apply_conditional_groups' ), 10, 2);
|
|
|
|
|
|
|
|
|
89 |
add_filter('caldera_forms_view_field_paragraph', 'wpautop' );
|
90 |
|
91 |
+
//mailer magic
|
|
|
|
|
92 |
add_filter('caldera_forms_get_magic_tags', array( $this, 'set_magic_tags'),1);
|
93 |
add_filter('caldera_forms_mailer', array( $this, 'mail_attachment_check'),10, 3);
|
94 |
|
95 |
// action
|
96 |
add_action('caldera_forms_submit_complete', array( $this, 'save_final_form'),50);
|
97 |
+
|
98 |
// find if profile is loaded
|
99 |
add_action('wp_loaded', array( $this, 'cf_init_system'), 25 );
|
100 |
add_action('wp', array( $this, 'cf_init_preview'));
|
113 |
add_action( 'wp_ajax_cf_email_save', array( 'Caldera_Forms_Email_Settings', 'save' ) );
|
114 |
}
|
115 |
|
116 |
+
//auto-population via Easy Pods/ Easy Queries
|
117 |
+
add_action( 'caldera_forms_render_start', array( __CLASS__, 'easy_pods_queries_setup' ) );
|
118 |
+
|
119 |
+
//delete file uploads that are not going in media library
|
120 |
+
add_action( 'caldera_forms_submit_complete', array( 'Caldera_Forms_Files', 'cleanup' ) );
|
121 |
+
add_action( Caldera_Forms_Files::CRON_ACTION, array( 'Caldera_Forms_Files', 'cleanup_via_cron' ) );
|
122 |
+
|
123 |
+
//format email
|
124 |
+
add_filter( 'caldera_forms_mailer', array( $this, 'format_message' ) );
|
125 |
|
126 |
if( current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
127 |
$id = null;
|
136 |
new Caldera_Forms_Email_Previews( $id, $view );
|
137 |
|
138 |
}
|
139 |
+
|
140 |
|
141 |
/**
|
142 |
* Runs after Caldera Forms core is initialized
|
172 |
|
173 |
}
|
174 |
|
175 |
+
/**
|
176 |
+
* Load a field from form
|
177 |
+
*
|
178 |
+
* @since 1.4.2
|
179 |
+
*
|
180 |
+
* @param array $form Form config
|
181 |
+
* @param string $field_base_id Field ID
|
182 |
+
*
|
183 |
+
* @return array
|
184 |
+
*/
|
185 |
+
public static function load_field( $form, $field_base_id ) {
|
186 |
+
/**
|
187 |
+
* Filter the field setup before render
|
188 |
+
*
|
189 |
+
* @since unknown
|
190 |
+
*
|
191 |
+
* @param string $notice Notices HTML
|
192 |
+
* @param array $config Form config
|
193 |
+
*/
|
194 |
+
$field = apply_filters( 'caldera_forms_render_setup_field', $form[ 'fields' ][ $field_base_id ], $form );
|
195 |
+
|
196 |
+
return $field;
|
197 |
+
}
|
198 |
+
|
199 |
/**
|
200 |
* Load the plugin text domain for translation.
|
201 |
*
|
278 |
if ( ! empty( $wpdb->collate ) ) {
|
279 |
$charset_collate .= " COLLATE $wpdb->collate";
|
280 |
}
|
281 |
+
|
282 |
/*
|
283 |
* Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
|
284 |
* As of WordPress 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which
|
350 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
351 |
|
352 |
if( !in_array($wpdb->prefix.'cf_form_entries', $alltables) ){
|
353 |
+
|
354 |
$entry_table = "CREATE TABLE `" . $wpdb->prefix . "cf_form_entries` (
|
355 |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
356 |
`form_id` varchar(18) NOT NULL DEFAULT '',
|
369 |
}
|
370 |
|
371 |
if( !in_array($wpdb->prefix.'cf_form_entry_values', $alltables) ){
|
372 |
+
|
373 |
$values_table = "CREATE TABLE `" . $wpdb->prefix . "cf_form_entry_values` (
|
374 |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
375 |
`entry_id` int(11) NOT NULL,
|
487 |
*
|
488 |
* @return array
|
489 |
*/
|
490 |
+
public static function mail_attachment_check( $mail, $data, $form){
|
491 |
+
foreach ( Caldera_Forms_Forms::get_fields( $form, false ) as $field_id => $field ) {
|
492 |
+
if ( Caldera_Forms_Field_Util::is_file_field( $field, $form ) ) {
|
493 |
+
if( ! Caldera_Forms_Files::should_attach( $field ) ){
|
494 |
+
continue;
|
495 |
+
}
|
496 |
+
$dir = wp_upload_dir();
|
497 |
+
if ( isset( $data[ $field_id ] ) && is_array( $data[ $field_id ] ) ) {
|
498 |
+
foreach ( $data[ $field_id ] as $file ) {
|
499 |
+
$file = str_replace( $dir[ 'baseurl' ], $dir[ 'basedir' ], $file );
|
500 |
+
if ( file_exists( $file ) ) {
|
501 |
+
$mail[ 'attachments' ][] = $file;
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
continue;
|
506 |
+
|
507 |
+
}
|
508 |
+
|
509 |
+
|
510 |
+
if ( isset( $data[ $field_id ] ) ) {
|
511 |
+
$file = $data[ $field_id ];
|
512 |
+
} else {
|
513 |
+
$file = self::get_field_data( $field_id, $form );
|
514 |
+
}
|
515 |
+
|
516 |
if ( is_array( $file ) ) {
|
517 |
foreach ( $file as $a_file ) {
|
518 |
+
$file = str_replace( $dir[ 'baseurl' ], $dir[ 'basedir' ], $file );
|
519 |
if ( is_string( $a_file ) && file_exists( $a_file ) ) {
|
520 |
$mail[ 'attachments' ][] = $a_file;
|
521 |
|
522 |
}
|
523 |
}
|
524 |
|
525 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
|
527 |
+
|
528 |
+
} else {
|
529 |
+
$file = str_replace( $dir[ 'baseurl' ], $dir[ 'basedir' ], $file );
|
530 |
+
if ( is_string( $file ) && file_exists( $file ) ) {
|
531 |
+
$mail[ 'attachments' ][] = $file;
|
532 |
} else {
|
533 |
+
if ( isset( $data[ $field_id ] ) && filter_var( $data[ $field_id ], FILTER_VALIDATE_URL ) ) {
|
534 |
+
$mail[ 'attachments' ][] = $data[ $field_id ];
|
535 |
+
} elseif ( isset( $_POST[ $field_id ] ) && filter_var( $_POST[ $field_id ], FILTER_VALIDATE_URL ) && 0 === strpos( $_POST[ $field_id ], $dir[ 'url' ] ) ) {
|
536 |
+
$mail[ 'attachments' ][] = $_POST[ $field_id ];
|
537 |
+
|
538 |
+
} else {
|
539 |
+
continue;
|
540 |
|
541 |
+
}
|
542 |
}
|
543 |
}
|
544 |
|
647 |
}
|
648 |
}
|
649 |
|
650 |
+
if( ! isset( $field['ID'], $field[ 'slug' ] ) ){
|
651 |
+
return;
|
652 |
+
}
|
653 |
+
|
654 |
$data = self::get_field_data($field['ID'], $form );
|
655 |
|
656 |
+
if( empty($data) && 0 != $data ){
|
657 |
return;
|
658 |
}
|
659 |
|
754 |
}
|
755 |
|
756 |
}
|
757 |
+
|
758 |
if(! empty( $form[ 'db_support' ] ) ) {
|
759 |
Caldera_Forms_Save_Final::save_in_db( $form, $entryid );
|
760 |
}
|
761 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
762 |
|
763 |
+
if ( self::should_send_mail( $form, $transdata ) ) {
|
764 |
+
Caldera_Forms_Save_Final::do_mailer($form, $entryid);
|
765 |
+
}
|
766 |
|
767 |
|
768 |
}
|
947 |
'attachments' => array()
|
948 |
);
|
949 |
|
950 |
+
if( ! is_email( $config[ 'sender_email' ] ) ){
|
951 |
+
$config[ 'sender_email' ] = get_option( 'admin_email' );
|
952 |
+
}
|
953 |
+
|
954 |
$email_message = apply_filters( 'caldera_forms_autoresponse_mail', $email_message, $config, $form);
|
955 |
|
956 |
if( 'wp' !== Caldera_Forms_Email_Settings::get_method() ){
|
1046 |
}
|
1047 |
|
1048 |
/**
|
1049 |
+
* Increment value using the incrimental value processor
|
1050 |
+
*
|
1051 |
+
* @since unknown
|
1052 |
*
|
1053 |
* @param array $config Processor config
|
1054 |
* @param array $form Form config
|
1056 |
* @return array Key is new value.
|
1057 |
*/
|
1058 |
public function increment_value( $config, $form ){
|
1059 |
+
$option = '_increment_' . $config[ 'processor_id' ];
|
1060 |
+
$field_id = $field_value = false;
|
1061 |
+
|
1062 |
+
if( ! empty( $config[ 'field' ] ) ){
|
1063 |
+
$field_id = $config[ 'field' ];
|
1064 |
+
$field_value = Caldera_Forms::get_field_data( $field_id, $form );
|
1065 |
+
}
|
1066 |
|
1067 |
+
$saved_value = get_option( $option, $config[ 'start' ] );
|
|
|
1068 |
|
1069 |
+
if( is_numeric( $field_value ) ){
|
1070 |
+
$increment_value = $saved_value + $field_value;
|
1071 |
+
}else{
|
1072 |
+
$increment_value = $saved_value + 1;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
/**
|
1076 |
+
* Filter value for incremental processor
|
1077 |
+
*
|
1078 |
+
* Runs after logic of incremental value is calculated, before is written to field value or tracking option
|
1079 |
+
*
|
1080 |
+
* @since 1.4.5
|
1081 |
+
*
|
1082 |
+
* @param int $increment_value New value
|
1083 |
+
* @param int $saved_value Previous value
|
1084 |
+
* @param array $config Processor config
|
1085 |
+
* @param array $form Form config
|
1086 |
+
*/
|
1087 |
+
$increment_value = apply_filters( 'caldera_forms_incremental_value', $increment_value, $saved_value, $config, $form );
|
1088 |
+
update_option( $option, $increment_value );
|
1089 |
|
1090 |
+
if( $field_id ){
|
1091 |
+
self::set_field_data( $field_id, $increment_value, $form );
|
1092 |
}
|
1093 |
|
1094 |
+
return array(
|
1095 |
+
'increment_value' => $increment_value
|
1096 |
+
);
|
1097 |
|
1098 |
}
|
1099 |
|
1448 |
"template" => CFCORE_PATH . "fields/advanced_file/config_template.php"
|
1449 |
),
|
1450 |
"scripts" => array(
|
1451 |
+
CFCORE_URL . 'fields/advanced_file/uploader.min.js'
|
1452 |
),
|
1453 |
|
1454 |
),
|
1698 |
$field['config']['option'] = array();
|
1699 |
switch($field['config']['auto_type']){
|
1700 |
case 'post_type':
|
1701 |
+
case 'easy-query' :
|
1702 |
|
1703 |
+
if( ! isset( $field[ 'config' ][ 'orderby_post' ] ) ) {
|
1704 |
$field[ 'config' ][ 'orderby_post' ] = 'date';
|
1705 |
}
|
1706 |
|
1724 |
* @param array $args Args for WP_Query
|
1725 |
* @param array $form Form config
|
1726 |
*/
|
1727 |
+
$args = apply_filters( 'caldera_forms_autopopulate_post_type_args', $args, $field );
|
1728 |
|
1729 |
$posts = get_posts( $args );
|
1730 |
+
|
1731 |
if( $field[ 'config' ][ 'value_field' ] === 'id' ){
|
1732 |
$field[ 'config' ][ 'value_field' ] = 'ID';
|
1733 |
}elseif( $field[ 'config' ][ 'value_field' ] === 'name' ){
|
2179 |
}
|
2180 |
}
|
2181 |
|
2182 |
+
if ( is_string( $value ) ) {
|
2183 |
+
// check for magics
|
2184 |
+
preg_match_all( "/\{(.+?)\}/", $value, $magics );
|
2185 |
+
if ( ! empty( $magics[ 1 ] ) ) {
|
2186 |
+
foreach ( $magics[ 1 ] as $magic_key => $magic_tag ) {
|
2187 |
|
2188 |
+
$magic = explode( ':', $magic_tag, 2 );
|
2189 |
|
2190 |
+
if ( count( $magic ) == 2 ) {
|
2191 |
+
switch ( strtolower( $magic[ 0 ] ) ) {
|
2192 |
+
case 'get':
|
2193 |
+
if ( isset( $_GET[ $magic[ 1 ] ] ) ) {
|
2194 |
+
$magic_tag = Caldera_Forms_Sanitize::sanitize( $_GET[ $magic[ 1 ] ] );
|
2195 |
+
} else {
|
2196 |
+
// check on referer.
|
2197 |
+
if ( isset( $referrer[ 'query' ][ $magic[ 1 ] ] ) ) {
|
2198 |
+
$magic_tag = $referrer[ 'query' ][ $magic[ 1 ] ];
|
2199 |
+
} else {
|
2200 |
+
$magic_tag = null;
|
2201 |
+
}
|
2202 |
+
}
|
2203 |
+
break;
|
2204 |
+
case 'post':
|
2205 |
+
if ( isset( $_POST[ $magic[ 1 ] ] ) ) {
|
2206 |
+
$magic_tag = Caldera_Forms_Sanitize::sanitize( $_POST[ $magic[ 1 ] ] );
|
2207 |
+
} else {
|
2208 |
$magic_tag = null;
|
2209 |
}
|
2210 |
+
break;
|
2211 |
+
case 'request':
|
2212 |
+
if ( isset( $_REQUEST[ $magic[ 1 ] ] ) ) {
|
2213 |
+
$magic_tag = Caldera_Forms_Sanitize::sanitize( $_REQUEST[ $magic[ 1 ] ] );
|
2214 |
+
} else {
|
2215 |
+
$magic_tag = null;
|
2216 |
+
}
|
2217 |
+
break;
|
2218 |
+
case 'variable':
|
2219 |
+
if ( ! empty( $this_form[ 'variables' ][ 'keys' ] ) ) {
|
2220 |
+
foreach ( $this_form[ 'variables' ][ 'keys' ] as $var_index => $var_key ) {
|
2221 |
+
if ( $var_key == $magic[ 1 ] ) {
|
2222 |
+
if ( ! in_array( $magic_tag, $magic_caller ) ) {
|
2223 |
+
$magic_caller[] = $magic_tag;
|
2224 |
+
$magic_tag = self::do_magic_tags( $this_form[ 'variables' ][ 'values' ][ $var_index ], $entry_id, $magic_caller );
|
2225 |
+
} else {
|
2226 |
+
$magic_tag = $this_form[ 'variables' ][ 'values' ][ $var_index ];
|
2227 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2228 |
}
|
2229 |
}
|
2230 |
}
|
2231 |
+
break;
|
2232 |
+
case 'date':
|
2233 |
+
$magic_tag = get_date_from_gmt( date( 'Y-m-d H:i:s' ), $magic[ 1 ] );
|
2234 |
+
break;
|
2235 |
+
case 'user':
|
2236 |
+
if ( is_user_logged_in() ) {
|
2237 |
+
$user = get_userdata( get_current_user_id() );
|
2238 |
+
if ( isset( $user->data->{$magic[ 1 ]} ) ) {
|
2239 |
+
$magic_tag = $user->data->{$magic[ 1 ]};
|
2240 |
+
} else {
|
2241 |
+
if ( strtolower( $magic[ 1 ] ) == 'id' ) {
|
2242 |
+
$magic_tag = $user->ID;
|
2243 |
+
} else {
|
2244 |
+
$magic_tag = get_user_meta( $user->ID, $magic[ 1 ], true );
|
2245 |
+
}
|
2246 |
}
|
2247 |
+
} else {
|
2248 |
+
$magic_tag = null;
|
2249 |
}
|
2250 |
+
break;
|
2251 |
+
case 'embed_post':
|
2252 |
+
global $post;
|
|
|
|
|
|
|
2253 |
|
2254 |
+
if ( is_object( $post ) ) {
|
2255 |
+
if ( isset( $post->{$magic[ 1 ]} ) ) {
|
2256 |
+
$magic_tag = $post->{$magic[ 1 ]};
|
2257 |
+
} else {
|
2258 |
|
2259 |
+
// extra post data
|
2260 |
+
switch ( $magic[ 1 ] ) {
|
2261 |
+
case 'permalink':
|
2262 |
+
$magic_tag = get_permalink( $post->ID );
|
2263 |
+
break;
|
2264 |
|
2265 |
+
}
|
2266 |
|
2267 |
+
}
|
2268 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2269 |
$magic_tag = null;
|
2270 |
+
}
|
2271 |
+
break;
|
2272 |
+
case 'post_meta':
|
2273 |
+
global $post;
|
2274 |
+
|
2275 |
+
if ( is_object( $post ) ) {
|
2276 |
+
$post_metavalue = get_post_meta( $post->ID, $magic[ 1 ] );
|
2277 |
+
if ( false !== strpos( $magic[ 1 ], ':' ) ) {
|
2278 |
+
$magic[ 3 ] = explode( ':', $magic[ 1 ] );
|
2279 |
+
}
|
2280 |
+
if ( empty( $post_metavalue ) ) {
|
2281 |
+
$magic_tag = null;
|
2282 |
+
} else {
|
2283 |
+
if ( empty( $magic[ 3 ] ) ) {
|
2284 |
+
$magic_tag = implode( ', ', $post_metavalue );
|
2285 |
+
} else {
|
2286 |
+
$outmagic = array();
|
2287 |
+
foreach ( $magic[ 3 ] as $subkey => $subvalue ) {
|
2288 |
+
foreach ( (array) $post_metavalue as $subsubkey => $subsubval ) {
|
2289 |
+
if ( isset( $subsubval[ $subvalue ] ) ) {
|
2290 |
+
$outmagic[] = $post_metavalue;
|
2291 |
+
}
|
2292 |
}
|
2293 |
}
|
2294 |
+
$magic_tag = implode( ', ', $outmagic );
|
2295 |
}
|
|
|
2296 |
}
|
2297 |
+
} else {
|
2298 |
+
$magic_tag = null;
|
2299 |
}
|
2300 |
+
break;
|
2301 |
+
}
|
2302 |
+
} else {
|
2303 |
+
switch ( $magic_tag ) {
|
2304 |
+
case 'entry_id':
|
2305 |
+
$magic_tag = self::get_field_data( '_entry_id', $this_form );
|
2306 |
+
if ( $magic_tag === null ) {
|
2307 |
+
// check if theres an entry
|
2308 |
+
if ( ! empty( $_GET[ 'cf_ee' ] ) ) {
|
2309 |
+
$entry = self::get_entry_detail( $_GET[ 'cf_ee' ], $this_form );
|
2310 |
+
if ( ! empty( $entry ) ) {
|
2311 |
+
$magic_tag = $entry[ 'id' ];
|
2312 |
+
}
|
|
|
|
|
2313 |
}
|
2314 |
}
|
2315 |
+
break;
|
2316 |
+
case 'entry_token':
|
2317 |
+
$magic_tag = self::get_field_data( '_entry_token', $this_form );
|
2318 |
+
break;
|
2319 |
+
case 'ip':
|
2320 |
+
|
2321 |
+
$ip = $_SERVER[ 'REMOTE_ADDR' ];
|
2322 |
+
if ( ! empty( $_SERVER[ 'HTTP_CLIENT_IP' ] ) ) {
|
2323 |
+
$ip = $_SERVER[ 'HTTP_CLIENT_IP' ];
|
2324 |
+
} elseif ( ! empty( $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] ) ) {
|
2325 |
+
$ip = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2326 |
}
|
2327 |
|
2328 |
+
$magic_tag = $ip;
|
2329 |
+
|
2330 |
+
break;
|
2331 |
+
case 'ua':
|
2332 |
+
$magic_tag = $_SERVER[ 'HTTP_USER_AGENT' ];
|
2333 |
+
break;
|
2334 |
+
case 'summary':
|
2335 |
+
if ( ! empty( $this_form[ 'fields' ] ) ) {
|
2336 |
+
if ( ! isset( $this_form[ 'mailer' ][ 'email_type' ] ) || $this_form[ 'mailer' ][ 'email_type' ] == 'html' ) {
|
2337 |
+
$html = true;
|
2338 |
+
} else {
|
2339 |
+
$html = false;
|
2340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2341 |
|
2342 |
+
$magic_paser = new Caldera_Forms_Magic_Summary( $form, null );
|
2343 |
+
$magic_paser->set_html_mode( $html );
|
2344 |
+
$magic_tag = $magic_paser->get_tag();
|
|
|
|
|
|
|
|
|
|
|
2345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2346 |
}
|
2347 |
+
break;
|
2348 |
+
case 'login_url' :
|
2349 |
+
$magic_tag = wp_login_url();
|
2350 |
+
break;
|
2351 |
+
case 'logout_url' :
|
2352 |
+
$magic_tag = wp_logout_url();
|
2353 |
+
break;
|
2354 |
+
case 'register_url' :
|
2355 |
+
$magic_tag = wp_registration_url();
|
2356 |
+
break;
|
2357 |
+
case 'lostpassword_url' :
|
2358 |
+
$magic_tag = wp_lostpassword_url();
|
2359 |
+
break;
|
|
|
2360 |
|
2361 |
|
2362 |
+
}
|
2363 |
}
|
|
|
2364 |
|
2365 |
+
$filter_value = apply_filters( 'caldera_forms_do_magic_tag', $magic_tag, $magics[ 0 ][ $magic_key ] );
|
2366 |
|
2367 |
+
if ( ! empty( $this_form[ 'ID' ] ) ) {
|
2368 |
|
2369 |
+
// split processor
|
2370 |
|
2371 |
+
if ( ! empty( $magic[ 1 ] ) ) {
|
2372 |
+
if ( false !== strpos( $magic[ 1 ], ':' ) ) {
|
2373 |
+
$magic = array_reverse( explode( ':', $magic[ 1 ] ) );
|
2374 |
+
}
|
2375 |
}
|
2376 |
+
// check if its a process id or processor slug
|
2377 |
+
if ( empty( $processed_meta[ $this_form[ 'ID' ] ][ $magic[ 0 ] ] ) && ! empty( $this_form[ 'processors' ] ) ) {
|
2378 |
+
|
2379 |
+
// if not a direct chec if theres a slug
|
2380 |
+
foreach ( $this_form[ 'processors' ] as $processid => $processor ) {
|
2381 |
+
if ( $processor[ 'type' ] === $magic[ 0 ] ) {
|
2382 |
+
if ( ! empty( $processed_meta[ $this_form[ 'ID' ] ][ $processid ] ) ) {
|
2383 |
+
$magic[ 0 ] = $processid;
|
2384 |
+
break;
|
2385 |
+
}
|
2386 |
}
|
2387 |
}
|
2388 |
}
|
2389 |
+
if ( ! empty( $processed_meta[ $this_form[ 'ID' ] ][ $magic[ 0 ] ] ) ) {
|
2390 |
+
|
2391 |
+
if ( isset( $processed_meta[ $this_form[ 'ID' ] ][ $magic[ 0 ] ][ $magic[ 1 ] ] ) ) {
|
2392 |
+
// direct fined
|
2393 |
+
$filter_value = implode( ', ', (array) $processed_meta[ $this_form[ 'ID' ] ][ $magic[ 0 ] ][ $magic[ 1 ] ] );
|
2394 |
+
} else {
|
2395 |
+
foreach ( $processed_meta[ $this_form[ 'ID' ] ][ $magic[ 0 ] ] as $return_array ) {
|
2396 |
+
foreach ( $return_array as $return_line ) {
|
2397 |
+
if ( isset( $return_line[ $magic[ 1 ] ] ) ) {
|
2398 |
+
$filter_value = $return_line[ $magic[ 1 ] ];
|
2399 |
+
}
|
2400 |
}
|
2401 |
}
|
2402 |
}
|
2403 |
}
|
2404 |
}
|
|
|
2405 |
|
2406 |
+
if ( $filter_value != $magics[ 1 ][ $magic_key ] ) {
|
2407 |
+
$value = str_replace( $magics[ 0 ][ $magic_key ], $filter_value, $value );
|
2408 |
+
}
|
2409 |
|
2410 |
+
}
|
2411 |
}
|
|
|
2412 |
|
2413 |
+
// fields
|
2414 |
+
$regex = "/%([a-zA-Z0-9_:]*)%/";
|
2415 |
|
2416 |
+
preg_match_all( $regex, $value, $matches );
|
2417 |
+
if ( ! empty( $matches[ 1 ] ) ) {
|
2418 |
+
foreach ( $matches[ 1 ] as $key => $tag ) {
|
2419 |
+
// check for parts
|
2420 |
+
$part_tags = explode( ':', $tag );
|
2421 |
+
if ( ! empty( $part_tags[ 1 ] ) ) {
|
2422 |
+
$tag = $part_tags[ 0 ];
|
2423 |
+
}
|
2424 |
+
$entry = self::get_slug_data( $tag, $this_form, $entry_id );
|
2425 |
|
2426 |
+
if ( $entry !== null ) {
|
2427 |
+
$field = self::get_field_by_slug( $tag, $this_form );
|
2428 |
+
}
|
2429 |
|
2430 |
|
2431 |
+
if ( ! empty( $field ) && ! empty( $part_tags[ 1 ] ) && $part_tags[ 1 ] == 'label' ) {
|
2432 |
+
if ( ! is_array( $entry ) ) {
|
2433 |
+
$entry = (array) $entry;
|
2434 |
+
}
|
2435 |
+
foreach ( (array) $entry as $entry_key => $entry_line ) {
|
2436 |
+
if ( ! empty( $field[ 'config' ][ 'option' ] ) ) {
|
2437 |
+
foreach ( $field[ 'config' ][ 'option' ] as $option ) {
|
2438 |
+
if ( $option[ 'value' ] == $entry_line ) {
|
2439 |
+
$entry[ $entry_key ] = $option[ 'label' ];
|
2440 |
+
}
|
2441 |
}
|
2442 |
}
|
2443 |
}
|
2444 |
}
|
|
|
2445 |
|
2446 |
+
if ( is_array( $entry ) ) {
|
2447 |
|
2448 |
+
if ( count( $entry ) === 1 ) {
|
2449 |
+
$entry = array_shift( $entry );
|
2450 |
+
}elseif(count($entry) === 2){
|
2451 |
+
$entry = implode(', ', $entry);
|
2452 |
+
}elseif(count($entry) > 2){
|
2453 |
+
$last = array_pop($entry);
|
2454 |
+
$entry = implode(', ', $entry).', '.$last;
|
2455 |
+
}else{
|
2456 |
+
$entry = null;
|
2457 |
+
}
|
2458 |
}
|
|
|
2459 |
|
2460 |
+
$value = str_replace($matches[0][$key], $entry, $value);
|
2461 |
+
}
|
2462 |
}
|
2463 |
}
|
2464 |
|
2747 |
}
|
2748 |
}
|
2749 |
}else{
|
2750 |
+
if( ! empty( $entry ) ) {
|
2751 |
+
$processed_data[$indexkey][$field_id] = $entry;
|
2752 |
+
}else{
|
2753 |
+
$processed_data[$indexkey][$field_id] = self::do_magic_tags($field['config']['default']);
|
2754 |
+
}
|
2755 |
}
|
2756 |
}else{
|
2757 |
// dynamic
|
3149 |
|
3150 |
|
3151 |
if(isset($_POST['_cf_frm_tr'])){
|
3152 |
+
$pretransient = Caldera_Forms_Transient::get_transient( $_POST['_cf_frm_tr'] );
|
3153 |
if( !empty( $pretransient['transient'] ) && $pretransient['transient'] === $_POST['_cf_frm_tr']){
|
3154 |
$transdata = $pretransient;
|
3155 |
$process_id = $transdata['transient'];
|
3178 |
if(isset($_POST['_cf_frm_edt'])){
|
3179 |
$entry_id = (int) $_POST['_cf_frm_edt'];
|
3180 |
}
|
3181 |
+
|
|
|
3182 |
$data = self::get_submission_data($form);
|
3183 |
+
|
3184 |
+
// set transient for returns submissions
|
|
|
3185 |
if(empty($transdata)){
|
3186 |
$transdata = array(
|
3187 |
'transient' => $process_id,
|
3188 |
'form_instance' => $form_instance_number,
|
3189 |
+
'expire' => 600,
|
3190 |
'data' => array_merge($_POST, $data),
|
3191 |
);
|
3192 |
}
|
3193 |
+
|
3194 |
// remove AJAX value for tp_
|
3195 |
if(isset($transdata['data']['cfajax'])){
|
3196 |
unset($transdata['data']['cfajax']);
|
3329 |
$referrer = apply_filters( 'caldera_forms_submit_return_redirect', $referrer, $form, $process_id);
|
3330 |
$referrer = apply_filters( 'caldera_forms_submit_return_redirect_required', $referrer, $form, $process_id);
|
3331 |
|
3332 |
+
Caldera_Forms_Transient::set_transient( $process_id, $transdata, $transdata['expire']);
|
3333 |
|
3334 |
return self::form_redirect('error', $referrer, $form, $process_id );
|
3335 |
}
|
3459 |
$referrer = apply_filters( 'caldera_forms_submit_return_redirect-'.$processor['type'], $referrer, $config, $form, $process_id);
|
3460 |
|
3461 |
// set transient data
|
3462 |
+
Caldera_Forms_Transient::set_transient( $process_id, $transdata, $transdata['expire']);
|
3463 |
|
3464 |
return self::form_redirect('preprocess', $referrer, $form, $process_id );
|
3465 |
}
|
3605 |
$referrer = apply_filters( 'caldera_forms_submit_error_redirect_pre_process', $referrer, $form, $process_id);
|
3606 |
|
3607 |
// set transient data
|
3608 |
+
Caldera_Forms_Transient::set_transient( $process_id, $transdata, $transdata['expire']);
|
3609 |
|
3610 |
return self::form_redirect('error', $referrer, $form, $process_id );
|
3611 |
}
|
3739 |
* Makes Caldera Forms load the preview
|
3740 |
*/
|
3741 |
static public function cf_init_preview(){
|
3742 |
+
if( ! isset( $_GET, $_GET['cf_preview'] ) ){
|
3743 |
+
return;
|
3744 |
+
}
|
3745 |
global $post, $form;
|
3746 |
|
3747 |
+
$preview_id = trim( $_GET['cf_preview'] );
|
3748 |
+
if(!empty( $preview_id )){
|
3749 |
+
$form = Caldera_Forms_Forms::get_form($preview_id );
|
3750 |
|
3751 |
$userid = get_current_user_id();
|
3752 |
if( !empty( $userid ) ){
|
3753 |
|
3754 |
+
if(empty( $form['ID']) || $form['ID'] !== trim( $preview_id ) ){
|
3755 |
return;
|
3756 |
}
|
3757 |
if( empty($post) || $post->post_title !== 'Caldera Forms Preview' ){
|
3768 |
'comment_status' => 'closed'
|
3769 |
);
|
3770 |
$page_id = wp_insert_post( $post );
|
3771 |
+
wp_redirect( trailingslashit( get_home_url() ) . '?page_id='.$page_id.'&preview=true&cf_preview='.$preview_id );
|
3772 |
exit;
|
3773 |
}
|
3774 |
if( $temp_page->post_status !== 'draft'){
|
3775 |
wp_update_post( array( 'ID' => $temp_page->ID, 'post_status' => 'draft' ) );
|
3776 |
}
|
3777 |
+
wp_redirect( trailingslashit( get_home_url() ) . '?page_id='.$temp_page->ID.'&preview=true&cf_preview='.$preview_id );
|
3778 |
exit;
|
3779 |
}
|
3780 |
$post->post_title = $form['name'];
|
3830 |
return;
|
3831 |
}
|
3832 |
|
3833 |
+
Caldera_Forms_Render_Assets::optional_style_includes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3834 |
|
3835 |
foreach( $page_forms as $form_id ){
|
3836 |
// has form get stuff for it
|
3889 |
if ( ! isset( $wp_query->query_vars['cf_api'] ) ){
|
3890 |
return;
|
3891 |
}
|
3892 |
+
|
3893 |
// check if form exists
|
3894 |
$form = Caldera_Forms_Forms::get_form( $wp_query->query_vars['cf_api'] );
|
3895 |
$atts = array(
|
3915 |
|
3916 |
if( !empty( $_POST['control'] ) ){
|
3917 |
$transient_name = sanitize_key( $_POST['control'] );
|
3918 |
+
$transdata = Caldera_Forms_Transient::get_transient( $transient_name );
|
3919 |
if( false === $transdata ){
|
3920 |
$transdata = array();
|
3921 |
}
|
3930 |
|
3931 |
$transdata[] = $data;
|
3932 |
//set
|
3933 |
+
Caldera_Forms_Transient::set_transient( $transient_name, $transdata, DAY_IN_SECONDS );
|
3934 |
// maybe put in some checks on file then can say yea or nei
|
3935 |
wp_send_json_success( array(
|
3936 |
|
3985 |
* @param string $form_id ID of form.
|
3986 |
*/
|
3987 |
return apply_filters( 'caldera_forms_submission_url', $url, $form_id );
|
3988 |
+
|
3989 |
}
|
3990 |
|
3991 |
/**
|
3996 |
global $post, $wp_query, $process_id, $form;
|
3997 |
|
3998 |
// setup script and style urls
|
3999 |
+
$style_urls = Caldera_Forms_Render_Assets::get_core_styles();
|
4000 |
+
$script_urls = Caldera_Forms_Render_Assets::get_core_scripts();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4001 |
$script_style_urls = array();
|
4002 |
|
4003 |
// check to see language and include the language add on
|
4048 |
}
|
4049 |
wp_register_style( 'cf-' . $style_key . '-styles', $style_url, array(), CFCORE_VER );
|
4050 |
}
|
4051 |
+
|
4052 |
+
wp_register_style( 'cf-front-styles', CFCORE_URL . 'assets/css/caldera-forms-front.min.css', array(), CFCORE_VER );
|
4053 |
// register scripts
|
4054 |
foreach( $script_style_urls['script'] as $script_key => $script_url ){
|
4055 |
if( empty( $script_url ) ){
|
4065 |
if(!empty($_GET['cf_tp'])){
|
4066 |
|
4067 |
// process a transient stored entry
|
4068 |
+
$data = Caldera_Forms_Transient::get_transient( $_GET[ 'cf_tp' ] );
|
4069 |
if(!empty($data) && $data['transient'] === $_GET['cf_tp'] && isset($data['data'])){
|
4070 |
// create post values
|
4071 |
$_POST = array_merge( $_POST, $data['data']);
|
4287 |
// allow plugins to alter the entry
|
4288 |
$data = apply_filters( 'caldera_forms_get_entry', $data, $entry_id, $form);
|
4289 |
|
4290 |
+
|
4291 |
return $data;
|
4292 |
}
|
4293 |
|
4304 |
* @return string
|
4305 |
*/
|
4306 |
static public function render_modal_form($atts, $content){
|
|
|
|
|
4307 |
|
4308 |
if(empty($atts['id'])){
|
4309 |
return $content;
|
4331 |
|
4332 |
$current_state = 'style="display:none;"';
|
4333 |
if(!empty($_GET['cf_er'])){
|
4334 |
+
$transdata = Caldera_Forms_Transient::get_transient( $_GET[ 'cf_er' ] );
|
4335 |
if($transdata['transient'] == $_GET['cf_er']){
|
4336 |
$current_state = 'style="display:block;"';
|
4337 |
}
|
4346 |
$width = ' width: ' . floatval( $atts['width'] ).'px; margin-left: -' . ( floatval( $atts['width'] ) / 2 ) . 'px;';
|
4347 |
}
|
4348 |
|
|
|
4349 |
ob_start();
|
4350 |
?>
|
4351 |
+
<div id="<?php echo esc_attr( $modal_id ); ?>" class="caldera-front-modal-container" <?php echo $current_state; ?> data-form-id="<?php echo esc_attr( $modal_id ); ?>">
|
4352 |
<div class="caldera-backdrop"></div>
|
4353 |
<div id="<?php echo $modal_id; ?>_modal_wrap" tabindex="-1" arialabelled-by="<?php echo $modal_id; ?>_modal_label" class="caldera-modal-wrap caldera-front-modal-wrap" style="display: block; <?php echo $width; ?>">
|
4354 |
<div class="caldera-modal-title" id="<?php echo $modal_id; ?>_modal_title" style="display: block;">
|
4361 |
</div>
|
4362 |
</div>
|
4363 |
<?php
|
4364 |
+
self::$footer_modals .= ob_get_clean();
|
4365 |
return $out;
|
4366 |
}
|
4367 |
|
4368 |
/**
|
4369 |
* Print modal content in footer.
|
4370 |
+
*
|
4371 |
+
* @since unknown
|
4372 |
+
*
|
4373 |
+
* @uses "wp_footer"
|
4374 |
*/
|
4375 |
static public function render_footer_modals(){
|
4376 |
+
$footer_modals = self::$footer_modals;
|
4377 |
+
if ( ! empty( $footer_modals ) && is_string( $footer_modals ) ) {
|
4378 |
echo $footer_modals;
|
4379 |
}
|
4380 |
+
|
4381 |
}
|
4382 |
|
4383 |
/**
|
4384 |
+
* Create HTML markup for a field.
|
4385 |
*
|
4386 |
* @since unknown
|
4387 |
*
|
4388 |
* @param array|string $field Form ID or shortcode atts or form config array
|
4389 |
+
* @param array|null $form Optional Form to load field from. Not necessary, but helps the filters out.
|
4390 |
* @param array $entry_data Optional. Entry data to populate field with. Null, the default, loads form for creating a new entry.
|
4391 |
*
|
4392 |
* @return void|string HTML for form, if it was able to be loaded,
|
4427 |
"field_before" => "<div class=\"" . $field_input_class ."\">\r\n",
|
4428 |
"label_before" => ( empty($field['hide_label']) ? "<label id=\"" . $field['ID'] ."Label\" for=\"" . $field['ID'].'_'.$current_form_count . "\" class=\"" . implode(' ', $field_classes['field_label'] ) . "\">" : null ),
|
4429 |
"label" => ( empty($field['hide_label']) ? $field['label'] : null ),
|
4430 |
+
"label_required" => ( empty($field['hide_label']) ? ( !empty($field['required']) ? " <span aria-hidden=\"true\" role=\"presentation\" class=\"" . implode(' ', $field_classes['field_required_tag'] ) . "\" style=\"color:#ee0000;\">*</span>" : "" ) : null ),
|
4431 |
"label_after" => ( empty($field['hide_label']) ? "</label>" : null ),
|
4432 |
"field_placeholder" => ( !empty($field['hide_label']) ? 'placeholder="' . htmlentities( $field['label'] ) .'"' : null),
|
4433 |
"field_required" => ( !empty($field['required']) ? 'required="required"' : null),
|
4449 |
if( !empty( $field['caption'] ) ){
|
4450 |
$field_structure['aria']['describedby'] = $field['ID'] . 'Caption';
|
4451 |
}
|
4452 |
+
|
4453 |
// add error
|
4454 |
if ( ! empty( $field_errors ) ) {
|
4455 |
if( is_string( $field_errors ) ){
|
4647 |
|
4648 |
do_action('caldera_forms_render_start', $form);
|
4649 |
|
4650 |
+
Caldera_Forms_Render_Assets::optional_style_includes();
|
4651 |
|
4652 |
+
$form_attributes = array(
|
4653 |
+
'method' => 'POST',
|
4654 |
+
'enctype' => 'multipart/form-data',
|
4655 |
+
'role' => 'form',
|
4656 |
+
'id' => $form['ID'] . '_' . $current_form_count
|
4657 |
+
);
|
4658 |
|
4659 |
+
//add extra attributes to make AJAX submissions JS do its thing
|
4660 |
+
if( ! empty( $form[ 'form_ajax'] ) ){
|
4661 |
+
add_filter('caldera_forms_render_form_attributes', 'cf_ajax_setatts', 10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
4662 |
|
4663 |
+
}
|
|
|
4664 |
|
4665 |
+
/**
|
4666 |
+
* Modify HTML attributes applied to form element
|
4667 |
+
*
|
4668 |
+
* @since unknown
|
4669 |
+
*
|
4670 |
+
* @param array $form_attributes Array of HTML attributes
|
4671 |
+
* @param array $config Form config
|
4672 |
+
*/
|
4673 |
+
$form_attributes = apply_filters( 'caldera_forms_render_form_attributes', $form_attributes, $form);
|
4674 |
|
4675 |
|
4676 |
include_once CFCORE_PATH . "classes/caldera-grid.php";
|
4699 |
"column_single" => 'single',
|
4700 |
"column_before" => '<div %1$s class="col-'.$gridsize.'-%2$d %3$s">',
|
4701 |
"column_after" => '</div>',
|
4702 |
+
'form_id' => $form['ID'],
|
4703 |
+
'form_id_attr' => $form_attributes[ 'id']
|
4704 |
);
|
4705 |
|
4706 |
// filter settings
|
4707 |
$grid_settings = apply_filters( 'caldera_forms_render_grid_settings', $grid_settings, $form);
|
4708 |
|
4709 |
$form['grid_object'] = new Caldera_Form_Grid($grid_settings);
|
4710 |
+
if( empty( $form['layout_grid'] ) ) {
|
4711 |
+
$form['layout_grid'] = array( 'structure' => '' );
|
4712 |
+
}
|
4713 |
|
4714 |
// Build Pages Breaks
|
4715 |
if( false !== strpos($form['layout_grid']['structure'], '#')){
|
4826 |
}
|
4827 |
|
4828 |
if(!empty($_GET['cf_er'])){
|
4829 |
+
$prev_post = Caldera_Forms_Transient::get_transient( $_GET['cf_er'] );
|
4830 |
if(!empty($prev_post['transient'])){
|
4831 |
|
4832 |
if($prev_post['transient'] === $_GET['cf_er']){
|
4869 |
}
|
4870 |
}
|
4871 |
|
4872 |
+
|
4873 |
// build grid & pages
|
4874 |
$form['grid_object']->setLayout($form['layout_grid']['structure']);
|
4875 |
|
4951 |
if(!empty($form['layout_grid']['fields'])){
|
4952 |
|
4953 |
foreach($form['layout_grid']['fields'] as $field_base_id=>$location){
|
|
|
|
|
|
|
4954 |
|
4955 |
+
if(isset($form['fields'][$field_base_id]) ) {
|
4956 |
+
$field = self::load_field( $form, $field_base_id );
|
4957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4958 |
|
4959 |
if(empty($field) || !isset($field_types[$field['type']]['file']) || !file_exists($field_types[$field['type']]['file'])){
|
4960 |
continue;
|
4962 |
|
4963 |
$field['grid_location'] = $location;
|
4964 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4965 |
|
4966 |
+
Caldera_Forms_Render_Assets::enqueue_field_scripts( $field_types, $field );
|
4967 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4968 |
|
4969 |
$field_base_id = $field['ID'] . '_' . $current_form_count;
|
4970 |
|
4976 |
$field_html = self::render_field( $field, $form, $prev_data, $field_error );
|
4977 |
// conditional wrapper
|
4978 |
if(!empty($field['conditions']['group']) && !empty($field['conditions']['type']) ){
|
4979 |
+
|
|
|
|
|
|
|
4980 |
$conditions_configs[$field_base_id] = $field['conditions'];
|
4981 |
|
4982 |
if( $field['conditions']['type'] !== 'disable' ){
|
5005 |
|
5006 |
}
|
5007 |
}
|
5008 |
+
|
5009 |
}
|
5010 |
+
|
5011 |
// form object strings
|
5012 |
wp_localize_script( 'cf-dynamic', $form['ID'] . '_' . $current_form_count, $form_field_strings );
|
5013 |
|
5075 |
'caldera_forms_form',
|
5076 |
);
|
5077 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5078 |
/**
|
5079 |
* Change what type of element form is in.
|
5080 |
*
|
5097 |
*/
|
5098 |
$form_classes = apply_filters( 'caldera_forms_render_form_classes', $form_classes, $form);
|
5099 |
|
5100 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5101 |
|
5102 |
$attributes = array();
|
5103 |
foreach($form_attributes as $attribute=>$value){
|
5151 |
}
|
5152 |
|
5153 |
$qurystr['cf_pg'] = $page_key + 1;
|
5154 |
+
$out .= "<li" . $tabclass . "><a aria-controls=\"form_page_" . $current_form_count ."_pg_" . ( $page_key + 1 ) . "\" aria-expanded=\"" . $expanded . "\" id=\"breadcrumb_" . $current_form_count ."_pg_" . ( $page_key + 1 ) . "\" href=\"?". http_build_query($qurystr) . "\" data-page=\"" . ( $page_key + 1 ) ."\" data-pagenav=\"caldera_form_" . $current_form_count ."\" title=\"" . sprintf( __( 'Navigate to %s', 'caldera-forms' ), $page_name ) ."\">". $page_name . "</a></li>\r\n";
|
5155 |
}
|
5156 |
$out .= "</ol></span>\r\n";
|
5157 |
}
|
5253 |
*/
|
5254 |
do_action('caldera_forms_render_end', $form);
|
5255 |
|
5256 |
+
wp_enqueue_style( 'cf-field-styles' );
|
5257 |
wp_enqueue_script( 'cf-field' );
|
|
|
5258 |
wp_enqueue_script( 'cf-validator' );
|
5259 |
wp_enqueue_script( 'cf-validator-i18n' );
|
5260 |
|
5377 |
return $time;
|
5378 |
}
|
5379 |
|
5380 |
+
/**
|
5381 |
+
* Setup auto-population options for Easy Pods and Easy Queries
|
5382 |
+
*
|
5383 |
+
* @since 1.4.3
|
5384 |
+
*
|
5385 |
+
* @uses "caldera_forms_render_start" action
|
5386 |
+
*/
|
5387 |
+
public static function easy_pods_queries_setup(){
|
5388 |
+
if ( version_compare( phpversion(), '5.3.0', '>=' ) ) {
|
5389 |
+
if ( function_exists( 'cep_get_easy_pod' ) || defined( 'CAEQ_PATH' ) ) {
|
5390 |
+
$setup = new Caldera_Forms_Render_AutoPopulation();
|
5391 |
+
$setup->add_hooks();
|
5392 |
+
}
|
5393 |
+
}
|
5394 |
+
|
5395 |
+
|
5396 |
+
}
|
5397 |
+
|
5398 |
+
/**
|
5399 |
+
* Load the Caldera Forms REST API
|
5400 |
+
*
|
5401 |
+
* @since 1.4.4
|
5402 |
+
*
|
5403 |
+
* @uses "rest_api_init" action
|
5404 |
+
*/
|
5405 |
+
public static function init_rest_api(){
|
5406 |
+
self::$api = new Caldera_Forms_API_Load( Caldera_Forms_API_Util::api_namespace() );
|
5407 |
+
|
5408 |
+
/**
|
5409 |
+
* Runs after REST API loader is initialized, but before routes are initialized.
|
5410 |
+
*
|
5411 |
+
* Use this hook to register routes in add-ons
|
5412 |
+
*
|
5413 |
+
* do_action( 'caldera_forms_rest_api_pre_init', function( $api ){ $api->add_route(...
|
5414 |
+
*
|
5415 |
+
* @since 1.4.4
|
5416 |
+
*
|
5417 |
+
* @param Caldera_Forms_API_Load $api API Load class
|
5418 |
+
*/
|
5419 |
+
do_action( 'caldera_forms_rest_api_pre_init', self::$api );
|
5420 |
+
|
5421 |
+
self::$api->init_routes();
|
5422 |
+
|
5423 |
+
/**
|
5424 |
+
* Runs after Caldera Forms REST API is loaded
|
5425 |
+
*
|
5426 |
+
* @since 1.4.4
|
5427 |
+
*/
|
5428 |
+
do_action( 'caldera_forms_rest_api_init' );
|
5429 |
+
|
5430 |
+
}
|
5431 |
+
|
5432 |
+
public static function should_send_mail( $form, $transadata = array() ){
|
5433 |
+
$send = true;
|
5434 |
+
if( empty( $transadata ) ){
|
5435 |
+
global $transadata;
|
5436 |
+
}
|
5437 |
+
|
5438 |
+
if( !empty( $transdata['edit'] ) ){
|
5439 |
+
// update
|
5440 |
+
if( empty($form['mailer']['on_update'] ) ){
|
5441 |
+
$send = false;
|
5442 |
+
}
|
5443 |
+
}else{
|
5444 |
+
// insert
|
5445 |
+
if( empty( $form['mailer']['enable_mailer'] ) && empty($form['mailer']['on_insert'] ) ){
|
5446 |
+
$send = false;
|
5447 |
+
}
|
5448 |
+
}
|
5449 |
+
|
5450 |
+
/**
|
5451 |
+
* Change programmed decision to send mailer or not
|
5452 |
+
*
|
5453 |
+
* Useful for causing emails to send on entry edit, when they normally would not
|
5454 |
+
*
|
5455 |
+
* @since 1.4.4
|
5456 |
+
*
|
5457 |
+
* @param bool $send Whether to send or not
|
5458 |
+
* @param array $form Form config
|
5459 |
+
*/
|
5460 |
+
return apply_filters( 'caldera_forms_send_email', $send, $form );
|
5461 |
+
|
5462 |
+
}
|
5463 |
+
|
5464 |
+
/**
|
5465 |
+
* Apply wpautop to email message.
|
5466 |
+
*
|
5467 |
+
* This was separated out from main email generation method in 1.4.7 so it would be removable, see: https://github.com/CalderaWP/Caldera-Forms/issues/1048
|
5468 |
+
*
|
5469 |
+
* @since 1.4.7
|
5470 |
+
*
|
5471 |
+
* @uses "caldera_forms_mailer" filter
|
5472 |
+
*
|
5473 |
+
* @param array $mail
|
5474 |
+
*
|
5475 |
+
* @return mixed
|
5476 |
+
*/
|
5477 |
+
public static function format_message( $mail ){
|
5478 |
+
$mail[ 'message' ] = wpautop( $mail[ 'message' ] );
|
5479 |
+
return $mail;
|
5480 |
+
}
|
5481 |
+
|
5482 |
}
|
classes/csv/util.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Utility functions for CSV related work
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_CSV_Util {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get the character encoding for CSV files
|
16 |
+
*
|
17 |
+
* @since 1.4.4
|
18 |
+
*
|
19 |
+
* @param array $form Form config. Technically optional, but should always be passed for benefit of filter.
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public static function character_encoding( array $form = array() ){
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Change the character encoding for CSV
|
27 |
+
*
|
28 |
+
* Used for entry export and email attachments
|
29 |
+
*
|
30 |
+
* @since 1.4.4
|
31 |
+
*
|
32 |
+
* @param string $encoding. Default is 'utf-8'
|
33 |
+
* @param array $form Current form configuration.
|
34 |
+
*/
|
35 |
+
return apply_filters( 'caldera_forms_csv_character_encoding', 'utf-8', $form );
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
classes/db/base.php
CHANGED
@@ -424,4 +424,22 @@ abstract class Caldera_Forms_DB_Base {
|
|
424 |
|
425 |
}
|
426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
}
|
424 |
|
425 |
}
|
426 |
|
427 |
+
/**
|
428 |
+
* Query by meta key
|
429 |
+
*
|
430 |
+
* @since 1.4.5
|
431 |
+
*
|
432 |
+
* @param string $key Meta key to query by
|
433 |
+
* @param string $value Meta value to query for
|
434 |
+
*
|
435 |
+
* @return array|null
|
436 |
+
*/
|
437 |
+
protected function query_meta( $key, $value ){
|
438 |
+
global $wpdb;
|
439 |
+
$table = $this->get_table_name( true );
|
440 |
+
$sql = $wpdb->prepare( "SELECT * FROM $table WHERE `meta_key` = '%s' AND `meta_value` = '%s' ", $key, $value );
|
441 |
+
$r = $wpdb->get_results( $sql, ARRAY_A );
|
442 |
+
return $r;
|
443 |
+
}
|
444 |
+
|
445 |
}
|
classes/db/track.php
CHANGED
@@ -291,6 +291,54 @@ class Caldera_Forms_DB_Track extends Caldera_Forms_DB_Base {
|
|
291 |
return true;
|
292 |
}
|
293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
|
296 |
}
|
291 |
return true;
|
292 |
}
|
293 |
|
294 |
+
/**
|
295 |
+
* Get tracking data by event name
|
296 |
+
*
|
297 |
+
* @since 1.4.5
|
298 |
+
*
|
299 |
+
* @param string $event Event name
|
300 |
+
* @param bool $return_forms Optional. If true, the default, form IDs are returned. If false, event meta data is returned.
|
301 |
+
*
|
302 |
+
* @return array|null
|
303 |
+
*/
|
304 |
+
public function by_event( $event, $return_forms = true ){
|
305 |
+
$metas = $this->query_meta( 'event', $event );
|
306 |
+
if( ! empty( $metas ) ){
|
307 |
+
|
308 |
+
if( $return_forms ){
|
309 |
+
$event_ids = array_unique( wp_list_pluck( $metas, 'event_id' ) );
|
310 |
+
$forms = $this->form_ids_for_events( $event_ids );
|
311 |
+
if( ! empty( $forms ) ){
|
312 |
+
return wp_list_pluck( $forms, 'form_id' );
|
313 |
+
}
|
314 |
+
|
315 |
+
}else{
|
316 |
+
return $metas;
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
}
|
321 |
+
|
322 |
+
return array();
|
323 |
+
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Get form IDs or an array of event IDs
|
328 |
+
*
|
329 |
+
* @since 1.4.5
|
330 |
+
*
|
331 |
+
* @param array $event_ids Event IDs to find form IDs for
|
332 |
+
*
|
333 |
+
* @return array|null
|
334 |
+
*/
|
335 |
+
protected function form_ids_for_events( $event_ids ){
|
336 |
+
global $wpdb;
|
337 |
+
$table = $this->get_table_name( false );
|
338 |
+
$sql = $wpdb->prepare( "SELECT `form_id` FROM $table WHERE `ID` IN( '%s' )", implode( ',', $event_ids ) );
|
339 |
+
return $wpdb->get_results( $sql, ARRAY_A );
|
340 |
+
}
|
341 |
+
|
342 |
|
343 |
|
344 |
}
|
classes/email/preview.php
CHANGED
@@ -9,81 +9,13 @@
|
|
9 |
* @link
|
10 |
* @copyright 2016 CalderaWP LLC
|
11 |
*/
|
12 |
-
class Caldera_Forms_Email_Preview
|
13 |
-
|
14 |
-
/**
|
15 |
-
* The mail data
|
16 |
-
*
|
17 |
-
* @since 1.4.0
|
18 |
-
*
|
19 |
-
* @var array
|
20 |
-
*/
|
21 |
-
protected $mail;
|
22 |
-
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Caldera_Forms_Email_Preview constructor.
|
26 |
-
*
|
27 |
-
* @since 1.4.0
|
28 |
-
*
|
29 |
-
* @param array $mail Mail data
|
30 |
-
*/
|
31 |
-
public function __construct( $mail ){
|
32 |
-
$this->mail = $mail;
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Get content type
|
38 |
-
*
|
39 |
-
* @since 1.4.0
|
40 |
-
*
|
41 |
-
* @return string
|
42 |
-
*/
|
43 |
-
public function content_type(){
|
44 |
-
if( isset( $this->mail[ 'html' ] ) && $this->mail[ 'html' ] ){
|
45 |
-
return 'text/html';
|
46 |
-
}
|
47 |
-
|
48 |
-
return 'text/plain';
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Get email headers
|
53 |
-
*
|
54 |
-
* @since 1.4.0
|
55 |
-
*
|
56 |
-
* @return array
|
57 |
-
*/
|
58 |
-
public function headers(){
|
59 |
-
$headers = array();
|
60 |
-
$headers[ 'recipients' ] = $this->mail[ 'recipients' ];
|
61 |
-
$headers[ 'subject' ] = $this->mail[ 'subject' ];
|
62 |
-
$headers[ 'all' ] = $this->mail[ 'headers' ];
|
63 |
-
|
64 |
-
return $headers;
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Get the email message
|
69 |
-
*
|
70 |
-
* @since 1.4.0
|
71 |
-
*
|
72 |
-
* @return string
|
73 |
-
*/
|
74 |
-
public function body(){
|
75 |
-
if( isset( $this->mail[ 'message' ] ) ){
|
76 |
-
return $this->mail[ 'message' ];
|
77 |
-
}
|
78 |
-
|
79 |
-
return '';
|
80 |
-
}
|
81 |
|
82 |
/**
|
83 |
* @inheritdoc
|
84 |
*/
|
85 |
public function jsonSerialize() {
|
86 |
-
return
|
87 |
'headers' => $this->headers(),
|
88 |
'message' => $this->body(),
|
89 |
'content-type' => $this->content_type()
|
9 |
* @link
|
10 |
* @copyright 2016 CalderaWP LLC
|
11 |
*/
|
12 |
+
class Caldera_Forms_Email_Preview extends Caldera_Forms_Email_Save {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @inheritdoc
|
16 |
*/
|
17 |
public function jsonSerialize() {
|
18 |
+
return array(
|
19 |
'headers' => $this->headers(),
|
20 |
'message' => $this->body(),
|
21 |
'content-type' => $this->content_type()
|
classes/email/save.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Creates a JSON serializable object to save emails
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
abstract class Caldera_Forms_Email_Save implements JsonSerializable {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The mail data
|
16 |
+
*
|
17 |
+
* @since 1.4.1
|
18 |
+
*
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
protected $mail;
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Caldera_Forms_Email_Preview constructor.
|
26 |
+
*
|
27 |
+
* @since 1.4.1
|
28 |
+
*
|
29 |
+
* @param array $mail Mail data
|
30 |
+
*/
|
31 |
+
public function __construct( $mail ){
|
32 |
+
$this->mail = $mail;
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get the raw mail message array
|
38 |
+
*
|
39 |
+
* @since 1.4.1
|
40 |
+
*
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public function get_mail(){
|
44 |
+
return $this->mail;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Get content type
|
49 |
+
*
|
50 |
+
* @since 1.4.1
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function content_type(){
|
55 |
+
if( isset( $this->mail[ 'html' ] ) && $this->mail[ 'html' ] ){
|
56 |
+
return 'text/html';
|
57 |
+
}
|
58 |
+
|
59 |
+
return 'text/plain';
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Get email headers
|
64 |
+
*
|
65 |
+
* @since 1.4.1
|
66 |
+
*
|
67 |
+
* @return array
|
68 |
+
*/
|
69 |
+
public function headers(){
|
70 |
+
$headers = array();
|
71 |
+
$headers[ 'recipients' ] = $this->recipients();
|
72 |
+
$headers[ 'subject' ] = $this->subject();
|
73 |
+
$headers[ 'all' ] = $this->headers_all();
|
74 |
+
return $headers;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Get the email message
|
79 |
+
*
|
80 |
+
* @since 1.4.1
|
81 |
+
*
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
public function body(){
|
85 |
+
if( isset( $this->mail[ 'message' ] ) ){
|
86 |
+
return $this->mail[ 'message' ];
|
87 |
+
}
|
88 |
+
|
89 |
+
return '';
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get the email's attachments
|
94 |
+
*
|
95 |
+
* @since 1.4.1
|
96 |
+
*
|
97 |
+
* @return array
|
98 |
+
*/
|
99 |
+
public function attachments(){
|
100 |
+
|
101 |
+
if( is_array( $this->mail->attachments) ? $attachments = $this->mail->attachments : $attachments = array() );
|
102 |
+
return $attachments;
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Get the email's reply to address
|
108 |
+
*
|
109 |
+
* @since 1.4.1
|
110 |
+
*
|
111 |
+
* @return string
|
112 |
+
*/
|
113 |
+
public function reply_to(){
|
114 |
+
|
115 |
+
if( is_array( $this->mail->replyto ) ? $replyto = $this->mail->replyto : $replyto = '' );
|
116 |
+
return $replyto;
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Get the email's subject
|
122 |
+
*
|
123 |
+
* @since 1.4.1
|
124 |
+
*
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public function subject(){
|
128 |
+
return $this->mail[ 'subject' ];
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Get the email's recipients
|
133 |
+
*
|
134 |
+
* @since 1.4.1
|
135 |
+
*
|
136 |
+
* @return array
|
137 |
+
*/
|
138 |
+
public function recipients(){
|
139 |
+
if ( ! empty( $this->mail[ 'recipients' ] ) ? $recipients = $this->mail[ 'recipients' ] : $recipients = array() );
|
140 |
+
return $recipients;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Get all of the email's headers
|
145 |
+
*
|
146 |
+
* @since 1.4.1
|
147 |
+
*
|
148 |
+
* @return array
|
149 |
+
*/
|
150 |
+
public function headers_all(){
|
151 |
+
if ( ! empty( $this->mail[ 'headers' ] ) ? $headers = $this->mail[ 'headers' ] : $headers = array() );
|
152 |
+
return $headers;
|
153 |
+
|
154 |
+
}
|
155 |
+
}
|
classes/email/sendgrid.php
CHANGED
@@ -36,6 +36,9 @@ class Caldera_Forms_Email_SendGrid extends Caldera_Forms_Email_Client{
|
|
36 |
* @inheritdoc
|
37 |
*/
|
38 |
public function include_sdk() {
|
|
|
|
|
|
|
39 |
include_once __DIR__ . '/sendgrid/sendgrid-php.php';
|
40 |
}
|
41 |
|
@@ -60,6 +63,7 @@ class Caldera_Forms_Email_SendGrid extends Caldera_Forms_Email_Client{
|
|
60 |
* @inheritdoc
|
61 |
*/
|
62 |
public function send(){
|
|
|
63 |
$mail = new Mail();
|
64 |
|
65 |
$email = $this->create_email( $this->message[ 'from' ], $this->message[ 'from_name' ], false );
|
@@ -132,7 +136,16 @@ class Caldera_Forms_Email_SendGrid extends Caldera_Forms_Email_Client{
|
|
132 |
$mail->setReplyTo ($reply_to );
|
133 |
}
|
134 |
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
//@TODO Caldera Exception
|
138 |
try {
|
36 |
* @inheritdoc
|
37 |
*/
|
38 |
public function include_sdk() {
|
39 |
+
if( class_exists('SendGrid') ){
|
40 |
+
return;
|
41 |
+
}
|
42 |
include_once __DIR__ . '/sendgrid/sendgrid-php.php';
|
43 |
}
|
44 |
|
63 |
* @inheritdoc
|
64 |
*/
|
65 |
public function send(){
|
66 |
+
|
67 |
$mail = new Mail();
|
68 |
|
69 |
$email = $this->create_email( $this->message[ 'from' ], $this->message[ 'from_name' ], false );
|
136 |
$mail->setReplyTo ($reply_to );
|
137 |
}
|
138 |
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Modify SendGrid mail object before sending to remote API
|
142 |
+
*
|
143 |
+
* @since 1.4.0
|
144 |
+
*
|
145 |
+
* @param \SendGrid\Mail $mail SendGrid SDK email object
|
146 |
+
* @param array $message Raw message details
|
147 |
+
*/
|
148 |
+
$mail = apply_filters( 'caldera_forms_sendgrid_before', $mail, $this->message );
|
149 |
|
150 |
//@TODO Caldera Exception
|
151 |
try {
|
classes/email/settings.php
CHANGED
@@ -31,9 +31,9 @@ class Caldera_Forms_Email_Settings {
|
|
31 |
|
32 |
/**
|
33 |
* Nonce action for settings UI
|
34 |
-
*
|
35 |
* @since 1.4.0
|
36 |
-
*
|
37 |
* @var string
|
38 |
*/
|
39 |
protected static $nonce_action = 'cf-emails';
|
@@ -50,7 +50,7 @@ class Caldera_Forms_Email_Settings {
|
|
50 |
'key' => false
|
51 |
),
|
52 |
'wp' => array(
|
53 |
-
|
54 |
),
|
55 |
'method' => 'wp'
|
56 |
);
|
@@ -114,9 +114,9 @@ class Caldera_Forms_Email_Settings {
|
|
114 |
|
115 |
/**
|
116 |
* Check if is an allowed API
|
117 |
-
*
|
118 |
* @since 1.4.0
|
119 |
-
*
|
120 |
* @param string $api Name of API
|
121 |
*
|
122 |
* @return bool
|
@@ -128,16 +128,16 @@ class Caldera_Forms_Email_Settings {
|
|
128 |
|
129 |
/**
|
130 |
* Save email settings
|
131 |
-
*
|
132 |
* @uses "wp_ajax_cf_email_save" action
|
133 |
-
*
|
134 |
* @since 1.3.5
|
135 |
*/
|
136 |
public static function save(){
|
137 |
if( ! current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
138 |
wp_die();
|
139 |
}
|
140 |
-
|
141 |
if( isset( $_POST[ 'nonce' ] ) && wp_verify_nonce( $_POST[ 'nonce' ], self::$nonce_action ) ){
|
142 |
if( isset( $_POST[ 'method' ] ) ){
|
143 |
if ( self::is_allowed_method( $_POST[ 'method' ] ) ) {
|
@@ -159,7 +159,7 @@ class Caldera_Forms_Email_Settings {
|
|
159 |
}
|
160 |
|
161 |
wp_send_json_error();
|
162 |
-
|
163 |
}
|
164 |
|
165 |
|
@@ -186,7 +186,7 @@ class Caldera_Forms_Email_Settings {
|
|
186 |
}
|
187 |
|
188 |
}
|
189 |
-
|
190 |
}
|
191 |
|
192 |
|
@@ -210,7 +210,7 @@ class Caldera_Forms_Email_Settings {
|
|
210 |
* @since 1.4.0
|
211 |
*
|
212 |
* @param string $api API name
|
213 |
-
|
214 |
* @return bool
|
215 |
*/
|
216 |
protected static function valid( $api ) {
|
@@ -261,7 +261,7 @@ class Caldera_Forms_Email_Settings {
|
|
261 |
include CFCORE_PATH . '/ui/emails/settings.php';
|
262 |
|
263 |
}
|
264 |
-
|
265 |
|
266 |
|
267 |
}
|
@@ -306,7 +306,7 @@ class Caldera_Forms_Email_Settings {
|
|
306 |
if( ! is_array( $values ) ){
|
307 |
return self::$defaults;
|
308 |
}
|
309 |
-
|
310 |
foreach ( $values as $key => $value ){
|
311 |
if( ! array_key_exists( $key, self::$defaults ) ){
|
312 |
unset( $values[ $key ] );
|
@@ -328,10 +328,10 @@ class Caldera_Forms_Email_Settings {
|
|
328 |
$values[ $api ] = self::$defaults[ $api ];
|
329 |
}
|
330 |
}
|
331 |
-
|
332 |
-
|
333 |
return $values;
|
334 |
-
|
335 |
}
|
336 |
|
337 |
}
|
31 |
|
32 |
/**
|
33 |
* Nonce action for settings UI
|
34 |
+
*
|
35 |
* @since 1.4.0
|
36 |
+
*
|
37 |
* @var string
|
38 |
*/
|
39 |
protected static $nonce_action = 'cf-emails';
|
50 |
'key' => false
|
51 |
),
|
52 |
'wp' => array(
|
53 |
+
|
54 |
),
|
55 |
'method' => 'wp'
|
56 |
);
|
114 |
|
115 |
/**
|
116 |
* Check if is an allowed API
|
117 |
+
*
|
118 |
* @since 1.4.0
|
119 |
+
*
|
120 |
* @param string $api Name of API
|
121 |
*
|
122 |
* @return bool
|
128 |
|
129 |
/**
|
130 |
* Save email settings
|
131 |
+
*
|
132 |
* @uses "wp_ajax_cf_email_save" action
|
133 |
+
*
|
134 |
* @since 1.3.5
|
135 |
*/
|
136 |
public static function save(){
|
137 |
if( ! current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
138 |
wp_die();
|
139 |
}
|
140 |
+
|
141 |
if( isset( $_POST[ 'nonce' ] ) && wp_verify_nonce( $_POST[ 'nonce' ], self::$nonce_action ) ){
|
142 |
if( isset( $_POST[ 'method' ] ) ){
|
143 |
if ( self::is_allowed_method( $_POST[ 'method' ] ) ) {
|
159 |
}
|
160 |
|
161 |
wp_send_json_error();
|
162 |
+
|
163 |
}
|
164 |
|
165 |
|
186 |
}
|
187 |
|
188 |
}
|
189 |
+
|
190 |
}
|
191 |
|
192 |
|
210 |
* @since 1.4.0
|
211 |
*
|
212 |
* @param string $api API name
|
213 |
+
|
214 |
* @return bool
|
215 |
*/
|
216 |
protected static function valid( $api ) {
|
261 |
include CFCORE_PATH . '/ui/emails/settings.php';
|
262 |
|
263 |
}
|
264 |
+
|
265 |
|
266 |
|
267 |
}
|
306 |
if( ! is_array( $values ) ){
|
307 |
return self::$defaults;
|
308 |
}
|
309 |
+
|
310 |
foreach ( $values as $key => $value ){
|
311 |
if( ! array_key_exists( $key, self::$defaults ) ){
|
312 |
unset( $values[ $key ] );
|
328 |
$values[ $api ] = self::$defaults[ $api ];
|
329 |
}
|
330 |
}
|
331 |
+
|
332 |
+
|
333 |
return $values;
|
334 |
+
|
335 |
}
|
336 |
|
337 |
}
|
classes/email/trackdata.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Get email stats
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Email_TrackData {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Is stats array ready?
|
16 |
+
*
|
17 |
+
* @since 1.4.5
|
18 |
+
*
|
19 |
+
* @var bool
|
20 |
+
*/
|
21 |
+
protected $ready = false;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Stats array
|
25 |
+
*
|
26 |
+
* @since 1.4.5
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
protected $stats = array(
|
31 |
+
'sent' => 0,
|
32 |
+
'failed' => 0,
|
33 |
+
'total' => 0,
|
34 |
+
'success_rate' => 0
|
35 |
+
);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Caldera_Forms_Email_TrackData constructor.
|
39 |
+
*
|
40 |
+
* @since 1.4.5
|
41 |
+
*/
|
42 |
+
public function __construct() {
|
43 |
+
$_stats = get_transient( __CLASS__ );
|
44 |
+
if( ! empty( $_stats ) ){
|
45 |
+
$this->prepare_stats();
|
46 |
+
set_transient( __CLASS__, $_stats, 599 );
|
47 |
+
$this->stats = $_stats;
|
48 |
+
$this->ready = true;
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Get the total sent successfully
|
55 |
+
*
|
56 |
+
* Note: Bypasses cache
|
57 |
+
*
|
58 |
+
* @since 1.4.5
|
59 |
+
*
|
60 |
+
* @return int
|
61 |
+
*/
|
62 |
+
public function success(){
|
63 |
+
$events = Caldera_Forms_DB_Track::get_instance()->by_event( 'email_sent', false );
|
64 |
+
$this->stats[ 'sent' ] = count( $events );
|
65 |
+
return $this->stats[ 'sent' ];
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Get the total fails
|
71 |
+
*
|
72 |
+
* Note: Bypasses cache
|
73 |
+
*
|
74 |
+
* @since 1.4.5
|
75 |
+
*
|
76 |
+
* @return int
|
77 |
+
*/
|
78 |
+
public function failed(){
|
79 |
+
$events = Caldera_Forms_DB_Track::get_instance()->by_event( 'email_failed', false );
|
80 |
+
$this->stats[ 'failed' ] = count( $events );
|
81 |
+
return $this->stats[ 'failed' ];
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Get all stats
|
86 |
+
*
|
87 |
+
* @since 1.4.5
|
88 |
+
*
|
89 |
+
* @param bool $bypass_cache Optional. If true, data is recalculated even if cached data is present. Default is false.
|
90 |
+
*
|
91 |
+
* @return array|mixed
|
92 |
+
*/
|
93 |
+
public function get_stats( $bypass_cache = false ){
|
94 |
+
if ( false == $this->ready || $bypass_cache ) {
|
95 |
+
$this->prepare_stats();
|
96 |
+
}
|
97 |
+
|
98 |
+
return $this->stats;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Prepare stats array with new queries
|
103 |
+
*
|
104 |
+
* @since 1.4.5
|
105 |
+
*/
|
106 |
+
protected function prepare_stats() {
|
107 |
+
if ( empty( $this->stats[ 'sent' ] ) ) {
|
108 |
+
$this->success();
|
109 |
+
}
|
110 |
+
if ( empty( $this->stats[ 'failed' ] ) ) {
|
111 |
+
$this->failed();
|
112 |
+
}
|
113 |
+
|
114 |
+
$this->stats[ 'success_rate' ] = 100;
|
115 |
+
|
116 |
+
if ( 0 != $this->stats[ 'failed' ] ) {
|
117 |
+
$total = $this->stats[ 'total' ] = $this->stats[ 'sent' ] + $this->stats[ 'failed' ];
|
118 |
+
if ( 0 != $total && 0 != $this->stats[ 'sent' ] ) {
|
119 |
+
$this->stats[ 'success_rate' ] = round( $this->stats[ 'sent' ] / $total, 2 );
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
set_transient( __CLASS__, $this->stats, 599 );
|
124 |
+
|
125 |
+
$this->ready = true;
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
classes/entry/entries.php
CHANGED
@@ -133,11 +133,14 @@ class Caldera_Forms_Entry_Entries {
|
|
133 |
foreach ( $entry->get_entry()->to_array() as $key => $value ) {
|
134 |
$_entry[ '_' . $key ] = $value;
|
135 |
}
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
return $data;
|
@@ -210,7 +213,7 @@ class Caldera_Forms_Entry_Entries {
|
|
210 |
$this->totals[ $status ] = $total;
|
211 |
$pages = ceil( $total / $this->perpage );
|
212 |
$this->entries[ $status ] = array();
|
213 |
-
if ( 1
|
214 |
$this->entries[ $status ] = array( 1 => array() );
|
215 |
} else {
|
216 |
$this->entries[ $status ] = array_fill( 1, $pages, array() );
|
133 |
foreach ( $entry->get_entry()->to_array() as $key => $value ) {
|
134 |
$_entry[ '_' . $key ] = $value;
|
135 |
}
|
136 |
+
|
137 |
+
$field_values = $entry->get_fields();
|
138 |
+
if ( ! empty( $field_values ) ) {
|
139 |
+
/** @var Caldera_Forms_Entry_Field $_field */
|
140 |
+
foreach ( $field_values as $_field ) {
|
141 |
+
$field = array_merge( $_field->to_array(), $_entry );
|
142 |
+
$data[] = (object) $field;
|
143 |
+
}
|
144 |
}
|
145 |
|
146 |
return $data;
|
213 |
$this->totals[ $status ] = $total;
|
214 |
$pages = ceil( $total / $this->perpage );
|
215 |
$this->entries[ $status ] = array();
|
216 |
+
if ( 1 >= $pages ) {
|
217 |
$this->entries[ $status ] = array( 1 => array() );
|
218 |
} else {
|
219 |
$this->entries[ $status ] = array_fill( 1, $pages, array() );
|
classes/field/util.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles file uploading from file fields
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2015 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Field_Util {
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get a field's type
|
17 |
+
*
|
18 |
+
* @since 1.4.4
|
19 |
+
*
|
20 |
+
* @param string|array $field Field ID or config array
|
21 |
+
* @param array|null $form Optional. Form config. MUST USE if $field is ID not config array
|
22 |
+
*
|
23 |
+
* @return bool
|
24 |
+
*/
|
25 |
+
public static function get_type( $field, array $form = null){
|
26 |
+
if( is_string( $field ) && is_array( $form ) ){
|
27 |
+
$field = self::get_field( $field, $form );
|
28 |
+
}elseif ( is_string( $field ) && null == $form ){
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
|
32 |
+
return $field[ 'type' ];
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get field config by ID
|
38 |
+
*
|
39 |
+
* @since 1.4.4
|
40 |
+
*
|
41 |
+
* @param string|array $field Field ID. If you pass an array, that will be returned.
|
42 |
+
* @param array|null $form
|
43 |
+
*
|
44 |
+
* @return bool|array
|
45 |
+
*/
|
46 |
+
public static function get_field( $field, array $form = null ){
|
47 |
+
if ( is_array( $field ) ) {
|
48 |
+
return $field;
|
49 |
+
}else{
|
50 |
+
if( ! is_array( $form ) ){
|
51 |
+
global $form;
|
52 |
+
}
|
53 |
+
$fields = Caldera_Forms_Forms::get_fields( $form, false );
|
54 |
+
if ( isset( $fields[ $field ] ) ) {
|
55 |
+
return $fields[ $field ];
|
56 |
+
}
|
57 |
+
}
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Check if a field is a file field of either type
|
63 |
+
*
|
64 |
+
* @since 1.4.4
|
65 |
+
*
|
66 |
+
* @param array|string $field Field ID or config array
|
67 |
+
* @param array|null $form Optional. Form config array. MUST USE if $field is ID not config array.
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public static function is_file_field( $field, array $form = null ){
|
72 |
+
$field = self::get_field( $field, $form );
|
73 |
+
return in_array( self::get_type( $field, $form ), Caldera_Forms_Files::types() );
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
classes/files.php
ADDED
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles file uploading from file fields
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2015 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Files{
|
13 |
+
|
14 |
+
const CRON_ACTION = 'caldera_forms_delete_files';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Holds upload dir path for non-media library uploads
|
18 |
+
*
|
19 |
+
* @since 1.4.4
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected static $dir;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Upload a file to WordPress
|
27 |
+
*
|
28 |
+
* @since 1.4.4
|
29 |
+
*
|
30 |
+
* @param array $file File
|
31 |
+
* @param array $args Optional. Used to place in private dir
|
32 |
+
*
|
33 |
+
* @return array
|
34 |
+
*/
|
35 |
+
public static function upload( $file, array $args = array() ){
|
36 |
+
$args = wp_parse_args($args, array(
|
37 |
+
'private' => false,
|
38 |
+
'field_id' => null,
|
39 |
+
'form_id' => null,
|
40 |
+
));
|
41 |
+
if( true == $args[ 'private' ] && ! empty( $args[ 'field_id' ] ) && ! empty( $args[ 'form_id' ] )){
|
42 |
+
$private = true;
|
43 |
+
}else{
|
44 |
+
$private = false;
|
45 |
+
}
|
46 |
+
|
47 |
+
if( $private ){
|
48 |
+
wp_schedule_single_event( time() + HOUR_IN_SECONDS, self::CRON_ACTION, array(
|
49 |
+
$args[ 'field_id' ],
|
50 |
+
$args[ 'form_id' ]
|
51 |
+
) );
|
52 |
+
}
|
53 |
+
|
54 |
+
self::add_upload_filter( $args[ 'field_id' ], $args[ 'form_id' ], $private );
|
55 |
+
|
56 |
+
$upload = wp_handle_upload($file, array( 'test_form' => false ) );
|
57 |
+
|
58 |
+
if( $private ){
|
59 |
+
self::remove_upload_filter();
|
60 |
+
}
|
61 |
+
|
62 |
+
return $upload;
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Add uploaded file to media library
|
68 |
+
*
|
69 |
+
* @since 1.4.4
|
70 |
+
*
|
71 |
+
* @param array $upload Uploaded file data
|
72 |
+
*/
|
73 |
+
public static function add_to_media_library( $upload ){
|
74 |
+
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
75 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
76 |
+
|
77 |
+
$media_item = array(
|
78 |
+
'guid' => $upload['file'],
|
79 |
+
'post_mime_type' => $upload['type'],
|
80 |
+
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $upload['file'] ) ),
|
81 |
+
'post_content' => '',
|
82 |
+
'post_status' => 'inherit'
|
83 |
+
);
|
84 |
+
|
85 |
+
$media_id = wp_insert_attachment( $media_item, $upload['file'] );
|
86 |
+
|
87 |
+
$media_data = wp_generate_attachment_metadata( $media_id, $upload['file'] );
|
88 |
+
wp_update_attachment_metadata( $media_id, $media_data );
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Setup upload directory filter
|
94 |
+
*
|
95 |
+
* @since 1.4.4
|
96 |
+
*
|
97 |
+
* @param string $field_id The field ID for file field
|
98 |
+
* @param string $form_id The form ID
|
99 |
+
*/
|
100 |
+
public static function add_upload_filter( $field_id , $form_id, $private = true ){
|
101 |
+
if ( $private ) {
|
102 |
+
self::$dir = self::secret_dir( $field_id, $form_id );
|
103 |
+
}else{
|
104 |
+
/**
|
105 |
+
* Filter directory for uploaded files
|
106 |
+
*
|
107 |
+
* If null, the file path will be WordPress' default
|
108 |
+
*
|
109 |
+
* @since 1.4.5
|
110 |
+
*
|
111 |
+
* @param string|null Directory
|
112 |
+
* @param string $field_id Field ID
|
113 |
+
* @param string $form_id Form ID
|
114 |
+
*/
|
115 |
+
$dir = apply_filters( 'caldera_forms_upload_directory', null, $field_id, $form_id );
|
116 |
+
if( null != $dir ){
|
117 |
+
self::$dir = $dir;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
add_filter( 'upload_dir', array( __CLASS__, 'uploads_filter' ) );
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Remove the filter for upload directory path
|
125 |
+
*
|
126 |
+
* @since 1.4.4
|
127 |
+
*/
|
128 |
+
public static function remove_upload_filter(){
|
129 |
+
remove_filter( 'upload_dir', array( __CLASS__, 'uploads_filter' ) );
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Filter upload directory
|
134 |
+
*
|
135 |
+
* @uses "upload_dir" filter
|
136 |
+
*
|
137 |
+
* @since 1.4.4
|
138 |
+
*
|
139 |
+
* @param array $args
|
140 |
+
* @return array
|
141 |
+
*/
|
142 |
+
public static function uploads_filter( $args ){
|
143 |
+
|
144 |
+
if ( self::$dir ) {
|
145 |
+
$newdir = '/' . self::$dir;
|
146 |
+
|
147 |
+
$args[ 'path' ] = str_replace( $args[ 'subdir' ], '', $args[ 'path' ] );
|
148 |
+
$args[ 'url' ] = str_replace( $args[ 'subdir' ], '', $args[ 'url' ] );
|
149 |
+
$args[ 'subdir' ] = $newdir;
|
150 |
+
$args[ 'path' ] .= $newdir;
|
151 |
+
$args[ 'url' ] .= $newdir;
|
152 |
+
}
|
153 |
+
|
154 |
+
return $args;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Get a secret file fir by field ID and form ID
|
159 |
+
*
|
160 |
+
* @since 1.4.4
|
161 |
+
*
|
162 |
+
* @param string $field_id The field ID for file field
|
163 |
+
* @param string $form_id The form ID
|
164 |
+
*
|
165 |
+
* @return string
|
166 |
+
*/
|
167 |
+
protected static function secret_dir( $field_id, $form_id ){
|
168 |
+
return md5( $field_id . $form_id . NONCE_SALT );
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Delete all files from the secret dir for a field
|
174 |
+
*
|
175 |
+
* @since 1.4.4
|
176 |
+
*
|
177 |
+
* @param string $field_id The field ID for file field
|
178 |
+
* @param string $form_id The form ID
|
179 |
+
*/
|
180 |
+
protected static function delete_uploaded_files( $field_id, $form_id ){
|
181 |
+
$uploads = wp_get_upload_dir();
|
182 |
+
$dir = $uploads[ 'basedir' ] . '/' . self::secret_dir($field_id, $form_id);
|
183 |
+
if (is_dir($dir)) {
|
184 |
+
array_map('unlink', glob($dir . '/*'));
|
185 |
+
rmdir($dir);
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* After form submit, clear out files from secret dirs
|
192 |
+
*
|
193 |
+
* @since 1.4.4
|
194 |
+
*
|
195 |
+
* @param array $form Form config
|
196 |
+
* @param bool $second_run Optional. If using at mail hooks, set true to prevent recurrsion
|
197 |
+
*/
|
198 |
+
public static function cleanup( $form, $second_run = false ){
|
199 |
+
if( false === $second_run && Caldera_Forms::should_send_mail( $form ) ) {
|
200 |
+
add_action( 'caldera_forms_mailer_complete', array( __CLASS__, 'delete_after_mail' ), 10, 3 );
|
201 |
+
add_action( 'caldera_forms_mailer_failed', array( __CLASS__, 'delete_after_mail' ), 10, 3 );
|
202 |
+
return;
|
203 |
+
}
|
204 |
+
|
205 |
+
$form_id = $form[ 'ID' ];
|
206 |
+
$fields = Caldera_Forms_Forms::get_fields( $form, false );
|
207 |
+
foreach( $fields as $id => $field ){
|
208 |
+
if( Caldera_Forms_Field_Util::is_file_field( $field, $form ) ){
|
209 |
+
self::delete_uploaded_files( $field[ 'ID' ], $form_id );
|
210 |
+
}
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Do cleanup after sending email
|
218 |
+
*
|
219 |
+
* We use "caldera_forms_submit_complete" to start the clean up, but that is too soon, if using mailer.
|
220 |
+
*
|
221 |
+
* @since 1.4.4
|
222 |
+
*
|
223 |
+
* @param $mail
|
224 |
+
* @param $data
|
225 |
+
* @param $form
|
226 |
+
*/
|
227 |
+
public static function delete_after_mail( $mail, $data, $form ){
|
228 |
+
self::cleanup( $form, true );
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Trigger file delete via CRON
|
233 |
+
*
|
234 |
+
* This is needed because if a form never completed submission, files are not deleted at caldera_forms_submit_complete
|
235 |
+
*
|
236 |
+
* @since 1.4.4
|
237 |
+
*
|
238 |
+
* @param array $args
|
239 |
+
*/
|
240 |
+
public static function cleanup_via_cron( $args ){
|
241 |
+
if( isset( $args[0], $args[1] ) ){
|
242 |
+
self::delete_uploaded_files( $args[0], $args[1] );
|
243 |
+
}
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Check if file field's uploads are private or not
|
249 |
+
*
|
250 |
+
* @since 1.4.4
|
251 |
+
*
|
252 |
+
* @param array $field Field config
|
253 |
+
*
|
254 |
+
* @return bool
|
255 |
+
*/
|
256 |
+
public static function is_private( array $field ){
|
257 |
+
|
258 |
+
if( Caldera_Forms_Field_Util::is_file_field( $field ) ) {
|
259 |
+
if( isset( $field[ 'config']['media_lib'] ) && true == $field['config']['media_lib'] ){
|
260 |
+
return false;
|
261 |
+
}else{
|
262 |
+
return true;
|
263 |
+
}
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
return true;
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Get the callback function for file uploads
|
272 |
+
*
|
273 |
+
* @since 1.4.4
|
274 |
+
*
|
275 |
+
* @param array $form Form config
|
276 |
+
* @param array $field Field config
|
277 |
+
*
|
278 |
+
* @return array|string|callable
|
279 |
+
*/
|
280 |
+
public static function get_upload_handler( $form, $field ){
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Filter the callback function for file uploads
|
284 |
+
*
|
285 |
+
* @since 1.4.4
|
286 |
+
*
|
287 |
+
* @param array|string|callable Callable
|
288 |
+
* @param array $form Form config
|
289 |
+
* @param array $field Field config
|
290 |
+
*/
|
291 |
+
return apply_filters( 'caldera_forms_file_upload_handler', array( 'Caldera_Forms_Files', 'upload' ), $form, $field );
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Check if field's files should be attatched
|
296 |
+
*
|
297 |
+
* @since 1.5.0
|
298 |
+
*
|
299 |
+
* @param array $field
|
300 |
+
*
|
301 |
+
* @return bool
|
302 |
+
*/
|
303 |
+
public static function should_attach( array $field ){
|
304 |
+
if( in_array( Caldera_Forms_Field_Util::get_type( $field ), self::types() ) ){
|
305 |
+
return ! empty( $field[ 'config' ][ 'attach'] );
|
306 |
+
}
|
307 |
+
|
308 |
+
return false;
|
309 |
+
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Get types of file fields
|
314 |
+
*
|
315 |
+
* @since 1.5.0
|
316 |
+
*
|
317 |
+
* @return array
|
318 |
+
*/
|
319 |
+
public static function types(){
|
320 |
+
return array( 'advanced_file', 'file' );
|
321 |
+
}
|
322 |
+
|
323 |
+
}
|
classes/forms.php
CHANGED
@@ -256,6 +256,9 @@ class Caldera_Forms_Forms {
|
|
256 |
$id = $data[ 'ID' ] = uniqid( 'CF' );
|
257 |
}
|
258 |
|
|
|
|
|
|
|
259 |
return self::save_form( $data );
|
260 |
|
261 |
}
|
@@ -450,11 +453,18 @@ class Caldera_Forms_Forms {
|
|
450 |
}
|
451 |
}
|
452 |
|
453 |
-
$
|
454 |
-
$newform
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
"ID" => $id,
|
456 |
-
"name" =>
|
457 |
-
"description" =>
|
458 |
"success" => __('Form has been successfully submitted. Thank you.', 'caldera-forms'),
|
459 |
"form_ajax" => 1,
|
460 |
"hide_form" => 1,
|
@@ -462,6 +472,9 @@ class Caldera_Forms_Forms {
|
|
462 |
"db_support" => 1,
|
463 |
'mailer' => array( 'on_insert' => 1 )
|
464 |
);
|
|
|
|
|
|
|
465 |
// is template?
|
466 |
if( !empty( $form_template ) && is_array( $form_template ) ){
|
467 |
$newform = array_merge( $form_template, $newform );
|
@@ -617,4 +630,58 @@ class Caldera_Forms_Forms {
|
|
617 |
|
618 |
}
|
619 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
620 |
}
|
256 |
$id = $data[ 'ID' ] = uniqid( 'CF' );
|
257 |
}
|
258 |
|
259 |
+
|
260 |
+
$data[ 'ID' ] = trim( $id );
|
261 |
+
|
262 |
return self::save_form( $data );
|
263 |
|
264 |
}
|
453 |
}
|
454 |
}
|
455 |
|
456 |
+
$forms = self::get_forms();
|
457 |
+
if( ! isset( $newform[ 'ID' ] ) || ( ! isset( $newform[ 'ID' ] ) && array_key_exists( $newform[ 'ID' ], $forms ) ) ) {
|
458 |
+
$id = uniqid('CF');
|
459 |
+
}else{
|
460 |
+
$id = $newform[ 'ID' ];
|
461 |
+
}
|
462 |
+
|
463 |
+
$id = trim( $id );
|
464 |
+
$defaults = array(
|
465 |
"ID" => $id,
|
466 |
+
"name" => '',
|
467 |
+
"description" => '',
|
468 |
"success" => __('Form has been successfully submitted. Thank you.', 'caldera-forms'),
|
469 |
"form_ajax" => 1,
|
470 |
"hide_form" => 1,
|
472 |
"db_support" => 1,
|
473 |
'mailer' => array( 'on_insert' => 1 )
|
474 |
);
|
475 |
+
|
476 |
+
$newform = wp_parse_args( $newform, $defaults );
|
477 |
+
|
478 |
// is template?
|
479 |
if( !empty( $form_template ) && is_array( $form_template ) ){
|
480 |
$newform = array_merge( $form_template, $newform );
|
630 |
|
631 |
}
|
632 |
|
633 |
+
/**
|
634 |
+
* Get all fields of a form
|
635 |
+
*
|
636 |
+
* @since 1.4.4
|
637 |
+
*
|
638 |
+
* @param array $form The form config
|
639 |
+
* @param bool $in_order Optional. Return in layout order, the default, or in stored order (false).
|
640 |
+
*
|
641 |
+
* @return array|mixed
|
642 |
+
*/
|
643 |
+
public static function get_fields( array $form, $in_order = true ){
|
644 |
+
if( empty( $form[ 'fields' ] ) ){
|
645 |
+
return array();
|
646 |
+
}
|
647 |
+
|
648 |
+
$fields = $form[ 'fields' ];
|
649 |
+
|
650 |
+
if ( $in_order ) {
|
651 |
+
|
652 |
+
if( isset( $form[ 'layout_grid' ][ 'fields' ] ) ){
|
653 |
+
$order = array_keys( $form[ 'layout_grid' ][ 'fields' ] );
|
654 |
+
}else{
|
655 |
+
$order = array_keys( $fields );
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Change order of fields
|
660 |
+
*
|
661 |
+
* Very useful for reordering fields outputted with {summary} magic tag
|
662 |
+
*
|
663 |
+
* @since 1.4.5
|
664 |
+
*
|
665 |
+
* @param array $order Order -- array of field IDs
|
666 |
+
* @param array $form Form config
|
667 |
+
*/
|
668 |
+
$order = apply_filters( 'caldera_forms_get_field_order', $order, $form );
|
669 |
+
|
670 |
+
$ordered = array();
|
671 |
+
foreach ( $order as $key ) {
|
672 |
+
if ( isset( $fields[ $key ] ) ) {
|
673 |
+
$ordered[ $key ] = $fields[ $key ];
|
674 |
+
}
|
675 |
+
|
676 |
+
}
|
677 |
+
|
678 |
+
return $ordered;
|
679 |
+
|
680 |
+
}else{
|
681 |
+
return $fields;
|
682 |
+
}
|
683 |
+
|
684 |
+
|
685 |
+
}
|
686 |
+
|
687 |
}
|
classes/magic/parser.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Abstract class that all magic tag parsing classes should extend
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
abstract class Caldera_Forms_Magic_Parser {
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Form config
|
17 |
+
*
|
18 |
+
* @since 1.4.6
|
19 |
+
*
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
protected $form;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The data to use for parsing
|
26 |
+
*
|
27 |
+
* @since 1.4.6
|
28 |
+
*
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
protected $data;
|
32 |
+
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Rendered magic tag
|
36 |
+
*
|
37 |
+
* @since 1.4.6
|
38 |
+
*
|
39 |
+
* @var string|null
|
40 |
+
*/
|
41 |
+
protected $tag;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Caldera_Forms_Magic_Parser constructor.
|
45 |
+
*
|
46 |
+
* @since 1.4.6
|
47 |
+
*
|
48 |
+
* @param array $form Form config
|
49 |
+
* @param array|null $data Optional (depending on parent) data to use to parse
|
50 |
+
*/
|
51 |
+
public function __construct( array $form, array $data = null ) {
|
52 |
+
$this->form = $form;
|
53 |
+
$this->data = $data;
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get rendered magic tag
|
59 |
+
*
|
60 |
+
* @since 1.4.6
|
61 |
+
*
|
62 |
+
* @return null|string
|
63 |
+
*/
|
64 |
+
public function get_tag(){
|
65 |
+
if( null == $this->tag ){
|
66 |
+
$this->parse();
|
67 |
+
}
|
68 |
+
|
69 |
+
return $this->tag;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Parse tag
|
74 |
+
*
|
75 |
+
* Set tag property
|
76 |
+
*
|
77 |
+
* @since 1.4.6
|
78 |
+
*/
|
79 |
+
protected function parse(){
|
80 |
+
//SHOULD OVVERIDE IN PARENT CLASS
|
81 |
+
//Would have declared abstract, but 5.2...
|
82 |
+
$this->tag = '';
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
classes/magic/summary.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Abstract class that all magic tag parsing classes should extend
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Magic_Summary extends Caldera_Forms_Magic_Parser {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Is email HTML?
|
16 |
+
*
|
17 |
+
* @since 1.4.6
|
18 |
+
*
|
19 |
+
* @var bool
|
20 |
+
*/
|
21 |
+
protected $html = true;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Sprintf pattern for HTML
|
25 |
+
*
|
26 |
+
* @since 1.4.6
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
protected $pattern = '';
|
31 |
+
|
32 |
+
protected $ordered_fields;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Set if we should use HTML tags or not
|
36 |
+
*
|
37 |
+
* @since 1.4.6
|
38 |
+
*
|
39 |
+
* @param bool $html Use HTML?
|
40 |
+
*/
|
41 |
+
public function set_html_mode( $html ){
|
42 |
+
$this->html = (bool) $html;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function set_fields( $fields ){
|
46 |
+
$this->ordered_fields = $fields;
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @inheritdoc
|
52 |
+
*/
|
53 |
+
protected function parse(){
|
54 |
+
if( $this->html ){
|
55 |
+
$this->set_pattern();
|
56 |
+
}
|
57 |
+
|
58 |
+
$out = array();
|
59 |
+
if( empty( $this->ordered_fields ) ){
|
60 |
+
$this->ordered_fields = $ordered_fields = Caldera_Forms_Forms::get_fields( $this->form );
|
61 |
+
}else{
|
62 |
+
$ordered_fields = $this->ordered_fields;
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
if ( ! empty( $ordered_fields ) ) {
|
67 |
+
foreach ( $ordered_fields as $field_id => $field ) {
|
68 |
+
|
69 |
+
if ( in_array( $field[ 'type' ], array(
|
70 |
+
'button',
|
71 |
+
'recaptcha',
|
72 |
+
'html'
|
73 |
+
) ) ) {
|
74 |
+
continue;
|
75 |
+
}
|
76 |
+
|
77 |
+
if( Caldera_Forms_Field_Util::is_file_field( $field_id, $this->form ) && Caldera_Forms_Files::is_private( Caldera_Forms_Field_Util::get_field( $field_id, $this->form ) ) ){
|
78 |
+
continue;
|
79 |
+
}
|
80 |
+
|
81 |
+
// filter the field to get field data
|
82 |
+
$field = apply_filters( 'caldera_forms_render_get_field', $field, $this->form );
|
83 |
+
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field[ 'type' ], $field, $this->form );
|
84 |
+
$field = apply_filters( 'caldera_forms_render_get_field_slug-' . $field[ 'slug' ], $field, $this->form );
|
85 |
+
|
86 |
+
if ( null == $this->data ) {
|
87 |
+
$field_values = (array) Caldera_Forms::get_field_data( $field_id, $this->form );
|
88 |
+
}else{
|
89 |
+
if( ! isset( $this->data[ $field_id ] ) ){
|
90 |
+
continue;
|
91 |
+
}
|
92 |
+
$field_values = (array) $this->data[ $field_id ];
|
93 |
+
}
|
94 |
+
|
95 |
+
if ( isset( $field_values[ 'label' ] ) ) {
|
96 |
+
$field_values = $field_values[ 'value' ];
|
97 |
+
} else {
|
98 |
+
foreach ( $field_values as $field_key => $field_value ) {
|
99 |
+
if ( true === is_array( $field_value ) && true === array_key_exists( 'label', $field_value ) && true === array_key_exists( 'value', $field_value ) ) {
|
100 |
+
$field_values[ $field_key ] = $field_value[ 'value' ];
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
$should_use_label = false;
|
107 |
+
if ( is_array( $field ) ) {
|
108 |
+
$should_use_label = $this->should_use_label( $field );
|
109 |
+
}
|
110 |
+
|
111 |
+
if( $should_use_label ){
|
112 |
+
foreach ( $field_values as $field_key => $field_value ) {
|
113 |
+
$field_values[ $field_key ] = $this->option_value_to_label( $field_value, $field );
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
$field_value = implode( ', ', (array) $field_values );
|
119 |
+
|
120 |
+
if ( $field_value !== null && strlen( $field_value ) > 0 ) {
|
121 |
+
if ( $this->html ) {
|
122 |
+
$out[] = sprintf( $this->pattern, $field[ 'label' ], $field_value );
|
123 |
+
} else {
|
124 |
+
$out[] = $field[ 'label' ] . ': ' . $field_value;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
// vars
|
131 |
+
if ( ! empty( $this_form[ 'variables' ] ) ) {
|
132 |
+
foreach ( $this_form[ 'variables' ][ 'keys' ] as $var_key => $var_label ) {
|
133 |
+
if ( $this_form[ 'variables' ][ 'types' ][ $var_key ] == 'entryitem' ) {
|
134 |
+
$label = ucfirst( str_replace( '_', ' ', $var_label ) );
|
135 |
+
if ( $this->html ) {
|
136 |
+
$out[] = sprintf( $this->pattern, $label, $this_form[ 'variables' ][ 'values' ][ $var_key ] );
|
137 |
+
} else {
|
138 |
+
$out[] = $label . ': ' . $this_form[ 'variables' ][ 'values' ][ $var_key ];
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
if ( ! empty( $out ) ) {
|
144 |
+
$this->tag = implode( "\r\n", $out );
|
145 |
+
} else {
|
146 |
+
$this->tag = '';
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Set sprintf pattern in pattern property
|
154 |
+
*
|
155 |
+
* @since 1.4.6
|
156 |
+
*/
|
157 |
+
protected function set_pattern(){
|
158 |
+
/**
|
159 |
+
* Change the sprintf pattern for the {summary} magic tag
|
160 |
+
*
|
161 |
+
* @since 1.4.5
|
162 |
+
*
|
163 |
+
* @param string $pattern The sprintf pattern to use
|
164 |
+
* @param array $this_form Form config
|
165 |
+
*/
|
166 |
+
$this->pattern = apply_filters( 'caldera_forms_summary_magic_pattern', '<strong>%s</strong><div style="margin-bottom:20px;">%s</div>', $this->form );
|
167 |
+
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Check if field should use label instead of value
|
172 |
+
*
|
173 |
+
* @since 1.4.6
|
174 |
+
*
|
175 |
+
* @param array $field Field config
|
176 |
+
*
|
177 |
+
* @return bool
|
178 |
+
*/
|
179 |
+
protected function should_use_label( array $field ){
|
180 |
+
if( empty( $field[ 'config' ][ 'option' ] ) ){
|
181 |
+
return false;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Set a single-select field to show label instead of value in {summary} magic tag
|
186 |
+
*
|
187 |
+
* @since 1.4.6
|
188 |
+
*
|
189 |
+
* @param bool $use Use or not?
|
190 |
+
* @param array $field Field config
|
191 |
+
* @param array $form Form config
|
192 |
+
*/
|
193 |
+
return wp_validate_boolean( apply_filters( 'caldera_forms_magic_summary_should_use_label', false, $field, $this->form ) );
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Convert option value to label
|
198 |
+
*
|
199 |
+
* @since 1.4.6
|
200 |
+
*
|
201 |
+
* @param mixed $value Value to find label for
|
202 |
+
* @param array$field
|
203 |
+
*
|
204 |
+
* @return bool|mixed False if not found, else value
|
205 |
+
*/
|
206 |
+
protected function option_value_to_label( $value, $field ){
|
207 |
+
if( empty( $field[ 'config' ][ 'option' ] ) ){
|
208 |
+
return false;
|
209 |
+
}
|
210 |
+
|
211 |
+
foreach ( $field[ 'config' ][ 'option' ] as $opt_id => $option ){
|
212 |
+
if( $value == $option[ 'value'] ){
|
213 |
+
return $option[ 'label' ];
|
214 |
+
}
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
return false;
|
219 |
+
}
|
220 |
+
|
221 |
+
}
|
classes/render/assets.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Utility functions for rendering assets
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Render_Assets {
|
13 |
+
|
14 |
+
protected static $loaded;
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Enqueue styles for field type
|
19 |
+
*
|
20 |
+
* @since 1.4.3
|
21 |
+
*
|
22 |
+
* @param array $field_types Field types in form
|
23 |
+
* @param array $field Current field
|
24 |
+
*/
|
25 |
+
public static function enqueue_field_scripts( $field_types, $field ) {
|
26 |
+
|
27 |
+
if( !empty( $field_types[$field['type']]['styles'])){
|
28 |
+
foreach($field_types[$field['type']]['styles'] as $style){
|
29 |
+
if( false !== strpos($style, '//')){
|
30 |
+
$slug = self::make_slug( $style );
|
31 |
+
if ( ! self::is_loaded( $slug, 'css' ) ) {
|
32 |
+
wp_enqueue_style( $slug, $style, array(), CFCORE_VER );
|
33 |
+
self::$loaded[ 'css' ][ $slug ] = true;
|
34 |
+
}
|
35 |
+
}else{
|
36 |
+
if ( ! wp_style_is( $style ) ) {
|
37 |
+
wp_enqueue_style( $style );
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
if ( ! empty( $field_types[ $field[ 'type' ] ][ 'scripts' ] ) ) {
|
45 |
+
$depts = array( 'jquery' );
|
46 |
+
foreach ( $field_types[ $field[ 'type' ] ][ 'scripts' ] as $script ) {
|
47 |
+
if ( false !== strpos( $script, '//' ) ) {
|
48 |
+
$slug = self::make_slug( $script );
|
49 |
+
if ( ! self::is_loaded( $slug ) ) {
|
50 |
+
wp_enqueue_script( $slug, $script, $depts, CFCORE_VER );
|
51 |
+
self::$loaded[ 'js' ][ $slug ] = true;
|
52 |
+
}
|
53 |
+
} else {
|
54 |
+
if ( ! wp_script_is( $script ) ) {
|
55 |
+
wp_enqueue_script( $script );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Load the optional styles based on settings
|
68 |
+
*
|
69 |
+
* @since 1.4.3
|
70 |
+
*/
|
71 |
+
public static function optional_style_includes() {
|
72 |
+
$style_includes = self::get_style_includes();
|
73 |
+
$all = true;
|
74 |
+
$styles = array();
|
75 |
+
if ( true == $style_includes[ 'grid' ] ) {
|
76 |
+
$styles[] = 'cf-grid-styles';
|
77 |
+
}else{
|
78 |
+
$all = false;
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( true == $style_includes[ 'form' ] ) {
|
82 |
+
$styles[] = 'cf-form-styles';
|
83 |
+
} else{
|
84 |
+
|
85 |
+
$all = false;
|
86 |
+
}
|
87 |
+
|
88 |
+
if ( true == $style_includes[ 'alert' ] ) {
|
89 |
+
$styles[] = 'cf-alert-styles';
|
90 |
+
|
91 |
+
}else{
|
92 |
+
$all = false;
|
93 |
+
}
|
94 |
+
|
95 |
+
if( $all ){
|
96 |
+
wp_enqueue_style( 'cf-front-styles' );
|
97 |
+
}else{
|
98 |
+
if ( ! empty( $styles ) ) {
|
99 |
+
foreach ( $styles as $style ) {
|
100 |
+
wp_enqueue_style( $style );
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Make slug for script or style
|
111 |
+
*
|
112 |
+
* @since 1.4.3
|
113 |
+
*
|
114 |
+
* @param string $script Base name
|
115 |
+
*
|
116 |
+
* @return string
|
117 |
+
*/
|
118 |
+
public static function make_slug( $script ) {
|
119 |
+
$slug = 'cf-' . sanitize_key( basename( $script ) );
|
120 |
+
return $slug;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Check if we've tracked loading this script/style yet
|
125 |
+
*
|
126 |
+
* @since 1.4.3
|
127 |
+
*
|
128 |
+
* @param string $slug Slug of script as formed by self::make_slug()
|
129 |
+
* @param string $type Optional. js, the default, or css.
|
130 |
+
*
|
131 |
+
* @return bool
|
132 |
+
*/
|
133 |
+
protected static function is_loaded( $slug, $type = 'js' ){
|
134 |
+
if ( empty( self::$loaded ) ){
|
135 |
+
self::$loaded = array_fill_keys( array( 'js', 'css' ), array() );
|
136 |
+
}
|
137 |
+
|
138 |
+
return isset( self::$loaded[ $type ][ $slug ] );
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get which of the optional styles are to be used
|
144 |
+
*
|
145 |
+
* @since 1.4.4.
|
146 |
+
*
|
147 |
+
* @return array
|
148 |
+
*/
|
149 |
+
protected static function get_style_includes() {
|
150 |
+
$style_includes = get_option( '_caldera_forms_styleincludes' );
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Disable/enable including of front-end styles
|
154 |
+
*
|
155 |
+
* @since unknown
|
156 |
+
*
|
157 |
+
* @param array $style_includes To include or not. Default is value of option "_caldera_forms_styleincludes"
|
158 |
+
*/
|
159 |
+
$style_includes = apply_filters( 'caldera_forms_get_style_includes', $style_includes );
|
160 |
+
$style_includes = wp_parse_args( $style_includes, array(
|
161 |
+
'grid' => true,
|
162 |
+
'alert' => true,
|
163 |
+
'form' => true
|
164 |
+
) );
|
165 |
+
|
166 |
+
return $style_includes;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Get URLs and handles for our CSS
|
171 |
+
*
|
172 |
+
* @since 1.4.4
|
173 |
+
*
|
174 |
+
* @return array
|
175 |
+
*/
|
176 |
+
public static function get_core_styles(){
|
177 |
+
$style_urls = array(
|
178 |
+
'modals' => CFCORE_URL . 'assets/css/remodal.min.css',
|
179 |
+
'modals-theme' => CFCORE_URL . 'assets/css/remodal-default-theme.min.css',
|
180 |
+
'grid' => CFCORE_URL . 'assets/css/caldera-grid.css',
|
181 |
+
'form' => CFCORE_URL . 'assets/css/caldera-form.css',
|
182 |
+
'alert' => CFCORE_URL . 'assets/css/caldera-alert.css',
|
183 |
+
'field' => CFCORE_URL . 'assets/css/fields.min.css',
|
184 |
+
);
|
185 |
+
|
186 |
+
$all = true;
|
187 |
+
foreach ( self::get_style_includes() as $script => $use ){
|
188 |
+
if( false == $use ){
|
189 |
+
$all = false;
|
190 |
+
unset($style_urls[ $script ] );
|
191 |
+
}
|
192 |
+
|
193 |
+
}
|
194 |
+
if( $all ){
|
195 |
+
foreach ( self::get_style_includes() as $script => $use ){
|
196 |
+
unset( $style_urls[ $script ] );
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
|
202 |
+
return $style_urls;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Get URLs and handles for our JavaScripts
|
207 |
+
*
|
208 |
+
* @since 1.4.4
|
209 |
+
*
|
210 |
+
* @return array
|
211 |
+
*/
|
212 |
+
public static function get_core_scripts(){
|
213 |
+
$script_urls = array(
|
214 |
+
'dynamic' => CFCORE_URL . 'assets/js/formobject.min.js',
|
215 |
+
'modals' => CFCORE_URL . 'assets/js/remodal.min.js',
|
216 |
+
'baldrick' => CFCORE_URL . 'assets/js/jquery.baldrick.min.js',
|
217 |
+
'ajax' => CFCORE_URL . 'assets/js/ajax-core.min.js',
|
218 |
+
'field' => CFCORE_URL . 'assets/js/fields.min.js',
|
219 |
+
'conditionals' => CFCORE_URL . 'assets/js/conditionals.min.js',
|
220 |
+
'validator-i18n' => null,
|
221 |
+
'validator' => CFCORE_URL . 'assets/js/parsley.min.js',
|
222 |
+
'init' => CFCORE_URL . 'assets/js/frontend-script-init.min.js',
|
223 |
+
);
|
224 |
+
|
225 |
+
return $script_urls;
|
226 |
+
}
|
227 |
+
|
228 |
+
}
|
classes/render/autopopulation.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Auto-populate fields based on Easy Pods and Easy Queries
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Render_AutoPopulation {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Add hooks for this class
|
16 |
+
*
|
17 |
+
* @since 1.4.3
|
18 |
+
*/
|
19 |
+
public function add_hooks(){
|
20 |
+
add_filter( 'caldera_forms_render_get_field', array( $this, 'easy_pods' ), 11, 2 );
|
21 |
+
add_filter( 'caldera_forms_autopopulate_post_type_args', array( $this, 'easy_queries' ), 11, 2 );
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Remove hooks for this class
|
26 |
+
*
|
27 |
+
* @since 1.4.3
|
28 |
+
*/
|
29 |
+
public function remove_hooks(){
|
30 |
+
remove_filter( 'caldera_forms_render_get_field', array( $this, 'easy_pods' ), 11 );
|
31 |
+
remove_filter( 'caldera_forms_autopopulate_post_type_args', array( $this, 'easy_queries' ), 11 );
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Auto-populate Easy Pods-based select fields
|
36 |
+
*
|
37 |
+
* @since "caldera_forms_render_get_field"
|
38 |
+
*
|
39 |
+
* @param array $field Field config
|
40 |
+
* @param array $form Form config
|
41 |
+
*
|
42 |
+
* @return array
|
43 |
+
*/
|
44 |
+
public function easy_pods( $field, $form ){
|
45 |
+
if ( ! empty( $field[ 'config' ][ 'auto' ] ) ) {
|
46 |
+
if ( 'easy-pod' == $field[ 'config' ][ 'auto_type' ] && isset( $field[ 'config' ][ 'easy-pod' ] ) && function_exists( 'cep_get_easy_pod' ) && function_exists( 'pods' ) ) {
|
47 |
+
$easy_pod = cep_get_easy_pod( $field[ 'config'][ 'easy-pod'] );
|
48 |
+
if( ! empty( $easy_pod ) ){
|
49 |
+
$pod = pods( $easy_pod['pod'] );
|
50 |
+
|
51 |
+
$pod_params = Caldera_Easy_Pods::get_instance()->apply_query( array(), $pod, array('query' => $easy_pod ) );
|
52 |
+
|
53 |
+
if( !empty( $params ) ){
|
54 |
+
$pod_params = array_merge( $pod_params, (array) $params );
|
55 |
+
}
|
56 |
+
|
57 |
+
$pod->find( $pod_params );
|
58 |
+
$fields = array_keys( $pod->fields() );
|
59 |
+
$label_field = false;
|
60 |
+
if( in_array( 'post_title', $fields ) ) {
|
61 |
+
$label_field = 'post_title';
|
62 |
+
}elseif( in_array( 'name', $fields) ){
|
63 |
+
$label_field = 'name';
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* The name of the Pods field to use for the label of the auto-populated field
|
68 |
+
*
|
69 |
+
* @since 1.4.3
|
70 |
+
*
|
71 |
+
* @param string $label_field Name of field to use for labels
|
72 |
+
* @param array $form Form config
|
73 |
+
* @param Pods $pod Pods object
|
74 |
+
* @param array $easy_pod Easy Pod config
|
75 |
+
*/
|
76 |
+
$label_field = apply_filters( 'caldera_forms_easy_pods_autopopulate_label_field', $label_field, $form, $pod, $easy_pod );
|
77 |
+
if( 0 < $pod->total() ){
|
78 |
+
while( $pod->fetch() ){
|
79 |
+
$label = $pod->display( $label_field );
|
80 |
+
if( empty( $label ) ){
|
81 |
+
$label = $pod->id();
|
82 |
+
}
|
83 |
+
$field['config']['option'][$pod->id()] = array(
|
84 |
+
'value' => $pod->id(),
|
85 |
+
'label' => $label,
|
86 |
+
);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
$field = Caldera_Forms::format_select_options( $field );
|
92 |
+
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
return $field;
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Auto-populate Easy Queries-based select fields
|
102 |
+
*
|
103 |
+
* @since "caldera_forms_autopopulate_post_type_args"
|
104 |
+
*
|
105 |
+
* @param array $args WP_Query args
|
106 |
+
* @param array $field Field config
|
107 |
+
*
|
108 |
+
* @return array
|
109 |
+
*/
|
110 |
+
public function easy_queries( $args, $field ){
|
111 |
+
if ( ! empty( $field[ 'config' ][ 'auto' ] ) ) {
|
112 |
+
if ( 'easy-query' == $field[ 'config' ][ 'auto_type' ] && isset( $field[ 'config' ][ 'easy-query' ] ) && defined( 'CAEQ_PATH' ) ) {
|
113 |
+
$easy_query = \calderawp\caeq\options::get_single( $field[ 'config' ][ 'easy-query' ] );
|
114 |
+
if ( ! empty( $easy_query ) ) {
|
115 |
+
$args = \calderawp\caeq\core::get_instance()->build_query_args( $easy_query );
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
return $args;
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
classes/save.php
CHANGED
@@ -150,6 +150,21 @@ class Caldera_Forms_Save_Final {
|
|
150 |
$data = Caldera_Forms::get_submission_data($form, $entryid );
|
151 |
}
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
// add entry ID to transient data
|
154 |
|
155 |
$transdata['entry_id'] = $entryid;
|
@@ -202,7 +217,7 @@ class Caldera_Forms_Save_Final {
|
|
202 |
|
203 |
// if added a bcc
|
204 |
$mail['bcc'] = false;
|
205 |
-
if ( isset( $form['mailer']['bcc_to'] ) ) {
|
206 |
$mail['bcc'] = $form['mailer']['bcc_to'];
|
207 |
$mail['headers'][] = Caldera_Forms::do_magic_tags( 'Bcc: ' . $form['mailer']['bcc_to'] );
|
208 |
}
|
@@ -221,12 +236,11 @@ class Caldera_Forms_Save_Final {
|
|
221 |
}
|
222 |
|
223 |
// Filter Mailer first as not to have user input be filtered
|
224 |
-
$mail['message'] = Caldera_Forms::do_magic_tags( $mail['message'] );
|
225 |
|
226 |
if ( ! isset( $form['mailer']['email_type'] ) || $form['mailer']['email_type'] == 'html' ) {
|
227 |
$mail['headers'][] = "Content-type: text/html";
|
228 |
$mail['html'] = true;
|
229 |
-
$mail['message'] = wpautop( $mail['message'] );
|
230 |
} else {
|
231 |
$mail['html'] = false;
|
232 |
}
|
@@ -294,6 +308,10 @@ class Caldera_Forms_Save_Final {
|
|
294 |
}
|
295 |
|
296 |
$key = $form['fields'][ $field_id ]['slug'];
|
|
|
|
|
|
|
|
|
297 |
if ( is_array( $row ) ) {
|
298 |
if ( ! empty( $row ) ) {
|
299 |
$keys = array_keys( $row );
|
150 |
$data = Caldera_Forms::get_submission_data($form, $entryid );
|
151 |
}
|
152 |
|
153 |
+
//fix for https://github.com/CalderaWP/Caldera-Forms/issues/888
|
154 |
+
//Josh - Please find time to redo all CSV rendering please. Your buddy, Josh
|
155 |
+
if( ! empty( $data ) ){
|
156 |
+
foreach ( $data as $id => $datum ){
|
157 |
+
|
158 |
+
if( is_string( $datum ) && '{"opt' == substr( $datum, 0, 5 ) ){
|
159 |
+
$_value = json_decode( $datum );
|
160 |
+
if( is_object( $_value ) ){
|
161 |
+
$data[ $id ] = implode( ', ', (array) $_value );
|
162 |
+
}
|
163 |
+
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
// add entry ID to transient data
|
169 |
|
170 |
$transdata['entry_id'] = $entryid;
|
217 |
|
218 |
// if added a bcc
|
219 |
$mail['bcc'] = false;
|
220 |
+
if ( isset( $form['mailer']['bcc_to'] ) && ! empty( $form['mailer']['bcc_to'] ) ) {
|
221 |
$mail['bcc'] = $form['mailer']['bcc_to'];
|
222 |
$mail['headers'][] = Caldera_Forms::do_magic_tags( 'Bcc: ' . $form['mailer']['bcc_to'] );
|
223 |
}
|
236 |
}
|
237 |
|
238 |
// Filter Mailer first as not to have user input be filtered
|
239 |
+
$mail['message'] = Caldera_Forms::do_magic_tags( $mail['message'], null, $data );
|
240 |
|
241 |
if ( ! isset( $form['mailer']['email_type'] ) || $form['mailer']['email_type'] == 'html' ) {
|
242 |
$mail['headers'][] = "Content-type: text/html";
|
243 |
$mail['html'] = true;
|
|
|
244 |
} else {
|
245 |
$mail['html'] = false;
|
246 |
}
|
308 |
}
|
309 |
|
310 |
$key = $form['fields'][ $field_id ]['slug'];
|
311 |
+
if( Caldera_Forms_Field_Util::is_file_field( $field_id, $form ) && Caldera_Forms_Files::is_private( Caldera_Forms_Field_Util::get_field( $field_id, $form ) ) ){
|
312 |
+
continue;
|
313 |
+
}
|
314 |
+
|
315 |
if ( is_array( $row ) ) {
|
316 |
if ( ! empty( $row ) ) {
|
317 |
$keys = array_keys( $row );
|
classes/tracking.php
CHANGED
@@ -17,7 +17,7 @@ class Caldera_Forms_Tracking {
|
|
17 |
*
|
18 |
* @var string
|
19 |
*/
|
20 |
-
protected static $api_url = '
|
21 |
|
22 |
/**
|
23 |
* Option key for tracking last row sent
|
@@ -99,6 +99,7 @@ class Caldera_Forms_Tracking {
|
|
99 |
$last_row = self::get_last_sent_row();
|
100 |
include_once CFCORE_PATH . 'classes/db/track.php';
|
101 |
$highest = Caldera_Forms_DB_Track::get_instance()->highest_id();
|
|
|
102 |
if( $highest <= $last_row ){
|
103 |
return;
|
104 |
}
|
@@ -112,11 +113,12 @@ class Caldera_Forms_Tracking {
|
|
112 |
|
113 |
$rows = self::prepare_rows_to_send( $last_row, $highest );
|
114 |
$body = array(
|
115 |
-
'url' => urlencode( home_url() ),
|
116 |
'rows' => $rows,
|
117 |
'plugins' => Caldera_Forms_Support::get_plugins()
|
118 |
);
|
119 |
|
|
|
|
|
120 |
$sent = self::send_to_api( self::$api_url . '/tracking', 'POST', $body );
|
121 |
if( ! is_numeric( $sent ) ){
|
122 |
end( $rows );
|
@@ -162,7 +164,7 @@ class Caldera_Forms_Tracking {
|
|
162 |
return;
|
163 |
}
|
164 |
|
165 |
-
$args[ 'body' ] = $body;
|
166 |
}
|
167 |
|
168 |
$r = wp_remote_request( $url, $args );
|
@@ -186,15 +188,31 @@ class Caldera_Forms_Tracking {
|
|
186 |
* @return string
|
187 |
*/
|
188 |
public static function api_url( $endpoint ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
global $wp_version;
|
190 |
$tracking_optin = intval( self::tracking_optin_status() );
|
191 |
-
$
|
192 |
-
$url = add_query_arg( array( 'wp' => urlencode( $wp_version ), 'php' => urlencode( PHP_VERSION ), 'db' => get_option( 'CF_DB', 0 ), 'url' => urlencode( site_url() ), 'tracking_optin' => $tracking_optin ), $url );
|
193 |
if( self::tracking_allowed() ){
|
194 |
-
$
|
|
|
|
|
195 |
}
|
196 |
|
197 |
-
return $
|
198 |
}
|
199 |
|
200 |
/**
|
@@ -237,4 +255,42 @@ class Caldera_Forms_Tracking {
|
|
237 |
|
238 |
return $rows;
|
239 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
17 |
*
|
18 |
* @var string
|
19 |
*/
|
20 |
+
protected static $api_url = 'https://asimov.caldera.space/cf-tracking/v3';
|
21 |
|
22 |
/**
|
23 |
* Option key for tracking last row sent
|
99 |
$last_row = self::get_last_sent_row();
|
100 |
include_once CFCORE_PATH . 'classes/db/track.php';
|
101 |
$highest = Caldera_Forms_DB_Track::get_instance()->highest_id();
|
102 |
+
|
103 |
if( $highest <= $last_row ){
|
104 |
return;
|
105 |
}
|
113 |
|
114 |
$rows = self::prepare_rows_to_send( $last_row, $highest );
|
115 |
$body = array(
|
|
|
116 |
'rows' => $rows,
|
117 |
'plugins' => Caldera_Forms_Support::get_plugins()
|
118 |
);
|
119 |
|
120 |
+
$body = array_merge( $body, self::site_data() );
|
121 |
+
|
122 |
$sent = self::send_to_api( self::$api_url . '/tracking', 'POST', $body );
|
123 |
if( ! is_numeric( $sent ) ){
|
124 |
end( $rows );
|
164 |
return;
|
165 |
}
|
166 |
|
167 |
+
$args[ 'body' ] = json_encode( $body );
|
168 |
}
|
169 |
|
170 |
$r = wp_remote_request( $url, $args );
|
188 |
* @return string
|
189 |
*/
|
190 |
public static function api_url( $endpoint ){
|
191 |
+
|
192 |
+
$url = trailingslashit( self::$api_url ) . $endpoint;
|
193 |
+
$url = add_query_arg( self::site_data(), $url );
|
194 |
+
|
195 |
+
return $url;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Site data for API
|
200 |
+
*
|
201 |
+
* @since 1.4.4
|
202 |
+
*
|
203 |
+
* @return array
|
204 |
+
*/
|
205 |
+
protected static function site_data(){
|
206 |
global $wp_version;
|
207 |
$tracking_optin = intval( self::tracking_optin_status() );
|
208 |
+
$data = array( 'wp' => urlencode( $wp_version ), 'php' => urlencode( PHP_VERSION ), 'db' => get_option( 'CF_DB', 0 ), 'url' => urlencode( site_url() ), 'tracking_optin' => $tracking_optin );
|
|
|
209 |
if( self::tracking_allowed() ){
|
210 |
+
$data[ 'email' ] = urlencode( get_option( 'admin_email' ) );
|
211 |
+
}else{
|
212 |
+
$data[ 'email' ] = 0;
|
213 |
}
|
214 |
|
215 |
+
return $data;
|
216 |
}
|
217 |
|
218 |
/**
|
255 |
|
256 |
return $rows;
|
257 |
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Get tracking optin url
|
261 |
+
*
|
262 |
+
* @since 1.4.5
|
263 |
+
*
|
264 |
+
* @return string
|
265 |
+
*/
|
266 |
+
protected static function optin_url(){
|
267 |
+
$url = add_query_arg( array(
|
268 |
+
'page' => 'caldera-forms',
|
269 |
+
'cal_tracking_nonce' => wp_create_nonce(),
|
270 |
+
), self_admin_url( 'admin.php' ) );
|
271 |
+
|
272 |
+
return $url;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Get the allow tracking URL
|
277 |
+
*
|
278 |
+
* @since 1.4.5
|
279 |
+
*
|
280 |
+
* @return string
|
281 |
+
*/
|
282 |
+
public static function allow_url(){
|
283 |
+
return add_query_arg( array( 'cal_tracking' => 1 ), self::optin_url() );
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Get the dismiss tracking URL
|
288 |
+
*
|
289 |
+
* @since 1.4.5
|
290 |
+
*
|
291 |
+
* @return string
|
292 |
+
*/
|
293 |
+
public static function dismiss(){
|
294 |
+
return add_query_arg( array( 'cal_tracking' =>'dismiss' ), self::optin_url() );
|
295 |
+
}
|
296 |
}
|
classes/transient.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @TODO What this does
|
4 |
+
*
|
5 |
+
* @package cf
|
6 |
+
* Copyright 2017 Josh Pollock <Josh@CalderaWP.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Caldera_Forms_Transient
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Transient {
|
13 |
+
|
14 |
+
protected static $prefix = 'cftransdata_';
|
15 |
+
|
16 |
+
public static function get_transient( $id ){
|
17 |
+
return get_transient( self::$prefix . $id );
|
18 |
+
}
|
19 |
+
|
20 |
+
public static function set_transient( $id, $data, $expires = null ){
|
21 |
+
if( ! is_numeric( $expires ) && isset( $data[ 'expires' ] ) && is_numeric( $data[ 'expires' ] ) ){
|
22 |
+
$expires = $data[ 'expires' ];
|
23 |
+
}elseif ( ! is_numeric( $expires ) ){
|
24 |
+
$expires = HOUR_IN_SECONDS;
|
25 |
+
}else{
|
26 |
+
$expires = absint( $expires );
|
27 |
+
}
|
28 |
+
|
29 |
+
return set_transient( self::$prefix . $id, $data, $expires );
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
fields/advanced_file/uploader.js
CHANGED
@@ -159,7 +159,6 @@ jQuery( function( $ ){
|
|
159 |
cf_uploader_filelist = {};
|
160 |
field.parent().find('.cf-uploader-trigger').hide();
|
161 |
}
|
162 |
-
console.log( field );
|
163 |
handleFileSelect( e, config );
|
164 |
});
|
165 |
|
159 |
cf_uploader_filelist = {};
|
160 |
field.parent().find('.cf-uploader-trigger').hide();
|
161 |
}
|
|
|
162 |
handleFileSelect( e, config );
|
163 |
});
|
164 |
|
fields/advanced_file/uploader.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function size_format(
|
1 |
+
function size_format(a){var b=!1;return quant=[{unit:"TB",mag:1099511627776},{unit:"GB",mag:1073741824},{unit:"MB",mag:1048576},{unit:"kB",mag:1024},{unit:"B ",mag:1}],quant.forEach(function(c){parseFloat(a)>=c.mag&&0==b&&(b=a/c.mag,b=a>1048576?b.toFixed(2):Math.round(b),b=b+" "+c.unit)}),b}function handleFileSelect(a,b){if(a.stopPropagation(),a.preventDefault(),a.dataTransfer)var c=a.dataTransfer.files;else var c=a.target.files;for(var d=[],e="valid",f=0;f<c.length;f++){var g="fl"+Math.round(0xaa7fca0bf1f1*Math.random()),h=1,i="";b.allowed.length&&b.allowed.indexOf(c[f].type)<0&&(h=0,i=b.notices.invalid_filetype),b.max_size&&c[f].size>b.max_size&&(h=0,i=b.notices.file_exceeds_size_limit),c[f].size||(h=0,i=b.notices.zero_byte_file),cf_uploader_filelist[a.target.id+"_file_"+g]={file:c[f],state:h,field:b.id,message:i}}for(var f in cf_uploader_filelist)if(cf_uploader_filelist[f].field===b.id){var j="";0===cf_uploader_filelist[f].state&&(j="has-error"),d.push('<li class="cf-uploader-queue-item '+f+" "+j+'">','<a href="#remove-file" data-file="'+f+'" class="cf-file-remove">×</a> <span class="file-name">',cf_uploader_filelist[f].file.name,"</span> ",'<div class="progress-bar" style="background:#ececec;"><div class="bar" id="progress-file-'+f+'" style="height:2px;width:0%;background:#a3be5f;"></div></div>','<small class="file-type">',cf_uploader_filelist[f].file.type||"n/a","</small> ",'<small class="file-size">'+size_format(cf_uploader_filelist[f].file.size)+"</small>",'<small class="file-error">'+cf_uploader_filelist[f].message+"</small>","</li>"),cf_uploader_filelist[f].message.length&&(e=cf_uploader_filelist[f].message)}a.target.value=null,document.getElementById(a.target.id+"_file_list").innerHTML='<ul class="cf-adv-preview-list">'+d.join("")+"</ul>",jQuery("#"+a.target.id+"_validator").val(e)}function handleDragOver(a){a.stopPropagation(),a.preventDefault(),a.dataTransfer.dropEffect="copy"}function handleDragOver(a){a.stopPropagation(),a.preventDefault(),a.dataTransfer.dropEffect="copy"}var cf_uploader_filelist={};jQuery(function(a){a(document).on("click",".cf-uploader-trigger",function(){var b=a(this);a("#"+b.data("parent")).trigger("click")}),a(".cf-multi-uploader").hide(),a(document).on("click",".cf-file-remove",function(b){b.preventDefault();var c=a(this),d=c.closest(".cf-adv-preview-list"),e=c.closest(".cf-multi-uploader-list").data("field"),f=c.closest(".cf-multi-uploader-list").data("id"),g=a("#"+f+"_validator");g.val(""),a('[data-parent="'+e+'"]').show(),delete cf_uploader_filelist[c.data("file")],c.closest(".cf-multi-uploader-list").parent().find(".cf-uploader-trigger").show(),c.parent().remove(),d.children().length||d.remove();for(var h in cf_uploader_filelist)cf_uploader_filelist[h].field===f&&cf_uploader_filelist[h].message.length&&g.val(cf_uploader_filelist[h].message)}),a(document).on("change",".cf-multi-uploader",function(b){var c=a(this),d=c.data("config");d.id=c.prop("id"),c.prop("multiple")||(cf_uploader_filelist={},c.parent().find(".cf-uploader-trigger").hide()),handleFileSelect(b,d)}),window.Parsley.addValidator("fileType",{requirementType:"string",validateString:function(a,b){return"valid"===a}})});
|
fields/button/field.php
CHANGED
@@ -31,10 +31,10 @@ if($field['config']['type'] == 'next' || $field['config']['type'] == 'prev'){
|
|
31 |
ob_start();
|
32 |
?>
|
33 |
<script>
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
});
|
39 |
|
40 |
});
|
31 |
ob_start();
|
32 |
?>
|
33 |
<script>
|
34 |
+
window.addEventListener("load", function(){
|
35 |
|
36 |
+
jQuery(document).on('click dblclick', '#<?php echo $field_id; ?>', function( e ){
|
37 |
+
jQuery('#<?php echo $field_id; ?>_btn').val( e.type ).trigger('change');
|
38 |
});
|
39 |
|
40 |
});
|
fields/calculation/config.php
CHANGED
@@ -29,10 +29,19 @@
|
|
29 |
</div>
|
30 |
|
31 |
<div class="caldera-config-group" id="{{_id}}_thousand_separator">
|
32 |
-
<label for="{{_id}}_sep"
|
|
|
|
|
33 |
<div class="caldera-config-field">
|
34 |
<input id="{{_id}}_sep" type="text" class="field-config" name="{{_name}}[thousand_separator]" value="{{#if thousand_separator}}{{thousand_separator}}{{else}},{{/if}}">
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
</div>
|
37 |
</div>
|
38 |
|
29 |
</div>
|
30 |
|
31 |
<div class="caldera-config-group" id="{{_id}}_thousand_separator">
|
32 |
+
<label for="{{_id}}_sep">
|
33 |
+
<?php esc_html_e('Thousands Separator', 'caldera-forms'); ?>
|
34 |
+
</label>
|
35 |
<div class="caldera-config-field">
|
36 |
<input id="{{_id}}_sep" type="text" class="field-config" name="{{_name}}[thousand_separator]" value="{{#if thousand_separator}}{{thousand_separator}}{{else}},{{/if}}">
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
<div class="caldera-config-group" id="{{_id}}_decimal_separator">
|
40 |
+
<label for="{{_id}}_sep_decimal">
|
41 |
+
<?php esc_html_e('Decimal Separator', 'caldera-forms'); ?>
|
42 |
+
</label>
|
43 |
+
<div class="caldera-config-field">
|
44 |
+
<input id="{{_id}}_sep_decimal" type="text" class="field-config" name="{{_name}}[decimal_separator]" value="{{#if decimal_separator}}{{decimal_separator}}{{else}}.{{/if}}">
|
45 |
</div>
|
46 |
</div>
|
47 |
|
fields/calculation/field.php
CHANGED
@@ -17,7 +17,12 @@ if( !isset( $field['config']['thousand_separator'] ) ){
|
|
17 |
$field['config']['thousand_separator'] = ',';
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
20 |
$thousand_separator = $field['config']['thousand_separator'];
|
|
|
21 |
|
22 |
?><?php echo $wrapper_before; ?>
|
23 |
<?php echo $field_label; ?>
|
@@ -75,7 +80,7 @@ foreach($form['fields'] as $fid=>$cfg){
|
|
75 |
if(false !== strpos($formula, $fid)){
|
76 |
//dump($cfg,0);
|
77 |
$formula = str_replace($fid, $fid, $formula);
|
78 |
-
$binds_vars[] = $fid." = parseFloat(
|
79 |
|
80 |
$binds[] = "[data-field=\"".$fid."\"]";
|
81 |
// include a conditional wrapper
|
@@ -90,13 +95,13 @@ if(!empty($binds)){
|
|
90 |
ob_start();
|
91 |
?>
|
92 |
<script type="text/javascript">
|
93 |
-
|
94 |
|
95 |
function checked_total_<?php echo $field_base_id; ?>(items){
|
96 |
var sum = 0;
|
97 |
|
98 |
items.each(function(k,v){
|
99 |
-
var val =
|
100 |
sum += parseFloat( val );
|
101 |
});
|
102 |
return sum;
|
@@ -111,27 +116,33 @@ if(!empty($binds)){
|
|
111 |
nStr += '';
|
112 |
x = nStr.split('.');
|
113 |
x1 = x[0];
|
114 |
-
x2 = x.length > 1 ? '
|
115 |
var rgx = /(\d+)(\d{3})/;
|
116 |
while (rgx.test(x1)) {
|
|
|
117 |
x1 = x1.replace(rgx, '$1' + '<?php echo $thousand_separator; ?>' + '$2');
|
118 |
}
|
119 |
return x1 + x2;
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
121 |
total = total.toFixed(2);
|
122 |
view_total = addCommas( total );
|
123 |
<?php } ?>
|
124 |
if( view_total.toString().length > 18 ){
|
125 |
view_total = Math.round( view_total );
|
126 |
}
|
127 |
-
|
128 |
-
|
129 |
|
130 |
}
|
131 |
-
|
132 |
docalc_<?php echo $field_base_id; ?>();
|
133 |
});
|
134 |
-
|
135 |
docalc_<?php echo $field_base_id; ?>();
|
136 |
})
|
137 |
docalc_<?php echo $field_base_id; ?>();
|
17 |
$field['config']['thousand_separator'] = ',';
|
18 |
}
|
19 |
|
20 |
+
if( !isset( $field['config']['decimal_separator'] ) ){
|
21 |
+
$field['config']['decimal_separator'] = '.';
|
22 |
+
}
|
23 |
+
|
24 |
$thousand_separator = $field['config']['thousand_separator'];
|
25 |
+
$decimal_separator = $field['config']['decimal_separator'];
|
26 |
|
27 |
?><?php echo $wrapper_before; ?>
|
28 |
<?php echo $field_label; ?>
|
80 |
if(false !== strpos($formula, $fid)){
|
81 |
//dump($cfg,0);
|
82 |
$formula = str_replace($fid, $fid, $formula);
|
83 |
+
$binds_vars[] = $fid." = parseFloat( jQuery('[data-field=\"".$fid."\"]').is(':checkbox') ? checked_total_" . $field_base_id. "(jQuery('[data-field=\"".$fid."\"]:checked')) : jQuery('[data-field=\"".$fid."\"]').is(':radio') ? jQuery('[data-field=\"".$fid."\"]:checked').val() : jQuery('[data-field=\"".$fid."\"]').val() ) || 0 ";
|
84 |
|
85 |
$binds[] = "[data-field=\"".$fid."\"]";
|
86 |
// include a conditional wrapper
|
95 |
ob_start();
|
96 |
?>
|
97 |
<script type="text/javascript">
|
98 |
+
window.addEventListener("load", function(){
|
99 |
|
100 |
function checked_total_<?php echo $field_base_id; ?>(items){
|
101 |
var sum = 0;
|
102 |
|
103 |
items.each(function(k,v){
|
104 |
+
var val = jQuery(v).val();
|
105 |
sum += parseFloat( val );
|
106 |
});
|
107 |
return sum;
|
116 |
nStr += '';
|
117 |
x = nStr.split('.');
|
118 |
x1 = x[0];
|
119 |
+
x2 = x.length > 1 ? '<?php echo $decimal_separator; ?>' + x[1] : '';
|
120 |
var rgx = /(\d+)(\d{3})/;
|
121 |
while (rgx.test(x1)) {
|
122 |
+
|
123 |
x1 = x1.replace(rgx, '$1' + '<?php echo $thousand_separator; ?>' + '$2');
|
124 |
}
|
125 |
return x1 + x2;
|
126 |
}
|
127 |
+
|
128 |
+
if( 'number' != typeof total ){
|
129 |
+
total = parseInt( total, 10 );
|
130 |
+
}
|
131 |
+
|
132 |
total = total.toFixed(2);
|
133 |
view_total = addCommas( total );
|
134 |
<?php } ?>
|
135 |
if( view_total.toString().length > 18 ){
|
136 |
view_total = Math.round( view_total );
|
137 |
}
|
138 |
+
jQuery('#<?php echo $field_id; ?>').html( view_total );
|
139 |
+
jQuery('[data-field="<?php echo esc_attr( $field_base_id ); ?>"]').val( total ).trigger('change');
|
140 |
|
141 |
}
|
142 |
+
jQuery('body').on('change keyup', '<?php echo implode(',', $bindtriggers); ?>', function(e){
|
143 |
docalc_<?php echo $field_base_id; ?>();
|
144 |
});
|
145 |
+
jQuery( document ).on('cf.remove cf.add', function( e ){
|
146 |
docalc_<?php echo $field_base_id; ?>();
|
147 |
})
|
148 |
docalc_<?php echo $field_base_id; ?>();
|
fields/checkbox/field.php
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<?php if(empty($field['config']['inline'])){ ?>
|
29 |
<div class="checkbox">
|
30 |
<?php } ?>
|
31 |
-
<label<?php if(!empty($field['config']['inline'])){ ?> class="checkbox-inline"<?php } ?> for="<?php echo esc_attr( $field_id . '_' . $option_key ); ?>"><input <?php echo $parsley_req; ?> type="checkbox" data-label="<?php echo esc_attr( $option['label'] );?>" data-field="<?php echo esc_attr( $field_base_id ); ?>" id="<?php echo $field_id . '_' . $option_key; ?>" class="<?php echo $field_id . $req_class; ?>" name="<?php echo esc_attr( $field_name ); ?>[<?php echo esc_attr( $option_key ); ?>]" value="<?php echo esc_attr( $option['value'] ); ?>" <?php if( in_array( $option['value'], (array) $field_value) ){ ?>checked="checked"<?php } ?>> <?php echo $option['label']; ?></label
|
32 |
<?php if(empty($field['config']['inline'])){ ?>
|
33 |
</div>
|
34 |
<?php } ?>
|
28 |
<?php if(empty($field['config']['inline'])){ ?>
|
29 |
<div class="checkbox">
|
30 |
<?php } ?>
|
31 |
+
<label<?php if(!empty($field['config']['inline'])){ ?> class="checkbox-inline"<?php } ?> for="<?php echo esc_attr( $field_id . '_' . $option_key ); ?>"><input <?php echo $parsley_req; ?> type="checkbox" data-label="<?php echo esc_attr( $option['label'] );?>" data-field="<?php echo esc_attr( $field_base_id ); ?>" id="<?php echo $field_id . '_' . $option_key; ?>" class="<?php echo $field_id . $req_class; ?>" name="<?php echo esc_attr( $field_name ); ?>[<?php echo esc_attr( $option_key ); ?>]" value="<?php echo esc_attr( $option['value'] ); ?>" <?php if( in_array( $option['value'], (array) $field_value) ){ ?>checked="checked"<?php } ?>> <?php echo $option['label']; ?></label>
|
32 |
<?php if(empty($field['config']['inline'])){ ?>
|
33 |
</div>
|
34 |
<?php } ?>
|
fields/date_picker/datepicker.php
CHANGED
@@ -30,7 +30,7 @@ if( !empty( $field['config']['autoclose'] ) ){
|
|
30 |
<?php echo $wrapper_before; ?>
|
31 |
<?php echo $field_label; ?>
|
32 |
<?php echo $field_before; ?>
|
33 |
-
<input <?php echo $field_placeholder; ?> type="text" data-provide="cfdatepicker" data-field="<?php echo esc_attr( $field_base_id ); ?>" class="<?php echo esc_attr( $field_class ); ?> is-cfdatepicker" id="<?php echo esc_attr( $field_id ); ?>" <?php echo $has_lang; ?> data-date-format="<?php echo $field['config']['format']; ?>" <?php echo $start_end_atts; ?> <?php echo $is_autoclose; ?> name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $field_value ); ?>" <?php echo $field_required; ?> <?php echo $field_structure['aria'];
|
34 |
<?php echo $field_caption; ?>
|
35 |
<?php echo $field_after; ?>
|
36 |
<?php echo $wrapper_after; ?>
|
30 |
<?php echo $wrapper_before; ?>
|
31 |
<?php echo $field_label; ?>
|
32 |
<?php echo $field_before; ?>
|
33 |
+
<input <?php echo $field_placeholder; ?> type="text" data-provide="cfdatepicker" data-field="<?php echo esc_attr( $field_base_id ); ?>" class="<?php echo esc_attr( $field_class ); ?> is-cfdatepicker" id="<?php echo esc_attr( $field_id ); ?>" <?php echo $has_lang; ?> data-date-format="<?php echo $field['config']['format']; ?>" <?php echo $start_end_atts; ?> <?php echo $is_autoclose; ?> name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $field_value ); ?>" <?php echo $field_required; ?> <?php echo $field_structure['aria']; ?> data-form-id="<?php echo esc_attr( $form[ 'ID' ] ); ?>" >
|
34 |
<?php echo $field_caption; ?>
|
35 |
<?php echo $field_after; ?>
|
36 |
<?php echo $wrapper_after; ?>
|
fields/dropdown/field.php
CHANGED
@@ -24,7 +24,9 @@
|
|
24 |
if( empty( $field_value ) ){
|
25 |
$sel = 'selected';
|
26 |
}
|
27 |
-
|
|
|
|
|
28 |
}
|
29 |
}
|
30 |
|
24 |
if( empty( $field_value ) ){
|
25 |
$sel = 'selected';
|
26 |
}
|
27 |
+
$placeholder = Caldera_Forms::do_magic_tags( $field['config']['placeholder'] );
|
28 |
+
|
29 |
+
echo '<option value="" disabled ' . $sel . '>' . $placeholder . '</option>';
|
30 |
}
|
31 |
}
|
32 |
|
fields/email/field.php
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
<?php
|
2 |
if(!empty($field['config']['placeholder'])){
|
3 |
-
$
|
|
|
4 |
}
|
|
|
5 |
?><?php echo $wrapper_before; ?>
|
6 |
<?php echo $field_label; ?>
|
7 |
<?php echo $field_before; ?>
|
1 |
<?php
|
2 |
if(!empty($field['config']['placeholder'])){
|
3 |
+
$placeholder = Caldera_Forms::do_magic_tags( $field['config']['placeholder'] );
|
4 |
+
$field_placeholder = 'placeholder="'. esc_attr( $placeholder ).'"';
|
5 |
}
|
6 |
+
|
7 |
?><?php echo $wrapper_before; ?>
|
8 |
<?php echo $field_label; ?>
|
9 |
<?php echo $field_before; ?>
|
fields/file/config_template.php
CHANGED
@@ -1,29 +1,53 @@
|
|
1 |
<div class="caldera-config-group">
|
2 |
-
<label
|
3 |
<div class="caldera-config-field">
|
4 |
-
<
|
|
|
|
|
|
|
5 |
</div>
|
6 |
</div>
|
7 |
|
8 |
<div class="caldera-config-group">
|
9 |
-
<label
|
10 |
<div class="caldera-config-field">
|
11 |
-
<
|
|
|
|
|
|
|
12 |
</div>
|
13 |
</div>
|
14 |
|
15 |
<div class="caldera-config-group" id="{{_id}}_allow_multiple_text_wrap">
|
16 |
-
<label
|
17 |
<div class="caldera-config-field">
|
18 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</div>
|
20 |
</div>
|
21 |
|
22 |
<div class="caldera-config-group">
|
23 |
-
<label for="{{_id}}_allowed"
|
|
|
|
|
24 |
<div class="caldera-config-field">
|
25 |
<input id="{{_id}}_allowed" type="text" class="field-config" name="{{_name}}[allowed]" value="{{allowed}}">
|
26 |
-
<p class="description"
|
|
|
|
|
27 |
</div>
|
28 |
</div>
|
29 |
|
1 |
<div class="caldera-config-group">
|
2 |
+
<label role="presentation"></label>
|
3 |
<div class="caldera-config-field">
|
4 |
+
<label for="{{_id}}_attach">
|
5 |
+
<input id="{{_id}}_attach" type="checkbox" class="field-config" name="{{_name}}[attach]" value="1" {{#if attach}}checked="checked"{{/if}}>
|
6 |
+
<?php esc_html_e('Attach to mailer', 'caldera-forms'); ?>
|
7 |
+
</label>
|
8 |
</div>
|
9 |
</div>
|
10 |
|
11 |
<div class="caldera-config-group">
|
12 |
+
<label role="presentation"></label>
|
13 |
<div class="caldera-config-field">
|
14 |
+
<label for="{{_id}}_allow_multiple">
|
15 |
+
<input id="{{_id}}_allow_multiple" type="checkbox" class="field-config" name="{{_name}}[multi_upload]" value="1" {{#if multi_upload}}checked="checked"{{/if}}>
|
16 |
+
<?php esc_html_e('Allow Multiple', 'caldera-forms'); ?>
|
17 |
+
</label>
|
18 |
</div>
|
19 |
</div>
|
20 |
|
21 |
<div class="caldera-config-group" id="{{_id}}_allow_multiple_text_wrap">
|
22 |
+
<label role="presentation"></label>
|
23 |
<div class="caldera-config-field">
|
24 |
+
<label for="{{_id}}_allow_multiple_text">
|
25 |
+
<input id="{{_id}}_allow_multiple_text" type="text" class="field-config" name="{{_name}}[multi_upload_text]" value="{{#if multi_upload_text}}{{multi_upload_text}}{{/if}}">
|
26 |
+
<?php esc_html_e('Button Text', 'caldera-forms'); ?>
|
27 |
+
</label>
|
28 |
+
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
|
32 |
+
<div class="caldera-config-group">
|
33 |
+
<label role="presentation"></label>
|
34 |
+
<div class="caldera-config-field">
|
35 |
+
<label for="{{_id}}_media_library">
|
36 |
+
<input id="{{_id}}_media_library" type="checkbox" class="field-config" name="{{_name}}[media_lib]" value="1" {{#if media_lib}}checked="checked"{{/if}}>
|
37 |
+
<?php echo esc_html__('Add to Media Library', 'caldera-forms'); ?>
|
38 |
+
</label>
|
39 |
</div>
|
40 |
</div>
|
41 |
|
42 |
<div class="caldera-config-group">
|
43 |
+
<label for="{{_id}}_allowed">
|
44 |
+
<?php esc_html_e('Allowed Types', 'caldera-forms'); ?>
|
45 |
+
</label>
|
46 |
<div class="caldera-config-field">
|
47 |
<input id="{{_id}}_allowed" type="text" class="field-config" name="{{_name}}[allowed]" value="{{allowed}}">
|
48 |
+
<p class="description">
|
49 |
+
<?php esc_html_e('Comma separated eg. jpg,pdf,txt', 'caldera-forms'); ?>
|
50 |
+
</p>
|
51 |
</div>
|
52 |
</div>
|
53 |
|
fields/gravatar/field.php
CHANGED
@@ -14,7 +14,7 @@ if(!empty($field['config']['email'])){
|
|
14 |
<span style="overflow: hidden;border-radius:<?php echo esc_attr( $field['config']['border_radius'] ); ?>px; border:<?php echo esc_attr( $field['config']['border_size'] ); ?>px solid <?php echo esc_attr( $field['config']['border_color'] ); ?>;display: inline-block;">
|
15 |
<span style="border-radius:<?php echo esc_attr( $field['config']['border_radius'] ); ?>px;width:<?php echo esc_attr( $field['config']['size'] ); ?>px;height:<?php echo esc_attr( $field['config']['size'] ); ?>px;display:inline-block;" id="<?php echo esc_attr( $field_id ); ?>_gravatar"><?php
|
16 |
|
17 |
-
echo get_avatar( $email, (int) $field['config']['size'], $field['config']['generator']);
|
18 |
|
19 |
?></span>
|
20 |
</span>
|
@@ -31,13 +31,13 @@ if( !empty( $form['fields'][ $field['config']['email'] ] ) ){
|
|
31 |
?>
|
32 |
<script type="text/javascript">
|
33 |
|
34 |
-
|
35 |
|
36 |
var timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>,
|
37 |
loading_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>,
|
38 |
current_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>;
|
39 |
|
40 |
-
|
41 |
|
42 |
if(timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>){
|
43 |
clearTimeout(timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>);
|
@@ -47,7 +47,7 @@ if( !empty( $form['fields'][ $field['config']['email'] ] ) ){
|
|
47 |
}
|
48 |
|
49 |
var email = this.value,
|
50 |
-
container =
|
51 |
if(email.indexOf('@') < 0 || email.length <= email.indexOf('@') + 1 || current_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> === email){
|
52 |
if(email.length > 0){
|
53 |
return;
|
@@ -55,7 +55,7 @@ if( !empty( $form['fields'][ $field['config']['email'] ] ) ){
|
|
55 |
}
|
56 |
timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> = setTimeout(function(){
|
57 |
container.find('img').animate({opacity: .5}, 200);
|
58 |
-
loading_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> =
|
59 |
action : 'cf_live_gravatar_get_gravatar',
|
60 |
email : email,
|
61 |
size : '<?php echo $field['config']['size']; ?>',
|
@@ -63,8 +63,8 @@ if( !empty( $form['fields'][ $field['config']['email'] ] ) ){
|
|
63 |
}, function(res){
|
64 |
if(res.length){
|
65 |
current_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> = email;
|
66 |
-
var image =
|
67 |
-
var img =
|
68 |
container.find('img').animate({opacity: 0}, 200, function(){
|
69 |
container.html(img).find('img').animate({opacity: 1}, 200);
|
70 |
})
|
@@ -78,8 +78,8 @@ if( !empty( $form['fields'][ $field['config']['email'] ] ) ){
|
|
78 |
|
79 |
}, 100);
|
80 |
});
|
81 |
-
|
82 |
-
|
83 |
});
|
84 |
|
85 |
})
|
14 |
<span style="overflow: hidden;border-radius:<?php echo esc_attr( $field['config']['border_radius'] ); ?>px; border:<?php echo esc_attr( $field['config']['border_size'] ); ?>px solid <?php echo esc_attr( $field['config']['border_color'] ); ?>;display: inline-block;">
|
15 |
<span style="border-radius:<?php echo esc_attr( $field['config']['border_radius'] ); ?>px;width:<?php echo esc_attr( $field['config']['size'] ); ?>px;height:<?php echo esc_attr( $field['config']['size'] ); ?>px;display:inline-block;" id="<?php echo esc_attr( $field_id ); ?>_gravatar"><?php
|
16 |
|
17 |
+
echo get_avatar( $email, (int) $field['config']['size'], $field['config']['generator'], esc_html__( 'Gravatar Image', 'caldera-forms' ) );
|
18 |
|
19 |
?></span>
|
20 |
</span>
|
31 |
?>
|
32 |
<script type="text/javascript">
|
33 |
|
34 |
+
window.addEventListener("load", function(){
|
35 |
|
36 |
var timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>,
|
37 |
loading_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>,
|
38 |
current_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>;
|
39 |
|
40 |
+
jQuery(document).on('keyup change cf.add cf.modal','#<?php echo $form['ID'].'_'.$current_form_count; ?> [data-field="<?php echo $field['config']['email']; ?>"]', function(){
|
41 |
|
42 |
if(timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>){
|
43 |
clearTimeout(timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?>);
|
47 |
}
|
48 |
|
49 |
var email = this.value,
|
50 |
+
container = jQuery('#<?php echo $field_id; ?>_gravatar');
|
51 |
if(email.indexOf('@') < 0 || email.length <= email.indexOf('@') + 1 || current_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> === email){
|
52 |
if(email.length > 0){
|
53 |
return;
|
55 |
}
|
56 |
timeout_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> = setTimeout(function(){
|
57 |
container.find('img').animate({opacity: .5}, 200);
|
58 |
+
loading_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> = jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', {
|
59 |
action : 'cf_live_gravatar_get_gravatar',
|
60 |
email : email,
|
61 |
size : '<?php echo $field['config']['size']; ?>',
|
63 |
}, function(res){
|
64 |
if(res.length){
|
65 |
current_<?php echo $field['config']['email'] .'_'.$current_form_count; ?> = email;
|
66 |
+
var image = jQuery(res).load(function(){
|
67 |
+
var img = jQuery(this).css('opacity', .5);
|
68 |
container.find('img').animate({opacity: 0}, 200, function(){
|
69 |
container.html(img).find('img').animate({opacity: 1}, 200);
|
70 |
})
|
78 |
|
79 |
}, 100);
|
80 |
});
|
81 |
+
jQuery(document).on('cf.add', '#conditional_<?php echo $field_id; ?>', function(){
|
82 |
+
jQuery('#<?php echo $form['ID'].'_'.$current_form_count; ?> [data-field="<?php echo $field['config']['email']; ?>"]').trigger('change');
|
83 |
});
|
84 |
|
85 |
})
|
fields/hidden/field.php
CHANGED
@@ -24,5 +24,5 @@ if(!empty($hastags[1])){
|
|
24 |
$sync = true;
|
25 |
}
|
26 |
?>
|
27 |
-
<input type="hidden" id="<?php echo esc_attr( $field_id ); ?>" class="<?php echo esc_attr( $field['config']['custom_class'] ); ?>" <?php if(!empty( $sync ) ){ ?>data-binds="<?php echo esc_attr(
|
28 |
|
24 |
$sync = true;
|
25 |
}
|
26 |
?>
|
27 |
+
<input type="hidden" id="<?php echo esc_attr( $field_id ); ?>" class="<?php echo esc_attr( $field['config']['custom_class'] ); ?>" <?php if(!empty( $sync ) ){ ?>data-binds="<?php echo esc_attr( wp_json_encode( $binds ) ); ?>"" data-sync="<?php echo esc_attr( $field['config']['default'] ); ?>"<?php } ?> data-field="<?php echo esc_attr( $field_base_id ); ?>" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo htmlentities( $field_value ); ?>">
|
28 |
|
fields/html/field.php
CHANGED
@@ -29,25 +29,25 @@ if(!empty($hastags[1])){
|
|
29 |
|
30 |
?>
|
31 |
<script type="text/javascript">
|
32 |
-
|
33 |
|
34 |
function htmltemplate<?php echo $field_id; ?>(){
|
35 |
|
36 |
-
var template =
|
37 |
-
target =
|
38 |
list = [<?php echo implode(',', $bindfields); ?>];
|
39 |
|
40 |
for(var i =0; i < list.length; i++){
|
41 |
|
42 |
-
var field =
|
43 |
value = [];
|
44 |
for(var f=0; f < field.length; f++){
|
45 |
-
if(
|
46 |
-
if(
|
47 |
continue;
|
48 |
}
|
49 |
}
|
50 |
-
if(
|
51 |
var file_parts = field[f].value.split('\\');
|
52 |
value.push( file_parts[file_parts.length-1] );
|
53 |
}else{
|
@@ -62,7 +62,7 @@ if(!empty($hastags[1])){
|
|
62 |
target.html(template).trigger('change');
|
63 |
|
64 |
}
|
65 |
-
|
66 |
|
67 |
htmltemplate<?php echo $field_id; ?>();
|
68 |
|
@@ -81,4 +81,4 @@ if(!empty($hastags[1])){
|
|
81 |
}
|
82 |
|
83 |
|
84 |
-
|
29 |
|
30 |
?>
|
31 |
<script type="text/javascript">
|
32 |
+
window.addEventListener("load", function(){
|
33 |
|
34 |
function htmltemplate<?php echo $field_id; ?>(){
|
35 |
|
36 |
+
var template = jQuery('#html-content-<?php echo $field_id; ?>-tmpl').html(),
|
37 |
+
target = jQuery('#html-content-<?php echo $field_id; ?>'),
|
38 |
list = [<?php echo implode(',', $bindfields); ?>];
|
39 |
|
40 |
for(var i =0; i < list.length; i++){
|
41 |
|
42 |
+
var field = jQuery('[data-field="'+list[i]+'"]'),
|
43 |
value = [];
|
44 |
for(var f=0; f < field.length; f++){
|
45 |
+
if( jQuery(field[f]).is(':radio,:checkbox') ){
|
46 |
+
if(!jQuery(field[f]).prop('checked')){
|
47 |
continue;
|
48 |
}
|
49 |
}
|
50 |
+
if( jQuery(field[f]).is('input:file') ){
|
51 |
var file_parts = field[f].value.split('\\');
|
52 |
value.push( file_parts[file_parts.length-1] );
|
53 |
}else{
|
62 |
target.html(template).trigger('change');
|
63 |
|
64 |
}
|
65 |
+
jQuery('body').on('change keyup', '<?php echo implode(',', $binds); ?>', htmltemplate<?php echo $field_id; ?>);
|
66 |
|
67 |
htmltemplate<?php echo $field_id; ?>();
|
68 |
|
81 |
}
|
82 |
|
83 |
|
84 |
+
|
fields/paragraph/field.php
CHANGED
@@ -9,7 +9,9 @@ if ( is_array( $field_value ) ) {
|
|
9 |
}
|
10 |
|
11 |
if(!empty($field['config']['placeholder'])){
|
12 |
-
$
|
|
|
|
|
13 |
}
|
14 |
preg_match_all("/%(.+?)%/", $field['config']['default'], $hastags);
|
15 |
if(!empty($hastags[1])){
|
@@ -30,7 +32,7 @@ if(!empty($hastags[1])){
|
|
30 |
?><?php echo $wrapper_before; ?>
|
31 |
<?php echo $field_label; ?>
|
32 |
<?php echo $field_before; ?>
|
33 |
-
<textarea <?php echo $field_placeholder; ?> data-field="<?php echo esc_attr( $field_base_id ); ?>" <?php if(!empty( $sync ) ){ ?>data-binds="<?php echo esc_attr(
|
34 |
<?php echo $field_caption; ?>
|
35 |
<?php echo $field_after; ?>
|
36 |
<?php echo $wrapper_after; ?>
|
9 |
}
|
10 |
|
11 |
if(!empty($field['config']['placeholder'])){
|
12 |
+
$placeholder = Caldera_Forms::do_magic_tags( $field['config']['placeholder'] );
|
13 |
+
|
14 |
+
$field_placeholder = 'placeholder="'. esc_attr( $placeholder ) .'"';
|
15 |
}
|
16 |
preg_match_all("/%(.+?)%/", $field['config']['default'], $hastags);
|
17 |
if(!empty($hastags[1])){
|
32 |
?><?php echo $wrapper_before; ?>
|
33 |
<?php echo $field_label; ?>
|
34 |
<?php echo $field_before; ?>
|
35 |
+
<textarea <?php echo $field_placeholder; ?> data-field="<?php echo esc_attr( $field_base_id ); ?>" <?php if(!empty( $sync ) ){ ?>data-binds="<?php echo esc_attr(wp_json_encode($binds)); ?>" data-sync="<?php echo esc_attr( $field['config']['default'] ); ?>"<?php } ?> class="<?php echo esc_attr( $field_class ); ?>" rows="<?php echo $field['config']['rows']; ?>" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_name ); ?>" <?php echo $field_required; ?> <?php echo $field_structure['aria']; ?>><?php echo esc_html( $field_value ); ?></textarea>
|
36 |
<?php echo $field_caption; ?>
|
37 |
<?php echo $field_after; ?>
|
38 |
<?php echo $wrapper_after; ?>
|
fields/phone/config.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
</div>
|
7 |
<div class="caldera-config-group">
|
8 |
<label><?php _e('Default'); ?></label>
|
9 |
-
<div class="caldera-config-field">
|
10 |
<input type="text" id="{{_id}}_default" class="block-input field-config" name="{{_name}}[default]" value="{{default}}">
|
11 |
</div>
|
12 |
</div>
|
@@ -17,7 +17,7 @@
|
|
17 |
<p class="description">(999) 999 9999</p>
|
18 |
<label><input type="radio" class="field-config {{_id}}_type international" name="{{_name}}[type]" value="international" {{#is type value="international"}}checked="checked"{{/is}}> <?php _e('International', 'caldera-forms'); ?></label>
|
19 |
<p class="description">+99 99 999 9999</p>
|
20 |
-
<label><input type="radio" class="field-config {{_id}}_type custom" name="{{_name}}[type]" value="custom" {{#is type value="custom"}}checked="checked"{{/is}}> <?php _e('Custom'); ?></label>
|
21 |
<p class="description"><input type="text" id="{{_id}}_custom" class="field-config" name="{{_name}}[custom]" value="{{custom}}"></p>
|
22 |
<p class="description"><?php echo __('Use the digit 9 to indicate a number', 'caldera-forms'); ?></p>
|
23 |
</div>
|
@@ -35,7 +35,7 @@
|
|
35 |
}else if(this.value === 'custom'){
|
36 |
$('#{{_id}}_default').inputmask( $('#{{_id}}_custom').val() );
|
37 |
}
|
38 |
-
});
|
39 |
$('#{{_id}}_custom').change(function(){
|
40 |
$('.{{_id}}_type.{{type}}').trigger('change');
|
41 |
});
|
6 |
</div>
|
7 |
<div class="caldera-config-group">
|
8 |
<label><?php _e('Default'); ?></label>
|
9 |
+
<div class="caldera-config-field">
|
10 |
<input type="text" id="{{_id}}_default" class="block-input field-config" name="{{_name}}[default]" value="{{default}}">
|
11 |
</div>
|
12 |
</div>
|
17 |
<p class="description">(999) 999 9999</p>
|
18 |
<label><input type="radio" class="field-config {{_id}}_type international" name="{{_name}}[type]" value="international" {{#is type value="international"}}checked="checked"{{/is}}> <?php _e('International', 'caldera-forms'); ?></label>
|
19 |
<p class="description">+99 99 999 9999</p>
|
20 |
+
<label><input type="radio" class="field-config {{_id}}_type custom" name="{{_name}}[type]" value="custom" {{#is type value="custom"}}checked="checked"{{/is}}> <?php _e('Custom', 'caldera-forms'); ?></label>
|
21 |
<p class="description"><input type="text" id="{{_id}}_custom" class="field-config" name="{{_name}}[custom]" value="{{custom}}"></p>
|
22 |
<p class="description"><?php echo __('Use the digit 9 to indicate a number', 'caldera-forms'); ?></p>
|
23 |
</div>
|
35 |
}else if(this.value === 'custom'){
|
36 |
$('#{{_id}}_default').inputmask( $('#{{_id}}_custom').val() );
|
37 |
}
|
38 |
+
});
|
39 |
$('#{{_id}}_custom').change(function(){
|
40 |
$('.{{_id}}_type.{{type}}').trigger('change');
|
41 |
});
|
fields/phone/field.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
if(!empty($field['config']['placeholder'])){
|
3 |
-
$field_placeholder = 'placeholder="'
|
4 |
}
|
5 |
|
6 |
$mask = '(999)999-9999';
|
@@ -13,7 +13,7 @@ if( $field['config']['type'] == 'international' ){
|
|
13 |
?><?php echo $wrapper_before; ?>
|
14 |
<?php echo $field_label; ?>
|
15 |
<?php echo $field_before; ?>
|
16 |
-
<input <?php echo $field_placeholder; ?> type="
|
17 |
<?php echo $field_caption; ?>
|
18 |
<?php echo $field_after; ?>
|
19 |
<?php echo $wrapper_after; ?>
|
1 |
<?php
|
2 |
if(!empty($field['config']['placeholder'])){
|
3 |
+
$field_placeholder = 'placeholder="'. esc_attr(Caldera_Forms::do_magic_tags($field['config']['placeholder'])) .'"';
|
4 |
}
|
5 |
|
6 |
$mask = '(999)999-9999';
|
13 |
?><?php echo $wrapper_before; ?>
|
14 |
<?php echo $field_label; ?>
|
15 |
<?php echo $field_before; ?>
|
16 |
+
<input <?php echo $field_placeholder; ?> type="tel" data-inputmask="'mask': '<?php echo esc_attr( $mask ); ?>'" data-field="<?php echo esc_attr( $field_base_id ); ?>" class="<?php echo esc_attr( $field_class ); ?>" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $field_value ); ?>" <?php echo $field_required; ?> <?php echo $field_structure['aria']; ?>>
|
17 |
<?php echo $field_caption; ?>
|
18 |
<?php echo $field_after; ?>
|
19 |
<?php echo $wrapper_after; ?>
|
fields/radio/field.php
CHANGED
@@ -34,7 +34,7 @@
|
|
34 |
<?php if(empty($field['config']['inline'])){ ?>
|
35 |
<div class="radio">
|
36 |
<?php } ?>
|
37 |
-
<label<?php if(!empty($field['config']['inline'])){ ?> class="radio-inline"<?php } ?> data-label="<?php echo esc_attr( $option['label'] ); ?>" for="<?php echo esc_attr( $field_id . '_' . $option_key ); ?>"><input type="radio" id="<?php echo esc_attr( $field_id . '_' . $option_key ); ?>" data-field="<?php echo esc_attr( $field_base_id ); ?>" class="<?php echo esc_attr( $field_id . $req_class ); ?>" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $option['value'] ); ?>" <?php if( $field_value == $option['value'] || $field_value == $option_key ){ ?>checked="checked"<?php } ?> <?php echo $field_required; ?>> <?php echo $option['label']; ?></label
|
38 |
<?php if(empty($field['config']['inline'])){ ?>
|
39 |
</div>
|
40 |
<?php } ?>
|
34 |
<?php if(empty($field['config']['inline'])){ ?>
|
35 |
<div class="radio">
|
36 |
<?php } ?>
|
37 |
+
<label<?php if(!empty($field['config']['inline'])){ ?> class="radio-inline"<?php } ?> data-label="<?php echo esc_attr( $option['label'] ); ?>" for="<?php echo esc_attr( $field_id . '_' . $option_key ); ?>"><input type="radio" id="<?php echo esc_attr( $field_id . '_' . $option_key ); ?>" data-field="<?php echo esc_attr( $field_base_id ); ?>" class="<?php echo esc_attr( $field_id . $req_class ); ?>" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $option['value'] ); ?>" <?php if( $field_value == $option['value'] || $field_value == $option_key ){ ?>checked="checked"<?php } ?> <?php echo $field_required; ?>> <?php echo $option['label']; ?></label>
|
38 |
<?php if(empty($field['config']['inline'])){ ?>
|
39 |
</div>
|
40 |
<?php } ?>
|
fields/range_slider/field.php
CHANGED
@@ -32,10 +32,10 @@ if ( is_array( $field_value ) ) {
|
|
32 |
<?php echo $wrapper_after; ?>
|
33 |
<?php ob_start(); ?>
|
34 |
<script type="text/javascript">
|
35 |
-
|
36 |
|
37 |
function init_rangeslider_<?php echo $field_id; ?>(){
|
38 |
-
var el =
|
39 |
rangeslider;
|
40 |
<?php if(empty($field['config']['pollyfill'])){ ?>
|
41 |
if (el.is(':visible')) {
|
@@ -48,7 +48,7 @@ if ( is_array( $field_value ) ) {
|
|
48 |
?>
|
49 |
value = value.toFixed( <?php echo strlen( $part[1] ); ?> );
|
50 |
<?php } ?>
|
51 |
-
|
52 |
},
|
53 |
polyfill: <?php echo $polyfill; ?>
|
54 |
});
|
@@ -62,13 +62,13 @@ if ( is_array( $field_value ) ) {
|
|
62 |
<?php }else{ ?>
|
63 |
// pollyfill support
|
64 |
el.on('change', function(){
|
65 |
-
|
66 |
}).css("width", "100%");
|
67 |
<?php } ?>
|
68 |
}
|
69 |
<?php if(empty($field['config']['pollyfill'])){ ?>
|
70 |
// setup tabs
|
71 |
-
|
72 |
init_rangeslider_<?php echo $field_id; ?>();
|
73 |
});
|
74 |
<?php } ?>
|
32 |
<?php echo $wrapper_after; ?>
|
33 |
<?php ob_start(); ?>
|
34 |
<script type="text/javascript">
|
35 |
+
window.addEventListener("load", function(){
|
36 |
|
37 |
function init_rangeslider_<?php echo $field_id; ?>(){
|
38 |
+
var el = jQuery('#<?php echo $field_id; ?>'),
|
39 |
rangeslider;
|
40 |
<?php if(empty($field['config']['pollyfill'])){ ?>
|
41 |
if (el.is(':visible')) {
|
48 |
?>
|
49 |
value = value.toFixed( <?php echo strlen( $part[1] ); ?> );
|
50 |
<?php } ?>
|
51 |
+
jQuery('#<?php echo $field_id; ?>_value').html(value);
|
52 |
},
|
53 |
polyfill: <?php echo $polyfill; ?>
|
54 |
});
|
62 |
<?php }else{ ?>
|
63 |
// pollyfill support
|
64 |
el.on('change', function(){
|
65 |
+
jQuery('#<?php echo $field_id; ?>_value').html(this.value);
|
66 |
}).css("width", "100%");
|
67 |
<?php } ?>
|
68 |
}
|
69 |
<?php if(empty($field['config']['pollyfill'])){ ?>
|
70 |
// setup tabs
|
71 |
+
jQuery(document).on('cf.pagenav cf.add cf.disable cf.modal', function(){
|
72 |
init_rangeslider_<?php echo $field_id; ?>();
|
73 |
});
|
74 |
<?php } ?>
|
fields/recaptcha/preview.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div class="notice notice-error"><?php
|
2 |
-
printf( '<p>%s <a href="https://
|
3 |
esc_html__( 'This field type is discontinued.', 'caldera-forms' ),
|
4 |
esc_attr__( 'Documenation for this field type', 'caldera-forms' ),
|
5 |
esc_html__( 'Click here for more information.', 'caldera-forms' )
|
1 |
<div class="notice notice-error"><?php
|
2 |
+
printf( '<p>%s <a href="https://calderaforms.com/doc/recaptcha-field/" title="%s" target="_blank">%s</a></p>',
|
3 |
esc_html__( 'This field type is discontinued.', 'caldera-forms' ),
|
4 |
esc_attr__( 'Documenation for this field type', 'caldera-forms' ),
|
5 |
esc_html__( 'Click here for more information.', 'caldera-forms' )
|
fields/select2/css/select2.css
CHANGED
@@ -609,7 +609,7 @@ html[dir="rtl"] .ccselect2-search-choice-close {
|
|
609 |
|
610 |
.ccselect2-container-multi .ccselect2-search-choice-close {
|
611 |
left: 3px;
|
612 |
-
font-size:
|
613 |
color: #333;
|
614 |
}
|
615 |
|
609 |
|
610 |
.ccselect2-container-multi .ccselect2-search-choice-close {
|
611 |
left: 3px;
|
612 |
+
font-size: 6px;
|
613 |
color: #333;
|
614 |
}
|
615 |
|
fields/select2/field/field.php
CHANGED
@@ -38,7 +38,7 @@ if( empty( $field['config']['color'] ) ){
|
|
38 |
|
39 |
$placeholder = '';
|
40 |
if( !empty( $field['config']['placeholder'] ) ){
|
41 |
-
$placeholder = 'data-placeholder="' . esc_attr( $field['config']['placeholder'] ) . '"';
|
42 |
}
|
43 |
|
44 |
?>
|
38 |
|
39 |
$placeholder = '';
|
40 |
if( !empty( $field['config']['placeholder'] ) ){
|
41 |
+
$placeholder = 'data-placeholder="' . esc_attr( Caldera_Forms::do_magic_tags( $field['config']['placeholder'] ) ). '"';
|
42 |
}
|
43 |
|
44 |
?>
|
fields/select2/js/select2.js
CHANGED
@@ -3051,7 +3051,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
3051 |
enabledItem = $(
|
3052 |
"<li class='ccselect2-search-choice'>" +
|
3053 |
" <div></div>" +
|
3054 |
-
" <a href='#' class='ccselect2-search-choice-close' tabindex='-1'></a>" +
|
3055 |
"</li>"),
|
3056 |
disabledItem = $(
|
3057 |
"<li class='ccselect2-search-choice ccselect2-locked'>" +
|
3051 |
enabledItem = $(
|
3052 |
"<li class='ccselect2-search-choice'>" +
|
3053 |
" <div></div>" +
|
3054 |
+
" <a href='#' class='ccselect2-search-choice-close' tabindex='-1'><i class='raty-cancel-on'></i></a>" +
|
3055 |
"</li>"),
|
3056 |
disabledItem = $(
|
3057 |
"<li class='ccselect2-search-choice ccselect2-locked'>" +
|
fields/select2/js/select2.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
!function(e){"undefined"==typeof e.fn.each2&&e.extend(e.fn,{each2:function(t){for(var s=e([0]),i=-1,c=this.length;++i<c&&(s.context=s[0]=this[i])&&t.call(s[0],i,s)!==!1;);return this}})}(jQuery),function(e,t){"use strict";function s(t){var s=e(document.createTextNode(""));t.before(s),s.before(t),s.remove()}function i(e){function t(e){return j[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function c(e,t){for(var s=0,i=t.length;i>s;s+=1)if(o(e,t[s]))return s;return-1}function n(){var t=e(z);t.appendTo(document.body);var s={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),s}function o(e,s){return e===s?!0:e===t||s===t?!1:null===e||null===s?!1:e.constructor===String?e+""==s+"":s.constructor===String?s+""==e+"":!1}function a(e,t,s){var i,c,n;if(null===e||e.length<1)return[];for(i=e.split(t),c=0,n=i.length;n>c;c+=1)i[c]=s(i[c]);return i}function r(e){return e.outerWidth(!1)-e.width()}function l(s){var i="keyup-change-value";s.on("keydown",function(){e.data(s,i)===t&&e.data(s,i,s.val())}),s.on("keyup",function(){var c=e.data(s,i);c!==t&&s.val()!==c&&(e.removeData(s,i),s.trigger("keyup-change"))})}function h(s){s.on("mousemove",function(s){var i=F;i!==t&&i.x===s.pageX&&i.y===s.pageY||e(s.target).trigger("mousemove-filtered",s)})}function u(e,s,i){i=i||t;var c;return function(){var t=arguments;window.clearTimeout(c),c=window.setTimeout(function(){s.apply(i,t)},e)}}function d(e,t){var s=u(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){c(e.target,t.get())>=0&&s(e)})}function p(e){e[0]!==document.activeElement&&window.setTimeout(function(){var t,s=e[0],i=e.val().length;e.focus();var c=s.offsetWidth>0||s.offsetHeight>0;c&&s===document.activeElement&&(s.setSelectionRange?s.setSelectionRange(i,i):s.createTextRange&&(t=s.createTextRange(),t.collapse(!1),t.select()))},0)}function f(t){t=e(t)[0];var s=0,i=0;if("selectionStart"in t)s=t.selectionStart,i=t.selectionEnd-s;else if("selection"in document){t.focus();var c=document.selection.createRange();i=document.selection.createRange().text.length,c.moveStart("character",-t.value.length),s=c.text.length-i}return{offset:s,length:i}}function g(e){e.preventDefault(),e.stopPropagation()}function m(e){e.preventDefault(),e.stopImmediatePropagation()}function v(t){if(!M){var s=t[0].currentStyle||window.getComputedStyle(t[0],null);M=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:s.fontSize,fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight,letterSpacing:s.letterSpacing,textTransform:s.textTransform,whiteSpace:"nowrap"}),M.attr("class","ccselect2-sizer"),e(document.body).append(M)}return M.text(t.val()),M.width()}function w(t,s,i){var c,n,o=[];c=e.trim(t.attr("class")),c&&(c=""+c,e(c.split(/\s+/)).each2(function(){0===this.indexOf("ccselect2-")&&o.push(this)})),c=e.trim(s.attr("class")),c&&(c=""+c,e(c.split(/\s+/)).each2(function(){0!==this.indexOf("ccselect2-")&&(n=i(this),n&&o.push(n))})),t.attr("class",o.join(" "))}function b(e,t,s,c){var n=i(e.toUpperCase()).indexOf(i(t.toUpperCase())),o=t.length;return 0>n?void s.push(c(e)):(s.push(c(e.substring(0,n))),s.push("<span class='ccselect2-match'>"),s.push(c(e.substring(n,n+o))),s.push("</span>"),void s.push(c(e.substring(n+o,e.length))))}function C(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function S(s){var i,c=null,n=s.quietMillis||100,o=s.url,a=this;return function(r){window.clearTimeout(i),i=window.setTimeout(function(){var i=s.data,n=o,l=s.transport||e.fn.select2.ajaxDefaults.transport,h={type:s.type||"GET",cache:s.cache||!1,jsonpCallback:s.jsonpCallback||t,dataType:s.dataType||"json"},u=e.extend({},e.fn.select2.ajaxDefaults.params,h);i=i?i.call(a,r.term,r.page,r.context):null,n="function"==typeof n?n.call(a,r.term,r.page,r.context):n,c&&"function"==typeof c.abort&&c.abort(),s.params&&(e.isFunction(s.params)?e.extend(u,s.params.call(a)):e.extend(u,s.params)),e.extend(u,{url:n,dataType:s.dataType,data:i,success:function(e){var t=s.results(e,r.page,r);r.callback(t)},error:function(e,t,s){var i={hasError:!0,jqXHR:e,textStatus:t,errorThrown:s};r.callback(i)}}),c=l.call(a,u)},n)}}function y(t){var s,i,c=t,n=function(e){return""+e.text};e.isArray(c)&&(i=c,c={results:i}),e.isFunction(c)===!1&&(i=c,c=function(){return i});var o=c();return o.text&&(n=o.text,e.isFunction(n)||(s=o.text,n=function(e){return e[s]})),function(t){var s,i=t.term,o={results:[]};return""===i?void t.callback(c()):(s=function(c,o){var a,r;if(c=c[0],c.children){a={};for(r in c)c.hasOwnProperty(r)&&(a[r]=c[r]);a.children=[],e(c.children).each2(function(e,t){s(t,a.children)}),(a.children.length||t.matcher(i,n(a),c))&&o.push(a)}else t.matcher(i,n(c),c)&&o.push(c)},e(c().results).each2(function(e,t){s(t,o.results)}),void t.callback(o))}}function x(s){var i=e.isFunction(s);return function(c){var n=c.term,o={results:[]},a=i?s(c):s;e.isArray(a)&&(e(a).each(function(){var e=this.text!==t,s=e?this.text:this;(""===n||c.matcher(n,s))&&o.results.push(e?this:{id:this,text:this})}),c.callback(o))}}function E(t,s){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw new Error(s+" must be a string, function, or falsy value")}function T(t,s){if(e.isFunction(t)){var i=Array.prototype.slice.call(arguments,2);return t.apply(s,i)}return t}function O(t){var s=0;return e.each(t,function(e,t){t.children?s+=O(t.children):s++}),s}function P(e,s,i,c){var n,a,r,l,h,u=e,d=!1;if(!c.createSearchChoice||!c.tokenSeparators||c.tokenSeparators.length<1)return t;for(;;){for(a=-1,r=0,l=c.tokenSeparators.length;l>r&&(h=c.tokenSeparators[r],a=e.indexOf(h),!(a>=0));r++);if(0>a)break;if(n=e.substring(0,a),e=e.substring(a+h.length),n.length>0&&(n=c.createSearchChoice.call(this,n,s),n!==t&&null!==n&&c.id(n)!==t&&null!==c.id(n))){for(d=!1,r=0,l=s.length;l>r;r++)if(o(c.id(n),c.id(s[r]))){d=!0;break}d||i(n)}}return u!==e?e:void 0}function I(){var t=this;e.each(arguments,function(e,s){t[s].remove(),t[s]=null})}function k(t,s){var i=function(){};return i.prototype=new t,i.prototype.constructor=i,i.prototype.parent=t.prototype,i.prototype=e.extend(i.prototype,s),i}if(window.Select2===t){var A,R,D,H,M,L,N,F={x:0,y:0},U={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case U.LEFT:case U.RIGHT:case U.UP:case U.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case U.SHIFT:case U.CTRL:case U.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&123>=e}},z="<div class='ccselect2-measure-scrollbar'></div>",j={"Ⓐ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};L=e(document),H=function(){var e=1;return function(){return e++}}(),A=k(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(s){var i,c,o=".ccselect2-results";this.opts=s=this.prepareOpts(s),this.id=s.id,s.element.data("ccselect2")!==t&&null!==s.element.data("ccselect2")&&s.element.data("ccselect2").destroy(),this.container=this.createContainer(),this.liveRegion=e(".ccselect2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ccselect2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(s.element.attr("id")||"autogen"+H()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",s.element.attr("title")),this.body=e(document.body),w(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",s.element.attr("style")),this.container.css(T(s.containerCss,this.opts.element)),this.container.addClass(T(s.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("ccselect2",this).attr("tabindex","-1").before(this.container).on("click.ccselect2",g),this.container.data("ccselect2",this),this.dropdown=this.container.find(".ccselect2-drop"),w(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(s.dropdownCssClass,this.opts.element)),this.dropdown.addClass(this.containerId),this.dropdown.data("ccselect2",this),this.dropdown.on("click",g),this.results=i=this.container.find(o),this.search=c=this.container.find("input.ccselect2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",g),h(this.results),this.dropdown.on("mousemove-filtered",o,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",o,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",o,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",o,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(e){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),d(80,this.results),this.dropdown.on("scroll-debounced",o,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".ccselect2-input",function(e){e.stopPropagation()}),e(this.dropdown).on("change",".ccselect2-input",function(e){e.stopPropagation()}),e.fn.mousewheel&&i.mousewheel(function(e,t,s,c){var n=i.scrollTop();c>0&&0>=n-c?(i.scrollTop(0),g(e)):0>c&&i.get(0).scrollHeight-i.scrollTop()+c<=i.height()&&(i.scrollTop(i.get(0).scrollHeight-i.height()),g(e))}),l(c),c.on("keyup-change input paste",this.bind(this.updateResults)),c.on("focus",function(){c.addClass("ccselect2-focused")}),c.on("blur",function(){c.removeClass("ccselect2-focused")}),this.dropdown.on("mouseup",o,this.bind(function(t){e(t.target).closest(".ccselect2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==s.maximumInputLength&&this.search.attr("maxlength",s.maximumInputLength);var a=s.element.prop("disabled");a===t&&(a=!1),this.enable(!a);var r=s.element.prop("readonly");r===t&&(r=!1),this.readonly(r),N=N||n(),this.autofocus=s.element.prop("autofocus"),s.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",s.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,s=e.data("ccselect2"),i=this;this.close(),e.length&&e[0].detachEvent&&i._sync&&e.each(function(){i._sync&&this.detachEvent("onpropertychange",i._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,s!==t&&(s.container.remove(),s.liveRegion.remove(),s.dropdown.remove(),e.show().removeData("ccselect2").off(".ccselect2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),I.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:o(e.attr("locked"),"locked")||o(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(s){var i,c,n,r,l=this;if(i=s.element,"select"===i.get(0).tagName.toLowerCase()&&(this.select=c=s.element),c&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in s)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),s=e.extend({},{populateResults:function(i,c,n){var o,a=this.opts.id,r=this.liveRegion;(o=function(i,c,h){var u,d,p,f,g,m,v,w,b,C;i=s.sortResults(i,c,n);var S=[];for(u=0,d=i.length;d>u;u+=1)p=i[u],g=p.disabled===!0,f=!g&&a(p)!==t,m=p.children&&p.children.length>0,v=e("<li></li>"),v.addClass("ccselect2-results-dept-"+h),v.addClass("ccselect2-result"),v.addClass(f?"ccselect2-result-selectable":"ccselect2-result-unselectable"),g&&v.addClass("ccselect2-disabled"),m&&v.addClass("ccselect2-result-with-children"),v.addClass(l.opts.formatResultCssClass(p)),v.attr("role","presentation"),w=e(document.createElement("div")),w.addClass("ccselect2-result-label"),w.attr("id","ccselect2-result-label-"+H()),w.attr("role","option"),C=s.formatResult(p,w,n,l.opts.escapeMarkup),C!==t&&(w.html(C),v.append(w)),m&&(b=e("<ul></ul>"),b.addClass("ccselect2-result-sub"),o(p.children,b,h+1),v.append(b)),v.data("ccselect2-data",p),S.push(v[0]);c.append(S),r.text(s.formatMatches(i.length))})(c,i,0)}},e.fn.select2.defaults,s),"function"!=typeof s.id&&(n=s.id,s.id=function(e){return e[n]}),e.isArray(s.element.data("ccselect2Tags"))){if("tags"in s)throw"tags specified as both an attribute 'data-ccselect2-tags' and in options of Select2 "+s.element.attr("id");s.tags=s.element.data("ccselect2Tags")}if(c?(s.query=this.bind(function(e){var s,c,n,o={results:[],more:!1},a=e.term;n=function(t,s){var i;t.is("option")?e.matcher(a,t.text(),t)&&s.push(l.optionToData(t)):t.is("optgroup")&&(i=l.optionToData(t),t.children().each2(function(e,t){n(t,i.children)}),i.children.length>0&&s.push(i))},s=i.children(),this.getPlaceholder()!==t&&s.length>0&&(c=this.getPlaceholderOption(),c&&(s=s.not(c))),s.each2(function(e,t){n(t,o.results)}),e.callback(o)}),s.id=function(e){return e.id}):"query"in s||("ajax"in s?(r=s.element.data("ajax-url"),r&&r.length>0&&(s.ajax.url=r),s.query=S.call(s.element,s.ajax)):"data"in s?s.query=y(s.data):"tags"in s&&(s.query=x(s.tags),s.createSearchChoice===t&&(s.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),s.initSelection===t&&(s.initSelection=function(t,i){var c=[];e(a(t.val(),s.separator,s.transformVal)).each(function(){var t={id:this,text:this},i=s.tags;e.isFunction(i)&&(i=i()),e(i).each(function(){return o(this.id,t.id)?(t=this,!1):void 0}),c.push(t)}),i(c)}))),"function"!=typeof s.query)throw"query function not defined for Select2 "+s.element.attr("id");if("top"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof s.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return s},monitorSource:function(){var s,i=this.opts.element,c=this;i.on("change.ccselect2",this.bind(function(e){this.opts.element.data("ccselect2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var e=i.prop("disabled");e===t&&(e=!1),this.enable(!e);var s=i.prop("readonly");s===t&&(s=!1),this.readonly(s),this.container&&(w(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(T(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(w(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(this.opts.dropdownCssClass,this.opts.element)))}),i.length&&i[0].attachEvent&&i.each(function(){this.attachEvent("onpropertychange",c._sync)}),s=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,s!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new s(function(t){e.each(t,c._sync)}),this.propertyObserver.observe(i.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var s=e.Event("ccselect2-selecting",{val:this.id(t),object:t,choice:t});return this.opts.element.trigger(s),!s.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("ccselect2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("ccselect2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e===this.enabledInterface?!1:(this.container.toggleClass("ccselect2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("ccselect2-dropdown-open"):!1},positionDropdown:function(){var t,s,i,c,n,o=this.dropdown,a=this.container,r=a.offset(),l=a.outerHeight(!1),h=a.outerWidth(!1),u=o.outerHeight(!1),d=e(window),p=d.width(),f=d.height(),g=d.scrollLeft()+p,m=d.scrollTop()+f,v=r.top+l,w=r.left,b=m>=v+u,C=r.top-u>=d.scrollTop(),S=o.outerWidth(!1),y=function(){return g>=w+S},x=function(){return r.left+g+a.outerWidth(!1)>S},E=o.hasClass("ccselect2-drop-above");E?(s=!0,!C&&b&&(i=!0,s=!1)):(s=!1,!b&&C&&(i=!0,s=!0)),i&&(o.hide(),r=this.container.offset(),l=this.container.outerHeight(!1),h=this.container.outerWidth(!1),u=o.outerHeight(!1),g=d.scrollLeft()+p,m=d.scrollTop()+f,v=r.top+l,w=r.left,S=o.outerWidth(!1),o.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(n=e(".ccselect2-results",o)[0],o.addClass("ccselect2-drop-auto-width"),o.css("width",""),S=o.outerWidth(!1)+(n.scrollHeight===n.clientHeight?0:N.width),S>h?h=S:S=h,u=o.outerHeight(!1)):this.container.removeClass("ccselect2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),v-=t.top,w-=t.left),!y()&&x()&&(w=r.left+this.container.outerWidth(!1)-S),c={left:w,width:h},s?(c.top=r.top-u,c.bottom="auto",this.container.addClass("ccselect2-drop-above"),o.addClass("ccselect2-drop-above")):(c.top=v,c.bottom="auto",this.container.removeClass("ccselect2-drop-above"),o.removeClass("ccselect2-drop-above")),c=e.extend(c,T(this.opts.dropdownCss,this.opts.element)),o.css(c)},shouldOpen:function(){var t;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(t=e.Event("ccselect2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("ccselect2-drop-above"),this.dropdown.removeClass("ccselect2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),L.on("mousemove.ccselect2Event",function(e){F.x=e.pageX,F.y=e.pageY}),!0):!1},opening:function(){var t,i=this.containerEventName,c="scroll."+i,n="resize."+i,o="orientationchange."+i;this.container.addClass("ccselect2-dropdown-open").addClass("ccselect2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),t=e("#ccselect2-drop-mask"),0===t.length&&(t=e(document.createElement("div")),t.attr("id","ccselect2-drop-mask").attr("class","ccselect2-drop-mask"),t.hide(),t.appendTo(this.body),t.on("mousedown touchstart click",function(i){s(t);var c,n=e("#ccselect2-drop");n.length>0&&(c=n.data("ccselect2"),c.opts.selectOnBlur&&c.selectHighlighted({noFocus:!0}),c.close(),i.preventDefault(),i.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#ccselect2-drop").removeAttr("id"),this.dropdown.attr("id","ccselect2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("ccselect2-drop-active");var a=this;this.container.parents().add(window).each(function(){e(this).on(n+" "+c+" "+o,function(e){a.opened()&&a.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerEventName,s="scroll."+t,i="resize."+t,c="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(s).off(i).off(c)}),this.clearDropdownAlignmentPreference(),e("#ccselect2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("ccselect2-dropdown-open").removeClass("ccselect2-container-active"),this.results.empty(),L.off("mousemove.ccselect2Event"),this.clearSearch(),this.search.removeClass("ccselect2-active"),this.opts.element.trigger(e.Event("ccselect2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return T(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var t,s,i,c,n,o,a,r,l=this.results;if(s=this.highlight(),!(0>s)){if(0==s)return void l.scrollTop(0);t=this.findHighlightableChoices().find(".ccselect2-result-label"),i=e(t[s]),r=(i.offset()||{}).top||0,c=r+i.outerHeight(!0),s===t.length-1&&(a=l.find("li.ccselect2-more-results"),a.length>0&&(c=a.offset().top+a.outerHeight(!0))),n=l.offset().top+l.outerHeight(!1),c>n&&l.scrollTop(l.scrollTop()+(c-n)),o=r-l.offset().top,0>o&&"none"!=i.css("display")&&l.scrollTop(l.scrollTop()+o)}},findHighlightableChoices:function(){return this.results.find(".ccselect2-result-selectable:not(.ccselect2-disabled):not(.ccselect2-selected)")},moveHighlight:function(t){for(var s=this.findHighlightableChoices(),i=this.highlight();i>-1&&i<s.length;){i+=t;var c=e(s[i]);if(c.hasClass("ccselect2-result-selectable")&&!c.hasClass("ccselect2-disabled")&&!c.hasClass("ccselect2-selected")){this.highlight(i);break}}},highlight:function(t){var s,i,n=this.findHighlightableChoices();return 0===arguments.length?c(n.filter(".ccselect2-highlighted")[0],n.get()):(t>=n.length&&(t=n.length-1),0>t&&(t=0),this.removeHighlight(),s=e(n[t]),s.addClass("ccselect2-highlighted"),this.search.attr("aria-activedescendant",s.find(".ccselect2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(s.text()),i=s.data("ccselect2-data"),void(i&&this.opts.element.trigger({type:"ccselect2-highlight",val:this.id(i),choice:i})))},removeHighlight:function(){this.results.find(".ccselect2-highlighted").removeClass("ccselect2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var s=e(t.target).closest(".ccselect2-result-selectable");if(s.length>0&&!s.is(".ccselect2-highlighted")){var i=this.findHighlightableChoices();this.highlight(i.index(s))}else 0==s.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e,t=this.results,s=t.find("li.ccselect2-more-results"),i=this.resultsPage+1,c=this,n=this.search.val(),o=this.context;0!==s.length&&(e=s.offset().top-t.offset().top-t.height(),e<=this.opts.loadMorePadding&&(s.addClass("ccselect2-active"),this.opts.query({element:this.opts.element,term:n,page:i,context:o,matcher:this.opts.matcher,callback:this.bind(function(e){c.opened()&&(c.opts.populateResults.call(this,t,e.results,{term:n,page:i,context:o}),c.postprocessResults(e,!1,!1),e.more===!0?(s.detach().appendTo(t).html(c.opts.escapeMarkup(T(c.opts.formatLoadMore,c.opts.element,i+1))),window.setTimeout(function(){c.loadMoreIfNeeded()},10)):s.remove(),c.positionDropdown(),c.resultsPage=i,c.context=e.context,this.opts.element.trigger({type:"ccselect2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(s){function i(){l.removeClass("ccselect2-active"),d.positionDropdown(),h.find(".ccselect2-no-results,.ccselect2-selection-limit,.ccselect2-searching").length?d.liveRegion.text(h.text()):d.liveRegion.text(d.opts.formatMatches(h.find('.ccselect2-result-selectable:not(".ccselect2-selected")').length))}function c(e){h.html(e),i()}var n,a,r,l=this.search,h=this.results,u=this.opts,d=this,p=l.val(),f=e.data(this.container,"ccselect2-last-term");if((s===!0||!f||!o(p,f))&&(e.data(this.container,"ccselect2-last-term",p),s===!0||this.showSearchInput!==!1&&this.opened())){r=++this.queryCount;var g=this.getMaximumSelectionSize();if(g>=1&&(n=this.data(),e.isArray(n)&&n.length>=g&&E(u.formatSelectionTooBig,"formatSelectionTooBig")))return void c("<li class='ccselect2-selection-limit'>"+T(u.formatSelectionTooBig,u.element,g)+"</li>");if(l.val().length<u.minimumInputLength)return c(E(u.formatInputTooShort,"formatInputTooShort")?"<li class='ccselect2-no-results'>"+T(u.formatInputTooShort,u.element,l.val(),u.minimumInputLength)+"</li>":""),void(s&&this.showSearch&&this.showSearch(!0));if(u.maximumInputLength&&l.val().length>u.maximumInputLength)return void c(E(u.formatInputTooLong,"formatInputTooLong")?"<li class='ccselect2-no-results'>"+T(u.formatInputTooLong,u.element,l.val(),u.maximumInputLength)+"</li>":"");u.formatSearching&&0===this.findHighlightableChoices().length&&c("<li class='ccselect2-searching'>"+T(u.formatSearching,u.element)+"</li>"),l.addClass("ccselect2-active"),this.removeHighlight(),a=this.tokenize(),a!=t&&null!=a&&l.val(a),this.resultsPage=1,u.query({element:u.element,term:l.val(),page:this.resultsPage,context:null,matcher:u.matcher,callback:this.bind(function(n){var a;if(r==this.queryCount){if(!this.opened())return void this.search.removeClass("ccselect2-active");if(n.hasError!==t&&E(u.formatAjaxError,"formatAjaxError"))ret
|
1 |
!function(e){"undefined"==typeof e.fn.each2&&e.extend(e.fn,{each2:function(t){for(var s=e([0]),i=-1,c=this.length;++i<c&&(s.context=s[0]=this[i])&&t.call(s[0],i,s)!==!1;);return this}})}(jQuery),function(e,t){"use strict";function s(t){var s=e(document.createTextNode(""));t.before(s),s.before(t),s.remove()}function i(e){function t(e){return j[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function c(e,t){for(var s=0,i=t.length;i>s;s+=1)if(o(e,t[s]))return s;return-1}function n(){var t=e(z);t.appendTo(document.body);var s={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),s}function o(e,s){return e===s?!0:e===t||s===t?!1:null===e||null===s?!1:e.constructor===String?e+""==s+"":s.constructor===String?s+""==e+"":!1}function a(e,t,s){var i,c,n;if(null===e||e.length<1)return[];for(i=e.split(t),c=0,n=i.length;n>c;c+=1)i[c]=s(i[c]);return i}function r(e){return e.outerWidth(!1)-e.width()}function l(s){var i="keyup-change-value";s.on("keydown",function(){e.data(s,i)===t&&e.data(s,i,s.val())}),s.on("keyup",function(){var c=e.data(s,i);c!==t&&s.val()!==c&&(e.removeData(s,i),s.trigger("keyup-change"))})}function h(s){s.on("mousemove",function(s){var i=F;i!==t&&i.x===s.pageX&&i.y===s.pageY||e(s.target).trigger("mousemove-filtered",s)})}function u(e,s,i){i=i||t;var c;return function(){var t=arguments;window.clearTimeout(c),c=window.setTimeout(function(){s.apply(i,t)},e)}}function d(e,t){var s=u(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){c(e.target,t.get())>=0&&s(e)})}function p(e){e[0]!==document.activeElement&&window.setTimeout(function(){var t,s=e[0],i=e.val().length;e.focus();var c=s.offsetWidth>0||s.offsetHeight>0;c&&s===document.activeElement&&(s.setSelectionRange?s.setSelectionRange(i,i):s.createTextRange&&(t=s.createTextRange(),t.collapse(!1),t.select()))},0)}function f(t){t=e(t)[0];var s=0,i=0;if("selectionStart"in t)s=t.selectionStart,i=t.selectionEnd-s;else if("selection"in document){t.focus();var c=document.selection.createRange();i=document.selection.createRange().text.length,c.moveStart("character",-t.value.length),s=c.text.length-i}return{offset:s,length:i}}function g(e){e.preventDefault(),e.stopPropagation()}function m(e){e.preventDefault(),e.stopImmediatePropagation()}function v(t){if(!M){var s=t[0].currentStyle||window.getComputedStyle(t[0],null);M=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:s.fontSize,fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight,letterSpacing:s.letterSpacing,textTransform:s.textTransform,whiteSpace:"nowrap"}),M.attr("class","ccselect2-sizer"),e(document.body).append(M)}return M.text(t.val()),M.width()}function w(t,s,i){var c,n,o=[];c=e.trim(t.attr("class")),c&&(c=""+c,e(c.split(/\s+/)).each2(function(){0===this.indexOf("ccselect2-")&&o.push(this)})),c=e.trim(s.attr("class")),c&&(c=""+c,e(c.split(/\s+/)).each2(function(){0!==this.indexOf("ccselect2-")&&(n=i(this),n&&o.push(n))})),t.attr("class",o.join(" "))}function b(e,t,s,c){var n=i(e.toUpperCase()).indexOf(i(t.toUpperCase())),o=t.length;return 0>n?void s.push(c(e)):(s.push(c(e.substring(0,n))),s.push("<span class='ccselect2-match'>"),s.push(c(e.substring(n,n+o))),s.push("</span>"),void s.push(c(e.substring(n+o,e.length))))}function C(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function S(s){var i,c=null,n=s.quietMillis||100,o=s.url,a=this;return function(r){window.clearTimeout(i),i=window.setTimeout(function(){var i=s.data,n=o,l=s.transport||e.fn.select2.ajaxDefaults.transport,h={type:s.type||"GET",cache:s.cache||!1,jsonpCallback:s.jsonpCallback||t,dataType:s.dataType||"json"},u=e.extend({},e.fn.select2.ajaxDefaults.params,h);i=i?i.call(a,r.term,r.page,r.context):null,n="function"==typeof n?n.call(a,r.term,r.page,r.context):n,c&&"function"==typeof c.abort&&c.abort(),s.params&&(e.isFunction(s.params)?e.extend(u,s.params.call(a)):e.extend(u,s.params)),e.extend(u,{url:n,dataType:s.dataType,data:i,success:function(e){var t=s.results(e,r.page,r);r.callback(t)},error:function(e,t,s){var i={hasError:!0,jqXHR:e,textStatus:t,errorThrown:s};r.callback(i)}}),c=l.call(a,u)},n)}}function y(t){var s,i,c=t,n=function(e){return""+e.text};e.isArray(c)&&(i=c,c={results:i}),e.isFunction(c)===!1&&(i=c,c=function(){return i});var o=c();return o.text&&(n=o.text,e.isFunction(n)||(s=o.text,n=function(e){return e[s]})),function(t){var s,i=t.term,o={results:[]};return""===i?void t.callback(c()):(s=function(c,o){var a,r;if(c=c[0],c.children){a={};for(r in c)c.hasOwnProperty(r)&&(a[r]=c[r]);a.children=[],e(c.children).each2(function(e,t){s(t,a.children)}),(a.children.length||t.matcher(i,n(a),c))&&o.push(a)}else t.matcher(i,n(c),c)&&o.push(c)},e(c().results).each2(function(e,t){s(t,o.results)}),void t.callback(o))}}function x(s){var i=e.isFunction(s);return function(c){var n=c.term,o={results:[]},a=i?s(c):s;e.isArray(a)&&(e(a).each(function(){var e=this.text!==t,s=e?this.text:this;(""===n||c.matcher(n,s))&&o.results.push(e?this:{id:this,text:this})}),c.callback(o))}}function E(t,s){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw new Error(s+" must be a string, function, or falsy value")}function T(t,s){if(e.isFunction(t)){var i=Array.prototype.slice.call(arguments,2);return t.apply(s,i)}return t}function O(t){var s=0;return e.each(t,function(e,t){t.children?s+=O(t.children):s++}),s}function P(e,s,i,c){var n,a,r,l,h,u=e,d=!1;if(!c.createSearchChoice||!c.tokenSeparators||c.tokenSeparators.length<1)return t;for(;;){for(a=-1,r=0,l=c.tokenSeparators.length;l>r&&(h=c.tokenSeparators[r],a=e.indexOf(h),!(a>=0));r++);if(0>a)break;if(n=e.substring(0,a),e=e.substring(a+h.length),n.length>0&&(n=c.createSearchChoice.call(this,n,s),n!==t&&null!==n&&c.id(n)!==t&&null!==c.id(n))){for(d=!1,r=0,l=s.length;l>r;r++)if(o(c.id(n),c.id(s[r]))){d=!0;break}d||i(n)}}return u!==e?e:void 0}function I(){var t=this;e.each(arguments,function(e,s){t[s].remove(),t[s]=null})}function k(t,s){var i=function(){};return i.prototype=new t,i.prototype.constructor=i,i.prototype.parent=t.prototype,i.prototype=e.extend(i.prototype,s),i}if(window.Select2===t){var A,R,D,H,M,L,N,F={x:0,y:0},U={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case U.LEFT:case U.RIGHT:case U.UP:case U.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case U.SHIFT:case U.CTRL:case U.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&123>=e}},z="<div class='ccselect2-measure-scrollbar'></div>",j={"Ⓐ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};L=e(document),H=function(){var e=1;return function(){return e++}}(),A=k(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(s){var i,c,o=".ccselect2-results";this.opts=s=this.prepareOpts(s),this.id=s.id,s.element.data("ccselect2")!==t&&null!==s.element.data("ccselect2")&&s.element.data("ccselect2").destroy(),this.container=this.createContainer(),this.liveRegion=e(".ccselect2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ccselect2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(s.element.attr("id")||"autogen"+H()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",s.element.attr("title")),this.body=e(document.body),w(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",s.element.attr("style")),this.container.css(T(s.containerCss,this.opts.element)),this.container.addClass(T(s.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("ccselect2",this).attr("tabindex","-1").before(this.container).on("click.ccselect2",g),this.container.data("ccselect2",this),this.dropdown=this.container.find(".ccselect2-drop"),w(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(s.dropdownCssClass,this.opts.element)),this.dropdown.addClass(this.containerId),this.dropdown.data("ccselect2",this),this.dropdown.on("click",g),this.results=i=this.container.find(o),this.search=c=this.container.find("input.ccselect2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",g),h(this.results),this.dropdown.on("mousemove-filtered",o,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",o,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",o,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",o,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(e){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),d(80,this.results),this.dropdown.on("scroll-debounced",o,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".ccselect2-input",function(e){e.stopPropagation()}),e(this.dropdown).on("change",".ccselect2-input",function(e){e.stopPropagation()}),e.fn.mousewheel&&i.mousewheel(function(e,t,s,c){var n=i.scrollTop();c>0&&0>=n-c?(i.scrollTop(0),g(e)):0>c&&i.get(0).scrollHeight-i.scrollTop()+c<=i.height()&&(i.scrollTop(i.get(0).scrollHeight-i.height()),g(e))}),l(c),c.on("keyup-change input paste",this.bind(this.updateResults)),c.on("focus",function(){c.addClass("ccselect2-focused")}),c.on("blur",function(){c.removeClass("ccselect2-focused")}),this.dropdown.on("mouseup",o,this.bind(function(t){e(t.target).closest(".ccselect2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==s.maximumInputLength&&this.search.attr("maxlength",s.maximumInputLength);var a=s.element.prop("disabled");a===t&&(a=!1),this.enable(!a);var r=s.element.prop("readonly");r===t&&(r=!1),this.readonly(r),N=N||n(),this.autofocus=s.element.prop("autofocus"),s.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",s.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,s=e.data("ccselect2"),i=this;this.close(),e.length&&e[0].detachEvent&&i._sync&&e.each(function(){i._sync&&this.detachEvent("onpropertychange",i._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,s!==t&&(s.container.remove(),s.liveRegion.remove(),s.dropdown.remove(),e.show().removeData("ccselect2").off(".ccselect2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),I.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:o(e.attr("locked"),"locked")||o(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(s){var i,c,n,r,l=this;if(i=s.element,"select"===i.get(0).tagName.toLowerCase()&&(this.select=c=s.element),c&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in s)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),s=e.extend({},{populateResults:function(i,c,n){var o,a=this.opts.id,r=this.liveRegion;(o=function(i,c,h){var u,d,p,f,g,m,v,w,b,C;i=s.sortResults(i,c,n);var S=[];for(u=0,d=i.length;d>u;u+=1)p=i[u],g=p.disabled===!0,f=!g&&a(p)!==t,m=p.children&&p.children.length>0,v=e("<li></li>"),v.addClass("ccselect2-results-dept-"+h),v.addClass("ccselect2-result"),v.addClass(f?"ccselect2-result-selectable":"ccselect2-result-unselectable"),g&&v.addClass("ccselect2-disabled"),m&&v.addClass("ccselect2-result-with-children"),v.addClass(l.opts.formatResultCssClass(p)),v.attr("role","presentation"),w=e(document.createElement("div")),w.addClass("ccselect2-result-label"),w.attr("id","ccselect2-result-label-"+H()),w.attr("role","option"),C=s.formatResult(p,w,n,l.opts.escapeMarkup),C!==t&&(w.html(C),v.append(w)),m&&(b=e("<ul></ul>"),b.addClass("ccselect2-result-sub"),o(p.children,b,h+1),v.append(b)),v.data("ccselect2-data",p),S.push(v[0]);c.append(S),r.text(s.formatMatches(i.length))})(c,i,0)}},e.fn.select2.defaults,s),"function"!=typeof s.id&&(n=s.id,s.id=function(e){return e[n]}),e.isArray(s.element.data("ccselect2Tags"))){if("tags"in s)throw"tags specified as both an attribute 'data-ccselect2-tags' and in options of Select2 "+s.element.attr("id");s.tags=s.element.data("ccselect2Tags")}if(c?(s.query=this.bind(function(e){var s,c,n,o={results:[],more:!1},a=e.term;n=function(t,s){var i;t.is("option")?e.matcher(a,t.text(),t)&&s.push(l.optionToData(t)):t.is("optgroup")&&(i=l.optionToData(t),t.children().each2(function(e,t){n(t,i.children)}),i.children.length>0&&s.push(i))},s=i.children(),this.getPlaceholder()!==t&&s.length>0&&(c=this.getPlaceholderOption(),c&&(s=s.not(c))),s.each2(function(e,t){n(t,o.results)}),e.callback(o)}),s.id=function(e){return e.id}):"query"in s||("ajax"in s?(r=s.element.data("ajax-url"),r&&r.length>0&&(s.ajax.url=r),s.query=S.call(s.element,s.ajax)):"data"in s?s.query=y(s.data):"tags"in s&&(s.query=x(s.tags),s.createSearchChoice===t&&(s.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),s.initSelection===t&&(s.initSelection=function(t,i){var c=[];e(a(t.val(),s.separator,s.transformVal)).each(function(){var t={id:this,text:this},i=s.tags;e.isFunction(i)&&(i=i()),e(i).each(function(){return o(this.id,t.id)?(t=this,!1):void 0}),c.push(t)}),i(c)}))),"function"!=typeof s.query)throw"query function not defined for Select2 "+s.element.attr("id");if("top"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof s.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return s},monitorSource:function(){var s,i=this.opts.element,c=this;i.on("change.ccselect2",this.bind(function(e){this.opts.element.data("ccselect2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var e=i.prop("disabled");e===t&&(e=!1),this.enable(!e);var s=i.prop("readonly");s===t&&(s=!1),this.readonly(s),this.container&&(w(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(T(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(w(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(this.opts.dropdownCssClass,this.opts.element)))}),i.length&&i[0].attachEvent&&i.each(function(){this.attachEvent("onpropertychange",c._sync)}),s=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,s!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new s(function(t){e.each(t,c._sync)}),this.propertyObserver.observe(i.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var s=e.Event("ccselect2-selecting",{val:this.id(t),object:t,choice:t});return this.opts.element.trigger(s),!s.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("ccselect2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("ccselect2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e===this.enabledInterface?!1:(this.container.toggleClass("ccselect2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("ccselect2-dropdown-open"):!1},positionDropdown:function(){var t,s,i,c,n,o=this.dropdown,a=this.container,r=a.offset(),l=a.outerHeight(!1),h=a.outerWidth(!1),u=o.outerHeight(!1),d=e(window),p=d.width(),f=d.height(),g=d.scrollLeft()+p,m=d.scrollTop()+f,v=r.top+l,w=r.left,b=m>=v+u,C=r.top-u>=d.scrollTop(),S=o.outerWidth(!1),y=function(){return g>=w+S},x=function(){return r.left+g+a.outerWidth(!1)>S},E=o.hasClass("ccselect2-drop-above");E?(s=!0,!C&&b&&(i=!0,s=!1)):(s=!1,!b&&C&&(i=!0,s=!0)),i&&(o.hide(),r=this.container.offset(),l=this.container.outerHeight(!1),h=this.container.outerWidth(!1),u=o.outerHeight(!1),g=d.scrollLeft()+p,m=d.scrollTop()+f,v=r.top+l,w=r.left,S=o.outerWidth(!1),o.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(n=e(".ccselect2-results",o)[0],o.addClass("ccselect2-drop-auto-width"),o.css("width",""),S=o.outerWidth(!1)+(n.scrollHeight===n.clientHeight?0:N.width),S>h?h=S:S=h,u=o.outerHeight(!1)):this.container.removeClass("ccselect2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),v-=t.top,w-=t.left),!y()&&x()&&(w=r.left+this.container.outerWidth(!1)-S),c={left:w,width:h},s?(c.top=r.top-u,c.bottom="auto",this.container.addClass("ccselect2-drop-above"),o.addClass("ccselect2-drop-above")):(c.top=v,c.bottom="auto",this.container.removeClass("ccselect2-drop-above"),o.removeClass("ccselect2-drop-above")),c=e.extend(c,T(this.opts.dropdownCss,this.opts.element)),o.css(c)},shouldOpen:function(){var t;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(t=e.Event("ccselect2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("ccselect2-drop-above"),this.dropdown.removeClass("ccselect2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),L.on("mousemove.ccselect2Event",function(e){F.x=e.pageX,F.y=e.pageY}),!0):!1},opening:function(){var t,i=this.containerEventName,c="scroll."+i,n="resize."+i,o="orientationchange."+i;this.container.addClass("ccselect2-dropdown-open").addClass("ccselect2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),t=e("#ccselect2-drop-mask"),0===t.length&&(t=e(document.createElement("div")),t.attr("id","ccselect2-drop-mask").attr("class","ccselect2-drop-mask"),t.hide(),t.appendTo(this.body),t.on("mousedown touchstart click",function(i){s(t);var c,n=e("#ccselect2-drop");n.length>0&&(c=n.data("ccselect2"),c.opts.selectOnBlur&&c.selectHighlighted({noFocus:!0}),c.close(),i.preventDefault(),i.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#ccselect2-drop").removeAttr("id"),this.dropdown.attr("id","ccselect2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("ccselect2-drop-active");var a=this;this.container.parents().add(window).each(function(){e(this).on(n+" "+c+" "+o,function(e){a.opened()&&a.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerEventName,s="scroll."+t,i="resize."+t,c="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(s).off(i).off(c)}),this.clearDropdownAlignmentPreference(),e("#ccselect2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("ccselect2-dropdown-open").removeClass("ccselect2-container-active"),this.results.empty(),L.off("mousemove.ccselect2Event"),this.clearSearch(),this.search.removeClass("ccselect2-active"),this.opts.element.trigger(e.Event("ccselect2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return T(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var t,s,i,c,n,o,a,r,l=this.results;if(s=this.highlight(),!(0>s)){if(0==s)return void l.scrollTop(0);t=this.findHighlightableChoices().find(".ccselect2-result-label"),i=e(t[s]),r=(i.offset()||{}).top||0,c=r+i.outerHeight(!0),s===t.length-1&&(a=l.find("li.ccselect2-more-results"),a.length>0&&(c=a.offset().top+a.outerHeight(!0))),n=l.offset().top+l.outerHeight(!1),c>n&&l.scrollTop(l.scrollTop()+(c-n)),o=r-l.offset().top,0>o&&"none"!=i.css("display")&&l.scrollTop(l.scrollTop()+o)}},findHighlightableChoices:function(){return this.results.find(".ccselect2-result-selectable:not(.ccselect2-disabled):not(.ccselect2-selected)")},moveHighlight:function(t){for(var s=this.findHighlightableChoices(),i=this.highlight();i>-1&&i<s.length;){i+=t;var c=e(s[i]);if(c.hasClass("ccselect2-result-selectable")&&!c.hasClass("ccselect2-disabled")&&!c.hasClass("ccselect2-selected")){this.highlight(i);break}}},highlight:function(t){var s,i,n=this.findHighlightableChoices();return 0===arguments.length?c(n.filter(".ccselect2-highlighted")[0],n.get()):(t>=n.length&&(t=n.length-1),0>t&&(t=0),this.removeHighlight(),s=e(n[t]),s.addClass("ccselect2-highlighted"),this.search.attr("aria-activedescendant",s.find(".ccselect2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(s.text()),i=s.data("ccselect2-data"),void(i&&this.opts.element.trigger({type:"ccselect2-highlight",val:this.id(i),choice:i})))},removeHighlight:function(){this.results.find(".ccselect2-highlighted").removeClass("ccselect2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var s=e(t.target).closest(".ccselect2-result-selectable");if(s.length>0&&!s.is(".ccselect2-highlighted")){var i=this.findHighlightableChoices();this.highlight(i.index(s))}else 0==s.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e,t=this.results,s=t.find("li.ccselect2-more-results"),i=this.resultsPage+1,c=this,n=this.search.val(),o=this.context;0!==s.length&&(e=s.offset().top-t.offset().top-t.height(),e<=this.opts.loadMorePadding&&(s.addClass("ccselect2-active"),this.opts.query({element:this.opts.element,term:n,page:i,context:o,matcher:this.opts.matcher,callback:this.bind(function(e){c.opened()&&(c.opts.populateResults.call(this,t,e.results,{term:n,page:i,context:o}),c.postprocessResults(e,!1,!1),e.more===!0?(s.detach().appendTo(t).html(c.opts.escapeMarkup(T(c.opts.formatLoadMore,c.opts.element,i+1))),window.setTimeout(function(){c.loadMoreIfNeeded()},10)):s.remove(),c.positionDropdown(),c.resultsPage=i,c.context=e.context,this.opts.element.trigger({type:"ccselect2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(s){function i(){l.removeClass("ccselect2-active"),d.positionDropdown(),h.find(".ccselect2-no-results,.ccselect2-selection-limit,.ccselect2-searching").length?d.liveRegion.text(h.text()):d.liveRegion.text(d.opts.formatMatches(h.find('.ccselect2-result-selectable:not(".ccselect2-selected")').length))}function c(e){h.html(e),i()}var n,a,r,l=this.search,h=this.results,u=this.opts,d=this,p=l.val(),f=e.data(this.container,"ccselect2-last-term");if((s===!0||!f||!o(p,f))&&(e.data(this.container,"ccselect2-last-term",p),s===!0||this.showSearchInput!==!1&&this.opened())){r=++this.queryCount;var g=this.getMaximumSelectionSize();if(g>=1&&(n=this.data(),e.isArray(n)&&n.length>=g&&E(u.formatSelectionTooBig,"formatSelectionTooBig")))return void c("<li class='ccselect2-selection-limit'>"+T(u.formatSelectionTooBig,u.element,g)+"</li>");if(l.val().length<u.minimumInputLength)return c(E(u.formatInputTooShort,"formatInputTooShort")?"<li class='ccselect2-no-results'>"+T(u.formatInputTooShort,u.element,l.val(),u.minimumInputLength)+"</li>":""),void(s&&this.showSearch&&this.showSearch(!0));if(u.maximumInputLength&&l.val().length>u.maximumInputLength)return void c(E(u.formatInputTooLong,"formatInputTooLong")?"<li class='ccselect2-no-results'>"+T(u.formatInputTooLong,u.element,l.val(),u.maximumInputLength)+"</li>":"");u.formatSearching&&0===this.findHighlightableChoices().length&&c("<li class='ccselect2-searching'>"+T(u.formatSearching,u.element)+"</li>"),l.addClass("ccselect2-active"),this.removeHighlight(),a=this.tokenize(),a!=t&&null!=a&&l.val(a),this.resultsPage=1,u.query({element:u.element,term:l.val(),page:this.resultsPage,context:null,matcher:u.matcher,callback:this.bind(function(n){var a;if(r==this.queryCount){if(!this.opened())return void this.search.removeClass("ccselect2-active");if(n.hasError!==t&&E(u.formatAjaxError,"formatAjaxError"))ret
|