Version Description
Added an explanationfor the phone based channels like WhatsApp, Viber, Phone, SMS text to make it clearer. When you click on enter while editing any of the chat channels, your settings will be saved.
Download this release
Release Info
Developer | galdub |
Plugin | Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line, WeChat, Email, SMS, Call Button – Chaty |
Version | 2.4.9 |
Comparing to | |
See all releases |
Code changes from version 2.4.8 to 2.4.9
- admin/assets/css/admin-cht-style.css +0 -4
- admin/assets/css/admin-cht-style.min.css +1 -0
- admin/assets/css/cht-style.css +56 -0
- admin/assets/css/cht-style.min.css +1 -0
- admin/assets/js/cht-scripts.js +1648 -0
- admin/assets/js/cht-scripts.min.js +1 -1623
- admin/assets/js/fileinput.min.js +1 -4484
- admin/assets/js/{jquery.sticky.js → jquery.sticky.min.js} +0 -0
- admin/class-admin-base.php +19 -3
- admin/class-social-icons.php +7 -1
- cht-icons.php +7 -2
- css/chaty-front.min.css +1 -0
- includes/class-frontend.php +7 -3
- js/cht-front-script.min.js +1 -0
- readme.txt +5 -2
- views/admin/channels-section.php +10 -4
- views/admin/chaty-popup.php +17 -0
- views/widget.php +3 -2
admin/assets/css/admin-cht-style.css
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
.chaty-plugins-gopro {
|
2 |
-
color: #FF5983;
|
3 |
-
font-weight: bold;
|
4 |
-
}
|
|
|
|
|
|
|
|
admin/assets/css/admin-cht-style.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.chaty-plugins-gopro{color:#ff5983;font-weight:700}
|
admin/assets/css/cht-style.css
CHANGED
@@ -4313,4 +4313,60 @@ span.default-chaty-icon.has-fa-icon svg {
|
|
4313 |
}
|
4314 |
label.custom-control.custom-radio:before {
|
4315 |
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4316 |
}
|
4313 |
}
|
4314 |
label.custom-control.custom-radio:before {
|
4315 |
display: none;
|
4316 |
+
}
|
4317 |
+
.channels-selected-list li#chaty-social-Poptin {
|
4318 |
+
padding-bottom: 30px;
|
4319 |
+
}
|
4320 |
+
|
4321 |
+
/* Only for Free */
|
4322 |
+
.chaty-popup {
|
4323 |
+
position: fixed;
|
4324 |
+
width: 100%;
|
4325 |
+
height: 100%;
|
4326 |
+
top: 0;
|
4327 |
+
left: 0;
|
4328 |
+
z-index: 100001;
|
4329 |
+
background: rgba(0,0,0,0.75);
|
4330 |
+
}
|
4331 |
+
.chaty-popup-box {
|
4332 |
+
padding: 0px;
|
4333 |
+
width: 600px;
|
4334 |
+
max-width: 100%;
|
4335 |
+
margin: auto;
|
4336 |
+
top: 50%;
|
4337 |
+
position: absolute;
|
4338 |
+
left: 0;
|
4339 |
+
right: 0;
|
4340 |
+
border-radius: 5px;
|
4341 |
+
transform: translate(0, -50%);
|
4342 |
+
-webkit-transform: translate(0, -50%);
|
4343 |
+
-moz-transform: translate(0, -50%);
|
4344 |
+
text-align: center;
|
4345 |
+
background: #fcfcfc;
|
4346 |
+
}
|
4347 |
+
.chaty-popup-header {
|
4348 |
+
padding: 15px;
|
4349 |
+
font-size: 20px;
|
4350 |
+
border-bottom: solid 1px #e6e6e6;
|
4351 |
+
}
|
4352 |
+
.chaty-popup-content {
|
4353 |
+
background: #ffffff;
|
4354 |
+
padding: 15px;
|
4355 |
+
}
|
4356 |
+
.chaty-popup-content iframe {
|
4357 |
+
margin: 30px 0;
|
4358 |
+
}
|
4359 |
+
.chaty-popup-footer {
|
4360 |
+
padding: 15px;
|
4361 |
+
border-top: solid 1px #e6e6e6;
|
4362 |
+
}
|
4363 |
+
.chaty-popup-footer button {
|
4364 |
+
border: none;
|
4365 |
+
padding: 10px 20px;
|
4366 |
+
border-radius: 4px;
|
4367 |
+
background: #00c478;
|
4368 |
+
color: #fff;
|
4369 |
+
}
|
4370 |
+
.close-chaty-popup {
|
4371 |
+
|
4372 |
}
|
admin/assets/css/cht-style.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
*,.rpt_plans .rpt_plan,::after,::before{box-sizing:border-box}.btn-help,.btn-help:active,.btn-help:hover,.btn-save,.btn-save-sticky a,.icon:after,i{color:#fff}body,i{-webkit-font-smoothing:antialiased}.main .channels-selected__item .btn-cancel:focus,.main .channels-selected__item.disabled .btn-cancel:focus,.main .channels-selected__item.disabled input:focus,button:focus,input:focus{outline:0}.easy-modal ul,.upgrade-block ul{list-style-image:url(../images/icon-check-purple.svg);columns:2}.btn-red,.link-back{text-decoration:none}.btn-file,.kv-file-content,.preview .page,.switch-preview{overflow:hidden}@font-face{font-family:icomoon;src:url(../fonts/icomoon.ttf?qh3c2u) format('truetype'),url(../fonts/icomoon.woff?qh3c2u) format('woff'),url(../fonts/icomoon.svg?qh3c2u#icomoon) format('svg');font-weight:400;font-style:normal}i{font-family:icomoon;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-moz-osx-font-smoothing:grayscale}.easy-modal__bottom,.plan_date,body,button,input{font-family:Rubik,sans-serif}.icon-chat-base:before{content:"\e901"}.icon-chat-db:before{content:"\e903"}.icon-chat-bubble:before{content:"\e900"}.icon-chat-smile:before{content:"\e904"}.icon-upload:before{content:"\e902"}.icon-phone:before{content:"\f095"}.icon-whatsapp:before{content:"\f232"}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{appearance:none;-webkit-appearance:none;margin:0}.container,.ml-auto{margin-left:auto}.container{width:100%;padding-right:15px;padding-left:15px;margin-right:auto}.col-12{flex:0 0 100%;max-width:100%}.text-center{text-align:center}.text-primary{color:#a886cd}.align-top{align-self:flex-start}.custom-control{display:inline-block;color:#5d5c5c;margin-bottom:0;cursor:pointer;min-height:22px;line-height:22px;padding-left:20px;position:relative}.custom-control .custom-control-input{position:absolute;z-index:-1;opacity:0}.custom-control .custom-control-input.js-upload:disabled~.custom-control-label::before{background:rgba(0,0,0,.1)}.custom-control .custom-control-input:disabled~i{opacity:.5}.custom-control+.custom-control{margin-left:16px}.custom-control.custom-checkbox .custom-control-label{position:static}.custom-control.custom-checkbox .custom-control-label::before{content:'';transition:all .2s;position:absolute;top:3px;left:0;display:block;width:15px;height:15px;line-height:15px;text-align:center;background-color:#fff;-webkit-box-shadow:0 0 15px 0 #eaeaea;-moz-box-shadow:0 0 15px 0 #eaeaea;box-shadow:0 0 15px 0 #eaeaea;border-radius:3px;background-position:center;background-repeat:no-repeat;background-size:15px}.color-picker-btn,.custom-control.custom-radio .custom-control-label::before{-webkit-box-shadow:0 0 15px 0 #eaeaea;-moz-box-shadow:0 0 15px 0 #eaeaea}.custom-control.custom-checkbox .custom-control-label::after{display:none}.custom-control.custom-checkbox .custom-control-input:checked~.custom-control-label::before{background-image:url(../images/icon-check.svg);background-color:transparent}.custom-control.custom-radio{padding-left:27px}.custom-control.custom-radio .custom-control-label{position:static}.custom-control.custom-radio .custom-control-label::before{content:'';transition:all .2s;position:absolute;top:0;left:0;display:block;width:22px;height:22px;background-color:#fff;box-shadow:0 0 15px 0 #eaeaea;border-radius:50%;border:5px solid #fff}.custom-control.custom-radio .custom-control-label::after{display:none}.custom-control.custom-radio .custom-control-input:checked~.custom-control-label::before{background:#a886cd}.position-pro{background:rgba(168,134,205,.1);border-radius:4px;display:flex;padding:6px 0;transition:all .2s;margin-top:11px;flex-wrap:wrap}.position-pro>div{flex:0 0 auto;padding:6px 15px}.position-pro>div>label:first-child{display:block;margin-bottom:10px}.position-pro>div .custom-control-group{background:#fff;box-shadow:0 4px 14px rgba(0,0,0,.15);border-radius:5px;display:flex;align-items:center;width:150px;height:34px}.position-pro>div .custom-control-group .custom-control{width:75px;padding:0;margin:0!important}.position-pro>div .custom-control-group .custom-control .custom-control-label{width:100%;color:#e0e0e0;height:34px;display:flex;align-items:center;padding:6px 7px}.position-pro>div .custom-control-group .custom-control .custom-control-label:before{content:none}.position-pro>div .custom-control-group .custom-control .custom-control-input:checked+.custom-control-label{color:#a886cd;box-shadow:inset 0 3px 7px rgba(0,0,0,.08)}.position-pro>div .custom-control-group .custom-control .custom-control-input:checked+.custom-control-label path{fill:#a886cd}.icon:not(.active):not(:hover) .color-element,.main .channels-icons>.icon:not(.active):not(:hover) .color-element{fill:#bdbdbd}.position-pro>div .custom-control-group .custom-control:first-child .custom-control-label{border-radius:5px 0 0 5px;text-align:left}.position-pro>div .custom-control-group .custom-control:first-child .custom-control-label svg{margin-right:5px}.position-pro>div .custom-control-group .custom-control:last-child .custom-control-label{border-radius:0 5px 5px 0;display:flex;justify-content:flex-end}.position-pro>div .custom-control-group .custom-control:last-child .custom-control-label svg{margin-left:5px}.btn-red,.color-picker .color-picker-radio label+label{margin-left:12px}.position-pro input{background:#fff;box-shadow:0 0 10px 2px rgba(0,0,0,.2);-webkit-box-shadow:0 0 10px 2px rgba(0,0,0,.2);-moz-box-shadow:0 0 10px 2px rgba(0,0,0,.2);border-radius:5px;border:0;line-height:24px;padding:5px 7px;width:60px;margin-right:3px}.color-picker{background:#fff;box-shadow:0 0 10px 2px rgba(0,0,0,.2);-webkit-box-shadow:0 0 10px 2px rgba(0,0,0,.2);-moz-box-shadow:0 0 10px 2px rgba(0,0,0,.2);border-radius:4px;width:330px;display:none;position:relative}.color-picker .color-picker-radio{display:flex;padding:6px 8px 10px;border-bottom:1px solid rgba(130,130,130,.1)}.color-picker .color-picker-radio label{border-radius:50%;width:28px;height:28px;position:relative;cursor:pointer;font-size:0}.color-picker .color-picker-radio label span{display:block;width:28px;height:28px;vertical-align:top;opacity:0;transition:all .2s;background-position:center;background-repeat:no-repeat;background-image:url(../images/icon-check-white.svg)}.color-picker .color-picker-radio label input{position:absolute;z-index:-1;opacity:0}.color-picker .color-picker-radio label input:checked+span{opacity:1}.btn-help span,.color-picker .color-picker-custom a{margin-left:5px}.color-picker .color-picker-custom{padding:10px 8px 16px}.color-picker .color-picker-custom>div{display:flex;align-items:center}.color-picker .color-picker-custom>div+div{margin-top:10px}.color-picker .color-picker-custom .circle{color:#ff6376;background:#fff;border:1px solid #d0d0d0;border-radius:50%;width:28px;height:28px;align-items:center;justify-content:center;display:flex;margin-right:3px;font-size:14px}a,a:focus{color:#a886cd}body,button{font-size:17px}.color-picker .color-picker-custom input{background:#fff;box-shadow:0 4px 14px rgba(0,0,0,.15);border-radius:5px;border:0;line-height:24px;padding:5px 7px;height:34px;width:180px}.color-picker-btn{background-color:#fff;box-shadow:0 0 15px 0 #eaeaea;border-radius:4px;border:0;padding:6px 8px;line-height:17px}.color-picker-btn .circle{display:inline-block;vertical-align:top;width:15px;height:15px;border-radius:50%;margin:1px 4px 1px 0}.color-picker-btn svg{transition:all .2s;margin-left:8px}.color-picker-btn-close{background-color:transparent;border:0;padding:5px;line-height:17px;position:absolute;right:0;top:0}.color-picker-btn-close svg{transform:rotate(180deg)}.switch{display:flex;align-items:center;margin-bottom:0;position:relative;flex:0 0 auto}.switch input[type=checkbox]{pointer-events:none;opacity:0;position:absolute;top:0;right:0;z-index:-1;width:0;height:0}.switch input[type=checkbox]:checked+.switch__styled{background:#a886cd;-webkit-box-shadow:0 0 15px 0 #eaeaea;-moz-box-shadow:0 0 15px 0 #eaeaea;box-shadow:0 0 15px 0 #eaeaea}.switch input[type=checkbox]:checked+.switch__styled:after{left:40px;background:#fff}.form-group .switch{height:42px}.switch__styled{background:linear-gradient(283.61deg,#f6f6f6 7.4%,#fff 91.67%),#fff;margin:0 8px;display:inline-block;height:34px;width:72px;border-radius:17px;position:relative;transition:all .2s;cursor:pointer;-webkit-box-shadow:0 0 15px 0 #eaeaea;-moz-box-shadow:0 0 15px 0 #eaeaea;box-shadow:0 0 15px 0 #eaeaea;background:#cfbde4}.switch__styled:after{content:'';position:absolute;left:2px;top:2px;height:30px;width:30px;border-radius:50%;background-color:#fff;transition:all .2s;-webkit-box-shadow:0 0 15px 0 #eaeaea inset;-moz-box-shadow:0 0 15px 0 #eaeaea inset;box-shadow:0 0 15px 0 #eaeaea inset}.switch.custom-switch{margin-right:auto;margin-left:30px}.switch.custom-switch .switch__styled{background:linear-gradient(283.61deg,#f6f6f6 7.4%,#fff 91.67%),#fff;box-shadow:0 4px 14px rgba(0,0,0,.15)}body{height:auto;background-image:url(../images/bg.svg);background-position:155px 30px;background-repeat:no-repeat;background-size:calc(100% - 150px) auto;background-attachment:fixed;color:#4f4f4f;padding-bottom:50px;margin:0}button{cursor:pointer}button#collapse-button{font-size:13px}input{font-size:17px}#cht-form input[type=submit]{opacity:0;position:absolute}a:focus{box-shadow:none}::-webkit-input-placeholder{color:#e0e0e0}::-moz-placeholder{color:#e0e0e0}:-ms-input-placeholder{color:#e0e0e0}:-moz-placeholder{color:#e0e0e0}.section{padding:30px 15px;position:relative}.section+.section{border-top:2px solid rgba(130,130,130,.1)}.section.one{max-width:680px}.section-title{font-family:Oswald,sans-serif;font-size:30px;color:#000;line-height:44px;margin-bottom:30px;font-weight:400;margin-top:0;display:flex}.section-title strong{margin:0 14px 0 0;text-align:right;font-weight:700}.main{background-color:#fff;border-radius:9px;position:relative}.main .channels-icons{display:flex;flex-wrap:wrap;margin:0 -8px 20px}.main .channels-icons>.icon{padding:0 8px;margin-bottom:16px}.main .channels-icons>.icon .color-element{transition:all .2s}.main .channels-icons>.icon:not(.active) svg{cursor:pointer}.main .channels-selected{padding-top:20px;position:relative;min-height:220px}.main .channels-selected__item{display:flex;align-items:center;flex-wrap:wrap;position:relative}.main .channels-selected__item .icon{margin-right:10px;cursor:pointer;width:50px;border-radius:100%;height:50px;text-align:center;vertical-align:middle}.main .channels-selected__item .icon>i{font-size:30px;line-height:50px}.main .channels-selected__item .btn-cancel{position:absolute;right:-15px;top:-15px;transform:translate(50%,-50%);background:linear-gradient(0deg,#333,#333),linear-gradient(153.18deg,#6371db 7.07%,#ff89c4 90.47%);border-radius:50%;width:22px;height:22px;display:flex;align-items:center;justify-content:center;padding:0;border:0;z-index:1;box-shadow:0 4px 14px rgba(0,0,0,.15);cursor:pointer}.main .channels-selected__item .input-example{font-size:13px;padding-top:0;line-height:14px;color:#444;opacity:.8;position:absolute;left:calc(50px + 16px + 7px);top:50px}.main .channels-selected__item.disabled .icon{cursor:default}.main .channels-selected__item.disabled .icon .color-element{fill:#e9e9e9}.main .channels-selected__item.disabled input{box-shadow:0 4px 14px rgba(179,179,179,.15);color:#e9e9e9}.main .channels-selected__item.disabled input::-webkit-input-placeholder{color:#e9e9e9}.main .channels-selected__item.disabled input::-moz-placeholder{color:#e9e9e9}.main .channels-selected__item.disabled input:-ms-input-placeholder{color:#e9e9e9}.main .channels-selected__item.disabled input:-moz-placeholder{color:#e9e9e9}.main .channels-selected__item.disabled .btn-cancel{cursor:default;background:linear-gradient(0deg,#cfcfcf,#cfcfcf),linear-gradient(153.18deg,#6371db 7.07%,#ff89c4 90.47%)}.btn-help,.btn-save-sticky,.channels__view,.icon:not(.active) svg{cursor:pointer}.main .channels-selected__item.disabled .input-example{color:#e9e9e9}.main #positionPro{margin-left:-122px}.main .form-horizontal__item{display:flex;flex-wrap:wrap}.main .form-horizontal__item+.form-horizontal__item{padding-top:30px}.main .form-horizontal__item-label{flex:0 0 122px;margin:0 14px 0 0;text-align:right;font-weight:700}.header,.main .form-horizontal__item.flex-center{align-items:center}.main .form-horizontal__item>div>input{background:#fff;-webkit-box-shadow:0 0 15px 0 #eaeaea;-moz-box-shadow:0 0 15px 0 #eaeaea;box-shadow:0 0 15px 0 #eaeaea;border-radius:5px;border:0;line-height:24px;padding:5px 7px}.main .form-horizontal__item>div>input.widget-size__input{width:47px;height:34px;text-align:center}.icon{border-radius:50%;vertical-align:top;font-size:0;position:relative}.icon:after,.icon:before{position:absolute;opacity:0;pointer-events:none;left:50%}.icon:after{text-align:center;content:"" attr(data-label) "";font-size:11px;top:0;transform:translate(-50%,calc(-100% - 6px));padding:0 20px;line-height:23px;min-width:90px;white-space:nowrap;background-color:#333;box-shadow:0 2px 4px rgba(0,0,0,.15);border-radius:6px;z-index:1001}.btn-save:after,.icon:before,.popover:after{content:''}.icon:before{top:-8px;transform:translateX(-50%);height:10px;width:10px;border-width:10px 5px 0;border-style:solid;border-color:#333 transparent transparent}.icon.tooltip-show:after,.icon.tooltip-show:before,.icon:hover:not(.tooltip-show):after,.icon:hover:not(.tooltip-show):before{opacity:1;pointer-events:auto}.chaty-help-form,.disabled{pointer-events:none}.icon .color-element{transition:all .2s}.icon.no-tooltip:after,.icon.no-tooltip:before{content:none!important}.icon.icon-md svg,.icon.icon-sm svg{width:50px;height:50px;cursor:move}.icon.icon-xs svg{width:30px;height:30px}.btn-save{border:0;text-transform:uppercase;line-height:24px;font-weight:700;position:relative;max-width:100%;margin-top:40px;height:50px;width:274px;border-radius:25px;padding:14px 15px 12px;background-image:url(../images/rocket.svg);background-color:#ff6624;background-position:left bottom;background-repeat:no-repeat;box-shadow:0 3px 10px 1px rgba(255,90,116,.5)}.btn-save:after{position:absolute;z-index:-1;top:30px;left:50%;transform:translateX(-50%);width:238.1px;height:30.81px;background:linear-gradient(97.71deg,#ff6624 9.04%,#ff6376 91.56%),linear-gradient(104.36deg,#6371db 20.37%,#ff89c4 72.52%);opacity:.77;filter:blur(19px);border-radius:9px}.btn-help{text-align:center;padding-top:10px;position:absolute;background:#03e78b;border-radius:7px 7px 0 0;right:0;top:60px;transform:rotate(-90deg);transform-origin:bottom right;border:0;height:42px;width:102px;text-transform:uppercase;font-weight:700}.btn-help span{display:inline-block;width:27px;height:27px;border:2px solid #fff;border-radius:100%}@media (min-width:1280px){.btn-help{transform:rotate(90deg);position:fixed;left:calc(50vw - 480px + 1050px / 12 * 7 + 373px);top:306px;right:auto}}.btn-save-sticky{padding:10px 0 11px;top:20px;background:#ff6624;right:0;border-radius:7px 0 0 7px;position:absolute;border:0;height:69px;width:42px;text-transform:uppercase;color:#fff;font-weight:700;font-size:11px}.btn-save-sticky span{text-align:center;display:inline-block;margin-bottom:4px;height:15px;line-height:13px}input.channels__input.border-red{border-color:#d00}@media (min-width:1280px){.btn-save-sticky{left:calc(50vw - 480px + 1050px / 12 * 7 + 475px);top:161px;right:auto;border-radius:0 7px 7px 0;position:fixed}body.has-premio-box .btn-save-sticky{top:320px}body.has-premio-box .btn-help{top:455px}html[dir=rtl] .btn-save-sticky{left:calc(50vw - 480px + 1050px / 12 * 7 + 295px)}html[dir=rtl] .btn-help{left:calc(50vw - 480px + 1050px / 12 * 7 + 193px)}}.popover{flex:0 0 auto;background:#fff;border-radius:4px;line-height:33px;padding:0 5px;position:relative;margin:25px 25px 25px 0;box-shadow:0 1px 14px rgba(156,117,198,.4),0 2px 4px rgba(0,0,0,.15);text-align:center}.popover:after{position:absolute;top:-7px;left:40px;width:20px;height:7px;background-image:url(../images/arrow.png);background-position:center;background-size:contain;background-repeat:no-repeat;display:none}.easy-modal{display:none;width:515px;max-width:calc(100vw - 30px);box-shadow:0 4px 6px rgba(0,0,0,.15);border-radius:6px;background-color:#fff;top:50%!important;transform:translateY(-50%)}.easy-modal .money-guaranteed svg,.upgrade-block .money-guaranteed svg{width:15px;vertical-align:text-bottom}.easy-modal .money-guaranteed{color:#a886cd;font-size:17px;line-height:24px;margin-bottom:20px}.easy-modal .easy-modal-inner{position:relative;padding:20px 50px}.easy-modal .easy-modal-close{position:absolute;right:0;top:0;padding:7px;line-height:12px;background-color:transparent;border:0}.easy-modal h2{font-family:Rubik;font-weight:700;font-size:27px;margin-bottom:13px;text-align:center;margin-top:0}.easy-modal .udner-title{font-size:17px}.easy-modal .udner-title span{font-size:15px;display:block;color:#bdbdbd}.easy-modal p{text-align:center;margin:0 auto 10px}.easy-modal ul{margin-bottom:17px;line-height:27px;list-style-position:inside;text-align:left}.easy-modal .easy-modal-link{font-size:15px;text-decoration-line:underline;color:#828282;display:inline-block;margin-top:7px}.easy-modal .form-horizontal__item{margin-bottom:50px;justify-content:center;text-align:center}.easy-modal .user-name,.easy-modal .user-role{margin:0;font-size:13px}.easy-modal .form-horizontal__item>div{flex:0 0 auto}.easy-modal .user-name{font-weight:700;color:#828282;text-align:left}.link-back,.link-back:hover{color:#fff}.easy-modal .user-photo{float:left;margin-right:5px}.link-back{display:inline-block;border:1px solid #fff;border-radius:60px;font-size:17px;line-height:20px;text-align:center;padding:7px 46px}.upgrade-wrap{margin:15px auto;max-width:1024px}.upgrade-block{background-color:#fff;border-radius:9px;padding:48px 0 67px;margin-top:21px}.upgrade-block .easy-modal-inner{margin:0 auto;direction:ltr!important;padding:0 30px;max-width:1024px}.upgrade-block h2{font-family:Rubik;font-weight:700;font-size:27px;margin-bottom:5px;text-align:center;margin-top:0;line-height:33px}.upgrade-block .udner-title{font-size:17px}.upgrade-block .udner-title span{font-size:15px;display:block;color:#bdbdbd}.form-horizontal__item .chaty-widget .icon,.upgrade-block ul{display:inline-block}.upgrade-block p{text-align:center;margin:0 auto 10px}.upgrade-block ul{margin-bottom:17px;line-height:27px;list-style-position:inside;text-align:left}.upgrade-block .easy-modal-link{font-size:15px;text-decoration-line:underline;color:#828282;display:inline-block;margin-top:7px}.upgrade-block .form-horizontal__item{margin-bottom:50px;justify-content:center;text-align:center}img.payment-img{margin:10px 0}.upgrade-block .form-horizontal__item>div{flex:0 0 auto}.upgrade-block .user-name{font-weight:700;color:#828282;margin:0;text-align:left;font-size:13px}.upgrade-block .user-role{margin:0;font-size:13px}.upgrade-block .user-photo{float:left;margin-right:5px}.upgrade-block .money-guaranteed{color:#b97fcf;font-size:16px;line-height:18px;margin:10px 0}.upgrade-block .money-guaranteed span.dashicons.dashicons-yes{background:#00bd00;color:#fff;border-radius:50%;-webkit-border-radius:50%;-moz-border-radius:50%}.easy-modal.modal-upgrade{width:560px}.easy-modal.modal-upgrade .easy-modal-inner{padding:20px 0 0}.modal__wrap{padding:0 5px;text-align:center}.form-horizontal__item .chaty-widget{position:static;flex:0 0 250px!important}.form-horizontal__item .chaty-widget .icon svg{width:62px;height:62px}.form-horizontal__item .chaty-widget .icon:after{z-index:10;content:"" attr(data-label) "";font-size:17px;left:0;top:50%;transform:translate(calc(-100% - 6px),-50%);white-space:nowrap;padding:16px 25px;line-height:21px;width:auto;color:#333;background-color:#fff;box-shadow:0 1.93px 7.74px rgba(0,0,0,.15);border-radius:10px}#toplevel_page_chaty-app img,.btn-red:hover,.text_update{color:#fff}.form-horizontal__item .chaty-widget .icon:before{content:'';left:-8px;top:50%;transform:translateY(-50%);height:10px;width:10px;z-index:11;border-width:5px 0 5px 10px;border-style:solid;border-color:transparent transparent transparent #fff}.btn-red,.btn-white{z-index:100;line-height:27px;box-shadow:0 4px 4px rgba(0,0,0,.11);vertical-align:top;position:relative;color:#fff}.btn-red:focus,.btn-red:hover{color:#fff}.form-horizontal__item .chaty-widget.chaty-widget-icons-right .icon:before{right:-8px;left:auto;border-width:5px 10px 5px 0;border-color:transparent #fff transparent transparent}.form-horizontal__item .chaty-widget.chaty-widget-icons-right .icon:after{right:0;left:auto;transform:translate(calc(100% + 6px),-50%)}.header{display:flex;padding:3px 0;margin-bottom:9px}.btn-red,.tooltip{display:inline-block}.btn-white{background-color:transparent;border:1px solid #fff;padding:4px 20px;border-radius:19px}.btn-red{border:0;text-transform:uppercase;font-weight:700;background-color:#ff6624;padding:6px 20px 4px;border-radius:19px}.btn-red svg{vertical-align:text-top;margin-left:5px}.text_update{top:2px;position:relative;margin:0;font-size:10px;left:15px}.sticky-wrapper{position:absolute;right:0;top:-370px;width:calc(320px);z-index:99}.tooltip{position:relative}.chaty-widget-icons-left .tooltip .tooltiptext,.chaty-widget-icons-right .tooltip .tooltiptext{white-space:pre-wrap;display:block;width:250px;min-height:24px;color:#000;text-align:center;padding:0;top:2.5px;position:absolute;z-index:35;font-size:12px;line-height:36px}.tooltip .tooltiptext span{background-color:#fff;padding:0 15px;display:inline-block;vertical-align:middle;line-height:24px;height:24px;float:right;margin:0;border-radius:6px}.chaty-widget-icons-left .tooltip .tooltiptext span{float:left}.tooltip:hover .tooltiptext{visibility:visible}.chaty-widget-icons-right .tooltip .tooltiptext{justify-content:center;align-items:center;right:41px}.mobiel-view .chaty-widget-icons-right .tooltip .tooltiptext{right:35px}.chaty-widget-icons-left .tooltip .tooltiptext{align-items:center;justify-content:center;left:43px}.mobiel-view .chaty-widget-icons-left .tooltip .tooltiptext{left:37px}.update-nag{display:block!important}.notice,div.error,div.updated{display:none!important}div#setting-error-settings_updated{display:block!important}.domain__input,.domain__label{max-width:342px;display:block}.domain{background:rgba(168,134,205,.1);border-radius:4px;text-align:left;margin:0 0 10px;padding:10px 20px}.domain__label{font-size:17px;font-weight:700;margin:0 auto 6px}.domain__input{height:34px;background:#fff;box-shadow:0 4px 14px rgba(0,0,0,.15);border-radius:5px;border:none;width:100%;margin:0 auto}.upg{background:0 0;border:none;text-align:center;width:270px;padding:0}.upg img,.upg svg{width:100%}.valid_domain{transition-property:margin-top;transition-delay:.3s;color:red;display:none}.payments{margin-bottom:5px}.easy-modal__bottom{padding:10px 10px 0;text-align:left;color:#828282;position:relative}.easy-modal__bottom .quote{position:absolute;left:65px;top:-4px}.easy-modal__bottom:before{content:'';display:block;position:absolute;left:0;top:0;width:100%;background:rgba(130,130,130,.1);height:2px}.easy-modal__bottom .easy-modal__bottom-p{text-align:left;font-weight:300;position:relative;margin-bottom:10px;font-size:14px;line-height:17px}.easy-modal__bottom .easy-modal__bottom-p p{text-align:left;margin:6px 0 0;line-height:15px}.plan_date{color:#fff;font-size:16px;opacity:.9}html[dir=rtl] body{background-position:0}html[dir=rtl] input[type=radio]:checked:before{text-indent:-1px}.chaty-new-widget-wrap{background:#f9fcfc url(../images/new_widget_bg.png) no-repeat left center;border-radius:10px;padding:30px 20px;margin:40px 30px 0 0;background-size:auto 100%}.chaty-new-widget-wrap h2{margin:0 0 30px;font-size:19px;color:#4f4f4f;line-height:1.4;font-weight:500}.chaty-new-widget-right p{font-size:14px;line-height:1.2;color:#4f4f4f;margin-top:0}.chaty-new-widget-right p strong{font-weight:700;font-size:16px}.chaty-new-widget-right li{font-size:14px;color:#727d81;position:relative;padding-left:20px;line-height:1.7;margin-bottom:10px}.chaty-new-widget-right li::before{content:"";position:absolute;top:5px;left:0;background-color:#7761df;width:10px;height:10px;border-radius:50%}.chaty-new-widget-right .upgrade-chatys a{font-size:14px;font-weight:500;padding:10px 26px;border-radius:40px;background:#dfddf7;color:#7761df;text-decoration:none;margin:10px 0 0 0;display:inline-block}.chaty-new-widget-row{display:flex;align-items:center}.chaty-new-widget-left{width:322px}.chaty-new-widget-right{padding-left:20px}.chaty-widget-icons-right .tooltip .tooltiptext{line-height:24px}.trigger-block{padding:0;background:#f6f3fa;margin-bottom:4px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;position:relative;flex:calc(100% - 152px);max-width:360px}.chaty-switch{display:inline-block;height:34px;position:relative;padding:0 0 0 50px;line-height:24px}.chaty-switch input{display:none}.chaty-slider{background-color:#cfbde4;bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0;transition:.4s;width:40px;height:24px}.chaty-slider:before{background-color:#fff;bottom:4px;content:"";height:16px;left:4px;position:absolute;transition:.4s;width:16px}.trigger-block-input{font-size:14px}.trigger-block-input input{width:40px}input:checked+.chaty-slider{background-color:#a886cd}input:checked+.chaty-slider:before{transform:translateX(16px)}.chaty-slider.round{border-radius:34px}.chaty-slider.round:before{border-radius:50%}.trigger-option-block{padding:10px;border-bottom:solid 1px #eee2ff}.trigger-option-block:last-child{border-bottom:none}.gmt-data{display:none}.chaty-date-time-option:first-child .gmt-data{display:block}.chaty-date-time-option{padding:5px;background:#f6f3fa;margin-bottom:4px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;position:relative}.chaty-date-time-option.last{margin-bottom:15px}.date-time-content>*{vertical-align:middle;display:inline-block}.day-select{width:25%;display:inline-block;padding-right:5px}.date-time-content input,.date-time-content select{width:100%;height:36px;line-height:36px;padding:0 10px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.day-label{width:50px;padding-right:5px;text-align:right}.day-time{width:10%;padding-right:5px}.day-buttons a{background:#bd2a00;text-align:center;display:inline-block;line-height:36px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;width:36px;height:36px}.main .form-horizontal__item.hide-show-button{display:none}.main .form-horizontal__item.hide-show-button.active{display:flex}.custom-chaty-image{display:none}.chaty-channels .social-item-box .custom-chaty-image{display:none}.chaty-channels .social-item-box .custom-chaty-image img{width:30px;height:30px;object-fit:cover;border-radius:50%}.chaty-channels .social-item-box.img-active .custom-chaty-image{display:block}.chaty-channels .social-item-box .custom-chaty-image,.chaty-channels .social-item-box .default-chaty-icon{width:30px;height:30px;cursor:pointer}.chaty-channels .social-item-box.img-active .default-chaty-icon{display:none}.social-item-box{display:block;height:30px;margin:0 0 5px 0;position:relative}#iconWidget{cursor:pointer}.chaty-channels{display:none}.chaty-widget.active .chaty-channels,.chaty-widget.hover:hover .chaty-channels{display:block}.preview .page .chaty-widget i.chaty-close-icon,.preview .page .chaty-widget.active.hide-arrow i.chaty-close-icon{display:none!important}.preview .page .chaty-widget.active:not(.has-single):not(.hide-arrow) i.chaty-close-icon,.preview .page .chaty-widget.hover:hover:not(.has-single):not(.hide-arrow) i.chaty-close-icon{display:block!important}.preview .page .chaty-widget.active:not(.has-single) i#iconWidget,.preview .page .chaty-widget.hover:hover:not(.has-single) i#iconWidget{display:none!important}.preview .page .chaty-widget.active:not(.has-single) .tooltiptext{display:none!important}.preview .page .chaty-widget.active:not(.has-single) .icon:before{display:none!important}span.social-tooltip{position:absolute;right:100%;background:#fff;padding:0 10px;color:#4f4f4f;top:0;z-index:1001;font-size:12px;margin:0 10px 0 0;border-radius:5px;display:none}.social-item-box:hover span.social-tooltip{display:block}span.social-tooltip:after{content:"";border-width:5px 0 5px 10px;border-style:solid;border-color:transparent transparent transparent #fff;position:absolute;top:6px;right:-9px}.chaty-widget-icons-left span.social-tooltip{margin:0 0 0 14px;left:100%;right:auto}.chaty-widget-icons-left span.social-tooltip:after{content:"";border-style:solid;border-width:5px 10px 5px 0;border-color:transparent #fff transparent transparent;position:absolute;top:12px;right:100%}.chaty-date-time-option input[readonly]{background:#fff}.upgrade-upload-btn .upgrade-link{display:none!important}.upgrade-upload-btn:hover .upgrade-link{display:block!important}.upgrade-upload-btn:hover .custom-control-label,.upgrade-upload-btn:hover .form-group{opacity:.5;filter:blur(2px);-o-filter:blur(2px);-ms-filter:blur(2px);-moz-filter:blur(2px);-webkit-filter:blur(2px)}.read-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}select.chaty-select:disabled,textarea.test_textarea:disabled{background:#eee;border:solid 1px #ddd;color:#32373c;font-size:14px}.widget-icon__block .custom-control.custom-radio.add-border{border-right:1px solid #fff}.upgrade-upload-btn:hover .custom-control-label,.upgrade-upload-btn:hover .form-group{opacity:.5;filter:blur(2px);-o-filter:blur(2px);-ms-filter:blur(2px);-moz-filter:blur(2px);-webkit-filter:blur(2px)}.widget-icon__wrap a.upgrade-link{display:block;font-size:16px;text-align:center;padding-left:0;position:absolute;bottom:35px;right:0;width:70px;text-decoration:none;text-align:center;left:0;margin:0 auto}.upgrade-upload-btn:hover .upgrade-link{display:block!important}.chaty-option-box{flex:calc(100% - 152px)}.chaty-data-and-time-rules{display:none}.chaty-date-time-option:hover .date-time-content{filter:blur(2px);-o-filter:blur(2px);-ms-filter:blur(2px);-moz-filter:blur(2px);-webkit-filter:blur(2px)}.hover.chaty-widget:hover .tooltiptext{display:none!important}.preview .page .hover.chaty-widget:hover .icon:before{display:none!important}span.header-tooltip{position:relative;display:inline-block}span.header-tooltip span.dashicons.dashicons-editor-help{display:inline-block;cursor:pointer}span.header-tooltip-text{display:none;position:absolute;bottom:140%;left:0;width:250px;left:-110px;font-size:12px;font-weight:400;line-height:16px;background:#000;padding:5px;border-radius:5px;color:#fff}span.header-tooltip-text:before{content:"";top:100%;transform:translateX(-50%);height:10px;width:10px;border-width:10px 5px 0;border-style:solid;border-color:#333 transparent transparent;position:absolute;left:0;right:0;margin:0 auto}span.header-tooltip:hover span.header-tooltip-text{display:block}.chaty-animation-pulse{animation:chaty-animation-pulse 1s forwards}.chaty-animation-jump{animation:chaty-animation-jump 1s forwards cubic-bezier(.84,-.54,.31,1.19)}.chaty-animation-waggle{animation:chaty-animation-waggle 1s forwards ease-out}.chaty-animation-sheen{position:relative;overflow:hidden}.chaty-animation-sheen:after{animation:chaty-animation-sheen 1.5s forwards;content:'';position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(to bottom,transparent,rgba(255,255,255,.5) 50%,transparent);transform:rotateZ(60deg) translate(-1em,4em)}.chaty-animation-spin{animation:chaty-animation-spin 1s forwards cubic-bezier(.56,-.35,.22,1.5)}.chaty-animation-fade{animation:chaty-animation-fade 1s forwards}@keyframes chaty-animation-pulse{0%{background-color:orange}25%{background-color:red}50%{background-color:orange}75%{background-color:red}}@keyframes chaty-animation-jump{0%{transform:none}50%{transform:translateY(-.8em)}}@keyframes chaty-animation-waggle{0%{transform:none}50%{transform:rotateZ(-20deg) scale(1.2)}60%{transform:rotateZ(25deg) scale(1.2)}67.5%{transform:rotateZ(-15deg) scale(1.2)}75%{transform:rotateZ(15deg) scale(1.2)}82.5%{transform:rotateZ(-12deg) scale(1.2)}85%{transform:rotateZ(0) scale(1.2)}100%{transform:rotateZ(0) scale(1)}}@keyframes chaty-animation-sheen{100%{transform:rotateZ(60deg) translate(0,-4em)}}@keyframes chaty-animation-spin{50%{transform:rotateZ(-20deg);animation-timing-function:ease}100%{transform:rotateZ(360deg)}}@keyframes chaty-animation-fade{25%{opacity:.25}50%{opacity:1}75%{opacity:.25}100%{opacity:1}}.start-now,.start-now:after{animation-delay:0}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}.modal__wrap{padding:0}.domain{margin:0 0 10px;padding:20px 60px 26px}}@media (min-width:992px){.container{max-width:1070px}}@media (max-width:767px){.position-pro>div{flex:0 0 100%}.main .channels-icons{max-width:95%}.main .channels-selected__item{max-width:100%;margin-bottom:10px;padding-bottom:10px}.main .form-horizontal__item{flex-wrap:wrap}.main .form-horizontal__item>label{flex:0 0 100%;margin-bottom:10px;text-align:left}.main .form-horizontal__item .custom-switch{flex:0 0 auto;margin:10px auto}.main .form-horizontal__item>div{flex:0 0 100%}.main .form-horizontal__item>div .custom-control{margin:0 10px 10px 0}.main .form-horizontal__item>div .custom-control:last-child{margin-right:0}body{background-position:center top;background-size:cover;background-attachment:fixed}.section{padding:30px 15px}.col-12{flex:0 0 auto}.popover{margin-left:0;white-space:normal;max-width:100%}.header{flex-wrap:wrap}.header img{flex:0 0 100%;margin-bottom:10px}.header .ml-auto{margin:0 auto;text-align:center}.header .ml-auto button{margin:5px 6px}}@media (max-width:991px){.form-horizontal{left:0!important}body{background-position:30px 30px;background-repeat:no-repeat;background-size:calc(100% - 20px) auto}.section{padding:30px}.main .channels-selected__item .input-example{left:0;top:40px;position:static;width:100%}.main .channels-selected__item .icon{width:40px;height:40px;margin-right:5px;margin-bottom:5px}.main .channels-selected__item .icon>i{font-size:25px;line-height:40px}.main .channels__input{width:190px}.main .channels__input-box{margin-right:5px;margin-bottom:5px}}@media screen and (max-width:782px){#sticky-wrapper{display:none}.test_textarea{width:250px}}.channels__view{display:inline-block;color:#444;margin-bottom:0;line-height:14px;padding-left:17px;position:relative;font-size:14px;margin-left:15px}.channels__view-check{position:absolute;z-index:-1;opacity:0}.channels__view-check:checked~.channels__view-txt::before{background:#a785cb;color:#fff}.channels__view-check:checked~.channels__view-txt::after{color:#fff;content:"\f147";font-family:dashicons;line-height:1;position:absolute;top:0;left:0}.channels__view-txt:before{content:'';transition:all .2s;position:absolute;top:0;left:0;display:block;width:14px;height:14px;line-height:14px;text-align:center;border:solid 2px #a785cb;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.file-input,.widget-icon__block .custom-control.custom-radio .custom-control-label{position:relative}.channels__input{padding:9px 7px;border:0;line-height:24px;background:#fff;box-shadow:0 4px 14px rgba(0,0,0,.15);border-radius:9px;width:330px}.channels__input-box{position:relative;margin-right:5px}.widget-icon__block [class^=icon-]{display:block;border-radius:100%;text-align:center;width:40px;height:40px;line-height:40px;font-size:20px;margin:0 auto 6px}.widget-icon__block [class^=icon-] svg{color:#fff}.widget-icon__block .icon-upload{background:0 0;color:#a886cd}.widget-icon__block .custom-control.custom-radio{text-align:center;margin:0;padding:22px 8px 42px;text-decoration:none;vertical-align:top;display:inline-block;max-width:70px}.widget-icon__block .custom-control.custom-radio .custom-control-label:before{transform:translateX(-50%);left:50%}.widget-icon__wrap{background:rgba(168,134,205,.1);padding:0;border-radius:4px;flex:none;font-size:0;margin-bottom:25px;position:relative}@media (min-width:768px){.widget-icon__block [class^=icon-]{width:54px;height:54px;font-size:28px;line-height:54px}.widget-icon__block [class^=icon-] svg{width:100%}.widget-icon__block .custom-control.custom-radio:first-child{padding-left:20px;max-width:90px}.widget-icon__block .custom-control.custom-radio:last-child{padding-right:20px}}@media (max-width:767px){.main .form-horizontal__item>.widget-icon__wrap{display:flex;justify-content:space-between}.main .form-horizontal__item>.widget-icon__wrap .custom-control{margin:0;flex:1;text-align:center}}.file-input{width:40px;height:44px;display:block}.file-input input[type=file]{top:0;left:0;min-width:100%;min-height:100%;text-align:right;opacity:0;background:0 0;cursor:pointer;display:block;position:absolute}.btn-file,.form-group,.kv-file-content{position:relative}.form-group:hover :not(.file-input-new) .file-browse{display:block;z-index:10}.file-actions,.file-browse,.file-browse span,.file-drop-zone-title,.file-footer-caption,.file-preview-status{display:none}.form-group:hover :not(.file-input-new) .file-browse .icon-upload{background:rgba(0,0,0,.5)}.kv-file-content{width:40px;height:40px;background:#fff;border-radius:100%;text-align:center;margin:0 auto}.kv-file-content img{width:auto;height:auto;max-width:100%;max-height:100%}.file-preview{position:absolute}.file-preview-thumbnails{width:54px;height:54px;border-radius:100%;position:absolute;left:0;top:0}.file-preview-frame{position:absolute;left:0;top:0;right:0;z-index:10}.file-preview-frame.file-preview-initial{z-index:0}.file-input-new .file-browse{display:block}.file-input-new .file-browse span{display:block;color:#a886cd;text-decoration:underline;position:absolute;bottom:0;left:0;right:0}.file-input-new .file-browse:hover span,a.pro-plugin-url,a.rpt_tooltip{text-decoration:none}@media (min-width:768px){.kv-file-content{width:54px;height:54px}.file-input{width:54px;height:60px}}.preview{width:337px;z-index:99;height:373px;margin-right:15px;float:right;z-index:1001}body.has-premio-box .preview{top:320px}.preview.mobiel-view .page{width:152px}.preview.mobiel-view .page .chaty-widget .icon i{width:24px;height:24px;font-size:12px;line-height:24px}.is-sticky .preview{left:calc(50vw - 480px + 960px / 12 * 7 + 140px)}.preview h2{text-align:center;font-weight:700;line-height:normal;font-size:17px;color:#4f4f4f;margin-bottom:5px}.preview .page{background-color:#f2f2f2;box-shadow:0 4px 35px rgba(0,0,0,.05);border-radius:5px;position:relative;height:194px;margin:0 auto}.preview .page .page-header{display:flex;align-items:center;background:#fff;border-radius:5px 5px 0 0;height:16px}.preview .page .page-header .circle{margin-left:9px;width:6px;height:6px;background:linear-gradient(153.19deg,#6371db 7.06%,#ff89c4 90.47%),#ffe663;box-shadow:0 4px 35px rgba(0,0,0,.05);border-radius:50%}.preview .page .page-header svg:last-child{margin-left:auto;margin-top:7px;margin-right:-7px}.preview .page .chaty-widget{position:absolute;left:auto}.preview .page .chaty-widget .icon:after{z-index:10;content:'';font-size:13px;top:13px;white-space:nowrap;padding:0;line-height:0;width:auto;color:#333;background-color:#fff;box-shadow:0 1.93px 7.74px rgba(0,0,0,.15);border-radius:0;right:0;left:auto;transform:translate(calc(100% + 6px),-50%)}.preview .page .chaty-widget .icon:before{content:'';right:-13px;left:auto;top:15px;transform:translateY(-50%);height:10px;width:10px;z-index:11;border-style:solid;border-width:5px 10px 5px 0;border-color:transparent #fff transparent transparent}.preview .page .chaty-widget .icon i{width:30px;height:30px;font-size:18px;display:block;border-radius:100%;line-height:30px;text-align:center;overflow:hidden}.preview .page .chaty-widget .icon i.icon-chat-image{background:0 0}.preview .page .chaty-widget .icon i.icon-chat-image img{display:block;background:#a886cd}.preview .page .chaty-widget .icon i svg{fill:#fff;width:100%;height:100%}.preview .page .chaty-widget .icon i img{width:auto;height:auto;max-width:100%;max-height:100%}.mobiel-view .preview .page .chaty-widget .icon i{width:23px;height:23px;font-size:13px;line-height:23px}.preview .page .chaty-widget[style*="left: auto;"] .icon:before{right:auto;left:-11px;border-width:5px 0 5px 10px;border-style:solid;border-color:transparent transparent transparent #fff}.preview .page .chaty-widget[style*="left: auto;"] .icon:after{left:0;right:auto;transform:translate(calc(-100% - 6px),-50%)}.switch-preview{display:flex;width:160px;border-radius:5px;margin:15px auto 0;-webkit-box-shadow:0 0 15px 0 #eaeaea inset;-moz-box-shadow:0 0 15px 0 #eaeaea inset;box-shadow:0 0 15px 0 #eaeaea inset;background:#fff}.easy-modal-open,.switch-preview__input[type=radio],.switch-preview__label input{display:none}.switch-preview__label{flex:1;text-align:center;line-height:30px}.switch-preview__input[type=radio]:checked+label{background:#a886cd;color:#fff}html[dir=rtl] .preview{right:auto}html[dir=rtl] .is-sticky .preview{left:calc(50vw - 480px + 960px / 12 * 7 + 84px - 175px)}@media (max-width:1200px){.preview{display:none}}a.pro-plugin-url{color:#fff;background:#7474d9;display:inline-block;margin-bottom:25px;-moz-border-radius:25px;-webkit-border-radius:25px;font-size:24px;border-radius:25px;padding:15px 45px}.test_textarea{-webkit-box-shadow:0 0 15px 0 #eaeaea;-moz-box-shadow:0 0 15px 0 #eaeaea;box-shadow:0 0 15px 0 #eaeaea;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;padding:10px;height:70px;border:solid 1px #f6f6f6;width:100%;max-width:360px}.license-key{border:1px solid #ccc;background:#fff;width:100%;max-width:350px;margin:10px 0 20px}.license-key .license-key-header{border-bottom:1px solid #ccc;padding:15px 12px;font-weight:600;background:#f9f9f9;color:#23282d}.license-key .license-key-content{padding:15px 12px;background:#fff}.license-key .license-key-content input[type=text]{width:100%;font-size:14px;font-weight:400}.license-key .license-key-footer{border-top:1px solid #ccc;padding:15px 12px;background:#f9f9f9}.license-key .license-key-message{margin:10px 0 0;min-height:40px}.license-key .button-secondary{font-weight:400}.testimonial-error-message,.testimonial-success-message{background:#fff;margin:10px 0 0;padding:10px;border-left:solid 3px #dd4b39}.testimonial-success-message{border-left:solid 3px #00a65a}.save-testimonial-license-key{width:102px;text-align:center}.remove-testimonial-license-key{width:128px;text-align:center}.test-error-message{color:#dc3232}.hide-this-table,.lean-overlay{display:none!important}span.expired-message{color:#a00000;font-size:18px}.wrap.wrap-licenses{background:#fff;padding:10px 25px 25px}.chaty-help-btn{position:fixed;right:20px;bottom:20px;z-index:1001}.chaty-help-btn a{display:block;border:3px solid #fff;width:50px;height:50px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;position:relative}.chaty-help-btn a img{width:100%;height:auto;display:block;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.chaty-help-form{position:fixed;right:85px;border:1px solid #e9edf0;bottom:25px;background:#fff;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;width:320px;z-index:1001;direction:ltr;opacity:0;transition:.4s;-webkit-transition:.4s;-moz-transition:.4s}.chaty-help-form.active{opacity:1;pointer-events:inherit}.chaty-help-header{background:#f4f4f4;border-bottom:solid 1px #e9edf0;padding:5px 20px;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px 10px 0 0;font-size:16px;text-align:right}.chaty-help-header b{float:left}.chaty-help-content{margin-bottom:10px;padding:20px 20px 10px}.chaty-help-form p{margin:0 0 1em}.chaty-form-field{margin-bottom:10px}.chaty-form-field input,.chaty-form-field textarea{-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:5px;width:100%;box-sizing:border-box;border:1px solid #c5c5c5}.chaty-form-field textarea{height:70px}.chaty-help-button{border:none;padding:8px 0;width:100%;background:#ff6624;color:#fff;border-radius:18px}.chaty-help-form .error-message{font-weight:400;font-size:14px}.chaty-help-form input.input-error,.chaty-help-form textarea.input-error{border-color:#dc3232}.chaty-help-btn span.tooltiptext{position:absolute;background:#000;font-size:12px;color:#fff;top:-35px;width:140%;text-align:center;left:-20%;border-radius:5px;direction:ltr}p.error-p,p.success-p{margin:0;font-size:14px;text-align:center}.chaty-help-btn span.tooltiptext:after{bottom:-9px;content:"";transform:translateX(-50%);height:10px;width:10px;border-width:10px 5px 0;border-style:solid;border-color:#000 transparent transparent;left:50%;position:absolute}p.success-p{color:green}p.error-p{color:#dc3232}html[dir=rtl] .chaty-help-btn{left:20px;right:auto}html[dir=rtl] .chaty-help-form{left:85px;right:auto}#rpt_container{margin-top:24px;width:100%}.rpt_plans .rpt_plan{-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.rpt_2_plans .rpt_plan{margin-right:2%;width:49%;float:left}.rpt_2_plans .rpt_plan:last-child{margin-right:0}.rpt_3_plans .rpt_plan{margin-right:2%;width:32%;float:left}.rpt_3_plans .rpt_plan:last-child{margin-right:0}.rpt_4_plans .rpt_plan{margin-right:1%;width:24.25%;float:left}.rpt_4_plans .rpt_plan:last-child{margin-right:0}.rpt_5_plans .rpt_plan{margin-right:.5%;width:19.6%;float:left}.rpt_5_plans .rpt_plan:last-child{margin-right:0}.rpt_style_bic .rpt_plan,.rpt_style_loc .rpt_plan{-webkit-box-shadow:1px 1px 3px 0 rgba(50,50,50,.19);-moz-box-shadow:1px 1px 3px 0 rgba(50,50,50,.19);box-shadow:1px 1px 3px 0 rgba(50,50,50,.19)}.rpt_plans .rpt_plan .rpt_title img{margin-right:10px;position:relative;vertical-align:middle}.rpt_plans .rpt_plan .rpt_title{background:#6371db;font-weight:300;padding:24px 18px;font-size:26px;color:#fff;line-height:35px;height:auto}.rpt_plans .rpt_plan .rpt_title span{display:inline-block;position:relative;top:-10px}.rpt_style_basic .rpt_plan .rpt_title{border-bottom:#ec86c6 solid 1px;border-top-left-radius:8px;border-top-right-radius:8px}.rpt_style_spec .rpt_plan .rpt_title{color:#fff}.rpt_style_bic .rpt_plan .rpt_title,.rpt_style_loc .rpt_plan .rpt_title,.rpt_style_swl .rpt_plan .rpt_title{background:#333}.rpt_plans .rpt_sm_title .rpt_plan .rpt_title{font-size:20px;line-height:18px}.rpt_plans .rpt_xsm_title .rpt_plan .rpt_title{font-size:15px;line-height:15px}.rpt_4_plans .rpt_plan .rpt_title{font-size:17px;line-height:15px}.rpt_4_plans .rpt_sm_title .rpt_plan .rpt_title{font-size:15px;line-height:13px}.rpt_4_plans .rpt_xsm_title .rpt_plan .rpt_title{font-size:13px;line-height:11px}.rpt_5_plans .rpt_plan .rpt_title{font-size:15px;line-height:13px}.rpt_5_plans .rpt_sm_title .rpt_plan .rpt_title{font-size:13px;line-height:11px}.rpt_5_plans .rpt_xsm_title .rpt_plan .rpt_title{font-size:12px;line-height:10px}.rpt_plans .rpt_recommended_plan .rpt_title{background:#6371db}.rpt_plans .rpt_plan .rpt_head .rpt_price .rpt_currency{position:relative;top:-44px;left:-10px;font-size:35px;line-height:0}.rpt_4_plans .rpt_plan .rpt_head .rpt_price .rpt_currency{top:-36px}.rpt_5_plans .rpt_plan .rpt_head .rpt_price .rpt_currency{top:-26px}.rpt_sm_price .rpt_plan .rpt_head .rpt_price .rpt_currency{font-size:30px;top:-44px;left:-4px}.rpt_xsm_price .rpt_plan .rpt_head .rpt_price .rpt_currency{font-size:25px;top:-30px;left:-4px}.rpt_xxsm_price .rpt_plan .rpt_head .rpt_price .rpt_currency{font-size:21px;top:-14px;left:-4px}.rpt_style_basic .rpt_plan .rpt_head{background:#ec86c6}.rpt_style_spec .rpt_plan .rpt_head{background:#222}.rpt_style_swl .rpt_plan .rpt_head{background:#fff}.rpt_plans .rpt_plan .rpt_head .rpt_price{padding:6px 10px;font-size:74px;line-height:100px;font-weight:300;text-align:center;color:#fff}.rpt_style_basic .rpt_plan .rpt_head .rpt_price,.rpt_style_spec .rpt_plan .rpt_head .rpt_price{text-shadow:1px 2px 7px rgba(0,0,0,.6)}.rpt_style_swl .rpt_plan .rpt_head .rpt_price{color:#000}.rpt_plans .rpt_sm_price .rpt_plan .rpt_head .rpt_price{font-size:62px}.rpt_plans .rpt_xsm_price .rpt_plan .rpt_head .rpt_price{font-size:56px}.rpt_plans .rpt_xxsm_price .rpt_plan .rpt_head .rpt_price{font-size:38px}.rpt_4_plans .rpt_plan .rpt_head .rpt_price{font-size:69px;line-height:80px}.rpt_4_plans .rpt_sm_price .rpt_plan .rpt_head .rpt_price{font-size:53px;line-height:65px}.rpt_4_plans .rpt_xsm_price .rpt_plan .rpt_head .rpt_price{font-size:47px;line-height:64px}.rpt_4_plans .rpt_xxsm_price .rpt_plan .rpt_head .rpt_price{font-size:31px;line-height:60px}.rpt_5_plans .rpt_plan .rpt_head .rpt_price{font-size:59px;line-height:80px}.rpt_5_plans .rpt_sm_price .rpt_plan .rpt_head .rpt_price{font-size:44px;line-height:60px}.rpt_5_plans .rpt_xsm_price .rpt_plan .rpt_head .rpt_price{font-size:37px;line-height:53px}.rpt_5_plans .rpt_xxsm_price .rpt_plan .rpt_head .rpt_price{font-size:24px;line-height:50px}.rpt_plans .rpt_recommended_plan .rpt_head .rpt_price{font-size:98px}.rpt_4_plans .rpt_recommended_plan .rpt_head .rpt_price{font-size:74px}.rpt_5_plans .rpt_recommended_plan .rpt_head .rpt_price{font-size:67px}.rpt_plans .rpt_sm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:83px}.rpt_4_plans .rpt_sm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:60px}.rpt_5_plans .rpt_sm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:54px}.rpt_plans .rpt_xsm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:55px}.rpt_4_plans .rpt_xsm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:49px}.rpt_5_plans .rpt_xsm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:41px}.rpt_plans .rpt_xxsm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:42px}.rpt_4_plans .rpt_xxsm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:34px}.rpt_5_plans .rpt_xxsm_price .rpt_recommended_plan .rpt_head .rpt_price{font-size:26px}.rpt_plans .rpt_plan .rpt_head .rpt_recurrence{font-size:13px;font-weight:300;line-height:18px;padding:20px 40px 10px;color:#d3d3d3;text-align:center}.rpt_style_spec .rpt_plan .rpt_head .rpt_recurrence{color:#d3d3d3}.rpt_style_bic .rpt_plan .rpt_head .rpt_recurrence,.rpt_style_loc .rpt_plan .rpt_head .rpt_recurrence{color:#f5f5f5}.rpt_style_swl .rpt_plan .rpt_head .rpt_recurrence{color:grey}.rpt_plans .rpt_sm_recurrence .rpt_plan .rpt_head .rpt_recurrence{font-size:11px;padding:20px 40px 4px}.rpt_plans .rpt_plan .rpt_head .rpt_subtitle{font-size:16px;line-height:20px;font-weight:300;text-align:center;padding:10px 30px 20px}.rpt_plans .rpt_sm_subtitle .rpt_plan .rpt_head .rpt_subtitle{font-size:14px}.rpt_plans .rpt_xsm_subtitle .rpt_plan .rpt_head .rpt_subtitle{font-size:12px}.rpt_4_plans .rpt_plan .rpt_head .rpt_subtitle{font-size:16px;line-height:18px;padding:10px 10px 20px}.rpt_4_plans .rpt_sm_subtitle .rpt_plan .rpt_head .rpt_subtitle{font-size:14px;line-height:17px}.rpt_4_plans .rpt_xsm_subtitle .rpt_plan .rpt_head .rpt_subtitle{font-size:13px;line-height:16px}.rpt_5_plans .rpt_plan .rpt_head .rpt_subtitle{font-size:15px;line-height:18px;padding:10px 10px 20px}.rpt_5_plans .rpt_sm_subtitle .rpt_plan .rpt_head .rpt_subtitle{font-size:13px;line-height:17px}.rpt_5_plans .rpt_xsm_subtitle .rpt_plan .rpt_head .rpt_subtitle{font-size:12px;line-height:16px}.rpt_plans .rpt_plan .rpt_head .rpt_description{font-size:14px;line-height:20px;padding:0 20px 30px;font-weight:300;text-align:center;color:#fff}.rpt_plans .rpt_sm_description .rpt_plan .rpt_head .rpt_description{font-size:12px}.rpt_style_bic .rpt_plan .rpt_head .rpt_description,.rpt_style_loc .rpt_plan .rpt_head .rpt_description{color:#f5f5f5}.rpt_4_plans .rpt_plan .rpt_head .rpt_description{font-size:13px;line-height:18px}.rpt_4_plans .rpt_sm_description .rpt_plan .rpt_head .rpt_description{font-size:12px;line-height:17px}.rpt_5_plans .rpt_plan .rpt_head .rpt_description{font-size:12px;line-height:18px}.rpt_5_plans .rpt_sm_description .rpt_plan .rpt_head .rpt_description{font-size:11px;line-height:17px}.rpt_plans .rpt_plan .rpt_features{padding:20px;background:#f5f5f5;text-align:center}.rpt_plans .rpt_plan .rpt_features .rpt_feature{font-size:16px;padding:6px 16px;border-bottom:1px dotted #d3d3d3}.rpt_plans .rpt_plan .rpt_features .rpt_feature:last-child{border-bottom:none}.rpt_plans .rpt_sm_features .rpt_plan .rpt_features .rpt_feature{font-size:14px}.rpt_style_bic .rpt_plan .rpt_features,.rpt_style_loc .rpt_plan .rpt_features,.rpt_style_swl .rpt_plan .rpt_features{background:#fff}.rpt_style_swl .rpt_plan .rpt_features .rpt_feature{padding:5px 16px}.rpt_4_plans .rpt_plan .rpt_features .rpt_feature{padding:6px 10px;font-size:14px}.rpt_4_plans .rpt_sm_features .rpt_plan .rpt_features .rpt_feature{font-size:12px}.rpt_5_plans .rpt_plan .rpt_features .rpt_feature{padding:6px 10px;font-size:13px}.rpt_5_plans .rpt_sm_features .rpt_plan .rpt_features .rpt_feature{font-size:11px}.rpt_plans .rpt_plan .rpt_foot{display:block;padding:10px 30px;border-top:#f5f5f5 solid 2px;text-align:center;color:#fff;font-size:24px;text-decoration:none;font-weight:300;transition:All .5s ease;-webkit-transition:All .5s ease;-moz-transition:All .5s ease;-o-transition:All .5s ease}.rpt_plans .rpt_sm_button .rpt_plan .rpt_foot{font-size:19px}.rpt_style_basic .rpt_plan .rpt_foot{border-bottom-left-radius:8px;border-bottom-right-radius:8px}.rpt_style_swl .rpt_plan .rpt_foot{border-top:none;padding:10px 30px 20px;color:#000;background:#333}.rpt_4_plans .rpt_plan .rpt_foot{padding:4px 20px;font-size:19px}.rpt_4_plans .rpt_sm_button .rpt_plan .rpt_foot,.rpt_5_plans .rpt_plan .rpt_foot{padding:4px 20px;font-size:17px}.rpt_5_plans .rpt_sm_button .rpt_plan .rpt_foot{font-size:16px}.rpt_plans .rpt_plan .rpt_foot:hover{opacity:.8}.rpt_style_swl .rpt_plan .rpt_foot:hover{opacity:1}.rpt_plans .rpt_recommended_plan .rpt_foot{font-size:30px;padding:16px 0}.rpt_plans .rpt_sm_button .rpt_recommended_plan .rpt_foot{font-size:26px}.rpt_4_plans .rpt_recommended_plan .rpt_foot{font-size:22px;font-weight:300;padding:10px 0}.rpt_4_plans .rpt_sm_button .rpt_recommended_plan .rpt_foot{font-size:19px;padding:10px 0}.rpt_5_plans .rpt_recommended_plan .rpt_foot{font-size:20px;font-weight:300;padding:10px 0}.rpt_5_plans .rpt_sm_button .rpt_recommended_plan .rpt_foot{font-size:18px;padding:10px 0}.rpt_custom_btn{border-bottom-left-radius:5px;border-bottom-right-radius:5px;text-align:center;padding:16px 20px}.rpt_plans .rpt_recommended_plan{position:relative;top:-10px}.rpt_recommended_plan img.rpt_recommended{position:absolute!important;right:10px!important}.rpt_style_bic .rpt_recommended_plan,.rpt_style_loc .rpt_recommended_plan{-webkit-box-shadow:1px 1px 6px 0 rgba(50,50,50,.39);-moz-box-shadow:1px 1px 6px 0 rgba(50,50,50,.39);box-shadow:1px 1px 6px 0 rgba(50,50,50,.39)}a.rpt_tooltip{display:block;outline:0;position:relative}a.rpt_tooltip strong{line-height:30px}a.rpt_tooltip>span.intool{width:90%;padding:10px;margin-top:56px;opacity:0;visibility:hidden;z-index:10;position:absolute;top:-15px;display:block;color:#f5f5f5;font-size:13px;line-height:20px;background:#333;font-weight:300;text-align:center}a.rpt_tooltip:hover{cursor:zoom-in}a.rpt_tooltip .rpt_tooltip_plus{text-decoration:none!important;display:inline;font-size:12px;font-weight:700;position:relative;top:-6px}.rpt_feature:hover a.rpt_tooltip>span.intool{opacity:.98;text-decoration:none;visibility:visible;overflow:visible}a.rpt_tooltip span.intool b{width:10px;height:10px;margin-left:35%;margin-top:-15px;position:absolute;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg);display:none \0/;background:#333}.rpt_3_plans a.rpt_tooltip>span.intool{margin-left:-1%}.rpt_4_plans a.rpt_tooltip>span.intool{margin-left:0}.rpt_5_plans a.rpt_tooltip>span.intool{margin-left:-2%}.entry-content .rpt_plan a,.rpt_plan a{border-bottom:none!important}.rpt_plans .rpt_plan .rpt_icon{max-width:30px;max-height:30px}.rpt_plans .rpt_plan img{display:inline;margin:0 10px 0 0;padding:0;-webkit-box-shadow:0 0 0 0 transparent;-moz-box-shadow:0 0 0 0 transparent;box-shadow:0 0 0 0 transparent;border:none}.chaty-new-widget-wrap{background:#f9fcfc url(../images/new_widget_bg.png) no-repeat left center;border-radius:10px;padding:30px 20px;margin:40px 30px 0 0;background-size:auto 100%}.chaty-new-widget-wrap .h2{margin:0 0 20px;font-size:20px;color:#4f4f4f;line-height:1.4;font-weight:700}.chaty-new-widget-right p{font-size:14px;line-height:1.2;color:#4f4f4f;margin-top:0}.chaty-new-widget-right p strong{font-weight:700;font-size:16px}.chaty-new-widget-right li{font-size:14px;color:#727d81;position:relative;padding-left:20px;line-height:1.7;margin-bottom:10px}.chaty-new-widget-right li::before{content:"";position:absolute;top:5px;left:0;background-color:#7761df;width:10px;height:10px;border-radius:50%}.chaty-new-widget-right .upgrade-chatys a{font-size:14px;padding:10px 26px;border-radius:40px;background:#dfddf7;color:#7761df;text-decoration:none;margin:10px 0 0 0;display:inline-block;text-transform:uppercase;font-weight:700}.chaty-new-widget-row{display:flex;align-items:center}.chaty-new-widget-left{width:322px}.chaty-new-widget-right{padding-left:20px}select.chaty-select,select.form-fonts{width:360px;max-width:100%;border:none;color:#32373c;outline:0;padding:5px 7px;line-height:26px;background-color:#fff;border-radius:5px;height:36px;-webkit-box-shadow:0 0 15px 0 #eaeaea;-moz-box-shadow:0 0 15px 0 #eaeaea;box-shadow:0 0 15px 0 #eaeaea}select.chaty-select:disabled,textarea.test_textarea:disabled{background:#eee;border:solid 1px #ddd;color:#32373c}.icon.label-tooltip{font-size:12px;font-weight:400;color:#72777c}.icon.label-tooltip:after{width:250px;white-space:normal;line-height:16px;padding:10px}@media only screen and (max-width:640px){.rpt_plans .rpt_plan{width:96%;margin:10px 2% 20px!important}.rpt_plans .rpt_plan .rpt_title{position:relative;font-size:26px!important;line-height:35px!important}.rpt_plans .rpt_plan .rpt_head .rpt_price{font-size:74px!important;line-height:100px!important}.rpt_plans .rpt_plan .rpt_head .rpt_subtitle{font-size:17px!important;line-height:28px!important;padding:10px 40px 20px}.rpt_plans .rpt_plan .rpt_head .rpt_description{font-size:15px!important;line-height:26px!important;padding:0 40px 30px}.rpt_plans .rpt_plan .rpt_features .rpt_feature{padding:6px 16px;font-size:14px!important}.rpt_plans .rpt_plan .rpt_foot{padding:10px 40px;text-align:center;color:#fff;font-size:20px}.rpt_plans .rpt_recommended_plan .rpt_foot{font-size:30px;font-weight:300;padding:20px 0}.rpt_plan .rpt_head .rpt_price .rpt_currency{top:-36px!important;left:-10px!important;font-size:35px!important}}#rpt_pricr .rpt_plan_ori .rpt_features .rpt_feature,#rpt_pricr .rpt_plan_ori .rpt_features .rpt_feature a,#rpt_pricr .rpt_plan_ori .rpt_foot,#rpt_pricr .rpt_plan_ori .rpt_head .rpt_description,#rpt_pricr .rpt_plan_ori .rpt_head .rpt_price,#rpt_pricr .rpt_plan_ori .rpt_head .rpt_price .rpt_currency,#rpt_pricr .rpt_plan_ori .rpt_head .rpt_recurrence,#rpt_pricr .rpt_plan_ori .rpt_head .rpt_subtitle,#rpt_pricr .rpt_plan_ori .rpt_title{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif!important;font-weight:300!important}p.udner-title strong{font-size:40px;padding-bottom:30px;display:block;color:#b97fcf}.channels-selected-list li{display:block;max-width:640px;padding:15px;background:#eff6f6;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;margin-bottom:15px}.chaty-settings a{text-decoration:none;display:inline-block;color:#fff;margin-left:5px;height:26px;width:26px;background:#ff6624;text-align:center;line-height:36px;vertical-align:middle;-webkit-border-radius:18px;-moz-border-radius:18px;border-radius:18px}.chaty-settings a .dashicons,.chaty-settings a .dashicons-before:before{font-size:16px;line-height:26px;display:block;margin:0;width:100%}.move-icon{display:inline-block;vertical-align:middle}.move-icon img{width:10px;margin-right:5px;margin-top:8px;cursor:move}.chaty-default-settings>*{display:inline-block;vertical-align:middle}.chaty-default-settings{display:flex;align-items:center;flex-wrap:wrap;position:relative;padding-bottom:15px}.chaty-advance-settings{width:100%;border:solid 1px #a785cb;margin:20px 0 0 0;padding:10px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;background:#f2f2f2;display:none;min-height:70px;position:relative}.chaty-setting-col>*{display:inline-block;padding:0 0 10px 0;vertical-align:middle}.chaty-setting-col>label{width:150px}.chaty-setting-col .channels__view{margin:0;padding:0}.chaty-setting-col input[type=text]{width:300px;height:36px;line-height:36px;padding:0 10px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.sp-replacer.sp-light{padding:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:none}.chaty-setting-col a.upload-chaty-icon{background:#a886cd;color:#fff;text-decoration:none;line-height:36px;padding:0 10px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;display:inline-block}.chaty-setting-col a.upload-chaty-icon span{line-height:40px}.chaty-setting-col input[type=text].chaty-color-field{width:40px}.chaty-setting-col input[type=text]:read-only{background:#fff}.chaty-pro-feature{position:absolute;left:0;width:100%;text-align:center;top:0;height:100%;vertical-align:middle;background:rgba(255,255,255,.4);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;display:none}.chaty-advance-settings:hover .chaty-pro-feature,.chaty-date-time-option:hover .chaty-pro-feature{display:inline-block}.chaty-pro-feature a{text-decoration:none;background:#ff6624;color:#fff;padding:0 10px;line-height:36px;display:inline-block;top:50%;position:absolute;left:0;right:0;width:180px;margin:-20px auto 0;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.chaty-pro-feature a:hover{background:#a886cd}a#upload_qr_code{background:#fff;display:inline-block;height:40px;width:40px;text-align:center;line-height:40px;text-decoration:none}a#upload_qr_code span{line-height:36px}.close-btn-set,.cls-btn-settings{opacity:0;visibility:hidden;pointer-events:none}.close-btn-set.active,.cls-btn-settings.active{opacity:1;visibility:visible;pointer-events:auto}.chaty-settings.cls-btn{margin-left:164px}.section2{padding:25px 15px 30px;border-top:2px solid rgba(130,130,130,.1)}#chaty-social-close{display:none}#chaty-social-Facebook_Messenger .chaty-default-settings{padding-bottom:25px}ul#channels-selected-list{margin:0;padding:0}.channels-selected-list li.ui-chaty-state-hl{border:dashed 1px #6972da;min-height:95px}.viber-help{position:absolute;right:43px;bottom:-4px;font-size:12px;color:#665cac;text-decoration:underline;cursor:pointer}.viber-help span{position:absolute;width:210px;left:-80%;text-align:center;background:#000;padding:5px;color:#fff;font-size:12px;bottom:20px;z-index:101;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;display:none}.viber-help:hover span{display:block}a.create-rule{background:#ff6624;text-decoration:none;padding:5px 20px;color:#fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.chaty-settings.cls-btn span{padding-left:2px}.rpt_description.title-text{padding:25px 0 0!important;display:block!important}.chaty-page-option{padding:5px;background:#f6f3fa;margin-bottom:15px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;position:relative}.url-select{width:17%;display:inline-block;padding-right:5px}.url-content>*{vertical-align:middle}.url-option{width:20%;display:inline-block;padding-right:5px}.url-box{width:25%;display:inline-block;padding-right:0;text-align:right}.url-values{width:calc(37% - 46px);display:inline-block;padding-right:5px}.day-buttons,.url-buttons{width:36px;display:inline-block;float:right;padding:2px 0 0 0}span.chaty-url{font-size:12px;line-height:12px}.url-content .remove-chaty{background:#bd2a00;text-align:center;display:block;line-height:36px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.url-content input,.url-content select{width:100%;height:36px;line-height:36px;padding:0 10px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.chaty-option-box .page-options:hover .chaty-page-option{filter:blur(2px);-o-filter:blur(2px);-ms-filter:blur(2px);-moz-filter:blur(2px);-webkit-filter:blur(2px)}.page-options{position:relative;display:none}.chaty-option-box .page-options:hover .chaty-pro-feature{display:block}.preview{position:fixed;top:190px;width:337px;height:290px;bottom:auto}.preview-section-chaty{position:static;width:352px;height:320px;display:block;vertical-align:baseline;float:right}select.multiple-options{max-width:100%}.rpt_plan.pro-active .rpt_head{padding-bottom:50px}.rpt_plan.pro-active .rpt_head .rpt_description{display:none}.updates-form-form{min-height:calc(100vh - 280px)}.popup-form-content{background:#fff;min-height:100px;width:450px;text-align:center;margin-top:50px;border:solid 1px #c1c1c1}.updates-content-buttons button{margin:10px 3px!important;float:left}.updates-content-buttons a span{-webkit-animation:fa-spin .75s infinite linear;animation:fa-spin .75s infinite linear}.updates-content-buttons a:focus,.updates-content-buttons a:hover{color:#fff;background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.updates-content-buttons a:focus{outline:0;box-shadow:0 0 0 2px #fff,0 0 0 4px rgba(50,100,150,.4)}.updates-content-buttons button.form-cancel-btn{float:right!important}.form-submit-btn{background-color:#3085d6}.updates-content-buttons a span{-webkit-animation:fa-spin .75s infinite linear;animation:fa-spin .75s infinite linear}.add-update-folder-title{font-size:20px;line-height:30px;padding:20px 20px 0}.folder-form-input{padding:10px 20px}.folder-form-input input{width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;font-size:1.125em;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);box-sizing:border-box;height:2.625em;margin:1em auto}.updates-content-buttons{background:#c1c1c1;padding:0 20px}.notice.chaty-notice{display:block!important}.preview .h2{padding:40px 0 10px 0;text-align:center;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__rendered{line-height:36px!important}.select2-container{width:300px!important}.select2-container--default .select2-selection--single{border:1px solid #ddd;height:38px;line-height:38px}.select2-container--default .select2-selection--single .select2-selection__arrow{height:36px}.select2-results i,.selection i{color:#333}.pro-features{position:relative;display:inline-flex}.pro-item{position:relative}.pro-button{display:none;position:absolute;width:100%;top:0;left:0;height:100%;line-height:36px;text-align:center}.pro-button a{display:block;line-height:36px}.pro-features:hover .pro-item{opacity:.25;filter:blur(2px);-o-filter:blur(2px);-ms-filter:blur(2px);-moz-filter:blur(2px);-webkit-filter:blur(2px)}.pro-features:hover .pro-button{display:block}.sp-replacer.sp-light{padding:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:none}.sp-preview{padding:0;margin:0 5px 0 0;height:40px;width:40px;border:none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.sp-preview-inner{-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.sp-dd{display:none}span.facustom-icon{display:block;width:50px;height:50px;font-size:30px;line-height:50px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}span.default-chaty-icon .facustom-icon{display:none}span.default-chaty-icon.has-fa-icon .facustom-icon{display:block}span.default-chaty-icon.has-fa-icon svg{display:none}.preview .page .chaty-widget span.facustom-icon{width:30px;height:30px;line-height:30px;font-size:20px}.preview .page .chaty-widget span.facustom-icon i{line-height:30px;font-size:18px}.preview.mobiel-view .page .chaty-widget span.facustom-icon{width:24px;height:24px;line-height:24px;font-size:12px}.preview.mobiel-view .page .chaty-widget svg{width:24px;height:24px}.preview.mobiel-view .page .chaty-widget span.facustom-icon i{line-height:24px;font-size:14px}.preview.mobiel-view .page .chaty-widget .social-item-box{height:24px;margin:0 0 4px 0}label.custom-control.custom-radio:before{display:none}.channels-selected-list li#chaty-social-Poptin{padding-bottom:30px}.chaty-popup{position:fixed;width:100%;height:100%;top:0;left:0;z-index:100001;background:rgba(0,0,0,.75)}.chaty-popup-box{padding:0;width:600px;max-width:100%;margin:auto;top:50%;position:absolute;left:0;right:0;border-radius:5px;transform:translate(0,-50%);-webkit-transform:translate(0,-50%);-moz-transform:translate(0,-50%);text-align:center;background:#fcfcfc}.chaty-popup-header{padding:15px;font-size:20px;border-bottom:solid 1px #e6e6e6}.chaty-popup-content{background:#fff;padding:15px}.chaty-popup-content iframe{margin:30px 0}.chaty-popup-footer{padding:15px;border-top:solid 1px #e6e6e6}.chaty-popup-footer button{border:none;padding:10px 20px;border-radius:4px;background:#00c478;color:#fff}.close-chaty-popup{margin:0;padding:0;background:0 0;border:none;float:right;background:#000;border-radius:50%;color:#fff;text-align:center;width:24px;height:24px}
|
admin/assets/js/cht-scripts.js
ADDED
@@ -0,0 +1,1648 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* easyModal.js v1.3.2
|
3 |
+
* A minimal jQuery modal that works with your CSS.
|
4 |
+
* Author: Flavius Matis - http://flaviusmatis.github.com/
|
5 |
+
* URL: https://github.com/flaviusmatis/easyModal.js
|
6 |
+
*
|
7 |
+
* Copyright 2012, Flavius Matis
|
8 |
+
* Released under the MIT license.
|
9 |
+
* http://flaviusmatis.github.com/license.html
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* jslint browser: true */
|
13 |
+
/* global jQuery */
|
14 |
+
|
15 |
+
jQuery(document).ready(function () {
|
16 |
+
var chatyError;
|
17 |
+
jQuery("#cht-form").submit(function () {
|
18 |
+
set_social_channel_order();
|
19 |
+
phoneNumberReg = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/;
|
20 |
+
if (jQuery("#cht-form #Whatsapp").length && jQuery("#cht-form #Whatsapp").val() != "") {
|
21 |
+
InputVal = jQuery.trim(jQuery("#cht-form #Whatsapp").val());
|
22 |
+
chatyError = check_for_number_chaty(InputVal, "Whatsapp");
|
23 |
+
if(chatyError) {
|
24 |
+
if(!confirm("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
25 |
+
jQuery("#cht-form #Whatsapp").focus();
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
if (jQuery("#cht-form #Phone").length && jQuery("#cht-form #Phone").val() != "") {
|
31 |
+
InputVal = jQuery.trim(jQuery("#cht-form #Phone").val());
|
32 |
+
chatyError = check_for_number_chaty(InputVal, "Phone");
|
33 |
+
if(chatyError) {
|
34 |
+
if(!confirm("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
35 |
+
jQuery("#cht-form #Phone").focus();
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
if (jQuery("#cht-form #Facebook_Messenger").length && jQuery("#cht-form #Facebook_Messenger").val() != "") {
|
41 |
+
faceBookMeReg = /(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
|
42 |
+
faceBookReg = /(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
|
43 |
+
InputVal = jQuery.trim(jQuery("#Facebook_Messenger").val());
|
44 |
+
jQuery("#cht-form #Facebook_Messenger").val(InputVal);
|
45 |
+
if (!faceBookReg.test(InputVal) && !faceBookMeReg.test(InputVal)) {
|
46 |
+
alert("Please make sure your Facebook page's URL looks like, \nhttps://m.me/YOURPAGE");
|
47 |
+
jQuery("#cht-form #Facebook_Messenger").focus();
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
if (jQuery("#cht-form #SMS").length && jQuery("#cht-form #SMS").val() != "") {
|
52 |
+
InputVal = jQuery.trim(jQuery("#cht-form #SMS").val());
|
53 |
+
chatyError = check_for_number_chaty(InputVal, "SMS");
|
54 |
+
if(chatyError) {
|
55 |
+
if(!confirm("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
56 |
+
jQuery("#cht-form #SMS").focus();
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
if (jQuery("#cht-form #Viber").length && jQuery("#cht-form #Viber").val() != "") {
|
62 |
+
InputVal = jQuery.trim(jQuery("#cht-form #Viber").val());
|
63 |
+
chatyError = check_for_number_chaty(InputVal, "Viber");
|
64 |
+
if(chatyError) {
|
65 |
+
if(!confirm("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
66 |
+
jQuery("#cht-form #Viber").focus();
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
errorCount = 0;
|
72 |
+
if (jQuery("#chaty-page-options .cht-required").length) {
|
73 |
+
jQuery("#chaty-page-options .cht-required").each(function () {
|
74 |
+
if (jQuery.trim(jQuery(this).val()) == "") {
|
75 |
+
jQuery(this).addClass("cht-input-error");
|
76 |
+
errorCount++;
|
77 |
+
}
|
78 |
+
});
|
79 |
+
}
|
80 |
+
if (jQuery(".chaty-data-and-time-rules .cht-required").length) {
|
81 |
+
jQuery(".chaty-data-and-time-rules .cht-required").each(function () {
|
82 |
+
if (jQuery.trim(jQuery(this).val()) == "") {
|
83 |
+
jQuery(this).addClass("cht-input-error");
|
84 |
+
errorCount++;
|
85 |
+
}
|
86 |
+
});
|
87 |
+
}
|
88 |
+
if (errorCount != 0) {
|
89 |
+
return false;
|
90 |
+
} else {
|
91 |
+
var inputError = 0;
|
92 |
+
if(jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
|
93 |
+
jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
|
94 |
+
if(jQuery.trim(jQuery(this).val()) == "") {
|
95 |
+
inputError++;
|
96 |
+
}
|
97 |
+
});
|
98 |
+
if(inputError == jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
|
99 |
+
if(confirm("You need to fill out at least one channel details for Chaty to show up on your website. Click cancel to keep editing.")) {
|
100 |
+
return true;
|
101 |
+
} else {
|
102 |
+
jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
|
103 |
+
if(jQuery.trim(jQuery(this).val()) == "") {
|
104 |
+
inputError = 1;
|
105 |
+
}
|
106 |
+
});
|
107 |
+
jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").addClass("border-red");
|
108 |
+
jQuery("#channels-selected-list > li:not(#chaty-social-close) .channels__input:first").focus();
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
return true;
|
115 |
+
});
|
116 |
+
});
|
117 |
+
|
118 |
+
function check_for_number_chaty(phoneNumber, validationFor) {
|
119 |
+
if (phoneNumber != "") {
|
120 |
+
if (phoneNumber[0] == "+") {
|
121 |
+
phoneNumber = phoneNumber.substr(1, phoneNumber.length)
|
122 |
+
}
|
123 |
+
if (validationFor == "Phone") {
|
124 |
+
if (phoneNumber[0] == "*") {
|
125 |
+
phoneNumber = phoneNumber.substr(1, phoneNumber.length)
|
126 |
+
}
|
127 |
+
}
|
128 |
+
if (isNaN(phoneNumber)) {
|
129 |
+
return true;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
return false;
|
133 |
+
}
|
134 |
+
|
135 |
+
(function ($, sr) {
|
136 |
+
var debounce = function (func, threshold, execAsap) {
|
137 |
+
var timeout;
|
138 |
+
|
139 |
+
return function debounced() {
|
140 |
+
var obj = this;
|
141 |
+
var
|
142 |
+
args = arguments;
|
143 |
+
|
144 |
+
function delayed() {
|
145 |
+
if (!execAsap) func.apply(obj, args);
|
146 |
+
timeout = null;
|
147 |
+
}
|
148 |
+
|
149 |
+
if (timeout) clearTimeout(timeout);
|
150 |
+
else if (execAsap) func.apply(obj, args);
|
151 |
+
|
152 |
+
timeout = setTimeout(delayed, threshold || 100);
|
153 |
+
};
|
154 |
+
};
|
155 |
+
// smartModalResize
|
156 |
+
jQuery.fn[sr] = function (fn) {
|
157 |
+
return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
|
158 |
+
};
|
159 |
+
}(jQuery, 'smartModalResize'));
|
160 |
+
|
161 |
+
(function ($) {
|
162 |
+
'use strict';
|
163 |
+
|
164 |
+
var methods = {
|
165 |
+
init: function (options) {
|
166 |
+
var defaults = {
|
167 |
+
top: 'auto',
|
168 |
+
left: 'auto',
|
169 |
+
autoOpen: false,
|
170 |
+
overlayOpacity: 0.5,
|
171 |
+
overlayColor: '#000',
|
172 |
+
overlayClose: true,
|
173 |
+
overlayParent: 'body',
|
174 |
+
closeOnEscape: true,
|
175 |
+
closeButtonClass: '.close',
|
176 |
+
transitionIn: '',
|
177 |
+
transitionOut: '',
|
178 |
+
onOpen: false,
|
179 |
+
onClose: false,
|
180 |
+
zIndex: function () {
|
181 |
+
return (function (value) {
|
182 |
+
return value === -Infinity ? 0 : value + 1;
|
183 |
+
}(Math.max.apply(Math, $.makeArray(jQuery('*').map(function () {
|
184 |
+
return jQuery(this).css('z-index');
|
185 |
+
}).filter(function () {
|
186 |
+
return $.isNumeric(this);
|
187 |
+
}).map(function () {
|
188 |
+
return parseInt(this, 10);
|
189 |
+
})))));
|
190 |
+
},
|
191 |
+
updateZIndexOnOpen: true,
|
192 |
+
hasVariableWidth: false
|
193 |
+
};
|
194 |
+
|
195 |
+
options = $.extend(defaults, options);
|
196 |
+
|
197 |
+
return this.each(function () {
|
198 |
+
var o = options;
|
199 |
+
|
200 |
+
|
201 |
+
var $overlay = jQuery('<div class="lean-overlay"></div>');
|
202 |
+
|
203 |
+
|
204 |
+
var $modal = jQuery(this);
|
205 |
+
|
206 |
+
$overlay.css({
|
207 |
+
display: 'none',
|
208 |
+
position: 'fixed',
|
209 |
+
// When updateZIndexOnOpen is set to true, we avoid computing the z-index on initialization,
|
210 |
+
// because the value would be replaced when opening the modal.
|
211 |
+
'z-index': (o.updateZIndexOnOpen ? 0 : o.zIndex()),
|
212 |
+
top: 0,
|
213 |
+
left: 0,
|
214 |
+
height: '100%',
|
215 |
+
width: '100%',
|
216 |
+
background: o.overlayColor,
|
217 |
+
opacity: o.overlayOpacity,
|
218 |
+
overflow: 'auto'
|
219 |
+
}).appendTo(o.overlayParent);
|
220 |
+
|
221 |
+
$modal.css({
|
222 |
+
display: 'none',
|
223 |
+
position: 'fixed',
|
224 |
+
// When updateZIndexOnOpen is set to true, we avoid computing the z-index on initialization,
|
225 |
+
// because the value would be replaced when opening the modal.
|
226 |
+
'z-index': (o.updateZIndexOnOpen ? 0 : o.zIndex() + 1),
|
227 |
+
left: parseInt(o.left, 10) > -1 ? o.left + 'px' : 50 + '%',
|
228 |
+
top: parseInt(o.top, 10) > -1 ? o.top + 'px' : 50 + '%'
|
229 |
+
});
|
230 |
+
|
231 |
+
$modal.bind('openModal', function () {
|
232 |
+
var overlayZ = o.updateZIndexOnOpen ? o.zIndex() : parseInt($overlay.css('z-index'), 10);
|
233 |
+
|
234 |
+
|
235 |
+
var modalZ = overlayZ + 1;
|
236 |
+
|
237 |
+
if (o.transitionIn !== '' && o.transitionOut !== '') {
|
238 |
+
$modal.removeClass(o.transitionOut).addClass(o.transitionIn);
|
239 |
+
}
|
240 |
+
$modal.css({
|
241 |
+
display: 'block',
|
242 |
+
'margin-left': (parseInt(o.left, 10) > -1 ? 0 : -($modal.outerWidth() / 2)) + 'px',
|
243 |
+
'margin-top': (parseInt(o.top, 10) > -1 ? 0 : -($modal.outerHeight() / 2)) + 'px',
|
244 |
+
'z-index': modalZ
|
245 |
+
});
|
246 |
+
|
247 |
+
$overlay.css({'z-index': overlayZ, display: 'block'});
|
248 |
+
|
249 |
+
if (o.onOpen && typeof o.onOpen === 'function') {
|
250 |
+
// onOpen callback receives as argument the modal window
|
251 |
+
o.onOpen($modal[0]);
|
252 |
+
}
|
253 |
+
});
|
254 |
+
|
255 |
+
$modal.bind('closeModal', function () {
|
256 |
+
if (o.transitionIn !== '' && o.transitionOut !== '') {
|
257 |
+
$modal.removeClass(o.transitionIn).addClass(o.transitionOut);
|
258 |
+
$modal.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
|
259 |
+
$modal.css('display', 'none');
|
260 |
+
$overlay.css('display', 'none');
|
261 |
+
});
|
262 |
+
} else {
|
263 |
+
$modal.css('display', 'none');
|
264 |
+
$overlay.css('display', 'none');
|
265 |
+
}
|
266 |
+
if (o.onClose && typeof o.onClose === 'function') {
|
267 |
+
// onClose callback receives as argument the modal window
|
268 |
+
o.onClose($modal[0]);
|
269 |
+
}
|
270 |
+
});
|
271 |
+
|
272 |
+
// Close on overlay click
|
273 |
+
$overlay.click(function () {
|
274 |
+
if (o.overlayClose) {
|
275 |
+
$modal.trigger('closeModal');
|
276 |
+
}
|
277 |
+
});
|
278 |
+
|
279 |
+
jQuery(document).keydown(function (e) {
|
280 |
+
// ESCAPE key pressed
|
281 |
+
if (o.closeOnEscape && e.keyCode === 27) {
|
282 |
+
$modal.trigger('closeModal');
|
283 |
+
}
|
284 |
+
});
|
285 |
+
|
286 |
+
jQuery(window).smartModalResize(function () {
|
287 |
+
if (o.hasVariableWidth) {
|
288 |
+
$modal.css({
|
289 |
+
'margin-left': (parseInt(o.left, 10) > -1 ? 0 : -($modal.outerWidth() / 2)) + 'px',
|
290 |
+
'margin-top': (parseInt(o.top, 10) > -1 ? 0 : -($modal.outerHeight() / 2)) + 'px'
|
291 |
+
});
|
292 |
+
}
|
293 |
+
});
|
294 |
+
|
295 |
+
// Close when button pressed
|
296 |
+
$modal.on('click', o.closeButtonClass, function (e) {
|
297 |
+
$modal.trigger('closeModal');
|
298 |
+
e.preventDefault();
|
299 |
+
});
|
300 |
+
|
301 |
+
// Automatically open modal if option set
|
302 |
+
if (o.autoOpen) {
|
303 |
+
$modal.trigger('openModal');
|
304 |
+
}
|
305 |
+
});
|
306 |
+
}
|
307 |
+
};
|
308 |
+
|
309 |
+
$.fn.easyModal = function (method) {
|
310 |
+
// Method calling logic
|
311 |
+
if (methods[method]) {
|
312 |
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
313 |
+
}
|
314 |
+
|
315 |
+
if (typeof method === 'object' || !method) {
|
316 |
+
return methods.init.apply(this, arguments);
|
317 |
+
}
|
318 |
+
|
319 |
+
$.error('Method ' + method + ' does not exist on jQuery.easyModal');
|
320 |
+
};
|
321 |
+
}(jQuery));
|
322 |
+
(function ($) {
|
323 |
+
jQuery(document).ready(function () {
|
324 |
+
jQuery('input, .icon, textarea, .btn-cancel:not(.close-btn-set) ').click(function (event) {
|
325 |
+
window.onbeforeunload = function (e) {
|
326 |
+
e = e || window.event;
|
327 |
+
e.preventDefault = true;
|
328 |
+
e.cancelBubble = true;
|
329 |
+
e.returnValue = 'Your beautiful goodbye message';
|
330 |
+
};
|
331 |
+
});
|
332 |
+
|
333 |
+
jQuery(document).on('submit', 'form', function (event) {
|
334 |
+
window.onbeforeunload = null;
|
335 |
+
});
|
336 |
+
|
337 |
+
//jQuery('.preview').stick_in_parent({
|
338 |
+
// offset_top: 200
|
339 |
+
//});
|
340 |
+
|
341 |
+
jQuery('.upg').click(function (event) {
|
342 |
+
jQuery('.valid_domain_input').val(jQuery('.valid_domain_input').val().replace(' ', ''));
|
343 |
+
if (!/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(jQuery('.valid_domain_input').val())) {
|
344 |
+
event.preventDefault();
|
345 |
+
jQuery('.valid_domain').fadeIn().css({
|
346 |
+
display: 'block'
|
347 |
+
});
|
348 |
+
}
|
349 |
+
});
|
350 |
+
jQuery('.del_token').click(function (event) {
|
351 |
+
$.ajax({
|
352 |
+
type: 'POST',
|
353 |
+
url: ajaxurl,
|
354 |
+
data: {
|
355 |
+
action: 'del_token',
|
356 |
+
nonce_code: cht_nonce_ajax.cht_nonce
|
357 |
+
},
|
358 |
+
success: function (bool) {
|
359 |
+
location.reload();
|
360 |
+
},
|
361 |
+
error: function (xhr, status, error) {
|
362 |
+
|
363 |
+
}
|
364 |
+
});
|
365 |
+
});
|
366 |
+
|
367 |
+
jQuery(document).on("blur", "#channels-selected-list > li:not(#chaty-social-close) .channels__input", function(){
|
368 |
+
if(jQuery(this).hasClass("border-red") && jQuery(this).val() != "") {
|
369 |
+
jQuery(this).removeClass("border-red");
|
370 |
+
}
|
371 |
+
});
|
372 |
+
|
373 |
+
(function easyModal() {
|
374 |
+
jQuery('.easy-modal').easyModal({
|
375 |
+
top: 150,
|
376 |
+
overlay: 0.2
|
377 |
+
});
|
378 |
+
jQuery('.easy-modal-open').click(function (e) {
|
379 |
+
var target = jQuery(this).attr('href');
|
380 |
+
jQuery(target).trigger('openModal');
|
381 |
+
e.preventDefault();
|
382 |
+
});
|
383 |
+
jQuery('.easy-modal-close').click(function (e) {
|
384 |
+
e.preventDefault();
|
385 |
+
jQuery('.easy-modal').trigger('closeModal');
|
386 |
+
});
|
387 |
+
}());
|
388 |
+
var count_click = 1000000003;
|
389 |
+
jQuery('.show_up').click(function () {
|
390 |
+
count_click += 10;
|
391 |
+
jQuery('#upgrade-modal').css({
|
392 |
+
'z-index': count_click,
|
393 |
+
display: 'block',
|
394 |
+
'margin-left': '-258px'
|
395 |
+
});
|
396 |
+
});
|
397 |
+
|
398 |
+
(function colorPicker() {
|
399 |
+
jQuery('.color-picker-btn, .color-picker-btn-close, .color-picker-custom button').on('click', function (e) {
|
400 |
+
e.preventDefault();
|
401 |
+
|
402 |
+
jQuery('.color-picker').toggle();
|
403 |
+
jQuery('.color-picker-btn').toggle();
|
404 |
+
});
|
405 |
+
|
406 |
+
jQuery('.color-picker-radio input').change(function () {
|
407 |
+
var $this = jQuery(this);
|
408 |
+
jQuery('.color-picker-custom input[name="cht_custom_color"]').val('');
|
409 |
+
jQuery('.color-picker-custom .circle').html('?').css({
|
410 |
+
'background-color': '#fff'
|
411 |
+
});
|
412 |
+
if ($this.prop('checked')) {
|
413 |
+
jQuery('.color-picker-radio input').prop('checked', false);
|
414 |
+
$this.prop('checked', true);
|
415 |
+
var color = $this.val();
|
416 |
+
var title = $this.prop('title');
|
417 |
+
} else {
|
418 |
+
color = jQuery('.color-picker-custom input').val();
|
419 |
+
title = 'Custom';
|
420 |
+
}
|
421 |
+
|
422 |
+
jQuery('.color-picker-btn .circle').css({backgroundColor: color});
|
423 |
+
jQuery('.color-picker-btn .text').text(title);
|
424 |
+
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
425 |
+
});
|
426 |
+
|
427 |
+
jQuery('.color-picker-custom input').change(function () {
|
428 |
+
jQuery('.color-picker-radio input').prop('checked', false);
|
429 |
+
|
430 |
+
var $this = jQuery(this);
|
431 |
+
|
432 |
+
var color = $this.val();
|
433 |
+
|
434 |
+
jQuery('.color-picker-btn .circle').css({backgroundColor: color});
|
435 |
+
jQuery('.color-picker-btn .text').text('Custom');
|
436 |
+
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
437 |
+
});
|
438 |
+
}());
|
439 |
+
|
440 |
+
(function customSelect() {
|
441 |
+
jQuery('[name="cht_position"]').change(function () {
|
442 |
+
if (jQuery('#positionCustom').prop('checked')) {
|
443 |
+
jQuery('#positionPro').show();
|
444 |
+
} else {
|
445 |
+
jQuery('#positionPro').hide();
|
446 |
+
}
|
447 |
+
});
|
448 |
+
}());
|
449 |
+
|
450 |
+
|
451 |
+
/**
|
452 |
+
* add Token
|
453 |
+
*/
|
454 |
+
|
455 |
+
var AddTokenBtn = jQuery('.update_token');
|
456 |
+
|
457 |
+
AddTokenBtn.on('click', function (e) {
|
458 |
+
e.preventDefault();
|
459 |
+
var token = jQuery('input[name="cht_token"]').val();
|
460 |
+
|
461 |
+
$.ajax({
|
462 |
+
type: 'POST',
|
463 |
+
url: ajaxurl,
|
464 |
+
data: {
|
465 |
+
action: 'add_token',
|
466 |
+
nonce_code: cht_nonce_ajax.cht_nonce,
|
467 |
+
token: token
|
468 |
+
},
|
469 |
+
beforeSend: function (xhr) {
|
470 |
+
|
471 |
+
},
|
472 |
+
success: function (bool) {
|
473 |
+
if (bool) {
|
474 |
+
alert('Your pro plan is activated');
|
475 |
+
location.reload();
|
476 |
+
} else {
|
477 |
+
alert('You`ve entered a wrong token');
|
478 |
+
}
|
479 |
+
},
|
480 |
+
error: function (xhr, status, error) {
|
481 |
+
|
482 |
+
}
|
483 |
+
});
|
484 |
+
});
|
485 |
+
jQuery('textarea[name=cht_cta]').keyup(function (event) {
|
486 |
+
jQuery('.tooltiptext span').html(jQuery(this).val());
|
487 |
+
if (jQuery(this).val().length == 0) {
|
488 |
+
jQuery('.cta').hide(200);
|
489 |
+
jQuery('.tooltiptext span').hide(200);
|
490 |
+
} else {
|
491 |
+
jQuery('.cta').show(300);
|
492 |
+
jQuery('.tooltiptext span').show(200);
|
493 |
+
}
|
494 |
+
});
|
495 |
+
});
|
496 |
+
}(jQuery));
|
497 |
+
|
498 |
+
(function ($) {
|
499 |
+
jQuery(document).ready(function () {
|
500 |
+
(function preview() {
|
501 |
+
(function previewColor() {
|
502 |
+
jQuery('.color-picker-radio input').change(function () {
|
503 |
+
var $this = jQuery(this);
|
504 |
+
|
505 |
+
if ($this.prop('checked')) {
|
506 |
+
var color = $this.val();
|
507 |
+
} else {
|
508 |
+
color = jQuery('.color-picker-custom input').val();
|
509 |
+
}
|
510 |
+
detectIcon();
|
511 |
+
});
|
512 |
+
|
513 |
+
jQuery('.color-picker-custom input').change(function () {
|
514 |
+
var $this = jQuery(this);
|
515 |
+
|
516 |
+
var color = $this.val();
|
517 |
+
|
518 |
+
detectIcon();
|
519 |
+
});
|
520 |
+
|
521 |
+
jQuery(document).on("change", "#chaty_default_state", function(){
|
522 |
+
|
523 |
+
detectIcon();
|
524 |
+
});
|
525 |
+
|
526 |
+
jQuery('#cht_close_button, #trigger_on_time, #chaty_trigger_on_scroll').click(function () {
|
527 |
+
detectIcon();
|
528 |
+
});
|
529 |
+
}());
|
530 |
+
|
531 |
+
(function previewTooltip() {
|
532 |
+
var $widgetTooltip = jQuery('#widgetTooltip');
|
533 |
+
var $icon = jQuery('.preview .page .icon');
|
534 |
+
|
535 |
+
function tooltipToggle() {
|
536 |
+
if (jQuery('[name=cht_cta]').val().length >= 1) {
|
537 |
+
$icon.removeClass('no-tooltip');
|
538 |
+
} else {
|
539 |
+
$icon.addClass('no-tooltip');
|
540 |
+
}
|
541 |
+
}
|
542 |
+
|
543 |
+
tooltipToggle();
|
544 |
+
|
545 |
+
$widgetTooltip.change(function () {
|
546 |
+
tooltipToggle();
|
547 |
+
});
|
548 |
+
}());
|
549 |
+
|
550 |
+
function previewPosition() {
|
551 |
+
var $inputPosBot = jQuery('#positionBottom');
|
552 |
+
var $inputPosSide = jQuery('#positionSide');
|
553 |
+
var $chatyWidget = jQuery('.preview .page .chaty-widget');
|
554 |
+
var customSpace = '7px';
|
555 |
+
|
556 |
+
var value = jQuery('[name="cht_position"]:checked').val();
|
557 |
+
|
558 |
+
if (value === 'right') {
|
559 |
+
$chatyWidget.css({right: customSpace, left: 'auto', bottom: '7px'});
|
560 |
+
} else if (value === 'left') {
|
561 |
+
$chatyWidget.css({left: customSpace, right: 'auto', bottom: '7px'});
|
562 |
+
} else if (value === 'custom') {
|
563 |
+
if ($inputPosBot.val()) {
|
564 |
+
var positionBottom = $inputPosBot.val() + 'px';
|
565 |
+
} else {
|
566 |
+
positionBottom = customSpace;
|
567 |
+
}
|
568 |
+
|
569 |
+
if ($inputPosSide.val()) {
|
570 |
+
var positionSide = $inputPosSide.val() + 'px';
|
571 |
+
} else {
|
572 |
+
positionSide = customSpace;
|
573 |
+
}
|
574 |
+
|
575 |
+
$inputPosBot.change(function () {
|
576 |
+
positionBottom = jQuery('#positionBottom').val() + 'px';
|
577 |
+
|
578 |
+
$chatyWidget.css({bottom: positionBottom});
|
579 |
+
});
|
580 |
+
|
581 |
+
$inputPosSide.change(function () {
|
582 |
+
var valueCustom = jQuery('[name="positionSide"]:checked').val();
|
583 |
+
positionSide = jQuery(this).val() + 'px';
|
584 |
+
|
585 |
+
if (valueCustom === 'right') {
|
586 |
+
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
|
587 |
+
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
|
588 |
+
$chatyWidget.css({right: positionSide, left: 'auto'});
|
589 |
+
} else if (valueCustom === 'left') {
|
590 |
+
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
|
591 |
+
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
|
592 |
+
$chatyWidget.css({left: positionSide, right: 'auto'});
|
593 |
+
}
|
594 |
+
});
|
595 |
+
|
596 |
+
jQuery('[name="positionSide"]').change(function () {
|
597 |
+
var valueCustom = jQuery('[name="positionSide"]:checked').val();
|
598 |
+
|
599 |
+
if (valueCustom === 'right') {
|
600 |
+
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
|
601 |
+
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
|
602 |
+
$chatyWidget.css({right: positionSide, left: 'auto'});
|
603 |
+
} else if (valueCustom === 'left') {
|
604 |
+
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
|
605 |
+
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
|
606 |
+
$chatyWidget.css({left: positionSide, right: 'auto'});
|
607 |
+
}
|
608 |
+
});
|
609 |
+
}
|
610 |
+
}
|
611 |
+
|
612 |
+
previewPosition();
|
613 |
+
|
614 |
+
|
615 |
+
jQuery('input[name="cht_position"]').change(function () {
|
616 |
+
var valueCustom = jQuery('[name="cht_position"]:checked').val();
|
617 |
+
|
618 |
+
if (valueCustom === 'right') {
|
619 |
+
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
|
620 |
+
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
|
621 |
+
} else if (valueCustom === 'left') {
|
622 |
+
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
|
623 |
+
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
|
624 |
+
}
|
625 |
+
previewPosition();
|
626 |
+
});
|
627 |
+
|
628 |
+
}());
|
629 |
+
jQuery('.popover').hide();
|
630 |
+
two_soc();
|
631 |
+
|
632 |
+
var socialIcon = jQuery('.channels-icons > .icon-sm');
|
633 |
+
|
634 |
+
var socialInputsContainer = jQuery('.social-inputs');
|
635 |
+
|
636 |
+
var click = 0;
|
637 |
+
jQuery('input[name=cht_custom_color]').keyup(function (event) {
|
638 |
+
var color = jQuery(this).val();
|
639 |
+
jQuery('.circle').html('');
|
640 |
+
jQuery('.color-picker-custom .circle').css({
|
641 |
+
'background-color': color
|
642 |
+
});
|
643 |
+
if (jQuery(this).val().length < 1) {
|
644 |
+
jQuery('.color-picker-custom .circle').html('?');
|
645 |
+
}
|
646 |
+
});
|
647 |
+
socialIcon.on('click', function () {
|
648 |
+
++click;
|
649 |
+
two_soc();
|
650 |
+
|
651 |
+
var $this = jQuery(this);
|
652 |
+
|
653 |
+
var social = $this.data('social');
|
654 |
+
|
655 |
+
var socialItem = socialInputsContainer.find('.social-form-group');
|
656 |
+
|
657 |
+
if ($this.hasClass('active')) {
|
658 |
+
var del = ',' + jQuery(this).attr('data-social');
|
659 |
+
|
660 |
+
var newlocaldata = jQuery('.add_slug').val();
|
661 |
+
newlocaldata = newlocaldata.replace(del, '');
|
662 |
+
jQuery('.add_slug').val(newlocaldata);
|
663 |
+
newlocaldata = newlocaldata.replace(del, '');
|
664 |
+
jQuery('.add_slug').val(newlocaldata);
|
665 |
+
newlocaldata = newlocaldata.replace(del, '');
|
666 |
+
jQuery('.add_slug').val(newlocaldata);
|
667 |
+
newlocaldata = newlocaldata.replace(del, '');
|
668 |
+
|
669 |
+
|
670 |
+
jQuery('.add_slug').val(newlocaldata);
|
671 |
+
|
672 |
+
$this.toggleClass('active');
|
673 |
+
return;
|
674 |
+
}
|
675 |
+
socialIcon.addClass('disabled');
|
676 |
+
icon = jQuery(this).data('social');
|
677 |
+
|
678 |
+
if (jQuery('.add_slug').val().indexOf(icon) == '1' && jQuery('.add_slug').val() != '') {
|
679 |
+
var del = ',' + icon;
|
680 |
+
var newlocaldata = jQuery('.add_slug').val();
|
681 |
+
|
682 |
+
newlocaldata = newlocaldata.replace(del, '');
|
683 |
+
jQuery('.add_slug').val(newlocaldata);
|
684 |
+
newlocaldata = newlocaldata.replace(del, '');
|
685 |
+
jQuery('.add_slug').val(newlocaldata);
|
686 |
+
newlocaldata = newlocaldata.replace(del, '');
|
687 |
+
jQuery('.add_slug').val(newlocaldata);
|
688 |
+
} else {
|
689 |
+
jQuery('.add_slug').val(jQuery('.add_slug').val() + ',' + jQuery(this).attr('data-social'));
|
690 |
+
}
|
691 |
+
|
692 |
+
|
693 |
+
/* if(jQuery('section').is("#pro")){
|
694 |
+
|
695 |
+
}else if(click >='3'){
|
696 |
+
// alert(click);
|
697 |
+
jQuery('.popover').show().effect( "shake", {times:3}, 600 );
|
698 |
+
click = jQuery('.channels-selected__item.free').length;
|
699 |
+
return;
|
700 |
+
|
701 |
+
|
702 |
+
} */
|
703 |
+
|
704 |
+
if (!jQuery('section').is('#pro') && jQuery('.channels-icons > .icon.active').length >= 2) {
|
705 |
+
jQuery('.popover').show().effect('shake', {times: 3}, 600);
|
706 |
+
socialIcon.removeClass('disabled');
|
707 |
+
return;
|
708 |
+
}
|
709 |
+
|
710 |
+
$this.toggleClass('active');
|
711 |
+
|
712 |
+
|
713 |
+
if (jQuery('section').is('#pro')) {
|
714 |
+
var token = 'pro';
|
715 |
+
} else {
|
716 |
+
var token = 'free';
|
717 |
+
}
|
718 |
+
|
719 |
+
|
720 |
+
$.ajax({
|
721 |
+
type: 'POST',
|
722 |
+
dataType: 'json',
|
723 |
+
url: ajaxurl,
|
724 |
+
data: {
|
725 |
+
action: 'choose_social',
|
726 |
+
social: social,
|
727 |
+
nonce_code: cht_nonce_ajax.cht_nonce,
|
728 |
+
version: token,
|
729 |
+
widget_index: jQuery("#widget_index").val()
|
730 |
+
},
|
731 |
+
beforeSend: function (xhr) {
|
732 |
+
|
733 |
+
},
|
734 |
+
success: function (data) {
|
735 |
+
var item = jQuery(data);
|
736 |
+
var itemName = item.find('.icon').data('title');
|
737 |
+
|
738 |
+
if (!jQuery('.channels-selected div[data-social="' + itemName + '"]').length) {
|
739 |
+
jQuery('#chaty-social-close').before(item);
|
740 |
+
}
|
741 |
+
|
742 |
+
socialIcon.removeClass('disabled');
|
743 |
+
detectIcon();
|
744 |
+
two_soc();
|
745 |
+
|
746 |
+
//jQuery('.chaty-color-field').wpColorPicker({
|
747 |
+
// pick: "Background Color",
|
748 |
+
// target: false,
|
749 |
+
// change: function(event, ui){
|
750 |
+
// chaty_set_bg_color();
|
751 |
+
// }
|
752 |
+
//});
|
753 |
+
jQuery('.chaty-color-field').spectrum({
|
754 |
+
chooseText: "Submit",
|
755 |
+
preferredFormat: "hex",
|
756 |
+
showInput: true,
|
757 |
+
cancelText: "Cancel",
|
758 |
+
move: function (color) {
|
759 |
+
jQuery(this).val(color.toHexString());
|
760 |
+
chaty_set_bg_color();
|
761 |
+
}
|
762 |
+
});
|
763 |
+
check_for_chaty_close_button();
|
764 |
+
},
|
765 |
+
error: function (xhr, status, error) {
|
766 |
+
|
767 |
+
}
|
768 |
+
});
|
769 |
+
|
770 |
+
two_soc();
|
771 |
+
});
|
772 |
+
|
773 |
+
/**
|
774 |
+
* Cancel Btn
|
775 |
+
*
|
776 |
+
*/
|
777 |
+
var cancelBtn = jQuery('body');
|
778 |
+
|
779 |
+
cancelBtn.on('click', '.icon, .btn-cancel:not(.close-btn-set)', function (e) {
|
780 |
+
|
781 |
+
if (jQuery(this).hasClass("close-btn-set")) {
|
782 |
+
return;
|
783 |
+
}
|
784 |
+
|
785 |
+
e.preventDefault();
|
786 |
+
|
787 |
+
if (jQuery(this).hasClass('icon') && jQuery(this).hasClass('active')) {
|
788 |
+
return;
|
789 |
+
}
|
790 |
+
|
791 |
+
icon = jQuery(this).data('social');
|
792 |
+
if (jQuery(this).hasClass('btn-cancel')) {
|
793 |
+
jQuery('.icon.active[data-social^="' + icon + '"]').removeClass('active');
|
794 |
+
|
795 |
+
var del = ',' + icon;
|
796 |
+
var newlocaldata = jQuery('.add_slug').val();
|
797 |
+
newlocaldata = newlocaldata.replace(del, '');
|
798 |
+
|
799 |
+
jQuery('.add_slug').val(newlocaldata);
|
800 |
+
}
|
801 |
+
var del_item = jQuery('#chaty-social-' + icon);
|
802 |
+
del_item.remove();
|
803 |
+
|
804 |
+
var item = jQuery(this).parent('.channels-selected__item');
|
805 |
+
|
806 |
+
|
807 |
+
var social = jQuery(this).data('social');
|
808 |
+
|
809 |
+
// $.ajax({
|
810 |
+
// type: 'POST',
|
811 |
+
// dataType: 'json',
|
812 |
+
// url: ajaxurl,
|
813 |
+
// data: {
|
814 |
+
// action: 'remove_social',
|
815 |
+
// nonce_code: cht_nonce_ajax.cht_nonce,
|
816 |
+
// social: social,
|
817 |
+
// widget_index: jQuery("#widget_index").val()
|
818 |
+
// },
|
819 |
+
// beforeSend: function (xhr) {
|
820 |
+
//
|
821 |
+
// },
|
822 |
+
// success: function (bool) {
|
823 |
+
// if (bool) {
|
824 |
+
// item.closest("li").remove();
|
825 |
+
// del_item.remove();
|
826 |
+
//
|
827 |
+
//
|
828 |
+
// jQuery('.icon-sm').each(function () {
|
829 |
+
// if (jQuery(this).data('social') === social) {
|
830 |
+
// // jQuery(this).removeClass('active');
|
831 |
+
// }
|
832 |
+
// });
|
833 |
+
// set_social_channel_order();
|
834 |
+
// }
|
835 |
+
// check_for_chaty_close_button();
|
836 |
+
// },
|
837 |
+
// error: function (xhr, status, error) {
|
838 |
+
//
|
839 |
+
// }
|
840 |
+
// });
|
841 |
+
detectIcon();
|
842 |
+
two_soc();
|
843 |
+
set_social_channel_order();
|
844 |
+
check_for_chaty_close_button();
|
845 |
+
});
|
846 |
+
|
847 |
+
function two_soc() {
|
848 |
+
if (jQuery('section').is('#pro')) {
|
849 |
+
return;
|
850 |
+
}
|
851 |
+
|
852 |
+
if (jQuery('.channels-selected__item').length <= 1) {
|
853 |
+
jQuery('.channels-selected__item').hide();
|
854 |
+
jQuery('.popover').hide();
|
855 |
+
} else if (jQuery('.channels-selected__item').length >= 2) {
|
856 |
+
jQuery('.channels-selected__item').show();
|
857 |
+
}
|
858 |
+
}
|
859 |
+
|
860 |
+
jQuery('.btn-help').click(function (event) {
|
861 |
+
window.open(
|
862 |
+
'https://premio.io/help/chaty/',
|
863 |
+
'_blank' // <- This is what makes it open in a new window.
|
864 |
+
);
|
865 |
+
});
|
866 |
+
|
867 |
+
|
868 |
+
var freeCustomInput = jQuery('.free-custom-radio, .free-custom-checkbox');
|
869 |
+
|
870 |
+
freeCustomInput.on('click', function (e) {
|
871 |
+
e.preventDefault();
|
872 |
+
});
|
873 |
+
var chatyCta = jQuery('[name=cht_cta]');
|
874 |
+
var toolTip = jQuery('.preview .tooltip-show');
|
875 |
+
|
876 |
+
chatyCta.keyup(function () {
|
877 |
+
var $icon = jQuery('.preview .page .icon');
|
878 |
+
if (chatyCta.val().length >= 1) {
|
879 |
+
$icon.removeClass('no-tooltip');
|
880 |
+
} else {
|
881 |
+
$icon.addClass('no-tooltip');
|
882 |
+
}
|
883 |
+
toolTip.attr('data-title', chatyCta.val());
|
884 |
+
});
|
885 |
+
|
886 |
+
|
887 |
+
var baseIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
888 |
+
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
889 |
+
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
890 |
+
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
891 |
+
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
892 |
+
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
893 |
+
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
894 |
+
' </svg>',
|
895 |
+
defaultIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
896 |
+
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
897 |
+
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
898 |
+
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
899 |
+
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
900 |
+
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
901 |
+
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
902 |
+
' </svg>',
|
903 |
+
iconBlock = document.getElementById('iconWidget'),
|
904 |
+
desktopIcon,
|
905 |
+
mobileIcon,
|
906 |
+
colorFill = jQuery('.color-picker-radio input:checked').val();
|
907 |
+
|
908 |
+
jQuery('#testUpload').on('change', function () {
|
909 |
+
if (this.value.length > 0) {
|
910 |
+
document.querySelector('.js-upload').disabled = false;
|
911 |
+
} else {
|
912 |
+
document.querySelector('.js-upload').disabled = true;
|
913 |
+
document.getElementById('uploadInput').checked = false;
|
914 |
+
}
|
915 |
+
});
|
916 |
+
|
917 |
+
jQuery(document).on("keyup", "textarea.test_textarea", function(){
|
918 |
+
detectIcon();
|
919 |
+
});
|
920 |
+
|
921 |
+
jQuery('.js-switch-preview').on('change', function () {
|
922 |
+
if (getPreviewDesktop()) {
|
923 |
+
jQuery(this).closest(".preview").removeClass('mobiel-view');
|
924 |
+
} else {
|
925 |
+
jQuery(this).closest(".preview").addClass('mobiel-view');
|
926 |
+
}
|
927 |
+
detectIcon();
|
928 |
+
});
|
929 |
+
|
930 |
+
function detectIcon() {
|
931 |
+
var desktop,
|
932 |
+
mobile,
|
933 |
+
colorSelf = false;
|
934 |
+
jQuery("#iconWidget").removeClass("img-p-active");
|
935 |
+
|
936 |
+
if (getPreviewDesktop()) {
|
937 |
+
if (jQuery('.js-chanel-desktop:checked').length === 0) {
|
938 |
+
desktop = false;
|
939 |
+
}
|
940 |
+
if (jQuery('.js-chanel-desktop:checked').length === 1) {
|
941 |
+
desktop = jQuery('.js-chanel-desktop:checked').closest("li").find(".icon.icon-md").html();
|
942 |
+
if (jQuery('.js-chanel-desktop:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
943 |
+
jQuery("#iconWidget").addClass("img-p-active");
|
944 |
+
}
|
945 |
+
}
|
946 |
+
if (jQuery('.js-chanel-desktop:checked').length > 1) {
|
947 |
+
desktop = defaultIcon;
|
948 |
+
colorSelf = true;
|
949 |
+
}
|
950 |
+
} else {
|
951 |
+
if (jQuery('.js-chanel-mobile:checked').length === 0) {
|
952 |
+
mobile = false;
|
953 |
+
}
|
954 |
+
if (jQuery('.js-chanel-mobile:checked').length === 1) {
|
955 |
+
mobile = jQuery('.js-chanel-mobile:checked').closest("li").find(".icon.icon-md").html();
|
956 |
+
if (jQuery('.js-chanel-mobile:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
957 |
+
jQuery("#iconWidget").addClass("img-p-active");
|
958 |
+
}
|
959 |
+
}
|
960 |
+
if (jQuery('.js-chanel-mobile:checked').length > 1) {
|
961 |
+
mobile = defaultIcon;
|
962 |
+
colorSelf = true;
|
963 |
+
}
|
964 |
+
}
|
965 |
+
|
966 |
+
desktopIcon = desktop;
|
967 |
+
mobileIcon = mobile;
|
968 |
+
|
969 |
+
if (getPreviewDesktop()) {
|
970 |
+
setIcon(desktopIcon, colorSelf)
|
971 |
+
} else {
|
972 |
+
setIcon(mobileIcon, colorSelf)
|
973 |
+
}
|
974 |
+
}
|
975 |
+
|
976 |
+
function stickyelement_iconformat(icon) {
|
977 |
+
var originalOption = icon.element;
|
978 |
+
return jQuery('<span><i class="' + icon.text + '"></i> ' + icon.text + '</span>');
|
979 |
+
}
|
980 |
+
|
981 |
+
function setIcon(icon, colorSelf) {
|
982 |
+
if (icon) {
|
983 |
+
//jQuery('.preview .page .chaty-widget').show();
|
984 |
+
iconBlock.innerHTML = icon;
|
985 |
+
} else {
|
986 |
+
//jQuery('.preview .page .chaty-widget').hide();
|
987 |
+
iconBlock.innerHTML = '';
|
988 |
+
}
|
989 |
+
if (colorSelf) {
|
990 |
+
var color = jQuery('.color-picker-custom input').val() ? jQuery('.color-picker-custom input').val() : jQuery('.color-picker-radio input:checked').val();
|
991 |
+
jQuery('.preview .page svg circle').css({fill: color});
|
992 |
+
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
993 |
+
}
|
994 |
+
|
995 |
+
thisVal = jQuery("#chaty_default_state").val();
|
996 |
+
if(thisVal == "open") {
|
997 |
+
jQuery(".hide-show-button").addClass("active");
|
998 |
+
} else {
|
999 |
+
jQuery(".hide-show-button").removeClass("active");
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
jQuery(".chaty-widget").removeClass("active").removeClass("hover").removeClass("click");
|
1003 |
+
if(thisVal == "open") {
|
1004 |
+
jQuery(".chaty-widget").addClass("active");
|
1005 |
+
} else if(thisVal == "hover") {
|
1006 |
+
jQuery(".chaty-widget").addClass("hover");
|
1007 |
+
} else {
|
1008 |
+
jQuery(".chaty-widget").addClass("click");
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
jQuery(".chaty-channels").html("");
|
1012 |
+
var eClass = ".js-chanel-mobile";
|
1013 |
+
if (getPreviewDesktop()) {
|
1014 |
+
var eClass = ".js-chanel-desktop";
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
if(thisVal == "open" && jQuery(eClass+':checked').length > 1) {
|
1018 |
+
jQuery("#chaty_attention_effect").val("");
|
1019 |
+
jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", true);
|
1020 |
+
jQuery("#chaty_attention_effect option:first-child").text("Doesn't apply for the open state");
|
1021 |
+
if(jQuery(".test_textarea").val() != "Doesn't apply for the open state") {
|
1022 |
+
jQuery(".test_textarea").attr("data-value", jQuery(".test_textarea").val());
|
1023 |
+
}
|
1024 |
+
jQuery(".test_textarea").val("Doesn't apply for the open state");
|
1025 |
+
} else {
|
1026 |
+
jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", false);
|
1027 |
+
jQuery("#chaty_attention_effect option:first-child").text("None");
|
1028 |
+
jQuery(".test_textarea").attr("placeholder","");
|
1029 |
+
if(jQuery(".test_textarea").val() == "Doesn't apply for the open state") {
|
1030 |
+
jQuery(".test_textarea").val(jQuery(".test_textarea").attr("data-value"));
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
if (jQuery(eClass+':checked').length > 1) {
|
1035 |
+
jQuery(eClass+':checked').each(function(){
|
1036 |
+
var socialIcon = jQuery(this).closest("li").find(".icon").html();
|
1037 |
+
var socialIcon = jQuery(this).closest("li").find(".icon").html();
|
1038 |
+
var socialIconText = jQuery(this).closest("li").find(".chaty-title").val();
|
1039 |
+
var eClass = jQuery(this).closest(".channels-selected__item").hasClass("img-active")?"img-active":"";
|
1040 |
+
if(socialIconText != "") {
|
1041 |
+
socialIconText = "<span class='social-tooltip'>"+socialIconText+"</span>";
|
1042 |
+
}
|
1043 |
+
jQuery(".chaty-channels").append("<div class='social-item-box "+eClass+"'><span class='tooltip-icon'>"+socialIcon+"</span>"+socialIconText+"</div>");
|
1044 |
+
});
|
1045 |
+
|
1046 |
+
if(jQuery("#chaty_default_state").val() == "open" && jQuery("#cht_close_button").is(":checked")) {
|
1047 |
+
jQuery("#iconWidget").css("display", "block");
|
1048 |
+
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1049 |
+
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1050 |
+
} else if(jQuery("#chaty_default_state").val() != "open") {
|
1051 |
+
jQuery("#iconWidget").css("display", "block");
|
1052 |
+
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1053 |
+
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1054 |
+
} else if(jQuery("#chaty_default_state").val() == "open") {
|
1055 |
+
jQuery("#iconWidget").hide();
|
1056 |
+
jQuery(".chaty-widget .tooltiptext").hide();
|
1057 |
+
jQuery(".chaty-widget").addClass("hide-arrow");
|
1058 |
+
}
|
1059 |
+
jQuery(".chaty-widget").removeClass("has-single");
|
1060 |
+
} else if (jQuery(eClass+':checked').length == 1) {
|
1061 |
+
if(jQuery("#chaty_default_state").val() == "open" && !jQuery("#cht_close_button").is(":checked")) {
|
1062 |
+
jQuery("#iconWidget").css("display","block");
|
1063 |
+
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1064 |
+
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1065 |
+
} else if(jQuery("#chaty_default_state").val() != "open") {
|
1066 |
+
jQuery("#iconWidget").css("display","block");
|
1067 |
+
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1068 |
+
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1069 |
+
}
|
1070 |
+
jQuery(".chaty-widget").addClass("has-single");
|
1071 |
+
} else if (jQuery(eClass+':checked').length == 0) {
|
1072 |
+
jQuery("#iconWidget").hide();
|
1073 |
+
jQuery(".chaty-widget .tooltiptext").hide();
|
1074 |
+
jQuery(".chaty-widget").addClass("hide-arrow");
|
1075 |
+
jQuery(".chaty-widget").removeClass("has-single");
|
1076 |
+
}
|
1077 |
+
jQuery(".chaty-channels .remove-icon-img").remove();
|
1078 |
+
|
1079 |
+
if(jQuery("#trigger_on_time").is(":checked")) {
|
1080 |
+
jQuery("#chaty_trigger_time").attr("readonly", false);
|
1081 |
+
} else {
|
1082 |
+
jQuery("#chaty_trigger_time").attr("readonly", true);
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
if(jQuery("#chaty_trigger_on_scroll").is(":checked")) {
|
1086 |
+
jQuery("#chaty_trigger_on_page_scroll").attr("readonly", false);
|
1087 |
+
} else {
|
1088 |
+
jQuery("#chaty_trigger_on_page_scroll").attr("readonly", true);
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
|
1092 |
+
if(jQuery(".chaty-widget .tooltiptext").text() == "") {
|
1093 |
+
jQuery(".chaty-widget .tooltiptext").hide();
|
1094 |
+
} else {
|
1095 |
+
if(jQuery("#chaty_default_state").val() == "open" && jQuery(eClass+':checked').length > 1) {
|
1096 |
+
jQuery(".chaty-widget .tooltiptext").hide();
|
1097 |
+
} else {
|
1098 |
+
jQuery(".chaty-widget .tooltiptext").css("display", "block");
|
1099 |
+
}
|
1100 |
+
}
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
function getPreviewDesktop() {
|
1104 |
+
return jQuery('#previewDesktop').attr('checked') === 'checked' ? true : false;
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
function changeWidgetIcon() {
|
1108 |
+
|
1109 |
+
jQuery(document).on('change', '.js-chanel-icon', function () {
|
1110 |
+
detectIcon();
|
1111 |
+
});
|
1112 |
+
|
1113 |
+
function calc(a) {
|
1114 |
+
var count = {}, res = 0, q;
|
1115 |
+
for (q = 0; q < a.length; ++q) {
|
1116 |
+
count[a[q].dataset.type] = ~~count[a[q].dataset.type] + 1;
|
1117 |
+
}
|
1118 |
+
for (q in count) {
|
1119 |
+
if (count.hasOwnProperty(q) && count[q] > 1) {
|
1120 |
+
res += count[q];
|
1121 |
+
}
|
1122 |
+
}
|
1123 |
+
return res;
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
|
1127 |
+
jQuery(document).on('change', '.js-widget-i', function (ev) {
|
1128 |
+
if (ev.target.classList.contains('js-upload')) {
|
1129 |
+
defaultIcon = jQuery('.file-preview-image').last().parent().html();
|
1130 |
+
} else {
|
1131 |
+
defaultIcon = jQuery('i[data-type=' + ev.target.dataset.type + ']').html()
|
1132 |
+
}
|
1133 |
+
detectIcon();
|
1134 |
+
});
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
changeWidgetIcon();
|
1138 |
+
|
1139 |
+
if (jQuery(".js-widget-i:checked").attr("data-type") !== 'chat-image') {
|
1140 |
+
defaultIcon = jQuery('i[data-type=' + jQuery(".js-widget-i:checked").attr("data-type") + ']').html();
|
1141 |
+
detectIcon();
|
1142 |
+
};
|
1143 |
+
});
|
1144 |
+
|
1145 |
+
jQuery(document).ready(function () {
|
1146 |
+
|
1147 |
+
jQuery(document).on("click", ".chaty-popup-box button, #chaty-intro-popup", function(e){
|
1148 |
+
e.stopPropagation();
|
1149 |
+
var nonceVal = jQuery("#chaty_update_popup_status").val();
|
1150 |
+
$("#chaty-intro-popup").remove();
|
1151 |
+
$.ajax({
|
1152 |
+
type: 'POST',
|
1153 |
+
url: ajaxurl,
|
1154 |
+
data: {
|
1155 |
+
action: 'update_popup_status',
|
1156 |
+
nonce: nonceVal
|
1157 |
+
},
|
1158 |
+
beforeSend: function (xhr) {
|
1159 |
+
|
1160 |
+
},
|
1161 |
+
success: function (res) {
|
1162 |
+
|
1163 |
+
},
|
1164 |
+
error: function (xhr, status, error) {
|
1165 |
+
|
1166 |
+
}
|
1167 |
+
});
|
1168 |
+
});
|
1169 |
+
|
1170 |
+
jQuery(document).on("click", ".chaty-popup-box", function(e){
|
1171 |
+
e.stopPropagation();
|
1172 |
+
});
|
1173 |
+
|
1174 |
+
jQuery(document).on("click", ".remove-chaty-options", function (e) {
|
1175 |
+
e.preventDefault();
|
1176 |
+
e.stopPropagation();
|
1177 |
+
if(confirm("Are you sure you want to delete this widget?")) {
|
1178 |
+
$.ajax({
|
1179 |
+
type: 'POST',
|
1180 |
+
url: ajaxurl,
|
1181 |
+
data: {
|
1182 |
+
action: 'remove_chaty_widget',
|
1183 |
+
nonce_code: cht_nonce_ajax.cht_nonce,
|
1184 |
+
widget_index: jQuery("#widget_index").val()
|
1185 |
+
},
|
1186 |
+
beforeSend: function (xhr) {
|
1187 |
+
|
1188 |
+
},
|
1189 |
+
success: function (res) {
|
1190 |
+
window.location = res;
|
1191 |
+
},
|
1192 |
+
error: function (xhr, status, error) {
|
1193 |
+
|
1194 |
+
}
|
1195 |
+
});
|
1196 |
+
}
|
1197 |
+
})
|
1198 |
+
|
1199 |
+
/* Date: 2019-07-26 */
|
1200 |
+
var location_href = window.location.href;
|
1201 |
+
if (window.location.href.indexOf('page=chaty-app&widget=') > -1) {
|
1202 |
+
jQuery('#toplevel_page_chaty-app .wp-submenu.wp-submenu-wrap li').each(function () {
|
1203 |
+
var element_href = jQuery(this).find('a').attr('href');
|
1204 |
+
if (typeof element_href !== 'undefined') {
|
1205 |
+
jQuery(this).removeClass('current');
|
1206 |
+
if (window.location.href.indexOf(element_href) > -1 && element_href.indexOf('&widget=') > -1) {
|
1207 |
+
jQuery(this).addClass('current');
|
1208 |
+
}
|
1209 |
+
}
|
1210 |
+
});
|
1211 |
+
}
|
1212 |
+
});
|
1213 |
+
}(jQuery));
|
1214 |
+
|
1215 |
+
|
1216 |
+
jQuery(window).scroll(function () {
|
1217 |
+
check_for_preview_pos();
|
1218 |
+
});
|
1219 |
+
jQuery(document).ready(function () {
|
1220 |
+
check_for_preview_pos();
|
1221 |
+
});
|
1222 |
+
|
1223 |
+
function check_for_preview_pos() {
|
1224 |
+
if(jQuery(".chaty-setting-form").length) {
|
1225 |
+
if(jQuery(window).width() > 1179) {
|
1226 |
+
var topPos = parseInt(jQuery(".chaty-setting-form").offset().top);
|
1227 |
+
jQuery(".btn-save-sticky").css("top", (topPos+58));
|
1228 |
+
jQuery(".preview").css("top", (topPos+18));
|
1229 |
+
jQuery(".btn-help").css("top", (topPos+58+145));
|
1230 |
+
jQuery("a.remove-chaty-widget-sticky").css("top", (topPos+58+145+119));
|
1231 |
+
} else {
|
1232 |
+
jQuery(".btn-save-sticky").attr("style", "");
|
1233 |
+
jQuery(".preview").attr("style", "");
|
1234 |
+
jQuery(".btn-help").attr("style", "");
|
1235 |
+
jQuery("a.remove-chaty-widget-sticky").attr("style", "");
|
1236 |
+
}
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
if (jQuery("#scroll-to-item").length && jQuery("#admin-preview").length) {
|
1240 |
+
if(jQuery("body").hasClass("has-premio-box")) {
|
1241 |
+
topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 625;
|
1242 |
+
} else {
|
1243 |
+
topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 485;
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
if (topPos < 0) {
|
1247 |
+
topPos = Math.abs(topPos);
|
1248 |
+
jQuery("#admin-preview").css("margin-top", ((-1) * topPos) + "px");
|
1249 |
+
} else {
|
1250 |
+
jQuery("#admin-preview").css("margin-top", "0");
|
1251 |
+
}
|
1252 |
+
}
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
var totalPageOptions = 0;
|
1256 |
+
var pageOptionContent = "";
|
1257 |
+
var totalDateAndTimeOptions = 0;
|
1258 |
+
var dateAndTimeOptionContent = "";
|
1259 |
+
jQuery(document).ready(function () {
|
1260 |
+
totalPageOptions = parseInt(jQuery(".chaty-page-option").length);
|
1261 |
+
pageOptionContent = jQuery(".chaty-page-options-html").html();
|
1262 |
+
jQuery(".chaty-page-options-html").remove();
|
1263 |
+
totalDateAndTimeOptions = parseInt(jQuery(".chaty-date-time-option").length);
|
1264 |
+
dateAndTimeOptionContent = jQuery(".chaty-date-and-time-options-html").html();
|
1265 |
+
jQuery(".chaty-date-and-time-options-html").remove();
|
1266 |
+
|
1267 |
+
jQuery("#create-rule").click(function () {
|
1268 |
+
// appendHtml = pageOptionContent.replace(/__count__/g, totalPageOptions, pageOptionContent);
|
1269 |
+
// totalPageOptions++;
|
1270 |
+
// jQuery(".chaty-page-options").append(appendHtml);
|
1271 |
+
// jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
|
1272 |
+
// jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
|
1273 |
+
//
|
1274 |
+
// if (jQuery("#is_pro_plugin").val() == "0") {
|
1275 |
+
// jQuery(".chaty-page-options").find("input").attr("name", "");
|
1276 |
+
// jQuery(".chaty-page-options").find("select").attr("name", "");
|
1277 |
+
// jQuery(".chaty-page-options").find("input").removeClass("cht-required");
|
1278 |
+
// jQuery(".chaty-page-options").find("select").removeClass("cht-required");
|
1279 |
+
// jQuery(this).remove();
|
1280 |
+
// }
|
1281 |
+
jQuery(".page-options").toggle();
|
1282 |
+
});
|
1283 |
+
|
1284 |
+
jQuery("#create-data-and-time-rule").click(function () {
|
1285 |
+
jQuery(".chaty-data-and-time-rules").toggle();
|
1286 |
+
});
|
1287 |
+
|
1288 |
+
jQuery(document).on("change", "#chaty_attention_effect", function(){
|
1289 |
+
var currentClass = jQuery(this).attr("data-effect");
|
1290 |
+
if(currentClass != "") {
|
1291 |
+
jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
|
1292 |
+
}
|
1293 |
+
jQuery("#iconWidget").removeClass("start-now");
|
1294 |
+
jQuery("#iconWidget").addClass("chaty-animation-"+jQuery(this).val()).addClass("start-now");
|
1295 |
+
jQuery(this).attr("data-effect", jQuery(this).val());
|
1296 |
+
});
|
1297 |
+
|
1298 |
+
setInterval(function(){
|
1299 |
+
var currentClass = jQuery("#chaty_attention_effect").attr("data-effect");
|
1300 |
+
if(currentClass != "") {
|
1301 |
+
jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
|
1302 |
+
jQuery("#iconWidget").removeClass("start-now");
|
1303 |
+
setTimeout(function(){
|
1304 |
+
jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now");
|
1305 |
+
}, 1000);
|
1306 |
+
} else {
|
1307 |
+
jQuery("#chaty_attention_effect").attr("data-effect", jQuery("#chaty_attention_effect").val());
|
1308 |
+
}
|
1309 |
+
}, 5000);
|
1310 |
+
|
1311 |
+
jQuery(document).on("click", ".remove-chaty", function () {
|
1312 |
+
jQuery(this).closest(".chaty-page-option").remove();
|
1313 |
+
jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
|
1314 |
+
jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
|
1315 |
+
});
|
1316 |
+
|
1317 |
+
jQuery(document).on("click", ".remove-page-option", function () {
|
1318 |
+
jQuery(this).closest(".chaty-date-time-option").remove();
|
1319 |
+
});
|
1320 |
+
|
1321 |
+
jQuery("#image-upload-content .custom-control-label").click(function (e) {
|
1322 |
+
e.stopPropagation();
|
1323 |
+
jQuery(this).closest(".custom-control").find("input[type=radio]").attr("checked", true);
|
1324 |
+
jQuery('.js-widget-i').trigger("change");
|
1325 |
+
return false;
|
1326 |
+
});
|
1327 |
+
//jQuery('.chaty-color-field').wpColorPicker({
|
1328 |
+
// pick: "Background Color",
|
1329 |
+
// target: false,
|
1330 |
+
// change: function(event, ui){
|
1331 |
+
// chaty_set_bg_color();
|
1332 |
+
// }
|
1333 |
+
//});
|
1334 |
+
|
1335 |
+
jQuery('.chaty-color-field').spectrum({
|
1336 |
+
chooseText: "Submit",
|
1337 |
+
preferredFormat: "hex",
|
1338 |
+
cancelText: "Cancel",
|
1339 |
+
showInput: true,
|
1340 |
+
move: function (color) {
|
1341 |
+
jQuery(this).val(color.toHexString());
|
1342 |
+
chaty_set_bg_color();
|
1343 |
+
change_custom_preview();
|
1344 |
+
}
|
1345 |
+
});
|
1346 |
+
jQuery(".chaty-color-field").change(function () {
|
1347 |
+
chaty_set_bg_color();
|
1348 |
+
change_custom_preview();
|
1349 |
+
});
|
1350 |
+
|
1351 |
+
jQuery(".remove-chaty-img").on("click", function (e) {
|
1352 |
+
e.stopPropagation();
|
1353 |
+
});
|
1354 |
+
|
1355 |
+
jQuery("#channels-selected-list").sortable({
|
1356 |
+
placeholder: "ui-chaty-state-hl",
|
1357 |
+
items: "li:not(#chaty-social-close)",
|
1358 |
+
update: function (event, ui) {
|
1359 |
+
set_social_channel_order();
|
1360 |
+
change_custom_preview();
|
1361 |
+
}
|
1362 |
+
});
|
1363 |
+
|
1364 |
+
jQuery(".close-button-img img, .close-button-img .image-upload").click(function () {
|
1365 |
+
var image = wp.media({
|
1366 |
+
title: 'Upload Image',
|
1367 |
+
// mutiple: true if you want to upload multiple files at once
|
1368 |
+
multiple: false,
|
1369 |
+
library: {
|
1370 |
+
type: 'image',
|
1371 |
+
}
|
1372 |
+
}).open()
|
1373 |
+
.on('select', function (e) {
|
1374 |
+
var uploaded_image = image.state().get('selection').first();
|
1375 |
+
imageData = uploaded_image.toJSON();
|
1376 |
+
jQuery('.close-button-img').addClass("active");
|
1377 |
+
jQuery('.close-button-img input').val(imageData.id);
|
1378 |
+
jQuery('.close-button-img img').attr("src", imageData.url);
|
1379 |
+
change_custom_preview();
|
1380 |
+
});
|
1381 |
+
});
|
1382 |
+
|
1383 |
+
jQuery(".remove-close-img").click(function () {
|
1384 |
+
default_image = jQuery("#default_image").val();
|
1385 |
+
jQuery('.close-button-img').removeClass("active");
|
1386 |
+
jQuery('.close-button-img input').val("");
|
1387 |
+
jQuery('.close-button-img img').attr("src", default_image);
|
1388 |
+
change_custom_preview();
|
1389 |
+
});
|
1390 |
+
|
1391 |
+
jQuery(document).on("click", ".chaty-widget.click", function(e){
|
1392 |
+
e.preventDefault();
|
1393 |
+
// jQuery(".chaty-channels").toggle();
|
1394 |
+
jQuery(".chaty-widget").toggleClass("active");
|
1395 |
+
});
|
1396 |
+
|
1397 |
+
jQuery(document).on('change', '.url-options.cht-required', function (ev) {
|
1398 |
+
thisVal = jQuery(this).val();
|
1399 |
+
siteURL = jQuery("#chaty_site_url").val();
|
1400 |
+
newURL = siteURL;
|
1401 |
+
if (thisVal == "page_has_url") {
|
1402 |
+
newURL = siteURL;
|
1403 |
+
} else if (thisVal == "page_contains") {
|
1404 |
+
newURL = siteURL + "%s%";
|
1405 |
+
} else if (thisVal == "page_start_with") {
|
1406 |
+
newURL = siteURL + "s%";
|
1407 |
+
} else if (thisVal == "page_end_with") {
|
1408 |
+
newURL = siteURL + "%s";
|
1409 |
+
}
|
1410 |
+
jQuery(this).closest(".url-content").find(".chaty-url").text(newURL);
|
1411 |
+
});
|
1412 |
+
|
1413 |
+
check_for_chaty_close_button();
|
1414 |
+
chaty_set_bg_color();
|
1415 |
+
change_custom_preview();
|
1416 |
+
|
1417 |
+
jQuery(".chaty-settings.cls-btn a, .close-btn-set").click(function (e) {
|
1418 |
+
e.preventDefault();
|
1419 |
+
jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active");
|
1420 |
+
});
|
1421 |
+
|
1422 |
+
/*Default Values*/
|
1423 |
+
if (jQuery("input[name='cht_position']:checked").length == 0) {
|
1424 |
+
jQuery("#right-position").attr("checked", true);
|
1425 |
+
jQuery("input[name='cht_position']:checked").trigger("change");
|
1426 |
+
}
|
1427 |
+
if (jQuery("input[name='widget_icon']:checked").length == 0) {
|
1428 |
+
jQuery("input[name='widget_icon']:first").attr("checked", true);
|
1429 |
+
jQuery("input[name='widget_icon']:checked").trigger("change");
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
/*font family Privew*/
|
1433 |
+
jQuery('.form-fonts').on( 'change', function() {
|
1434 |
+
var font_val = jQuery(this).val();
|
1435 |
+
jQuery('.chaty-google-font').remove();
|
1436 |
+
if (font_val != "") {
|
1437 |
+
jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
|
1438 |
+
jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
|
1439 |
+
} else {
|
1440 |
+
jQuery('.preview-section-chaty #admin-preview .page-body').attr("style","");
|
1441 |
+
}
|
1442 |
+
});
|
1443 |
+
});
|
1444 |
+
|
1445 |
+
jQuery(window).load(function () {
|
1446 |
+
check_for_chaty_close_button();
|
1447 |
+
chaty_set_bg_color();
|
1448 |
+
jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
|
1449 |
+
jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
|
1450 |
+
|
1451 |
+
jQuery('.url-options.cht-required').each(function () {
|
1452 |
+
jQuery(this).trigger("change");
|
1453 |
+
});
|
1454 |
+
var font_val = jQuery('.form-fonts').val();
|
1455 |
+
jQuery('.chaty-google-font').remove();
|
1456 |
+
if (font_val != "") {
|
1457 |
+
jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
|
1458 |
+
jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
|
1459 |
+
}
|
1460 |
+
// jQuery("#chaty_default_state").trigger("change");
|
1461 |
+
});
|
1462 |
+
|
1463 |
+
var selectedsocialSlug = "";
|
1464 |
+
|
1465 |
+
function upload_chaty_image(socialSlug) {
|
1466 |
+
selectedsocialSlug = socialSlug;
|
1467 |
+
var image = wp.media({
|
1468 |
+
title: 'Upload Image',
|
1469 |
+
// mutiple: true if you want to upload multiple files at once
|
1470 |
+
multiple: false,
|
1471 |
+
library: {
|
1472 |
+
type: 'image',
|
1473 |
+
}
|
1474 |
+
}).open()
|
1475 |
+
.on('select', function (e) {
|
1476 |
+
var uploaded_image = image.state().get('selection').first();
|
1477 |
+
imageData = uploaded_image.toJSON();
|
1478 |
+
jQuery('#cht_social_image_' + selectedsocialSlug).val(imageData.id);
|
1479 |
+
jQuery('.custom-image-' + selectedsocialSlug + " img").attr("src", imageData.url);
|
1480 |
+
jQuery("#chaty-social-" + selectedsocialSlug + " .channels-selected__item").addClass("img-active");
|
1481 |
+
change_custom_preview();
|
1482 |
+
});
|
1483 |
+
}
|
1484 |
+
|
1485 |
+
function toggle_chaty_setting(socId) {
|
1486 |
+
jQuery("#chaty-social-" + socId).find(".chaty-advance-settings").toggle();
|
1487 |
+
change_custom_preview();
|
1488 |
+
}
|
1489 |
+
|
1490 |
+
function chaty_set_bg_color() {
|
1491 |
+
jQuery(".chaty-color-field").each(function () {
|
1492 |
+
if (jQuery(this).val() != "" && jQuery(this).val() != "#ffffff") {
|
1493 |
+
if (jQuery(this).closest("li").data("id") != "Linkedin" || (jQuery(this).closest("li").data("id") == "Linkedin" && jQuery(this).val() != "#ffffff")) {
|
1494 |
+
defaultColor = jQuery(this).val();
|
1495 |
+
jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill", defaultColor);
|
1496 |
+
jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background", defaultColor);
|
1497 |
+
jQuery(this).closest(".channels-selected__item").find(".facustom-icon").css("background", defaultColor);
|
1498 |
+
}
|
1499 |
+
}
|
1500 |
+
});
|
1501 |
+
change_custom_preview();
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
function upload_qr_code() {
|
1505 |
+
var image = wp.media({
|
1506 |
+
title: 'Upload QR Image',
|
1507 |
+
multiple: false,
|
1508 |
+
library: {
|
1509 |
+
type: 'image',
|
1510 |
+
}
|
1511 |
+
}).open()
|
1512 |
+
.on('select', function (e) {
|
1513 |
+
var uploaded_image = image.state().get('selection').first();
|
1514 |
+
imageData = uploaded_image.toJSON();
|
1515 |
+
jQuery('#upload_qr_code_val').val(imageData.id);
|
1516 |
+
jQuery('#upload_qr_code img').attr("src", imageData.url);
|
1517 |
+
jQuery(".remove-qr-code").addClass("active");
|
1518 |
+
change_custom_preview();
|
1519 |
+
});
|
1520 |
+
}
|
1521 |
+
|
1522 |
+
function remove_qr_code() {
|
1523 |
+
jQuery(".remove-qr-code").removeClass("active");
|
1524 |
+
jQuery('#upload_qr_code_val').val("");
|
1525 |
+
default_image = jQuery("#default_image").val();
|
1526 |
+
jQuery('#upload_qr_code img').attr("src", default_image);
|
1527 |
+
change_custom_preview();
|
1528 |
+
}
|
1529 |
+
|
1530 |
+
function remove_chaty_image(socId) {
|
1531 |
+
default_image = jQuery("#default_image").val();
|
1532 |
+
jQuery("#chaty-social-" + socId + " .channels-selected__item").removeClass("img-active");
|
1533 |
+
jQuery('#cht_social_image_' + socId).val("");
|
1534 |
+
jQuery('#cht_social_image_src_' + socId).attr("src", default_image);
|
1535 |
+
change_custom_preview();
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
var baseIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
1539 |
+
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
1540 |
+
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
1541 |
+
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1542 |
+
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
1543 |
+
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1544 |
+
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
1545 |
+
' </svg>',
|
1546 |
+
defaultIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
1547 |
+
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
1548 |
+
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
1549 |
+
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1550 |
+
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
1551 |
+
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1552 |
+
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
1553 |
+
' </svg>'
|
1554 |
+
var iconBlock = document.getElementById('iconWidget');
|
1555 |
+
|
1556 |
+
function set_social_channel_order() {
|
1557 |
+
socialString = [];
|
1558 |
+
jQuery("#channels-selected-list li").each(function () {
|
1559 |
+
socialString.push(jQuery(this).attr("data-id"));
|
1560 |
+
});
|
1561 |
+
socialString = socialString.join(",");
|
1562 |
+
jQuery("#cht_numb_slug").val(socialString);
|
1563 |
+
check_for_chaty_close_button();
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
function check_for_chaty_close_button() {
|
1567 |
+
if (jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length >= 2) {
|
1568 |
+
jQuery("#chaty-social-close").show();
|
1569 |
+
} else {
|
1570 |
+
jQuery("#chaty-social-close").hide();
|
1571 |
+
}
|
1572 |
+
change_custom_preview();
|
1573 |
+
var srtString = "";
|
1574 |
+
jQuery("#channels-selected-list > li").each(function(){
|
1575 |
+
if(jQuery(this).attr("data-id") != "undefined" && jQuery(this).attr("data-id") != "") {
|
1576 |
+
srtString += jQuery(this).attr("data-id")+",";
|
1577 |
+
}
|
1578 |
+
srtString = srtString.trimRight(",")
|
1579 |
+
});
|
1580 |
+
jQuery(".add_slug").val(srtString);
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
function change_custom_preview() {
|
1584 |
+
var desktop,
|
1585 |
+
mobile,
|
1586 |
+
colorSelf = false;
|
1587 |
+
jQuery("#iconWidget").removeClass("img-p-active");
|
1588 |
+
if (getChtPreviewDesktop()) {
|
1589 |
+
if (jQuery('.js-chanel-desktop:checked').length === 0) {
|
1590 |
+
desktop = false;
|
1591 |
+
}
|
1592 |
+
if (jQuery('.js-chanel-desktop:checked').length === 1) {
|
1593 |
+
desktop = jQuery('.js-chanel-desktop:checked').closest("li").find(".icon.icon-md").html();
|
1594 |
+
if (jQuery('.js-chanel-desktop:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
1595 |
+
jQuery("#iconWidget").addClass("img-p-active");
|
1596 |
+
}
|
1597 |
+
}
|
1598 |
+
if (jQuery('.js-chanel-desktop:checked').length > 1) {
|
1599 |
+
desktop = defaultIcon;
|
1600 |
+
colorSelf = true;
|
1601 |
+
}
|
1602 |
+
} else {
|
1603 |
+
if (jQuery('.js-chanel-mobile:checked').length === 0) {
|
1604 |
+
mobile = false;
|
1605 |
+
}
|
1606 |
+
if (jQuery('.js-chanel-mobile:checked').length === 1) {
|
1607 |
+
mobile = jQuery('.js-chanel-mobile:checked').closest("li").find(".icon.icon-md").html();
|
1608 |
+
if (jQuery('.js-chanel-mobile:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
1609 |
+
jQuery("#iconWidget").addClass("img-p-active");
|
1610 |
+
}
|
1611 |
+
}
|
1612 |
+
if (jQuery('.js-chanel-mobile:checked').length > 1) {
|
1613 |
+
mobile = defaultIcon;
|
1614 |
+
colorSelf = true;
|
1615 |
+
}
|
1616 |
+
}
|
1617 |
+
|
1618 |
+
|
1619 |
+
desktopIcon = desktop;
|
1620 |
+
mobileIcon = mobile;
|
1621 |
+
|
1622 |
+
if (getChtPreviewDesktop()) {
|
1623 |
+
setChtIcon(desktopIcon, colorSelf)
|
1624 |
+
} else {
|
1625 |
+
setChtIcon(mobileIcon, colorSelf)
|
1626 |
+
}
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
function getChtPreviewDesktop() {
|
1630 |
+
return jQuery('#previewDesktop').attr('checked') === 'checked' ? true : false;
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
function setChtIcon(icon, colorSelf) {
|
1634 |
+
iconBlock = document.getElementById('iconWidget');
|
1635 |
+
if (icon) {
|
1636 |
+
//jQuery('.preview .page .chaty-widget').show();
|
1637 |
+
iconBlock.innerHTML = icon;
|
1638 |
+
} else {
|
1639 |
+
//jQuery('.preview .page .chaty-widget').hide();
|
1640 |
+
iconBlock.innerHTML = '';
|
1641 |
+
}
|
1642 |
+
if (colorSelf) {
|
1643 |
+
var color = jQuery('.color-picker-custom input').val() ? jQuery('.color-picker-custom input').val() : jQuery('.color-picker-radio input:checked').val();
|
1644 |
+
jQuery('.preview .page svg circle').css({fill: color});
|
1645 |
+
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
1646 |
+
}
|
1647 |
+
jQuery('.js-widget-i:checked').trigger("change");
|
1648 |
+
}
|
admin/assets/js/cht-scripts.min.js
CHANGED
@@ -1,1623 +1 @@
|
|
1 |
-
/**
|
2 |
-
* easyModal.js v1.3.2
|
3 |
-
* A minimal jQuery modal that works with your CSS.
|
4 |
-
* Author: Flavius Matis - http://flaviusmatis.github.com/
|
5 |
-
* URL: https://github.com/flaviusmatis/easyModal.js
|
6 |
-
*
|
7 |
-
* Copyright 2012, Flavius Matis
|
8 |
-
* Released under the MIT license.
|
9 |
-
* http://flaviusmatis.github.com/license.html
|
10 |
-
*/
|
11 |
-
|
12 |
-
/* jslint browser: true */
|
13 |
-
/* global jQuery */
|
14 |
-
|
15 |
-
jQuery(document).ready(function () {
|
16 |
-
var chatyError;
|
17 |
-
jQuery("#cht-form").submit(function () {
|
18 |
-
set_social_channel_order();
|
19 |
-
phoneNumberReg = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/;
|
20 |
-
if (jQuery("#cht-form #Whatsapp").length && jQuery("#cht-form #Whatsapp").val() != "") {
|
21 |
-
InputVal = jQuery.trim(jQuery("#cht-form #Whatsapp").val());
|
22 |
-
chatyError = check_for_number_chaty(InputVal, "Whatsapp");
|
23 |
-
if(chatyError) {
|
24 |
-
if(!confirm("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
25 |
-
jQuery("#cht-form #Whatsapp").focus();
|
26 |
-
return false;
|
27 |
-
}
|
28 |
-
}
|
29 |
-
}
|
30 |
-
if (jQuery("#cht-form #Phone").length && jQuery("#cht-form #Phone").val() != "") {
|
31 |
-
InputVal = jQuery.trim(jQuery("#cht-form #Phone").val());
|
32 |
-
chatyError = check_for_number_chaty(InputVal, "Phone");
|
33 |
-
if(chatyError) {
|
34 |
-
if(!confirm("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
35 |
-
jQuery("#cht-form #Phone").focus();
|
36 |
-
return false;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
if (jQuery("#cht-form #Facebook_Messenger").length && jQuery("#cht-form #Facebook_Messenger").val() != "") {
|
41 |
-
faceBookMeReg = /(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
|
42 |
-
faceBookReg = /(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
|
43 |
-
InputVal = jQuery.trim(jQuery("#Facebook_Messenger").val());
|
44 |
-
jQuery("#cht-form #Facebook_Messenger").val(InputVal);
|
45 |
-
if (!faceBookReg.test(InputVal) && !faceBookMeReg.test(InputVal)) {
|
46 |
-
alert("Please make sure your Facebook page's URL looks like, \nhttps://m.me/YOURPAGE");
|
47 |
-
jQuery("#cht-form #Facebook_Messenger").focus();
|
48 |
-
return false;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
if (jQuery("#cht-form #SMS").length && jQuery("#cht-form #SMS").val() != "") {
|
52 |
-
InputVal = jQuery.trim(jQuery("#cht-form #SMS").val());
|
53 |
-
chatyError = check_for_number_chaty(InputVal, "SMS");
|
54 |
-
if(chatyError) {
|
55 |
-
if(!confirm("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
56 |
-
jQuery("#cht-form #SMS").focus();
|
57 |
-
return false;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
if (jQuery("#cht-form #Viber").length && jQuery("#cht-form #Viber").val() != "") {
|
62 |
-
InputVal = jQuery.trim(jQuery("#cht-form #Viber").val());
|
63 |
-
chatyError = check_for_number_chaty(InputVal, "Viber");
|
64 |
-
if(chatyError) {
|
65 |
-
if(!confirm("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
|
66 |
-
jQuery("#cht-form #Viber").focus();
|
67 |
-
return false;
|
68 |
-
}
|
69 |
-
}
|
70 |
-
}
|
71 |
-
errorCount = 0;
|
72 |
-
if (jQuery("#chaty-page-options .cht-required").length) {
|
73 |
-
jQuery("#chaty-page-options .cht-required").each(function () {
|
74 |
-
if (jQuery.trim(jQuery(this).val()) == "") {
|
75 |
-
jQuery(this).addClass("cht-input-error");
|
76 |
-
errorCount++;
|
77 |
-
}
|
78 |
-
});
|
79 |
-
}
|
80 |
-
if (jQuery(".chaty-data-and-time-rules .cht-required").length) {
|
81 |
-
jQuery(".chaty-data-and-time-rules .cht-required").each(function () {
|
82 |
-
if (jQuery.trim(jQuery(this).val()) == "") {
|
83 |
-
jQuery(this).addClass("cht-input-error");
|
84 |
-
errorCount++;
|
85 |
-
}
|
86 |
-
});
|
87 |
-
}
|
88 |
-
console.log("errorCount: "+ errorCount);
|
89 |
-
if (errorCount != 0) {
|
90 |
-
return false;
|
91 |
-
} else {
|
92 |
-
var inputError = 0;
|
93 |
-
if(jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
|
94 |
-
jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
|
95 |
-
if(jQuery.trim(jQuery(this).val()) == "") {
|
96 |
-
inputError++;
|
97 |
-
}
|
98 |
-
});
|
99 |
-
if(inputError == jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
|
100 |
-
if(confirm("You need to fill out at least one channel details for Chaty to show up on your website. Click cancel to keep editing.")) {
|
101 |
-
return true;
|
102 |
-
} else {
|
103 |
-
jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
|
104 |
-
if(jQuery.trim(jQuery(this).val()) == "") {
|
105 |
-
inputError = 1;
|
106 |
-
}
|
107 |
-
});
|
108 |
-
jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").addClass("border-red");
|
109 |
-
jQuery("#channels-selected-list > li:not(#chaty-social-close) .channels__input:first").focus();
|
110 |
-
return false;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
}
|
115 |
-
return true;
|
116 |
-
});
|
117 |
-
});
|
118 |
-
|
119 |
-
function check_for_number_chaty(phoneNumber, validationFor) {
|
120 |
-
if (phoneNumber != "") {
|
121 |
-
if (phoneNumber[0] == "+") {
|
122 |
-
phoneNumber = phoneNumber.substr(1, phoneNumber.length)
|
123 |
-
}
|
124 |
-
if (validationFor == "Phone") {
|
125 |
-
if (phoneNumber[0] == "*") {
|
126 |
-
phoneNumber = phoneNumber.substr(1, phoneNumber.length)
|
127 |
-
}
|
128 |
-
}
|
129 |
-
if (isNaN(phoneNumber)) {
|
130 |
-
return true;
|
131 |
-
}
|
132 |
-
}
|
133 |
-
return false;
|
134 |
-
}
|
135 |
-
|
136 |
-
(function ($, sr) {
|
137 |
-
var debounce = function (func, threshold, execAsap) {
|
138 |
-
var timeout;
|
139 |
-
|
140 |
-
return function debounced() {
|
141 |
-
var obj = this;
|
142 |
-
var
|
143 |
-
args = arguments;
|
144 |
-
|
145 |
-
function delayed() {
|
146 |
-
if (!execAsap) func.apply(obj, args);
|
147 |
-
timeout = null;
|
148 |
-
}
|
149 |
-
|
150 |
-
if (timeout) clearTimeout(timeout);
|
151 |
-
else if (execAsap) func.apply(obj, args);
|
152 |
-
|
153 |
-
timeout = setTimeout(delayed, threshold || 100);
|
154 |
-
};
|
155 |
-
};
|
156 |
-
// smartModalResize
|
157 |
-
jQuery.fn[sr] = function (fn) {
|
158 |
-
return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
|
159 |
-
};
|
160 |
-
}(jQuery, 'smartModalResize'));
|
161 |
-
|
162 |
-
(function ($) {
|
163 |
-
'use strict';
|
164 |
-
|
165 |
-
var methods = {
|
166 |
-
init: function (options) {
|
167 |
-
var defaults = {
|
168 |
-
top: 'auto',
|
169 |
-
left: 'auto',
|
170 |
-
autoOpen: false,
|
171 |
-
overlayOpacity: 0.5,
|
172 |
-
overlayColor: '#000',
|
173 |
-
overlayClose: true,
|
174 |
-
overlayParent: 'body',
|
175 |
-
closeOnEscape: true,
|
176 |
-
closeButtonClass: '.close',
|
177 |
-
transitionIn: '',
|
178 |
-
transitionOut: '',
|
179 |
-
onOpen: false,
|
180 |
-
onClose: false,
|
181 |
-
zIndex: function () {
|
182 |
-
return (function (value) {
|
183 |
-
return value === -Infinity ? 0 : value + 1;
|
184 |
-
}(Math.max.apply(Math, $.makeArray(jQuery('*').map(function () {
|
185 |
-
return jQuery(this).css('z-index');
|
186 |
-
}).filter(function () {
|
187 |
-
return $.isNumeric(this);
|
188 |
-
}).map(function () {
|
189 |
-
return parseInt(this, 10);
|
190 |
-
})))));
|
191 |
-
},
|
192 |
-
updateZIndexOnOpen: true,
|
193 |
-
hasVariableWidth: false
|
194 |
-
};
|
195 |
-
|
196 |
-
options = $.extend(defaults, options);
|
197 |
-
|
198 |
-
return this.each(function () {
|
199 |
-
var o = options;
|
200 |
-
|
201 |
-
|
202 |
-
var $overlay = jQuery('<div class="lean-overlay"></div>');
|
203 |
-
|
204 |
-
|
205 |
-
var $modal = jQuery(this);
|
206 |
-
|
207 |
-
$overlay.css({
|
208 |
-
display: 'none',
|
209 |
-
position: 'fixed',
|
210 |
-
// When updateZIndexOnOpen is set to true, we avoid computing the z-index on initialization,
|
211 |
-
// because the value would be replaced when opening the modal.
|
212 |
-
'z-index': (o.updateZIndexOnOpen ? 0 : o.zIndex()),
|
213 |
-
top: 0,
|
214 |
-
left: 0,
|
215 |
-
height: '100%',
|
216 |
-
width: '100%',
|
217 |
-
background: o.overlayColor,
|
218 |
-
opacity: o.overlayOpacity,
|
219 |
-
overflow: 'auto'
|
220 |
-
}).appendTo(o.overlayParent);
|
221 |
-
|
222 |
-
$modal.css({
|
223 |
-
display: 'none',
|
224 |
-
position: 'fixed',
|
225 |
-
// When updateZIndexOnOpen is set to true, we avoid computing the z-index on initialization,
|
226 |
-
// because the value would be replaced when opening the modal.
|
227 |
-
'z-index': (o.updateZIndexOnOpen ? 0 : o.zIndex() + 1),
|
228 |
-
left: parseInt(o.left, 10) > -1 ? o.left + 'px' : 50 + '%',
|
229 |
-
top: parseInt(o.top, 10) > -1 ? o.top + 'px' : 50 + '%'
|
230 |
-
});
|
231 |
-
|
232 |
-
$modal.bind('openModal', function () {
|
233 |
-
var overlayZ = o.updateZIndexOnOpen ? o.zIndex() : parseInt($overlay.css('z-index'), 10);
|
234 |
-
|
235 |
-
|
236 |
-
var modalZ = overlayZ + 1;
|
237 |
-
|
238 |
-
if (o.transitionIn !== '' && o.transitionOut !== '') {
|
239 |
-
$modal.removeClass(o.transitionOut).addClass(o.transitionIn);
|
240 |
-
}
|
241 |
-
$modal.css({
|
242 |
-
display: 'block',
|
243 |
-
'margin-left': (parseInt(o.left, 10) > -1 ? 0 : -($modal.outerWidth() / 2)) + 'px',
|
244 |
-
'margin-top': (parseInt(o.top, 10) > -1 ? 0 : -($modal.outerHeight() / 2)) + 'px',
|
245 |
-
'z-index': modalZ
|
246 |
-
});
|
247 |
-
|
248 |
-
$overlay.css({'z-index': overlayZ, display: 'block'});
|
249 |
-
|
250 |
-
if (o.onOpen && typeof o.onOpen === 'function') {
|
251 |
-
// onOpen callback receives as argument the modal window
|
252 |
-
o.onOpen($modal[0]);
|
253 |
-
}
|
254 |
-
});
|
255 |
-
|
256 |
-
$modal.bind('closeModal', function () {
|
257 |
-
if (o.transitionIn !== '' && o.transitionOut !== '') {
|
258 |
-
$modal.removeClass(o.transitionIn).addClass(o.transitionOut);
|
259 |
-
$modal.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
|
260 |
-
$modal.css('display', 'none');
|
261 |
-
$overlay.css('display', 'none');
|
262 |
-
});
|
263 |
-
} else {
|
264 |
-
$modal.css('display', 'none');
|
265 |
-
$overlay.css('display', 'none');
|
266 |
-
}
|
267 |
-
if (o.onClose && typeof o.onClose === 'function') {
|
268 |
-
// onClose callback receives as argument the modal window
|
269 |
-
o.onClose($modal[0]);
|
270 |
-
}
|
271 |
-
});
|
272 |
-
|
273 |
-
// Close on overlay click
|
274 |
-
$overlay.click(function () {
|
275 |
-
if (o.overlayClose) {
|
276 |
-
$modal.trigger('closeModal');
|
277 |
-
}
|
278 |
-
});
|
279 |
-
|
280 |
-
jQuery(document).keydown(function (e) {
|
281 |
-
// ESCAPE key pressed
|
282 |
-
if (o.closeOnEscape && e.keyCode === 27) {
|
283 |
-
$modal.trigger('closeModal');
|
284 |
-
}
|
285 |
-
});
|
286 |
-
|
287 |
-
jQuery(window).smartModalResize(function () {
|
288 |
-
if (o.hasVariableWidth) {
|
289 |
-
$modal.css({
|
290 |
-
'margin-left': (parseInt(o.left, 10) > -1 ? 0 : -($modal.outerWidth() / 2)) + 'px',
|
291 |
-
'margin-top': (parseInt(o.top, 10) > -1 ? 0 : -($modal.outerHeight() / 2)) + 'px'
|
292 |
-
});
|
293 |
-
}
|
294 |
-
});
|
295 |
-
|
296 |
-
// Close when button pressed
|
297 |
-
$modal.on('click', o.closeButtonClass, function (e) {
|
298 |
-
$modal.trigger('closeModal');
|
299 |
-
e.preventDefault();
|
300 |
-
});
|
301 |
-
|
302 |
-
// Automatically open modal if option set
|
303 |
-
if (o.autoOpen) {
|
304 |
-
$modal.trigger('openModal');
|
305 |
-
}
|
306 |
-
});
|
307 |
-
}
|
308 |
-
};
|
309 |
-
|
310 |
-
$.fn.easyModal = function (method) {
|
311 |
-
// Method calling logic
|
312 |
-
if (methods[method]) {
|
313 |
-
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
314 |
-
}
|
315 |
-
|
316 |
-
if (typeof method === 'object' || !method) {
|
317 |
-
return methods.init.apply(this, arguments);
|
318 |
-
}
|
319 |
-
|
320 |
-
$.error('Method ' + method + ' does not exist on jQuery.easyModal');
|
321 |
-
};
|
322 |
-
}(jQuery));
|
323 |
-
(function ($) {
|
324 |
-
jQuery(document).ready(function () {
|
325 |
-
jQuery('input, .icon, textarea, .btn-cancel:not(.close-btn-set) ').click(function (event) {
|
326 |
-
window.onbeforeunload = function (e) {
|
327 |
-
e = e || window.event;
|
328 |
-
e.preventDefault = true;
|
329 |
-
e.cancelBubble = true;
|
330 |
-
e.returnValue = 'Your beautiful goodbye message';
|
331 |
-
};
|
332 |
-
});
|
333 |
-
|
334 |
-
jQuery(document).on('submit', 'form', function (event) {
|
335 |
-
window.onbeforeunload = null;
|
336 |
-
});
|
337 |
-
|
338 |
-
//jQuery('.preview').stick_in_parent({
|
339 |
-
// offset_top: 200
|
340 |
-
//});
|
341 |
-
|
342 |
-
jQuery('.upg').click(function (event) {
|
343 |
-
jQuery('.valid_domain_input').val(jQuery('.valid_domain_input').val().replace(' ', ''));
|
344 |
-
if (!/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(jQuery('.valid_domain_input').val())) {
|
345 |
-
event.preventDefault();
|
346 |
-
jQuery('.valid_domain').fadeIn().css({
|
347 |
-
display: 'block'
|
348 |
-
});
|
349 |
-
}
|
350 |
-
});
|
351 |
-
jQuery('.del_token').click(function (event) {
|
352 |
-
$.ajax({
|
353 |
-
type: 'POST',
|
354 |
-
url: ajaxurl,
|
355 |
-
data: {
|
356 |
-
action: 'del_token',
|
357 |
-
nonce_code: cht_nonce_ajax.cht_nonce
|
358 |
-
},
|
359 |
-
success: function (bool) {
|
360 |
-
location.reload();
|
361 |
-
},
|
362 |
-
error: function (xhr, status, error) {
|
363 |
-
|
364 |
-
}
|
365 |
-
});
|
366 |
-
});
|
367 |
-
|
368 |
-
jQuery(document).on("blur", "#channels-selected-list > li:not(#chaty-social-close) .channels__input", function(){
|
369 |
-
if(jQuery(this).hasClass("border-red") && jQuery(this).val() != "") {
|
370 |
-
jQuery(this).removeClass("border-red");
|
371 |
-
}
|
372 |
-
});
|
373 |
-
|
374 |
-
(function easyModal() {
|
375 |
-
jQuery('.easy-modal').easyModal({
|
376 |
-
top: 150,
|
377 |
-
overlay: 0.2
|
378 |
-
});
|
379 |
-
jQuery('.easy-modal-open').click(function (e) {
|
380 |
-
var target = jQuery(this).attr('href');
|
381 |
-
jQuery(target).trigger('openModal');
|
382 |
-
e.preventDefault();
|
383 |
-
});
|
384 |
-
jQuery('.easy-modal-close').click(function (e) {
|
385 |
-
e.preventDefault();
|
386 |
-
jQuery('.easy-modal').trigger('closeModal');
|
387 |
-
});
|
388 |
-
}());
|
389 |
-
var count_click = 1000000003;
|
390 |
-
jQuery('.show_up').click(function () {
|
391 |
-
count_click += 10;
|
392 |
-
jQuery('#upgrade-modal').css({
|
393 |
-
'z-index': count_click,
|
394 |
-
display: 'block',
|
395 |
-
'margin-left': '-258px'
|
396 |
-
});
|
397 |
-
});
|
398 |
-
|
399 |
-
(function colorPicker() {
|
400 |
-
jQuery('.color-picker-btn, .color-picker-btn-close, .color-picker-custom button').on('click', function (e) {
|
401 |
-
e.preventDefault();
|
402 |
-
|
403 |
-
jQuery('.color-picker').toggle();
|
404 |
-
jQuery('.color-picker-btn').toggle();
|
405 |
-
});
|
406 |
-
|
407 |
-
jQuery('.color-picker-radio input').change(function () {
|
408 |
-
var $this = jQuery(this);
|
409 |
-
jQuery('.color-picker-custom input[name="cht_custom_color"]').val('');
|
410 |
-
jQuery('.color-picker-custom .circle').html('?').css({
|
411 |
-
'background-color': '#fff'
|
412 |
-
});
|
413 |
-
if ($this.prop('checked')) {
|
414 |
-
jQuery('.color-picker-radio input').prop('checked', false);
|
415 |
-
$this.prop('checked', true);
|
416 |
-
var color = $this.val();
|
417 |
-
var title = $this.prop('title');
|
418 |
-
} else {
|
419 |
-
color = jQuery('.color-picker-custom input').val();
|
420 |
-
title = 'Custom';
|
421 |
-
}
|
422 |
-
|
423 |
-
jQuery('.color-picker-btn .circle').css({backgroundColor: color});
|
424 |
-
jQuery('.color-picker-btn .text').text(title);
|
425 |
-
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
426 |
-
});
|
427 |
-
|
428 |
-
jQuery('.color-picker-custom input').change(function () {
|
429 |
-
jQuery('.color-picker-radio input').prop('checked', false);
|
430 |
-
|
431 |
-
var $this = jQuery(this);
|
432 |
-
|
433 |
-
var color = $this.val();
|
434 |
-
|
435 |
-
jQuery('.color-picker-btn .circle').css({backgroundColor: color});
|
436 |
-
jQuery('.color-picker-btn .text').text('Custom');
|
437 |
-
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
438 |
-
});
|
439 |
-
}());
|
440 |
-
|
441 |
-
(function customSelect() {
|
442 |
-
jQuery('[name="cht_position"]').change(function () {
|
443 |
-
if (jQuery('#positionCustom').prop('checked')) {
|
444 |
-
jQuery('#positionPro').show();
|
445 |
-
} else {
|
446 |
-
jQuery('#positionPro').hide();
|
447 |
-
}
|
448 |
-
});
|
449 |
-
}());
|
450 |
-
|
451 |
-
|
452 |
-
/**
|
453 |
-
* add Token
|
454 |
-
*/
|
455 |
-
|
456 |
-
var AddTokenBtn = jQuery('.update_token');
|
457 |
-
|
458 |
-
AddTokenBtn.on('click', function (e) {
|
459 |
-
e.preventDefault();
|
460 |
-
var token = jQuery('input[name="cht_token"]').val();
|
461 |
-
|
462 |
-
$.ajax({
|
463 |
-
type: 'POST',
|
464 |
-
url: ajaxurl,
|
465 |
-
data: {
|
466 |
-
action: 'add_token',
|
467 |
-
nonce_code: cht_nonce_ajax.cht_nonce,
|
468 |
-
token: token
|
469 |
-
},
|
470 |
-
beforeSend: function (xhr) {
|
471 |
-
|
472 |
-
},
|
473 |
-
success: function (bool) {
|
474 |
-
if (bool) {
|
475 |
-
alert('Your pro plan is activated');
|
476 |
-
location.reload();
|
477 |
-
} else {
|
478 |
-
alert('You`ve entered a wrong token');
|
479 |
-
}
|
480 |
-
},
|
481 |
-
error: function (xhr, status, error) {
|
482 |
-
|
483 |
-
}
|
484 |
-
});
|
485 |
-
});
|
486 |
-
jQuery('textarea[name=cht_cta]').keyup(function (event) {
|
487 |
-
jQuery('.tooltiptext span').html(jQuery(this).val());
|
488 |
-
if (jQuery(this).val().length == 0) {
|
489 |
-
jQuery('.cta').hide(200);
|
490 |
-
jQuery('.tooltiptext span').hide(200);
|
491 |
-
} else {
|
492 |
-
jQuery('.cta').show(300);
|
493 |
-
jQuery('.tooltiptext span').show(200);
|
494 |
-
}
|
495 |
-
});
|
496 |
-
});
|
497 |
-
}(jQuery));
|
498 |
-
|
499 |
-
(function ($) {
|
500 |
-
jQuery(document).ready(function () {
|
501 |
-
(function preview() {
|
502 |
-
(function previewColor() {
|
503 |
-
jQuery('.color-picker-radio input').change(function () {
|
504 |
-
var $this = jQuery(this);
|
505 |
-
|
506 |
-
if ($this.prop('checked')) {
|
507 |
-
var color = $this.val();
|
508 |
-
} else {
|
509 |
-
color = jQuery('.color-picker-custom input').val();
|
510 |
-
}
|
511 |
-
detectIcon();
|
512 |
-
});
|
513 |
-
|
514 |
-
jQuery('.color-picker-custom input').change(function () {
|
515 |
-
var $this = jQuery(this);
|
516 |
-
|
517 |
-
var color = $this.val();
|
518 |
-
|
519 |
-
detectIcon();
|
520 |
-
});
|
521 |
-
|
522 |
-
jQuery(document).on("change", "#chaty_default_state", function(){
|
523 |
-
|
524 |
-
detectIcon();
|
525 |
-
});
|
526 |
-
|
527 |
-
jQuery('#cht_close_button, #trigger_on_time, #chaty_trigger_on_scroll').click(function () {
|
528 |
-
detectIcon();
|
529 |
-
});
|
530 |
-
}());
|
531 |
-
|
532 |
-
(function previewTooltip() {
|
533 |
-
var $widgetTooltip = jQuery('#widgetTooltip');
|
534 |
-
var $icon = jQuery('.preview .page .icon');
|
535 |
-
|
536 |
-
function tooltipToggle() {
|
537 |
-
if (jQuery('[name=cht_cta]').val().length >= 1) {
|
538 |
-
$icon.removeClass('no-tooltip');
|
539 |
-
} else {
|
540 |
-
$icon.addClass('no-tooltip');
|
541 |
-
}
|
542 |
-
}
|
543 |
-
|
544 |
-
tooltipToggle();
|
545 |
-
|
546 |
-
$widgetTooltip.change(function () {
|
547 |
-
tooltipToggle();
|
548 |
-
});
|
549 |
-
}());
|
550 |
-
|
551 |
-
function previewPosition() {
|
552 |
-
var $inputPosBot = jQuery('#positionBottom');
|
553 |
-
var $inputPosSide = jQuery('#positionSide');
|
554 |
-
var $chatyWidget = jQuery('.preview .page .chaty-widget');
|
555 |
-
var customSpace = '7px';
|
556 |
-
|
557 |
-
var value = jQuery('[name="cht_position"]:checked').val();
|
558 |
-
|
559 |
-
if (value === 'right') {
|
560 |
-
$chatyWidget.css({right: customSpace, left: 'auto', bottom: '7px'});
|
561 |
-
} else if (value === 'left') {
|
562 |
-
$chatyWidget.css({left: customSpace, right: 'auto', bottom: '7px'});
|
563 |
-
} else if (value === 'custom') {
|
564 |
-
if ($inputPosBot.val()) {
|
565 |
-
var positionBottom = $inputPosBot.val() + 'px';
|
566 |
-
} else {
|
567 |
-
positionBottom = customSpace;
|
568 |
-
}
|
569 |
-
|
570 |
-
if ($inputPosSide.val()) {
|
571 |
-
var positionSide = $inputPosSide.val() + 'px';
|
572 |
-
} else {
|
573 |
-
positionSide = customSpace;
|
574 |
-
}
|
575 |
-
|
576 |
-
$inputPosBot.change(function () {
|
577 |
-
positionBottom = jQuery('#positionBottom').val() + 'px';
|
578 |
-
|
579 |
-
$chatyWidget.css({bottom: positionBottom});
|
580 |
-
});
|
581 |
-
|
582 |
-
$inputPosSide.change(function () {
|
583 |
-
var valueCustom = jQuery('[name="positionSide"]:checked').val();
|
584 |
-
positionSide = jQuery(this).val() + 'px';
|
585 |
-
|
586 |
-
if (valueCustom === 'right') {
|
587 |
-
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
|
588 |
-
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
|
589 |
-
$chatyWidget.css({right: positionSide, left: 'auto'});
|
590 |
-
} else if (valueCustom === 'left') {
|
591 |
-
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
|
592 |
-
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
|
593 |
-
$chatyWidget.css({left: positionSide, right: 'auto'});
|
594 |
-
}
|
595 |
-
});
|
596 |
-
|
597 |
-
jQuery('[name="positionSide"]').change(function () {
|
598 |
-
var valueCustom = jQuery('[name="positionSide"]:checked').val();
|
599 |
-
|
600 |
-
if (valueCustom === 'right') {
|
601 |
-
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
|
602 |
-
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
|
603 |
-
$chatyWidget.css({right: positionSide, left: 'auto'});
|
604 |
-
} else if (valueCustom === 'left') {
|
605 |
-
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
|
606 |
-
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
|
607 |
-
$chatyWidget.css({left: positionSide, right: 'auto'});
|
608 |
-
}
|
609 |
-
});
|
610 |
-
}
|
611 |
-
}
|
612 |
-
|
613 |
-
previewPosition();
|
614 |
-
|
615 |
-
|
616 |
-
jQuery('input[name="cht_position"]').change(function () {
|
617 |
-
var valueCustom = jQuery('[name="cht_position"]:checked').val();
|
618 |
-
|
619 |
-
if (valueCustom === 'right') {
|
620 |
-
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
|
621 |
-
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
|
622 |
-
} else if (valueCustom === 'left') {
|
623 |
-
jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
|
624 |
-
jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
|
625 |
-
}
|
626 |
-
previewPosition();
|
627 |
-
});
|
628 |
-
|
629 |
-
}());
|
630 |
-
jQuery('.popover').hide();
|
631 |
-
two_soc();
|
632 |
-
|
633 |
-
var socialIcon = jQuery('.channels-icons > .icon-sm');
|
634 |
-
|
635 |
-
|
636 |
-
var socialInputsContainer = jQuery('.social-inputs');
|
637 |
-
|
638 |
-
var click = 0;
|
639 |
-
jQuery('input[name=cht_custom_color]').keyup(function (event) {
|
640 |
-
var color = jQuery(this).val();
|
641 |
-
jQuery('.circle').html('');
|
642 |
-
jQuery('.color-picker-custom .circle').css({
|
643 |
-
'background-color': color
|
644 |
-
});
|
645 |
-
if (jQuery(this).val().length < 1) {
|
646 |
-
jQuery('.color-picker-custom .circle').html('?');
|
647 |
-
}
|
648 |
-
});
|
649 |
-
socialIcon.on('click', function () {
|
650 |
-
++click;
|
651 |
-
two_soc();
|
652 |
-
|
653 |
-
var $this = jQuery(this);
|
654 |
-
|
655 |
-
var social = $this.data('social');
|
656 |
-
|
657 |
-
var socialItem = socialInputsContainer.find('.social-form-group');
|
658 |
-
|
659 |
-
if ($this.hasClass('active')) {
|
660 |
-
var del = ',' + jQuery(this).attr('data-social');
|
661 |
-
|
662 |
-
var newlocaldata = jQuery('.add_slug').val();
|
663 |
-
newlocaldata = newlocaldata.replace(del, '');
|
664 |
-
jQuery('.add_slug').val(newlocaldata);
|
665 |
-
newlocaldata = newlocaldata.replace(del, '');
|
666 |
-
jQuery('.add_slug').val(newlocaldata);
|
667 |
-
newlocaldata = newlocaldata.replace(del, '');
|
668 |
-
jQuery('.add_slug').val(newlocaldata);
|
669 |
-
newlocaldata = newlocaldata.replace(del, '');
|
670 |
-
|
671 |
-
|
672 |
-
jQuery('.add_slug').val(newlocaldata);
|
673 |
-
|
674 |
-
$this.toggleClass('active');
|
675 |
-
return;
|
676 |
-
}
|
677 |
-
socialIcon.addClass('disabled');
|
678 |
-
icon = jQuery(this).data('social');
|
679 |
-
|
680 |
-
if (jQuery('.add_slug').val().indexOf(icon) == '1' && jQuery('.add_slug').val() != '') {
|
681 |
-
var del = ',' + icon;
|
682 |
-
var newlocaldata = jQuery('.add_slug').val();
|
683 |
-
|
684 |
-
newlocaldata = newlocaldata.replace(del, '');
|
685 |
-
jQuery('.add_slug').val(newlocaldata);
|
686 |
-
newlocaldata = newlocaldata.replace(del, '');
|
687 |
-
jQuery('.add_slug').val(newlocaldata);
|
688 |
-
newlocaldata = newlocaldata.replace(del, '');
|
689 |
-
jQuery('.add_slug').val(newlocaldata);
|
690 |
-
} else {
|
691 |
-
jQuery('.add_slug').val(jQuery('.add_slug').val() + ',' + jQuery(this).attr('data-social'));
|
692 |
-
}
|
693 |
-
|
694 |
-
|
695 |
-
/* if(jQuery('section').is("#pro")){
|
696 |
-
|
697 |
-
}else if(click >='3'){
|
698 |
-
// alert(click);
|
699 |
-
jQuery('.popover').show().effect( "shake", {times:3}, 600 );
|
700 |
-
click = jQuery('.channels-selected__item.free').length;
|
701 |
-
return;
|
702 |
-
|
703 |
-
|
704 |
-
} */
|
705 |
-
|
706 |
-
if (!jQuery('section').is('#pro') && jQuery('.channels-icons > .icon.active').length >= 2) {
|
707 |
-
jQuery('.popover').show().effect('shake', {times: 3}, 600);
|
708 |
-
socialIcon.removeClass('disabled');
|
709 |
-
return;
|
710 |
-
}
|
711 |
-
|
712 |
-
$this.toggleClass('active');
|
713 |
-
|
714 |
-
|
715 |
-
if (jQuery('section').is('#pro')) {
|
716 |
-
var token = 'pro';
|
717 |
-
} else {
|
718 |
-
var token = 'free';
|
719 |
-
}
|
720 |
-
|
721 |
-
|
722 |
-
$.ajax({
|
723 |
-
type: 'POST',
|
724 |
-
dataType: 'json',
|
725 |
-
url: ajaxurl,
|
726 |
-
data: {
|
727 |
-
action: 'choose_social',
|
728 |
-
social: social,
|
729 |
-
nonce_code: cht_nonce_ajax.cht_nonce,
|
730 |
-
version: token,
|
731 |
-
widget_index: jQuery("#widget_index").val()
|
732 |
-
},
|
733 |
-
beforeSend: function (xhr) {
|
734 |
-
|
735 |
-
},
|
736 |
-
success: function (data) {
|
737 |
-
var item = jQuery(data);
|
738 |
-
var itemName = item.find('.icon').data('title');
|
739 |
-
|
740 |
-
if (!jQuery('.channels-selected div[data-social="' + itemName + '"]').length) {
|
741 |
-
jQuery('#chaty-social-close').before(item);
|
742 |
-
}
|
743 |
-
|
744 |
-
socialIcon.removeClass('disabled');
|
745 |
-
detectIcon();
|
746 |
-
two_soc();
|
747 |
-
|
748 |
-
//jQuery('.chaty-color-field').wpColorPicker({
|
749 |
-
// pick: "Background Color",
|
750 |
-
// target: false,
|
751 |
-
// change: function(event, ui){
|
752 |
-
// chaty_set_bg_color();
|
753 |
-
// }
|
754 |
-
//});
|
755 |
-
jQuery('.chaty-color-field').spectrum({
|
756 |
-
chooseText: "Submit",
|
757 |
-
preferredFormat: "hex",
|
758 |
-
showInput: true,
|
759 |
-
cancelText: "Cancel",
|
760 |
-
move: function (color) {
|
761 |
-
jQuery(this).val(color.toHexString());
|
762 |
-
chaty_set_bg_color();
|
763 |
-
}
|
764 |
-
});
|
765 |
-
check_for_chaty_close_button();
|
766 |
-
},
|
767 |
-
error: function (xhr, status, error) {
|
768 |
-
|
769 |
-
}
|
770 |
-
});
|
771 |
-
|
772 |
-
two_soc();
|
773 |
-
});
|
774 |
-
|
775 |
-
|
776 |
-
/**
|
777 |
-
* Cancel Btn
|
778 |
-
*/
|
779 |
-
var cancelBtn = jQuery('body');
|
780 |
-
|
781 |
-
cancelBtn.on('click', '.icon, .btn-cancel:not(.close-btn-set)', function (e) {
|
782 |
-
|
783 |
-
if (jQuery(this).hasClass("close-btn-set")) {
|
784 |
-
return;
|
785 |
-
}
|
786 |
-
|
787 |
-
e.preventDefault();
|
788 |
-
|
789 |
-
if (jQuery(this).hasClass('icon') && jQuery(this).hasClass('active')) {
|
790 |
-
return;
|
791 |
-
}
|
792 |
-
|
793 |
-
icon = jQuery(this).data('social');
|
794 |
-
if (jQuery(this).hasClass('btn-cancel')) {
|
795 |
-
jQuery('.icon.active[data-social^="' + icon + '"]').removeClass('active');
|
796 |
-
|
797 |
-
var del = ',' + icon;
|
798 |
-
var newlocaldata = jQuery('.add_slug').val();
|
799 |
-
newlocaldata = newlocaldata.replace(del, '');
|
800 |
-
|
801 |
-
jQuery('.add_slug').val(newlocaldata);
|
802 |
-
}
|
803 |
-
var del_item = jQuery('#chaty-social-' + icon);
|
804 |
-
del_item.remove();
|
805 |
-
|
806 |
-
var item = jQuery(this).parent('.channels-selected__item');
|
807 |
-
|
808 |
-
|
809 |
-
var social = jQuery(this).data('social');
|
810 |
-
|
811 |
-
// $.ajax({
|
812 |
-
// type: 'POST',
|
813 |
-
// dataType: 'json',
|
814 |
-
// url: ajaxurl,
|
815 |
-
// data: {
|
816 |
-
// action: 'remove_social',
|
817 |
-
// nonce_code: cht_nonce_ajax.cht_nonce,
|
818 |
-
// social: social,
|
819 |
-
// widget_index: jQuery("#widget_index").val()
|
820 |
-
// },
|
821 |
-
// beforeSend: function (xhr) {
|
822 |
-
//
|
823 |
-
// },
|
824 |
-
// success: function (bool) {
|
825 |
-
// if (bool) {
|
826 |
-
// item.closest("li").remove();
|
827 |
-
// del_item.remove();
|
828 |
-
//
|
829 |
-
//
|
830 |
-
// jQuery('.icon-sm').each(function () {
|
831 |
-
// if (jQuery(this).data('social') === social) {
|
832 |
-
// // jQuery(this).removeClass('active');
|
833 |
-
// }
|
834 |
-
// });
|
835 |
-
// set_social_channel_order();
|
836 |
-
// }
|
837 |
-
// check_for_chaty_close_button();
|
838 |
-
// },
|
839 |
-
// error: function (xhr, status, error) {
|
840 |
-
//
|
841 |
-
// }
|
842 |
-
// });
|
843 |
-
detectIcon();
|
844 |
-
two_soc();
|
845 |
-
set_social_channel_order();
|
846 |
-
check_for_chaty_close_button();
|
847 |
-
});
|
848 |
-
|
849 |
-
function two_soc() {
|
850 |
-
if (jQuery('section').is('#pro')) {
|
851 |
-
return;
|
852 |
-
}
|
853 |
-
|
854 |
-
if (jQuery('.channels-selected__item').length <= 1) {
|
855 |
-
jQuery('.channels-selected__item').hide();
|
856 |
-
jQuery('.popover').hide();
|
857 |
-
} else if (jQuery('.channels-selected__item').length >= 2) {
|
858 |
-
jQuery('.channels-selected__item').show();
|
859 |
-
}
|
860 |
-
}
|
861 |
-
|
862 |
-
jQuery('.btn-help').click(function (event) {
|
863 |
-
window.open(
|
864 |
-
'https://premio.io/help/chaty/',
|
865 |
-
'_blank' // <- This is what makes it open in a new window.
|
866 |
-
);
|
867 |
-
});
|
868 |
-
|
869 |
-
|
870 |
-
var freeCustomInput = jQuery('.free-custom-radio, .free-custom-checkbox');
|
871 |
-
|
872 |
-
freeCustomInput.on('click', function (e) {
|
873 |
-
e.preventDefault();
|
874 |
-
});
|
875 |
-
var chatyCta = jQuery('[name=cht_cta]');
|
876 |
-
var toolTip = jQuery('.preview .tooltip-show');
|
877 |
-
|
878 |
-
chatyCta.keyup(function () {
|
879 |
-
var $icon = jQuery('.preview .page .icon');
|
880 |
-
if (chatyCta.val().length >= 1) {
|
881 |
-
$icon.removeClass('no-tooltip');
|
882 |
-
} else {
|
883 |
-
$icon.addClass('no-tooltip');
|
884 |
-
}
|
885 |
-
toolTip.attr('data-title', chatyCta.val());
|
886 |
-
});
|
887 |
-
|
888 |
-
|
889 |
-
var baseIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
890 |
-
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
891 |
-
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
892 |
-
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
893 |
-
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
894 |
-
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
895 |
-
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
896 |
-
' </svg>',
|
897 |
-
defaultIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
898 |
-
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
899 |
-
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
900 |
-
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
901 |
-
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
902 |
-
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
903 |
-
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
904 |
-
' </svg>',
|
905 |
-
iconBlock = document.getElementById('iconWidget'),
|
906 |
-
desktopIcon,
|
907 |
-
mobileIcon,
|
908 |
-
colorFill = jQuery('.color-picker-radio input:checked').val();
|
909 |
-
|
910 |
-
jQuery('#testUpload').on('change', function () {
|
911 |
-
if (this.value.length > 0) {
|
912 |
-
document.querySelector('.js-upload').disabled = false;
|
913 |
-
} else {
|
914 |
-
document.querySelector('.js-upload').disabled = true;
|
915 |
-
document.getElementById('uploadInput').checked = false;
|
916 |
-
}
|
917 |
-
});
|
918 |
-
|
919 |
-
jQuery(document).on("keyup", "textarea.test_textarea", function(){
|
920 |
-
detectIcon();
|
921 |
-
});
|
922 |
-
|
923 |
-
jQuery('.js-switch-preview').on('change', function () {
|
924 |
-
if (getPreviewDesktop()) {
|
925 |
-
jQuery(this).closest(".preview").removeClass('mobiel-view');
|
926 |
-
} else {
|
927 |
-
jQuery(this).closest(".preview").addClass('mobiel-view');
|
928 |
-
}
|
929 |
-
detectIcon();
|
930 |
-
});
|
931 |
-
|
932 |
-
function detectIcon() {
|
933 |
-
var desktop,
|
934 |
-
mobile,
|
935 |
-
colorSelf = false;
|
936 |
-
jQuery("#iconWidget").removeClass("img-p-active");
|
937 |
-
|
938 |
-
if (getPreviewDesktop()) {
|
939 |
-
if (jQuery('.js-chanel-desktop:checked').length === 0) {
|
940 |
-
desktop = false;
|
941 |
-
}
|
942 |
-
if (jQuery('.js-chanel-desktop:checked').length === 1) {
|
943 |
-
desktop = jQuery('.js-chanel-desktop:checked').closest("li").find(".icon.icon-md").html();
|
944 |
-
if (jQuery('.js-chanel-desktop:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
945 |
-
jQuery("#iconWidget").addClass("img-p-active");
|
946 |
-
}
|
947 |
-
}
|
948 |
-
if (jQuery('.js-chanel-desktop:checked').length > 1) {
|
949 |
-
desktop = defaultIcon;
|
950 |
-
colorSelf = true;
|
951 |
-
}
|
952 |
-
} else {
|
953 |
-
if (jQuery('.js-chanel-mobile:checked').length === 0) {
|
954 |
-
mobile = false;
|
955 |
-
}
|
956 |
-
if (jQuery('.js-chanel-mobile:checked').length === 1) {
|
957 |
-
mobile = jQuery('.js-chanel-mobile:checked').closest("li").find(".icon.icon-md").html();
|
958 |
-
if (jQuery('.js-chanel-mobile:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
959 |
-
jQuery("#iconWidget").addClass("img-p-active");
|
960 |
-
}
|
961 |
-
}
|
962 |
-
if (jQuery('.js-chanel-mobile:checked').length > 1) {
|
963 |
-
mobile = defaultIcon;
|
964 |
-
colorSelf = true;
|
965 |
-
}
|
966 |
-
}
|
967 |
-
|
968 |
-
desktopIcon = desktop;
|
969 |
-
mobileIcon = mobile;
|
970 |
-
|
971 |
-
if (getPreviewDesktop()) {
|
972 |
-
setIcon(desktopIcon, colorSelf)
|
973 |
-
} else {
|
974 |
-
setIcon(mobileIcon, colorSelf)
|
975 |
-
}
|
976 |
-
}
|
977 |
-
|
978 |
-
function stickyelement_iconformat(icon) {
|
979 |
-
var originalOption = icon.element;
|
980 |
-
return jQuery('<span><i class="' + icon.text + '"></i> ' + icon.text + '</span>');
|
981 |
-
}
|
982 |
-
|
983 |
-
function setIcon(icon, colorSelf) {
|
984 |
-
if (icon) {
|
985 |
-
//jQuery('.preview .page .chaty-widget').show();
|
986 |
-
iconBlock.innerHTML = icon;
|
987 |
-
} else {
|
988 |
-
//jQuery('.preview .page .chaty-widget').hide();
|
989 |
-
iconBlock.innerHTML = '';
|
990 |
-
}
|
991 |
-
if (colorSelf) {
|
992 |
-
var color = jQuery('.color-picker-custom input').val() ? jQuery('.color-picker-custom input').val() : jQuery('.color-picker-radio input:checked').val();
|
993 |
-
jQuery('.preview .page svg circle').css({fill: color});
|
994 |
-
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
995 |
-
}
|
996 |
-
|
997 |
-
thisVal = jQuery("#chaty_default_state").val();
|
998 |
-
if(thisVal == "open") {
|
999 |
-
jQuery(".hide-show-button").addClass("active");
|
1000 |
-
} else {
|
1001 |
-
jQuery(".hide-show-button").removeClass("active");
|
1002 |
-
}
|
1003 |
-
|
1004 |
-
jQuery(".chaty-widget").removeClass("active").removeClass("hover").removeClass("click");
|
1005 |
-
if(thisVal == "open") {
|
1006 |
-
jQuery(".chaty-widget").addClass("active");
|
1007 |
-
} else if(thisVal == "hover") {
|
1008 |
-
jQuery(".chaty-widget").addClass("hover");
|
1009 |
-
} else {
|
1010 |
-
jQuery(".chaty-widget").addClass("click");
|
1011 |
-
}
|
1012 |
-
|
1013 |
-
jQuery(".chaty-channels").html("");
|
1014 |
-
var eClass = ".js-chanel-mobile";
|
1015 |
-
if (getPreviewDesktop()) {
|
1016 |
-
var eClass = ".js-chanel-desktop";
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
if(thisVal == "open" && jQuery(eClass+':checked').length > 1) {
|
1020 |
-
jQuery("#chaty_attention_effect").val("");
|
1021 |
-
jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", true);
|
1022 |
-
jQuery("#chaty_attention_effect option:first-child").text("Doesn't apply for the open state");
|
1023 |
-
if(jQuery(".test_textarea").val() != "Doesn't apply for the open state") {
|
1024 |
-
jQuery(".test_textarea").attr("data-value", jQuery(".test_textarea").val());
|
1025 |
-
}
|
1026 |
-
jQuery(".test_textarea").val("Doesn't apply for the open state");
|
1027 |
-
} else {
|
1028 |
-
jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", false);
|
1029 |
-
jQuery("#chaty_attention_effect option:first-child").text("None");
|
1030 |
-
jQuery(".test_textarea").attr("placeholder","");
|
1031 |
-
if(jQuery(".test_textarea").val() == "Doesn't apply for the open state") {
|
1032 |
-
jQuery(".test_textarea").val(jQuery(".test_textarea").attr("data-value"));
|
1033 |
-
}
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
if (jQuery(eClass+':checked').length > 1) {
|
1037 |
-
jQuery(eClass+':checked').each(function(){
|
1038 |
-
var socialIcon = jQuery(this).closest("li").find(".icon").html();
|
1039 |
-
var socialIcon = jQuery(this).closest("li").find(".icon").html();
|
1040 |
-
var socialIconText = jQuery(this).closest("li").find(".chaty-title").val();
|
1041 |
-
var eClass = jQuery(this).closest(".channels-selected__item").hasClass("img-active")?"img-active":"";
|
1042 |
-
if(socialIconText != "") {
|
1043 |
-
socialIconText = "<span class='social-tooltip'>"+socialIconText+"</span>";
|
1044 |
-
}
|
1045 |
-
jQuery(".chaty-channels").append("<div class='social-item-box "+eClass+"'><span class='tooltip-icon'>"+socialIcon+"</span>"+socialIconText+"</div>");
|
1046 |
-
});
|
1047 |
-
|
1048 |
-
if(jQuery("#chaty_default_state").val() == "open" && jQuery("#cht_close_button").is(":checked")) {
|
1049 |
-
jQuery("#iconWidget").css("display", "block");
|
1050 |
-
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1051 |
-
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1052 |
-
} else if(jQuery("#chaty_default_state").val() != "open") {
|
1053 |
-
jQuery("#iconWidget").css("display", "block");
|
1054 |
-
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1055 |
-
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1056 |
-
} else if(jQuery("#chaty_default_state").val() == "open") {
|
1057 |
-
jQuery("#iconWidget").hide();
|
1058 |
-
jQuery(".chaty-widget .tooltiptext").hide();
|
1059 |
-
jQuery(".chaty-widget").addClass("hide-arrow");
|
1060 |
-
}
|
1061 |
-
jQuery(".chaty-widget").removeClass("has-single");
|
1062 |
-
} else if (jQuery(eClass+':checked').length == 1) {
|
1063 |
-
if(jQuery("#chaty_default_state").val() == "open" && !jQuery("#cht_close_button").is(":checked")) {
|
1064 |
-
jQuery("#iconWidget").css("display","block");
|
1065 |
-
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1066 |
-
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1067 |
-
} else if(jQuery("#chaty_default_state").val() != "open") {
|
1068 |
-
jQuery("#iconWidget").css("display","block");
|
1069 |
-
jQuery(".chaty-widget .tooltiptext").css("display","block");
|
1070 |
-
jQuery(".chaty-widget").removeClass("hide-arrow");
|
1071 |
-
}
|
1072 |
-
jQuery(".chaty-widget").addClass("has-single");
|
1073 |
-
} else if (jQuery(eClass+':checked').length == 0) {
|
1074 |
-
jQuery("#iconWidget").hide();
|
1075 |
-
jQuery(".chaty-widget .tooltiptext").hide();
|
1076 |
-
jQuery(".chaty-widget").addClass("hide-arrow");
|
1077 |
-
jQuery(".chaty-widget").removeClass("has-single");
|
1078 |
-
}
|
1079 |
-
jQuery(".chaty-channels .remove-icon-img").remove();
|
1080 |
-
|
1081 |
-
if(jQuery("#trigger_on_time").is(":checked")) {
|
1082 |
-
jQuery("#chaty_trigger_time").attr("readonly", false);
|
1083 |
-
} else {
|
1084 |
-
jQuery("#chaty_trigger_time").attr("readonly", true);
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
if(jQuery("#chaty_trigger_on_scroll").is(":checked")) {
|
1088 |
-
jQuery("#chaty_trigger_on_page_scroll").attr("readonly", false);
|
1089 |
-
} else {
|
1090 |
-
jQuery("#chaty_trigger_on_page_scroll").attr("readonly", true);
|
1091 |
-
}
|
1092 |
-
|
1093 |
-
|
1094 |
-
if(jQuery(".chaty-widget .tooltiptext").text() == "") {
|
1095 |
-
jQuery(".chaty-widget .tooltiptext").hide();
|
1096 |
-
} else {
|
1097 |
-
if(jQuery("#chaty_default_state").val() == "open" && jQuery(eClass+':checked').length > 1) {
|
1098 |
-
jQuery(".chaty-widget .tooltiptext").hide();
|
1099 |
-
} else {
|
1100 |
-
jQuery(".chaty-widget .tooltiptext").css("display", "block");
|
1101 |
-
}
|
1102 |
-
}
|
1103 |
-
}
|
1104 |
-
|
1105 |
-
function getPreviewDesktop() {
|
1106 |
-
return jQuery('#previewDesktop').attr('checked') === 'checked' ? true : false;
|
1107 |
-
}
|
1108 |
-
|
1109 |
-
function changeWidgetIcon() {
|
1110 |
-
|
1111 |
-
jQuery(document).on('change', '.js-chanel-icon', function () {
|
1112 |
-
detectIcon();
|
1113 |
-
});
|
1114 |
-
|
1115 |
-
function calc(a) {
|
1116 |
-
var count = {}, res = 0, q;
|
1117 |
-
for (q = 0; q < a.length; ++q) {
|
1118 |
-
count[a[q].dataset.type] = ~~count[a[q].dataset.type] + 1;
|
1119 |
-
}
|
1120 |
-
for (q in count) {
|
1121 |
-
if (count.hasOwnProperty(q) && count[q] > 1) {
|
1122 |
-
res += count[q];
|
1123 |
-
}
|
1124 |
-
}
|
1125 |
-
return res;
|
1126 |
-
}
|
1127 |
-
|
1128 |
-
|
1129 |
-
jQuery(document).on('change', '.js-widget-i', function (ev) {
|
1130 |
-
if (ev.target.classList.contains('js-upload')) {
|
1131 |
-
defaultIcon = jQuery('.file-preview-image').last().parent().html();
|
1132 |
-
} else {
|
1133 |
-
defaultIcon = jQuery('i[data-type=' + ev.target.dataset.type + ']').html()
|
1134 |
-
}
|
1135 |
-
detectIcon();
|
1136 |
-
});
|
1137 |
-
}
|
1138 |
-
|
1139 |
-
changeWidgetIcon();
|
1140 |
-
|
1141 |
-
if (jQuery(".js-widget-i:checked").attr("data-type") !== 'chat-image') {
|
1142 |
-
defaultIcon = jQuery('i[data-type=' + jQuery(".js-widget-i:checked").attr("data-type") + ']').html();
|
1143 |
-
detectIcon();
|
1144 |
-
};
|
1145 |
-
});
|
1146 |
-
|
1147 |
-
jQuery(document).ready(function () {
|
1148 |
-
|
1149 |
-
jQuery(document).on("click", ".remove-chaty-options", function (e) {
|
1150 |
-
e.preventDefault();
|
1151 |
-
e.stopPropagation();
|
1152 |
-
if(confirm("Are you sure you want to delete this widget?")) {
|
1153 |
-
$.ajax({
|
1154 |
-
type: 'POST',
|
1155 |
-
url: ajaxurl,
|
1156 |
-
data: {
|
1157 |
-
action: 'remove_chaty_widget',
|
1158 |
-
nonce_code: cht_nonce_ajax.cht_nonce,
|
1159 |
-
widget_index: jQuery("#widget_index").val()
|
1160 |
-
},
|
1161 |
-
beforeSend: function (xhr) {
|
1162 |
-
|
1163 |
-
},
|
1164 |
-
success: function (res) {
|
1165 |
-
window.location = res;
|
1166 |
-
},
|
1167 |
-
error: function (xhr, status, error) {
|
1168 |
-
|
1169 |
-
}
|
1170 |
-
});
|
1171 |
-
}
|
1172 |
-
})
|
1173 |
-
|
1174 |
-
/* Date: 2019-07-26 */
|
1175 |
-
var location_href = window.location.href;
|
1176 |
-
if (window.location.href.indexOf('page=chaty-app&widget=') > -1) {
|
1177 |
-
jQuery('#toplevel_page_chaty-app .wp-submenu.wp-submenu-wrap li').each(function () {
|
1178 |
-
var element_href = jQuery(this).find('a').attr('href');
|
1179 |
-
if (typeof element_href !== 'undefined') {
|
1180 |
-
jQuery(this).removeClass('current');
|
1181 |
-
if (window.location.href.indexOf(element_href) > -1 && element_href.indexOf('&widget=') > -1) {
|
1182 |
-
jQuery(this).addClass('current');
|
1183 |
-
}
|
1184 |
-
}
|
1185 |
-
});
|
1186 |
-
}
|
1187 |
-
});
|
1188 |
-
}(jQuery));
|
1189 |
-
|
1190 |
-
|
1191 |
-
jQuery(window).scroll(function () {
|
1192 |
-
check_for_preview_pos();
|
1193 |
-
});
|
1194 |
-
jQuery(document).ready(function () {
|
1195 |
-
check_for_preview_pos();
|
1196 |
-
});
|
1197 |
-
|
1198 |
-
function check_for_preview_pos() {
|
1199 |
-
if(jQuery(".chaty-setting-form").length) {
|
1200 |
-
if(jQuery(window).width() > 1179) {
|
1201 |
-
var topPos = parseInt(jQuery(".chaty-setting-form").offset().top);
|
1202 |
-
jQuery(".btn-save-sticky").css("top", (topPos+58));
|
1203 |
-
jQuery(".preview").css("top", (topPos+18));
|
1204 |
-
jQuery(".btn-help").css("top", (topPos+58+145));
|
1205 |
-
jQuery("a.remove-chaty-widget-sticky").css("top", (topPos+58+145+119));
|
1206 |
-
} else {
|
1207 |
-
jQuery(".btn-save-sticky").attr("style", "");
|
1208 |
-
jQuery(".preview").attr("style", "");
|
1209 |
-
jQuery(".btn-help").attr("style", "");
|
1210 |
-
jQuery("a.remove-chaty-widget-sticky").attr("style", "");
|
1211 |
-
}
|
1212 |
-
}
|
1213 |
-
|
1214 |
-
if (jQuery("#scroll-to-item").length && jQuery("#admin-preview").length) {
|
1215 |
-
if(jQuery("body").hasClass("has-premio-box")) {
|
1216 |
-
topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 625;
|
1217 |
-
} else {
|
1218 |
-
topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 485;
|
1219 |
-
}
|
1220 |
-
|
1221 |
-
if (topPos < 0) {
|
1222 |
-
topPos = Math.abs(topPos);
|
1223 |
-
jQuery("#admin-preview").css("margin-top", ((-1) * topPos) + "px");
|
1224 |
-
} else {
|
1225 |
-
jQuery("#admin-preview").css("margin-top", "0");
|
1226 |
-
}
|
1227 |
-
}
|
1228 |
-
}
|
1229 |
-
|
1230 |
-
var totalPageOptions = 0;
|
1231 |
-
var pageOptionContent = "";
|
1232 |
-
var totalDateAndTimeOptions = 0;
|
1233 |
-
var dateAndTimeOptionContent = "";
|
1234 |
-
jQuery(document).ready(function () {
|
1235 |
-
totalPageOptions = parseInt(jQuery(".chaty-page-option").length);
|
1236 |
-
pageOptionContent = jQuery(".chaty-page-options-html").html();
|
1237 |
-
jQuery(".chaty-page-options-html").remove();
|
1238 |
-
totalDateAndTimeOptions = parseInt(jQuery(".chaty-date-time-option").length);
|
1239 |
-
dateAndTimeOptionContent = jQuery(".chaty-date-and-time-options-html").html();
|
1240 |
-
jQuery(".chaty-date-and-time-options-html").remove();
|
1241 |
-
|
1242 |
-
jQuery("#create-rule").click(function () {
|
1243 |
-
// appendHtml = pageOptionContent.replace(/__count__/g, totalPageOptions, pageOptionContent);
|
1244 |
-
// totalPageOptions++;
|
1245 |
-
// jQuery(".chaty-page-options").append(appendHtml);
|
1246 |
-
// jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
|
1247 |
-
// jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
|
1248 |
-
//
|
1249 |
-
// if (jQuery("#is_pro_plugin").val() == "0") {
|
1250 |
-
// jQuery(".chaty-page-options").find("input").attr("name", "");
|
1251 |
-
// jQuery(".chaty-page-options").find("select").attr("name", "");
|
1252 |
-
// jQuery(".chaty-page-options").find("input").removeClass("cht-required");
|
1253 |
-
// jQuery(".chaty-page-options").find("select").removeClass("cht-required");
|
1254 |
-
// jQuery(this).remove();
|
1255 |
-
// }
|
1256 |
-
jQuery(".page-options").toggle();
|
1257 |
-
});
|
1258 |
-
|
1259 |
-
jQuery("#create-data-and-time-rule").click(function () {
|
1260 |
-
jQuery(".chaty-data-and-time-rules").toggle();
|
1261 |
-
});
|
1262 |
-
|
1263 |
-
jQuery(document).on("change", "#chaty_attention_effect", function(){
|
1264 |
-
var currentClass = jQuery(this).attr("data-effect");
|
1265 |
-
if(currentClass != "") {
|
1266 |
-
jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
|
1267 |
-
}
|
1268 |
-
jQuery("#iconWidget").removeClass("start-now");
|
1269 |
-
jQuery("#iconWidget").addClass("chaty-animation-"+jQuery(this).val()).addClass("start-now");
|
1270 |
-
jQuery(this).attr("data-effect", jQuery(this).val());
|
1271 |
-
});
|
1272 |
-
|
1273 |
-
setInterval(function(){
|
1274 |
-
var currentClass = jQuery("#chaty_attention_effect").attr("data-effect");
|
1275 |
-
if(currentClass != "") {
|
1276 |
-
jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
|
1277 |
-
jQuery("#iconWidget").removeClass("start-now");
|
1278 |
-
setTimeout(function(){
|
1279 |
-
jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now");
|
1280 |
-
}, 1000);
|
1281 |
-
} else {
|
1282 |
-
jQuery("#chaty_attention_effect").attr("data-effect", jQuery("#chaty_attention_effect").val());
|
1283 |
-
}
|
1284 |
-
}, 5000);
|
1285 |
-
|
1286 |
-
jQuery(document).on("click", ".remove-chaty", function () {
|
1287 |
-
jQuery(this).closest(".chaty-page-option").remove();
|
1288 |
-
jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
|
1289 |
-
jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
|
1290 |
-
});
|
1291 |
-
|
1292 |
-
jQuery(document).on("click", ".remove-page-option", function () {
|
1293 |
-
jQuery(this).closest(".chaty-date-time-option").remove();
|
1294 |
-
});
|
1295 |
-
|
1296 |
-
jQuery("#image-upload-content .custom-control-label").click(function (e) {
|
1297 |
-
e.stopPropagation();
|
1298 |
-
jQuery(this).closest(".custom-control").find("input[type=radio]").attr("checked", true);
|
1299 |
-
jQuery('.js-widget-i').trigger("change");
|
1300 |
-
return false;
|
1301 |
-
});
|
1302 |
-
//jQuery('.chaty-color-field').wpColorPicker({
|
1303 |
-
// pick: "Background Color",
|
1304 |
-
// target: false,
|
1305 |
-
// change: function(event, ui){
|
1306 |
-
// chaty_set_bg_color();
|
1307 |
-
// }
|
1308 |
-
//});
|
1309 |
-
|
1310 |
-
jQuery('.chaty-color-field').spectrum({
|
1311 |
-
chooseText: "Submit",
|
1312 |
-
preferredFormat: "hex",
|
1313 |
-
cancelText: "Cancel",
|
1314 |
-
showInput: true,
|
1315 |
-
move: function (color) {
|
1316 |
-
jQuery(this).val(color.toHexString());
|
1317 |
-
chaty_set_bg_color();
|
1318 |
-
change_custom_preview();
|
1319 |
-
}
|
1320 |
-
});
|
1321 |
-
jQuery(".chaty-color-field").change(function () {
|
1322 |
-
chaty_set_bg_color();
|
1323 |
-
change_custom_preview();
|
1324 |
-
});
|
1325 |
-
|
1326 |
-
jQuery(".remove-chaty-img").on("click", function (e) {
|
1327 |
-
e.stopPropagation();
|
1328 |
-
});
|
1329 |
-
|
1330 |
-
jQuery("#channels-selected-list").sortable({
|
1331 |
-
placeholder: "ui-chaty-state-hl",
|
1332 |
-
items: "li:not(#chaty-social-close)",
|
1333 |
-
update: function (event, ui) {
|
1334 |
-
set_social_channel_order();
|
1335 |
-
change_custom_preview();
|
1336 |
-
}
|
1337 |
-
});
|
1338 |
-
|
1339 |
-
jQuery(".close-button-img img, .close-button-img .image-upload").click(function () {
|
1340 |
-
var image = wp.media({
|
1341 |
-
title: 'Upload Image',
|
1342 |
-
// mutiple: true if you want to upload multiple files at once
|
1343 |
-
multiple: false,
|
1344 |
-
library: {
|
1345 |
-
type: 'image',
|
1346 |
-
}
|
1347 |
-
}).open()
|
1348 |
-
.on('select', function (e) {
|
1349 |
-
var uploaded_image = image.state().get('selection').first();
|
1350 |
-
imageData = uploaded_image.toJSON();
|
1351 |
-
jQuery('.close-button-img').addClass("active");
|
1352 |
-
jQuery('.close-button-img input').val(imageData.id);
|
1353 |
-
jQuery('.close-button-img img').attr("src", imageData.url);
|
1354 |
-
change_custom_preview();
|
1355 |
-
});
|
1356 |
-
});
|
1357 |
-
|
1358 |
-
jQuery(".remove-close-img").click(function () {
|
1359 |
-
default_image = jQuery("#default_image").val();
|
1360 |
-
jQuery('.close-button-img').removeClass("active");
|
1361 |
-
jQuery('.close-button-img input').val("");
|
1362 |
-
jQuery('.close-button-img img').attr("src", default_image);
|
1363 |
-
change_custom_preview();
|
1364 |
-
});
|
1365 |
-
|
1366 |
-
jQuery(document).on("click", ".chaty-widget.click", function(e){
|
1367 |
-
e.preventDefault();
|
1368 |
-
// jQuery(".chaty-channels").toggle();
|
1369 |
-
jQuery(".chaty-widget").toggleClass("active");
|
1370 |
-
});
|
1371 |
-
|
1372 |
-
jQuery(document).on('change', '.url-options.cht-required', function (ev) {
|
1373 |
-
thisVal = jQuery(this).val();
|
1374 |
-
siteURL = jQuery("#chaty_site_url").val();
|
1375 |
-
newURL = siteURL;
|
1376 |
-
if (thisVal == "page_has_url") {
|
1377 |
-
newURL = siteURL;
|
1378 |
-
} else if (thisVal == "page_contains") {
|
1379 |
-
newURL = siteURL + "%s%";
|
1380 |
-
} else if (thisVal == "page_start_with") {
|
1381 |
-
newURL = siteURL + "s%";
|
1382 |
-
} else if (thisVal == "page_end_with") {
|
1383 |
-
newURL = siteURL + "%s";
|
1384 |
-
}
|
1385 |
-
jQuery(this).closest(".url-content").find(".chaty-url").text(newURL);
|
1386 |
-
});
|
1387 |
-
|
1388 |
-
check_for_chaty_close_button();
|
1389 |
-
chaty_set_bg_color();
|
1390 |
-
change_custom_preview();
|
1391 |
-
|
1392 |
-
jQuery(".chaty-settings.cls-btn a, .close-btn-set").click(function (e) {
|
1393 |
-
e.preventDefault();
|
1394 |
-
jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active");
|
1395 |
-
});
|
1396 |
-
|
1397 |
-
/*Default Values*/
|
1398 |
-
if (jQuery("input[name='cht_position']:checked").length == 0) {
|
1399 |
-
jQuery("#right-position").attr("checked", true);
|
1400 |
-
jQuery("input[name='cht_position']:checked").trigger("change");
|
1401 |
-
}
|
1402 |
-
if (jQuery("input[name='widget_icon']:checked").length == 0) {
|
1403 |
-
jQuery("input[name='widget_icon']:first").attr("checked", true);
|
1404 |
-
jQuery("input[name='widget_icon']:checked").trigger("change");
|
1405 |
-
}
|
1406 |
-
|
1407 |
-
/*font family Privew*/
|
1408 |
-
jQuery('.form-fonts').on( 'change', function() {
|
1409 |
-
var font_val = jQuery(this).val();
|
1410 |
-
jQuery('.chaty-google-font').remove();
|
1411 |
-
if (font_val != "") {
|
1412 |
-
jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
|
1413 |
-
jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
|
1414 |
-
} else {
|
1415 |
-
jQuery('.preview-section-chaty #admin-preview .page-body').attr("style","");
|
1416 |
-
}
|
1417 |
-
});
|
1418 |
-
});
|
1419 |
-
|
1420 |
-
jQuery(window).load(function () {
|
1421 |
-
check_for_chaty_close_button();
|
1422 |
-
chaty_set_bg_color();
|
1423 |
-
jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
|
1424 |
-
jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
|
1425 |
-
|
1426 |
-
jQuery('.url-options.cht-required').each(function () {
|
1427 |
-
jQuery(this).trigger("change");
|
1428 |
-
});
|
1429 |
-
var font_val = jQuery('.form-fonts').val();
|
1430 |
-
jQuery('.chaty-google-font').remove();
|
1431 |
-
if (font_val != "") {
|
1432 |
-
jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
|
1433 |
-
jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
|
1434 |
-
}
|
1435 |
-
// jQuery("#chaty_default_state").trigger("change");
|
1436 |
-
});
|
1437 |
-
|
1438 |
-
var selectedsocialSlug = "";
|
1439 |
-
|
1440 |
-
function upload_chaty_image(socialSlug) {
|
1441 |
-
selectedsocialSlug = socialSlug;
|
1442 |
-
var image = wp.media({
|
1443 |
-
title: 'Upload Image',
|
1444 |
-
// mutiple: true if you want to upload multiple files at once
|
1445 |
-
multiple: false,
|
1446 |
-
library: {
|
1447 |
-
type: 'image',
|
1448 |
-
}
|
1449 |
-
}).open()
|
1450 |
-
.on('select', function (e) {
|
1451 |
-
var uploaded_image = image.state().get('selection').first();
|
1452 |
-
imageData = uploaded_image.toJSON();
|
1453 |
-
jQuery('#cht_social_image_' + selectedsocialSlug).val(imageData.id);
|
1454 |
-
jQuery('.custom-image-' + selectedsocialSlug + " img").attr("src", imageData.url);
|
1455 |
-
jQuery("#chaty-social-" + selectedsocialSlug + " .channels-selected__item").addClass("img-active");
|
1456 |
-
change_custom_preview();
|
1457 |
-
});
|
1458 |
-
}
|
1459 |
-
|
1460 |
-
function toggle_chaty_setting(socId) {
|
1461 |
-
jQuery("#chaty-social-" + socId).find(".chaty-advance-settings").toggle();
|
1462 |
-
change_custom_preview();
|
1463 |
-
}
|
1464 |
-
|
1465 |
-
function chaty_set_bg_color() {
|
1466 |
-
jQuery(".chaty-color-field").each(function () {
|
1467 |
-
if (jQuery(this).val() != "" && jQuery(this).val() != "#ffffff") {
|
1468 |
-
if (jQuery(this).closest("li").data("id") != "Linkedin" || (jQuery(this).closest("li").data("id") == "Linkedin" && jQuery(this).val() != "#ffffff")) {
|
1469 |
-
defaultColor = jQuery(this).val();
|
1470 |
-
jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill", defaultColor);
|
1471 |
-
jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background", defaultColor);
|
1472 |
-
jQuery(this).closest(".channels-selected__item").find(".facustom-icon").css("background", defaultColor);
|
1473 |
-
}
|
1474 |
-
}
|
1475 |
-
});
|
1476 |
-
change_custom_preview();
|
1477 |
-
}
|
1478 |
-
|
1479 |
-
function upload_qr_code() {
|
1480 |
-
var image = wp.media({
|
1481 |
-
title: 'Upload QR Image',
|
1482 |
-
multiple: false,
|
1483 |
-
library: {
|
1484 |
-
type: 'image',
|
1485 |
-
}
|
1486 |
-
}).open()
|
1487 |
-
.on('select', function (e) {
|
1488 |
-
var uploaded_image = image.state().get('selection').first();
|
1489 |
-
imageData = uploaded_image.toJSON();
|
1490 |
-
jQuery('#upload_qr_code_val').val(imageData.id);
|
1491 |
-
jQuery('#upload_qr_code img').attr("src", imageData.url);
|
1492 |
-
jQuery(".remove-qr-code").addClass("active");
|
1493 |
-
change_custom_preview();
|
1494 |
-
});
|
1495 |
-
}
|
1496 |
-
|
1497 |
-
function remove_qr_code() {
|
1498 |
-
jQuery(".remove-qr-code").removeClass("active");
|
1499 |
-
jQuery('#upload_qr_code_val').val("");
|
1500 |
-
default_image = jQuery("#default_image").val();
|
1501 |
-
jQuery('#upload_qr_code img').attr("src", default_image);
|
1502 |
-
change_custom_preview();
|
1503 |
-
}
|
1504 |
-
|
1505 |
-
function remove_chaty_image(socId) {
|
1506 |
-
default_image = jQuery("#default_image").val();
|
1507 |
-
jQuery("#chaty-social-" + socId + " .channels-selected__item").removeClass("img-active");
|
1508 |
-
jQuery('#cht_social_image_' + socId).val("");
|
1509 |
-
jQuery('#cht_social_image_src_' + socId).attr("src", default_image);
|
1510 |
-
change_custom_preview();
|
1511 |
-
}
|
1512 |
-
|
1513 |
-
var baseIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
1514 |
-
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
1515 |
-
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
1516 |
-
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1517 |
-
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
1518 |
-
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1519 |
-
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
1520 |
-
' </svg>',
|
1521 |
-
defaultIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
|
1522 |
-
' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
|
1523 |
-
' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
|
1524 |
-
' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1525 |
-
' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
|
1526 |
-
' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
|
1527 |
-
' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
|
1528 |
-
' </svg>'
|
1529 |
-
var iconBlock = document.getElementById('iconWidget');
|
1530 |
-
|
1531 |
-
function set_social_channel_order() {
|
1532 |
-
socialString = [];
|
1533 |
-
jQuery("#channels-selected-list li").each(function () {
|
1534 |
-
socialString.push(jQuery(this).attr("data-id"));
|
1535 |
-
});
|
1536 |
-
socialString = socialString.join(",");
|
1537 |
-
jQuery("#cht_numb_slug").val(socialString);
|
1538 |
-
check_for_chaty_close_button();
|
1539 |
-
}
|
1540 |
-
|
1541 |
-
function check_for_chaty_close_button() {
|
1542 |
-
if (jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length >= 2) {
|
1543 |
-
jQuery("#chaty-social-close").show();
|
1544 |
-
} else {
|
1545 |
-
jQuery("#chaty-social-close").hide();
|
1546 |
-
}
|
1547 |
-
change_custom_preview();
|
1548 |
-
var srtString = "";
|
1549 |
-
jQuery("#channels-selected-list > li").each(function(){
|
1550 |
-
if(jQuery(this).attr("data-id") != "undefined" && jQuery(this).attr("data-id") != "") {
|
1551 |
-
srtString += jQuery(this).attr("data-id")+",";
|
1552 |
-
}
|
1553 |
-
srtString = srtString.trimRight(",")
|
1554 |
-
});
|
1555 |
-
jQuery(".add_slug").val(srtString);
|
1556 |
-
}
|
1557 |
-
|
1558 |
-
function change_custom_preview() {
|
1559 |
-
var desktop,
|
1560 |
-
mobile,
|
1561 |
-
colorSelf = false;
|
1562 |
-
jQuery("#iconWidget").removeClass("img-p-active");
|
1563 |
-
if (getChtPreviewDesktop()) {
|
1564 |
-
if (jQuery('.js-chanel-desktop:checked').length === 0) {
|
1565 |
-
desktop = false;
|
1566 |
-
}
|
1567 |
-
if (jQuery('.js-chanel-desktop:checked').length === 1) {
|
1568 |
-
desktop = jQuery('.js-chanel-desktop:checked').closest("li").find(".icon.icon-md").html();
|
1569 |
-
if (jQuery('.js-chanel-desktop:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
1570 |
-
jQuery("#iconWidget").addClass("img-p-active");
|
1571 |
-
}
|
1572 |
-
}
|
1573 |
-
if (jQuery('.js-chanel-desktop:checked').length > 1) {
|
1574 |
-
desktop = defaultIcon;
|
1575 |
-
colorSelf = true;
|
1576 |
-
}
|
1577 |
-
} else {
|
1578 |
-
if (jQuery('.js-chanel-mobile:checked').length === 0) {
|
1579 |
-
mobile = false;
|
1580 |
-
}
|
1581 |
-
if (jQuery('.js-chanel-mobile:checked').length === 1) {
|
1582 |
-
mobile = jQuery('.js-chanel-mobile:checked').closest("li").find(".icon.icon-md").html();
|
1583 |
-
if (jQuery('.js-chanel-mobile:checked').closest(".channels-selected__item").hasClass("img-active")) {
|
1584 |
-
jQuery("#iconWidget").addClass("img-p-active");
|
1585 |
-
}
|
1586 |
-
}
|
1587 |
-
if (jQuery('.js-chanel-mobile:checked').length > 1) {
|
1588 |
-
mobile = defaultIcon;
|
1589 |
-
colorSelf = true;
|
1590 |
-
}
|
1591 |
-
}
|
1592 |
-
|
1593 |
-
|
1594 |
-
desktopIcon = desktop;
|
1595 |
-
mobileIcon = mobile;
|
1596 |
-
|
1597 |
-
if (getChtPreviewDesktop()) {
|
1598 |
-
setChtIcon(desktopIcon, colorSelf)
|
1599 |
-
} else {
|
1600 |
-
setChtIcon(mobileIcon, colorSelf)
|
1601 |
-
}
|
1602 |
-
}
|
1603 |
-
|
1604 |
-
function getChtPreviewDesktop() {
|
1605 |
-
return jQuery('#previewDesktop').attr('checked') === 'checked' ? true : false;
|
1606 |
-
}
|
1607 |
-
|
1608 |
-
function setChtIcon(icon, colorSelf) {
|
1609 |
-
iconBlock = document.getElementById('iconWidget');
|
1610 |
-
if (icon) {
|
1611 |
-
//jQuery('.preview .page .chaty-widget').show();
|
1612 |
-
iconBlock.innerHTML = icon;
|
1613 |
-
} else {
|
1614 |
-
//jQuery('.preview .page .chaty-widget').hide();
|
1615 |
-
iconBlock.innerHTML = '';
|
1616 |
-
}
|
1617 |
-
if (colorSelf) {
|
1618 |
-
var color = jQuery('.color-picker-custom input').val() ? jQuery('.color-picker-custom input').val() : jQuery('.color-picker-radio input:checked').val();
|
1619 |
-
jQuery('.preview .page svg circle').css({fill: color});
|
1620 |
-
jQuery('#chaty-social-close ellipse').attr("fill", color);
|
1621 |
-
}
|
1622 |
-
jQuery('.js-widget-i:checked').trigger("change");
|
1623 |
-
}
|
1 |
+
function check_for_number_chaty(e,t){return!(""==e||("+"==e[0]&&(e=e.substr(1,e.length)),"Phone"==t&&"*"==e[0]&&(e=e.substr(1,e.length)),!isNaN(e)))}function check_for_preview_pos(){if(jQuery(".chaty-setting-form").length)if(jQuery(window).width()>1179){var e=parseInt(jQuery(".chaty-setting-form").offset().top);jQuery(".btn-save-sticky").css("top",e+58),jQuery(".preview").css("top",e+18),jQuery(".btn-help").css("top",e+58+145),jQuery("a.remove-chaty-widget-sticky").css("top",e+58+145+119)}else jQuery(".btn-save-sticky").attr("style",""),jQuery(".preview").attr("style",""),jQuery(".btn-help").attr("style",""),jQuery("a.remove-chaty-widget-sticky").attr("style","");jQuery("#scroll-to-item").length&&jQuery("#admin-preview").length&&((e=jQuery("body").hasClass("has-premio-box")?jQuery("#scroll-to-item").offset().top-jQuery(window).scrollTop()-625:jQuery("#scroll-to-item").offset().top-jQuery(window).scrollTop()-485)<0?(e=Math.abs(e),jQuery("#admin-preview").css("margin-top",-1*e+"px")):jQuery("#admin-preview").css("margin-top","0"))}jQuery(document).ready(function(){jQuery("#cht-form").submit(function(){if(set_social_channel_order(),phoneNumberReg=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,jQuery("#cht-form #Whatsapp").length&&""!=jQuery("#cht-form #Whatsapp").val()&&(InputVal=jQuery.trim(jQuery("#cht-form #Whatsapp").val()),check_for_number_chaty(InputVal,"Whatsapp")&&!confirm("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")))return jQuery("#cht-form #Whatsapp").focus(),!1;if(jQuery("#cht-form #Phone").length&&""!=jQuery("#cht-form #Phone").val()&&(InputVal=jQuery.trim(jQuery("#cht-form #Phone").val()),check_for_number_chaty(InputVal,"Phone")&&!confirm("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")))return jQuery("#cht-form #Phone").focus(),!1;if(jQuery("#cht-form #Facebook_Messenger").length&&""!=jQuery("#cht-form #Facebook_Messenger").val()&&(faceBookMeReg=/(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/,faceBookReg=/(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/,InputVal=jQuery.trim(jQuery("#Facebook_Messenger").val()),jQuery("#cht-form #Facebook_Messenger").val(InputVal),!faceBookReg.test(InputVal)&&!faceBookMeReg.test(InputVal)))return alert("Please make sure your Facebook page's URL looks like, \nhttps://m.me/YOURPAGE"),jQuery("#cht-form #Facebook_Messenger").focus(),!1;if(jQuery("#cht-form #SMS").length&&""!=jQuery("#cht-form #SMS").val()&&(InputVal=jQuery.trim(jQuery("#cht-form #SMS").val()),check_for_number_chaty(InputVal,"SMS")&&!confirm("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")))return jQuery("#cht-form #SMS").focus(),!1;if(jQuery("#cht-form #Viber").length&&""!=jQuery("#cht-form #Viber").val()&&(InputVal=jQuery.trim(jQuery("#cht-form #Viber").val()),check_for_number_chaty(InputVal,"Viber")&&!confirm("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")))return jQuery("#cht-form #Viber").focus(),!1;if(errorCount=0,jQuery("#chaty-page-options .cht-required").length&&jQuery("#chaty-page-options .cht-required").each(function(){""==jQuery.trim(jQuery(this).val())&&(jQuery(this).addClass("cht-input-error"),errorCount++)}),jQuery(".chaty-data-and-time-rules .cht-required").length&&jQuery(".chaty-data-and-time-rules .cht-required").each(function(){""==jQuery.trim(jQuery(this).val())&&(jQuery(this).addClass("cht-input-error"),errorCount++)}),0!=errorCount)return!1;var e=0;return!jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length||(jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){""==jQuery.trim(jQuery(this).val())&&e++}),e!=jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length)||(!!confirm("You need to fill out at least one channel details for Chaty to show up on your website. Click cancel to keep editing.")||(jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){""==jQuery.trim(jQuery(this).val())&&(e=1)}),jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").addClass("border-red"),jQuery("#channels-selected-list > li:not(#chaty-social-close) .channels__input:first").focus(),!1))})}),function(e,t){jQuery.fn[t]=function(e){return e?this.bind("resize",(a=e,function(){var e=this,t=arguments;i?clearTimeout(i):c&&a.apply(e,t),i=setTimeout(function(){c||a.apply(e,t),i=null},o||100)})):this.trigger(t);var a,o,c,i}}(jQuery,"smartModalResize"),function(e){"use strict";var t={init:function(t){var a={top:"auto",left:"auto",autoOpen:!1,overlayOpacity:.5,overlayColor:"#000",overlayClose:!0,overlayParent:"body",closeOnEscape:!0,closeButtonClass:".close",transitionIn:"",transitionOut:"",onOpen:!1,onClose:!1,zIndex:function(){return(t=Math.max.apply(Math,e.makeArray(jQuery("*").map(function(){return jQuery(this).css("z-index")}).filter(function(){return e.isNumeric(this)}).map(function(){return parseInt(this,10)}))))===-1/0?0:t+1;var t},updateZIndexOnOpen:!0,hasVariableWidth:!1};return t=e.extend(a,t),this.each(function(){var e=t,a=jQuery('<div class="lean-overlay"></div>'),o=jQuery(this);a.css({display:"none",position:"fixed","z-index":e.updateZIndexOnOpen?0:e.zIndex(),top:0,left:0,height:"100%",width:"100%",background:e.overlayColor,opacity:e.overlayOpacity,overflow:"auto"}).appendTo(e.overlayParent),o.css({display:"none",position:"fixed","z-index":e.updateZIndexOnOpen?0:e.zIndex()+1,left:parseInt(e.left,10)>-1?e.left+"px":"50%",top:parseInt(e.top,10)>-1?e.top+"px":"50%"}),o.bind("openModal",function(){var t=e.updateZIndexOnOpen?e.zIndex():parseInt(a.css("z-index"),10),c=t+1;""!==e.transitionIn&&""!==e.transitionOut&&o.removeClass(e.transitionOut).addClass(e.transitionIn),o.css({display:"block","margin-left":(parseInt(e.left,10)>-1?0:-o.outerWidth()/2)+"px","margin-top":(parseInt(e.top,10)>-1?0:-o.outerHeight()/2)+"px","z-index":c}),a.css({"z-index":t,display:"block"}),e.onOpen&&"function"==typeof e.onOpen&&e.onOpen(o[0])}),o.bind("closeModal",function(){""!==e.transitionIn&&""!==e.transitionOut?(o.removeClass(e.transitionIn).addClass(e.transitionOut),o.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){o.css("display","none"),a.css("display","none")})):(o.css("display","none"),a.css("display","none")),e.onClose&&"function"==typeof e.onClose&&e.onClose(o[0])}),a.click(function(){e.overlayClose&&o.trigger("closeModal")}),jQuery(document).keydown(function(t){e.closeOnEscape&&27===t.keyCode&&o.trigger("closeModal")}),jQuery(window).smartModalResize(function(){e.hasVariableWidth&&o.css({"margin-left":(parseInt(e.left,10)>-1?0:-o.outerWidth()/2)+"px","margin-top":(parseInt(e.top,10)>-1?0:-o.outerHeight()/2)+"px"})}),o.on("click",e.closeButtonClass,function(e){o.trigger("closeModal"),e.preventDefault()}),e.autoOpen&&o.trigger("openModal")})}};e.fn.easyModal=function(a){return t[a]?t[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?void e.error("Method "+a+" does not exist on jQuery.easyModal"):t.init.apply(this,arguments)}}(jQuery),function(e){jQuery(document).ready(function(){jQuery("input, .icon, textarea, .btn-cancel:not(.close-btn-set) ").click(function(e){window.onbeforeunload=function(e){(e=e||window.event).preventDefault=!0,e.cancelBubble=!0,e.returnValue="Your beautiful goodbye message"}}),jQuery(document).on("submit","form",function(e){window.onbeforeunload=null}),jQuery(".upg").click(function(e){jQuery(".valid_domain_input").val(jQuery(".valid_domain_input").val().replace(" ","")),/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(jQuery(".valid_domain_input").val())||(e.preventDefault(),jQuery(".valid_domain").fadeIn().css({display:"block"}))}),jQuery(".del_token").click(function(t){e.ajax({type:"POST",url:ajaxurl,data:{action:"del_token",nonce_code:cht_nonce_ajax.cht_nonce},success:function(e){location.reload()},error:function(e,t,a){}})}),jQuery(document).on("blur","#channels-selected-list > li:not(#chaty-social-close) .channels__input",function(){jQuery(this).hasClass("border-red")&&""!=jQuery(this).val()&&jQuery(this).removeClass("border-red")}),jQuery(".easy-modal").easyModal({top:150,overlay:.2}),jQuery(".easy-modal-open").click(function(e){var t=jQuery(this).attr("href");jQuery(t).trigger("openModal"),e.preventDefault()}),jQuery(".easy-modal-close").click(function(e){e.preventDefault(),jQuery(".easy-modal").trigger("closeModal")});var t=1000000003;jQuery(".show_up").click(function(){t+=10,jQuery("#upgrade-modal").css({"z-index":t,display:"block","margin-left":"-258px"})}),jQuery(".color-picker-btn, .color-picker-btn-close, .color-picker-custom button").on("click",function(e){e.preventDefault(),jQuery(".color-picker").toggle(),jQuery(".color-picker-btn").toggle()}),jQuery(".color-picker-radio input").change(function(){var e=jQuery(this);if(jQuery('.color-picker-custom input[name="cht_custom_color"]').val(""),jQuery(".color-picker-custom .circle").html("?").css({"background-color":"#fff"}),e.prop("checked")){jQuery(".color-picker-radio input").prop("checked",!1),e.prop("checked",!0);var t=e.val(),a=e.prop("title")}else t=jQuery(".color-picker-custom input").val(),a="Custom";jQuery(".color-picker-btn .circle").css({backgroundColor:t}),jQuery(".color-picker-btn .text").text(a),jQuery("#chaty-social-close ellipse").attr("fill",t)}),jQuery(".color-picker-custom input").change(function(){jQuery(".color-picker-radio input").prop("checked",!1);var e=jQuery(this).val();jQuery(".color-picker-btn .circle").css({backgroundColor:e}),jQuery(".color-picker-btn .text").text("Custom"),jQuery("#chaty-social-close ellipse").attr("fill",e)}),jQuery('[name="cht_position"]').change(function(){jQuery("#positionCustom").prop("checked")?jQuery("#positionPro").show():jQuery("#positionPro").hide()}),jQuery(".update_token").on("click",function(t){t.preventDefault();var a=jQuery('input[name="cht_token"]').val();e.ajax({type:"POST",url:ajaxurl,data:{action:"add_token",nonce_code:cht_nonce_ajax.cht_nonce,token:a},beforeSend:function(e){},success:function(e){e?(alert("Your pro plan is activated"),location.reload()):alert("You`ve entered a wrong token")},error:function(e,t,a){}})}),jQuery("textarea[name=cht_cta]").keyup(function(e){jQuery(".tooltiptext span").html(jQuery(this).val()),0==jQuery(this).val().length?(jQuery(".cta").hide(200),jQuery(".tooltiptext span").hide(200)):(jQuery(".cta").show(300),jQuery(".tooltiptext span").show(200))})})}(jQuery),function(e){jQuery(document).ready(function(){!function(){function e(){var e=jQuery("#positionBottom"),t=jQuery("#positionSide"),a=jQuery(".preview .page .chaty-widget"),o=jQuery('[name="cht_position"]:checked').val();if("right"===o)a.css({right:"7px",left:"auto",bottom:"7px"});else if("left"===o)a.css({left:"7px",right:"auto",bottom:"7px"});else if("custom"===o){if(e.val())var c=e.val()+"px";else c="7px";if(t.val())var i=t.val()+"px";else i="7px";e.change(function(){c=jQuery("#positionBottom").val()+"px",a.css({bottom:c})}),t.change(function(){var e=jQuery('[name="positionSide"]:checked').val();i=jQuery(this).val()+"px","right"===e?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"),a.css({right:i,left:"auto"})):"left"===e&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"),a.css({left:i,right:"auto"}))}),jQuery('[name="positionSide"]').change(function(){var e=jQuery('[name="positionSide"]:checked').val();"right"===e?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"),a.css({right:i,left:"auto"})):"left"===e&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"),a.css({left:i,right:"auto"}))})}}jQuery(".color-picker-radio input").change(function(){var e=jQuery(this);e.prop("checked")?e.val():jQuery(".color-picker-custom input").val(),u()}),jQuery(".color-picker-custom input").change(function(){jQuery(this).val(),u()}),jQuery(document).on("change","#chaty_default_state",function(){u()}),jQuery("#cht_close_button, #trigger_on_time, #chaty_trigger_on_scroll").click(function(){u()}),function(){var e=jQuery("#widgetTooltip"),t=jQuery(".preview .page .icon");function a(){jQuery("[name=cht_cta]").val().length>=1?t.removeClass("no-tooltip"):t.addClass("no-tooltip")}a(),e.change(function(){a()})}(),e(),jQuery('input[name="cht_position"]').change(function(){var t=jQuery('[name="cht_position"]:checked').val();"right"===t?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right")):"left"===t&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left")),e()})}(),jQuery(".popover").hide(),o();var t=jQuery(".channels-icons > .icon-sm"),a=jQuery(".social-inputs");function o(){jQuery("section").is("#pro")||(jQuery(".channels-selected__item").length<=1?(jQuery(".channels-selected__item").hide(),jQuery(".popover").hide()):jQuery(".channels-selected__item").length>=2&&jQuery(".channels-selected__item").show())}jQuery("input[name=cht_custom_color]").keyup(function(e){var t=jQuery(this).val();jQuery(".circle").html(""),jQuery(".color-picker-custom .circle").css({"background-color":t}),jQuery(this).val().length<1&&jQuery(".color-picker-custom .circle").html("?")}),t.on("click",function(){0,o();var c=jQuery(this),i=c.data("social");a.find(".social-form-group");if(c.hasClass("active")){var n=","+jQuery(this).attr("data-social");return r=(r=jQuery(".add_slug").val()).replace(n,""),jQuery(".add_slug").val(r),r=r.replace(n,""),jQuery(".add_slug").val(r),r=r.replace(n,""),jQuery(".add_slug").val(r),r=r.replace(n,""),jQuery(".add_slug").val(r),void c.toggleClass("active")}if(t.addClass("disabled"),icon=jQuery(this).data("social"),"1"==jQuery(".add_slug").val().indexOf(icon)&&""!=jQuery(".add_slug").val()){var r;n=","+icon;r=(r=jQuery(".add_slug").val()).replace(n,""),jQuery(".add_slug").val(r),r=r.replace(n,""),jQuery(".add_slug").val(r),r=r.replace(n,""),jQuery(".add_slug").val(r)}else jQuery(".add_slug").val(jQuery(".add_slug").val()+","+jQuery(this).attr("data-social"));if(!jQuery("section").is("#pro")&&jQuery(".channels-icons > .icon.active").length>=2)return jQuery(".popover").show().effect("shake",{times:3},600),void t.removeClass("disabled");if(c.toggleClass("active"),jQuery("section").is("#pro"))var s="pro";else s="free";e.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"choose_social",social:i,nonce_code:cht_nonce_ajax.cht_nonce,version:s,widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(e){var a=jQuery(e),c=a.find(".icon").data("title");jQuery('.channels-selected div[data-social="'+c+'"]').length||jQuery("#chaty-social-close").before(a),t.removeClass("disabled"),u(),o(),jQuery(".chaty-color-field").spectrum({chooseText:"Submit",preferredFormat:"hex",showInput:!0,cancelText:"Cancel",move:function(e){jQuery(this).val(e.toHexString()),chaty_set_bg_color()}}),check_for_chaty_close_button()},error:function(e,t,a){}}),o()}),jQuery("body").on("click",".icon, .btn-cancel:not(.close-btn-set)",function(e){if(!jQuery(this).hasClass("close-btn-set")&&(e.preventDefault(),!jQuery(this).hasClass("icon")||!jQuery(this).hasClass("active"))){if(icon=jQuery(this).data("social"),jQuery(this).hasClass("btn-cancel")){jQuery('.icon.active[data-social^="'+icon+'"]').removeClass("active");var t=","+icon,a=jQuery(".add_slug").val();a=a.replace(t,""),jQuery(".add_slug").val(a)}jQuery("#chaty-social-"+icon).remove();jQuery(this).parent(".channels-selected__item"),jQuery(this).data("social");u(),o(),set_social_channel_order(),check_for_chaty_close_button()}}),jQuery(".btn-help").click(function(e){window.open("https://premio.io/help/chaty/","_blank")}),jQuery(".free-custom-radio, .free-custom-checkbox").on("click",function(e){e.preventDefault()});var c=jQuery("[name=cht_cta]"),i=jQuery(".preview .tooltip-show");c.keyup(function(){var e=jQuery(".preview .page .icon");c.val().length>=1?e.removeClass("no-tooltip"):e.addClass("no-tooltip"),i.attr("data-title",c.val())});var n,r,s='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',l=document.getElementById("iconWidget");jQuery(".color-picker-radio input:checked").val();function u(){var e,t,a=!1;jQuery("#iconWidget").removeClass("img-p-active"),h()?(0===jQuery(".js-chanel-desktop:checked").length&&(e=!1),1===jQuery(".js-chanel-desktop:checked").length&&(e=jQuery(".js-chanel-desktop:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-desktop:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-desktop:checked").length>1&&(e=s,a=!0)):(0===jQuery(".js-chanel-mobile:checked").length&&(t=!1),1===jQuery(".js-chanel-mobile:checked").length&&(t=jQuery(".js-chanel-mobile:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-mobile:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-mobile:checked").length>1&&(t=s,a=!0)),n=e,r=t,h()?y(n,a):y(r,a)}function y(e,t){if(l.innerHTML=e||"",t){var a=jQuery(".color-picker-custom input").val()?jQuery(".color-picker-custom input").val():jQuery(".color-picker-radio input:checked").val();jQuery(".preview .page svg circle").css({fill:a}),jQuery("#chaty-social-close ellipse").attr("fill",a)}thisVal=jQuery("#chaty_default_state").val(),"open"==thisVal?jQuery(".hide-show-button").addClass("active"):jQuery(".hide-show-button").removeClass("active"),jQuery(".chaty-widget").removeClass("active").removeClass("hover").removeClass("click"),"open"==thisVal?jQuery(".chaty-widget").addClass("active"):"hover"==thisVal?jQuery(".chaty-widget").addClass("hover"):jQuery(".chaty-widget").addClass("click"),jQuery(".chaty-channels").html("");var o=".js-chanel-mobile";if(h())o=".js-chanel-desktop";"open"==thisVal&&jQuery(o+":checked").length>1?(jQuery("#chaty_attention_effect").val(""),jQuery("#chaty_attention_effect, .test_textarea").attr("disabled",!0),jQuery("#chaty_attention_effect option:first-child").text("Doesn't apply for the open state"),"Doesn't apply for the open state"!=jQuery(".test_textarea").val()&&jQuery(".test_textarea").attr("data-value",jQuery(".test_textarea").val()),jQuery(".test_textarea").val("Doesn't apply for the open state")):(jQuery("#chaty_attention_effect, .test_textarea").attr("disabled",!1),jQuery("#chaty_attention_effect option:first-child").text("None"),jQuery(".test_textarea").attr("placeholder",""),"Doesn't apply for the open state"==jQuery(".test_textarea").val()&&jQuery(".test_textarea").val(jQuery(".test_textarea").attr("data-value"))),jQuery(o+":checked").length>1?(jQuery(o+":checked").each(function(){var e=jQuery(this).closest("li").find(".icon").html(),t=(e=jQuery(this).closest("li").find(".icon").html(),jQuery(this).closest("li").find(".chaty-title").val()),a=jQuery(this).closest(".channels-selected__item").hasClass("img-active")?"img-active":"";""!=t&&(t="<span class='social-tooltip'>"+t+"</span>"),jQuery(".chaty-channels").append("<div class='social-item-box "+a+"'><span class='tooltip-icon'>"+e+"</span>"+t+"</div>")}),"open"==jQuery("#chaty_default_state").val()&&jQuery("#cht_close_button").is(":checked")?(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):"open"!=jQuery("#chaty_default_state").val()?(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):"open"==jQuery("#chaty_default_state").val()&&(jQuery("#iconWidget").hide(),jQuery(".chaty-widget .tooltiptext").hide(),jQuery(".chaty-widget").addClass("hide-arrow")),jQuery(".chaty-widget").removeClass("has-single")):1==jQuery(o+":checked").length?("open"!=jQuery("#chaty_default_state").val()||jQuery("#cht_close_button").is(":checked")?"open"!=jQuery("#chaty_default_state").val()&&(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")),jQuery(".chaty-widget").addClass("has-single")):0==jQuery(o+":checked").length&&(jQuery("#iconWidget").hide(),jQuery(".chaty-widget .tooltiptext").hide(),jQuery(".chaty-widget").addClass("hide-arrow"),jQuery(".chaty-widget").removeClass("has-single")),jQuery(".chaty-channels .remove-icon-img").remove(),jQuery("#trigger_on_time").is(":checked")?jQuery("#chaty_trigger_time").attr("readonly",!1):jQuery("#chaty_trigger_time").attr("readonly",!0),jQuery("#chaty_trigger_on_scroll").is(":checked")?jQuery("#chaty_trigger_on_page_scroll").attr("readonly",!1):jQuery("#chaty_trigger_on_page_scroll").attr("readonly",!0),""==jQuery(".chaty-widget .tooltiptext").text()?jQuery(".chaty-widget .tooltiptext").hide():"open"==jQuery("#chaty_default_state").val()&&jQuery(o+":checked").length>1?jQuery(".chaty-widget .tooltiptext").hide():jQuery(".chaty-widget .tooltiptext").css("display","block")}function h(){return"checked"===jQuery("#previewDesktop").attr("checked")}jQuery("#testUpload").on("change",function(){this.value.length>0?document.querySelector(".js-upload").disabled=!1:(document.querySelector(".js-upload").disabled=!0,document.getElementById("uploadInput").checked=!1)}),jQuery(document).on("keyup","textarea.test_textarea",function(){u()}),jQuery(".js-switch-preview").on("change",function(){h()?jQuery(this).closest(".preview").removeClass("mobiel-view"):jQuery(this).closest(".preview").addClass("mobiel-view"),u()}),jQuery(document).on("change",".js-chanel-icon",function(){u()}),jQuery(document).on("change",".js-widget-i",function(e){s=e.target.classList.contains("js-upload")?jQuery(".file-preview-image").last().parent().html():jQuery("i[data-type="+e.target.dataset.type+"]").html(),u()}),"chat-image"!==jQuery(".js-widget-i:checked").attr("data-type")&&(s=jQuery("i[data-type="+jQuery(".js-widget-i:checked").attr("data-type")+"]").html(),u())}),jQuery(document).ready(function(){jQuery(document).on("click",".chaty-popup-box button, #chaty-intro-popup",function(t){t.stopPropagation();var a=jQuery("#chaty_update_popup_status").val();e("#chaty-intro-popup").remove(),e.ajax({type:"POST",url:ajaxurl,data:{action:"update_popup_status",nonce:a},beforeSend:function(e){},success:function(e){},error:function(e,t,a){}})}),jQuery(document).on("click",".chaty-popup-box",function(e){e.stopPropagation()}),jQuery(document).on("click",".remove-chaty-options",function(t){t.preventDefault(),t.stopPropagation(),confirm("Are you sure you want to delete this widget?")&&e.ajax({type:"POST",url:ajaxurl,data:{action:"remove_chaty_widget",nonce_code:cht_nonce_ajax.cht_nonce,widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(e){window.location=e},error:function(e,t,a){}})});window.location.href;window.location.href.indexOf("page=chaty-app&widget=")>-1&&jQuery("#toplevel_page_chaty-app .wp-submenu.wp-submenu-wrap li").each(function(){var e=jQuery(this).find("a").attr("href");void 0!==e&&(jQuery(this).removeClass("current"),window.location.href.indexOf(e)>-1&&e.indexOf("&widget=")>-1&&jQuery(this).addClass("current"))})})}(jQuery),jQuery(window).scroll(function(){check_for_preview_pos()}),jQuery(document).ready(function(){check_for_preview_pos()});var totalPageOptions=0,pageOptionContent="",totalDateAndTimeOptions=0,dateAndTimeOptionContent="";jQuery(document).ready(function(){totalPageOptions=parseInt(jQuery(".chaty-page-option").length),pageOptionContent=jQuery(".chaty-page-options-html").html(),jQuery(".chaty-page-options-html").remove(),totalDateAndTimeOptions=parseInt(jQuery(".chaty-date-time-option").length),dateAndTimeOptionContent=jQuery(".chaty-date-and-time-options-html").html(),jQuery(".chaty-date-and-time-options-html").remove(),jQuery("#create-rule").click(function(){jQuery(".page-options").toggle()}),jQuery("#create-data-and-time-rule").click(function(){jQuery(".chaty-data-and-time-rules").toggle()}),jQuery(document).on("change","#chaty_attention_effect",function(){var e=jQuery(this).attr("data-effect");""!=e&&jQuery("#iconWidget").removeClass("chaty-animation-"+e),jQuery("#iconWidget").removeClass("start-now"),jQuery("#iconWidget").addClass("chaty-animation-"+jQuery(this).val()).addClass("start-now"),jQuery(this).attr("data-effect",jQuery(this).val())}),setInterval(function(){var e=jQuery("#chaty_attention_effect").attr("data-effect");""!=e?(jQuery("#iconWidget").removeClass("chaty-animation-"+e),jQuery("#iconWidget").removeClass("start-now"),setTimeout(function(){jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now")},1e3)):jQuery("#chaty_attention_effect").attr("data-effect",jQuery("#chaty_attention_effect").val())},5e3),jQuery(document).on("click",".remove-chaty",function(){jQuery(this).closest(".chaty-page-option").remove(),jQuery(".chaty-page-options .chaty-page-option").removeClass("last"),jQuery(".chaty-page-options .chaty-page-option:last").addClass("last")}),jQuery(document).on("click",".remove-page-option",function(){jQuery(this).closest(".chaty-date-time-option").remove()}),jQuery("#image-upload-content .custom-control-label").click(function(e){return e.stopPropagation(),jQuery(this).closest(".custom-control").find("input[type=radio]").attr("checked",!0),jQuery(".js-widget-i").trigger("change"),!1}),jQuery(".chaty-color-field").spectrum({chooseText:"Submit",preferredFormat:"hex",cancelText:"Cancel",showInput:!0,move:function(e){jQuery(this).val(e.toHexString()),chaty_set_bg_color(),change_custom_preview()}}),jQuery(".chaty-color-field").change(function(){chaty_set_bg_color(),change_custom_preview()}),jQuery(".remove-chaty-img").on("click",function(e){e.stopPropagation()}),jQuery("#channels-selected-list").sortable({placeholder:"ui-chaty-state-hl",items:"li:not(#chaty-social-close)",update:function(e,t){set_social_channel_order(),change_custom_preview()}}),jQuery(".close-button-img img, .close-button-img .image-upload").click(function(){var e=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery(".close-button-img").addClass("active"),jQuery(".close-button-img input").val(imageData.id),jQuery(".close-button-img img").attr("src",imageData.url),change_custom_preview()})}),jQuery(".remove-close-img").click(function(){default_image=jQuery("#default_image").val(),jQuery(".close-button-img").removeClass("active"),jQuery(".close-button-img input").val(""),jQuery(".close-button-img img").attr("src",default_image),change_custom_preview()}),jQuery(document).on("click",".chaty-widget.click",function(e){e.preventDefault(),jQuery(".chaty-widget").toggleClass("active")}),jQuery(document).on("change",".url-options.cht-required",function(e){thisVal=jQuery(this).val(),siteURL=jQuery("#chaty_site_url").val(),newURL=siteURL,"page_has_url"==thisVal?newURL=siteURL:"page_contains"==thisVal?newURL=siteURL+"%s%":"page_start_with"==thisVal?newURL=siteURL+"s%":"page_end_with"==thisVal&&(newURL=siteURL+"%s"),jQuery(this).closest(".url-content").find(".chaty-url").text(newURL)}),check_for_chaty_close_button(),chaty_set_bg_color(),change_custom_preview(),jQuery(".chaty-settings.cls-btn a, .close-btn-set").click(function(e){e.preventDefault(),jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active")}),0==jQuery("input[name='cht_position']:checked").length&&(jQuery("#right-position").attr("checked",!0),jQuery("input[name='cht_position']:checked").trigger("change")),0==jQuery("input[name='widget_icon']:checked").length&&(jQuery("input[name='widget_icon']:first").attr("checked",!0),jQuery("input[name='widget_icon']:checked").trigger("change")),jQuery(".form-fonts").on("change",function(){var e=jQuery(this).val();jQuery(".chaty-google-font").remove(),""!=e?(jQuery("head").append('<link href="https://fonts.googleapis.com/css?family='+e+':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">'),jQuery(".preview-section-chaty #admin-preview .page-body").css("font-family",e)):jQuery(".preview-section-chaty #admin-preview .page-body").attr("style","")})}),jQuery(window).load(function(){check_for_chaty_close_button(),chaty_set_bg_color(),jQuery(".chaty-page-options .chaty-page-option").removeClass("last"),jQuery(".chaty-page-options .chaty-page-option:last").addClass("last"),jQuery(".url-options.cht-required").each(function(){jQuery(this).trigger("change")});var e=jQuery(".form-fonts").val();jQuery(".chaty-google-font").remove(),""!=e&&(jQuery("head").append('<link href="https://fonts.googleapis.com/css?family='+e+':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">'),jQuery(".preview-section-chaty #admin-preview .page-body").css("font-family",e))});var selectedsocialSlug="";function upload_chaty_image(e){selectedsocialSlug=e;var t=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",function(e){var a=t.state().get("selection").first();imageData=a.toJSON(),jQuery("#cht_social_image_"+selectedsocialSlug).val(imageData.id),jQuery(".custom-image-"+selectedsocialSlug+" img").attr("src",imageData.url),jQuery("#chaty-social-"+selectedsocialSlug+" .channels-selected__item").addClass("img-active"),change_custom_preview()})}function toggle_chaty_setting(e){jQuery("#chaty-social-"+e).find(".chaty-advance-settings").toggle(),change_custom_preview()}function chaty_set_bg_color(){jQuery(".chaty-color-field").each(function(){""!=jQuery(this).val()&&"#ffffff"!=jQuery(this).val()&&("Linkedin"!=jQuery(this).closest("li").data("id")||"Linkedin"==jQuery(this).closest("li").data("id")&&"#ffffff"!=jQuery(this).val())&&(defaultColor=jQuery(this).val(),jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill",defaultColor),jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background",defaultColor),jQuery(this).closest(".channels-selected__item").find(".facustom-icon").css("background",defaultColor))}),change_custom_preview()}function upload_qr_code(){var e=wp.media({title:"Upload QR Image",multiple:!1,library:{type:"image"}}).open().on("select",function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery("#upload_qr_code_val").val(imageData.id),jQuery("#upload_qr_code img").attr("src",imageData.url),jQuery(".remove-qr-code").addClass("active"),change_custom_preview()})}function remove_qr_code(){jQuery(".remove-qr-code").removeClass("active"),jQuery("#upload_qr_code_val").val(""),default_image=jQuery("#default_image").val(),jQuery("#upload_qr_code img").attr("src",default_image),change_custom_preview()}function remove_chaty_image(e){default_image=jQuery("#default_image").val(),jQuery("#chaty-social-"+e+" .channels-selected__item").removeClass("img-active"),jQuery("#cht_social_image_"+e).val(""),jQuery("#cht_social_image_src_"+e).attr("src",default_image),change_custom_preview()}var baseIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',defaultIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',iconBlock=document.getElementById("iconWidget");function set_social_channel_order(){socialString=[],jQuery("#channels-selected-list li").each(function(){socialString.push(jQuery(this).attr("data-id"))}),socialString=socialString.join(","),jQuery("#cht_numb_slug").val(socialString),check_for_chaty_close_button()}function check_for_chaty_close_button(){jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length>=2?jQuery("#chaty-social-close").show():jQuery("#chaty-social-close").hide(),change_custom_preview();var e="";jQuery("#channels-selected-list > li").each(function(){"undefined"!=jQuery(this).attr("data-id")&&""!=jQuery(this).attr("data-id")&&(e+=jQuery(this).attr("data-id")+","),e=e.trimRight(",")}),jQuery(".add_slug").val(e)}function change_custom_preview(){var e,t,a=!1;jQuery("#iconWidget").removeClass("img-p-active"),getChtPreviewDesktop()?(0===jQuery(".js-chanel-desktop:checked").length&&(e=!1),1===jQuery(".js-chanel-desktop:checked").length&&(e=jQuery(".js-chanel-desktop:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-desktop:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-desktop:checked").length>1&&(e=defaultIcon,a=!0)):(0===jQuery(".js-chanel-mobile:checked").length&&(t=!1),1===jQuery(".js-chanel-mobile:checked").length&&(t=jQuery(".js-chanel-mobile:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-mobile:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-mobile:checked").length>1&&(t=defaultIcon,a=!0)),desktopIcon=e,mobileIcon=t,getChtPreviewDesktop()?setChtIcon(desktopIcon,a):setChtIcon(mobileIcon,a)}function getChtPreviewDesktop(){return"checked"===jQuery("#previewDesktop").attr("checked")}function setChtIcon(e,t){if((iconBlock=document.getElementById("iconWidget")).innerHTML=e||"",t){var a=jQuery(".color-picker-custom input").val()?jQuery(".color-picker-custom input").val():jQuery(".color-picker-radio input:checked").val();jQuery(".preview .page svg circle").css({fill:a}),jQuery("#chaty-social-close ellipse").attr("fill",a)}jQuery(".js-widget-i:checked").trigger("change")}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/assets/js/fileinput.min.js
CHANGED
@@ -1,4484 +1 @@
|
|
1 |
-
/*!
|
2 |
-
* bootstrap-fileinput v4.5.0
|
3 |
-
* http://plugins.krajee.com/file-input
|
4 |
-
*
|
5 |
-
* Author: Kartik Visweswaran
|
6 |
-
* Copyright: 2014 - 2018, Kartik Visweswaran, Krajee.com
|
7 |
-
*
|
8 |
-
* Licensed under the BSD 3-Clause
|
9 |
-
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
|
10 |
-
*/
|
11 |
-
(function (factory) {
|
12 |
-
"use strict";
|
13 |
-
//noinspection JSUnresolvedVariable
|
14 |
-
if (typeof define === 'function' && define.amd) { // jshint ignore:line
|
15 |
-
// AMD. Register as an anonymous module.
|
16 |
-
define(['jquery'], factory); // jshint ignore:line
|
17 |
-
} else { // noinspection JSUnresolvedVariable
|
18 |
-
if (typeof module === 'object' && module.exports) { // jshint ignore:line
|
19 |
-
// Node/CommonJS
|
20 |
-
// noinspection JSUnresolvedVariable
|
21 |
-
module.exports = factory(require('jquery')); // jshint ignore:line
|
22 |
-
} else {
|
23 |
-
// Browser globals
|
24 |
-
factory(window.jQuery);
|
25 |
-
}
|
26 |
-
}
|
27 |
-
}(function ($) {
|
28 |
-
"use strict";
|
29 |
-
|
30 |
-
$.fn.fileinputLocales = {};
|
31 |
-
$.fn.fileinputThemes = {};
|
32 |
-
|
33 |
-
String.prototype.setTokens = function (replacePairs) {
|
34 |
-
var str = this.toString(), key, re;
|
35 |
-
for (key in replacePairs) {
|
36 |
-
if (replacePairs.hasOwnProperty(key)) {
|
37 |
-
re = new RegExp("\{" + key + "\}", "g");
|
38 |
-
str = str.replace(re, replacePairs[key]);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
return str;
|
42 |
-
};
|
43 |
-
|
44 |
-
var $h, FileInput;
|
45 |
-
|
46 |
-
// fileinput helper object for all global variables and internal helper methods
|
47 |
-
//noinspection JSUnresolvedVariable
|
48 |
-
$h = {
|
49 |
-
FRAMES: '.kv-preview-thumb',
|
50 |
-
SORT_CSS: 'file-sortable',
|
51 |
-
OBJECT_PARAMS: '<param name="controller" value="true" />\n' +
|
52 |
-
'<param name="allowFullScreen" value="true" />\n' +
|
53 |
-
'<param name="allowScriptAccess" value="always" />\n' +
|
54 |
-
'<param name="autoPlay" value="false" />\n' +
|
55 |
-
'<param name="autoStart" value="false" />\n' +
|
56 |
-
'<param name="quality" value="high" />\n',
|
57 |
-
DEFAULT_PREVIEW: '<div class="file-preview-other">\n' +
|
58 |
-
'<span class="{previewFileIconClass}">{previewFileIcon}</span>\n' +
|
59 |
-
'</div>',
|
60 |
-
MODAL_ID: 'kvFileinputModal',
|
61 |
-
MODAL_EVENTS: ['show', 'shown', 'hide', 'hidden', 'loaded'],
|
62 |
-
objUrl: window.URL || window.webkitURL,
|
63 |
-
compare: function (input, str, exact) {
|
64 |
-
return input !== undefined && (exact ? input === str : input.match(str));
|
65 |
-
},
|
66 |
-
isIE: function (ver) {
|
67 |
-
// check for IE versions < 11
|
68 |
-
if (navigator.appName !== 'Microsoft Internet Explorer') {
|
69 |
-
return false;
|
70 |
-
}
|
71 |
-
if (ver === 10) {
|
72 |
-
return new RegExp('msie\\s' + ver, 'i').test(navigator.userAgent);
|
73 |
-
}
|
74 |
-
var div = document.createElement("div"), status;
|
75 |
-
div.innerHTML = "<!--[if IE " + ver + "]> <i></i> <![endif]-->";
|
76 |
-
status = div.getElementsByTagName("i").length;
|
77 |
-
document.body.appendChild(div);
|
78 |
-
div.parentNode.removeChild(div);
|
79 |
-
return status;
|
80 |
-
},
|
81 |
-
canAssignFilesToInput: function () {
|
82 |
-
var input = document.createElement('input');
|
83 |
-
try {
|
84 |
-
input.type = "file";
|
85 |
-
input.files = null;
|
86 |
-
return true;
|
87 |
-
} catch (err) {
|
88 |
-
return false;
|
89 |
-
}
|
90 |
-
},
|
91 |
-
getDragDropFolders: function (items) {
|
92 |
-
var i, item, len = items.length, folders = 0;
|
93 |
-
if (len > 0 && items[0].webkitGetAsEntry()) {
|
94 |
-
for (i = 0; i < len; i++) {
|
95 |
-
item = items[i].webkitGetAsEntry();
|
96 |
-
if (item && item.isDirectory) {
|
97 |
-
folders++;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
return folders;
|
102 |
-
},
|
103 |
-
initModal: function ($modal) {
|
104 |
-
var $body = $('body');
|
105 |
-
if ($body.length) {
|
106 |
-
$modal.appendTo($body);
|
107 |
-
}
|
108 |
-
},
|
109 |
-
isEmpty: function (value, trim) {
|
110 |
-
return value === undefined || value === null || value.length === 0 || (trim && $.trim(value) === '');
|
111 |
-
},
|
112 |
-
isArray: function (a) {
|
113 |
-
return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]';
|
114 |
-
},
|
115 |
-
ifSet: function (needle, haystack, def) {
|
116 |
-
def = def || '';
|
117 |
-
return (haystack && typeof haystack === 'object' && needle in haystack) ? haystack[needle] : def;
|
118 |
-
},
|
119 |
-
cleanArray: function (arr) {
|
120 |
-
if (!(arr instanceof Array)) {
|
121 |
-
arr = [];
|
122 |
-
}
|
123 |
-
return arr.filter(function (e) {
|
124 |
-
return (e !== undefined && e !== null);
|
125 |
-
});
|
126 |
-
},
|
127 |
-
spliceArray: function (arr, index, reverseOrder) {
|
128 |
-
var i, j = 0, out = [], newArr;
|
129 |
-
if (!(arr instanceof Array)) {
|
130 |
-
return [];
|
131 |
-
}
|
132 |
-
newArr = $.extend(true, [], arr);
|
133 |
-
if (reverseOrder) {
|
134 |
-
newArr.reverse();
|
135 |
-
}
|
136 |
-
for (i = 0; i < newArr.length; i++) {
|
137 |
-
if (i !== index) {
|
138 |
-
out[j] = newArr[i];
|
139 |
-
j++;
|
140 |
-
}
|
141 |
-
}
|
142 |
-
if (reverseOrder) {
|
143 |
-
out.reverse();
|
144 |
-
}
|
145 |
-
return out;
|
146 |
-
},
|
147 |
-
getNum: function (num, def) {
|
148 |
-
def = def || 0;
|
149 |
-
if (typeof num === "number") {
|
150 |
-
return num;
|
151 |
-
}
|
152 |
-
if (typeof num === "string") {
|
153 |
-
num = parseFloat(num);
|
154 |
-
}
|
155 |
-
return isNaN(num) ? def : num;
|
156 |
-
},
|
157 |
-
hasFileAPISupport: function () {
|
158 |
-
return !!(window.File && window.FileReader);
|
159 |
-
},
|
160 |
-
hasDragDropSupport: function () {
|
161 |
-
var div = document.createElement('div');
|
162 |
-
/** @namespace div.draggable */
|
163 |
-
/** @namespace div.ondragstart */
|
164 |
-
/** @namespace div.ondrop */
|
165 |
-
return !$h.isIE(9) &&
|
166 |
-
(div.draggable !== undefined || (div.ondragstart !== undefined && div.ondrop !== undefined));
|
167 |
-
},
|
168 |
-
hasFileUploadSupport: function () {
|
169 |
-
return $h.hasFileAPISupport() && window.FormData;
|
170 |
-
},
|
171 |
-
hasBlobSupport: function () {
|
172 |
-
try {
|
173 |
-
return !!window.Blob && Boolean(new Blob());
|
174 |
-
} catch (e) {
|
175 |
-
return false;
|
176 |
-
}
|
177 |
-
},
|
178 |
-
hasArrayBufferViewSupport: function () {
|
179 |
-
try {
|
180 |
-
return new Blob([new Uint8Array(100)]).size === 100;
|
181 |
-
} catch (e) {
|
182 |
-
return false;
|
183 |
-
}
|
184 |
-
},
|
185 |
-
dataURI2Blob: function (dataURI) {
|
186 |
-
//noinspection JSUnresolvedVariable
|
187 |
-
var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder ||
|
188 |
-
window.MSBlobBuilder, canBlob = $h.hasBlobSupport(), byteStr, arrayBuffer, intArray, i, mimeStr, bb,
|
189 |
-
canProceed = (canBlob || BlobBuilder) && window.atob && window.ArrayBuffer && window.Uint8Array;
|
190 |
-
if (!canProceed) {
|
191 |
-
return null;
|
192 |
-
}
|
193 |
-
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
|
194 |
-
byteStr = atob(dataURI.split(',')[1]);
|
195 |
-
} else {
|
196 |
-
byteStr = decodeURIComponent(dataURI.split(',')[1]);
|
197 |
-
}
|
198 |
-
arrayBuffer = new ArrayBuffer(byteStr.length);
|
199 |
-
intArray = new Uint8Array(arrayBuffer);
|
200 |
-
for (i = 0; i < byteStr.length; i += 1) {
|
201 |
-
intArray[i] = byteStr.charCodeAt(i);
|
202 |
-
}
|
203 |
-
mimeStr = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
204 |
-
if (canBlob) {
|
205 |
-
return new Blob([$h.hasArrayBufferViewSupport() ? intArray : arrayBuffer], {type: mimeStr});
|
206 |
-
}
|
207 |
-
bb = new BlobBuilder();
|
208 |
-
bb.append(arrayBuffer);
|
209 |
-
return bb.getBlob(mimeStr);
|
210 |
-
},
|
211 |
-
arrayBuffer2String: function (buffer) {
|
212 |
-
//noinspection JSUnresolvedVariable
|
213 |
-
if (window.TextDecoder) {
|
214 |
-
// noinspection JSUnresolvedFunction
|
215 |
-
return new TextDecoder("utf-8").decode(buffer);
|
216 |
-
}
|
217 |
-
var array = Array.prototype.slice.apply(new Uint8Array(buffer)), out = '', i = 0, len, c, char2, char3;
|
218 |
-
len = array.length;
|
219 |
-
while (i < len) {
|
220 |
-
c = array[i++];
|
221 |
-
switch (c >> 4) { // jshint ignore:line
|
222 |
-
case 0:
|
223 |
-
case 1:
|
224 |
-
case 2:
|
225 |
-
case 3:
|
226 |
-
case 4:
|
227 |
-
case 5:
|
228 |
-
case 6:
|
229 |
-
case 7:
|
230 |
-
// 0xxxxxxx
|
231 |
-
out += String.fromCharCode(c);
|
232 |
-
break;
|
233 |
-
case 12:
|
234 |
-
case 13:
|
235 |
-
// 110x xxxx 10xx xxxx
|
236 |
-
char2 = array[i++];
|
237 |
-
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); // jshint ignore:line
|
238 |
-
break;
|
239 |
-
case 14:
|
240 |
-
// 1110 xxxx 10xx xxxx 10xx xxxx
|
241 |
-
char2 = array[i++];
|
242 |
-
char3 = array[i++];
|
243 |
-
out += String.fromCharCode(((c & 0x0F) << 12) | // jshint ignore:line
|
244 |
-
((char2 & 0x3F) << 6) | // jshint ignore:line
|
245 |
-
((char3 & 0x3F) << 0)); // jshint ignore:line
|
246 |
-
break;
|
247 |
-
}
|
248 |
-
}
|
249 |
-
return out;
|
250 |
-
},
|
251 |
-
isHtml: function (str) {
|
252 |
-
var a = document.createElement('div');
|
253 |
-
a.innerHTML = str;
|
254 |
-
for (var c = a.childNodes, i = c.length; i--;) {
|
255 |
-
if (c[i].nodeType === 1) {
|
256 |
-
return true;
|
257 |
-
}
|
258 |
-
}
|
259 |
-
return false;
|
260 |
-
},
|
261 |
-
isSvg: function (str) {
|
262 |
-
return str.match(/^\s*<\?xml/i) && (str.match(/<!DOCTYPE svg/i) || str.match(/<svg/i));
|
263 |
-
},
|
264 |
-
getMimeType: function (signature, contents, type) {
|
265 |
-
switch (signature) {
|
266 |
-
case "ffd8ffe0":
|
267 |
-
case "ffd8ffe1":
|
268 |
-
case "ffd8ffe2":
|
269 |
-
return 'image/jpeg';
|
270 |
-
case '89504E47':
|
271 |
-
return 'image/png';
|
272 |
-
case '47494638':
|
273 |
-
return 'image/gif';
|
274 |
-
case '49492a00':
|
275 |
-
return 'image/tiff';
|
276 |
-
case '52494646':
|
277 |
-
return 'image/webp';
|
278 |
-
case '66747970':
|
279 |
-
return 'video/3gp';
|
280 |
-
case '4f676753':
|
281 |
-
return 'video/ogg';
|
282 |
-
case '1a45dfa3':
|
283 |
-
return 'video/mkv';
|
284 |
-
case '000001ba':
|
285 |
-
case '000001b3':
|
286 |
-
return 'video/mpeg';
|
287 |
-
case '3026b275':
|
288 |
-
return 'video/wmv';
|
289 |
-
case '25504446':
|
290 |
-
return 'application/pdf';
|
291 |
-
case '25215053':
|
292 |
-
return 'application/ps';
|
293 |
-
case '504b0304':
|
294 |
-
case '504b0506':
|
295 |
-
case '504b0508':
|
296 |
-
return 'application/zip';
|
297 |
-
case '377abcaf':
|
298 |
-
return 'application/7z';
|
299 |
-
case '75737461':
|
300 |
-
return 'application/tar';
|
301 |
-
case '7801730d':
|
302 |
-
return 'application/dmg';
|
303 |
-
default:
|
304 |
-
switch (signature.substring(0, 6)) {
|
305 |
-
case '435753':
|
306 |
-
return 'application/x-shockwave-flash';
|
307 |
-
case '494433':
|
308 |
-
return 'audio/mp3';
|
309 |
-
case '425a68':
|
310 |
-
return 'application/bzip';
|
311 |
-
default:
|
312 |
-
switch (signature.substring(0, 4)) {
|
313 |
-
case '424d':
|
314 |
-
return 'image/bmp';
|
315 |
-
case 'fffb':
|
316 |
-
return 'audio/mp3';
|
317 |
-
case '4d5a':
|
318 |
-
return 'application/exe';
|
319 |
-
case '1f9d':
|
320 |
-
case '1fa0':
|
321 |
-
return 'application/zip';
|
322 |
-
case '1f8b':
|
323 |
-
return 'application/gzip';
|
324 |
-
default:
|
325 |
-
return contents && !contents.match(/[^\u0000-\u007f]/) ? 'application/text-plain' : type;
|
326 |
-
}
|
327 |
-
}
|
328 |
-
}
|
329 |
-
},
|
330 |
-
addCss: function ($el, css) {
|
331 |
-
$el.removeClass(css).addClass(css);
|
332 |
-
},
|
333 |
-
getElement: function (options, param, value) {
|
334 |
-
return ($h.isEmpty(options) || $h.isEmpty(options[param])) ? value : $(options[param]);
|
335 |
-
},
|
336 |
-
uniqId: function () {
|
337 |
-
return Math.round(new Date().getTime()) + '_' + Math.round(Math.random() * 100);
|
338 |
-
},
|
339 |
-
htmlEncode: function (str, undefVal) {
|
340 |
-
if (str === undefined) {
|
341 |
-
return undefVal || null;
|
342 |
-
}
|
343 |
-
return str.replace(/&/g, '&')
|
344 |
-
.replace(/</g, '<')
|
345 |
-
.replace(/>/g, '>')
|
346 |
-
.replace(/"/g, '"')
|
347 |
-
.replace(/'/g, ''');
|
348 |
-
},
|
349 |
-
replaceTags: function (str, tags) {
|
350 |
-
var out = str;
|
351 |
-
if (!tags) {
|
352 |
-
return out;
|
353 |
-
}
|
354 |
-
$.each(tags, function (key, value) {
|
355 |
-
if (typeof value === "function") {
|
356 |
-
value = value();
|
357 |
-
}
|
358 |
-
out = out.split(key).join(value);
|
359 |
-
});
|
360 |
-
return out;
|
361 |
-
},
|
362 |
-
cleanMemory: function ($thumb) {
|
363 |
-
var data = $thumb.is('img') ? $thumb.attr('src') : $thumb.find('source').attr('src');
|
364 |
-
/** @namespace $h.objUrl.revokeObjectURL */
|
365 |
-
$h.objUrl.revokeObjectURL(data);
|
366 |
-
},
|
367 |
-
findFileName: function (filePath) {
|
368 |
-
var sepIndex = filePath.lastIndexOf('/');
|
369 |
-
if (sepIndex === -1) {
|
370 |
-
sepIndex = filePath.lastIndexOf('\\');
|
371 |
-
}
|
372 |
-
return filePath.split(filePath.substring(sepIndex, sepIndex + 1)).pop();
|
373 |
-
},
|
374 |
-
checkFullScreen: function () {
|
375 |
-
//noinspection JSUnresolvedVariable
|
376 |
-
return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement ||
|
377 |
-
document.msFullscreenElement;
|
378 |
-
},
|
379 |
-
toggleFullScreen: function (maximize) {
|
380 |
-
var doc = document, de = doc.documentElement;
|
381 |
-
if (de && maximize && !$h.checkFullScreen()) {
|
382 |
-
/** @namespace document.requestFullscreen */
|
383 |
-
/** @namespace document.msRequestFullscreen */
|
384 |
-
/** @namespace document.mozRequestFullScreen */
|
385 |
-
/** @namespace document.webkitRequestFullscreen */
|
386 |
-
/** @namespace Element.ALLOW_KEYBOARD_INPUT */
|
387 |
-
if (de.requestFullscreen) {
|
388 |
-
de.requestFullscreen();
|
389 |
-
} else if (de.msRequestFullscreen) {
|
390 |
-
de.msRequestFullscreen();
|
391 |
-
} else if (de.mozRequestFullScreen) {
|
392 |
-
de.mozRequestFullScreen();
|
393 |
-
} else if (de.webkitRequestFullscreen) {
|
394 |
-
de.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
395 |
-
}
|
396 |
-
} else {
|
397 |
-
/** @namespace document.exitFullscreen */
|
398 |
-
/** @namespace document.msExitFullscreen */
|
399 |
-
/** @namespace document.mozCancelFullScreen */
|
400 |
-
/** @namespace document.webkitExitFullscreen */
|
401 |
-
if (doc.exitFullscreen) {
|
402 |
-
doc.exitFullscreen();
|
403 |
-
} else if (doc.msExitFullscreen) {
|
404 |
-
doc.msExitFullscreen();
|
405 |
-
} else if (doc.mozCancelFullScreen) {
|
406 |
-
doc.mozCancelFullScreen();
|
407 |
-
} else if (doc.webkitExitFullscreen) {
|
408 |
-
doc.webkitExitFullscreen();
|
409 |
-
}
|
410 |
-
}
|
411 |
-
},
|
412 |
-
moveArray: function (arr, oldIndex, newIndex, reverseOrder) {
|
413 |
-
var newArr = $.extend(true, [], arr);
|
414 |
-
if (reverseOrder) {
|
415 |
-
newArr.reverse();
|
416 |
-
}
|
417 |
-
if (newIndex >= newArr.length) {
|
418 |
-
var k = newIndex - newArr.length;
|
419 |
-
while ((k--) + 1) {
|
420 |
-
newArr.push(undefined);
|
421 |
-
}
|
422 |
-
}
|
423 |
-
newArr.splice(newIndex, 0, newArr.splice(oldIndex, 1)[0]);
|
424 |
-
if (reverseOrder) {
|
425 |
-
newArr.reverse();
|
426 |
-
}
|
427 |
-
return newArr;
|
428 |
-
},
|
429 |
-
cleanZoomCache: function ($el) {
|
430 |
-
var $cache = $el.closest('.kv-zoom-cache-theme');
|
431 |
-
if (!$cache.length) {
|
432 |
-
$cache = $el.closest('.kv-zoom-cache');
|
433 |
-
}
|
434 |
-
$cache.remove();
|
435 |
-
},
|
436 |
-
closeButton: function (css) {
|
437 |
-
css = css ? 'close ' + css : 'close';
|
438 |
-
return '<button type="button" class="' + css + '" aria-label="Close">\n' +
|
439 |
-
' <span aria-hidden="true">×</span>\n' +
|
440 |
-
'</button>';
|
441 |
-
},
|
442 |
-
getRotation: function (value) {
|
443 |
-
switch (value) {
|
444 |
-
case 2:
|
445 |
-
return 'rotateY(180deg)';
|
446 |
-
case 3:
|
447 |
-
return 'rotate(180deg)';
|
448 |
-
case 4:
|
449 |
-
return 'rotate(180deg) rotateY(180deg)';
|
450 |
-
case 5:
|
451 |
-
return 'rotate(270deg) rotateY(180deg)';
|
452 |
-
case 6:
|
453 |
-
return 'rotate(90deg)';
|
454 |
-
case 7:
|
455 |
-
return 'rotate(90deg) rotateY(180deg)';
|
456 |
-
case 8:
|
457 |
-
return 'rotate(270deg)';
|
458 |
-
default:
|
459 |
-
return '';
|
460 |
-
}
|
461 |
-
},
|
462 |
-
setTransform: function (el, val) {
|
463 |
-
if (!el) {
|
464 |
-
return;
|
465 |
-
}
|
466 |
-
el.style.transform = val;
|
467 |
-
el.style.webkitTransform = val;
|
468 |
-
el.style['-moz-transform'] = val;
|
469 |
-
el.style['-ms-transform'] = val;
|
470 |
-
el.style['-o-transform'] = val;
|
471 |
-
},
|
472 |
-
setImageOrientation: function ($img, $zoomImg, value) {
|
473 |
-
if (!$img || !$img.length) {
|
474 |
-
return;
|
475 |
-
}
|
476 |
-
var ev = 'load.fileinputimageorient';
|
477 |
-
$img.off(ev).on(ev, function () {
|
478 |
-
var img = $img.get(0), zoomImg = $zoomImg && $zoomImg.length ? $zoomImg.get(0) : null,
|
479 |
-
h = img.offsetHeight, w = img.offsetWidth, r = $h.getRotation(value);
|
480 |
-
$img.data('orientation', value);
|
481 |
-
if (zoomImg) {
|
482 |
-
$zoomImg.data('orientation', value);
|
483 |
-
}
|
484 |
-
if (value < 5) {
|
485 |
-
$h.setTransform(img, r);
|
486 |
-
$h.setTransform(zoomImg, r);
|
487 |
-
return;
|
488 |
-
}
|
489 |
-
var offsetAngle = Math.atan(w / h), origFactor = Math.sqrt(Math.pow(h, 2) + Math.pow(w, 2)),
|
490 |
-
scale = !origFactor ? 1 : (h / Math.cos(Math.PI / 2 + offsetAngle)) / origFactor,
|
491 |
-
s = ' scale(' + Math.abs(scale) + ')';
|
492 |
-
$h.setTransform(img, r + s);
|
493 |
-
$h.setTransform(zoomImg, r + s);
|
494 |
-
});
|
495 |
-
}
|
496 |
-
};
|
497 |
-
FileInput = function (element, options) {
|
498 |
-
var self = this;
|
499 |
-
self.$element = $(element);
|
500 |
-
self.$parent = self.$element.parent();
|
501 |
-
if (!self._validate()) {
|
502 |
-
return;
|
503 |
-
}
|
504 |
-
self.isPreviewable = $h.hasFileAPISupport();
|
505 |
-
self.isIE9 = $h.isIE(9);
|
506 |
-
self.isIE10 = $h.isIE(10);
|
507 |
-
if (self.isPreviewable || self.isIE9) {
|
508 |
-
self._init(options);
|
509 |
-
self._listen();
|
510 |
-
}
|
511 |
-
self.$element.removeClass('file-loading');
|
512 |
-
};
|
513 |
-
//noinspection JSUnusedGlobalSymbols
|
514 |
-
FileInput.prototype = {
|
515 |
-
constructor: FileInput,
|
516 |
-
_cleanup: function () {
|
517 |
-
var self = this;
|
518 |
-
self.reader = null;
|
519 |
-
self.formdata = {};
|
520 |
-
self.uploadCount = 0;
|
521 |
-
self.uploadStatus = {};
|
522 |
-
self.uploadLog = [];
|
523 |
-
self.uploadAsyncCount = 0;
|
524 |
-
self.loadedImages = [];
|
525 |
-
self.totalImagesCount = 0;
|
526 |
-
self.ajaxRequests = [];
|
527 |
-
self.clearStack();
|
528 |
-
self.fileBatchCompleted = true;
|
529 |
-
if (!self.isPreviewable) {
|
530 |
-
self.showPreview = false;
|
531 |
-
}
|
532 |
-
self.isError = false;
|
533 |
-
self.ajaxAborted = false;
|
534 |
-
self.cancelling = false;
|
535 |
-
},
|
536 |
-
_init: function (options, refreshMode) {
|
537 |
-
var self = this, f, $el = self.$element, $cont, t, tmp;
|
538 |
-
self.options = options;
|
539 |
-
$.each(options, function (key, value) {
|
540 |
-
switch (key) {
|
541 |
-
case 'minFileCount':
|
542 |
-
case 'maxFileCount':
|
543 |
-
case 'minFileSize':
|
544 |
-
case 'maxFileSize':
|
545 |
-
case 'maxFilePreviewSize':
|
546 |
-
case 'resizeImageQuality':
|
547 |
-
case 'resizeIfSizeMoreThan':
|
548 |
-
case 'progressUploadThreshold':
|
549 |
-
case 'initialPreviewCount':
|
550 |
-
case 'zoomModalHeight':
|
551 |
-
case 'minImageHeight':
|
552 |
-
case 'maxImageHeight':
|
553 |
-
case 'minImageWidth':
|
554 |
-
case 'maxImageWidth':
|
555 |
-
self[key] = $h.getNum(value);
|
556 |
-
break;
|
557 |
-
default:
|
558 |
-
self[key] = value;
|
559 |
-
break;
|
560 |
-
}
|
561 |
-
});
|
562 |
-
if (self.rtl) { // swap buttons for rtl
|
563 |
-
tmp = self.previewZoomButtonIcons.prev;
|
564 |
-
self.previewZoomButtonIcons.prev = self.previewZoomButtonIcons.next;
|
565 |
-
self.previewZoomButtonIcons.next = tmp;
|
566 |
-
}
|
567 |
-
if (!refreshMode) {
|
568 |
-
self._cleanup();
|
569 |
-
}
|
570 |
-
self.$form = $el.closest('form');
|
571 |
-
self._initTemplateDefaults();
|
572 |
-
self.uploadFileAttr = !$h.isEmpty($el.attr('name')) ? $el.attr('name') : 'file_data';
|
573 |
-
t = self._getLayoutTemplate('progress');
|
574 |
-
self.progressTemplate = t.replace('{class}', self.progressClass);
|
575 |
-
self.progressCompleteTemplate = t.replace('{class}', self.progressCompleteClass);
|
576 |
-
self.progressErrorTemplate = t.replace('{class}', self.progressErrorClass);
|
577 |
-
self.isDisabled = $el.attr('disabled') || $el.attr('readonly');
|
578 |
-
if (self.isDisabled) {
|
579 |
-
$el.attr('disabled', true);
|
580 |
-
}
|
581 |
-
self.isAjaxUpload = $h.hasFileUploadSupport() && !$h.isEmpty(self.uploadUrl);
|
582 |
-
self.dropZoneEnabled = $h.hasDragDropSupport() && self.dropZoneEnabled;
|
583 |
-
if (!self.isAjaxUpload) {
|
584 |
-
self.dropZoneEnabled = self.dropZoneEnabled && $h.canAssignFilesToInput();
|
585 |
-
}
|
586 |
-
self.isClickable = self.browseOnZoneClick && self.showPreview &&
|
587 |
-
(self.dropZoneEnabled || !$h.isEmpty(self.defaultPreviewContent));
|
588 |
-
self.slug = typeof options.slugCallback === "function" ? options.slugCallback : self._slugDefault;
|
589 |
-
self.mainTemplate = self.showCaption ? self._getLayoutTemplate('main1') : self._getLayoutTemplate('main2');
|
590 |
-
self.captionTemplate = self._getLayoutTemplate('caption');
|
591 |
-
self.previewGenericTemplate = self._getPreviewTemplate('generic');
|
592 |
-
if (!self.imageCanvas && self.resizeImage && (self.maxImageWidth || self.maxImageHeight)) {
|
593 |
-
self.imageCanvas = document.createElement('canvas');
|
594 |
-
self.imageCanvasContext = self.imageCanvas.getContext('2d');
|
595 |
-
}
|
596 |
-
if ($h.isEmpty($el.attr('id'))) {
|
597 |
-
$el.attr('id', $h.uniqId());
|
598 |
-
}
|
599 |
-
self.namespace = '.fileinput_' + $el.attr('id').replace(/-/g, '_');
|
600 |
-
if (self.$container === undefined) {
|
601 |
-
self.$container = self._createContainer();
|
602 |
-
} else {
|
603 |
-
self._refreshContainer();
|
604 |
-
}
|
605 |
-
$cont = self.$container;
|
606 |
-
self.$dropZone = $cont.find('.file-drop-zone');
|
607 |
-
self.$progress = $cont.find('.kv-upload-progress');
|
608 |
-
self.$btnUpload = $cont.find('.fileinput-upload');
|
609 |
-
self.$captionContainer = $h.getElement(options, 'elCaptionContainer', $cont.find('.file-caption'));
|
610 |
-
self.$caption = $h.getElement(options, 'elCaptionText', $cont.find('.file-caption-name'));
|
611 |
-
if (!$h.isEmpty(self.msgPlaceholder)) {
|
612 |
-
f = $el.attr('multiple') ? self.filePlural : self.fileSingle;
|
613 |
-
self.$caption.attr('placeholder', self.msgPlaceholder.replace('{files}', f));
|
614 |
-
}
|
615 |
-
self.$captionIcon = self.$captionContainer.find('.file-caption-icon');
|
616 |
-
self.$previewContainer = $h.getElement(options, 'elPreviewContainer', $cont.find('.file-preview'));
|
617 |
-
self.$preview = $h.getElement(options, 'elPreviewImage', $cont.find('.file-preview-thumbnails'));
|
618 |
-
self.$previewStatus = $h.getElement(options, 'elPreviewStatus', $cont.find('.file-preview-status'));
|
619 |
-
self.$errorContainer = $h.getElement(options, 'elErrorContainer', self.$previewContainer.find('.kv-fileinput-error'));
|
620 |
-
self._validateDisabled();
|
621 |
-
if (!$h.isEmpty(self.msgErrorClass)) {
|
622 |
-
$h.addCss(self.$errorContainer, self.msgErrorClass);
|
623 |
-
}
|
624 |
-
if (!refreshMode) {
|
625 |
-
self.$errorContainer.hide();
|
626 |
-
self.previewInitId = "preview-" + $h.uniqId();
|
627 |
-
self._initPreviewCache();
|
628 |
-
self._initPreview(true);
|
629 |
-
self._initPreviewActions();
|
630 |
-
if (self.$parent.hasClass('file-loading')) {
|
631 |
-
self.$container.insertBefore(self.$parent);
|
632 |
-
self.$parent.remove();
|
633 |
-
}
|
634 |
-
} else {
|
635 |
-
if (!self._errorsExist()) {
|
636 |
-
self.$errorContainer.hide();
|
637 |
-
}
|
638 |
-
}
|
639 |
-
self._setFileDropZoneTitle();
|
640 |
-
if ($el.attr('disabled')) {
|
641 |
-
self.disable();
|
642 |
-
}
|
643 |
-
self._initZoom();
|
644 |
-
if (self.hideThumbnailContent) {
|
645 |
-
$h.addCss(self.$preview, 'hide-content');
|
646 |
-
}
|
647 |
-
},
|
648 |
-
_initTemplateDefaults: function () {
|
649 |
-
var self = this, tMain1, tMain2, tPreview, tFileIcon, tClose, tCaption, tBtnDefault, tBtnLink, tBtnBrowse,
|
650 |
-
tModalMain, tModal, tProgress, tSize, tFooter, tActions, tActionDelete, tActionUpload, tActionDownload,
|
651 |
-
tActionZoom, tActionDrag, tIndicator, tTagBef, tTagBef1, tTagBef2, tTagAft, tGeneric, tHtml, tImage,
|
652 |
-
tText, tOffice, tGdocs, tVideo, tAudio, tFlash, tObject, tPdf, tOther, tStyle, tZoomCache, vDefaultDim;
|
653 |
-
tMain1 = '{preview}\n' +
|
654 |
-
'<div class="kv-upload-progress kv-hidden"></div><div class="clearfix"></div>\n' +
|
655 |
-
'<div class="input-group {class}">\n' +
|
656 |
-
' {caption}\n' +
|
657 |
-
'<div class="input-group-btn input-group-append">\n' +
|
658 |
-
' {remove}\n' +
|
659 |
-
' {cancel}\n' +
|
660 |
-
' {upload}\n' +
|
661 |
-
' {browse}\n' +
|
662 |
-
' </div>\n' +
|
663 |
-
'</div>';
|
664 |
-
tMain2 = '{preview}\n<div class="kv-upload-progress kv-hidden"></div>\n<div class="clearfix"></div>\n{remove}\n{cancel}\n{upload}\n{browse}\n';
|
665 |
-
tPreview = '<div class="file-preview {class}">\n' +
|
666 |
-
' {close}' +
|
667 |
-
' <div class="{dropClass}">\n' +
|
668 |
-
' <div class="file-preview-thumbnails">\n' +
|
669 |
-
' </div>\n' +
|
670 |
-
' <div class="clearfix"></div>' +
|
671 |
-
' <div class="file-preview-status text-center text-success"></div>\n' +
|
672 |
-
' <div class="kv-fileinput-error"></div>\n' +
|
673 |
-
' </div>\n' +
|
674 |
-
'</div>';
|
675 |
-
tClose = $h.closeButton('fileinput-remove');
|
676 |
-
tFileIcon = '<i class="glyphicon glyphicon-file"></i>';
|
677 |
-
// noinspection HtmlUnknownAttribute
|
678 |
-
tCaption = '<div class="file-caption form-control {class}" tabindex="500">\n' +
|
679 |
-
' <span class="file-caption-icon"></span>\n' +
|
680 |
-
' <input class="file-caption-name" onkeydown="return false;" onpaste="return false;">\n' +
|
681 |
-
'</div>';
|
682 |
-
//noinspection HtmlUnknownAttribute
|
683 |
-
tBtnDefault = '<button type="{type}" tabindex="500" title="{title}" class="{css}" ' +
|
684 |
-
'{status}>{icon} {label}</button>';
|
685 |
-
//noinspection HtmlUnknownAttribute
|
686 |
-
tBtnLink = '<a href="{href}" tabindex="500" title="{title}" class="{css}" {status}>{icon} {label}</a>';
|
687 |
-
//noinspection HtmlUnknownAttribute
|
688 |
-
tBtnBrowse = '<div tabindex="500" class="{css}" {status}>{icon} {label}</div>';
|
689 |
-
tModalMain = '<div id="' + $h.MODAL_ID + '" class="file-zoom-dialog modal fade" ' +
|
690 |
-
'tabindex="-1" aria-labelledby="' + $h.MODAL_ID + 'Label"></div>';
|
691 |
-
tModal = '<div class="modal-dialog modal-lg{rtl}" role="document">\n' +
|
692 |
-
' <div class="modal-content">\n' +
|
693 |
-
' <div class="modal-header">\n' +
|
694 |
-
' <h5 class="modal-title">{heading}</h5>\n' +
|
695 |
-
' <span class="kv-zoom-title"></span>\n' +
|
696 |
-
' <div class="kv-zoom-actions">{toggleheader}{fullscreen}{borderless}{close}</div>\n' +
|
697 |
-
' </div>\n' +
|
698 |
-
' <div class="modal-body">\n' +
|
699 |
-
' <div class="floating-buttons"></div>\n' +
|
700 |
-
' <div class="kv-zoom-body file-zoom-content {zoomFrameClass}"></div>\n' + '{prev} {next}\n' +
|
701 |
-
' </div>\n' +
|
702 |
-
' </div>\n' +
|
703 |
-
'</div>\n';
|
704 |
-
tProgress = '<div class="progress">\n' +
|
705 |
-
' <div class="{class}" role="progressbar"' +
|
706 |
-
' aria-valuenow="{percent}" aria-valuemin="0" aria-valuemax="100" style="width:{percent}%;">\n' +
|
707 |
-
' {status}\n' +
|
708 |
-
' </div>\n' +
|
709 |
-
'</div>';
|
710 |
-
tSize = ' <samp>({sizeText})</samp>';
|
711 |
-
tFooter = '<div class="file-thumbnail-footer">\n' +
|
712 |
-
' <div class="file-footer-caption" title="{caption}">\n' +
|
713 |
-
' <div class="file-caption-info">{caption}</div>\n' +
|
714 |
-
' <div class="file-size-info">{size}</div>\n' +
|
715 |
-
' </div>\n' +
|
716 |
-
' {progress}\n{indicator}\n{actions}\n' +
|
717 |
-
'</div>';
|
718 |
-
tActions = '<div class="file-actions">\n' +
|
719 |
-
' <div class="file-footer-buttons">\n' +
|
720 |
-
' {download} {upload} {delete} {zoom} {other}' +
|
721 |
-
' </div>\n' +
|
722 |
-
'</div>\n' +
|
723 |
-
'{drag}\n' +
|
724 |
-
'<div class="clearfix"></div>';
|
725 |
-
//noinspection HtmlUnknownAttribute
|
726 |
-
tActionDelete = '<button type="button" class="kv-file-remove {removeClass}" ' +
|
727 |
-
'title="{removeTitle}" {dataUrl}{dataKey}>{removeIcon}</button>\n';
|
728 |
-
tActionUpload = '<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">' +
|
729 |
-
'{uploadIcon}</button>';
|
730 |
-
tActionDownload = '<a class="kv-file-download {downloadClass}" title="{downloadTitle}" ' +
|
731 |
-
'href="{downloadUrl}" download="{caption}" target="_blank">{downloadIcon}</a>';
|
732 |
-
tActionZoom = '<button type="button" class="kv-file-zoom {zoomClass}" ' +
|
733 |
-
'title="{zoomTitle}">{zoomIcon}</button>';
|
734 |
-
tActionDrag = '<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>';
|
735 |
-
tIndicator = '<div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>';
|
736 |
-
tTagBef = '<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}"' +
|
737 |
-
' data-template="{template}"';
|
738 |
-
tTagBef1 = tTagBef + '><div class="kv-file-content">\n';
|
739 |
-
tTagBef2 = tTagBef + ' title="{caption}"><div class="kv-file-content">\n';
|
740 |
-
tTagAft = '</div>{footer}\n</div>\n';
|
741 |
-
tGeneric = '{content}\n';
|
742 |
-
tStyle = ' {style}';
|
743 |
-
tHtml = '<div class="kv-preview-data file-preview-html" title="{caption}"' + tStyle + '>{data}</div>\n';
|
744 |
-
tImage = '<img src="{data}" class="file-preview-image kv-preview-data" title="{caption}" ' +
|
745 |
-
'alt="{caption}"' + tStyle + '>\n';
|
746 |
-
tText = '<textarea class="kv-preview-data file-preview-text" title="{caption}" readonly' + tStyle + '>' +
|
747 |
-
'{data}</textarea>\n';
|
748 |
-
tOffice = '<iframe class="kv-preview-data file-preview-office" ' +
|
749 |
-
'src="https://view.officeapps.live.com/op/embed.aspx?src={data}"' + tStyle + '></iframe>';
|
750 |
-
tGdocs = '<iframe class="kv-preview-data file-preview-gdocs" ' +
|
751 |
-
'src="https://docs.google.com/gview?url={data}&embedded=true"' + tStyle + '></iframe>';
|
752 |
-
tVideo = '<video class="kv-preview-data file-preview-video" controls' + tStyle + '>\n' +
|
753 |
-
'<source src="{data}" type="{type}">\n' + $h.DEFAULT_PREVIEW + '\n</video>\n';
|
754 |
-
tAudio = '<!--suppress ALL --><audio class="kv-preview-data file-preview-audio" controls' + tStyle + '>\n<source src="{data}" ' +
|
755 |
-
'type="{type}">\n' + $h.DEFAULT_PREVIEW + '\n</audio>\n';
|
756 |
-
tFlash = '<embed class="kv-preview-data file-preview-flash" src="{data}" type="application/x-shockwave-flash"' + tStyle + '>\n';
|
757 |
-
tPdf = '<embed class="kv-preview-data file-preview-pdf" src="{data}" type="application/pdf"' + tStyle + '>\n';
|
758 |
-
tObject = '<object class="kv-preview-data file-preview-object file-object {typeCss}" ' +
|
759 |
-
'data="{data}" type="{type}"' + tStyle + '>\n' + '<param name="movie" value="{caption}" />\n' +
|
760 |
-
$h.OBJECT_PARAMS + ' ' + $h.DEFAULT_PREVIEW + '\n</object>\n';
|
761 |
-
tOther = '<div class="kv-preview-data file-preview-other-frame"' + tStyle + '>\n' + $h.DEFAULT_PREVIEW + '\n</div>\n';
|
762 |
-
tZoomCache = '<div class="kv-zoom-cache" style="display:none">{zoomContent}</div>';
|
763 |
-
vDefaultDim = {width: "100%", height: "100%", 'min-height': "480px"};
|
764 |
-
if (self._isPdfRendered()) {
|
765 |
-
tPdf = self.pdfRendererTemplate.replace('{renderer}', self.pdfRendererUrl);
|
766 |
-
}
|
767 |
-
self.defaults = {
|
768 |
-
layoutTemplates: {
|
769 |
-
main1: tMain1,
|
770 |
-
main2: tMain2,
|
771 |
-
preview: tPreview,
|
772 |
-
close: tClose,
|
773 |
-
fileIcon: tFileIcon,
|
774 |
-
caption: tCaption,
|
775 |
-
modalMain: tModalMain,
|
776 |
-
modal: tModal,
|
777 |
-
progress: tProgress,
|
778 |
-
size: tSize,
|
779 |
-
footer: tFooter,
|
780 |
-
indicator: tIndicator,
|
781 |
-
actions: tActions,
|
782 |
-
actionDelete: tActionDelete,
|
783 |
-
actionUpload: tActionUpload,
|
784 |
-
actionDownload: tActionDownload,
|
785 |
-
actionZoom: tActionZoom,
|
786 |
-
actionDrag: tActionDrag,
|
787 |
-
btnDefault: tBtnDefault,
|
788 |
-
btnLink: tBtnLink,
|
789 |
-
btnBrowse: tBtnBrowse,
|
790 |
-
zoomCache: tZoomCache
|
791 |
-
},
|
792 |
-
previewMarkupTags: {
|
793 |
-
tagBefore1: tTagBef1,
|
794 |
-
tagBefore2: tTagBef2,
|
795 |
-
tagAfter: tTagAft
|
796 |
-
},
|
797 |
-
previewContentTemplates: {
|
798 |
-
generic: tGeneric,
|
799 |
-
html: tHtml,
|
800 |
-
image: tImage,
|
801 |
-
text: tText,
|
802 |
-
office: tOffice,
|
803 |
-
gdocs: tGdocs,
|
804 |
-
video: tVideo,
|
805 |
-
audio: tAudio,
|
806 |
-
flash: tFlash,
|
807 |
-
object: tObject,
|
808 |
-
pdf: tPdf,
|
809 |
-
other: tOther
|
810 |
-
},
|
811 |
-
allowedPreviewTypes: ['image', 'html', 'text', 'video', 'audio', 'flash', 'pdf', 'object'],
|
812 |
-
previewTemplates: {},
|
813 |
-
previewSettings: {
|
814 |
-
image: {width: "auto", height: "auto", 'max-width': "100%", 'max-height': "100%"},
|
815 |
-
html: {width: "213px", height: "160px"},
|
816 |
-
text: {width: "213px", height: "160px"},
|
817 |
-
office: {width: "213px", height: "160px"},
|
818 |
-
gdocs: {width: "213px", height: "160px"},
|
819 |
-
video: {width: "213px", height: "160px"},
|
820 |
-
audio: {width: "100%", height: "30px"},
|
821 |
-
flash: {width: "213px", height: "160px"},
|
822 |
-
object: {width: "213px", height: "160px"},
|
823 |
-
pdf: {width: "100%", height: "160px"},
|
824 |
-
other: {width: "213px", height: "160px"}
|
825 |
-
},
|
826 |
-
previewSettingsSmall: {
|
827 |
-
image: {width: "auto", height: "auto", 'max-width': "100%", 'max-height': "100%"},
|
828 |
-
html: {width: "100%", height: "160px"},
|
829 |
-
text: {width: "100%", height: "160px"},
|
830 |
-
office: {width: "100%", height: "160px"},
|
831 |
-
gdocs: {width: "100%", height: "160px"},
|
832 |
-
video: {width: "100%", height: "auto"},
|
833 |
-
audio: {width: "100%", height: "30px"},
|
834 |
-
flash: {width: "100%", height: "auto"},
|
835 |
-
object: {width: "100%", height: "auto"},
|
836 |
-
pdf: {width: "100%", height: "160px"},
|
837 |
-
other: {width: "100%", height: "160px"}
|
838 |
-
},
|
839 |
-
previewZoomSettings: {
|
840 |
-
image: {width: "auto", height: "auto", 'max-width': "100%", 'max-height': "100%"},
|
841 |
-
html: vDefaultDim,
|
842 |
-
text: vDefaultDim,
|
843 |
-
office: {width: "100%", height: "100%", 'max-width': "100%", 'min-height': "480px"},
|
844 |
-
gdocs: {width: "100%", height: "100%", 'max-width': "100%", 'min-height': "480px"},
|
845 |
-
video: {width: "auto", height: "100%", 'max-width': "100%"},
|
846 |
-
audio: {width: "100%", height: "30px"},
|
847 |
-
flash: {width: "auto", height: "480px"},
|
848 |
-
object: {width: "auto", height: "100%", 'max-width': "100%", 'min-height': "480px"},
|
849 |
-
pdf: vDefaultDim,
|
850 |
-
other: {width: "auto", height: "100%", 'min-height': "480px"}
|
851 |
-
},
|
852 |
-
fileTypeSettings: {
|
853 |
-
image: function (vType, vName) {
|
854 |
-
return ($h.compare(vType, 'image.*') && !$h.compare(vType, /(tiff?|wmf)$/i) ||
|
855 |
-
$h.compare(vName, /\.(gif|png|jpe?g)$/i));
|
856 |
-
},
|
857 |
-
html: function (vType, vName) {
|
858 |
-
return $h.compare(vType, 'text/html') || $h.compare(vName, /\.(htm|html)$/i);
|
859 |
-
},
|
860 |
-
office: function (vType, vName) {
|
861 |
-
return $h.compare(vType, /(word|excel|powerpoint|office)$/i) ||
|
862 |
-
$h.compare(vName, /\.(docx?|xlsx?|pptx?|pps|potx?)$/i);
|
863 |
-
},
|
864 |
-
gdocs: function (vType, vName) {
|
865 |
-
return $h.compare(vType, /(word|excel|powerpoint|office|iwork-pages|tiff?)$/i) ||
|
866 |
-
$h.compare(vName, /\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i);
|
867 |
-
},
|
868 |
-
text: function (vType, vName) {
|
869 |
-
return $h.compare(vType, 'text.*') || $h.compare(vName, /\.(xml|javascript)$/i) ||
|
870 |
-
$h.compare(vName, /\.(txt|md|csv|nfo|ini|json|php|js|css)$/i);
|
871 |
-
},
|
872 |
-
video: function (vType, vName) {
|
873 |
-
return $h.compare(vType, 'video.*') && ($h.compare(vType, /(ogg|mp4|mp?g|mov|webm|3gp)$/i) ||
|
874 |
-
$h.compare(vName, /\.(og?|mp4|webm|mp?g|mov|3gp)$/i));
|
875 |
-
},
|
876 |
-
audio: function (vType, vName) {
|
877 |
-
return $h.compare(vType, 'audio.*') && ($h.compare(vName, /(ogg|mp3|mp?g|wav)$/i) ||
|
878 |
-
$h.compare(vName, /\.(og?|mp3|mp?g|wav)$/i));
|
879 |
-
},
|
880 |
-
flash: function (vType, vName) {
|
881 |
-
return $h.compare(vType, 'application/x-shockwave-flash', true) || $h.compare(vName, /\.(swf)$/i);
|
882 |
-
},
|
883 |
-
pdf: function (vType, vName) {
|
884 |
-
return $h.compare(vType, 'application/pdf', true) || $h.compare(vName, /\.(pdf)$/i);
|
885 |
-
},
|
886 |
-
object: function () {
|
887 |
-
return true;
|
888 |
-
},
|
889 |
-
other: function () {
|
890 |
-
return true;
|
891 |
-
}
|
892 |
-
},
|
893 |
-
fileActionSettings: {
|
894 |
-
showRemove: true,
|
895 |
-
showUpload: true,
|
896 |
-
showDownload: true,
|
897 |
-
showZoom: true,
|
898 |
-
showDrag: true,
|
899 |
-
removeIcon: '<i class="glyphicon glyphicon-trash"></i>',
|
900 |
-
removeClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary',
|
901 |
-
removeErrorClass: 'btn btn-sm btn-kv btn-danger',
|
902 |
-
removeTitle: 'Remove file',
|
903 |
-
uploadIcon: '<i class="glyphicon glyphicon-upload"></i>',
|
904 |
-
uploadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary',
|
905 |
-
uploadTitle: 'Upload file',
|
906 |
-
uploadRetryIcon: '<i class="glyphicon glyphicon-repeat"></i>',
|
907 |
-
uploadRetryTitle: 'Retry upload',
|
908 |
-
downloadIcon: '<i class="glyphicon glyphicon-download"></i>',
|
909 |
-
downloadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary',
|
910 |
-
downloadTitle: 'Download file',
|
911 |
-
zoomIcon: '<i class="glyphicon glyphicon-zoom-in"></i>',
|
912 |
-
zoomClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary',
|
913 |
-
zoomTitle: 'View Details',
|
914 |
-
dragIcon: '<i class="glyphicon glyphicon-move"></i>',
|
915 |
-
dragClass: 'text-info',
|
916 |
-
dragTitle: 'Move / Rearrange',
|
917 |
-
dragSettings: {},
|
918 |
-
indicatorNew: '<i class="glyphicon glyphicon-plus-sign text-warning"></i>',
|
919 |
-
indicatorSuccess: '<i class="glyphicon glyphicon-ok-sign text-success"></i>',
|
920 |
-
indicatorError: '<i class="glyphicon glyphicon-exclamation-sign text-danger"></i>',
|
921 |
-
indicatorLoading: '<i class="glyphicon glyphicon-hourglass text-muted"></i>',
|
922 |
-
indicatorNewTitle: 'Not uploaded yet',
|
923 |
-
indicatorSuccessTitle: 'Uploaded',
|
924 |
-
indicatorErrorTitle: 'Upload Error',
|
925 |
-
indicatorLoadingTitle: 'Uploading ...'
|
926 |
-
}
|
927 |
-
};
|
928 |
-
$.each(self.defaults, function (key, setting) {
|
929 |
-
if (key === 'allowedPreviewTypes') {
|
930 |
-
if (self.allowedPreviewTypes === undefined) {
|
931 |
-
self.allowedPreviewTypes = setting;
|
932 |
-
}
|
933 |
-
return;
|
934 |
-
}
|
935 |
-
self[key] = $.extend(true, {}, setting, self[key]);
|
936 |
-
});
|
937 |
-
self._initPreviewTemplates();
|
938 |
-
},
|
939 |
-
_initPreviewTemplates: function () {
|
940 |
-
var self = this, tags = self.previewMarkupTags, tagBef, tagAft = tags.tagAfter;
|
941 |
-
$.each(self.previewContentTemplates, function (key, value) {
|
942 |
-
if ($h.isEmpty(self.previewTemplates[key])) {
|
943 |
-
tagBef = tags.tagBefore2;
|
944 |
-
if (key === 'generic' || key === 'image' || key === 'html' || key === 'text') {
|
945 |
-
tagBef = tags.tagBefore1;
|
946 |
-
}
|
947 |
-
if (self._isPdfRendered() && key === 'pdf') {
|
948 |
-
tagBef = tagBef.replace('kv-file-content', 'kv-file-content kv-pdf-rendered');
|
949 |
-
}
|
950 |
-
self.previewTemplates[key] = tagBef + value + tagAft;
|
951 |
-
}
|
952 |
-
});
|
953 |
-
},
|
954 |
-
_initPreviewCache: function () {
|
955 |
-
var self = this;
|
956 |
-
self.previewCache = {
|
957 |
-
data: {},
|
958 |
-
init: function () {
|
959 |
-
var content = self.initialPreview;
|
960 |
-
if (content.length > 0 && !$h.isArray(content)) {
|
961 |
-
content = content.split(self.initialPreviewDelimiter);
|
962 |
-
}
|
963 |
-
self.previewCache.data = {
|
964 |
-
content: content,
|
965 |
-
config: self.initialPreviewConfig,
|
966 |
-
tags: self.initialPreviewThumbTags
|
967 |
-
};
|
968 |
-
},
|
969 |
-
count: function () {
|
970 |
-
return !!self.previewCache.data && !!self.previewCache.data.content ?
|
971 |
-
self.previewCache.data.content.length : 0;
|
972 |
-
},
|
973 |
-
get: function (i, isDisabled) {
|
974 |
-
var ind = 'init_' + i, data = self.previewCache.data, config = data.config[i],
|
975 |
-
content = data.content[i], previewId = self.previewInitId + '-' + ind, out, $tmp, cat, ftr,
|
976 |
-
fname, ftype, frameClass, asData = $h.ifSet('previewAsData', config, self.initialPreviewAsData),
|
977 |
-
parseTemplate = function (cat, dat, fn, ft, id, ftr, ind, fc, t) {
|
978 |
-
fc = ' file-preview-initial ' + $h.SORT_CSS + (fc ? ' ' + fc : '');
|
979 |
-
return self._generatePreviewTemplate(cat, dat, fn, ft, id, false, null, fc, ftr, ind, t);
|
980 |
-
};
|
981 |
-
if (!content) {
|
982 |
-
return '';
|
983 |
-
}
|
984 |
-
isDisabled = isDisabled === undefined ? true : isDisabled;
|
985 |
-
cat = $h.ifSet('type', config, self.initialPreviewFileType || 'generic');
|
986 |
-
fname = $h.ifSet('filename', config, $h.ifSet('caption', config));
|
987 |
-
ftype = $h.ifSet('filetype', config, cat);
|
988 |
-
ftr = self.previewCache.footer(i, isDisabled, (config && config.size || null));
|
989 |
-
frameClass = $h.ifSet('frameClass', config);
|
990 |
-
if (asData) {
|
991 |
-
out = parseTemplate(cat, content, fname, ftype, previewId, ftr, ind, frameClass);
|
992 |
-
} else {
|
993 |
-
out = parseTemplate('generic', content, fname, ftype, previewId, ftr, ind, frameClass, cat)
|
994 |
-
.setTokens({'content': data.content[i]});
|
995 |
-
}
|
996 |
-
if (data.tags.length && data.tags[i]) {
|
997 |
-
out = $h.replaceTags(out, data.tags[i]);
|
998 |
-
}
|
999 |
-
/** @namespace config.frameAttr */
|
1000 |
-
if (!$h.isEmpty(config) && !$h.isEmpty(config.frameAttr)) {
|
1001 |
-
$tmp = $(document.createElement('div')).html(out);
|
1002 |
-
$tmp.find('.file-preview-initial').attr(config.frameAttr);
|
1003 |
-
out = $tmp.html();
|
1004 |
-
$tmp.remove();
|
1005 |
-
}
|
1006 |
-
return out;
|
1007 |
-
},
|
1008 |
-
add: function (content, config, tags, append) {
|
1009 |
-
var data = self.previewCache.data, index;
|
1010 |
-
if (!$h.isArray(content)) {
|
1011 |
-
content = content.split(self.initialPreviewDelimiter);
|
1012 |
-
}
|
1013 |
-
if (append) {
|
1014 |
-
index = data.content.push(content) - 1;
|
1015 |
-
data.config[index] = config;
|
1016 |
-
data.tags[index] = tags;
|
1017 |
-
} else {
|
1018 |
-
index = content.length - 1;
|
1019 |
-
data.content = content;
|
1020 |
-
data.config = config;
|
1021 |
-
data.tags = tags;
|
1022 |
-
}
|
1023 |
-
self.previewCache.data = data;
|
1024 |
-
return index;
|
1025 |
-
},
|
1026 |
-
set: function (content, config, tags, append) {
|
1027 |
-
var data = self.previewCache.data, i, chk;
|
1028 |
-
if (!content || !content.length) {
|
1029 |
-
return;
|
1030 |
-
}
|
1031 |
-
if (!$h.isArray(content)) {
|
1032 |
-
content = content.split(self.initialPreviewDelimiter);
|
1033 |
-
}
|
1034 |
-
chk = content.filter(function (n) {
|
1035 |
-
return n !== null;
|
1036 |
-
});
|
1037 |
-
if (!chk.length) {
|
1038 |
-
return;
|
1039 |
-
}
|
1040 |
-
if (data.content === undefined) {
|
1041 |
-
data.content = [];
|
1042 |
-
}
|
1043 |
-
if (data.config === undefined) {
|
1044 |
-
data.config = [];
|
1045 |
-
}
|
1046 |
-
if (data.tags === undefined) {
|
1047 |
-
data.tags = [];
|
1048 |
-
}
|
1049 |
-
if (append) {
|
1050 |
-
for (i = 0; i < content.length; i++) {
|
1051 |
-
if (content[i]) {
|
1052 |
-
data.content.push(content[i]);
|
1053 |
-
}
|
1054 |
-
}
|
1055 |
-
for (i = 0; i < config.length; i++) {
|
1056 |
-
if (config[i]) {
|
1057 |
-
data.config.push(config[i]);
|
1058 |
-
}
|
1059 |
-
}
|
1060 |
-
for (i = 0; i < tags.length; i++) {
|
1061 |
-
if (tags[i]) {
|
1062 |
-
data.tags.push(tags[i]);
|
1063 |
-
}
|
1064 |
-
}
|
1065 |
-
} else {
|
1066 |
-
data.content = content;
|
1067 |
-
data.config = config;
|
1068 |
-
data.tags = tags;
|
1069 |
-
}
|
1070 |
-
self.previewCache.data = data;
|
1071 |
-
},
|
1072 |
-
unset: function (index) {
|
1073 |
-
var chk = self.previewCache.count(), rev = self.reversePreviewOrder;
|
1074 |
-
if (!chk) {
|
1075 |
-
return;
|
1076 |
-
}
|
1077 |
-
if (chk === 1) {
|
1078 |
-
self.previewCache.data.content = [];
|
1079 |
-
self.previewCache.data.config = [];
|
1080 |
-
self.previewCache.data.tags = [];
|
1081 |
-
self.initialPreview = [];
|
1082 |
-
self.initialPreviewConfig = [];
|
1083 |
-
self.initialPreviewThumbTags = [];
|
1084 |
-
return;
|
1085 |
-
}
|
1086 |
-
self.previewCache.data.content = $h.spliceArray(self.previewCache.data.content, index, rev);
|
1087 |
-
self.previewCache.data.config = $h.spliceArray(self.previewCache.data.config, index, rev);
|
1088 |
-
self.previewCache.data.tags = $h.spliceArray(self.previewCache.data.tags, index, rev);
|
1089 |
-
},
|
1090 |
-
out: function () {
|
1091 |
-
var html = '', caption, len = self.previewCache.count(), i, content;
|
1092 |
-
if (len === 0) {
|
1093 |
-
return {content: '', caption: ''};
|
1094 |
-
}
|
1095 |
-
for (i = 0; i < len; i++) {
|
1096 |
-
content = self.previewCache.get(i);
|
1097 |
-
html = self.reversePreviewOrder ? (content + html) : (html + content);
|
1098 |
-
}
|
1099 |
-
caption = self._getMsgSelected(len);
|
1100 |
-
return {content: html, caption: caption};
|
1101 |
-
},
|
1102 |
-
footer: function (i, isDisabled, size) {
|
1103 |
-
var data = self.previewCache.data || {};
|
1104 |
-
if ($h.isEmpty(data.content)) {
|
1105 |
-
return '';
|
1106 |
-
}
|
1107 |
-
if ($h.isEmpty(data.config) || $h.isEmpty(data.config[i])) {
|
1108 |
-
data.config[i] = {};
|
1109 |
-
}
|
1110 |
-
isDisabled = isDisabled === undefined ? true : isDisabled;
|
1111 |
-
var config = data.config[i], caption = $h.ifSet('caption', config), a,
|
1112 |
-
width = $h.ifSet('width', config, 'auto'), url = $h.ifSet('url', config, false),
|
1113 |
-
key = $h.ifSet('key', config, null), fs = self.fileActionSettings,
|
1114 |
-
initPreviewShowDel = self.initialPreviewShowDelete || false,
|
1115 |
-
dUrl = config.downloadUrl || self.initialPreviewDownloadUrl || '',
|
1116 |
-
dFil = config.filename || config.caption || '',
|
1117 |
-
initPreviewShowDwl = !!(dUrl),
|
1118 |
-
sDel = $h.ifSet('showRemove', config, $h.ifSet('showRemove', fs, initPreviewShowDel)),
|
1119 |
-
sDwl = $h.ifSet('showDownload', config, $h.ifSet('showDownload', fs, initPreviewShowDwl)),
|
1120 |
-
sZm = $h.ifSet('showZoom', config, $h.ifSet('showZoom', fs, true)),
|
1121 |
-
sDrg = $h.ifSet('showDrag', config, $h.ifSet('showDrag', fs, true)),
|
1122 |
-
dis = (url === false) && isDisabled;
|
1123 |
-
sDwl = sDwl && config.downloadUrl !== false && !!dUrl;
|
1124 |
-
a = self._renderFileActions(false, sDwl, sDel, sZm, sDrg, dis, url, key, true, dUrl, dFil);
|
1125 |
-
return self._getLayoutTemplate('footer').setTokens({
|
1126 |
-
'progress': self._renderThumbProgress(),
|
1127 |
-
'actions': a,
|
1128 |
-
'caption': caption,
|
1129 |
-
'size': self._getSize(size),
|
1130 |
-
'width': width,
|
1131 |
-
'indicator': ''
|
1132 |
-
});
|
1133 |
-
}
|
1134 |
-
};
|
1135 |
-
self.previewCache.init();
|
1136 |
-
},
|
1137 |
-
_isPdfRendered: function () {
|
1138 |
-
var self = this, useLib = self.usePdfRenderer,
|
1139 |
-
flag = typeof useLib === "function" ? useLib() : !!useLib;
|
1140 |
-
return flag && self.pdfRendererUrl;
|
1141 |
-
},
|
1142 |
-
_handler: function ($el, event, callback) {
|
1143 |
-
var self = this, ns = self.namespace, ev = event.split(' ').join(ns + ' ') + ns;
|
1144 |
-
if (!$el || !$el.length) {
|
1145 |
-
return;
|
1146 |
-
}
|
1147 |
-
$el.off(ev).on(ev, callback);
|
1148 |
-
},
|
1149 |
-
_log: function (msg) {
|
1150 |
-
var self = this, id = self.$element.attr('id');
|
1151 |
-
if (id) {
|
1152 |
-
msg = '"' + id + '": ' + msg;
|
1153 |
-
}
|
1154 |
-
msg = 'bootstrap-fileinput: ' + msg;
|
1155 |
-
if (typeof window.console.log !== "undefined") {
|
1156 |
-
window.console.log(msg);
|
1157 |
-
} else {
|
1158 |
-
window.alert(msg);
|
1159 |
-
}
|
1160 |
-
},
|
1161 |
-
_validate: function () {
|
1162 |
-
var self = this, status = self.$element.attr('type') === 'file';
|
1163 |
-
if (!status) {
|
1164 |
-
self._log('The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.');
|
1165 |
-
}
|
1166 |
-
return status;
|
1167 |
-
},
|
1168 |
-
_errorsExist: function () {
|
1169 |
-
var self = this, $err, $errList = self.$errorContainer.find('li');
|
1170 |
-
if ($errList.length) {
|
1171 |
-
return true;
|
1172 |
-
}
|
1173 |
-
$err = $(document.createElement('div')).html(self.$errorContainer.html());
|
1174 |
-
$err.find('.kv-error-close').remove();
|
1175 |
-
$err.find('ul').remove();
|
1176 |
-
return !!$.trim($err.text()).length;
|
1177 |
-
},
|
1178 |
-
_errorHandler: function (evt, caption) {
|
1179 |
-
var self = this, err = evt.target.error, showError = function (msg) {
|
1180 |
-
self._showError(msg.replace('{name}', caption));
|
1181 |
-
};
|
1182 |
-
/** @namespace err.NOT_FOUND_ERR */
|
1183 |
-
/** @namespace err.SECURITY_ERR */
|
1184 |
-
/** @namespace err.NOT_READABLE_ERR */
|
1185 |
-
if (err.code === err.NOT_FOUND_ERR) {
|
1186 |
-
showError(self.msgFileNotFound);
|
1187 |
-
} else if (err.code === err.SECURITY_ERR) {
|
1188 |
-
showError(self.msgFileSecured);
|
1189 |
-
} else if (err.code === err.NOT_READABLE_ERR) {
|
1190 |
-
showError(self.msgFileNotReadable);
|
1191 |
-
} else if (err.code === err.ABORT_ERR) {
|
1192 |
-
showError(self.msgFilePreviewAborted);
|
1193 |
-
} else {
|
1194 |
-
showError(self.msgFilePreviewError);
|
1195 |
-
}
|
1196 |
-
},
|
1197 |
-
_addError: function (msg) {
|
1198 |
-
var self = this, $error = self.$errorContainer;
|
1199 |
-
if (msg && $error.length) {
|
1200 |
-
$error.html(self.errorCloseButton + msg);
|
1201 |
-
self._handler($error.find('.kv-error-close'), 'click', function () {
|
1202 |
-
setTimeout(function () {
|
1203 |
-
if (self.showPreview && !self.getFrames().length) {
|
1204 |
-
self.clear();
|
1205 |
-
}
|
1206 |
-
$error.fadeOut('slow');
|
1207 |
-
}, 10);
|
1208 |
-
});
|
1209 |
-
}
|
1210 |
-
},
|
1211 |
-
_setValidationError: function (css) {
|
1212 |
-
var self = this;
|
1213 |
-
css = (css ? css + ' ' : '') + 'has-error';
|
1214 |
-
self.$container.removeClass(css).addClass('has-error');
|
1215 |
-
$h.addCss(self.$captionContainer, 'is-invalid');
|
1216 |
-
},
|
1217 |
-
_resetErrors: function (fade) {
|
1218 |
-
var self = this, $error = self.$errorContainer;
|
1219 |
-
self.isError = false;
|
1220 |
-
self.$container.removeClass('has-error');
|
1221 |
-
self.$captionContainer.removeClass('is-invalid');
|
1222 |
-
$error.html('');
|
1223 |
-
if (fade) {
|
1224 |
-
$error.fadeOut('slow');
|
1225 |
-
} else {
|
1226 |
-
$error.hide();
|
1227 |
-
}
|
1228 |
-
},
|
1229 |
-
_showFolderError: function (folders) {
|
1230 |
-
var self = this, $error = self.$errorContainer, msg;
|
1231 |
-
if (!folders) {
|
1232 |
-
return;
|
1233 |
-
}
|
1234 |
-
if (!self.isAjaxUpload) {
|
1235 |
-
self._clearFileInput();
|
1236 |
-
}
|
1237 |
-
msg = self.msgFoldersNotAllowed.replace('{n}', folders);
|
1238 |
-
self._addError(msg);
|
1239 |
-
self._setValidationError();
|
1240 |
-
$error.fadeIn(800);
|
1241 |
-
self._raise('filefoldererror', [folders, msg]);
|
1242 |
-
},
|
1243 |
-
_showUploadError: function (msg, params, event) {
|
1244 |
-
var self = this, $error = self.$errorContainer, ev = event || 'fileuploaderror', e = params && params.id ?
|
1245 |
-
'<li data-file-id="' + params.id + '">' + msg + '</li>' : '<li>' + msg + '</li>';
|
1246 |
-
if ($error.find('ul').length === 0) {
|
1247 |
-
self._addError('<ul>' + e + '</ul>');
|
1248 |
-
} else {
|
1249 |
-
$error.find('ul').append(e);
|
1250 |
-
}
|
1251 |
-
$error.fadeIn(800);
|
1252 |
-
self._raise(ev, [params, msg]);
|
1253 |
-
self._setValidationError('file-input-new');
|
1254 |
-
return true;
|
1255 |
-
},
|
1256 |
-
_showError: function (msg, params, event) {
|
1257 |
-
var self = this, $error = self.$errorContainer, ev = event || 'fileerror';
|
1258 |
-
params = params || {};
|
1259 |
-
params.reader = self.reader;
|
1260 |
-
self._addError(msg);
|
1261 |
-
$error.fadeIn(800);
|
1262 |
-
self._raise(ev, [params, msg]);
|
1263 |
-
if (!self.isAjaxUpload) {
|
1264 |
-
self._clearFileInput();
|
1265 |
-
}
|
1266 |
-
self._setValidationError('file-input-new');
|
1267 |
-
self.$btnUpload.attr('disabled', true);
|
1268 |
-
return true;
|
1269 |
-
},
|
1270 |
-
_noFilesError: function (params) {
|
1271 |
-
var self = this, label = self.minFileCount > 1 ? self.filePlural : self.fileSingle,
|
1272 |
-
msg = self.msgFilesTooLess.replace('{n}', self.minFileCount).replace('{files}', label),
|
1273 |
-
$error = self.$errorContainer;
|
1274 |
-
self._addError(msg);
|
1275 |
-
self.isError = true;
|
1276 |
-
self._updateFileDetails(0);
|
1277 |
-
$error.fadeIn(800);
|
1278 |
-
self._raise('fileerror', [params, msg]);
|
1279 |
-
self._clearFileInput();
|
1280 |
-
self._setValidationError();
|
1281 |
-
},
|
1282 |
-
_parseError: function (operation, jqXHR, errorThrown, fileName) {
|
1283 |
-
/** @namespace jqXHR.responseJSON */
|
1284 |
-
var self = this, errMsg = $.trim(errorThrown + ''), textPre,
|
1285 |
-
text = jqXHR.responseJSON !== undefined && jqXHR.responseJSON.error !== undefined ?
|
1286 |
-
jqXHR.responseJSON.error : jqXHR.responseText;
|
1287 |
-
if (self.cancelling && self.msgUploadAborted) {
|
1288 |
-
errMsg = self.msgUploadAborted;
|
1289 |
-
}
|
1290 |
-
if (self.showAjaxErrorDetails && text) {
|
1291 |
-
text = $.trim(text.replace(/\n\s*\n/g, '\n'));
|
1292 |
-
textPre = text.length ? '<pre>' + text + '</pre>' : '';
|
1293 |
-
errMsg += errMsg ? textPre : text;
|
1294 |
-
}
|
1295 |
-
if (!errMsg) {
|
1296 |
-
errMsg = self.msgAjaxError.replace('{operation}', operation);
|
1297 |
-
}
|
1298 |
-
self.cancelling = false;
|
1299 |
-
return fileName ? '<b>' + fileName + ': </b>' + errMsg : errMsg;
|
1300 |
-
},
|
1301 |
-
_parseFileType: function (type, name) {
|
1302 |
-
var self = this, isValid, vType, cat, i, types = self.allowedPreviewTypes || [];
|
1303 |
-
if (type === 'application/text-plain') {
|
1304 |
-
return 'text';
|
1305 |
-
}
|
1306 |
-
for (i = 0; i < types.length; i++) {
|
1307 |
-
cat = types[i];
|
1308 |
-
isValid = self.fileTypeSettings[cat];
|
1309 |
-
vType = isValid(type, name) ? cat : '';
|
1310 |
-
if (!$h.isEmpty(vType)) {
|
1311 |
-
return vType;
|
1312 |
-
}
|
1313 |
-
}
|
1314 |
-
return 'other';
|
1315 |
-
},
|
1316 |
-
_getPreviewIcon: function (fname) {
|
1317 |
-
var self = this, ext, out = null;
|
1318 |
-
if (fname && fname.indexOf('.') > -1) {
|
1319 |
-
ext = fname.split('.').pop();
|
1320 |
-
if (self.previewFileIconSettings) {
|
1321 |
-
out = self.previewFileIconSettings[ext] || self.previewFileIconSettings[ext.toLowerCase()] || null;
|
1322 |
-
}
|
1323 |
-
if (self.previewFileExtSettings) {
|
1324 |
-
$.each(self.previewFileExtSettings, function (key, func) {
|
1325 |
-
if (self.previewFileIconSettings[key] && func(ext)) {
|
1326 |
-
out = self.previewFileIconSettings[key];
|
1327 |
-
//noinspection UnnecessaryReturnStatementJS
|
1328 |
-
return;
|
1329 |
-
}
|
1330 |
-
});
|
1331 |
-
}
|
1332 |
-
}
|
1333 |
-
return out;
|
1334 |
-
},
|
1335 |
-
_parseFilePreviewIcon: function (content, fname) {
|
1336 |
-
var self = this, icn = self._getPreviewIcon(fname) || self.previewFileIcon, out = content;
|
1337 |
-
if (out.indexOf('{previewFileIcon}') > -1) {
|
1338 |
-
out = out.setTokens({'previewFileIconClass': self.previewFileIconClass, 'previewFileIcon': icn});
|
1339 |
-
}
|
1340 |
-
return out;
|
1341 |
-
},
|
1342 |
-
_raise: function (event, params) {
|
1343 |
-
var self = this, e = $.Event(event);
|
1344 |
-
if (params !== undefined) {
|
1345 |
-
self.$element.trigger(e, params);
|
1346 |
-
} else {
|
1347 |
-
self.$element.trigger(e);
|
1348 |
-
}
|
1349 |
-
if (e.isDefaultPrevented() || e.result === false) {
|
1350 |
-
return false;
|
1351 |
-
}
|
1352 |
-
switch (event) {
|
1353 |
-
// ignore these events
|
1354 |
-
case 'filebatchuploadcomplete':
|
1355 |
-
case 'filebatchuploadsuccess':
|
1356 |
-
case 'fileuploaded':
|
1357 |
-
case 'fileclear':
|
1358 |
-
case 'filecleared':
|
1359 |
-
case 'filereset':
|
1360 |
-
case 'fileerror':
|
1361 |
-
case 'filefoldererror':
|
1362 |
-
case 'fileuploaderror':
|
1363 |
-
case 'filebatchuploaderror':
|
1364 |
-
case 'filedeleteerror':
|
1365 |
-
case 'filecustomerror':
|
1366 |
-
case 'filesuccessremove':
|
1367 |
-
break;
|
1368 |
-
// receive data response via `filecustomerror` event`
|
1369 |
-
default:
|
1370 |
-
if (!self.ajaxAborted) {
|
1371 |
-
self.ajaxAborted = e.result;
|
1372 |
-
}
|
1373 |
-
break;
|
1374 |
-
}
|
1375 |
-
return true;
|
1376 |
-
},
|
1377 |
-
_listenFullScreen: function (isFullScreen) {
|
1378 |
-
var self = this, $modal = self.$modal, $btnFull, $btnBord;
|
1379 |
-
if (!$modal || !$modal.length) {
|
1380 |
-
return;
|
1381 |
-
}
|
1382 |
-
$btnFull = $modal && $modal.find('.btn-fullscreen');
|
1383 |
-
$btnBord = $modal && $modal.find('.btn-borderless');
|
1384 |
-
if (!$btnFull.length || !$btnBord.length) {
|
1385 |
-
return;
|
1386 |
-
}
|
1387 |
-
$btnFull.removeClass('active').attr('aria-pressed', 'false');
|
1388 |
-
$btnBord.removeClass('active').attr('aria-pressed', 'false');
|
1389 |
-
if (isFullScreen) {
|
1390 |
-
$btnFull.addClass('active').attr('aria-pressed', 'true');
|
1391 |
-
} else {
|
1392 |
-
$btnBord.addClass('active').attr('aria-pressed', 'true');
|
1393 |
-
}
|
1394 |
-
if ($modal.hasClass('file-zoom-fullscreen')) {
|
1395 |
-
self._maximizeZoomDialog();
|
1396 |
-
} else {
|
1397 |
-
if (isFullScreen) {
|
1398 |
-
self._maximizeZoomDialog();
|
1399 |
-
} else {
|
1400 |
-
$btnBord.removeClass('active').attr('aria-pressed', 'false');
|
1401 |
-
}
|
1402 |
-
}
|
1403 |
-
},
|
1404 |
-
_listen: function () {
|
1405 |
-
var self = this, $el = self.$element, $form = self.$form, $cont = self.$container, fullScreenEvents;
|
1406 |
-
self._handler($el, 'click', function (e) {
|
1407 |
-
if ($el.hasClass('file-no-browse')) {
|
1408 |
-
if ($el.data('zoneClicked')) {
|
1409 |
-
$el.data('zoneClicked', false);
|
1410 |
-
} else {
|
1411 |
-
e.preventDefault();
|
1412 |
-
}
|
1413 |
-
}
|
1414 |
-
});
|
1415 |
-
self._handler($el, 'change', $.proxy(self._change, self));
|
1416 |
-
if (self.showBrowse) {
|
1417 |
-
self._handler(self.$btnFile, 'click', $.proxy(self._browse, self));
|
1418 |
-
}
|
1419 |
-
self._handler($cont.find('.fileinput-remove:not([disabled])'), 'click', $.proxy(self.clear, self));
|
1420 |
-
self._handler($cont.find('.fileinput-cancel'), 'click', $.proxy(self.cancel, self));
|
1421 |
-
self._initDragDrop();
|
1422 |
-
self._handler($form, 'reset', $.proxy(self.clear, self));
|
1423 |
-
if (!self.isAjaxUpload) {
|
1424 |
-
self._handler($form, 'submit', $.proxy(self._submitForm, self));
|
1425 |
-
}
|
1426 |
-
self._handler(self.$container.find('.fileinput-upload'), 'click', $.proxy(self._uploadClick, self));
|
1427 |
-
self._handler($(window), 'resize', function () {
|
1428 |
-
self._listenFullScreen(screen.width === window.innerWidth && screen.height === window.innerHeight);
|
1429 |
-
});
|
1430 |
-
fullScreenEvents = 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange';
|
1431 |
-
self._handler($(document), fullScreenEvents, function () {
|
1432 |
-
self._listenFullScreen($h.checkFullScreen());
|
1433 |
-
});
|
1434 |
-
self._autoFitContent();
|
1435 |
-
self._initClickable();
|
1436 |
-
self._refreshPreview();
|
1437 |
-
},
|
1438 |
-
_autoFitContent: function () {
|
1439 |
-
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
|
1440 |
-
self = this, config = width < 400 ? (self.previewSettingsSmall || self.defaults.previewSettingsSmall) :
|
1441 |
-
(self.previewSettings || self.defaults.previewSettings), sel;
|
1442 |
-
$.each(config, function (cat, settings) {
|
1443 |
-
sel = '.file-preview-frame .file-preview-' + cat;
|
1444 |
-
self.$preview.find(sel + '.kv-preview-data,' + sel + ' .kv-preview-data').css(settings);
|
1445 |
-
});
|
1446 |
-
},
|
1447 |
-
_scanDroppedItems: function (item, files, path) {
|
1448 |
-
path = path || "";
|
1449 |
-
var self = this, i, dirReader, readDir, errorHandler = function (e) {
|
1450 |
-
self._log('Error scanning dropped files!');
|
1451 |
-
self._log(e);
|
1452 |
-
};
|
1453 |
-
if (item.isFile) {
|
1454 |
-
item.file(function (file) {
|
1455 |
-
files.push(file);
|
1456 |
-
}, errorHandler);
|
1457 |
-
} else {
|
1458 |
-
if (item.isDirectory) {
|
1459 |
-
dirReader = item.createReader();
|
1460 |
-
readDir = function () {
|
1461 |
-
dirReader.readEntries(function (entries) {
|
1462 |
-
if (entries && entries.length > 0) {
|
1463 |
-
for (i = 0; i < entries.length; i++) {
|
1464 |
-
self._scanDroppedItems(entries[i], files, path + item.name + "/");
|
1465 |
-
}
|
1466 |
-
// recursively call readDir() again, since browser can only handle first 100 entries.
|
1467 |
-
readDir();
|
1468 |
-
}
|
1469 |
-
return null;
|
1470 |
-
}, errorHandler);
|
1471 |
-
};
|
1472 |
-
readDir();
|
1473 |
-
}
|
1474 |
-
}
|
1475 |
-
|
1476 |
-
},
|
1477 |
-
_initDragDrop: function () {
|
1478 |
-
var self = this, $zone = self.$dropZone;
|
1479 |
-
if (self.dropZoneEnabled && self.showPreview) {
|
1480 |
-
self._handler($zone, 'dragenter dragover', $.proxy(self._zoneDragEnter, self));
|
1481 |
-
self._handler($zone, 'dragleave', $.proxy(self._zoneDragLeave, self));
|
1482 |
-
self._handler($zone, 'drop', $.proxy(self._zoneDrop, self));
|
1483 |
-
self._handler($(document), 'dragenter dragover drop', self._zoneDragDropInit);
|
1484 |
-
}
|
1485 |
-
},
|
1486 |
-
_zoneDragDropInit: function (e) {
|
1487 |
-
e.stopPropagation();
|
1488 |
-
e.preventDefault();
|
1489 |
-
},
|
1490 |
-
_zoneDragEnter: function (e) {
|
1491 |
-
var self = this, hasFiles = $.inArray('Files', e.originalEvent.dataTransfer.types) > -1;
|
1492 |
-
self._zoneDragDropInit(e);
|
1493 |
-
if (self.isDisabled || !hasFiles) {
|
1494 |
-
e.originalEvent.dataTransfer.effectAllowed = 'none';
|
1495 |
-
e.originalEvent.dataTransfer.dropEffect = 'none';
|
1496 |
-
return;
|
1497 |
-
}
|
1498 |
-
$h.addCss(self.$dropZone, 'file-highlighted');
|
1499 |
-
},
|
1500 |
-
_zoneDragLeave: function (e) {
|
1501 |
-
var self = this;
|
1502 |
-
self._zoneDragDropInit(e);
|
1503 |
-
if (self.isDisabled) {
|
1504 |
-
return;
|
1505 |
-
}
|
1506 |
-
self.$dropZone.removeClass('file-highlighted');
|
1507 |
-
},
|
1508 |
-
_zoneDrop: function (e) {
|
1509 |
-
/** @namespace e.originalEvent.dataTransfer */
|
1510 |
-
var self = this, i, $el = self.$element, dataTransfer = e.originalEvent.dataTransfer,
|
1511 |
-
files = dataTransfer.files, items = dataTransfer.items, folders = $h.getDragDropFolders(items),
|
1512 |
-
processFiles = function () {
|
1513 |
-
if (!self.isAjaxUpload) {
|
1514 |
-
self.changeTriggered = true;
|
1515 |
-
$el.get(0).files = files;
|
1516 |
-
setTimeout(function () {
|
1517 |
-
self.changeTriggered = false;
|
1518 |
-
$el.trigger('change' + self.namespace);
|
1519 |
-
}, 10);
|
1520 |
-
} else {
|
1521 |
-
self._change(e, files);
|
1522 |
-
}
|
1523 |
-
self.$dropZone.removeClass('file-highlighted');
|
1524 |
-
};
|
1525 |
-
e.preventDefault();
|
1526 |
-
if (self.isDisabled || $h.isEmpty(files)) {
|
1527 |
-
return;
|
1528 |
-
}
|
1529 |
-
if (folders > 0) {
|
1530 |
-
if (!self.isAjaxUpload) {
|
1531 |
-
self._showFolderError(folders);
|
1532 |
-
return;
|
1533 |
-
}
|
1534 |
-
files = [];
|
1535 |
-
for (i = 0; i < items.length; i++) {
|
1536 |
-
var item = items[i].webkitGetAsEntry();
|
1537 |
-
if (item) {
|
1538 |
-
self._scanDroppedItems(item, files);
|
1539 |
-
}
|
1540 |
-
}
|
1541 |
-
setTimeout(function () {
|
1542 |
-
processFiles();
|
1543 |
-
}, 500);
|
1544 |
-
} else {
|
1545 |
-
processFiles();
|
1546 |
-
}
|
1547 |
-
},
|
1548 |
-
_uploadClick: function (e) {
|
1549 |
-
var self = this, $btn = self.$container.find('.fileinput-upload'), $form,
|
1550 |
-
isEnabled = !$btn.hasClass('disabled') && $h.isEmpty($btn.attr('disabled'));
|
1551 |
-
if (e && e.isDefaultPrevented()) {
|
1552 |
-
return;
|
1553 |
-
}
|
1554 |
-
if (!self.isAjaxUpload) {
|
1555 |
-
if (isEnabled && $btn.attr('type') !== 'submit') {
|
1556 |
-
$form = $btn.closest('form');
|
1557 |
-
// downgrade to normal form submit if possible
|
1558 |
-
if ($form.length) {
|
1559 |
-
$form.trigger('submit');
|
1560 |
-
}
|
1561 |
-
e.preventDefault();
|
1562 |
-
}
|
1563 |
-
return;
|
1564 |
-
}
|
1565 |
-
e.preventDefault();
|
1566 |
-
if (isEnabled) {
|
1567 |
-
self.upload();
|
1568 |
-
}
|
1569 |
-
},
|
1570 |
-
_submitForm: function () {
|
1571 |
-
var self = this;
|
1572 |
-
return self._isFileSelectionValid() && !self._abort({});
|
1573 |
-
},
|
1574 |
-
_clearPreview: function () {
|
1575 |
-
var self = this, $p = self.$preview,
|
1576 |
-
$thumbs = self.showUploadedThumbs ? self.getFrames(':not(.file-preview-success)') : self.getFrames();
|
1577 |
-
$thumbs.each(function () {
|
1578 |
-
var $thumb = $(this);
|
1579 |
-
$thumb.remove();
|
1580 |
-
$h.cleanZoomCache($p.find('#zoom-' + $thumb.attr('id')));
|
1581 |
-
});
|
1582 |
-
if (!self.getFrames().length || !self.showPreview) {
|
1583 |
-
self._resetUpload();
|
1584 |
-
}
|
1585 |
-
self._validateDefaultPreview();
|
1586 |
-
},
|
1587 |
-
_initSortable: function () {
|
1588 |
-
var self = this, $el = self.$preview, settings, selector = '.' + $h.SORT_CSS,
|
1589 |
-
rev = self.reversePreviewOrder;
|
1590 |
-
if (!window.KvSortable || $el.find(selector).length === 0) {
|
1591 |
-
return;
|
1592 |
-
}
|
1593 |
-
//noinspection JSUnusedGlobalSymbols
|
1594 |
-
settings = {
|
1595 |
-
handle: '.drag-handle-init',
|
1596 |
-
dataIdAttr: 'data-preview-id',
|
1597 |
-
scroll: false,
|
1598 |
-
draggable: selector,
|
1599 |
-
onSort: function (e) {
|
1600 |
-
var oldIndex = e.oldIndex, newIndex = e.newIndex, i = 0;
|
1601 |
-
self.initialPreview = $h.moveArray(self.initialPreview, oldIndex, newIndex, rev);
|
1602 |
-
self.initialPreviewConfig = $h.moveArray(self.initialPreviewConfig, oldIndex, newIndex, rev);
|
1603 |
-
self.previewCache.init();
|
1604 |
-
self.getFrames('.file-preview-initial').each(function () {
|
1605 |
-
$(this).attr('data-fileindex', 'init_' + i);
|
1606 |
-
i++;
|
1607 |
-
});
|
1608 |
-
self._raise('filesorted', {
|
1609 |
-
previewId: $(e.item).attr('id'),
|
1610 |
-
'oldIndex': oldIndex,
|
1611 |
-
'newIndex': newIndex,
|
1612 |
-
stack: self.initialPreviewConfig
|
1613 |
-
});
|
1614 |
-
}
|
1615 |
-
};
|
1616 |
-
if ($el.data('kvsortable')) {
|
1617 |
-
$el.kvsortable('destroy');
|
1618 |
-
}
|
1619 |
-
$.extend(true, settings, self.fileActionSettings.dragSettings);
|
1620 |
-
$el.kvsortable(settings);
|
1621 |
-
},
|
1622 |
-
_setPreviewContent: function (content) {
|
1623 |
-
var self = this;
|
1624 |
-
self.$preview.html(content);
|
1625 |
-
self._autoFitContent();
|
1626 |
-
},
|
1627 |
-
_initPreview: function (isInit) {
|
1628 |
-
var self = this, cap = self.initialCaption || '', out;
|
1629 |
-
if (!self.previewCache.count()) {
|
1630 |
-
self._clearPreview();
|
1631 |
-
if (isInit) {
|
1632 |
-
self._setCaption(cap);
|
1633 |
-
} else {
|
1634 |
-
self._initCaption();
|
1635 |
-
}
|
1636 |
-
return;
|
1637 |
-
}
|
1638 |
-
out = self.previewCache.out();
|
1639 |
-
cap = isInit && self.initialCaption ? self.initialCaption : out.caption;
|
1640 |
-
self._setPreviewContent(out.content);
|
1641 |
-
self._setInitThumbAttr();
|
1642 |
-
self._setCaption(cap);
|
1643 |
-
self._initSortable();
|
1644 |
-
if (!$h.isEmpty(out.content)) {
|
1645 |
-
self.$container.removeClass('file-input-new');
|
1646 |
-
}
|
1647 |
-
},
|
1648 |
-
_getZoomButton: function (type) {
|
1649 |
-
var self = this, label = self.previewZoomButtonIcons[type], css = self.previewZoomButtonClasses[type],
|
1650 |
-
title = ' title="' + (self.previewZoomButtonTitles[type] || '') + '" ',
|
1651 |
-
params = title + (type === 'close' ? ' data-dismiss="modal" aria-hidden="true"' : '');
|
1652 |
-
if (type === 'fullscreen' || type === 'borderless' || type === 'toggleheader') {
|
1653 |
-
params += ' data-toggle="button" aria-pressed="false" autocomplete="off"';
|
1654 |
-
}
|
1655 |
-
return '<button type="button" class="' + css + ' btn-' + type + '"' + params + '>' + label + '</button>';
|
1656 |
-
},
|
1657 |
-
_getModalContent: function () {
|
1658 |
-
var self = this;
|
1659 |
-
return self._getLayoutTemplate('modal').setTokens({
|
1660 |
-
'rtl': self.rtl ? ' kv-rtl' : '',
|
1661 |
-
'zoomFrameClass': self.frameClass,
|
1662 |
-
'heading': self.msgZoomModalHeading,
|
1663 |
-
'prev': self._getZoomButton('prev'),
|
1664 |
-
'next': self._getZoomButton('next'),
|
1665 |
-
'toggleheader': self._getZoomButton('toggleheader'),
|
1666 |
-
'fullscreen': self._getZoomButton('fullscreen'),
|
1667 |
-
'borderless': self._getZoomButton('borderless'),
|
1668 |
-
'close': self._getZoomButton('close')
|
1669 |
-
});
|
1670 |
-
},
|
1671 |
-
_listenModalEvent: function (event) {
|
1672 |
-
var self = this, $modal = self.$modal, getParams = function (e) {
|
1673 |
-
return {
|
1674 |
-
sourceEvent: e,
|
1675 |
-
previewId: $modal.data('previewId'),
|
1676 |
-
modal: $modal
|
1677 |
-
};
|
1678 |
-
};
|
1679 |
-
$modal.on(event + '.bs.modal', function (e) {
|
1680 |
-
var $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless');
|
1681 |
-
self._raise('filezoom' + event, getParams(e));
|
1682 |
-
if (event === 'shown') {
|
1683 |
-
$btnBord.removeClass('active').attr('aria-pressed', 'false');
|
1684 |
-
$btnFull.removeClass('active').attr('aria-pressed', 'false');
|
1685 |
-
if ($modal.hasClass('file-zoom-fullscreen')) {
|
1686 |
-
self._maximizeZoomDialog();
|
1687 |
-
if ($h.checkFullScreen()) {
|
1688 |
-
$btnFull.addClass('active').attr('aria-pressed', 'true');
|
1689 |
-
} else {
|
1690 |
-
$btnBord.addClass('active').attr('aria-pressed', 'true');
|
1691 |
-
}
|
1692 |
-
}
|
1693 |
-
}
|
1694 |
-
});
|
1695 |
-
},
|
1696 |
-
_initZoom: function () {
|
1697 |
-
var self = this, $dialog, modalMain = self._getLayoutTemplate('modalMain'), modalId = '#' + $h.MODAL_ID;
|
1698 |
-
if (!self.showPreview) {
|
1699 |
-
return;
|
1700 |
-
}
|
1701 |
-
self.$modal = $(modalId);
|
1702 |
-
if (!self.$modal || !self.$modal.length) {
|
1703 |
-
$dialog = $(document.createElement('div')).html(modalMain).insertAfter(self.$container);
|
1704 |
-
self.$modal = $(modalId).insertBefore($dialog);
|
1705 |
-
$dialog.remove();
|
1706 |
-
}
|
1707 |
-
$h.initModal(self.$modal);
|
1708 |
-
self.$modal.html(self._getModalContent());
|
1709 |
-
$.each($h.MODAL_EVENTS, function (key, event) {
|
1710 |
-
self._listenModalEvent(event);
|
1711 |
-
});
|
1712 |
-
},
|
1713 |
-
_initZoomButtons: function () {
|
1714 |
-
var self = this, previewId = self.$modal.data('previewId') || '', $first, $last,
|
1715 |
-
thumbs = self.getFrames().toArray(), len = thumbs.length, $prev = self.$modal.find('.btn-prev'),
|
1716 |
-
$next = self.$modal.find('.btn-next');
|
1717 |
-
if (thumbs.length < 2) {
|
1718 |
-
$prev.hide();
|
1719 |
-
$next.hide();
|
1720 |
-
return;
|
1721 |
-
} else {
|
1722 |
-
$prev.show();
|
1723 |
-
$next.show();
|
1724 |
-
}
|
1725 |
-
if (!len) {
|
1726 |
-
return;
|
1727 |
-
}
|
1728 |
-
$first = $(thumbs[0]);
|
1729 |
-
$last = $(thumbs[len - 1]);
|
1730 |
-
$prev.removeAttr('disabled');
|
1731 |
-
$next.removeAttr('disabled');
|
1732 |
-
if ($first.length && $first.attr('id') === previewId) {
|
1733 |
-
$prev.attr('disabled', true);
|
1734 |
-
}
|
1735 |
-
if ($last.length && $last.attr('id') === previewId) {
|
1736 |
-
$next.attr('disabled', true);
|
1737 |
-
}
|
1738 |
-
},
|
1739 |
-
_maximizeZoomDialog: function () {
|
1740 |
-
var self = this, $modal = self.$modal, $head = $modal.find('.modal-header:visible'),
|
1741 |
-
$foot = $modal.find('.modal-footer:visible'), $body = $modal.find('.modal-body'),
|
1742 |
-
h = $(window).height(), diff = 0;
|
1743 |
-
$modal.addClass('file-zoom-fullscreen');
|
1744 |
-
if ($head && $head.length) {
|
1745 |
-
h -= $head.outerHeight(true);
|
1746 |
-
}
|
1747 |
-
if ($foot && $foot.length) {
|
1748 |
-
h -= $foot.outerHeight(true);
|
1749 |
-
}
|
1750 |
-
if ($body && $body.length) {
|
1751 |
-
diff = $body.outerHeight(true) - $body.height();
|
1752 |
-
h -= diff;
|
1753 |
-
}
|
1754 |
-
$modal.find('.kv-zoom-body').height(h);
|
1755 |
-
},
|
1756 |
-
_resizeZoomDialog: function (fullScreen) {
|
1757 |
-
var self = this, $modal = self.$modal, $btnFull = $modal.find('.btn-fullscreen'),
|
1758 |
-
$btnBord = $modal.find('.btn-borderless');
|
1759 |
-
if ($modal.hasClass('file-zoom-fullscreen')) {
|
1760 |
-
$h.toggleFullScreen(false);
|
1761 |
-
if (!fullScreen) {
|
1762 |
-
if (!$btnFull.hasClass('active')) {
|
1763 |
-
$modal.removeClass('file-zoom-fullscreen');
|
1764 |
-
self.$modal.find('.kv-zoom-body').css('height', self.zoomModalHeight);
|
1765 |
-
} else {
|
1766 |
-
$btnFull.removeClass('active').attr('aria-pressed', 'false');
|
1767 |
-
}
|
1768 |
-
} else {
|
1769 |
-
if (!$btnFull.hasClass('active')) {
|
1770 |
-
$modal.removeClass('file-zoom-fullscreen');
|
1771 |
-
self._resizeZoomDialog(true);
|
1772 |
-
if ($btnBord.hasClass('active')) {
|
1773 |
-
$btnBord.removeClass('active').attr('aria-pressed', 'false');
|
1774 |
-
}
|
1775 |
-
}
|
1776 |
-
}
|
1777 |
-
} else {
|
1778 |
-
if (!fullScreen) {
|
1779 |
-
self._maximizeZoomDialog();
|
1780 |
-
return;
|
1781 |
-
}
|
1782 |
-
$h.toggleFullScreen(true);
|
1783 |
-
}
|
1784 |
-
$modal.focus();
|
1785 |
-
},
|
1786 |
-
_setZoomContent: function ($frame, animate) {
|
1787 |
-
var self = this, $content, tmplt, body, title, $body, $dataEl, config, pid = $frame.attr('id'),
|
1788 |
-
$modal = self.$modal, $prev = $modal.find('.btn-prev'), $next = $modal.find('.btn-next'), $tmp,
|
1789 |
-
$btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'), cap, size,
|
1790 |
-
$btnTogh = $modal.find('.btn-toggleheader'), $zoomPreview = self.$preview.find('#zoom-' + pid);
|
1791 |
-
tmplt = $zoomPreview.attr('data-template') || 'generic';
|
1792 |
-
$content = $zoomPreview.find('.kv-file-content');
|
1793 |
-
body = $content.length ? $content.html() : '';
|
1794 |
-
cap = $frame.data('caption') || '';
|
1795 |
-
size = $frame.data('size') || '';
|
1796 |
-
title = cap + ' ' + size;
|
1797 |
-
$modal.find('.kv-zoom-title').attr('title', $('<div/>').html(title).text()).html(title);
|
1798 |
-
$body = $modal.find('.kv-zoom-body');
|
1799 |
-
$modal.removeClass('kv-single-content');
|
1800 |
-
if (animate) {
|
1801 |
-
$tmp = $body.addClass('file-thumb-loading').clone().insertAfter($body);
|
1802 |
-
$body.html(body).hide();
|
1803 |
-
$tmp.fadeOut('fast', function () {
|
1804 |
-
$body.fadeIn('fast', function () {
|
1805 |
-
$body.removeClass('file-thumb-loading');
|
1806 |
-
});
|
1807 |
-
$tmp.remove();
|
1808 |
-
});
|
1809 |
-
} else {
|
1810 |
-
$body.html(body);
|
1811 |
-
}
|
1812 |
-
config = self.previewZoomSettings[tmplt];
|
1813 |
-
if (config) {
|
1814 |
-
$dataEl = $body.find('.kv-preview-data');
|
1815 |
-
$h.addCss($dataEl, 'file-zoom-detail');
|
1816 |
-
$.each(config, function (key, value) {
|
1817 |
-
$dataEl.css(key, value);
|
1818 |
-
if (($dataEl.attr('width') && key === 'width') || ($dataEl.attr('height') && key === 'height')) {
|
1819 |
-
$dataEl.removeAttr(key);
|
1820 |
-
}
|
1821 |
-
});
|
1822 |
-
}
|
1823 |
-
$modal.data('previewId', pid);
|
1824 |
-
self._handler($prev, 'click', function () {
|
1825 |
-
self._zoomSlideShow('prev', pid);
|
1826 |
-
});
|
1827 |
-
self._handler($next, 'click', function () {
|
1828 |
-
self._zoomSlideShow('next', pid);
|
1829 |
-
});
|
1830 |
-
self._handler($btnFull, 'click', function () {
|
1831 |
-
self._resizeZoomDialog(true);
|
1832 |
-
});
|
1833 |
-
self._handler($btnBord, 'click', function () {
|
1834 |
-
self._resizeZoomDialog(false);
|
1835 |
-
});
|
1836 |
-
self._handler($btnTogh, 'click', function () {
|
1837 |
-
var $header = $modal.find('.modal-header'), $floatBar = $modal.find('.modal-body .floating-buttons'),
|
1838 |
-
ht, $actions = $header.find('.kv-zoom-actions'), resize = function (height) {
|
1839 |
-
var $body = self.$modal.find('.kv-zoom-body'), h = self.zoomModalHeight;
|
1840 |
-
if ($modal.hasClass('file-zoom-fullscreen')) {
|
1841 |
-
h = $body.outerHeight(true);
|
1842 |
-
if (!height) {
|
1843 |
-
h = h - $header.outerHeight(true);
|
1844 |
-
}
|
1845 |
-
}
|
1846 |
-
$body.css('height', height ? h + height : h);
|
1847 |
-
};
|
1848 |
-
if ($header.is(':visible')) {
|
1849 |
-
ht = $header.outerHeight(true);
|
1850 |
-
$header.slideUp('slow', function () {
|
1851 |
-
$actions.find('.btn').appendTo($floatBar);
|
1852 |
-
resize(ht);
|
1853 |
-
});
|
1854 |
-
} else {
|
1855 |
-
$floatBar.find('.btn').appendTo($actions);
|
1856 |
-
$header.slideDown('slow', function () {
|
1857 |
-
resize();
|
1858 |
-
});
|
1859 |
-
}
|
1860 |
-
$modal.focus();
|
1861 |
-
});
|
1862 |
-
self._handler($modal, 'keydown', function (e) {
|
1863 |
-
var key = e.which || e.keyCode;
|
1864 |
-
if (key === 37 && !$prev.attr('disabled')) {
|
1865 |
-
self._zoomSlideShow('prev', pid);
|
1866 |
-
}
|
1867 |
-
if (key === 39 && !$next.attr('disabled')) {
|
1868 |
-
self._zoomSlideShow('next', pid);
|
1869 |
-
}
|
1870 |
-
});
|
1871 |
-
},
|
1872 |
-
_zoomPreview: function ($btn) {
|
1873 |
-
var self = this, $frame, $modal = self.$modal;
|
1874 |
-
if (!$btn.length) {
|
1875 |
-
throw 'Cannot zoom to detailed preview!';
|
1876 |
-
}
|
1877 |
-
$h.initModal($modal);
|
1878 |
-
$modal.html(self._getModalContent());
|
1879 |
-
$frame = $btn.closest($h.FRAMES);
|
1880 |
-
self._setZoomContent($frame);
|
1881 |
-
$modal.modal('show');
|
1882 |
-
self._initZoomButtons();
|
1883 |
-
},
|
1884 |
-
_zoomSlideShow: function (dir, previewId) {
|
1885 |
-
var self = this, $btn = self.$modal.find('.kv-zoom-actions .btn-' + dir), $targFrame, i,
|
1886 |
-
thumbs = self.getFrames().toArray(), len = thumbs.length, out;
|
1887 |
-
if ($btn.attr('disabled')) {
|
1888 |
-
return;
|
1889 |
-
}
|
1890 |
-
for (i = 0; i < len; i++) {
|
1891 |
-
if ($(thumbs[i]).attr('id') === previewId) {
|
1892 |
-
out = dir === 'prev' ? i - 1 : i + 1;
|
1893 |
-
break;
|
1894 |
-
}
|
1895 |
-
}
|
1896 |
-
if (out < 0 || out >= len || !thumbs[out]) {
|
1897 |
-
return;
|
1898 |
-
}
|
1899 |
-
$targFrame = $(thumbs[out]);
|
1900 |
-
if ($targFrame.length) {
|
1901 |
-
self._setZoomContent($targFrame, true);
|
1902 |
-
}
|
1903 |
-
self._initZoomButtons();
|
1904 |
-
self._raise('filezoom' + dir, {'previewId': previewId, modal: self.$modal});
|
1905 |
-
},
|
1906 |
-
_initZoomButton: function () {
|
1907 |
-
var self = this;
|
1908 |
-
self.$preview.find('.kv-file-zoom').each(function () {
|
1909 |
-
var $el = $(this);
|
1910 |
-
self._handler($el, 'click', function () {
|
1911 |
-
self._zoomPreview($el);
|
1912 |
-
});
|
1913 |
-
});
|
1914 |
-
},
|
1915 |
-
_inputFileCount: function () {
|
1916 |
-
return this.$element.get(0).files.length;
|
1917 |
-
},
|
1918 |
-
_refreshPreview: function () {
|
1919 |
-
var self = this, files;
|
1920 |
-
if (!self._inputFileCount() || !self.showPreview || !self.isPreviewable) {
|
1921 |
-
return;
|
1922 |
-
}
|
1923 |
-
if (self.isAjaxUpload) {
|
1924 |
-
files = self.getFileStack();
|
1925 |
-
self.filestack = [];
|
1926 |
-
if (files.length) {
|
1927 |
-
self._clearFileInput();
|
1928 |
-
} else {
|
1929 |
-
files = self.$element.get(0).files;
|
1930 |
-
}
|
1931 |
-
} else {
|
1932 |
-
files = self.$element.get(0).files;
|
1933 |
-
}
|
1934 |
-
if (files && files.length) {
|
1935 |
-
self.readFiles(files);
|
1936 |
-
self._setFileDropZoneTitle();
|
1937 |
-
}
|
1938 |
-
},
|
1939 |
-
_clearObjects: function ($el) {
|
1940 |
-
$el.find('video audio').each(function () {
|
1941 |
-
this.pause();
|
1942 |
-
$(this).remove();
|
1943 |
-
});
|
1944 |
-
$el.find('img object div').each(function () {
|
1945 |
-
$(this).remove();
|
1946 |
-
});
|
1947 |
-
},
|
1948 |
-
_clearFileInput: function () {
|
1949 |
-
var self = this, $el = self.$element, $srcFrm, $tmpFrm, $tmpEl;
|
1950 |
-
if (!self._inputFileCount()) {
|
1951 |
-
return;
|
1952 |
-
}
|
1953 |
-
$srcFrm = $el.closest('form');
|
1954 |
-
$tmpFrm = $(document.createElement('form'));
|
1955 |
-
$tmpEl = $(document.createElement('div'));
|
1956 |
-
$el.before($tmpEl);
|
1957 |
-
if ($srcFrm.length) {
|
1958 |
-
$srcFrm.after($tmpFrm);
|
1959 |
-
} else {
|
1960 |
-
$tmpEl.after($tmpFrm);
|
1961 |
-
}
|
1962 |
-
$tmpFrm.append($el).trigger('reset');
|
1963 |
-
$tmpEl.before($el).remove();
|
1964 |
-
$tmpFrm.remove();
|
1965 |
-
},
|
1966 |
-
_resetUpload: function () {
|
1967 |
-
var self = this;
|
1968 |
-
self.uploadCache = {content: [], config: [], tags: [], append: true};
|
1969 |
-
self.uploadCount = 0;
|
1970 |
-
self.uploadStatus = {};
|
1971 |
-
self.uploadLog = [];
|
1972 |
-
self.uploadAsyncCount = 0;
|
1973 |
-
self.loadedImages = [];
|
1974 |
-
self.totalImagesCount = 0;
|
1975 |
-
self.$btnUpload.removeAttr('disabled');
|
1976 |
-
self._setProgress(0);
|
1977 |
-
self.$progress.hide();
|
1978 |
-
self._resetErrors(false);
|
1979 |
-
self.ajaxAborted = false;
|
1980 |
-
self.ajaxRequests = [];
|
1981 |
-
self._resetCanvas();
|
1982 |
-
self.cacheInitialPreview = {};
|
1983 |
-
if (self.overwriteInitial) {
|
1984 |
-
self.initialPreview = [];
|
1985 |
-
self.initialPreviewConfig = [];
|
1986 |
-
self.initialPreviewThumbTags = [];
|
1987 |
-
self.previewCache.data = {
|
1988 |
-
content: [],
|
1989 |
-
config: [],
|
1990 |
-
tags: []
|
1991 |
-
};
|
1992 |
-
}
|
1993 |
-
},
|
1994 |
-
_resetCanvas: function () {
|
1995 |
-
var self = this;
|
1996 |
-
if (self.canvas && self.imageCanvasContext) {
|
1997 |
-
self.imageCanvasContext.clearRect(0, 0, self.canvas.width, self.canvas.height);
|
1998 |
-
}
|
1999 |
-
},
|
2000 |
-
_hasInitialPreview: function () {
|
2001 |
-
var self = this;
|
2002 |
-
return !self.overwriteInitial && self.previewCache.count();
|
2003 |
-
},
|
2004 |
-
_resetPreview: function () {
|
2005 |
-
var self = this, out, cap;
|
2006 |
-
if (self.previewCache.count()) {
|
2007 |
-
out = self.previewCache.out();
|
2008 |
-
self._setPreviewContent(out.content);
|
2009 |
-
self._setInitThumbAttr();
|
2010 |
-
cap = self.initialCaption ? self.initialCaption : out.caption;
|
2011 |
-
self._setCaption(cap);
|
2012 |
-
} else {
|
2013 |
-
self._clearPreview();
|
2014 |
-
self._initCaption();
|
2015 |
-
}
|
2016 |
-
if (self.showPreview) {
|
2017 |
-
self._initZoom();
|
2018 |
-
self._initSortable();
|
2019 |
-
}
|
2020 |
-
},
|
2021 |
-
_clearDefaultPreview: function () {
|
2022 |
-
var self = this;
|
2023 |
-
self.$preview.find('.file-default-preview').remove();
|
2024 |
-
},
|
2025 |
-
_validateDefaultPreview: function () {
|
2026 |
-
var self = this;
|
2027 |
-
if (!self.showPreview || $h.isEmpty(self.defaultPreviewContent)) {
|
2028 |
-
return;
|
2029 |
-
}
|
2030 |
-
self._setPreviewContent('<div class="file-default-preview">' + self.defaultPreviewContent + '</div>');
|
2031 |
-
self.$container.removeClass('file-input-new');
|
2032 |
-
self._initClickable();
|
2033 |
-
},
|
2034 |
-
_resetPreviewThumbs: function (isAjax) {
|
2035 |
-
var self = this, out;
|
2036 |
-
if (isAjax) {
|
2037 |
-
self._clearPreview();
|
2038 |
-
self.clearStack();
|
2039 |
-
return;
|
2040 |
-
}
|
2041 |
-
if (self._hasInitialPreview()) {
|
2042 |
-
out = self.previewCache.out();
|
2043 |
-
self._setPreviewContent(out.content);
|
2044 |
-
self._setInitThumbAttr();
|
2045 |
-
self._setCaption(out.caption);
|
2046 |
-
self._initPreviewActions();
|
2047 |
-
} else {
|
2048 |
-
self._clearPreview();
|
2049 |
-
}
|
2050 |
-
},
|
2051 |
-
_getLayoutTemplate: function (t) {
|
2052 |
-
var self = this, template = self.layoutTemplates[t];
|
2053 |
-
if ($h.isEmpty(self.customLayoutTags)) {
|
2054 |
-
return template;
|
2055 |
-
}
|
2056 |
-
return $h.replaceTags(template, self.customLayoutTags);
|
2057 |
-
},
|
2058 |
-
_getPreviewTemplate: function (t) {
|
2059 |
-
var self = this, template = self.previewTemplates[t];
|
2060 |
-
if ($h.isEmpty(self.customPreviewTags)) {
|
2061 |
-
return template;
|
2062 |
-
}
|
2063 |
-
return $h.replaceTags(template, self.customPreviewTags);
|
2064 |
-
},
|
2065 |
-
_getOutData: function (jqXHR, responseData, filesData) {
|
2066 |
-
var self = this;
|
2067 |
-
jqXHR = jqXHR || {};
|
2068 |
-
responseData = responseData || {};
|
2069 |
-
filesData = filesData || self.filestack.slice(0) || {};
|
2070 |
-
return {
|
2071 |
-
form: self.formdata,
|
2072 |
-
files: filesData,
|
2073 |
-
filenames: self.filenames,
|
2074 |
-
filescount: self.getFilesCount(),
|
2075 |
-
extra: self._getExtraData(),
|
2076 |
-
response: responseData,
|
2077 |
-
reader: self.reader,
|
2078 |
-
jqXHR: jqXHR
|
2079 |
-
};
|
2080 |
-
},
|
2081 |
-
_getMsgSelected: function (n) {
|
2082 |
-
var self = this, strFiles = n === 1 ? self.fileSingle : self.filePlural;
|
2083 |
-
return n > 0 ? self.msgSelected.replace('{n}', n).replace('{files}', strFiles) : self.msgNoFilesSelected;
|
2084 |
-
},
|
2085 |
-
_getFrame: function (id) {
|
2086 |
-
var self = this, $frame = $('#' + id);
|
2087 |
-
if (!$frame.length) {
|
2088 |
-
self._log('Invalid thumb frame with id: "' + id + '".');
|
2089 |
-
return null;
|
2090 |
-
}
|
2091 |
-
return $frame;
|
2092 |
-
},
|
2093 |
-
_getThumbs: function (css) {
|
2094 |
-
css = css || '';
|
2095 |
-
return this.getFrames(':not(.file-preview-initial)' + css);
|
2096 |
-
},
|
2097 |
-
_getExtraData: function (previewId, index) {
|
2098 |
-
var self = this, data = self.uploadExtraData;
|
2099 |
-
if (typeof self.uploadExtraData === "function") {
|
2100 |
-
data = self.uploadExtraData(previewId, index);
|
2101 |
-
}
|
2102 |
-
return data;
|
2103 |
-
},
|
2104 |
-
_initXhr: function (xhrobj, previewId, fileCount) {
|
2105 |
-
var self = this;
|
2106 |
-
if (xhrobj.upload) {
|
2107 |
-
xhrobj.upload.addEventListener('progress', function (event) {
|
2108 |
-
var pct = 0, total = event.total, position = event.loaded || event.position;
|
2109 |
-
/** @namespace event.lengthComputable */
|
2110 |
-
if (event.lengthComputable) {
|
2111 |
-
pct = Math.floor(position / total * 100);
|
2112 |
-
}
|
2113 |
-
if (previewId) {
|
2114 |
-
self._setAsyncUploadStatus(previewId, pct, fileCount);
|
2115 |
-
} else {
|
2116 |
-
self._setProgress(pct);
|
2117 |
-
}
|
2118 |
-
}, false);
|
2119 |
-
}
|
2120 |
-
return xhrobj;
|
2121 |
-
},
|
2122 |
-
_initAjaxSettings: function () {
|
2123 |
-
var self = this;
|
2124 |
-
self._ajaxSettings = $.extend(true, {}, self.ajaxSettings);
|
2125 |
-
self._ajaxDeleteSettings = $.extend(true, {}, self.ajaxDeleteSettings);
|
2126 |
-
},
|
2127 |
-
_mergeAjaxCallback: function (funcName, srcFunc, type) {
|
2128 |
-
var self = this, settings = self._ajaxSettings, flag = self.mergeAjaxCallbacks, targFunc;
|
2129 |
-
if (type === 'delete') {
|
2130 |
-
settings = self._ajaxDeleteSettings;
|
2131 |
-
flag = self.mergeAjaxDeleteCallbacks;
|
2132 |
-
}
|
2133 |
-
targFunc = settings[funcName];
|
2134 |
-
if (flag && typeof targFunc === "function") {
|
2135 |
-
if (flag === 'before') {
|
2136 |
-
settings[funcName] = function () {
|
2137 |
-
targFunc.apply(this, arguments);
|
2138 |
-
srcFunc.apply(this, arguments);
|
2139 |
-
};
|
2140 |
-
} else {
|
2141 |
-
settings[funcName] = function () {
|
2142 |
-
srcFunc.apply(this, arguments);
|
2143 |
-
targFunc.apply(this, arguments);
|
2144 |
-
};
|
2145 |
-
}
|
2146 |
-
} else {
|
2147 |
-
settings[funcName] = srcFunc;
|
2148 |
-
}
|
2149 |
-
},
|
2150 |
-
_ajaxSubmit: function (fnBefore, fnSuccess, fnComplete, fnError, previewId, index) {
|
2151 |
-
var self = this, settings;
|
2152 |
-
if (!self._raise('filepreajax', [previewId, index])) {
|
2153 |
-
return;
|
2154 |
-
}
|
2155 |
-
self._uploadExtra(previewId, index);
|
2156 |
-
self._initAjaxSettings();
|
2157 |
-
self._mergeAjaxCallback('beforeSend', fnBefore);
|
2158 |
-
self._mergeAjaxCallback('success', fnSuccess);
|
2159 |
-
self._mergeAjaxCallback('complete', fnComplete);
|
2160 |
-
self._mergeAjaxCallback('error', fnError);
|
2161 |
-
settings = $.extend(true, {}, {
|
2162 |
-
xhr: function () {
|
2163 |
-
var xhrobj = $.ajaxSettings.xhr();
|
2164 |
-
return self._initXhr(xhrobj, previewId, self.getFileStack().length);
|
2165 |
-
},
|
2166 |
-
url: index && self.uploadUrlThumb ? self.uploadUrlThumb : self.uploadUrl,
|
2167 |
-
type: 'POST',
|
2168 |
-
dataType: 'json',
|
2169 |
-
data: self.formdata,
|
2170 |
-
cache: false,
|
2171 |
-
processData: false,
|
2172 |
-
contentType: false
|
2173 |
-
}, self._ajaxSettings);
|
2174 |
-
self.ajaxRequests.push($.ajax(settings));
|
2175 |
-
},
|
2176 |
-
_mergeArray: function (prop, content) {
|
2177 |
-
var self = this, arr1 = $h.cleanArray(self[prop]), arr2 = $h.cleanArray(content);
|
2178 |
-
self[prop] = arr1.concat(arr2);
|
2179 |
-
},
|
2180 |
-
_initUploadSuccess: function (out, $thumb, allFiles) {
|
2181 |
-
var self = this, append, data, index, $div, $newCache, content, config, tags, i;
|
2182 |
-
if (!self.showPreview || typeof out !== 'object' || $.isEmptyObject(out)) {
|
2183 |
-
return;
|
2184 |
-
}
|
2185 |
-
if (out.initialPreview !== undefined && out.initialPreview.length > 0) {
|
2186 |
-
self.hasInitData = true;
|
2187 |
-
content = out.initialPreview || [];
|
2188 |
-
config = out.initialPreviewConfig || [];
|
2189 |
-
tags = out.initialPreviewThumbTags || [];
|
2190 |
-
append = out.append === undefined || out.append;
|
2191 |
-
if (content.length > 0 && !$h.isArray(content)) {
|
2192 |
-
content = content.split(self.initialPreviewDelimiter);
|
2193 |
-
}
|
2194 |
-
self._mergeArray('initialPreview', content);
|
2195 |
-
self._mergeArray('initialPreviewConfig', config);
|
2196 |
-
self._mergeArray('initialPreviewThumbTags', tags);
|
2197 |
-
if ($thumb !== undefined) {
|
2198 |
-
if (!allFiles) {
|
2199 |
-
index = self.previewCache.add(content, config[0], tags[0], append);
|
2200 |
-
data = self.previewCache.get(index, false);
|
2201 |
-
$div = $(document.createElement('div')).html(data).hide().insertAfter($thumb);
|
2202 |
-
$newCache = $div.find('.kv-zoom-cache');
|
2203 |
-
if ($newCache && $newCache.length) {
|
2204 |
-
$newCache.insertAfter($thumb);
|
2205 |
-
}
|
2206 |
-
$thumb.fadeOut('slow', function () {
|
2207 |
-
var $newThumb = $div.find('.file-preview-frame');
|
2208 |
-
if ($newThumb && $newThumb.length) {
|
2209 |
-
$newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block');
|
2210 |
-
}
|
2211 |
-
self._initPreviewActions();
|
2212 |
-
self._clearFileInput();
|
2213 |
-
$h.cleanZoomCache(self.$preview.find('#zoom-' + $thumb.attr('id')));
|
2214 |
-
$thumb.remove();
|
2215 |
-
$div.remove();
|
2216 |
-
self._initSortable();
|
2217 |
-
});
|
2218 |
-
} else {
|
2219 |
-
i = $thumb.attr('data-fileindex');
|
2220 |
-
self.uploadCache.content[i] = content[0];
|
2221 |
-
self.uploadCache.config[i] = config[0] || [];
|
2222 |
-
self.uploadCache.tags[i] = tags[0] || [];
|
2223 |
-
self.uploadCache.append = append;
|
2224 |
-
}
|
2225 |
-
} else {
|
2226 |
-
self.previewCache.set(content, config, tags, append);
|
2227 |
-
self._initPreview();
|
2228 |
-
self._initPreviewActions();
|
2229 |
-
}
|
2230 |
-
}
|
2231 |
-
},
|
2232 |
-
_initSuccessThumbs: function () {
|
2233 |
-
var self = this;
|
2234 |
-
if (!self.showPreview) {
|
2235 |
-
return;
|
2236 |
-
}
|
2237 |
-
self._getThumbs($h.FRAMES + '.file-preview-success').each(function () {
|
2238 |
-
var $thumb = $(this), $preview = self.$preview, $remove = $thumb.find('.kv-file-remove');
|
2239 |
-
$remove.removeAttr('disabled');
|
2240 |
-
self._handler($remove, 'click', function () {
|
2241 |
-
var id = $thumb.attr('id'),
|
2242 |
-
out = self._raise('filesuccessremove', [id, $thumb.attr('data-fileindex')]);
|
2243 |
-
$h.cleanMemory($thumb);
|
2244 |
-
if (out === false) {
|
2245 |
-
return;
|
2246 |
-
}
|
2247 |
-
$thumb.fadeOut('slow', function () {
|
2248 |
-
$h.cleanZoomCache($preview.find('#zoom-' + id));
|
2249 |
-
$thumb.remove();
|
2250 |
-
if (!self.getFrames().length) {
|
2251 |
-
self.reset();
|
2252 |
-
}
|
2253 |
-
});
|
2254 |
-
});
|
2255 |
-
});
|
2256 |
-
},
|
2257 |
-
_checkAsyncComplete: function () {
|
2258 |
-
var self = this, previewId, i;
|
2259 |
-
for (i = 0; i < self.filestack.length; i++) {
|
2260 |
-
if (self.filestack[i]) {
|
2261 |
-
previewId = self.previewInitId + "-" + i;
|
2262 |
-
if ($.inArray(previewId, self.uploadLog) === -1) {
|
2263 |
-
return false;
|
2264 |
-
}
|
2265 |
-
}
|
2266 |
-
}
|
2267 |
-
return (self.uploadAsyncCount === self.uploadLog.length);
|
2268 |
-
},
|
2269 |
-
_uploadExtra: function (previewId, index) {
|
2270 |
-
var self = this, data = self._getExtraData(previewId, index);
|
2271 |
-
if (data.length === 0) {
|
2272 |
-
return;
|
2273 |
-
}
|
2274 |
-
$.each(data, function (key, value) {
|
2275 |
-
self.formdata.append(key, value);
|
2276 |
-
});
|
2277 |
-
},
|
2278 |
-
_uploadSingle: function (i, isBatch) {
|
2279 |
-
var self = this, total = self.getFileStack().length, formdata = new FormData(), outData,
|
2280 |
-
previewId = self.previewInitId + "-" + i, $thumb, chkComplete, $btnUpload, $btnDelete,
|
2281 |
-
hasPostData = self.filestack.length > 0 || !$.isEmptyObject(self.uploadExtraData), uploadFailed,
|
2282 |
-
$prog = $('#' + previewId).find('.file-thumb-progress'), fnBefore, fnSuccess, fnComplete, fnError,
|
2283 |
-
updateUploadLog, params = {id: previewId, index: i};
|
2284 |
-
self.formdata = formdata;
|
2285 |
-
if (self.showPreview) {
|
2286 |
-
$thumb = $('#' + previewId + ':not(.file-preview-initial)');
|
2287 |
-
$btnUpload = $thumb.find('.kv-file-upload');
|
2288 |
-
$btnDelete = $thumb.find('.kv-file-remove');
|
2289 |
-
$prog.show();
|
2290 |
-
}
|
2291 |
-
if (total === 0 || !hasPostData || ($btnUpload && $btnUpload.hasClass('disabled')) || self._abort(params)) {
|
2292 |
-
return;
|
2293 |
-
}
|
2294 |
-
updateUploadLog = function (i, previewId) {
|
2295 |
-
if (!uploadFailed) {
|
2296 |
-
self.updateStack(i, undefined);
|
2297 |
-
}
|
2298 |
-
self.uploadLog.push(previewId);
|
2299 |
-
if (self._checkAsyncComplete()) {
|
2300 |
-
self.fileBatchCompleted = true;
|
2301 |
-
}
|
2302 |
-
};
|
2303 |
-
chkComplete = function () {
|
2304 |
-
var u = self.uploadCache, $initThumbs, i, j, len = 0, data = self.cacheInitialPreview;
|
2305 |
-
if (!self.fileBatchCompleted) {
|
2306 |
-
return;
|
2307 |
-
}
|
2308 |
-
if (data && data.content) {
|
2309 |
-
len = data.content.length;
|
2310 |
-
}
|
2311 |
-
setTimeout(function () {
|
2312 |
-
var triggerReset = self.getFileStack(true).length === 0;
|
2313 |
-
if (self.showPreview) {
|
2314 |
-
self.previewCache.set(u.content, u.config, u.tags, u.append);
|
2315 |
-
if (len) {
|
2316 |
-
for (i = 0; i < u.content.length; i++) {
|
2317 |
-
j = i + len;
|
2318 |
-
data.content[j] = u.content[i];
|
2319 |
-
//noinspection JSUnresolvedVariable
|
2320 |
-
if (data.config.length) {
|
2321 |
-
data.config[j] = u.config[i];
|
2322 |
-
}
|
2323 |
-
if (data.tags.length) {
|
2324 |
-
data.tags[j] = u.tags[i];
|
2325 |
-
}
|
2326 |
-
}
|
2327 |
-
self.initialPreview = $h.cleanArray(data.content);
|
2328 |
-
self.initialPreviewConfig = $h.cleanArray(data.config);
|
2329 |
-
self.initialPreviewThumbTags = $h.cleanArray(data.tags);
|
2330 |
-
} else {
|
2331 |
-
self.initialPreview = u.content;
|
2332 |
-
self.initialPreviewConfig = u.config;
|
2333 |
-
self.initialPreviewThumbTags = u.tags;
|
2334 |
-
}
|
2335 |
-
self.cacheInitialPreview = {};
|
2336 |
-
if (self.hasInitData) {
|
2337 |
-
self._initPreview();
|
2338 |
-
self._initPreviewActions();
|
2339 |
-
}
|
2340 |
-
}
|
2341 |
-
self.unlock(triggerReset);
|
2342 |
-
if (triggerReset) {
|
2343 |
-
self._clearFileInput();
|
2344 |
-
}
|
2345 |
-
$initThumbs = self.$preview.find('.file-preview-initial');
|
2346 |
-
if (self.uploadAsync && $initThumbs.length) {
|
2347 |
-
$h.addCss($initThumbs, $h.SORT_CSS);
|
2348 |
-
self._initSortable();
|
2349 |
-
}
|
2350 |
-
self._raise('filebatchuploadcomplete', [self.filestack, self._getExtraData()]);
|
2351 |
-
self.uploadCount = 0;
|
2352 |
-
self.uploadStatus = {};
|
2353 |
-
self.uploadLog = [];
|
2354 |
-
self._setProgress(101);
|
2355 |
-
self.ajaxAborted = false;
|
2356 |
-
}, 100);
|
2357 |
-
};
|
2358 |
-
fnBefore = function (jqXHR) {
|
2359 |
-
outData = self._getOutData(jqXHR);
|
2360 |
-
self.fileBatchCompleted = false;
|
2361 |
-
if (!isBatch) {
|
2362 |
-
self.ajaxAborted = false;
|
2363 |
-
}
|
2364 |
-
if (self.showPreview) {
|
2365 |
-
if (!$thumb.hasClass('file-preview-success')) {
|
2366 |
-
self._setThumbStatus($thumb, 'Loading');
|
2367 |
-
$h.addCss($thumb, 'file-uploading');
|
2368 |
-
}
|
2369 |
-
$btnUpload.attr('disabled', true);
|
2370 |
-
$btnDelete.attr('disabled', true);
|
2371 |
-
}
|
2372 |
-
if (!isBatch) {
|
2373 |
-
self.lock();
|
2374 |
-
}
|
2375 |
-
self._raise('filepreupload', [outData, previewId, i]);
|
2376 |
-
$.extend(true, params, outData);
|
2377 |
-
if (self._abort(params)) {
|
2378 |
-
jqXHR.abort();
|
2379 |
-
if (!isBatch) {
|
2380 |
-
self._setThumbStatus($thumb, 'New');
|
2381 |
-
$thumb.removeClass('file-uploading');
|
2382 |
-
$btnUpload.removeAttr('disabled');
|
2383 |
-
$btnDelete.removeAttr('disabled');
|
2384 |
-
self.unlock();
|
2385 |
-
}
|
2386 |
-
self._setProgressCancelled();
|
2387 |
-
}
|
2388 |
-
};
|
2389 |
-
fnSuccess = function (data, textStatus, jqXHR) {
|
2390 |
-
var pid = self.showPreview && $thumb.attr('id') ? $thumb.attr('id') : previewId;
|
2391 |
-
outData = self._getOutData(jqXHR, data);
|
2392 |
-
$.extend(true, params, outData);
|
2393 |
-
setTimeout(function () {
|
2394 |
-
if ($h.isEmpty(data) || $h.isEmpty(data.error)) {
|
2395 |
-
if (self.showPreview) {
|
2396 |
-
self._setThumbStatus($thumb, 'Success');
|
2397 |
-
$btnUpload.hide();
|
2398 |
-
self._initUploadSuccess(data, $thumb, isBatch);
|
2399 |
-
self._setProgress(101, $prog);
|
2400 |
-
}
|
2401 |
-
self._raise('fileuploaded', [outData, pid, i]);
|
2402 |
-
if (!isBatch) {
|
2403 |
-
self.updateStack(i, undefined);
|
2404 |
-
} else {
|
2405 |
-
updateUploadLog(i, pid);
|
2406 |
-
}
|
2407 |
-
} else {
|
2408 |
-
uploadFailed = true;
|
2409 |
-
self._showUploadError(data.error, params);
|
2410 |
-
self._setPreviewError($thumb, i, self.filestack[i], self.retryErrorUploads);
|
2411 |
-
if (!self.retryErrorUploads) {
|
2412 |
-
$btnUpload.hide();
|
2413 |
-
}
|
2414 |
-
if (isBatch) {
|
2415 |
-
updateUploadLog(i, pid);
|
2416 |
-
}
|
2417 |
-
self._setProgress(101, $('#' + pid).find('.file-thumb-progress'), self.msgUploadError);
|
2418 |
-
}
|
2419 |
-
}, 100);
|
2420 |
-
};
|
2421 |
-
fnComplete = function () {
|
2422 |
-
setTimeout(function () {
|
2423 |
-
if (self.showPreview) {
|
2424 |
-
$btnUpload.removeAttr('disabled');
|
2425 |
-
$btnDelete.removeAttr('disabled');
|
2426 |
-
$thumb.removeClass('file-uploading');
|
2427 |
-
}
|
2428 |
-
if (!isBatch) {
|
2429 |
-
self.unlock(false);
|
2430 |
-
self._clearFileInput();
|
2431 |
-
} else {
|
2432 |
-
chkComplete();
|
2433 |
-
}
|
2434 |
-
self._initSuccessThumbs();
|
2435 |
-
}, 100);
|
2436 |
-
};
|
2437 |
-
fnError = function (jqXHR, textStatus, errorThrown) {
|
2438 |
-
var op = self.ajaxOperations.uploadThumb,
|
2439 |
-
errMsg = self._parseError(op, jqXHR, errorThrown, (isBatch && self.filestack[i].name ? self.filestack[i].name : null));
|
2440 |
-
uploadFailed = true;
|
2441 |
-
setTimeout(function () {
|
2442 |
-
if (isBatch) {
|
2443 |
-
updateUploadLog(i, previewId);
|
2444 |
-
}
|
2445 |
-
self.uploadStatus[previewId] = 100;
|
2446 |
-
self._setPreviewError($thumb, i, self.filestack[i], self.retryErrorUploads);
|
2447 |
-
if (!self.retryErrorUploads) {
|
2448 |
-
$btnUpload.hide();
|
2449 |
-
}
|
2450 |
-
$.extend(true, params, self._getOutData(jqXHR));
|
2451 |
-
self._setProgress(101, $prog, self.msgAjaxProgressError.replace('{operation}', op));
|
2452 |
-
self._setProgress(101, $('#' + previewId).find('.file-thumb-progress'), self.msgUploadError);
|
2453 |
-
self._showUploadError(errMsg, params);
|
2454 |
-
}, 100);
|
2455 |
-
};
|
2456 |
-
formdata.append(self.uploadFileAttr, self.filestack[i], self.filenames[i]);
|
2457 |
-
formdata.append('file_id', i);
|
2458 |
-
self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, previewId, i);
|
2459 |
-
},
|
2460 |
-
_uploadBatch: function () {
|
2461 |
-
var self = this, files = self.filestack, total = files.length, params = {}, fnBefore, fnSuccess, fnError,
|
2462 |
-
fnComplete, hasPostData = self.filestack.length > 0 || !$.isEmptyObject(self.uploadExtraData),
|
2463 |
-
setAllUploaded;
|
2464 |
-
self.formdata = new FormData();
|
2465 |
-
if (total === 0 || !hasPostData || self._abort(params)) {
|
2466 |
-
return;
|
2467 |
-
}
|
2468 |
-
setAllUploaded = function () {
|
2469 |
-
$.each(files, function (key) {
|
2470 |
-
self.updateStack(key, undefined);
|
2471 |
-
});
|
2472 |
-
self._clearFileInput();
|
2473 |
-
};
|
2474 |
-
fnBefore = function (jqXHR) {
|
2475 |
-
self.lock();
|
2476 |
-
var outData = self._getOutData(jqXHR);
|
2477 |
-
self.ajaxAborted = false;
|
2478 |
-
if (self.showPreview) {
|
2479 |
-
self._getThumbs().each(function () {
|
2480 |
-
var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'),
|
2481 |
-
$btnDelete = $thumb.find('.kv-file-remove');
|
2482 |
-
if (!$thumb.hasClass('file-preview-success')) {
|
2483 |
-
self._setThumbStatus($thumb, 'Loading');
|
2484 |
-
$h.addCss($thumb, 'file-uploading');
|
2485 |
-
}
|
2486 |
-
$btnUpload.attr('disabled', true);
|
2487 |
-
$btnDelete.attr('disabled', true);
|
2488 |
-
});
|
2489 |
-
}
|
2490 |
-
self._raise('filebatchpreupload', [outData]);
|
2491 |
-
if (self._abort(outData)) {
|
2492 |
-
jqXHR.abort();
|
2493 |
-
self._getThumbs().each(function () {
|
2494 |
-
var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'),
|
2495 |
-
$btnDelete = $thumb.find('.kv-file-remove');
|
2496 |
-
if ($thumb.hasClass('file-preview-loading')) {
|
2497 |
-
self._setThumbStatus($thumb, 'New');
|
2498 |
-
$thumb.removeClass('file-uploading');
|
2499 |
-
}
|
2500 |
-
$btnUpload.removeAttr('disabled');
|
2501 |
-
$btnDelete.removeAttr('disabled');
|
2502 |
-
});
|
2503 |
-
self._setProgressCancelled();
|
2504 |
-
}
|
2505 |
-
};
|
2506 |
-
fnSuccess = function (data, textStatus, jqXHR) {
|
2507 |
-
/** @namespace data.errorkeys */
|
2508 |
-
var outData = self._getOutData(jqXHR, data), key = 0,
|
2509 |
-
$thumbs = self._getThumbs(':not(.file-preview-success)'),
|
2510 |
-
keys = $h.isEmpty(data) || $h.isEmpty(data.errorkeys) ? [] : data.errorkeys;
|
2511 |
-
|
2512 |
-
if ($h.isEmpty(data) || $h.isEmpty(data.error)) {
|
2513 |
-
self._raise('filebatchuploadsuccess', [outData]);
|
2514 |
-
setAllUploaded();
|
2515 |
-
if (self.showPreview) {
|
2516 |
-
$thumbs.each(function () {
|
2517 |
-
var $thumb = $(this);
|
2518 |
-
self._setThumbStatus($thumb, 'Success');
|
2519 |
-
$thumb.removeClass('file-uploading');
|
2520 |
-
$thumb.find('.kv-file-upload').hide().removeAttr('disabled');
|
2521 |
-
});
|
2522 |
-
self._initUploadSuccess(data);
|
2523 |
-
} else {
|
2524 |
-
self.reset();
|
2525 |
-
}
|
2526 |
-
self._setProgress(101);
|
2527 |
-
} else {
|
2528 |
-
if (self.showPreview) {
|
2529 |
-
$thumbs.each(function () {
|
2530 |
-
var $thumb = $(this), i = $thumb.attr('data-fileindex');
|
2531 |
-
$thumb.removeClass('file-uploading');
|
2532 |
-
$thumb.find('.kv-file-upload').removeAttr('disabled');
|
2533 |
-
$thumb.find('.kv-file-remove').removeAttr('disabled');
|
2534 |
-
if (keys.length === 0 || $.inArray(key, keys) !== -1) {
|
2535 |
-
self._setPreviewError($thumb, i, self.filestack[i], self.retryErrorUploads);
|
2536 |
-
if (!self.retryErrorUploads) {
|
2537 |
-
$thumb.find('.kv-file-upload').hide();
|
2538 |
-
self.updateStack(i, undefined);
|
2539 |
-
}
|
2540 |
-
} else {
|
2541 |
-
$thumb.find('.kv-file-upload').hide();
|
2542 |
-
self._setThumbStatus($thumb, 'Success');
|
2543 |
-
self.updateStack(i, undefined);
|
2544 |
-
}
|
2545 |
-
if (!$thumb.hasClass('file-preview-error') || self.retryErrorUploads) {
|
2546 |
-
key++;
|
2547 |
-
}
|
2548 |
-
});
|
2549 |
-
self._initUploadSuccess(data);
|
2550 |
-
}
|
2551 |
-
self._showUploadError(data.error, outData, 'filebatchuploaderror');
|
2552 |
-
self._setProgress(101, self.$progress, self.msgUploadError);
|
2553 |
-
}
|
2554 |
-
};
|
2555 |
-
fnComplete = function () {
|
2556 |
-
self.unlock();
|
2557 |
-
self._initSuccessThumbs();
|
2558 |
-
self._clearFileInput();
|
2559 |
-
self._raise('filebatchuploadcomplete', [self.filestack, self._getExtraData()]);
|
2560 |
-
};
|
2561 |
-
fnError = function (jqXHR, textStatus, errorThrown) {
|
2562 |
-
var outData = self._getOutData(jqXHR), op = self.ajaxOperations.uploadBatch,
|
2563 |
-
errMsg = self._parseError(op, jqXHR, errorThrown);
|
2564 |
-
self._showUploadError(errMsg, outData, 'filebatchuploaderror');
|
2565 |
-
self.uploadFileCount = total - 1;
|
2566 |
-
if (!self.showPreview) {
|
2567 |
-
return;
|
2568 |
-
}
|
2569 |
-
self._getThumbs().each(function () {
|
2570 |
-
var $thumb = $(this), key = $thumb.attr('data-fileindex');
|
2571 |
-
$thumb.removeClass('file-uploading');
|
2572 |
-
if (self.filestack[key] !== undefined) {
|
2573 |
-
self._setPreviewError($thumb);
|
2574 |
-
}
|
2575 |
-
});
|
2576 |
-
self._getThumbs().removeClass('file-uploading');
|
2577 |
-
self._getThumbs(' .kv-file-upload').removeAttr('disabled');
|
2578 |
-
self._getThumbs(' .kv-file-delete').removeAttr('disabled');
|
2579 |
-
self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op));
|
2580 |
-
};
|
2581 |
-
$.each(files, function (key, data) {
|
2582 |
-
if (!$h.isEmpty(files[key])) {
|
2583 |
-
self.formdata.append(self.uploadFileAttr, data, self.filenames[key]);
|
2584 |
-
}
|
2585 |
-
});
|
2586 |
-
self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError);
|
2587 |
-
},
|
2588 |
-
_uploadExtraOnly: function () {
|
2589 |
-
var self = this, params = {}, fnBefore, fnSuccess, fnComplete, fnError;
|
2590 |
-
self.formdata = new FormData();
|
2591 |
-
if (self._abort(params)) {
|
2592 |
-
return;
|
2593 |
-
}
|
2594 |
-
fnBefore = function (jqXHR) {
|
2595 |
-
self.lock();
|
2596 |
-
var outData = self._getOutData(jqXHR);
|
2597 |
-
self._raise('filebatchpreupload', [outData]);
|
2598 |
-
self._setProgress(50);
|
2599 |
-
params.data = outData;
|
2600 |
-
params.xhr = jqXHR;
|
2601 |
-
if (self._abort(params)) {
|
2602 |
-
jqXHR.abort();
|
2603 |
-
self._setProgressCancelled();
|
2604 |
-
}
|
2605 |
-
};
|
2606 |
-
fnSuccess = function (data, textStatus, jqXHR) {
|
2607 |
-
var outData = self._getOutData(jqXHR, data);
|
2608 |
-
if ($h.isEmpty(data) || $h.isEmpty(data.error)) {
|
2609 |
-
self._raise('filebatchuploadsuccess', [outData]);
|
2610 |
-
self._clearFileInput();
|
2611 |
-
self._initUploadSuccess(data);
|
2612 |
-
self._setProgress(101);
|
2613 |
-
} else {
|
2614 |
-
self._showUploadError(data.error, outData, 'filebatchuploaderror');
|
2615 |
-
}
|
2616 |
-
};
|
2617 |
-
fnComplete = function () {
|
2618 |
-
self.unlock();
|
2619 |
-
self._clearFileInput();
|
2620 |
-
self._raise('filebatchuploadcomplete', [self.filestack, self._getExtraData()]);
|
2621 |
-
};
|
2622 |
-
fnError = function (jqXHR, textStatus, errorThrown) {
|
2623 |
-
var outData = self._getOutData(jqXHR), op = self.ajaxOperations.uploadExtra,
|
2624 |
-
errMsg = self._parseError(op, jqXHR, errorThrown);
|
2625 |
-
params.data = outData;
|
2626 |
-
self._showUploadError(errMsg, outData, 'filebatchuploaderror');
|
2627 |
-
self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op));
|
2628 |
-
};
|
2629 |
-
self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError);
|
2630 |
-
},
|
2631 |
-
_deleteFileIndex: function ($frame) {
|
2632 |
-
var self = this, ind = $frame.attr('data-fileindex'), rev = self.reversePreviewOrder;
|
2633 |
-
if (ind.substring(0, 5) === 'init_') {
|
2634 |
-
ind = parseInt(ind.replace('init_', ''));
|
2635 |
-
self.initialPreview = $h.spliceArray(self.initialPreview, ind, rev);
|
2636 |
-
self.initialPreviewConfig = $h.spliceArray(self.initialPreviewConfig, ind, rev);
|
2637 |
-
self.initialPreviewThumbTags = $h.spliceArray(self.initialPreviewThumbTags, ind, rev);
|
2638 |
-
self.getFrames().each(function () {
|
2639 |
-
var $nFrame = $(this), nInd = $nFrame.attr('data-fileindex');
|
2640 |
-
if (nInd.substring(0, 5) === 'init_') {
|
2641 |
-
nInd = parseInt(nInd.replace('init_', ''));
|
2642 |
-
if (nInd > ind) {
|
2643 |
-
nInd--;
|
2644 |
-
$nFrame.attr('data-fileindex', 'init_' + nInd);
|
2645 |
-
}
|
2646 |
-
}
|
2647 |
-
});
|
2648 |
-
if (self.uploadAsync) {
|
2649 |
-
self.cacheInitialPreview = self.getPreview();
|
2650 |
-
}
|
2651 |
-
}
|
2652 |
-
},
|
2653 |
-
_initFileActions: function () {
|
2654 |
-
var self = this, $preview = self.$preview;
|
2655 |
-
if (!self.showPreview) {
|
2656 |
-
return;
|
2657 |
-
}
|
2658 |
-
self._initZoomButton();
|
2659 |
-
self.getFrames(' .kv-file-remove').each(function () {
|
2660 |
-
var $el = $(this), $frame = $el.closest($h.FRAMES), hasError, id = $frame.attr('id'),
|
2661 |
-
ind = $frame.attr('data-fileindex'), n, cap, status;
|
2662 |
-
self._handler($el, 'click', function () {
|
2663 |
-
status = self._raise('filepreremove', [id, ind]);
|
2664 |
-
if (status === false || !self._validateMinCount()) {
|
2665 |
-
return false;
|
2666 |
-
}
|
2667 |
-
hasError = $frame.hasClass('file-preview-error');
|
2668 |
-
$h.cleanMemory($frame);
|
2669 |
-
$frame.fadeOut('slow', function () {
|
2670 |
-
$h.cleanZoomCache($preview.find('#zoom-' + id));
|
2671 |
-
self.updateStack(ind, undefined);
|
2672 |
-
self._clearObjects($frame);
|
2673 |
-
$frame.remove();
|
2674 |
-
if (id && hasError) {
|
2675 |
-
self.$errorContainer.find('li[data-file-id="' + id + '"]').fadeOut('fast', function () {
|
2676 |
-
$(this).remove();
|
2677 |
-
if (!self._errorsExist()) {
|
2678 |
-
self._resetErrors();
|
2679 |
-
}
|
2680 |
-
});
|
2681 |
-
}
|
2682 |
-
self._clearFileInput();
|
2683 |
-
var filestack = self.getFileStack(true), chk = self.previewCache.count(),
|
2684 |
-
len = filestack.length, hasThumb = self.showPreview && self.getFrames().length;
|
2685 |
-
if (len === 0 && chk === 0 && !hasThumb) {
|
2686 |
-
self.reset();
|
2687 |
-
} else {
|
2688 |
-
n = chk + len;
|
2689 |
-
cap = n > 1 ? self._getMsgSelected(n) : (filestack[0] ? self._getFileNames()[0] : '');
|
2690 |
-
self._setCaption(cap);
|
2691 |
-
}
|
2692 |
-
self._raise('fileremoved', [id, ind]);
|
2693 |
-
});
|
2694 |
-
});
|
2695 |
-
});
|
2696 |
-
self.getFrames(' .kv-file-upload').each(function () {
|
2697 |
-
var $el = $(this);
|
2698 |
-
self._handler($el, 'click', function () {
|
2699 |
-
var $frame = $el.closest($h.FRAMES), ind = $frame.attr('data-fileindex');
|
2700 |
-
self.$progress.hide();
|
2701 |
-
if ($frame.hasClass('file-preview-error') && !self.retryErrorUploads) {
|
2702 |
-
return;
|
2703 |
-
}
|
2704 |
-
self._uploadSingle(ind, false);
|
2705 |
-
});
|
2706 |
-
});
|
2707 |
-
},
|
2708 |
-
_initPreviewActions: function () {
|
2709 |
-
var self = this, $preview = self.$preview, deleteExtraData = self.deleteExtraData || {},
|
2710 |
-
btnRemove = $h.FRAMES + ' .kv-file-remove', settings = self.fileActionSettings,
|
2711 |
-
origClass = settings.removeClass, errClass = settings.removeErrorClass,
|
2712 |
-
resetProgress = function () {
|
2713 |
-
var hasFiles = self.isAjaxUpload ? self.previewCache.count() : self._inputFileCount();
|
2714 |
-
if (!$preview.find($h.FRAMES).length && !hasFiles) {
|
2715 |
-
self._setCaption('');
|
2716 |
-
self.reset();
|
2717 |
-
self.initialCaption = '';
|
2718 |
-
}
|
2719 |
-
};
|
2720 |
-
self._initZoomButton();
|
2721 |
-
$preview.find(btnRemove).each(function () {
|
2722 |
-
var $el = $(this), vUrl = $el.data('url') || self.deleteUrl, vKey = $el.data('key'),
|
2723 |
-
fnBefore, fnSuccess, fnError;
|
2724 |
-
if ($h.isEmpty(vUrl) || vKey === undefined) {
|
2725 |
-
return;
|
2726 |
-
}
|
2727 |
-
var $frame = $el.closest($h.FRAMES), cache = self.previewCache.data,
|
2728 |
-
settings, params, index = $frame.attr('data-fileindex'), config, extraData;
|
2729 |
-
index = parseInt(index.replace('init_', ''));
|
2730 |
-
config = $h.isEmpty(cache.config) && $h.isEmpty(cache.config[index]) ? null : cache.config[index];
|
2731 |
-
extraData = $h.isEmpty(config) || $h.isEmpty(config.extra) ? deleteExtraData : config.extra;
|
2732 |
-
if (typeof extraData === "function") {
|
2733 |
-
extraData = extraData();
|
2734 |
-
}
|
2735 |
-
params = {id: $el.attr('id'), key: vKey, extra: extraData};
|
2736 |
-
fnBefore = function (jqXHR) {
|
2737 |
-
self.ajaxAborted = false;
|
2738 |
-
self._raise('filepredelete', [vKey, jqXHR, extraData]);
|
2739 |
-
if (self._abort()) {
|
2740 |
-
jqXHR.abort();
|
2741 |
-
} else {
|
2742 |
-
$el.removeClass(errClass);
|
2743 |
-
$h.addCss($frame, 'file-uploading');
|
2744 |
-
$h.addCss($el, 'disabled ' + origClass);
|
2745 |
-
}
|
2746 |
-
};
|
2747 |
-
fnSuccess = function (data, textStatus, jqXHR) {
|
2748 |
-
var n, cap;
|
2749 |
-
if (!$h.isEmpty(data) && !$h.isEmpty(data.error)) {
|
2750 |
-
params.jqXHR = jqXHR;
|
2751 |
-
params.response = data;
|
2752 |
-
self._showError(data.error, params, 'filedeleteerror');
|
2753 |
-
$frame.removeClass('file-uploading');
|
2754 |
-
$el.removeClass('disabled ' + origClass).addClass(errClass);
|
2755 |
-
resetProgress();
|
2756 |
-
return;
|
2757 |
-
}
|
2758 |
-
$frame.removeClass('file-uploading').addClass('file-deleted');
|
2759 |
-
$frame.fadeOut('slow', function () {
|
2760 |
-
index = parseInt(($frame.attr('data-fileindex')).replace('init_', ''));
|
2761 |
-
self.previewCache.unset(index);
|
2762 |
-
self._deleteFileIndex($frame);
|
2763 |
-
n = self.previewCache.count();
|
2764 |
-
cap = n > 0 ? self._getMsgSelected(n) : '';
|
2765 |
-
self._setCaption(cap);
|
2766 |
-
self._raise('filedeleted', [vKey, jqXHR, extraData]);
|
2767 |
-
$h.cleanZoomCache($preview.find('#zoom-' + $frame.attr('id')));
|
2768 |
-
self._clearObjects($frame);
|
2769 |
-
$frame.remove();
|
2770 |
-
resetProgress();
|
2771 |
-
});
|
2772 |
-
};
|
2773 |
-
fnError = function (jqXHR, textStatus, errorThrown) {
|
2774 |
-
var op = self.ajaxOperations.deleteThumb, errMsg = self._parseError(op, jqXHR, errorThrown);
|
2775 |
-
params.jqXHR = jqXHR;
|
2776 |
-
params.response = {};
|
2777 |
-
self._showError(errMsg, params, 'filedeleteerror');
|
2778 |
-
$frame.removeClass('file-uploading');
|
2779 |
-
$el.removeClass('disabled ' + origClass).addClass(errClass);
|
2780 |
-
resetProgress();
|
2781 |
-
};
|
2782 |
-
self._initAjaxSettings();
|
2783 |
-
self._mergeAjaxCallback('beforeSend', fnBefore, 'delete');
|
2784 |
-
self._mergeAjaxCallback('success', fnSuccess, 'delete');
|
2785 |
-
self._mergeAjaxCallback('error', fnError, 'delete');
|
2786 |
-
settings = $.extend(true, {}, {
|
2787 |
-
url: vUrl,
|
2788 |
-
type: 'POST',
|
2789 |
-
dataType: 'json',
|
2790 |
-
data: $.extend(true, {}, {key: vKey}, extraData)
|
2791 |
-
}, self._ajaxDeleteSettings);
|
2792 |
-
self._handler($el, 'click', function () {
|
2793 |
-
if (!self._validateMinCount()) {
|
2794 |
-
return false;
|
2795 |
-
}
|
2796 |
-
self.ajaxAborted = false;
|
2797 |
-
self._raise('filebeforedelete', [vKey, extraData]);
|
2798 |
-
//noinspection JSUnresolvedVariable,JSHint
|
2799 |
-
if (self.ajaxAborted instanceof Promise) {
|
2800 |
-
self.ajaxAborted.then(function (result) {
|
2801 |
-
if (!result) {
|
2802 |
-
$.ajax(settings);
|
2803 |
-
}
|
2804 |
-
});
|
2805 |
-
} else {
|
2806 |
-
if (!self.ajaxAborted) {
|
2807 |
-
$.ajax(settings);
|
2808 |
-
}
|
2809 |
-
}
|
2810 |
-
});
|
2811 |
-
});
|
2812 |
-
},
|
2813 |
-
_hideFileIcon: function () {
|
2814 |
-
var self = this;
|
2815 |
-
if (self.overwriteInitial) {
|
2816 |
-
self.$captionContainer.removeClass('icon-visible');
|
2817 |
-
}
|
2818 |
-
},
|
2819 |
-
_showFileIcon: function () {
|
2820 |
-
var self = this;
|
2821 |
-
$h.addCss(self.$captionContainer, 'icon-visible');
|
2822 |
-
},
|
2823 |
-
_getSize: function (bytes) {
|
2824 |
-
var self = this, size = parseFloat(bytes), i, func = self.fileSizeGetter, sizes, out;
|
2825 |
-
if (!$.isNumeric(bytes) || !$.isNumeric(size)) {
|
2826 |
-
return '';
|
2827 |
-
}
|
2828 |
-
if (typeof func === 'function') {
|
2829 |
-
out = func(size);
|
2830 |
-
} else {
|
2831 |
-
if (size === 0) {
|
2832 |
-
out = '0.00 B';
|
2833 |
-
} else {
|
2834 |
-
i = Math.floor(Math.log(size) / Math.log(1024));
|
2835 |
-
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
2836 |
-
out = (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i];
|
2837 |
-
}
|
2838 |
-
}
|
2839 |
-
return self._getLayoutTemplate('size').replace('{sizeText}', out);
|
2840 |
-
},
|
2841 |
-
_generatePreviewTemplate: function (cat, data, fname, ftype, previewId, isError, size, frameClass, foot, ind, templ) {
|
2842 |
-
var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '',
|
2843 |
-
screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
|
2844 |
-
config = screenW < 400 ? (self.previewSettingsSmall[cat] || self.defaults.previewSettingsSmall[cat]) :
|
2845 |
-
(self.previewSettings[cat] || self.defaults.previewSettings[cat]),
|
2846 |
-
footer = foot || self._renderFileFooter(caption, size, 'auto', isError),
|
2847 |
-
hasIconSetting = self._getPreviewIcon(fname), typeCss = 'type-default',
|
2848 |
-
forcePrevIcon = hasIconSetting && self.preferIconicPreview,
|
2849 |
-
forceZoomIcon = hasIconSetting && self.preferIconicZoomPreview, getContent;
|
2850 |
-
if (config) {
|
2851 |
-
$.each(config, function (key, val) {
|
2852 |
-
styleAttribs += key + ':' + val + ';';
|
2853 |
-
});
|
2854 |
-
}
|
2855 |
-
getContent = function (c, d, zoom, frameCss) {
|
2856 |
-
var id = zoom ? 'zoom-' + previewId : previewId, tmplt = self._getPreviewTemplate(c),
|
2857 |
-
css = (frameClass || '') + ' ' + frameCss;
|
2858 |
-
if (self.frameClass) {
|
2859 |
-
css = self.frameClass + ' ' + css;
|
2860 |
-
}
|
2861 |
-
if (zoom) {
|
2862 |
-
css = css.replace(' ' + $h.SORT_CSS, '');
|
2863 |
-
}
|
2864 |
-
tmplt = self._parseFilePreviewIcon(tmplt, fname);
|
2865 |
-
if (c === 'text') {
|
2866 |
-
d = $h.htmlEncode(d);
|
2867 |
-
}
|
2868 |
-
if (cat === 'object' && !ftype) {
|
2869 |
-
$.each(self.defaults.fileTypeSettings, function (key, func) {
|
2870 |
-
if (key === 'object' || key === 'other') {
|
2871 |
-
return;
|
2872 |
-
}
|
2873 |
-
if (func(fname, ftype)) {
|
2874 |
-
typeCss = 'type-' + key;
|
2875 |
-
}
|
2876 |
-
});
|
2877 |
-
}
|
2878 |
-
return tmplt.setTokens({
|
2879 |
-
'previewId': id,
|
2880 |
-
'caption': caption,
|
2881 |
-
'frameClass': css,
|
2882 |
-
'type': ftype,
|
2883 |
-
'fileindex': ind,
|
2884 |
-
'typeCss': typeCss,
|
2885 |
-
'footer': footer,
|
2886 |
-
'data': d,
|
2887 |
-
'template': templ || cat,
|
2888 |
-
'style': styleAttribs ? 'style="' + styleAttribs + '"' : ''
|
2889 |
-
});
|
2890 |
-
};
|
2891 |
-
ind = ind || previewId.slice(previewId.lastIndexOf('-') + 1);
|
2892 |
-
if (self.fileActionSettings.showZoom) {
|
2893 |
-
zoomContent = getContent((forceZoomIcon ? 'other' : cat), data, true, 'kv-zoom-thumb');
|
2894 |
-
}
|
2895 |
-
zoomContent = '\n' + self._getLayoutTemplate('zoomCache').replace('{zoomContent}', zoomContent);
|
2896 |
-
prevContent = getContent((forcePrevIcon ? 'other' : cat), data, false, 'kv-preview-thumb');
|
2897 |
-
return prevContent + zoomContent;
|
2898 |
-
},
|
2899 |
-
_addToPreview: function ($preview, content) {
|
2900 |
-
var self = this;
|
2901 |
-
return self.reversePreviewOrder ? $preview.prepend(content) : $preview.append(content);
|
2902 |
-
},
|
2903 |
-
_previewDefault: function (file, previewId, isDisabled) {
|
2904 |
-
var self = this, $preview = self.$preview;
|
2905 |
-
if (!self.showPreview) {
|
2906 |
-
return;
|
2907 |
-
}
|
2908 |
-
var fname = file ? file.name : '', ftype = file ? file.type : '', content, size = file.size || 0,
|
2909 |
-
caption = self.slug(fname), isError = isDisabled === true && !self.isAjaxUpload,
|
2910 |
-
data = $h.objUrl.createObjectURL(file);
|
2911 |
-
self._clearDefaultPreview();
|
2912 |
-
content = self._generatePreviewTemplate('other', data, fname, ftype, previewId, isError, size);
|
2913 |
-
self._addToPreview($preview, content);
|
2914 |
-
self._setThumbAttr(previewId, caption, size);
|
2915 |
-
if (isDisabled === true && self.isAjaxUpload) {
|
2916 |
-
self._setThumbStatus($('#' + previewId), 'Error');
|
2917 |
-
}
|
2918 |
-
},
|
2919 |
-
_previewFile: function (i, file, theFile, previewId, data, fileInfo) {
|
2920 |
-
if (!this.showPreview) {
|
2921 |
-
return;
|
2922 |
-
}
|
2923 |
-
var self = this, fname = file ? file.name : '', ftype = fileInfo.type, caption = fileInfo.name,
|
2924 |
-
cat = self._parseFileType(ftype, fname), types = self.allowedPreviewTypes, content,
|
2925 |
-
mimes = self.allowedPreviewMimeTypes, $preview = self.$preview, fsize = file.size || 0,
|
2926 |
-
chkTypes = types && types.indexOf(cat) >= 0, chkMimes = mimes && mimes.indexOf(ftype) !== -1,
|
2927 |
-
iData = (cat === 'text' || cat === 'html' || cat === 'image') ? theFile.target.result : data;
|
2928 |
-
/** @namespace window.DOMPurify */
|
2929 |
-
if (cat === 'html' && self.purifyHtml && window.DOMPurify) {
|
2930 |
-
iData = window.DOMPurify.sanitize(iData);
|
2931 |
-
}
|
2932 |
-
if (chkTypes || chkMimes) {
|
2933 |
-
content = self._generatePreviewTemplate(cat, iData, fname, ftype, previewId, false, fsize);
|
2934 |
-
self._clearDefaultPreview();
|
2935 |
-
self._addToPreview($preview, content);
|
2936 |
-
var $img = $preview.find('#' + previewId + ' img');
|
2937 |
-
self._validateImageOrientation($img, file, previewId, caption, ftype, fsize, iData);
|
2938 |
-
} else {
|
2939 |
-
self._previewDefault(file, previewId);
|
2940 |
-
}
|
2941 |
-
self._setThumbAttr(previewId, caption, fsize);
|
2942 |
-
self._initSortable();
|
2943 |
-
},
|
2944 |
-
_setThumbAttr: function (id, caption, size) {
|
2945 |
-
var self = this, $frame = $('#' + id);
|
2946 |
-
if ($frame.length) {
|
2947 |
-
size = size && size > 0 ? self._getSize(size) : '';
|
2948 |
-
$frame.data({'caption': caption, 'size': size});
|
2949 |
-
}
|
2950 |
-
},
|
2951 |
-
_setInitThumbAttr: function () {
|
2952 |
-
var self = this, data = self.previewCache.data, len = self.previewCache.count(), config,
|
2953 |
-
caption, size, previewId;
|
2954 |
-
if (len === 0) {
|
2955 |
-
return;
|
2956 |
-
}
|
2957 |
-
for (var i = 0; i < len; i++) {
|
2958 |
-
config = data.config[i];
|
2959 |
-
previewId = self.previewInitId + '-' + 'init_' + i;
|
2960 |
-
caption = $h.ifSet('caption', config, $h.ifSet('filename', config));
|
2961 |
-
size = $h.ifSet('size', config);
|
2962 |
-
self._setThumbAttr(previewId, caption, size);
|
2963 |
-
}
|
2964 |
-
},
|
2965 |
-
_slugDefault: function (text) {
|
2966 |
-
// noinspection RegExpRedundantEscape
|
2967 |
-
return $h.isEmpty(text) ? '' : String(text).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g, '_');
|
2968 |
-
},
|
2969 |
-
_updateFileDetails: function (numFiles) {
|
2970 |
-
var self = this, $el = self.$element, fileStack = self.getFileStack(),
|
2971 |
-
name = ($h.isIE(9) && $h.findFileName($el.val())) ||
|
2972 |
-
($el[0].files[0] && $el[0].files[0].name) || (fileStack.length && fileStack[0].name) || '',
|
2973 |
-
label = self.slug(name), n = self.isAjaxUpload ? fileStack.length : numFiles,
|
2974 |
-
nFiles = self.previewCache.count() + n, log = n === 1 ? label : self._getMsgSelected(nFiles);
|
2975 |
-
if (self.isError) {
|
2976 |
-
self.$previewContainer.removeClass('file-thumb-loading');
|
2977 |
-
self.$previewStatus.html('');
|
2978 |
-
self.$captionContainer.removeClass('icon-visible');
|
2979 |
-
} else {
|
2980 |
-
self._showFileIcon();
|
2981 |
-
}
|
2982 |
-
self._setCaption(log, self.isError);
|
2983 |
-
self.$container.removeClass('file-input-new file-input-ajax-new');
|
2984 |
-
if (arguments.length === 1) {
|
2985 |
-
self._raise('fileselect', [numFiles, label]);
|
2986 |
-
}
|
2987 |
-
if (self.previewCache.count()) {
|
2988 |
-
self._initPreviewActions();
|
2989 |
-
}
|
2990 |
-
},
|
2991 |
-
_setThumbStatus: function ($thumb, status) {
|
2992 |
-
var self = this;
|
2993 |
-
if (!self.showPreview) {
|
2994 |
-
return;
|
2995 |
-
}
|
2996 |
-
var icon = 'indicator' + status, msg = icon + 'Title',
|
2997 |
-
css = 'file-preview-' + status.toLowerCase(),
|
2998 |
-
$indicator = $thumb.find('.file-upload-indicator'),
|
2999 |
-
config = self.fileActionSettings;
|
3000 |
-
$thumb.removeClass('file-preview-success file-preview-error file-preview-loading');
|
3001 |
-
if (status === 'Success') {
|
3002 |
-
$thumb.find('.file-drag-handle').remove();
|
3003 |
-
}
|
3004 |
-
$indicator.html(config[icon]);
|
3005 |
-
$indicator.attr('title', config[msg]);
|
3006 |
-
$thumb.addClass(css);
|
3007 |
-
if (status === 'Error' && !self.retryErrorUploads) {
|
3008 |
-
$thumb.find('.kv-file-upload').attr('disabled', true);
|
3009 |
-
}
|
3010 |
-
},
|
3011 |
-
_setProgressCancelled: function () {
|
3012 |
-
var self = this;
|
3013 |
-
self._setProgress(101, self.$progress, self.msgCancelled);
|
3014 |
-
},
|
3015 |
-
_setProgress: function (p, $el, error) {
|
3016 |
-
var self = this, pct = Math.min(p, 100), out, pctLimit = self.progressUploadThreshold,
|
3017 |
-
t = p <= 100 ? self.progressTemplate : self.progressCompleteTemplate,
|
3018 |
-
template = pct < 100 ? self.progressTemplate : (error ? self.progressErrorTemplate : t);
|
3019 |
-
$el = $el || self.$progress;
|
3020 |
-
if (!$h.isEmpty(template)) {
|
3021 |
-
if (pctLimit && pct > pctLimit && p <= 100) {
|
3022 |
-
out = template.setTokens({'percent': pctLimit, 'status': self.msgUploadThreshold});
|
3023 |
-
} else {
|
3024 |
-
out = template.setTokens({'percent': pct, 'status': (p > 100 ? self.msgUploadEnd : pct + '%')});
|
3025 |
-
}
|
3026 |
-
$el.html(out);
|
3027 |
-
if (error) {
|
3028 |
-
$el.find('[role="progressbar"]').html(error);
|
3029 |
-
}
|
3030 |
-
}
|
3031 |
-
},
|
3032 |
-
_setFileDropZoneTitle: function () {
|
3033 |
-
var self = this, $zone = self.$container.find('.file-drop-zone'), title = self.dropZoneTitle, strFiles;
|
3034 |
-
if (self.isClickable) {
|
3035 |
-
strFiles = $h.isEmpty(self.$element.attr('multiple')) ? self.fileSingle : self.filePlural;
|
3036 |
-
title += self.dropZoneClickTitle.replace('{files}', strFiles);
|
3037 |
-
}
|
3038 |
-
$zone.find('.' + self.dropZoneTitleClass).remove();
|
3039 |
-
if (!self.showPreview || $zone.length === 0 || self.getFileStack().length > 0 || !self.dropZoneEnabled ||
|
3040 |
-
(!self.isAjaxUpload && self.$element.files)) {
|
3041 |
-
return;
|
3042 |
-
}
|
3043 |
-
if ($zone.find($h.FRAMES).length === 0 && $h.isEmpty(self.defaultPreviewContent)) {
|
3044 |
-
$zone.prepend('<div class="' + self.dropZoneTitleClass + '">' + title + '</div>');
|
3045 |
-
}
|
3046 |
-
self.$container.removeClass('file-input-new');
|
3047 |
-
$h.addCss(self.$container, 'file-input-ajax-new');
|
3048 |
-
},
|
3049 |
-
_setAsyncUploadStatus: function (previewId, pct, total) {
|
3050 |
-
var self = this, sum = 0;
|
3051 |
-
self._setProgress(pct, $('#' + previewId).find('.file-thumb-progress'));
|
3052 |
-
self.uploadStatus[previewId] = pct;
|
3053 |
-
$.each(self.uploadStatus, function (key, value) {
|
3054 |
-
sum += value;
|
3055 |
-
});
|
3056 |
-
self._setProgress(Math.floor(sum / total));
|
3057 |
-
},
|
3058 |
-
_validateMinCount: function () {
|
3059 |
-
var self = this, len = self.isAjaxUpload ? self.getFileStack().length : self._inputFileCount();
|
3060 |
-
if (self.validateInitialCount && self.minFileCount > 0 && self._getFileCount(len - 1) < self.minFileCount) {
|
3061 |
-
self._noFilesError({});
|
3062 |
-
return false;
|
3063 |
-
}
|
3064 |
-
return true;
|
3065 |
-
},
|
3066 |
-
_getFileCount: function (fileCount) {
|
3067 |
-
var self = this, addCount = 0;
|
3068 |
-
if (self.validateInitialCount && !self.overwriteInitial) {
|
3069 |
-
addCount = self.previewCache.count();
|
3070 |
-
fileCount += addCount;
|
3071 |
-
}
|
3072 |
-
return fileCount;
|
3073 |
-
},
|
3074 |
-
_getFileId: function (file) {
|
3075 |
-
var self = this, custom = self.generateFileId, relativePath;
|
3076 |
-
if (typeof custom === 'function') {
|
3077 |
-
return custom(file, event);
|
3078 |
-
}
|
3079 |
-
if (!file) {
|
3080 |
-
return null;
|
3081 |
-
}
|
3082 |
-
/** @namespace file.webkitRelativePath */
|
3083 |
-
/** @namespace file.fileName */
|
3084 |
-
relativePath = String(file.webkitRelativePath || file.fileName || file.name || null);
|
3085 |
-
if (!relativePath) {
|
3086 |
-
return null;
|
3087 |
-
}
|
3088 |
-
return (file.size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''));
|
3089 |
-
},
|
3090 |
-
_getFileName: function (file) {
|
3091 |
-
return file && file.name ? this.slug(file.name) : undefined;
|
3092 |
-
},
|
3093 |
-
_getFileIds: function (skipNull) {
|
3094 |
-
var self = this;
|
3095 |
-
return self.fileids.filter(function (n) {
|
3096 |
-
return (skipNull ? n !== undefined : n !== undefined && n !== null);
|
3097 |
-
});
|
3098 |
-
},
|
3099 |
-
_getFileNames: function (skipNull) {
|
3100 |
-
var self = this;
|
3101 |
-
return self.filenames.filter(function (n) {
|
3102 |
-
return (skipNull ? n !== undefined : n !== undefined && n !== null);
|
3103 |
-
});
|
3104 |
-
},
|
3105 |
-
_setPreviewError: function ($thumb, i, val, repeat) {
|
3106 |
-
var self = this;
|
3107 |
-
if (i !== undefined) {
|
3108 |
-
self.updateStack(i, val);
|
3109 |
-
}
|
3110 |
-
if (!self.showPreview) {
|
3111 |
-
return;
|
3112 |
-
}
|
3113 |
-
if (self.removeFromPreviewOnError && !repeat) {
|
3114 |
-
$thumb.remove();
|
3115 |
-
return;
|
3116 |
-
} else {
|
3117 |
-
self._setThumbStatus($thumb, 'Error');
|
3118 |
-
}
|
3119 |
-
self._refreshUploadButton($thumb, repeat);
|
3120 |
-
},
|
3121 |
-
_refreshUploadButton: function ($thumb, repeat) {
|
3122 |
-
var self = this, $btn = $thumb.find('.kv-file-upload'), cfg = self.fileActionSettings,
|
3123 |
-
icon = cfg.uploadIcon, title = cfg.uploadTitle;
|
3124 |
-
if (!$btn.length) {
|
3125 |
-
return;
|
3126 |
-
}
|
3127 |
-
if (repeat) {
|
3128 |
-
icon = cfg.uploadRetryIcon;
|
3129 |
-
title = cfg.uploadRetryTitle;
|
3130 |
-
}
|
3131 |
-
$btn.attr('title', title).html(icon);
|
3132 |
-
},
|
3133 |
-
_checkDimensions: function (i, chk, $img, $thumb, fname, type, params) {
|
3134 |
-
var self = this, msg, dim, tag = chk === 'Small' ? 'min' : 'max', limit = self[tag + 'Image' + type],
|
3135 |
-
$imgEl, isValid;
|
3136 |
-
if ($h.isEmpty(limit) || !$img.length) {
|
3137 |
-
return;
|
3138 |
-
}
|
3139 |
-
$imgEl = $img[0];
|
3140 |
-
dim = (type === 'Width') ? $imgEl.naturalWidth || $imgEl.width : $imgEl.naturalHeight || $imgEl.height;
|
3141 |
-
isValid = chk === 'Small' ? dim >= limit : dim <= limit;
|
3142 |
-
if (isValid) {
|
3143 |
-
return;
|
3144 |
-
}
|
3145 |
-
msg = self['msgImage' + type + chk].setTokens({'name': fname, 'size': limit});
|
3146 |
-
self._showUploadError(msg, params);
|
3147 |
-
self._setPreviewError($thumb, i, null);
|
3148 |
-
},
|
3149 |
-
_getExifObj: function (iData) {
|
3150 |
-
var self = this, exifObj = null;
|
3151 |
-
try {
|
3152 |
-
exifObj = window.piexif ? window.piexif.load(iData) : null;
|
3153 |
-
} catch (err) {
|
3154 |
-
exifObj = null;
|
3155 |
-
}
|
3156 |
-
if (!exifObj) {
|
3157 |
-
self._log('Error loading the piexif.js library.');
|
3158 |
-
}
|
3159 |
-
return exifObj;
|
3160 |
-
},
|
3161 |
-
_validateImageOrientation: function ($img, file, previewId, caption, ftype, fsize, iData) {
|
3162 |
-
var self = this, exifObj = self._getExifObj(iData), value = null;
|
3163 |
-
if ($img.length && self.autoOrientImage && exifObj) {
|
3164 |
-
value = exifObj["0th"][piexif.ImageIFD.Orientation]; // jshint ignore:line
|
3165 |
-
}
|
3166 |
-
if (!value) {
|
3167 |
-
self._validateImage(previewId, caption, ftype, fsize, iData, exifObj);
|
3168 |
-
return;
|
3169 |
-
}
|
3170 |
-
$h.setImageOrientation($img, self.$preview.find('#zoom-' + previewId + ' img'), value);
|
3171 |
-
self._raise('fileimageoriented', {'$img': $img, 'file': file});
|
3172 |
-
self._validateImage(previewId, caption, ftype, fsize, iData, exifObj);
|
3173 |
-
},
|
3174 |
-
_validateImage: function (previewId, fname, ftype, fsize, iData, exifObj) {
|
3175 |
-
var self = this, $preview = self.$preview, params, w1, w2, $thumb = $preview.find("#" + previewId),
|
3176 |
-
i = $thumb.attr('data-fileindex'), $img = $thumb.find('img');
|
3177 |
-
fname = fname || 'Untitled';
|
3178 |
-
$img.one('load', function () {
|
3179 |
-
w1 = $thumb.width();
|
3180 |
-
w2 = $preview.width();
|
3181 |
-
if (w1 > w2) {
|
3182 |
-
$img.css('width', '100%');
|
3183 |
-
}
|
3184 |
-
params = {ind: i, id: previewId};
|
3185 |
-
self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Width', params);
|
3186 |
-
self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Height', params);
|
3187 |
-
if (!self.resizeImage) {
|
3188 |
-
self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Width', params);
|
3189 |
-
self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Height', params);
|
3190 |
-
}
|
3191 |
-
self._raise('fileimageloaded', [previewId]);
|
3192 |
-
self.loadedImages.push({
|
3193 |
-
ind: i,
|
3194 |
-
img: $img,
|
3195 |
-
thumb: $thumb,
|
3196 |
-
pid: previewId,
|
3197 |
-
typ: ftype,
|
3198 |
-
siz: fsize,
|
3199 |
-
validated: false,
|
3200 |
-
imgData: iData,
|
3201 |
-
exifObj: exifObj
|
3202 |
-
});
|
3203 |
-
$thumb.data('exif', exifObj);
|
3204 |
-
self._validateAllImages();
|
3205 |
-
}).one('error', function () {
|
3206 |
-
self._raise('fileimageloaderror', [previewId]);
|
3207 |
-
}).each(function () {
|
3208 |
-
if (this.complete) {
|
3209 |
-
$(this).trigger('load');
|
3210 |
-
} else {
|
3211 |
-
if (this.error) {
|
3212 |
-
$(this).trigger('error');
|
3213 |
-
}
|
3214 |
-
}
|
3215 |
-
});
|
3216 |
-
},
|
3217 |
-
_validateAllImages: function () {
|
3218 |
-
var self = this, i, counter = {val: 0}, numImgs = self.loadedImages.length, config,
|
3219 |
-
fsize, minSize = self.resizeIfSizeMoreThan;
|
3220 |
-
if (numImgs !== self.totalImagesCount) {
|
3221 |
-
return;
|
3222 |
-
}
|
3223 |
-
self._raise('fileimagesloaded');
|
3224 |
-
if (!self.resizeImage) {
|
3225 |
-
return;
|
3226 |
-
}
|
3227 |
-
for (i = 0; i < self.loadedImages.length; i++) {
|
3228 |
-
config = self.loadedImages[i];
|
3229 |
-
if (config.validated) {
|
3230 |
-
continue;
|
3231 |
-
}
|
3232 |
-
fsize = config.siz;
|
3233 |
-
if (fsize && fsize > minSize * 1000) {
|
3234 |
-
self._getResizedImage(config, counter, numImgs);
|
3235 |
-
}
|
3236 |
-
self.loadedImages[i].validated = true;
|
3237 |
-
}
|
3238 |
-
},
|
3239 |
-
_getResizedImage: function (config, counter, numImgs) {
|
3240 |
-
var self = this, img = $(config.img)[0], width = img.naturalWidth, height = img.naturalHeight, blob,
|
3241 |
-
ratio = 1, maxWidth = self.maxImageWidth || width, maxHeight = self.maxImageHeight || height,
|
3242 |
-
isValidImage = !!(width && height), chkWidth, chkHeight, canvas = self.imageCanvas, dataURI,
|
3243 |
-
context = self.imageCanvasContext, type = config.typ, pid = config.pid, ind = config.ind,
|
3244 |
-
$thumb = config.thumb, throwError, msg, exifObj = config.exifObj, exifStr;
|
3245 |
-
throwError = function (msg, params, ev) {
|
3246 |
-
if (self.isAjaxUpload) {
|
3247 |
-
self._showUploadError(msg, params, ev);
|
3248 |
-
} else {
|
3249 |
-
self._showError(msg, params, ev);
|
3250 |
-
}
|
3251 |
-
self._setPreviewError($thumb, ind);
|
3252 |
-
};
|
3253 |
-
if (!self.filestack[ind] || !isValidImage || (width <= maxWidth && height <= maxHeight)) {
|
3254 |
-
if (isValidImage && self.filestack[ind]) {
|
3255 |
-
self._raise('fileimageresized', [pid, ind]);
|
3256 |
-
}
|
3257 |
-
counter.val++;
|
3258 |
-
if (counter.val === numImgs) {
|
3259 |
-
self._raise('fileimagesresized');
|
3260 |
-
}
|
3261 |
-
if (!isValidImage) {
|
3262 |
-
throwError(self.msgImageResizeError, {id: pid, 'index': ind}, 'fileimageresizeerror');
|
3263 |
-
return;
|
3264 |
-
}
|
3265 |
-
}
|
3266 |
-
type = type || self.resizeDefaultImageType;
|
3267 |
-
chkWidth = width > maxWidth;
|
3268 |
-
chkHeight = height > maxHeight;
|
3269 |
-
if (self.resizePreference === 'width') {
|
3270 |
-
ratio = chkWidth ? maxWidth / width : (chkHeight ? maxHeight / height : 1);
|
3271 |
-
} else {
|
3272 |
-
ratio = chkHeight ? maxHeight / height : (chkWidth ? maxWidth / width : 1);
|
3273 |
-
}
|
3274 |
-
self._resetCanvas();
|
3275 |
-
width *= ratio;
|
3276 |
-
height *= ratio;
|
3277 |
-
canvas.width = width;
|
3278 |
-
canvas.height = height;
|
3279 |
-
try {
|
3280 |
-
context.drawImage(img, 0, 0, width, height);
|
3281 |
-
dataURI = canvas.toDataURL(type, self.resizeQuality);
|
3282 |
-
if (exifObj) {
|
3283 |
-
exifStr = window.piexif.dump(exifObj);
|
3284 |
-
dataURI = window.piexif.insert(exifStr, dataURI);
|
3285 |
-
}
|
3286 |
-
blob = $h.dataURI2Blob(dataURI);
|
3287 |
-
self.filestack[ind] = blob;
|
3288 |
-
self._raise('fileimageresized', [pid, ind]);
|
3289 |
-
counter.val++;
|
3290 |
-
if (counter.val === numImgs) {
|
3291 |
-
self._raise('fileimagesresized', [undefined, undefined]);
|
3292 |
-
}
|
3293 |
-
if (!(blob instanceof Blob)) {
|
3294 |
-
throwError(self.msgImageResizeError, {id: pid, 'index': ind}, 'fileimageresizeerror');
|
3295 |
-
}
|
3296 |
-
}
|
3297 |
-
catch (err) {
|
3298 |
-
counter.val++;
|
3299 |
-
if (counter.val === numImgs) {
|
3300 |
-
self._raise('fileimagesresized', [undefined, undefined]);
|
3301 |
-
}
|
3302 |
-
msg = self.msgImageResizeException.replace('{errors}', err.message);
|
3303 |
-
throwError(msg, {id: pid, 'index': ind}, 'fileimageresizeexception');
|
3304 |
-
}
|
3305 |
-
},
|
3306 |
-
_initBrowse: function ($container) {
|
3307 |
-
var self = this, $el = self.$element;
|
3308 |
-
if (self.showBrowse) {
|
3309 |
-
self.$btnFile = $container.find('.btn-file').append($el);
|
3310 |
-
} else {
|
3311 |
-
$el.appendTo($container).attr('tabindex', -1);
|
3312 |
-
$h.addCss($el, 'file-no-browse');
|
3313 |
-
}
|
3314 |
-
},
|
3315 |
-
_initClickable: function () {
|
3316 |
-
var self = this, $zone;
|
3317 |
-
if (!self.isClickable) {
|
3318 |
-
return;
|
3319 |
-
}
|
3320 |
-
$zone = self.isAjaxUpload ? self.$dropZone : self.$preview.find('.file-default-preview');
|
3321 |
-
$h.addCss($zone, 'clickable');
|
3322 |
-
$zone.attr('tabindex', -1);
|
3323 |
-
self._handler($zone, 'click', function (e) {
|
3324 |
-
var $tar = $(e.target);
|
3325 |
-
if (!$(self.elErrorContainer + ':visible').length &&
|
3326 |
-
(!$tar.parents('.file-preview-thumbnails').length || $tar.parents('.file-default-preview').length)) {
|
3327 |
-
self.$element.data('zoneClicked', true).trigger('click');
|
3328 |
-
$zone.blur();
|
3329 |
-
}
|
3330 |
-
});
|
3331 |
-
},
|
3332 |
-
_initCaption: function () {
|
3333 |
-
var self = this, cap = self.initialCaption || '';
|
3334 |
-
if (self.overwriteInitial || $h.isEmpty(cap)) {
|
3335 |
-
self.$caption.val('');
|
3336 |
-
return false;
|
3337 |
-
}
|
3338 |
-
self._setCaption(cap);
|
3339 |
-
return true;
|
3340 |
-
},
|
3341 |
-
_setCaption: function (content, isError) {
|
3342 |
-
var self = this, title, out, icon, n, cap, stack = self.getFileStack();
|
3343 |
-
if (!self.$caption.length) {
|
3344 |
-
return;
|
3345 |
-
}
|
3346 |
-
self.$captionContainer.removeClass('icon-visible');
|
3347 |
-
if (isError) {
|
3348 |
-
title = $('<div>' + self.msgValidationError + '</div>').text();
|
3349 |
-
n = stack.length;
|
3350 |
-
if (n) {
|
3351 |
-
cap = n === 1 && stack[0] ? self._getFileNames()[0] : self._getMsgSelected(n);
|
3352 |
-
} else {
|
3353 |
-
cap = self._getMsgSelected(self.msgNo);
|
3354 |
-
}
|
3355 |
-
out = $h.isEmpty(content) ? cap : content;
|
3356 |
-
icon = '<span class="' + self.msgValidationErrorClass + '">' + self.msgValidationErrorIcon + '</span>';
|
3357 |
-
} else {
|
3358 |
-
if ($h.isEmpty(content)) {
|
3359 |
-
return;
|
3360 |
-
}
|
3361 |
-
title = $('<div>' + content + '</div>').text();
|
3362 |
-
out = title;
|
3363 |
-
icon = self._getLayoutTemplate('fileIcon');
|
3364 |
-
}
|
3365 |
-
self.$captionContainer.addClass('icon-visible');
|
3366 |
-
self.$caption.attr('title', title).val(out);
|
3367 |
-
self.$captionIcon.html(icon);
|
3368 |
-
},
|
3369 |
-
_createContainer: function () {
|
3370 |
-
var self = this, attribs = {"class": 'file-input file-input-new' + (self.rtl ? ' kv-rtl' : '')},
|
3371 |
-
$container = $(document.createElement("div")).attr(attribs).html(self._renderMain());
|
3372 |
-
$container.insertBefore(self.$element);
|
3373 |
-
self._initBrowse($container);
|
3374 |
-
if (self.theme) {
|
3375 |
-
$container.addClass('theme-' + self.theme);
|
3376 |
-
}
|
3377 |
-
return $container;
|
3378 |
-
},
|
3379 |
-
_refreshContainer: function () {
|
3380 |
-
var self = this, $container = self.$container, $el = self.$element;
|
3381 |
-
$el.insertAfter($container);
|
3382 |
-
$container.html(self._renderMain());
|
3383 |
-
self._initBrowse($container);
|
3384 |
-
self._validateDisabled();
|
3385 |
-
},
|
3386 |
-
_validateDisabled: function () {
|
3387 |
-
var self = this;
|
3388 |
-
self.$caption.attr({readonly: self.isDisabled});
|
3389 |
-
},
|
3390 |
-
_renderMain: function () {
|
3391 |
-
var self = this,
|
3392 |
-
dropCss = self.dropZoneEnabled ? ' file-drop-zone' : 'file-drop-disabled',
|
3393 |
-
close = !self.showClose ? '' : self._getLayoutTemplate('close'),
|
3394 |
-
preview = !self.showPreview ? '' : self._getLayoutTemplate('preview')
|
3395 |
-
.setTokens({'class': self.previewClass, 'dropClass': dropCss}),
|
3396 |
-
css = self.isDisabled ? self.captionClass + ' file-caption-disabled' : self.captionClass,
|
3397 |
-
caption = self.captionTemplate.setTokens({'class': css + ' kv-fileinput-caption'});
|
3398 |
-
return self.mainTemplate.setTokens({
|
3399 |
-
'class': self.mainClass + (!self.showBrowse && self.showCaption ? ' no-browse' : ''),
|
3400 |
-
'preview': preview,
|
3401 |
-
'close': close,
|
3402 |
-
'caption': caption,
|
3403 |
-
'upload': self._renderButton('upload'),
|
3404 |
-
'remove': self._renderButton('remove'),
|
3405 |
-
'cancel': self._renderButton('cancel'),
|
3406 |
-
'browse': self._renderButton('browse')
|
3407 |
-
});
|
3408 |
-
|
3409 |
-
},
|
3410 |
-
_renderButton: function (type) {
|
3411 |
-
var self = this, tmplt = self._getLayoutTemplate('btnDefault'), css = self[type + 'Class'],
|
3412 |
-
title = self[type + 'Title'], icon = self[type + 'Icon'], label = self[type + 'Label'],
|
3413 |
-
status = self.isDisabled ? ' disabled' : '', btnType = 'button';
|
3414 |
-
switch (type) {
|
3415 |
-
case 'remove':
|
3416 |
-
if (!self.showRemove) {
|
3417 |
-
return '';
|
3418 |
-
}
|
3419 |
-
break;
|
3420 |
-
case 'cancel':
|
3421 |
-
if (!self.showCancel) {
|
3422 |
-
return '';
|
3423 |
-
}
|
3424 |
-
css += ' kv-hidden';
|
3425 |
-
break;
|
3426 |
-
case 'upload':
|
3427 |
-
if (!self.showUpload) {
|
3428 |
-
return '';
|
3429 |
-
}
|
3430 |
-
if (self.isAjaxUpload && !self.isDisabled) {
|
3431 |
-
tmplt = self._getLayoutTemplate('btnLink').replace('{href}', self.uploadUrl);
|
3432 |
-
} else {
|
3433 |
-
btnType = 'submit';
|
3434 |
-
}
|
3435 |
-
break;
|
3436 |
-
case 'browse':
|
3437 |
-
if (!self.showBrowse) {
|
3438 |
-
return '';
|
3439 |
-
}
|
3440 |
-
tmplt = self._getLayoutTemplate('btnBrowse');
|
3441 |
-
break;
|
3442 |
-
default:
|
3443 |
-
return '';
|
3444 |
-
}
|
3445 |
-
|
3446 |
-
css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button';
|
3447 |
-
if (!$h.isEmpty(label)) {
|
3448 |
-
label = ' <span class="' + self.buttonLabelClass + '">' + label + '</span>';
|
3449 |
-
}
|
3450 |
-
return tmplt.setTokens({
|
3451 |
-
'type': btnType, 'css': css, 'title': title, 'status': status, 'icon': icon, 'label': label
|
3452 |
-
});
|
3453 |
-
},
|
3454 |
-
_renderThumbProgress: function () {
|
3455 |
-
var self = this;
|
3456 |
-
return '<div class="file-thumb-progress kv-hidden">' +
|
3457 |
-
self.progressTemplate.setTokens({'percent': '0', 'status': self.msgUploadBegin}) +
|
3458 |
-
'</div>';
|
3459 |
-
},
|
3460 |
-
_renderFileFooter: function (caption, size, width, isError) {
|
3461 |
-
var self = this, config = self.fileActionSettings, rem = config.showRemove, drg = config.showDrag,
|
3462 |
-
upl = config.showUpload, zoom = config.showZoom, out,
|
3463 |
-
template = self._getLayoutTemplate('footer'), tInd = self._getLayoutTemplate('indicator'),
|
3464 |
-
ind = isError ? config.indicatorError : config.indicatorNew,
|
3465 |
-
title = isError ? config.indicatorErrorTitle : config.indicatorNewTitle,
|
3466 |
-
indicator = tInd.setTokens({'indicator': ind, 'indicatorTitle': title});
|
3467 |
-
size = self._getSize(size);
|
3468 |
-
if (self.isAjaxUpload) {
|
3469 |
-
out = template.setTokens({
|
3470 |
-
'actions': self._renderFileActions(upl, false, rem, zoom, drg, false, false, false),
|
3471 |
-
'caption': caption,
|
3472 |
-
'size': size,
|
3473 |
-
'width': width,
|
3474 |
-
'progress': self._renderThumbProgress(),
|
3475 |
-
'indicator': indicator
|
3476 |
-
});
|
3477 |
-
} else {
|
3478 |
-
out = template.setTokens({
|
3479 |
-
'actions': self._renderFileActions(false, false, false, zoom, drg, false, false, false),
|
3480 |
-
'caption': caption,
|
3481 |
-
'size': size,
|
3482 |
-
'width': width,
|
3483 |
-
'progress': '',
|
3484 |
-
'indicator': indicator
|
3485 |
-
});
|
3486 |
-
}
|
3487 |
-
out = $h.replaceTags(out, self.previewThumbTags);
|
3488 |
-
return out;
|
3489 |
-
},
|
3490 |
-
_renderFileActions: function (showUpl, showDwn, showDel, showZoom, showDrag, disabled, url, key, isInit, dUrl, dFile) {
|
3491 |
-
if (!showUpl && !showDwn && !showDel && !showZoom && !showDrag) {
|
3492 |
-
return '';
|
3493 |
-
}
|
3494 |
-
var self = this, vUrl = url === false ? '' : ' data-url="' + url + '"',
|
3495 |
-
vKey = key === false ? '' : ' data-key="' + key + '"', btnDelete = '', btnUpload = '', btnDownload = '',
|
3496 |
-
btnZoom = '', btnDrag = '', css, template = self._getLayoutTemplate('actions'),
|
3497 |
-
config = self.fileActionSettings,
|
3498 |
-
otherButtons = self.otherActionButtons.setTokens({'dataKey': vKey, 'key': key}),
|
3499 |
-
removeClass = disabled ? config.removeClass + ' disabled' : config.removeClass;
|
3500 |
-
if (showDel) {
|
3501 |
-
btnDelete = self._getLayoutTemplate('actionDelete').setTokens({
|
3502 |
-
'removeClass': removeClass,
|
3503 |
-
'removeIcon': config.removeIcon,
|
3504 |
-
'removeTitle': config.removeTitle,
|
3505 |
-
'dataUrl': vUrl,
|
3506 |
-
'dataKey': vKey,
|
3507 |
-
'key': key
|
3508 |
-
});
|
3509 |
-
}
|
3510 |
-
if (showUpl) {
|
3511 |
-
btnUpload = self._getLayoutTemplate('actionUpload').setTokens({
|
3512 |
-
'uploadClass': config.uploadClass,
|
3513 |
-
'uploadIcon': config.uploadIcon,
|
3514 |
-
'uploadTitle': config.uploadTitle
|
3515 |
-
});
|
3516 |
-
}
|
3517 |
-
if (showDwn) {
|
3518 |
-
btnDownload = self._getLayoutTemplate('actionDownload').setTokens({
|
3519 |
-
'downloadClass': config.downloadClass,
|
3520 |
-
'downloadIcon': config.downloadIcon,
|
3521 |
-
'downloadTitle': config.downloadTitle,
|
3522 |
-
'downloadUrl': dUrl || self.initialPreviewDownloadUrl
|
3523 |
-
});
|
3524 |
-
btnDownload = btnDownload.setTokens({'filename': dFile, 'key': key});
|
3525 |
-
}
|
3526 |
-
if (showZoom) {
|
3527 |
-
btnZoom = self._getLayoutTemplate('actionZoom').setTokens({
|
3528 |
-
'zoomClass': config.zoomClass,
|
3529 |
-
'zoomIcon': config.zoomIcon,
|
3530 |
-
'zoomTitle': config.zoomTitle
|
3531 |
-
});
|
3532 |
-
}
|
3533 |
-
if (showDrag && isInit) {
|
3534 |
-
css = 'drag-handle-init ' + config.dragClass;
|
3535 |
-
btnDrag = self._getLayoutTemplate('actionDrag').setTokens({
|
3536 |
-
'dragClass': css,
|
3537 |
-
'dragTitle': config.dragTitle,
|
3538 |
-
'dragIcon': config.dragIcon
|
3539 |
-
});
|
3540 |
-
}
|
3541 |
-
return template.setTokens({
|
3542 |
-
'delete': btnDelete,
|
3543 |
-
'upload': btnUpload,
|
3544 |
-
'download': btnDownload,
|
3545 |
-
'zoom': btnZoom,
|
3546 |
-
'drag': btnDrag,
|
3547 |
-
'other': otherButtons
|
3548 |
-
});
|
3549 |
-
},
|
3550 |
-
_browse: function (e) {
|
3551 |
-
var self = this;
|
3552 |
-
if (e && e.isDefaultPrevented() || !self._raise('filebrowse')) {
|
3553 |
-
return;
|
3554 |
-
}
|
3555 |
-
if (self.isError && !self.isAjaxUpload) {
|
3556 |
-
self.clear();
|
3557 |
-
}
|
3558 |
-
self.$captionContainer.focus();
|
3559 |
-
},
|
3560 |
-
_filterDuplicate: function (file, files, fileIds) {
|
3561 |
-
var self = this, fileId = self._getFileId(file);
|
3562 |
-
|
3563 |
-
if (fileId && fileIds && fileIds.indexOf(fileId) > -1) {
|
3564 |
-
return;
|
3565 |
-
}
|
3566 |
-
if (!fileIds) {
|
3567 |
-
fileIds = [];
|
3568 |
-
}
|
3569 |
-
files.push(file);
|
3570 |
-
fileIds.push(fileId);
|
3571 |
-
},
|
3572 |
-
_change: function (e) {
|
3573 |
-
var self = this;
|
3574 |
-
if (self.changeTriggered) {
|
3575 |
-
return;
|
3576 |
-
}
|
3577 |
-
var $el = self.$element, isDragDrop = arguments.length > 1, isAjaxUpload = self.isAjaxUpload,
|
3578 |
-
tfiles = [], files = isDragDrop ? arguments[1] : $el.get(0).files, total,
|
3579 |
-
maxCount = !isAjaxUpload && $h.isEmpty($el.attr('multiple')) ? 1 : self.maxFileCount,
|
3580 |
-
len, ctr = self.filestack.length, isSingleUpload = $h.isEmpty($el.attr('multiple')),
|
3581 |
-
flagSingle = (isSingleUpload && ctr > 0), fileIds = self._getFileIds(),
|
3582 |
-
throwError = function (mesg, file, previewId, index) {
|
3583 |
-
var p1 = $.extend(true, {}, self._getOutData({}, {}, files), {id: previewId, index: index}),
|
3584 |
-
p2 = {id: previewId, index: index, file: file, files: files};
|
3585 |
-
return isAjaxUpload ? self._showUploadError(mesg, p1) : self._showError(mesg, p2);
|
3586 |
-
},
|
3587 |
-
maxCountCheck = function (n, m) {
|
3588 |
-
var msg = self.msgFilesTooMany.replace('{m}', m).replace('{n}', n);
|
3589 |
-
self.isError = throwError(msg, null, null, null);
|
3590 |
-
self.$captionContainer.removeClass('icon-visible');
|
3591 |
-
self._setCaption('', true);
|
3592 |
-
self.$container.removeClass('file-input-new file-input-ajax-new');
|
3593 |
-
};
|
3594 |
-
self.reader = null;
|
3595 |
-
self._resetUpload();
|
3596 |
-
self._hideFileIcon();
|
3597 |
-
if (self.dropZoneEnabled) {
|
3598 |
-
self.$container.find('.file-drop-zone .' + self.dropZoneTitleClass).remove();
|
3599 |
-
}
|
3600 |
-
if (isAjaxUpload) {
|
3601 |
-
$.each(files, function (vKey, vFile) {
|
3602 |
-
self._filterDuplicate(vFile, tfiles, fileIds);
|
3603 |
-
});
|
3604 |
-
} else {
|
3605 |
-
if (e.target && e.target.files === undefined) {
|
3606 |
-
files = e.target.value ? [{name: e.target.value.replace(/^.+\\/, '')}] : [];
|
3607 |
-
} else {
|
3608 |
-
files = e.target.files || {};
|
3609 |
-
}
|
3610 |
-
tfiles = files;
|
3611 |
-
}
|
3612 |
-
if ($h.isEmpty(tfiles) || tfiles.length === 0) {
|
3613 |
-
if (!isAjaxUpload) {
|
3614 |
-
self.clear();
|
3615 |
-
}
|
3616 |
-
self._raise('fileselectnone');
|
3617 |
-
return;
|
3618 |
-
}
|
3619 |
-
self._resetErrors();
|
3620 |
-
len = tfiles.length;
|
3621 |
-
total = self._getFileCount(isAjaxUpload ? (self.getFileStack().length + len) : len);
|
3622 |
-
if (maxCount > 0 && total > maxCount) {
|
3623 |
-
if (!self.autoReplace || len > maxCount) {
|
3624 |
-
maxCountCheck((self.autoReplace && len > maxCount ? len : total), maxCount);
|
3625 |
-
return;
|
3626 |
-
}
|
3627 |
-
if (total > maxCount) {
|
3628 |
-
self._resetPreviewThumbs(isAjaxUpload);
|
3629 |
-
}
|
3630 |
-
} else {
|
3631 |
-
if (!isAjaxUpload || flagSingle) {
|
3632 |
-
self._resetPreviewThumbs(false);
|
3633 |
-
if (flagSingle) {
|
3634 |
-
self.clearStack();
|
3635 |
-
}
|
3636 |
-
} else {
|
3637 |
-
if (isAjaxUpload && ctr === 0 && (!self.previewCache.count() || self.overwriteInitial)) {
|
3638 |
-
self._resetPreviewThumbs(true);
|
3639 |
-
}
|
3640 |
-
}
|
3641 |
-
}
|
3642 |
-
if (self.isPreviewable) {
|
3643 |
-
self.readFiles(tfiles);
|
3644 |
-
} else {
|
3645 |
-
self._updateFileDetails(1);
|
3646 |
-
}
|
3647 |
-
},
|
3648 |
-
_abort: function (params) {
|
3649 |
-
var self = this, data;
|
3650 |
-
if (self.ajaxAborted && typeof self.ajaxAborted === "object" && self.ajaxAborted.message !== undefined) {
|
3651 |
-
data = $.extend(true, {}, self._getOutData(), params);
|
3652 |
-
data.abortData = self.ajaxAborted.data || {};
|
3653 |
-
data.abortMessage = self.ajaxAborted.message;
|
3654 |
-
self._setProgress(101, self.$progress, self.msgCancelled);
|
3655 |
-
self._showUploadError(self.ajaxAborted.message, data, 'filecustomerror');
|
3656 |
-
self.cancel();
|
3657 |
-
return true;
|
3658 |
-
}
|
3659 |
-
return !!self.ajaxAborted;
|
3660 |
-
},
|
3661 |
-
_resetFileStack: function () {
|
3662 |
-
var self = this, i = 0, newstack = [], newnames = [], newids = [];
|
3663 |
-
self._getThumbs().each(function () {
|
3664 |
-
var $thumb = $(this), ind = $thumb.attr('data-fileindex'), file = self.filestack[ind],
|
3665 |
-
pid = $thumb.attr('id');
|
3666 |
-
if (ind === '-1' || ind === -1) {
|
3667 |
-
return;
|
3668 |
-
}
|
3669 |
-
if (file !== undefined) {
|
3670 |
-
newstack[i] = file;
|
3671 |
-
newnames[i] = self._getFileName(file);
|
3672 |
-
newids[i] = self._getFileId(file);
|
3673 |
-
$thumb.attr({'id': self.previewInitId + '-' + i, 'data-fileindex': i});
|
3674 |
-
i++;
|
3675 |
-
} else {
|
3676 |
-
$thumb.attr({'id': 'uploaded-' + $h.uniqId(), 'data-fileindex': '-1'});
|
3677 |
-
}
|
3678 |
-
self.$preview.find('#zoom-' + pid).attr({
|
3679 |
-
'id': 'zoom-' + $thumb.attr('id'),
|
3680 |
-
'data-fileindex': $thumb.attr('data-fileindex')
|
3681 |
-
});
|
3682 |
-
});
|
3683 |
-
self.filestack = newstack;
|
3684 |
-
self.filenames = newnames;
|
3685 |
-
self.fileids = newids;
|
3686 |
-
},
|
3687 |
-
_isFileSelectionValid: function (cnt) {
|
3688 |
-
var self = this;
|
3689 |
-
cnt = cnt || 0;
|
3690 |
-
if (self.required && !self.getFilesCount()) {
|
3691 |
-
self.$errorContainer.html('');
|
3692 |
-
self._showUploadError(self.msgFileRequired);
|
3693 |
-
return false;
|
3694 |
-
}
|
3695 |
-
if (self.minFileCount > 0 && self._getFileCount(cnt) < self.minFileCount) {
|
3696 |
-
self._noFilesError({});
|
3697 |
-
return false;
|
3698 |
-
}
|
3699 |
-
return true;
|
3700 |
-
},
|
3701 |
-
clearStack: function () {
|
3702 |
-
var self = this;
|
3703 |
-
self.filestack = [];
|
3704 |
-
self.filenames = [];
|
3705 |
-
self.fileids = [];
|
3706 |
-
return self.$element;
|
3707 |
-
},
|
3708 |
-
updateStack: function (i, file) {
|
3709 |
-
var self = this;
|
3710 |
-
self.filestack[i] = file;
|
3711 |
-
self.filenames[i] = self._getFileName(file);
|
3712 |
-
self.fileids[i] = file && self._getFileId(file) || null;
|
3713 |
-
return self.$element;
|
3714 |
-
},
|
3715 |
-
addToStack: function (file) {
|
3716 |
-
var self = this;
|
3717 |
-
self.filestack.push(file);
|
3718 |
-
self.filenames.push(self._getFileName(file));
|
3719 |
-
self.fileids.push(self._getFileId(file));
|
3720 |
-
return self.$element;
|
3721 |
-
},
|
3722 |
-
getFileStack: function (skipNull) {
|
3723 |
-
var self = this;
|
3724 |
-
return self.filestack.filter(function (n) {
|
3725 |
-
return (skipNull ? n !== undefined : n !== undefined && n !== null);
|
3726 |
-
});
|
3727 |
-
},
|
3728 |
-
getFilesCount: function () {
|
3729 |
-
var self = this, len = self.isAjaxUpload ? self.getFileStack().length : self._inputFileCount();
|
3730 |
-
return self._getFileCount(len);
|
3731 |
-
},
|
3732 |
-
readFiles: function (files) {
|
3733 |
-
this.reader = new FileReader();
|
3734 |
-
var self = this, $el = self.$element, $preview = self.$preview, reader = self.reader,
|
3735 |
-
$container = self.$previewContainer, $status = self.$previewStatus, msgLoading = self.msgLoading,
|
3736 |
-
msgProgress = self.msgProgress, previewInitId = self.previewInitId, numFiles = files.length,
|
3737 |
-
settings = self.fileTypeSettings, ctr = self.filestack.length, readFile,
|
3738 |
-
fileTypes = self.allowedFileTypes, typLen = fileTypes ? fileTypes.length : 0,
|
3739 |
-
fileExt = self.allowedFileExtensions, strExt = $h.isEmpty(fileExt) ? '' : fileExt.join(', '),
|
3740 |
-
maxPreviewSize = self.maxFilePreviewSize && parseFloat(self.maxFilePreviewSize),
|
3741 |
-
canPreview = $preview.length && (!maxPreviewSize || isNaN(maxPreviewSize)),
|
3742 |
-
throwError = function (msg, file, previewId, index) {
|
3743 |
-
var p1 = $.extend(true, {}, self._getOutData({}, {}, files), {id: previewId, index: index}),
|
3744 |
-
p2 = {id: previewId, index: index, file: file, files: files}, $thumb;
|
3745 |
-
self._previewDefault(file, previewId, true);
|
3746 |
-
if (self.isAjaxUpload) {
|
3747 |
-
self.addToStack(undefined);
|
3748 |
-
setTimeout(function () {
|
3749 |
-
readFile(index + 1);
|
3750 |
-
}, 100);
|
3751 |
-
} else {
|
3752 |
-
numFiles = 0;
|
3753 |
-
}
|
3754 |
-
self._initFileActions();
|
3755 |
-
$thumb = $('#' + previewId);
|
3756 |
-
$thumb.find('.kv-file-upload').hide();
|
3757 |
-
if (self.removeFromPreviewOnError) {
|
3758 |
-
$thumb.remove();
|
3759 |
-
}
|
3760 |
-
self.isError = self.isAjaxUpload ? self._showUploadError(msg, p1) : self._showError(msg, p2);
|
3761 |
-
self._updateFileDetails(numFiles);
|
3762 |
-
};
|
3763 |
-
|
3764 |
-
self.loadedImages = [];
|
3765 |
-
self.totalImagesCount = 0;
|
3766 |
-
|
3767 |
-
$.each(files, function (key, file) {
|
3768 |
-
var func = self.fileTypeSettings.image;
|
3769 |
-
if (func && func(file.type)) {
|
3770 |
-
self.totalImagesCount++;
|
3771 |
-
}
|
3772 |
-
});
|
3773 |
-
readFile = function (i) {
|
3774 |
-
if ($h.isEmpty($el.attr('multiple'))) {
|
3775 |
-
numFiles = 1;
|
3776 |
-
}
|
3777 |
-
if (i >= numFiles) {
|
3778 |
-
if (self.isAjaxUpload && self.filestack.length > 0) {
|
3779 |
-
self._raise('filebatchselected', [self.getFileStack()]);
|
3780 |
-
} else {
|
3781 |
-
self._raise('filebatchselected', [files]);
|
3782 |
-
}
|
3783 |
-
$container.removeClass('file-thumb-loading');
|
3784 |
-
$status.html('');
|
3785 |
-
return;
|
3786 |
-
}
|
3787 |
-
var node = ctr + i, previewId = previewInitId + "-" + node, file = files[i], fSizeKB, j, msg,
|
3788 |
-
fnText = settings.text, fnImage = settings.image, fnHtml = settings.html, typ, chk, typ1, typ2,
|
3789 |
-
caption = file && file.name ? self.slug(file.name) : '', fileSize = (file && file.size || 0) / 1000,
|
3790 |
-
fileExtExpr = '', previewData = file ? $h.objUrl.createObjectURL(file) : null, fileCount = 0,
|
3791 |
-
strTypes = '',
|
3792 |
-
func, knownTypes = 0, isText, isHtml, isImage, txtFlag, processFileLoaded = function () {
|
3793 |
-
var msg = msgProgress.setTokens({
|
3794 |
-
'index': i + 1,
|
3795 |
-
'files': numFiles,
|
3796 |
-
'percent': 50,
|
3797 |
-
'name': caption
|
3798 |
-
});
|
3799 |
-
setTimeout(function () {
|
3800 |
-
$status.html(msg);
|
3801 |
-
self._updateFileDetails(numFiles);
|
3802 |
-
readFile(i + 1);
|
3803 |
-
}, 100);
|
3804 |
-
self._raise('fileloaded', [file, previewId, i, reader]);
|
3805 |
-
};
|
3806 |
-
if (!file) {
|
3807 |
-
return;
|
3808 |
-
}
|
3809 |
-
if (typLen > 0) {
|
3810 |
-
for (j = 0; j < typLen; j++) {
|
3811 |
-
typ1 = fileTypes[j];
|
3812 |
-
typ2 = self.msgFileTypes[typ1] || typ1;
|
3813 |
-
strTypes += j === 0 ? typ2 : ', ' + typ2;
|
3814 |
-
}
|
3815 |
-
}
|
3816 |
-
if (caption === false) {
|
3817 |
-
readFile(i + 1);
|
3818 |
-
return;
|
3819 |
-
}
|
3820 |
-
if (caption.length === 0) {
|
3821 |
-
msg = self.msgInvalidFileName.replace('{name}', $h.htmlEncode(file.name, '[unknown]'));
|
3822 |
-
throwError(msg, file, previewId, i);
|
3823 |
-
return;
|
3824 |
-
}
|
3825 |
-
if (!$h.isEmpty(fileExt)) {
|
3826 |
-
fileExtExpr = new RegExp('\\.(' + fileExt.join('|') + ')$', 'i');
|
3827 |
-
}
|
3828 |
-
fSizeKB = fileSize.toFixed(2);
|
3829 |
-
if (self.maxFileSize > 0 && fileSize > self.maxFileSize) {
|
3830 |
-
msg = self.msgSizeTooLarge.setTokens({
|
3831 |
-
'name': caption,
|
3832 |
-
'size': fSizeKB,
|
3833 |
-
'maxSize': self.maxFileSize
|
3834 |
-
});
|
3835 |
-
throwError(msg, file, previewId, i);
|
3836 |
-
return;
|
3837 |
-
}
|
3838 |
-
if (self.minFileSize !== null && fileSize <= $h.getNum(self.minFileSize)) {
|
3839 |
-
msg = self.msgSizeTooSmall.setTokens({
|
3840 |
-
'name': caption,
|
3841 |
-
'size': fSizeKB,
|
3842 |
-
'minSize': self.minFileSize
|
3843 |
-
});
|
3844 |
-
throwError(msg, file, previewId, i);
|
3845 |
-
return;
|
3846 |
-
}
|
3847 |
-
if (!$h.isEmpty(fileTypes) && $h.isArray(fileTypes)) {
|
3848 |
-
for (j = 0; j < fileTypes.length; j += 1) {
|
3849 |
-
typ = fileTypes[j];
|
3850 |
-
func = settings[typ];
|
3851 |
-
fileCount += !func || (typeof func !== 'function') ? 0 : (func(file.type, file.name) ? 1 : 0);
|
3852 |
-
}
|
3853 |
-
if (fileCount === 0) {
|
3854 |
-
msg = self.msgInvalidFileType.setTokens({'name': caption, 'types': strTypes});
|
3855 |
-
throwError(msg, file, previewId, i);
|
3856 |
-
return;
|
3857 |
-
}
|
3858 |
-
}
|
3859 |
-
if (fileCount === 0 && !$h.isEmpty(fileExt) && $h.isArray(fileExt) && !$h.isEmpty(fileExtExpr)) {
|
3860 |
-
chk = $h.compare(caption, fileExtExpr);
|
3861 |
-
fileCount += $h.isEmpty(chk) ? 0 : chk.length;
|
3862 |
-
if (fileCount === 0) {
|
3863 |
-
msg = self.msgInvalidFileExtension.setTokens({'name': caption, 'extensions': strExt});
|
3864 |
-
throwError(msg, file, previewId, i);
|
3865 |
-
return;
|
3866 |
-
}
|
3867 |
-
}
|
3868 |
-
if (!self.showPreview) {
|
3869 |
-
if (self.isAjaxUpload) {
|
3870 |
-
self.addToStack(file);
|
3871 |
-
}
|
3872 |
-
setTimeout(function () {
|
3873 |
-
readFile(i + 1);
|
3874 |
-
self._updateFileDetails(numFiles);
|
3875 |
-
}, 100);
|
3876 |
-
self._raise('fileloaded', [file, previewId, i, reader]);
|
3877 |
-
return;
|
3878 |
-
}
|
3879 |
-
if (!canPreview && fileSize > maxPreviewSize) {
|
3880 |
-
self.addToStack(file);
|
3881 |
-
$container.addClass('file-thumb-loading');
|
3882 |
-
self._previewDefault(file, previewId);
|
3883 |
-
self._initFileActions();
|
3884 |
-
self._updateFileDetails(numFiles);
|
3885 |
-
readFile(i + 1);
|
3886 |
-
return;
|
3887 |
-
}
|
3888 |
-
if ($preview.length && FileReader !== undefined) {
|
3889 |
-
isText = fnText(file.type, caption);
|
3890 |
-
isHtml = fnHtml(file.type, caption);
|
3891 |
-
isImage = fnImage(file.type, caption);
|
3892 |
-
$status.html(msgLoading.replace('{index}', i + 1).replace('{files}', numFiles));
|
3893 |
-
$container.addClass('file-thumb-loading');
|
3894 |
-
reader.onerror = function (evt) {
|
3895 |
-
self._errorHandler(evt, caption);
|
3896 |
-
};
|
3897 |
-
reader.onload = function (theFile) {
|
3898 |
-
var hex, fileInfo, uint, byte, bytes = [], contents, mime, readTextImage = function (textFlag) {
|
3899 |
-
var newReader = new FileReader();
|
3900 |
-
newReader.onerror = function (theFileNew) {
|
3901 |
-
self._errorHandler(theFileNew, caption);
|
3902 |
-
};
|
3903 |
-
newReader.onload = function (theFileNew) {
|
3904 |
-
self._previewFile(i, file, theFileNew, previewId, previewData, fileInfo);
|
3905 |
-
self._initFileActions();
|
3906 |
-
processFileLoaded();
|
3907 |
-
};
|
3908 |
-
if (textFlag) {
|
3909 |
-
newReader.readAsText(file, self.textEncoding);
|
3910 |
-
} else {
|
3911 |
-
newReader.readAsDataURL(file);
|
3912 |
-
}
|
3913 |
-
};
|
3914 |
-
fileInfo = {'name': caption, 'type': file.type};
|
3915 |
-
$.each(settings, function (key, func) {
|
3916 |
-
if (key !== 'object' && key !== 'other' && func(file.type, caption)) {
|
3917 |
-
knownTypes++;
|
3918 |
-
}
|
3919 |
-
});
|
3920 |
-
if (knownTypes === 0) {// auto detect mime types from content if no known file types detected
|
3921 |
-
uint = new Uint8Array(theFile.target.result);
|
3922 |
-
for (j = 0; j < uint.length; j++) {
|
3923 |
-
byte = uint[j].toString(16);
|
3924 |
-
bytes.push(byte);
|
3925 |
-
}
|
3926 |
-
hex = bytes.join('').toLowerCase().substring(0, 8);
|
3927 |
-
mime = $h.getMimeType(hex, '', '');
|
3928 |
-
if ($h.isEmpty(mime)) { // look for ascii text content
|
3929 |
-
contents = $h.arrayBuffer2String(reader.result);
|
3930 |
-
mime = $h.isSvg(contents) ? 'image/svg+xml' : $h.getMimeType(hex, contents, file.type);
|
3931 |
-
}
|
3932 |
-
fileInfo = {'name': caption, 'type': mime};
|
3933 |
-
isText = fnText(mime, '');
|
3934 |
-
isHtml = fnHtml(mime, '');
|
3935 |
-
isImage = fnImage(mime, '');
|
3936 |
-
txtFlag = isText || isHtml;
|
3937 |
-
if (txtFlag || isImage) {
|
3938 |
-
readTextImage(txtFlag);
|
3939 |
-
return;
|
3940 |
-
}
|
3941 |
-
}
|
3942 |
-
self._previewFile(i, file, theFile, previewId, previewData, fileInfo);
|
3943 |
-
self._initFileActions();
|
3944 |
-
processFileLoaded();
|
3945 |
-
};
|
3946 |
-
reader.onprogress = function (data) {
|
3947 |
-
if (data.lengthComputable) {
|
3948 |
-
var fact = (data.loaded / data.total) * 100, progress = Math.ceil(fact);
|
3949 |
-
msg = msgProgress.setTokens({
|
3950 |
-
'index': i + 1,
|
3951 |
-
'files': numFiles,
|
3952 |
-
'percent': progress,
|
3953 |
-
'name': caption
|
3954 |
-
});
|
3955 |
-
setTimeout(function () {
|
3956 |
-
$status.html(msg);
|
3957 |
-
}, 100);
|
3958 |
-
}
|
3959 |
-
};
|
3960 |
-
|
3961 |
-
if (isText || isHtml) {
|
3962 |
-
reader.readAsText(file, self.textEncoding);
|
3963 |
-
} else {
|
3964 |
-
if (isImage) {
|
3965 |
-
reader.readAsDataURL(file);
|
3966 |
-
} else {
|
3967 |
-
reader.readAsArrayBuffer(file);
|
3968 |
-
}
|
3969 |
-
}
|
3970 |
-
} else {
|
3971 |
-
self._previewDefault(file, previewId);
|
3972 |
-
setTimeout(function () {
|
3973 |
-
readFile(i + 1);
|
3974 |
-
self._updateFileDetails(numFiles);
|
3975 |
-
}, 100);
|
3976 |
-
self._raise('fileloaded', [file, previewId, i, reader]);
|
3977 |
-
}
|
3978 |
-
self.addToStack(file);
|
3979 |
-
};
|
3980 |
-
|
3981 |
-
readFile(0);
|
3982 |
-
self._updateFileDetails(numFiles, false);
|
3983 |
-
},
|
3984 |
-
lock: function () {
|
3985 |
-
var self = this;
|
3986 |
-
self._resetErrors();
|
3987 |
-
self.disable();
|
3988 |
-
if (self.showRemove) {
|
3989 |
-
self.$container.find('.fileinput-remove').hide();
|
3990 |
-
}
|
3991 |
-
if (self.showCancel) {
|
3992 |
-
self.$container.find('.fileinput-cancel').show();
|
3993 |
-
}
|
3994 |
-
self._raise('filelock', [self.filestack, self._getExtraData()]);
|
3995 |
-
return self.$element;
|
3996 |
-
},
|
3997 |
-
unlock: function (reset) {
|
3998 |
-
var self = this;
|
3999 |
-
if (reset === undefined) {
|
4000 |
-
reset = true;
|
4001 |
-
}
|
4002 |
-
self.enable();
|
4003 |
-
if (self.showCancel) {
|
4004 |
-
self.$container.find('.fileinput-cancel').hide();
|
4005 |
-
}
|
4006 |
-
if (self.showRemove) {
|
4007 |
-
self.$container.find('.fileinput-remove').show();
|
4008 |
-
}
|
4009 |
-
if (reset) {
|
4010 |
-
self._resetFileStack();
|
4011 |
-
}
|
4012 |
-
self._raise('fileunlock', [self.filestack, self._getExtraData()]);
|
4013 |
-
return self.$element;
|
4014 |
-
},
|
4015 |
-
cancel: function () {
|
4016 |
-
var self = this, xhr = self.ajaxRequests, len = xhr.length, i;
|
4017 |
-
if (len > 0) {
|
4018 |
-
for (i = 0; i < len; i += 1) {
|
4019 |
-
self.cancelling = true;
|
4020 |
-
xhr[i].abort();
|
4021 |
-
}
|
4022 |
-
}
|
4023 |
-
self._setProgressCancelled();
|
4024 |
-
self._getThumbs().each(function () {
|
4025 |
-
var $thumb = $(this), ind = $thumb.attr('data-fileindex');
|
4026 |
-
$thumb.removeClass('file-uploading');
|
4027 |
-
if (self.filestack[ind] !== undefined) {
|
4028 |
-
$thumb.find('.kv-file-upload').removeClass('disabled').removeAttr('disabled');
|
4029 |
-
$thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled');
|
4030 |
-
}
|
4031 |
-
self.unlock();
|
4032 |
-
});
|
4033 |
-
return self.$element;
|
4034 |
-
},
|
4035 |
-
clear: function () {
|
4036 |
-
var self = this, cap;
|
4037 |
-
if (!self._raise('fileclear')) {
|
4038 |
-
return;
|
4039 |
-
}
|
4040 |
-
self.$btnUpload.removeAttr('disabled');
|
4041 |
-
self._getThumbs().find('video,audio,img').each(function () {
|
4042 |
-
$h.cleanMemory($(this));
|
4043 |
-
});
|
4044 |
-
self._clearFileInput();
|
4045 |
-
self._resetUpload();
|
4046 |
-
self.clearStack();
|
4047 |
-
self._resetErrors(true);
|
4048 |
-
if (self._hasInitialPreview()) {
|
4049 |
-
self._showFileIcon();
|
4050 |
-
self._resetPreview();
|
4051 |
-
self._initPreviewActions();
|
4052 |
-
self.$container.removeClass('file-input-new');
|
4053 |
-
} else {
|
4054 |
-
self._getThumbs().each(function () {
|
4055 |
-
self._clearObjects($(this));
|
4056 |
-
});
|
4057 |
-
if (self.isAjaxUpload) {
|
4058 |
-
self.previewCache.data = {};
|
4059 |
-
}
|
4060 |
-
self.$preview.html('');
|
4061 |
-
cap = (!self.overwriteInitial && self.initialCaption.length > 0) ? self.initialCaption : '';
|
4062 |
-
self.$caption.attr('title', '').val(cap);
|
4063 |
-
$h.addCss(self.$container, 'file-input-new');
|
4064 |
-
self._validateDefaultPreview();
|
4065 |
-
}
|
4066 |
-
$h.addCss(self.$container, 'file-input-new');
|
4067 |
-
if (self.$container.find($h.FRAMES).length === 0) {
|
4068 |
-
if (!self._initCaption()) {
|
4069 |
-
self.$captionContainer.removeClass('icon-visible');
|
4070 |
-
}
|
4071 |
-
}
|
4072 |
-
self._hideFileIcon();
|
4073 |
-
self._raise('filecleared');
|
4074 |
-
self.$captionContainer.focus();
|
4075 |
-
self._setFileDropZoneTitle();
|
4076 |
-
return self.$element;
|
4077 |
-
},
|
4078 |
-
reset: function () {
|
4079 |
-
var self = this;
|
4080 |
-
if (!self._raise('filereset')) {
|
4081 |
-
return;
|
4082 |
-
}
|
4083 |
-
self._resetPreview();
|
4084 |
-
self.$container.find('.fileinput-filename').text('');
|
4085 |
-
$h.addCss(self.$container, 'file-input-new');
|
4086 |
-
if (self.getFrames().length || self.dropZoneEnabled) {
|
4087 |
-
self.$container.removeClass('file-input-new');
|
4088 |
-
}
|
4089 |
-
self.clearStack();
|
4090 |
-
self.formdata = {};
|
4091 |
-
self._setFileDropZoneTitle();
|
4092 |
-
return self.$element;
|
4093 |
-
},
|
4094 |
-
disable: function () {
|
4095 |
-
var self = this;
|
4096 |
-
self.isDisabled = true;
|
4097 |
-
self._raise('filedisabled');
|
4098 |
-
self.$element.attr('disabled', 'disabled');
|
4099 |
-
self.$container.find(".kv-fileinput-caption").addClass("file-caption-disabled");
|
4100 |
-
self.$container.find(".fileinput-remove, .fileinput-upload, .file-preview-frame button")
|
4101 |
-
.attr("disabled", true);
|
4102 |
-
$h.addCss(self.$container.find('.btn-file'), 'disabled');
|
4103 |
-
self._initDragDrop();
|
4104 |
-
return self.$element;
|
4105 |
-
},
|
4106 |
-
enable: function () {
|
4107 |
-
var self = this;
|
4108 |
-
self.isDisabled = false;
|
4109 |
-
self._raise('fileenabled');
|
4110 |
-
self.$element.removeAttr('disabled');
|
4111 |
-
self.$container.find(".kv-fileinput-caption").removeClass("file-caption-disabled");
|
4112 |
-
self.$container.find(".fileinput-remove, .fileinput-upload, .file-preview-frame button")
|
4113 |
-
.removeAttr("disabled");
|
4114 |
-
self.$container.find('.btn-file').removeClass('disabled');
|
4115 |
-
self._initDragDrop();
|
4116 |
-
return self.$element;
|
4117 |
-
},
|
4118 |
-
upload: function () {
|
4119 |
-
var self = this, totLen = self.getFileStack().length, i, outData, len,
|
4120 |
-
hasExtraData = !$.isEmptyObject(self._getExtraData());
|
4121 |
-
if (!self.isAjaxUpload || self.isDisabled || !self._isFileSelectionValid(totLen)) {
|
4122 |
-
return;
|
4123 |
-
}
|
4124 |
-
self._resetUpload();
|
4125 |
-
if (totLen === 0 && !hasExtraData) {
|
4126 |
-
self._showUploadError(self.msgUploadEmpty);
|
4127 |
-
return;
|
4128 |
-
}
|
4129 |
-
self.$progress.show();
|
4130 |
-
self.uploadCount = 0;
|
4131 |
-
self.uploadStatus = {};
|
4132 |
-
self.uploadLog = [];
|
4133 |
-
self.lock();
|
4134 |
-
self._setProgress(2);
|
4135 |
-
if (totLen === 0 && hasExtraData) {
|
4136 |
-
self._uploadExtraOnly();
|
4137 |
-
return;
|
4138 |
-
}
|
4139 |
-
len = self.filestack.length;
|
4140 |
-
self.hasInitData = false;
|
4141 |
-
if (self.uploadAsync) {
|
4142 |
-
outData = self._getOutData();
|
4143 |
-
self._raise('filebatchpreupload', [outData]);
|
4144 |
-
self.fileBatchCompleted = false;
|
4145 |
-
self.uploadCache = {content: [], config: [], tags: [], append: true};
|
4146 |
-
self.uploadAsyncCount = self.getFileStack().length;
|
4147 |
-
for (i = 0; i < len; i++) {
|
4148 |
-
self.uploadCache.content[i] = null;
|
4149 |
-
self.uploadCache.config[i] = null;
|
4150 |
-
self.uploadCache.tags[i] = null;
|
4151 |
-
}
|
4152 |
-
self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS);
|
4153 |
-
self._initSortable();
|
4154 |
-
self.cacheInitialPreview = self.getPreview();
|
4155 |
-
|
4156 |
-
for (i = 0; i < len; i++) {
|
4157 |
-
if (self.filestack[i]) {
|
4158 |
-
self._uploadSingle(i, true);
|
4159 |
-
}
|
4160 |
-
}
|
4161 |
-
return;
|
4162 |
-
}
|
4163 |
-
self._uploadBatch();
|
4164 |
-
return self.$element;
|
4165 |
-
},
|
4166 |
-
destroy: function () {
|
4167 |
-
var self = this, $form = self.$form, $cont = self.$container, $el = self.$element, ns = self.namespace;
|
4168 |
-
$(document).off(ns);
|
4169 |
-
$(window).off(ns);
|
4170 |
-
if ($form && $form.length) {
|
4171 |
-
$form.off(ns);
|
4172 |
-
}
|
4173 |
-
if (self.isAjaxUpload) {
|
4174 |
-
self._clearFileInput();
|
4175 |
-
}
|
4176 |
-
self._cleanup();
|
4177 |
-
self._initPreviewCache();
|
4178 |
-
$el.insertBefore($cont).off(ns).removeData();
|
4179 |
-
$cont.off().remove();
|
4180 |
-
return $el;
|
4181 |
-
},
|
4182 |
-
refresh: function (options) {
|
4183 |
-
var self = this, $el = self.$element;
|
4184 |
-
if (typeof options !== 'object' || $h.isEmpty(options)) {
|
4185 |
-
options = self.options;
|
4186 |
-
} else {
|
4187 |
-
options = $.extend(true, {}, self.options, options);
|
4188 |
-
}
|
4189 |
-
self._init(options, true);
|
4190 |
-
self._listen();
|
4191 |
-
return $el;
|
4192 |
-
},
|
4193 |
-
zoom: function (frameId) {
|
4194 |
-
var self = this, $frame = self._getFrame(frameId), $modal = self.$modal;
|
4195 |
-
if (!$frame) {
|
4196 |
-
return;
|
4197 |
-
}
|
4198 |
-
$h.initModal($modal);
|
4199 |
-
$modal.html(self._getModalContent());
|
4200 |
-
self._setZoomContent($frame);
|
4201 |
-
$modal.modal('show');
|
4202 |
-
self._initZoomButtons();
|
4203 |
-
},
|
4204 |
-
getExif: function (frameId) {
|
4205 |
-
var self = this, $frame = self._getFrame(frameId);
|
4206 |
-
return $frame && $frame.data('exif') || null;
|
4207 |
-
},
|
4208 |
-
getFrames: function (cssFilter) {
|
4209 |
-
var self = this, $frames;
|
4210 |
-
cssFilter = cssFilter || '';
|
4211 |
-
$frames = self.$preview.find($h.FRAMES + cssFilter);
|
4212 |
-
if (self.reversePreviewOrder) {
|
4213 |
-
$frames = $($frames.get().reverse());
|
4214 |
-
}
|
4215 |
-
return $frames;
|
4216 |
-
},
|
4217 |
-
getPreview: function () {
|
4218 |
-
var self = this;
|
4219 |
-
return {
|
4220 |
-
content: self.initialPreview,
|
4221 |
-
config: self.initialPreviewConfig,
|
4222 |
-
tags: self.initialPreviewThumbTags
|
4223 |
-
};
|
4224 |
-
}
|
4225 |
-
};
|
4226 |
-
|
4227 |
-
$.fn.fileinput = function (option) {
|
4228 |
-
if (!$h.hasFileAPISupport() && !$h.isIE(9)) {
|
4229 |
-
return;
|
4230 |
-
}
|
4231 |
-
var args = Array.apply(null, arguments), retvals = [];
|
4232 |
-
args.shift();
|
4233 |
-
this.each(function () {
|
4234 |
-
var self = $(this), data = self.data('fileinput'), options = typeof option === 'object' && option,
|
4235 |
-
theme = options.theme || self.data('theme'), l = {}, t = {},
|
4236 |
-
lang = options.language || self.data('language') || $.fn.fileinput.defaults.language || 'en', opt;
|
4237 |
-
if (!data) {
|
4238 |
-
if (theme) {
|
4239 |
-
t = $.fn.fileinputThemes[theme] || {};
|
4240 |
-
}
|
4241 |
-
if (lang !== 'en' && !$h.isEmpty($.fn.fileinputLocales[lang])) {
|
4242 |
-
l = $.fn.fileinputLocales[lang] || {};
|
4243 |
-
}
|
4244 |
-
opt = $.extend(true, {}, $.fn.fileinput.defaults, t, $.fn.fileinputLocales.en, l, options, self.data());
|
4245 |
-
data = new FileInput(this, opt);
|
4246 |
-
self.data('fileinput', data);
|
4247 |
-
}
|
4248 |
-
|
4249 |
-
if (typeof option === 'string') {
|
4250 |
-
retvals.push(data[option].apply(data, args));
|
4251 |
-
}
|
4252 |
-
});
|
4253 |
-
switch (retvals.length) {
|
4254 |
-
case 0:
|
4255 |
-
return this;
|
4256 |
-
case 1:
|
4257 |
-
return retvals[0];
|
4258 |
-
default:
|
4259 |
-
return retvals;
|
4260 |
-
}
|
4261 |
-
};
|
4262 |
-
|
4263 |
-
$.fn.fileinput.defaults = {
|
4264 |
-
language: 'en',
|
4265 |
-
showCaption: true,
|
4266 |
-
showBrowse: true,
|
4267 |
-
showPreview: true,
|
4268 |
-
showRemove: true,
|
4269 |
-
showUpload: true,
|
4270 |
-
showCancel: true,
|
4271 |
-
showClose: true,
|
4272 |
-
showUploadedThumbs: true,
|
4273 |
-
browseOnZoneClick: false,
|
4274 |
-
autoReplace: false,
|
4275 |
-
autoOrientImage: false, // if `true` applicable for JPEG images only
|
4276 |
-
required: false,
|
4277 |
-
rtl: false,
|
4278 |
-
hideThumbnailContent: false,
|
4279 |
-
generateFileId: null,
|
4280 |
-
previewClass: '',
|
4281 |
-
captionClass: '',
|
4282 |
-
frameClass: 'krajee-default',
|
4283 |
-
mainClass: 'file-caption-main',
|
4284 |
-
mainTemplate: null,
|
4285 |
-
purifyHtml: true,
|
4286 |
-
fileSizeGetter: null,
|
4287 |
-
initialCaption: '',
|
4288 |
-
initialPreview: [],
|
4289 |
-
initialPreviewDelimiter: '*$$*',
|
4290 |
-
initialPreviewAsData: false,
|
4291 |
-
initialPreviewFileType: 'image',
|
4292 |
-
initialPreviewConfig: [],
|
4293 |
-
initialPreviewThumbTags: [],
|
4294 |
-
previewThumbTags: {},
|
4295 |
-
initialPreviewShowDelete: true,
|
4296 |
-
initialPreviewDownloadUrl: '',
|
4297 |
-
removeFromPreviewOnError: false,
|
4298 |
-
deleteUrl: '',
|
4299 |
-
deleteExtraData: {},
|
4300 |
-
overwriteInitial: true,
|
4301 |
-
previewZoomButtonIcons: {
|
4302 |
-
prev: '<i class="glyphicon glyphicon-triangle-left"></i>',
|
4303 |
-
next: '<i class="glyphicon glyphicon-triangle-right"></i>',
|
4304 |
-
toggleheader: '<i class="glyphicon glyphicon-resize-vertical"></i>',
|
4305 |
-
fullscreen: '<i class="glyphicon glyphicon-fullscreen"></i>',
|
4306 |
-
borderless: '<i class="glyphicon glyphicon-resize-full"></i>',
|
4307 |
-
close: '<i class="glyphicon glyphicon-remove"></i>'
|
4308 |
-
},
|
4309 |
-
previewZoomButtonClasses: {
|
4310 |
-
prev: 'btn btn-navigate',
|
4311 |
-
next: 'btn btn-navigate',
|
4312 |
-
toggleheader: 'btn btn-sm btn-kv btn-default btn-outline-secondary',
|
4313 |
-
fullscreen: 'btn btn-sm btn-kv btn-default btn-outline-secondary',
|
4314 |
-
borderless: 'btn btn-sm btn-kv btn-default btn-outline-secondary',
|
4315 |
-
close: 'btn btn-sm btn-kv btn-default btn-outline-secondary'
|
4316 |
-
},
|
4317 |
-
previewTemplates: {},
|
4318 |
-
previewContentTemplates: {},
|
4319 |
-
preferIconicPreview: false,
|
4320 |
-
preferIconicZoomPreview: false,
|
4321 |
-
allowedPreviewTypes: undefined,
|
4322 |
-
allowedPreviewMimeTypes: null,
|
4323 |
-
allowedFileTypes: null,
|
4324 |
-
allowedFileExtensions: null,
|
4325 |
-
defaultPreviewContent: null,
|
4326 |
-
customLayoutTags: {},
|
4327 |
-
customPreviewTags: {},
|
4328 |
-
previewFileIcon: '<i class="glyphicon glyphicon-file"></i>',
|
4329 |
-
previewFileIconClass: 'file-other-icon',
|
4330 |
-
previewFileIconSettings: {},
|
4331 |
-
previewFileExtSettings: {},
|
4332 |
-
buttonLabelClass: 'hidden-xs',
|
4333 |
-
browseIcon: '<i class="glyphicon glyphicon-folder-open"></i> ',
|
4334 |
-
browseClass: 'btn btn-primary',
|
4335 |
-
removeIcon: '<i class="glyphicon glyphicon-trash"></i>',
|
4336 |
-
removeClass: 'btn btn-default btn-secondary',
|
4337 |
-
cancelIcon: '<i class="glyphicon glyphicon-ban-circle"></i>',
|
4338 |
-
cancelClass: 'btn btn-default btn-secondary',
|
4339 |
-
uploadIcon: '<i class="glyphicon glyphicon-upload"></i>',
|
4340 |
-
uploadClass: 'btn btn-default btn-secondary',
|
4341 |
-
uploadUrl: null,
|
4342 |
-
uploadUrlThumb: null,
|
4343 |
-
uploadAsync: true,
|
4344 |
-
uploadExtraData: {},
|
4345 |
-
zoomModalHeight: 480,
|
4346 |
-
minImageWidth: null,
|
4347 |
-
minImageHeight: null,
|
4348 |
-
maxImageWidth: null,
|
4349 |
-
maxImageHeight: null,
|
4350 |
-
resizeImage: false,
|
4351 |
-
resizePreference: 'width',
|
4352 |
-
resizeQuality: 0.92,
|
4353 |
-
resizeDefaultImageType: 'image/jpeg',
|
4354 |
-
resizeIfSizeMoreThan: 0, // in KB
|
4355 |
-
minFileSize: 0,
|
4356 |
-
maxFileSize: 0,
|
4357 |
-
maxFilePreviewSize: 25600, // 25 MB
|
4358 |
-
minFileCount: 0,
|
4359 |
-
maxFileCount: 0,
|
4360 |
-
validateInitialCount: false,
|
4361 |
-
msgValidationErrorClass: 'text-danger',
|
4362 |
-
msgValidationErrorIcon: '<i class="glyphicon glyphicon-exclamation-sign"></i> ',
|
4363 |
-
msgErrorClass: 'file-error-message',
|
4364 |
-
progressThumbClass: "progress-bar bg-success progress-bar-success progress-bar-striped active",
|
4365 |
-
progressClass: "progress-bar bg-success progress-bar-success progress-bar-striped active",
|
4366 |
-
progressCompleteClass: "progress-bar bg-success progress-bar-success",
|
4367 |
-
progressErrorClass: "progress-bar bg-danger progress-bar-danger",
|
4368 |
-
progressUploadThreshold: 99,
|
4369 |
-
previewFileType: 'image',
|
4370 |
-
elCaptionContainer: null,
|
4371 |
-
elCaptionText: null,
|
4372 |
-
elPreviewContainer: null,
|
4373 |
-
elPreviewImage: null,
|
4374 |
-
elPreviewStatus: null,
|
4375 |
-
elErrorContainer: null,
|
4376 |
-
errorCloseButton: $h.closeButton('kv-error-close'),
|
4377 |
-
slugCallback: null,
|
4378 |
-
dropZoneEnabled: true,
|
4379 |
-
dropZoneTitleClass: 'file-drop-zone-title',
|
4380 |
-
fileActionSettings: {},
|
4381 |
-
otherActionButtons: '',
|
4382 |
-
textEncoding: 'UTF-8',
|
4383 |
-
ajaxSettings: {},
|
4384 |
-
ajaxDeleteSettings: {},
|
4385 |
-
showAjaxErrorDetails: true,
|
4386 |
-
mergeAjaxCallbacks: false,
|
4387 |
-
mergeAjaxDeleteCallbacks: false,
|
4388 |
-
retryErrorUploads: true,
|
4389 |
-
reversePreviewOrder: false
|
4390 |
-
};
|
4391 |
-
|
4392 |
-
// noinspection HtmlUnknownAttribute
|
4393 |
-
$.fn.fileinputLocales.en = {
|
4394 |
-
fileSingle: 'file',
|
4395 |
-
filePlural: 'files',
|
4396 |
-
browseLabel: 'Browse …',
|
4397 |
-
removeLabel: 'Remove',
|
4398 |
-
removeTitle: 'Clear selected files',
|
4399 |
-
cancelLabel: 'Cancel',
|
4400 |
-
cancelTitle: 'Abort ongoing upload',
|
4401 |
-
uploadLabel: 'Upload',
|
4402 |
-
uploadTitle: 'Upload selected files',
|
4403 |
-
msgNo: 'No',
|
4404 |
-
msgNoFilesSelected: 'No files selected',
|
4405 |
-
msgCancelled: 'Cancelled',
|
4406 |
-
msgPlaceholder: 'Select {files}...',
|
4407 |
-
msgZoomModalHeading: 'Detailed Preview',
|
4408 |
-
msgFileRequired: 'You must select a file to upload.',
|
4409 |
-
msgSizeTooSmall: 'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.',
|
4410 |
-
msgSizeTooLarge: 'File "{name}" (<b>{size} KB</b>) exceeds maximum allowed upload size of <b>{maxSize} KB</b>.',
|
4411 |
-
msgFilesTooLess: 'You must select at least <b>{n}</b> {files} to upload.',
|
4412 |
-
msgFilesTooMany: 'Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.',
|
4413 |
-
msgFileNotFound: 'File "{name}" not found!',
|
4414 |
-
msgFileSecured: 'Security restrictions prevent reading the file "{name}".',
|
4415 |
-
msgFileNotReadable: 'File "{name}" is not readable.',
|
4416 |
-
msgFilePreviewAborted: 'File preview aborted for "{name}".',
|
4417 |
-
msgFilePreviewError: 'An error occurred while reading the file "{name}".',
|
4418 |
-
msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".',
|
4419 |
-
msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.',
|
4420 |
-
msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.',
|
4421 |
-
msgFileTypes: {
|
4422 |
-
'image': 'image',
|
4423 |
-
'html': 'HTML',
|
4424 |
-
'text': 'text',
|
4425 |
-
'video': 'video',
|
4426 |
-
'audio': 'audio',
|
4427 |
-
'flash': 'flash',
|
4428 |
-
'pdf': 'PDF',
|
4429 |
-
'object': 'object'
|
4430 |
-
},
|
4431 |
-
msgUploadAborted: 'The file upload was aborted',
|
4432 |
-
msgUploadThreshold: 'Processing...',
|
4433 |
-
msgUploadBegin: 'Initializing...',
|
4434 |
-
msgUploadEnd: 'Done',
|
4435 |
-
msgUploadEmpty: 'No valid data available for upload.',
|
4436 |
-
msgUploadError: 'Error',
|
4437 |
-
msgValidationError: 'Validation Error',
|
4438 |
-
msgLoading: 'Loading file {index} of {files} …',
|
4439 |
-
msgProgress: 'Loading file {index} of {files} - {name} - {percent}% completed.',
|
4440 |
-
msgSelected: '{n} {files} selected',
|
4441 |
-
msgFoldersNotAllowed: 'Drag & drop files only! {n} folder(s) dropped were skipped.',
|
4442 |
-
msgImageWidthSmall: 'Width of image file "{name}" must be at least {size} px.',
|
4443 |
-
msgImageHeightSmall: 'Height of image file "{name}" must be at least {size} px.',
|
4444 |
-
msgImageWidthLarge: 'Width of image file "{name}" cannot exceed {size} px.',
|
4445 |
-
msgImageHeightLarge: 'Height of image file "{name}" cannot exceed {size} px.',
|
4446 |
-
msgImageResizeError: 'Could not get the image dimensions to resize.',
|
4447 |
-
msgImageResizeException: 'Error while resizing the image.<pre>{errors}</pre>',
|
4448 |
-
msgAjaxError: 'Something went wrong with the {operation} operation. Please try again later!',
|
4449 |
-
msgAjaxProgressError: '{operation} failed',
|
4450 |
-
ajaxOperations: {
|
4451 |
-
deleteThumb: 'file delete',
|
4452 |
-
uploadThumb: 'file upload',
|
4453 |
-
uploadBatch: 'batch file upload',
|
4454 |
-
uploadExtra: 'form data upload'
|
4455 |
-
},
|
4456 |
-
dropZoneTitle: 'Drag & drop files here …',
|
4457 |
-
dropZoneClickTitle: '<br>(or click to select {files})',
|
4458 |
-
previewZoomButtonTitles: {
|
4459 |
-
prev: 'View previous file',
|
4460 |
-
next: 'View next file',
|
4461 |
-
toggleheader: 'Toggle header',
|
4462 |
-
fullscreen: 'Toggle full screen',
|
4463 |
-
borderless: 'Toggle borderless mode',
|
4464 |
-
close: 'Close detailed preview'
|
4465 |
-
},
|
4466 |
-
usePdfRenderer: function () {
|
4467 |
-
return !!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i);
|
4468 |
-
},
|
4469 |
-
pdfRendererUrl: '',
|
4470 |
-
pdfRendererTemplate: '<iframe class="kv-preview-data file-preview-pdf" src="{renderer}?file={data}" {style}></iframe>'
|
4471 |
-
};
|
4472 |
-
|
4473 |
-
$.fn.fileinput.Constructor = FileInput;
|
4474 |
-
|
4475 |
-
/**
|
4476 |
-
* Convert automatically file inputs with class 'file' into a bootstrap fileinput control.
|
4477 |
-
*/
|
4478 |
-
$(document).ready(function () {
|
4479 |
-
var $input = $('input.file[type=file]');
|
4480 |
-
if ($input.length) {
|
4481 |
-
$input.fileinput();
|
4482 |
-
}
|
4483 |
-
});
|
4484 |
-
}));
|
1 |
+
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";var t,i;e.fn.fileinputLocales={},e.fn.fileinputThemes={},String.prototype.setTokens=function(e){var t,i,a=this.toString();for(t in e)e.hasOwnProperty(t)&&(i=new RegExp("{"+t+"}","g"),a=a.replace(i,e[t]));return a},t={FRAMES:".kv-preview-thumb",SORT_CSS:"file-sortable",OBJECT_PARAMS:'<param name="controller" value="true" />\n<param name="allowFullScreen" value="true" />\n<param name="allowScriptAccess" value="always" />\n<param name="autoPlay" value="false" />\n<param name="autoStart" value="false" />\n<param name="quality" value="high" />\n',DEFAULT_PREVIEW:'<div class="file-preview-other">\n<span class="{previewFileIconClass}">{previewFileIcon}</span>\n</div>',MODAL_ID:"kvFileinputModal",MODAL_EVENTS:["show","shown","hide","hidden","loaded"],objUrl:window.URL||window.webkitURL,compare:function(e,t,i){return void 0!==e&&(i?e===t:e.match(t))},isIE:function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var t,i=document.createElement("div");return i.innerHTML="\x3c!--[if IE "+e+"]> <i></i> <![endif]--\x3e",t=i.getElementsByTagName("i").length,document.body.appendChild(i),i.parentNode.removeChild(i),t},canAssignFilesToInput:function(){var e=document.createElement("input");try{return e.type="file",e.files=null,!0}catch(e){return!1}},getDragDropFolders:function(e){var t,i,a=e.length,r=0;if(a>0&&e[0].webkitGetAsEntry())for(t=0;t<a;t++)(i=e[t].webkitGetAsEntry())&&i.isDirectory&&r++;return r},initModal:function(t){var i=e("body");i.length&&t.appendTo(i)},isEmpty:function(t,i){return null==t||0===t.length||i&&""===e.trim(t)},isArray:function(e){return Array.isArray(e)||"[object Array]"===Object.prototype.toString.call(e)},ifSet:function(e,t,i){return i=i||"",t&&"object"==typeof t&&e in t?t[e]:i},cleanArray:function(e){return e instanceof Array||(e=[]),e.filter(function(e){return null!=e})},spliceArray:function(t,i,a){var r,n,s=0,o=[];if(!(t instanceof Array))return[];for(n=e.extend(!0,[],t),a&&n.reverse(),r=0;r<n.length;r++)r!==i&&(o[s]=n[r],s++);return a&&o.reverse(),o},getNum:function(e,t){return t=t||0,"number"==typeof e?e:("string"==typeof e&&(e=parseFloat(e)),isNaN(e)?t:e)},hasFileAPISupport:function(){return!(!window.File||!window.FileReader)},hasDragDropSupport:function(){var e=document.createElement("div");return!t.isIE(9)&&(void 0!==e.draggable||void 0!==e.ondragstart&&void 0!==e.ondrop)},hasFileUploadSupport:function(){return t.hasFileAPISupport()&&window.FormData},hasBlobSupport:function(){try{return!!window.Blob&&Boolean(new Blob)}catch(e){return!1}},hasArrayBufferViewSupport:function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}},dataURI2Blob:function(e){var i,a,r,n,s,o,l=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,d=t.hasBlobSupport();if(!((d||l)&&window.atob&&window.ArrayBuffer&&window.Uint8Array))return null;for(i=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):decodeURIComponent(e.split(",")[1]),a=new ArrayBuffer(i.length),r=new Uint8Array(a),n=0;n<i.length;n+=1)r[n]=i.charCodeAt(n);return s=e.split(",")[0].split(":")[1].split(";")[0],d?new Blob([t.hasArrayBufferViewSupport()?r:a],{type:s}):((o=new l).append(a),o.getBlob(s))},arrayBuffer2String:function(e){if(window.TextDecoder)return new TextDecoder("utf-8").decode(e);var t,i,a,r,n=Array.prototype.slice.apply(new Uint8Array(e)),s="",o=0;for(t=n.length;o<t;)switch((i=n[o++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s+=String.fromCharCode(i);break;case 12:case 13:a=n[o++],s+=String.fromCharCode((31&i)<<6|63&a);break;case 14:a=n[o++],r=n[o++],s+=String.fromCharCode((15&i)<<12|(63&a)<<6|(63&r)<<0)}return s},isHtml:function(e){var t=document.createElement("div");t.innerHTML=e;for(var i=t.childNodes,a=i.length;a--;)if(1===i[a].nodeType)return!0;return!1},isSvg:function(e){return e.match(/^\s*<\?xml/i)&&(e.match(/<!DOCTYPE svg/i)||e.match(/<svg/i))},getMimeType:function(e,t,i){switch(e){case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":return"image/jpeg";case"89504E47":return"image/png";case"47494638":return"image/gif";case"49492a00":return"image/tiff";case"52494646":return"image/webp";case"66747970":return"video/3gp";case"4f676753":return"video/ogg";case"1a45dfa3":return"video/mkv";case"000001ba":case"000001b3":return"video/mpeg";case"3026b275":return"video/wmv";case"25504446":return"application/pdf";case"25215053":return"application/ps";case"504b0304":case"504b0506":case"504b0508":return"application/zip";case"377abcaf":return"application/7z";case"75737461":return"application/tar";case"7801730d":return"application/dmg";default:switch(e.substring(0,6)){case"435753":return"application/x-shockwave-flash";case"494433":return"audio/mp3";case"425a68":return"application/bzip";default:switch(e.substring(0,4)){case"424d":return"image/bmp";case"fffb":return"audio/mp3";case"4d5a":return"application/exe";case"1f9d":case"1fa0":return"application/zip";case"1f8b":return"application/gzip";default:return t&&!t.match(/[^\u0000-\u007f]/)?"application/text-plain":i}}}},addCss:function(e,t){e.removeClass(t).addClass(t)},getElement:function(i,a,r){return t.isEmpty(i)||t.isEmpty(i[a])?r:e(i[a])},uniqId:function(){return Math.round((new Date).getTime())+"_"+Math.round(100*Math.random())},htmlEncode:function(e,t){return void 0===e?t||null:e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},replaceTags:function(t,i){var a=t;return i?(e.each(i,function(e,t){"function"==typeof t&&(t=t()),a=a.split(e).join(t)}),a):a},cleanMemory:function(e){var i=e.is("img")?e.attr("src"):e.find("source").attr("src");t.objUrl.revokeObjectURL(i)},findFileName:function(e){var t=e.lastIndexOf("/");return-1===t&&(t=e.lastIndexOf("\\")),e.split(e.substring(t,t+1)).pop()},checkFullScreen:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},toggleFullScreen:function(e){var i=document,a=i.documentElement;a&&e&&!t.checkFullScreen()?a.requestFullscreen?a.requestFullscreen():a.msRequestFullscreen?a.msRequestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen&&a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.exitFullscreen?i.exitFullscreen():i.msExitFullscreen?i.msExitFullscreen():i.mozCancelFullScreen?i.mozCancelFullScreen():i.webkitExitFullscreen&&i.webkitExitFullscreen()},moveArray:function(t,i,a,r){var n=e.extend(!0,[],t);if(r&&n.reverse(),a>=n.length)for(var s=a-n.length;1+s--;)n.push(void 0);return n.splice(a,0,n.splice(i,1)[0]),r&&n.reverse(),n},cleanZoomCache:function(e){var t=e.closest(".kv-zoom-cache-theme");t.length||(t=e.closest(".kv-zoom-cache")),t.remove()},closeButton:function(e){return'<button type="button" class="'+(e=e?"close "+e:"close")+'" aria-label="Close">\n <span aria-hidden="true">×</span>\n</button>'},getRotation:function(e){switch(e){case 2:return"rotateY(180deg)";case 3:return"rotate(180deg)";case 4:return"rotate(180deg) rotateY(180deg)";case 5:return"rotate(270deg) rotateY(180deg)";case 6:return"rotate(90deg)";case 7:return"rotate(90deg) rotateY(180deg)";case 8:return"rotate(270deg)";default:return""}},setTransform:function(e,t){e&&(e.style.transform=t,e.style.webkitTransform=t,e.style["-moz-transform"]=t,e.style["-ms-transform"]=t,e.style["-o-transform"]=t)},setImageOrientation:function(e,i,a){if(e&&e.length){var r="load.fileinputimageorient";e.off(r).on(r,function(){var r=e.get(0),n=i&&i.length?i.get(0):null,s=r.offsetHeight,o=r.offsetWidth,l=t.getRotation(a);if(e.data("orientation",a),n&&i.data("orientation",a),a<5)return t.setTransform(r,l),void t.setTransform(n,l);var d=Math.atan(o/s),c=Math.sqrt(Math.pow(s,2)+Math.pow(o,2)),h=c?s/Math.cos(Math.PI/2+d)/c:1,p=" scale("+Math.abs(h)+")";t.setTransform(r,l+p),t.setTransform(n,l+p)})}}},(i=function(i,a){this.$element=e(i),this.$parent=this.$element.parent(),this._validate()&&(this.isPreviewable=t.hasFileAPISupport(),this.isIE9=t.isIE(9),this.isIE10=t.isIE(10),(this.isPreviewable||this.isIE9)&&(this._init(a),this._listen()),this.$element.removeClass("file-loading"))}).prototype={constructor:i,_cleanup:function(){this.reader=null,this.formdata={},this.uploadCount=0,this.uploadStatus={},this.uploadLog=[],this.uploadAsyncCount=0,this.loadedImages=[],this.totalImagesCount=0,this.ajaxRequests=[],this.clearStack(),this.fileBatchCompleted=!0,this.isPreviewable||(this.showPreview=!1),this.isError=!1,this.ajaxAborted=!1,this.cancelling=!1},_init:function(i,a){var r,n,s,o,l=this,d=l.$element;l.options=i,e.each(i,function(e,i){switch(e){case"minFileCount":case"maxFileCount":case"minFileSize":case"maxFileSize":case"maxFilePreviewSize":case"resizeImageQuality":case"resizeIfSizeMoreThan":case"progressUploadThreshold":case"initialPreviewCount":case"zoomModalHeight":case"minImageHeight":case"maxImageHeight":case"minImageWidth":case"maxImageWidth":l[e]=t.getNum(i);break;default:l[e]=i}}),l.rtl&&(o=l.previewZoomButtonIcons.prev,l.previewZoomButtonIcons.prev=l.previewZoomButtonIcons.next,l.previewZoomButtonIcons.next=o),a||l._cleanup(),l.$form=d.closest("form"),l._initTemplateDefaults(),l.uploadFileAttr=t.isEmpty(d.attr("name"))?"file_data":d.attr("name"),s=l._getLayoutTemplate("progress"),l.progressTemplate=s.replace("{class}",l.progressClass),l.progressCompleteTemplate=s.replace("{class}",l.progressCompleteClass),l.progressErrorTemplate=s.replace("{class}",l.progressErrorClass),l.isDisabled=d.attr("disabled")||d.attr("readonly"),l.isDisabled&&d.attr("disabled",!0),l.isAjaxUpload=t.hasFileUploadSupport()&&!t.isEmpty(l.uploadUrl),l.dropZoneEnabled=t.hasDragDropSupport()&&l.dropZoneEnabled,l.isAjaxUpload||(l.dropZoneEnabled=l.dropZoneEnabled&&t.canAssignFilesToInput()),l.isClickable=l.browseOnZoneClick&&l.showPreview&&(l.dropZoneEnabled||!t.isEmpty(l.defaultPreviewContent)),l.slug="function"==typeof i.slugCallback?i.slugCallback:l._slugDefault,l.mainTemplate=l.showCaption?l._getLayoutTemplate("main1"):l._getLayoutTemplate("main2"),l.captionTemplate=l._getLayoutTemplate("caption"),l.previewGenericTemplate=l._getPreviewTemplate("generic"),!l.imageCanvas&&l.resizeImage&&(l.maxImageWidth||l.maxImageHeight)&&(l.imageCanvas=document.createElement("canvas"),l.imageCanvasContext=l.imageCanvas.getContext("2d")),t.isEmpty(d.attr("id"))&&d.attr("id",t.uniqId()),l.namespace=".fileinput_"+d.attr("id").replace(/-/g,"_"),void 0===l.$container?l.$container=l._createContainer():l._refreshContainer(),n=l.$container,l.$dropZone=n.find(".file-drop-zone"),l.$progress=n.find(".kv-upload-progress"),l.$btnUpload=n.find(".fileinput-upload"),l.$captionContainer=t.getElement(i,"elCaptionContainer",n.find(".file-caption")),l.$caption=t.getElement(i,"elCaptionText",n.find(".file-caption-name")),t.isEmpty(l.msgPlaceholder)||(r=d.attr("multiple")?l.filePlural:l.fileSingle,l.$caption.attr("placeholder",l.msgPlaceholder.replace("{files}",r))),l.$captionIcon=l.$captionContainer.find(".file-caption-icon"),l.$previewContainer=t.getElement(i,"elPreviewContainer",n.find(".file-preview")),l.$preview=t.getElement(i,"elPreviewImage",n.find(".file-preview-thumbnails")),l.$previewStatus=t.getElement(i,"elPreviewStatus",n.find(".file-preview-status")),l.$errorContainer=t.getElement(i,"elErrorContainer",l.$previewContainer.find(".kv-fileinput-error")),l._validateDisabled(),t.isEmpty(l.msgErrorClass)||t.addCss(l.$errorContainer,l.msgErrorClass),a?l._errorsExist()||l.$errorContainer.hide():(l.$errorContainer.hide(),l.previewInitId="preview-"+t.uniqId(),l._initPreviewCache(),l._initPreview(!0),l._initPreviewActions(),l.$parent.hasClass("file-loading")&&(l.$container.insertBefore(l.$parent),l.$parent.remove())),l._setFileDropZoneTitle(),d.attr("disabled")&&l.disable(),l._initZoom(),l.hideThumbnailContent&&t.addCss(l.$preview,"hide-content")},_initTemplateDefaults:function(){var i,a,r,n,s,o,l,d,c,h=this;i=t.closeButton("fileinput-remove"),a='<div id="'+t.MODAL_ID+'" class="file-zoom-dialog modal fade" tabindex="-1" aria-labelledby="'+t.MODAL_ID+'Label"></div>',r='<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}" data-template="{template}"',n='<video class="kv-preview-data file-preview-video" controls {style}>\n<source src="{data}" type="{type}">\n'+t.DEFAULT_PREVIEW+"\n</video>\n",s='\x3c!--suppress ALL --\x3e<audio class="kv-preview-data file-preview-audio" controls {style}>\n<source src="{data}" type="{type}">\n'+t.DEFAULT_PREVIEW+"\n</audio>\n",l='<embed class="kv-preview-data file-preview-pdf" src="{data}" type="application/pdf" {style}>\n',o='<object class="kv-preview-data file-preview-object file-object {typeCss}" data="{data}" type="{type}" {style}>\n<param name="movie" value="{caption}" />\n'+t.OBJECT_PARAMS+" "+t.DEFAULT_PREVIEW+"\n</object>\n",d='<div class="kv-preview-data file-preview-other-frame" {style}>\n'+t.DEFAULT_PREVIEW+"\n</div>\n",c={width:"100%",height:"100%","min-height":"480px"},h._isPdfRendered()&&(l=h.pdfRendererTemplate.replace("{renderer}",h.pdfRendererUrl)),h.defaults={layoutTemplates:{main1:'{preview}\n<div class="kv-upload-progress kv-hidden"></div><div class="clearfix"></div>\n<div class="input-group {class}">\n {caption}\n<div class="input-group-btn input-group-append">\n {remove}\n {cancel}\n {upload}\n {browse}\n </div>\n</div>',main2:'{preview}\n<div class="kv-upload-progress kv-hidden"></div>\n<div class="clearfix"></div>\n{remove}\n{cancel}\n{upload}\n{browse}\n',preview:'<div class="file-preview {class}">\n {close} <div class="{dropClass}">\n <div class="file-preview-thumbnails">\n </div>\n <div class="clearfix"></div> <div class="file-preview-status text-center text-success"></div>\n <div class="kv-fileinput-error"></div>\n </div>\n</div>',close:i,fileIcon:'<i class="glyphicon glyphicon-file"></i>',caption:'<div class="file-caption form-control {class}" tabindex="500">\n <span class="file-caption-icon"></span>\n <input class="file-caption-name" onkeydown="return false;" onpaste="return false;">\n</div>',modalMain:a,modal:'<div class="modal-dialog modal-lg{rtl}" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">{heading}</h5>\n <span class="kv-zoom-title"></span>\n <div class="kv-zoom-actions">{toggleheader}{fullscreen}{borderless}{close}</div>\n </div>\n <div class="modal-body">\n <div class="floating-buttons"></div>\n <div class="kv-zoom-body file-zoom-content {zoomFrameClass}"></div>\n{prev} {next}\n </div>\n </div>\n</div>\n',progress:'<div class="progress">\n <div class="{class}" role="progressbar" aria-valuenow="{percent}" aria-valuemin="0" aria-valuemax="100" style="width:{percent}%;">\n {status}\n </div>\n</div>',size:" <samp>({sizeText})</samp>",footer:'<div class="file-thumbnail-footer">\n <div class="file-footer-caption" title="{caption}">\n <div class="file-caption-info">{caption}</div>\n <div class="file-size-info">{size}</div>\n </div>\n {progress}\n{indicator}\n{actions}\n</div>',indicator:'<div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>',actions:'<div class="file-actions">\n <div class="file-footer-buttons">\n {download} {upload} {delete} {zoom} {other} </div>\n</div>\n{drag}\n<div class="clearfix"></div>',actionDelete:'<button type="button" class="kv-file-remove {removeClass}" title="{removeTitle}" {dataUrl}{dataKey}>{removeIcon}</button>\n',actionUpload:'<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">{uploadIcon}</button>',actionDownload:'<a class="kv-file-download {downloadClass}" title="{downloadTitle}" href="{downloadUrl}" download="{caption}" target="_blank">{downloadIcon}</a>',actionZoom:'<button type="button" class="kv-file-zoom {zoomClass}" title="{zoomTitle}">{zoomIcon}</button>',actionDrag:'<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>',btnDefault:'<button type="{type}" tabindex="500" title="{title}" class="{css}" {status}>{icon} {label}</button>',btnLink:'<a href="{href}" tabindex="500" title="{title}" class="{css}" {status}>{icon} {label}</a>',btnBrowse:'<div tabindex="500" class="{css}" {status}>{icon} {label}</div>',zoomCache:'<div class="kv-zoom-cache" style="display:none">{zoomContent}</div>'},previewMarkupTags:{tagBefore1:'<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}" data-template="{template}"><div class="kv-file-content">\n',tagBefore2:'<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}" data-template="{template}" title="{caption}"><div class="kv-file-content">\n',tagAfter:"</div>{footer}\n</div>\n"},previewContentTemplates:{generic:"{content}\n",html:'<div class="kv-preview-data file-preview-html" title="{caption}" {style}>{data}</div>\n',image:'<img src="{data}" class="file-preview-image kv-preview-data" title="{caption}" alt="{caption}" {style}>\n',text:'<textarea class="kv-preview-data file-preview-text" title="{caption}" readonly {style}>{data}</textarea>\n',office:'<iframe class="kv-preview-data file-preview-office" src="https://view.officeapps.live.com/op/embed.aspx?src={data}" {style}></iframe>',gdocs:'<iframe class="kv-preview-data file-preview-gdocs" src="https://docs.google.com/gview?url={data}&embedded=true" {style}></iframe>',video:n,audio:s,flash:'<embed class="kv-preview-data file-preview-flash" src="{data}" type="application/x-shockwave-flash" {style}>\n',object:o,pdf:l,other:d},allowedPreviewTypes:["image","html","text","video","audio","flash","pdf","object"],previewTemplates:{},previewSettings:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:{width:"213px",height:"160px"},text:{width:"213px",height:"160px"},office:{width:"213px",height:"160px"},gdocs:{width:"213px",height:"160px"},video:{width:"213px",height:"160px"},audio:{width:"100%",height:"30px"},flash:{width:"213px",height:"160px"},object:{width:"213px",height:"160px"},pdf:{width:"100%",height:"160px"},other:{width:"213px",height:"160px"}},previewSettingsSmall:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:{width:"100%",height:"160px"},text:{width:"100%",height:"160px"},office:{width:"100%",height:"160px"},gdocs:{width:"100%",height:"160px"},video:{width:"100%",height:"auto"},audio:{width:"100%",height:"30px"},flash:{width:"100%",height:"auto"},object:{width:"100%",height:"auto"},pdf:{width:"100%",height:"160px"},other:{width:"100%",height:"160px"}},previewZoomSettings:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:c,text:c,office:{width:"100%",height:"100%","max-width":"100%","min-height":"480px"},gdocs:{width:"100%",height:"100%","max-width":"100%","min-height":"480px"},video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"480px"},object:{width:"auto",height:"100%","max-width":"100%","min-height":"480px"},pdf:c,other:{width:"auto",height:"100%","min-height":"480px"}},fileTypeSettings:{image:function(e,i){return t.compare(e,"image.*")&&!t.compare(e,/(tiff?|wmf)$/i)||t.compare(i,/\.(gif|png|jpe?g)$/i)},html:function(e,i){return t.compare(e,"text/html")||t.compare(i,/\.(htm|html)$/i)},office:function(e,i){return t.compare(e,/(word|excel|powerpoint|office)$/i)||t.compare(i,/\.(docx?|xlsx?|pptx?|pps|potx?)$/i)},gdocs:function(e,i){return t.compare(e,/(word|excel|powerpoint|office|iwork-pages|tiff?)$/i)||t.compare(i,/\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i)},text:function(e,i){return t.compare(e,"text.*")||t.compare(i,/\.(xml|javascript)$/i)||t.compare(i,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(e,i){return t.compare(e,"video.*")&&(t.compare(e,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||t.compare(i,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(e,i){return t.compare(e,"audio.*")&&(t.compare(i,/(ogg|mp3|mp?g|wav)$/i)||t.compare(i,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(e,i){return t.compare(e,"application/x-shockwave-flash",!0)||t.compare(i,/\.(swf)$/i)},pdf:function(e,i){return t.compare(e,"application/pdf",!0)||t.compare(i,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},fileActionSettings:{showRemove:!0,showUpload:!0,showDownload:!0,showZoom:!0,showDrag:!0,removeIcon:'<i class="glyphicon glyphicon-trash"></i>',removeClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",removeErrorClass:"btn btn-sm btn-kv btn-danger",removeTitle:"Remove file",uploadIcon:'<i class="glyphicon glyphicon-upload"></i>',uploadClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",uploadTitle:"Upload file",uploadRetryIcon:'<i class="glyphicon glyphicon-repeat"></i>',uploadRetryTitle:"Retry upload",downloadIcon:'<i class="glyphicon glyphicon-download"></i>',downloadClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",downloadTitle:"Download file",zoomIcon:'<i class="glyphicon glyphicon-zoom-in"></i>',zoomClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",zoomTitle:"View Details",dragIcon:'<i class="glyphicon glyphicon-move"></i>',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'<i class="glyphicon glyphicon-plus-sign text-warning"></i>',indicatorSuccess:'<i class="glyphicon glyphicon-ok-sign text-success"></i>',indicatorError:'<i class="glyphicon glyphicon-exclamation-sign text-danger"></i>',indicatorLoading:'<i class="glyphicon glyphicon-hourglass text-muted"></i>',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading ..."}},e.each(h.defaults,function(t,i){"allowedPreviewTypes"!==t?h[t]=e.extend(!0,{},i,h[t]):void 0===h.allowedPreviewTypes&&(h.allowedPreviewTypes=i)}),h._initPreviewTemplates()},_initPreviewTemplates:function(){var i,a=this,r=a.previewMarkupTags,n=r.tagAfter;e.each(a.previewContentTemplates,function(e,s){t.isEmpty(a.previewTemplates[e])&&(i=r.tagBefore2,"generic"!==e&&"image"!==e&&"html"!==e&&"text"!==e||(i=r.tagBefore1),a._isPdfRendered()&&"pdf"===e&&(i=i.replace("kv-file-content","kv-file-content kv-pdf-rendered")),a.previewTemplates[e]=i+s+n)})},_initPreviewCache:function(){var i=this;i.previewCache={data:{},init:function(){var e=i.initialPreview;e.length>0&&!t.isArray(e)&&(e=e.split(i.initialPreviewDelimiter)),i.previewCache.data={content:e,config:i.initialPreviewConfig,tags:i.initialPreviewThumbTags}},count:function(){return i.previewCache.data&&i.previewCache.data.content?i.previewCache.data.content.length:0},get:function(a,r){var n,s,o,l,d,c,h,p="init_"+a,u=i.previewCache.data,f=u.config[a],m=u.content[a],g=i.previewInitId+"-"+p,v=t.ifSet("previewAsData",f,i.initialPreviewAsData),w=function(e,a,r,n,s,o,l,d,c){return d=" file-preview-initial "+t.SORT_CSS+(d?" "+d:""),i._generatePreviewTemplate(e,a,r,n,s,!1,null,d,o,l,c)};return m?(r=void 0===r||r,o=t.ifSet("type",f,i.initialPreviewFileType||"generic"),d=t.ifSet("filename",f,t.ifSet("caption",f)),c=t.ifSet("filetype",f,o),l=i.previewCache.footer(a,r,f&&f.size||null),h=t.ifSet("frameClass",f),n=v?w(o,m,d,c,g,l,p,h):w("generic",m,d,c,g,l,p,h,o).setTokens({content:u.content[a]}),u.tags.length&&u.tags[a]&&(n=t.replaceTags(n,u.tags[a])),t.isEmpty(f)||t.isEmpty(f.frameAttr)||((s=e(document.createElement("div")).html(n)).find(".file-preview-initial").attr(f.frameAttr),n=s.html(),s.remove()),n):""},add:function(e,a,r,n){var s,o=i.previewCache.data;return t.isArray(e)||(e=e.split(i.initialPreviewDelimiter)),n?(s=o.content.push(e)-1,o.config[s]=a,o.tags[s]=r):(s=e.length-1,o.content=e,o.config=a,o.tags=r),i.previewCache.data=o,s},set:function(e,a,r,n){var s,o=i.previewCache.data;if(e&&e.length&&(t.isArray(e)||(e=e.split(i.initialPreviewDelimiter)),e.filter(function(e){return null!==e}).length)){if(void 0===o.content&&(o.content=[]),void 0===o.config&&(o.config=[]),void 0===o.tags&&(o.tags=[]),n){for(s=0;s<e.length;s++)e[s]&&o.content.push(e[s]);for(s=0;s<a.length;s++)a[s]&&o.config.push(a[s]);for(s=0;s<r.length;s++)r[s]&&o.tags.push(r[s])}else o.content=e,o.config=a,o.tags=r;i.previewCache.data=o}},unset:function(e){var a=i.previewCache.count(),r=i.reversePreviewOrder;if(a){if(1===a)return i.previewCache.data.content=[],i.previewCache.data.config=[],i.previewCache.data.tags=[],i.initialPreview=[],i.initialPreviewConfig=[],void(i.initialPreviewThumbTags=[]);i.previewCache.data.content=t.spliceArray(i.previewCache.data.content,e,r),i.previewCache.data.config=t.spliceArray(i.previewCache.data.config,e,r),i.previewCache.data.tags=t.spliceArray(i.previewCache.data.tags,e,r)}},out:function(){var e,t,a="",r=i.previewCache.count();if(0===r)return{content:"",caption:""};for(e=0;e<r;e++)t=i.previewCache.get(e),a=i.reversePreviewOrder?t+a:a+t;return{content:a,caption:i._getMsgSelected(r)}},footer:function(e,a,r){var n=i.previewCache.data||{};if(t.isEmpty(n.content))return"";(t.isEmpty(n.config)||t.isEmpty(n.config[e]))&&(n.config[e]={}),a=void 0===a||a;var s,o=n.config[e],l=t.ifSet("caption",o),d=t.ifSet("width",o,"auto"),c=t.ifSet("url",o,!1),h=t.ifSet("key",o,null),p=i.fileActionSettings,u=i.initialPreviewShowDelete||!1,f=o.downloadUrl||i.initialPreviewDownloadUrl||"",m=o.filename||o.caption||"",g=!!f,v=t.ifSet("showRemove",o,t.ifSet("showRemove",p,u)),w=t.ifSet("showDownload",o,t.ifSet("showDownload",p,g)),_=t.ifSet("showZoom",o,t.ifSet("showZoom",p,!0)),b=t.ifSet("showDrag",o,t.ifSet("showDrag",p,!0)),C=!1===c&&a;return w=w&&!1!==o.downloadUrl&&!!f,s=i._renderFileActions(!1,w,v,_,b,C,c,h,!0,f,m),i._getLayoutTemplate("footer").setTokens({progress:i._renderThumbProgress(),actions:s,caption:l,size:i._getSize(r),width:d,indicator:""})}},i.previewCache.init()},_isPdfRendered:function(){var e=this.usePdfRenderer;return("function"==typeof e?e():!!e)&&this.pdfRendererUrl},_handler:function(e,t,i){var a=this.namespace,r=t.split(" ").join(a+" ")+a;e&&e.length&&e.off(r).on(r,i)},_log:function(e){var t=this.$element.attr("id");t&&(e='"'+t+'": '+e),e="bootstrap-fileinput: "+e,void 0!==window.console.log?window.console.log(e):window.alert(e)},_validate:function(){var e="file"===this.$element.attr("type");return e||this._log('The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.'),e},_errorsExist:function(){var t;return!!this.$errorContainer.find("li").length||((t=e(document.createElement("div")).html(this.$errorContainer.html())).find(".kv-error-close").remove(),t.find("ul").remove(),!!e.trim(t.text()).length)},_errorHandler:function(e,t){var i=this,a=e.target.error,r=function(e){i._showError(e.replace("{name}",t))};a.code===a.NOT_FOUND_ERR?r(i.msgFileNotFound):a.code===a.SECURITY_ERR?r(i.msgFileSecured):a.code===a.NOT_READABLE_ERR?r(i.msgFileNotReadable):a.code===a.ABORT_ERR?r(i.msgFilePreviewAborted):r(i.msgFilePreviewError)},_addError:function(e){var t=this,i=t.$errorContainer;e&&i.length&&(i.html(t.errorCloseButton+e),t._handler(i.find(".kv-error-close"),"click",function(){setTimeout(function(){t.showPreview&&!t.getFrames().length&&t.clear(),i.fadeOut("slow")},10)}))},_setValidationError:function(e){e=(e?e+" ":"")+"has-error",this.$container.removeClass(e).addClass("has-error"),t.addCss(this.$captionContainer,"is-invalid")},_resetErrors:function(e){var t=this.$errorContainer;this.isError=!1,this.$container.removeClass("has-error"),this.$captionContainer.removeClass("is-invalid"),t.html(""),e?t.fadeOut("slow"):t.hide()},_showFolderError:function(e){var t,i=this.$errorContainer;e&&(this.isAjaxUpload||this._clearFileInput(),t=this.msgFoldersNotAllowed.replace("{n}",e),this._addError(t),this._setValidationError(),i.fadeIn(800),this._raise("filefoldererror",[e,t]))},_showUploadError:function(e,t,i){var a=this.$errorContainer,r=i||"fileuploaderror",n=t&&t.id?'<li data-file-id="'+t.id+'">'+e+"</li>":"<li>"+e+"</li>";return 0===a.find("ul").length?this._addError("<ul>"+n+"</ul>"):a.find("ul").append(n),a.fadeIn(800),this._raise(r,[t,e]),this._setValidationError("file-input-new"),!0},_showError:function(e,t,i){var a=this.$errorContainer,r=i||"fileerror";return(t=t||{}).reader=this.reader,this._addError(e),a.fadeIn(800),this._raise(r,[t,e]),this.isAjaxUpload||this._clearFileInput(),this._setValidationError("file-input-new"),this.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(e){var t=this.minFileCount>1?this.filePlural:this.fileSingle,i=this.msgFilesTooLess.replace("{n}",this.minFileCount).replace("{files}",t),a=this.$errorContainer;this._addError(i),this.isError=!0,this._updateFileDetails(0),a.fadeIn(800),this._raise("fileerror",[e,i]),this._clearFileInput(),this._setValidationError()},_parseError:function(t,i,a,r){var n,s=e.trim(a+""),o=void 0!==i.responseJSON&&void 0!==i.responseJSON.error?i.responseJSON.error:i.responseText;return this.cancelling&&this.msgUploadAborted&&(s=this.msgUploadAborted),this.showAjaxErrorDetails&&o&&(n=(o=e.trim(o.replace(/\n\s*\n/g,"\n"))).length?"<pre>"+o+"</pre>":"",s+=s?n:o),s||(s=this.msgAjaxError.replace("{operation}",t)),this.cancelling=!1,r?"<b>"+r+": </b>"+s:s},_parseFileType:function(e,i){var a,r,n,s=this.allowedPreviewTypes||[];if("application/text-plain"===e)return"text";for(n=0;n<s.length;n++)if(r=s[n],a=(0,this.fileTypeSettings[r])(e,i)?r:"",!t.isEmpty(a))return a;return"other"},_getPreviewIcon:function(t){var i,a=this,r=null;return t&&t.indexOf(".")>-1&&(i=t.split(".").pop(),a.previewFileIconSettings&&(r=a.previewFileIconSettings[i]||a.previewFileIconSettings[i.toLowerCase()]||null),a.previewFileExtSettings&&e.each(a.previewFileExtSettings,function(e,t){a.previewFileIconSettings[e]&&t(i)&&(r=a.previewFileIconSettings[e])})),r},_parseFilePreviewIcon:function(e,t){var i=this._getPreviewIcon(t)||this.previewFileIcon,a=e;return a.indexOf("{previewFileIcon}")>-1&&(a=a.setTokens({previewFileIconClass:this.previewFileIconClass,previewFileIcon:i})),a},_raise:function(t,i){var a=e.Event(t);if(void 0!==i?this.$element.trigger(a,i):this.$element.trigger(a),a.isDefaultPrevented()||!1===a.result)return!1;switch(t){case"filebatchuploadcomplete":case"filebatchuploadsuccess":case"fileuploaded":case"fileclear":case"filecleared":case"filereset":case"fileerror":case"filefoldererror":case"fileuploaderror":case"filebatchuploaderror":case"filedeleteerror":case"filecustomerror":case"filesuccessremove":break;default:this.ajaxAborted||(this.ajaxAborted=a.result)}return!0},_listenFullScreen:function(e){var t,i,a=this.$modal;a&&a.length&&(t=a&&a.find(".btn-fullscreen"),i=a&&a.find(".btn-borderless"),t.length&&i.length&&(t.removeClass("active").attr("aria-pressed","false"),i.removeClass("active").attr("aria-pressed","false"),e?t.addClass("active").attr("aria-pressed","true"):i.addClass("active").attr("aria-pressed","true"),a.hasClass("file-zoom-fullscreen")?this._maximizeZoomDialog():e?this._maximizeZoomDialog():i.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var i=this,a=i.$element,r=i.$form,n=i.$container;i._handler(a,"click",function(e){a.hasClass("file-no-browse")&&(a.data("zoneClicked")?a.data("zoneClicked",!1):e.preventDefault())}),i._handler(a,"change",e.proxy(i._change,i)),i.showBrowse&&i._handler(i.$btnFile,"click",e.proxy(i._browse,i)),i._handler(n.find(".fileinput-remove:not([disabled])"),"click",e.proxy(i.clear,i)),i._handler(n.find(".fileinput-cancel"),"click",e.proxy(i.cancel,i)),i._initDragDrop(),i._handler(r,"reset",e.proxy(i.clear,i)),i.isAjaxUpload||i._handler(r,"submit",e.proxy(i._submitForm,i)),i._handler(i.$container.find(".fileinput-upload"),"click",e.proxy(i._uploadClick,i)),i._handler(e(window),"resize",function(){i._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),i._handler(e(document),"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){i._listenFullScreen(t.checkFullScreen())}),i._autoFitContent(),i._initClickable(),i._refreshPreview()},_autoFitContent:function(){var t,i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=this,r=i<400?a.previewSettingsSmall||a.defaults.previewSettingsSmall:a.previewSettings||a.defaults.previewSettings;e.each(r,function(e,i){t=".file-preview-frame .file-preview-"+e,a.$preview.find(t+".kv-preview-data,"+t+" .kv-preview-data").css(i)})},_scanDroppedItems:function(e,t,i){i=i||"";var a,r,n,s=this,o=function(e){s._log("Error scanning dropped files!"),s._log(e)};e.isFile?e.file(function(e){t.push(e)},o):e.isDirectory&&(r=e.createReader(),(n=function(){r.readEntries(function(r){if(r&&r.length>0){for(a=0;a<r.length;a++)s._scanDroppedItems(r[a],t,i+e.name+"/");n()}return null},o)})())},_initDragDrop:function(){var t=this.$dropZone;this.dropZoneEnabled&&this.showPreview&&(this._handler(t,"dragenter dragover",e.proxy(this._zoneDragEnter,this)),this._handler(t,"dragleave",e.proxy(this._zoneDragLeave,this)),this._handler(t,"drop",e.proxy(this._zoneDrop,this)),this._handler(e(document),"dragenter dragover drop",this._zoneDragDropInit))},_zoneDragDropInit:function(e){e.stopPropagation(),e.preventDefault()},_zoneDragEnter:function(i){var a=e.inArray("Files",i.originalEvent.dataTransfer.types)>-1;if(this._zoneDragDropInit(i),this.isDisabled||!a)return i.originalEvent.dataTransfer.effectAllowed="none",void(i.originalEvent.dataTransfer.dropEffect="none");t.addCss(this.$dropZone,"file-highlighted")},_zoneDragLeave:function(e){this._zoneDragDropInit(e),this.isDisabled||this.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(e){var i,a=this,r=a.$element,n=e.originalEvent.dataTransfer,s=n.files,o=n.items,l=t.getDragDropFolders(o),d=function(){a.isAjaxUpload?a._change(e,s):(a.changeTriggered=!0,r.get(0).files=s,setTimeout(function(){a.changeTriggered=!1,r.trigger("change"+a.namespace)},10)),a.$dropZone.removeClass("file-highlighted")};if(e.preventDefault(),!a.isDisabled&&!t.isEmpty(s))if(l>0){if(!a.isAjaxUpload)return void a._showFolderError(l);for(s=[],i=0;i<o.length;i++){var c=o[i].webkitGetAsEntry();c&&a._scanDroppedItems(c,s)}setTimeout(function(){d()},500)}else d()},_uploadClick:function(e){var i,a=this.$container.find(".fileinput-upload"),r=!a.hasClass("disabled")&&t.isEmpty(a.attr("disabled"));e&&e.isDefaultPrevented()||(this.isAjaxUpload?(e.preventDefault(),r&&this.upload()):r&&"submit"!==a.attr("type")&&((i=a.closest("form")).length&&i.trigger("submit"),e.preventDefault()))},_submitForm:function(){return this._isFileSelectionValid()&&!this._abort({})},_clearPreview:function(){var i=this.$preview;(this.showUploadedThumbs?this.getFrames(":not(.file-preview-success)"):this.getFrames()).each(function(){var a=e(this);a.remove(),t.cleanZoomCache(i.find("#zoom-"+a.attr("id")))}),this.getFrames().length&&this.showPreview||this._resetUpload(),this._validateDefaultPreview()},_initSortable:function(){var i,a=this,r=a.$preview,n="."+t.SORT_CSS,s=a.reversePreviewOrder;window.KvSortable&&0!==r.find(n).length&&(i={handle:".drag-handle-init",dataIdAttr:"data-preview-id",scroll:!1,draggable:n,onSort:function(i){var r=i.oldIndex,n=i.newIndex,o=0;a.initialPreview=t.moveArray(a.initialPreview,r,n,s),a.initialPreviewConfig=t.moveArray(a.initialPreviewConfig,r,n,s),a.previewCache.init(),a.getFrames(".file-preview-initial").each(function(){e(this).attr("data-fileindex","init_"+o),o++}),a._raise("filesorted",{previewId:e(i.item).attr("id"),oldIndex:r,newIndex:n,stack:a.initialPreviewConfig})}},r.data("kvsortable")&&r.kvsortable("destroy"),e.extend(!0,i,a.fileActionSettings.dragSettings),r.kvsortable(i))},_setPreviewContent:function(e){this.$preview.html(e),this._autoFitContent()},_initPreview:function(e){var i,a=this.initialCaption||"";if(!this.previewCache.count())return this._clearPreview(),void(e?this._setCaption(a):this._initCaption());i=this.previewCache.out(),a=e&&this.initialCaption?this.initialCaption:i.caption,this._setPreviewContent(i.content),this._setInitThumbAttr(),this._setCaption(a),this._initSortable(),t.isEmpty(i.content)||this.$container.removeClass("file-input-new")},_getZoomButton:function(e){var t=this.previewZoomButtonIcons[e],i=this.previewZoomButtonClasses[e],a=' title="'+(this.previewZoomButtonTitles[e]||"")+'" '+("close"===e?' data-dismiss="modal" aria-hidden="true"':"");return"fullscreen"!==e&&"borderless"!==e&&"toggleheader"!==e||(a+=' data-toggle="button" aria-pressed="false" autocomplete="off"'),'<button type="button" class="'+i+" btn-"+e+'"'+a+">"+t+"</button>"},_getModalContent:function(){return this._getLayoutTemplate("modal").setTokens({rtl:this.rtl?" kv-rtl":"",zoomFrameClass:this.frameClass,heading:this.msgZoomModalHeading,prev:this._getZoomButton("prev"),next:this._getZoomButton("next"),toggleheader:this._getZoomButton("toggleheader"),fullscreen:this._getZoomButton("fullscreen"),borderless:this._getZoomButton("borderless"),close:this._getZoomButton("close")})},_listenModalEvent:function(e){var i=this,a=i.$modal;a.on(e+".bs.modal",function(r){var n=a.find(".btn-fullscreen"),s=a.find(".btn-borderless");i._raise("filezoom"+e,function(e){return{sourceEvent:e,previewId:a.data("previewId"),modal:a}}(r)),"shown"===e&&(s.removeClass("active").attr("aria-pressed","false"),n.removeClass("active").attr("aria-pressed","false"),a.hasClass("file-zoom-fullscreen")&&(i._maximizeZoomDialog(),t.checkFullScreen()?n.addClass("active").attr("aria-pressed","true"):s.addClass("active").attr("aria-pressed","true")))})},_initZoom:function(){var i,a=this,r=a._getLayoutTemplate("modalMain"),n="#"+t.MODAL_ID;a.showPreview&&(a.$modal=e(n),a.$modal&&a.$modal.length||(i=e(document.createElement("div")).html(r).insertAfter(a.$container),a.$modal=e(n).insertBefore(i),i.remove()),t.initModal(a.$modal),a.$modal.html(a._getModalContent()),e.each(t.MODAL_EVENTS,function(e,t){a._listenModalEvent(t)}))},_initZoomButtons:function(){var t,i,a=this.$modal.data("previewId")||"",r=this.getFrames().toArray(),n=r.length,s=this.$modal.find(".btn-prev"),o=this.$modal.find(".btn-next");if(r.length<2)return s.hide(),void o.hide();s.show(),o.show(),n&&(t=e(r[0]),i=e(r[n-1]),s.removeAttr("disabled"),o.removeAttr("disabled"),t.length&&t.attr("id")===a&&s.attr("disabled",!0),i.length&&i.attr("id")===a&&o.attr("disabled",!0))},_maximizeZoomDialog:function(){var t=this.$modal,i=t.find(".modal-header:visible"),a=t.find(".modal-footer:visible"),r=t.find(".modal-body"),n=e(window).height();t.addClass("file-zoom-fullscreen"),i&&i.length&&(n-=i.outerHeight(!0)),a&&a.length&&(n-=a.outerHeight(!0)),r&&r.length&&(n-=r.outerHeight(!0)-r.height()),t.find(".kv-zoom-body").height(n)},_resizeZoomDialog:function(e){var i=this.$modal,a=i.find(".btn-fullscreen"),r=i.find(".btn-borderless");if(i.hasClass("file-zoom-fullscreen"))t.toggleFullScreen(!1),e?a.hasClass("active")||(i.removeClass("file-zoom-fullscreen"),this._resizeZoomDialog(!0),r.hasClass("active")&&r.removeClass("active").attr("aria-pressed","false")):a.hasClass("active")?a.removeClass("active").attr("aria-pressed","false"):(i.removeClass("file-zoom-fullscreen"),this.$modal.find(".kv-zoom-body").css("height",this.zoomModalHeight));else{if(!e)return void this._maximizeZoomDialog();t.toggleFullScreen(!0)}i.focus()},_setZoomContent:function(i,a){var r,n,s,o,l,d,c,h,p=this,u=i.attr("id"),f=p.$modal,m=f.find(".btn-prev"),g=f.find(".btn-next"),v=f.find(".btn-fullscreen"),w=f.find(".btn-borderless"),_=f.find(".btn-toggleheader"),b=p.$preview.find("#zoom-"+u);n=b.attr("data-template")||"generic",s=(r=b.find(".kv-file-content")).length?r.html():"",o=(i.data("caption")||"")+" "+(i.data("size")||""),f.find(".kv-zoom-title").attr("title",e("<div/>").html(o).text()).html(o),l=f.find(".kv-zoom-body"),f.removeClass("kv-single-content"),a?(h=l.addClass("file-thumb-loading").clone().insertAfter(l),l.html(s).hide(),h.fadeOut("fast",function(){l.fadeIn("fast",function(){l.removeClass("file-thumb-loading")}),h.remove()})):l.html(s),(c=p.previewZoomSettings[n])&&(d=l.find(".kv-preview-data"),t.addCss(d,"file-zoom-detail"),e.each(c,function(e,t){d.css(e,t),(d.attr("width")&&"width"===e||d.attr("height")&&"height"===e)&&d.removeAttr(e)})),f.data("previewId",u),p._handler(m,"click",function(){p._zoomSlideShow("prev",u)}),p._handler(g,"click",function(){p._zoomSlideShow("next",u)}),p._handler(v,"click",function(){p._resizeZoomDialog(!0)}),p._handler(w,"click",function(){p._resizeZoomDialog(!1)}),p._handler(_,"click",function(){var e,t=f.find(".modal-header"),i=f.find(".modal-body .floating-buttons"),a=t.find(".kv-zoom-actions"),r=function(e){var i=p.$modal.find(".kv-zoom-body"),a=p.zoomModalHeight;f.hasClass("file-zoom-fullscreen")&&(a=i.outerHeight(!0),e||(a-=t.outerHeight(!0))),i.css("height",e?a+e:a)};t.is(":visible")?(e=t.outerHeight(!0),t.slideUp("slow",function(){a.find(".btn").appendTo(i),r(e)})):(i.find(".btn").appendTo(a),t.slideDown("slow",function(){r()})),f.focus()}),p._handler(f,"keydown",function(e){var t=e.which||e.keyCode;37!==t||m.attr("disabled")||p._zoomSlideShow("prev",u),39!==t||g.attr("disabled")||p._zoomSlideShow("next",u)})},_zoomPreview:function(e){var i,a=this.$modal;if(!e.length)throw"Cannot zoom to detailed preview!";t.initModal(a),a.html(this._getModalContent()),i=e.closest(t.FRAMES),this._setZoomContent(i),a.modal("show"),this._initZoomButtons()},_zoomSlideShow:function(t,i){var a,r,n,s=this.$modal.find(".kv-zoom-actions .btn-"+t),o=this.getFrames().toArray(),l=o.length;if(!s.attr("disabled")){for(r=0;r<l;r++)if(e(o[r]).attr("id")===i){n="prev"===t?r-1:r+1;break}n<0||n>=l||!o[n]||((a=e(o[n])).length&&this._setZoomContent(a,!0),this._initZoomButtons(),this._raise("filezoom"+t,{previewId:i,modal:this.$modal}))}},_initZoomButton:function(){var t=this;t.$preview.find(".kv-file-zoom").each(function(){var i=e(this);t._handler(i,"click",function(){t._zoomPreview(i)})})},_inputFileCount:function(){return this.$element.get(0).files.length},_refreshPreview:function(){var e;this._inputFileCount()&&this.showPreview&&this.isPreviewable&&(this.isAjaxUpload?(e=this.getFileStack(),this.filestack=[],e.length?this._clearFileInput():e=this.$element.get(0).files):e=this.$element.get(0).files,e&&e.length&&(this.readFiles(e),this._setFileDropZoneTitle()))},_clearObjects:function(t){t.find("video audio").each(function(){this.pause(),e(this).remove()}),t.find("img object div").each(function(){e(this).remove()})},_clearFileInput:function(){var t,i,a,r=this.$element;this._inputFileCount()&&(t=r.closest("form"),i=e(document.createElement("form")),a=e(document.createElement("div")),r.before(a),t.length?t.after(i):a.after(i),i.append(r).trigger("reset"),a.before(r).remove(),i.remove())},_resetUpload:function(){this.uploadCache={content:[],config:[],tags:[],append:!0},this.uploadCount=0,this.uploadStatus={},this.uploadLog=[],this.uploadAsyncCount=0,this.loadedImages=[],this.totalImagesCount=0,this.$btnUpload.removeAttr("disabled"),this._setProgress(0),this.$progress.hide(),this._resetErrors(!1),this.ajaxAborted=!1,this.ajaxRequests=[],this._resetCanvas(),this.cacheInitialPreview={},this.overwriteInitial&&(this.initialPreview=[],this.initialPreviewConfig=[],this.initialPreviewThumbTags=[],this.previewCache.data={content:[],config:[],tags:[]})},_resetCanvas:function(){this.canvas&&this.imageCanvasContext&&this.imageCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)},_hasInitialPreview:function(){return!this.overwriteInitial&&this.previewCache.count()},_resetPreview:function(){var e,t;this.previewCache.count()?(e=this.previewCache.out(),this._setPreviewContent(e.content),this._setInitThumbAttr(),t=this.initialCaption?this.initialCaption:e.caption,this._setCaption(t)):(this._clearPreview(),this._initCaption()),this.showPreview&&(this._initZoom(),this._initSortable())},_clearDefaultPreview:function(){this.$preview.find(".file-default-preview").remove()},_validateDefaultPreview:function(){this.showPreview&&!t.isEmpty(this.defaultPreviewContent)&&(this._setPreviewContent('<div class="file-default-preview">'+this.defaultPreviewContent+"</div>"),this.$container.removeClass("file-input-new"),this._initClickable())},_resetPreviewThumbs:function(e){var t;if(e)return this._clearPreview(),void this.clearStack();this._hasInitialPreview()?(t=this.previewCache.out(),this._setPreviewContent(t.content),this._setInitThumbAttr(),this._setCaption(t.caption),this._initPreviewActions()):this._clearPreview()},_getLayoutTemplate:function(e){var i=this.layoutTemplates[e];return t.isEmpty(this.customLayoutTags)?i:t.replaceTags(i,this.customLayoutTags)},_getPreviewTemplate:function(e){var i=this.previewTemplates[e];return t.isEmpty(this.customPreviewTags)?i:t.replaceTags(i,this.customPreviewTags)},_getOutData:function(e,t,i){return e=e||{},t=t||{},i=i||this.filestack.slice(0)||{},{form:this.formdata,files:i,filenames:this.filenames,filescount:this.getFilesCount(),extra:this._getExtraData(),response:t,reader:this.reader,jqXHR:e}},_getMsgSelected:function(e){var t=1===e?this.fileSingle:this.filePlural;return e>0?this.msgSelected.replace("{n}",e).replace("{files}",t):this.msgNoFilesSelected},_getFrame:function(t){var i=e("#"+t);return i.length?i:(this._log('Invalid thumb frame with id: "'+t+'".'),null)},_getThumbs:function(e){return e=e||"",this.getFrames(":not(.file-preview-initial)"+e)},_getExtraData:function(e,t){var i=this.uploadExtraData;return"function"==typeof this.uploadExtraData&&(i=this.uploadExtraData(e,t)),i},_initXhr:function(e,t,i){var a=this;return e.upload&&e.upload.addEventListener("progress",function(e){var r=0,n=e.total,s=e.loaded||e.position;e.lengthComputable&&(r=Math.floor(s/n*100)),t?a._setAsyncUploadStatus(t,r,i):a._setProgress(r)},!1),e},_initAjaxSettings:function(){this._ajaxSettings=e.extend(!0,{},this.ajaxSettings),this._ajaxDeleteSettings=e.extend(!0,{},this.ajaxDeleteSettings)},_mergeAjaxCallback:function(e,t,i){var a,r=this._ajaxSettings,n=this.mergeAjaxCallbacks;"delete"===i&&(r=this._ajaxDeleteSettings,n=this.mergeAjaxDeleteCallbacks),a=r[e],r[e]=n&&"function"==typeof a?"before"===n?function(){a.apply(this,arguments),t.apply(this,arguments)}:function(){t.apply(this,arguments),a.apply(this,arguments)}:t},_ajaxSubmit:function(t,i,a,r,n,s){var o,l=this;l._raise("filepreajax",[n,s])&&(l._uploadExtra(n,s),l._initAjaxSettings(),l._mergeAjaxCallback("beforeSend",t),l._mergeAjaxCallback("success",i),l._mergeAjaxCallback("complete",a),l._mergeAjaxCallback("error",r),o=e.extend(!0,{},{xhr:function(){var t=e.ajaxSettings.xhr();return l._initXhr(t,n,l.getFileStack().length)},url:s&&l.uploadUrlThumb?l.uploadUrlThumb:l.uploadUrl,type:"POST",dataType:"json",data:l.formdata,cache:!1,processData:!1,contentType:!1},l._ajaxSettings),l.ajaxRequests.push(e.ajax(o)))},_mergeArray:function(e,i){var a=t.cleanArray(this[e]),r=t.cleanArray(i);this[e]=a.concat(r)},_initUploadSuccess:function(i,a,r){var n,s,o,l,d,c,h,p,u,f=this;f.showPreview&&"object"==typeof i&&!e.isEmptyObject(i)&&void 0!==i.initialPreview&&i.initialPreview.length>0&&(f.hasInitData=!0,c=i.initialPreview||[],h=i.initialPreviewConfig||[],p=i.initialPreviewThumbTags||[],n=void 0===i.append||i.append,c.length>0&&!t.isArray(c)&&(c=c.split(f.initialPreviewDelimiter)),f._mergeArray("initialPreview",c),f._mergeArray("initialPreviewConfig",h),f._mergeArray("initialPreviewThumbTags",p),void 0!==a?r?(u=a.attr("data-fileindex"),f.uploadCache.content[u]=c[0],f.uploadCache.config[u]=h[0]||[],f.uploadCache.tags[u]=p[0]||[],f.uploadCache.append=n):(o=f.previewCache.add(c,h[0],p[0],n),s=f.previewCache.get(o,!1),(d=(l=e(document.createElement("div")).html(s).hide().insertAfter(a)).find(".kv-zoom-cache"))&&d.length&&d.insertAfter(a),a.fadeOut("slow",function(){var e=l.find(".file-preview-frame");e&&e.length&&e.insertBefore(a).fadeIn("slow").css("display:inline-block"),f._initPreviewActions(),f._clearFileInput(),t.cleanZoomCache(f.$preview.find("#zoom-"+a.attr("id"))),a.remove(),l.remove(),f._initSortable()})):(f.previewCache.set(c,h,p,n),f._initPreview(),f._initPreviewActions()))},_initSuccessThumbs:function(){var i=this;i.showPreview&&i._getThumbs(t.FRAMES+".file-preview-success").each(function(){var a=e(this),r=i.$preview,n=a.find(".kv-file-remove");n.removeAttr("disabled"),i._handler(n,"click",function(){var e=a.attr("id"),n=i._raise("filesuccessremove",[e,a.attr("data-fileindex")]);t.cleanMemory(a),!1!==n&&a.fadeOut("slow",function(){t.cleanZoomCache(r.find("#zoom-"+e)),a.remove(),i.getFrames().length||i.reset()})})})},_checkAsyncComplete:function(){var t,i;for(i=0;i<this.filestack.length;i++)if(this.filestack[i]&&(t=this.previewInitId+"-"+i,-1===e.inArray(t,this.uploadLog)))return!1;return this.uploadAsyncCount===this.uploadLog.length},_uploadExtra:function(t,i){var a=this,r=a._getExtraData(t,i);0!==r.length&&e.each(r,function(e,t){a.formdata.append(e,t)})},_uploadSingle:function(i,a){var r,n,s,o,l,d,c,h,p,u,f,m=this,g=m.getFileStack().length,v=new FormData,w=m.previewInitId+"-"+i,_=m.filestack.length>0||!e.isEmptyObject(m.uploadExtraData),b=e("#"+w).find(".file-thumb-progress"),C={id:w,index:i};m.formdata=v,m.showPreview&&(n=e("#"+w+":not(.file-preview-initial)"),o=n.find(".kv-file-upload"),l=n.find(".kv-file-remove"),b.show()),0===g||!_||o&&o.hasClass("disabled")||m._abort(C)||(f=function(e,t){d||m.updateStack(e,void 0),m.uploadLog.push(t),m._checkAsyncComplete()&&(m.fileBatchCompleted=!0)},s=function(){var e,i,a,r=m.uploadCache,n=0,s=m.cacheInitialPreview;m.fileBatchCompleted&&(s&&s.content&&(n=s.content.length),setTimeout(function(){var o=0===m.getFileStack(!0).length;if(m.showPreview){if(m.previewCache.set(r.content,r.config,r.tags,r.append),n){for(i=0;i<r.content.length;i++)a=i+n,s.content[a]=r.content[i],s.config.length&&(s.config[a]=r.config[i]),s.tags.length&&(s.tags[a]=r.tags[i]);m.initialPreview=t.cleanArray(s.content),m.initialPreviewConfig=t.cleanArray(s.config),m.initialPreviewThumbTags=t.cleanArray(s.tags)}else m.initialPreview=r.content,m.initialPreviewConfig=r.config,m.initialPreviewThumbTags=r.tags;m.cacheInitialPreview={},m.hasInitData&&(m._initPreview(),m._initPreviewActions())}m.unlock(o),o&&m._clearFileInput(),e=m.$preview.find(".file-preview-initial"),m.uploadAsync&&e.length&&(t.addCss(e,t.SORT_CSS),m._initSortable()),m._raise("filebatchuploadcomplete",[m.filestack,m._getExtraData()]),m.uploadCount=0,m.uploadStatus={},m.uploadLog=[],m._setProgress(101),m.ajaxAborted=!1},100))},c=function(s){r=m._getOutData(s),m.fileBatchCompleted=!1,a||(m.ajaxAborted=!1),m.showPreview&&(n.hasClass("file-preview-success")||(m._setThumbStatus(n,"Loading"),t.addCss(n,"file-uploading")),o.attr("disabled",!0),l.attr("disabled",!0)),a||m.lock(),m._raise("filepreupload",[r,w,i]),e.extend(!0,C,r),m._abort(C)&&(s.abort(),a||(m._setThumbStatus(n,"New"),n.removeClass("file-uploading"),o.removeAttr("disabled"),l.removeAttr("disabled"),m.unlock()),m._setProgressCancelled())},h=function(s,l,c){var h=m.showPreview&&n.attr("id")?n.attr("id"):w;r=m._getOutData(c,s),e.extend(!0,C,r),setTimeout(function(){t.isEmpty(s)||t.isEmpty(s.error)?(m.showPreview&&(m._setThumbStatus(n,"Success"),o.hide(),m._initUploadSuccess(s,n,a),m._setProgress(101,b)),m._raise("fileuploaded",[r,h,i]),a?f(i,h):m.updateStack(i,void 0)):(d=!0,m._showUploadError(s.error,C),m._setPreviewError(n,i,m.filestack[i],m.retryErrorUploads),m.retryErrorUploads||o.hide(),a&&f(i,h),m._setProgress(101,e("#"+h).find(".file-thumb-progress"),m.msgUploadError))},100)},p=function(){setTimeout(function(){m.showPreview&&(o.removeAttr("disabled"),l.removeAttr("disabled"),n.removeClass("file-uploading")),a?s():(m.unlock(!1),m._clearFileInput()),m._initSuccessThumbs()},100)},u=function(t,r,s){var l=m.ajaxOperations.uploadThumb,c=m._parseError(l,t,s,a&&m.filestack[i].name?m.filestack[i].name:null);d=!0,setTimeout(function(){a&&f(i,w),m.uploadStatus[w]=100,m._setPreviewError(n,i,m.filestack[i],m.retryErrorUploads),m.retryErrorUploads||o.hide(),e.extend(!0,C,m._getOutData(t)),m._setProgress(101,b,m.msgAjaxProgressError.replace("{operation}",l)),m._setProgress(101,e("#"+w).find(".file-thumb-progress"),m.msgUploadError),m._showUploadError(c,C)},100)},v.append(m.uploadFileAttr,m.filestack[i],m.filenames[i]),v.append("file_id",i),m._ajaxSubmit(c,h,p,u,w,i))},_uploadBatch:function(){var i,a,r,n,s,o=this,l=o.filestack,d=l.length,c=o.filestack.length>0||!e.isEmptyObject(o.uploadExtraData);o.formdata=new FormData,0!==d&&c&&!o._abort({})&&(s=function(){e.each(l,function(e){o.updateStack(e,void 0)}),o._clearFileInput()},i=function(i){o.lock();var a=o._getOutData(i);o.ajaxAborted=!1,o.showPreview&&o._getThumbs().each(function(){var i=e(this),a=i.find(".kv-file-upload"),r=i.find(".kv-file-remove");i.hasClass("file-preview-success")||(o._setThumbStatus(i,"Loading"),t.addCss(i,"file-uploading")),a.attr("disabled",!0),r.attr("disabled",!0)}),o._raise("filebatchpreupload",[a]),o._abort(a)&&(i.abort(),o._getThumbs().each(function(){var t=e(this),i=t.find(".kv-file-upload"),a=t.find(".kv-file-remove");t.hasClass("file-preview-loading")&&(o._setThumbStatus(t,"New"),t.removeClass("file-uploading")),i.removeAttr("disabled"),a.removeAttr("disabled")}),o._setProgressCancelled())},a=function(i,a,r){var n=o._getOutData(r,i),l=0,d=o._getThumbs(":not(.file-preview-success)"),c=t.isEmpty(i)||t.isEmpty(i.errorkeys)?[]:i.errorkeys;t.isEmpty(i)||t.isEmpty(i.error)?(o._raise("filebatchuploadsuccess",[n]),s(),o.showPreview?(d.each(function(){var t=e(this);o._setThumbStatus(t,"Success"),t.removeClass("file-uploading"),t.find(".kv-file-upload").hide().removeAttr("disabled")}),o._initUploadSuccess(i)):o.reset(),o._setProgress(101)):(o.showPreview&&(d.each(function(){var t=e(this),i=t.attr("data-fileindex");t.removeClass("file-uploading"),t.find(".kv-file-upload").removeAttr("disabled"),t.find(".kv-file-remove").removeAttr("disabled"),0===c.length||-1!==e.inArray(l,c)?(o._setPreviewError(t,i,o.filestack[i],o.retryErrorUploads),o.retryErrorUploads||(t.find(".kv-file-upload").hide(),o.updateStack(i,void 0))):(t.find(".kv-file-upload").hide(),o._setThumbStatus(t,"Success"),o.updateStack(i,void 0)),t.hasClass("file-preview-error")&&!o.retryErrorUploads||l++}),o._initUploadSuccess(i)),o._showUploadError(i.error,n,"filebatchuploaderror"),o._setProgress(101,o.$progress,o.msgUploadError))},n=function(){o.unlock(),o._initSuccessThumbs(),o._clearFileInput(),o._raise("filebatchuploadcomplete",[o.filestack,o._getExtraData()])},r=function(t,i,a){var r=o._getOutData(t),n=o.ajaxOperations.uploadBatch,s=o._parseError(n,t,a);o._showUploadError(s,r,"filebatchuploaderror"),o.uploadFileCount=d-1,o.showPreview&&(o._getThumbs().each(function(){var t=e(this),i=t.attr("data-fileindex");t.removeClass("file-uploading"),void 0!==o.filestack[i]&&o._setPreviewError(t)}),o._getThumbs().removeClass("file-uploading"),o._getThumbs(" .kv-file-upload").removeAttr("disabled"),o._getThumbs(" .kv-file-delete").removeAttr("disabled"),o._setProgress(101,o.$progress,o.msgAjaxProgressError.replace("{operation}",n)))},e.each(l,function(e,i){t.isEmpty(l[e])||o.formdata.append(o.uploadFileAttr,i,o.filenames[e])}),o._ajaxSubmit(i,a,n,r))},_uploadExtraOnly:function(){var e,i,a,r,n=this,s={};n.formdata=new FormData,n._abort(s)||(e=function(e){n.lock();var t=n._getOutData(e);n._raise("filebatchpreupload",[t]),n._setProgress(50),s.data=t,s.xhr=e,n._abort(s)&&(e.abort(),n._setProgressCancelled())},i=function(e,i,a){var r=n._getOutData(a,e);t.isEmpty(e)||t.isEmpty(e.error)?(n._raise("filebatchuploadsuccess",[r]),n._clearFileInput(),n._initUploadSuccess(e),n._setProgress(101)):n._showUploadError(e.error,r,"filebatchuploaderror")},a=function(){n.unlock(),n._clearFileInput(),n._raise("filebatchuploadcomplete",[n.filestack,n._getExtraData()])},r=function(e,t,i){var a=n._getOutData(e),r=n.ajaxOperations.uploadExtra,o=n._parseError(r,e,i);s.data=a,n._showUploadError(o,a,"filebatchuploaderror"),n._setProgress(101,n.$progress,n.msgAjaxProgressError.replace("{operation}",r))},n._ajaxSubmit(e,i,a,r))},_deleteFileIndex:function(i){var a=i.attr("data-fileindex"),r=this.reversePreviewOrder;"init_"===a.substring(0,5)&&(a=parseInt(a.replace("init_","")),this.initialPreview=t.spliceArray(this.initialPreview,a,r),this.initialPreviewConfig=t.spliceArray(this.initialPreviewConfig,a,r),this.initialPreviewThumbTags=t.spliceArray(this.initialPreviewThumbTags,a,r),this.getFrames().each(function(){var t=e(this),i=t.attr("data-fileindex");"init_"===i.substring(0,5)&&(i=parseInt(i.replace("init_","")))>a&&(i--,t.attr("data-fileindex","init_"+i))}),this.uploadAsync&&(this.cacheInitialPreview=this.getPreview()))},_initFileActions:function(){var i=this,a=i.$preview;i.showPreview&&(i._initZoomButton(),i.getFrames(" .kv-file-remove").each(function(){var r,n,s,o=e(this),l=o.closest(t.FRAMES),d=l.attr("id"),c=l.attr("data-fileindex");i._handler(o,"click",function(){if(!1===i._raise("filepreremove",[d,c])||!i._validateMinCount())return!1;r=l.hasClass("file-preview-error"),t.cleanMemory(l),l.fadeOut("slow",function(){t.cleanZoomCache(a.find("#zoom-"+d)),i.updateStack(c,void 0),i._clearObjects(l),l.remove(),d&&r&&i.$errorContainer.find('li[data-file-id="'+d+'"]').fadeOut("fast",function(){e(this).remove(),i._errorsExist()||i._resetErrors()}),i._clearFileInput();var o=i.getFileStack(!0),h=i.previewCache.count(),p=o.length,u=i.showPreview&&i.getFrames().length;0!==p||0!==h||u?(s=(n=h+p)>1?i._getMsgSelected(n):o[0]?i._getFileNames()[0]:"",i._setCaption(s)):i.reset(),i._raise("fileremoved",[d,c])})})}),i.getFrames(" .kv-file-upload").each(function(){var a=e(this);i._handler(a,"click",function(){var e=a.closest(t.FRAMES),r=e.attr("data-fileindex");i.$progress.hide(),e.hasClass("file-preview-error")&&!i.retryErrorUploads||i._uploadSingle(r,!1)})}))},_initPreviewActions:function(){var i=this,a=i.$preview,r=i.deleteExtraData||{},n=t.FRAMES+" .kv-file-remove",s=i.fileActionSettings,o=s.removeClass,l=s.removeErrorClass,d=function(){var e=i.isAjaxUpload?i.previewCache.count():i._inputFileCount();a.find(t.FRAMES).length||e||(i._setCaption(""),i.reset(),i.initialCaption="")};i._initZoomButton(),a.find(n).each(function(){var n,s,c,h=e(this),p=h.data("url")||i.deleteUrl,u=h.data("key");if(!t.isEmpty(p)&&void 0!==u){var f,m,g,v,w=h.closest(t.FRAMES),_=i.previewCache.data,b=w.attr("data-fileindex");b=parseInt(b.replace("init_","")),g=t.isEmpty(_.config)&&t.isEmpty(_.config[b])?null:_.config[b],"function"==typeof(v=t.isEmpty(g)||t.isEmpty(g.extra)?r:g.extra)&&(v=v()),m={id:h.attr("id"),key:u,extra:v},n=function(e){i.ajaxAborted=!1,i._raise("filepredelete",[u,e,v]),i._abort()?e.abort():(h.removeClass(l),t.addCss(w,"file-uploading"),t.addCss(h,"disabled "+o))},s=function(e,r,n){var s,c;if(!t.isEmpty(e)&&!t.isEmpty(e.error))return m.jqXHR=n,m.response=e,i._showError(e.error,m,"filedeleteerror"),w.removeClass("file-uploading"),h.removeClass("disabled "+o).addClass(l),void d();w.removeClass("file-uploading").addClass("file-deleted"),w.fadeOut("slow",function(){b=parseInt(w.attr("data-fileindex").replace("init_","")),i.previewCache.unset(b),i._deleteFileIndex(w),s=i.previewCache.count(),c=s>0?i._getMsgSelected(s):"",i._setCaption(c),i._raise("filedeleted",[u,n,v]),t.cleanZoomCache(a.find("#zoom-"+w.attr("id"))),i._clearObjects(w),w.remove(),d()})},c=function(e,t,a){var r=i.ajaxOperations.deleteThumb,n=i._parseError(r,e,a);m.jqXHR=e,m.response={},i._showError(n,m,"filedeleteerror"),w.removeClass("file-uploading"),h.removeClass("disabled "+o).addClass(l),d()},i._initAjaxSettings(),i._mergeAjaxCallback("beforeSend",n,"delete"),i._mergeAjaxCallback("success",s,"delete"),i._mergeAjaxCallback("error",c,"delete"),f=e.extend(!0,{},{url:p,type:"POST",dataType:"json",data:e.extend(!0,{},{key:u},v)},i._ajaxDeleteSettings),i._handler(h,"click",function(){if(!i._validateMinCount())return!1;i.ajaxAborted=!1,i._raise("filebeforedelete",[u,v]),i.ajaxAborted instanceof Promise?i.ajaxAborted.then(function(t){t||e.ajax(f)}):i.ajaxAborted||e.ajax(f)})}})},_hideFileIcon:function(){this.overwriteInitial&&this.$captionContainer.removeClass("icon-visible")},_showFileIcon:function(){t.addCss(this.$captionContainer,"icon-visible")},_getSize:function(t){var i,a,r,n=parseFloat(t),s=this.fileSizeGetter;return e.isNumeric(t)&&e.isNumeric(n)?("function"==typeof s?r=s(n):0===n?r="0.00 B":(i=Math.floor(Math.log(n)/Math.log(1024)),a=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=1*(n/Math.pow(1024,i)).toFixed(2)+" "+a[i]),this._getLayoutTemplate("size").replace("{sizeText}",r)):""},_generatePreviewTemplate:function(i,a,r,n,s,o,l,d,c,h,p){var u,f=this,m=f.slug(r),g="",v="",w=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<400?f.previewSettingsSmall[i]||f.defaults.previewSettingsSmall[i]:f.previewSettings[i]||f.defaults.previewSettings[i],_=c||f._renderFileFooter(m,l,"auto",o),b=f._getPreviewIcon(r),C="type-default",y=b&&f.preferIconicPreview,x=b&&f.preferIconicZoomPreview;return w&&e.each(w,function(e,t){v+=e+":"+t+";"}),u=function(a,o,l,c){var u=l?"zoom-"+s:s,g=f._getPreviewTemplate(a),w=(d||"")+" "+c;return f.frameClass&&(w=f.frameClass+" "+w),l&&(w=w.replace(" "+t.SORT_CSS,"")),g=f._parseFilePreviewIcon(g,r),"text"===a&&(o=t.htmlEncode(o)),"object"!==i||n||e.each(f.defaults.fileTypeSettings,function(e,t){"object"!==e&&"other"!==e&&t(r,n)&&(C="type-"+e)}),g.setTokens({previewId:u,caption:m,frameClass:w,type:n,fileindex:h,typeCss:C,footer:_,data:o,template:p||i,style:v?'style="'+v+'"':""})},h=h||s.slice(s.lastIndexOf("-")+1),f.fileActionSettings.showZoom&&(g=u(x?"other":i,a,!0,"kv-zoom-thumb")),g="\n"+f._getLayoutTemplate("zoomCache").replace("{zoomContent}",g),u(y?"other":i,a,!1,"kv-preview-thumb")+g},_addToPreview:function(e,t){return this.reversePreviewOrder?e.prepend(t):e.append(t)},_previewDefault:function(i,a,r){var n=this.$preview;if(this.showPreview){var s,o=i?i.name:"",l=i?i.type:"",d=i.size||0,c=this.slug(o),h=!0===r&&!this.isAjaxUpload,p=t.objUrl.createObjectURL(i);this._clearDefaultPreview(),s=this._generatePreviewTemplate("other",p,o,l,a,h,d),this._addToPreview(n,s),this._setThumbAttr(a,c,d),!0===r&&this.isAjaxUpload&&this._setThumbStatus(e("#"+a),"Error")}},_previewFile:function(e,t,i,a,r,n){if(this.showPreview){var s,o=t?t.name:"",l=n.type,d=n.name,c=this._parseFileType(l,o),h=this.allowedPreviewTypes,p=this.allowedPreviewMimeTypes,u=this.$preview,f=t.size||0,m=h&&h.indexOf(c)>=0,g=p&&-1!==p.indexOf(l),v="text"===c||"html"===c||"image"===c?i.target.result:r;if("html"===c&&this.purifyHtml&&window.DOMPurify&&(v=window.DOMPurify.sanitize(v)),m||g){s=this._generatePreviewTemplate(c,v,o,l,a,!1,f),this._clearDefaultPreview(),this._addToPreview(u,s);var w=u.find("#"+a+" img");this._validateImageOrientation(w,t,a,d,l,f,v)}else this._previewDefault(t,a);this._setThumbAttr(a,d,f),this._initSortable()}},_setThumbAttr:function(t,i,a){var r=e("#"+t);r.length&&(a=a&&a>0?this._getSize(a):"",r.data({caption:i,size:a}))},_setInitThumbAttr:function(){var e,i,a,r,n=this.previewCache.data,s=this.previewCache.count();if(0!==s)for(var o=0;o<s;o++)e=n.config[o],r=this.previewInitId+"-init_"+o,i=t.ifSet("caption",e,t.ifSet("filename",e)),a=t.ifSet("size",e),this._setThumbAttr(r,i,a)},_slugDefault:function(e){return t.isEmpty(e)?"":String(e).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g,"_")},_updateFileDetails:function(e){var i=this.$element,a=this.getFileStack(),r=t.isIE(9)&&t.findFileName(i.val())||i[0].files[0]&&i[0].files[0].name||a.length&&a[0].name||"",n=this.slug(r),s=this.isAjaxUpload?a.length:e,o=this.previewCache.count()+s,l=1===s?n:this._getMsgSelected(o);this.isError?(this.$previewContainer.removeClass("file-thumb-loading"),this.$previewStatus.html(""),this.$captionContainer.removeClass("icon-visible")):this._showFileIcon(),this._setCaption(l,this.isError),this.$container.removeClass("file-input-new file-input-ajax-new"),1===arguments.length&&this._raise("fileselect",[e,n]),this.previewCache.count()&&this._initPreviewActions()},_setThumbStatus:function(e,t){if(this.showPreview){var i="indicator"+t,a=i+"Title",r="file-preview-"+t.toLowerCase(),n=e.find(".file-upload-indicator"),s=this.fileActionSettings;e.removeClass("file-preview-success file-preview-error file-preview-loading"),"Success"===t&&e.find(".file-drag-handle").remove(),n.html(s[i]),n.attr("title",s[a]),e.addClass(r),"Error"!==t||this.retryErrorUploads||e.find(".kv-file-upload").attr("disabled",!0)}},_setProgressCancelled:function(){this._setProgress(101,this.$progress,this.msgCancelled)},_setProgress:function(e,i,a){var r,n=Math.min(e,100),s=this.progressUploadThreshold,o=e<=100?this.progressTemplate:this.progressCompleteTemplate,l=n<100?this.progressTemplate:a?this.progressErrorTemplate:o;i=i||this.$progress,t.isEmpty(l)||(r=s&&n>s&&e<=100?l.setTokens({percent:s,status:this.msgUploadThreshold}):l.setTokens({percent:n,status:e>100?this.msgUploadEnd:n+"%"}),i.html(r),a&&i.find('[role="progressbar"]').html(a))},_setFileDropZoneTitle:function(){var e,i=this.$container.find(".file-drop-zone"),a=this.dropZoneTitle;this.isClickable&&(e=t.isEmpty(this.$element.attr("multiple"))?this.fileSingle:this.filePlural,a+=this.dropZoneClickTitle.replace("{files}",e)),i.find("."+this.dropZoneTitleClass).remove(),!this.showPreview||0===i.length||this.getFileStack().length>0||!this.dropZoneEnabled||!this.isAjaxUpload&&this.$element.files||(0===i.find(t.FRAMES).length&&t.isEmpty(this.defaultPreviewContent)&&i.prepend('<div class="'+this.dropZoneTitleClass+'">'+a+"</div>"),this.$container.removeClass("file-input-new"),t.addCss(this.$container,"file-input-ajax-new"))},_setAsyncUploadStatus:function(t,i,a){var r=0;this._setProgress(i,e("#"+t).find(".file-thumb-progress")),this.uploadStatus[t]=i,e.each(this.uploadStatus,function(e,t){r+=t}),this._setProgress(Math.floor(r/a))},_validateMinCount:function(){var e=this.isAjaxUpload?this.getFileStack().length:this._inputFileCount();return!(this.validateInitialCount&&this.minFileCount>0&&this._getFileCount(e-1)<this.minFileCount)||(this._noFilesError({}),!1)},_getFileCount:function(e){return this.validateInitialCount&&!this.overwriteInitial&&(e+=this.previewCache.count()),e},_getFileId:function(e){var t,i=this.generateFileId;return"function"==typeof i?i(e,event):e&&(t=String(e.webkitRelativePath||e.fileName||e.name||null))?e.size+"-"+t.replace(/[^0-9a-zA-Z_-]/gim,""):null},_getFileName:function(e){return e&&e.name?this.slug(e.name):void 0},_getFileIds:function(e){return this.fileids.filter(function(t){return e?void 0!==t:null!=t})},_getFileNames:function(e){return this.filenames.filter(function(t){return e?void 0!==t:null!=t})},_setPreviewError:function(e,t,i,a){void 0!==t&&this.updateStack(t,i),this.showPreview&&(!this.removeFromPreviewOnError||a?(this._setThumbStatus(e,"Error"),this._refreshUploadButton(e,a)):e.remove())},_refreshUploadButton:function(e,t){var i=e.find(".kv-file-upload"),a=this.fileActionSettings,r=a.uploadIcon,n=a.uploadTitle;i.length&&(t&&(r=a.uploadRetryIcon,n=a.uploadRetryTitle),i.attr("title",n).html(r))},_checkDimensions:function(e,i,a,r,n,s,o){var l,d,c,h=this[("Small"===i?"min":"max")+"Image"+s];!t.isEmpty(h)&&a.length&&(c=a[0],d="Width"===s?c.naturalWidth||c.width:c.naturalHeight||c.height,("Small"===i?d>=h:d<=h)||(l=this["msgImage"+s+i].setTokens({name:n,size:h}),this._showUploadError(l,o),this._setPreviewError(r,e,null)))},_getExifObj:function(e){var t=null;try{t=window.piexif?window.piexif.load(e):null}catch(e){t=null}return t||this._log("Error loading the piexif.js library."),t},_validateImageOrientation:function(e,i,a,r,n,s,o){var l=this._getExifObj(o),d=null;e.length&&this.autoOrientImage&&l&&(d=l["0th"][piexif.ImageIFD.Orientation]),d?(t.setImageOrientation(e,this.$preview.find("#zoom-"+a+" img"),d),this._raise("fileimageoriented",{$img:e,file:i}),this._validateImage(a,r,n,s,o,l)):this._validateImage(a,r,n,s,o,l)},_validateImage:function(t,i,a,r,n,s){var o,l,d,c=this,h=c.$preview,p=h.find("#"+t),u=p.attr("data-fileindex"),f=p.find("img");i=i||"Untitled",f.one("load",function(){l=p.width(),d=h.width(),l>d&&f.css("width","100%"),o={ind:u,id:t},c._checkDimensions(u,"Small",f,p,i,"Width",o),c._checkDimensions(u,"Small",f,p,i,"Height",o),c.resizeImage||(c._checkDimensions(u,"Large",f,p,i,"Width",o),c._checkDimensions(u,"Large",f,p,i,"Height",o)),c._raise("fileimageloaded",[t]),c.loadedImages.push({ind:u,img:f,thumb:p,pid:t,typ:a,siz:r,validated:!1,imgData:n,exifObj:s}),p.data("exif",s),c._validateAllImages()}).one("error",function(){c._raise("fileimageloaderror",[t])}).each(function(){this.complete?e(this).trigger("load"):this.error&&e(this).trigger("error")})},_validateAllImages:function(){var e,t,i,a={val:0},r=this.loadedImages.length,n=this.resizeIfSizeMoreThan;if(r===this.totalImagesCount&&(this._raise("fileimagesloaded"),this.resizeImage))for(e=0;e<this.loadedImages.length;e++)(t=this.loadedImages[e]).validated||((i=t.siz)&&i>1e3*n&&this._getResizedImage(t,a,r),this.loadedImages[e].validated=!0)},_getResizedImage:function(i,a,r){var n,s,o,l,d,c,h=this,p=e(i.img)[0],u=p.naturalWidth,f=p.naturalHeight,m=1,g=h.maxImageWidth||u,v=h.maxImageHeight||f,w=!(!u||!f),_=h.imageCanvas,b=h.imageCanvasContext,C=i.typ,y=i.pid,x=i.ind,T=i.thumb,E=i.exifObj;if(d=function(e,t,i){h.isAjaxUpload?h._showUploadError(e,t,i):h._showError(e,t,i),h._setPreviewError(T,x)},h.filestack[x]&&w&&!(u<=g&&f<=v)||(w&&h.filestack[x]&&h._raise("fileimageresized",[y,x]),a.val++,a.val===r&&h._raise("fileimagesresized"),w)){C=C||h.resizeDefaultImageType,s=u>g,o=f>v,m="width"===h.resizePreference?s?g/u:o?v/f:1:o?v/f:s?g/u:1,h._resetCanvas(),u*=m,f*=m,_.width=u,_.height=f;try{b.drawImage(p,0,0,u,f),l=_.toDataURL(C,h.resizeQuality),E&&(c=window.piexif.dump(E),l=window.piexif.insert(c,l)),n=t.dataURI2Blob(l),h.filestack[x]=n,h._raise("fileimageresized",[y,x]),a.val++,a.val===r&&h._raise("fileimagesresized",[void 0,void 0]),n instanceof Blob||d(h.msgImageResizeError,{id:y,index:x},"fileimageresizeerror")}catch(e){a.val++,a.val===r&&h._raise("fileimagesresized",[void 0,void 0]),d(h.msgImageResizeException.replace("{errors}",e.message),{id:y,index:x},"fileimageresizeexception")}}else d(h.msgImageResizeError,{id:y,index:x},"fileimageresizeerror")},_initBrowse:function(e){var i=this.$element;this.showBrowse?this.$btnFile=e.find(".btn-file").append(i):(i.appendTo(e).attr("tabindex",-1),t.addCss(i,"file-no-browse"))},_initClickable:function(){var i,a=this;a.isClickable&&(i=a.isAjaxUpload?a.$dropZone:a.$preview.find(".file-default-preview"),t.addCss(i,"clickable"),i.attr("tabindex",-1),a._handler(i,"click",function(t){var r=e(t.target);e(a.elErrorContainer+":visible").length||r.parents(".file-preview-thumbnails").length&&!r.parents(".file-default-preview").length||(a.$element.data("zoneClicked",!0).trigger("click"),i.blur())}))},_initCaption:function(){var e=this.initialCaption||"";return this.overwriteInitial||t.isEmpty(e)?(this.$caption.val(""),!1):(this._setCaption(e),!0)},_setCaption:function(i,a){var r,n,s,o,l,d=this.getFileStack();if(this.$caption.length){if(this.$captionContainer.removeClass("icon-visible"),a)r=e("<div>"+this.msgValidationError+"</div>").text(),l=(o=d.length)?1===o&&d[0]?this._getFileNames()[0]:this._getMsgSelected(o):this._getMsgSelected(this.msgNo),n=t.isEmpty(i)?l:i,s='<span class="'+this.msgValidationErrorClass+'">'+this.msgValidationErrorIcon+"</span>";else{if(t.isEmpty(i))return;n=r=e("<div>"+i+"</div>").text(),s=this._getLayoutTemplate("fileIcon")}this.$captionContainer.addClass("icon-visible"),this.$caption.attr("title",r).val(n),this.$captionIcon.html(s)}},_createContainer:function(){var t={class:"file-input file-input-new"+(this.rtl?" kv-rtl":"")},i=e(document.createElement("div")).attr(t).html(this._renderMain());return i.insertBefore(this.$element),this._initBrowse(i),this.theme&&i.addClass("theme-"+this.theme),i},_refreshContainer:function(){var e=this.$container;this.$element.insertAfter(e),e.html(this._renderMain()),this._initBrowse(e),this._validateDisabled()},_validateDisabled:function(){this.$caption.attr({readonly:this.isDisabled})},_renderMain:function(){var e=this.dropZoneEnabled?" file-drop-zone":"file-drop-disabled",t=this.showClose?this._getLayoutTemplate("close"):"",i=this.showPreview?this._getLayoutTemplate("preview").setTokens({class:this.previewClass,dropClass:e}):"",a=this.isDisabled?this.captionClass+" file-caption-disabled":this.captionClass,r=this.captionTemplate.setTokens({class:a+" kv-fileinput-caption"});return this.mainTemplate.setTokens({class:this.mainClass+(!this.showBrowse&&this.showCaption?" no-browse":""),preview:i,close:t,caption:r,upload:this._renderButton("upload"),remove:this._renderButton("remove"),cancel:this._renderButton("cancel"),browse:this._renderButton("browse")})},_renderButton:function(e){var i=this._getLayoutTemplate("btnDefault"),a=this[e+"Class"],r=this[e+"Title"],n=this[e+"Icon"],s=this[e+"Label"],o=this.isDisabled?" disabled":"",l="button";switch(e){case"remove":if(!this.showRemove)return"";break;case"cancel":if(!this.showCancel)return"";a+=" kv-hidden";break;case"upload":if(!this.showUpload)return"";this.isAjaxUpload&&!this.isDisabled?i=this._getLayoutTemplate("btnLink").replace("{href}",this.uploadUrl):l="submit";break;case"browse":if(!this.showBrowse)return"";i=this._getLayoutTemplate("btnBrowse");break;default:return""}return a+="browse"===e?" btn-file":" fileinput-"+e+" fileinput-"+e+"-button",t.isEmpty(s)||(s=' <span class="'+this.buttonLabelClass+'">'+s+"</span>"),i.setTokens({type:l,css:a,title:r,status:o,icon:n,label:s})},_renderThumbProgress:function(){return'<div class="file-thumb-progress kv-hidden">'+this.progressTemplate.setTokens({percent:"0",status:this.msgUploadBegin})+"</div>"},_renderFileFooter:function(e,i,a,r){var n,s=this.fileActionSettings,o=s.showRemove,l=s.showDrag,d=s.showUpload,c=s.showZoom,h=this._getLayoutTemplate("footer"),p=this._getLayoutTemplate("indicator"),u=r?s.indicatorError:s.indicatorNew,f=r?s.indicatorErrorTitle:s.indicatorNewTitle,m=p.setTokens({indicator:u,indicatorTitle:f});return i=this._getSize(i),n=this.isAjaxUpload?h.setTokens({actions:this._renderFileActions(d,!1,o,c,l,!1,!1,!1),caption:e,size:i,width:a,progress:this._renderThumbProgress(),indicator:m}):h.setTokens({actions:this._renderFileActions(!1,!1,!1,c,l,!1,!1,!1),caption:e,size:i,width:a,progress:"",indicator:m}),n=t.replaceTags(n,this.previewThumbTags)},_renderFileActions:function(e,t,i,a,r,n,s,o,l,d,c){if(!(e||t||i||a||r))return"";var h,p=!1===s?"":' data-url="'+s+'"',u=!1===o?"":' data-key="'+o+'"',f="",m="",g="",v="",w="",_=this._getLayoutTemplate("actions"),b=this.fileActionSettings,C=this.otherActionButtons.setTokens({dataKey:u,key:o}),y=n?b.removeClass+" disabled":b.removeClass;return i&&(f=this._getLayoutTemplate("actionDelete").setTokens({removeClass:y,removeIcon:b.removeIcon,removeTitle:b.removeTitle,dataUrl:p,dataKey:u,key:o})),e&&(m=this._getLayoutTemplate("actionUpload").setTokens({uploadClass:b.uploadClass,uploadIcon:b.uploadIcon,uploadTitle:b.uploadTitle})),t&&(g=(g=this._getLayoutTemplate("actionDownload").setTokens({downloadClass:b.downloadClass,downloadIcon:b.downloadIcon,downloadTitle:b.downloadTitle,downloadUrl:d||this.initialPreviewDownloadUrl})).setTokens({filename:c,key:o})),a&&(v=this._getLayoutTemplate("actionZoom").setTokens({zoomClass:b.zoomClass,zoomIcon:b.zoomIcon,zoomTitle:b.zoomTitle})),r&&l&&(h="drag-handle-init "+b.dragClass,w=this._getLayoutTemplate("actionDrag").setTokens({dragClass:h,dragTitle:b.dragTitle,dragIcon:b.dragIcon})),_.setTokens({delete:f,upload:m,download:g,zoom:v,drag:w,other:C})},_browse:function(e){e&&e.isDefaultPrevented()||!this._raise("filebrowse")||(this.isError&&!this.isAjaxUpload&&this.clear(),this.$captionContainer.focus())},_filterDuplicate:function(e,t,i){var a=this._getFileId(e);a&&i&&i.indexOf(a)>-1||(i||(i=[]),t.push(e),i.push(a))},_change:function(i){var a=this;if(!a.changeTriggered){var r,n,s,o,l,d,c,h,p,u,f,m=a.$element,g=arguments.length>1,v=a.isAjaxUpload,w=[],_=g?arguments[1]:m.get(0).files,b=!v&&t.isEmpty(m.attr("multiple"))?1:a.maxFileCount,C=a.filestack.length,y=t.isEmpty(m.attr("multiple"))&&C>0,x=a._getFileIds();if(a.reader=null,a._resetUpload(),a._hideFileIcon(),a.dropZoneEnabled&&a.$container.find(".file-drop-zone ."+a.dropZoneTitleClass).remove(),v?e.each(_,function(e,t){a._filterDuplicate(t,w,x)}):(_=i.target&&void 0===i.target.files?i.target.value?[{name:i.target.value.replace(/^.+\\/,"")}]:[]:i.target.files||{},w=_),t.isEmpty(w)||0===w.length)return v||a.clear(),void a._raise("fileselectnone");if(a._resetErrors(),n=w.length,r=a._getFileCount(v?a.getFileStack().length+n:n),b>0&&r>b){if(!a.autoReplace||n>b)return s=a.autoReplace&&n>b?n:r,o=b,f=a.msgFilesTooMany.replace("{m}",o).replace("{n}",s),a.isError=(l=f,d=null,c=null,h=null,p=e.extend(!0,{},a._getOutData({},{},_),{id:c,index:h}),u={id:c,index:h,file:d,files:_},v?a._showUploadError(l,p):a._showError(l,u)),a.$captionContainer.removeClass("icon-visible"),a._setCaption("",!0),void a.$container.removeClass("file-input-new file-input-ajax-new");r>b&&a._resetPreviewThumbs(v)}else!v||y?(a._resetPreviewThumbs(!1),y&&a.clearStack()):!v||0!==C||a.previewCache.count()&&!a.overwriteInitial||a._resetPreviewThumbs(!0);a.isPreviewable?a.readFiles(w):a._updateFileDetails(1)}},_abort:function(t){var i;return this.ajaxAborted&&"object"==typeof this.ajaxAborted&&void 0!==this.ajaxAborted.message?((i=e.extend(!0,{},this._getOutData(),t)).abortData=this.ajaxAborted.data||{},i.abortMessage=this.ajaxAborted.message,this._setProgress(101,this.$progress,this.msgCancelled),this._showUploadError(this.ajaxAborted.message,i,"filecustomerror"),this.cancel(),!0):!!this.ajaxAborted},_resetFileStack:function(){var i=this,a=0,r=[],n=[],s=[];i._getThumbs().each(function(){var o=e(this),l=o.attr("data-fileindex"),d=i.filestack[l],c=o.attr("id");"-1"!==l&&-1!==l&&(void 0!==d?(r[a]=d,n[a]=i._getFileName(d),s[a]=i._getFileId(d),o.attr({id:i.previewInitId+"-"+a,"data-fileindex":a}),a++):o.attr({id:"uploaded-"+t.uniqId(),"data-fileindex":"-1"}),i.$preview.find("#zoom-"+c).attr({id:"zoom-"+o.attr("id"),"data-fileindex":o.attr("data-fileindex")}))}),i.filestack=r,i.filenames=n,i.fileids=s},_isFileSelectionValid:function(e){return e=e||0,this.required&&!this.getFilesCount()?(this.$errorContainer.html(""),this._showUploadError(this.msgFileRequired),!1):!(this.minFileCount>0&&this._getFileCount(e)<this.minFileCount)||(this._noFilesError({}),!1)},clearStack:function(){return this.filestack=[],this.filenames=[],this.fileids=[],this.$element},updateStack:function(e,t){return this.filestack[e]=t,this.filenames[e]=this._getFileName(t),this.fileids[e]=t&&this._getFileId(t)||null,this.$element},addToStack:function(e){return this.filestack.push(e),this.filenames.push(this._getFileName(e)),this.fileids.push(this._getFileId(e)),this.$element},getFileStack:function(e){return this.filestack.filter(function(t){return e?void 0!==t:null!=t})},getFilesCount:function(){var e=this.isAjaxUpload?this.getFileStack().length:this._inputFileCount();return this._getFileCount(e)},readFiles:function(i){this.reader=new FileReader;var a,r=this,n=r.$element,s=r.$preview,o=r.reader,l=r.$previewContainer,d=r.$previewStatus,c=r.msgLoading,h=r.msgProgress,p=r.previewInitId,u=i.length,f=r.fileTypeSettings,m=r.filestack.length,g=r.allowedFileTypes,v=g?g.length:0,w=r.allowedFileExtensions,_=t.isEmpty(w)?"":w.join(", "),b=r.maxFilePreviewSize&&parseFloat(r.maxFilePreviewSize),C=s.length&&(!b||isNaN(b)),y=function(t,n,s,o){var l,d=e.extend(!0,{},r._getOutData({},{},i),{id:s,index:o}),c={id:s,index:o,file:n,files:i};r._previewDefault(n,s,!0),r.isAjaxUpload?(r.addToStack(void 0),setTimeout(function(){a(o+1)},100)):u=0,r._initFileActions(),(l=e("#"+s)).find(".kv-file-upload").hide(),r.removeFromPreviewOnError&&l.remove(),r.isError=r.isAjaxUpload?r._showUploadError(t,d):r._showError(t,c),r._updateFileDetails(u)};r.loadedImages=[],r.totalImagesCount=0,e.each(i,function(e,t){var i=r.fileTypeSettings.image;i&&i(t.type)&&r.totalImagesCount++}),(a=function(x){if(t.isEmpty(n.attr("multiple"))&&(u=1),x>=u)return r.isAjaxUpload&&r.filestack.length>0?r._raise("filebatchselected",[r.getFileStack()]):r._raise("filebatchselected",[i]),l.removeClass("file-thumb-loading"),void d.html("");var T,E,S,k,F,P,I,A,D,z,$,j,U=p+"-"+(m+x),B=i[x],R=f.text,O=f.image,L=f.html,M=B&&B.name?r.slug(B.name):"",Z=(B&&B.size||0)/1e3,N="",H=B?t.objUrl.createObjectURL(B):null,W=0,q="",V=0,K=function(){var e=h.setTokens({index:x+1,files:u,percent:50,name:M});setTimeout(function(){d.html(e),r._updateFileDetails(u),a(x+1)},100),r._raise("fileloaded",[B,U,x,o])};if(B){if(v>0)for(E=0;E<v;E++)P=g[E],I=r.msgFileTypes[P]||P,q+=0===E?I:", "+I;if(!1!==M){if(0===M.length)return S=r.msgInvalidFileName.replace("{name}",t.htmlEncode(B.name,"[unknown]")),void y(S,B,U,x);if(t.isEmpty(w)||(N=new RegExp("\\.("+w.join("|")+")$","i")),T=Z.toFixed(2),r.maxFileSize>0&&Z>r.maxFileSize)return S=r.msgSizeTooLarge.setTokens({name:M,size:T,maxSize:r.maxFileSize}),void y(S,B,U,x);if(null!==r.minFileSize&&Z<=t.getNum(r.minFileSize))return S=r.msgSizeTooSmall.setTokens({name:M,size:T,minSize:r.minFileSize}),void y(S,B,U,x);if(!t.isEmpty(g)&&t.isArray(g)){for(E=0;E<g.length;E+=1)k=g[E],W+=(A=f[k])&&"function"==typeof A&&A(B.type,B.name)?1:0;if(0===W)return S=r.msgInvalidFileType.setTokens({name:M,types:q}),void y(S,B,U,x)}if(0===W&&!t.isEmpty(w)&&t.isArray(w)&&!t.isEmpty(N)&&(F=t.compare(M,N),0===(W+=t.isEmpty(F)?0:F.length)))return S=r.msgInvalidFileExtension.setTokens({name:M,extensions:_}),void y(S,B,U,x);if(!r.showPreview)return r.isAjaxUpload&&r.addToStack(B),setTimeout(function(){a(x+1),r._updateFileDetails(u)},100),void r._raise("fileloaded",[B,U,x,o]);if(!C&&Z>b)return r.addToStack(B),l.addClass("file-thumb-loading"),r._previewDefault(B,U),r._initFileActions(),r._updateFileDetails(u),void a(x+1);s.length&&void 0!==FileReader?(D=R(B.type,M),z=L(B.type,M),$=O(B.type,M),d.html(c.replace("{index}",x+1).replace("{files}",u)),l.addClass("file-thumb-loading"),o.onerror=function(e){r._errorHandler(e,M)},o.onload=function(i){var a,n,s,l,d,c,h,p,u=[];if(n={name:M,type:B.type},e.each(f,function(e,t){"object"!==e&&"other"!==e&&t(B.type,M)&&V++}),0===V){for(s=new Uint8Array(i.target.result),E=0;E<s.length;E++)l=s[E].toString(16),u.push(l);if(a=u.join("").toLowerCase().substring(0,8),c=t.getMimeType(a,"",""),t.isEmpty(c)&&(d=t.arrayBuffer2String(o.result),c=t.isSvg(d)?"image/svg+xml":t.getMimeType(a,d,B.type)),n={name:M,type:c},D=R(c,""),z=L(c,""),$=O(c,""),(j=D||z)||$)return h=j,(p=new FileReader).onerror=function(e){r._errorHandler(e,M)},p.onload=function(e){r._previewFile(x,B,e,U,H,n),r._initFileActions(),K()},void(h?p.readAsText(B,r.textEncoding):p.readAsDataURL(B))}r._previewFile(x,B,i,U,H,n),r._initFileActions(),K()},o.onprogress=function(e){if(e.lengthComputable){var t=e.loaded/e.total*100,i=Math.ceil(t);S=h.setTokens({index:x+1,files:u,percent:i,name:M}),setTimeout(function(){d.html(S)},100)}},D||z?o.readAsText(B,r.textEncoding):$?o.readAsDataURL(B):o.readAsArrayBuffer(B)):(r._previewDefault(B,U),setTimeout(function(){a(x+1),r._updateFileDetails(u)},100),r._raise("fileloaded",[B,U,x,o])),r.addToStack(B)}else a(x+1)}})(0),r._updateFileDetails(u,!1)},lock:function(){return this._resetErrors(),this.disable(),this.showRemove&&this.$container.find(".fileinput-remove").hide(),this.showCancel&&this.$container.find(".fileinput-cancel").show(),this._raise("filelock",[this.filestack,this._getExtraData()]),this.$element},unlock:function(e){return void 0===e&&(e=!0),this.enable(),this.showCancel&&this.$container.find(".fileinput-cancel").hide(),this.showRemove&&this.$container.find(".fileinput-remove").show(),e&&this._resetFileStack(),this._raise("fileunlock",[this.filestack,this._getExtraData()]),this.$element},cancel:function(){var t,i=this,a=i.ajaxRequests,r=a.length;if(r>0)for(t=0;t<r;t+=1)i.cancelling=!0,a[t].abort();return i._setProgressCancelled(),i._getThumbs().each(function(){var t=e(this),a=t.attr("data-fileindex");t.removeClass("file-uploading"),void 0!==i.filestack[a]&&(t.find(".kv-file-upload").removeClass("disabled").removeAttr("disabled"),t.find(".kv-file-remove").removeClass("disabled").removeAttr("disabled")),i.unlock()}),i.$element},clear:function(){var i,a=this;if(a._raise("fileclear"))return a.$btnUpload.removeAttr("disabled"),a._getThumbs().find("video,audio,img").each(function(){t.cleanMemory(e(this))}),a._clearFileInput(),a._resetUpload(),a.clearStack(),a._resetErrors(!0),a._hasInitialPreview()?(a._showFileIcon(),a._resetPreview(),a._initPreviewActions(),a.$container.removeClass("file-input-new")):(a._getThumbs().each(function(){a._clearObjects(e(this))}),a.isAjaxUpload&&(a.previewCache.data={}),a.$preview.html(""),i=!a.overwriteInitial&&a.initialCaption.length>0?a.initialCaption:"",a.$caption.attr("title","").val(i),t.addCss(a.$container,"file-input-new"),a._validateDefaultPreview()),t.addCss(a.$container,"file-input-new"),0===a.$container.find(t.FRAMES).length&&(a._initCaption()||a.$captionContainer.removeClass("icon-visible")),a._hideFileIcon(),a._raise("filecleared"),a.$captionContainer.focus(),a._setFileDropZoneTitle(),a.$element},reset:function(){if(this._raise("filereset"))return this._resetPreview(),this.$container.find(".fileinput-filename").text(""),t.addCss(this.$container,"file-input-new"),(this.getFrames().length||this.dropZoneEnabled)&&this.$container.removeClass("file-input-new"),this.clearStack(),this.formdata={},this._setFileDropZoneTitle(),this.$element},disable:function(){return this.isDisabled=!0,this._raise("filedisabled"),this.$element.attr("disabled","disabled"),this.$container.find(".kv-fileinput-caption").addClass("file-caption-disabled"),this.$container.find(".fileinput-remove, .fileinput-upload, .file-preview-frame button").attr("disabled",!0),t.addCss(this.$container.find(".btn-file"),"disabled"),this._initDragDrop(),this.$element},enable:function(){return this.isDisabled=!1,this._raise("fileenabled"),this.$element.removeAttr("disabled"),this.$container.find(".kv-fileinput-caption").removeClass("file-caption-disabled"),this.$container.find(".fileinput-remove, .fileinput-upload, .file-preview-frame button").removeAttr("disabled"),this.$container.find(".btn-file").removeClass("disabled"),this._initDragDrop(),this.$element},upload:function(){var i,a,r,n=this.getFileStack().length,s=!e.isEmptyObject(this._getExtraData());if(this.isAjaxUpload&&!this.isDisabled&&this._isFileSelectionValid(n))if(this._resetUpload(),0!==n||s)if(this.$progress.show(),this.uploadCount=0,this.uploadStatus={},this.uploadLog=[],this.lock(),this._setProgress(2),0===n&&s)this._uploadExtraOnly();else{if(r=this.filestack.length,this.hasInitData=!1,!this.uploadAsync)return this._uploadBatch(),this.$element;for(a=this._getOutData(),this._raise("filebatchpreupload",[a]),this.fileBatchCompleted=!1,this.uploadCache={content:[],config:[],tags:[],append:!0},this.uploadAsyncCount=this.getFileStack().length,i=0;i<r;i++)this.uploadCache.content[i]=null,this.uploadCache.config[i]=null,this.uploadCache.tags[i]=null;for(this.$preview.find(".file-preview-initial").removeClass(t.SORT_CSS),this._initSortable(),this.cacheInitialPreview=this.getPreview(),i=0;i<r;i++)this.filestack[i]&&this._uploadSingle(i,!0)}else this._showUploadError(this.msgUploadEmpty)},destroy:function(){var t=this.$form,i=this.$container,a=this.$element,r=this.namespace;return e(document).off(r),e(window).off(r),t&&t.length&&t.off(r),this.isAjaxUpload&&this._clearFileInput(),this._cleanup(),this._initPreviewCache(),a.insertBefore(i).off(r).removeData(),i.off().remove(),a},refresh:function(i){var a=this.$element;return i="object"!=typeof i||t.isEmpty(i)?this.options:e.extend(!0,{},this.options,i),this._init(i,!0),this._listen(),a},zoom:function(e){var i=this._getFrame(e),a=this.$modal;i&&(t.initModal(a),a.html(this._getModalContent()),this._setZoomContent(i),a.modal("show"),this._initZoomButtons())},getExif:function(e){var t=this._getFrame(e);return t&&t.data("exif")||null},getFrames:function(i){var a;return i=i||"",a=this.$preview.find(t.FRAMES+i),this.reversePreviewOrder&&(a=e(a.get().reverse())),a},getPreview:function(){return{content:this.initialPreview,config:this.initialPreviewConfig,tags:this.initialPreviewThumbTags}}},e.fn.fileinput=function(a){if(t.hasFileAPISupport()||t.isIE(9)){var r=Array.apply(null,arguments),n=[];switch(r.shift(),this.each(function(){var s,o=e(this),l=o.data("fileinput"),d="object"==typeof a&&a,c=d.theme||o.data("theme"),h={},p={},u=d.language||o.data("language")||e.fn.fileinput.defaults.language||"en";l||(c&&(p=e.fn.fileinputThemes[c]||{}),"en"===u||t.isEmpty(e.fn.fileinputLocales[u])||(h=e.fn.fileinputLocales[u]||{}),s=e.extend(!0,{},e.fn.fileinput.defaults,p,e.fn.fileinputLocales.en,h,d,o.data()),l=new i(this,s),o.data("fileinput",l)),"string"==typeof a&&n.push(l[a].apply(l,r))}),n.length){case 0:return this;case 1:return n[0];default:return n}}},e.fn.fileinput.defaults={language:"en",showCaption:!0,showBrowse:!0,showPreview:!0,showRemove:!0,showUpload:!0,showCancel:!0,showClose:!0,showUploadedThumbs:!0,browseOnZoneClick:!1,autoReplace:!1,autoOrientImage:!1,required:!1,rtl:!1,hideThumbnailContent:!1,generateFileId:null,previewClass:"",captionClass:"",frameClass:"krajee-default",mainClass:"file-caption-main",mainTemplate:null,purifyHtml:!0,fileSizeGetter:null,initialCaption:"",initialPreview:[],initialPreviewDelimiter:"*$$*",initialPreviewAsData:!1,initialPreviewFileType:"image",initialPreviewConfig:[],initialPreviewThumbTags:[],previewThumbTags:{},initialPreviewShowDelete:!0,initialPreviewDownloadUrl:"",removeFromPreviewOnError:!1,deleteUrl:"",deleteExtraData:{},overwriteInitial:!0,previewZoomButtonIcons:{prev:'<i class="glyphicon glyphicon-triangle-left"></i>',next:'<i class="glyphicon glyphicon-triangle-right"></i>',toggleheader:'<i class="glyphicon glyphicon-resize-vertical"></i>',fullscreen:'<i class="glyphicon glyphicon-fullscreen"></i>',borderless:'<i class="glyphicon glyphicon-resize-full"></i>',close:'<i class="glyphicon glyphicon-remove"></i>'},previewZoomButtonClasses:{prev:"btn btn-navigate",next:"btn btn-navigate",toggleheader:"btn btn-sm btn-kv btn-default btn-outline-secondary",fullscreen:"btn btn-sm btn-kv btn-default btn-outline-secondary",borderless:"btn btn-sm btn-kv btn-default btn-outline-secondary",close:"btn btn-sm btn-kv btn-default btn-outline-secondary"},previewTemplates:{},previewContentTemplates:{},preferIconicPreview:!1,preferIconicZoomPreview:!1,allowedPreviewTypes:void 0,allowedPreviewMimeTypes:null,allowedFileTypes:null,allowedFileExtensions:null,defaultPreviewContent:null,customLayoutTags:{},customPreviewTags:{},previewFileIcon:'<i class="glyphicon glyphicon-file"></i>',previewFileIconClass:"file-other-icon",previewFileIconSettings:{},previewFileExtSettings:{},buttonLabelClass:"hidden-xs",browseIcon:'<i class="glyphicon glyphicon-folder-open"></i> ',browseClass:"btn btn-primary",removeIcon:'<i class="glyphicon glyphicon-trash"></i>',removeClass:"btn btn-default btn-secondary",cancelIcon:'<i class="glyphicon glyphicon-ban-circle"></i>',cancelClass:"btn btn-default btn-secondary",uploadIcon:'<i class="glyphicon glyphicon-upload"></i>',uploadClass:"btn btn-default btn-secondary",uploadUrl:null,uploadUrlThumb:null,uploadAsync:!0,uploadExtraData:{},zoomModalHeight:480,minImageWidth:null,minImageHeight:null,maxImageWidth:null,maxImageHeight:null,resizeImage:!1,resizePreference:"width",resizeQuality:.92,resizeDefaultImageType:"image/jpeg",resizeIfSizeMoreThan:0,minFileSize:0,maxFileSize:0,maxFilePreviewSize:25600,minFileCount:0,maxFileCount:0,validateInitialCount:!1,msgValidationErrorClass:"text-danger",msgValidationErrorIcon:'<i class="glyphicon glyphicon-exclamation-sign"></i> ',msgErrorClass:"file-error-message",progressThumbClass:"progress-bar bg-success progress-bar-success progress-bar-striped active",progressClass:"progress-bar bg-success progress-bar-success progress-bar-striped active",progressCompleteClass:"progress-bar bg-success progress-bar-success",progressErrorClass:"progress-bar bg-danger progress-bar-danger",progressUploadThreshold:99,previewFileType:"image",elCaptionContainer:null,elCaptionText:null,elPreviewContainer:null,elPreviewImage:null,elPreviewStatus:null,elErrorContainer:null,errorCloseButton:t.closeButton("kv-error-close"),slugCallback:null,dropZoneEnabled:!0,dropZoneTitleClass:"file-drop-zone-title",fileActionSettings:{},otherActionButtons:"",textEncoding:"UTF-8",ajaxSettings:{},ajaxDeleteSettings:{},showAjaxErrorDetails:!0,mergeAjaxCallbacks:!1,mergeAjaxDeleteCallbacks:!1,retryErrorUploads:!0,reversePreviewOrder:!1},e.fn.fileinputLocales.en={fileSingle:"file",filePlural:"files",browseLabel:"Browse …",removeLabel:"Remove",removeTitle:"Clear selected files",cancelLabel:"Cancel",cancelTitle:"Abort ongoing upload",uploadLabel:"Upload",uploadTitle:"Upload selected files",msgNo:"No",msgNoFilesSelected:"No files selected",msgCancelled:"Cancelled",msgPlaceholder:"Select {files}...",msgZoomModalHeading:"Detailed Preview",msgFileRequired:"You must select a file to upload.",msgSizeTooSmall:'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.',msgSizeTooLarge:'File "{name}" (<b>{size} KB</b>) exceeds maximum allowed upload size of <b>{maxSize} KB</b>.',msgFilesTooLess:"You must select at least <b>{n}</b> {files} to upload.",msgFilesTooMany:"Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.",msgFileNotFound:'File "{name}" not found!',msgFileSecured:'Security restrictions prevent reading the file "{name}".',msgFileNotReadable:'File "{name}" is not readable.',msgFilePreviewAborted:'File preview aborted for "{name}".',msgFilePreviewError:'An error occurred while reading the file "{name}".',msgInvalidFileName:'Invalid or unsupported characters in file name "{name}".',msgInvalidFileType:'Invalid type for file "{name}". Only "{types}" files are supported.',msgInvalidFileExtension:'Invalid extension for file "{name}". Only "{extensions}" files are supported.',msgFileTypes:{image:"image",html:"HTML",text:"text",video:"video",audio:"audio",flash:"flash",pdf:"PDF",object:"object"},msgUploadAborted:"The file upload was aborted",msgUploadThreshold:"Processing...",msgUploadBegin:"Initializing...",msgUploadEnd:"Done",msgUploadEmpty:"No valid data available for upload.",msgUploadError:"Error",msgValidationError:"Validation Error",msgLoading:"Loading file {index} of {files} …",msgProgress:"Loading file {index} of {files} - {name} - {percent}% completed.",msgSelected:"{n} {files} selected",msgFoldersNotAllowed:"Drag & drop files only! {n} folder(s) dropped were skipped.",msgImageWidthSmall:'Width of image file "{name}" must be at least {size} px.',msgImageHeightSmall:'Height of image file "{name}" must be at least {size} px.',msgImageWidthLarge:'Width of image file "{name}" cannot exceed {size} px.',msgImageHeightLarge:'Height of image file "{name}" cannot exceed {size} px.',msgImageResizeError:"Could not get the image dimensions to resize.",msgImageResizeException:"Error while resizing the image.<pre>{errors}</pre>",msgAjaxError:"Something went wrong with the {operation} operation. Please try again later!",msgAjaxProgressError:"{operation} failed",ajaxOperations:{deleteThumb:"file delete",uploadThumb:"file upload",uploadBatch:"batch file upload",uploadExtra:"form data upload"},dropZoneTitle:"Drag & drop files here …",dropZoneClickTitle:"<br>(or click to select {files})",previewZoomButtonTitles:{prev:"View previous file",next:"View next file",toggleheader:"Toggle header",fullscreen:"Toggle full screen",borderless:"Toggle borderless mode",close:"Close detailed preview"},usePdfRenderer:function(){return!!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i)},pdfRendererUrl:"",pdfRendererTemplate:'<iframe class="kv-preview-data file-preview-pdf" src="{renderer}?file={data}" {style}></iframe>'},e.fn.fileinput.Constructor=i,e(document).ready(function(){var t=e("input.file[type=file]");t.length&&t.fileinput()})});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/assets/js/{jquery.sticky.js → jquery.sticky.min.js}
RENAMED
File without changes
|
admin/class-admin-base.php
CHANGED
@@ -55,13 +55,15 @@ class CHT_Admin_Base
|
|
55 |
|
56 |
/* load language files */
|
57 |
add_action( 'plugins_loaded', array( $this, 'chaty_text' ) );
|
|
|
|
|
58 |
}
|
59 |
|
60 |
public function plugin_action_links($links)
|
61 |
{
|
62 |
$links['need_help'] = '<a target="_blank" href="https://premio.io/help/chaty/?utm_source=pluginspage" >'.__( 'Need help?', CHT_OPT ).'</a>';
|
63 |
$links['go_pro'] = '<a href="' . CHT_PRO_URL . '" class="chaty-plugins-gopro">' . esc_attr__('Upgrade', CHT_OPT) . '</a>';
|
64 |
-
wp_register_style('chaty-admin-custom-style', CHT_PLUGIN_URL . '/assets/css/admin-cht-style.css');
|
65 |
wp_enqueue_style('chaty-admin-custom-style');
|
66 |
|
67 |
return $links;
|
@@ -206,7 +208,8 @@ class CHT_Admin_Base
|
|
206 |
);
|
207 |
wp_enqueue_style('google_fonts', add_query_arg($query_args, "//fonts.googleapis.com/css"), array(), null);
|
208 |
wp_enqueue_style($this->plugin_slug . 'spectrum', plugins_url('../admin/assets/css/spectrum.min.css', __FILE__), array(), CHT_VERSION);
|
209 |
-
|
|
|
210 |
}
|
211 |
|
212 |
/* admin js files */
|
@@ -218,8 +221,9 @@ class CHT_Admin_Base
|
|
218 |
wp_enqueue_script($this->plugin_slug . 'fileinput', plugins_url('../admin/assets/js/fileinput.min.js', __FILE__), array('jquery'), CHT_VERSION);
|
219 |
wp_enqueue_script($this->plugin_slug . 'spectrum', plugins_url('../admin/assets/js/spectrum.min.js', __FILE__), array('jquery'), CHT_VERSION);
|
220 |
wp_enqueue_script($this->plugin_slug . 'pop', plugins_url('../admin/assets/js/popper.min.js', __FILE__), array('jquery'), CHT_VERSION);
|
|
|
|
|
221 |
wp_enqueue_script($this->plugin_slug, plugins_url('../admin/assets/js/cht-scripts.min.js', __FILE__), array('jquery', 'wp-color-picker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable'), CHT_VERSION);
|
222 |
-
wp_enqueue_script($this->plugin_slug . 'stick', plugins_url('../admin/assets/js/jquery.sticky.js', __FILE__), array('jquery'), CHT_VERSION);
|
223 |
wp_localize_script($this->plugin_slug . 'stick', 'cht_nonce_ajax',
|
224 |
array(
|
225 |
'cht_nonce' => wp_create_nonce('cht_nonce_ajax')
|
@@ -295,6 +299,10 @@ class CHT_Admin_Base
|
|
295 |
$channel_class = "";
|
296 |
$fonts = self::get_font_list();
|
297 |
include_once CHT_DIR . '/views/admin/admin.php';
|
|
|
|
|
|
|
|
|
298 |
}
|
299 |
}
|
300 |
|
@@ -1486,6 +1494,14 @@ class CHT_Admin_Base
|
|
1486 |
}
|
1487 |
}
|
1488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1489 |
public function wcp_admin_send_message_to_owner()
|
1490 |
{
|
1491 |
$response = array();
|
55 |
|
56 |
/* load language files */
|
57 |
add_action( 'plugins_loaded', array( $this, 'chaty_text' ) );
|
58 |
+
|
59 |
+
add_action("wp_ajax_update_popup_status", array($this, 'update_popup_status'));
|
60 |
}
|
61 |
|
62 |
public function plugin_action_links($links)
|
63 |
{
|
64 |
$links['need_help'] = '<a target="_blank" href="https://premio.io/help/chaty/?utm_source=pluginspage" >'.__( 'Need help?', CHT_OPT ).'</a>';
|
65 |
$links['go_pro'] = '<a href="' . CHT_PRO_URL . '" class="chaty-plugins-gopro">' . esc_attr__('Upgrade', CHT_OPT) . '</a>';
|
66 |
+
wp_register_style('chaty-admin-custom-style', CHT_PLUGIN_URL . '/assets/css/admin-cht-style.min.css');
|
67 |
wp_enqueue_style('chaty-admin-custom-style');
|
68 |
|
69 |
return $links;
|
208 |
);
|
209 |
wp_enqueue_style('google_fonts', add_query_arg($query_args, "//fonts.googleapis.com/css"), array(), null);
|
210 |
wp_enqueue_style($this->plugin_slug . 'spectrum', plugins_url('../admin/assets/css/spectrum.min.css', __FILE__), array(), CHT_VERSION);
|
211 |
+
/* WP change this */
|
212 |
+
wp_enqueue_style($this->plugin_slug, plugins_url('../admin/assets/css/cht-style.min.css', __FILE__), array(), CHT_VERSION);
|
213 |
}
|
214 |
|
215 |
/* admin js files */
|
221 |
wp_enqueue_script($this->plugin_slug . 'fileinput', plugins_url('../admin/assets/js/fileinput.min.js', __FILE__), array('jquery'), CHT_VERSION);
|
222 |
wp_enqueue_script($this->plugin_slug . 'spectrum', plugins_url('../admin/assets/js/spectrum.min.js', __FILE__), array('jquery'), CHT_VERSION);
|
223 |
wp_enqueue_script($this->plugin_slug . 'pop', plugins_url('../admin/assets/js/popper.min.js', __FILE__), array('jquery'), CHT_VERSION);
|
224 |
+
wp_enqueue_script($this->plugin_slug . 'stick', plugins_url('../admin/assets/js/jquery.sticky.min.js', __FILE__), array('jquery'), CHT_VERSION);
|
225 |
+
/* WP change this */
|
226 |
wp_enqueue_script($this->plugin_slug, plugins_url('../admin/assets/js/cht-scripts.min.js', __FILE__), array('jquery', 'wp-color-picker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable'), CHT_VERSION);
|
|
|
227 |
wp_localize_script($this->plugin_slug . 'stick', 'cht_nonce_ajax',
|
228 |
array(
|
229 |
'cht_nonce' => wp_create_nonce('cht_nonce_ajax')
|
299 |
$channel_class = "";
|
300 |
$fonts = self::get_font_list();
|
301 |
include_once CHT_DIR . '/views/admin/admin.php';
|
302 |
+
$popup_status = get_option("chaty_intro_popup");
|
303 |
+
if($popup_status == "show") {
|
304 |
+
include_once CHT_DIR . '/views/admin/chaty-popup.php';
|
305 |
+
}
|
306 |
}
|
307 |
}
|
308 |
|
1494 |
}
|
1495 |
}
|
1496 |
|
1497 |
+
public function update_popup_status() {
|
1498 |
+
if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'chaty_update_popup_status')) {
|
1499 |
+
update_option("chaty_intro_popup", "hide");
|
1500 |
+
}
|
1501 |
+
echo esc_attr("1");
|
1502 |
+
die;
|
1503 |
+
}
|
1504 |
+
|
1505 |
public function wcp_admin_send_message_to_owner()
|
1506 |
{
|
1507 |
$response = array();
|
admin/class-social-icons.php
CHANGED
@@ -51,6 +51,8 @@ class CHT_Social_Icons
|
|
51 |
array(
|
52 |
'example' => '1507854875',
|
53 |
'placeholder' => __('Phone number', CHT_OPT),
|
|
|
|
|
54 |
'slug' => 'Whatsapp',
|
55 |
'svg' => '<circle class="color-element" cx="19.4395" cy="19.4395" r="19.4395" fill="#49E670"/>
|
56 |
<path d="M12.9821 10.1115C12.7029 10.7767 11.5862 11.442 10.7486 11.575C10.1902 11.7081 9.35269 11.8411 6.84003 10.7767C3.48981 9.44628 1.39593 6.25317 1.25634 6.12012C1.11674 5.85403 2.13001e-06 4.39053 2.13001e-06 2.92702C2.13001e-06 1.46351 0.83755 0.665231 1.11673 0.399139C1.39592 0.133046 1.8147 1.01506e-06 2.23348 1.01506e-06C2.37307 1.01506e-06 2.51267 1.01506e-06 2.65226 1.01506e-06C2.93144 1.01506e-06 3.21063 -2.02219e-06 3.35022 0.532183C3.62941 1.19741 4.32736 2.66092 4.32736 2.79397C4.46696 2.92702 4.46696 3.19311 4.32736 3.32616C4.18777 3.59225 4.18777 3.59224 3.90858 3.85834C3.76899 3.99138 3.6294 4.12443 3.48981 4.39052C3.35022 4.52357 3.21063 4.78966 3.35022 5.05576C3.48981 5.32185 4.18777 6.38622 5.16491 7.18449C6.42125 8.24886 7.39839 8.51496 7.81717 8.78105C8.09636 8.91409 8.37554 8.9141 8.65472 8.648C8.93391 8.38191 9.21309 7.98277 9.49228 7.58363C9.77146 7.31754 10.0507 7.1845 10.3298 7.31754C10.609 7.45059 12.2841 8.11582 12.5633 8.38191C12.8425 8.51496 13.1217 8.648 13.1217 8.78105C13.1217 8.78105 13.1217 9.44628 12.9821 10.1115Z" transform="translate(12.9597 12.9597)" fill="#FAFAFA"/>
|
@@ -71,6 +73,8 @@ class CHT_Social_Icons
|
|
71 |
array(
|
72 |
'example' => '+1507854875',
|
73 |
'placeholder' => __('Phone number', CHT_OPT),
|
|
|
|
|
74 |
'slug' => 'SMS',
|
75 |
'title' => 'SMS',
|
76 |
'color' => '#FF549C',
|
@@ -177,6 +181,8 @@ class CHT_Social_Icons
|
|
177 |
array(
|
178 |
'example' => '+1507854875',
|
179 |
'placeholder' => __('Phone number', CHT_OPT),
|
|
|
|
|
180 |
'slug' => 'Phone',
|
181 |
'title' => 'Phone',
|
182 |
'color' => '#03E78B',
|
@@ -253,7 +259,7 @@ class CHT_Social_Icons
|
|
253 |
fill="#6ECCEF" class="color-element"/> <path d="M12.3405 18.0628C3.97637 18.0628 0 16.5344 0 13.1997C0 12.7829 0.274233 12.505 0.685582 12.505C1.37116 12.505 1.91963 12.3661 2.19386 11.9492C3.01656 10.9766 2.74233 9.17034 2.74233 9.17034C2.74233 4.02939 6.99293 0 12.3405 0C17.688 0 21.9386 4.02939 21.9386 9.0314C21.9386 14.0334 17.688 18.0628 12.3405 18.0628ZM1.50828 13.7555C2.19386 15.5618 5.896 16.6733 12.3405 16.6733C16.8653 16.6733 20.5675 13.1997 20.5675 9.0314C20.5675 4.86306 16.8653 1.38945 12.3405 1.38945C7.81563 1.38945 4.11349 4.86306 4.11349 9.0314C4.11349 9.0314 4.52484 11.3935 3.29079 12.7829C2.74233 13.3387 2.19386 13.6166 1.50828 13.7555Z" transform="translate(8.46936 9.01862)" fill="white"/> <path d="M2.74233 5.55778C4.25687 5.55778 5.48465 4.31363 5.48465 2.77889C5.48465 1.24415 4.25687 0 2.74233 0C1.22778 0 0 1.24415 0 2.77889C0 4.31363 1.22778 5.55778 2.74233 5.55778Z" transform="translate(20.8105 24.3027)" fill="white"/> <path d="M2.74233 5.55778C4.25687 5.55778 5.48465 4.31363 5.48465 2.77889C5.48465 1.24415 4.25687 0 2.74233 0C1.22778 0 0 1.24415 0 2.77889C0 4.31363 1.22778 5.55778 2.74233 5.55778Z" transform="translate(12.5836 24.3025)" fill="white"/> <path d="M0.685582 1.38945C0.274233 1.38945 0 1.11156 0 0.694723C0 0.277889 0.274233 0 0.685582 0C1.09693 0 1.37116 0.277889 1.37116 0.694723C1.37116 1.11156 1.09693 1.38945 0.685582 1.38945Z" transform="translate(17.3835 15.2717)" fill="white"/> <path d="M0.685582 1.38945C0.274233 1.38945 0 1.11156 0 0.694723C0 0.277889 0.274233 0 0.685582 0C1.09693 0 1.37116 0.277889 1.37116 0.694723C1.37116 1.11156 1.09693 1.38945 0.685582 1.38945Z" transform="translate(22.8668 15.2717)" fill="white"/> <path d="M4.14916 4.20448C2.22953 4.20448 0.447017 2.81503 0.035668 0.869809C-0.101448 0.452975 0.172786 0.175088 0.584135 0.0361436C0.995484 -0.102801 1.26972 0.17509 1.40683 0.591924C1.68106 1.84242 2.77799 2.81503 4.14916 2.81503C5.52032 2.81503 6.61725 1.84242 6.89148 0.591924C7.0286 0.17509 7.30283 0.0361436 7.71418 0.0361436C8.12553 0.175088 8.26265 0.452975 8.26265 0.869809C7.8513 2.81503 6.06879 4.20448 4.14916 4.20448Z" transform="translate(16.662 18.7092)" fill="white"/>'
|
254 |
),
|
255 |
array(
|
256 |
-
'example' => '
|
257 |
'placeholder' => __('Enter a poptin link', CHT_OPT),
|
258 |
'slug' => 'Poptin',
|
259 |
'title' => 'Poptin',
|
51 |
array(
|
52 |
'example' => '1507854875',
|
53 |
'placeholder' => __('Phone number', CHT_OPT),
|
54 |
+
'help_title' => 'How do I use this?',
|
55 |
+
'help' => 'Enter your country code (in our example 1) and then your number without a leading zero (in our example 507854875)',
|
56 |
'slug' => 'Whatsapp',
|
57 |
'svg' => '<circle class="color-element" cx="19.4395" cy="19.4395" r="19.4395" fill="#49E670"/>
|
58 |
<path d="M12.9821 10.1115C12.7029 10.7767 11.5862 11.442 10.7486 11.575C10.1902 11.7081 9.35269 11.8411 6.84003 10.7767C3.48981 9.44628 1.39593 6.25317 1.25634 6.12012C1.11674 5.85403 2.13001e-06 4.39053 2.13001e-06 2.92702C2.13001e-06 1.46351 0.83755 0.665231 1.11673 0.399139C1.39592 0.133046 1.8147 1.01506e-06 2.23348 1.01506e-06C2.37307 1.01506e-06 2.51267 1.01506e-06 2.65226 1.01506e-06C2.93144 1.01506e-06 3.21063 -2.02219e-06 3.35022 0.532183C3.62941 1.19741 4.32736 2.66092 4.32736 2.79397C4.46696 2.92702 4.46696 3.19311 4.32736 3.32616C4.18777 3.59225 4.18777 3.59224 3.90858 3.85834C3.76899 3.99138 3.6294 4.12443 3.48981 4.39052C3.35022 4.52357 3.21063 4.78966 3.35022 5.05576C3.48981 5.32185 4.18777 6.38622 5.16491 7.18449C6.42125 8.24886 7.39839 8.51496 7.81717 8.78105C8.09636 8.91409 8.37554 8.9141 8.65472 8.648C8.93391 8.38191 9.21309 7.98277 9.49228 7.58363C9.77146 7.31754 10.0507 7.1845 10.3298 7.31754C10.609 7.45059 12.2841 8.11582 12.5633 8.38191C12.8425 8.51496 13.1217 8.648 13.1217 8.78105C13.1217 8.78105 13.1217 9.44628 12.9821 10.1115Z" transform="translate(12.9597 12.9597)" fill="#FAFAFA"/>
|
73 |
array(
|
74 |
'example' => '+1507854875',
|
75 |
'placeholder' => __('Phone number', CHT_OPT),
|
76 |
+
'help_title' => 'How do I use this?',
|
77 |
+
'help' => 'Enter your country code (in our example +1) and then your number without a leading zero (in our example 507854875)',
|
78 |
'slug' => 'SMS',
|
79 |
'title' => 'SMS',
|
80 |
'color' => '#FF549C',
|
181 |
array(
|
182 |
'example' => '+1507854875',
|
183 |
'placeholder' => __('Phone number', CHT_OPT),
|
184 |
+
'help_title' => 'How do I use this?',
|
185 |
+
'help' => 'Enter your country code (in our example +1) and then your number without a leading zero (in our example 507854875)',
|
186 |
'slug' => 'Phone',
|
187 |
'title' => 'Phone',
|
188 |
'color' => '#03E78B',
|
259 |
fill="#6ECCEF" class="color-element"/> <path d="M12.3405 18.0628C3.97637 18.0628 0 16.5344 0 13.1997C0 12.7829 0.274233 12.505 0.685582 12.505C1.37116 12.505 1.91963 12.3661 2.19386 11.9492C3.01656 10.9766 2.74233 9.17034 2.74233 9.17034C2.74233 4.02939 6.99293 0 12.3405 0C17.688 0 21.9386 4.02939 21.9386 9.0314C21.9386 14.0334 17.688 18.0628 12.3405 18.0628ZM1.50828 13.7555C2.19386 15.5618 5.896 16.6733 12.3405 16.6733C16.8653 16.6733 20.5675 13.1997 20.5675 9.0314C20.5675 4.86306 16.8653 1.38945 12.3405 1.38945C7.81563 1.38945 4.11349 4.86306 4.11349 9.0314C4.11349 9.0314 4.52484 11.3935 3.29079 12.7829C2.74233 13.3387 2.19386 13.6166 1.50828 13.7555Z" transform="translate(8.46936 9.01862)" fill="white"/> <path d="M2.74233 5.55778C4.25687 5.55778 5.48465 4.31363 5.48465 2.77889C5.48465 1.24415 4.25687 0 2.74233 0C1.22778 0 0 1.24415 0 2.77889C0 4.31363 1.22778 5.55778 2.74233 5.55778Z" transform="translate(20.8105 24.3027)" fill="white"/> <path d="M2.74233 5.55778C4.25687 5.55778 5.48465 4.31363 5.48465 2.77889C5.48465 1.24415 4.25687 0 2.74233 0C1.22778 0 0 1.24415 0 2.77889C0 4.31363 1.22778 5.55778 2.74233 5.55778Z" transform="translate(12.5836 24.3025)" fill="white"/> <path d="M0.685582 1.38945C0.274233 1.38945 0 1.11156 0 0.694723C0 0.277889 0.274233 0 0.685582 0C1.09693 0 1.37116 0.277889 1.37116 0.694723C1.37116 1.11156 1.09693 1.38945 0.685582 1.38945Z" transform="translate(17.3835 15.2717)" fill="white"/> <path d="M0.685582 1.38945C0.274233 1.38945 0 1.11156 0 0.694723C0 0.277889 0.274233 0 0.685582 0C1.09693 0 1.37116 0.277889 1.37116 0.694723C1.37116 1.11156 1.09693 1.38945 0.685582 1.38945Z" transform="translate(22.8668 15.2717)" fill="white"/> <path d="M4.14916 4.20448C2.22953 4.20448 0.447017 2.81503 0.035668 0.869809C-0.101448 0.452975 0.172786 0.175088 0.584135 0.0361436C0.995484 -0.102801 1.26972 0.17509 1.40683 0.591924C1.68106 1.84242 2.77799 2.81503 4.14916 2.81503C5.52032 2.81503 6.61725 1.84242 6.89148 0.591924C7.0286 0.17509 7.30283 0.0361436 7.71418 0.0361436C8.12553 0.175088 8.26265 0.452975 8.26265 0.869809C7.8513 2.81503 6.06879 4.20448 4.14916 4.20448Z" transform="translate(16.662 18.7092)" fill="white"/>'
|
260 |
),
|
261 |
array(
|
262 |
+
'example' => 'https://app.popt.in/APIRequest/click/34e92354f927c',
|
263 |
'placeholder' => __('Enter a poptin link', CHT_OPT),
|
264 |
'slug' => 'Poptin',
|
265 |
'title' => 'Poptin',
|
cht-icons.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
Author URI: https://premio.io/downloads/chaty/
|
8 |
Text Domain: chaty
|
9 |
Domain Path: /languages
|
10 |
-
Version: 2.4.
|
11 |
License: GPL2
|
12 |
*/
|
13 |
|
@@ -27,7 +27,7 @@ define('CHT_INC', CHT_DIR . '/includes');
|
|
27 |
define('CHT_PRO_URL', admin_url("admin.php?page=chaty-app-upgrade"));
|
28 |
define('CHT_PLUGIN_URL', plugin_dir_url(__FILE__));
|
29 |
define('CHT_PLUGIN_BASE', plugin_basename(CHT_FILE));
|
30 |
-
define('CHT_VERSION', "2.4.
|
31 |
|
32 |
if (!function_exists('wp_doing_ajax')) {
|
33 |
function wp_doing_ajax()
|
@@ -140,6 +140,11 @@ function cht_install()
|
|
140 |
update_option('cht_color', '#A886CD');
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
|
|
143 |
$option = get_option("Chaty_show_affiliate_box_after");
|
144 |
if($option === false || empty($option)) {
|
145 |
$date = date("Y-m-d", strtotime("+5 days"));
|
7 |
Author URI: https://premio.io/downloads/chaty/
|
8 |
Text Domain: chaty
|
9 |
Domain Path: /languages
|
10 |
+
Version: 2.4.9
|
11 |
License: GPL2
|
12 |
*/
|
13 |
|
27 |
define('CHT_PRO_URL', admin_url("admin.php?page=chaty-app-upgrade"));
|
28 |
define('CHT_PLUGIN_URL', plugin_dir_url(__FILE__));
|
29 |
define('CHT_PLUGIN_BASE', plugin_basename(CHT_FILE));
|
30 |
+
define('CHT_VERSION', "2.4.9");
|
31 |
|
32 |
if (!function_exists('wp_doing_ajax')) {
|
33 |
function wp_doing_ajax()
|
140 |
update_option('cht_color', '#A886CD');
|
141 |
}
|
142 |
|
143 |
+
$popup_status = get_option("chaty_intro_popup");
|
144 |
+
if($popup_status === false || empty($popup_status)) {
|
145 |
+
add_option("chaty_intro_popup", "show");
|
146 |
+
}
|
147 |
+
|
148 |
$option = get_option("Chaty_show_affiliate_box_after");
|
149 |
if($option === false || empty($option)) {
|
150 |
$date = date("Y-m-d", strtotime("+5 days"));
|
css/chaty-front.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
body.hide-cht-widget .chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before{display:none}.facebook .chaty-widget-i-title{padding:0!important}.widget-img img{max-height:100%;max-width:100%;height:auto;margin:0 auto}.widget-img{text-align:center}.widget-img img{object-fit:cover}.chaty-widget .chaty-widget-i.facebook.active.before .chaty-widget-i-title.fb-title{display:none!important}.wechat-box img{object-fit:cover;max-width:220px;height:auto;width:100%}.wechat-box-head svg{cursor:pointer;width:30px;height:30px}.wechat-box-head SVG{cursor:pointer;width:30PX;height:30px;fill:#fff;font-weight:700}.wechat-box-head{width:100%;display:inline-block;vertical-align:bottom;color:#fff;padding:0 0 0 10px;line-height:34px;background:#34a700;height:34px}.wechat-box{display:inline-block;vertical-align:bottom;position:relative;padding:10px}.wechat-qr-code{display:inline-block;vertical-align:bottom;background:#fff;border-radius:5px;-webkit-box-shadow:0 0 5px 0 #ccc;-moz-box-shadow:0 0 5px 0 #ccc;box-shadow:0 0 5px 0 #ccc;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;max-width:250px;height:auto;overflow:hidden;position:fixed;bottom:30px;left:100px;padding:0;z-index:100001}.chaty-social-img{display:block;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.chaty-social-img img{object-fit:cover;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.widget-img{display:flex;align-items:center;height:100%;overflow:hidden;border-radius:100%}.get{opacity:1}.chaty-widget-show .get{opacity:1}.get a{color:#222!important;text-decoration:none!important}body .one_widget .bofore_del:before{opacity:0!important;display:none}.one_widget.chaty-widget:not(.chaty-widget-is-right) .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title{font-size:17px;left:-3px;top:50%;white-space:nowrap;padding:5px 15px;line-height:21px;color:#333;background-color:#fff;box-shadow:0 1.93465px 7.73859px rgba(0,0,0,.15);border-radius:10px}.chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title,.chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before{opacity:1!important}.snap-wee-title{z-index:20;opacity:0;padding:10px 10px 9px 12px!important;font-size:17px;transform:translate(calc(-100% - 14px),-50%);left:-3px;top:50%;white-space:nowrap;line-height:21px;color:#333;background-color:#fff;box-shadow:0 1.93465px 7.73859px rgba(0,0,0,.15);border-radius:10px;position:absolute}@media (min-width:1024px){.chaty-widget-i:hover .snap-wee-title{opacity:1}}.chaty-widget-i.hover .snap-wee-title{opacity:1}.snap-wee-title:before{content:"";right:-9px;position:absolute;top:50%;transform:translateY(-50%);height:0;width:0;z-index:11;border-width:5px 0 5px 10px;border-style:solid;border-color:transparent transparent transparent #fff}.snap-wee-title p{color:#222;text-decoration:none;margin:0;padding:0}.chaty-widget-i .chaty-widget-i-title p{color:#222!important;text-decoration:none!important;margin:0!important;padding:0!important}.chaty-widget-i .i-trigger a{color:#222!important;text-decoration:none!important}*{-webkit-tap-highlight-color:transparent!important}.i-trigger-close svg,.i-trigger-open svg{transition:all .5s}.chaty-widget-show .i-trigger-close svg,.chaty-widget-show .i-trigger-open svg{transform:rotate(180deg)}.none-widget-show .i-trigger-ope{-webkit-animation:fadein 1.5s;-moz-animation:fadein 1.5s;-ms-animation:fadein 1.5s;-o-animation:fadein 1.5s}.chaty-widget-show .i-trigger-cloe{-webkit-animation:fadein 1.5s;-moz-animation:fadein 1.5s;-ms-animation:fadein 1.5s;-o-animation:fadein 1.5s}.chaty-widget .i-trigger-open.chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title{transform:translate(calc(-100% - 12px),-50%)}.chaty-widget-is-right.chaty-widget .i-trigger-open.chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title{right:0;left:auto;transform:translate(calc(100% + 12px),-50%)}.chaty-widget-is-right.chaty-widget .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title{right:0;left:auto;transform:translate(calc(100% + 13px),-50%)}.chaty-widget-is-right.chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before{left:auto;right:-18px}.chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before{left:-18px}.one_widget .i-trigger-open .chaty-widget-i-title{padding:10px 10px 9px 12px!important}.one_widget .i-trigger-open.hidetooltip .chaty-widget-i-title{display:none}.one_widget .i-trigger-open.hidetooltip .chaty-widget-i:before{display:none}.chaty-widget .chaty-widget-i.before.facebook:not(.no-tooltip):hover:before,.chaty-widget .chaty-widget-i.facebook.before:not(.no-tooltip):hover .chaty-widget-i-title{opacity:1;pointer-events:auto}.chaty-widget .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title,.chaty-widget .chaty-widget-i:not(.no-tooltip).before:before{opacity:1}.one_widget .chaty-widget-i svg{position:relative}body .chaty-widget-i-title.true{opacity:1!important}.chaty-widget .i-trigger-open:not(.no-tooltip):before{opacity:1!important}.chaty-widget .chaty-widget-i.facebook.active:not(.no-tooltip) .chaty-widget-i-title,.chaty-widget .chaty-widget-i.facebook:not(.no-tooltip):hover:before{pointer-events:initial}.chaty-widget .facebook_header{background-color:#1e88e5;height:34px;border-top-left-radius:5px;border-top-right-radius:5px;padding-left:9px;display:flex;align-items:center;justify-content:space-between}body .chaty-widget-i .facebook_header p{font-family:Lato,Helvetica,Arial,sans-serif;font-size:13px;color:#fff!important;position:relative}.facebook_header p,.facebook_header svg{display:inline-block;vertical-align:bottom;margin:0}.chaty-widget .chaty-widget-i .facebook_header svg{height:30px!important;width:30px!important}.chaty-widget{display:none!important}@media screen and (max-width:800px){.i-trigger-close .chaty-widget-i-title{display:none}}@media screen and (max-width:480px){.mobile_none{display:none}.chaty-widget.mobile_active{display:block!important}}@media screen and (min-width:480px){.chaty-widget.desktop_active{display:block!important}}.chaty-widget{position:fixed;z-index:9999}.chaty-widget .chaty-widget-is{display:flex;z-index:1111;flex-wrap:wrap;overflow:hidden;height:0;position:absolute;pointer-events:none;left:0;right:auto;bottom:65px;opacity:0}#transition_disabled{-webkit-animation:none!important;-moz-animation:none!important;-ms-animation:none!important;-o-animation:none!important;-webkit-animation:none!important}@keyframes fadeout{from{opacity:1}to{opacity:0}}@-moz-keyframes fadeout{from{opacity:1}to{opacity:0}}@-webkit-keyframes fadeout{from{opacity:1}to{opacity:0}}@-o-keyframes fadeout{from{opacity:1}to{opacity:0}}.chaty-widget .i-trigger{cursor:pointer;position:relative}.chaty-widget .i-trigger .i-trigger-close,.chaty-widget .i-trigger .i-trigger-open{transition:all .2s}.chaty-widget .i-trigger .i-trigger-close{position:absolute;bottom:-4px;left:0;right:0;z-index:2}.chaty-widget .i-trigger .i-trigger-open{opacity:1;pointer-events:auto}.chaty-widget .i-trigger .i-trigger-close{opacity:0;pointer-events:none}.chaty-widget.chaty-widget-show .i-trigger .i-trigger-open{opacity:0;pointer-events:none}.chaty-widget.chaty-widget-show .i-trigger .i-trigger-close{box-shadow:none;opacity:1;pointer-events:auto}.chaty-widget.chaty-widget-show .chaty-widget-is{pointer-events:auto;overflow:visible;opacity:1;visibility:visible}@keyframes fadein{from{opacity:0}to{opacity:1}}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-ms-keyframes fadein{from{opacity:0}to{opacity:1}}@-o-keyframes fadein{from{opacity:0}to{opacity:1}}.chaty-widget.chaty-widget-show .chaty-widget-is .chaty-widget-i{opacity:1;overflow:visible}.chaty-widget .chaty-widget-i .chaty-widget-i{margin:0}.chaty-widget .chaty-widget-i{border-radius:50%;vertical-align:top;width:54px;height:54px;position:relative;margin:4px}.chaty-widget .chaty-widget-i .wrap-svg,.chaty-widget .chaty-widget-i svg{cursor:pointer;width:100%;height:100%;display:block;position:relative;box-shadow:0 3px 6px rgba(0,0,0,.25);box-shadow:0 3px 6px rgba(0,0,0,.25);border-radius:50%;-wekit-border-radius:50%;-moz-border-radius:50%}body .i-trigger-open .chaty-widget-i-title{padding:5px 16px 5px 17px!important}.chaty-widget:not(.chaty-widget-is-right) .i-trigger-open:before{left:-18px!important}.one_widget.chaty-widget.chaty-widget-is-right .i-trigger-open:before{right:-12px!important}body .one_widget .i-trigger-open .chaty-widget-i-title.face_title{padding:0!important}.one_widget.chaty-widget .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title{transform:translate(calc(-100% - 14px),-50%)}.chaty-widget .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title,.chaty-widget .chaty-widget-i:not(.no-tooltip):before{content:none;position:absolute;opacity:0;pointer-events:none;z-index:10}.chaty-widget .chaty-widget-i:not(.no-tooltip):before{content:"";left:-14px;top:50%;transform:translateY(-50%);height:0;width:0;z-index:11;border-width:5px 0 5px 10px;border-style:solid;border-color:transparent transparent transparent #fff}.chaty-widget .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title{text-align:center;font-size:17px;left:0;top:50%;transform:translate(calc(-100% - 13px),-50%);white-space:nowrap;padding:5px 15px;line-height:21px;color:#333;background-color:#fff;box-shadow:0 1.93465px 7.73859px rgba(0,0,0,.15);border-radius:10px}.chaty-widget .chaty-widget-i:not(.no-tooltip):hover .chaty-widget-i-title,.chaty-widget .chaty-widget-i:not(.no-tooltip):hover:before{opacity:1;pointer-events:auto}.chaty-widget .chaty-widget-i.facebook:not(.no-tooltip):hover .chaty-widget-i-title,.chaty-widget .chaty-widget-i.facebook:not(.no-tooltip):hover:before{opacity:0;pointer-events:auto}.chaty-widget .chaty-widget-i .color-element{transition:all .2s}.chaty-widget:not(.chaty-widget-is-right) .chaty-widget-is{position:absolute;right:0;left:auto;bottom:65px;justify-content:flex-end}.chaty-widget.chaty-widget-is-right .i-trigger-open.chaty-widget-i:before{right:-13px;left:auto;border-width:5px 10px 5px 0;border-color:transparent #fff transparent transparent}.chaty-widget.chaty-widget-is-right .chaty-widget-i:before{right:-14px;left:auto;border-width:5px 10px 5px 0;border-color:transparent #fff transparent transparent}.chaty-widget.chaty-widget-is-right .chaty-widget-i.facebook.active .chaty-widget-i-title.face_title{position:fixed;transform:initial!important;right:auto;top:calc(100% - 484px)}.chaty-widget .chaty-widget-i.facebook.active .chaty-widget-i-title{min-width:250px;padding:0;position:fixed;transform:initial;right:29px;left:auto;top:calc(100% - 484px)}.one_widget.chaty-widget.chaty-widget-is-right .chaty-widget-i .chaty-widget-i-title{right:0;left:auto;transform:translate(calc(100% + 17px),-50%)!important}.chaty-animation-pulse{animation:chaty-animation-pulse 1s forwards}.chaty-animation-jump{animation:chaty-animation-jump 1s forwards cubic-bezier(.84,-.54,.31,1.19)}.chaty-animation-waggle{animation:chaty-animation-waggle 1s forwards ease-out}.chaty-animation-sheen{position:relative;overflow:hidden}.chaty-animation-sheen:after{animation:chaty-animation-sheen 1.5s forwards;content:'';position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(to bottom,transparent,rgba(255,255,255,.5) 50%,transparent);transform:rotateZ(60deg) translate(0,5em)}.chaty-animation-spin{animation:chaty-animation-spin 1s forwards cubic-bezier(.56,-.35,.22,1.5)}.chaty-animation-fade{animation:chaty-animation-fade 1s forwards}@keyframes chaty-animation-pulse{0%{background-color:orange}25%{background-color:red}50%{background-color:orange}75%{background-color:red}}@keyframes chaty-animation-jump{0%{transform:none}50%{transform:translateY(-1em)}}@keyframes chaty-animation-waggle{0%{transform:none}50%{transform:rotateZ(-20deg) scale(1.2)}60%{transform:rotateZ(25deg) scale(1.2)}67.5%{transform:rotateZ(-15deg) scale(1.2)}75%{transform:rotateZ(15deg) scale(1.2)}82.5%{transform:rotateZ(-12deg) scale(1.2)}85%{transform:rotateZ(0) scale(1.2)}100%{transform:rotateZ(0) scale(1)}}@keyframes chaty-animation-sheen{100%{transform:rotateZ(60deg) translate(0,-80px)}}@keyframes chaty-animation-spin{50%{transform:rotateZ(-20deg);animation-timing-function:ease}100%{transform:rotateZ(360deg)}}@keyframes chaty-animation-fade{25%{opacity:.25}50%{opacity:1}75%{opacity:.25}100%{opacity:1}}.start-now,.start-now:after{animation-delay:0}.chaty-widget .i-trigger{z-index:1000}.chaty-widget:not(.chaty-widget-is-right) .chaty-widget-is{z-index:1000}.chaty-nav:before{display:block;position:fixed;top:0;left:0;content:'';width:100vw;height:100vh;background:rgba(0,0,0,.8);visibility:hidden;z-index:100;transition:all .5s ease-in-out;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out}.chaty-animation-widget.left-position .chaty-nav:before{clip-path:circle(15px at 60px calc(100% - 60px))}.chaty-animation-widget.right-position .chaty-nav:before{clip-path:circle(15px at calc(100% - 60px) calc(100% - 60px))}.chaty-animation-widget.active .chaty-nav:before{visibility:visible;clip-path:circle(100%)}.chaty-widget-is.has-no-close-btn{position:absolute!important;bottom:0!important;top:auto!important}.chaty-widget.hide-tooltip-arrow .chaty-widget-i:before{display:none!important}body .no-tooltip .chaty-widget-i-title.true{display:none}.chaty-widget-i.hide-chaty-arrow:before{display:none}.chaty-widget-show .i-trigger-open.single-button svg{transform:rotate(0)!important;-webkit-transform:rotate(0)!important}.facustom-icon{display:block;border-radius:50%;-moz-border-radius:50%;-webkit-border-radius:50%;text-align:center;color:#fff}
|
includes/class-frontend.php
CHANGED
@@ -115,7 +115,7 @@ class CHT_Frontend extends CHT_Admin_Base
|
|
115 |
</div>
|
116 |
<!-- Social Media input -->
|
117 |
<div class="channels__input-box">
|
118 |
-
<input type="text" class="channels__input" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php esc_attr_e($value['value']); ?>" data-gramm_editor="false" id="<?php echo esc_attr($social['slug']); ?>" />
|
119 |
</div>
|
120 |
<?php
|
121 |
$channel_id = $this->del_space($social['slug']);
|
@@ -143,7 +143,11 @@ class CHT_Frontend extends CHT_Admin_Base
|
|
143 |
|
144 |
<!-- example for social media -->
|
145 |
<div class="input-example">
|
146 |
-
<?php esc_attr_e('For example', CHT_OPT); ?>:
|
|
|
|
|
|
|
|
|
147 |
</div>
|
148 |
|
149 |
<!-- checking for extra help message for social media -->
|
@@ -369,7 +373,7 @@ class CHT_Frontend extends CHT_Admin_Base
|
|
369 |
<!-- advance setting fields: end -->
|
370 |
|
371 |
<!-- remove social media setting button: start -->
|
372 |
-
<button class="btn-cancel" data-social="<?php echo esc_attr($social['slug']); ?>">
|
373 |
<svg width="14" height="13" viewBox="0 0 14 13" fill="none"
|
374 |
xmlns="http://www.w3.org/2000/svg">
|
375 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
|
115 |
</div>
|
116 |
<!-- Social Media input -->
|
117 |
<div class="channels__input-box">
|
118 |
+
<input placeholder="<?php esc_attr_e($social['example']); ?>" type="text" class="channels__input" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php esc_attr_e($value['value']); ?>" data-gramm_editor="false" id="<?php echo esc_attr($social['slug']); ?>" />
|
119 |
</div>
|
120 |
<?php
|
121 |
$channel_id = $this->del_space($social['slug']);
|
143 |
|
144 |
<!-- example for social media -->
|
145 |
<div class="input-example">
|
146 |
+
<?php esc_attr_e('For example', CHT_OPT); ?>:
|
147 |
+
<?php if($social['slug'] == "Poptin") { ?>
|
148 |
+
<br/>
|
149 |
+
<?php } ?>
|
150 |
+
<?php esc_attr_e($social['example']); ?>
|
151 |
</div>
|
152 |
|
153 |
<!-- checking for extra help message for social media -->
|
373 |
<!-- advance setting fields: end -->
|
374 |
|
375 |
<!-- remove social media setting button: start -->
|
376 |
+
<button type="button" class="btn-cancel" data-social="<?php echo esc_attr($social['slug']); ?>">
|
377 |
<svg width="14" height="13" viewBox="0 0 14 13" fill="none"
|
378 |
xmlns="http://www.w3.org/2000/svg">
|
379 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
|
js/cht-front-script.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t){var e={};function i(s){if(e[s])return e[s].exports;var a=e[s]={i:s,l:!1,exports:{}};return t[s].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/",i(i.s=10)}({10:function(t,e,i){i(11),t.exports=i(12)},11:function(t,e){!function(t){var e,i=0,s=chaty_settings,a=".i-trigger .chaty-widget-i .svg, .i-trigger .chaty-widget-i .widget-img, .i-trigger .chaty-widget-i .facustom-icon";function o(t){for(var e=t+"=",i=document.cookie.split(";"),s=0;s<i.length;s++){for(var a=i[s];" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(e))return a.substring(e.length,a.length)}return""}new Date;function c(){var t=new Date;setInterval(function(){t.setTime(t.getTime()+1e3),document.cookie="display_cta=none; expires="+t.toGMTString()+"; path=/"},500)}function n(t,e,i){var s="";if(i){var a=new Date;a.setTime(a.getTime()+24*i*60*60*1e3),s="; expires="+a.toUTCString()}document.cookie=t+"="+(e||"")+s+"; path=/"}function g(t){for(var e=t+"=",i=document.cookie.split(";"),s=0;s<i.length;s++){for(var a=i[s];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(e))return a.substring(e.length,a.length)}return null}function l(){n("cta_widget_status","yes",1),i=1;var t=0;t=jQuery("body").hasClass("chaty-in-desktop")?jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop").length:jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile").length,null!=g("chaty-animation")&&(chaty_settings.object_settings.animation_class=""),""!=chaty_settings.object_settings.animation_class&&(jQuery(".i-trigger .chaty-widget-i svg").wrap(function(){return"<div class='svg'></div>"}),"sheen"!=chaty_settings.object_settings.animation_class?t>1?(jQuery(a).removeClass("chaty-animation-"+chaty_settings.object_settings.animation_class).removeClass("start-now"),setTimeout(function(){jQuery(a).addClass("chaty-animation-"+chaty_settings.object_settings.animation_class).addClass("start-now")},1e3),e=setInterval(function(){jQuery(a).removeClass("chaty-animation-"+chaty_settings.object_settings.animation_class).removeClass("start-now"),setTimeout(function(){jQuery(a).addClass("chaty-animation-"+chaty_settings.object_settings.animation_class).addClass("start-now")},1e3)},5e3)):1==t&&(a=".chaty-main-widget svg, .chaty-main-widget img, .chaty-main-widget .facustom-icon",jQuery(a).removeClass("chaty-animation-"+chaty_settings.object_settings.animation_class).removeClass("start-now"),setTimeout(function(){jQuery(a).addClass("chaty-animation-"+chaty_settings.object_settings.animation_class).addClass("start-now")},1e3),e=setInterval(function(){jQuery(a).removeClass("chaty-animation-"+chaty_settings.object_settings.animation_class).removeClass("start-now"),setTimeout(function(){jQuery(a).addClass("chaty-animation-"+chaty_settings.object_settings.animation_class).addClass("start-now")},1e3)},5e3)):(a=".i-trigger .chaty-widget-i .wrap-svg",jQuery(".i-trigger .chaty-widget-i .wrap-svg").length||jQuery(".i-trigger .chaty-widget-i svg").wrap(function(){return"<div class='wrap-svg'></div>"}),jQuery(a).removeClass("chaty-animation-sheen").removeClass("start-now"),setTimeout(function(){jQuery(a).addClass("chaty-animation-sheen").addClass("start-now")},10),e=setInterval(function(){jQuery(a).removeClass("chaty-animation-sheen").removeClass("start-now"),setTimeout(function(){jQuery(a).addClass("chaty-animation-sheen").addClass("start-now")},10)},5e3))),"open"==chaty_settings.object_settings.display_state&&("no"==chaty_settings.object_settings.has_close_button?t>1&&(r(),jQuery(".chaty-widget").find(".i-trigger-open").removeClass("active_clos"),jQuery(".chaty-widget").find(".i-trigger-open").trigger("click"),jQuery(".chaty-widget-is").addClass("has-no-close-btn"),jQuery(".i-trigger").remove()):t>1&&(r(),jQuery(".chaty-widget").find(".i-trigger-open").removeClass("active_clos"),jQuery(".chaty-widget").find(".i-trigger-open").trigger("click")))}function r(){e&&(clearInterval(e),e=0),n("chaty-animation","stop",1),jQuery(".chaty-animation-"+chaty_settings.object_settings.animation_class).removeClass("chaty-animation-"+chaty_settings.object_settings.animation_class).removeClass("start-now"),jQuery(".start-now").removeClass("start-now"),chaty_settings.object_settings.animation_class=""}o("display_cta"),token="",jQuery(document).ready(function(){"true"==s.object_settings.active&&function(e,i){var s=e.object_settings.device,a="";if("right"==e.object_settings.position)a="left: auto;bottom: 25px; right: 25px;";else if("left"==e.object_settings.position)a="right: auto; bottom: 25px; left: 25px;";else if("custom"==e.object_settings.position){var c=e.object_settings.pos_side,n=e.object_settings.bot,g=e.object_settings.side;a="right"===c?"left: auto; bottom: "+n+"px; right: "+g+"px":"left: "+g+"px; bottom: "+n+"px; right: auto"}var l=e.object_settings.cta,r="",d=e.object_settings.social,h=!1;if((/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4)))&&(h=!0),h?jQuery("body").addClass("chaty-in-mobile"):jQuery("body").addClass("chaty-in-desktop"),Object.keys(d).length>=1&&(r='<div class="chaty-widget hide-widget '+i+" "+s+' " style="display:block; '+a+'" dir="ltr">',r+='<div class="chaty-widget-is" id="transition_disabled">'),r+=function(e){var i="",s=0;return t.each(e.object_settings.social,function(t,a){if(e.object_settings.isPRO&&jQuery("body").addClass("has-pro-version"),!e.object_settings.isPRO&&"3"==++s)return!1;extra_class="","1"!=e.object_settings.analytics&&1!=e.object_settings.analytics||(extra_class+=" update-analytics ");var o=1==e.object_settings.social[t].is_desktop?"is-in-desktop":"",c=1==e.object_settings.social[t].is_mobile?"is-in-mobile":"",n=1==e.object_settings.is_mobile?e.object_settings.social[t].mobile_target:e.object_settings.social[t].desktop_target;if(jQuery("body").hasClass("chaty-in-mobile")&&(e.object_settings.social[t].href_url=e.object_settings.social[t].mobile_url),"viber"==e.object_settings.social[t].social_channel){if(jQuery("body").hasClass("chaty-in-mobile")){var g=e.object_settings.social[t].href_url;g=g.replace("+",""),navigator.userAgent.match(/(iPod|iPhone|iPad)/)&&(g="+"+g),e.object_settings.social[t].href_url=g}e.object_settings.social[t].href_url="viber://chat?number="+e.object_settings.social[t].href_url}console.log(e.object_settings.social[t].href_url),socialString='<div class="chaty-widget-i chaty-main-widget '+o+" "+c+" "+extra_class+" "+e.object_settings.social[t].social_channel+'" data-title="'+e.object_settings.social[t].val+'" id="chaty-channel-'+e.object_settings.social[t].social_channel+'" data-channel="'+e.object_settings.social[t].social_channel+'" data-code="'+e.object_settings.social[t].qr_code_image+'">',bgColor="",""!=e.object_settings.social[t].bg_color&&(socialString+="<style>#chaty-channel-"+e.object_settings.social[t].social_channel+" .color-element {fill: "+e.object_settings.social[t].bg_color+"}</style>",bgColor="style='background-color: "+e.object_settings.social[t].bg_color+";'"),socialString+="<a class='set-url-target' rel='noopener' data-mobile-target='"+e.object_settings.social[t].mobile_target+"' data-desktop-target='"+e.object_settings.social[t].desktop_target+"' target='"+n+"' href='"+e.object_settings.social[t].href_url+"' >",""!=e.object_settings.social[t].img_url?socialString+="<span "+bgColor+" class='chaty-social-img'><img src='"+e.object_settings.social[t].img_url+"' alt='"+e.object_settings.social[t].title+"' /></span>":socialString+=e.object_settings.social[t].default_icon,socialString+="</a>",socialString+="<div class='chaty-widget-i-title'><p>"+e.object_settings.social[t].title+"</p></div>",socialString+="</div>",i+=socialString}),i}(e),d=e.object_settings.social,Object.keys(d).length>=1){r+="</div>",r+='<div class="i-trigger">';var y=o("display_cta"),w=current_url=window.location.origin;if(w=(w=w.replace("https://","")).replace("http://",""),""!=l&&"none"!=y)var _="true";else _="no-tooltip";r+='<div class="chaty-widget-i chaty-close-settings i-trigger-open '+_+' ">',r+=function(t){switch(t.object_settings.widget_type){case"chat-image":if(t.object_settings.widget_img.length>1)return'<div class="widget-img" style="background-color:'+t.object_settings.color+'"><img src="'+t.object_settings.widget_img+'"/></div>';case"chat-smile":return'<svg version="1.1" id="smile" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.8 507.1 54 54" style="enable-background:new -496.8 507.1 54 54;" xml:space="preserve"><style type="text/css">.st1{fill:#FFFFFF;} .st2{fill:none;stroke:#808080;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;}</style><g><circle cx="-469.8" cy="534.1" r="27" fill="'+t.object_settings.color+'"/></g><path class="st1" d="M-459.5,523.5H-482c-2.1,0-3.7,1.7-3.7,3.7v13.1c0,2.1,1.7,3.7,3.7,3.7h19.3l5.4,5.4c0.2,0.2,0.4,0.2,0.7,0.2c0.2,0,0.2,0,0.4,0c0.4-0.2,0.6-0.6,0.6-0.9v-21.5C-455.8,525.2-457.5,523.5-459.5,523.5z"/><path class="st2" d="M-476.5,537.3c2.5,1.1,8.5,2.1,13-2.7"/><path class="st2" d="M-460.8,534.5c-0.1-1.2-0.8-3.4-3.3-2.8"/></svg>';case"chat-bubble":return'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.9 507.1 54 54" style="enable-background:new -496.9 507.1 54 54;" xml:space="preserve"><style type="text/css">.st1{fill:#FFFFFF;}</style><g><circle cx="-469.9" cy="534.1" r="27" fill="'+t.object_settings.color+'"/></g><path class="st1" d="M-472.6,522.1h5.3c3,0,6,1.2,8.1,3.4c2.1,2.1,3.4,5.1,3.4,8.1c0,6-4.6,11-10.6,11.5v4.4c0,0.4-0.2,0.7-0.5,0.9 c-0.2,0-0.2,0-0.4,0c-0.2,0-0.5-0.2-0.7-0.4l-4.6-5c-3,0-6-1.2-8.1-3.4s-3.4-5.1-3.4-8.1C-484.1,527.2-478.9,522.1-472.6,522.1z M-462.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-464.6,534.6-463.9,535.3-462.9,535.3z M-469.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-471.7,534.6-471,535.3-469.9,535.3z M-477,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-478.8,534.6-478.1,535.3-477,535.3z"/></svg>';case"chat-db":return'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.1 54 54" style="enable-background:new -496 507.1 54 54;" xml:space="preserve"><style type="text/css">.st1{fill:#FFFFFF;}</style><g><circle cx="-469" cy="534.1" r="27" fill="'+t.object_settings.color+'"/></g><path class="st1" d="M-464.6,527.7h-15.6c-1.9,0-3.5,1.6-3.5,3.5v10.4c0,1.9,1.6,3.5,3.5,3.5h12.6l5,5c0.2,0.2,0.3,0.2,0.7,0.2c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18.2C-461.1,529.3-462.7,527.7-464.6,527.7z"/><path class="st1" d="M-459.4,522.5H-475c-1.9,0-3.5,1.6-3.5,3.5h13.9c2.9,0,5.2,2.3,5.2,5.2v11.6l1.9,1.9c0.2,0.2,0.3,0.2,0.7,0.2c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18C-455.9,524.1-457.5,522.5-459.4,522.5z"/></svg>';default:return'<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve"><style type="text/css">.st1 {fill: #FFFFFF;}.st0{fill: #808080;}</style><g><circle cx="-469" cy="534.7" r="27" fill="'+t.object_settings.color+'"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/><path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,530.8-478.2,530.5-477.7,530.5z"/><path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,533.9-478.2,533.5-477.7,533.5z"/></svg>'}}(e),y=o("display_cta"),""!=l&&"none"!=y&&(r+=' <div class="chaty-widget-i-title true"> ',r+=l,r+="</div>"),r+="</div>",r+='<div class="chaty-widget-i chaty-close-settings i-trigger-close" data-title="'+e.object_settings.close_text+'" style="background-color:'+e.object_settings.color+'">',""==e.object_settings.close_img?(r+='<svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">',r+='<ellipse cx="26" cy="26" rx="26" ry="26" fill="'+e.object_settings.color+'"/>',r+='<rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"/>',r+='<rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"/>',r+="</svg>"):r+="<span class='chaty-social-img'><img alt='"+e.object_settings.close_text+"' src='"+e.object_settings.close_img+"' /></span>",r+='<div class="chaty-widget-i-title">',r+=e.object_settings.close_text,r+="</div>",r+="</div>",r+=" </div>",0===i.length&&!e.object_settings.isPRO&&(r+='<div class="get" style="position: absolute;width: 100%;text-align: center;"> <a href="https://premio.io/downloads/chaty/?utm_source=wpplugin&domain='+w+'" target="_blank" style=" font-size: 11px; top: -10px; font-family: Lato, Helvetica, Arial, sans-serif; position: relative; color: #8c8585; ">Get Chaty</a></div>'),r+="</div>"}t("body").append(r)}(s,token),function(){var e=t(".chaty-widget"),i=s.object_settings.widget_size?s.object_settings.widget_size:54,a=+s.object_settings.widget_size+8;function c(){e.position().top;var t=e.find(".chaty-widget-is .chaty-widget-i").length;if((t=jQuery("body").hasClass("chaty-in-desktop")?e.find(".chaty-widget-is .chaty-widget-i.is-in-desktop").length:e.find(".chaty-widget-is .chaty-widget-i.is-in-mobile").length)*a>jQuery(window).height()-(chaty_settings.object_settings.widget_size+8)){var i=Math.round(Math.sqrt(t)),s=Math.ceil(Math.sqrt(t));e.find(".chaty-widget-is").css({height:s*a,width:i*a}),g(s),e.find("span").css({height:s*a,width:i*a}),g(s),e.find("img").css({height:s*a,width:i*a}),g(s)}else g()}function n(){"left"===s.object_settings.position&&e.addClass("chaty-widget-is-right"),"custom"===s.object_settings.position&&"left"===s.object_settings.pos_side&&e.addClass("chaty-widget-is-right")}function g(t){var s;s=jQuery("body").hasClass("chaty-in-desktop")?e.find(".chaty-widget-is .chaty-widget-i.is-in-desktop").length:e.find(".chaty-widget-is .chaty-widget-i.is-in-mobile").length,e.find(".chaty-widget-i").css({height:i+"px",width:i+"px"}),e.find("img").css({height:i+"px",width:i+"px"}),e.find("span").css({height:i+"px",width:i+"px"}),e.find(".chaty-widget-is").css({top:"-"+100*s+"%"}),e.find(".chaty-widget-is").height(s*(parseInt(i)+8)),e.find(".chaty-widget-is").width(parseInt(i)+8)}n(),c(),jQuery(window).resize(function(){c(),1==Object.keys(s.object_settings.social).length&&(jQuery(".chaty-widget").addClass("chaty-widget-show"),jQuery(".chaty-widget-is").css("top","auto"))}),t(".chaty-widget-i.facebook").mouseenter(function(){t(".facebook_two_mess").css({opacity:"1","z-index":"1"}),t(this).addClass("before")}),t(".chaty-widget-i.facebook").mouseleave(function(){t(".facebook_two_mess").css({opacity:"0","z-index":"1"}),t(this).removeClass("before")}),t(".chaty-widget-i.facebook").on("click",function(){t(this).addClass("active"),t(".facebook_two_mess").hide(),jQuery(".chaty-widget .get a").hide(),t(this).children(".face_title").css({opacity:"1","z-index":"2"}).show(),t(".chaty-widget").hasClass("one_widget")?t(".chaty-widget").hasClass("chaty-widget-is-right")?t(".face_title").css({top:"calc(100% - 447px)",left:"20px"}):t(".face_title").css({top:"calc(100% - 447px)",left:"auto",right:"20px"}):(t(".facebook_two_mess").css({opacity:"0","z-index":"10001"}),t(".ico_d").hide(),t(".chaty-widget .chaty-widget-i").css({"box-shadow":"0px 3px 6px rgba(0,0,0,0)"}),t(".chaty-widget").hasClass("one_widget")||t(".i-trigger").hide())}),t(".i-trigger-close").on("click",function(i){i.preventDefault(),t(".chaty-widget-i.facebook").hasClass("active")||(e.removeClass("chaty-widget-show"),e.addClass("none-widget-show"))}),t("body").on("click",".close_facebook",function(){t(".facebook_two_mess").show(),jQuery(".chaty-widget .get a").show(),t(".chaty-widget-i.facebook").removeClass("active"),t(this).parent().parent().css({opacity:"1"}).hide(),t(".i-trigger").show(),t(".chaty-widget-is .chaty-widget-i svg").show()}),t(".i-trigger-close").on("click",function(i){t(".i-trigger-open").addClass("active_clos"),i.preventDefault(),t(".chaty-widget-i.facebook").hasClass("active")||(e.removeClass("chaty-widget-show"),e.addClass("none-widget-show"))}),t("body").on("click",".update-analytics",function(t){if(channelName=jQuery(this).attr("data-channel"),null!=channelName&&""!=channelName)if(window.hasOwnProperty("gtag"))gtag("event","chaty_"+channelName,{eventCategory:"chaty_"+channelName,event_action:"chaty_"+channelName});else if(window.hasOwnProperty("ga")){var e=window.ga.getAll()[0];e&&e.send("event","click",{eventCategory:"chaty_"+channelName,eventAction:"chaty_"+channelName})}}),t("body").on("click",".wechat",function(){var t=jQuery(".chaty-widget .chaty-widget-i.wechat").attr("data-code");null!=t&&""!=t&&(jQuery("#wechat-qr-code").length||(htmlString="<div id='wechat-qr-code' class='wechat-qr-code'>",htmlString+='<div class="wechat-box-head">WeChat<svg xmlns="http://www.w3.org/2000/svg" class="close_facebook" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="612px" height="612px" viewBox="0 0 612 612" style="fill: #fff; float: right; margin-top: 4px;" xml:space="preserve"><path xmlns="http://www.w3.org/2000/svg" d="M268.064,256.75l138.593-138.593c3.124-3.124,3.124-8.189,0-11.313c-3.125-3.124-8.189-3.124-11.314,0L256.75,245.436 L118.157,106.843c-3.124-3.124-8.189-3.124-11.313,0c-3.125,3.124-3.125,8.189,0,11.313L245.436,256.75L106.843,395.343 c-3.125,3.125-3.125,8.189,0,11.314c1.562,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343L256.75,268.064l138.593,138.593 c1.563,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343c3.124-3.125,3.124-8.189,0-11.314L268.064,256.75z"></path></svg></div>',htmlString+="<div class='wechat-box'><img src='"+t+"' alt='QR Code' /><a href='javascript:;'>",htmlString+="</a></div></div>",jQuery("body").append(htmlString)),jQuery("#wechat-qr-code").show())});var l=o("display_cta");"hover"==chaty_settings.object_settings.display_state?e.find(".i-trigger-open").mouseenter(function(i){i.stopPropagation(),r(),t(".chaty-widget-is").removeAttr("id"),t(this).hasClass("active_clos")||t(".chaty-widget-i.facebook").hasClass("active")||e.hasClass("one_widget")||(n(),t(e).hasClass("chaty-widget-show")||(e.addClass("chaty-widget-show"),e.removeClass("none-widget-show"))),jQuery("body .chaty-widget-i-title.true").remove()}):e.find(".i-trigger-open").click(function(i){i.stopPropagation(),r(),t(".chaty-widget-is").removeAttr("id"),t(this).hasClass("active_clos")||t(".chaty-widget-i.facebook").hasClass("active")||e.hasClass("one_widget")||(n(),t(e).hasClass("chaty-widget-show")||(e.addClass("chaty-widget-show"),e.removeClass("none-widget-show"))),jQuery("body .chaty-widget-i-title.true").remove()}),t(".one_widget").on("click",function(){t(".chaty-widget-i-title").hasClass("face_title")?(t(".facebook_two_mess").detach(),t(".chaty-widget-i").addClass("bofore_del")):(t(".chaty-widget-i-title").detach(),t(".chaty-widget-i").addClass("bofore_del")),r()}),e.find(".i-trigger-open").on("click",function(){"none"!=l&&(t(".chaty-widget").hasClass(".one_widget")||t(".i-trigger-open .chaty-widget-i-title").detach()),t(".i-trigger-open").addClass("no-tooltip"),t(this).hasClass("active_clos")||t(".chaty-widget-i.facebook").hasClass("active")||e.hasClass("one_widget")||(n(),t(e).hasClass("chaty-widget-show")||(e.addClass("chaty-widget-show"),e.removeClass("none-widget-show"))),r()}),e.find(".i-trigger-open").mouseenter(function(){t(this).addClass("no-tooltip"),t(".i-trigger-open").removeClass("active_clos"),c()}),e.find(".chaty-widget-is").mouseleave(function(){t(".i-trigger-open").removeClass("active_clos"),t(".chaty-widget-i.facebook").hasClass("active")}),1===Object.keys(s.object_settings.social).length&&e.find(".i-trigger-open").on("touchstart",function(e){"use strict";t(this).find(".chaty-widget-i").toggleClass("hover")}),1==Object.keys(s.object_settings.social).length&&(jQuery(".chaty-widget").addClass("chaty-widget-show"),jQuery(".chaty-widget-is").css("top","auto"),jQuery(".chaty-widget-is").css("z-index","10001"),jQuery(".chaty-widget-i.i-trigger-close, .i-trigger.chaty-widget-i").remove(),jQuery(".chaty-widget .get a").css("top","-10px"),jQuery(".chaty-widget").addClass("one_widget"),jQuery(".chaty-widget-i:first .chaty-widget-i-title:last p").text(s.object_settings.cta),jQuery(document).on("click",".chaty-widget-i",function(){jQuery(".chaty-widget-i:first .chaty-widget-i-title:last").hide(),jQuery("body").addClass("hide-cht-widget")}),jQuery("body").append("<style>.chaty-widget-is{top:0!important;}</style>"))}(),t(document).ready(function(){1!==Object.keys(s.object_settings.social).length||!s.object_settings.social.snapchat&&!s.object_settings.social.wechat||s.object_settings.cta||(t(".chaty-widget-i-title").detach(),t(".chaty-widget-i").addClass("bofore_del")),t(".chaty-widget-i-title").hasClass("one_go")&&(t(".chaty-widget-i-title p").text(t(".chaty-widget-i-title.one_go").html()),"none"==o("display_cta")&&(t(".chaty-widget-i-title").hasClass("face_title")?(t(".facebook_two_mess").detach(),t(".chaty-widget-i").addClass("bofore_del")):(t(".chaty-widget-i-title").detach(),t(".chaty-widget-i").addClass("bofore_del")))),window.matchMedia("only screen and (max-width: 760px)").matches&&t(".i-trigger-open").addClass("active_clos"),jQuery(".chaty-widget-i-title").each(function(){""==jQuery(this).text()&&jQuery(this).remove()})}),t(document).ready(function(){var t=0;0==(t=jQuery("body").hasClass("chaty-in-desktop")?jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop").length:jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile").length)?jQuery(".chaty-widget").addClass("hide-widget").removeClass("desktop_active").removeClass("mobile_active"):(jQuery("body").hasClass("chaty-in-desktop")?jQuery(".chaty-widget").removeClass("hide-widget").addClass("desktop_active"):jQuery(".chaty-widget").removeClass("hide-widget").addClass("mobile_active"),1==t?(jQuery(".chaty-close-settings").hide(),jQuery("body").hasClass("chaty-in-desktop")?(htmlToAdd=jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop:first").clone(),jQuery(".i-trigger").html(htmlToAdd)):(htmlToAdd=jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile:first").clone(),jQuery(".i-trigger").html(htmlToAdd)),jQuery(".i-trigger .chaty-widget-i-title p").text(chaty_settings.object_settings.cta),jQuery(".chaty-widget").addClass("one_widget"),jQuery(".chaty-widget.one_widget, .i-trigger, .chaty-widget-i").mouseenter(function(){jQuery(".chaty-widget-i-title").remove(),jQuery(".chaty-widget").addClass("hide-tooltip-arrow"),c(),r()})):(jQuery(".chaty-widget").removeClass("one_widget"),jQuery(".i-trigger .chaty-main-widget").remove(),jQuery(".chaty-close-settings").show(),jQuery(".chaty-widget-i-title").removeClass("hide-it"),jQuery(".chaty-widget.one_widget, .i-trigger, .chaty-widget-i").mouseenter(function(){c(),jQuery(".i-trigger .chaty-widget-i-title").addClass("hide-it"),r()})));var e,a,d,h=0;if(1==parseInt(chaty_settings.object_settings.display_conditions)){var y=chaty_settings.object_settings.display_rules;if(y.length>0){var w=new Date;w.setHours(w.getHours()+chaty_settings.object_settings.gmt);for(var _=w.getUTCHours(),u=w.getUTCMinutes(),p=w.getUTCDay(),m=0;m<y.length;m++){var b=0,v=0;-1==y[m].days?v=1:y[m].days>=0&&y[m].days<=6?y[m].days==p&&(v=1):7==y[m].days?p>=0&&p<=4&&(v=1):8==y[m].days?p>=1&&p<=5&&(v=1):9==y[m].days&&(5!=p&&6!=p||(v=1)),1==v&&(_>y[m].start_hours&&_<y[m].end_hours?b=1:_==y[m].start_hours&&_<y[m].end_hours?u>=y[m].start_min&&(b=1):_>y[m].start_hours&&_==y[m].end_hours?u<=y[m].end_min&&(b=1):_==y[m].start_hours&&_==y[m].end_hours&&u>=y[m].start_min&&u<=y[m].end_min&&(b=1),1==b&&u>=y[m].start_min&&u<=y[m].end_min&&1),1==b&&1==v&&(h=1),1==h&&(m=y.length+1)}}else h=1}else h=1;if(1==t&&(""!=o("display_cta")&&(jQuery(".chaty-widget-i-title").remove(),jQuery(".chaty-widget").addClass("hide-tooltip-arrow"),setInterval(function(){c()},900)),jQuery(".chaty-main-widget").addClass("i-trigger-open").addClass("single-button"),jQuery(".chaty-widget-show .i-trigger-open svg").css("transform","rotate(0deg)")),jQuery("chaty-main-widget").mouseenter(function(){c()}),1==h)if("yes"==g("cta_widget_status"))jQuery(".chaty-widget").removeClass("hide-widget"),l();else if("no"==chaty_settings.object_settings.time_trigger&&"no"==chaty_settings.object_settings.exit_intent&&"no"==chaty_settings.object_settings.on_page_scroll)jQuery(".chaty-widget").removeClass("hide-widget"),"open"==chaty_settings.object_settings.display_state&&"no"==chaty_settings.object_settings.has_close_button?chaty_settings.object_settings.has_close_button="no":(chaty_settings.object_settings.display_state="hover",chaty_settings.object_settings.has_close_button="yes"),l();else{if(jQuery(".chaty-widget").addClass("hide-widget"),"yes"==chaty_settings.object_settings.time_trigger&&setTimeout(function(){i||(jQuery(".chaty-widget").removeClass("hide-widget"),l())},1e3*parseInt(chaty_settings.object_settings.trigger_time)),"yes"==chaty_settings.object_settings.exit_intent){e=document,a="mouseout",d=function(t){null==t.toElement&&null==t.relatedTarget&&null==g("cta_exit_intent_shown")&&(n("cta_exit_intent_shown","yes",1),i=!0,jQuery(".chaty-widget").removeClass("hide-widget"),jQuery(".chaty-widget").addClass("chaty-animation-widget"),jQuery(".chaty-animation-widget").append("<div class='chaty-nav'></div>"),"open"==chaty_settings.object_settings.display_state&&"no"==chaty_settings.object_settings.has_close_button?chaty_settings.object_settings.has_close_button="no":(chaty_settings.object_settings.display_state="open",chaty_settings.object_settings.has_close_button="yes"),l(),"left"==chaty_settings.object_settings.position?jQuery(".chaty-widget").addClass("left-position"):"right"==chaty_settings.object_settings.position?jQuery(".chaty-widget").addClass("right-position"):"custom"==chaty_settings.object_settings.position&&("left"==s.object_settings.pos_side?jQuery(".chaty-widget").addClass("left-position"):jQuery(".chaty-widget").addClass("right-position")),r(),setTimeout(function(){jQuery(".chaty-animation-widget").addClass("active")},100),setTimeout(function(){jQuery(".chaty-nav").remove()},2500))},e.addEventListener?e.addEventListener(a,d,!1):e.attachEvent&&e.attachEvent("on"+a,d)}"yes"==chaty_settings.object_settings.on_page_scroll&&parseInt(chaty_settings.object_settings.page_scroll)>0&&jQuery(window).scroll(function(){if(!i){var t=jQuery(document).height()-jQuery(window).height(),e=jQuery(window).scrollTop();0!=e&&e/t*100>=parseInt(chaty_settings.object_settings.page_scroll)&&(jQuery(".chaty-widget").removeClass("hide-widget"),l())}})}else jQuery(".chaty-widget").addClass("hide-widget")}),jQuery(".chaty-widget-i-title").each(function(){""==jQuery(this).text()&&(jQuery(this).closest(".chaty-widget-i").addClass("hide-chaty-arrow"),jQuery(this).remove())})})}(jQuery)},12:function(t,e){}});
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: galdub, tomeraharon, premio
|
3 |
Tags: whatsapp, facebook messenger, click to chat, chat, chat button, call now button, messenger, whatsapp button, chat icon, messenger chat icon, contact button, click to call
|
4 |
Requires at least: 3.1
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 2.4.
|
7 |
Plugin URI: https://premio.io/downloads/chaty/
|
8 |
|
9 |
Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, Phone call, SMS and more with customizable chat & call buttons
|
@@ -196,6 +196,9 @@ Yes! You can even decide what chat buttons will show up on each device (desktop/
|
|
196 |
|
197 |
== Changelog ==
|
198 |
|
|
|
|
|
|
|
199 |
= 2.4.8 =
|
200 |
Route fix
|
201 |
|
2 |
Contributors: galdub, tomeraharon, premio
|
3 |
Tags: whatsapp, facebook messenger, click to chat, chat, chat button, call now button, messenger, whatsapp button, chat icon, messenger chat icon, contact button, click to call
|
4 |
Requires at least: 3.1
|
5 |
+
Tested up to: 5.4
|
6 |
+
Stable tag: 2.4.9
|
7 |
Plugin URI: https://premio.io/downloads/chaty/
|
8 |
|
9 |
Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, Phone call, SMS and more with customizable chat & call buttons
|
196 |
|
197 |
== Changelog ==
|
198 |
|
199 |
+
= 2.4.9 =
|
200 |
+
Added an explanation for the phone based channels like WhatsApp, Viber, Phone, SMS text to make it clearer. When you click on enter while editing any of the chat channels, your settings will be saved.
|
201 |
+
|
202 |
= 2.4.8 =
|
203 |
Route fix
|
204 |
|
views/admin/channels-section.php
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
<div class="preview-section-chaty wrap">
|
2 |
<svg class="read-only" aria-hidden="true" width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
3 |
<defs>
|
@@ -177,6 +178,7 @@
|
|
177 |
$social_app = trim($social_app, ",");
|
178 |
$social_app = explode(",", $social_app);
|
179 |
$social_app = array_unique($social_app);
|
|
|
180 |
?>
|
181 |
<input type="hidden" id="default_image" value="<?php echo esc_url($imageUrl) ?>" />
|
182 |
<div class="channels-icons">
|
@@ -306,7 +308,7 @@
|
|
306 |
|
307 |
<!-- Social Media input -->
|
308 |
<div class="channels__input-box">
|
309 |
-
<input type="text" class="channels__input" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php esc_attr_e(wp_unslash($value['value'])); ?>" data-gramm_editor="false" id="<?php echo esc_attr($social['slug']); ?>" />
|
310 |
</div>
|
311 |
<div>
|
312 |
<?php
|
@@ -335,7 +337,11 @@
|
|
335 |
|
336 |
<!-- example for social media -->
|
337 |
<div class="input-example">
|
338 |
-
<?php esc_attr_e('For example', CHT_OPT); ?>:
|
|
|
|
|
|
|
|
|
339 |
</div>
|
340 |
|
341 |
<!-- checking for extra help message for social media -->
|
@@ -570,7 +576,7 @@
|
|
570 |
|
571 |
|
572 |
<!-- remove social media setting button: start -->
|
573 |
-
<button class="btn-cancel" data-social="<?php echo esc_attr($social['slug']); ?>">
|
574 |
<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
575 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
|
576 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
|
@@ -614,7 +620,7 @@
|
|
614 |
<?php esc_attr_e('On hover Close button text', CHT_OPT); ?>
|
615 |
</div>
|
616 |
</div>
|
617 |
-
<button class="btn-cancel close-btn-set" data-social="<?php echo esc_attr($social['slug']); ?>">
|
618 |
<svg width="14" height="13" viewBox="0 0 14 13" fill="none"
|
619 |
xmlns="http://www.w3.org/2000/svg">
|
620 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
|
1 |
+
|
2 |
<div class="preview-section-chaty wrap">
|
3 |
<svg class="read-only" aria-hidden="true" width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
4 |
<defs>
|
178 |
$social_app = trim($social_app, ",");
|
179 |
$social_app = explode(",", $social_app);
|
180 |
$social_app = array_unique($social_app);
|
181 |
+
$imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png";
|
182 |
?>
|
183 |
<input type="hidden" id="default_image" value="<?php echo esc_url($imageUrl) ?>" />
|
184 |
<div class="channels-icons">
|
308 |
|
309 |
<!-- Social Media input -->
|
310 |
<div class="channels__input-box">
|
311 |
+
<input type="text" class="channels__input" placeholder="<?php esc_attr_e($social['example']); ?>" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php esc_attr_e(wp_unslash($value['value'])); ?>" data-gramm_editor="false" id="<?php echo esc_attr($social['slug']); ?>" />
|
312 |
</div>
|
313 |
<div>
|
314 |
<?php
|
337 |
|
338 |
<!-- example for social media -->
|
339 |
<div class="input-example">
|
340 |
+
<?php esc_attr_e('For example', CHT_OPT); ?>:
|
341 |
+
<?php if($social['slug'] == "Poptin") { ?>
|
342 |
+
<br/>
|
343 |
+
<?php } ?>
|
344 |
+
<?php esc_attr_e($social['example']); ?>
|
345 |
</div>
|
346 |
|
347 |
<!-- checking for extra help message for social media -->
|
576 |
|
577 |
|
578 |
<!-- remove social media setting button: start -->
|
579 |
+
<button type="button" class="btn-cancel" data-social="<?php echo esc_attr($social['slug']); ?>">
|
580 |
<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
581 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
|
582 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
|
620 |
<?php esc_attr_e('On hover Close button text', CHT_OPT); ?>
|
621 |
</div>
|
622 |
</div>
|
623 |
+
<button type="button" class="btn-cancel close-btn-set" data-social="<?php echo esc_attr($social['slug']); ?>">
|
624 |
<svg width="14" height="13" viewBox="0 0 14 13" fill="none"
|
625 |
xmlns="http://www.w3.org/2000/svg">
|
626 |
<rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
|
views/admin/chaty-popup.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="chaty-popup" id="chaty-intro-popup">
|
2 |
+
<div class="chaty-popup-box">
|
3 |
+
<div class="chaty-popup-header">
|
4 |
+
Welcome to Chaty 🎉
|
5 |
+
<button class="close-chaty-popup"><span class="dashicons dashicons-no-alt"></span></button>
|
6 |
+
<div class="clear"></div>
|
7 |
+
</div>
|
8 |
+
<div class="chaty-popup-content">
|
9 |
+
Select chat channels that you'd like to add to your store, and fill out your info. For more info visit our <a target="_blank" href="https://premio.io/help/chaty/?utm_soruce=wordpresschaty">Help Center</a> and check the video.
|
10 |
+
<iframe width="420" height="240" src="https://www.youtube.com/embed/uaqjRp3HAqU?rel=0&start=18"></iframe>
|
11 |
+
</div>
|
12 |
+
<div class="chaty-popup-footer">
|
13 |
+
<button type="button">Go to Chaty</button>
|
14 |
+
</div>
|
15 |
+
<input type="hidden" id="chaty_update_popup_status" value="<?php echo wp_create_nonce("chaty_update_popup_status") ?>">
|
16 |
+
</div>
|
17 |
+
</div>
|
views/widget.php
CHANGED
@@ -181,8 +181,9 @@ if($len >= 1 && !empty($settings['social'])) {
|
|
181 |
if(!empty($font_family)) {
|
182 |
wp_enqueue_style( 'custom-google-fonts', 'https://fonts.googleapis.com/css?family='.urlencode($font_family), false, false );
|
183 |
}
|
184 |
-
|
185 |
-
|
|
|
186 |
wp_localize_script('chaty-front-end', 'chaty_settings', $data);
|
187 |
}
|
188 |
?>
|
181 |
if(!empty($font_family)) {
|
182 |
wp_enqueue_style( 'custom-google-fonts', 'https://fonts.googleapis.com/css?family='.urlencode($font_family), false, false );
|
183 |
}
|
184 |
+
/* WP change this */
|
185 |
+
wp_enqueue_style( 'chaty-front-css', CHT_PLUGIN_URL."css/chaty-front.min.css", array(), CHT_VERSION);
|
186 |
+
wp_enqueue_script( "chaty-front-end", CHT_PLUGIN_URL."js/cht-front-script.min.js", array( 'jquery' ), rand());
|
187 |
wp_localize_script('chaty-front-end', 'chaty_settings', $data);
|
188 |
}
|
189 |
?>
|