Imagify Image Optimizer - Version 1.6.9

Version Description

  • Improvement: the bulk optimization now stops as soon as the quota is fully consumed, instead of trying to optimize more images and getting error messages one after the other.
  • Improvement: updated (almost) all JavaScript libraries we use. SweetAlert won't conflict with new versions anymore. Few code improvements.
  • Improvement: in the medias list, improved the Imagify column behavior on small screens.
  • Improvement: when optimizing in NextGen Gallery, update some NGG data.
  • Bug Fix: revamped the whole Enable Media Replace plugin compatibility. Optimization, restoration, and backup should work properly now.
  • Bug Fix: revamped the way to restore images in NextGen Gallery to prevent deletion of alt text, description, and tags.
  • Regression fix: fixed optimization and restoration not working in NextGen Gallery.
  • Regression fix: fixed the bulk optimization not working with PHP 5.2.
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Imagify Image Optimizer
Version 1.6.9
Comparing to
See all releases

Code changes from version 1.6.8 to 1.6.9

Files changed (52) hide show
  1. assets/css/admin.css +42 -2
  2. assets/css/admin.min.css +1 -1
  3. assets/css/sweetalert2.css +324 -226
  4. assets/css/sweetalert2.min.css +1 -1
  5. assets/js/admin.js +72 -68
  6. assets/js/admin.min.js +1 -1
  7. assets/js/bulk.js +182 -169
  8. assets/js/bulk.min.js +1 -1
  9. assets/js/es6-promise.auto.js +116 -117
  10. assets/js/es6-promise.auto.min.js +1 -1
  11. assets/js/imagify-gulp.js +268 -0
  12. assets/js/imagify-gulp.min.js +5 -0
  13. assets/js/imagify.js +0 -292
  14. assets/js/imagify.min.js +0 -1
  15. assets/js/jquery.event.move.js +355 -357
  16. assets/js/jquery.event.move.min.js +1 -10
  17. assets/js/jquery.twentytwenty.js +61 -56
  18. assets/js/jquery.twentytwenty.min.js +1 -1
  19. assets/js/options.js +24 -26
  20. assets/js/sweetalert2.js +1417 -1119
  21. assets/js/sweetalert2.min.js +1 -1
  22. assets/js/upload.js +22 -23
  23. assets/js/upload.min.js +1 -1
  24. imagify.php +6 -2
  25. inc/3rd-party/3rd-party.php +1 -1
  26. inc/3rd-party/amazon-s3-and-cloudfront/inc/classes/class-imagify-as3cf-attachment.php +0 -17
  27. inc/3rd-party/enable-media-replace.php +0 -34
  28. inc/3rd-party/enable-media-replace/enable-media-replace.php +10 -0
  29. inc/3rd-party/enable-media-replace/inc/classes/class-imagify-enable-media-replace.php +212 -0
  30. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-attachment.php +262 -16
  31. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-db.php +1 -1
  32. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-storage.php +5 -1
  33. inc/3rd-party/nextgen-gallery/inc/common/attachments.php +1 -1
  34. inc/3rd-party/wp-retina-2x.php +1 -1
  35. inc/admin/ajax.php +3 -2
  36. inc/admin/enqueue.php +6 -6
  37. inc/admin/ui/bulk.php +8 -4
  38. inc/admin/ui/notices.php +9 -5
  39. inc/admin/ui/options.php +20 -10
  40. inc/admin/upgrader.php +1 -1
  41. inc/classes/abstracts/class-imagify-abstract-attachment.php +16 -4
  42. inc/classes/class-imagify-attachment.php +10 -9
  43. inc/classes/class-imagify-rocket-infos.php +433 -0
  44. inc/classes/class-imagify.php +34 -3
  45. inc/compat.php +166 -2
  46. inc/functions/admin-ui.php +9 -9
  47. inc/functions/admin.php +44 -9
  48. inc/functions/attachments.php +36 -0
  49. inc/functions/deprecated.php +36 -0
  50. inc/functions/process.php +13 -1
  51. readme.txt +12 -2
  52. uninstall.php +1 -0
assets/css/admin.css CHANGED
@@ -1476,6 +1476,46 @@ ul.imagify-datas-list.imagify-datas-list {
1476
  color: #555;
1477
  font-size: 10px;
1478
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1479
  .compat-field-imagify .label {
1480
  vertical-align: top;
1481
  }
@@ -1564,8 +1604,8 @@ ul.imagify-datas-list .imagify-data-item strong {
1564
  .imagify-datas-more-action .the-text {
1565
  display: inline-block;
1566
  vertical-align: middle;
1567
- height: 20px;
1568
- line-height: 20px;
1569
  }
1570
 
1571
  ul.imagify-datas-details.imagify-datas-details {
1476
  color: #555;
1477
  font-size: 10px;
1478
  }
1479
+ @media (min-width: 1151px) and (max-width: 1800px) {
1480
+ .column-imagify_optimized_file.column-imagify_optimized_file {
1481
+ width: 235px;
1482
+ }
1483
+ }
1484
+ @media (min-width: 783px) and (max-width: 1150px) {
1485
+ .column-imagify_optimized_file.column-imagify_optimized_file {
1486
+ width: 13em;
1487
+ }
1488
+ table.media .column-title .has-media-icon ~ .row-actions.row-actions {
1489
+ margin-left: 0;
1490
+ }
1491
+ }
1492
+ @media (max-width: 782px) {
1493
+ table.media .column-imagify_optimized_file.column-imagify_optimized_file {
1494
+ text-align: left;
1495
+ }
1496
+ table.media .imagify-datas-more-action,
1497
+ table.media .imagify-datas-actions-links {
1498
+ text-align: center;
1499
+ }
1500
+ table.media .column-imagify_optimized_file > *,
1501
+ table.media .column-imagify_optimized_file .imagify-datas-actions-links a {
1502
+ max-width: 100%;
1503
+ margin-left: 0;
1504
+ }
1505
+ }
1506
+ @media (min-width: 783px) and (max-width: 1150px), (max-width: 360px) {
1507
+ table.media .imagify-hide-if-small {
1508
+ position: absolute;
1509
+ margin: -1px;
1510
+ padding: 0;
1511
+ height: 1px;
1512
+ width: 1px;
1513
+ overflow: hidden;
1514
+ clip: rect(0 0 0 0);
1515
+ border: 0;
1516
+ word-wrap: normal !important; /* Many screen reader and browser combinations announce broken words as they would appear visually. */
1517
+ }
1518
+ }
1519
  .compat-field-imagify .label {
1520
  vertical-align: top;
1521
  }
1604
  .imagify-datas-more-action .the-text {
1605
  display: inline-block;
1606
  vertical-align: middle;
1607
+ height: auto;
1608
+ line-height: inherit;
1609
  }
1610
 
1611
  ul.imagify-datas-details.imagify-datas-details {
assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .imagify-cell,.imagify-cell.va-top,.va-top .imagify-cell{vertical-align:top}#imagify-overview-chart-legend,.imagify-oh,body.imagify-modal-is-open{overflow:hidden}.imagify-start{float:left}.imagify-end{float:right}.imagify-txt-start.imagify-txt-start.imagify-txt-start{text-align:left}.imagify-txt-center.imagify-txt-center.imagify-txt-center{text-align:center}.imagify-txt-end.imagify-txt-end.imagify-txt-end{text-align:right}.imagify-mt1.imagify-mt1{margin-top:1em}.imagify-mb1.imagify-mb1{margin-bottom:1em}.imagify-mr1.imagify-mr1{margin-right:1em}.imagify-ml2.imagify-ml2{margin-left:2em}.imagify-mr2.imagify-mr2{margin-right:2em}.imagify-pl0.imagify-pl0.imagify-pl0{padding-left:0}.imagify-pr1.imagify-pr1{padding-right:1em}.imagify-clear{clear:both}.imagify-clearfix:after,.imagify-inline-options:after{content:"";display:table;clear:both}.imagify-count.imagify-count{counter-reset:num}.imagify-count .imagify-count-title{font-weight:700}.imagify-default-settings{color:#73818c;font-weight:400}.imagify-count .imagify-count-title:before{counter-increment:num 1;content:counter(num) ". "}.imagify-table{display:table;width:100%}.imagify-cell{display:table-cell;padding:10px}.imagify-bulk-submit .imagify-cell{padding-top:0}.imagify-plugins-error{overflow:hidden;padding-left:20px;list-style-type:disc}.imagify-plugins-error li{width:300px;line-height:30px}@media (max-width:570px){.imagify-plugins-error li{width:auto}}.imagify-notice-dismiss.notice-dismiss{text-decoration:none}.imagify-spinner{display:inline-block;width:20px;height:20px;margin-right:5px;vertical-align:middle;background:url(../images/spinner.gif) 0 0/20px 20px no-repeat rgba(0,0,0,0);opacity:.7}.spinner.imagify-hidden{width:0;margin:4px 0 0}.misc-pub-section.misc-pub-imagify h4{font-size:14px;margin-top:5px;margin-bottom:0}.imagify-sweet-alert button{margin-top:17px!important;height:45px!important;letter-spacing:3px;text-transform:uppercase!important;border-radius:3px!important;background-color:#40b1d0!important;-webkit-box-shadow:0 3px 0 #338ea6!important;box-shadow:0 3px 0 #338ea6!important}.imagify-sweet-alert button.loading{border-radius:100%!important;height:40px!important;padding:0!important;-webkit-box-shadow:none!important;box-shadow:none!important}.imagify-sweet-alert button.swal2-cancel{background:#777!important;-webkit-box-shadow:0 3px 0 #444!important;box-shadow:0 3px 0 #444!important}.imagify-sweet-alert-signup .sa-confirm-button-container{width:40%}.imagify-sweet-alert-signup button{width:100%;padding:0!important}.imagify-sweet-alert .la-ball-fall,.imagify-sweet-alert .sa-input-error:after,.imagify-sweet-alert .sa-input-error:before{top:25%!important}#wpwrap{-webkit-transition:all .4s;-o-transition:all .4s;transition:all .4s}.stop-scrolling #wpwrap{-webkit-filter:blur(2px);filter:blur(2px)}.stop-scrolling #wpwrap #wpadminbar{top:-32px}.imagify-primary.imagify-primary.imagify-primary{color:#40b1d0}.imagify-secondary.imagify-secondary.imagify-secondary{color:#8cc152}#imagify-check-api-container{font-weight:700}#imagify-check-api-container .dashicons{font-size:25px}#imagify-check-api-container .dashicons-no:before{color:#f06e57;vertical-align:-1px}#imagify-check-api-container .dashicons-yes:before{color:#8BC34A;vertical-align:-1px}.imagify-valid{color:#8BC34A}.imagify-chart{width:33.33%;position:relative}.imagify-doughnut-legend{margin-top:38px;list-style:none}.imagify-doughnut-legend li{display:block;padding-left:30px;position:relative;margin-bottom:15px;border-radius:5px;padding:3px 8px 2px 31px;font-size:14px;font-weight:600;cursor:default;-webkit-transition:background-color .2s ease-in-out;-o-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}.imagify-doughnut-legend li span{display:block;position:absolute;left:0;top:0;width:25px;height:25px;border-radius:50%}.button-text,.imagify-bulk-info p{display:inline-block}.imagify-chart{float:left;margin-bottom:20px}td .imagify-chart{float:none;margin-bottom:0;top:4px}.imagify-chart-container{position:relative;width:180px;float:left;margin-right:20px}.imagify-global-optim-phrase{width:180px;padding-top:20px;font-size:14px;font-weight:700;text-align:center}.imagify-total-percent{color:#46b1ce}td .imagify-chart-container{width:18px;height:18px;float:none;margin-right:10px}.imagify-chart-percent{position:absolute;left:0;right:0;top:50%;margin-top:-14px;text-align:center;font-size:55px;font-weight:700;color:#46B1CE}.imagify-chart-percent span{font-size:20px;vertical-align:super}.media_page_imagify-bulk-optimization .notice,.settings_page_imagify .notice,body[class*="_imagify-ngg-bulk-optimization"] .notice{margin-right:20px;margin-left:2px}.media_page_imagify-bulk-optimization .media-item,body[class*="_imagify-ngg-bulk-optimization"] .media-item{margin:0}.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress{float:none;width:100%;margin:0;background:#1F2331;-webkit-box-shadow:0;box-shadow:0;border-radius:0}.media_page_imagify-bulk-optimization .media-item .percent,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent{width:auto;padding:0 5px;line-height:1.85;font-size:12px}.media_page_imagify-bulk-optimization .media-item .percent,.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress{text-align:right}.media_page_imagify-bulk-optimization .media-item .progress .bar,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress .bar{width:1px;height:22px;margin-top:0;background:#46B1CE;border-radius:0;overflow:visible;-webkit-transition:width .5s;-o-transition:width .5s;transition:width .5s}.imagify-settings .button,.imagify-settings a,.imagify-settings input,.imagify-welcome .button,.imagify-welcome a,.imagify-weolcome input{-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-settings a{color:#40b1d0}.imagify-options-title{padding-bottom:.5em;border-bottom:3px solid #F2F2F2;font-size:13px;font-weight:500;text-transform:uppercase;letter-spacing:.025em;color:#40b1d0}.imagify-settings,.imagify-settings p,.imagify-settings th{color:#5F758E}@media (max-width:782px){.imagify-settings .form-table th{padding-top:2em;padding-bottom:.5em}}.imagify-settings .form-table td{vertical-align:top}.button .dashicons,.button-text,.imagify-button-primary.imagify-button-primary .dashicons,.imagify-button-secondary.imagify-button-secondary .dashicons,.imagify-button.imagify-button .dashicons,.imagify-notice .button .dashicons,.imagify-settings .button .dashicons,.imagify-welcome .button .dashicons{vertical-align:middle}.imagify-settings .form-table th span{cursor:pointer}.imagify-middle th{padding-top:35px}.imagify-button-primary.imagify-button-primary,.imagify-button-secondary.imagify-button-secondary,.imagify-button.imagify-button,.imagify-notice .button,.imagify-settings .button,.imagify-welcome .button{height:auto;padding:8px 20px;border:0;font-size:14px;font-weight:600;-webkit-box-shadow:0 3px 0 rgba(0,0,0,.15);box-shadow:0 3px 0 rgba(0,0,0,.15);border-radius:3px;cursor:pointer;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-notice .button-mini{padding:2px 10px;font-size:13px}.button-primary.button-mini{padding:2px 10px}.imagify-settings .button.button-mini-flat{padding:3px 6px 5px;font-size:12px;-webkit-box-shadow:none!important;box-shadow:none!important;line-height:1.2}.imagify-settings .button.button-mini-flat:focus,.imagify-settings .button.button-mini-flat:hover{-webkit-box-shadow:none!important;box-shadow:none!important}.imagify-button-ghost.imagify-button-ghost,.imagify-title .button-ghost.button-ghost{padding:2px 9px;border:1px solid #40B1D0;font-size:12px;font-weight:400;color:#40B1D0;background:0 0;-webkit-box-shadow:none;box-shadow:none}.imagify-button-ghost.imagify-button-ghost:focus,.imagify-button-ghost.imagify-button-ghost:hover,.imagify-title .button-ghost.button-ghost:focus,.imagify-title .button-ghost.button-ghost:hover{border-color:transparent;color:#000;background:#40B1D0}.imagify-button-ghost.imagify-button-ghost:focus,.imagify-button-ghost.imagify-button-ghost:hover{color:#FFF}.imagify-button-medium.imagify-button-medium{text-transform:uppercase;letter-spacing:.1em;padding:3px 10px;font-weight:700}.imagify-button-medium.imagify-button-ghost{border-width:2px}.button .dashicons{margin-right:5px}.imagify-button-primary.imagify-button-primary,.imagify-settings .button-primary.button-primary,.imagify-welcome .button-primary.button-primary{background:#40B1D0;color:#FFF;-webkit-box-shadow:0 3px 0 rgba(51,142,166,1);box-shadow:0 3px 0 rgba(51,142,166,1);text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799!important}.imagify-button-secondary.imagify-button-secondary{background:#8BC34A;color:#FFF;-webkit-box-shadow:0 3px 0 #6F9C3B;box-shadow:0 3px 0 #6F9C3B;text-shadow:0 -1px 1px #6F9C3B,1px 0 1px #6F9C3B,0 1px 1px #6F9C3B!important}.imagify-button-primary.imagify-button-primary:focus,.imagify-button-primary.imagify-button-primary:hover,.imagify-settings .button-primary:focus,.imagify-settings .button-primary:hover,.imagify-welcome .button-primary:focus,.imagify-welcome .button-primary:hover{background:#338ea6;-webkit-box-shadow:0 3px 0 #1f7a92;box-shadow:0 3px 0 #1f7a92}.imagify-button-secondary.imagify-button-secondary:focus,.imagify-button-secondary.imagify-button-secondary:hover{background:#6F9C3B;color:#FFF}.imagify-button-light.imagify-button-light{background:#FFF;color:#4a4a4a;-webkit-box-shadow:0 2px 0 rgba(0,0,0,.2);box-shadow:0 2px 0 rgba(0,0,0,.2)}.imagify-button-light.imagify-button-light:focus,.imagify-button-light.imagify-button-light:hover{color:#FFF;background:rgba(0,0,0,.2)}.imagify-section-positive .imagify-button-light{color:#709A41}.imagify-button.imagify-button-big{font-size:15px;padding:11px 30px}.imagify-button-big .dashicons{font-size:1.45em;margin-right:6px;margin-left:-4px}.imagify-info,.imagify-logo{vertical-align:top}#imagify-bulk-action{padding:11px 20px}.media-frame-content .imagify-button-primary,.wp_attachment_image .imagify-button-primary{float:left;padding:0 10px 1px;margin:0 5px 2px 0;font-size:13px;line-height:26px;-webkit-box-shadow:0 3px 0 rgba(51,142,166,1);box-shadow:0 3px 0 rgba(51,142,166,1)}.imagify-settings input[type=text]{color:#4A4A4A;font-weight:600;-webkit-box-shadow:none;box-shadow:none}.imagify-settings div.submit.submit{padding-left:235px;padding-top:40px}.imagify-settings p.submit{float:left;margin-top:0}.imagify-settings p.submit .button{margin:0 5px}@media (max-width:850px){.imagify-settings div.submit{padding-left:0}.imagify-settings p.submit{text-align:center}}.imagify-title.imagify-title{position:relative;padding:30px 50px;font-size:23px;background:#2E3243;color:#FFF}.imagify-settings .imagify-title+.imagify-notice{margin:0;border-right:1px solid #D9D9D9;padding-top:15px;padding-bottom:15px}.imagify-section,.imagify-settings div.submit,.imagify-sub-header,.imagify-sub-title.imagify-sub-title{margin:0;padding:20px;background:#F2F5F7}.imagify-section-positive,.imagify-sub-title.imagify-sub-title{padding-left:40px}.imagify-section-positive{background:#8cc152;color:#FFF}.imagify-section-positive p{color:#FFF}.imagify-section-gray{background:#D9E4EB}.imagify-section-gray .imagify-count-title{color:#4a4a4a}.imagify-section p:first-child{margin-top:0}.imagify-section p:last-child{margin-bottom:0}p.imagify-section-title.imagify-section-title{font-size:20px;margin-top:-.3em;margin-bottom:-.6em}.imagify-bulk-info{margin:1em 1em 1em 5px;-webkit-transition:margin .3s;-o-transition:margin .3s;transition:margin .3s}@media (max-width:850px){.imagify-bulk-info{margin:1em}}.imagify-bulk-info p{text-align:left;width:400px;max-width:100%;font-weight:700}@media (min-width:1500px){.imagify-settings div.submit{display:table;width:100%}.imagify-settings div.submit>*{display:table-cell;vertical-align:middle}.imagify-bulk-info{padding:0 25px;text-align:right}}.imagify-settings div.submit{margin-top:2em;padding:20px 0}.imagify-notice .imagify-rate-us .stars,.imagify-sub-header .form-table{margin:0}.imagify-sub-header th{text-align:right}.imagify-sub-header td,.imagify-sub-header th{padding-top:0;padding-bottom:0}[for=api_key]{padding-top:5px}.imagify-notice .imagify-rate-us.imagify-rate-us{position:relative;bottom:0;right:0;text-align:left}.imagify-rate-us.imagify-rate-us{position:absolute;bottom:50%;right:20px;text-align:right;margin-bottom:-2.4em;color:#FFF}.imagify-rate-us a{color:#40B1D0}.imagify-rate-us .stars{display:inline-block;margin:2px 0 0 10px;text-decoration:none;letter-spacing:.2em;vertical-align:-1px}.imagify-rate-us .stars .dashicons:before{font-size:18px}.imagify-rate-us a:focus,.imagify-rate-us a:hover{color:#FEE102}@media (max-width:1220px){.imagify-rate-us.imagify-rate-us{position:static;margin-bottom:0;text-align:left}.imagify-rate-us.imagify-rate-us br{display:none}.imagify-rate-us .stars{display:block;margin-left:0}}.imagify-rkt-notice.imagify-rkt-notice{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;-ms-grid-row-align:center;align-items:center;padding:10px 45px 10px 0;border:0;-webkit-box-shadow:none;box-shadow:none;color:#FFF;background:#412355}.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:2px;margin-right:20px}@media (max-width:782px){.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:0;margin-right:12px}}.imagify-rkt-notice .imagify-cross{position:absolute;right:8px;top:50%;width:22px;height:22px;padding:0;margin-top:-11px;background:0 0;color:#FD7300;border-radius:50%;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-rkt-notice .imagify-cross .dashicons{position:relative;top:2px;left:1px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-rkt-notice .imagify-cross:hover{background:#FFF}.imagify-rkt-notice .imagify-cross:hover .dashicons{color:#412355}.imagify-rkt-notice .imagify-rkt-coupon,.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo{-ms-flex-negative:0;flex-shrink:0}.imagify-rkt-notice .imagify-rkt-logo{width:150px!important;text-align:center;padding:0 25px 0 30px;line-height:.8}.imagify-rkt-notice .imagify-rkt-msg{width:100%!important;padding:0 15px;font-size:14px;line-height:1.6}.imagify-rkt-notice .imagify-rkt-coupon{width:150px!important;padding:0 15px}.imagify-rkt-notice .imagify-rkt-coupon-code{padding:5px 10px;font-size:23px;font-weight:700;border:1px dashed #F7A933;color:#F7A933}.imagify-rkt-notice .imagify-rkt-cta{width:250px!important;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:200px;flex-basis:200px}.imagify-rkt-notice .button.button{position:relative;top:-1px;height:auto;font-weight:600;font-size:14px;-webkit-box-shadow:0 4px 0 #B27A27;box-shadow:0 4px 0 #B27A27;border:0;padding:9px 18px;background:#F7A933;text-shadow:1px 1px 1px rgba(0,0,0,.2)}@media (max-width:880px){.imagify-rkt-notice{-ms-flex-wrap:wrap;flex-wrap:wrap}.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo,.imagify-rkt-notice .imagify-rkt-msg{text-align:left;padding:5px 15px}.imagify-cross.imagify-cross{top:8px;margin-top:0}.imagify-rkt-notice .imagify-cross .dashicons{top:1px}}.imagify-settings-section{padding:10px 20px}.imagify-welcome .imagify-settings-section,[id=imagify-settings]{border:1px solid #D9D9D9;border-top:0 none;background:#FFF}.imagify-br{line-height:2}.imagify-important{color:#F5A623}.imagify-info,.imagify-info a{color:#40B1D0;font-size:12px}.imagify-info{position:relative;display:inline-block;padding-left:25px}.imagify-info .dashicons{position:absolute;left:0;top:-1px}.imagify-visual-label,label+.imagify-info,label+.imagify-options-line{display:inline-block;max-width:70%;margin-left:15px;margin-top:2px!important;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}.imagify-visual-label{vertical-align:-5px}label[for=imagify_sizes_full]+.imagify-info{vertical-align:middle}.imagify-settings.imagify-settings [type=checkbox]:not(:checked)+label .imagify-visual-label,.imagify-settings.imagify-settings [type=checkbox]:not(:checked)+label+.imagify-options-line{opacity:.5}.imagify-settings.imagify-settings [type=checkbox]:checked+label .imagify-visual-label,.imagify-settings.imagify-settings [type=checkbox]:checked+label+.imagify-options-line{opacity:1}.imagify-checkbox-marged{max-width:500px;margin-left:45px}.imagify-checkbox.imagify-checkbox:checked,.imagify-checkbox.imagify-checkbox:not(:checked),.imagify-settings.imagify-settings [type=checkbox]:checked,.imagify-settings.imagify-settings [type=checkbox]:not(:checked){opacity:.01}.imagify-checkbox.imagify-checkbox:checked:focus,.imagify-checkbox.imagify-checkbox:not(:checked):focus,.imagify-settings.imagify-settings [type=checkbox]:checked:focus,.imagify-settings.imagify-settings [type=checkbox]:not(:checked):focus{-webkit-box-shadow:none!important;box-shadow:none!important;outline:0!important;border:0!important}.imagify-checkbox.imagify-checkbox:checked+label,.imagify-checkbox.imagify-checkbox:not(:checked)+label,.imagify-settings [type=checkbox]:checked+label,.imagify-settings [type=checkbox]:not(:checked)+label{position:relative;padding-left:6px;cursor:pointer;vertical-align:top}.imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-checkbox.imagify-checkbox:not(:checked)+label:before,.imagify-settings [type=checkbox]:checked+label:before,.imagify-settings [type=checkbox]:not(:checked)+label:before{content:'';position:absolute;left:0;top:0;width:28px;height:28px;margin:0 0 0 -24px;border:2px solid #8BA6B4;background:#FFF;border-radius:4px}.imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-settings [type=checkbox]:checked+label:after,.imagify-settings [type=checkbox]:not(:checked)+label:after{content:"✓";position:absolute;font-size:1.4em;top:3px;left:-16px;-webkit-transition:all .2s;-o-transition:all .2s;transition:all .2s}.imagify-checkbox.imagify-checkbox[disabled]:checked+label:before,.imagify-checkbox.imagify-checkbox[disabled]:not(:checked)+label:before,.imagify-settings [type=checkbox][disabled]:checked+label:before,.imagify-settings [type=checkbox][disabled]:not(:checked)+label:before{border-color:#ccc;background:#ddd}.imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-settings [type=checkbox]:not(:checked)+label:after{opacity:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-settings [type=checkbox]:checked+label:after{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}input[id^=imagify_sizes_]:checked+label{font-weight:700}.medium.imagify-checkbox:checked+label:before,.medium.imagify-checkbox:not(:checked)+label:before{width:22px;height:22px;border-width:1.5px;border-radius:2px;margin-top:0}.medium.imagify-checkbox:checked+label:after,.medium.imagify-checkbox:not(:checked)+label:after{font-size:1.1em;left:-17px;top:3px}.imagify-settings .mini[type=checkbox]:checked+label:before,.imagify-settings .mini[type=checkbox]:not(:checked)+label:before,.mini.imagify-checkbox:checked+label:before,.mini.imagify-checkbox:not(:checked)+label:before{width:15px;height:15px;border-width:1px;border-radius:2px;margin-top:0}.imagify-settings .mini[type=checkbox]:checked+label:after,.imagify-settings .mini[type=checkbox]:not(:checked)+label:after,.mini.imagify-checkbox:checked+label:after,.mini.imagify-checkbox:not(:checked)+label:after{font-size:.9em;left:-21px;top:1px}.imagify-checkbox.imagify-checkbox:checked:focus+label:before,.imagify-checkbox.imagify-checkbox:not(:checked):focus+label:before,.imagify-settings [type=checkbox]:checked:focus+label:before,.imagify-settings [type=checkbox]:not(:checked):focus+label:before{border-style:dotted;border-color:#40b1d0}.imagify-inline-options{position:relative;display:table;width:100%;max-width:600px;border-collapse:collapse}.imagify-small-options{width:300px;margin:1em auto .5em;background:#338EA6;border-radius:4px}.imagify-inline-options input[type=radio]:checked,.imagify-inline-options input[type=radio]:not(:checked){position:absolute;left:5px;top:5px;display:none}.imagify-inline-options input[type=radio]:checked+label,.imagify-inline-options input[type=radio]:not(:checked)+label{position:relative;display:table-cell;padding:13px 10px;text-align:center;font-weight:600;font-size:16px;text-transform:uppercase;letter-spacing:.1em;color:#FFF;background:#2E3243;border-left:1px solid rgba(255,255,255,.2);-webkit-box-shadow:0 -3px 0 rgba(0,0,0,.1) inset,inset -1px 0 0 rgba(255,255,255,.2);box-shadow:0 -3px 0 rgba(0,0,0,.1) inset,inset -1px 0 0 rgba(255,255,255,.2);z-index:2;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-small-options input[type=radio]:checked+label,.imagify-small-options input[type=radio]:not(:checked)+label{padding:8px 10px;font-size:13px;color:#FFF;-webkit-box-shadow:none;box-shadow:none;border-left:0}.imagify-bulk-submit .imagify-inline-options input[type=radio]:checked+label,.imagify-bulk-submit .imagify-inline-options input[type=radio]:not(:checked)+label{margin-bottom:1.75em}.imagify-inline-options input[type=radio]:checked+label:first-of-type,.imagify-inline-options input[type=radio]:not(:checked)+label:first-of-type{border-radius:3px 0 0 3px}.imagify-inline-options input[type=radio]:checked+label:last-of-type,.imagify-inline-options input[type=radio]:not(:checked)+label:last-of-type{border-radius:0 3px 3px 0}.imagify-inline-options input[type=radio]:checked+label{background:#8BC34A}.imagify-small-options input[type=radio]:not(:checked)+label{background:#338EA6;color:rgba(255,255,255,.4)}.imagify-small-options input[type=radio]:checked+label{background:#40B1D0}.imagify-inline-options .imagify-info{margin-top:15px}.imagify-btn-info{display:block;font-size:.7em;letter-spacing:0;line-height:1;text-transform:none}.imagify-datas-more-action a,a.btn-rocket{text-transform:uppercase;text-decoration:none}#describe-resize-larger input{width:5em}.imagify-cols:after{content:"";display:table;clear:both}.imagify-col{float:left;width:50%}.imagify-main{float:left;width:70%}.imagify-sidebar{float:right;width:28%;max-width:300px}.imagify-sidebar-section{border:1px solid #BBB;background:#FFF}.imagify-sidebar-section+.imagify-sidebar-section{margin-top:2em}@media (max-width:820px){.imagify-main,.imagify-sidebar{float:none;width:auto}.imagify-settings{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-sidebar{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;max-width:none;margin-left:0;margin-top:25px}.wp-media-products{text-align:center}.wp-media-products li{display:inline-block;width:100%;max-width:276px}}@media (min-width:1400px){.imagify-main{width:74%}}.imagify-sidebar-title{display:block;padding:20px 15px;border-bottom:1px solid #BBB;font-size:14px;font-weight:700;color:#23282d;background:#F2F5F7}.imagify-sidebar-title img{vertical-align:top;margin-right:5px}.imagify-sidebar .wp-media-products{margin-top:0;margin-bottom:-.5em}.imagify-sidebar .wp-media-products .links{display:block;padding:85px 25px 24px;text-align:center;background-color:#2E3243;background-size:contain;background-repeat:no-repeat;background-position:50% 0;text-decoration:none}.imagify-sidebar .wp-media-products .links p{margin:1.5em auto;color:#FFF}.imagify-sidebar .wp-media-products .wprocket-link{background-image:-o-linear-gradient(top,rgba(59,30,78 ,0),rgba(59,30,78 ,0) 130px,rgba(59 ,30 ,78 ,1) 210px),url(../images/sidebar-wp-rocket.jpg);background-image:linear-gradient(to bottom,rgba(59,30,78 ,0),rgba(59,30,78 ,0) 130px,rgba(59 ,30 ,78 ,1) 210px),url(../images/sidebar-wp-rocket.jpg);background-color:#3B1E4E;background-repeat:repeat-x,no-repeat}.imagify-sidebar-content{padding:10px 20px}.imagify-mark-styled{display:inline-block;padding:1px 2px 1px 4px;line-height:1.3;font-weight:700;background:#F7A933;-webkit-transform-origin:50% 50%;-ms-transform-origin:50% 50%;transform-origin:50% 50%;-webkit-transform:rotateZ(-2deg) rotateX(-10deg) skewX(-2deg) skewY(-3deg);transform:rotateZ(-2deg) rotateX(-10deg) skewX(-2deg) skewY(-3deg);text-shadow:1px 1px 0 rgba(0,0,0,.2)}.imagify-mark-styled span{display:inline-block;-webkit-transform:rotateZ(2deg) rotateX(10deg) skewX(2deg) skewY(3deg);transform:rotateZ(2deg) rotateX(10deg) skewX(2deg) skewY(3deg)}.imagify-discount-code,a.btn-rocket{display:block;text-shadow:1px 1px 0 rgba(0,0,0,.2);font-weight:700}.imagify-discount-code{margin:.35em 0 .5em;font-size:2em;letter-spacing:.05em;text-align:center}.imagify-big-text{font-size:15px;font-weight:700}.imagify-big-text strong{font-size:20px}a.btn-rocket{font-size:1.15em;padding:12px;background:#F7A933;-webkit-box-shadow:0 3px 0 #D69626;box-shadow:0 3px 0 #D69626;border-radius:3px;color:#FFF}a.btn-rocket:focus,a.btn-rocket:hover{background:#ff8c00;-webkit-box-shadow:0 3px 0 #ff8c00;box-shadow:0 3px 0 #ff8c00}.imagify-welcome{margin:30px 20px 0 0}.imagify-welcome .baseline{display:inline-block;margin:.2em 0 0 2em;font-size:17px}.imagify-welcome .imagify-logo{vertical-align:middle}.imagify-welcome-remove{position:absolute;top:50%;right:15px;margin-top:-8px;color:#FFF;text-decoration:none}.imagify-columns{overflow:hidden;padding:15px 0;counter-reset:cols}.imagify-columns [class^=col-]{float:left;-webkit-box-sizing:border-box;box-sizing:border-box}.imagify-columns .col-1-3{width:33.333%;padding-left:28px}.imagify-columns .col-2-3{width:66.666%;padding-left:28px}.imagify-columns .col-1-2{width:50%;padding:0 20px}.imagify-columns .col-overview{padding-left:20px}.imagify-columns .col-informations{width:36.6%;padding-right:30px}.imagify-columns .col-statistics{width:30%}@media (max-width:830px){.imagify-columns [class^=col-]{float:none;margin-bottom:1.5em}.imagify-columns .col-1-2,.imagify-columns .col-1-3{width:auto;padding:0 28px;clear:both;padding-top:1em}}.imagify-columns [class^=col-] img{float:left;margin-right:18px}.imagify-col-content{overflow:hidden}.imagify-col-title{margin:0 0 15px;font-size:23px}.counter .imagify-col-title:before{counter-increment:cols;content:counter(cols) ". ";color:#40B1D0}.imagify-col-desc{color:#5F758E;margin-bottom:2em}.imagify-notice.imagify-notice{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;padding:0;margin:10px 20px 10px 2px;border:0;background:#2E3243;-webkit-box-shadow:none;box-shadow:none;color:#FFF}@media (max-width:782px){.imagify-notice.imagify-notice,.imagify-welcome{margin-right:12px}}@media (max-width:450px){.imagify-notice.imagify-notice{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}}.wrap .imagify-notice{margin:5px 15px 2px;position:relative}.imagify-notice-logo{padding:18px 23px;background:#40B1D0}.updated .imagify-notice-logo{background:#8BC34A}.error .imagify-notice-logo{background:#D0021B}.imagify-popin-message{padding:5px 15px;text-align:left}.imagify-popin-message.imagify-error p{color:#FFF}.imagify-notice-title{font-size:15px}.imagify-notice-content{padding:5px 23px}.imagify-notice-content.imagify-notice-content p{margin:.65em 0}.imagify-notice a{color:#40B1D0}.imagify-notice a:focus,.imagify-notice a:hover{color:#FEE102}.imagify-notice code{background:rgba(0,0,0,.4)}.column-imagify_optimized_file.column-imagify_optimized_file{width:300px;text-align:center;vertical-align:middle}.column-imagify_optimized_file>*{max-width:235px;margin:0 auto}ul.imagify-datas-list.imagify-datas-list{margin:0 auto;color:#555;font-size:10px}.compat-field-imagify .label{vertical-align:top}.compat-field-imagify ul.imagify-datas-list{margin-top:7px;font-size:11px}ul.imagify-datas-list .big{font-size:12px;color:#40B1D0}.imagify-data-item{overflow:hidden}.imagify-data-item .imagify-chart{display:inline-block;top:1px;width:20px;vertical-align:middle;margin-bottom:0}li.imagify-data-item{clear:both;margin-bottom:2px}ul.imagify-datas-list .imagify-data-item span.data,ul.imagify-datas-list .imagify-data-item strong{float:left;width:50%;-webkit-box-sizing:border-box;box-sizing:border-box}ul.imagify-datas-list .imagify-data-item span.data{text-align:left;padding-right:5px}.compat-field-imagify .imagify-datas-list .imagify-data-item .data{width:130px;text-align:left;font-weight:700}.media-sidebar .imagify-datas-list .imagify-data-item .data,.media-sidebar .imagify-datas-list .imagify-data-item strong{width:auto;float:none}ul.imagify-datas-list .imagify-data-item strong{text-align:left;padding-left:5px}.imagify-datas-more-action.imagify-datas-more-action{margin:.4em auto;background:-webkit-gradient(linear,left top,left bottom,from(transparent),color-stop(49%,transparent),color-stop(50%,rgba(0,0,0,.075)),color-stop(58%,rgba(0,0,0,.075)),color-stop(58%,transparent),to(transparent));background:-o-linear-gradient(top,transparent,transparent 49%,rgba(0,0,0,.075) 50%,rgba(0,0,0,.075) 58%,transparent 58%,transparent);background:linear-gradient(to bottom,transparent,transparent 49%,rgba(0,0,0,.075) 50%,rgba(0,0,0,.075) 58%,transparent 58%,transparent)}.imagify-datas-more-action a{display:inline-block;padding:0 5px;background:#40B1D0;color:#FFF;font-size:9px;font-weight:700;line-height:1.9}.imagify-datas-more-action a.is-open{background:#555}.imagify-datas-more-action a.is-open .dashicons{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.imagify-datas-more-action a .dashicons{font-size:14px;vertical-align:middle;line-height:.8}.imagify-datas-more-action .the-text,.imagify-datas-more-action a .dashicons:before{line-height:20px;vertical-align:middle}.imagify-datas-more-action .the-text{display:inline-block;height:20px}ul.imagify-datas-details.imagify-datas-details{margin:.7em auto}.imagify-datas-details strong{color:#40B1D0}.imagify-datas-details .original{color:#555}.imagify-datas-actions-links{overflow:hidden;border-top:2px solid transparent;padding-top:5px;font-size:8px}.imagify-datas-actions-links a{position:relative;display:inline-block;padding-left:17px;text-decoration:none;font-weight:600}.compat-field-imagify .imagify-datas-actions-links{max-width:300px}.misc-pub-imagify .imagify-datas-actions-links{border-top:2px solid #f2f2f2;padding-bottom:5px}.compat-field-imagify .imagify-datas-actions-links a,.misc-pub-imagify .imagify-datas-actions-links a{font-size:10px;float:left;width:50%}.media-sidebar .compat-field-imagify .imagify-datas-actions-links a,.submitbox .misc-pub-imagify .imagify-datas-actions-links a{display:block;width:auto;float:none}.column-imagify_optimized_file .imagify-datas-actions-links a{margin:0 .7em;padding-left:15px}.imagify-datas-actions-links a:only-child{float:none;width:auto}.imagify-datas-details.is-open+.imagify-datas-actions-links{border-top-color:rgba(0,0,0,.075)}.imagify-datas-actions-links .dashicons{position:absolute;left:0;top:4px;width:12px;margin-right:2px;font-size:11px}.imagify-title>h1{padding:0}.imagify-title-right{display:table;float:right;margin-top:-10px}.imagify-title-right p{margin:0}.imagify-title-right a{font-weight:700;text-decoration:none}.imagify-title-right>div{display:table-cell;vertical-align:middle}.imagify-title-right .dashicons-arrow-down-alt2{vertical-align:-4px;margin-left:2px}@media (max-width:1200px){.imagify-bulk .imagify-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-title-right{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;margin-top:20px}}.imagify-account,.imagify-account-link{padding-right:15px}.imagify-sep-v{width:1px;background:rgba(255,255,255,.2)}.imagify-credit-left{position:relative;min-width:280px;padding-left:15px}.imagify-meteo-icon{display:inline-block;height:38px;vertical-align:middle;margin-right:10px}.imagify-user-plan{color:#40b1d0}@media (max-width:630px){.imagify-title-right,.imagify-title-right>div{display:block;width:auto}.imagify-title-right>div{margin-top:10px;max-width:100%}.imagify-credit-left{padding-left:0}}.imagify-meteo-title.imagify-meteo-title{color:#FFF;font-size:17px}.imagify-space-left{display:inline-block;min-height:38px;min-width:245px;vertical-align:middle}.imagify-space-left>p{color:#FFF}#wp-admin-bar-imagify-profile [class^=imagify-bar-],[class^=imagify-bar-]{position:relative;height:1.5em;width:100%;background:#60758D;color:#FFF;font-size:10px}.base-transparent{background:0 0}[class^=imagify-bar-].right-outside-number{-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:4.5em}.right-outside-number .imagify-barnb{display:block;margin-right:-4.5em;text-align:right;font-weight:700;line-height:1.5}#wp-admin-bar-imagify-profile .imagify-progress-value,.imagify-progress-value{position:absolute;top:0;right:0;left:0;bottom:0;text-align:center;line-height:13px;font-weight:700}#wp-admin-bar-imagify-profile .imagify-progress,.imagify-progress{height:1.5em}.imagify-progress{-webkit-transition:width .3s;-o-transition:width .3s;transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8CC152}.imagify-bar-positive .imagify-barnb{color:#8CC152}.imagify-bar-negative .imagify-progress{background:#73818C}.imagify-bar-negative .imagify-barnb{color:#73818C}.imagify-bar-neutral .imagify-progress{background:#F5A623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#D0021B}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p,.imagify-list-infos li+li{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost,.btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:0 0;color:#FFF;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:hover,.btn-ghost:focus,.btn-ghost:hover{background:#FFF;color:#888}.imagify-list-infos{max-width:100%;width:415px}.imagify-info-block,.imagify-list-infos li{position:relative;padding:10px;padding-left:42px;background:#D9E4EB;border-radius:4px;line-height:1.6}.imagify-list-infos .imagify-alt.imagify-alt{background:#8BA7B5;color:#FFF;font-weight:700}.imagify-info-block:before,.imagify-list-infos li:before{content:"";position:absolute;left:13px;top:14px;height:16px;width:16px;border:1px solid #46b1ce;border-radius:10px}.imagify-info-block:after,.imagify-list-infos li:after{content:"i";position:absolute;left:20px;top:13px;font-style:italic;color:#46b1ce}.imagify-cell .imagify-info-block{padding-top:0}.imagify-cell .imagify-info-block:after{top:6px}.imagify-cell .imagify-info-block:before{top:7px}.imagify-list-infos .imagify-alt:after,.imagify-list-infos .imagify-alt:before{color:#fff;border-color:#fff}.imagify-sub-title.imagify-sub-title{font-size:23px;background:#FFF;color:#2E3243;border-left:1px solid #D9D9D9;border-right:1px solid #D9D9D9;font-weight:lighter}.imagify-sub-title .icon-bulk{margin-right:10px;vertical-align:middle}.imagify-sub-title .title-text{display:inline-block;line-height:1;vertical-align:middle}.imagify-bulk .imagify-settings-section{border:1px solid #D9D9D9;border-top:0;background:#F2F5F7;color:#4A4A4A}.imagify-bulk .imagify-settings-section h3,.imagify-bulk .imagify-settings-section li,.imagify-bulk .imagify-settings-section p{color:#4A4A4A}.imagify-bulk .imagify-settings-section h3{margin-bottom:2em}.imagify-title .imagify-tooltips{position:absolute;top:100%;left:0}.imagify-tooltips .icon-round{float:left;display:inline-block;width:28px;height:28px;border:1px solid #FFF;margin-right:8px;margin-bottom:8px;font-size:17px;font-style:italic;line-height:29px;font-weight:700;text-align:center;border-radius:50%}.imagify-tooltips .tooltip-content{display:block;position:relative;max-width:250px;padding:7px 15px 8px;background:#2e3242;color:#FFF;font-size:10px;border-radius:3px}.imagify-tooltips.right .tooltip-content{margin-left:12px}.imagify-tooltips.bottom .tooltip-content{margin-top:4px}.imagify-inline-options label .tooltip-content{position:absolute;left:0;right:0;top:100%;text-transform:none;font-size:10px;letter-spacing:0;text-align:center}.imagify-ac-rt-big,.imagistatus{text-transform:uppercase;font-weight:700}.imagify-tooltips .tooltip-content:after{content:"";position:absolute}.imagify-tooltips.right .tooltip-content:after{top:16px;left:-6px;border-right:8px solid #2e3242;border-top:6px solid transparent;border-bottom:6px solid transparent}.imagify-tooltips.bottom .tooltip-content:after{top:-5px;left:50%;margin-left:-3px;border-bottom:6px solid #2e3242;border-left:6px solid transparent;border-right:6px solid transparent}.imagify-space-tooltips .tooltip-content{max-width:280px;margin-top:20px;margin-left:0;padding:5px 15px;font-size:13px;background:#40B1D0;-webkit-box-shadow:0 3px 0 #338EA6;box-shadow:0 3px 0 #338EA6}.imagify-space-tooltips .tooltip-content:after{top:-14px;left:50%;margin-left:-7px;border:0;border-bottom:15px solid #40B1D0;border-left:15px solid transparent;border-right:15px solid transparent}.tooltip-content.tooltip-table{display:table;width:100%}.tooltip-content.tooltip-table>*{display:table-cell;vertical-align:middle}.tooltip-content .cell-icon{width:28px}.tooltip-content .cell-icon .icon{margin-bottom:0}.tooltip-content .cell-text{padding:5px 10px 5px 0;line-height:1.3}.tooltip-content .cell-sep{width:1px;background:rgba(255,255,255,.4)}.tooltip-content .cell-cta{padding-left:10px}.tooltip-content .cell-cta a{display:block;color:#FFF;width:100%;height:100%;white-space:nowrap}.imagify-number-you-optimized .number{display:table-cell;padding-right:15px;font-size:36px;font-weight:700;line-height:1.1;vertical-align:middle;white-space:nowrap}.imagify-number-you-optimized .text{display:table-cell;vertical-align:middle;overflow:hidden;font-size:12px}.imagify-number-you-optimized .text br{display:none}.imagify-number-you-optimized>p{display:table}.imagify-number-you-optimized{padding-bottom:.85em;margin-bottom:1.35em;overflow:hidden;border-bottom:1px solid rgba(0,0,0,.05)}.imagify-bars p{font-weight:700;font-size:12px;margin-bottom:0}.imagify-bars+.imagify-number-you-optimized{border-bottom:0;padding-top:.85em}.imagify-bars+.imagify-number-you-optimized p{color:#46b1ce}.imagify-bulk-table{margin-top:2em;max-height:600px;max-height:60vh;overflow:auto}.imagify-ac-report-text,.imagiuploaded{overflow:hidden}.imagify-bulk-table table{width:100%;border-spacing:0;border-collapse:collapse;border:1px solid #D3D3D3}.imagify-bulk-table td{padding:8px 15px}.imagify-bulk-table thead th,.imagify-bulk-table thead tr{background:#2E3242}.imagify-bulk-table tfoot th,.imagify-bulk-table tfoot tr{background:#73818C}.imagify-bulk-table thead th{padding:14px 15px;text-align:left;color:#F2F5F7;font-weight:700;font-size:14px}.imagify-bulk-table tfoot td{padding:14px 15px;color:#F9FAFA}.imagify-bulk-table tbody td,.imagify-bulk-table tbody tr{background:#FFF}.imagify-bulk-table tbody tr:nth-child(odd),.imagify-bulk-table tbody tr:nth-child(odd) td{background:#F2F5F7}.imagify-bulk-table .imagify-row-progress{display:none}.imagify-bulk-table .imagify-row-progress,.imagify-bulk-table .imagify-row-progress td{height:15px;padding:0}.imagify-bulk-table .imagify-no-uploaded-yet td{height:200px;font-size:17px;letter-spacing:.1em;word-spacing:.12em;vertical-align:middle;text-transform:uppercase;font-weight:700;text-align:center;color:#999;background-color:#FFF}.imagify-row-complete{padding:35px 20px;margin-top:2em;background:#8BC34A;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.1)}.imagify-row-complete .imagify-ac-chart{margin-top:3px}.imagify-row-complete p{color:#FFF;margin:0}@-webkit-keyframes congrate{0%{opacity:0;-webkit-transform:scale(1)}50%{-webkit-transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);opacity:1}}@keyframes congrate{0%{opacity:0;-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.05);transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}.imagify-row-complete.done{-webkit-animation:congrate .5s ease-in-out;animation:congrate .5s ease-in-out}.imagify-all-complete{margin:1.5em 0}.imagify-all-complete>div{display:inline-block;vertical-align:middle}.imagify-ac-report{min-width:310px}.imagify-ac-chart{width:46px;height:46px;float:left;margin:0 20px 0 10px}.imagify-ac-report-text p{line-height:1.3}.imagify-ac-rt-big{font-size:24px;letter-spacing:.15em;word-spacing:.15em}.imagify-ac-share{text-align:right}.imagify-ac-share-content{display:inline-block;padding:10px 15px;background:rgba(255,255,255,.2)}.imagify-ac-share-content>*{display:inline-block;vertical-align:middle}.imagify-bulk-table .imagify-ac-share-content p{margin-right:5px}.imagify-share-networks,.imagify-share-networks li{margin:0}.imagify-share-networks li{display:inline-block}.imagify-share-networks a{display:inline-block;vertical-align:-7px;margin:0 5px;text-decoration:none;color:#FFF}.imagify-cell-filename{max-width:200px}.imagify-cell-status{max-width:145px}.imagify-cell-status .dashicons-warning{margin-right:2px}.imagify-cell-thumbnails{max-width:120px}td.imagify-cell-filename{-o-text-overflow:clip;text-overflow:clip;white-space:nowrap;overflow:hidden}.imagify-bulk-table td.imagify-cell-totaloriginal{padding-right:78px}.imagifilename,.imagiuploaded{display:inline-block;vertical-align:middle}.imagifilename{font-size:12px}.imagiuploaded{width:33px;height:33px;margin-right:5px;margin-left:-8px;background:url(../images/upload-image.png) no-repeat;background-size:cover}.imagiuploaded img{max-widht:100%;height:auto}.imagistatus{color:#8CA6B3}.status-compressing{color:#46B1CE}.status-error{color:#CE0B24}.status-warning{color:#f5a623}.status-complete{color:#8CC152}.imagify-error{background:#D0021B;color:#FFF}.imagify-settings-section .imagify-error{display:inline-block;padding:7px 10px;margin:10px 0 0 45px;border-radius:3px}.imagify-settings-section .imagify-error code{font-weight:400}.imagify-settings-section .imagify-error.hidden{display:none}#wpadminbar .imagify-warning *,.imagify-warning{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.2)}.imagify-bulk-table .imagify-cell-thumbnails{text-align:center}.imagify-cell-percentage,.imagify-cell-savings{color:#46B1CE;font-weight:700}.imagify-cell-optimized{font-weight:700}.imagify-cell-totaloriginal{text-align:right}.imagify-modal .h2,.imagify-modal .h3{font-weight:400;letter-spacing:.075em;text-align:center}.dashicons.rotate{-webkit-animation:icon-rotate 2.6s infinite linear;animation:icon-rotate 2.6s infinite linear}.dashicons-admin-generic{-webkit-transform-origin:48.75% 51.75%;-ms-transform-origin:48.75% 51.75%;transform-origin:48.75% 51.75%}.imagify-modal{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.js .imagify-modal{display:none;position:fixed;top:0;right:0;bottom:0;left:0;background-color:#1F2332;background-color:rgba(31,35,50,.95);z-index:99999}.imagify-modal-content{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:800px;max-width:95%;max-height:90vw;overflow:auto;padding:20px 25px;margin:1em auto;background:#FFF;-webkit-box-shadow:1px 1px 4px rgba(0,0,0,.7);box-shadow:1px 1px 4px rgba(0,0,0,.7);border-radius:3px}#imagify-visual-comparison .imagify-modal-content,.imagify-visual-comparison .imagify-modal-content{max-width:1400px;background:0 0;padding:5px;-webkit-box-shadow:none;box-shadow:none;border-radius:0}.imagify-modal .h2{margin:.5em 0;color:#8ba6b4;font-size:24px}.imagify-modal .h3{color:#40b1d0;font-size:18px}.text-justify{text-align:justify}.imagify-modal .close-btn{display:none;visibility:hidden;position:absolute;right:20px;top:20px;font-size:1.2em;border:0;background:0 0;border-radius:0;cursor:pointer}.imagify-modal .close-btn i{margin-left:-2px}.imagify-modal .close-btn:focus,.imagify-modal .close-btn:hover{color:#40b1d0}.js .imagify-modal .close-btn{display:block;visibility:visible}.js .imagify-iframe-viewing .close-btn{display:none}#imagify-visual-comparison .close-btn,.imagify-visual-comparison .close-btn{top:50px;right:5px;width:33px;height:33px;padding:1px 0 0 2px;border:1px solid #F2F2F2;color:#F2F2F2;line-height:19px;text-align:center;border-radius:50%}.imagify-visual-comparison .close-btn,.wp_attachment_image #imagify-visual-comparison .close-btn{top:0}.imagify-visual-comparison .imagify-modal-content,.wp_attachment_image #imagify-visual-comparison .imagify-modal-content{padding-top:40px}.imagify-modal .imagify-comparison-title{font-size:28px;margin-bottom:1em;color:#F2F2F2;text-align:left}.imagify-modal .imagify-comparison-title .twentytwenty-duo-buttons{position:static;margin:0 10px 0 15px}.imagify-comparison-title .twentytwenty-duo-buttons button{float:none;padding:6px 12px;font-size:16px;text-transform:none;border:1px solid #40B1D0;color:#889;letter-spacing:0}.imagify-comparison-title .twentytwenty-duo-buttons button:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}.imagify-comparison-title .twentytwenty-duo-buttons .selected{border:1px solid #40B1D0;color:#FFF;background:#40B1D0}.imagify-comparison-levels{margin:15px 0;overflow:hidden}.imagify-comparison-levels div{display:none;min-width:175px;font-size:11px}.imagify-comparison-levels .imagify-chart,.imagify-comparison-levels .imagify-chart-container{width:25px;float:none;margin:0}.imagify-visual-comparison .imagify-chart-container canvas{width:15px!important;height:15px!important;margin-right:5px}.imagify-c-level.go-left{float:left}.imagify-c-level.go-right{float:right}.imagify-c-level.go-left,.imagify-c-level.go-right{display:table}.imagify-c-level .imagify-c-level-row{display:table-row;margin:0;color:#FFF}.imagify-c-level-row>span{display:table-cell;padding:2px 0}.imagify-c-level-row .value{text-align:right;padding-left:5px}.imagify-c-level-row .value.level{color:#40b1d0}.imagify-c-level-row .value.size{color:#8bc34a;font-weight:700}.imagify-c-level-row .value .imagify-chart{top:1px}@-webkit-keyframes icon-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes icon-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.imagify-menu-bar-img{margin-top:1em}.imagify-modal .loader{position:absolute;top:50%;left:50%;margin:-32px 0 0 -32px;opacity:0;visibility:hidden;-webkit-transition:opacity .4s;-o-transition:opacity .4s;transition:opacity .4s}.imagify-modal .loading .loader{visibility:visible;opacity:1}.imagify-settings .imagify-visual-comparison-text{margin-top:1em;color:#40b1d0;font-weight:700}.imagify-border-styled,.imagify-flex-table,.imagify-modal-cols,.imagify-offer-header,.imagify-payment-modal .imagify-modal-content,.imagify-tabs{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.imagify-analyzing .imagify-numbers-calc,.imagify-modal-content.imagify-iframe-viewing .imagify-modal-sidebar,.imagify-modal-content.imagify-success-viewing .imagify-modal-sidebar,.imagify-modal-section .imagify-loader,.imagify-modal-section.imagify-analyzing .imagify-modal-cols,.imagify-numbers-notcalc{display:none}.imagify-border-styled,.imagify-modal-cols{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-payment-modal{text-align:center;color:#7A8996}.imagify-payment-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}.imagify-modal-loader{position:absolute;top:0;left:0;right:0;bottom:0;background:url(../images/loader-balls.svg) center no-repeat #fff;z-index:10}.imagify-payment-modal .imagify-modal-content{width:980px;max-width:100%;min-width:925px;padding:0}.imagify-modal-content.imagify-iframe-viewing{width:980px;height:672px;overflow:hidden}.imagify-iframe-viewing #imagify-payment-process-view{width:980px;height:668px}.imagify-payment-modal .imagify-modal-main{width:70%}.imagify-iframe-viewing .imagify-modal-main{width:auto}.imagify-payment-modal .imagify-modal-content.imagify-success-viewing{min-width:auto;width:450px;min-height:300px}.imagify-success-viewing .imagify-modal-main{width:100%}.imagify-payment-modal .imagify-modal-sidebar{width:30%;padding:15px 20px;background:#1F2332;color:#FFF}.imagify-modal-section{padding:0 25px}.imagify-modal-section.section-gray{margin:0 0 1em;padding:10px 25px 15px;background:#F6F7FB}.imagify-tabs-contents .section-gray{padding:8px 25px 10px}.imagify-modal-section .imagify-modal-title:first-child{margin-top:1em;margin-bottom:1.5em}.imagify-modal-section.section-gray .imagify-modal-title{margin-top:.5em;margin-bottom:.5em}.imagify-modal-title{font-size:1.8em}.imagify-analyzing .imagify-numbers-notcalc,.imagify-modal-section.imagify-analyzing .imagify-loader{display:block}.imagify-modal-section .imagify-loader{margin:2em auto}.imagify-border-styled{width:200px;margin:0 auto;color:#8BC34A;font-weight:700;font-size:.925em}.imagify-big-number,.imagify-payment-modal strong{font-weight:700;color:#4A4A4A}.imagify-big-number{font-size:3.7em;margin:-3px 0;line-height:1}.imagify-border-styled:after,.imagify-border-styled:before{content:"";height:1px;background:rgba(0,0,0,.1);-ms-flex-preferred-size:40px;flex-basis:40px}.imagify-border-styled:before{margin-right:5px}.imagify-border-styled:after{margin-left:5px}.imagify-col{-ms-flex-preferred-size:50%;flex-basis:50%}.imagify-modal .imagify-cols{padding:0 20px}.imagify-payment-modal .imagify-iconed{margin:1.5em 5em 1.5em 0}.imagify-iconed{position:relative;text-align:left;padding-left:42px;margin-right:15px;font-weight:500}.imagify-iconed .dashicons,.imagify-iconed .icon{position:absolute;font-size:2em;left:0;top:2px;color:#40B1D0}.imagify-payment-modal .close-btn{top:10px;right:10px;width:24px;height:24px;padding:2px 0 0 4.5px;color:#FFF;background:#40B1D0;border-radius:50%;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-payment-modal .close-btn i{margin-left:-3.5px;margin-top:-.5px}.imagify-payment-modal .close-btn:hover{background:#F6F7FB}.imagify-offer-line{margin-top:1.5em}.imagify-offer-line+.imagify-offer-line{margin-top:.75em}.imagify-offer-header{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 0 0 15px;border-radius:4px 4px 0 0;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-header.imagify-offer-header.imagify-offer-header .imagify-inline-options label:last-child{border-radius:0 4px 0 0}.imagify-offer-header .imagify-inline-options{width:auto}.imagify-offer-title{font-weight:700;margin:0}.imagify-offer-header,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#E5EBEF}.imagify-offer-onetime .imagify-offer-header{padding-top:8px;padding-bottom:8px}.imagify-offer-onetimes>div{padding-top:15px;padding-bottom:15px}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{position:relative;padding:7px 30px;font-size:1em;letter-spacing:.05em;color:inherit;-webkit-box-shadow:0 0 0;box-shadow:0 0 0;border-radius:0}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#F6F7FB}.imagify-2-free{position:absolute;bottom:100%;left:0;right:0;padding:2px 10px;margin-bottom:8px;font-size:.8em;letter-spacing:0;text-transform:none;text-align:center;color:#FFF;background:#10121A;border-radius:2px}.imagify-2-free:after{content:"";position:absolute;left:50%;bottom:-3px;margin-left:-3px;border-top:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent}.imagify-2-free.imagify-b-right{bottom:auto;left:100%;right:-100%;margin-bottom:0;margin-left:8px}.imagify-2-free.imagify-b-right:after{left:-3px;bottom:auto;top:50%;margin-top:-3px;margin-left:0;border-right:3px solid #10121A;border-top:3px solid transparent;border-bottom:3px solid transparent;border-left:0}.imagify-2-free.imagify-b-bottom{bottom:-100%;left:0;right:0;margin-top:8px}.imagify-2-free.imagify-b-bottom:after{top:-3px;bottom:auto;border-bottom:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent;border-top:0}.imagify-offer-content{text-align:left;background:#F6F7FB;border-radius:0 0 4px 4px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-onetime .imagify-offer-content{padding:10px 0}div.imagify-col-checkbox{position:relative;width:25.5%;padding-top:10px;padding-bottom:7px}.imagify-col-checkbox label{display:block;padding-left:55px!important}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked){position:absolute;top:50%;left:6px;margin:-8px 0 0}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{margin:0;top:-2px;left:6px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-by,.imagify-offer-size{-webkit-transition:all .275s;-o-transition:all .275s}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:after{top:1px;left:13px}.imagify-offer-size{font-size:30px;color:#2E3243;font-weight:700;transition:all .275s}.imagify-offer-by{font-size:10px;transition:all .275s}.imagify-approx{display:none;font-size:11px;line-height:1.2;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}div.imagify-col-price{width:35%}.imagify-flex-table .imagify-price-block{padding-left:0;padding-right:0}.imagify-offer-monthlies .imagify-price-block,.imagify-offer-monthly .imagify-flex-table .imagify-price-block{padding-top:0}.imagify-flex-table .imagify-price-complement{padding-right:0;font-size:10px;font-weight:700}.imagify-price-block,.imagify-price-discount{white-space:nowrap}.imagify-price-block span,.imagify-price-discount span{display:inline-block;vertical-align:middle}.imagify-price-discount.imagify-price-discount{position:relative;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;padding-top:15px;font-weight:700;width:70px}.imagify-price-discount:before{content:"";position:absolute;top:25px;width:62%;height:2px;background:#2E3243;-webkit-transform:rotate(-15deg);-ms-transform:rotate(-15deg);transform:rotate(-15deg)}.imagify-offer-onetimes .imagify-price-discount:before{width:100%}.imagify-price-discount-dollar{color:#2E3243}.imagify-price-discount-number{color:#8BA6B4}.imagify-offer-selected .imagify-price-discount-number{color:#FFF}span.imagify-dollars{color:#1F2332;font-size:18px;font-weight:700;vertical-align:-2px}.imagify-offer-onetime .imagify-col-price{padding-top:0}.imagify-offer-onetime .imagify-dollars{vertical-align:-1px}.imagify-price-big,.imagify-price-mini{color:#40B1D0;font-weight:700}.imagify-price-big{font-size:36px}span.imagify-price-mini{font-size:18px;vertical-align:2px}span.imagify-price-by{font-size:10px;color:#1F2332;vertical-align:-13px;text-indent:-27px}.imagify-col-other-actions{width:18.5%;text-align:right}.imagify-col-other-actions a{font-size:11px}.imagify-offer-selected,.imagify-offer-selected .imagify-col-other-actions a,.imagify-offer-selected .imagify-offer-size,.imagify-offer-selected .imagify-offer-title,.imagify-offer-selected .imagify-price-big,.imagify-offer-selected .imagify-price-complement,.imagify-offer-selected .imagify-price-mini{color:#FFF}.imagify-offer-selected .imagify-offer-header,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#338EA6}.imagify-offer-selected .imagify-offer-content,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#40B1D0}.imagify-offer-selected .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{border-color:#FFF;background:#40B1D0}.imagify-offer-selected .imagify-offer-by{color:#2E3243}.imagify-enough-free .imagify-not-enough-title,.imagify-enough-title{display:none}.imagify-enough-free .imagify-enough-title{display:block}.imagify-submit-line{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:2em 0;text-align:left}.imagify-coupon-section{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-coupon-section p{margin:0;line-height:1.3}.imagify-coupon-text{width:200px;max-width:100%;padding-right:15px}.imagify-coupon-loader{display:none}.imagify-coupon-text.checking{text-align:right}.imagify-coupon-text.checking .imagify-coupon-loader{display:inline}.imagify-coupon-text.checking label{display:none}.imagify-coupon-input{position:relative}.imagify-coupon-input input{position:relative;z-index:1}[id=imagify-coupon-validate].button-secondary{position:absolute;top:1px;right:3px;bottom:2px;-webkit-box-shadow:none;box-shadow:none;padding:4px 10px;z-index:0;-webkit-transition:-webkit-transform .275s;-o-transition:transform .275s;transition:transform .275s;transition:transform .275s,-webkit-transform .275s}.imagify-canbe-validate [id=imagify-coupon-validate]{-webkit-transform:translateX(45px);-ms-transform:translateX(45px);transform:translateX(45px)}.imagify-modal-section+.imagify-modal-promotion{margin-top:-1em}.imagify-modal-promotion{position:relative;overflow:hidden;display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:15px 25px;background:#604D90;text-shadow:0 0 3px rgba(0,0,0,.3)}.imagify-modal-promotion.active{display:-webkit-box;display:-ms-flexbox;display:flex}[id=imagify-pricing-tab-onetime] .imagify-modal-promotion{margin-bottom:4em}.imagify-modal-promotion:before{content:"\f488";position:absolute;top:28px;left:8%;font-family:dashicons;font-size:90px;color:#8476A9;text-shadow:none}.imagify-modal-promotion p{position:relative;margin:.2em 0;color:#FFF}.imagify-promo-title{-ms-flex-preferred-size:100%;flex-basis:100%;text-transform:uppercase;font-size:20px;font-weight:700;letter-spacing:.125em}.imagify-until-date{-ms-flex-preferred-size:200px;flex-basis:200px;text-align:right}.imagify-until-date strong{color:#FFF}.imagify-submit-line button{font-size:16px}input.imagify-coupon-code{padding:10px;border:2px solid #7A8996;font-size:.875em;font-weight:700;border-radius:3px}.validated.imagify-coupon-section .imagify-coupon-text,.validated.imagify-coupon-section strong{color:#8BC34A}.validated.imagify-coupon-section .imagify-coupon-code{color:#8BC34A;border-color:#8BC34A}.invalid.imagify-coupon-section .imagify-coupon-text,.invalid.imagify-coupon-section strong{color:#d0021b}.invalid.imagify-coupon-section .imagify-coupon-code{color:#d0021b;border-color:#d0021b}.imagify-footer-lines{width:500px;max-width:100%;margin:2em auto 2.5em;font-size:.85em;line-height:1.5}.imagify-year-selected .imagify-switch-my .imagify-yearly{display:block}.imagify-month-selected .imagify-switch-my .imagify-yearly,.imagify-year-selected .imagify-switch-my .imagify-monthly{display:none}.imagify-month-selected .imagify-switch-my .imagify-monthly{display:block}.imagify-flex-table{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-flex-table>*{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;padding:7px 15px}div.imagify-col-details{width:22%;padding-left:25px}.imagify-col-details p{margin:0}.imagify-pricing-table{margin:0 20px}.imagify-pricing-table .imagify-offer-line{padding:.6em 0;border:2px solid #E8EEF0;text-align:left;border-radius:3px}.imagify-pricing-table .imagify-offer-line:first-child{margin-top:.75em}.imagify-pricing-table .imagify-offer-line.imagify-offer-selected:first-child{margin-top:1.75em}.imagify-pricing-table .imagify-offer-line+.imagify-offer-line{margin-top:-2px}.imagify-pricing-table .imagify-col-other-actions{width:20.5%}.imagify-pricing-table .imagify-approx{margin-left:0;line-height:.5;margin-bottom:1em}.imagify-pricing-table .imagify-offer-selected{-webkit-transform:scale(1.03);-ms-transform:scale(1.03);transform:scale(1.03);background:#40B1D0;border-width:0}.imagify-pricing-table .imagify-offer-selected .imagify-approx{color:#FFF}.imagify-pricing-table .imagify-button-secondary{padding:3px 20px;-webkit-box-shadow:none;box-shadow:none;text-transform:uppercase;font-size:12px;letter-spacing:.025em}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary{border:2px solid #FFF;background:#40B1D0;-webkit-box-shadow:none;box-shadow:none;text-shadow:none!important}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:focus,.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:hover{background:#FFF;color:#40B1D0}.imagify-col .imagify-special-needs{margin-left:25px}.imagify-special-needs strong{font-size:25px;font-weight:700;color:#40B1D0}.imagify-special-needs span{display:block;font-size:12px;margin-top:-.5em}div.imagify-col-price{position:relative}.imagify-recommend{display:none;position:absolute;left:-20px;bottom:100%;padding:0;margin-bottom:8px;color:#1F2332;font-weight:700;font-style:italic}.imagify-offer-selected .imagify-recommend,.imagify-tab-content.imagify-current{display:block}[class*=imagify-onetime-] .imagify-recommend{left:65px;margin-bottom:20px}.imagify-recommend:before{content:"";position:absolute;top:7px;left:-35px;width:29px;height:30px;background:url(../images/icon-arrow-choice.png) 0 no-repeat;background-size:contain}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/1),only screen and (min-resolution:192dpi),only screen and (min-resolution:2dppx){.imagify-recommend:before{background-image:url(../images/icon-arrow-choice.svg)}}.imagify-offer-line[class*=imagify-onetime-]{padding:0;margin:.3em 0 0}.imagify-offer-line.imagify-offer-line[class*=imagify-onetime-]:first-child{margin-top:2em}.imagify-offer-line[class*=imagify-onetime-]+.imagify-offer-line{margin-top:.5em}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-]{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);border-width:2px}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{position:relative;overflow:hidden;width:21%;background:#1F2332;color:#FFF}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{background:#338EA6}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details:before{content:"";position:absolute;bottom:0;right:25px;width:75px;height:54px;background:url(../images/icon-pack.png)}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-other-actions{width:30%}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx,.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{color:#FFF}.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{font-size:24px}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx{font-size:12px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-block{padding-left:10px}.imagify-offer-line[class*=imagify-onetime-] .imagify-dollars{vertical-align:middle}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-big{vertical-align:-5px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-mini{vertical-align:7px}.imagify-tabs{margin-bottom:0;list-style:none;background:#E5EBEF}.imagify-modal-content .imagify-tabs{margin:1em 0 0}.imagify-tab{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;width:50%;margin:0;font-size:23px}.imagify-tab a{display:block;padding:15px 10px;color:inherit;text-decoration:none}.imagify-tab a:focus{-webkit-box-shadow:none;box-shadow:none;outline:0;color:#40B1D8}.imagify-tab.imagify-current a{background:#F6F7FB}.imagify-tab-content{display:none}.imagify-tab-content .imagify-modal-section:first-child{margin-top:0}.imagify-modal-sidebar-content,.imagify-payment-modal .imagify-modal-sidebar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-modal-sidebar-content{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}p.imagify-modal-sidebar-title{margin-top:5px;padding-right:40px;font-size:18px;color:#FFF}.imagify-modal-testimony{margin-top:1em}.imagify-modal-testimony+.imagify-modal-testimony{margin-top:2em}@media (max-height:620px){.imagify-modal-testimony+.imagify-modal-testimony{display:none}}.imagify-modal-testimony-person{display:table;width:100%}.imagify-modal-testimony-person>*{display:table-cell;vertical-align:middle}.imagify-modal-avatar{width:114px;line-height:0}.imagify-modal-avatar img{border:2px solid #FFF;border-radius:50%;width:96px;height:96px}.imagify-modal-identity a{text-decoration:none;font-weight:700}.imagify-modal-identity a:first-child{font-size:13px}.imagify-modal-identity a:first-child+a{display:block;font-size:10px;color:#7A8996}.imagify-modal-testimony-content p{font-size:13px;font-style:italic;line-height:1.7;color:#7A8996}.imagify-modal-sidebar-trust{margin-top:auto;padding-top:1.5em}.imagify-modal-sidebar-trust p{margin:0;font-weight:700;font-size:12px;line-height:1.7}.imagify-modal-sidebar-trust p img{margin-right:3px;vertical-align:-2px}.imagify-modal-sidebar-trust p+p{font-size:11px}.imagify-cart{text-align:left}.imagify-cart .imagify-cart-list{border-top:1px solid rgba(122,137,150,.2);border-bottom:1px solid rgba(122,137,150,.2)}.imagify-cart .imagify-cart-label{margin-bottom:.5em;font-size:10px;color:#2E3243}.imagify-cart-list p{margin:0;font-weight:700}.imagify-cart-item{margin:.4em 0}.imagify-cart .imagify-cart-suggestion{margin-top:-.3em}.imagify-cart-suggestion a,.imagify-cl-description p{font-size:10px}.imagify-remove-from-cart{border:0;padding:0;width:14px;height:14px;line-height:13px;border-radius:50%;background:#40B1D0;cursor:pointer;-webkit-transition:background .3s;-o-transition:background .3s;transition:background .3s}.imagify-remove-from-cart i:before{position:relative;top:-6px;left:-3px;font-size:13px;color:#FFF}.imagify-remove-from-cart:focus,.imagify-remove-from-cart:hover{background:#D0021B}.imagify-cart .imagify-cl-remove{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:45px}.imagify-cart .imagify-cl-name{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:200px}.imagify-cart .imagify-cl-description{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;padding-top:10px}.imagify-cart .imagify-cl-price{text-align:right}#imagify-payment-iframe{width:980px;height:672px;background:url(../images/loader-balls.svg) 50% 50% no-repeat #f6f7fb}.imagify-success-view{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%}.imagify-success-view p{font-weight:700;font-size:16px}.imagify-cart-emptied-item{margin:.3em auto;padding:6px 20px;background:#E6EBEF;border-radius:20px}.imagify-cart-emptied-item.imagify-cart-emptied-item p{font-weight:700}.imagify-cart-emptied-item a{color:#40b1d0;float:right;font-weight:700}
1
+ .imagify-cell,.imagify-cell.va-top,.va-top .imagify-cell{vertical-align:top}#imagify-overview-chart-legend,.imagify-oh,body.imagify-modal-is-open{overflow:hidden}.imagify-start{float:left}.imagify-end{float:right}.imagify-txt-start.imagify-txt-start.imagify-txt-start{text-align:left}.imagify-txt-center.imagify-txt-center.imagify-txt-center{text-align:center}.imagify-txt-end.imagify-txt-end.imagify-txt-end{text-align:right}.imagify-mt1.imagify-mt1{margin-top:1em}.imagify-mb1.imagify-mb1{margin-bottom:1em}.imagify-mr1.imagify-mr1{margin-right:1em}.imagify-ml2.imagify-ml2{margin-left:2em}.imagify-mr2.imagify-mr2{margin-right:2em}.imagify-pl0.imagify-pl0.imagify-pl0{padding-left:0}.imagify-pr1.imagify-pr1{padding-right:1em}.imagify-clear{clear:both}.imagify-clearfix:after,.imagify-inline-options:after{content:"";display:table;clear:both}.imagify-count.imagify-count{counter-reset:num}.imagify-count .imagify-count-title{font-weight:700}.imagify-default-settings{color:#73818c;font-weight:400}.imagify-count .imagify-count-title:before{counter-increment:num 1;content:counter(num) ". "}.imagify-table{display:table;width:100%}.imagify-cell{display:table-cell;padding:10px}.imagify-bulk-submit .imagify-cell{padding-top:0}.imagify-plugins-error{overflow:hidden;padding-left:20px;list-style-type:disc}.imagify-plugins-error li{width:300px;line-height:30px}@media (max-width:570px){.imagify-plugins-error li{width:auto}}.imagify-notice-dismiss.notice-dismiss{text-decoration:none}.imagify-spinner{display:inline-block;width:20px;height:20px;margin-right:5px;vertical-align:middle;background:url(../images/spinner.gif) 0 0/20px 20px no-repeat rgba(0,0,0,0);opacity:.7}.spinner.imagify-hidden{width:0;margin:4px 0 0}.misc-pub-section.misc-pub-imagify h4{font-size:14px;margin-top:5px;margin-bottom:0}.imagify-sweet-alert button{margin-top:17px!important;height:45px!important;letter-spacing:3px;text-transform:uppercase!important;border-radius:3px!important;background-color:#40b1d0!important;-webkit-box-shadow:0 3px 0 #338ea6!important;box-shadow:0 3px 0 #338ea6!important}.imagify-sweet-alert button.loading{border-radius:100%!important;height:40px!important;padding:0!important;-webkit-box-shadow:none!important;box-shadow:none!important}.imagify-sweet-alert button.swal2-cancel{background:#777!important;-webkit-box-shadow:0 3px 0 #444!important;box-shadow:0 3px 0 #444!important}.imagify-sweet-alert-signup .sa-confirm-button-container{width:40%}.imagify-sweet-alert-signup button{width:100%;padding:0!important}.imagify-sweet-alert .la-ball-fall,.imagify-sweet-alert .sa-input-error:after,.imagify-sweet-alert .sa-input-error:before{top:25%!important}#wpwrap{-webkit-transition:all .4s;-o-transition:all .4s;transition:all .4s}.stop-scrolling #wpwrap{-webkit-filter:blur(2px);filter:blur(2px)}.stop-scrolling #wpwrap #wpadminbar{top:-32px}.imagify-primary.imagify-primary.imagify-primary{color:#40b1d0}.imagify-secondary.imagify-secondary.imagify-secondary{color:#8cc152}#imagify-check-api-container{font-weight:700}#imagify-check-api-container .dashicons{font-size:25px}#imagify-check-api-container .dashicons-no:before{color:#f06e57;vertical-align:-1px}#imagify-check-api-container .dashicons-yes:before{color:#8BC34A;vertical-align:-1px}.imagify-valid{color:#8BC34A}.imagify-chart{width:33.33%;position:relative}.imagify-doughnut-legend{margin-top:38px;list-style:none}.imagify-doughnut-legend li{display:block;padding-left:30px;position:relative;margin-bottom:15px;border-radius:5px;padding:3px 8px 2px 31px;font-size:14px;font-weight:600;cursor:default;-webkit-transition:background-color .2s ease-in-out;-o-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}.imagify-doughnut-legend li span{display:block;position:absolute;left:0;top:0;width:25px;height:25px;border-radius:50%}.button-text,.imagify-bulk-info p{display:inline-block}.imagify-chart{float:left;margin-bottom:20px}td .imagify-chart{float:none;margin-bottom:0;top:4px}.imagify-chart-container{position:relative;width:180px;float:left;margin-right:20px}.imagify-global-optim-phrase{width:180px;padding-top:20px;font-size:14px;font-weight:700;text-align:center}.imagify-total-percent{color:#46b1ce}td .imagify-chart-container{width:18px;height:18px;float:none;margin-right:10px}.imagify-chart-percent{position:absolute;left:0;right:0;top:50%;margin-top:-14px;text-align:center;font-size:55px;font-weight:700;color:#46B1CE}.imagify-chart-percent span{font-size:20px;vertical-align:super}.media_page_imagify-bulk-optimization .notice,.settings_page_imagify .notice,body[class*="_imagify-ngg-bulk-optimization"] .notice{margin-right:20px;margin-left:2px}.media_page_imagify-bulk-optimization .media-item,body[class*="_imagify-ngg-bulk-optimization"] .media-item{margin:0}.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress{float:none;width:100%;margin:0;background:#1F2331;-webkit-box-shadow:0;box-shadow:0;border-radius:0}.media_page_imagify-bulk-optimization .media-item .percent,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent{width:auto;padding:0 5px;line-height:1.85;font-size:12px}.media_page_imagify-bulk-optimization .media-item .percent,.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress{text-align:right}.media_page_imagify-bulk-optimization .media-item .progress .bar,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress .bar{width:1px;height:22px;margin-top:0;background:#46B1CE;border-radius:0;overflow:visible;-webkit-transition:width .5s;-o-transition:width .5s;transition:width .5s}.imagify-settings .button,.imagify-settings a,.imagify-settings input,.imagify-welcome .button,.imagify-welcome a,.imagify-weolcome input{-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-settings a{color:#40b1d0}.imagify-options-title{padding-bottom:.5em;border-bottom:3px solid #F2F2F2;font-size:13px;font-weight:500;text-transform:uppercase;letter-spacing:.025em;color:#40b1d0}.imagify-settings,.imagify-settings p,.imagify-settings th{color:#5F758E}@media (max-width:782px){.imagify-settings .form-table th{padding-top:2em;padding-bottom:.5em}}.imagify-settings .form-table td{vertical-align:top}.button .dashicons,.button-text,.imagify-button-primary.imagify-button-primary .dashicons,.imagify-button-secondary.imagify-button-secondary .dashicons,.imagify-button.imagify-button .dashicons,.imagify-notice .button .dashicons,.imagify-settings .button .dashicons,.imagify-welcome .button .dashicons{vertical-align:middle}.imagify-settings .form-table th span{cursor:pointer}.imagify-middle th{padding-top:35px}.imagify-button-primary.imagify-button-primary,.imagify-button-secondary.imagify-button-secondary,.imagify-button.imagify-button,.imagify-notice .button,.imagify-settings .button,.imagify-welcome .button{height:auto;padding:8px 20px;border:0;font-size:14px;font-weight:600;-webkit-box-shadow:0 3px 0 rgba(0,0,0,.15);box-shadow:0 3px 0 rgba(0,0,0,.15);border-radius:3px;cursor:pointer;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-notice .button-mini{padding:2px 10px;font-size:13px}.button-primary.button-mini{padding:2px 10px}.imagify-settings .button.button-mini-flat{padding:3px 6px 5px;font-size:12px;-webkit-box-shadow:none!important;box-shadow:none!important;line-height:1.2}.imagify-settings .button.button-mini-flat:focus,.imagify-settings .button.button-mini-flat:hover{-webkit-box-shadow:none!important;box-shadow:none!important}.imagify-button-ghost.imagify-button-ghost,.imagify-title .button-ghost.button-ghost{padding:2px 9px;border:1px solid #40B1D0;font-size:12px;font-weight:400;color:#40B1D0;background:0 0;-webkit-box-shadow:none;box-shadow:none}.imagify-button-ghost.imagify-button-ghost:focus,.imagify-button-ghost.imagify-button-ghost:hover,.imagify-title .button-ghost.button-ghost:focus,.imagify-title .button-ghost.button-ghost:hover{border-color:transparent;color:#000;background:#40B1D0}.imagify-button-ghost.imagify-button-ghost:focus,.imagify-button-ghost.imagify-button-ghost:hover{color:#FFF}.imagify-button-medium.imagify-button-medium{text-transform:uppercase;letter-spacing:.1em;padding:3px 10px;font-weight:700}.imagify-button-medium.imagify-button-ghost{border-width:2px}.button .dashicons{margin-right:5px}.imagify-button-primary.imagify-button-primary,.imagify-settings .button-primary.button-primary,.imagify-welcome .button-primary.button-primary{background:#40B1D0;color:#FFF;-webkit-box-shadow:0 3px 0 rgba(51,142,166,1);box-shadow:0 3px 0 rgba(51,142,166,1);text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799!important}.imagify-button-secondary.imagify-button-secondary{background:#8BC34A;color:#FFF;-webkit-box-shadow:0 3px 0 #6F9C3B;box-shadow:0 3px 0 #6F9C3B;text-shadow:0 -1px 1px #6F9C3B,1px 0 1px #6F9C3B,0 1px 1px #6F9C3B!important}.imagify-button-primary.imagify-button-primary:focus,.imagify-button-primary.imagify-button-primary:hover,.imagify-settings .button-primary:focus,.imagify-settings .button-primary:hover,.imagify-welcome .button-primary:focus,.imagify-welcome .button-primary:hover{background:#338ea6;-webkit-box-shadow:0 3px 0 #1f7a92;box-shadow:0 3px 0 #1f7a92}.imagify-button-secondary.imagify-button-secondary:focus,.imagify-button-secondary.imagify-button-secondary:hover{background:#6F9C3B;color:#FFF}.imagify-button-light.imagify-button-light{background:#FFF;color:#4a4a4a;-webkit-box-shadow:0 2px 0 rgba(0,0,0,.2);box-shadow:0 2px 0 rgba(0,0,0,.2)}.imagify-button-light.imagify-button-light:focus,.imagify-button-light.imagify-button-light:hover{color:#FFF;background:rgba(0,0,0,.2)}.imagify-section-positive .imagify-button-light{color:#709A41}.imagify-button.imagify-button-big{font-size:15px;padding:11px 30px}.imagify-button-big .dashicons{font-size:1.45em;margin-right:6px;margin-left:-4px}.imagify-info,.imagify-logo{vertical-align:top}#imagify-bulk-action{padding:11px 20px}.media-frame-content .imagify-button-primary,.wp_attachment_image .imagify-button-primary{float:left;padding:0 10px 1px;margin:0 5px 2px 0;font-size:13px;line-height:26px;-webkit-box-shadow:0 3px 0 rgba(51,142,166,1);box-shadow:0 3px 0 rgba(51,142,166,1)}.imagify-settings input[type=text]{color:#4A4A4A;font-weight:600;-webkit-box-shadow:none;box-shadow:none}.imagify-settings div.submit.submit{padding-left:235px;padding-top:40px}.imagify-settings p.submit{float:left;margin-top:0}.imagify-settings p.submit .button{margin:0 5px}@media (max-width:850px){.imagify-settings div.submit{padding-left:0}.imagify-settings p.submit{text-align:center}}.imagify-title.imagify-title{position:relative;padding:30px 50px;font-size:23px;background:#2E3243;color:#FFF}.imagify-settings .imagify-title+.imagify-notice{margin:0;border-right:1px solid #D9D9D9;padding-top:15px;padding-bottom:15px}.imagify-section,.imagify-settings div.submit,.imagify-sub-header,.imagify-sub-title.imagify-sub-title{margin:0;padding:20px;background:#F2F5F7}.imagify-section-positive,.imagify-sub-title.imagify-sub-title{padding-left:40px}.imagify-section-positive{background:#8cc152;color:#FFF}.imagify-section-positive p{color:#FFF}.imagify-section-gray{background:#D9E4EB}.imagify-section-gray .imagify-count-title{color:#4a4a4a}.imagify-section p:first-child{margin-top:0}.imagify-section p:last-child{margin-bottom:0}p.imagify-section-title.imagify-section-title{font-size:20px;margin-top:-.3em;margin-bottom:-.6em}.imagify-bulk-info{margin:1em 1em 1em 5px;-webkit-transition:margin .3s;-o-transition:margin .3s;transition:margin .3s}@media (max-width:850px){.imagify-bulk-info{margin:1em}}.imagify-bulk-info p{text-align:left;width:400px;max-width:100%;font-weight:700}@media (min-width:1500px){.imagify-settings div.submit{display:table;width:100%}.imagify-settings div.submit>*{display:table-cell;vertical-align:middle}.imagify-bulk-info{padding:0 25px;text-align:right}}.imagify-settings div.submit{margin-top:2em;padding:20px 0}.imagify-notice .imagify-rate-us .stars,.imagify-sub-header .form-table{margin:0}.imagify-sub-header th{text-align:right}.imagify-sub-header td,.imagify-sub-header th{padding-top:0;padding-bottom:0}[for=api_key]{padding-top:5px}.imagify-notice .imagify-rate-us.imagify-rate-us{position:relative;bottom:0;right:0;text-align:left}.imagify-rate-us.imagify-rate-us{position:absolute;bottom:50%;right:20px;text-align:right;margin-bottom:-2.4em;color:#FFF}.imagify-rate-us a{color:#40B1D0}.imagify-rate-us .stars{display:inline-block;margin:2px 0 0 10px;text-decoration:none;letter-spacing:.2em;vertical-align:-1px}.imagify-rate-us .stars .dashicons:before{font-size:18px}.imagify-rate-us a:focus,.imagify-rate-us a:hover{color:#FEE102}@media (max-width:1220px){.imagify-rate-us.imagify-rate-us{position:static;margin-bottom:0;text-align:left}.imagify-rate-us.imagify-rate-us br{display:none}.imagify-rate-us .stars{display:block;margin-left:0}}.imagify-rkt-notice.imagify-rkt-notice{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;-ms-grid-row-align:center;align-items:center;padding:10px 45px 10px 0;border:0;-webkit-box-shadow:none;box-shadow:none;color:#FFF;background:#412355}.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:2px;margin-right:20px}@media (max-width:782px){.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:0;margin-right:12px}}.imagify-rkt-notice .imagify-cross{position:absolute;right:8px;top:50%;width:22px;height:22px;padding:0;margin-top:-11px;background:0 0;color:#FD7300;border-radius:50%;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-rkt-notice .imagify-cross .dashicons{position:relative;top:2px;left:1px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-rkt-notice .imagify-cross:hover{background:#FFF}.imagify-rkt-notice .imagify-cross:hover .dashicons{color:#412355}.imagify-rkt-notice .imagify-rkt-coupon,.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo{-ms-flex-negative:0;flex-shrink:0}.imagify-rkt-notice .imagify-rkt-logo{width:150px!important;text-align:center;padding:0 25px 0 30px;line-height:.8}.imagify-rkt-notice .imagify-rkt-msg{width:100%!important;padding:0 15px;font-size:14px;line-height:1.6}.imagify-rkt-notice .imagify-rkt-coupon{width:150px!important;padding:0 15px}.imagify-rkt-notice .imagify-rkt-coupon-code{padding:5px 10px;font-size:23px;font-weight:700;border:1px dashed #F7A933;color:#F7A933}.imagify-rkt-notice .imagify-rkt-cta{width:250px!important;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:200px;flex-basis:200px}.imagify-rkt-notice .button.button{position:relative;top:-1px;height:auto;font-weight:600;font-size:14px;-webkit-box-shadow:0 4px 0 #B27A27;box-shadow:0 4px 0 #B27A27;border:0;padding:9px 18px;background:#F7A933;text-shadow:1px 1px 1px rgba(0,0,0,.2)}@media (max-width:880px){.imagify-rkt-notice{-ms-flex-wrap:wrap;flex-wrap:wrap}.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo,.imagify-rkt-notice .imagify-rkt-msg{text-align:left;padding:5px 15px}.imagify-cross.imagify-cross{top:8px;margin-top:0}.imagify-rkt-notice .imagify-cross .dashicons{top:1px}}.imagify-settings-section{padding:10px 20px}.imagify-welcome .imagify-settings-section,[id=imagify-settings]{border:1px solid #D9D9D9;border-top:0 none;background:#FFF}.imagify-br{line-height:2}.imagify-important{color:#F5A623}.imagify-info,.imagify-info a{color:#40B1D0;font-size:12px}.imagify-info{position:relative;display:inline-block;padding-left:25px}.imagify-info .dashicons{position:absolute;left:0;top:-1px}.imagify-visual-label,label+.imagify-info,label+.imagify-options-line{display:inline-block;max-width:70%;margin-left:15px;margin-top:2px!important;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}.imagify-visual-label{vertical-align:-5px}label[for=imagify_sizes_full]+.imagify-info{vertical-align:middle}.imagify-settings.imagify-settings [type=checkbox]:not(:checked)+label .imagify-visual-label,.imagify-settings.imagify-settings [type=checkbox]:not(:checked)+label+.imagify-options-line{opacity:.5}.imagify-settings.imagify-settings [type=checkbox]:checked+label .imagify-visual-label,.imagify-settings.imagify-settings [type=checkbox]:checked+label+.imagify-options-line{opacity:1}.imagify-checkbox-marged{max-width:500px;margin-left:45px}.imagify-checkbox.imagify-checkbox:checked,.imagify-checkbox.imagify-checkbox:not(:checked),.imagify-settings.imagify-settings [type=checkbox]:checked,.imagify-settings.imagify-settings [type=checkbox]:not(:checked){opacity:.01}.imagify-checkbox.imagify-checkbox:checked:focus,.imagify-checkbox.imagify-checkbox:not(:checked):focus,.imagify-settings.imagify-settings [type=checkbox]:checked:focus,.imagify-settings.imagify-settings [type=checkbox]:not(:checked):focus{-webkit-box-shadow:none!important;box-shadow:none!important;outline:0!important;border:0!important}.imagify-checkbox.imagify-checkbox:checked+label,.imagify-checkbox.imagify-checkbox:not(:checked)+label,.imagify-settings [type=checkbox]:checked+label,.imagify-settings [type=checkbox]:not(:checked)+label{position:relative;padding-left:6px;cursor:pointer;vertical-align:top}.imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-checkbox.imagify-checkbox:not(:checked)+label:before,.imagify-settings [type=checkbox]:checked+label:before,.imagify-settings [type=checkbox]:not(:checked)+label:before{content:'';position:absolute;left:0;top:0;width:28px;height:28px;margin:0 0 0 -24px;border:2px solid #8BA6B4;background:#FFF;border-radius:4px}.imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-settings [type=checkbox]:checked+label:after,.imagify-settings [type=checkbox]:not(:checked)+label:after{content:"✓";position:absolute;font-size:1.4em;top:3px;left:-16px;-webkit-transition:all .2s;-o-transition:all .2s;transition:all .2s}.imagify-checkbox.imagify-checkbox[disabled]:checked+label:before,.imagify-checkbox.imagify-checkbox[disabled]:not(:checked)+label:before,.imagify-settings [type=checkbox][disabled]:checked+label:before,.imagify-settings [type=checkbox][disabled]:not(:checked)+label:before{border-color:#ccc;background:#ddd}.imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-settings [type=checkbox]:not(:checked)+label:after{opacity:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-settings [type=checkbox]:checked+label:after{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}input[id^=imagify_sizes_]:checked+label{font-weight:700}.medium.imagify-checkbox:checked+label:before,.medium.imagify-checkbox:not(:checked)+label:before{width:22px;height:22px;border-width:1.5px;border-radius:2px;margin-top:0}.medium.imagify-checkbox:checked+label:after,.medium.imagify-checkbox:not(:checked)+label:after{font-size:1.1em;left:-17px;top:3px}.imagify-settings .mini[type=checkbox]:checked+label:before,.imagify-settings .mini[type=checkbox]:not(:checked)+label:before,.mini.imagify-checkbox:checked+label:before,.mini.imagify-checkbox:not(:checked)+label:before{width:15px;height:15px;border-width:1px;border-radius:2px;margin-top:0}.imagify-settings .mini[type=checkbox]:checked+label:after,.imagify-settings .mini[type=checkbox]:not(:checked)+label:after,.mini.imagify-checkbox:checked+label:after,.mini.imagify-checkbox:not(:checked)+label:after{font-size:.9em;left:-21px;top:1px}.imagify-checkbox.imagify-checkbox:checked:focus+label:before,.imagify-checkbox.imagify-checkbox:not(:checked):focus+label:before,.imagify-settings [type=checkbox]:checked:focus+label:before,.imagify-settings [type=checkbox]:not(:checked):focus+label:before{border-style:dotted;border-color:#40b1d0}.imagify-inline-options{position:relative;display:table;width:100%;max-width:600px;border-collapse:collapse}.imagify-small-options{width:300px;margin:1em auto .5em;background:#338EA6;border-radius:4px}.imagify-inline-options input[type=radio]:checked,.imagify-inline-options input[type=radio]:not(:checked){position:absolute;left:5px;top:5px;display:none}.imagify-inline-options input[type=radio]:checked+label,.imagify-inline-options input[type=radio]:not(:checked)+label{position:relative;display:table-cell;padding:13px 10px;text-align:center;font-weight:600;font-size:16px;text-transform:uppercase;letter-spacing:.1em;color:#FFF;background:#2E3243;border-left:1px solid rgba(255,255,255,.2);-webkit-box-shadow:0 -3px 0 rgba(0,0,0,.1) inset,inset -1px 0 0 rgba(255,255,255,.2);box-shadow:0 -3px 0 rgba(0,0,0,.1) inset,inset -1px 0 0 rgba(255,255,255,.2);z-index:2;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-small-options input[type=radio]:checked+label,.imagify-small-options input[type=radio]:not(:checked)+label{padding:8px 10px;font-size:13px;color:#FFF;-webkit-box-shadow:none;box-shadow:none;border-left:0}.imagify-bulk-submit .imagify-inline-options input[type=radio]:checked+label,.imagify-bulk-submit .imagify-inline-options input[type=radio]:not(:checked)+label{margin-bottom:1.75em}.imagify-inline-options input[type=radio]:checked+label:first-of-type,.imagify-inline-options input[type=radio]:not(:checked)+label:first-of-type{border-radius:3px 0 0 3px}.imagify-inline-options input[type=radio]:checked+label:last-of-type,.imagify-inline-options input[type=radio]:not(:checked)+label:last-of-type{border-radius:0 3px 3px 0}.imagify-inline-options input[type=radio]:checked+label{background:#8BC34A}.imagify-small-options input[type=radio]:not(:checked)+label{background:#338EA6;color:rgba(255,255,255,.4)}.imagify-small-options input[type=radio]:checked+label{background:#40B1D0}.imagify-inline-options .imagify-info{margin-top:15px}.imagify-btn-info{display:block;font-size:.7em;letter-spacing:0;line-height:1;text-transform:none}.imagify-datas-more-action a,a.btn-rocket{text-transform:uppercase;text-decoration:none}#describe-resize-larger input{width:5em}.imagify-cols:after{content:"";display:table;clear:both}.imagify-col{float:left;width:50%}.imagify-main{float:left;width:70%}.imagify-sidebar{float:right;width:28%;max-width:300px}.imagify-sidebar-section{border:1px solid #BBB;background:#FFF}.imagify-sidebar-section+.imagify-sidebar-section{margin-top:2em}@media (max-width:820px){.imagify-main,.imagify-sidebar{float:none;width:auto}.imagify-settings{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-sidebar{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;max-width:none;margin-left:0;margin-top:25px}.wp-media-products{text-align:center}.wp-media-products li{display:inline-block;width:100%;max-width:276px}}@media (min-width:1400px){.imagify-main{width:74%}}.imagify-sidebar-title{display:block;padding:20px 15px;border-bottom:1px solid #BBB;font-size:14px;font-weight:700;color:#23282d;background:#F2F5F7}.imagify-sidebar-title img{vertical-align:top;margin-right:5px}.imagify-sidebar .wp-media-products{margin-top:0;margin-bottom:-.5em}.imagify-sidebar .wp-media-products .links{display:block;padding:85px 25px 24px;text-align:center;background-color:#2E3243;background-size:contain;background-repeat:no-repeat;background-position:50% 0;text-decoration:none}.imagify-sidebar .wp-media-products .links p{margin:1.5em auto;color:#FFF}.imagify-sidebar .wp-media-products .wprocket-link{background-image:-o-linear-gradient(top,rgba(59,30,78 ,0),rgba(59,30,78 ,0) 130px,rgba(59 ,30 ,78 ,1) 210px),url(../images/sidebar-wp-rocket.jpg);background-image:linear-gradient(to bottom,rgba(59,30,78 ,0),rgba(59,30,78 ,0) 130px,rgba(59 ,30 ,78 ,1) 210px),url(../images/sidebar-wp-rocket.jpg);background-color:#3B1E4E;background-repeat:repeat-x,no-repeat}.imagify-sidebar-content{padding:10px 20px}.imagify-mark-styled{display:inline-block;padding:1px 2px 1px 4px;line-height:1.3;font-weight:700;background:#F7A933;-webkit-transform-origin:50% 50%;-ms-transform-origin:50% 50%;transform-origin:50% 50%;-webkit-transform:rotateZ(-2deg) rotateX(-10deg) skewX(-2deg) skewY(-3deg);transform:rotateZ(-2deg) rotateX(-10deg) skewX(-2deg) skewY(-3deg);text-shadow:1px 1px 0 rgba(0,0,0,.2)}.imagify-mark-styled span{display:inline-block;-webkit-transform:rotateZ(2deg) rotateX(10deg) skewX(2deg) skewY(3deg);transform:rotateZ(2deg) rotateX(10deg) skewX(2deg) skewY(3deg)}.imagify-discount-code,a.btn-rocket{display:block;text-shadow:1px 1px 0 rgba(0,0,0,.2);font-weight:700}.imagify-discount-code{margin:.35em 0 .5em;font-size:2em;letter-spacing:.05em;text-align:center}.imagify-big-text{font-size:15px;font-weight:700}.imagify-big-text strong{font-size:20px}a.btn-rocket{font-size:1.15em;padding:12px;background:#F7A933;-webkit-box-shadow:0 3px 0 #D69626;box-shadow:0 3px 0 #D69626;border-radius:3px;color:#FFF}a.btn-rocket:focus,a.btn-rocket:hover{background:#ff8c00;-webkit-box-shadow:0 3px 0 #ff8c00;box-shadow:0 3px 0 #ff8c00}.imagify-welcome{margin:30px 20px 0 0}.imagify-welcome .baseline{display:inline-block;margin:.2em 0 0 2em;font-size:17px}.imagify-welcome .imagify-logo{vertical-align:middle}.imagify-welcome-remove{position:absolute;top:50%;right:15px;margin-top:-8px;color:#FFF;text-decoration:none}.imagify-columns{overflow:hidden;padding:15px 0;counter-reset:cols}.imagify-columns [class^=col-]{float:left;-webkit-box-sizing:border-box;box-sizing:border-box}.imagify-columns .col-1-3{width:33.333%;padding-left:28px}.imagify-columns .col-2-3{width:66.666%;padding-left:28px}.imagify-columns .col-1-2{width:50%;padding:0 20px}.imagify-columns .col-overview{padding-left:20px}.imagify-columns .col-informations{width:36.6%;padding-right:30px}.imagify-columns .col-statistics{width:30%}@media (max-width:830px){.imagify-columns [class^=col-]{float:none;margin-bottom:1.5em}.imagify-columns .col-1-2,.imagify-columns .col-1-3{width:auto;padding:0 28px;clear:both;padding-top:1em}}.imagify-columns [class^=col-] img{float:left;margin-right:18px}.imagify-col-content{overflow:hidden}.imagify-col-title{margin:0 0 15px;font-size:23px}.counter .imagify-col-title:before{counter-increment:cols;content:counter(cols) ". ";color:#40B1D0}.imagify-col-desc{color:#5F758E;margin-bottom:2em}.imagify-notice.imagify-notice{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;padding:0;margin:10px 20px 10px 2px;border:0;background:#2E3243;-webkit-box-shadow:none;box-shadow:none;color:#FFF}@media (max-width:782px){.imagify-notice.imagify-notice,.imagify-welcome{margin-right:12px}}@media (max-width:450px){.imagify-notice.imagify-notice{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}}.wrap .imagify-notice{margin:5px 15px 2px;position:relative}.imagify-notice-logo{padding:18px 23px;background:#40B1D0}.updated .imagify-notice-logo{background:#8BC34A}.error .imagify-notice-logo{background:#D0021B}.imagify-popin-message{padding:5px 15px;text-align:left}.imagify-popin-message.imagify-error p{color:#FFF}.imagify-notice-title{font-size:15px}.imagify-notice-content{padding:5px 23px}.imagify-notice-content.imagify-notice-content p{margin:.65em 0}.imagify-notice a{color:#40B1D0}.imagify-notice a:focus,.imagify-notice a:hover{color:#FEE102}.imagify-notice code{background:rgba(0,0,0,.4)}.column-imagify_optimized_file.column-imagify_optimized_file{width:300px;text-align:center;vertical-align:middle}.column-imagify_optimized_file>*{max-width:235px;margin:0 auto}ul.imagify-datas-list.imagify-datas-list{margin:0 auto;color:#555;font-size:10px}@media (min-width:1151px) and (max-width:1800px){.column-imagify_optimized_file.column-imagify_optimized_file{width:235px}}@media (min-width:783px) and (max-width:1150px){.column-imagify_optimized_file.column-imagify_optimized_file{width:13em}table.media .column-title .has-media-icon~.row-actions.row-actions{margin-left:0}}@media (max-width:782px){table.media .column-imagify_optimized_file.column-imagify_optimized_file{text-align:left}table.media .imagify-datas-actions-links,table.media .imagify-datas-more-action{text-align:center}table.media .column-imagify_optimized_file .imagify-datas-actions-links a,table.media .column-imagify_optimized_file>*{max-width:100%;margin-left:0}}@media (min-width:783px) and (max-width:1150px),(max-width:360px){table.media .imagify-hide-if-small{position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip:rect(0 0 0 0);border:0;word-wrap:normal!important}}.compat-field-imagify .label{vertical-align:top}.compat-field-imagify ul.imagify-datas-list{margin-top:7px;font-size:11px}ul.imagify-datas-list .big{font-size:12px;color:#40B1D0}.imagify-data-item{overflow:hidden}.imagify-data-item .imagify-chart{display:inline-block;top:1px;width:20px;vertical-align:middle;margin-bottom:0}li.imagify-data-item{clear:both;margin-bottom:2px}ul.imagify-datas-list .imagify-data-item span.data,ul.imagify-datas-list .imagify-data-item strong{float:left;width:50%;-webkit-box-sizing:border-box;box-sizing:border-box}ul.imagify-datas-list .imagify-data-item span.data{text-align:left;padding-right:5px}.compat-field-imagify .imagify-datas-list .imagify-data-item .data{width:130px;text-align:left;font-weight:700}.media-sidebar .imagify-datas-list .imagify-data-item .data,.media-sidebar .imagify-datas-list .imagify-data-item strong{width:auto;float:none}ul.imagify-datas-list .imagify-data-item strong{text-align:left;padding-left:5px}.imagify-datas-more-action.imagify-datas-more-action{margin:.4em auto;background:-webkit-gradient(linear,left top,left bottom,from(transparent),color-stop(49%,transparent),color-stop(50%,rgba(0,0,0,.075)),color-stop(58%,rgba(0,0,0,.075)),color-stop(58%,transparent),to(transparent));background:-o-linear-gradient(top,transparent,transparent 49%,rgba(0,0,0,.075) 50%,rgba(0,0,0,.075) 58%,transparent 58%,transparent);background:linear-gradient(to bottom,transparent,transparent 49%,rgba(0,0,0,.075) 50%,rgba(0,0,0,.075) 58%,transparent 58%,transparent)}.imagify-datas-more-action a{display:inline-block;padding:0 5px;background:#40B1D0;color:#FFF;font-size:9px;font-weight:700;line-height:1.9}.imagify-datas-more-action a.is-open{background:#555}.imagify-datas-more-action a.is-open .dashicons{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.imagify-datas-more-action a .dashicons{font-size:14px;vertical-align:middle;line-height:.8}.imagify-datas-more-action a .dashicons:before{vertical-align:middle;line-height:20px}.imagify-datas-more-action .the-text{display:inline-block;vertical-align:middle;height:auto;line-height:inherit}ul.imagify-datas-details.imagify-datas-details{margin:.7em auto}.imagify-datas-details strong{color:#40B1D0}.imagify-datas-details .original{color:#555}.imagify-datas-actions-links{overflow:hidden;border-top:2px solid transparent;padding-top:5px;font-size:8px}.imagify-datas-actions-links a{position:relative;display:inline-block;padding-left:17px;text-decoration:none;font-weight:600}.compat-field-imagify .imagify-datas-actions-links{max-width:300px}.misc-pub-imagify .imagify-datas-actions-links{border-top:2px solid #f2f2f2;padding-bottom:5px}.compat-field-imagify .imagify-datas-actions-links a,.misc-pub-imagify .imagify-datas-actions-links a{font-size:10px;float:left;width:50%}.media-sidebar .compat-field-imagify .imagify-datas-actions-links a,.submitbox .misc-pub-imagify .imagify-datas-actions-links a{display:block;width:auto;float:none}.column-imagify_optimized_file .imagify-datas-actions-links a{margin:0 .7em;padding-left:15px}.imagify-datas-actions-links a:only-child{float:none;width:auto}.imagify-datas-details.is-open+.imagify-datas-actions-links{border-top-color:rgba(0,0,0,.075)}.imagify-datas-actions-links .dashicons{position:absolute;left:0;top:4px;width:12px;margin-right:2px;font-size:11px}.imagify-title>h1{padding:0}.imagify-title-right{display:table;float:right;margin-top:-10px}.imagify-title-right p{margin:0}.imagify-title-right a{font-weight:700;text-decoration:none}.imagify-title-right>div{display:table-cell;vertical-align:middle}.imagify-title-right .dashicons-arrow-down-alt2{vertical-align:-4px;margin-left:2px}@media (max-width:1200px){.imagify-bulk .imagify-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-title-right{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;margin-top:20px}}.imagify-account,.imagify-account-link{padding-right:15px}.imagify-sep-v{width:1px;background:rgba(255,255,255,.2)}.imagify-credit-left{position:relative;min-width:280px;padding-left:15px}.imagify-meteo-icon{display:inline-block;height:38px;vertical-align:middle;margin-right:10px}.imagify-user-plan{color:#40b1d0}@media (max-width:630px){.imagify-title-right,.imagify-title-right>div{display:block;width:auto}.imagify-title-right>div{margin-top:10px;max-width:100%}.imagify-credit-left{padding-left:0}}.imagify-meteo-title.imagify-meteo-title{color:#FFF;font-size:17px}.imagify-space-left{display:inline-block;min-height:38px;min-width:245px;vertical-align:middle}.imagify-space-left>p{color:#FFF}#wp-admin-bar-imagify-profile [class^=imagify-bar-],[class^=imagify-bar-]{position:relative;height:1.5em;width:100%;background:#60758D;color:#FFF;font-size:10px}.base-transparent{background:0 0}[class^=imagify-bar-].right-outside-number{-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:4.5em}.right-outside-number .imagify-barnb{display:block;margin-right:-4.5em;text-align:right;font-weight:700;line-height:1.5}#wp-admin-bar-imagify-profile .imagify-progress-value,.imagify-progress-value{position:absolute;top:0;right:0;left:0;bottom:0;text-align:center;line-height:13px;font-weight:700}#wp-admin-bar-imagify-profile .imagify-progress,.imagify-progress{height:1.5em}.imagify-progress{-webkit-transition:width .3s;-o-transition:width .3s;transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8CC152}.imagify-bar-positive .imagify-barnb{color:#8CC152}.imagify-bar-negative .imagify-progress{background:#73818C}.imagify-bar-negative .imagify-barnb{color:#73818C}.imagify-bar-neutral .imagify-progress{background:#F5A623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#D0021B}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p,.imagify-list-infos li+li{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost,.btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:0 0;color:#FFF;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:hover,.btn-ghost:focus,.btn-ghost:hover{background:#FFF;color:#888}.imagify-list-infos{max-width:100%;width:415px}.imagify-info-block,.imagify-list-infos li{position:relative;padding:10px;padding-left:42px;background:#D9E4EB;border-radius:4px;line-height:1.6}.imagify-list-infos .imagify-alt.imagify-alt{background:#8BA7B5;color:#FFF;font-weight:700}.imagify-info-block:before,.imagify-list-infos li:before{content:"";position:absolute;left:13px;top:14px;height:16px;width:16px;border:1px solid #46b1ce;border-radius:10px}.imagify-info-block:after,.imagify-list-infos li:after{content:"i";position:absolute;left:20px;top:13px;font-style:italic;color:#46b1ce}.imagify-cell .imagify-info-block{padding-top:0}.imagify-cell .imagify-info-block:after{top:6px}.imagify-cell .imagify-info-block:before{top:7px}.imagify-list-infos .imagify-alt:after,.imagify-list-infos .imagify-alt:before{color:#fff;border-color:#fff}.imagify-sub-title.imagify-sub-title{font-size:23px;background:#FFF;color:#2E3243;border-left:1px solid #D9D9D9;border-right:1px solid #D9D9D9;font-weight:lighter}.imagify-sub-title .icon-bulk{margin-right:10px;vertical-align:middle}.imagify-sub-title .title-text{display:inline-block;line-height:1;vertical-align:middle}.imagify-bulk .imagify-settings-section{border:1px solid #D9D9D9;border-top:0;background:#F2F5F7;color:#4A4A4A}.imagify-bulk .imagify-settings-section h3,.imagify-bulk .imagify-settings-section li,.imagify-bulk .imagify-settings-section p{color:#4A4A4A}.imagify-bulk .imagify-settings-section h3{margin-bottom:2em}.imagify-title .imagify-tooltips{position:absolute;top:100%;left:0}.imagify-tooltips .icon-round{float:left;display:inline-block;width:28px;height:28px;border:1px solid #FFF;margin-right:8px;margin-bottom:8px;font-size:17px;font-style:italic;line-height:29px;font-weight:700;text-align:center;border-radius:50%}.imagify-tooltips .tooltip-content{display:block;position:relative;max-width:250px;padding:7px 15px 8px;background:#2e3242;color:#FFF;font-size:10px;border-radius:3px}.imagify-tooltips.right .tooltip-content{margin-left:12px}.imagify-tooltips.bottom .tooltip-content{margin-top:4px}.imagify-inline-options label .tooltip-content{position:absolute;left:0;right:0;top:100%;text-transform:none;font-size:10px;letter-spacing:0;text-align:center}.imagify-ac-rt-big,.imagistatus{text-transform:uppercase;font-weight:700}.imagify-tooltips .tooltip-content:after{content:"";position:absolute}.imagify-tooltips.right .tooltip-content:after{top:16px;left:-6px;border-right:8px solid #2e3242;border-top:6px solid transparent;border-bottom:6px solid transparent}.imagify-tooltips.bottom .tooltip-content:after{top:-5px;left:50%;margin-left:-3px;border-bottom:6px solid #2e3242;border-left:6px solid transparent;border-right:6px solid transparent}.imagify-space-tooltips .tooltip-content{max-width:280px;margin-top:20px;margin-left:0;padding:5px 15px;font-size:13px;background:#40B1D0;-webkit-box-shadow:0 3px 0 #338EA6;box-shadow:0 3px 0 #338EA6}.imagify-space-tooltips .tooltip-content:after{top:-14px;left:50%;margin-left:-7px;border:0;border-bottom:15px solid #40B1D0;border-left:15px solid transparent;border-right:15px solid transparent}.tooltip-content.tooltip-table{display:table;width:100%}.tooltip-content.tooltip-table>*{display:table-cell;vertical-align:middle}.tooltip-content .cell-icon{width:28px}.tooltip-content .cell-icon .icon{margin-bottom:0}.tooltip-content .cell-text{padding:5px 10px 5px 0;line-height:1.3}.tooltip-content .cell-sep{width:1px;background:rgba(255,255,255,.4)}.tooltip-content .cell-cta{padding-left:10px}.tooltip-content .cell-cta a{display:block;color:#FFF;width:100%;height:100%;white-space:nowrap}.imagify-number-you-optimized .number{display:table-cell;padding-right:15px;font-size:36px;font-weight:700;line-height:1.1;vertical-align:middle;white-space:nowrap}.imagify-number-you-optimized .text{display:table-cell;vertical-align:middle;overflow:hidden;font-size:12px}.imagify-number-you-optimized .text br{display:none}.imagify-number-you-optimized>p{display:table}.imagify-number-you-optimized{padding-bottom:.85em;margin-bottom:1.35em;overflow:hidden;border-bottom:1px solid rgba(0,0,0,.05)}.imagify-bars p{font-weight:700;font-size:12px;margin-bottom:0}.imagify-bars+.imagify-number-you-optimized{border-bottom:0;padding-top:.85em}.imagify-bars+.imagify-number-you-optimized p{color:#46b1ce}.imagify-bulk-table{margin-top:2em;max-height:600px;max-height:60vh;overflow:auto}.imagify-ac-report-text,.imagiuploaded{overflow:hidden}.imagify-bulk-table table{width:100%;border-spacing:0;border-collapse:collapse;border:1px solid #D3D3D3}.imagify-bulk-table td{padding:8px 15px}.imagify-bulk-table thead th,.imagify-bulk-table thead tr{background:#2E3242}.imagify-bulk-table tfoot th,.imagify-bulk-table tfoot tr{background:#73818C}.imagify-bulk-table thead th{padding:14px 15px;text-align:left;color:#F2F5F7;font-weight:700;font-size:14px}.imagify-bulk-table tfoot td{padding:14px 15px;color:#F9FAFA}.imagify-bulk-table tbody td,.imagify-bulk-table tbody tr{background:#FFF}.imagify-bulk-table tbody tr:nth-child(odd),.imagify-bulk-table tbody tr:nth-child(odd) td{background:#F2F5F7}.imagify-bulk-table .imagify-row-progress{display:none}.imagify-bulk-table .imagify-row-progress,.imagify-bulk-table .imagify-row-progress td{height:15px;padding:0}.imagify-bulk-table .imagify-no-uploaded-yet td{height:200px;font-size:17px;letter-spacing:.1em;word-spacing:.12em;vertical-align:middle;text-transform:uppercase;font-weight:700;text-align:center;color:#999;background-color:#FFF}.imagify-row-complete{padding:35px 20px;margin-top:2em;background:#8BC34A;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.1)}.imagify-row-complete .imagify-ac-chart{margin-top:3px}.imagify-row-complete p{color:#FFF;margin:0}@-webkit-keyframes congrate{0%{opacity:0;-webkit-transform:scale(1)}50%{-webkit-transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);opacity:1}}@keyframes congrate{0%{opacity:0;-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.05);transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}.imagify-row-complete.done{-webkit-animation:congrate .5s ease-in-out;animation:congrate .5s ease-in-out}.imagify-all-complete{margin:1.5em 0}.imagify-all-complete>div{display:inline-block;vertical-align:middle}.imagify-ac-report{min-width:310px}.imagify-ac-chart{width:46px;height:46px;float:left;margin:0 20px 0 10px}.imagify-ac-report-text p{line-height:1.3}.imagify-ac-rt-big{font-size:24px;letter-spacing:.15em;word-spacing:.15em}.imagify-ac-share{text-align:right}.imagify-ac-share-content{display:inline-block;padding:10px 15px;background:rgba(255,255,255,.2)}.imagify-ac-share-content>*{display:inline-block;vertical-align:middle}.imagify-bulk-table .imagify-ac-share-content p{margin-right:5px}.imagify-share-networks,.imagify-share-networks li{margin:0}.imagify-share-networks li{display:inline-block}.imagify-share-networks a{display:inline-block;vertical-align:-7px;margin:0 5px;text-decoration:none;color:#FFF}.imagify-cell-filename{max-width:200px}.imagify-cell-status{max-width:145px}.imagify-cell-status .dashicons-warning{margin-right:2px}.imagify-cell-thumbnails{max-width:120px}td.imagify-cell-filename{-o-text-overflow:clip;text-overflow:clip;white-space:nowrap;overflow:hidden}.imagify-bulk-table td.imagify-cell-totaloriginal{padding-right:78px}.imagifilename,.imagiuploaded{display:inline-block;vertical-align:middle}.imagifilename{font-size:12px}.imagiuploaded{width:33px;height:33px;margin-right:5px;margin-left:-8px;background:url(../images/upload-image.png) no-repeat;background-size:cover}.imagiuploaded img{max-widht:100%;height:auto}.imagistatus{color:#8CA6B3}.status-compressing{color:#46B1CE}.status-error{color:#CE0B24}.status-warning{color:#f5a623}.status-complete{color:#8CC152}.imagify-error{background:#D0021B;color:#FFF}.imagify-settings-section .imagify-error{display:inline-block;padding:7px 10px;margin:10px 0 0 45px;border-radius:3px}.imagify-settings-section .imagify-error code{font-weight:400}.imagify-settings-section .imagify-error.hidden{display:none}#wpadminbar .imagify-warning *,.imagify-warning{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.2)}.imagify-bulk-table .imagify-cell-thumbnails{text-align:center}.imagify-cell-percentage,.imagify-cell-savings{color:#46B1CE;font-weight:700}.imagify-cell-optimized{font-weight:700}.imagify-cell-totaloriginal{text-align:right}.imagify-modal .h2,.imagify-modal .h3{font-weight:400;letter-spacing:.075em;text-align:center}.dashicons.rotate{-webkit-animation:icon-rotate 2.6s infinite linear;animation:icon-rotate 2.6s infinite linear}.dashicons-admin-generic{-webkit-transform-origin:48.75% 51.75%;-ms-transform-origin:48.75% 51.75%;transform-origin:48.75% 51.75%}.imagify-modal{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.js .imagify-modal{display:none;position:fixed;top:0;right:0;bottom:0;left:0;background-color:#1F2332;background-color:rgba(31,35,50,.95);z-index:99999}.imagify-modal-content{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:800px;max-width:95%;max-height:90vw;overflow:auto;padding:20px 25px;margin:1em auto;background:#FFF;-webkit-box-shadow:1px 1px 4px rgba(0,0,0,.7);box-shadow:1px 1px 4px rgba(0,0,0,.7);border-radius:3px}#imagify-visual-comparison .imagify-modal-content,.imagify-visual-comparison .imagify-modal-content{max-width:1400px;background:0 0;padding:5px;-webkit-box-shadow:none;box-shadow:none;border-radius:0}.imagify-modal .h2{margin:.5em 0;color:#8ba6b4;font-size:24px}.imagify-modal .h3{color:#40b1d0;font-size:18px}.text-justify{text-align:justify}.imagify-modal .close-btn{display:none;visibility:hidden;position:absolute;right:20px;top:20px;font-size:1.2em;border:0;background:0 0;border-radius:0;cursor:pointer}.imagify-modal .close-btn i{margin-left:-2px}.imagify-modal .close-btn:focus,.imagify-modal .close-btn:hover{color:#40b1d0}.js .imagify-modal .close-btn{display:block;visibility:visible}.js .imagify-iframe-viewing .close-btn{display:none}#imagify-visual-comparison .close-btn,.imagify-visual-comparison .close-btn{top:50px;right:5px;width:33px;height:33px;padding:1px 0 0 2px;border:1px solid #F2F2F2;color:#F2F2F2;line-height:19px;text-align:center;border-radius:50%}.imagify-visual-comparison .close-btn,.wp_attachment_image #imagify-visual-comparison .close-btn{top:0}.imagify-visual-comparison .imagify-modal-content,.wp_attachment_image #imagify-visual-comparison .imagify-modal-content{padding-top:40px}.imagify-modal .imagify-comparison-title{font-size:28px;margin-bottom:1em;color:#F2F2F2;text-align:left}.imagify-modal .imagify-comparison-title .twentytwenty-duo-buttons{position:static;margin:0 10px 0 15px}.imagify-comparison-title .twentytwenty-duo-buttons button{float:none;padding:6px 12px;font-size:16px;text-transform:none;border:1px solid #40B1D0;color:#889;letter-spacing:0}.imagify-comparison-title .twentytwenty-duo-buttons button:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}.imagify-comparison-title .twentytwenty-duo-buttons .selected{border:1px solid #40B1D0;color:#FFF;background:#40B1D0}.imagify-comparison-levels{margin:15px 0;overflow:hidden}.imagify-comparison-levels div{display:none;min-width:175px;font-size:11px}.imagify-comparison-levels .imagify-chart,.imagify-comparison-levels .imagify-chart-container{width:25px;float:none;margin:0}.imagify-visual-comparison .imagify-chart-container canvas{width:15px!important;height:15px!important;margin-right:5px}.imagify-c-level.go-left{float:left}.imagify-c-level.go-right{float:right}.imagify-c-level.go-left,.imagify-c-level.go-right{display:table}.imagify-c-level .imagify-c-level-row{display:table-row;margin:0;color:#FFF}.imagify-c-level-row>span{display:table-cell;padding:2px 0}.imagify-c-level-row .value{text-align:right;padding-left:5px}.imagify-c-level-row .value.level{color:#40b1d0}.imagify-c-level-row .value.size{color:#8bc34a;font-weight:700}.imagify-c-level-row .value .imagify-chart{top:1px}@-webkit-keyframes icon-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes icon-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.imagify-menu-bar-img{margin-top:1em}.imagify-modal .loader{position:absolute;top:50%;left:50%;margin:-32px 0 0 -32px;opacity:0;visibility:hidden;-webkit-transition:opacity .4s;-o-transition:opacity .4s;transition:opacity .4s}.imagify-modal .loading .loader{visibility:visible;opacity:1}.imagify-settings .imagify-visual-comparison-text{margin-top:1em;color:#40b1d0;font-weight:700}.imagify-border-styled,.imagify-flex-table,.imagify-modal-cols,.imagify-offer-header,.imagify-payment-modal .imagify-modal-content,.imagify-tabs{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.imagify-analyzing .imagify-numbers-calc,.imagify-modal-content.imagify-iframe-viewing .imagify-modal-sidebar,.imagify-modal-content.imagify-success-viewing .imagify-modal-sidebar,.imagify-modal-section .imagify-loader,.imagify-modal-section.imagify-analyzing .imagify-modal-cols,.imagify-numbers-notcalc{display:none}.imagify-border-styled,.imagify-modal-cols{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-payment-modal{text-align:center;color:#7A8996}.imagify-payment-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}.imagify-modal-loader{position:absolute;top:0;left:0;right:0;bottom:0;background:url(../images/loader-balls.svg) center no-repeat #fff;z-index:10}.imagify-payment-modal .imagify-modal-content{width:980px;max-width:100%;min-width:925px;padding:0}.imagify-modal-content.imagify-iframe-viewing{width:980px;height:672px;overflow:hidden}.imagify-iframe-viewing #imagify-payment-process-view{width:980px;height:668px}.imagify-payment-modal .imagify-modal-main{width:70%}.imagify-iframe-viewing .imagify-modal-main{width:auto}.imagify-payment-modal .imagify-modal-content.imagify-success-viewing{min-width:auto;width:450px;min-height:300px}.imagify-success-viewing .imagify-modal-main{width:100%}.imagify-payment-modal .imagify-modal-sidebar{width:30%;padding:15px 20px;background:#1F2332;color:#FFF}.imagify-modal-section{padding:0 25px}.imagify-modal-section.section-gray{margin:0 0 1em;padding:10px 25px 15px;background:#F6F7FB}.imagify-tabs-contents .section-gray{padding:8px 25px 10px}.imagify-modal-section .imagify-modal-title:first-child{margin-top:1em;margin-bottom:1.5em}.imagify-modal-section.section-gray .imagify-modal-title{margin-top:.5em;margin-bottom:.5em}.imagify-modal-title{font-size:1.8em}.imagify-analyzing .imagify-numbers-notcalc,.imagify-modal-section.imagify-analyzing .imagify-loader{display:block}.imagify-modal-section .imagify-loader{margin:2em auto}.imagify-border-styled{width:200px;margin:0 auto;color:#8BC34A;font-weight:700;font-size:.925em}.imagify-big-number,.imagify-payment-modal strong{font-weight:700;color:#4A4A4A}.imagify-big-number{font-size:3.7em;margin:-3px 0;line-height:1}.imagify-border-styled:after,.imagify-border-styled:before{content:"";height:1px;background:rgba(0,0,0,.1);-ms-flex-preferred-size:40px;flex-basis:40px}.imagify-border-styled:before{margin-right:5px}.imagify-border-styled:after{margin-left:5px}.imagify-col{-ms-flex-preferred-size:50%;flex-basis:50%}.imagify-modal .imagify-cols{padding:0 20px}.imagify-payment-modal .imagify-iconed{margin:1.5em 5em 1.5em 0}.imagify-iconed{position:relative;text-align:left;padding-left:42px;margin-right:15px;font-weight:500}.imagify-iconed .dashicons,.imagify-iconed .icon{position:absolute;font-size:2em;left:0;top:2px;color:#40B1D0}.imagify-payment-modal .close-btn{top:10px;right:10px;width:24px;height:24px;padding:2px 0 0 4.5px;color:#FFF;background:#40B1D0;border-radius:50%;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-payment-modal .close-btn i{margin-left:-3.5px;margin-top:-.5px}.imagify-payment-modal .close-btn:hover{background:#F6F7FB}.imagify-offer-line{margin-top:1.5em}.imagify-offer-line+.imagify-offer-line{margin-top:.75em}.imagify-offer-header{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 0 0 15px;border-radius:4px 4px 0 0;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-header.imagify-offer-header.imagify-offer-header .imagify-inline-options label:last-child{border-radius:0 4px 0 0}.imagify-offer-header .imagify-inline-options{width:auto}.imagify-offer-title{font-weight:700;margin:0}.imagify-offer-header,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#E5EBEF}.imagify-offer-onetime .imagify-offer-header{padding-top:8px;padding-bottom:8px}.imagify-offer-onetimes>div{padding-top:15px;padding-bottom:15px}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{position:relative;padding:7px 30px;font-size:1em;letter-spacing:.05em;color:inherit;-webkit-box-shadow:0 0 0;box-shadow:0 0 0;border-radius:0}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#F6F7FB}.imagify-2-free{position:absolute;bottom:100%;left:0;right:0;padding:2px 10px;margin-bottom:8px;font-size:.8em;letter-spacing:0;text-transform:none;text-align:center;color:#FFF;background:#10121A;border-radius:2px}.imagify-2-free:after{content:"";position:absolute;left:50%;bottom:-3px;margin-left:-3px;border-top:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent}.imagify-2-free.imagify-b-right{bottom:auto;left:100%;right:-100%;margin-bottom:0;margin-left:8px}.imagify-2-free.imagify-b-right:after{left:-3px;bottom:auto;top:50%;margin-top:-3px;margin-left:0;border-right:3px solid #10121A;border-top:3px solid transparent;border-bottom:3px solid transparent;border-left:0}.imagify-2-free.imagify-b-bottom{bottom:-100%;left:0;right:0;margin-top:8px}.imagify-2-free.imagify-b-bottom:after{top:-3px;bottom:auto;border-bottom:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent;border-top:0}.imagify-offer-content{text-align:left;background:#F6F7FB;border-radius:0 0 4px 4px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-onetime .imagify-offer-content{padding:10px 0}div.imagify-col-checkbox{position:relative;width:25.5%;padding-top:10px;padding-bottom:7px}.imagify-col-checkbox label{display:block;padding-left:55px!important}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked){position:absolute;top:50%;left:6px;margin:-8px 0 0}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{margin:0;top:-2px;left:6px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-by,.imagify-offer-size{-webkit-transition:all .275s;-o-transition:all .275s}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:after{top:1px;left:13px}.imagify-offer-size{font-size:30px;color:#2E3243;font-weight:700;transition:all .275s}.imagify-offer-by{font-size:10px;transition:all .275s}.imagify-approx{display:none;font-size:11px;line-height:1.2;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}div.imagify-col-price{width:35%}.imagify-flex-table .imagify-price-block{padding-left:0;padding-right:0}.imagify-offer-monthlies .imagify-price-block,.imagify-offer-monthly .imagify-flex-table .imagify-price-block{padding-top:0}.imagify-flex-table .imagify-price-complement{padding-right:0;font-size:10px;font-weight:700}.imagify-price-block,.imagify-price-discount{white-space:nowrap}.imagify-price-block span,.imagify-price-discount span{display:inline-block;vertical-align:middle}.imagify-price-discount.imagify-price-discount{position:relative;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;padding-top:15px;font-weight:700;width:70px}.imagify-price-discount:before{content:"";position:absolute;top:25px;width:62%;height:2px;background:#2E3243;-webkit-transform:rotate(-15deg);-ms-transform:rotate(-15deg);transform:rotate(-15deg)}.imagify-offer-onetimes .imagify-price-discount:before{width:100%}.imagify-price-discount-dollar{color:#2E3243}.imagify-price-discount-number{color:#8BA6B4}.imagify-offer-selected .imagify-price-discount-number{color:#FFF}span.imagify-dollars{color:#1F2332;font-size:18px;font-weight:700;vertical-align:-2px}.imagify-offer-onetime .imagify-col-price{padding-top:0}.imagify-offer-onetime .imagify-dollars{vertical-align:-1px}.imagify-price-big,.imagify-price-mini{color:#40B1D0;font-weight:700}.imagify-price-big{font-size:36px}span.imagify-price-mini{font-size:18px;vertical-align:2px}span.imagify-price-by{font-size:10px;color:#1F2332;vertical-align:-13px;text-indent:-27px}.imagify-col-other-actions{width:18.5%;text-align:right}.imagify-col-other-actions a{font-size:11px}.imagify-offer-selected,.imagify-offer-selected .imagify-col-other-actions a,.imagify-offer-selected .imagify-offer-size,.imagify-offer-selected .imagify-offer-title,.imagify-offer-selected .imagify-price-big,.imagify-offer-selected .imagify-price-complement,.imagify-offer-selected .imagify-price-mini{color:#FFF}.imagify-offer-selected .imagify-offer-header,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#338EA6}.imagify-offer-selected .imagify-offer-content,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#40B1D0}.imagify-offer-selected .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{border-color:#FFF;background:#40B1D0}.imagify-offer-selected .imagify-offer-by{color:#2E3243}.imagify-enough-free .imagify-not-enough-title,.imagify-enough-title{display:none}.imagify-enough-free .imagify-enough-title{display:block}.imagify-submit-line{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:2em 0;text-align:left}.imagify-coupon-section{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-coupon-section p{margin:0;line-height:1.3}.imagify-coupon-text{width:200px;max-width:100%;padding-right:15px}.imagify-coupon-loader{display:none}.imagify-coupon-text.checking{text-align:right}.imagify-coupon-text.checking .imagify-coupon-loader{display:inline}.imagify-coupon-text.checking label{display:none}.imagify-coupon-input{position:relative}.imagify-coupon-input input{position:relative;z-index:1}[id=imagify-coupon-validate].button-secondary{position:absolute;top:1px;right:3px;bottom:2px;-webkit-box-shadow:none;box-shadow:none;padding:4px 10px;z-index:0;-webkit-transition:-webkit-transform .275s;-o-transition:transform .275s;transition:transform .275s;transition:transform .275s,-webkit-transform .275s}.imagify-canbe-validate [id=imagify-coupon-validate]{-webkit-transform:translateX(45px);-ms-transform:translateX(45px);transform:translateX(45px)}.imagify-modal-section+.imagify-modal-promotion{margin-top:-1em}.imagify-modal-promotion{position:relative;overflow:hidden;display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:15px 25px;background:#604D90;text-shadow:0 0 3px rgba(0,0,0,.3)}.imagify-modal-promotion.active{display:-webkit-box;display:-ms-flexbox;display:flex}[id=imagify-pricing-tab-onetime] .imagify-modal-promotion{margin-bottom:4em}.imagify-modal-promotion:before{content:"\f488";position:absolute;top:28px;left:8%;font-family:dashicons;font-size:90px;color:#8476A9;text-shadow:none}.imagify-modal-promotion p{position:relative;margin:.2em 0;color:#FFF}.imagify-promo-title{-ms-flex-preferred-size:100%;flex-basis:100%;text-transform:uppercase;font-size:20px;font-weight:700;letter-spacing:.125em}.imagify-until-date{-ms-flex-preferred-size:200px;flex-basis:200px;text-align:right}.imagify-until-date strong{color:#FFF}.imagify-submit-line button{font-size:16px}input.imagify-coupon-code{padding:10px;border:2px solid #7A8996;font-size:.875em;font-weight:700;border-radius:3px}.validated.imagify-coupon-section .imagify-coupon-text,.validated.imagify-coupon-section strong{color:#8BC34A}.validated.imagify-coupon-section .imagify-coupon-code{color:#8BC34A;border-color:#8BC34A}.invalid.imagify-coupon-section .imagify-coupon-text,.invalid.imagify-coupon-section strong{color:#d0021b}.invalid.imagify-coupon-section .imagify-coupon-code{color:#d0021b;border-color:#d0021b}.imagify-footer-lines{width:500px;max-width:100%;margin:2em auto 2.5em;font-size:.85em;line-height:1.5}.imagify-year-selected .imagify-switch-my .imagify-yearly{display:block}.imagify-month-selected .imagify-switch-my .imagify-yearly,.imagify-year-selected .imagify-switch-my .imagify-monthly{display:none}.imagify-month-selected .imagify-switch-my .imagify-monthly{display:block}.imagify-flex-table{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-flex-table>*{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;padding:7px 15px}div.imagify-col-details{width:22%;padding-left:25px}.imagify-col-details p{margin:0}.imagify-pricing-table{margin:0 20px}.imagify-pricing-table .imagify-offer-line{padding:.6em 0;border:2px solid #E8EEF0;text-align:left;border-radius:3px}.imagify-pricing-table .imagify-offer-line:first-child{margin-top:.75em}.imagify-pricing-table .imagify-offer-line.imagify-offer-selected:first-child{margin-top:1.75em}.imagify-pricing-table .imagify-offer-line+.imagify-offer-line{margin-top:-2px}.imagify-pricing-table .imagify-col-other-actions{width:20.5%}.imagify-pricing-table .imagify-approx{margin-left:0;line-height:.5;margin-bottom:1em}.imagify-pricing-table .imagify-offer-selected{-webkit-transform:scale(1.03);-ms-transform:scale(1.03);transform:scale(1.03);background:#40B1D0;border-width:0}.imagify-pricing-table .imagify-offer-selected .imagify-approx{color:#FFF}.imagify-pricing-table .imagify-button-secondary{padding:3px 20px;-webkit-box-shadow:none;box-shadow:none;text-transform:uppercase;font-size:12px;letter-spacing:.025em}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary{border:2px solid #FFF;background:#40B1D0;-webkit-box-shadow:none;box-shadow:none;text-shadow:none!important}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:focus,.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:hover{background:#FFF;color:#40B1D0}.imagify-col .imagify-special-needs{margin-left:25px}.imagify-special-needs strong{font-size:25px;font-weight:700;color:#40B1D0}.imagify-special-needs span{display:block;font-size:12px;margin-top:-.5em}div.imagify-col-price{position:relative}.imagify-recommend{display:none;position:absolute;left:-20px;bottom:100%;padding:0;margin-bottom:8px;color:#1F2332;font-weight:700;font-style:italic}.imagify-offer-selected .imagify-recommend,.imagify-tab-content.imagify-current{display:block}[class*=imagify-onetime-] .imagify-recommend{left:65px;margin-bottom:20px}.imagify-recommend:before{content:"";position:absolute;top:7px;left:-35px;width:29px;height:30px;background:url(../images/icon-arrow-choice.png) 0 no-repeat;background-size:contain}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/1),only screen and (min-resolution:192dpi),only screen and (min-resolution:2dppx){.imagify-recommend:before{background-image:url(../images/icon-arrow-choice.svg)}}.imagify-offer-line[class*=imagify-onetime-]{padding:0;margin:.3em 0 0}.imagify-offer-line.imagify-offer-line[class*=imagify-onetime-]:first-child{margin-top:2em}.imagify-offer-line[class*=imagify-onetime-]+.imagify-offer-line{margin-top:.5em}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-]{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);border-width:2px}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{position:relative;overflow:hidden;width:21%;background:#1F2332;color:#FFF}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{background:#338EA6}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details:before{content:"";position:absolute;bottom:0;right:25px;width:75px;height:54px;background:url(../images/icon-pack.png)}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-other-actions{width:30%}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx,.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{color:#FFF}.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{font-size:24px}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx{font-size:12px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-block{padding-left:10px}.imagify-offer-line[class*=imagify-onetime-] .imagify-dollars{vertical-align:middle}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-big{vertical-align:-5px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-mini{vertical-align:7px}.imagify-tabs{margin-bottom:0;list-style:none;background:#E5EBEF}.imagify-modal-content .imagify-tabs{margin:1em 0 0}.imagify-tab{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;width:50%;margin:0;font-size:23px}.imagify-tab a{display:block;padding:15px 10px;color:inherit;text-decoration:none}.imagify-tab a:focus{-webkit-box-shadow:none;box-shadow:none;outline:0;color:#40B1D8}.imagify-tab.imagify-current a{background:#F6F7FB}.imagify-tab-content{display:none}.imagify-tab-content .imagify-modal-section:first-child{margin-top:0}.imagify-modal-sidebar-content,.imagify-payment-modal .imagify-modal-sidebar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-modal-sidebar-content{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}p.imagify-modal-sidebar-title{margin-top:5px;padding-right:40px;font-size:18px;color:#FFF}.imagify-modal-testimony{margin-top:1em}.imagify-modal-testimony+.imagify-modal-testimony{margin-top:2em}@media (max-height:620px){.imagify-modal-testimony+.imagify-modal-testimony{display:none}}.imagify-modal-testimony-person{display:table;width:100%}.imagify-modal-testimony-person>*{display:table-cell;vertical-align:middle}.imagify-modal-avatar{width:114px;line-height:0}.imagify-modal-avatar img{border:2px solid #FFF;border-radius:50%;width:96px;height:96px}.imagify-modal-identity a{text-decoration:none;font-weight:700}.imagify-modal-identity a:first-child{font-size:13px}.imagify-modal-identity a:first-child+a{display:block;font-size:10px;color:#7A8996}.imagify-modal-testimony-content p{font-size:13px;font-style:italic;line-height:1.7;color:#7A8996}.imagify-modal-sidebar-trust{margin-top:auto;padding-top:1.5em}.imagify-modal-sidebar-trust p{margin:0;font-weight:700;font-size:12px;line-height:1.7}.imagify-modal-sidebar-trust p img{margin-right:3px;vertical-align:-2px}.imagify-modal-sidebar-trust p+p{font-size:11px}.imagify-cart{text-align:left}.imagify-cart .imagify-cart-list{border-top:1px solid rgba(122,137,150,.2);border-bottom:1px solid rgba(122,137,150,.2)}.imagify-cart .imagify-cart-label{margin-bottom:.5em;font-size:10px;color:#2E3243}.imagify-cart-list p{margin:0;font-weight:700}.imagify-cart-item{margin:.4em 0}.imagify-cart .imagify-cart-suggestion{margin-top:-.3em}.imagify-cart-suggestion a,.imagify-cl-description p{font-size:10px}.imagify-remove-from-cart{border:0;padding:0;width:14px;height:14px;line-height:13px;border-radius:50%;background:#40B1D0;cursor:pointer;-webkit-transition:background .3s;-o-transition:background .3s;transition:background .3s}.imagify-remove-from-cart i:before{position:relative;top:-6px;left:-3px;font-size:13px;color:#FFF}.imagify-remove-from-cart:focus,.imagify-remove-from-cart:hover{background:#D0021B}.imagify-cart .imagify-cl-remove{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:45px}.imagify-cart .imagify-cl-name{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:200px}.imagify-cart .imagify-cl-description{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;padding-top:10px}.imagify-cart .imagify-cl-price{text-align:right}#imagify-payment-iframe{width:980px;height:672px;background:url(../images/loader-balls.svg) 50% 50% no-repeat #f6f7fb}.imagify-success-view{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%}.imagify-success-view p{font-weight:700;font-size:16px}.imagify-cart-emptied-item{margin:.3em auto;padding:6px 20px;background:#E6EBEF;border-radius:20px}.imagify-cart-emptied-item.imagify-cart-emptied-item p{font-weight:700}.imagify-cart-emptied-item a{color:#40b1d0;float:right;font-weight:700}
assets/css/sweetalert2.css CHANGED
@@ -1,141 +1,316 @@
1
- .swal2-overlay {
2
- background-color: rgba(0, 0, 0, 0.4);
 
 
3
  position: fixed;
4
  left: 0;
5
- right: 0;
 
 
 
 
 
 
 
 
 
6
  top: 0;
 
7
  bottom: 0;
8
- display: none;
9
- z-index: 1000; }
 
 
 
 
 
 
 
10
 
11
  .swal2-modal {
12
  background-color: #fff;
13
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
14
  border-radius: 5px;
15
- box-sizing: border-box;
 
16
  text-align: center;
17
- position: fixed;
18
- left: 50%;
19
- top: 50%;
20
- margin-top: -200px;
21
- max-height: 90%;
22
  overflow-x: hidden;
23
  overflow-y: auto;
24
  display: none;
25
- z-index: 2000; }
26
- .swal2-modal.loading {
 
 
 
27
  overflow-y: hidden; }
28
- .swal2-modal h2 {
29
- color: #575757;
30
  font-size: 30px;
31
  text-align: center;
32
  font-weight: 600;
33
  text-transform: none;
34
  position: relative;
35
- margin: 0;
36
  padding: 0;
37
- line-height: 60px;
38
- display: block; }
39
- .swal2-modal hr {
40
- height: 10px;
41
- color: transparent;
42
- border: 0; }
43
- .swal2-modal button.styled {
44
- color: #fff;
45
- border: 0;
46
- box-shadow: none;
47
- font-size: 17px;
48
- font-weight: 500;
49
- border-radius: 3px;
50
- padding: 10px 32px;
51
- margin: 0 5px;
52
- cursor: pointer; }
53
- .swal2-modal button.styled:not(.loading)[disabled] {
54
  opacity: .4;
55
  cursor: no-drop; }
56
- .swal2-modal button.styled.loading {
57
- box-sizing: border-box;
 
58
  border: 4px solid transparent;
59
  border-color: transparent;
60
  width: 40px;
61
  height: 40px;
62
  padding: 0;
63
- margin: -2px 30px;
64
  vertical-align: top;
65
  background-color: transparent !important;
66
  color: transparent;
67
  cursor: default;
68
  border-radius: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  -webkit-animation: rotate-loading 1.5s linear 0s infinite normal;
70
  animation: rotate-loading 1.5s linear 0s infinite normal; }
71
- .swal2-modal button:not(.styled).loading:after {
72
- display: inline-block;
73
- content: "";
74
- margin-left: 5px;
75
- vertical-align: -1px;
76
- height: 6px;
77
- width: 6px;
78
- border: 3px solid #999;
79
- border-right-color: transparent;
80
- border-radius: 50%;
81
- -webkit-animation: rotate-loading 1.5s linear 0s infinite normal;
82
- animation: rotate-loading 1.5s linear 0s infinite normal; }
83
  .swal2-modal .swal2-image {
84
  margin: 20px auto;
85
  max-width: 100%; }
86
  .swal2-modal .swal2-close {
 
 
 
 
 
 
87
  font-size: 36px;
88
- line-height: 36px;
89
  font-family: serif;
90
  position: absolute;
91
  top: 5px;
92
- right: 13px;
93
  cursor: pointer;
94
- color: #cfcfcf;
95
- -webkit-transition: all 0.1s ease;
96
- transition: all 0.1s ease; }
97
  .swal2-modal .swal2-close:hover {
98
  color: #d55; }
99
  .swal2-modal > .swal2-input,
 
100
  .swal2-modal > .swal2-textarea,
101
  .swal2-modal > .swal2-select,
102
  .swal2-modal > .swal2-radio,
103
  .swal2-modal > .swal2-checkbox {
104
  display: none; }
105
-
106
- .swal2-content {
107
- font-size: 18px;
108
- text-align: center;
109
- font-weight: 300;
110
- position: relative;
111
- float: none;
112
- margin: 0;
113
- padding: 0;
114
- line-height: normal;
115
- color: #555; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  .swal2-icon {
118
  width: 80px;
119
  height: 80px;
120
- border: 4px solid #808080;
121
  border-radius: 50%;
122
  margin: 20px auto 30px;
123
  padding: 0;
124
  position: relative;
125
- box-sizing: content-box;
 
126
  cursor: default;
127
- /* http://stackoverflow.com/a/4407335/1331425 */
128
- -webkit-touch-callout: none;
129
  -webkit-user-select: none;
130
- -moz-user-select: none;
131
- -ms-user-select: none;
132
- user-select: none; }
133
  .swal2-icon.swal2-error {
134
  border-color: #f27474; }
135
- .swal2-icon.swal2-error .x-mark {
136
  position: relative;
137
  display: block; }
138
- .swal2-icon.swal2-error .line {
139
  position: absolute;
140
  height: 5px;
141
  width: 47px;
@@ -143,195 +318,134 @@
143
  display: block;
144
  top: 37px;
145
  border-radius: 2px; }
146
- .swal2-icon.swal2-error .line.left {
147
  -webkit-transform: rotate(45deg);
148
  transform: rotate(45deg);
149
  left: 17px; }
150
- .swal2-icon.swal2-error .line.right {
151
  -webkit-transform: rotate(-45deg);
152
  transform: rotate(-45deg);
153
  right: 16px; }
154
  .swal2-icon.swal2-warning {
155
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
156
  color: #f8bb86;
157
- border-color: #f8bb86;
158
  font-size: 60px;
159
  line-height: 80px;
160
  text-align: center; }
161
  .swal2-icon.swal2-info {
162
- font-family: "Open Sans", sans-serif;
163
  color: #3fc3ee;
164
- border-color: #3fc3ee;
165
  font-size: 60px;
166
  line-height: 80px;
167
  text-align: center; }
168
  .swal2-icon.swal2-question {
169
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
170
- color: #c9dae1;
171
  border-color: #c9dae1;
172
  font-size: 60px;
173
  line-height: 80px;
174
  text-align: center; }
175
  .swal2-icon.swal2-success {
176
  border-color: #a5dc86; }
177
- .swal2-icon.swal2-success::before, .swal2-icon.swal2-success::after {
178
- content: '';
179
  border-radius: 50%;
180
  position: absolute;
181
  width: 60px;
182
  height: 120px;
183
- background: #fff;
184
  -webkit-transform: rotate(45deg);
185
  transform: rotate(45deg); }
186
- .swal2-icon.swal2-success::before {
187
- border-radius: 120px 0 0 120px;
188
- top: -7px;
189
- left: -33px;
190
- -webkit-transform: rotate(-45deg);
191
- transform: rotate(-45deg);
192
- -webkit-transform-origin: 60px 60px;
193
- transform-origin: 60px 60px; }
194
- .swal2-icon.swal2-success::after {
195
- border-radius: 0 120px 120px 0;
196
- top: -11px;
197
- left: 30px;
198
- -webkit-transform: rotate(-45deg);
199
- transform: rotate(-45deg);
200
- -webkit-transform-origin: 0 60px;
201
- transform-origin: 0 60px; }
202
- .swal2-icon.swal2-success .placeholder {
203
  width: 80px;
204
  height: 80px;
205
  border: 4px solid rgba(165, 220, 134, 0.2);
206
  border-radius: 50%;
207
- box-sizing: content-box;
 
208
  position: absolute;
209
  left: -4px;
210
  top: -4px;
211
  z-index: 2; }
212
- .swal2-icon.swal2-success .fix {
213
  width: 7px;
214
  height: 90px;
215
- background-color: #fff;
216
  position: absolute;
217
  left: 28px;
218
  top: 8px;
219
  z-index: 1;
220
  -webkit-transform: rotate(-45deg);
221
  transform: rotate(-45deg); }
222
- .swal2-icon.swal2-success .line {
223
  height: 5px;
224
  background-color: #a5dc86;
225
  display: block;
226
  border-radius: 2px;
227
  position: absolute;
228
  z-index: 2; }
229
- .swal2-icon.swal2-success .line.tip {
230
  width: 25px;
231
  left: 14px;
232
  top: 46px;
233
  -webkit-transform: rotate(45deg);
234
  transform: rotate(45deg); }
235
- .swal2-icon.swal2-success .line.long {
236
  width: 47px;
237
  right: 8px;
238
  top: 38px;
239
  -webkit-transform: rotate(-45deg);
240
  transform: rotate(-45deg); }
241
 
242
- .swal2-input,
243
- .swal2-textarea,
244
- .swal2-select,
245
- .swal2-radio,
246
- .swal2-checkbox {
247
- margin: 20px auto; }
248
-
249
- .swal2-input:not([type="file"]), .swal2-textarea {
250
- width: 100%;
251
- box-sizing: border-box;
252
- border-radius: 3px;
253
- border: 1px solid #d7d7d7;
254
- font-size: 18px;
255
- box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.06);
256
- -webkit-transition: all 0.3s;
257
- transition: all 0.3s; }
258
- .swal2-input:not([type="file"]).error, .swal2-textarea.error {
259
- border-color: #f06e57 !important; }
260
- .swal2-input:not([type="file"]):focus, .swal2-textarea:focus {
261
- outline: none;
262
- box-shadow: 0px 0px 3px #c4e6f5;
263
- border: 1px solid #b4dbed; }
264
- .swal2-input:not([type="file"]):focus::-moz-placeholder, .swal2-textarea:focus::-moz-placeholder {
265
- -webkit-transition: opacity 0.3s 0.03s ease;
266
- transition: opacity 0.3s 0.03s ease;
267
- opacity: 0.8; }
268
- .swal2-input:not([type="file"]):focus:-ms-input-placeholder, .swal2-textarea:focus:-ms-input-placeholder {
269
- -webkit-transition: opacity 0.3s 0.03s ease;
270
- transition: opacity 0.3s 0.03s ease;
271
- opacity: 0.8; }
272
- .swal2-input:not([type="file"]):focus::-webkit-input-placeholder, .swal2-textarea:focus::-webkit-input-placeholder {
273
- -webkit-transition: opacity 0.3s 0.03s ease;
274
- transition: opacity 0.3s 0.03s ease;
275
- opacity: 0.8; }
276
- .swal2-input:not([type="file"])::-moz-placeholder, .swal2-textarea::-moz-placeholder {
277
- color: #bdbdbd; }
278
- .swal2-input:not([type="file"]):-ms-input-placeholder, .swal2-textarea:-ms-input-placeholder {
279
- color: #bdbdbd; }
280
- .swal2-input:not([type="file"])::-webkit-input-placeholder, .swal2-textarea::-webkit-input-placeholder {
281
- color: #bdbdbd; }
282
-
283
- .swal2-input:not([type="file"]) {
284
- height: 43px;
285
- padding: 0 12px; }
286
-
287
- .swal2-input[type="file"] {
288
- font-size: 20px; }
289
-
290
- .swal2-textarea {
291
- height: 108px;
292
- padding: 12px; }
293
-
294
- .swal2-select {
295
- color: #555;
296
- font-size: inherit;
297
- padding: 5px 10px;
298
- min-width: 40%;
299
- max-width: 100%; }
300
-
301
- .swal2-radio {
302
- border: 0; }
303
- .swal2-radio label:not(:first-child) {
304
- margin-left: 20px; }
305
- .swal2-radio input, .swal2-radio span {
306
- vertical-align: middle; }
307
- .swal2-radio input {
308
- margin: 0 3px 0 0; }
309
-
310
- .swal2-checkbox {
311
- color: #555; }
312
- .swal2-checkbox input, .swal2-checkbox span {
313
- vertical-align: middle; }
314
-
315
- .swal2-validationerror {
316
- background-color: #f1f1f1;
317
- margin: 0 -20px;
318
- overflow: hidden;
319
- padding: 10px;
320
- color: #797979;
321
- font-size: 16px;
322
- font-weight: 300;
323
- display: none; }
324
- .swal2-validationerror::before {
325
- content: "!";
326
  display: inline-block;
327
- width: 24px;
328
- height: 24px;
329
- border-radius: 50%;
330
- background-color: #ea7d7d;
331
- color: white;
332
- line-height: 24px;
 
333
  text-align: center;
334
- margin-right: 10px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
 
336
  @-webkit-keyframes showSweetAlert {
337
  0% {
@@ -381,17 +495,17 @@
381
  transform: scale(0.5);
382
  opacity: 0; } }
383
 
384
- .show-swal2 {
385
  -webkit-animation: showSweetAlert 0.3s;
386
  animation: showSweetAlert 0.3s; }
387
- .show-swal2.no-animation {
388
  -webkit-animation: none;
389
  animation: none; }
390
 
391
- .hide-swal2 {
392
- -webkit-animation: hideSweetAlert 0.15s;
393
- animation: hideSweetAlert 0.15s; }
394
- .hide-swal2.no-animation {
395
  -webkit-animation: none;
396
  animation: none; }
397
 
@@ -503,15 +617,15 @@
503
  -webkit-transform: rotate(-405deg);
504
  transform: rotate(-405deg); } }
505
 
506
- .animate-success-tip {
507
  -webkit-animation: animate-success-tip 0.75s;
508
  animation: animate-success-tip 0.75s; }
509
 
510
- .animate-success-long {
511
  -webkit-animation: animate-success-long 0.75s;
512
  animation: animate-success-long 0.75s; }
513
 
514
- .swal2-icon.swal2-success.animate::after {
515
  -webkit-animation: rotatePlaceholder 4.25s ease-in;
516
  animation: rotatePlaceholder 4.25s ease-in; }
517
 
@@ -535,7 +649,7 @@
535
  transform: rotateX(0deg);
536
  opacity: 1; } }
537
 
538
- .animate-error-icon {
539
  -webkit-animation: animate-error-icon 0.5s;
540
  animation: animate-error-icon 0.5s; }
541
 
@@ -581,26 +695,10 @@
581
  margin-top: 0;
582
  opacity: 1; } }
583
 
584
- .animate-x-mark {
585
  -webkit-animation: animate-x-mark 0.5s;
586
  animation: animate-x-mark 0.5s; }
587
 
588
- @-webkit-keyframes pulse-warning {
589
- 0% {
590
- border-color: #f8d486; }
591
- 100% {
592
- border-color: #f8bb86; } }
593
-
594
- @keyframes pulse-warning {
595
- 0% {
596
- border-color: #f8d486; }
597
- 100% {
598
- border-color: #f8bb86; } }
599
-
600
- .pulse-warning {
601
- -webkit-animation: pulse-warning 0.75s infinite alternate;
602
- animation: pulse-warning 0.75s infinite alternate; }
603
-
604
  @-webkit-keyframes rotate-loading {
605
  0% {
606
  -webkit-transform: rotate(0deg);
1
+ body.swal2-shown {
2
+ overflow-y: hidden; }
3
+
4
+ body.swal2-iosfix {
5
  position: fixed;
6
  left: 0;
7
+ right: 0; }
8
+
9
+ .swal2-container {
10
+ display: -webkit-box;
11
+ display: -ms-flexbox;
12
+ display: flex;
13
+ -webkit-box-align: center;
14
+ -ms-flex-align: center;
15
+ align-items: center;
16
+ position: fixed;
17
  top: 0;
18
+ left: 0;
19
  bottom: 0;
20
+ right: 0;
21
+ padding: 10px;
22
+ background-color: transparent;
23
+ z-index: 1060; }
24
+ .swal2-container.swal2-fade {
25
+ -webkit-transition: background-color .1s;
26
+ transition: background-color .1s; }
27
+ .swal2-container.swal2-shown {
28
+ background-color: rgba(0, 0, 0, 0.4); }
29
 
30
  .swal2-modal {
31
  background-color: #fff;
32
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
33
  border-radius: 5px;
34
+ -webkit-box-sizing: border-box;
35
+ box-sizing: border-box;
36
  text-align: center;
37
+ margin: auto;
 
 
 
 
38
  overflow-x: hidden;
39
  overflow-y: auto;
40
  display: none;
41
+ position: relative;
42
+ max-width: 100%; }
43
+ .swal2-modal:focus {
44
+ outline: none; }
45
+ .swal2-modal.swal2-loading {
46
  overflow-y: hidden; }
47
+ .swal2-modal .swal2-title {
48
+ color: #595959;
49
  font-size: 30px;
50
  text-align: center;
51
  font-weight: 600;
52
  text-transform: none;
53
  position: relative;
54
+ margin: 0 0 .4em;
55
  padding: 0;
56
+ display: block;
57
+ word-wrap: break-word; }
58
+ .swal2-modal .swal2-buttonswrapper {
59
+ margin-top: 15px; }
60
+ .swal2-modal .swal2-buttonswrapper:not(.swal2-loading) .swal2-styled[disabled] {
 
 
 
 
 
 
 
 
 
 
 
 
61
  opacity: .4;
62
  cursor: no-drop; }
63
+ .swal2-modal .swal2-buttonswrapper.swal2-loading .swal2-styled.swal2-confirm {
64
+ -webkit-box-sizing: border-box;
65
+ box-sizing: border-box;
66
  border: 4px solid transparent;
67
  border-color: transparent;
68
  width: 40px;
69
  height: 40px;
70
  padding: 0;
71
+ margin: 7.5px;
72
  vertical-align: top;
73
  background-color: transparent !important;
74
  color: transparent;
75
  cursor: default;
76
  border-radius: 100%;
77
+ -webkit-animation: rotate-loading 1.5s linear 0s infinite normal;
78
+ animation: rotate-loading 1.5s linear 0s infinite normal;
79
+ -webkit-user-select: none;
80
+ -moz-user-select: none;
81
+ -ms-user-select: none;
82
+ user-select: none; }
83
+ .swal2-modal .swal2-buttonswrapper.swal2-loading .swal2-styled.swal2-cancel {
84
+ margin-left: 30px;
85
+ margin-right: 30px; }
86
+ .swal2-modal .swal2-buttonswrapper.swal2-loading :not(.swal2-styled).swal2-confirm::after {
87
+ display: inline-block;
88
+ content: '';
89
+ margin-left: 5px 0 15px;
90
+ vertical-align: -1px;
91
+ height: 15px;
92
+ width: 15px;
93
+ border: 3px solid #999999;
94
+ -webkit-box-shadow: 1px 1px 1px #fff;
95
+ box-shadow: 1px 1px 1px #fff;
96
+ border-right-color: transparent;
97
+ border-radius: 50%;
98
  -webkit-animation: rotate-loading 1.5s linear 0s infinite normal;
99
  animation: rotate-loading 1.5s linear 0s infinite normal; }
100
+ .swal2-modal .swal2-styled {
101
+ border: 0;
102
+ border-radius: 3px;
103
+ -webkit-box-shadow: none;
104
+ box-shadow: none;
105
+ color: #fff;
106
+ cursor: pointer;
107
+ font-size: 17px;
108
+ font-weight: 500;
109
+ margin: 15px 5px 0;
110
+ padding: 10px 32px; }
 
111
  .swal2-modal .swal2-image {
112
  margin: 20px auto;
113
  max-width: 100%; }
114
  .swal2-modal .swal2-close {
115
+ background: transparent;
116
+ border: 0;
117
+ margin: 0;
118
+ padding: 0;
119
+ width: 38px;
120
+ height: 40px;
121
  font-size: 36px;
122
+ line-height: 40px;
123
  font-family: serif;
124
  position: absolute;
125
  top: 5px;
126
+ right: 8px;
127
  cursor: pointer;
128
+ color: #cccccc;
129
+ -webkit-transition: color .1s ease;
130
+ transition: color .1s ease; }
131
  .swal2-modal .swal2-close:hover {
132
  color: #d55; }
133
  .swal2-modal > .swal2-input,
134
+ .swal2-modal > .swal2-file,
135
  .swal2-modal > .swal2-textarea,
136
  .swal2-modal > .swal2-select,
137
  .swal2-modal > .swal2-radio,
138
  .swal2-modal > .swal2-checkbox {
139
  display: none; }
140
+ .swal2-modal .swal2-content {
141
+ font-size: 18px;
142
+ text-align: center;
143
+ font-weight: 300;
144
+ position: relative;
145
+ float: none;
146
+ margin: 0;
147
+ padding: 0;
148
+ line-height: normal;
149
+ color: #545454;
150
+ word-wrap: break-word; }
151
+ .swal2-modal .swal2-input,
152
+ .swal2-modal .swal2-file,
153
+ .swal2-modal .swal2-textarea,
154
+ .swal2-modal .swal2-select,
155
+ .swal2-modal .swal2-radio,
156
+ .swal2-modal .swal2-checkbox {
157
+ margin: 20px auto; }
158
+ .swal2-modal .swal2-input,
159
+ .swal2-modal .swal2-file,
160
+ .swal2-modal .swal2-textarea {
161
+ width: 100%;
162
+ -webkit-box-sizing: border-box;
163
+ box-sizing: border-box;
164
+ font-size: 18px;
165
+ border-radius: 3px;
166
+ border: 1px solid #d9d9d9;
167
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06);
168
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06);
169
+ -webkit-transition: border-color box-shadow .3s;
170
+ transition: border-color box-shadow .3s; }
171
+ .swal2-modal .swal2-input.swal2-inputerror,
172
+ .swal2-modal .swal2-file.swal2-inputerror,
173
+ .swal2-modal .swal2-textarea.swal2-inputerror {
174
+ border-color: #f27474 !important;
175
+ -webkit-box-shadow: 0 0 2px #f27474 !important;
176
+ box-shadow: 0 0 2px #f27474 !important; }
177
+ .swal2-modal .swal2-input:focus,
178
+ .swal2-modal .swal2-file:focus,
179
+ .swal2-modal .swal2-textarea:focus {
180
+ outline: none;
181
+ border: 1px solid #b4dbed;
182
+ -webkit-box-shadow: 0 0 3px #c4e6f5;
183
+ box-shadow: 0 0 3px #c4e6f5; }
184
+ .swal2-modal .swal2-input:focus::-webkit-input-placeholder,
185
+ .swal2-modal .swal2-file:focus::-webkit-input-placeholder,
186
+ .swal2-modal .swal2-textarea:focus::-webkit-input-placeholder {
187
+ -webkit-transition: opacity .3s .03s ease;
188
+ transition: opacity .3s .03s ease;
189
+ opacity: .8; }
190
+ .swal2-modal .swal2-input:focus:-ms-input-placeholder,
191
+ .swal2-modal .swal2-file:focus:-ms-input-placeholder,
192
+ .swal2-modal .swal2-textarea:focus:-ms-input-placeholder {
193
+ -webkit-transition: opacity .3s .03s ease;
194
+ transition: opacity .3s .03s ease;
195
+ opacity: .8; }
196
+ .swal2-modal .swal2-input:focus::placeholder,
197
+ .swal2-modal .swal2-file:focus::placeholder,
198
+ .swal2-modal .swal2-textarea:focus::placeholder {
199
+ -webkit-transition: opacity .3s .03s ease;
200
+ transition: opacity .3s .03s ease;
201
+ opacity: .8; }
202
+ .swal2-modal .swal2-input::-webkit-input-placeholder,
203
+ .swal2-modal .swal2-file::-webkit-input-placeholder,
204
+ .swal2-modal .swal2-textarea::-webkit-input-placeholder {
205
+ color: #e6e6e6; }
206
+ .swal2-modal .swal2-input:-ms-input-placeholder,
207
+ .swal2-modal .swal2-file:-ms-input-placeholder,
208
+ .swal2-modal .swal2-textarea:-ms-input-placeholder {
209
+ color: #e6e6e6; }
210
+ .swal2-modal .swal2-input::placeholder,
211
+ .swal2-modal .swal2-file::placeholder,
212
+ .swal2-modal .swal2-textarea::placeholder {
213
+ color: #e6e6e6; }
214
+ .swal2-modal .swal2-range input {
215
+ float: left;
216
+ width: 80%; }
217
+ .swal2-modal .swal2-range output {
218
+ float: right;
219
+ width: 20%;
220
+ font-size: 20px;
221
+ font-weight: 600;
222
+ text-align: center; }
223
+ .swal2-modal .swal2-range input,
224
+ .swal2-modal .swal2-range output {
225
+ height: 43px;
226
+ line-height: 43px;
227
+ vertical-align: middle;
228
+ margin: 20px auto;
229
+ padding: 0; }
230
+ .swal2-modal .swal2-input {
231
+ height: 43px;
232
+ padding: 0 12px; }
233
+ .swal2-modal .swal2-input[type='number'] {
234
+ max-width: 150px; }
235
+ .swal2-modal .swal2-file {
236
+ font-size: 20px; }
237
+ .swal2-modal .swal2-textarea {
238
+ height: 108px;
239
+ padding: 12px; }
240
+ .swal2-modal .swal2-select {
241
+ color: #545454;
242
+ font-size: inherit;
243
+ padding: 5px 10px;
244
+ min-width: 40%;
245
+ max-width: 100%; }
246
+ .swal2-modal .swal2-radio {
247
+ border: 0; }
248
+ .swal2-modal .swal2-radio label:not(:first-child) {
249
+ margin-left: 20px; }
250
+ .swal2-modal .swal2-radio input,
251
+ .swal2-modal .swal2-radio span {
252
+ vertical-align: middle; }
253
+ .swal2-modal .swal2-radio input {
254
+ margin: 0 3px 0 0; }
255
+ .swal2-modal .swal2-checkbox {
256
+ color: #545454; }
257
+ .swal2-modal .swal2-checkbox input,
258
+ .swal2-modal .swal2-checkbox span {
259
+ vertical-align: middle; }
260
+ .swal2-modal .swal2-validationerror {
261
+ background-color: #f0f0f0;
262
+ margin: 0 -20px;
263
+ overflow: hidden;
264
+ padding: 10px;
265
+ color: gray;
266
+ font-size: 16px;
267
+ font-weight: 300;
268
+ display: none; }
269
+ .swal2-modal .swal2-validationerror::before {
270
+ content: '!';
271
+ display: inline-block;
272
+ width: 24px;
273
+ height: 24px;
274
+ border-radius: 50%;
275
+ background-color: #ea7d7d;
276
+ color: #fff;
277
+ line-height: 24px;
278
+ text-align: center;
279
+ margin-right: 10px; }
280
+
281
+ @supports (-ms-accelerator: true) {
282
+ .swal2-range input {
283
+ width: 100% !important; }
284
+ .swal2-range output {
285
+ display: none; } }
286
+
287
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
288
+ .swal2-range input {
289
+ width: 100% !important; }
290
+ .swal2-range output {
291
+ display: none; } }
292
 
293
  .swal2-icon {
294
  width: 80px;
295
  height: 80px;
296
+ border: 4px solid transparent;
297
  border-radius: 50%;
298
  margin: 20px auto 30px;
299
  padding: 0;
300
  position: relative;
301
+ -webkit-box-sizing: content-box;
302
+ box-sizing: content-box;
303
  cursor: default;
 
 
304
  -webkit-user-select: none;
305
+ -moz-user-select: none;
306
+ -ms-user-select: none;
307
+ user-select: none; }
308
  .swal2-icon.swal2-error {
309
  border-color: #f27474; }
310
+ .swal2-icon.swal2-error .swal2-x-mark {
311
  position: relative;
312
  display: block; }
313
+ .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
314
  position: absolute;
315
  height: 5px;
316
  width: 47px;
318
  display: block;
319
  top: 37px;
320
  border-radius: 2px; }
321
+ .swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='left'] {
322
  -webkit-transform: rotate(45deg);
323
  transform: rotate(45deg);
324
  left: 17px; }
325
+ .swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='right'] {
326
  -webkit-transform: rotate(-45deg);
327
  transform: rotate(-45deg);
328
  right: 16px; }
329
  .swal2-icon.swal2-warning {
330
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
331
  color: #f8bb86;
332
+ border-color: #facea8;
333
  font-size: 60px;
334
  line-height: 80px;
335
  text-align: center; }
336
  .swal2-icon.swal2-info {
337
+ font-family: 'Open Sans', sans-serif;
338
  color: #3fc3ee;
339
+ border-color: #9de0f6;
340
  font-size: 60px;
341
  line-height: 80px;
342
  text-align: center; }
343
  .swal2-icon.swal2-question {
344
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
345
+ color: #87adbd;
346
  border-color: #c9dae1;
347
  font-size: 60px;
348
  line-height: 80px;
349
  text-align: center; }
350
  .swal2-icon.swal2-success {
351
  border-color: #a5dc86; }
352
+ .swal2-icon.swal2-success [class^='swal2-success-circular-line'] {
 
353
  border-radius: 50%;
354
  position: absolute;
355
  width: 60px;
356
  height: 120px;
 
357
  -webkit-transform: rotate(45deg);
358
  transform: rotate(45deg); }
359
+ .swal2-icon.swal2-success [class^='swal2-success-circular-line'][class$='left'] {
360
+ border-radius: 120px 0 0 120px;
361
+ top: -7px;
362
+ left: -33px;
363
+ -webkit-transform: rotate(-45deg);
364
+ transform: rotate(-45deg);
365
+ -webkit-transform-origin: 60px 60px;
366
+ transform-origin: 60px 60px; }
367
+ .swal2-icon.swal2-success [class^='swal2-success-circular-line'][class$='right'] {
368
+ border-radius: 0 120px 120px 0;
369
+ top: -11px;
370
+ left: 30px;
371
+ -webkit-transform: rotate(-45deg);
372
+ transform: rotate(-45deg);
373
+ -webkit-transform-origin: 0 60px;
374
+ transform-origin: 0 60px; }
375
+ .swal2-icon.swal2-success .swal2-success-ring {
376
  width: 80px;
377
  height: 80px;
378
  border: 4px solid rgba(165, 220, 134, 0.2);
379
  border-radius: 50%;
380
+ -webkit-box-sizing: content-box;
381
+ box-sizing: content-box;
382
  position: absolute;
383
  left: -4px;
384
  top: -4px;
385
  z-index: 2; }
386
+ .swal2-icon.swal2-success .swal2-success-fix {
387
  width: 7px;
388
  height: 90px;
 
389
  position: absolute;
390
  left: 28px;
391
  top: 8px;
392
  z-index: 1;
393
  -webkit-transform: rotate(-45deg);
394
  transform: rotate(-45deg); }
395
+ .swal2-icon.swal2-success [class^='swal2-success-line'] {
396
  height: 5px;
397
  background-color: #a5dc86;
398
  display: block;
399
  border-radius: 2px;
400
  position: absolute;
401
  z-index: 2; }
402
+ .swal2-icon.swal2-success [class^='swal2-success-line'][class$='tip'] {
403
  width: 25px;
404
  left: 14px;
405
  top: 46px;
406
  -webkit-transform: rotate(45deg);
407
  transform: rotate(45deg); }
408
+ .swal2-icon.swal2-success [class^='swal2-success-line'][class$='long'] {
409
  width: 47px;
410
  right: 8px;
411
  top: 38px;
412
  -webkit-transform: rotate(-45deg);
413
  transform: rotate(-45deg); }
414
 
415
+ .swal2-progresssteps {
416
+ font-weight: 600;
417
+ margin: 0 0 20px;
418
+ padding: 0; }
419
+ .swal2-progresssteps li {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  display: inline-block;
421
+ position: relative; }
422
+ .swal2-progresssteps .swal2-progresscircle {
423
+ background: #3085d6;
424
+ border-radius: 2em;
425
+ color: #fff;
426
+ height: 2em;
427
+ line-height: 2em;
428
  text-align: center;
429
+ width: 2em;
430
+ z-index: 20; }
431
+ .swal2-progresssteps .swal2-progresscircle:first-child {
432
+ margin-left: 0; }
433
+ .swal2-progresssteps .swal2-progresscircle:last-child {
434
+ margin-right: 0; }
435
+ .swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep {
436
+ background: #3085d6; }
437
+ .swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep ~ .swal2-progresscircle {
438
+ background: #add8e6; }
439
+ .swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep ~ .swal2-progressline {
440
+ background: #add8e6; }
441
+ .swal2-progresssteps .swal2-progressline {
442
+ background: #3085d6;
443
+ height: .4em;
444
+ margin: 0 -1px;
445
+ z-index: 10; }
446
+
447
+ [class^='swal2'] {
448
+ -webkit-tap-highlight-color: transparent; }
449
 
450
  @-webkit-keyframes showSweetAlert {
451
  0% {
495
  transform: scale(0.5);
496
  opacity: 0; } }
497
 
498
+ .swal2-show {
499
  -webkit-animation: showSweetAlert 0.3s;
500
  animation: showSweetAlert 0.3s; }
501
+ .swal2-show.swal2-noanimation {
502
  -webkit-animation: none;
503
  animation: none; }
504
 
505
+ .swal2-hide {
506
+ -webkit-animation: hideSweetAlert 0.15s forwards;
507
+ animation: hideSweetAlert 0.15s forwards; }
508
+ .swal2-hide.swal2-noanimation {
509
  -webkit-animation: none;
510
  animation: none; }
511
 
617
  -webkit-transform: rotate(-405deg);
618
  transform: rotate(-405deg); } }
619
 
620
+ .swal2-animate-success-line-tip {
621
  -webkit-animation: animate-success-tip 0.75s;
622
  animation: animate-success-tip 0.75s; }
623
 
624
+ .swal2-animate-success-line-long {
625
  -webkit-animation: animate-success-long 0.75s;
626
  animation: animate-success-long 0.75s; }
627
 
628
+ .swal2-success.swal2-animate-success-icon .swal2-success-circular-line-right {
629
  -webkit-animation: rotatePlaceholder 4.25s ease-in;
630
  animation: rotatePlaceholder 4.25s ease-in; }
631
 
649
  transform: rotateX(0deg);
650
  opacity: 1; } }
651
 
652
+ .swal2-animate-error-icon {
653
  -webkit-animation: animate-error-icon 0.5s;
654
  animation: animate-error-icon 0.5s; }
655
 
695
  margin-top: 0;
696
  opacity: 1; } }
697
 
698
+ .swal2-animate-x-mark {
699
  -webkit-animation: animate-x-mark 0.5s;
700
  animation: animate-x-mark 0.5s; }
701
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
702
  @-webkit-keyframes rotate-loading {
703
  0% {
704
  -webkit-transform: rotate(0deg);
assets/css/sweetalert2.min.css CHANGED
@@ -1 +1 @@
1
- .swal2-modal,.swal2-overlay{position:fixed;display:none}.swal2-overlay{background-color:rgba(0,0,0,.4);left:0;right:0;top:0;bottom:0;z-index:1000}.swal2-modal{background-color:#fff;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;border-radius:5px;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:center;left:50%;top:50%;margin-top:-200px;max-height:90%;overflow-x:hidden;overflow-y:auto;z-index:2000}.swal2-modal.loading{overflow-y:hidden}.swal2-modal h2{color:#575757;font-size:30px;text-align:center;font-weight:600;text-transform:none;position:relative;margin:0;padding:0;line-height:60px;display:block}.swal2-modal hr{height:10px;color:transparent;border:0}.swal2-modal button.styled{color:#fff;border:0;-webkit-box-shadow:none;box-shadow:none;font-size:17px;font-weight:500;border-radius:3px;padding:10px 32px;margin:0 5px;cursor:pointer}.swal2-content,.swal2-icon{padding:0;position:relative}.swal2-modal button.styled:not(.loading)[disabled]{opacity:.4;cursor:no-drop}.swal2-modal button.styled.loading{-webkit-box-sizing:border-box;box-sizing:border-box;border:4px solid transparent;border-color:transparent;width:40px;height:40px;padding:0;margin:-2px 30px;vertical-align:top;background-color:transparent!important;color:transparent;cursor:default;border-radius:100%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-modal button:not(.styled).loading:after{display:inline-block;content:"";margin-left:5px;vertical-align:-1px;height:6px;width:6px;border:3px solid #999;border-right-color:transparent;border-radius:50%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-checkbox input,.swal2-checkbox span,.swal2-radio input,.swal2-radio span{vertical-align:middle}.swal2-modal .swal2-image{margin:20px auto;max-width:100%}.swal2-modal .swal2-close{font-size:36px;line-height:36px;font-family:serif;position:absolute;top:5px;right:13px;cursor:pointer;color:#cfcfcf;-webkit-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.swal2-modal .swal2-close:hover{color:#d55}.swal2-modal>.swal2-checkbox,.swal2-modal>.swal2-input,.swal2-modal>.swal2-radio,.swal2-modal>.swal2-select,.swal2-modal>.swal2-textarea{display:none}.swal2-content{font-size:18px;text-align:center;font-weight:300;float:none;margin:0;line-height:normal;color:#555}.swal2-icon.swal2-info,.swal2-icon.swal2-question,.swal2-icon.swal2-warning{font-size:60px;line-height:80px;text-align:center}.swal2-icon{width:80px;height:80px;border:4px solid grey;border-radius:50%;margin:20px auto 30px;-webkit-box-sizing:content-box;box-sizing:content-box;cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .x-mark{position:relative;display:block}.swal2-icon.swal2-error .line{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal2-icon.swal2-error .line.left{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal2-icon.swal2-error .line.right{-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.swal2-icon.swal2-warning{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#f8bb86;border-color:#f8bb86}.swal2-icon.swal2-info{font-family:"Open Sans",sans-serif;color:#3fc3ee;border-color:#3fc3ee}.swal2-icon.swal2-question{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#c9dae1;border-color:#c9dae1}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success::after,.swal2-icon.swal2-success::before{content:'';position:absolute;width:60px;height:120px;background:#fff}.swal2-icon.swal2-success::before{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;-ms-transform-origin:60px 60px;transform-origin:60px 60px}.swal2-icon.swal2-success::after{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;-ms-transform-origin:0 60px;transform-origin:0 60px}.swal2-icon.swal2-success .placeholder{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);border-radius:50%;-webkit-box-sizing:content-box;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal2-icon.swal2-success .fix{width:7px;height:90px;background-color:#fff;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success .line{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal2-icon.swal2-success .line.tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success .line.long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-checkbox,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:20px auto}.swal2-input:not([type=file]),.swal2-textarea{width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:3px;border:1px solid #d7d7d7;font-size:18px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.06);box-shadow:inset 0 1px 1px rgba(0,0,0,.06);-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s}.swal2-input:not([type=file]).error,.swal2-textarea.error{border-color:#f06e57!important}.swal2-input:not([type=file]):focus,.swal2-textarea:focus{outline:0;-webkit-box-shadow:0 0 3px #c4e6f5;box-shadow:0 0 3px #c4e6f5;border:1px solid #b4dbed}.swal2-input:not([type=file]):focus::-moz-placeholder,.swal2-textarea:focus::-moz-placeholder{-webkit-transition:opacity .3s 30ms ease;-o-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus:-ms-input-placeholder,.swal2-textarea:focus:-ms-input-placeholder{-webkit-transition:opacity .3s 30ms ease;-o-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus::-webkit-input-placeholder,.swal2-textarea:focus::-webkit-input-placeholder{-webkit-transition:opacity .3s 30ms ease;-o-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file])::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#bdbdbd}.swal2-input:not([type=file]):-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file])::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file]){height:43px;padding:0 12px}.swal2-input[type=file]{font-size:20px}.swal2-textarea{height:108px;padding:12px}.swal2-select{color:#555;font-size:inherit;padding:5px 10px;min-width:40%;max-width:100%}.swal2-radio{border:0}.swal2-radio label:not(:first-child){margin-left:20px}.swal2-radio input{margin:0 3px 0 0}.swal2-checkbox{color:#555}.swal2-validationerror{background-color:#f1f1f1;margin:0 -20px;overflow:hidden;padding:10px;color:#797979;font-size:16px;font-weight:300;display:none}.swal2-validationerror::before{content:"!";display:inline-block;width:24px;height:24px;border-radius:50%;background-color:#ea7d7d;color:#fff;line-height:24px;text-align:center;margin-right:10px}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}.show-swal2{-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s}.show-swal2.no-animation{-webkit-animation:none;animation:none}.hide-swal2{-webkit-animation:hideSweetAlert .15s;animation:hideSweetAlert .15s}.hide-swal2.no-animation{-webkit-animation:none;animation:none}@-webkit-keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}.animate-success-tip{-webkit-animation:animate-success-tip .75s;animation:animate-success-tip .75s}.animate-success-long{-webkit-animation:animate-success-long .75s;animation:animate-success-long .75s}.swal2-icon.swal2-success.animate::after{-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}@-webkit-keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}.animate-error-icon{-webkit-animation:animate-error-icon .5s;animation:animate-error-icon .5s}@-webkit-keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.animate-x-mark{-webkit-animation:animate-x-mark .5s;animation:animate-x-mark .5s}@-webkit-keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}@keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}.pulse-warning{-webkit-animation:pulse-warning .75s infinite alternate;animation:pulse-warning .75s infinite alternate}@-webkit-keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
1
+ .swal2-container,body.swal2-iosfix{position:fixed;left:0;right:0}body.swal2-shown{overflow-y:hidden}.swal2-container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;top:0;bottom:0;padding:10px;background-color:transparent;z-index:1060}.swal2-container.swal2-fade{-webkit-transition:background-color .1s;-o-transition:background-color .1s;transition:background-color .1s}.swal2-container.swal2-shown{background-color:rgba(0,0,0,.4)}.swal2-modal{background-color:#fff;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;border-radius:5px;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:center;margin:auto;overflow-x:hidden;overflow-y:auto;display:none;position:relative;max-width:100%}.swal2-modal:focus{outline:0}.swal2-modal.swal2-loading{overflow-y:hidden}.swal2-modal .swal2-title{color:#595959;font-size:30px;text-align:center;font-weight:600;text-transform:none;position:relative;margin:0 0 .4em;padding:0;display:block;word-wrap:break-word}.swal2-modal .swal2-buttonswrapper{margin-top:15px}.swal2-modal .swal2-buttonswrapper:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4;cursor:no-drop}.swal2-modal .swal2-buttonswrapper.swal2-loading .swal2-styled.swal2-confirm{-webkit-box-sizing:border-box;box-sizing:border-box;border:4px solid transparent;border-color:transparent;width:40px;height:40px;padding:0;margin:7.5px;vertical-align:top;background-color:transparent!important;color:transparent;cursor:default;border-radius:100%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-modal .swal2-buttonswrapper.swal2-loading .swal2-styled.swal2-cancel{margin-left:30px;margin-right:30px}.swal2-modal .swal2-buttonswrapper.swal2-loading :not(.swal2-styled).swal2-confirm::after{display:inline-block;content:'';margin-left:5px 0 15px;vertical-align:-1px;height:15px;width:15px;border:3px solid #999;-webkit-box-shadow:1px 1px 1px #fff;box-shadow:1px 1px 1px #fff;border-right-color:transparent;border-radius:50%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-modal .swal2-checkbox input,.swal2-modal .swal2-checkbox span,.swal2-modal .swal2-radio input,.swal2-modal .swal2-radio span{vertical-align:middle}.swal2-modal .swal2-styled{border:0;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;color:#fff;cursor:pointer;font-size:17px;font-weight:500;margin:15px 5px 0;padding:10px 32px}.swal2-modal .swal2-image{margin:20px auto;max-width:100%}.swal2-modal .swal2-close{background:0 0;border:0;margin:0;padding:0;width:38px;height:40px;font-size:36px;line-height:40px;font-family:serif;position:absolute;top:5px;right:8px;cursor:pointer;color:#ccc;-webkit-transition:color .1s ease;-o-transition:color .1s ease;transition:color .1s ease}.swal2-modal .swal2-close:hover{color:#d55}.swal2-modal>.swal2-checkbox,.swal2-modal>.swal2-file,.swal2-modal>.swal2-input,.swal2-modal>.swal2-radio,.swal2-modal>.swal2-select,.swal2-modal>.swal2-textarea{display:none}.swal2-modal .swal2-content{font-size:18px;text-align:center;font-weight:300;position:relative;float:none;margin:0;padding:0;line-height:normal;color:#545454;word-wrap:break-word}.swal2-modal .swal2-checkbox,.swal2-modal .swal2-file,.swal2-modal .swal2-input,.swal2-modal .swal2-radio,.swal2-modal .swal2-select,.swal2-modal .swal2-textarea{margin:20px auto}.swal2-modal .swal2-file,.swal2-modal .swal2-input,.swal2-modal .swal2-textarea{width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;font-size:18px;border-radius:3px;border:1px solid #d9d9d9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.06);box-shadow:inset 0 1px 1px rgba(0,0,0,.06);-webkit-transition:border-color box-shadow .3s;-o-transition:border-color box-shadow .3s;transition:border-color box-shadow .3s}.swal2-modal .swal2-file.swal2-inputerror,.swal2-modal .swal2-input.swal2-inputerror,.swal2-modal .swal2-textarea.swal2-inputerror{border-color:#f27474!important;-webkit-box-shadow:0 0 2px #f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-modal .swal2-file:focus,.swal2-modal .swal2-input:focus,.swal2-modal .swal2-textarea:focus{outline:0;border:1px solid #b4dbed;-webkit-box-shadow:0 0 3px #c4e6f5;box-shadow:0 0 3px #c4e6f5}.swal2-modal .swal2-file:focus::-webkit-input-placeholder,.swal2-modal .swal2-input:focus::-webkit-input-placeholder,.swal2-modal .swal2-textarea:focus::-webkit-input-placeholder{-webkit-transition:opacity .3s .03s ease;-o-transition:opacity .3s .03s ease;transition:opacity .3s .03s ease;opacity:.8}.swal2-modal .swal2-file:focus:-ms-input-placeholder,.swal2-modal .swal2-input:focus:-ms-input-placeholder,.swal2-modal .swal2-textarea:focus:-ms-input-placeholder{-webkit-transition:opacity .3s .03s ease;-o-transition:opacity .3s .03s ease;transition:opacity .3s .03s ease;opacity:.8}.swal2-modal .swal2-file:focus::placeholder,.swal2-modal .swal2-input:focus::placeholder,.swal2-modal .swal2-textarea:focus::placeholder{-webkit-transition:opacity .3s .03s ease;-o-transition:opacity .3s .03s ease;transition:opacity .3s .03s ease;opacity:.8}.swal2-modal .swal2-file::-webkit-input-placeholder,.swal2-modal .swal2-input::-webkit-input-placeholder,.swal2-modal .swal2-textarea::-webkit-input-placeholder{color:#e6e6e6}.swal2-modal .swal2-file:-ms-input-placeholder,.swal2-modal .swal2-input:-ms-input-placeholder,.swal2-modal .swal2-textarea:-ms-input-placeholder{color:#e6e6e6}.swal2-modal .swal2-file::placeholder,.swal2-modal .swal2-input::placeholder,.swal2-modal .swal2-textarea::placeholder{color:#e6e6e6}.swal2-modal .swal2-range input{float:left;width:80%}.swal2-modal .swal2-range output{float:right;width:20%;font-size:20px;font-weight:600;text-align:center}.swal2-modal .swal2-range input,.swal2-modal .swal2-range output{height:43px;line-height:43px;vertical-align:middle;margin:20px auto;padding:0}.swal2-modal .swal2-input{height:43px;padding:0 12px}.swal2-modal .swal2-input[type=number]{max-width:150px}.swal2-modal .swal2-file{font-size:20px}.swal2-modal .swal2-textarea{height:108px;padding:12px}.swal2-modal .swal2-select{color:#545454;font-size:inherit;padding:5px 10px;min-width:40%;max-width:100%}.swal2-modal .swal2-radio{border:0}.swal2-modal .swal2-radio label:not(:first-child){margin-left:20px}.swal2-modal .swal2-radio input{margin:0 3px 0 0}.swal2-modal .swal2-checkbox{color:#545454}.swal2-modal .swal2-validationerror{background-color:#f0f0f0;margin:0 -20px;overflow:hidden;padding:10px;color:gray;font-size:16px;font-weight:300;display:none}.swal2-modal .swal2-validationerror::before{content:'!';display:inline-block;width:24px;height:24px;border-radius:50%;background-color:#ea7d7d;color:#fff;line-height:24px;text-align:center;margin-right:10px}.swal2-icon.swal2-info,.swal2-icon.swal2-question,.swal2-icon.swal2-warning{font-size:60px;line-height:80px;text-align:center}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}.swal2-icon{width:80px;height:80px;border:4px solid transparent;border-radius:50%;margin:20px auto 30px;padding:0;position:relative;-webkit-box-sizing:content-box;box-sizing:content-box;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;display:block}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.swal2-icon.swal2-warning{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;color:#f8bb86;border-color:#facea8}.swal2-icon.swal2-info{font-family:'Open Sans',sans-serif;color:#3fc3ee;border-color:#9de0f6}.swal2-icon.swal2-question{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;color:#87adbd;border-color:#c9dae1}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{border-radius:50%;position:absolute;width:60px;height:120px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;-ms-transform-origin:60px 60px;transform-origin:60px 60px}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;-ms-transform-origin:0 60px;transform-origin:0 60px}.swal2-icon.swal2-success .swal2-success-ring{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);border-radius:50%;-webkit-box-sizing:content-box;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal2-icon.swal2-success .swal2-success-fix{width:7px;height:90px;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-progresssteps{font-weight:600;margin:0 0 20px;padding:0}.swal2-progresssteps li{display:inline-block;position:relative}.swal2-progresssteps .swal2-progresscircle{background:#3085d6;border-radius:2em;color:#fff;height:2em;line-height:2em;text-align:center;width:2em;z-index:20}.swal2-progresssteps .swal2-progresscircle:first-child{margin-left:0}.swal2-progresssteps .swal2-progresscircle:last-child{margin-right:0}.swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep{background:#3085d6}.swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep~.swal2-progresscircle,.swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep~.swal2-progressline{background:#add8e6}.swal2-progresssteps .swal2-progressline{background:#3085d6;height:.4em;margin:0 -1px;z-index:10}[class^=swal2]{-webkit-tap-highlight-color:transparent}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}.swal2-show{-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s}.swal2-show.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-hide{-webkit-animation:hideSweetAlert .15s forwards;animation:hideSweetAlert .15s forwards}.swal2-hide.swal2-noanimation{-webkit-animation:none;animation:none}@-webkit-keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}.swal2-animate-success-line-tip{-webkit-animation:animate-success-tip .75s;animation:animate-success-tip .75s}.swal2-animate-success-line-long{-webkit-animation:animate-success-long .75s;animation:animate-success-long .75s}.swal2-success.swal2-animate-success-icon .swal2-success-circular-line-right{-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}@-webkit-keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}.swal2-animate-error-icon{-webkit-animation:animate-error-icon .5s;animation:animate-error-icon .5s}@-webkit-keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.swal2-animate-x-mark{-webkit-animation:animate-x-mark .5s;animation:animate-x-mark .5s}@-webkit-keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
assets/js/admin.js CHANGED
@@ -1,21 +1,19 @@
1
- /* globals ajaxurl: false, console: false, imagify: true, imagifyAdmin: true, swal: false, Promise: false */
2
-
3
  window.imagify = window.imagify || {
4
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
  log: function( content ) {
6
  if ( undefined !== console ) {
7
- console.log( content );
8
  }
9
  },
10
  info: function( content ) {
11
  if ( undefined !== console ) {
12
- console.info( content );
13
  }
14
  }
15
  };
16
 
17
  // Admin bar =======================================================================================
18
- (function($, d, w, undefined) {
19
 
20
  var busy = false;
21
 
@@ -35,18 +33,18 @@ window.imagify = window.imagify || {
35
  }
36
 
37
  $.get( ajaxurl + imagify.concat + 'action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce=' + $( '#imagifygetadminbarprofilenonce' ).val() )
38
- .done( function( response ) {
39
- $adminBarProfile.html( response.data );
40
- $( '#wp-admin-bar-imagify-profile-loading' ).remove();
41
- busy = false;
42
- } );
43
  } );
44
 
45
  } )(jQuery, document, window);
46
 
47
 
48
  // The big welcome notice ==========================================================================
49
- (function($, d, w, undefined) {
50
 
51
  /**
52
  * 1. Create a new Imagify account.
@@ -60,7 +58,6 @@ window.imagify = window.imagify || {
60
  html: imagifyAdmin.labels.signupText,
61
  confirmButtonText: imagifyAdmin.labels.signupConfirmButtonText,
62
  input: 'email',
63
- allowOutsideClick: true,
64
  showLoaderOnConfirm: true,
65
  customClass: 'imagify-sweet-alert imagify-sweet-alert-signup',
66
  inputValidator: function( inputValue ) {
@@ -76,13 +73,13 @@ window.imagify = window.imagify || {
76
  return new Promise( function( resolve, reject ) {
77
  setTimeout( function() {
78
  $.get( ajaxurl + imagify.concat + 'action=imagify_signup&email=' + inputValue + '&imagifysignupnonce=' + $( '#imagifysignupnonce' ).val() )
79
- .done( function( response ) {
80
- if ( ! response.success ) {
81
- reject( response.data );
82
- } else {
83
- resolve();
84
- }
85
- } );
86
  }, 2000 );
87
  } );
88
  },
@@ -108,7 +105,6 @@ window.imagify = window.imagify || {
108
  html: imagifyAdmin.labels.saveApiKeyText,
109
  confirmButtonText: imagifyAdmin.labels.saveApiKeyConfirmButtonText,
110
  input: 'text',
111
- allowOutsideClick: true,
112
  showLoaderOnConfirm: true,
113
  customClass: 'imagify-sweet-alert imagify-sweet-alert-signup',
114
  inputValidator: function( inputValue ) {
@@ -123,13 +119,13 @@ window.imagify = window.imagify || {
123
  preConfirm: function( inputValue ) {
124
  return new Promise( function( resolve, reject ) {
125
  $.get( ajaxurl + imagify.concat + 'action=imagify_check_api_key_validity&api_key=' + inputValue + '&imagifycheckapikeynonce=' + $( '#imagifycheckapikeynonce' ).val() )
126
- .done( function( response ) {
127
- if ( ! response.success ) {
128
- reject( response.data );
129
- } else {
130
- resolve();
131
- }
132
- } );
133
  } );
134
  },
135
  } ).then( function() {
@@ -167,7 +163,7 @@ window.imagify = window.imagify || {
167
 
168
 
169
  // Imagify light modal =============================================================================
170
- (function($, d, w, undefined) {
171
 
172
  var imagifyOpenModal = function( $the_link ) {
173
  var the_target = $the_link.data( 'target' ) || $the_link.attr( 'href' );
@@ -180,45 +176,45 @@ window.imagify = window.imagify || {
180
  $( '.imagify-modal' ).attr( 'aria-hidden', 'true' );
181
 
182
  $( d )
183
- // On click on modal trigger.
184
- .on( 'click.imagify', '.imagify-modal-trigger', function( e ) {
185
- e.preventDefault();
186
- imagifyOpenModal( $( this ) );
187
- } )
188
- // On click on close button.
189
- .on( 'click.imagify', '.imagify-modal .close-btn', function() {
190
- var $modal = $( this ).closest( '.imagify-modal' );
191
-
192
- $modal.fadeOut( 400 ).attr( 'aria-hidden', 'true' ).removeClass( 'modal-is-open' ).trigger( 'modalClosed.imagify' );
193
-
194
- $( 'body' ).removeClass( 'imagify-modal-is-open' );
195
- } )
196
- // On close button blur, improve accessibility.
197
- .on( 'blur.imagify', '.imagify-modal .close-btn', function() {
198
- var $modal = $( this ).closest( '.imagify-modal' );
199
-
200
- if ( $modal.attr( 'aria-hidden' ) === 'false' ) {
201
- $modal.attr( 'tabindex', '0' ).focus().removeAttr( 'tabindex' );
202
- }
203
- } )
204
- // On click on dropped layer of modal.
205
- .on( 'click.imagify', '.imagify-modal', function( e ) {
206
- $( e.target ).filter( '.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' );
207
- } )
208
- // `Esc` key binding.
209
- .on( 'keydown.imagify', function( e ) {
210
- if ( 27 === e.keyCode && $( '.imagify-modal.modal-is-open' ).length > 0 ) {
211
  e.preventDefault();
212
- // Trigger the event.
213
- $( '.imagify-modal.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' );
214
- }
215
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
  } )(jQuery, document, window);
218
 
219
 
220
  // Imagify payment modal ===========================================================================
221
- (function($, d, w, undefined) {
222
 
223
  /**
224
  * Payment Modal.
@@ -268,6 +264,7 @@ window.imagify = window.imagify || {
268
  m = monthly.split( '.' );
269
  y = yearly.split( '.' );
270
  output = '<span class="imagify-switch-my">';
 
271
  output += '<span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly">';
272
  output += '<span class="imagify-price-big">' + m[0] + '</span> ';
273
  output += '<span class="imagify-price-mini">.' + ( m[1].length === 1 ? m[1] + '0' : ( '' + m[1] ).substring( 0, 2 ) ) + '</span>';
@@ -276,6 +273,7 @@ window.imagify = window.imagify || {
276
  output += '<span class="imagify-price-big">' + y[0] + '</span> ';
277
  output += '<span class="imagify-price-mini">.' + ( y[1].length === 1 ? y[1] + '0' : ( '' + y[1] ).substring( 0, 2 ) ) + '</span>';
278
  output += '</span>';
 
279
  output += '</span>';
280
 
281
  return output;
@@ -294,6 +292,7 @@ window.imagify = window.imagify || {
294
  yearly = content.yearly + '';
295
 
296
  output += '<span class="imagify-price-discount">';
 
297
  output += '<span class="imagify-price-discount-dollar">$</span>';
298
  output += '<span class="imagify-switch-my">';
299
  output += '<span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly">';
@@ -303,12 +302,15 @@ window.imagify = window.imagify || {
303
  output += '<span class="imagify-price-discount-number">' + yearly + '</span>';
304
  output += '</span>';
305
  output += '</span>';
 
306
  output += '</span>';
307
  } else {
308
  content += ''; // Be sure content is a string.
309
  output += '<span class="imagify-price-discount">';
 
310
  output += '<span class="imagify-price-discount-dollar">$</span>';
311
  output += '<span class="imagify-price-discount-number">' + content + '</span>';
 
312
  output += '</span>';
313
  }
314
 
@@ -328,7 +330,7 @@ window.imagify = window.imagify || {
328
  mon = datas.monthly_cost, // 4.99 (monthly)
329
  quo = datas.quota, // 1000 (MB) - 5000 images (monthly/onetime)
330
  cos = datas.cost, // 3.49 (onetime)
331
- name = ( quo >= 1000 ? quo/1000 + ' GB' : quo + ' MB' ),
332
  pcs = type === 'monthly' ? { monthly: mon, yearly: Math.round( ann / 12 * 100 ) / 100 } : cos,
333
  pcsd = pcs, // Used if discount is active.
334
  percent, $datas_c, datas_content;
@@ -840,7 +842,9 @@ window.imagify = window.imagify || {
840
  pay_src = $iframe.data( 'src' ),
841
  monthly_id = 0,
842
  onetime_id = 0,
843
- key, rt_onetime, rt_yearly, rt_monthly, coupon, rt_coupon, amount, $iframeClone, tofind;
 
 
844
 
845
  // If we only change monthly/yearly payment mode.
846
  if ( typeof params === 'string' && '' !== iframe_src ) {
@@ -916,14 +920,14 @@ window.imagify = window.imagify || {
916
  * @uses imagifyModal.paymentBack()
917
  * @uses imagifyModal.paymentSuccess()
918
  */
919
- checkPluginMessage: function( event ) {
920
- var origin = event.origin || event.originalEvent.origin;
921
 
922
  if ( 'https://app.imagify.io' !== origin && 'http://dapp.imagify.io' !== origin ) {
923
  return;
924
  }
925
 
926
- switch ( event.data ) {
927
  case 'cancel':
928
  imagifyModal.paymentClose();
929
  break;
@@ -1049,7 +1053,7 @@ window.imagify = window.imagify || {
1049
  is_onetime = $_this.closest( '.imagify-tab-content' ).attr( 'id' ) !== 'imagify-pricing-tab-monthly',
1050
  $target_line = is_onetime ? imagifyModal.$preView.find( '.imagify-offer-onetime' ) : imagifyModal.$preView.find( '.imagify-offer-monthly' ),
1051
  period = is_onetime ? null : ( $_this.closest( '.imagify-pricing-table' ).hasClass( 'imagify-month-selected' ) ? 'monthly' : 'yearly' ),
1052
- price = is_onetime ? imagifyModal.getHtmlPrice( datas[ Object.keys( datas )[0] ].price ) : imagifyModal.getHtmlPrice ( datas[ Object.keys( datas )[0] ].prices, period ),
1053
  monthly_txt = is_onetime ? '' : '<span class="imagify-price-by">' + $offer_line.find( '.imagify-price-by' ).text() + '</span>',
1054
  discount = $offer_line.find( '.imagify-price-discount' ).html(),
1055
  imgs = $offer_line.find( '.imagify-approx-nb' ).text(),
@@ -1152,7 +1156,7 @@ window.imagify = window.imagify || {
1152
  } )(jQuery, document, window);
1153
 
1154
 
1155
- (function($, d, w, undefined) {
1156
 
1157
  /**
1158
  * Tabs.
 
 
1
  window.imagify = window.imagify || {
2
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
3
  log: function( content ) {
4
  if ( undefined !== console ) {
5
+ console.log( content ); // eslint-disable-line no-console
6
  }
7
  },
8
  info: function( content ) {
9
  if ( undefined !== console ) {
10
+ console.info( content ); // eslint-disable-line no-console
11
  }
12
  }
13
  };
14
 
15
  // Admin bar =======================================================================================
16
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
17
 
18
  var busy = false;
19
 
33
  }
34
 
35
  $.get( ajaxurl + imagify.concat + 'action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce=' + $( '#imagifygetadminbarprofilenonce' ).val() )
36
+ .done( function( response ) {
37
+ $adminBarProfile.html( response.data );
38
+ $( '#wp-admin-bar-imagify-profile-loading' ).remove();
39
+ busy = false;
40
+ } );
41
  } );
42
 
43
  } )(jQuery, document, window);
44
 
45
 
46
  // The big welcome notice ==========================================================================
47
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
48
 
49
  /**
50
  * 1. Create a new Imagify account.
58
  html: imagifyAdmin.labels.signupText,
59
  confirmButtonText: imagifyAdmin.labels.signupConfirmButtonText,
60
  input: 'email',
 
61
  showLoaderOnConfirm: true,
62
  customClass: 'imagify-sweet-alert imagify-sweet-alert-signup',
63
  inputValidator: function( inputValue ) {
73
  return new Promise( function( resolve, reject ) {
74
  setTimeout( function() {
75
  $.get( ajaxurl + imagify.concat + 'action=imagify_signup&email=' + inputValue + '&imagifysignupnonce=' + $( '#imagifysignupnonce' ).val() )
76
+ .done( function( response ) {
77
+ if ( ! response.success ) {
78
+ reject( response.data );
79
+ } else {
80
+ resolve();
81
+ }
82
+ } );
83
  }, 2000 );
84
  } );
85
  },
105
  html: imagifyAdmin.labels.saveApiKeyText,
106
  confirmButtonText: imagifyAdmin.labels.saveApiKeyConfirmButtonText,
107
  input: 'text',
 
108
  showLoaderOnConfirm: true,
109
  customClass: 'imagify-sweet-alert imagify-sweet-alert-signup',
110
  inputValidator: function( inputValue ) {
119
  preConfirm: function( inputValue ) {
120
  return new Promise( function( resolve, reject ) {
121
  $.get( ajaxurl + imagify.concat + 'action=imagify_check_api_key_validity&api_key=' + inputValue + '&imagifycheckapikeynonce=' + $( '#imagifycheckapikeynonce' ).val() )
122
+ .done( function( response ) {
123
+ if ( ! response.success ) {
124
+ reject( response.data );
125
+ } else {
126
+ resolve();
127
+ }
128
+ } );
129
  } );
130
  },
131
  } ).then( function() {
163
 
164
 
165
  // Imagify light modal =============================================================================
166
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
167
 
168
  var imagifyOpenModal = function( $the_link ) {
169
  var the_target = $the_link.data( 'target' ) || $the_link.attr( 'href' );
176
  $( '.imagify-modal' ).attr( 'aria-hidden', 'true' );
177
 
178
  $( d )
179
+ // On click on modal trigger.
180
+ .on( 'click.imagify', '.imagify-modal-trigger', function( e ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  e.preventDefault();
182
+ imagifyOpenModal( $( this ) );
183
+ } )
184
+ // On click on close button.
185
+ .on( 'click.imagify', '.imagify-modal .close-btn', function() {
186
+ var $modal = $( this ).closest( '.imagify-modal' );
187
+
188
+ $modal.fadeOut( 400 ).attr( 'aria-hidden', 'true' ).removeClass( 'modal-is-open' ).trigger( 'modalClosed.imagify' );
189
+
190
+ $( 'body' ).removeClass( 'imagify-modal-is-open' );
191
+ } )
192
+ // On close button blur, improve accessibility.
193
+ .on( 'blur.imagify', '.imagify-modal .close-btn', function() {
194
+ var $modal = $( this ).closest( '.imagify-modal' );
195
+
196
+ if ( $modal.attr( 'aria-hidden' ) === 'false' ) {
197
+ $modal.attr( 'tabindex', '0' ).focus().removeAttr( 'tabindex' );
198
+ }
199
+ } )
200
+ // On click on dropped layer of modal.
201
+ .on( 'click.imagify', '.imagify-modal', function( e ) {
202
+ $( e.target ).filter( '.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' );
203
+ } )
204
+ // `Esc` key binding.
205
+ .on( 'keydown.imagify', function( e ) {
206
+ if ( 27 === e.keyCode && $( '.imagify-modal.modal-is-open' ).length > 0 ) {
207
+ e.preventDefault();
208
+ // Trigger the event.
209
+ $( '.imagify-modal.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' );
210
+ }
211
+ } );
212
 
213
  } )(jQuery, document, window);
214
 
215
 
216
  // Imagify payment modal ===========================================================================
217
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
218
 
219
  /**
220
  * Payment Modal.
264
  m = monthly.split( '.' );
265
  y = yearly.split( '.' );
266
  output = '<span class="imagify-switch-my">';
267
+ /* eslint-disable indent */
268
  output += '<span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly">';
269
  output += '<span class="imagify-price-big">' + m[0] + '</span> ';
270
  output += '<span class="imagify-price-mini">.' + ( m[1].length === 1 ? m[1] + '0' : ( '' + m[1] ).substring( 0, 2 ) ) + '</span>';
273
  output += '<span class="imagify-price-big">' + y[0] + '</span> ';
274
  output += '<span class="imagify-price-mini">.' + ( y[1].length === 1 ? y[1] + '0' : ( '' + y[1] ).substring( 0, 2 ) ) + '</span>';
275
  output += '</span>';
276
+ /* eslint-enable indent */
277
  output += '</span>';
278
 
279
  return output;
292
  yearly = content.yearly + '';
293
 
294
  output += '<span class="imagify-price-discount">';
295
+ /* eslint-disable indent */
296
  output += '<span class="imagify-price-discount-dollar">$</span>';
297
  output += '<span class="imagify-switch-my">';
298
  output += '<span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly">';
302
  output += '<span class="imagify-price-discount-number">' + yearly + '</span>';
303
  output += '</span>';
304
  output += '</span>';
305
+ /* eslint-enable indent */
306
  output += '</span>';
307
  } else {
308
  content += ''; // Be sure content is a string.
309
  output += '<span class="imagify-price-discount">';
310
+ /* eslint-disable indent */
311
  output += '<span class="imagify-price-discount-dollar">$</span>';
312
  output += '<span class="imagify-price-discount-number">' + content + '</span>';
313
+ /* eslint-enable indent */
314
  output += '</span>';
315
  }
316
 
330
  mon = datas.monthly_cost, // 4.99 (monthly)
331
  quo = datas.quota, // 1000 (MB) - 5000 images (monthly/onetime)
332
  cos = datas.cost, // 3.49 (onetime)
333
+ name = ( quo >= 1000 ? quo / 1000 + ' GB' : quo + ' MB' ),
334
  pcs = type === 'monthly' ? { monthly: mon, yearly: Math.round( ann / 12 * 100 ) / 100 } : cos,
335
  pcsd = pcs, // Used if discount is active.
336
  percent, $datas_c, datas_content;
842
  pay_src = $iframe.data( 'src' ),
843
  monthly_id = 0,
844
  onetime_id = 0,
845
+ // Stop it ESLint, you're drunk.
846
+ key, amount, // eslint-disable-line no-unused-vars
847
+ rt_onetime, rt_yearly, rt_monthly, coupon, rt_coupon, $iframeClone, tofind;
848
 
849
  // If we only change monthly/yearly payment mode.
850
  if ( typeof params === 'string' && '' !== iframe_src ) {
920
  * @uses imagifyModal.paymentBack()
921
  * @uses imagifyModal.paymentSuccess()
922
  */
923
+ checkPluginMessage: function( e ) {
924
+ var origin = e.origin || e.originalEvent.origin;
925
 
926
  if ( 'https://app.imagify.io' !== origin && 'http://dapp.imagify.io' !== origin ) {
927
  return;
928
  }
929
 
930
+ switch ( e.data ) {
931
  case 'cancel':
932
  imagifyModal.paymentClose();
933
  break;
1053
  is_onetime = $_this.closest( '.imagify-tab-content' ).attr( 'id' ) !== 'imagify-pricing-tab-monthly',
1054
  $target_line = is_onetime ? imagifyModal.$preView.find( '.imagify-offer-onetime' ) : imagifyModal.$preView.find( '.imagify-offer-monthly' ),
1055
  period = is_onetime ? null : ( $_this.closest( '.imagify-pricing-table' ).hasClass( 'imagify-month-selected' ) ? 'monthly' : 'yearly' ),
1056
+ price = is_onetime ? imagifyModal.getHtmlPrice( datas[ Object.keys( datas )[0] ].price ) : imagifyModal.getHtmlPrice( datas[ Object.keys( datas )[0] ].prices, period ),
1057
  monthly_txt = is_onetime ? '' : '<span class="imagify-price-by">' + $offer_line.find( '.imagify-price-by' ).text() + '</span>',
1058
  discount = $offer_line.find( '.imagify-price-discount' ).html(),
1059
  imgs = $offer_line.find( '.imagify-approx-nb' ).text(),
1156
  } )(jQuery, document, window);
1157
 
1158
 
1159
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
1160
 
1161
  /**
1162
  * Tabs.
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){var e=!1;a("#wp-admin-bar-imagify").hover(function(){var b;!0!==e&&(e=!0,b=a("#wp-admin-bar-imagify-profile-content"),b.is(":empty")&&a.get(ajaxurl+imagify.concat+"action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce="+a("#imagifygetadminbarprofilenonce").val()).done(function(c){b.html(c.data),a("#wp-admin-bar-imagify-profile-loading").remove(),e=!1}))})}(jQuery,document,window),function(a,b,c,d){a("#imagify-signup").on("click.imagify",function(b){b.preventDefault(),swal({title:imagifyAdmin.labels.signupTitle,html:imagifyAdmin.labels.signupText,confirmButtonText:imagifyAdmin.labels.signupConfirmButtonText,input:"email",allowOutsideClick:!0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(b){return new Promise(function(c,d){""!==a.trim(b)&&b?c():d(imagifyAdmin.labels.signupErrorEmptyEmail)})},preConfirm:function(b){return new Promise(function(c,d){setTimeout(function(){a.get(ajaxurl+imagify.concat+"action=imagify_signup&email="+b+"&imagifysignupnonce="+a("#imagifysignupnonce").val()).done(function(a){a.success?c():d(a.data)})},2e3)})}}).then(function(){swal({title:imagifyAdmin.labels.signupSuccessTitle,html:imagifyAdmin.labels.signupSuccessText,type:"success",customClass:"imagify-sweet-alert"})})}),a("#imagify-save-api-key").on("click.imagify",function(b){b.preventDefault(),swal({title:imagifyAdmin.labels.saveApiKeyTitle,html:imagifyAdmin.labels.saveApiKeyText,confirmButtonText:imagifyAdmin.labels.saveApiKeyConfirmButtonText,input:"text",allowOutsideClick:!0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(b){return new Promise(function(c,d){""!==a.trim(b)&&b?c():d(imagifyAdmin.labels.ApiKeyErrorEmpty)})},preConfirm:function(b){return new Promise(function(c,d){a.get(ajaxurl+imagify.concat+"action=imagify_check_api_key_validity&api_key="+b+"&imagifycheckapikeynonce="+a("#imagifycheckapikeynonce").val()).done(function(a){a.success?c():d(a.data)})})}}).then(function(){swal({title:imagifyAdmin.labels.ApiKeyCheckSuccessTitle,html:imagifyAdmin.labels.ApiKeyCheckSuccessText,type:"success",customClass:"imagify-sweet-alert"})})}),a(".imagify-notice-dismiss").on("click.imagify",function(b){var c=a(this),d=c.parents(".imagify-welcome, .imagify-notice"),e=c.attr("href");b.preventDefault(),d.fadeTo(100,0,function(){a(this).slideUp(100,function(){a(this).remove()})}),a.get(e.replace("admin-post.php","admin-ajax.php"))})}(jQuery,document,window),function(a,b,c,d){var e=function(b){var c=b.data("target")||b.attr("href");a(c).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open"),a("body").addClass("imagify-modal-is-open")};a(".imagify-modal").attr("aria-hidden","true"),a(b).on("click.imagify",".imagify-modal-trigger",function(b){b.preventDefault(),e(a(this))}).on("click.imagify",".imagify-modal .close-btn",function(){a(this).closest(".imagify-modal").fadeOut(400).attr("aria-hidden","true").removeClass("modal-is-open").trigger("modalClosed.imagify"),a("body").removeClass("imagify-modal-is-open")}).on("blur.imagify",".imagify-modal .close-btn",function(){var b=a(this).closest(".imagify-modal");"false"===b.attr("aria-hidden")&&b.attr("tabindex","0").focus().removeAttr("tabindex")}).on("click.imagify",".imagify-modal",function(b){a(b.target).filter(".modal-is-open").find(".close-btn").trigger("click.imagify")}).on("keydown.imagify",function(b){27===b.keyCode&&a(".imagify-modal.modal-is-open").length>0&&(b.preventDefault(),a(".imagify-modal.modal-is-open").find(".close-btn").trigger("click.imagify"))})}(jQuery,document,window),function(a,b,c,d){var e={};a("#imagify-pricing-modal").length&&(e={$modal:a("#imagify-pricing-modal"),$checkboxes:a(".imagify-offer-line .imagify-checkbox"),$radios:a(".imagify-payment-modal .imagify-radio-line input"),$preView:a("#imagify-pre-checkout-view"),$plansView:a("#imagify-plans-selection-view").hide(),$paymentView:a("#imagify-payment-process-view").hide(),$successView:a("#imagify-success-view").hide(),$anotherBtn:a(".imagify-choose-another-plan"),speedFadeIn:300,getHtmlPrice:function(a,b){var c,d,e,f,g;return b||(b=null),"object"!=typeof a?(a+="",a=a.split("."),a[1]=1===a[1].length?a[1]+"0":(""+a[1]).substring(0,2),g='<span class="imagify-price-big">'+a[0]+"</span> ",g+='<span class="imagify-price-mini">.'+a[1]+"</span>"):(c=a.monthly+"",d=a.yearly+"",e=c.split("."),f=d.split("."),g='<span class="imagify-switch-my">',g+='<span aria-hidden="'+("monthly"===b?"false":"true")+'" class="imagify-monthly">',g+='<span class="imagify-price-big">'+e[0]+"</span> ",g+='<span class="imagify-price-mini">.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+"</span>",g+="</span> ",g+='<span aria-hidden="'+("yearly"===b?"false":"true")+'" class="imagify-yearly">',g+='<span class="imagify-price-big">'+f[0]+"</span> ",g+='<span class="imagify-price-mini">.'+(1===f[1].length?f[1]+"0":(""+f[1]).substring(0,2))+"</span>",g+="</span>",g+="</span>")},getHtmlDiscountPrice:function(a,b){var c,d,e="";return b||(b=null),"object"==typeof a?(c=a.monthly+"",d=a.yearly+"",e+='<span class="imagify-price-discount">',e+='<span class="imagify-price-discount-dollar">$</span>',e+='<span class="imagify-switch-my">',e+='<span aria-hidden="'+("monthly"===b?"false":"true")+'" class="imagify-monthly">',e+='<span class="imagify-price-discount-number">'+c+"</span>",e+="</span>",e+='<span aria-hidden="'+("yearly"===b?"false":"true")+'" class="imagify-yearly">',e+='<span class="imagify-price-discount-number">'+d+"</span>",e+="</span>",e+="</span>",e+="</span>"):(a+="",e+='<span class="imagify-price-discount">',e+='<span class="imagify-price-discount-dollar">$</span>',e+='<span class="imagify-price-discount-number">'+a+"</span>",e+="</span>"),e},populateOffer:function(a,b,d,f){var g,h,i,j=c.imagify_discount_datas,k=b.additional_gb,l=b.annual_cost,m=b.id,n=b.label,o=b.monthly_cost,p=b.quota,q=b.cost,r=p>=1e3?p/1e3+" GB":p+" MB",s="monthly"===d?{monthly:o,yearly:Math.round(l/12*100)/100}:q,t=s;return j.is_active&&"percentage"===j.coupon_type&&"monthly"===d&&(g=(100-j.coupon_value)/100,s="monthly"===d?{monthly:o*g,yearly:Math.round(l*g/12*100)/100}:q*g),void 0!==f&&a.addClass("imagify-"+d+"-"+n+f),a.find(".imagify-offer-size").text(r),a.find(".imagify-number-block").html(e.getHtmlPrice(s,"monthly")),j.is_active&&"percentage"===j.coupon_type&&"monthly"===d&&(a.find(".imagify-price-block").prev(".imagify-price-discount").remove(),a.find(".imagify-price-block").before(e.getHtmlDiscountPrice(t,"monthly"))),a.find(".imagify-approx-nb").text(5*p),"monthly"===d&&a.find(".imagify-price-add-data").text("$"+k),h=a.find(".imagify-payment-btn-select-plan").length?a.find(".imagify-payment-btn-select-plan"):a,i="monthly"===d?'{"'+n+'":{"id":'+m+',"name":"'+r+'","data":'+p+',"dataf":"'+r+'","imgs":'+5*p+',"prices":{"monthly":'+s.monthly+',"yearly":'+s.yearly+',"add":'+k+"}}}":'{"ot'+n+'":{"id":'+m+',"name":"'+r+'","data":'+p+',"dataf":"'+r+'","imgs":'+5*p+',"price":'+s+"}}",h.attr("data-offer",i),a},populatePayBtn:function(){var b=JSON.parse(a(".imagify-offer-monthly").attr("data-offer")),c=JSON.parse(a(".imagify-offer-onetime").attr("data-offer")),d=0,e=0,f=0;a(".imagify-offer-monthly").hasClass("imagify-offer-selected")&&(e=a("#imagify-subscription-monthly").filter(":checked").length?b[Object.keys(b)[0]].prices.monthly:12*b[Object.keys(b)[0]].prices.yearly),a(".imagify-offer-onetime").hasClass("imagify-offer-selected")&&(f=c[Object.keys(c)[0]].price),d=parseFloat(f+e).toFixed(2),"0.00"===d||0===d?a("#imagify-modal-checkout-btn").attr("disabled","disabled").addClass("imagify-button-disabled"):a("#imagify-modal-checkout-btn").removeAttr("disabled").removeClass("imagify-button-disabled")},checkCoupon:function(){var b,c,d,e,f=a("#imagify-coupon-code").val();""!==f&&(b=a(".imagify-coupon-text"),c=b.find("label"),d=a(".imagify-coupon-section"),e=a("#imagify-get-pricing-modal").data("nonce"),b.addClass("checking"),a.post(ajaxurl,{action:"imagify_check_coupon",coupon:f,imagifynonce:e},function(a){var e;b.removeClass("checking"),a.success?a.data.success?(e="percentage"===a.data.coupon_type?a.data.value+"%":"$"+a.data.value,d.removeClass("invalid").addClass("validated"),c.html(imagifyAdmin.labels.successCouponAPI),c.find(".imagify-coupon-offer").text(e),c.find(".imagify-coupon-word").text(f)):(d.removeClass("validated").addClass("invalid"),c.text(a.data.detail)):(d.removeClass("validated").addClass("invalid"),c.text(imagifyAdmin.labels.errorCouponAPI))}))},getPricing:function(b){var d=b.data("nonce"),f={action:"imagify_get_prices",imagifynonce:d},g={action:"imagify_get_images_counts",imagifynonce:d},h={action:"imagify_get_discount",imagifynonce:d};e.$modal.find(".imagify-modal-loader").hide().show(),a.post(ajaxurl,f,function(b){if(!b.success)return void e.populatePayBtn();a.post(ajaxurl,g,function(d){d.success&&a.post(ajaxurl,h,function(f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C="",D="",E=!1,F=!1;if(f.success){if(g=d.data,h=b.data,i=f.data,j=h.monthlies,k=h.onetimes,l=Math.round(g.average_month_size.raw/1e6),m=Math.round(g.total_library_size.raw/1e6),n=a("#imagify-offer-monthly-template"),o=a("#imagify-offer-onetime-template"),p=o.html(),q=n.html(),r=a(".imagify-estimation-block"),r.removeClass("imagify-analyzing"),r.find(".average-month-size").text(g.average_month_size.human),r.find(".total-library-size").text(g.total_library_size.human),l<25&&m<25?(a(".imagify-pre-checkout-offers .imagify-modal-title").addClass("imagify-enough-free"),a(".imagify-offer-selected").removeClass("imagify-offer-selected").find(".imagify-checkbox").removeAttr("checked")):(a(".imagify-enough-free").removeClass("imagify-enough-free"),a(".imagify-offer-selected").addClass("imagify-offer-selected").find(".imagify-checkbox").attr("checked","checked")),null===j||null===k)return s=a(".imagify-pre-checkout-offers"),s.hide().attr("aria-hidden",!0),s.closest(".imagify-modal-views").find(".imagify-popin-message").remove(),s.after('<div class="imagify-popin-message imagify-error"><p>'+imagifyAdmin.labels.errorPriceAPI+"</p></div>"),void e.$modal.find(".imagify-modal-loader").fadeOut(300);if(c.imagify_discount_datas=i,i.is_active&&(t=a(".imagify-modal-promotion"),u=i.date_end.split("T")[0],v=i.coupon_value,w="percentage"===i.coupon_type?v+"%":"$"+v,a("#imagify-coupon-code").val(i.label).attr("readonly",!0),t.addClass("active").attr("aria-hidden","false"),t.find(".imagify-promotion-number").text(w),t.find(".imagify-promotion-date").text(u),e.checkCoupon()),a.each(j,function(b,c){var d,f,g="";return"free"===c.label||(d=a(q).clone(),!1!==F&&b-F>2||(l<c.quota&&!1===F&&(g=" imagify-offer-selected",F=b,f=a(".imagify-pre-checkout-offers").find(".imagify-offer-monthly"),e.populateOffer(f,c,"monthly")),d=e.populateOffer(d,c,"monthly",g),void(D+=d[0].outerHTML)))}),x=a(D).filter(".imagify-offer-selected").prevAll(),x.length>1){for(y=x.length-1,z=a(D),A=0;A<y;A++)delete z[A];for(D="",B=0;B<z.length;B++)D+=a("<div/>").append(z[B]).html()}a.each(k,function(b,c){var d,f=a(p).clone(),g=a(".imagify-pre-checkout-offers").find(".imagify-offer-onetime"),h="";m<c.quota&&!1===E&&(h=" imagify-offer-selected",E=!0,e.populateOffer(g,c,"onetime")),k.length-1===b&&!1===E&&(d=k[k.length-1],e.populateOffer(g,d,"onetime")),f=e.populateOffer(f,c,"onetime",h),C+=f[0].outerHTML}),n.parent().find(".imagify-offer-line")&&n.parent().find(".imagify-offer-line").remove(),n.before(D),o.parent().find(".imagify-offer-line")&&o.parent().find(".imagify-offer-line").remove(),o.before(C),e.$modal.find(".imagify-modal-loader").fadeOut(300)}})}),e.populatePayBtn()})},checkCheckbox:function(b){b.each(function(){var b=a(this);b.is(":checked")?b.closest(".imagify-offer-line").addClass("imagify-offer-selected"):b.closest(".imagify-offer-line").removeClass("imagify-offer-selected")}),e.populatePayBtn()},checkRadio:function(b){return b.each(function(){var b,c,d=a(this);b=d.parent(".imagify-cart-list-switcher").length?d.closest(".imagify-cart"):d.parent(".imagify-small-options").length?d.parent(".imagify-small-options").next(".imagify-pricing-table"):d.closest(".imagify-offer-line"),c=b.find(".imagify-switch-my"),"yearly"===d.val()?(b.addClass("imagify-year-selected").removeClass("imagify-month-selected"),c.find(".imagify-monthly").attr("aria-hidden","true"),c.find(".imagify-yearly").attr("aria-hidden","false")):(b.addClass("imagify-month-selected").removeClass("imagify-year-selected"),c.find(".imagify-monthly").attr("aria-hidden","false"),c.find(".imagify-yearly").attr("aria-hidden","true"))}),e.populatePayBtn(),b},populateBtnPrice:setInterval(function(){e.populatePayBtn()},1e3),getPeriod:function(){return a(".imagify-offer-monthly").hasClass("imagify-month-selected")?"monthly":"yearly"},getApiKey:function(){return a("#imagify-payment-iframe").data("imagify-api")},switchToView:function(a,b){var c=a.attr("id"),d=e.$modal.children(".imagify-modal-content");a.siblings(".imagify-modal-views").hide().attr("aria-hidden","true"),b&&b.tab&&a.find('a[href="#'+b.tab+'"]').trigger("click.imagify"),"imagify-payment-process-view"===c?d.addClass("imagify-iframe-viewing"):d.removeClass("imagify-iframe-viewing"),"imagify-success-view"===c?(d.addClass("imagify-success-viewing"),e.$modal.attr("aria-labelledby","imagify-success-view")):(d.removeClass("imagify-success-viewing"),e.$modal.removeAttr("aria-labelledby")),a.fadeIn(e.speedFadeIn).attr("aria-hidden","false")},iframeSetSrc:function(b){var c,d,f,g,h,i,j,k=a("#imagify-payment-iframe"),l=k.attr("src"),m=k.data("src"),n=0,o=0;if("string"==typeof b&&""!==l)return j="monthly"===b?"yearly":"monthly",l=l.replace(j,b),void k.attr("src",l);if("object"==typeof b){if(b.monthly&&(n=b.monthly[Object.keys(b.monthly)[0]].id),b.onetime&&(o=b.onetime[Object.keys(b.onetime)[0]].id,o=o+""=="999"?b.onetime[Object.keys(b.onetime)[0]].data:o),!b.period)return void imagify.info("No period defined");e.getApiKey(),c=o,d="yearly"===b.period?n:0,f="monthly"===b.period?n:0,g=a("#imagify-coupon-code").val(),h=""===g?"none":g,parseFloat(a(".imagify-global-amount").text()).toFixed(2),m=m+c+"/"+f+"/"+d+"/"+h+"/",i=k.remove().attr("src",m),e.$paymentView.html(i)}},paymentClose:function(){a(".imagify-iframe-viewing .close-btn").trigger("click.imagify"),a(".imagify-iframe-viewing").removeClass("imagify-iframe-viewing")},paymentBack:function(){e.switchToView(e.$preView)},paymentSuccess:function(){e.switchToView(e.$successView)},checkPluginMessage:function(a){var b=a.origin||a.originalEvent.origin;if("https://app.imagify.io"===b||"http://dapp.imagify.io"===b)switch(a.data){case"cancel":e.paymentClose();break;case"back":e.paymentBack();break;case"success":e.paymentSuccess()}}},e.checkCheckbox(e.$checkboxes),e.checkRadio(e.$radios.filter(":checked")),e.checkCoupon(),e.$checkboxes.on("change.imagify",function(){e.checkCheckbox(a(this))}),e.$radios.on("change.imagify",function(){e.checkRadio(a(this))}),a("#imagify-get-pricing-modal").on("click.imagify-ajax",function(){e.getPricing(a(this))}),a(b).on("modalClosed.imagify",".imagify-payment-modal",function(){a(this).find(".imagify-modal-content").removeClass("imagify-success-viewing imagify-iframe-viewing"),setTimeout(function(){a(".imagify-modal-views").hide(),a("#imagify-pre-checkout-view").show()},300)}),a("#imagify-coupon-code").on("blur.imagify",function(){a(this).attr("readonly")||e.checkCoupon()}).on("keydown.imagify",function(b){var c=a(this);if(!c.attr("readonly"))return 13===b.keyCode||32===b.keyCode?(e.checkCoupon(),!1):void(c.val().length>=3?c.closest(".imagify-coupon-input").addClass("imagify-canbe-validate"):c.closest(".imagify-coupon-input").removeClass("imagify-canbe-validate"))}),a("#imagify-coupon-validate").on("click.imagify",function(){e.checkCoupon(),a(this).closest(".imagify-canbe-validate").removeClass("imagify-canbe-validate")}),e.$anotherBtn.on("click.imagify",function(b){var c=a(this).data("imagify-choose"),d="imagify-pricing-tab-"+("plan"===c?"monthly":"onetime");b.preventDefault(),e.switchToView(e.$plansView,{tab:d})}),e.$modal.on("click.imagify",".imagify-payment-btn-select-plan",function(b){var c=a(this),d=c.closest(".imagify-offer-line"),f=c.data("offer"),g=c.attr("data-offer"),h="imagify-pricing-tab-monthly"!==c.closest(".imagify-tab-content").attr("id"),i=h?e.$preView.find(".imagify-offer-onetime"):e.$preView.find(".imagify-offer-monthly"),j=h?null:c.closest(".imagify-pricing-table").hasClass("imagify-month-selected")?"monthly":"yearly",k=h?e.getHtmlPrice(f[Object.keys(f)[0]].price):e.getHtmlPrice(f[Object.keys(f)[0]].prices,j),l=h?"":'<span class="imagify-price-by">'+d.find(".imagify-price-by").text()+"</span>",m=d.find(".imagify-price-discount").html(),n=d.find(".imagify-approx-nb").text(),o=d.find(".imagify-offer-size").text();b.preventDefault(),e.switchToView(e.$preView),i.find(".imagify-number-block").html(k+l),i.find(".imagify-price-discount").html(m),i.find(".imagify-approx-nb").text(n),i.find(".imagify-offer-size").text(o),i.attr("data-offer",g),h||(i.find(".imagify-price-add-data").text(d.find(".imagify-price-add-data").text()),"monthly"===j?i.find("#imagify-subscription-monthly").trigger("click.imagify"):i.find("#imagify-subscription-yearly").trigger("click.imagify"),i.find(".imagify-inline-options").find("input:radio:checked").trigger("change.imagify")),e.populatePayBtn()}),a("#imagify-modal-checkout-btn").on("click.imagify",function(b){var c,d,f;b.preventDefault(),a(this).hasClass("imagify-button-disabled")||(c=a(".imagify-offer-monthly"),d=a(".imagify-offer-onetime"),f={},c.hasClass("imagify-offer-selected")&&(f.monthly=JSON.parse(c.attr("data-offer"))),d.hasClass("imagify-offer-selected")&&(f.onetime=JSON.parse(d.attr("data-offer"))),e.switchToView(e.$paymentView),f.period=e.getPeriod(),e.iframeSetSrc(f))}),a(".imagify-back-to-plans").on("click.imagify",function(b){var c=a(this),d=c.closest(".imagify-cart-item").hasClass("imagify-cart-item-onetime");b.preventDefault(),d?a(".imagify-offer-onetime").find(".imagify-choose-another-plan").trigger("click.imagify"):a(".imagify-offer-monthly").find(".imagify-choose-another-plan").trigger("click.imagify")}),c.addEventListener("message",e.checkPluginMessage,!0))}(jQuery,document,window),function(a,b,c,d){a(".imagify-tab").on("click.imagify",function(b){var c,d=a(this);b.preventDefault(),d.hasClass("imagify-current")||(c=d.find("a").attr("href")||"#"+d.find("a").attr("aria-controls"),d.closest(".imagify-tabs").next(".imagify-tabs-contents").find(".imagify-tab-content").hide().attr("aria-hidden","true"),a(c).fadeIn(275).attr("aria-hidden","false"),d.closest(".imagify-tabs").find(".imagify-tab").removeClass("imagify-current").attr("aria-selected","false"),d.addClass("imagify-current").attr("aria-selected","true"))})}(jQuery,document,window);
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){var e=!1;a("#wp-admin-bar-imagify").hover(function(){var b;!0!==e&&(e=!0,b=a("#wp-admin-bar-imagify-profile-content"),b.is(":empty")&&a.get(ajaxurl+imagify.concat+"action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce="+a("#imagifygetadminbarprofilenonce").val()).done(function(c){b.html(c.data),a("#wp-admin-bar-imagify-profile-loading").remove(),e=!1}))})}(jQuery,document,window),function(a,b,c,d){a("#imagify-signup").on("click.imagify",function(b){b.preventDefault(),swal({title:imagifyAdmin.labels.signupTitle,html:imagifyAdmin.labels.signupText,confirmButtonText:imagifyAdmin.labels.signupConfirmButtonText,input:"email",showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(b){return new Promise(function(c,d){""!==a.trim(b)&&b?c():d(imagifyAdmin.labels.signupErrorEmptyEmail)})},preConfirm:function(b){return new Promise(function(c,d){setTimeout(function(){a.get(ajaxurl+imagify.concat+"action=imagify_signup&email="+b+"&imagifysignupnonce="+a("#imagifysignupnonce").val()).done(function(a){a.success?c():d(a.data)})},2e3)})}}).then(function(){swal({title:imagifyAdmin.labels.signupSuccessTitle,html:imagifyAdmin.labels.signupSuccessText,type:"success",customClass:"imagify-sweet-alert"})})}),a("#imagify-save-api-key").on("click.imagify",function(b){b.preventDefault(),swal({title:imagifyAdmin.labels.saveApiKeyTitle,html:imagifyAdmin.labels.saveApiKeyText,confirmButtonText:imagifyAdmin.labels.saveApiKeyConfirmButtonText,input:"text",showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(b){return new Promise(function(c,d){""!==a.trim(b)&&b?c():d(imagifyAdmin.labels.ApiKeyErrorEmpty)})},preConfirm:function(b){return new Promise(function(c,d){a.get(ajaxurl+imagify.concat+"action=imagify_check_api_key_validity&api_key="+b+"&imagifycheckapikeynonce="+a("#imagifycheckapikeynonce").val()).done(function(a){a.success?c():d(a.data)})})}}).then(function(){swal({title:imagifyAdmin.labels.ApiKeyCheckSuccessTitle,html:imagifyAdmin.labels.ApiKeyCheckSuccessText,type:"success",customClass:"imagify-sweet-alert"})})}),a(".imagify-notice-dismiss").on("click.imagify",function(b){var c=a(this),d=c.parents(".imagify-welcome, .imagify-notice"),e=c.attr("href");b.preventDefault(),d.fadeTo(100,0,function(){a(this).slideUp(100,function(){a(this).remove()})}),a.get(e.replace("admin-post.php","admin-ajax.php"))})}(jQuery,document,window),function(a,b,c,d){var e=function(b){var c=b.data("target")||b.attr("href");a(c).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open"),a("body").addClass("imagify-modal-is-open")};a(".imagify-modal").attr("aria-hidden","true"),a(b).on("click.imagify",".imagify-modal-trigger",function(b){b.preventDefault(),e(a(this))}).on("click.imagify",".imagify-modal .close-btn",function(){a(this).closest(".imagify-modal").fadeOut(400).attr("aria-hidden","true").removeClass("modal-is-open").trigger("modalClosed.imagify"),a("body").removeClass("imagify-modal-is-open")}).on("blur.imagify",".imagify-modal .close-btn",function(){var b=a(this).closest(".imagify-modal");"false"===b.attr("aria-hidden")&&b.attr("tabindex","0").focus().removeAttr("tabindex")}).on("click.imagify",".imagify-modal",function(b){a(b.target).filter(".modal-is-open").find(".close-btn").trigger("click.imagify")}).on("keydown.imagify",function(b){27===b.keyCode&&a(".imagify-modal.modal-is-open").length>0&&(b.preventDefault(),a(".imagify-modal.modal-is-open").find(".close-btn").trigger("click.imagify"))})}(jQuery,document,window),function(a,b,c,d){var e={};a("#imagify-pricing-modal").length&&(e={$modal:a("#imagify-pricing-modal"),$checkboxes:a(".imagify-offer-line .imagify-checkbox"),$radios:a(".imagify-payment-modal .imagify-radio-line input"),$preView:a("#imagify-pre-checkout-view"),$plansView:a("#imagify-plans-selection-view").hide(),$paymentView:a("#imagify-payment-process-view").hide(),$successView:a("#imagify-success-view").hide(),$anotherBtn:a(".imagify-choose-another-plan"),speedFadeIn:300,getHtmlPrice:function(a,b){var c,d,e,f,g;return b||(b=null),"object"!=typeof a?(a+="",a=a.split("."),a[1]=1===a[1].length?a[1]+"0":(""+a[1]).substring(0,2),g='<span class="imagify-price-big">'+a[0]+"</span> ",g+='<span class="imagify-price-mini">.'+a[1]+"</span>"):(c=a.monthly+"",d=a.yearly+"",e=c.split("."),f=d.split("."),g='<span class="imagify-switch-my">',g+='<span aria-hidden="'+("monthly"===b?"false":"true")+'" class="imagify-monthly">',g+='<span class="imagify-price-big">'+e[0]+"</span> ",g+='<span class="imagify-price-mini">.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+"</span>",g+="</span> ",g+='<span aria-hidden="'+("yearly"===b?"false":"true")+'" class="imagify-yearly">',g+='<span class="imagify-price-big">'+f[0]+"</span> ",g+='<span class="imagify-price-mini">.'+(1===f[1].length?f[1]+"0":(""+f[1]).substring(0,2))+"</span>",g+="</span>",g+="</span>")},getHtmlDiscountPrice:function(a,b){var c,d,e="";return b||(b=null),"object"==typeof a?(c=a.monthly+"",d=a.yearly+"",e+='<span class="imagify-price-discount">',e+='<span class="imagify-price-discount-dollar">$</span>',e+='<span class="imagify-switch-my">',e+='<span aria-hidden="'+("monthly"===b?"false":"true")+'" class="imagify-monthly">',e+='<span class="imagify-price-discount-number">'+c+"</span>",e+="</span>",e+='<span aria-hidden="'+("yearly"===b?"false":"true")+'" class="imagify-yearly">',e+='<span class="imagify-price-discount-number">'+d+"</span>",e+="</span>",e+="</span>",e+="</span>"):(a+="",e+='<span class="imagify-price-discount">',e+='<span class="imagify-price-discount-dollar">$</span>',e+='<span class="imagify-price-discount-number">'+a+"</span>",e+="</span>"),e},populateOffer:function(a,b,d,f){var g,h,i,j=c.imagify_discount_datas,k=b.additional_gb,l=b.annual_cost,m=b.id,n=b.label,o=b.monthly_cost,p=b.quota,q=b.cost,r=p>=1e3?p/1e3+" GB":p+" MB",s="monthly"===d?{monthly:o,yearly:Math.round(l/12*100)/100}:q,t=s;return j.is_active&&"percentage"===j.coupon_type&&"monthly"===d&&(g=(100-j.coupon_value)/100,s="monthly"===d?{monthly:o*g,yearly:Math.round(l*g/12*100)/100}:q*g),void 0!==f&&a.addClass("imagify-"+d+"-"+n+f),a.find(".imagify-offer-size").text(r),a.find(".imagify-number-block").html(e.getHtmlPrice(s,"monthly")),j.is_active&&"percentage"===j.coupon_type&&"monthly"===d&&(a.find(".imagify-price-block").prev(".imagify-price-discount").remove(),a.find(".imagify-price-block").before(e.getHtmlDiscountPrice(t,"monthly"))),a.find(".imagify-approx-nb").text(5*p),"monthly"===d&&a.find(".imagify-price-add-data").text("$"+k),h=a.find(".imagify-payment-btn-select-plan").length?a.find(".imagify-payment-btn-select-plan"):a,i="monthly"===d?'{"'+n+'":{"id":'+m+',"name":"'+r+'","data":'+p+',"dataf":"'+r+'","imgs":'+5*p+',"prices":{"monthly":'+s.monthly+',"yearly":'+s.yearly+',"add":'+k+"}}}":'{"ot'+n+'":{"id":'+m+',"name":"'+r+'","data":'+p+',"dataf":"'+r+'","imgs":'+5*p+',"price":'+s+"}}",h.attr("data-offer",i),a},populatePayBtn:function(){var b=JSON.parse(a(".imagify-offer-monthly").attr("data-offer")),c=JSON.parse(a(".imagify-offer-onetime").attr("data-offer")),d=0,e=0,f=0;a(".imagify-offer-monthly").hasClass("imagify-offer-selected")&&(e=a("#imagify-subscription-monthly").filter(":checked").length?b[Object.keys(b)[0]].prices.monthly:12*b[Object.keys(b)[0]].prices.yearly),a(".imagify-offer-onetime").hasClass("imagify-offer-selected")&&(f=c[Object.keys(c)[0]].price),d=parseFloat(f+e).toFixed(2),"0.00"===d||0===d?a("#imagify-modal-checkout-btn").attr("disabled","disabled").addClass("imagify-button-disabled"):a("#imagify-modal-checkout-btn").removeAttr("disabled").removeClass("imagify-button-disabled")},checkCoupon:function(){var b,c,d,e,f=a("#imagify-coupon-code").val();""!==f&&(b=a(".imagify-coupon-text"),c=b.find("label"),d=a(".imagify-coupon-section"),e=a("#imagify-get-pricing-modal").data("nonce"),b.addClass("checking"),a.post(ajaxurl,{action:"imagify_check_coupon",coupon:f,imagifynonce:e},function(a){var e;b.removeClass("checking"),a.success?a.data.success?(e="percentage"===a.data.coupon_type?a.data.value+"%":"$"+a.data.value,d.removeClass("invalid").addClass("validated"),c.html(imagifyAdmin.labels.successCouponAPI),c.find(".imagify-coupon-offer").text(e),c.find(".imagify-coupon-word").text(f)):(d.removeClass("validated").addClass("invalid"),c.text(a.data.detail)):(d.removeClass("validated").addClass("invalid"),c.text(imagifyAdmin.labels.errorCouponAPI))}))},getPricing:function(b){var d=b.data("nonce"),f={action:"imagify_get_prices",imagifynonce:d},g={action:"imagify_get_images_counts",imagifynonce:d},h={action:"imagify_get_discount",imagifynonce:d};e.$modal.find(".imagify-modal-loader").hide().show(),a.post(ajaxurl,f,function(b){if(!b.success)return void e.populatePayBtn();a.post(ajaxurl,g,function(d){d.success&&a.post(ajaxurl,h,function(f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C="",D="",E=!1,F=!1;if(f.success){if(g=d.data,h=b.data,i=f.data,j=h.monthlies,k=h.onetimes,l=Math.round(g.average_month_size.raw/1e6),m=Math.round(g.total_library_size.raw/1e6),n=a("#imagify-offer-monthly-template"),o=a("#imagify-offer-onetime-template"),p=o.html(),q=n.html(),r=a(".imagify-estimation-block"),r.removeClass("imagify-analyzing"),r.find(".average-month-size").text(g.average_month_size.human),r.find(".total-library-size").text(g.total_library_size.human),l<25&&m<25?(a(".imagify-pre-checkout-offers .imagify-modal-title").addClass("imagify-enough-free"),a(".imagify-offer-selected").removeClass("imagify-offer-selected").find(".imagify-checkbox").removeAttr("checked")):(a(".imagify-enough-free").removeClass("imagify-enough-free"),a(".imagify-offer-selected").addClass("imagify-offer-selected").find(".imagify-checkbox").attr("checked","checked")),null===j||null===k)return s=a(".imagify-pre-checkout-offers"),s.hide().attr("aria-hidden",!0),s.closest(".imagify-modal-views").find(".imagify-popin-message").remove(),s.after('<div class="imagify-popin-message imagify-error"><p>'+imagifyAdmin.labels.errorPriceAPI+"</p></div>"),void e.$modal.find(".imagify-modal-loader").fadeOut(300);if(c.imagify_discount_datas=i,i.is_active&&(t=a(".imagify-modal-promotion"),u=i.date_end.split("T")[0],v=i.coupon_value,w="percentage"===i.coupon_type?v+"%":"$"+v,a("#imagify-coupon-code").val(i.label).attr("readonly",!0),t.addClass("active").attr("aria-hidden","false"),t.find(".imagify-promotion-number").text(w),t.find(".imagify-promotion-date").text(u),e.checkCoupon()),a.each(j,function(b,c){var d,f,g="";return"free"===c.label||(d=a(q).clone(),!1!==F&&b-F>2||(l<c.quota&&!1===F&&(g=" imagify-offer-selected",F=b,f=a(".imagify-pre-checkout-offers").find(".imagify-offer-monthly"),e.populateOffer(f,c,"monthly")),d=e.populateOffer(d,c,"monthly",g),void(D+=d[0].outerHTML)))}),x=a(D).filter(".imagify-offer-selected").prevAll(),x.length>1){for(y=x.length-1,z=a(D),A=0;A<y;A++)delete z[A];for(D="",B=0;B<z.length;B++)D+=a("<div/>").append(z[B]).html()}a.each(k,function(b,c){var d,f=a(p).clone(),g=a(".imagify-pre-checkout-offers").find(".imagify-offer-onetime"),h="";m<c.quota&&!1===E&&(h=" imagify-offer-selected",E=!0,e.populateOffer(g,c,"onetime")),k.length-1===b&&!1===E&&(d=k[k.length-1],e.populateOffer(g,d,"onetime")),f=e.populateOffer(f,c,"onetime",h),C+=f[0].outerHTML}),n.parent().find(".imagify-offer-line")&&n.parent().find(".imagify-offer-line").remove(),n.before(D),o.parent().find(".imagify-offer-line")&&o.parent().find(".imagify-offer-line").remove(),o.before(C),e.$modal.find(".imagify-modal-loader").fadeOut(300)}})}),e.populatePayBtn()})},checkCheckbox:function(b){b.each(function(){var b=a(this);b.is(":checked")?b.closest(".imagify-offer-line").addClass("imagify-offer-selected"):b.closest(".imagify-offer-line").removeClass("imagify-offer-selected")}),e.populatePayBtn()},checkRadio:function(b){return b.each(function(){var b,c,d=a(this);b=d.parent(".imagify-cart-list-switcher").length?d.closest(".imagify-cart"):d.parent(".imagify-small-options").length?d.parent(".imagify-small-options").next(".imagify-pricing-table"):d.closest(".imagify-offer-line"),c=b.find(".imagify-switch-my"),"yearly"===d.val()?(b.addClass("imagify-year-selected").removeClass("imagify-month-selected"),c.find(".imagify-monthly").attr("aria-hidden","true"),c.find(".imagify-yearly").attr("aria-hidden","false")):(b.addClass("imagify-month-selected").removeClass("imagify-year-selected"),c.find(".imagify-monthly").attr("aria-hidden","false"),c.find(".imagify-yearly").attr("aria-hidden","true"))}),e.populatePayBtn(),b},populateBtnPrice:setInterval(function(){e.populatePayBtn()},1e3),getPeriod:function(){return a(".imagify-offer-monthly").hasClass("imagify-month-selected")?"monthly":"yearly"},getApiKey:function(){return a("#imagify-payment-iframe").data("imagify-api")},switchToView:function(a,b){var c=a.attr("id"),d=e.$modal.children(".imagify-modal-content");a.siblings(".imagify-modal-views").hide().attr("aria-hidden","true"),b&&b.tab&&a.find('a[href="#'+b.tab+'"]').trigger("click.imagify"),"imagify-payment-process-view"===c?d.addClass("imagify-iframe-viewing"):d.removeClass("imagify-iframe-viewing"),"imagify-success-view"===c?(d.addClass("imagify-success-viewing"),e.$modal.attr("aria-labelledby","imagify-success-view")):(d.removeClass("imagify-success-viewing"),e.$modal.removeAttr("aria-labelledby")),a.fadeIn(e.speedFadeIn).attr("aria-hidden","false")},iframeSetSrc:function(b){var c,d,f,g,h,i,j,k=a("#imagify-payment-iframe"),l=k.attr("src"),m=k.data("src"),n=0,o=0;if("string"==typeof b&&""!==l)return j="monthly"===b?"yearly":"monthly",l=l.replace(j,b),void k.attr("src",l);if("object"==typeof b){if(b.monthly&&(n=b.monthly[Object.keys(b.monthly)[0]].id),b.onetime&&(o=b.onetime[Object.keys(b.onetime)[0]].id,o=o+""=="999"?b.onetime[Object.keys(b.onetime)[0]].data:o),!b.period)return void imagify.info("No period defined");e.getApiKey(),c=o,d="yearly"===b.period?n:0,f="monthly"===b.period?n:0,g=a("#imagify-coupon-code").val(),h=""===g?"none":g,parseFloat(a(".imagify-global-amount").text()).toFixed(2),m=m+c+"/"+f+"/"+d+"/"+h+"/",i=k.remove().attr("src",m),e.$paymentView.html(i)}},paymentClose:function(){a(".imagify-iframe-viewing .close-btn").trigger("click.imagify"),a(".imagify-iframe-viewing").removeClass("imagify-iframe-viewing")},paymentBack:function(){e.switchToView(e.$preView)},paymentSuccess:function(){e.switchToView(e.$successView)},checkPluginMessage:function(a){var b=a.origin||a.originalEvent.origin;if("https://app.imagify.io"===b||"http://dapp.imagify.io"===b)switch(a.data){case"cancel":e.paymentClose();break;case"back":e.paymentBack();break;case"success":e.paymentSuccess()}}},e.checkCheckbox(e.$checkboxes),e.checkRadio(e.$radios.filter(":checked")),e.checkCoupon(),e.$checkboxes.on("change.imagify",function(){e.checkCheckbox(a(this))}),e.$radios.on("change.imagify",function(){e.checkRadio(a(this))}),a("#imagify-get-pricing-modal").on("click.imagify-ajax",function(){e.getPricing(a(this))}),a(b).on("modalClosed.imagify",".imagify-payment-modal",function(){a(this).find(".imagify-modal-content").removeClass("imagify-success-viewing imagify-iframe-viewing"),setTimeout(function(){a(".imagify-modal-views").hide(),a("#imagify-pre-checkout-view").show()},300)}),a("#imagify-coupon-code").on("blur.imagify",function(){a(this).attr("readonly")||e.checkCoupon()}).on("keydown.imagify",function(b){var c=a(this);if(!c.attr("readonly"))return 13===b.keyCode||32===b.keyCode?(e.checkCoupon(),!1):void(c.val().length>=3?c.closest(".imagify-coupon-input").addClass("imagify-canbe-validate"):c.closest(".imagify-coupon-input").removeClass("imagify-canbe-validate"))}),a("#imagify-coupon-validate").on("click.imagify",function(){e.checkCoupon(),a(this).closest(".imagify-canbe-validate").removeClass("imagify-canbe-validate")}),e.$anotherBtn.on("click.imagify",function(b){var c=a(this).data("imagify-choose"),d="imagify-pricing-tab-"+("plan"===c?"monthly":"onetime");b.preventDefault(),e.switchToView(e.$plansView,{tab:d})}),e.$modal.on("click.imagify",".imagify-payment-btn-select-plan",function(b){var c=a(this),d=c.closest(".imagify-offer-line"),f=c.data("offer"),g=c.attr("data-offer"),h="imagify-pricing-tab-monthly"!==c.closest(".imagify-tab-content").attr("id"),i=h?e.$preView.find(".imagify-offer-onetime"):e.$preView.find(".imagify-offer-monthly"),j=h?null:c.closest(".imagify-pricing-table").hasClass("imagify-month-selected")?"monthly":"yearly",k=h?e.getHtmlPrice(f[Object.keys(f)[0]].price):e.getHtmlPrice(f[Object.keys(f)[0]].prices,j),l=h?"":'<span class="imagify-price-by">'+d.find(".imagify-price-by").text()+"</span>",m=d.find(".imagify-price-discount").html(),n=d.find(".imagify-approx-nb").text(),o=d.find(".imagify-offer-size").text();b.preventDefault(),e.switchToView(e.$preView),i.find(".imagify-number-block").html(k+l),i.find(".imagify-price-discount").html(m),i.find(".imagify-approx-nb").text(n),i.find(".imagify-offer-size").text(o),i.attr("data-offer",g),h||(i.find(".imagify-price-add-data").text(d.find(".imagify-price-add-data").text()),"monthly"===j?i.find("#imagify-subscription-monthly").trigger("click.imagify"):i.find("#imagify-subscription-yearly").trigger("click.imagify"),i.find(".imagify-inline-options").find("input:radio:checked").trigger("change.imagify")),e.populatePayBtn()}),a("#imagify-modal-checkout-btn").on("click.imagify",function(b){var c,d,f;b.preventDefault(),a(this).hasClass("imagify-button-disabled")||(c=a(".imagify-offer-monthly"),d=a(".imagify-offer-onetime"),f={},c.hasClass("imagify-offer-selected")&&(f.monthly=JSON.parse(c.attr("data-offer"))),d.hasClass("imagify-offer-selected")&&(f.onetime=JSON.parse(d.attr("data-offer"))),e.switchToView(e.$paymentView),f.period=e.getPeriod(),e.iframeSetSrc(f))}),a(".imagify-back-to-plans").on("click.imagify",function(b){var c=a(this),d=c.closest(".imagify-cart-item").hasClass("imagify-cart-item-onetime");b.preventDefault(),d?a(".imagify-offer-onetime").find(".imagify-choose-another-plan").trigger("click.imagify"):a(".imagify-offer-monthly").find(".imagify-choose-another-plan").trigger("click.imagify")}),c.addEventListener("message",e.checkPluginMessage,!0))}(jQuery,document,window),function(a,b,c,d){a(".imagify-tab").on("click.imagify",function(b){var c,d=a(this);b.preventDefault(),d.hasClass("imagify-current")||(c=d.find("a").attr("href")||"#"+d.find("a").attr("aria-controls"),d.closest(".imagify-tabs").next(".imagify-tabs-contents").find(".imagify-tab-content").hide().attr("aria-hidden","true"),a(c).fadeIn(275).attr("aria-hidden","false"),d.closest(".imagify-tabs").find(".imagify-tab").removeClass("imagify-current").attr("aria-selected","false"),d.addClass("imagify-current").attr("aria-selected","true"))})}(jQuery,document,window);
assets/js/bulk.js CHANGED
@@ -1,20 +1,18 @@
1
- /* globals ajaxurl: false, console: false, imagify: true, Chart: false, ImagifyGulp: false, swal: false */
2
-
3
  window.imagify = window.imagify || {
4
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
  log: function( content ) {
6
  if ( undefined !== console ) {
7
- console.log( content );
8
  }
9
  },
10
  info: function( content ) {
11
  if ( undefined !== console ) {
12
- console.info( content );
13
  }
14
  }
15
  };
16
 
17
- (function($, d, w, undefined) {
18
  var overviewCanvas = d.getElementById( 'imagify-overview-chart' ),
19
  overviewData = [
20
  {
@@ -46,20 +44,20 @@ window.imagify = window.imagify || {
46
  */
47
  function drawMeAChart( canvas ) {
48
  canvas.each( function() {
49
- var $this = $( this ),
50
- theValue = parseInt( $this.closest( '.imagify-chart' ).next( '.imagipercent' ).text(), 10 ),
51
- overviewData = [
52
  {
53
  value: theValue,
54
  color: '#00B3D3'
55
  },
56
  {
57
  value: 100 - theValue,
58
- color:'#D8D8D8'
59
  }
60
  ];
61
 
62
- new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, {
63
  segmentStrokeColor: '#FFF',
64
  segmentStrokeWidth: 1,
65
  animateRotate: true,
@@ -76,9 +74,9 @@ window.imagify = window.imagify || {
76
  */
77
  function drawMeCompleteChart( canvas ) {
78
  canvas.each( function() {
79
- var $this = $( this ),
80
- theValue = parseInt( $this.closest( '.imagify-ac-chart' ).attr( 'data-percent' ), 10 ),
81
- overviewData = [
82
  {
83
  value: theValue,
84
  color: '#40B1D0'
@@ -89,7 +87,7 @@ window.imagify = window.imagify || {
89
  }
90
  ];
91
 
92
- new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, {
93
  segmentStrokeColor: 'transparent',
94
  segmentStrokeWidth: 0,
95
  animateRotate: true,
@@ -101,7 +99,7 @@ window.imagify = window.imagify || {
101
  }
102
 
103
  if ( overviewCanvas ) {
104
- overviewDoughnut = new Chart( overviewCanvas.getContext( '2d' ) ).Doughnut( overviewData, {
105
  segmentStrokeColor: 'transparent',
106
  segmentStrokeWidth: 0,
107
  animateRotate: true,
@@ -136,11 +134,18 @@ window.imagify = window.imagify || {
136
 
137
  // Listen for the custom event "heartbeat-tick" on $(document).
138
  $( d ).on( 'heartbeat-tick', function( e, data ) {
 
 
139
  if ( ! data.imagify_bulk_data ) {
140
  return;
141
  }
142
 
143
- data = data.imagify_bulk_data;
 
 
 
 
 
144
 
145
  // The overview chart percent.
146
  $( '#imagify-overview-chart-percent' ).html( data.optimized_attachments_percent + '<span>%</span>' );
@@ -207,175 +212,183 @@ window.imagify = window.imagify || {
207
  } );
208
 
209
  $.get( ajaxurl + imagify.concat + 'action=' + imagifyBulk.ajax_action + '&optimization_level=' + optimizationLevel + '&imagifybulkuploadnonce=' + $( '#imagifybulkuploadnonce' ).val() )
210
- .done( function( response ) {
211
- var swal_title = '',
212
- swal_text = '',
213
- text, Optimizer, table,
214
- files = 0,
215
- errors = 0,
216
- original_overall_size = 0,
217
- overall_saving = 0;
218
-
219
- if ( ! response.success ) {
220
- $obj.removeAttr( 'disabled' );
221
- $obj.find( '.dashicons' ).removeClass( 'rotate' );
222
-
223
- // Remove confirm dialog before quit the page.
224
- $( w ).off( 'beforeunload', confirmMessage );
225
-
226
- if ( 'invalid-api-key' === response.data.message ) {
227
- swal_title = imagifyBulk.labels.invalidAPIKeyTitle;
228
- }
229
-
230
- if ( 'over-quota' === response.data.message ) {
231
- swal_title = imagifyBulk.labels.overQuotaTitle;
232
- text = imagifyBulk.labels.overQuotaText;
233
- }
234
-
235
- if ( 'no-images' === response.data.message ) {
236
- swal_title = imagifyBulk.labels.noAttachmentToOptimizeTitle;
237
- swal_text = imagifyBulk.labels.noAttachmentToOptimizeText;
238
- }
239
-
240
- // Display an alert to warn that all images has been optimized.
241
- swal( {
242
- title: swal_title,
243
- html: swal_text,
244
- type: 'info',
245
- customClass: 'imagify-sweet-alert'
246
- } );
247
-
248
- return;
249
- }
250
-
251
- swal.close();
252
-
253
- $( '.imagify-row-progress' ).slideDown();
254
- $( '.imagify-no-uploaded-yet, .imagify-row-complete' ).hide( 200 );
255
-
256
- table = $( '.imagify-bulk-table table tbody' );
257
- Optimizer = new ImagifyGulp( {
258
- 'lib': ajaxurl + imagify.concat + 'action=imagify_bulk_upload&imagifybulkuploadnonce=' + $( '#imagifybulkuploadnonce' ).val(),
259
- 'images': response.data,
260
- 'context': imagifyBulk.ajax_context
261
- } );
262
-
263
- // Before the attachment optimization.
264
- Optimizer.before( function( data ) {
265
- table.find( '.imagify-row-progress' ).after( '<tr id="attachment-' + data.id + '"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="' + data.thumbnail + '" alt=""/></span><span class="imagifilename">' + data.filename + '</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>' + imagifyBulk.labels.optimizing + '<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>' );
266
- } )
267
- // After the attachment optimization.
268
- .each( function( data ) {
269
- var $progress = $( '#imagify-progress-bar' ),
270
- errorClass = 'error',
271
- errorDashicon = 'dismiss',
272
- errorMessage = imagifyBulk.labels.error;
273
-
274
- $progress.css( { 'width': data.progress + '%' } );
275
- $progress.find( '.percent' ).html( data.progress + '%' );
276
-
277
- if ( data.success ) {
278
- $( '#attachment-' + data.image + ' .imagify-cell-status' ).html( '<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>' + imagifyBulk.labels.complete + '</span>' );
279
- $( '#attachment-' + data.image + ' .imagify-cell-original' ).html( data.original_size_human );
280
- $( '#attachment-' + data.image + ' .imagify-cell-optimized' ).html( data.new_size_human );
281
- $( '#attachment-' + data.image + ' .imagify-cell-percentage' ).html( '<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">' + data.percent + '</span>%' );
282
- drawMeAChart( $( '#attachment-' + data.image + ' .imagify-cell-percentage' ).find( 'canvas' ) );
283
- $( '#attachment-' + data.image + ' .imagify-cell-thumbnails' ).html( data.thumbnails );
284
- $( '#attachment-' + data.image + ' .imagify-cell-savings' ).html( Optimizer.humanSize( data.overall_saving, 1 ) );
285
-
286
- // The table footer total optimized files.
287
- files = files + data.thumbnails + 1;
288
- $( '.imagify-cell-nb-files' ).html( imagifyBulk.labels.nbrFiles.replace( '%s', files ) );
289
-
290
- // The table footer original size.
291
- original_overall_size = original_overall_size + data.original_overall_size;
292
- $( '.imagify-total-original' ).html( Optimizer.humanSize( original_overall_size, 1 ) );
293
-
294
- // The table footer overall saving.
295
- overall_saving = overall_saving + data.overall_saving;
296
- $( '.imagify-total-gain' ).html( Optimizer.humanSize( overall_saving, 1 ) );
297
-
298
- return;
299
- }
300
 
301
- if ( data.error.indexOf( "You've consumed all your data" ) >= 0 ) {
302
  swal( {
303
- title: imagifyBulk.labels.overQuotaTitle,
304
- html: imagifyBulk.labels.overQuotaText,
305
- type: 'error',
306
- customClass: 'imagify-sweet-alert',
307
- } ).then( function() {
308
- location.reload();
309
  } );
310
- }
311
 
312
- if ( data.error.indexOf( 'This image is already compressed' ) >= 0 ) {
313
- errorClass = 'warning';
314
- errorDashicon = 'warning';
315
- errorMessage = imagifyBulk.labels.notice;
316
- } else {
317
- errors++;
318
- $( '.imagify-cell-errors' ).html( imagifyBulk.labels.nbrErrors.replace( '%s', errors ) );
319
  }
320
 
321
- $( '#attachment-' + data.image ).after( '<tr><td colspan="7"><span class="status-' + errorClass + '">' + data.error + '</span></td></tr>' );
322
-
323
- $( '#attachment-' + data.image + ' .imagify-cell-status' ).html( '<span class="imagistatus status-' + errorClass + '"><span class="dashicons dashicons-' + errorDashicon + '"></span>' + errorMessage + '</span>' );
324
- } )
325
- // After all attachments optimization.
326
- .done( function( data ) {
327
- var text2share;
328
-
329
- $obj.removeAttr( 'disabled' ).find( '.dashicons' ).removeClass( 'rotate' );
330
-
331
- // Remove confirm dialog before quit the page.
332
- $( w ).off( 'beforeunload', confirmMessage );
333
 
334
- // Hide the progress bar.
335
- $( '.imagify-row-progress' ).slideUp();
336
 
337
- if ( 'NaN' !== data.global_percent ) {
338
- // Display the complete section.
339
- $( '.imagify-row-complete' ).removeClass( 'hidden' ).addClass( 'done' ).attr( 'aria-hidden', 'false' );
340
- $( 'html, body' ).animate( {
341
- scrollTop: $( '.imagify-row-complete' ).offset().top
342
- }, 200 );
343
-
344
- $( '.imagify-ac-rt-total-gain' ).html( data.global_gain_human );
345
- $( '.imagify-ac-rt-total-original' ).html( data.global_original_size_human );
346
-
347
- text2share = imagifyBulk.labels.textToShare;
348
- text2share = text2share.replace( '%1$s', data.global_gain_human );
349
- text2share = text2share.replace( '%2$s', data.global_original_size_human );
350
- text2share = encodeURIComponent( text2share );
351
-
352
- $( '.imagify-sn-twitter' ).attr( 'href', 'https://twitter.com/intent/tweet?source=webclient&amp;original_referer=' + imagifyBulk.labels.pluginURL + '&amp;text=' + text2share + '&amp;url=' + imagifyBulk.labels.pluginURL + '&amp;related=imagify&amp;hastags=performance,web,wordpress' );
353
 
354
- $( '.imagify-ac-chart' ).attr( 'data-percent', data.global_percent );
355
- drawMeCompleteChart( $( '.imagify-ac-chart' ).find( 'canvas' ) );
356
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  } )
358
- .error( function( id ) {
359
- imagify.log( "Can't optimize image with id " + id + "." );
360
- } )
361
- .run();
362
- } )
363
- .fail( function() {
364
- swal( {
365
- title: imagifyBulk.labels.getUnoptimizedImagesErrorTitle,
366
- html: imagifyBulk.labels.getUnoptimizedImagesErrorText,
367
- type: 'error',
368
- customClass: 'imagify-sweet-alert'
369
- } ).then( function() {
370
- location.reload();
371
  } );
372
- } );
373
  } );
374
 
375
  } )(jQuery, document, window);
376
 
377
 
378
- (function($, d, w, undefined) {
379
 
380
  var width = 700,
381
  height = 290,
 
 
1
  window.imagify = window.imagify || {
2
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
3
  log: function( content ) {
4
  if ( undefined !== console ) {
5
+ console.log( content ); // eslint-disable-line no-console
6
  }
7
  },
8
  info: function( content ) {
9
  if ( undefined !== console ) {
10
+ console.info( content ); // eslint-disable-line no-console
11
  }
12
  }
13
  };
14
 
15
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
16
  var overviewCanvas = d.getElementById( 'imagify-overview-chart' ),
17
  overviewData = [
18
  {
44
  */
45
  function drawMeAChart( canvas ) {
46
  canvas.each( function() {
47
+ var $this = $( this ),
48
+ theValue = parseInt( $this.closest( '.imagify-chart' ).next( '.imagipercent' ).text(), 10 ),
49
+ data = [
50
  {
51
  value: theValue,
52
  color: '#00B3D3'
53
  },
54
  {
55
  value: 100 - theValue,
56
+ color: '#D8D8D8'
57
  }
58
  ];
59
 
60
+ new Chart( $this[0].getContext( '2d' ) ).Doughnut( data, { // eslint-disable-line new-cap
61
  segmentStrokeColor: '#FFF',
62
  segmentStrokeWidth: 1,
63
  animateRotate: true,
74
  */
75
  function drawMeCompleteChart( canvas ) {
76
  canvas.each( function() {
77
+ var $this = $( this ),
78
+ theValue = parseInt( $this.closest( '.imagify-ac-chart' ).attr( 'data-percent' ), 10 ),
79
+ data = [
80
  {
81
  value: theValue,
82
  color: '#40B1D0'
87
  }
88
  ];
89
 
90
+ new Chart( $this[0].getContext( '2d' ) ).Doughnut( data, { // eslint-disable-line new-cap
91
  segmentStrokeColor: 'transparent',
92
  segmentStrokeWidth: 0,
93
  animateRotate: true,
99
  }
100
 
101
  if ( overviewCanvas ) {
102
+ overviewDoughnut = new Chart( overviewCanvas.getContext( '2d' ) ).Doughnut( overviewData, { // eslint-disable-line new-cap
103
  segmentStrokeColor: 'transparent',
104
  segmentStrokeWidth: 0,
105
  animateRotate: true,
134
 
135
  // Listen for the custom event "heartbeat-tick" on $(document).
136
  $( d ).on( 'heartbeat-tick', function( e, data ) {
137
+ var donutData;
138
+
139
  if ( ! data.imagify_bulk_data ) {
140
  return;
141
  }
142
 
143
+ data = data.imagify_bulk_data;
144
+ donutData = overviewDoughnut.segments;
145
+
146
+ if ( data.unoptimized_attachments === donutData[0].value && data.optimized_attachments === donutData[1].value && data.errors_attachments === donutData[2].value ) {
147
+ return;
148
+ }
149
 
150
  // The overview chart percent.
151
  $( '#imagify-overview-chart-percent' ).html( data.optimized_attachments_percent + '<span>%</span>' );
212
  } );
213
 
214
  $.get( ajaxurl + imagify.concat + 'action=' + imagifyBulk.ajax_action + '&optimization_level=' + optimizationLevel + '&imagifybulkuploadnonce=' + $( '#imagifybulkuploadnonce' ).val() )
215
+ .done( function( response ) {
216
+ var swal_title = '',
217
+ swal_text = '',
218
+ Optimizer, table,
219
+ files = 0,
220
+ errors = 0,
221
+ stopOptimization = 0,
222
+ original_overall_size = 0,
223
+ overall_saving = 0,
224
+ incr = 0;
225
+
226
+ if ( ! response.success ) {
227
+ $obj.removeAttr( 'disabled' );
228
+ $obj.find( '.dashicons' ).removeClass( 'rotate' );
229
+
230
+ // Remove confirm dialog before quit the page.
231
+ $( w ).off( 'beforeunload', confirmMessage );
232
+
233
+ if ( 'invalid-api-key' === response.data.message ) {
234
+ swal_title = imagifyBulk.labels.invalidAPIKeyTitle;
235
+ } else if ( 'over-quota' === response.data.message ) {
236
+ swal_title = imagifyBulk.labels.overQuotaTitle;
237
+ swal_text = imagifyBulk.labels.overQuotaText;
238
+ } else if ( 'no-images' === response.data.message ) {
239
+ swal_title = imagifyBulk.labels.noAttachmentToOptimizeTitle;
240
+ swal_text = imagifyBulk.labels.noAttachmentToOptimizeText;
241
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
 
243
+ // Display an alert to warn that all images has been optimized.
244
  swal( {
245
+ title: swal_title,
246
+ html: swal_text,
247
+ type: 'info',
248
+ customClass: 'imagify-sweet-alert'
 
 
249
  } );
 
250
 
251
+ return;
 
 
 
 
 
 
252
  }
253
 
254
+ swal.close();
 
 
 
 
 
 
 
 
 
 
 
255
 
256
+ $( '.imagify-row-progress' ).slideDown();
257
+ $( '.imagify-no-uploaded-yet, .imagify-row-complete' ).hide( 200 );
258
 
259
+ table = $( '.imagify-bulk-table table tbody' );
260
+ Optimizer = new ImagifyGulp( {
261
+ 'buffer_size': imagifyBulk.buffer_size,
262
+ 'lib': ajaxurl + imagify.concat + 'action=imagify_bulk_upload&imagifybulkuploadnonce=' + $( '#imagifybulkuploadnonce' ).val(),
263
+ 'images': response.data,
264
+ 'context': imagifyBulk.ajax_context
265
+ } );
 
 
 
 
 
 
 
 
 
266
 
267
+ // Before the attachment optimization.
268
+ Optimizer.before( function( data ) {
269
+ table.find( '.imagify-row-progress' ).after( '<tr id="attachment-' + data.id + '"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="' + data.thumbnail + '" alt=""/></span><span class="imagifilename">' + data.filename + '</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>' + imagifyBulk.labels.optimizing + '<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>' );
270
+ } )
271
+ // After the attachment optimization.
272
+ .each( function( data ) {
273
+ var $progress = $( '#imagify-progress-bar' ),
274
+ errorClass = 'error',
275
+ errorDashicon = 'dismiss',
276
+ errorMessage = imagifyBulk.labels.error,
277
+ $attachment = $( '#attachment-' + data.image );
278
+
279
+ $progress.css( { 'width': data.progress + '%' } );
280
+ $progress.find( '.percent' ).html( data.progress + '%' );
281
+
282
+ if ( data.success ) {
283
+ ++incr;
284
+ $attachment.find( '.imagify-cell-status' ).html( '<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>' + imagifyBulk.labels.complete + '</span>' );
285
+ $attachment.find( '.imagify-cell-original' ).html( data.original_size_human );
286
+ $attachment.find( '.imagify-cell-optimized' ).html( data.new_size_human );
287
+ $attachment.find( '.imagify-cell-percentage' ).html( '<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart-' + data.image + '-' + incr + '" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">' + data.percent + '</span>%' );
288
+ drawMeAChart( $attachment.find( '.imagify-cell-percentage canvas' ) );
289
+ $attachment.find( '.imagify-cell-thumbnails' ).html( data.thumbnails );
290
+ $attachment.find( '.imagify-cell-savings' ).html( Optimizer.humanSize( data.overall_saving, 1 ) );
291
+
292
+ // The table footer total optimized files.
293
+ files = files + data.thumbnails + 1;
294
+ $( '.imagify-cell-nb-files' ).html( imagifyBulk.labels.nbrFiles.replace( '%s', files ) );
295
+
296
+ // The table footer original size.
297
+ original_overall_size = original_overall_size + data.original_overall_size;
298
+ $( '.imagify-total-original' ).html( Optimizer.humanSize( original_overall_size, 1 ) );
299
+
300
+ // The table footer overall saving.
301
+ overall_saving = overall_saving + data.overall_saving;
302
+ $( '.imagify-total-gain' ).html( Optimizer.humanSize( overall_saving, 1 ) );
303
+
304
+ return;
305
+ }
306
+
307
+ if ( ! stopOptimization && data.error.indexOf( "You've consumed all your data" ) >= 0 ) {
308
+ stopOptimization = 1;
309
+ Optimizer.stopProcess();
310
+
311
+ // Display an alert to warn that all data is consumed.
312
+ swal( {
313
+ title: imagifyBulk.labels.overQuotaTitle,
314
+ html: imagifyBulk.labels.overQuotaText,
315
+ type: 'error',
316
+ customClass: 'imagify-sweet-alert',
317
+ } ).then( function() {
318
+ location.reload();
319
+ } );
320
+ }
321
+
322
+ if ( data.error.indexOf( 'This image is already compressed' ) >= 0 ) {
323
+ errorClass = 'warning';
324
+ errorDashicon = 'warning';
325
+ errorMessage = imagifyBulk.labels.notice;
326
+ } else {
327
+ errors++;
328
+ $( '.imagify-cell-errors' ).html( imagifyBulk.labels.nbrErrors.replace( '%s', errors ) );
329
+ }
330
+
331
+ $attachment.after( '<tr><td colspan="7"><span class="status-' + errorClass + '">' + data.error + '</span></td></tr>' );
332
+
333
+ $attachment.find( '.imagify-cell-status' ).html( '<span class="imagistatus status-' + errorClass + '"><span class="dashicons dashicons-' + errorDashicon + '"></span>' + errorMessage + '</span>' );
334
+ } )
335
+ // After all attachments optimization.
336
+ .done( function( data ) {
337
+ var text2share;
338
+
339
+ $obj.removeAttr( 'disabled' ).find( '.dashicons' ).removeClass( 'rotate' );
340
+
341
+ // Remove confirm dialog before quit the page.
342
+ $( w ).off( 'beforeunload', confirmMessage );
343
+
344
+ // Hide the progress bar.
345
+ $( '.imagify-row-progress' ).slideUp();
346
+
347
+ if ( 'NaN' !== data.global_percent ) {
348
+ // Display the complete section.
349
+ $( '.imagify-row-complete' ).removeClass( 'hidden' ).addClass( 'done' ).attr( 'aria-hidden', 'false' );
350
+ $( 'html, body' ).animate( {
351
+ scrollTop: $( '.imagify-row-complete' ).offset().top
352
+ }, 200 );
353
+
354
+ $( '.imagify-ac-rt-total-gain' ).html( data.global_gain_human );
355
+ $( '.imagify-ac-rt-total-original' ).html( data.global_original_size_human );
356
+
357
+ text2share = imagifyBulk.labels.textToShare;
358
+ text2share = text2share.replace( '%1$s', data.global_gain_human );
359
+ text2share = text2share.replace( '%2$s', data.global_original_size_human );
360
+ text2share = encodeURIComponent( text2share );
361
+
362
+ $( '.imagify-sn-twitter' ).attr( 'href', 'https://twitter.com/intent/tweet?source=webclient&amp;original_referer=' + imagifyBulk.labels.pluginURL + '&amp;text=' + text2share + '&amp;url=' + imagifyBulk.labels.pluginURL + '&amp;related=imagify&amp;hastags=performance,web,wordpress' );
363
+
364
+ $( '.imagify-ac-chart' ).attr( 'data-percent', data.global_percent );
365
+ drawMeCompleteChart( $( '.imagify-ac-chart' ).find( 'canvas' ) );
366
+ }
367
+
368
+ stopOptimization = 0;
369
+ } )
370
+ .error( function( id ) {
371
+ imagify.log( "Can't optimize image with id " + id + "." );
372
+ } )
373
+ .run();
374
  } )
375
+ .fail( function() {
376
+ // Display an error alert.
377
+ swal( {
378
+ title: imagifyBulk.labels.getUnoptimizedImagesErrorTitle,
379
+ html: imagifyBulk.labels.getUnoptimizedImagesErrorText,
380
+ type: 'error',
381
+ customClass: 'imagify-sweet-alert'
382
+ } ).then( function() {
383
+ location.reload();
384
+ } );
 
 
 
385
  } );
 
386
  } );
387
 
388
  } )(jQuery, document, window);
389
 
390
 
391
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
392
 
393
  var width = 700,
394
  height = 290,
assets/js/bulk.min.js CHANGED
@@ -1 +1 @@
1
- window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){function e(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-chart").next(".imagipercent").text(),10),d=[{value:c,color:"#00B3D3"},{value:100-c,color:"#D8D8D8"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}function f(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-ac-chart").attr("data-percent"),10),d=[{value:c,color:"#40B1D0"},{value:100-c,color:"#FFFFFF"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:70,tooltipEvents:[]})})}var g,h,i=b.getElementById("imagify-overview-chart"),j=[{value:imagifyBulk.labels.totalUnoptimizedAttachments,color:"#D9E4EB",highlight:"#D9E4EB",label:imagifyBulk.labels.overviewChartLabels.unoptimized},{value:imagifyBulk.labels.totalOptimizedAttachments,color:"#46B1CE",highlight:"#46B1CE",label:imagifyBulk.labels.overviewChartLabels.optimized},{value:imagifyBulk.labels.totalErrorsAttachments,color:"#2E3242",highlight:"#2E3242",label:imagifyBulk.labels.overviewChartLabels.error}];i&&(g=new Chart(i.getContext("2d")).Doughnut(j,{segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:85,legendTemplate:'<ul class="imagify-<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',tooltipTemplate:"<%= value %>"}),h='<ul class="imagify-doughnut-legend">',a(j).each(function(a){h+='<li><span style="background-color:'+j[a].color+'"></span>'+j[a].label+"</li>"}),h+="</ul>",b.getElementById("imagify-overview-chart-legend").innerHTML=h),a(b).on("heartbeat-send",function(a,b){b.imagify_heartbeat=imagifyBulk.heartbeat_id}),a(b).on("heartbeat-tick",function(b,c){c.imagify_bulk_data&&(c=c.imagify_bulk_data,a("#imagify-overview-chart-percent").html(c.optimized_attachments_percent+"<span>%</span>"),a(".imagify-total-percent").html(c.optimized_attachments_percent+"%"),a(".imagify-unconsumed-percent").html(c.unconsumed_quota+"%"),a(".imagify-unconsumed-bar").css("width",c.unconsumed_quota+"%"),a("#imagify-total-optimized-attachments").html(c.already_optimized_attachments),a("#imagify-original-bar").find(".imagify-barnb").html(c.original_human),a("#imagify-optimized-bar").css("width",c.optimized_percent+"%").find(".imagify-barnb").html(c.optimized_human),a("#imagify-total-optimized-attachments-pct").html(c.optimized_percent+"%"),g.segments[0].value=c.unoptimized_attachments,g.segments[1].value=c.optimized_attachments,g.segments[2].value=c.errors_attachments,g.update())}),a("#imagify-simulate-bulk-action").on("click",function(b){b.preventDefault(),a("#imagify-bulk-action").trigger("click")}),a("#imagify-bulk-action").on("click",function(b){var d,g=a(this),h=a('[name="optimization_level"]:checked').val();b.preventDefault(),void 0===h&&(h=-1),g.attr("disabled")||(g.attr("disabled","disabled"),g.find(".dashicons").addClass("rotate"),d=function(){return imagifyBulk.labels.processing},a(c).on("beforeunload",d),swal({title:imagifyBulk.labels.waitTitle,html:imagifyBulk.labels.waitText,showConfirmButton:!1,imageUrl:imagifyBulk.labels.waitImageUrl}),a.get(ajaxurl+imagify.concat+"action="+imagifyBulk.ajax_action+"&optimization_level="+h+"&imagifybulkuploadnonce="+a("#imagifybulkuploadnonce").val()).done(function(b){var h,i,j="",k="",l=0,m=0,n=0,o=0;if(!b.success)return g.removeAttr("disabled"),g.find(".dashicons").removeClass("rotate"),a(c).off("beforeunload",d),"invalid-api-key"===b.data.message&&(j=imagifyBulk.labels.invalidAPIKeyTitle),"over-quota"===b.data.message&&(j=imagifyBulk.labels.overQuotaTitle,imagifyBulk.labels.overQuotaText),"no-images"===b.data.message&&(j=imagifyBulk.labels.noAttachmentToOptimizeTitle,k=imagifyBulk.labels.noAttachmentToOptimizeText),void swal({title:j,html:k,type:"info",customClass:"imagify-sweet-alert"});swal.close(),a(".imagify-row-progress").slideDown(),a(".imagify-no-uploaded-yet, .imagify-row-complete").hide(200),i=a(".imagify-bulk-table table tbody"),h=new ImagifyGulp({lib:ajaxurl+imagify.concat+"action=imagify_bulk_upload&imagifybulkuploadnonce="+a("#imagifybulkuploadnonce").val(),images:b.data,context:imagifyBulk.ajax_context}),h.before(function(a){i.find(".imagify-row-progress").after('<tr id="attachment-'+a.id+'"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="'+a.thumbnail+'" alt=""/></span><span class="imagifilename">'+a.filename+'</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>'+imagifyBulk.labels.optimizing+'<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>')}).each(function(b){var c=a("#imagify-progress-bar"),d="error",f="dismiss",g=imagifyBulk.labels.error;if(c.css({width:b.progress+"%"}),c.find(".percent").html(b.progress+"%"),b.success)return a("#attachment-"+b.image+" .imagify-cell-status").html('<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>'+imagifyBulk.labels.complete+"</span>"),a("#attachment-"+b.image+" .imagify-cell-original").html(b.original_size_human),a("#attachment-"+b.image+" .imagify-cell-optimized").html(b.new_size_human),a("#attachment-"+b.image+" .imagify-cell-percentage").html('<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">'+b.percent+"</span>%"),e(a("#attachment-"+b.image+" .imagify-cell-percentage").find("canvas")),a("#attachment-"+b.image+" .imagify-cell-thumbnails").html(b.thumbnails),a("#attachment-"+b.image+" .imagify-cell-savings").html(h.humanSize(b.overall_saving,1)),l=l+b.thumbnails+1,a(".imagify-cell-nb-files").html(imagifyBulk.labels.nbrFiles.replace("%s",l)),n+=b.original_overall_size,a(".imagify-total-original").html(h.humanSize(n,1)),o+=b.overall_saving,void a(".imagify-total-gain").html(h.humanSize(o,1));b.error.indexOf("You've consumed all your data")>=0&&swal({title:imagifyBulk.labels.overQuotaTitle,html:imagifyBulk.labels.overQuotaText,type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()}),b.error.indexOf("This image is already compressed")>=0?(d="warning",f="warning",g=imagifyBulk.labels.notice):(m++,a(".imagify-cell-errors").html(imagifyBulk.labels.nbrErrors.replace("%s",m))),a("#attachment-"+b.image).after('<tr><td colspan="7"><span class="status-'+d+'">'+b.error+"</span></td></tr>"),a("#attachment-"+b.image+" .imagify-cell-status").html('<span class="imagistatus status-'+d+'"><span class="dashicons dashicons-'+f+'"></span>'+g+"</span>")}).done(function(b){var e;g.removeAttr("disabled").find(".dashicons").removeClass("rotate"),a(c).off("beforeunload",d),a(".imagify-row-progress").slideUp(),"NaN"!==b.global_percent&&(a(".imagify-row-complete").removeClass("hidden").addClass("done").attr("aria-hidden","false"),a("html, body").animate({scrollTop:a(".imagify-row-complete").offset().top},200),a(".imagify-ac-rt-total-gain").html(b.global_gain_human),a(".imagify-ac-rt-total-original").html(b.global_original_size_human),e=imagifyBulk.labels.textToShare,e=e.replace("%1$s",b.global_gain_human),e=e.replace("%2$s",b.global_original_size_human),e=encodeURIComponent(e),a(".imagify-sn-twitter").attr("href","https://twitter.com/intent/tweet?source=webclient&amp;original_referer="+imagifyBulk.labels.pluginURL+"&amp;text="+e+"&amp;url="+imagifyBulk.labels.pluginURL+"&amp;related=imagify&amp;hastags=performance,web,wordpress"),a(".imagify-ac-chart").attr("data-percent",b.global_percent),f(a(".imagify-ac-chart").find("canvas")))}).error(function(a){imagify.log("Can't optimize image with id "+a+".")}).run()}).fail(function(){swal({title:imagifyBulk.labels.getUnoptimizedImagesErrorTitle,html:imagifyBulk.labels.getUnoptimizedImagesErrorText,type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()})}))})}(jQuery,document,window),function(a,b,c,d){var e,f;c.innerWidth?(e=(c.innerWidth-700)/2,f=(c.innerHeight-290)/2):(e=(b.body.clientWidth-700)/2,f=(b.body.clientHeight-290)/2),[].forEach.call(b.querySelectorAll(".imagify-share-networks a"),function(a){a.addEventListener("click",function(a){c.open(this.href,"","status=no, scrollbars=no, menubar=no, top="+f+", left="+e+", width=700, height=290"),a.preventDefault()},!1)})}(jQuery,document,window);
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){function e(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-chart").next(".imagipercent").text(),10),d=[{value:c,color:"#00B3D3"},{value:100-c,color:"#D8D8D8"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}function f(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-ac-chart").attr("data-percent"),10),d=[{value:c,color:"#40B1D0"},{value:100-c,color:"#FFFFFF"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:70,tooltipEvents:[]})})}var g,h,i=b.getElementById("imagify-overview-chart"),j=[{value:imagifyBulk.labels.totalUnoptimizedAttachments,color:"#D9E4EB",highlight:"#D9E4EB",label:imagifyBulk.labels.overviewChartLabels.unoptimized},{value:imagifyBulk.labels.totalOptimizedAttachments,color:"#46B1CE",highlight:"#46B1CE",label:imagifyBulk.labels.overviewChartLabels.optimized},{value:imagifyBulk.labels.totalErrorsAttachments,color:"#2E3242",highlight:"#2E3242",label:imagifyBulk.labels.overviewChartLabels.error}];i&&(g=new Chart(i.getContext("2d")).Doughnut(j,{segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:85,legendTemplate:'<ul class="imagify-<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',tooltipTemplate:"<%= value %>"}),h='<ul class="imagify-doughnut-legend">',a(j).each(function(a){h+='<li><span style="background-color:'+j[a].color+'"></span>'+j[a].label+"</li>"}),h+="</ul>",b.getElementById("imagify-overview-chart-legend").innerHTML=h),a(b).on("heartbeat-send",function(a,b){b.imagify_heartbeat=imagifyBulk.heartbeat_id}),a(b).on("heartbeat-tick",function(b,c){var d;c.imagify_bulk_data&&(c=c.imagify_bulk_data,d=g.segments,c.unoptimized_attachments===d[0].value&&c.optimized_attachments===d[1].value&&c.errors_attachments===d[2].value||(a("#imagify-overview-chart-percent").html(c.optimized_attachments_percent+"<span>%</span>"),a(".imagify-total-percent").html(c.optimized_attachments_percent+"%"),a(".imagify-unconsumed-percent").html(c.unconsumed_quota+"%"),a(".imagify-unconsumed-bar").css("width",c.unconsumed_quota+"%"),a("#imagify-total-optimized-attachments").html(c.already_optimized_attachments),a("#imagify-original-bar").find(".imagify-barnb").html(c.original_human),a("#imagify-optimized-bar").css("width",c.optimized_percent+"%").find(".imagify-barnb").html(c.optimized_human),a("#imagify-total-optimized-attachments-pct").html(c.optimized_percent+"%"),g.segments[0].value=c.unoptimized_attachments,g.segments[1].value=c.optimized_attachments,g.segments[2].value=c.errors_attachments,g.update()))}),a("#imagify-simulate-bulk-action").on("click",function(b){b.preventDefault(),a("#imagify-bulk-action").trigger("click")}),a("#imagify-bulk-action").on("click",function(b){var d,g=a(this),h=a('[name="optimization_level"]:checked').val();b.preventDefault(),void 0===h&&(h=-1),g.attr("disabled")||(g.attr("disabled","disabled"),g.find(".dashicons").addClass("rotate"),d=function(){return imagifyBulk.labels.processing},a(c).on("beforeunload",d),swal({title:imagifyBulk.labels.waitTitle,html:imagifyBulk.labels.waitText,showConfirmButton:!1,imageUrl:imagifyBulk.labels.waitImageUrl}),a.get(ajaxurl+imagify.concat+"action="+imagifyBulk.ajax_action+"&optimization_level="+h+"&imagifybulkuploadnonce="+a("#imagifybulkuploadnonce").val()).done(function(b){var h,i,j="",k="",l=0,m=0,n=0,o=0,p=0,q=0;if(!b.success)return g.removeAttr("disabled"),g.find(".dashicons").removeClass("rotate"),a(c).off("beforeunload",d),"invalid-api-key"===b.data.message?j=imagifyBulk.labels.invalidAPIKeyTitle:"over-quota"===b.data.message?(j=imagifyBulk.labels.overQuotaTitle,k=imagifyBulk.labels.overQuotaText):"no-images"===b.data.message&&(j=imagifyBulk.labels.noAttachmentToOptimizeTitle,k=imagifyBulk.labels.noAttachmentToOptimizeText),void swal({title:j,html:k,type:"info",customClass:"imagify-sweet-alert"});swal.close(),a(".imagify-row-progress").slideDown(),a(".imagify-no-uploaded-yet, .imagify-row-complete").hide(200),i=a(".imagify-bulk-table table tbody"),h=new ImagifyGulp({buffer_size:imagifyBulk.buffer_size,lib:ajaxurl+imagify.concat+"action=imagify_bulk_upload&imagifybulkuploadnonce="+a("#imagifybulkuploadnonce").val(),images:b.data,context:imagifyBulk.ajax_context}),h.before(function(a){i.find(".imagify-row-progress").after('<tr id="attachment-'+a.id+'"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="'+a.thumbnail+'" alt=""/></span><span class="imagifilename">'+a.filename+'</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>'+imagifyBulk.labels.optimizing+'<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>')}).each(function(b){var c=a("#imagify-progress-bar"),d="error",f="dismiss",g=imagifyBulk.labels.error,i=a("#attachment-"+b.image);if(c.css({width:b.progress+"%"}),c.find(".percent").html(b.progress+"%"),b.success)return++q,i.find(".imagify-cell-status").html('<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>'+imagifyBulk.labels.complete+"</span>"),i.find(".imagify-cell-original").html(b.original_size_human),i.find(".imagify-cell-optimized").html(b.new_size_human),i.find(".imagify-cell-percentage").html('<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart-'+b.image+"-"+q+'" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">'+b.percent+"</span>%"),e(i.find(".imagify-cell-percentage canvas")),i.find(".imagify-cell-thumbnails").html(b.thumbnails),i.find(".imagify-cell-savings").html(h.humanSize(b.overall_saving,1)),l=l+b.thumbnails+1,a(".imagify-cell-nb-files").html(imagifyBulk.labels.nbrFiles.replace("%s",l)),o+=b.original_overall_size,a(".imagify-total-original").html(h.humanSize(o,1)),p+=b.overall_saving,void a(".imagify-total-gain").html(h.humanSize(p,1));!n&&b.error.indexOf("You've consumed all your data")>=0&&(n=1,h.stopProcess(),swal({title:imagifyBulk.labels.overQuotaTitle,html:imagifyBulk.labels.overQuotaText,type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()})),b.error.indexOf("This image is already compressed")>=0?(d="warning",f="warning",g=imagifyBulk.labels.notice):(m++,a(".imagify-cell-errors").html(imagifyBulk.labels.nbrErrors.replace("%s",m))),i.after('<tr><td colspan="7"><span class="status-'+d+'">'+b.error+"</span></td></tr>"),i.find(".imagify-cell-status").html('<span class="imagistatus status-'+d+'"><span class="dashicons dashicons-'+f+'"></span>'+g+"</span>")}).done(function(b){var e;g.removeAttr("disabled").find(".dashicons").removeClass("rotate"),a(c).off("beforeunload",d),a(".imagify-row-progress").slideUp(),"NaN"!==b.global_percent&&(a(".imagify-row-complete").removeClass("hidden").addClass("done").attr("aria-hidden","false"),a("html, body").animate({scrollTop:a(".imagify-row-complete").offset().top},200),a(".imagify-ac-rt-total-gain").html(b.global_gain_human),a(".imagify-ac-rt-total-original").html(b.global_original_size_human),e=imagifyBulk.labels.textToShare,e=e.replace("%1$s",b.global_gain_human),e=e.replace("%2$s",b.global_original_size_human),e=encodeURIComponent(e),a(".imagify-sn-twitter").attr("href","https://twitter.com/intent/tweet?source=webclient&amp;original_referer="+imagifyBulk.labels.pluginURL+"&amp;text="+e+"&amp;url="+imagifyBulk.labels.pluginURL+"&amp;related=imagify&amp;hastags=performance,web,wordpress"),a(".imagify-ac-chart").attr("data-percent",b.global_percent),f(a(".imagify-ac-chart").find("canvas"))),n=0}).error(function(a){imagify.log("Can't optimize image with id "+a+".")}).run()}).fail(function(){swal({title:imagifyBulk.labels.getUnoptimizedImagesErrorTitle,html:imagifyBulk.labels.getUnoptimizedImagesErrorText,type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()})}))})}(jQuery,document,window),function(a,b,c,d){var e,f;c.innerWidth?(e=(c.innerWidth-700)/2,f=(c.innerHeight-290)/2):(e=(b.body.clientWidth-700)/2,f=(b.body.clientHeight-290)/2),[].forEach.call(b.querySelectorAll(".imagify-share-networks a"),function(a){a.addEventListener("click",function(a){c.open(this.href,"","status=no, scrollbars=no, menubar=no, top="+f+", left="+e+", width=700, height=290"),a.preventDefault()},!1)})}(jQuery,document,window);
assets/js/es6-promise.auto.js CHANGED
@@ -3,17 +3,18 @@
3
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
4
  * @license Licensed under MIT license
5
  * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
6
- * @version 4.1.0+f9a5575b
7
  */
8
 
9
  (function (global, factory) {
10
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
11
- typeof define === 'function' && define.amd ? define(factory) :
12
- (global.ES6Promise = factory());
13
  }(this, (function () { 'use strict';
14
 
15
  function objectOrFunction(x) {
16
- return typeof x === 'function' || typeof x === 'object' && x !== null;
 
17
  }
18
 
19
  function isFunction(x) {
@@ -21,12 +22,12 @@ function isFunction(x) {
21
  }
22
 
23
  var _isArray = undefined;
24
- if (!Array.isArray) {
 
 
25
  _isArray = function (x) {
26
  return Object.prototype.toString.call(x) === '[object Array]';
27
  };
28
- } else {
29
- _isArray = Array.isArray;
30
  }
31
 
32
  var isArray = _isArray;
@@ -214,7 +215,7 @@ function then(onFulfillment, onRejection) {
214
  @return {Promise} a promise that will become fulfilled with the given
215
  `value`
216
  */
217
- function resolve(object) {
218
  /*jshint validthis:true */
219
  var Constructor = this;
220
 
@@ -223,7 +224,7 @@ function resolve(object) {
223
  }
224
 
225
  var promise = new Constructor(noop);
226
- _resolve(promise, object);
227
  return promise;
228
  }
229
 
@@ -254,24 +255,24 @@ function getThen(promise) {
254
  }
255
  }
256
 
257
- function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
258
  try {
259
- then.call(value, fulfillmentHandler, rejectionHandler);
260
  } catch (e) {
261
  return e;
262
  }
263
  }
264
 
265
- function handleForeignThenable(promise, thenable, then) {
266
  asap(function (promise) {
267
  var sealed = false;
268
- var error = tryThen(then, thenable, function (value) {
269
  if (sealed) {
270
  return;
271
  }
272
  sealed = true;
273
  if (thenable !== value) {
274
- _resolve(promise, value);
275
  } else {
276
  fulfill(promise, value);
277
  }
@@ -281,12 +282,12 @@ function handleForeignThenable(promise, thenable, then) {
281
  }
282
  sealed = true;
283
 
284
- _reject(promise, reason);
285
  }, 'Settle: ' + (promise._label || ' unknown promise'));
286
 
287
  if (!sealed && error) {
288
  sealed = true;
289
- _reject(promise, error);
290
  }
291
  }, promise);
292
  }
@@ -295,36 +296,36 @@ function handleOwnThenable(promise, thenable) {
295
  if (thenable._state === FULFILLED) {
296
  fulfill(promise, thenable._result);
297
  } else if (thenable._state === REJECTED) {
298
- _reject(promise, thenable._result);
299
  } else {
300
  subscribe(thenable, undefined, function (value) {
301
- return _resolve(promise, value);
302
  }, function (reason) {
303
- return _reject(promise, reason);
304
  });
305
  }
306
  }
307
 
308
- function handleMaybeThenable(promise, maybeThenable, then$$) {
309
- if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
310
  handleOwnThenable(promise, maybeThenable);
311
  } else {
312
- if (then$$ === GET_THEN_ERROR) {
313
- _reject(promise, GET_THEN_ERROR.error);
314
  GET_THEN_ERROR.error = null;
315
- } else if (then$$ === undefined) {
316
  fulfill(promise, maybeThenable);
317
- } else if (isFunction(then$$)) {
318
- handleForeignThenable(promise, maybeThenable, then$$);
319
  } else {
320
  fulfill(promise, maybeThenable);
321
  }
322
  }
323
  }
324
 
325
- function _resolve(promise, value) {
326
  if (promise === value) {
327
- _reject(promise, selfFulfillment());
328
  } else if (objectOrFunction(value)) {
329
  handleMaybeThenable(promise, value, getThen(value));
330
  } else {
@@ -353,7 +354,7 @@ function fulfill(promise, value) {
353
  }
354
  }
355
 
356
- function _reject(promise, reason) {
357
  if (promise._state !== PENDING) {
358
  return;
359
  }
@@ -438,7 +439,7 @@ function invokeCallback(settled, promise, callback, detail) {
438
  }
439
 
440
  if (promise === value) {
441
- _reject(promise, cannotReturnOwn());
442
  return;
443
  }
444
  } else {
@@ -449,25 +450,25 @@ function invokeCallback(settled, promise, callback, detail) {
449
  if (promise._state !== PENDING) {
450
  // noop
451
  } else if (hasCallback && succeeded) {
452
- _resolve(promise, value);
453
  } else if (failed) {
454
- _reject(promise, error);
455
  } else if (settled === FULFILLED) {
456
  fulfill(promise, value);
457
  } else if (settled === REJECTED) {
458
- _reject(promise, value);
459
  }
460
  }
461
 
462
  function initializePromise(promise, resolver) {
463
  try {
464
  resolver(function resolvePromise(value) {
465
- _resolve(promise, value);
466
  }, function rejectPromise(reason) {
467
- _reject(promise, reason);
468
  });
469
  } catch (e) {
470
- _reject(promise, e);
471
  }
472
  }
473
 
@@ -483,7 +484,7 @@ function makePromise(promise) {
483
  promise._subscribers = [];
484
  }
485
 
486
- function Enumerator(Constructor, input) {
487
  this._instanceConstructor = Constructor;
488
  this.promise = new Constructor(noop);
489
 
@@ -492,7 +493,6 @@ function Enumerator(Constructor, input) {
492
  }
493
 
494
  if (isArray(input)) {
495
- this._input = input;
496
  this.length = input.length;
497
  this._remaining = input.length;
498
 
@@ -502,34 +502,31 @@ function Enumerator(Constructor, input) {
502
  fulfill(this.promise, this._result);
503
  } else {
504
  this.length = this.length || 0;
505
- this._enumerate();
506
  if (this._remaining === 0) {
507
  fulfill(this.promise, this._result);
508
  }
509
  }
510
  } else {
511
- _reject(this.promise, validationError());
512
  }
513
  }
514
 
515
  function validationError() {
516
  return new Error('Array Methods must be provided an Array');
517
- };
518
-
519
- Enumerator.prototype._enumerate = function () {
520
- var length = this.length;
521
- var _input = this._input;
522
 
523
- for (var i = 0; this._state === PENDING && i < length; i++) {
524
- this._eachEntry(_input[i], i);
 
525
  }
526
  };
527
 
528
- Enumerator.prototype._eachEntry = function (entry, i) {
529
  var c = this._instanceConstructor;
530
- var resolve$$ = c.resolve;
531
 
532
- if (resolve$$ === resolve) {
533
  var _then = getThen(entry);
534
 
535
  if (_then === then && entry._state !== PENDING) {
@@ -537,28 +534,28 @@ Enumerator.prototype._eachEntry = function (entry, i) {
537
  } else if (typeof _then !== 'function') {
538
  this._remaining--;
539
  this._result[i] = entry;
540
- } else if (c === Promise) {
541
  var promise = new c(noop);
542
  handleMaybeThenable(promise, entry, _then);
543
  this._willSettleAt(promise, i);
544
  } else {
545
- this._willSettleAt(new c(function (resolve$$) {
546
- return resolve$$(entry);
547
  }), i);
548
  }
549
  } else {
550
- this._willSettleAt(resolve$$(entry), i);
551
  }
552
  };
553
 
554
- Enumerator.prototype._settledAt = function (state, i, value) {
555
  var promise = this.promise;
556
 
557
  if (promise._state === PENDING) {
558
  this._remaining--;
559
 
560
  if (state === REJECTED) {
561
- _reject(promise, value);
562
  } else {
563
  this._result[i] = value;
564
  }
@@ -569,7 +566,7 @@ Enumerator.prototype._settledAt = function (state, i, value) {
569
  }
570
  };
571
 
572
- Enumerator.prototype._willSettleAt = function (promise, i) {
573
  var enumerator = this;
574
 
575
  subscribe(promise, undefined, function (value) {
@@ -626,8 +623,8 @@ Enumerator.prototype._willSettleAt = function (promise, i) {
626
  fulfilled, or rejected if any of them become rejected.
627
  @static
628
  */
629
- function all(entries) {
630
- return new Enumerator(this, entries).promise;
631
  }
632
 
633
  /**
@@ -695,7 +692,7 @@ function all(entries) {
695
  @return {Promise} a promise which settles in the same way as the first passed
696
  promise to settle.
697
  */
698
- function race(entries) {
699
  /*jshint validthis:true */
700
  var Constructor = this;
701
 
@@ -747,11 +744,11 @@ function race(entries) {
747
  Useful for tooling.
748
  @return {Promise} a promise rejected with the given `reason`.
749
  */
750
- function reject(reason) {
751
  /*jshint validthis:true */
752
  var Constructor = this;
753
  var promise = new Constructor(noop);
754
- _reject(promise, reason);
755
  return promise;
756
  }
757
 
@@ -866,33 +863,33 @@ function needsNew() {
866
  Useful for tooling.
867
  @constructor
868
  */
869
- function Promise(resolver) {
870
  this[PROMISE_ID] = nextId();
871
  this._result = this._state = undefined;
872
  this._subscribers = [];
873
 
874
  if (noop !== resolver) {
875
  typeof resolver !== 'function' && needsResolver();
876
- this instanceof Promise ? initializePromise(this, resolver) : needsNew();
877
  }
878
  }
879
 
880
- Promise.all = all;
881
- Promise.race = race;
882
- Promise.resolve = resolve;
883
- Promise.reject = reject;
884
- Promise._setScheduler = setScheduler;
885
- Promise._setAsap = setAsap;
886
- Promise._asap = asap;
887
 
888
- Promise.prototype = {
889
- constructor: Promise,
890
 
891
  /**
892
  The primary way of interacting with a promise is through its `then` method,
893
  which registers callbacks to receive either a promise's eventual value or the
894
  reason why the promise cannot be fulfilled.
895
-
896
  ```js
897
  findUser().then(function(user){
898
  // user is available
@@ -900,14 +897,14 @@ Promise.prototype = {
900
  // user is unavailable, and you are given the reason why
901
  });
902
  ```
903
-
904
  Chaining
905
  --------
906
-
907
  The return value of `then` is itself a promise. This second, 'downstream'
908
  promise is resolved with the return value of the first promise's fulfillment
909
  or rejection handler, or rejected if the handler throws an exception.
910
-
911
  ```js
912
  findUser().then(function (user) {
913
  return user.name;
@@ -917,7 +914,7 @@ Promise.prototype = {
917
  // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
918
  // will be `'default name'`
919
  });
920
-
921
  findUser().then(function (user) {
922
  throw new Error('Found user, but still unhappy');
923
  }, function (reason) {
@@ -930,7 +927,7 @@ Promise.prototype = {
930
  });
931
  ```
932
  If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
933
-
934
  ```js
935
  findUser().then(function (user) {
936
  throw new PedagogicalException('Upstream error');
@@ -942,15 +939,15 @@ Promise.prototype = {
942
  // The `PedgagocialException` is propagated all the way down to here
943
  });
944
  ```
945
-
946
  Assimilation
947
  ------------
948
-
949
  Sometimes the value you want to propagate to a downstream promise can only be
950
  retrieved asynchronously. This can be achieved by returning a promise in the
951
  fulfillment or rejection handler. The downstream promise will then be pending
952
  until the returned promise is settled. This is called *assimilation*.
953
-
954
  ```js
955
  findUser().then(function (user) {
956
  return findCommentsByAuthor(user);
@@ -958,9 +955,9 @@ Promise.prototype = {
958
  // The user's comments are now available
959
  });
960
  ```
961
-
962
  If the assimliated promise rejects, then the downstream promise will also reject.
963
-
964
  ```js
965
  findUser().then(function (user) {
966
  return findCommentsByAuthor(user);
@@ -970,15 +967,15 @@ Promise.prototype = {
970
  // If `findCommentsByAuthor` rejects, we'll have the reason here
971
  });
972
  ```
973
-
974
  Simple Example
975
  --------------
976
-
977
  Synchronous Example
978
-
979
  ```javascript
980
  let result;
981
-
982
  try {
983
  result = findResult();
984
  // success
@@ -986,9 +983,9 @@ Promise.prototype = {
986
  // failure
987
  }
988
  ```
989
-
990
  Errback Example
991
-
992
  ```js
993
  findResult(function(result, err){
994
  if (err) {
@@ -998,9 +995,9 @@ Promise.prototype = {
998
  }
999
  });
1000
  ```
1001
-
1002
  Promise Example;
1003
-
1004
  ```javascript
1005
  findResult().then(function(result){
1006
  // success
@@ -1008,15 +1005,15 @@ Promise.prototype = {
1008
  // failure
1009
  });
1010
  ```
1011
-
1012
  Advanced Example
1013
  --------------
1014
-
1015
  Synchronous Example
1016
-
1017
  ```javascript
1018
  let author, books;
1019
-
1020
  try {
1021
  author = findAuthor();
1022
  books = findBooksByAuthor(author);
@@ -1025,19 +1022,19 @@ Promise.prototype = {
1025
  // failure
1026
  }
1027
  ```
1028
-
1029
  Errback Example
1030
-
1031
  ```js
1032
-
1033
  function foundBooks(books) {
1034
-
1035
  }
1036
-
1037
  function failure(reason) {
1038
-
1039
  }
1040
-
1041
  findAuthor(function(author, err){
1042
  if (err) {
1043
  failure(err);
@@ -1062,9 +1059,9 @@ Promise.prototype = {
1062
  }
1063
  });
1064
  ```
1065
-
1066
  Promise Example;
1067
-
1068
  ```javascript
1069
  findAuthor().
1070
  then(findBooksByAuthor).
@@ -1074,7 +1071,7 @@ Promise.prototype = {
1074
  // something went wrong
1075
  });
1076
  ```
1077
-
1078
  @method then
1079
  @param {Function} onFulfilled
1080
  @param {Function} onRejected
@@ -1086,25 +1083,25 @@ Promise.prototype = {
1086
  /**
1087
  `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
1088
  as the catch block of a try/catch statement.
1089
-
1090
  ```js
1091
  function findAuthor(){
1092
  throw new Error('couldn't find that author');
1093
  }
1094
-
1095
  // synchronous
1096
  try {
1097
  findAuthor();
1098
  } catch(reason) {
1099
  // something went wrong
1100
  }
1101
-
1102
  // async with promises
1103
  findAuthor().catch(function(reason){
1104
  // something went wrong
1105
  });
1106
  ```
1107
-
1108
  @method catch
1109
  @param {Function} onRejection
1110
  Useful for tooling.
@@ -1115,7 +1112,8 @@ Promise.prototype = {
1115
  }
1116
  };
1117
 
1118
- function polyfill() {
 
1119
  var local = undefined;
1120
 
1121
  if (typeof global !== 'undefined') {
@@ -1145,16 +1143,17 @@ function polyfill() {
1145
  }
1146
  }
1147
 
1148
- local.Promise = Promise;
1149
  }
1150
 
1151
  // Strange compat..
1152
- Promise.polyfill = polyfill;
1153
- Promise.Promise = Promise;
1154
 
1155
- Promise.polyfill();
1156
 
1157
- return Promise;
1158
 
1159
  })));
 
1160
  //# sourceMappingURL=es6-promise.auto.map
3
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
4
  * @license Licensed under MIT license
5
  * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
6
+ * @version 4.1.1+f046478d
7
  */
8
 
9
  (function (global, factory) {
10
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
11
+ typeof define === 'function' && define.amd ? define(factory) :
12
+ (global.ES6Promise = factory());
13
  }(this, (function () { 'use strict';
14
 
15
  function objectOrFunction(x) {
16
+ var type = typeof x;
17
+ return x !== null && (type === 'object' || type === 'function');
18
  }
19
 
20
  function isFunction(x) {
22
  }
23
 
24
  var _isArray = undefined;
25
+ if (Array.isArray) {
26
+ _isArray = Array.isArray;
27
+ } else {
28
  _isArray = function (x) {
29
  return Object.prototype.toString.call(x) === '[object Array]';
30
  };
 
 
31
  }
32
 
33
  var isArray = _isArray;
215
  @return {Promise} a promise that will become fulfilled with the given
216
  `value`
217
  */
218
+ function resolve$1(object) {
219
  /*jshint validthis:true */
220
  var Constructor = this;
221
 
224
  }
225
 
226
  var promise = new Constructor(noop);
227
+ resolve(promise, object);
228
  return promise;
229
  }
230
 
255
  }
256
  }
257
 
258
+ function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
259
  try {
260
+ then$$1.call(value, fulfillmentHandler, rejectionHandler);
261
  } catch (e) {
262
  return e;
263
  }
264
  }
265
 
266
+ function handleForeignThenable(promise, thenable, then$$1) {
267
  asap(function (promise) {
268
  var sealed = false;
269
+ var error = tryThen(then$$1, thenable, function (value) {
270
  if (sealed) {
271
  return;
272
  }
273
  sealed = true;
274
  if (thenable !== value) {
275
+ resolve(promise, value);
276
  } else {
277
  fulfill(promise, value);
278
  }
282
  }
283
  sealed = true;
284
 
285
+ reject(promise, reason);
286
  }, 'Settle: ' + (promise._label || ' unknown promise'));
287
 
288
  if (!sealed && error) {
289
  sealed = true;
290
+ reject(promise, error);
291
  }
292
  }, promise);
293
  }
296
  if (thenable._state === FULFILLED) {
297
  fulfill(promise, thenable._result);
298
  } else if (thenable._state === REJECTED) {
299
+ reject(promise, thenable._result);
300
  } else {
301
  subscribe(thenable, undefined, function (value) {
302
+ return resolve(promise, value);
303
  }, function (reason) {
304
+ return reject(promise, reason);
305
  });
306
  }
307
  }
308
 
309
+ function handleMaybeThenable(promise, maybeThenable, then$$1) {
310
+ if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
311
  handleOwnThenable(promise, maybeThenable);
312
  } else {
313
+ if (then$$1 === GET_THEN_ERROR) {
314
+ reject(promise, GET_THEN_ERROR.error);
315
  GET_THEN_ERROR.error = null;
316
+ } else if (then$$1 === undefined) {
317
  fulfill(promise, maybeThenable);
318
+ } else if (isFunction(then$$1)) {
319
+ handleForeignThenable(promise, maybeThenable, then$$1);
320
  } else {
321
  fulfill(promise, maybeThenable);
322
  }
323
  }
324
  }
325
 
326
+ function resolve(promise, value) {
327
  if (promise === value) {
328
+ reject(promise, selfFulfillment());
329
  } else if (objectOrFunction(value)) {
330
  handleMaybeThenable(promise, value, getThen(value));
331
  } else {
354
  }
355
  }
356
 
357
+ function reject(promise, reason) {
358
  if (promise._state !== PENDING) {
359
  return;
360
  }
439
  }
440
 
441
  if (promise === value) {
442
+ reject(promise, cannotReturnOwn());
443
  return;
444
  }
445
  } else {
450
  if (promise._state !== PENDING) {
451
  // noop
452
  } else if (hasCallback && succeeded) {
453
+ resolve(promise, value);
454
  } else if (failed) {
455
+ reject(promise, error);
456
  } else if (settled === FULFILLED) {
457
  fulfill(promise, value);
458
  } else if (settled === REJECTED) {
459
+ reject(promise, value);
460
  }
461
  }
462
 
463
  function initializePromise(promise, resolver) {
464
  try {
465
  resolver(function resolvePromise(value) {
466
+ resolve(promise, value);
467
  }, function rejectPromise(reason) {
468
+ reject(promise, reason);
469
  });
470
  } catch (e) {
471
+ reject(promise, e);
472
  }
473
  }
474
 
484
  promise._subscribers = [];
485
  }
486
 
487
+ function Enumerator$1(Constructor, input) {
488
  this._instanceConstructor = Constructor;
489
  this.promise = new Constructor(noop);
490
 
493
  }
494
 
495
  if (isArray(input)) {
 
496
  this.length = input.length;
497
  this._remaining = input.length;
498
 
502
  fulfill(this.promise, this._result);
503
  } else {
504
  this.length = this.length || 0;
505
+ this._enumerate(input);
506
  if (this._remaining === 0) {
507
  fulfill(this.promise, this._result);
508
  }
509
  }
510
  } else {
511
+ reject(this.promise, validationError());
512
  }
513
  }
514
 
515
  function validationError() {
516
  return new Error('Array Methods must be provided an Array');
517
+ }
 
 
 
 
518
 
519
+ Enumerator$1.prototype._enumerate = function (input) {
520
+ for (var i = 0; this._state === PENDING && i < input.length; i++) {
521
+ this._eachEntry(input[i], i);
522
  }
523
  };
524
 
525
+ Enumerator$1.prototype._eachEntry = function (entry, i) {
526
  var c = this._instanceConstructor;
527
+ var resolve$$1 = c.resolve;
528
 
529
+ if (resolve$$1 === resolve$1) {
530
  var _then = getThen(entry);
531
 
532
  if (_then === then && entry._state !== PENDING) {
534
  } else if (typeof _then !== 'function') {
535
  this._remaining--;
536
  this._result[i] = entry;
537
+ } else if (c === Promise$3) {
538
  var promise = new c(noop);
539
  handleMaybeThenable(promise, entry, _then);
540
  this._willSettleAt(promise, i);
541
  } else {
542
+ this._willSettleAt(new c(function (resolve$$1) {
543
+ return resolve$$1(entry);
544
  }), i);
545
  }
546
  } else {
547
+ this._willSettleAt(resolve$$1(entry), i);
548
  }
549
  };
550
 
551
+ Enumerator$1.prototype._settledAt = function (state, i, value) {
552
  var promise = this.promise;
553
 
554
  if (promise._state === PENDING) {
555
  this._remaining--;
556
 
557
  if (state === REJECTED) {
558
+ reject(promise, value);
559
  } else {
560
  this._result[i] = value;
561
  }
566
  }
567
  };
568
 
569
+ Enumerator$1.prototype._willSettleAt = function (promise, i) {
570
  var enumerator = this;
571
 
572
  subscribe(promise, undefined, function (value) {
623
  fulfilled, or rejected if any of them become rejected.
624
  @static
625
  */
626
+ function all$1(entries) {
627
+ return new Enumerator$1(this, entries).promise;
628
  }
629
 
630
  /**
692
  @return {Promise} a promise which settles in the same way as the first passed
693
  promise to settle.
694
  */
695
+ function race$1(entries) {
696
  /*jshint validthis:true */
697
  var Constructor = this;
698
 
744
  Useful for tooling.
745
  @return {Promise} a promise rejected with the given `reason`.
746
  */
747
+ function reject$1(reason) {
748
  /*jshint validthis:true */
749
  var Constructor = this;
750
  var promise = new Constructor(noop);
751
+ reject(promise, reason);
752
  return promise;
753
  }
754
 
863
  Useful for tooling.
864
  @constructor
865
  */
866
+ function Promise$3(resolver) {
867
  this[PROMISE_ID] = nextId();
868
  this._result = this._state = undefined;
869
  this._subscribers = [];
870
 
871
  if (noop !== resolver) {
872
  typeof resolver !== 'function' && needsResolver();
873
+ this instanceof Promise$3 ? initializePromise(this, resolver) : needsNew();
874
  }
875
  }
876
 
877
+ Promise$3.all = all$1;
878
+ Promise$3.race = race$1;
879
+ Promise$3.resolve = resolve$1;
880
+ Promise$3.reject = reject$1;
881
+ Promise$3._setScheduler = setScheduler;
882
+ Promise$3._setAsap = setAsap;
883
+ Promise$3._asap = asap;
884
 
885
+ Promise$3.prototype = {
886
+ constructor: Promise$3,
887
 
888
  /**
889
  The primary way of interacting with a promise is through its `then` method,
890
  which registers callbacks to receive either a promise's eventual value or the
891
  reason why the promise cannot be fulfilled.
892
+
893
  ```js
894
  findUser().then(function(user){
895
  // user is available
897
  // user is unavailable, and you are given the reason why
898
  });
899
  ```
900
+
901
  Chaining
902
  --------
903
+
904
  The return value of `then` is itself a promise. This second, 'downstream'
905
  promise is resolved with the return value of the first promise's fulfillment
906
  or rejection handler, or rejected if the handler throws an exception.
907
+
908
  ```js
909
  findUser().then(function (user) {
910
  return user.name;
914
  // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
915
  // will be `'default name'`
916
  });
917
+
918
  findUser().then(function (user) {
919
  throw new Error('Found user, but still unhappy');
920
  }, function (reason) {
927
  });
928
  ```
929
  If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
930
+
931
  ```js
932
  findUser().then(function (user) {
933
  throw new PedagogicalException('Upstream error');
939
  // The `PedgagocialException` is propagated all the way down to here
940
  });
941
  ```
942
+
943
  Assimilation
944
  ------------
945
+
946
  Sometimes the value you want to propagate to a downstream promise can only be
947
  retrieved asynchronously. This can be achieved by returning a promise in the
948
  fulfillment or rejection handler. The downstream promise will then be pending
949
  until the returned promise is settled. This is called *assimilation*.
950
+
951
  ```js
952
  findUser().then(function (user) {
953
  return findCommentsByAuthor(user);
955
  // The user's comments are now available
956
  });
957
  ```
958
+
959
  If the assimliated promise rejects, then the downstream promise will also reject.
960
+
961
  ```js
962
  findUser().then(function (user) {
963
  return findCommentsByAuthor(user);
967
  // If `findCommentsByAuthor` rejects, we'll have the reason here
968
  });
969
  ```
970
+
971
  Simple Example
972
  --------------
973
+
974
  Synchronous Example
975
+
976
  ```javascript
977
  let result;
978
+
979
  try {
980
  result = findResult();
981
  // success
983
  // failure
984
  }
985
  ```
986
+
987
  Errback Example
988
+
989
  ```js
990
  findResult(function(result, err){
991
  if (err) {
995
  }
996
  });
997
  ```
998
+
999
  Promise Example;
1000
+
1001
  ```javascript
1002
  findResult().then(function(result){
1003
  // success
1005
  // failure
1006
  });
1007
  ```
1008
+
1009
  Advanced Example
1010
  --------------
1011
+
1012
  Synchronous Example
1013
+
1014
  ```javascript
1015
  let author, books;
1016
+
1017
  try {
1018
  author = findAuthor();
1019
  books = findBooksByAuthor(author);
1022
  // failure
1023
  }
1024
  ```
1025
+
1026
  Errback Example
1027
+
1028
  ```js
1029
+
1030
  function foundBooks(books) {
1031
+
1032
  }
1033
+
1034
  function failure(reason) {
1035
+
1036
  }
1037
+
1038
  findAuthor(function(author, err){
1039
  if (err) {
1040
  failure(err);
1059
  }
1060
  });
1061
  ```
1062
+
1063
  Promise Example;
1064
+
1065
  ```javascript
1066
  findAuthor().
1067
  then(findBooksByAuthor).
1071
  // something went wrong
1072
  });
1073
  ```
1074
+
1075
  @method then
1076
  @param {Function} onFulfilled
1077
  @param {Function} onRejected
1083
  /**
1084
  `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
1085
  as the catch block of a try/catch statement.
1086
+
1087
  ```js
1088
  function findAuthor(){
1089
  throw new Error('couldn't find that author');
1090
  }
1091
+
1092
  // synchronous
1093
  try {
1094
  findAuthor();
1095
  } catch(reason) {
1096
  // something went wrong
1097
  }
1098
+
1099
  // async with promises
1100
  findAuthor().catch(function(reason){
1101
  // something went wrong
1102
  });
1103
  ```
1104
+
1105
  @method catch
1106
  @param {Function} onRejection
1107
  Useful for tooling.
1112
  }
1113
  };
1114
 
1115
+ /*global self*/
1116
+ function polyfill$1() {
1117
  var local = undefined;
1118
 
1119
  if (typeof global !== 'undefined') {
1143
  }
1144
  }
1145
 
1146
+ local.Promise = Promise$3;
1147
  }
1148
 
1149
  // Strange compat..
1150
+ Promise$3.polyfill = polyfill$1;
1151
+ Promise$3.Promise = Promise$3;
1152
 
1153
+ Promise$3.polyfill();
1154
 
1155
+ return Promise$3;
1156
 
1157
  })));
1158
+
1159
  //# sourceMappingURL=es6-promise.auto.map
assets/js/es6-promise.auto.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function e(t){return"function"==typeof t}function n(t){I=t}function r(t){J=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof H?function(){H(a)}:c()}function s(){var t=0,e=new V(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<G;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}G=0}function f(){try{var t=require,e=t("vertx");return H=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=arguments,r=this,o=new this.constructor(p);void 0===o[et]&&k(o);var i=r._state;return i?!function(){var t=n[i-1];J(function(){return x(i,o,t,r._result)})}():E(r,o,t,e),o}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return it.error=e,it}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){J(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===rt?S(t,e._result):e._state===ot?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===it?(j(t,it.error),it.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===nt&&(t._result=e,t._state=rt,0!==t._subscribers.length&&J(T,t))}function j(t,e){t._state===nt&&(t._state=ot,t._result=e,J(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+rt]=n,o[i+ot]=r,0===i&&t._state&&J(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function M(){this.error=null}function P(t,e){try{return t(e)}catch(n){return st.error=n,st}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=P(r,o),s===st?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==nt||(i&&c?g(n,s):a?j(n,u):t===rt?S(n,s):t===ot&&j(n,s))}function C(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return ut++}function k(t){t[et]=ut++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[et]||k(this.promise),B(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,q())}function q(){return new Error("Array Methods must be provided an Array")}function F(t){return new Y(this,t).promise}function D(t){var e=this;return new e(B(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function K(t){var e=this,n=new e(p);return j(n,t),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this[et]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&L(),this instanceof U?C(this,t):N())}function W(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=U}var z=void 0;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B=z,G=0,H=void 0,I=void 0,J=function(t,e){$[G]=t,$[G+1]=e,G+=2,2===G&&(I?I(a):tt())},Q="undefined"!=typeof window?window:void 0,R=Q||{},V=R.MutationObserver||R.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),tt=void 0;tt=X?o():V?s():Z?u():void 0===Q&&"function"==typeof require?f():c();var et=Math.random().toString(36).substring(16),nt=void 0,rt=1,ot=2,it=new M,st=new M,ut=0;return Y.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===nt&&n<t;n++)this._eachEntry(e[n],n)},Y.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==nt)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===U){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},Y.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===nt&&(this._remaining--,t===ot?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},Y.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(rt,e,t)},function(t){return n._settledAt(ot,e,t)})},U.all=F,U.race=D,U.resolve=h,U.reject=K,U._setScheduler=n,U._setAsap=r,U._asap=J,U.prototype={constructor:U,then:l,"catch":function(t){return this.then(null,t)}},U.polyfill=W,U.Promise=U,U.polyfill(),U});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){I=t}function r(t){J=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof H?function(){H(a)}:c()}function s(){var t=0,e=new V(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<G;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}G=0}function f(){try{var t=require,e=t("vertx");return H=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=arguments,r=this,o=new this.constructor(p);void 0===o[et]&&k(o);var i=r._state;return i?!function(){var t=n[i-1];J(function(){return x(i,o,t,r._result)})}():E(r,o,t,e),o}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return it.error=e,it}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){J(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===rt?S(t,e._result):e._state===ot?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===it?(j(t,it.error),it.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===nt&&(t._result=e,t._state=rt,0!==t._subscribers.length&&J(T,t))}function j(t,e){t._state===nt&&(t._state=ot,t._result=e,J(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+rt]=n,o[i+ot]=r,0===i&&t._state&&J(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function M(){this.error=null}function P(t,e){try{return t(e)}catch(n){return st.error=n,st}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=P(r,o),s===st?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==nt||(i&&c?g(n,s):a?j(n,u):t===rt?S(n,s):t===ot&&j(n,s))}function C(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return ut++}function k(t){t[et]=ut++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[et]||k(this.promise),B(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&S(this.promise,this._result))):j(this.promise,q())}function q(){return new Error("Array Methods must be provided an Array")}function F(t){return new Y(this,t).promise}function D(t){var e=this;return new e(B(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function K(t){var e=this,n=new e(p);return j(n,t),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this[et]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&L(),this instanceof U?C(this,t):N())}function W(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=U}var z=void 0;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B=z,G=0,H=void 0,I=void 0,J=function(t,e){$[G]=t,$[G+1]=e,G+=2,2===G&&(I?I(a):tt())},Q="undefined"!=typeof window?window:void 0,R=Q||{},V=R.MutationObserver||R.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),tt=void 0;tt=X?o():V?s():Z?u():void 0===Q&&"function"==typeof require?f():c();var et=Math.random().toString(36).substring(16),nt=void 0,rt=1,ot=2,it=new M,st=new M,ut=0;return Y.prototype._enumerate=function(t){for(var e=0;this._state===nt&&e<t.length;e++)this._eachEntry(t[e],e)},Y.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==nt)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===U){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},Y.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===nt&&(this._remaining--,t===ot?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},Y.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(rt,e,t)},function(t){return n._settledAt(ot,e,t)})},U.all=F,U.race=D,U.resolve=h,U.reject=K,U._setScheduler=n,U._setAsap=r,U._asap=J,U.prototype={constructor:U,then:l,"catch":function(t){return this.then(null,t)}},U.polyfill=W,U.Promise=U,U.polyfill(),U});
assets/js/imagify-gulp.js ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * imagify-gulpjs - version 0.0.1 - 2017-07-28
3
+ * WP Media <contact@wp-media.me>
4
+ */
5
+ 'use strict';
6
+
7
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
+
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+
11
+ var ImagifyGulp = function () {
12
+ function ImagifyGulp(settings) {
13
+ _classCallCheck(this, ImagifyGulp);
14
+
15
+ this.buffer_size = settings.buffer_size || 1;
16
+ this.lib_url = settings.lib;
17
+ this.default_thumb = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==";
18
+ this.images = settings.images;
19
+ this.images_ids = Object.keys(settings.images);
20
+ this.total_images = this.images_ids.length;
21
+ this.processed_images = 0;
22
+ this.inprocess_images = 0;
23
+ this._before = new Function();
24
+ this._each = new Function();
25
+ this._done = new Function();
26
+ this._error = new Function();
27
+ this.total_original_size = 0;
28
+ this.total_optimized_size = 0;
29
+ this.total_gain = 0;
30
+ this.total_percent = 0;
31
+ this.global_original_size = 0;
32
+ this.global_optimized_size = 0;
33
+ this.global_gain = 0;
34
+ this.global_percent = 0;
35
+ this.context = settings.context || 'wp';
36
+ }
37
+
38
+ _createClass(ImagifyGulp, [{
39
+ key: 'before',
40
+ value: function before(fnc) {
41
+ this._before = fnc;
42
+ return this;
43
+ }
44
+ }, {
45
+ key: 'each',
46
+ value: function each(fnc) {
47
+ this._each = fnc;
48
+ return this;
49
+ }
50
+ }, {
51
+ key: 'done',
52
+ value: function done(fnc) {
53
+ this._done = fnc;
54
+ return this;
55
+ }
56
+ }, {
57
+ key: 'error',
58
+ value: function error(fnc) {
59
+ this._error = fnc;
60
+ return this;
61
+ }
62
+ }, {
63
+ key: 'humanSize',
64
+ value: function humanSize(bytes) {
65
+ if (0 === bytes) return '0\xA0kB';
66
+
67
+ var sizes = ['B', 'kB', 'MB'],
68
+ i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10);
69
+
70
+ return (bytes / Math.pow(1024, i)).toFixed(2) + '\xA0' + sizes[i];
71
+ }
72
+ }, {
73
+ key: 'run',
74
+ value: function run() {
75
+ var cpt = this.images_ids.length > this.buffer_size ? this.buffer_size : this.images_ids.length;
76
+
77
+ for (var i = 0; i < cpt; i++) {
78
+ var id = this.images_ids.shift();
79
+ this.process(id);
80
+ }
81
+
82
+ return this;
83
+ }
84
+ }, {
85
+ key: 'stopProcess',
86
+ value: function stopProcess() {
87
+ this.total_images = this.total_images - this.images_ids.length;
88
+ this.images_ids = [];
89
+ return this;
90
+ }
91
+ }, {
92
+ key: 'process',
93
+ value: function process(id) {
94
+ this.inprocess_images++;
95
+
96
+ var data = {
97
+ id: id,
98
+ image_id: parseInt(id.toString().substr(1), 10),
99
+ image_src: this.images[id],
100
+ filename: this.images[id].split('/').pop(),
101
+ thumbnail: this.default_thumb,
102
+ error: ''
103
+ };
104
+
105
+ this.createThumb(data);
106
+ }
107
+ }, {
108
+ key: 'createThumb',
109
+ value: function createThumb(data) {
110
+ var self = this,
111
+ image = new Image();
112
+
113
+ image.onerror = function () {
114
+ var data_before = data;
115
+ data_before.id = data.image_id;
116
+
117
+ self._before(data_before);
118
+ self.send(data);
119
+ };
120
+
121
+ image.onload = function () {
122
+ var maxWidth = 33,
123
+ maxHeight = 33,
124
+ imageWidth = image.width,
125
+ imageHeight = image.height,
126
+ ratio = 1,
127
+ newHeight = 0,
128
+ newWidth = 0,
129
+ canvas = null,
130
+ ctx = null;
131
+
132
+ if (imageWidth < imageHeight) {
133
+ ratio = maxWidth / imageWidth;
134
+ newWidth = maxWidth;
135
+ newHeight = imageHeight * ratio;
136
+ } else {
137
+ ratio = maxHeight / imageHeight;
138
+ newHeight = maxHeight;
139
+ newWidth = imageWidth * ratio;
140
+ }
141
+
142
+ canvas = document.createElement('canvas');
143
+
144
+ canvas.width = newWidth;
145
+ canvas.height = newHeight;
146
+ image.width = newWidth;
147
+ image.height = newHeight;
148
+
149
+ ctx = canvas.getContext('2d');
150
+ ctx.drawImage(this, 0, 0, newWidth, newHeight);
151
+
152
+ try {
153
+ data.thumbnail = canvas.toDataURL('image/jpeg');
154
+ } catch (e) {
155
+ data.thumbnail = self.default_thumb;
156
+ }
157
+
158
+ var before_data = data;
159
+ before_data.id = data.image_id;
160
+
161
+ self._before(before_data);
162
+
163
+ self.send(data);
164
+
165
+ canvas = null;
166
+ };
167
+
168
+ image.src = data.image_src;
169
+ }
170
+ }, {
171
+ key: 'send',
172
+ value: function send(data) {
173
+
174
+ var self = this,
175
+ transport = new XMLHttpRequest(),
176
+ err = false,
177
+ json = {},
178
+ response = {
179
+ filename: data.filename,
180
+ image: data.image_id,
181
+ error: ''
182
+ };
183
+
184
+ transport.onreadystatechange = function () {
185
+ if (4 === this.readyState) {
186
+
187
+ self.processed_images++;
188
+
189
+ try {
190
+ json = JSON.parse(this.responseText);
191
+ err = false;
192
+ } catch (e) {
193
+
194
+ response.success = false;
195
+ response.error = 'Unknown error occured';
196
+
197
+ err = true;
198
+ }
199
+
200
+ response.progress = Math.floor(self.processed_images / self.total_images * 100);
201
+
202
+ if (!err) {
203
+ var json_data = json.data;
204
+
205
+ response.success = json.success;
206
+
207
+ if (true === json.success) {
208
+
209
+ self.total_original_size += json_data.original_size;
210
+ self.total_optimized_size += json_data.new_size;
211
+ self.total_gain += json_data.original_size - json_data.new_size;
212
+ self.total_percent = (self.total_optimized_size / self.total_original_size * 100).toFixed(2);
213
+ self.global_original_size += json_data.original_overall_size;
214
+ self.global_optimized_size += json_data.new_overall_size;
215
+ self.global_gain += json_data.overall_saving;
216
+ self.global_percent = (100 - self.global_optimized_size / self.global_optimized_size * 100).toFixed(2);
217
+
218
+ response.original_size = json_data.original_size;
219
+ response.original_size_human = self.humanSize(json_data.original_size);
220
+
221
+ response.new_size = json_data.new_size;
222
+ response.new_size_human = self.humanSize(json_data.new_size);
223
+
224
+ response.percent = json_data.percent;
225
+ response.thumbnails = json_data.thumbnails;
226
+
227
+ response.overall_saving = json_data.overall_saving;
228
+ response.overall_saving_human = self.humanSize(json_data.overall_saving);
229
+
230
+ response.original_overall_size = json_data.original_overall_size;
231
+ response.original_overall_size_human = self.humanSize(json_data.original_overall_size);
232
+ } else {
233
+ response.error = json_data.error;
234
+ }
235
+ }
236
+
237
+ self._each(response);
238
+
239
+ if (self.inprocess_images < self.total_images) {
240
+ self.process(self.images_ids.shift());
241
+ }
242
+
243
+ if (self.processed_images === self.total_images) {
244
+
245
+ var tmp_global_percent = 0;
246
+
247
+ if (0 !== self.global_original_size) {
248
+ tmp_global_percent = (100 - 100 * (self.global_optimized_size / self.global_original_size)).toFixed(2);
249
+ }
250
+
251
+ self._done({
252
+ global_original_size_human: self.humanSize(self.global_original_size),
253
+ global_gain_human: self.humanSize(self.global_gain),
254
+ global_percent: tmp_global_percent
255
+ });
256
+ }
257
+ }
258
+ };
259
+
260
+ transport.open('POST', this.lib_url, true);
261
+ transport.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
262
+ transport.send('image=' + data.image_id + '&context=' + this.context);
263
+ }
264
+ }]);
265
+
266
+ return ImagifyGulp;
267
+ }();
268
+ //# sourceMappingURL=imagify-gulp.js.map
assets/js/imagify-gulp.min.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*
2
+ * imagify-gulpjs - version 0.0.1 - 2017-07-28
3
+ * WP Media <contact@wp-media.me>
4
+ */
5
+ "use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),ImagifyGulp=function(){function a(b){_classCallCheck(this,a),this.buffer_size=b.buffer_size||1,this.lib_url=b.lib,this.default_thumb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==",this.images=b.images,this.images_ids=Object.keys(b.images),this.total_images=this.images_ids.length,this.processed_images=0,this.inprocess_images=0,this._before=new Function,this._each=new Function,this._done=new Function,this._error=new Function,this.total_original_size=0,this.total_optimized_size=0,this.total_gain=0,this.total_percent=0,this.global_original_size=0,this.global_optimized_size=0,this.global_gain=0,this.global_percent=0,this.context=b.context||"wp"}return _createClass(a,[{key:"before",value:function(a){return this._before=a,this}},{key:"each",value:function(a){return this._each=a,this}},{key:"done",value:function(a){return this._done=a,this}},{key:"error",value:function(a){return this._error=a,this}},{key:"humanSize",value:function(a){if(0===a)return"0 kB";var b=["B","kB","MB"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,c)).toFixed(2)+" "+b[c]}},{key:"run",value:function(){for(var a=this.images_ids.length>this.buffer_size?this.buffer_size:this.images_ids.length,b=0;a>b;b++){var c=this.images_ids.shift();this.process(c)}return this}},{key:"stopProcess",value:function(){return this.total_images=this.total_images-this.images_ids.length,this.images_ids=[],this}},{key:"process",value:function(a){this.inprocess_images++;var b={id:a,image_id:parseInt(a.toString().substr(1),10),image_src:this.images[a],filename:this.images[a].split("/").pop(),thumbnail:this.default_thumb,error:""};this.createThumb(b)}},{key:"createThumb",value:function(a){var b=this,c=new Image;c.onerror=function(){var c=a;c.id=a.image_id,b._before(c),b.send(a)},c.onload=function(){var d=33,e=33,f=c.width,g=c.height,h=1,i=0,j=0,k=null,l=null;g>f?(h=d/f,j=d,i=g*h):(h=e/g,i=e,j=f*h),k=document.createElement("canvas"),k.width=j,k.height=i,c.width=j,c.height=i,l=k.getContext("2d"),l.drawImage(this,0,0,j,i);try{a.thumbnail=k.toDataURL("image/jpeg")}catch(m){a.thumbnail=b.default_thumb}var n=a;n.id=a.image_id,b._before(n),b.send(a),k=null},c.src=a.image_src}},{key:"send",value:function(a){var b=this,c=new XMLHttpRequest,d=!1,e={},f={filename:a.filename,image:a.image_id,error:""};c.onreadystatechange=function(){if(4===this.readyState){b.processed_images++;try{e=JSON.parse(this.responseText),d=!1}catch(a){f.success=!1,f.error="Unknown error occured",d=!0}if(f.progress=Math.floor(b.processed_images/b.total_images*100),!d){var c=e.data;f.success=e.success,!0===e.success?(b.total_original_size+=c.original_size,b.total_optimized_size+=c.new_size,b.total_gain+=c.original_size-c.new_size,b.total_percent=(b.total_optimized_size/b.total_original_size*100).toFixed(2),b.global_original_size+=c.original_overall_size,b.global_optimized_size+=c.new_overall_size,b.global_gain+=c.overall_saving,b.global_percent=(100-b.global_optimized_size/b.global_optimized_size*100).toFixed(2),f.original_size=c.original_size,f.original_size_human=b.humanSize(c.original_size),f.new_size=c.new_size,f.new_size_human=b.humanSize(c.new_size),f.percent=c.percent,f.thumbnails=c.thumbnails,f.overall_saving=c.overall_saving,f.overall_saving_human=b.humanSize(c.overall_saving),f.original_overall_size=c.original_overall_size,f.original_overall_size_human=b.humanSize(c.original_overall_size)):f.error=c.error}if(b._each(f),b.inprocess_images<b.total_images&&b.process(b.images_ids.shift()),b.processed_images===b.total_images){var g=0;0!==b.global_original_size&&(g=(100-100*(b.global_optimized_size/b.global_original_size)).toFixed(2)),b._done({global_original_size_human:b.humanSize(b.global_original_size),global_gain_human:b.humanSize(b.global_gain),global_percent:g})}}},c.open("POST",this.lib_url,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send("image="+a.image_id+"&context="+this.context)}}]),a}();
assets/js/imagify.js DELETED
@@ -1,292 +0,0 @@
1
- /**
2
- * imagify-gulpjs - version 0.0.1 - 2016-04-07
3
- * WP Media <contact@wp-media.me>
4
- *
5
- * Note: when updating this file, don't forget to replace `this.buffer_size = 1;` by `this.buffer_size = imagifyBulk.buffer_size;`. Also, humanSize() has been edited to use a correct format.
6
- */
7
- (function () {
8
- 'use strict';
9
-
10
- var _createClass = function () {
11
- function defineProperties( target, props ) {
12
- for ( var i = 0; i < props.length; i++ ) {
13
- var descriptor = props[i];
14
- descriptor.enumerable = descriptor.enumerable || false;
15
- descriptor.configurable = true;
16
-
17
- if ( 'value' in descriptor ) {
18
- descriptor.writable = true;
19
- }
20
- Object.defineProperty( target, descriptor.key, descriptor );
21
- }
22
- }
23
-
24
- return function ( Constructor, protoProps, staticProps ) {
25
- if ( protoProps ) {
26
- defineProperties( Constructor.prototype, protoProps );
27
- }
28
- if ( staticProps ) {
29
- defineProperties( Constructor, staticProps );
30
- }
31
-
32
- return Constructor;
33
- };
34
- }();
35
-
36
- function _classCallCheck( instance, Constructor ) {
37
- if ( ! ( instance instanceof Constructor ) ) {
38
- throw new TypeError( 'Cannot call a class as a function' );
39
- }
40
- }
41
-
42
- window.ImagifyGulp = function () {
43
- function ImagifyGulp( settings ) {
44
- _classCallCheck( this, ImagifyGulp );
45
-
46
- this.buffer_size = imagifyBulk.buffer_size;
47
- this.lib_url = settings.lib;
48
- this.default_thumb = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==";
49
- this.images = settings.images;
50
- this.images_ids = Object.keys( settings.images );
51
- this.total_images = this.images_ids.length;
52
- this.processed_images = 0;
53
- this.inprocess_images = 0;
54
- this._before = function() {};
55
- this._each = function() {};
56
- this._done = function() {};
57
- this._error = function() {};
58
- this.total_original_size = 0;
59
- this.total_optimized_size = 0;
60
- this.total_gain = 0;
61
- this.total_percent = 0;
62
- this.global_original_size = 0;
63
- this.global_optimized_size = 0;
64
- this.global_gain = 0;
65
- this.global_percent = 0;
66
- this.context = settings.context || 'wp';
67
- }
68
-
69
- _createClass( ImagifyGulp, [ {
70
- key: 'before',
71
- value: function before( fnc ) {
72
- this._before = fnc;
73
- return this;
74
- }
75
- }, {
76
- key: 'each',
77
- value: function each( fnc ) {
78
- this._each = fnc;
79
- return this;
80
- }
81
- }, {
82
- key: 'done',
83
- value: function done( fnc ) {
84
- this._done = fnc;
85
- return this;
86
- }
87
- }, {
88
- key: 'error',
89
- value: function error( fnc ) {
90
- this._error = fnc;
91
- return this;
92
- }
93
- }, {
94
- key: 'humanSize',
95
- value: function humanSize( bytes ) {
96
- if ( 0 === bytes ) {
97
- return '0\u00A0kB';
98
- }
99
-
100
- var sizes = [ 'B', 'kB', 'MB' ],
101
- i = parseInt( Math.floor( Math.log( bytes ) / Math.log( 1024 ) ) );
102
-
103
- return ( bytes / Math.pow( 1024, i ) ).toFixed( 2 ) + '\u00A0' + sizes[ i ];
104
- }
105
- }, {
106
- key: 'run',
107
- value: function run() {
108
- var cpt = this.images_ids.length > this.buffer_size ? this.buffer_size : this.images_ids.length;
109
-
110
- for ( var i = 0; i < cpt; i++ ) {
111
- var id = this.images_ids.shift();
112
- this.process( id );
113
- }
114
-
115
- return this;
116
- }
117
- }, {
118
- key: 'process',
119
- value: function process( id ) {
120
- this.inprocess_images++;
121
-
122
- var data = {
123
- id: id,
124
- image_id: parseInt( id.toString().substr( 1 ), 10 ),
125
- image_src: this.images[ id ],
126
- filename: this.images[ id ].split( '/' ).pop(),
127
- thumbnail: this.default_thumb,
128
- error: ''
129
- };
130
-
131
- this.createThumb( data );
132
- }
133
- }, {
134
- key: 'createThumb',
135
- value: function createThumb( data ) {
136
- var self = this,
137
- image = new Image();
138
-
139
- image.onerror = function () {
140
- var data_before = data;
141
- data_before.id = data.image_id;
142
-
143
- self._before(data_before);
144
- self.send(data);
145
- };
146
-
147
- image.onload = function () {
148
- var maxWidth = 33,
149
- maxHeight = 33,
150
- imageWidth = image.width,
151
- imageHeight = image.height,
152
- ratio = 1,
153
- newHeight = 0,
154
- newWidth = 0,
155
- canvas = null,
156
- ctx = null;
157
-
158
- if ( imageWidth < imageHeight ) {
159
- ratio = maxWidth / imageWidth;
160
- newWidth = maxWidth;
161
- newHeight = imageHeight * ratio;
162
- } else {
163
- ratio = maxHeight / imageHeight;
164
- newHeight = maxHeight;
165
- newWidth = imageWidth * ratio;
166
- }
167
-
168
- canvas = document.createElement( 'canvas' );
169
-
170
- canvas.width = newWidth;
171
- canvas.height = newHeight;
172
- image.width = newWidth;
173
- image.height = newHeight;
174
-
175
- ctx = canvas.getContext( '2d' );
176
- ctx.drawImage( this, 0, 0, newWidth, newHeight );
177
-
178
- try {
179
- data.thumbnail = canvas.toDataURL( 'image/jpeg' );
180
- } catch ( e ) {
181
- data.thumbnail = self.default_thumb;
182
- }
183
-
184
- var before_data = data;
185
- before_data.id = data.image_id;
186
-
187
- self._before(before_data);
188
-
189
- self.send(data);
190
-
191
- canvas = null;
192
- };
193
-
194
- image.src = data.image_src;
195
- }
196
- }, {
197
- key: 'send',
198
- value: function send( data ) {
199
-
200
- var self = this,
201
- transport = new XMLHttpRequest(),
202
- err = false,
203
- json = {},
204
- response = {
205
- filename: data.filename,
206
- image: data.image_id,
207
- error: ''
208
- };
209
-
210
- transport.onreadystatechange = function () {
211
- if ( 4 === this.readyState ) {
212
-
213
- self.processed_images++;
214
-
215
- try {
216
- json = JSON.parse( this.responseText );
217
- err = false;
218
- } catch ( e ) {
219
- response.success = false;
220
- response.error = 'Unknown error occured';
221
- err = true;
222
- }
223
-
224
- response.progress = Math.floor( self.processed_images / self.total_images * 100 );
225
-
226
- if ( ! err ) {
227
- var json_data = json.data;
228
-
229
- response.success = json.success;
230
-
231
- if ( true === json.success ) {
232
- self.total_original_size += json_data.original_size;
233
- self.total_optimized_size += json_data.new_size;
234
- self.total_gain += json_data.original_size - json_data.new_size;
235
- self.total_percent = ( self.total_optimized_size / self.total_original_size * 100 ).toFixed( 2 );
236
- self.global_original_size += json_data.original_overall_size;
237
- self.global_optimized_size += json_data.new_overall_size;
238
- self.global_gain += json_data.overall_saving;
239
- self.global_percent = ( 100 - self.global_optimized_size / self.global_optimized_size * 100 ).toFixed( 2 );
240
-
241
- response.original_size = json_data.original_size;
242
- response.original_size_human = self.humanSize( json_data.original_size );
243
-
244
- response.new_size = json_data.new_size;
245
- response.new_size_human = self.humanSize( json_data.new_size );
246
-
247
- response.percent = json_data.percent;
248
- response.thumbnails = json_data.thumbnails;
249
-
250
- response.overall_saving = json_data.overall_saving;
251
- response.overall_saving_human = self.humanSize( json_data.overall_saving );
252
-
253
- response.original_overall_size = json_data.original_overall_size;
254
- response.original_overall_size_human = self.humanSize( json_data.original_overall_size );
255
- } else {
256
- response.error = json_data.error;
257
- }
258
- }
259
-
260
- self._each( response );
261
-
262
- if ( self.inprocess_images < self.total_images ) {
263
- self.process( self.images_ids.shift() );
264
- }
265
-
266
- if ( self.processed_images === self.total_images ) {
267
-
268
- var tmp_global_percent = 0;
269
-
270
- if ( 0 !== self.global_original_size ) {
271
- tmp_global_percent = ( 100 - 100 * ( self.global_optimized_size / self.global_original_size ) ).toFixed( 2 );
272
- }
273
-
274
- self._done( {
275
- global_original_size_human: self.humanSize( self.global_original_size ),
276
- global_gain_human: self.humanSize( self.global_gain ),
277
- global_percent: tmp_global_percent
278
- } );
279
- }
280
- }
281
- };
282
-
283
- transport.open( 'POST', this.lib_url, true );
284
- transport.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
285
- transport.send( 'image=' + data.image_id + '&context=' + this.context );
286
- }
287
- } ] );
288
-
289
- return ImagifyGulp;
290
- }();
291
- //# sourceMappingURL=imagify-gulp.js.map
292
- }());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/imagify.min.js DELETED
@@ -1 +0,0 @@
1
- !function(){"use strict";function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();window.ImagifyGulp=function(){function c(b){a(this,c),this.buffer_size=imagifyBulk.buffer_size,this.lib_url=b.lib,this.default_thumb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==",this.images=b.images,this.images_ids=Object.keys(b.images),this.total_images=this.images_ids.length,this.processed_images=0,this.inprocess_images=0,this._before=function(){},this._each=function(){},this._done=function(){},this._error=function(){},this.total_original_size=0,this.total_optimized_size=0,this.total_gain=0,this.total_percent=0,this.global_original_size=0,this.global_optimized_size=0,this.global_gain=0,this.global_percent=0,this.context=b.context||"wp"}return b(c,[{key:"before",value:function(a){return this._before=a,this}},{key:"each",value:function(a){return this._each=a,this}},{key:"done",value:function(a){return this._done=a,this}},{key:"error",value:function(a){return this._error=a,this}},{key:"humanSize",value:function(a){if(0===a)return"0 kB";var b=["B","kB","MB"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,c)).toFixed(2)+" "+b[c]}},{key:"run",value:function(){for(var a=this.images_ids.length>this.buffer_size?this.buffer_size:this.images_ids.length,b=0;b<a;b++){var c=this.images_ids.shift();this.process(c)}return this}},{key:"process",value:function(a){this.inprocess_images++;var b={id:a,image_id:parseInt(a.toString().substr(1),10),image_src:this.images[a],filename:this.images[a].split("/").pop(),thumbnail:this.default_thumb,error:""};this.createThumb(b)}},{key:"createThumb",value:function(a){var b=this,c=new Image;c.onerror=function(){var c=a;c.id=a.image_id,b._before(c),b.send(a)},c.onload=function(){var d=c.width,e=c.height,f=1,g=0,h=0,i=null,j=null;d<e?(f=33/d,h=33,g=e*f):(f=33/e,g=33,h=d*f),i=document.createElement("canvas"),i.width=h,i.height=g,c.width=h,c.height=g,j=i.getContext("2d"),j.drawImage(this,0,0,h,g);try{a.thumbnail=i.toDataURL("image/jpeg")}catch(c){a.thumbnail=b.default_thumb}var k=a;k.id=a.image_id,b._before(k),b.send(a),i=null},c.src=a.image_src}},{key:"send",value:function(a){var b=this,c=new XMLHttpRequest,d=!1,e={},f={filename:a.filename,image:a.image_id,error:""};c.onreadystatechange=function(){if(4===this.readyState){b.processed_images++;try{e=JSON.parse(this.responseText),d=!1}catch(a){f.success=!1,f.error="Unknown error occured",d=!0}if(f.progress=Math.floor(b.processed_images/b.total_images*100),!d){var a=e.data;f.success=e.success,!0===e.success?(b.total_original_size+=a.original_size,b.total_optimized_size+=a.new_size,b.total_gain+=a.original_size-a.new_size,b.total_percent=(b.total_optimized_size/b.total_original_size*100).toFixed(2),b.global_original_size+=a.original_overall_size,b.global_optimized_size+=a.new_overall_size,b.global_gain+=a.overall_saving,b.global_percent=(100-b.global_optimized_size/b.global_optimized_size*100).toFixed(2),f.original_size=a.original_size,f.original_size_human=b.humanSize(a.original_size),f.new_size=a.new_size,f.new_size_human=b.humanSize(a.new_size),f.percent=a.percent,f.thumbnails=a.thumbnails,f.overall_saving=a.overall_saving,f.overall_saving_human=b.humanSize(a.overall_saving),f.original_overall_size=a.original_overall_size,f.original_overall_size_human=b.humanSize(a.original_overall_size)):f.error=a.error}if(b._each(f),b.inprocess_images<b.total_images&&b.process(b.images_ids.shift()),b.processed_images===b.total_images){var c=0;0!==b.global_original_size&&(c=(100-b.global_optimized_size/b.global_original_size*100).toFixed(2)),b._done({global_original_size_human:b.humanSize(b.global_original_size),global_gain_human:b.humanSize(b.global_gain),global_percent:c})}}},c.open("POST",this.lib_url,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send("image="+a.image_id+"&context="+this.context)}}]),c}()}();
 
assets/js/jquery.event.move.js CHANGED
@@ -1,6 +1,6 @@
1
- // jquery.event.move
2
  //
3
- // 1.3.6
4
  //
5
  // Stephen Band
6
  //
@@ -11,85 +11,141 @@
11
  // have the properties:
12
  //
13
  // pageX:
14
- // pageY: Page coordinates of pointer.
15
  // startX:
16
- // startY: Page coordinates of pointer at movestart.
17
  // distX:
18
- // distY: Distance the pointer has moved since movestart.
19
  // deltaX:
20
- // deltaY: Distance the finger has moved since last event.
21
  // velocityX:
22
- // velocityY: Average velocity over last few events.
23
 
24
 
25
- (function (module) {
26
  if (typeof define === 'function' && define.amd) {
27
- // AMD. Register as an anonymous module.
28
- define(['jquery'], module);
 
29
  } else {
30
- // Browser globals
31
- module(jQuery);
32
- }
33
- })(function(jQuery, undefined){
34
-
35
- var // Number of pixels a pressed pointer travels before movestart
36
- // event is fired.
37
- threshold = 6,
38
-
39
- add = jQuery.event.add,
40
-
41
- remove = jQuery.event.remove,
42
-
43
- // Just sugar, so we can have arguments in the same order as
44
- // add and remove.
45
- trigger = function(node, type, data) {
46
- jQuery.event.trigger(type, data, node);
47
- },
48
-
49
- // Shim for requestAnimationFrame, falling back to timer. See:
50
- // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
51
- requestFrame = (function(){
52
- return (
53
- window.requestAnimationFrame ||
54
- window.webkitRequestAnimationFrame ||
55
- window.mozRequestAnimationFrame ||
56
- window.oRequestAnimationFrame ||
57
- window.msRequestAnimationFrame ||
58
- function(fn, element){
59
- return window.setTimeout(function(){
60
- fn();
61
- }, 25);
62
- }
63
- );
64
- })(),
65
-
66
- ignoreTags = {
67
- textarea: true,
68
- input: true,
69
- select: true,
70
- button: true
71
- },
72
-
73
- mouseevents = {
74
- move: 'mousemove',
75
- cancel: 'mouseup dragstart',
76
- end: 'mouseup'
77
- },
78
-
79
- touchevents = {
80
- move: 'touchmove',
81
- cancel: 'touchend',
82
- end: 'touchend'
83
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
 
86
  // Constructors
87
-
88
  function Timer(fn){
89
  var callback = fn,
90
  active = false,
91
  running = false;
92
-
93
  function trigger(time) {
94
  if (active){
95
  callback();
@@ -101,17 +157,17 @@
101
  running = false;
102
  }
103
  }
104
-
105
  this.kick = function(fn) {
106
  active = true;
107
  if (!running) { trigger(); }
108
  };
109
-
110
  this.end = function(fn) {
111
  var cb = callback;
112
-
113
  if (!fn) { return; }
114
-
115
  // If the timer is not running, simply call the end callback.
116
  if (!running) {
117
  fn();
@@ -121,9 +177,9 @@
121
  // just the end callback.
122
  else {
123
  callback = active ?
124
- function(){ cb(); fn(); } :
125
  fn ;
126
-
127
  active = true;
128
  }
129
  };
@@ -131,27 +187,18 @@
131
 
132
 
133
  // Functions
134
-
135
- function returnTrue() {
136
- return true;
137
- }
138
-
139
- function returnFalse() {
140
- return false;
141
- }
142
-
143
  function preventDefault(e) {
144
  e.preventDefault();
145
  }
146
-
147
- function preventIgnoreTags(e) {
148
- // Don't prevent interaction with form elements.
149
- if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
150
-
151
- e.preventDefault();
152
  }
153
 
154
- function isLeftButton(e) {
155
  // Ignore mousedowns on any button other than the left (or primary)
156
  // mouse button, or when a modifier key is pressed.
157
  return (e.which === 1 && !e.ctrlKey && !e.altKey);
@@ -163,13 +210,13 @@
163
  if (touchList.identifiedTouch) {
164
  return touchList.identifiedTouch(id);
165
  }
166
-
167
  // touchList.identifiedTouch() does not exist in
168
  // webkit yet… we must do the search ourselves...
169
-
170
  i = -1;
171
  l = touchList.length;
172
-
173
  while (++i < l) {
174
  if (touchList[i].identifier === id) {
175
  return touchList[i];
@@ -177,8 +224,8 @@
177
  }
178
  }
179
 
180
- function changedTouch(e, event) {
181
- var touch = identifiedTouch(e.changedTouches, event.identifier);
182
 
183
  // This isn't the touch you're looking for.
184
  if (!touch) { return; }
@@ -186,192 +233,164 @@
186
  // Chrome Android (at least) includes touches that have not
187
  // changed in e.changedTouches. That's a bit annoying. Check
188
  // that this touch has changed.
189
- if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; }
190
 
191
  return touch;
192
  }
193
 
194
 
195
  // Handlers that decide when the first movestart is triggered
196
-
197
- function mousedown(e){
198
- var data;
199
 
200
- if (!isLeftButton(e)) { return; }
 
 
201
 
202
- data = {
203
- target: e.target,
204
- startX: e.pageX,
205
- startY: e.pageY,
206
- timeStamp: e.timeStamp
207
- };
208
 
209
- add(document, mouseevents.move, mousemove, data);
210
- add(document, mouseevents.cancel, mouseend, data);
211
  }
212
 
213
- function mousemove(e){
214
- var data = e.data;
215
-
216
  checkThreshold(e, data, e, removeMouse);
217
  }
218
 
219
- function mouseend(e) {
220
  removeMouse();
221
  }
222
 
223
  function removeMouse() {
224
- remove(document, mouseevents.move, mousemove);
225
- remove(document, mouseevents.cancel, mouseend);
226
  }
227
 
228
  function touchstart(e) {
229
- var touch, template;
 
230
 
231
- // Don't get in the way of interaction with form elements.
232
- if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
233
 
234
- touch = e.changedTouches[0];
235
-
236
  // iOS live updates the touch objects whereas Android gives us copies.
237
  // That means we can't trust the touchstart object to stay the same,
238
  // so we must copy the data. This object acts as a template for
239
  // movestart, move and moveend event objects.
240
- template = {
241
- target: touch.target,
242
- startX: touch.pageX,
243
- startY: touch.pageY,
244
- timeStamp: e.timeStamp,
245
- identifier: touch.identifier
 
 
 
 
246
  };
247
 
248
- // Use the touch identifier as a namespace, so that we can later
249
- // remove handlers pertaining only to this touch.
250
- add(document, touchevents.move + '.' + touch.identifier, touchmove, template);
251
- add(document, touchevents.cancel + '.' + touch.identifier, touchend, template);
252
  }
253
 
254
- function touchmove(e){
255
- var data = e.data,
256
- touch = changedTouch(e, data);
257
-
258
  if (!touch) { return; }
259
-
260
  checkThreshold(e, data, touch, removeTouch);
261
  }
262
 
263
- function touchend(e) {
264
- var template = e.data,
265
- touch = identifiedTouch(e.changedTouches, template.identifier);
266
-
267
  if (!touch) { return; }
268
-
269
- removeTouch(template.identifier);
270
  }
271
 
272
- function removeTouch(identifier) {
273
- remove(document, '.' + identifier, touchmove);
274
- remove(document, '.' + identifier, touchend);
275
  }
276
 
277
-
278
- // Logic for deciding when to trigger a movestart.
279
-
280
- function checkThreshold(e, template, touch, fn) {
281
- var distX = touch.pageX - template.startX,
282
- distY = touch.pageY - template.startY;
283
 
284
  // Do nothing if the threshold has not been crossed.
285
  if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
286
 
287
- triggerStart(e, template, touch, distX, distY, fn);
288
- }
289
-
290
- function handled() {
291
- // this._handled should return false once, and after return true.
292
- this._handled = returnTrue;
293
- return false;
294
  }
295
 
296
- function flagAsHandled(e) {
297
- e._handled();
298
- }
299
-
300
- function triggerStart(e, template, touch, distX, distY, fn) {
301
- var node = template.target,
302
- touches, time;
303
-
304
- touches = e.targetTouches;
305
- time = e.timeStamp - template.timeStamp;
306
 
307
  // Create a movestart object with some special properties that
308
  // are passed only to the movestart handlers.
309
- template.type = 'movestart';
310
- template.distX = distX;
311
- template.distY = distY;
312
- template.deltaX = distX;
313
- template.deltaY = distY;
314
- template.pageX = touch.pageX;
315
- template.pageY = touch.pageY;
316
- template.velocityX = distX / time;
317
- template.velocityY = distY / time;
318
- template.targetTouches = touches;
319
- template.finger = touches ?
320
- touches.length :
321
- 1 ;
322
-
323
- // The _handled method is fired to tell the default movestart
324
- // handler that one of the move events is bound.
325
- template._handled = handled;
326
-
327
- // Pass the touchmove event so it can be prevented if or when
328
- // movestart is handled.
329
- template._preventTouchmoveDefault = function() {
330
- e.preventDefault();
331
  };
332
 
333
  // Trigger the movestart event.
334
- trigger(template.target, template);
335
 
336
  // Unbind handlers that tracked the touch or mouse up till now.
337
- fn(template.identifier);
338
  }
339
 
340
 
341
  // Handlers that control what happens following a movestart
342
 
343
- function activeMousemove(e) {
344
- var timer = e.data.timer;
345
 
346
- e.data.touch = e;
347
- e.data.timeStamp = e.timeStamp;
348
  timer.kick();
349
  }
350
 
351
- function activeMouseend(e) {
352
- var event = e.data.event,
353
- timer = e.data.timer;
354
-
 
355
  removeActiveMouse();
356
 
357
- endEvent(event, timer, function() {
358
  // Unbind the click suppressor, waiting until after mouseup
359
  // has been handled.
360
  setTimeout(function(){
361
- remove(event.target, 'click', returnFalse);
362
  }, 0);
363
  });
364
  }
365
 
366
- function removeActiveMouse(event) {
367
- remove(document, mouseevents.move, activeMousemove);
368
- remove(document, mouseevents.end, activeMouseend);
369
  }
370
 
371
- function activeTouchmove(e) {
372
- var event = e.data.event,
373
- timer = e.data.timer,
374
- touch = changedTouch(e, event);
375
 
376
  if (!touch) { return; }
377
 
@@ -379,40 +398,41 @@
379
  e.preventDefault();
380
 
381
  event.targetTouches = e.targetTouches;
382
- e.data.touch = touch;
383
- e.data.timeStamp = e.timeStamp;
 
384
  timer.kick();
385
  }
386
 
387
- function activeTouchend(e) {
388
- var event = e.data.event,
389
- timer = e.data.timer,
390
- touch = identifiedTouch(e.changedTouches, event.identifier);
 
391
 
392
  // This isn't the touch you're looking for.
393
  if (!touch) { return; }
394
 
395
- removeActiveTouch(event);
396
- endEvent(event, timer);
397
  }
398
 
399
- function removeActiveTouch(event) {
400
- remove(document, '.' + event.identifier, activeTouchmove);
401
- remove(document, '.' + event.identifier, activeTouchend);
402
  }
403
 
404
 
405
  // Logic for triggering move and moveend events
406
 
407
- function updateEvent(event, touch, timeStamp, timer) {
408
  var time = timeStamp - event.timeStamp;
409
 
410
- event.type = 'move';
411
  event.distX = touch.pageX - event.startX;
412
  event.distY = touch.pageY - event.startY;
413
  event.deltaX = touch.pageX - event.pageX;
414
  event.deltaY = touch.pageY - event.pageY;
415
-
416
  // Average the velocity of the last few events using a decay
417
  // curve to even out spurious jumps in values.
418
  event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
@@ -421,166 +441,144 @@
421
  event.pageY = touch.pageY;
422
  }
423
 
424
- function endEvent(event, timer, fn) {
425
  timer.end(function(){
426
- event.type = 'moveend';
427
-
428
- trigger(event.target, event);
429
-
430
  return fn && fn();
431
  });
432
  }
433
 
434
 
435
- // jQuery special event definition
436
-
437
- function setup(data, namespaces, eventHandle) {
438
- // Stop the node from being dragged
439
- //add(this, 'dragstart.move drag.move', preventDefault);
440
-
441
- // Prevent text selection and touch interface scrolling
442
- //add(this, 'mousedown.move', preventIgnoreTags);
443
-
444
- // Tell movestart default handler that we've handled this
445
- add(this, 'movestart.move', flagAsHandled);
446
-
447
- // Don't bind to the DOM. For speed.
448
- return true;
449
- }
450
-
451
- function teardown(namespaces) {
452
- remove(this, 'dragstart drag', preventDefault);
453
- remove(this, 'mousedown touchstart', preventIgnoreTags);
454
- remove(this, 'movestart', flagAsHandled);
455
-
456
- // Don't bind to the DOM. For speed.
457
- return true;
458
- }
459
-
460
- function addMethod(handleObj) {
461
- // We're not interested in preventing defaults for handlers that
462
- // come from internal move or moveend bindings
463
- if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
464
- return;
 
 
 
465
  }
466
-
467
- // Stop the node from being dragged
468
- add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector);
469
-
470
- // Prevent text selection and touch interface scrolling
471
- add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector);
472
- }
473
-
474
- function removeMethod(handleObj) {
475
- if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
476
- return;
 
 
 
 
 
477
  }
478
-
479
- remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid);
480
- remove(this, 'mousedown.' + handleObj.guid);
481
  }
482
-
483
- jQuery.event.special.movestart = {
484
- setup: setup,
485
- teardown: teardown,
486
- add: addMethod,
487
- remove: removeMethod,
488
-
489
- _default: function(e) {
490
- var event, data;
491
-
492
- // If no move events were bound to any ancestors of this
493
- // target, high tail it out of here.
494
- if (!e._handled()) { return; }
495
-
496
- function update(time) {
497
- updateEvent(event, data.touch, data.timeStamp);
498
- trigger(e.target, event);
499
- }
500
 
501
- event = {
502
- target: e.target,
503
- startX: e.startX,
504
- startY: e.startY,
505
- pageX: e.pageX,
506
- pageY: e.pageY,
507
- distX: e.distX,
508
- distY: e.distY,
509
- deltaX: e.deltaX,
510
- deltaY: e.deltaY,
511
- velocityX: e.velocityX,
512
- velocityY: e.velocityY,
513
- timeStamp: e.timeStamp,
514
- identifier: e.identifier,
515
- targetTouches: e.targetTouches,
516
- finger: e.finger
517
- };
518
-
519
- data = {
520
- event: event,
521
- timer: new Timer(update),
522
- touch: undefined,
523
- timeStamp: undefined
524
- };
525
-
526
- if (e.identifier === undefined) {
527
- // We're dealing with a mouse
528
- // Stop clicks from propagating during a move
529
- add(e.target, 'click', returnFalse);
530
- add(document, mouseevents.move, activeMousemove, data);
531
- add(document, mouseevents.end, activeMouseend, data);
532
- }
533
- else {
534
- // We're dealing with a touch. Stop touchmove doing
535
- // anything defaulty.
536
- e._preventTouchmoveDefault();
537
- add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data);
538
- add(document, touchevents.end + '.' + e.identifier, activeTouchend, data);
539
  }
540
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  };
542
 
543
  jQuery.event.special.move = {
544
  setup: function() {
545
- // Bind a noop to movestart. Why? It's the movestart
546
- // setup that decides whether other move events are fired.
547
- add(this, 'movestart.move', jQuery.noop);
548
  },
549
-
550
  teardown: function() {
551
- remove(this, 'movestart.move', jQuery.noop);
552
- }
 
 
 
553
  };
554
-
555
  jQuery.event.special.moveend = {
556
  setup: function() {
557
- // Bind a noop to movestart. Why? It's the movestart
558
- // setup that decides whether other move events are fired.
559
- add(this, 'movestart.moveend', jQuery.noop);
560
  },
561
-
562
  teardown: function() {
563
- remove(this, 'movestart.moveend', jQuery.noop);
564
- }
565
- };
566
 
567
- add(document, 'mousedown.move', mousedown);
568
- add(document, 'touchstart.move', touchstart);
569
-
570
- // Make jQuery copy touch event properties over to the jQuery event
571
- // object, if they are not already listed. But only do the ones we
572
- // really need. IE7/8 do not have Array#indexOf(), but nor do they
573
- // have touch events, so let's assume we can ignore them.
574
- if (typeof Array.prototype.indexOf === 'function') {
575
- (function(jQuery, undefined){
576
- var props = ["changedTouches", "targetTouches"],
577
- l = props.length;
578
-
579
- while (l--) {
580
- if (jQuery.event.props.indexOf(props[l]) === -1) {
581
- jQuery.event.props.push(props[l]);
582
- }
583
- }
584
- })(jQuery);
585
  };
586
  });
1
+ // DOM.event.move
2
  //
3
+ // 2.0.1
4
  //
5
  // Stephen Band
6
  //
11
  // have the properties:
12
  //
13
  // pageX:
14
+ // pageY: Page coordinates of pointer.
15
  // startX:
16
+ // startY: Page coordinates of pointer at movestart.
17
  // distX:
18
+ // distY: Distance the pointer has moved since movestart.
19
  // deltaX:
20
+ // deltaY: Distance the finger has moved since last event.
21
  // velocityX:
22
+ // velocityY: Average velocity over last few events.
23
 
24
 
25
+ (function(fn) {
26
  if (typeof define === 'function' && define.amd) {
27
+ define([], fn);
28
+ } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
29
+ module.exports = fn;
30
  } else {
31
+ fn();
32
+ }
33
+ })(function(){
34
+ var assign = Object.assign || window.jQuery && jQuery.extend;
35
+
36
+ // Number of pixels a pressed pointer travels before movestart
37
+ // event is fired.
38
+ var threshold = 8;
39
+
40
+ // Shim for requestAnimationFrame, falling back to timer. See:
41
+ // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
42
+ var requestFrame = (function(){
43
+ return (
44
+ window.requestAnimationFrame ||
45
+ window.webkitRequestAnimationFrame ||
46
+ window.mozRequestAnimationFrame ||
47
+ window.oRequestAnimationFrame ||
48
+ window.msRequestAnimationFrame ||
49
+ function(fn, element){
50
+ return window.setTimeout(function(){
51
+ fn();
52
+ }, 25);
53
+ }
54
+ );
55
+ })();
56
+
57
+ var ignoreTags = {
58
+ textarea: true,
59
+ input: true,
60
+ select: true,
61
+ button: true
62
+ };
63
+
64
+ var mouseevents = {
65
+ move: 'mousemove',
66
+ cancel: 'mouseup dragstart',
67
+ end: 'mouseup'
68
+ };
69
+
70
+ var touchevents = {
71
+ move: 'touchmove',
72
+ cancel: 'touchend',
73
+ end: 'touchend'
74
+ };
75
+
76
+ var rspaces = /\s+/;
77
+
78
+
79
+ // DOM Events
80
+
81
+ var eventOptions = { bubbles: true, cancelable: true };
82
+
83
+ var eventsSymbol = Symbol('events');
84
+
85
+ function createEvent(type) {
86
+ return new CustomEvent(type, eventOptions);
87
+ }
88
+
89
+ function getEvents(node) {
90
+ return node[eventsSymbol] || (node[eventsSymbol] = {});
91
+ }
92
+
93
+ function on(node, types, fn, data, selector) {
94
+ types = types.split(rspaces);
95
+
96
+ var events = getEvents(node);
97
+ var i = types.length;
98
+ var handlers, type;
99
+
100
+ function handler(e) { fn(e, data); }
101
+
102
+ while (i--) {
103
+ type = types[i];
104
+ handlers = events[type] || (events[type] = []);
105
+ handlers.push([fn, handler]);
106
+ node.addEventListener(type, handler);
107
+ }
108
+ }
109
+
110
+ function off(node, types, fn, selector) {
111
+ types = types.split(rspaces);
112
+
113
+ var events = getEvents(node);
114
+ var i = types.length;
115
+ var type, handlers, k;
116
+
117
+ if (!events) { return; }
118
+
119
+ while (i--) {
120
+ type = types[i];
121
+ handlers = events[type];
122
+ if (!handlers) { continue; }
123
+ k = handlers.length;
124
+ while (k--) {
125
+ if (handlers[k][0] === fn) {
126
+ node.removeEventListener(type, handlers[k][1]);
127
+ handlers.splice(k, 1);
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ function trigger(node, type, properties) {
134
+ // Don't cache events. It prevents you from triggering an event of a
135
+ // given type from inside the handler of another event of that type.
136
+ var event = createEvent(type);
137
+ if (properties) { assign(event, properties); }
138
+ node.dispatchEvent(event);
139
+ }
140
 
141
 
142
  // Constructors
143
+
144
  function Timer(fn){
145
  var callback = fn,
146
  active = false,
147
  running = false;
148
+
149
  function trigger(time) {
150
  if (active){
151
  callback();
157
  running = false;
158
  }
159
  }
160
+
161
  this.kick = function(fn) {
162
  active = true;
163
  if (!running) { trigger(); }
164
  };
165
+
166
  this.end = function(fn) {
167
  var cb = callback;
168
+
169
  if (!fn) { return; }
170
+
171
  // If the timer is not running, simply call the end callback.
172
  if (!running) {
173
  fn();
177
  // just the end callback.
178
  else {
179
  callback = active ?
180
+ function(){ cb(); fn(); } :
181
  fn ;
182
+
183
  active = true;
184
  }
185
  };
187
 
188
 
189
  // Functions
190
+
191
+ function noop() {}
192
+
 
 
 
 
 
 
193
  function preventDefault(e) {
194
  e.preventDefault();
195
  }
196
+
197
+ function isIgnoreTag(e) {
198
+ return !!ignoreTags[e.target.tagName.toLowerCase()];
 
 
 
199
  }
200
 
201
+ function isPrimaryButton(e) {
202
  // Ignore mousedowns on any button other than the left (or primary)
203
  // mouse button, or when a modifier key is pressed.
204
  return (e.which === 1 && !e.ctrlKey && !e.altKey);
210
  if (touchList.identifiedTouch) {
211
  return touchList.identifiedTouch(id);
212
  }
213
+
214
  // touchList.identifiedTouch() does not exist in
215
  // webkit yet… we must do the search ourselves...
216
+
217
  i = -1;
218
  l = touchList.length;
219
+
220
  while (++i < l) {
221
  if (touchList[i].identifier === id) {
222
  return touchList[i];
224
  }
225
  }
226
 
227
+ function changedTouch(e, data) {
228
+ var touch = identifiedTouch(e.changedTouches, data.identifier);
229
 
230
  // This isn't the touch you're looking for.
231
  if (!touch) { return; }
233
  // Chrome Android (at least) includes touches that have not
234
  // changed in e.changedTouches. That's a bit annoying. Check
235
  // that this touch has changed.
236
+ if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
237
 
238
  return touch;
239
  }
240
 
241
 
242
  // Handlers that decide when the first movestart is triggered
 
 
 
243
 
244
+ function mousedown(e){
245
+ // Ignore non-primary buttons
246
+ if (!isPrimaryButton(e)) { return; }
247
 
248
+ // Ignore form and interactive elements
249
+ if (isIgnoreTag(e)) { return; }
 
 
 
 
250
 
251
+ on(document, mouseevents.move, mousemove, e);
252
+ on(document, mouseevents.cancel, mouseend, e);
253
  }
254
 
255
+ function mousemove(e, data){
 
 
256
  checkThreshold(e, data, e, removeMouse);
257
  }
258
 
259
+ function mouseend(e, data) {
260
  removeMouse();
261
  }
262
 
263
  function removeMouse() {
264
+ off(document, mouseevents.move, mousemove);
265
+ off(document, mouseevents.cancel, mouseend);
266
  }
267
 
268
  function touchstart(e) {
269
+ // Don't get in the way of interaction with form elements
270
+ if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
271
 
272
+ var touch = e.changedTouches[0];
 
273
 
 
 
274
  // iOS live updates the touch objects whereas Android gives us copies.
275
  // That means we can't trust the touchstart object to stay the same,
276
  // so we must copy the data. This object acts as a template for
277
  // movestart, move and moveend event objects.
278
+ var data = {
279
+ target: touch.target,
280
+ pageX: touch.pageX,
281
+ pageY: touch.pageY,
282
+ identifier: touch.identifier,
283
+
284
+ // The only way to make handlers individually unbindable is by
285
+ // making them unique.
286
+ touchmove: function(e, data) { touchmove(e, data); },
287
+ touchend: function(e, data) { touchend(e, data); }
288
  };
289
 
290
+ on(document, touchevents.move, data.touchmove, data);
291
+ on(document, touchevents.cancel, data.touchend, data);
 
 
292
  }
293
 
294
+ function touchmove(e, data) {
295
+ var touch = changedTouch(e, data);
 
 
296
  if (!touch) { return; }
 
297
  checkThreshold(e, data, touch, removeTouch);
298
  }
299
 
300
+ function touchend(e, data) {
301
+ var touch = identifiedTouch(e.changedTouches, data.identifier);
 
 
302
  if (!touch) { return; }
303
+ removeTouch(data);
 
304
  }
305
 
306
+ function removeTouch(data) {
307
+ off(document, touchevents.move, data.touchmove);
308
+ off(document, touchevents.cancel, data.touchend);
309
  }
310
 
311
+ function checkThreshold(e, data, touch, fn) {
312
+ var distX = touch.pageX - data.pageX;
313
+ var distY = touch.pageY - data.pageY;
 
 
 
314
 
315
  // Do nothing if the threshold has not been crossed.
316
  if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
317
 
318
+ triggerStart(e, data, touch, distX, distY, fn);
 
 
 
 
 
 
319
  }
320
 
321
+ function triggerStart(e, data, touch, distX, distY, fn) {
322
+ var touches = e.targetTouches;
323
+ var time = e.timeStamp - data.timeStamp;
 
 
 
 
 
 
 
324
 
325
  // Create a movestart object with some special properties that
326
  // are passed only to the movestart handlers.
327
+ var template = {
328
+ altKey: e.altKey,
329
+ ctrlKey: e.ctrlKey,
330
+ shiftKey: e.shiftKey,
331
+ startX: data.pageX,
332
+ startY: data.pageY,
333
+ distX: distX,
334
+ distY: distY,
335
+ deltaX: distX,
336
+ deltaY: distY,
337
+ pageX: touch.pageX,
338
+ pageY: touch.pageY,
339
+ velocityX: distX / time,
340
+ velocityY: distY / time,
341
+ identifier: data.identifier,
342
+ targetTouches: touches,
343
+ finger: touches ? touches.length : 1,
344
+ enableMove: function() {
345
+ this.moveEnabled = true;
346
+ this.enableMove = noop;
347
+ e.preventDefault();
348
+ }
349
  };
350
 
351
  // Trigger the movestart event.
352
+ trigger(data.target, 'movestart', template);
353
 
354
  // Unbind handlers that tracked the touch or mouse up till now.
355
+ fn(data);
356
  }
357
 
358
 
359
  // Handlers that control what happens following a movestart
360
 
361
+ function activeMousemove(e, data) {
362
+ var timer = data.timer;
363
 
364
+ data.touch = e;
365
+ data.timeStamp = e.timeStamp;
366
  timer.kick();
367
  }
368
 
369
+ function activeMouseend(e, data) {
370
+ var target = data.target;
371
+ var event = data.event;
372
+ var timer = data.timer;
373
+
374
  removeActiveMouse();
375
 
376
+ endEvent(target, event, timer, function() {
377
  // Unbind the click suppressor, waiting until after mouseup
378
  // has been handled.
379
  setTimeout(function(){
380
+ off(target, 'click', preventDefault);
381
  }, 0);
382
  });
383
  }
384
 
385
+ function removeActiveMouse() {
386
+ off(document, mouseevents.move, activeMousemove);
387
+ off(document, mouseevents.end, activeMouseend);
388
  }
389
 
390
+ function activeTouchmove(e, data) {
391
+ var event = data.event;
392
+ var timer = data.timer;
393
+ var touch = changedTouch(e, event);
394
 
395
  if (!touch) { return; }
396
 
398
  e.preventDefault();
399
 
400
  event.targetTouches = e.targetTouches;
401
+ data.touch = touch;
402
+ data.timeStamp = e.timeStamp;
403
+
404
  timer.kick();
405
  }
406
 
407
+ function activeTouchend(e, data) {
408
+ var target = data.target;
409
+ var event = data.event;
410
+ var timer = data.timer;
411
+ var touch = identifiedTouch(e.changedTouches, event.identifier);
412
 
413
  // This isn't the touch you're looking for.
414
  if (!touch) { return; }
415
 
416
+ removeActiveTouch(data);
417
+ endEvent(target, event, timer);
418
  }
419
 
420
+ function removeActiveTouch(data) {
421
+ off(document, touchevents.move, data.activeTouchmove);
422
+ off(document, touchevents.end, data.activeTouchend);
423
  }
424
 
425
 
426
  // Logic for triggering move and moveend events
427
 
428
+ function updateEvent(event, touch, timeStamp) {
429
  var time = timeStamp - event.timeStamp;
430
 
 
431
  event.distX = touch.pageX - event.startX;
432
  event.distY = touch.pageY - event.startY;
433
  event.deltaX = touch.pageX - event.pageX;
434
  event.deltaY = touch.pageY - event.pageY;
435
+
436
  // Average the velocity of the last few events using a decay
437
  // curve to even out spurious jumps in values.
438
  event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
441
  event.pageY = touch.pageY;
442
  }
443
 
444
+ function endEvent(target, event, timer, fn) {
445
  timer.end(function(){
446
+ trigger(target, 'moveend', event);
 
 
 
447
  return fn && fn();
448
  });
449
  }
450
 
451
 
452
+ // Set up the DOM
453
+
454
+ function movestart(e) {
455
+ if (e.defaultPrevented) { return; }
456
+ if (!e.moveEnabled) { return; }
457
+
458
+ var event = {
459
+ startX: e.startX,
460
+ startY: e.startY,
461
+ pageX: e.pageX,
462
+ pageY: e.pageY,
463
+ distX: e.distX,
464
+ distY: e.distY,
465
+ deltaX: e.deltaX,
466
+ deltaY: e.deltaY,
467
+ velocityX: e.velocityX,
468
+ velocityY: e.velocityY,
469
+ identifier: e.identifier,
470
+ targetTouches: e.targetTouches,
471
+ finger: e.finger
472
+ };
473
+
474
+ var data = {
475
+ target: e.target,
476
+ event: event,
477
+ timer: new Timer(update),
478
+ touch: undefined,
479
+ timeStamp: e.timeStamp
480
+ };
481
+
482
+ function update(time) {
483
+ updateEvent(event, data.touch, data.timeStamp);
484
+ trigger(data.target, 'move', event);
485
  }
486
+
487
+ if (e.identifier === undefined) {
488
+ // We're dealing with a mouse event.
489
+ // Stop clicks from propagating during a move
490
+ on(e.target, 'click', preventDefault);
491
+ on(document, mouseevents.move, activeMousemove, data);
492
+ on(document, mouseevents.end, activeMouseend, data);
493
+ }
494
+ else {
495
+ // In order to unbind correct handlers they have to be unique
496
+ data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
497
+ data.activeTouchend = function(e, data) { activeTouchend(e, data); };
498
+
499
+ // We're dealing with a touch.
500
+ on(document, touchevents.move, data.activeTouchmove, data);
501
+ on(document, touchevents.end, data.activeTouchend, data);
502
  }
 
 
 
503
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
 
505
+ on(document, 'mousedown', mousedown);
506
+ on(document, 'touchstart', touchstart);
507
+ on(document, 'movestart', movestart);
508
+
509
+
510
+ // jQuery special events
511
+ //
512
+ // jQuery event objects are copies of DOM event objects. They need
513
+ // a little help copying the move properties across.
514
+
515
+ if (!window.jQuery) { return; }
516
+
517
+ var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
518
+
519
+ function enableMove1(e) { e.enableMove(); }
520
+ function enableMove2(e) { e.enableMove(); }
521
+ function enableMove3(e) { e.enableMove(); }
522
+
523
+ function add(handleObj) {
524
+ var handler = handleObj.handler;
525
+
526
+ handleObj.handler = function(e) {
527
+ // Copy move properties across from originalEvent
528
+ var i = properties.length;
529
+ var property;
530
+
531
+ while(i--) {
532
+ property = properties[i];
533
+ e[property] = e.originalEvent[property];
 
 
 
 
 
 
 
 
 
534
  }
535
+
536
+ handler.apply(this, arguments);
537
+ };
538
+ }
539
+
540
+ jQuery.event.special.movestart = {
541
+ setup: function() {
542
+ // Movestart must be enabled to allow other move events
543
+ on(this, 'movestart', enableMove1);
544
+
545
+ // Do listen to DOM events
546
+ return false;
547
+ },
548
+
549
+ teardown: function() {
550
+ off(this, 'movestart', enableMove1);
551
+ return false;
552
+ },
553
+
554
+ add: add
555
  };
556
 
557
  jQuery.event.special.move = {
558
  setup: function() {
559
+ on(this, 'movestart', enableMove2);
560
+ return false;
 
561
  },
562
+
563
  teardown: function() {
564
+ off(this, 'movestart', enableMove2);
565
+ return false;
566
+ },
567
+
568
+ add: add
569
  };
570
+
571
  jQuery.event.special.moveend = {
572
  setup: function() {
573
+ on(this, 'movestart', enableMove3);
574
+ return false;
 
575
  },
576
+
577
  teardown: function() {
578
+ off(this, 'movestart', enableMove3);
579
+ return false;
580
+ },
581
 
582
+ add: add
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  };
584
  });
assets/js/jquery.event.move.min.js CHANGED
@@ -1,10 +1 @@
1
- (function(g){"function"===typeof define&&define.amd?define(["jquery"],g):g(jQuery)})(function(g,l){function H(a){function b(a){d?(c(),I(b),h=!0,d=!1):h=!1}var c=a,d=!1,h=!1;this.kick=function(a){d=!0;h||b()};this.end=function(a){var b=c;a&&(h?(c=d?function(){b();a()}:a,d=!0):a())}}function J(){return!0}function n(){return!1}function p(a){a.preventDefault()}function q(a){r[a.target.tagName.toLowerCase()]||a.preventDefault()}function m(a,b){var c,d;if(a.identifiedTouch)return a.identifiedTouch(b);c=
2
- -1;for(d=a.length;++c<d;)if(a[c].identifier===b)return a[c]}function t(a,b){var c=m(a.changedTouches,b.identifier);if(c&&(c.pageX!==b.pageX||c.pageY!==b.pageY))return c}function u(a){v(a,a.data,a,w)}function x(a){w()}function w(){f(document,k.move,u);f(document,k.cancel,x)}function y(a){var b=a.data,c=t(a,b);c&&v(a,b,c,z)}function A(a){var b=a.data;m(a.changedTouches,b.identifier)&&z(b.identifier)}function z(a){f(document,"."+a,y);f(document,"."+a,A)}function v(a,b,c,d){var h=c.pageX-b.startX,g=c.pageY-
3
- b.startY;36>h*h+g*g||K(a,b,c,h,g,d)}function L(){this._handled=J;return!1}function B(a){a._handled()}function K(a,b,c,d,h,f){var e,k;e=a.targetTouches;k=a.timeStamp-b.timeStamp;b.type="movestart";b.distX=d;b.distY=h;b.deltaX=d;b.deltaY=h;b.pageX=c.pageX;b.pageY=c.pageY;b.velocityX=d/k;b.velocityY=h/k;b.targetTouches=e;b.finger=e?e.length:1;b._handled=L;b._preventTouchmoveDefault=function(){a.preventDefault()};g.event.trigger(b,void 0,b.target);f(b.identifier)}function C(a){var b=a.data.timer;a.data.touch=
4
- a;a.data.timeStamp=a.timeStamp;b.kick()}function D(a){var b=a.data.event;a=a.data.timer;f(document,k.move,C);f(document,k.end,D);E(b,a,function(){setTimeout(function(){f(b.target,"click",n)},0)})}function F(a){var b=a.data.event,c=a.data.timer,d=t(a,b);d&&(a.preventDefault(),b.targetTouches=a.targetTouches,a.data.touch=d,a.data.timeStamp=a.timeStamp,c.kick())}function G(a){var b=a.data.event,c=a.data.timer;m(a.changedTouches,b.identifier)&&(f(document,"."+b.identifier,F),f(document,"."+b.identifier,
5
- G),E(b,c))}function E(a,b,c){b.end(function(){a.type="moveend";g.event.trigger(a,void 0,a.target);return c&&c()})}var e=g.event.add,f=g.event.remove,I=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a,b){return window.setTimeout(function(){a()},25)}}(),r={textarea:!0,input:!0,select:!0,button:!0},k={move:"mousemove",cancel:"mouseup dragstart",end:"mouseup"};
6
- g.event.special.movestart={setup:function(a,b,c){e(this,"movestart.move",B);return!0},teardown:function(a){f(this,"dragstart drag",p);f(this,"mousedown touchstart",q);f(this,"movestart",B);return!0},add:function(a){"move"!==a.namespace&&"moveend"!==a.namespace&&(e(this,"dragstart."+a.guid+" drag."+a.guid,p,l,a.selector),e(this,"mousedown."+a.guid,q,l,a.selector))},remove:function(a){"move"!==a.namespace&&"moveend"!==a.namespace&&(f(this,"dragstart."+a.guid+" drag."+a.guid),f(this,"mousedown."+a.guid))},
7
- _default:function(a){function b(b){b=c;var e=d.touch,f=d.timeStamp-b.timeStamp;b.type="move";b.distX=e.pageX-b.startX;b.distY=e.pageY-b.startY;b.deltaX=e.pageX-b.pageX;b.deltaY=e.pageY-b.pageY;b.velocityX=.3*b.velocityX+.7*b.deltaX/f;b.velocityY=.3*b.velocityY+.7*b.deltaY/f;b.pageX=e.pageX;b.pageY=e.pageY;g.event.trigger(c,void 0,a.target)}var c,d;a._handled()&&(c={target:a.target,startX:a.startX,startY:a.startY,pageX:a.pageX,pageY:a.pageY,distX:a.distX,distY:a.distY,deltaX:a.deltaX,deltaY:a.deltaY,
8
- velocityX:a.velocityX,velocityY:a.velocityY,timeStamp:a.timeStamp,identifier:a.identifier,targetTouches:a.targetTouches,finger:a.finger},d={event:c,timer:new H(b),touch:l,timeStamp:l},a.identifier===l?(e(a.target,"click",n),e(document,k.move,C,d),e(document,k.end,D,d)):(a._preventTouchmoveDefault(),e(document,"touchmove."+a.identifier,F,d),e(document,"touchend."+a.identifier,G,d)))}};g.event.special.move={setup:function(){e(this,"movestart.move",g.noop)},teardown:function(){f(this,"movestart.move",
9
- g.noop)}};g.event.special.moveend={setup:function(){e(this,"movestart.moveend",g.noop)},teardown:function(){f(this,"movestart.moveend",g.noop)}};e(document,"mousedown.move",function(a){1!==a.which||a.ctrlKey||a.altKey||(a={target:a.target,startX:a.pageX,startY:a.pageY,timeStamp:a.timeStamp},e(document,k.move,u,a),e(document,k.cancel,x,a))});e(document,"touchstart.move",function(a){var b;r[a.target.tagName.toLowerCase()]||(b=a.changedTouches[0],a={target:b.target,startX:b.pageX,startY:b.pageY,timeStamp:a.timeStamp,
10
- identifier:b.identifier},e(document,"touchmove."+b.identifier,y,a),e(document,"touchend."+b.identifier,A,a))});"function"===typeof Array.prototype.indexOf&&function(a,b){for(var c=["changedTouches","targetTouches"],d=c.length;d--;)-1===a.event.props.indexOf(c[d])&&a.event.props.push(c[d])}(g)});
1
+ !function(a){"function"==typeof define&&define.amd?define([],a):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=a:a()}(function(){function a(a){return new CustomEvent(a,Q)}function b(a){return a[R]||(a[R]={})}function c(a,c,d,e,f){function g(a){d(a,e)}c=c.split(P);for(var h,i,j=b(a),k=c.length;k--;)i=c[k],h=j[i]||(j[i]=[]),h.push([d,g]),a.addEventListener(i,g)}function d(a,c,d,e){c=c.split(P);var f,g,h,i=b(a),j=c.length;if(i)for(;j--;)if(f=c[j],g=i[f])for(h=g.length;h--;)g[h][0]===d&&(a.removeEventListener(f,g[h][1]),g.splice(h,1))}function e(b,c,d){var e=a(c);d&&J(e,d),b.dispatchEvent(e)}function f(a){function b(a){d?(c(),L(b),e=!0,d=!1):e=!1}var c=a,d=!1,e=!1;this.kick=function(a){d=!0,e||b()},this.end=function(a){var b=c;a&&(e?(c=d?function(){b(),a()}:a,d=!0):a())}}function g(){}function h(a){a.preventDefault()}function i(a){return!!M[a.target.tagName.toLowerCase()]}function j(a){return 1===a.which&&!a.ctrlKey&&!a.altKey}function k(a,b){var c,d;if(a.identifiedTouch)return a.identifiedTouch(b);for(c=-1,d=a.length;++c<d;)if(a[c].identifier===b)return a[c]}function l(a,b){var c=k(a.changedTouches,b.identifier);if(c&&(c.pageX!==b.pageX||c.pageY!==b.pageY))return c}function m(a){j(a)&&(i(a)||(c(document,N.move,n,a),c(document,N.cancel,o,a)))}function n(a,b){u(a,b,a,p)}function o(a,b){p()}function p(){d(document,N.move,n),d(document,N.cancel,o)}function q(a){if(!M[a.target.tagName.toLowerCase()]){var b=a.changedTouches[0],d={target:b.target,pageX:b.pageX,pageY:b.pageY,identifier:b.identifier,touchmove:function(a,b){r(a,b)},touchend:function(a,b){s(a,b)}};c(document,O.move,d.touchmove,d),c(document,O.cancel,d.touchend,d)}}function r(a,b){var c=l(a,b);c&&u(a,b,c,t)}function s(a,b){k(a.changedTouches,b.identifier)&&t(b)}function t(a){d(document,O.move,a.touchmove),d(document,O.cancel,a.touchend)}function u(a,b,c,d){var e=c.pageX-b.pageX,f=c.pageY-b.pageY;e*e+f*f<K*K||v(a,b,c,e,f,d)}function v(a,b,c,d,f,h){var i=a.targetTouches,j=a.timeStamp-b.timeStamp,k={altKey:a.altKey,ctrlKey:a.ctrlKey,shiftKey:a.shiftKey,startX:b.pageX,startY:b.pageY,distX:d,distY:f,deltaX:d,deltaY:f,pageX:c.pageX,pageY:c.pageY,velocityX:d/j,velocityY:f/j,identifier:b.identifier,targetTouches:i,finger:i?i.length:1,enableMove:function(){this.moveEnabled=!0,this.enableMove=g,a.preventDefault()}};e(b.target,"movestart",k),h(b)}function w(a,b){var c=b.timer;b.touch=a,b.timeStamp=a.timeStamp,c.kick()}function x(a,b){var c=b.target,e=b.event,f=b.timer;y(),D(c,e,f,function(){setTimeout(function(){d(c,"click",h)},0)})}function y(){d(document,N.move,w),d(document,N.end,x)}function z(a,b){var c=b.event,d=b.timer,e=l(a,c);e&&(a.preventDefault(),c.targetTouches=a.targetTouches,b.touch=e,b.timeStamp=a.timeStamp,d.kick())}function A(a,b){var c=b.target,d=b.event,e=b.timer;k(a.changedTouches,d.identifier)&&(B(b),D(c,d,e))}function B(a){d(document,O.move,a.activeTouchmove),d(document,O.end,a.activeTouchend)}function C(a,b,c){var d=c-a.timeStamp;a.distX=b.pageX-a.startX,a.distY=b.pageY-a.startY,a.deltaX=b.pageX-a.pageX,a.deltaY=b.pageY-a.pageY,a.velocityX=.3*a.velocityX+.7*a.deltaX/d,a.velocityY=.3*a.velocityY+.7*a.deltaY/d,a.pageX=b.pageX,a.pageY=b.pageY}function D(a,b,c,d){c.end(function(){return e(a,"moveend",b),d&&d()})}function E(a){function b(a){C(d,g.touch,g.timeStamp),e(g.target,"move",d)}if(!a.defaultPrevented&&a.moveEnabled){var d={startX:a.startX,startY:a.startY,pageX:a.pageX,pageY:a.pageY,distX:a.distX,distY:a.distY,deltaX:a.deltaX,deltaY:a.deltaY,velocityX:a.velocityX,velocityY:a.velocityY,identifier:a.identifier,targetTouches:a.targetTouches,finger:a.finger},g={target:a.target,event:d,timer:new f(b),touch:void 0,timeStamp:a.timeStamp};void 0===a.identifier?(c(a.target,"click",h),c(document,N.move,w,g),c(document,N.end,x,g)):(g.activeTouchmove=function(a,b){z(a,b)},g.activeTouchend=function(a,b){A(a,b)},c(document,O.move,g.activeTouchmove,g),c(document,O.end,g.activeTouchend,g))}}function F(a){a.enableMove()}function G(a){a.enableMove()}function H(a){a.enableMove()}function I(a){var b=a.handler;a.handler=function(a){for(var c,d=S.length;d--;)c=S[d],a[c]=a.originalEvent[c];b.apply(this,arguments)}}var J=Object.assign||window.jQuery&&jQuery.extend,K=8,L=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a,b){return window.setTimeout(function(){a()},25)}}(),M={textarea:!0,input:!0,select:!0,button:!0},N={move:"mousemove",cancel:"mouseup dragstart",end:"mouseup"},O={move:"touchmove",cancel:"touchend",end:"touchend"},P=/\s+/,Q={bubbles:!0,cancelable:!0},R=Symbol("events");if(c(document,"mousedown",m),c(document,"touchstart",q),c(document,"movestart",E),window.jQuery){var S="startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY".split(" ");jQuery.event.special.movestart={setup:function(){return c(this,"movestart",F),!1},teardown:function(){return d(this,"movestart",F),!1},add:I},jQuery.event.special.move={setup:function(){return c(this,"movestart",G),!1},teardown:function(){return d(this,"movestart",G),!1},add:I},jQuery.event.special.moveend={setup:function(){return c(this,"movestart",H),!1},teardown:function(){return d(this,"movestart",H),!1},add:I}}});
 
 
 
 
 
 
 
 
 
assets/js/jquery.twentytwenty.js CHANGED
@@ -1,38 +1,36 @@
1
- /* globals ajaxurl: false, console: false, imagifyTTT: true */
2
-
3
  window.imagify = window.imagify || {
4
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
  log: function( content ) {
6
  if ( undefined !== console ) {
7
- console.log( content );
8
  }
9
  },
10
  info: function( content ) {
11
  if ( undefined !== console ) {
12
- console.info( content );
13
  }
14
  }
15
  };
16
 
 
17
  (function($, d, w, undefined) {
18
 
19
  $.fn.twentytwenty = function(options, callback) {
20
  options = $.extend({
21
- handlePosition : 0.5,
22
- orientation : 'horizontal',
23
- labelBefore : 'Before',
24
- labelAfter : 'After'
25
  }, options);
26
 
27
  return this.each(function() {
28
-
29
- var sliderPct = options.handlePosition,
30
- $container = $(this),
31
- sliderOrientation = options.orientation,
32
- beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left',
33
- afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right',
34
- $beforeImg = $container.find('img:first'),
35
- $afterImg = $container.find('img:last');
36
 
37
 
38
  $container.wrap('<div class="twentytwenty-wrapper twentytwenty-' + sliderOrientation + '"></div>');
@@ -92,7 +90,7 @@ window.imagify = window.imagify || {
92
  imgWidth = 0,
93
  imgHeight = 0;
94
 
95
- $(window).on('resize.twentytwenty', function() {
96
  adjustSlider( sliderPct );
97
  });
98
 
@@ -133,16 +131,17 @@ window.imagify = window.imagify || {
133
  event.preventDefault();
134
  });
135
 
136
- $(window).trigger('resize.twentytwenty');
137
  });
138
  };
139
 
140
  } )(jQuery, document, window);
 
141
 
142
  /**
143
  * Twentytwenty Imagify Init
144
  */
145
- (function($, d, w, undefined) {
146
 
147
  /*
148
  * Mini chart
@@ -152,7 +151,7 @@ window.imagify = window.imagify || {
152
  var drawMeAChart = function ( canvas ) {
153
  canvas.each( function() {
154
  var $this = $( this ),
155
- theValue = parseInt( $this.closest( '.imagify-chart' ).next( '.imagify-chart-value' ).text() ),
156
  overviewData = [
157
  {
158
  value: theValue,
@@ -164,12 +163,12 @@ window.imagify = window.imagify || {
164
  }
165
  ];
166
 
167
- new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, {
168
- segmentStrokeColor : '#2A2E3C',
169
- segmentStrokeWidth : 1,
170
- animateRotate : true,
171
  percentageInnerCutout: 60,
172
- tooltipEvents : []
173
  } );
174
  } );
175
  },
@@ -207,6 +206,7 @@ window.imagify = window.imagify || {
207
 
208
  // create modal box
209
  modalHtml = '<div id="' + settings.modalId + '" class="imagify-modal imagify-visual-comparison" aria-hidden="true">';
 
210
  modalHtml += '<div class="imagify-modal-content loading">';
211
  modalHtml += '<div class="twentytwenty-container">';
212
  modalHtml += '<img class="imagify-img-before" alt="" width="' + settings.width + '" height="' + settings.height + '">';
@@ -232,6 +232,7 @@ window.imagify = window.imagify || {
232
  modalHtml += '</div>';
233
  modalHtml += '<button class="close-btn absolute" type="button"><i aria-hidden="true" class="dashicons dashicons-no-alt"></i><span class="screen-reader-text">' + imagifyTTT.labels.close + '</span></button>';
234
  modalHtml += '</div>';
 
235
  modalHtml += '</div>';
236
 
237
  settings.modalAppendTo.append( modalHtml );
@@ -248,7 +249,7 @@ window.imagify = window.imagify || {
248
  }
249
 
250
  $modal.find( '.imagify-modal-content').css( {
251
- 'width' : ( $( w ).outerWidth() * 0.85 ) + 'px',
252
  'max-width': settings.width
253
  } );
254
 
@@ -315,7 +316,7 @@ window.imagify = window.imagify || {
315
  top: labelsPos + scrollTop
316
  } );
317
  $datas.css( {
318
- bottom: - scrollTop
319
  } );
320
  } );
321
  }
@@ -378,14 +379,18 @@ window.imagify = window.imagify || {
378
  ultraDim = $tt.data( 'ultra-dim' ).split( 'x' );
379
 
380
  ttBeforeButtons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-left">';
 
381
  ttBeforeButtons += '<button type="button" class="imagify-comparison-original selected" data-img="original">' + labelOriginal + '</button>';
382
  ttBeforeButtons += '<button type="button" class="imagify-comparison-normal" data-img="normal">' + labelNormal + '</button>';
383
  ttBeforeButtons += '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + labelAggressive + '</button>';
 
384
  ttBeforeButtons += '</span>';
385
  ttAfterButtons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-right">';
 
386
  ttAfterButtons += '<button type="button" class="imagify-comparison-normal" data-img="normal">' + labelNormal + '</button>';
387
  ttAfterButtons += '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + labelAggressive + '</button>';
388
  ttAfterButtons += '<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">' + labelUltra + '</button>';
 
389
  ttAfterButtons += '</span>';
390
 
391
  // Loader.
@@ -603,38 +608,38 @@ window.imagify = window.imagify || {
603
  },
604
  imagifyContentInModal = function() {
605
  var tempTimer = setInterval( function() {
606
- var $datas;
607
 
608
- if ( ! $( '.media-modal' ).find( '.imagify-datas-details' ).length ) {
609
- return;
610
- }
611
 
612
- if ( $( '#imagify-original-src' ).length > 0 && $( '#imagify-original-src' ) !== '' ) {
613
- // Trigger creation.
614
- $( '.media-frame-content' ).find( '.attachment-actions' ).prepend( '<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-comparison-modal" id="imagify-media-frame-comparison-btn">' + imagifyTTT.labels.compare + '</button>' );
615
-
616
- // Get datas.
617
- $datas = $( '.media-frame-content' ).find( '.compat-field-imagify' );
618
-
619
- // Modal and trigger event creation.
620
- imagifyTwentyModal( {
621
- width: $( '#imagify-full-width' ).val(),
622
- height: $( '#imagify-full-height' ).val(),
623
- originalUrl: $( '#imagify-original-src' ).val(),
624
- optimizedUrl: $( '#imagify-full-src' ).val(),
625
- originalSize: $( '#imagify-original-size' ).val(),
626
- optimizedSize: $datas.find( '.imagify-data-item' ).find( '.big' ).text(),
627
- saving: $datas.find( '.imagify-chart-value' ).text(),
628
- modalAppendTo: $( '.media-frame-content' ).find( '.thumbnail-image' ),
629
- trigger: $( '#imagify-media-frame-comparison-btn' ),
630
- modalId: 'imagify-comparison-modal',
631
- openModal: true
632
- } );
633
- }
634
 
635
- clearInterval( tempTimer );
636
- tempTimer = null;
637
- }, 20 );
638
  },
639
  waitContent = setInterval( function() {
640
  if ( ! $('.upload-php').find('.media-frame.mode-grid').find('.attachments').length ) {
 
 
1
  window.imagify = window.imagify || {
2
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
3
  log: function( content ) {
4
  if ( undefined !== console ) {
5
+ console.log( content ); // eslint-disable-line no-console
6
  }
7
  },
8
  info: function( content ) {
9
  if ( undefined !== console ) {
10
+ console.info( content ); // eslint-disable-line no-console
11
  }
12
  }
13
  };
14
 
15
+ /* eslint-disable */
16
  (function($, d, w, undefined) {
17
 
18
  $.fn.twentytwenty = function(options, callback) {
19
  options = $.extend({
20
+ handlePosition: 0.5,
21
+ orientation: 'horizontal',
22
+ labelBefore: 'Before',
23
+ labelAfter: 'After'
24
  }, options);
25
 
26
  return this.each(function() {
27
+ var sliderPct = options.handlePosition,
28
+ $container = $(this),
29
+ sliderOrientation = options.orientation,
30
+ beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left',
31
+ afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right',
32
+ $beforeImg = $container.find('img:first'),
33
+ $afterImg = $container.find('img:last');
 
34
 
35
 
36
  $container.wrap('<div class="twentytwenty-wrapper twentytwenty-' + sliderOrientation + '"></div>');
90
  imgWidth = 0,
91
  imgHeight = 0;
92
 
93
+ $( w ).on('resize.twentytwenty', function() {
94
  adjustSlider( sliderPct );
95
  });
96
 
131
  event.preventDefault();
132
  });
133
 
134
+ $( w ).trigger('resize.twentytwenty');
135
  });
136
  };
137
 
138
  } )(jQuery, document, window);
139
+ /* eslint-enable */
140
 
141
  /**
142
  * Twentytwenty Imagify Init
143
  */
144
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
145
 
146
  /*
147
  * Mini chart
151
  var drawMeAChart = function ( canvas ) {
152
  canvas.each( function() {
153
  var $this = $( this ),
154
+ theValue = parseInt( $this.closest( '.imagify-chart' ).next( '.imagify-chart-value' ).text(), 10 ),
155
  overviewData = [
156
  {
157
  value: theValue,
163
  }
164
  ];
165
 
166
+ new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, { // eslint-disable-line new-cap
167
+ segmentStrokeColor: '#2A2E3C',
168
+ segmentStrokeWidth: 1,
169
+ animateRotate: true,
170
  percentageInnerCutout: 60,
171
+ tooltipEvents: []
172
  } );
173
  } );
174
  },
206
 
207
  // create modal box
208
  modalHtml = '<div id="' + settings.modalId + '" class="imagify-modal imagify-visual-comparison" aria-hidden="true">';
209
+ /* eslint-disable indent */
210
  modalHtml += '<div class="imagify-modal-content loading">';
211
  modalHtml += '<div class="twentytwenty-container">';
212
  modalHtml += '<img class="imagify-img-before" alt="" width="' + settings.width + '" height="' + settings.height + '">';
232
  modalHtml += '</div>';
233
  modalHtml += '<button class="close-btn absolute" type="button"><i aria-hidden="true" class="dashicons dashicons-no-alt"></i><span class="screen-reader-text">' + imagifyTTT.labels.close + '</span></button>';
234
  modalHtml += '</div>';
235
+ /* eslint-enable indent */
236
  modalHtml += '</div>';
237
 
238
  settings.modalAppendTo.append( modalHtml );
249
  }
250
 
251
  $modal.find( '.imagify-modal-content').css( {
252
+ 'width': ( $( w ).outerWidth() * 0.85 ) + 'px',
253
  'max-width': settings.width
254
  } );
255
 
316
  top: labelsPos + scrollTop
317
  } );
318
  $datas.css( {
319
+ bottom: -scrollTop
320
  } );
321
  } );
322
  }
379
  ultraDim = $tt.data( 'ultra-dim' ).split( 'x' );
380
 
381
  ttBeforeButtons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-left">';
382
+ /* eslint-disable indent */
383
  ttBeforeButtons += '<button type="button" class="imagify-comparison-original selected" data-img="original">' + labelOriginal + '</button>';
384
  ttBeforeButtons += '<button type="button" class="imagify-comparison-normal" data-img="normal">' + labelNormal + '</button>';
385
  ttBeforeButtons += '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + labelAggressive + '</button>';
386
+ /* eslint-enable indent */
387
  ttBeforeButtons += '</span>';
388
  ttAfterButtons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-right">';
389
+ /* eslint-disable indent */
390
  ttAfterButtons += '<button type="button" class="imagify-comparison-normal" data-img="normal">' + labelNormal + '</button>';
391
  ttAfterButtons += '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + labelAggressive + '</button>';
392
  ttAfterButtons += '<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">' + labelUltra + '</button>';
393
+ /* eslint-enable indent */
394
  ttAfterButtons += '</span>';
395
 
396
  // Loader.
608
  },
609
  imagifyContentInModal = function() {
610
  var tempTimer = setInterval( function() {
611
+ var $datas;
612
 
613
+ if ( ! $( '.media-modal' ).find( '.imagify-datas-details' ).length ) {
614
+ return;
615
+ }
616
 
617
+ if ( $( '#imagify-original-src' ).length > 0 && $( '#imagify-original-src' ) !== '' ) {
618
+ // Trigger creation.
619
+ $( '.media-frame-content' ).find( '.attachment-actions' ).prepend( '<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-comparison-modal" id="imagify-media-frame-comparison-btn">' + imagifyTTT.labels.compare + '</button>' );
620
+
621
+ // Get datas.
622
+ $datas = $( '.media-frame-content' ).find( '.compat-field-imagify' );
623
+
624
+ // Modal and trigger event creation.
625
+ imagifyTwentyModal( {
626
+ width: $( '#imagify-full-width' ).val(),
627
+ height: $( '#imagify-full-height' ).val(),
628
+ originalUrl: $( '#imagify-original-src' ).val(),
629
+ optimizedUrl: $( '#imagify-full-src' ).val(),
630
+ originalSize: $( '#imagify-original-size' ).val(),
631
+ optimizedSize: $datas.find( '.imagify-data-item' ).find( '.big' ).text(),
632
+ saving: $datas.find( '.imagify-chart-value' ).text(),
633
+ modalAppendTo: $( '.media-frame-content' ).find( '.thumbnail-image' ),
634
+ trigger: $( '#imagify-media-frame-comparison-btn' ),
635
+ modalId: 'imagify-comparison-modal',
636
+ openModal: true
637
+ } );
638
+ }
639
 
640
+ clearInterval( tempTimer );
641
+ tempTimer = null;
642
+ }, 20 );
643
  },
644
  waitContent = setInterval( function() {
645
  if ( ! $('.upload-php').find('.media-frame.mode-grid').find('.attachments').length ) {
assets/js/jquery.twentytwenty.min.js CHANGED
@@ -1 +1 @@
1
- window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){a.fn.twentytwenty=function(b,c){return b=a.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},b),this.each(function(){var d=b.handlePosition,e=a(this),f=b.orientation,g="vertical"===f?"down":"left",h="vertical"===f?"up":"right",i=e.find("img:first"),j=e.find("img:last");e.wrap('<div class="twentytwenty-wrapper twentytwenty-'+f+'"></div>'),e.append('<div class="twentytwenty-overlay"></div>'),e.append('<div class="twentytwenty-handle"></div>');var k=e.find(".twentytwenty-handle");k.append('<span class="twentytwenty-'+g+'-arrow"></span>'),k.append('<span class="twentytwenty-'+h+'-arrow"></span>'),e.addClass("twentytwenty-container"),i.addClass("twentytwenty-before"),j.addClass("twentytwenty-after");var l=e.find(".twentytwenty-overlay");l.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">'+b.labelBefore+"</span></div>"),l.append('<div class="twentytwenty-labels twentytwenty-after-label"><span class="twentytwenty-label-content">'+b.labelAfter+"</span></div>");var m=function(a){var b=i.width(),c=i.height();return{w:b+"px",h:c+"px",cw:a*b+"px",ch:a*c+"px"}},n=function(a){var b=e.find(".twentytwenty-before");"vertical"===f?b.css("clip","rect(0,"+a.w+","+a.ch+",0)"):b.css("clip","rect(0,"+a.cw+","+a.h+",0)"),e.css("height",a.h),"function"==typeof c&&c()},o=function(a){var b=m(a);k.css("vertical"===f?"top":"left","vertical"===f?b.ch:b.cw),n(b)},p=0,q=0,r=0,s=0;a(window).on("resize.twentytwenty",function(){o(d)}),k.on("movestart",function(a){(a.distX>a.distY&&a.distX<-a.distY||a.distX<a.distY&&a.distX>-a.distY)&&"vertical"!==f?a.preventDefault():(a.distX<a.distY&&a.distX<-a.distY||a.distX>a.distY&&a.distX>-a.distY)&&"vertical"===f&&a.preventDefault(),e.addClass("active"),p=e.offset().left,q=e.offset().top,r=i.width(),s=i.height()}),k.on("moveend",function(){e.removeClass("active")}),k.on("move",function(a){e.hasClass("active")&&(d="vertical"===f?(a.pageY-q)/s:(a.pageX-p)/r,d<0&&(d=0),d>1&&(d=1),o(d))}),e.find("img").on("mousedown",function(a){a.preventDefault()}),a(window).trigger("resize.twentytwenty")})}}(jQuery,document,window),function(a,b,c,d){var e=function(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-chart").next(".imagify-chart-value").text()),d=[{value:c,color:"#00B3D3"},{value:100-c,color:"#D8D8D8"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"#2A2E3C",segmentStrokeWidth:1,animateRotate:!0,percentageInnerCutout:60,tooltipEvents:[]})})},f=function(b){var c=b.data("target")||b.attr("href");a(c).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open"),a("body").addClass("imagify-modal-is-open")},g=function(b){var d,g={width:0,height:0,originalUrl:"",optimizedUrl:"",originalSize:0,optimizedSize:0,saving:0,modalAppendTo:a("body"),trigger:a('[data-target="imagify-visual-comparison"]'),modalId:"imagify-visual-comparison",openModal:!1},h=a.extend({},g,b);if(0===h.width||0===h.height||""===h.originalUrl||""===h.optimizedUrl||0===h.originalSize||0===h.optimizedSize||0===h.saving)return"error";d='<div id="'+h.modalId+'" class="imagify-modal imagify-visual-comparison" aria-hidden="true">',d+='<div class="imagify-modal-content loading">',d+='<div class="twentytwenty-container">',d+='<img class="imagify-img-before" alt="" width="'+h.width+'" height="'+h.height+'">',d+='<img class="imagify-img-after" alt="" width="'+h.width+'" height="'+h.height+'">',d+="</div>",d+='<div class="imagify-comparison-levels">',d+='<div class="imagify-c-level imagify-level-original go-left">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+h.originalSize+"</span>",d+="</p>",d+="</div>",d+='<div class="imagify-c-level imagify-level-optimized go-right">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+h.optimizedSize+"</span>",d+="</p>",d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.saving+"</span>",d+='<span class="value"><span class="imagify-chart"><span class="imagify-chart-container"><canvas id="imagify-consumption-chart-normal" width="15" height="15"></canvas></span></span><span class="imagify-chart-value">'+h.saving+"</span>%</span>",d+="</p>",d+="</div>",d+="</div>",d+='<button class="close-btn absolute" type="button"><i aria-hidden="true" class="dashicons dashicons-no-alt"></i><span class="screen-reader-text">'+imagifyTTT.labels.close+"</span></button>",d+="</div>",d+="</div>",h.modalAppendTo.append(d),h.trigger.on("click.imagify",function(b){var d,g,i=a(a(this).data("target")),j=0;b.preventDefault(),"function"==typeof f&&h.openModal&&f(a(this)),i.find(".imagify-modal-content").css({width:.85*a(c).outerWidth()+"px","max-width":h.width}),i.find(".imagify-img-before").on("load",function(){j++}).attr("src",h.originalUrl),i.find(".imagify-img-after").on("load",function(){j++}).attr("src",h.optimizedUrl),d=i.find(".twentytwenty-container"),g=setInterval(function(){if(2===j)return d.twentytwenty({handlePosition:.3,orientation:"horizontal",labelBefore:imagifyTTT.labels.original_l,labelAfter:imagifyTTT.labels.optimized_l},function(){var b,f,g,h,j,k,l=a(c).height(),m=i.find(".twentytwenty-container").height(),n=i.find(".twentytwenty-wrapper").position().top;d.closest(".imagify-modal-content").hasClass("loaded")||(d.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(i.find(".imagify-level-optimized").find(".imagify-chart").find("canvas"))),l<m&&!i.hasClass("modal-is-too-high")&&(i.addClass("modal-is-too-high"),b=i.find(".twentytwenty-handle"),f=i.find(".twentytwenty-label-content"),g=i.find(".imagify-comparison-levels"),h=g.outerHeight(),j=(l-n-b.height())/2,k=l-3*n-h,b.css({top:j}),f.css({top:k,bottom:"auto"}),i.find(".twentytwenty-wrapper").css({paddingBottom:h}),i.find(".imagify-modal-content").on("scroll.imagify",function(){var c=a(this).scrollTop();b.css({top:j+c}),f.css({top:k+c}),g.css({bottom:-c})}))}),clearInterval(g),g=null,"done"},75)})};if(a(".imagify-visual-comparison-btn").on("click",function(){var b,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;1!==a(".twentytwenty-wrapper").length&&(a(a(this).data("target")).find(".imagify-modal-content").css("width",.95*a(c).outerWidth()+"px"),a(".twentytwenty-container").length>0&&a(c).outerWidth()<=800||(b=a(".twentytwenty-container"),d=0,f=b.data("loader"),g=b.data("label-original"),h=b.data("label-normal"),i=b.data("label-aggressive"),j=b.data("label-ultra"),k=b.data("original-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),l=b.data("original-alt"),m=b.data("original-img"),n=b.data("original-dim").split("x"),o=b.data("normal-alt"),p=b.data("normal-img"),q=b.data("normal-dim").split("x"),r=b.data("aggressive-alt"),s=b.data("aggressive-img"),t=b.data("aggressive-dim").split("x"),u=b.data("ultra-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),v=b.data("ultra-alt"),w=b.data("ultra-img"),x=b.data("ultra-dim").split("x"),y='<span class="twentytwenty-duo-buttons twentytwenty-duo-left">',y+='<button type="button" class="imagify-comparison-original selected" data-img="original">'+g+"</button>",y+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",y+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",y+="</span>",z='<span class="twentytwenty-duo-buttons twentytwenty-duo-right">',z+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",z+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",z+='<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">'+j+"</button>",z+="</span>",b.before('<img class="loader" src="'+f+'" alt="Loading…" width="64" height="64">'),a(".twentytwenty-left-buttons").append(y),a(".twentytwenty-right-buttons").append(z),A='<img class="img-original" alt="'+l+'" width="'+n[0]+'" height="'+n[1]+'">',A+='<img class="img-normal" alt="'+o+'" width="'+q[0]+'" height="'+q[1]+'">',A+='<img class="img-aggressive" alt="'+r+'" width="'+t[0]+'" height="'+t[1]+'">',A+='<img class="img-ultra" alt="'+v+'" width="'+x[0]+'" height="'+x[1]+'">',A+=a(".twentytwenty-left-buttons").lenght?y+z:"",b.closest(".imagify-modal-content").addClass("loading").find(".twentytwenty-container").append(A),a(".img-original").on("load",function(){d++}).attr("src",m),a(".img-normal").on("load",function(){d++}).attr("src",p),a(".img-aggressive").on("load",function(){d++}).attr("src",s),a(".img-ultra").on("load",function(){d++}).attr("src",w),B=setInterval(function(){4===d&&(b.twentytwenty({handlePosition:.6,orientation:"horizontal",labelBefore:k,labelAfter:u},function(){b.closest(".imagify-modal-content").hasClass("loaded")||(b.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(a(".imagify-level-ultra").find(".imagify-chart").find("canvas")))}),clearInterval(B),B=null)},75),a(".imagify-comparison-title").on("click",".twentytwenty-duo-buttons button:not(.selected)",function(b){var c,d=a(this),f=d.closest(".imagify-comparison-title").nextAll(".twentytwenty-wrapper").find(".twentytwenty-container"),g=d.closest(".twentytwenty-duo-buttons").hasClass("twentytwenty-duo-left")?"left":"right",h="left"===g?d.closest(".imagify-comparison-title").find(".twentytwenty-duo-right"):d.closest(".imagify-comparison-title").find(".twentytwenty-duo-left"),i=d.closest(".twentytwenty-duo-buttons").find("button"),j=f.find(".twentytwenty-before"),k=f.find(".twentytwenty-after"),l=d.data("img");b.stopPropagation(),b.preventDefault(),i.removeClass("selected"),d.addClass("selected"),h.find(".selected").data("img")===l&&h.find("button:not(.selected)").eq(0).trigger("click"),"left"===g&&(c=j.css("clip"),j.attr("style",""),j.removeClass("twentytwenty-before"),f.find(".img-"+l).addClass("twentytwenty-before").css("clip",c),a(".twentytwenty-before-label").find(".twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-left").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-left")),"right"===g&&(k.removeClass("twentytwenty-after"),f.find(".img-"+l).addClass("twentytwenty-after"),a(".twentytwenty-after-label").find(".twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-right").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-right")),e(a(".imagify-level-"+l).find(".imagify-chart").find("canvas"))})))}),a(".post-php").find(".wp_attachment_image").find(".thumbnail").length>0){var h,i,j=a(".post-php").find(".wp_attachment_image"),k=j.find(".thumbnail"),l={src:k.prop("src"),width:k.width(),height:k.height()},m={src:a("#imagify-full-original").val(),size:a("#imagify-full-original-size").val()},n=a("#misc-publishing-actions").find(".misc-pub-imagify").find(".button-primary");l.width>360&&a("#imagify-full-original").length>0&&""!==a("#imagify-full-original").val()?(h=a(".misc-pub-filesize").find("strong").text(),i=a(".imagify-data-item").find(".imagify-chart-value").text(),a('[id^="imgedit-open-btn-"]').before('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-visual-comparison" id="imagify-start-comparison">'+imagifyTTT.labels.compare+"</button>"),g({width:l.width,height:l.height,originalUrl:m.src,optimizedUrl:l.src,originalSize:m.size,optimizedSize:h,saving:i,modalAppendTo:j,trigger:a("#imagify-start-comparison"),modalId:"imagify-visual-comparison"})):l.width<360&&a("#imagify-full-original").length>0&&""!==a("#imagify-full-original").val()||a("#imagify-full-original").length>0&&""===a("#imagify-full-original").val()||1===a("#misc-publishing-actions").find(".misc-pub-imagify").find(".button-primary").length&&(a('[id^="imgedit-open-btn-"]').before('<span class="spinner imagify-hidden"></span><a class="imagify-button-primary button-primary imagify-optimize-trigger" id="imagify-optimize-trigger" href="'+n.attr("href")+'">'+imagifyTTT.labels.optimize+"</a>"),a("#imagify-optimize-trigger").on("click",function(){a(this).prev(".spinner").removeClass("imagify-hidden").addClass("is-active")}))}if(a(".upload-php").find(".imagify-compare-images").length>0&&a(".imagify-compare-images").each(function(){var b=a(this),c=b.data("id"),d=b.closest("#post-"+c).find(".column-imagify_optimized_file");g({width:b.data("full-width"),height:b.data("full-height"),originalUrl:b.data("backup-src"),optimizedUrl:b.data("full-src"),originalSize:d.find(".original").text(),optimizedSize:d.find(".imagify-data-item").find(".big").text(),saving:d.find(".imagify-chart-value").text(),modalAppendTo:b.closest(".column-primary"),trigger:b,modalId:"imagify-comparison-"+c})}),a(".upload-php").length>0)var o=function(a){var b={};return c.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,c,d){b[c]=void 0!==d?d:""}),a?b[a]?b[a]:null:b},p=function(){var b=setInterval(function(){var c;a(".media-modal").find(".imagify-datas-details").length&&(a("#imagify-original-src").length>0&&""!==a("#imagify-original-src")&&(a(".media-frame-content").find(".attachment-actions").prepend('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-comparison-modal" id="imagify-media-frame-comparison-btn">'+imagifyTTT.labels.compare+"</button>"),c=a(".media-frame-content").find(".compat-field-imagify"),g({width:a("#imagify-full-width").val(),height:a("#imagify-full-height").val(),originalUrl:a("#imagify-original-src").val(),optimizedUrl:a("#imagify-full-src").val(),originalSize:a("#imagify-original-size").val(),optimizedSize:c.find(".imagify-data-item").find(".big").text(),saving:c.find(".imagify-chart-value").text(),modalAppendTo:a(".media-frame-content").find(".thumbnail-image"),trigger:a("#imagify-media-frame-comparison-btn"),modalId:"imagify-comparison-modal",openModal:!0})),clearInterval(b),b=null)},20)},q=setInterval(function(){a(".upload-php").find(".media-frame.mode-grid").find(".attachments").length&&(a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){p()}),o("item")&&p(),clearInterval(q),q=null)},100)}(jQuery,document,window);
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){a.fn.twentytwenty=function(b,d){return b=a.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},b),this.each(function(){var e=b.handlePosition,f=a(this),g=b.orientation,h="vertical"===g?"down":"left",i="vertical"===g?"up":"right",j=f.find("img:first"),k=f.find("img:last");f.wrap('<div class="twentytwenty-wrapper twentytwenty-'+g+'"></div>'),f.append('<div class="twentytwenty-overlay"></div>'),f.append('<div class="twentytwenty-handle"></div>');var l=f.find(".twentytwenty-handle");l.append('<span class="twentytwenty-'+h+'-arrow"></span>'),l.append('<span class="twentytwenty-'+i+'-arrow"></span>'),f.addClass("twentytwenty-container"),j.addClass("twentytwenty-before"),k.addClass("twentytwenty-after");var m=f.find(".twentytwenty-overlay");m.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">'+b.labelBefore+"</span></div>"),m.append('<div class="twentytwenty-labels twentytwenty-after-label"><span class="twentytwenty-label-content">'+b.labelAfter+"</span></div>");var n=function(a){var b=j.width(),c=j.height();return{w:b+"px",h:c+"px",cw:a*b+"px",ch:a*c+"px"}},o=function(a){var b=f.find(".twentytwenty-before");"vertical"===g?b.css("clip","rect(0,"+a.w+","+a.ch+",0)"):b.css("clip","rect(0,"+a.cw+","+a.h+",0)"),f.css("height",a.h),"function"==typeof d&&d()},p=function(a){var b=n(a);l.css("vertical"===g?"top":"left","vertical"===g?b.ch:b.cw),o(b)},q=0,r=0,s=0,t=0;a(c).on("resize.twentytwenty",function(){p(e)}),l.on("movestart",function(a){(a.distX>a.distY&&a.distX<-a.distY||a.distX<a.distY&&a.distX>-a.distY)&&"vertical"!==g?a.preventDefault():(a.distX<a.distY&&a.distX<-a.distY||a.distX>a.distY&&a.distX>-a.distY)&&"vertical"===g&&a.preventDefault(),f.addClass("active"),q=f.offset().left,r=f.offset().top,s=j.width(),t=j.height()}),l.on("moveend",function(){f.removeClass("active")}),l.on("move",function(a){f.hasClass("active")&&(e="vertical"===g?(a.pageY-r)/t:(a.pageX-q)/s,e<0&&(e=0),e>1&&(e=1),p(e))}),f.find("img").on("mousedown",function(a){a.preventDefault()}),a(c).trigger("resize.twentytwenty")})}}(jQuery,document,window),function(a,b,c,d){var e=function(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-chart").next(".imagify-chart-value").text(),10),d=[{value:c,color:"#00B3D3"},{value:100-c,color:"#D8D8D8"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"#2A2E3C",segmentStrokeWidth:1,animateRotate:!0,percentageInnerCutout:60,tooltipEvents:[]})})},f=function(b){var c=b.data("target")||b.attr("href");a(c).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open"),a("body").addClass("imagify-modal-is-open")},g=function(b){var d,g={width:0,height:0,originalUrl:"",optimizedUrl:"",originalSize:0,optimizedSize:0,saving:0,modalAppendTo:a("body"),trigger:a('[data-target="imagify-visual-comparison"]'),modalId:"imagify-visual-comparison",openModal:!1},h=a.extend({},g,b);if(0===h.width||0===h.height||""===h.originalUrl||""===h.optimizedUrl||0===h.originalSize||0===h.optimizedSize||0===h.saving)return"error";d='<div id="'+h.modalId+'" class="imagify-modal imagify-visual-comparison" aria-hidden="true">',d+='<div class="imagify-modal-content loading">',d+='<div class="twentytwenty-container">',d+='<img class="imagify-img-before" alt="" width="'+h.width+'" height="'+h.height+'">',d+='<img class="imagify-img-after" alt="" width="'+h.width+'" height="'+h.height+'">',d+="</div>",d+='<div class="imagify-comparison-levels">',d+='<div class="imagify-c-level imagify-level-original go-left">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+h.originalSize+"</span>",d+="</p>",d+="</div>",d+='<div class="imagify-c-level imagify-level-optimized go-right">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+h.optimizedSize+"</span>",d+="</p>",d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.saving+"</span>",d+='<span class="value"><span class="imagify-chart"><span class="imagify-chart-container"><canvas id="imagify-consumption-chart-normal" width="15" height="15"></canvas></span></span><span class="imagify-chart-value">'+h.saving+"</span>%</span>",d+="</p>",d+="</div>",d+="</div>",d+='<button class="close-btn absolute" type="button"><i aria-hidden="true" class="dashicons dashicons-no-alt"></i><span class="screen-reader-text">'+imagifyTTT.labels.close+"</span></button>",d+="</div>",d+="</div>",h.modalAppendTo.append(d),h.trigger.on("click.imagify",function(b){var d,g,i=a(a(this).data("target")),j=0;b.preventDefault(),"function"==typeof f&&h.openModal&&f(a(this)),i.find(".imagify-modal-content").css({width:.85*a(c).outerWidth()+"px","max-width":h.width}),i.find(".imagify-img-before").on("load",function(){j++}).attr("src",h.originalUrl),i.find(".imagify-img-after").on("load",function(){j++}).attr("src",h.optimizedUrl),d=i.find(".twentytwenty-container"),g=setInterval(function(){if(2===j)return d.twentytwenty({handlePosition:.3,orientation:"horizontal",labelBefore:imagifyTTT.labels.original_l,labelAfter:imagifyTTT.labels.optimized_l},function(){var b,f,g,h,j,k,l=a(c).height(),m=i.find(".twentytwenty-container").height(),n=i.find(".twentytwenty-wrapper").position().top;d.closest(".imagify-modal-content").hasClass("loaded")||(d.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(i.find(".imagify-level-optimized").find(".imagify-chart").find("canvas"))),l<m&&!i.hasClass("modal-is-too-high")&&(i.addClass("modal-is-too-high"),b=i.find(".twentytwenty-handle"),f=i.find(".twentytwenty-label-content"),g=i.find(".imagify-comparison-levels"),h=g.outerHeight(),j=(l-n-b.height())/2,k=l-3*n-h,b.css({top:j}),f.css({top:k,bottom:"auto"}),i.find(".twentytwenty-wrapper").css({paddingBottom:h}),i.find(".imagify-modal-content").on("scroll.imagify",function(){var c=a(this).scrollTop();b.css({top:j+c}),f.css({top:k+c}),g.css({bottom:-c})}))}),clearInterval(g),g=null,"done"},75)})};if(a(".imagify-visual-comparison-btn").on("click",function(){var b,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;1!==a(".twentytwenty-wrapper").length&&(a(a(this).data("target")).find(".imagify-modal-content").css("width",.95*a(c).outerWidth()+"px"),a(".twentytwenty-container").length>0&&a(c).outerWidth()<=800||(b=a(".twentytwenty-container"),d=0,f=b.data("loader"),g=b.data("label-original"),h=b.data("label-normal"),i=b.data("label-aggressive"),j=b.data("label-ultra"),k=b.data("original-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),l=b.data("original-alt"),m=b.data("original-img"),n=b.data("original-dim").split("x"),o=b.data("normal-alt"),p=b.data("normal-img"),q=b.data("normal-dim").split("x"),r=b.data("aggressive-alt"),s=b.data("aggressive-img"),t=b.data("aggressive-dim").split("x"),u=b.data("ultra-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),v=b.data("ultra-alt"),w=b.data("ultra-img"),x=b.data("ultra-dim").split("x"),y='<span class="twentytwenty-duo-buttons twentytwenty-duo-left">',y+='<button type="button" class="imagify-comparison-original selected" data-img="original">'+g+"</button>",y+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",y+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",y+="</span>",z='<span class="twentytwenty-duo-buttons twentytwenty-duo-right">',z+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",z+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",z+='<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">'+j+"</button>",z+="</span>",b.before('<img class="loader" src="'+f+'" alt="Loading…" width="64" height="64">'),a(".twentytwenty-left-buttons").append(y),a(".twentytwenty-right-buttons").append(z),A='<img class="img-original" alt="'+l+'" width="'+n[0]+'" height="'+n[1]+'">',A+='<img class="img-normal" alt="'+o+'" width="'+q[0]+'" height="'+q[1]+'">',A+='<img class="img-aggressive" alt="'+r+'" width="'+t[0]+'" height="'+t[1]+'">',A+='<img class="img-ultra" alt="'+v+'" width="'+x[0]+'" height="'+x[1]+'">',A+=a(".twentytwenty-left-buttons").lenght?y+z:"",b.closest(".imagify-modal-content").addClass("loading").find(".twentytwenty-container").append(A),a(".img-original").on("load",function(){d++}).attr("src",m),a(".img-normal").on("load",function(){d++}).attr("src",p),a(".img-aggressive").on("load",function(){d++}).attr("src",s),a(".img-ultra").on("load",function(){d++}).attr("src",w),B=setInterval(function(){4===d&&(b.twentytwenty({handlePosition:.6,orientation:"horizontal",labelBefore:k,labelAfter:u},function(){b.closest(".imagify-modal-content").hasClass("loaded")||(b.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(a(".imagify-level-ultra").find(".imagify-chart").find("canvas")))}),clearInterval(B),B=null)},75),a(".imagify-comparison-title").on("click",".twentytwenty-duo-buttons button:not(.selected)",function(b){var c,d=a(this),f=d.closest(".imagify-comparison-title").nextAll(".twentytwenty-wrapper").find(".twentytwenty-container"),g=d.closest(".twentytwenty-duo-buttons").hasClass("twentytwenty-duo-left")?"left":"right",h="left"===g?d.closest(".imagify-comparison-title").find(".twentytwenty-duo-right"):d.closest(".imagify-comparison-title").find(".twentytwenty-duo-left"),i=d.closest(".twentytwenty-duo-buttons").find("button"),j=f.find(".twentytwenty-before"),k=f.find(".twentytwenty-after"),l=d.data("img");b.stopPropagation(),b.preventDefault(),i.removeClass("selected"),d.addClass("selected"),h.find(".selected").data("img")===l&&h.find("button:not(.selected)").eq(0).trigger("click"),"left"===g&&(c=j.css("clip"),j.attr("style",""),j.removeClass("twentytwenty-before"),f.find(".img-"+l).addClass("twentytwenty-before").css("clip",c),a(".twentytwenty-before-label").find(".twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-left").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-left")),"right"===g&&(k.removeClass("twentytwenty-after"),f.find(".img-"+l).addClass("twentytwenty-after"),a(".twentytwenty-after-label").find(".twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-right").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-right")),e(a(".imagify-level-"+l).find(".imagify-chart").find("canvas"))})))}),a(".post-php").find(".wp_attachment_image").find(".thumbnail").length>0){var h,i,j=a(".post-php").find(".wp_attachment_image"),k=j.find(".thumbnail"),l={src:k.prop("src"),width:k.width(),height:k.height()},m={src:a("#imagify-full-original").val(),size:a("#imagify-full-original-size").val()},n=a("#misc-publishing-actions").find(".misc-pub-imagify").find(".button-primary");l.width>360&&a("#imagify-full-original").length>0&&""!==a("#imagify-full-original").val()?(h=a(".misc-pub-filesize").find("strong").text(),i=a(".imagify-data-item").find(".imagify-chart-value").text(),a('[id^="imgedit-open-btn-"]').before('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-visual-comparison" id="imagify-start-comparison">'+imagifyTTT.labels.compare+"</button>"),g({width:l.width,height:l.height,originalUrl:m.src,optimizedUrl:l.src,originalSize:m.size,optimizedSize:h,saving:i,modalAppendTo:j,trigger:a("#imagify-start-comparison"),modalId:"imagify-visual-comparison"})):l.width<360&&a("#imagify-full-original").length>0&&""!==a("#imagify-full-original").val()||a("#imagify-full-original").length>0&&""===a("#imagify-full-original").val()||1===a("#misc-publishing-actions").find(".misc-pub-imagify").find(".button-primary").length&&(a('[id^="imgedit-open-btn-"]').before('<span class="spinner imagify-hidden"></span><a class="imagify-button-primary button-primary imagify-optimize-trigger" id="imagify-optimize-trigger" href="'+n.attr("href")+'">'+imagifyTTT.labels.optimize+"</a>"),a("#imagify-optimize-trigger").on("click",function(){a(this).prev(".spinner").removeClass("imagify-hidden").addClass("is-active")}))}if(a(".upload-php").find(".imagify-compare-images").length>0&&a(".imagify-compare-images").each(function(){var b=a(this),c=b.data("id"),d=b.closest("#post-"+c).find(".column-imagify_optimized_file");g({width:b.data("full-width"),height:b.data("full-height"),originalUrl:b.data("backup-src"),optimizedUrl:b.data("full-src"),originalSize:d.find(".original").text(),optimizedSize:d.find(".imagify-data-item").find(".big").text(),saving:d.find(".imagify-chart-value").text(),modalAppendTo:b.closest(".column-primary"),trigger:b,modalId:"imagify-comparison-"+c})}),a(".upload-php").length>0)var o=function(a){var b={};return c.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,c,d){b[c]=void 0!==d?d:""}),a?b[a]?b[a]:null:b},p=function(){var b=setInterval(function(){var c;a(".media-modal").find(".imagify-datas-details").length&&(a("#imagify-original-src").length>0&&""!==a("#imagify-original-src")&&(a(".media-frame-content").find(".attachment-actions").prepend('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-comparison-modal" id="imagify-media-frame-comparison-btn">'+imagifyTTT.labels.compare+"</button>"),c=a(".media-frame-content").find(".compat-field-imagify"),g({width:a("#imagify-full-width").val(),height:a("#imagify-full-height").val(),originalUrl:a("#imagify-original-src").val(),optimizedUrl:a("#imagify-full-src").val(),originalSize:a("#imagify-original-size").val(),optimizedSize:c.find(".imagify-data-item").find(".big").text(),saving:c.find(".imagify-chart-value").text(),modalAppendTo:a(".media-frame-content").find(".thumbnail-image"),trigger:a("#imagify-media-frame-comparison-btn"),modalId:"imagify-comparison-modal",openModal:!0})),clearInterval(b),b=null)},20)},q=setInterval(function(){a(".upload-php").find(".media-frame.mode-grid").find(".attachments").length&&(a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){p()}),o("item")&&p(),clearInterval(q),q=null)},100)}(jQuery,document,window);
assets/js/options.js CHANGED
@@ -1,20 +1,18 @@
1
- /* globals ajaxurl: false, console: false, imagify: true, imagifyAdmin: true, imagifyOptions: true, swal: false */
2
-
3
  window.imagify = window.imagify || {
4
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
  log: function( content ) {
6
  if ( undefined !== console ) {
7
- console.log( content );
8
  }
9
  },
10
  info: function( content ) {
11
  if ( undefined !== console ) {
12
- console.info( content );
13
  }
14
  }
15
  };
16
 
17
- (function($, d, w, undefined) {
18
  /*
19
  * Process an API key check validity.
20
  */
@@ -44,24 +42,24 @@ window.imagify = window.imagify || {
44
  busy = true;
45
 
46
  xhr = $.get( ajaxurl + imagify.concat + 'action=imagify_check_api_key_validity&api_key=' + obj.val() + '&imagifycheckapikeynonce=' + $( '#imagifycheckapikeynonce' ).val() )
47
- .done( function( response ) {
48
- if ( ! response.success ) {
49
- $( '#imagify-check-api-container' ).html( '<span class="dashicons dashicons-no"></span> ' + response.data );
50
- } else {
51
- $( '#imagify-check-api-container' ).remove();
52
- swal( {
53
- title: imagifyAdmin.labels.ApiKeyCheckSuccessTitle,
54
- html: imagifyAdmin.labels.ApiKeyCheckSuccessText,
55
- type: 'success',
56
- customClass: 'imagify-sweet-alert'
57
- } ).then(
58
- function() {
59
- location.reload();
60
- } );
61
- }
62
 
63
- busy = false;
64
- } );
65
  } );
66
 
67
  /**
@@ -78,7 +76,7 @@ window.imagify = window.imagify || {
78
  $( '.imagify-settings th span' ).on( 'click', function() {
79
  var $input = $( this ).parent().next( 'td' ).find( 'input:checkbox' );
80
 
81
- if ( $input.length === 1 ) {
82
  $input.trigger( 'click' );
83
  }
84
  } );
@@ -121,6 +119,7 @@ window.imagify = window.imagify || {
121
  return;
122
  }
123
 
 
124
  swal( {
125
  title: imagifyOptions.noBackupTitle,
126
  html: imagifyOptions.noBackupText,
@@ -145,7 +144,7 @@ window.imagify = window.imagify || {
145
 
146
 
147
  // "Select all" checkboxes =========================================================================
148
- (function( w, d, $, undefined ) {
149
 
150
  var jqPropHookChecked = $.propHooks.checked;
151
 
@@ -173,8 +172,7 @@ window.imagify = window.imagify || {
173
 
174
  // Toggle "check all" checkboxes.
175
  $group.find( '.imagify-toggle-check' ).prop( 'checked', allChecked );
176
- } )
177
- .first().trigger( 'change.imagify' );
178
 
179
  $( '.imagify-check-group .imagify-toggle-check' ).on( 'click.wp-toggle-checkboxes', function( e ) {
180
  var $this = $( this ),
 
 
1
  window.imagify = window.imagify || {
2
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
3
  log: function( content ) {
4
  if ( undefined !== console ) {
5
+ console.log( content ); // eslint-disable-line no-console
6
  }
7
  },
8
  info: function( content ) {
9
  if ( undefined !== console ) {
10
+ console.info( content ); // eslint-disable-line no-console
11
  }
12
  }
13
  };
14
 
15
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
16
  /*
17
  * Process an API key check validity.
18
  */
42
  busy = true;
43
 
44
  xhr = $.get( ajaxurl + imagify.concat + 'action=imagify_check_api_key_validity&api_key=' + obj.val() + '&imagifycheckapikeynonce=' + $( '#imagifycheckapikeynonce' ).val() )
45
+ .done( function( response ) {
46
+ if ( ! response.success ) {
47
+ $( '#imagify-check-api-container' ).html( '<span class="dashicons dashicons-no"></span> ' + response.data );
48
+ } else {
49
+ // Success, the API key is valid.
50
+ $( '#imagify-check-api-container' ).remove();
51
+ swal( {
52
+ title: imagifyAdmin.labels.ApiKeyCheckSuccessTitle,
53
+ html: imagifyAdmin.labels.ApiKeyCheckSuccessText,
54
+ type: 'success',
55
+ customClass: 'imagify-sweet-alert'
56
+ } ).then( function() {
57
+ location.reload();
58
+ } );
59
+ }
60
 
61
+ busy = false;
62
+ } );
63
  } );
64
 
65
  /**
76
  $( '.imagify-settings th span' ).on( 'click', function() {
77
  var $input = $( this ).parent().next( 'td' ).find( 'input:checkbox' );
78
 
79
+ if ( 1 === $input.length ) {
80
  $input.trigger( 'click' );
81
  }
82
  } );
119
  return;
120
  }
121
 
122
+ // Are you sure? No backup?
123
  swal( {
124
  title: imagifyOptions.noBackupTitle,
125
  html: imagifyOptions.noBackupText,
144
 
145
 
146
  // "Select all" checkboxes =========================================================================
147
+ (function(w, d, $, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
148
 
149
  var jqPropHookChecked = $.propHooks.checked;
150
 
172
 
173
  // Toggle "check all" checkboxes.
174
  $group.find( '.imagify-toggle-check' ).prop( 'checked', allChecked );
175
+ } ).first().trigger( 'change.imagify' );
 
176
 
177
  $( '.imagify-check-group .imagify-toggle-check' ).on( 'click.wp-toggle-checkboxes', function( e ) {
178
  var $this = $( this ),
assets/js/sweetalert2.js CHANGED
@@ -1,1343 +1,1641 @@
1
  /*!
2
- * sweetalert2 v4.0.15
3
  * Released under the MIT License.
4
  */
5
  (function (global, factory) {
6
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
7
- typeof define === 'function' && define.amd ? define(factory) :
8
- (global.Sweetalert2 = factory());
9
- }(this, function () { 'use strict';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- var swalPrefix = 'swal2-';
12
 
13
- var prefix = function(items) {
14
- var result = {};
15
- for (var i in items) {
16
- result[items[i]] = swalPrefix + items[i];
17
- }
18
- return result;
19
- };
20
 
21
- var swalClasses = prefix([
22
- 'container',
23
- 'modal',
24
- 'overlay',
25
- 'close',
26
- 'content',
27
- 'spacer',
28
- 'confirm',
29
- 'cancel',
30
- 'icon',
31
- 'image',
32
- 'input',
33
- 'select',
34
- 'radio',
35
- 'checkbox',
36
- 'textarea',
37
- 'validationerror'
38
- ]);
39
-
40
- var iconTypes = prefix([
41
- 'success',
42
- 'warning',
43
- 'info',
44
- 'question',
45
- 'error'
46
- ]);
47
-
48
- var defaultParams = {
49
- title: '',
50
- text: '',
51
- html: '',
52
- type: null,
53
- animation: true,
54
- allowOutsideClick: true,
55
- allowEscapeKey: true,
56
- showConfirmButton: true,
57
- showCancelButton: false,
58
- preConfirm: null,
59
- confirmButtonText: 'OK',
60
- confirmButtonColor: '#3085d6',
61
- confirmButtonClass: null,
62
- cancelButtonText: 'Cancel',
63
- cancelButtonColor: '#aaa',
64
- cancelButtonClass: null,
65
- buttonsStyling: true,
66
- reverseButtons: false,
67
- showCloseButton: false,
68
- showLoaderOnConfirm: false,
69
- imageUrl: null,
70
- imageWidth: null,
71
- imageHeight: null,
72
- imageClass: null,
73
- timer: null,
74
- width: 500,
75
- padding: 20,
76
- background: '#fff',
77
- input: null, // 'text' | 'email' | 'password' | 'select' | 'radio' | 'checkbox' | 'textarea' | 'file'
78
- inputPlaceholder: '',
79
- inputValue: '',
80
- inputOptions: {},
81
- inputAutoTrim: true,
82
- inputClass: null,
83
- inputAttributes: {},
84
- inputValidator: null,
85
- onOpen: null,
86
- onClose: null,
87
- };
88
 
89
- var sweetHTML = '<div class="' + swalClasses.overlay + '" tabIndex="-1"></div>' +
90
- '<div class="' + swalClasses.modal + '" style="display: none" tabIndex="-1">' +
91
- '<div class="' + swalClasses.icon + ' ' + iconTypes.error + '">' +
92
- '<span class="x-mark"><span class="line left"></span><span class="line right"></span></span>' +
93
- '</div>' +
94
- '<div class="' + swalClasses.icon + ' ' + iconTypes.question + '">?</div>' +
95
- '<div class="' + swalClasses.icon + ' ' + iconTypes.warning + '">!</div>' +
96
- '<div class="' + swalClasses.icon + ' ' + iconTypes.info + '">i</div>' +
97
- '<div class="' + swalClasses.icon + ' ' + iconTypes.success + '">' +
98
- '<span class="line tip"></span> <span class="line long"></span>' +
99
- '<div class="placeholder"></div> <div class="fix"></div>' +
100
- '</div>' +
101
- '<img class="' + swalClasses.image + '">' +
102
- '<h2></h2>' +
103
- '<div class="' + swalClasses.content + '"></div>' +
104
- '<input class="' + swalClasses.input + '">' +
105
- '<select class="' + swalClasses.select + '"></select>' +
106
- '<div class="' + swalClasses.radio + '"></div>' +
107
- '<label for="' + swalClasses.checkbox + '" class="' + swalClasses.checkbox + '">' +
108
- '<input type="checkbox" id="' + swalClasses.checkbox + '">' +
109
- '</label>' +
110
- '<textarea class="' + swalClasses.textarea + '"></textarea>' +
111
- '<div class="' + swalClasses.validationerror + '"></div>' +
112
- '<hr class="' + swalClasses.spacer + '">' +
113
- '<button class="' + swalClasses.confirm + '">OK</button>' +
114
- '<button class="' + swalClasses.cancel + '">Cancel</button>' +
115
- '<span class="' + swalClasses.close + '">&times;</span>' +
116
- '</div>';
117
-
118
- var extend = function(a, b) {
119
- for (var key in b) {
120
- if (b.hasOwnProperty(key)) {
121
- a[key] = b[key];
122
- }
123
  }
 
 
 
124
 
125
- return a;
126
- };
127
 
 
 
 
 
 
128
 
129
  /*
130
- * Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color)
131
  */
132
- var colorLuminance = function(hex, lum) {
133
- // Validate hex string
134
- hex = String(hex).replace(/[^0-9a-f]/gi, '');
135
- if (hex.length < 6) {
136
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
137
- }
138
- lum = lum || 0;
139
-
140
- // Convert to decimal and change luminosity
141
- var rgb = '#';
142
- for (var i = 0; i < 3; i++) {
143
- var c = parseInt(hex.substr(i * 2, 2), 16);
144
- c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
145
- rgb += ('00' + c).substr(c.length);
146
- }
147
 
148
- return rgb;
149
- };
 
150
 
151
- var mediaqueryId = swalPrefix + 'mediaquery';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
- // Remember state in cases where opening and handling a modal will fiddle with it.
154
- var states = {
155
- previousWindowKeyDown: null,
156
- previousActiveElement: null
 
 
 
157
  };
158
 
159
- /*
160
- * Manipulate DOM
161
- */
162
- var elementByClass = function(className) {
163
- return document.querySelector('.' + className);
164
  };
165
 
166
- var getModal = function() {
167
- return elementByClass(swalClasses.modal);
 
168
  };
169
 
170
- var getOverlay = function() {
171
- return elementByClass(swalClasses.overlay);
 
172
  };
173
 
174
- var getConfirmButton = function() {
175
- return elementByClass(swalClasses.confirm);
176
  };
177
 
178
- var getCancelButton = function() {
179
- return elementByClass(swalClasses.cancel);
180
  };
181
 
182
- var getCloseButton = function() {
183
- return elementByClass(swalClasses.close);
184
  };
185
 
186
- var hasClass = function(elem, className) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  return elem.classList.contains(className);
188
- };
 
 
189
 
190
- var focusInput = function(input) {
191
- input.focus();
192
 
 
 
193
  // http://stackoverflow.com/a/2345915/1331425
194
  var val = input.value;
195
  input.value = '';
196
  input.value = val;
197
- };
 
198
 
199
- var addClass = function(elem, className) {
200
- if (!elem || !className) {
201
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
- var classes = className.split(/\s+/);
204
- classes.forEach(function (className) {
205
- elem.classList.add(className)
206
- });
207
- };
208
 
209
- var removeClass = function(elem, className) {
210
- if (!elem || !className) {
211
- return;
212
- }
213
- var classes = className.split(/\s+/);
214
- classes.forEach(function (className) {
215
- elem.classList.remove(className);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  };
 
 
 
 
 
218
 
219
- var getChildByClass = function(elem, className) {
220
- for (var i = 0; i < elem.childNodes.length; i++) {
221
- if (hasClass(elem.childNodes[i], className)) {
222
- return elem.childNodes[i];
223
- }
 
 
 
 
 
 
 
 
224
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  };
 
 
 
 
 
 
 
226
 
227
- var _show = function(elem) {
228
- elem.style.opacity = '';
229
- elem.style.display = 'block';
230
- };
231
 
232
- var show = function(elems) {
233
- if (elems && !elems.length) {
234
- return _show(elems);
235
- }
236
- for (var i = 0; i < elems.length; ++i) {
237
- _show(elems[i]);
238
- }
239
- };
240
 
241
- var _hide = function(elem) {
242
- elem.style.opacity = '';
243
- elem.style.display = 'none';
244
- };
245
 
246
- var hide = function(elems) {
247
- if (elems && !elems.length) {
248
- return _hide(elems);
249
- }
250
- for (var i = 0; i < elems.length; ++i) {
251
- _hide(elems[i]);
252
- }
253
- };
254
 
255
- var removeStyleProperty = function(elem, property) {
256
- if (elem.style.removeProperty) {
257
- elem.style.removeProperty(property);
258
- } else {
259
- elem.style.removeAttribute(property);
260
- }
261
- };
262
 
263
- var getTopMargin = function(elem) {
264
- var elemDisplay = elem.style.display;
265
- elem.style.left = '-9999px';
266
- elem.style.display = 'block';
267
 
268
- var height = elem.clientHeight;
269
 
270
- elem.style.left = '';
271
- elem.style.display = elemDisplay;
272
- return ('-' + parseInt(height / 2, 10) + 'px');
273
- };
274
 
275
- var fadeIn = function(elem, interval) {
276
- if (+elem.style.opacity < 1) {
277
- interval = interval || 16;
278
- elem.style.opacity = 0;
279
- elem.style.display = 'block';
280
- var last = +new Date();
281
- var tick = function() {
282
- var newOpacity = +elem.style.opacity + (new Date() - last) / 100;
283
- elem.style.opacity = (newOpacity > 1) ? 1 : newOpacity;
284
- last = +new Date();
285
-
286
- if (+elem.style.opacity < 1) {
287
- setTimeout(tick, interval);
288
- }
289
- };
290
- tick();
291
- }
292
- };
293
 
294
- var fadeOut = function(elem, interval) {
295
- if (+elem.style.opacity > 0) {
296
- interval = interval || 16;
297
- var opacity = elem.style.opacity;
298
- var last = +new Date();
299
- var tick = function() {
300
- var change = new Date() - last;
301
- var newOpacity = +elem.style.opacity - change / (opacity * 100);
302
- elem.style.opacity = newOpacity;
303
- last = +new Date();
304
-
305
- if (+elem.style.opacity > 0) {
306
- setTimeout(tick, interval);
307
- } else {
308
- _hide(elem);
309
- }
310
- };
311
- tick();
312
- }
313
- };
314
 
315
- var fireClick = function(node) {
316
- // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
317
- // Then fixed for today's Chrome browser.
318
- if (typeof MouseEvent === 'function') {
319
- // Up-to-date approach
320
- var mevt = new MouseEvent('click', {
321
- view: window,
322
- bubbles: false,
323
- cancelable: true
324
- });
325
- node.dispatchEvent(mevt);
326
- } else if (document.createEvent) {
327
- // Fallback
328
- var evt = document.createEvent('MouseEvents');
329
- evt.initEvent('click', false, false);
330
- node.dispatchEvent(evt);
331
- } else if (document.createEventObject) {
332
- node.fireEvent('onclick');
333
- } else if (typeof node.onclick === 'function') {
334
- node.onclick();
335
- }
336
- };
337
 
338
- var stopEventPropagation = function(e) {
339
- // In particular, make sure the space bar doesn't scroll the main window.
340
- if (typeof e.stopPropagation === 'function') {
341
- e.stopPropagation();
342
- e.preventDefault();
343
- } else if (window.event && window.event.hasOwnProperty('cancelBubble')) {
344
- window.event.cancelBubble = true;
345
- }
346
- };
347
 
348
- var animationEndEvent = (function() {
349
- var testEl = document.createElement('div'),
350
- transEndEventNames = {
351
- 'WebkitAnimation': 'webkitAnimationEnd',
352
- 'MozAnimation': 'animationend',
353
- 'OAnimation': 'oAnimationEnd oanimationend',
354
- 'msAnimation': 'MSAnimationEnd',
355
- 'animation': 'animationend'
356
- };
357
- for (var i in transEndEventNames) {
358
- if (transEndEventNames.hasOwnProperty(i) &&
359
- testEl.style[i] !== undefined) {
360
- return transEndEventNames[i];
 
 
361
  }
362
  }
 
363
 
364
- return false;
365
- })();
366
 
 
 
 
367
 
368
- // Reset the page to its previous state
369
- var resetPrevState = function() {
370
- var modal = getModal();
371
- window.onkeydown = states.previousWindowKeyDown;
372
- if (states.previousActiveElement) {
373
- states.previousActiveElement.focus();
374
- }
375
- clearTimeout(modal.timeout);
376
 
377
- // Remove dynamically created media query
378
- var head = document.getElementsByTagName('head')[0];
379
- var mediaquery = document.getElementById(mediaqueryId);
380
- if (mediaquery) {
381
- head.removeChild(mediaquery);
382
  }
383
- };
384
 
385
- var modalParams = extend({}, defaultParams);
 
386
 
387
- /*
388
- * Set type, text and actions on modal
389
- */
390
- var setParameters = function(params) {
391
- var modal = getModal();
 
392
 
393
- for (var param in params) {
394
- if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
395
- console.warn('SweetAlert2: Unknown parameter "' + param + '"');
396
- }
397
- }
 
 
 
 
 
 
 
 
398
 
399
- // set modal width, padding and margin-left
400
- modal.style.width = params.width + 'px';
401
- modal.style.padding = params.padding + 'px';
402
- modal.style.marginLeft = -params.width / 2 + 'px';
403
- modal.style.background = params.background;
404
-
405
- // add dynamic media query css
406
- var head = document.getElementsByTagName('head')[0];
407
- var cssNode = document.createElement('style');
408
- cssNode.type = 'text/css';
409
- cssNode.id = mediaqueryId;
410
- var margin = 5; // %
411
- var mediaQueryMaxWidth = params.width + parseInt(params.width * (margin/100) * 2, 10);
412
- cssNode.innerHTML =
413
- '@media screen and (max-width: ' + mediaQueryMaxWidth + 'px) {' +
414
- '.' + swalClasses.modal + ' {' +
415
- 'width: auto !important;' +
416
- 'left: ' + margin + '% !important;' +
417
- 'right: ' + margin + '% !important;' +
418
- 'margin-left: 0 !important;' +
419
- '}' +
420
- '}';
421
- head.appendChild(cssNode);
422
-
423
- var $title = modal.querySelector('h2');
424
- var $content = modal.querySelector('.' + swalClasses.content);
425
- var $confirmBtn = getConfirmButton();
426
- var $cancelBtn = getCancelButton();
427
- var $spacer = modal.querySelector('.' + swalClasses.spacer);
428
- var $closeButton = modal.querySelector('.' + swalClasses.close);
429
-
430
- // Title
431
- $title.innerHTML = params.title.split('\n').join('<br>');
432
-
433
- // Content
434
- if (params.text || params.html) {
435
- if (typeof params.html === 'object') {
436
- $content.innerHTML = '';
437
- if (0 in params.html) {
438
- for (var i = 0; i in params.html; i++) {
439
- $content.appendChild(params.html[i]);
440
- }
441
- } else {
442
- $content.appendChild(params.html);
443
  }
444
  } else {
445
- $content.innerHTML = params.html || (params.text.split('\n').join('<br>'));
446
  }
447
- show($content);
448
- } else {
449
- hide($content);
 
450
  }
 
 
 
 
451
 
452
- // Close button
453
- if (params.showCloseButton) {
454
- show($closeButton);
455
- } else {
456
- hide($closeButton);
457
- }
458
 
459
- // Custom Class
460
- modal.className = swalClasses.modal;
461
- if (params.customClass) {
462
- addClass(modal, params.customClass);
463
- }
464
 
465
- // Icon
466
- hide(modal.querySelectorAll('.' + swalClasses.icon));
467
- if (params.type) {
468
- var validType = false;
469
- for (var iconType in iconTypes) {
470
- if (params.type === iconType) {
471
- validType = true;
472
- break;
473
- }
 
 
 
 
 
 
474
  }
475
- if (!validType) {
476
- console.error('SweetAlert2: Unknown alert type: ' + params.type);
477
- return false;
 
 
 
478
  }
479
- var $icon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes[params.type]);
480
- show($icon);
 
 
481
 
482
- // Animate icon
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  switch (params.type) {
484
  case 'success':
485
- addClass($icon, 'animate');
486
- addClass($icon.querySelector('.tip'), 'animate-success-tip');
487
- addClass($icon.querySelector('.long'), 'animate-success-long');
488
  break;
489
  case 'error':
490
- addClass($icon, 'animate-error-icon');
491
- addClass($icon.querySelector('.x-mark'), 'animate-x-mark');
492
- break;
493
- case 'warning':
494
- addClass($icon, 'pulse-warning');
495
  break;
496
  default:
497
  break;
498
  }
499
-
500
  }
 
501
 
502
- // Custom image
503
- var $customImage = modal.querySelector('.' + swalClasses.image);
504
- if (params.imageUrl) {
505
- $customImage.setAttribute('src', params.imageUrl);
506
- show($customImage);
507
-
508
- if (params.imageWidth) {
509
- $customImage.setAttribute('width', params.imageWidth);
510
- } else {
511
- $customImage.removeAttribute('width');
512
- }
513
-
514
- if (params.imageHeight) {
515
- $customImage.setAttribute('height', params.imageHeight);
516
- } else {
517
- $customImage.removeAttribute('height');
518
- }
519
 
520
- if (params.imageClass) {
521
- addClass($customImage, params.imageClass);
522
- }
523
  } else {
524
- hide($customImage);
525
  }
526
 
527
- // Cancel button
528
- if (params.showCancelButton) {
529
- $cancelBtn.style.display = 'inline-block';
530
  } else {
531
- hide($cancelBtn);
532
  }
533
 
534
- // Confirm button
535
- if (params.showConfirmButton) {
536
- removeStyleProperty($confirmBtn, 'display');
537
- } else {
538
- hide($confirmBtn);
539
  }
 
 
 
540
 
541
- // Buttons spacer
542
- if (!params.showConfirmButton && !params.showCancelButton) {
543
- hide($spacer);
544
- } else {
545
- show($spacer);
546
- }
547
 
548
- // Edit text on cancel and confirm buttons
549
- $confirmBtn.innerHTML = params.confirmButtonText;
550
- $cancelBtn.innerHTML = params.cancelButtonText;
 
 
 
551
 
552
- // Set buttons to selected background colors
553
- if (params.buttonsStyling) {
554
- $confirmBtn.style.backgroundColor = params.confirmButtonColor;
555
- $cancelBtn.style.backgroundColor = params.cancelButtonColor;
556
- }
 
557
 
558
- // Add buttons custom classes
559
- $confirmBtn.className = swalClasses.confirm;
560
- addClass($confirmBtn, params.confirmButtonClass);
561
- $cancelBtn.className = swalClasses.cancel;
562
- addClass($cancelBtn, params.cancelButtonClass);
563
 
564
- // Buttons styling
565
- if (params.buttonsStyling) {
566
- addClass($confirmBtn, 'styled');
567
- addClass($cancelBtn, 'styled');
568
- } else {
569
- removeClass($confirmBtn, 'styled');
570
- removeClass($cancelBtn, 'styled');
571
 
572
- $confirmBtn.style.backgroundColor = $confirmBtn.style.borderLeftColor = $confirmBtn.style.borderRightColor = '';
573
- $cancelBtn.style.backgroundColor = $cancelBtn.style.borderLeftColor = $cancelBtn.style.borderRightColor = '';
574
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
 
576
- // CSS animation
577
- if (params.animation === true) {
578
- removeClass(modal, 'no-animation');
579
- } else {
580
- addClass(modal, 'no-animation');
581
- }
582
- };
583
 
584
- /*
585
- * Animations
586
- */
587
- var openModal = function(animation, onComplete) {
588
- var modal = getModal();
589
- if (animation) {
590
- fadeIn(getOverlay(), 10);
591
- addClass(modal, 'show-swal2');
592
- removeClass(modal, 'hide-swal2');
593
- } else {
594
- show(getOverlay());
595
- }
596
- show(modal);
597
- states.previousActiveElement = document.activeElement;
598
- addClass(modal, 'visible');
599
- if (onComplete !== null && typeof onComplete === 'function') {
600
- onComplete.call(this, modal);
601
- }
602
- };
 
 
 
 
 
 
 
603
 
604
- /*
605
- * Set 'margin-top'-property on modal based on its computed height
606
- */
607
- var fixVerticalPosition = function() {
608
- var modal = getModal();
 
 
 
 
 
 
 
609
 
610
- modal.style.marginTop = getTopMargin(modal);
611
- };
 
 
 
 
 
 
 
 
 
 
612
 
613
- function modalDependant() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
 
615
- if (arguments[0] === undefined) {
616
- console.error('SweetAlert2 expects at least 1 attribute!');
617
- return false;
618
- }
 
619
 
620
- var params = extend({}, modalParams);
 
 
 
621
 
622
- switch (typeof arguments[0]) {
623
 
624
- case 'string':
625
- params.title = arguments[0];
626
- params.text = arguments[1] || '';
627
- params.type = arguments[2] || '';
 
628
 
629
- break;
630
 
631
- case 'object':
632
- extend(params, arguments[0]);
633
- params.extraParams = arguments[0].extraParams;
634
 
635
- if (params.input === 'email' && params.inputValidator === null) {
636
- params.inputValidator = function(email) {
637
- return new Promise(function(resolve, reject) {
638
- var emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
639
- if (emailRegex.test(email)) {
640
- resolve();
641
- } else {
642
- reject('Invalid email address');
643
- }
644
- });
645
- };
646
- }
647
 
648
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
649
 
650
- default:
651
- console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got ' + typeof arguments[0]);
652
- return false;
653
- }
654
 
655
- setParameters(params);
656
 
657
- // Modal interactions
658
- var modal = getModal();
659
 
660
- return new Promise(function(resolve, reject) {
661
- // Close on timer
662
- if (params.timer) {
663
- modal.timeout = setTimeout(function() {
664
- sweetAlert.closeModal(params.onClose);
 
665
  reject('timer');
666
- }, params.timer);
 
 
 
 
 
 
 
 
 
 
667
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
 
669
- var getInput = function() {
670
- switch (params.input) {
671
- case 'select':
672
- return getChildByClass(modal, swalClasses.select);
673
- case 'radio':
674
- return modal.querySelector('.' + swalClasses.radio + ' input:checked') ||
675
- modal.querySelector('.' + swalClasses.radio + ' input:first-child');
676
- case 'checkbox':
677
- return modal.querySelector('#' + swalClasses.checkbox);
678
- case 'textarea':
679
- return getChildByClass(modal, swalClasses.textarea);
680
- default:
681
- return getChildByClass(modal, swalClasses.input);
682
- }
683
- };
684
- var getInputValue = function() {
 
 
 
 
 
685
  var input = getInput();
686
- switch (params.input) {
687
- case 'checkbox':
688
- return input.checked ? 1 : 0;
689
- case 'radio':
690
- return input.checked ? input.value : null;
691
- case 'file':
692
- return input.files.length ? input.files[0] : null;
693
- default:
694
- return params.inputAutoTrim? input.value.trim() : input.value;
695
  }
696
- };
 
697
 
698
- if (params.input) {
699
- setTimeout(function() {
700
- var input = getInput();
701
- if (input) {
702
- focusInput(input);
703
- }
704
- }, 0);
705
  }
706
 
707
- var confirm = function(value) {
708
- if (params.showLoaderOnConfirm) {
709
- sweetAlert.showLoading();
710
- }
711
-
712
- if (params.preConfirm) {
713
- params.preConfirm(value, params.extraParams).then(
714
- function(preConfirmValue) {
715
- sweetAlert.closeModal(params.onClose);
716
- resolve(preConfirmValue || value);
717
- },
718
- function(error) {
719
- sweetAlert.hideLoading();
720
- if (error) {
721
- sweetAlert.showValidationError(error);
722
- }
723
- }
724
- );
725
- } else {
726
  sweetAlert.closeModal(params.onClose);
 
 
 
 
 
 
 
 
 
 
727
  resolve(value);
 
 
728
  }
729
- };
730
-
731
- // Mouse interactions
732
- var onButtonEvent = function(event) {
733
- var e = event || window.event;
734
- var target = e.target || e.srcElement;
735
- var confirmBtn = getConfirmButton();
736
- var cancelBtn = getCancelButton();
737
- var targetedConfirm = confirmBtn === target || confirmBtn.contains(target);
738
- var targetedCancel = cancelBtn === target || cancelBtn.contains(target);
739
- var modalIsVisible = hasClass(modal, 'visible');
740
-
741
- switch (e.type) {
742
- case 'mouseover':
743
- case 'mouseup':
744
- if (params.buttonsStyling) {
745
- if (targetedConfirm) {
746
- confirmBtn.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.1);
747
- } else if (targetedCancel) {
748
- cancelBtn.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.1);
749
- }
750
  }
751
- break;
752
- case 'mouseout':
753
- if (params.buttonsStyling) {
754
- if (targetedConfirm) {
755
- confirmBtn.style.backgroundColor = params.confirmButtonColor;
756
- } else if (targetedCancel) {
757
- cancelBtn.style.backgroundColor = params.cancelButtonColor;
758
- }
759
  }
760
- break;
761
- case 'mousedown':
762
- if (params.buttonsStyling) {
763
- if (targetedConfirm) {
764
- confirmBtn.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.2);
765
- } else if (targetedCancel) {
766
- cancelBtn.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.2);
767
- }
768
  }
769
- break;
770
- case 'click':
771
- // Clicked 'confirm'
772
- if (targetedConfirm && modalIsVisible) {
773
- if (params.input) {
774
- var inputValue = getInputValue();
775
-
776
- if (params.inputValidator) {
777
- sweetAlert.disableInput();
778
- params.inputValidator(inputValue, params.extraParams).then(
779
- function() {
780
- sweetAlert.enableInput();
781
- confirm(inputValue);
782
- },
783
- function(error) {
784
- sweetAlert.enableInput();
785
- if (error) {
786
- sweetAlert.showValidationError(error);
787
- }
788
- }
789
- );
790
- } else {
791
  confirm(inputValue);
792
- }
793
-
 
 
 
 
 
794
  } else {
795
- confirm(true);
796
  }
 
 
 
797
 
798
  // Clicked 'cancel'
799
- } else if (targetedCancel && modalIsVisible) {
800
- sweetAlert.closeModal(params.onClose);
 
 
801
  reject('cancel');
 
 
802
  }
803
-
804
- break;
805
- default:
806
- }
807
- };
808
-
809
- var $buttons = modal.querySelectorAll('button');
810
- var i;
811
- for (i = 0; i < $buttons.length; i++) {
812
- $buttons[i].onclick = onButtonEvent;
813
- $buttons[i].onmouseover = onButtonEvent;
814
- $buttons[i].onmouseout = onButtonEvent;
815
- $buttons[i].onmousedown = onButtonEvent;
816
  }
 
817
 
818
- // Closing modal by close button
819
- getCloseButton().onclick = function() {
820
- sweetAlert.closeModal(params.onClose);
 
 
 
 
 
 
 
 
 
821
  reject('close');
822
- };
 
 
 
823
 
824
- // Closing modal by overlay click
825
- getOverlay().onclick = function() {
826
- if (params.allowOutsideClick) {
827
- sweetAlert.closeModal(params.onClose);
 
 
 
 
828
  reject('overlay');
 
 
829
  }
830
- };
 
831
 
832
- var $confirmButton = getConfirmButton();
833
- var $cancelButton = getCancelButton();
834
- var $modalElements = [$confirmButton, $cancelButton].concat(Array.prototype.slice.call(
835
- modal.querySelectorAll('button:not([class^=' + swalPrefix + ']), input:not([type=hidden]), textarea, select')
836
- ));
837
 
838
- // Reverse buttons if neede d
839
- if (params.reverseButtons) {
840
- $confirmButton.parentNode.insertBefore($cancelButton, $confirmButton);
841
- }
 
 
842
 
843
- // Focus handling
844
- function setFocus(index, increment) {
845
- // search for visible elements and select the next possible match
846
- for (var i = 0; i < $modalElements.length; i++) {
847
- index = index + increment;
 
848
 
849
- // rollover to first item
850
- if (index === $modalElements.length) {
851
- index = 0;
852
 
853
  // go to last item
854
- } else if (index === -1) {
855
- index = $modalElements.length - 1;
856
- }
857
 
858
- // determine if element is visible, the following is borrowed from jqeury $(elem).is(':visible') implementation
859
- if (
860
- $modalElements[index].offsetWidth ||
861
- $modalElements[index].offsetHeight ||
862
- $modalElements[index].getClientRects().length
863
- ) {
864
- $modalElements[index].focus();
865
- return;
866
- }
867
  }
868
  }
 
869
 
870
- function handleKeyDown(event) {
871
- var e = event || window.event;
872
- var keyCode = e.keyCode || e.which;
873
 
874
- if ([9, 13, 32, 27].indexOf(keyCode) === -1) {
875
- // Don't do work on keys we don't care about.
876
- return;
877
- }
878
 
879
- var $targetElement = e.target || e.srcElement;
880
 
881
- var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
882
- for (var i = 0; i < $modalElements.length; i++) {
883
- if ($targetElement === $modalElements[i]) {
884
- btnIndex = i;
885
- break;
886
- }
887
  }
 
888
 
889
- // TAB
890
- if (keyCode === 9) {
891
- if (!e.shiftKey) {
892
- // Cycle to the next button
893
- setFocus(btnIndex, 1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894
  } else {
895
- // Cycle to the prev button
896
- setFocus(btnIndex, -1);
897
  }
 
 
 
898
 
899
- stopEventPropagation(e);
900
-
 
 
 
901
  } else {
902
- if (keyCode === 13 || keyCode === 32) {
903
- if (btnIndex === -1) {
904
- // ENTER/SPACE clicked outside of a button.
905
- fireClick($confirmButton, e);
906
- }
907
- } else if (keyCode === 27 && params.allowEscapeKey === true) {
908
- sweetAlert.closeModal(params.onClose);
909
- reject('esc');
910
- }
911
  }
912
  }
 
913
 
 
914
  states.previousWindowKeyDown = window.onkeydown;
915
  window.onkeydown = handleKeyDown;
 
916
 
917
- // Loading state
918
- if (params.buttonsStyling) {
919
- $confirmButton.style.borderLeftColor = params.confirmButtonColor;
920
- $confirmButton.style.borderRightColor = params.confirmButtonColor;
921
- }
922
 
923
- /**
924
- * Show spinner instead of Confirm button and disable Cancel button
925
- */
926
- sweetAlert.showLoading = sweetAlert.enableLoading = function() {
927
- addClass($confirmButton, 'loading');
928
- addClass(modal, 'loading');
929
- $confirmButton.disabled = true;
930
- $cancelButton.disabled = true;
931
- };
932
-
933
- /**
934
- * Show spinner instead of Confirm button and disable Cancel button
935
- */
936
- sweetAlert.hideLoading = sweetAlert.disableLoading = function() {
937
- removeClass($confirmButton, 'loading');
938
- removeClass(modal, 'loading');
939
- $confirmButton.disabled = false;
940
- $cancelButton.disabled = false;
941
- };
942
-
943
- sweetAlert.enableButtons = function() {
944
- $confirmButton.disabled = false;
945
- $cancelButton.disabled = false;
946
- };
947
-
948
- sweetAlert.disableButtons = function() {
949
- $confirmButton.disabled = true;
950
- $cancelButton.disabled = true;
951
- };
952
-
953
- sweetAlert.enableConfirmButton = function() {
954
- $confirmButton.disabled = false;
955
- };
956
-
957
- sweetAlert.disableConfirmButton = function() {
958
- $confirmButton.disabled = true;
959
- };
960
-
961
- sweetAlert.enableInput = function() {
962
- var input = getInput();
963
- if (input.type === 'radio') {
964
- var radiosContainer = input.parentNode.parentNode;
965
- var radios = radiosContainer.querySelectorAll('input');
966
- for (var i = 0; i < radios.length; i++) {
967
- radios[i].disabled = false;
968
- }
969
- } else {
970
- input.disabled = false;
971
  }
972
- };
 
 
 
 
 
973
 
974
- sweetAlert.disableInput = function() {
975
- var input = getInput();
976
- if (input.type === 'radio') {
977
- var radiosContainer = input.parentNode.parentNode;
978
- var radios = radiosContainer.querySelectorAll('input');
979
- for (var i = 0; i < radios.length; i++) {
980
- radios[i].disabled = true;
981
- }
982
- } else {
983
- input.disabled = true;
984
- }
985
- };
 
 
 
 
 
 
 
 
 
986
 
987
- sweetAlert.showValidationError = function(error) {
988
- var $validationError = modal.querySelector('.' + swalClasses.validationerror);
989
- $validationError.innerHTML = error;
990
- show($validationError);
991
 
992
- var input = getInput();
993
- focusInput(input);
994
- addClass(input, 'error');
995
- };
996
 
997
- sweetAlert.resetValidationError = function() {
998
- var $validationError = modal.querySelector('.' + swalClasses.validationerror);
999
- hide($validationError);
1000
 
1001
- var input = getInput();
1002
- if (input) {
1003
- removeClass(input, 'error');
1004
- }
1005
- };
1006
-
1007
- sweetAlert.enableButtons();
1008
- sweetAlert.hideLoading();
1009
- sweetAlert.resetValidationError();
1010
-
1011
- // input, select
1012
- var inputTypes = ['input', 'select', 'radio', 'checkbox', 'textarea'];
1013
- var input;
1014
- for (i = 0; i < inputTypes.length; i++) {
1015
- var inputClass = swalClasses[inputTypes[i]];
1016
- input = getChildByClass(modal, inputClass);
1017
-
1018
- // set attributes
1019
- while (input.attributes.length > 0) {
1020
- input.removeAttribute(input.attributes[0].name);
1021
- }
1022
- for (var attr in params.inputAttributes) {
1023
- input.setAttribute(attr, params.inputAttributes[attr]);
1024
- }
1025
 
1026
- // set class
1027
- input.className = inputClass;
1028
- if (params.inputClass) {
1029
- addClass(input, params.inputClass);
 
 
 
 
 
 
1030
  }
 
 
 
 
1031
 
1032
- _hide(input);
 
 
 
1033
  }
 
 
 
 
 
 
 
 
 
 
1034
 
1035
- var populateInputOptions;
1036
- switch (params.input) {
1037
- case 'text':
1038
- case 'email':
1039
- case 'password':
1040
- case 'file':
1041
- input = getChildByClass(modal, swalClasses.input);
1042
- input.value = params.inputValue;
1043
- input.placeholder = params.inputPlaceholder;
1044
- input.type = params.input;
1045
- _show(input);
1046
- break;
1047
- case 'select':
1048
- var select = getChildByClass(modal, swalClasses.select);
1049
- select.innerHTML = '';
1050
- if (params.inputPlaceholder) {
1051
- var placeholder = document.createElement('option');
1052
- placeholder.innerHTML = params.inputPlaceholder;
1053
- placeholder.value = '';
1054
- placeholder.disabled = true;
1055
- placeholder.selected = true;
1056
- select.appendChild(placeholder);
1057
- }
1058
- populateInputOptions = function(inputOptions) {
1059
- for (var optionValue in inputOptions) {
1060
- var option = document.createElement('option');
1061
- option.value = optionValue;
1062
- option.innerHTML = inputOptions[optionValue];
1063
- if (params.inputValue === optionValue) {
1064
- option.selected = true;
1065
- }
1066
- select.appendChild(option);
1067
- }
1068
- _show(select);
1069
- select.focus();
1070
- };
1071
- break;
1072
- case 'radio':
1073
- var radio = getChildByClass(modal, swalClasses.radio);
1074
- radio.innerHTML = '';
1075
- populateInputOptions = function(inputOptions) {
1076
- for (var radioValue in inputOptions) {
1077
- var id = 1;
1078
- var radioInput = document.createElement('input');
1079
- var radioLabel = document.createElement('label');
1080
- var radioLabelSpan = document.createElement('span');
1081
- radioInput.type = 'radio';
1082
- radioInput.name = swalClasses.radio;
1083
- radioInput.value = radioValue;
1084
- radioInput.id = swalClasses.radio + '-' + (id++);
1085
- if (params.inputValue === radioValue) {
1086
- radioInput.checked = true;
1087
- }
1088
- radioLabelSpan.innerHTML = inputOptions[radioValue];
1089
- radioLabel.appendChild(radioInput);
1090
- radioLabel.appendChild(radioLabelSpan);
1091
- radioLabel.for = radioInput.id;
1092
- radio.appendChild(radioLabel);
1093
- }
1094
- _show(radio);
1095
- var radios = radio.querySelectorAll('input');
1096
- if (radios.length) {
1097
- radios[0].focus();
1098
- }
1099
- };
1100
- break;
1101
- case 'checkbox':
1102
- var checkbox = getChildByClass(modal, swalClasses.checkbox);
1103
- var checkboxInput = modal.querySelector('#' + swalClasses.checkbox);
1104
- checkboxInput.value = 1;
1105
- checkboxInput.checked = Boolean(params.inputValue);
1106
- var label = checkbox.getElementsByTagName('span');
1107
- if (label.length) {
1108
- checkbox.removeChild(label[0]);
1109
- }
1110
- label = document.createElement('span');
1111
- label.innerHTML = params.inputPlaceholder;
1112
- checkbox.appendChild(label);
1113
- _show(checkbox);
1114
- break;
1115
- case 'textarea':
1116
- var textarea = getChildByClass(modal, swalClasses.textarea);
1117
- textarea.value = params.inputValue;
1118
- textarea.placeholder = params.inputPlaceholder;
1119
- _show(textarea);
1120
- break;
1121
- case null:
1122
- break;
1123
- default:
1124
- console.error('SweetAlert2: Unexpected type of input! Expected "text" or "email" or "password", "select", "checkbox", "textarea" or "file", got "' + params.input + '"');
1125
- break;
1126
  }
 
1127
 
1128
- if (params.input === 'select' || params.input === 'radio') {
1129
- if (params.inputOptions instanceof Promise) {
1130
- sweetAlert.showLoading();
1131
- params.inputOptions.then(function(inputOptions) {
1132
- sweetAlert.hideLoading();
1133
- populateInputOptions(inputOptions);
1134
- });
1135
- } else if (typeof params.inputOptions === 'object') {
1136
- populateInputOptions(params.inputOptions);
1137
- } else {
1138
- console.error('SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got ' + typeof params.inputOptions);
1139
- }
1140
  }
 
1141
 
1142
- fixVerticalPosition();
1143
- openModal(params.animation, params.onOpen);
 
1144
 
1145
- // Focus the first element (input or button)
1146
- setFocus(-1, 1);
1147
- });
1148
- }
 
 
 
 
1149
 
1150
- // SweetAlert function
1151
- function sweetAlert() {
1152
- // Copy arguments to the local args variable
1153
- var args = arguments;
1154
- var modal = getModal();
1155
 
1156
- if (modal === null) {
1157
- sweetAlert.init();
1158
- modal = getModal();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1159
  }
1160
 
1161
- if (hasClass(modal, 'visible')) {
1162
- resetPrevState();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1163
  }
1164
 
1165
- return modalDependant.apply(this, args);
1166
- }
 
 
 
 
 
 
 
 
 
 
 
1167
 
1168
- /*
1169
- * Global function for chaining sweetAlert modals
1170
- */
1171
- sweetAlert.queue = function(steps) {
1172
- return new Promise(function(resolve, reject) {
1173
- (function step(i, callback) {
1174
- if (i < steps.length) {
1175
- sweetAlert(steps[i]).then(function() {
1176
- step(i+1, callback);
1177
- }, function(dismiss) {
1178
- reject(dismiss);
1179
- });
1180
- } else {
1181
- resolve();
1182
- }
1183
- })(0);
1184
- });
1185
- };
1186
 
1187
- /*
1188
- * Global function to close sweetAlert
1189
- */
1190
- sweetAlert.close = sweetAlert.closeModal = function(onComplete) {
1191
- var modal = getModal();
1192
- removeClass(modal, 'show-swal2');
1193
- addClass(modal, 'hide-swal2');
1194
- removeClass(modal, 'visible');
1195
-
1196
- // Reset icon animations
1197
- var $successIcon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes.success);
1198
- removeClass($successIcon, 'animate');
1199
- removeClass($successIcon.querySelector('.tip'), 'animate-success-tip');
1200
- removeClass($successIcon.querySelector('.long'), 'animate-success-long');
1201
-
1202
- var $errorIcon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes.error);
1203
- removeClass($errorIcon, 'animate-error-icon');
1204
- removeClass($errorIcon.querySelector('.x-mark'), 'animate-x-mark');
1205
-
1206
- var $warningIcon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes.warning);
1207
- removeClass($warningIcon, 'pulse-warning');
1208
-
1209
- resetPrevState();
1210
-
1211
- if (animationEndEvent && !hasClass(modal, 'no-animation')) {
1212
- modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
1213
- modal.removeEventListener(animationEndEvent, swalCloseEventFinished);
1214
- if (hasClass(modal, 'hide-swal2')) {
1215
- _hide(modal);
1216
- fadeOut(getOverlay(), 0);
1217
- }
1218
- });
1219
  } else {
1220
- _hide(modal);
1221
- _hide(getOverlay());
 
1222
  }
1223
- if (onComplete !== null && typeof onComplete === 'function') {
1224
- onComplete.call(this, modal);
 
 
 
 
 
 
1225
  }
1226
- };
 
1227
 
1228
- /*
1229
- * Global function to click 'Confirm' button
1230
- */
1231
- sweetAlert.clickConfirm = function() {
1232
- getConfirmButton().click();
1233
- };
1234
 
1235
- /*
1236
- * Global function to click 'Cancel' button
1237
- */
1238
- sweetAlert.clickCancel = function() {
1239
- getCancelButton().click();
 
 
 
1240
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1241
 
1242
- /*
1243
- * Add modal + overlay to DOM
1244
- */
1245
- sweetAlert.init = function() {
1246
- if (typeof document === 'undefined') {
1247
- console.log('SweetAlert2 requires document to initialize');
1248
- return;
1249
- } else if (document.getElementsByClassName(swalClasses.container).length) {
1250
- return;
1251
- }
1252
 
1253
- var sweetWrap = document.createElement('div');
1254
- sweetWrap.className = swalClasses.container;
 
 
 
 
 
 
 
1255
 
1256
- sweetWrap.innerHTML = sweetHTML;
 
 
 
 
 
 
 
1257
 
1258
- document.body.appendChild(sweetWrap);
 
 
 
 
 
 
 
 
 
 
 
1259
 
1260
- var modal = getModal();
1261
- var $input = getChildByClass(modal, swalClasses.input);
1262
- var $select = getChildByClass(modal, swalClasses.select);
1263
- var $checkbox = modal.querySelector('#' + swalClasses.checkbox);
1264
- var $textarea = getChildByClass(modal, swalClasses.textarea);
1265
 
1266
- $input.oninput = function() {
1267
- sweetAlert.resetValidationError();
1268
- };
 
 
 
 
 
 
1269
 
1270
- $input.onkeyup = function(event) {
1271
- event.stopPropagation();
1272
- if (event.keyCode === 13) {
1273
- sweetAlert.clickConfirm();
 
 
1274
  }
1275
- };
1276
-
1277
- $select.onchange = function() {
1278
- sweetAlert.resetValidationError();
1279
- };
 
 
 
 
 
 
1280
 
1281
- $checkbox.onchange = function() {
1282
- sweetAlert.resetValidationError();
1283
- };
 
 
 
1284
 
1285
- $textarea.oninput = function() {
1286
- sweetAlert.resetValidationError();
1287
- };
 
 
 
1288
 
1289
- window.addEventListener('resize', fixVerticalPosition, false);
1290
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1291
 
1292
- /**
1293
- * Set default params for each popup
1294
- * @param {Object} userParams
1295
- */
1296
- sweetAlert.setDefaults = function(userParams) {
1297
- if (!userParams) {
1298
- throw new Error('userParams is required');
1299
- }
1300
- if (typeof userParams !== 'object') {
1301
- throw new Error('userParams has to be a object');
1302
  }
 
1303
 
1304
- extend(modalParams, userParams);
1305
- };
1306
 
1307
- /**
1308
- * Reset default params for each popup
1309
- */
1310
- sweetAlert.resetDefaults = function() {
1311
- modalParams = extend({}, defaultParams);
1312
- };
1313
 
1314
- sweetAlert.version = '4.0.15';
1315
 
1316
- window.sweetAlert = window.swal = sweetAlert;
1317
 
1318
- /*
1319
- * If library is injected after page has loaded
1320
- */
1321
- (function() {
1322
- if (document.readyState === 'complete' || document.readyState === 'interactive' && document.body) {
1323
- sweetAlert.init();
1324
- } else {
1325
- document.addEventListener('DOMContentLoaded', function onDomContentLoaded() {
1326
- document.removeEventListener('DOMContentLoaded', onDomContentLoaded, false);
1327
- sweetAlert.init();
1328
- }, false);
1329
- }
1330
- })();
1331
-
1332
- if (typeof Promise === 'function') {
1333
- Promise.prototype.done = function() {
1334
- return this.catch(function() {
1335
- // Catch promise rejections silently.
1336
- // https://github.com/limonte/sweetalert2/issues/177
1337
- });
1338
- };
1339
- }
1340
 
1341
- return sweetAlert;
1342
 
1343
- }));
 
1
  /*!
2
+ * sweetalert2 v6.6.6
3
  * Released under the MIT License.
4
  */
5
  (function (global, factory) {
6
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
7
+ typeof define === 'function' && define.amd ? define(factory) :
8
+ (global.Sweetalert2 = factory());
9
+ }(this, (function () { 'use strict';
10
+
11
+ var defaultParams = {
12
+ title: '',
13
+ titleText: '',
14
+ text: '',
15
+ html: '',
16
+ type: null,
17
+ customClass: '',
18
+ target: 'body',
19
+ animation: true,
20
+ allowOutsideClick: true,
21
+ allowEscapeKey: true,
22
+ allowEnterKey: true,
23
+ showConfirmButton: true,
24
+ showCancelButton: false,
25
+ preConfirm: null,
26
+ confirmButtonText: 'OK',
27
+ confirmButtonColor: '#3085d6',
28
+ confirmButtonClass: null,
29
+ cancelButtonText: 'Cancel',
30
+ cancelButtonColor: '#aaa',
31
+ cancelButtonClass: null,
32
+ buttonsStyling: true,
33
+ reverseButtons: false,
34
+ focusCancel: false,
35
+ showCloseButton: false,
36
+ showLoaderOnConfirm: false,
37
+ imageUrl: null,
38
+ imageWidth: null,
39
+ imageHeight: null,
40
+ imageClass: null,
41
+ timer: null,
42
+ width: 500,
43
+ padding: 20,
44
+ background: '#fff',
45
+ input: null,
46
+ inputPlaceholder: '',
47
+ inputValue: '',
48
+ inputOptions: {},
49
+ inputAutoTrim: true,
50
+ inputClass: null,
51
+ inputAttributes: {},
52
+ inputValidator: null,
53
+ progressSteps: [],
54
+ currentProgressStep: null,
55
+ progressStepsDistance: '40px',
56
+ onOpen: null,
57
+ onClose: null,
58
+ useRejections: true
59
+ };
60
+
61
+ var swalPrefix = 'swal2-';
62
+
63
+ var prefix = function prefix(items) {
64
+ var result = {};
65
+ for (var i in items) {
66
+ result[items[i]] = swalPrefix + items[i];
67
+ }
68
+ return result;
69
+ };
70
 
71
+ var swalClasses = prefix(['container', 'shown', 'iosfix', 'modal', 'overlay', 'fade', 'show', 'hide', 'noanimation', 'close', 'title', 'content', 'buttonswrapper', 'confirm', 'cancel', 'icon', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea', 'inputerror', 'validationerror', 'progresssteps', 'activeprogressstep', 'progresscircle', 'progressline', 'loading', 'styled']);
72
 
73
+ var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);
 
 
 
 
 
 
74
 
75
+ /*
76
+ * Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color)
77
+ */
78
+ var colorLuminance = function colorLuminance(hex, lum) {
79
+ // Validate hex string
80
+ hex = String(hex).replace(/[^0-9a-f]/gi, '');
81
+ if (hex.length < 6) {
82
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
83
+ }
84
+ lum = lum || 0;
85
+
86
+ // Convert to decimal and change luminosity
87
+ var rgb = '#';
88
+ for (var i = 0; i < 3; i++) {
89
+ var c = parseInt(hex.substr(i * 2, 2), 16);
90
+ c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16);
91
+ rgb += ('00' + c).substr(c.length);
92
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
+ return rgb;
95
+ };
96
+
97
+ var uniqueArray = function uniqueArray(arr) {
98
+ var result = [];
99
+ for (var i in arr) {
100
+ if (result.indexOf(arr[i]) === -1) {
101
+ result.push(arr[i]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
+ }
104
+ return result;
105
+ };
106
 
107
+ /* global MouseEvent */
 
108
 
109
+ // Remember state in cases where opening and handling a modal will fiddle with it.
110
+ var states = {
111
+ previousWindowKeyDown: null,
112
+ previousActiveElement: null,
113
+ previousBodyPadding: null
114
 
115
  /*
116
+ * Add modal + overlay to DOM
117
  */
118
+ };var init = function init(params) {
119
+ if (typeof document === 'undefined') {
120
+ console.error('SweetAlert2 requires document to initialize');
121
+ return;
122
+ }
 
 
 
 
 
 
 
 
 
 
123
 
124
+ var container = document.createElement('div');
125
+ container.className = swalClasses.container;
126
+ container.innerHTML = sweetHTML;
127
 
128
+ var targetElement = document.querySelector(params.target);
129
+ if (!targetElement) {
130
+ console.warn('SweetAlert2: Can\'t find the target "' + params.target + '"');
131
+ targetElement = document.body;
132
+ }
133
+ targetElement.appendChild(container);
134
+
135
+ var modal = getModal();
136
+ var input = getChildByClass(modal, swalClasses.input);
137
+ var file = getChildByClass(modal, swalClasses.file);
138
+ var range = modal.querySelector('.' + swalClasses.range + ' input');
139
+ var rangeOutput = modal.querySelector('.' + swalClasses.range + ' output');
140
+ var select = getChildByClass(modal, swalClasses.select);
141
+ var checkbox = modal.querySelector('.' + swalClasses.checkbox + ' input');
142
+ var textarea = getChildByClass(modal, swalClasses.textarea);
143
+
144
+ input.oninput = function () {
145
+ sweetAlert.resetValidationError();
146
+ };
147
 
148
+ input.onkeydown = function (event) {
149
+ setTimeout(function () {
150
+ if (event.keyCode === 13 && params.allowEnterKey) {
151
+ event.stopPropagation();
152
+ sweetAlert.clickConfirm();
153
+ }
154
+ }, 0);
155
  };
156
 
157
+ file.onchange = function () {
158
+ sweetAlert.resetValidationError();
 
 
 
159
  };
160
 
161
+ range.oninput = function () {
162
+ sweetAlert.resetValidationError();
163
+ rangeOutput.value = range.value;
164
  };
165
 
166
+ range.onchange = function () {
167
+ sweetAlert.resetValidationError();
168
+ range.previousSibling.value = range.value;
169
  };
170
 
171
+ select.onchange = function () {
172
+ sweetAlert.resetValidationError();
173
  };
174
 
175
+ checkbox.onchange = function () {
176
+ sweetAlert.resetValidationError();
177
  };
178
 
179
+ textarea.oninput = function () {
180
+ sweetAlert.resetValidationError();
181
  };
182
 
183
+ return modal;
184
+ };
185
+
186
+ /*
187
+ * Manipulate DOM
188
+ */
189
+
190
+ var sweetHTML = ('\n <div role="dialog" aria-labelledby="' + swalClasses.title + '" aria-describedby="' + swalClasses.content + '" class="' + swalClasses.modal + '" tabindex="-1">\n <ul class="' + swalClasses.progresssteps + '"></ul>\n <div class="' + swalClasses.icon + ' ' + iconTypes.error + '">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.question + '">?</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.warning + '">!</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.info + '">i</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.success + '">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="' + swalClasses.image + '" />\n <h2 class="' + swalClasses.title + '" id="' + swalClasses.title + '"></h2>\n <div id="' + swalClasses.content + '" class="' + swalClasses.content + '"></div>\n <input class="' + swalClasses.input + '" />\n <input type="file" class="' + swalClasses.file + '" />\n <div class="' + swalClasses.range + '">\n <output></output>\n <input type="range" />\n </div>\n <select class="' + swalClasses.select + '"></select>\n <div class="' + swalClasses.radio + '"></div>\n <label for="' + swalClasses.checkbox + '" class="' + swalClasses.checkbox + '">\n <input type="checkbox" />\n </label>\n <textarea class="' + swalClasses.textarea + '"></textarea>\n <div class="' + swalClasses.validationerror + '"></div>\n <div class="' + swalClasses.buttonswrapper + '">\n <button type="button" class="' + swalClasses.confirm + '">OK</button>\n <button type="button" class="' + swalClasses.cancel + '">Cancel</button>\n </div>\n <button type="button" class="' + swalClasses.close + '" aria-label="Close this dialog">\xD7</button>\n </div>\n').replace(/(^|\n)\s*/g, '');
191
+
192
+ var getContainer = function getContainer() {
193
+ return document.body.querySelector('.' + swalClasses.container);
194
+ };
195
+
196
+ var getModal = function getModal() {
197
+ return getContainer() ? getContainer().querySelector('.' + swalClasses.modal) : null;
198
+ };
199
+
200
+ var getIcons = function getIcons() {
201
+ var modal = getModal();
202
+ return modal.querySelectorAll('.' + swalClasses.icon);
203
+ };
204
+
205
+ var elementByClass = function elementByClass(className) {
206
+ return getContainer() ? getContainer().querySelector('.' + className) : null;
207
+ };
208
+
209
+ var getTitle = function getTitle() {
210
+ return elementByClass(swalClasses.title);
211
+ };
212
+
213
+ var getContent = function getContent() {
214
+ return elementByClass(swalClasses.content);
215
+ };
216
+
217
+ var getImage = function getImage() {
218
+ return elementByClass(swalClasses.image);
219
+ };
220
+
221
+ var getButtonsWrapper = function getButtonsWrapper() {
222
+ return elementByClass(swalClasses.buttonswrapper);
223
+ };
224
+
225
+ var getProgressSteps = function getProgressSteps() {
226
+ return elementByClass(swalClasses.progresssteps);
227
+ };
228
+
229
+ var getValidationError = function getValidationError() {
230
+ return elementByClass(swalClasses.validationerror);
231
+ };
232
+
233
+ var getConfirmButton = function getConfirmButton() {
234
+ return elementByClass(swalClasses.confirm);
235
+ };
236
+
237
+ var getCancelButton = function getCancelButton() {
238
+ return elementByClass(swalClasses.cancel);
239
+ };
240
+
241
+ var getCloseButton = function getCloseButton() {
242
+ return elementByClass(swalClasses.close);
243
+ };
244
+
245
+ var getFocusableElements = function getFocusableElements(focusCancel) {
246
+ var buttons = [getConfirmButton(), getCancelButton()];
247
+ if (focusCancel) {
248
+ buttons.reverse();
249
+ }
250
+ var focusableElements = buttons.concat(Array.prototype.slice.call(getModal().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, *[tabindex]:not([tabindex="-1"])')));
251
+ return uniqueArray(focusableElements);
252
+ };
253
+
254
+ var hasClass = function hasClass(elem, className) {
255
+ if (elem.classList) {
256
  return elem.classList.contains(className);
257
+ }
258
+ return false;
259
+ };
260
 
261
+ var focusInput = function focusInput(input) {
262
+ input.focus();
263
 
264
+ // place cursor at end of text in text input
265
+ if (input.type !== 'file') {
266
  // http://stackoverflow.com/a/2345915/1331425
267
  var val = input.value;
268
  input.value = '';
269
  input.value = val;
270
+ }
271
+ };
272
 
273
+ var addClass = function addClass(elem, className) {
274
+ if (!elem || !className) {
275
+ return;
276
+ }
277
+ var classes = className.split(/\s+/).filter(Boolean);
278
+ classes.forEach(function (className) {
279
+ elem.classList.add(className);
280
+ });
281
+ };
282
+
283
+ var removeClass = function removeClass(elem, className) {
284
+ if (!elem || !className) {
285
+ return;
286
+ }
287
+ var classes = className.split(/\s+/).filter(Boolean);
288
+ classes.forEach(function (className) {
289
+ elem.classList.remove(className);
290
+ });
291
+ };
292
+
293
+ var getChildByClass = function getChildByClass(elem, className) {
294
+ for (var i = 0; i < elem.childNodes.length; i++) {
295
+ if (hasClass(elem.childNodes[i], className)) {
296
+ return elem.childNodes[i];
297
  }
298
+ }
299
+ };
 
 
 
300
 
301
+ var show = function show(elem, display) {
302
+ if (!display) {
303
+ display = 'block';
304
+ }
305
+ elem.style.opacity = '';
306
+ elem.style.display = display;
307
+ };
308
+
309
+ var hide = function hide(elem) {
310
+ elem.style.opacity = '';
311
+ elem.style.display = 'none';
312
+ };
313
+
314
+ var empty = function empty(elem) {
315
+ while (elem.firstChild) {
316
+ elem.removeChild(elem.firstChild);
317
+ }
318
+ };
319
+
320
+ // borrowed from jqeury $(elem).is(':visible') implementation
321
+ var isVisible = function isVisible(elem) {
322
+ return elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length;
323
+ };
324
+
325
+ var removeStyleProperty = function removeStyleProperty(elem, property) {
326
+ if (elem.style.removeProperty) {
327
+ elem.style.removeProperty(property);
328
+ } else {
329
+ elem.style.removeAttribute(property);
330
+ }
331
+ };
332
+
333
+ var fireClick = function fireClick(node) {
334
+ if (!isVisible(node)) {
335
+ return false;
336
+ }
337
+
338
+ // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
339
+ // Then fixed for today's Chrome browser.
340
+ if (typeof MouseEvent === 'function') {
341
+ // Up-to-date approach
342
+ var mevt = new MouseEvent('click', {
343
+ view: window,
344
+ bubbles: false,
345
+ cancelable: true
346
  });
347
+ node.dispatchEvent(mevt);
348
+ } else if (document.createEvent) {
349
+ // Fallback
350
+ var evt = document.createEvent('MouseEvents');
351
+ evt.initEvent('click', false, false);
352
+ node.dispatchEvent(evt);
353
+ } else if (document.createEventObject) {
354
+ node.fireEvent('onclick');
355
+ } else if (typeof node.onclick === 'function') {
356
+ node.onclick();
357
+ }
358
+ };
359
+
360
+ var animationEndEvent = function () {
361
+ var testEl = document.createElement('div');
362
+ var transEndEventNames = {
363
+ 'WebkitAnimation': 'webkitAnimationEnd',
364
+ 'OAnimation': 'oAnimationEnd oanimationend',
365
+ 'msAnimation': 'MSAnimationEnd',
366
+ 'animation': 'animationend'
367
  };
368
+ for (var i in transEndEventNames) {
369
+ if (transEndEventNames.hasOwnProperty(i) && testEl.style[i] !== undefined) {
370
+ return transEndEventNames[i];
371
+ }
372
+ }
373
 
374
+ return false;
375
+ }();
376
+
377
+ // Reset previous window keydown handler and focued element
378
+ var resetPrevState = function resetPrevState() {
379
+ window.onkeydown = states.previousWindowKeyDown;
380
+ if (states.previousActiveElement && states.previousActiveElement.focus) {
381
+ var x = window.scrollX;
382
+ var y = window.scrollY;
383
+ states.previousActiveElement.focus();
384
+ if (x && y) {
385
+ // IE has no scrollX/scrollY support
386
+ window.scrollTo(x, y);
387
  }
388
+ }
389
+ };
390
+
391
+ // Measure width of scrollbar
392
+ // https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286
393
+ var measureScrollbar = function measureScrollbar() {
394
+ var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
395
+ if (supportsTouch) {
396
+ return 0;
397
+ }
398
+ var scrollDiv = document.createElement('div');
399
+ scrollDiv.style.width = '50px';
400
+ scrollDiv.style.height = '50px';
401
+ scrollDiv.style.overflow = 'scroll';
402
+ document.body.appendChild(scrollDiv);
403
+ var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
404
+ document.body.removeChild(scrollDiv);
405
+ return scrollbarWidth;
406
+ };
407
+
408
+ // JavaScript Debounce Function
409
+ // Simplivied version of https://davidwalsh.name/javascript-debounce-function
410
+ var debounce = function debounce(func, wait) {
411
+ var timeout = void 0;
412
+ return function () {
413
+ var later = function later() {
414
+ timeout = null;
415
+ func();
416
+ };
417
+ clearTimeout(timeout);
418
+ timeout = setTimeout(later, wait);
419
  };
420
+ };
421
+
422
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
423
+ return typeof obj;
424
+ } : function (obj) {
425
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
426
+ };
427
 
 
 
 
 
428
 
 
 
 
 
 
 
 
 
429
 
 
 
 
 
430
 
 
 
 
 
 
 
 
 
431
 
 
 
 
 
 
 
 
432
 
 
 
 
 
433
 
 
434
 
 
 
 
 
435
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
 
 
 
 
 
 
 
 
 
 
439
 
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+ var _extends = Object.assign || function (target) {
449
+ for (var i = 1; i < arguments.length; i++) {
450
+ var source = arguments[i];
451
+
452
+ for (var key in source) {
453
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
454
+ target[key] = source[key];
455
  }
456
  }
457
+ }
458
 
459
+ return target;
460
+ };
461
 
462
+ var modalParams = _extends({}, defaultParams);
463
+ var queue = [];
464
+ var swal2Observer = void 0;
465
 
466
+ /*
467
+ * Set type, text and actions on modal
468
+ */
469
+ var setParameters = function setParameters(params) {
470
+ var modal = getModal() || init(params);
 
 
 
471
 
472
+ for (var param in params) {
473
+ if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
474
+ console.warn('SweetAlert2: Unknown parameter "' + param + '"');
 
 
475
  }
476
+ }
477
 
478
+ // Set modal width
479
+ modal.style.width = typeof params.width === 'number' ? params.width + 'px' : params.width;
480
 
481
+ modal.style.padding = params.padding + 'px';
482
+ modal.style.background = params.background;
483
+ var successIconParts = modal.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
484
+ for (var i = 0; i < successIconParts.length; i++) {
485
+ successIconParts[i].style.background = params.background;
486
+ }
487
 
488
+ var title = getTitle();
489
+ var content = getContent();
490
+ var buttonsWrapper = getButtonsWrapper();
491
+ var confirmButton = getConfirmButton();
492
+ var cancelButton = getCancelButton();
493
+ var closeButton = getCloseButton();
494
+
495
+ // Title
496
+ if (params.titleText) {
497
+ title.innerText = params.titleText;
498
+ } else {
499
+ title.innerHTML = params.title.split('\n').join('<br />');
500
+ }
501
 
502
+ // Content
503
+ if (params.text || params.html) {
504
+ if (_typeof(params.html) === 'object') {
505
+ content.innerHTML = '';
506
+ if (0 in params.html) {
507
+ for (var _i = 0; _i in params.html; _i++) {
508
+ content.appendChild(params.html[_i].cloneNode(true));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
  }
510
  } else {
511
+ content.appendChild(params.html.cloneNode(true));
512
  }
513
+ } else if (params.html) {
514
+ content.innerHTML = params.html;
515
+ } else if (params.text) {
516
+ content.textContent = params.text;
517
  }
518
+ show(content);
519
+ } else {
520
+ hide(content);
521
+ }
522
 
523
+ // Close button
524
+ if (params.showCloseButton) {
525
+ show(closeButton);
526
+ } else {
527
+ hide(closeButton);
528
+ }
529
 
530
+ // Custom Class
531
+ modal.className = swalClasses.modal;
532
+ if (params.customClass) {
533
+ addClass(modal, params.customClass);
534
+ }
535
 
536
+ // Progress steps
537
+ var progressStepsContainer = getProgressSteps();
538
+ var currentProgressStep = parseInt(params.currentProgressStep === null ? sweetAlert.getQueueStep() : params.currentProgressStep, 10);
539
+ if (params.progressSteps.length) {
540
+ show(progressStepsContainer);
541
+ empty(progressStepsContainer);
542
+ if (currentProgressStep >= params.progressSteps.length) {
543
+ console.warn('SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
544
+ }
545
+ params.progressSteps.forEach(function (step, index) {
546
+ var circle = document.createElement('li');
547
+ addClass(circle, swalClasses.progresscircle);
548
+ circle.innerHTML = step;
549
+ if (index === currentProgressStep) {
550
+ addClass(circle, swalClasses.activeprogressstep);
551
  }
552
+ progressStepsContainer.appendChild(circle);
553
+ if (index !== params.progressSteps.length - 1) {
554
+ var line = document.createElement('li');
555
+ addClass(line, swalClasses.progressline);
556
+ line.style.width = params.progressStepsDistance;
557
+ progressStepsContainer.appendChild(line);
558
  }
559
+ });
560
+ } else {
561
+ hide(progressStepsContainer);
562
+ }
563
 
564
+ // Icon
565
+ var icons = getIcons();
566
+ for (var _i2 = 0; _i2 < icons.length; _i2++) {
567
+ hide(icons[_i2]);
568
+ }
569
+ if (params.type) {
570
+ var validType = false;
571
+ for (var iconType in iconTypes) {
572
+ if (params.type === iconType) {
573
+ validType = true;
574
+ break;
575
+ }
576
+ }
577
+ if (!validType) {
578
+ console.error('SweetAlert2: Unknown alert type: ' + params.type);
579
+ return false;
580
+ }
581
+ var icon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes[params.type]);
582
+ show(icon);
583
+
584
+ // Animate icon
585
+ if (params.animation) {
586
  switch (params.type) {
587
  case 'success':
588
+ addClass(icon, 'swal2-animate-success-icon');
589
+ addClass(icon.querySelector('.swal2-success-line-tip'), 'swal2-animate-success-line-tip');
590
+ addClass(icon.querySelector('.swal2-success-line-long'), 'swal2-animate-success-line-long');
591
  break;
592
  case 'error':
593
+ addClass(icon, 'swal2-animate-error-icon');
594
+ addClass(icon.querySelector('.swal2-x-mark'), 'swal2-animate-x-mark');
 
 
 
595
  break;
596
  default:
597
  break;
598
  }
 
599
  }
600
+ }
601
 
602
+ // Custom image
603
+ var image = getImage();
604
+ if (params.imageUrl) {
605
+ image.setAttribute('src', params.imageUrl);
606
+ show(image);
 
 
 
 
 
 
 
 
 
 
 
 
607
 
608
+ if (params.imageWidth) {
609
+ image.setAttribute('width', params.imageWidth);
 
610
  } else {
611
+ image.removeAttribute('width');
612
  }
613
 
614
+ if (params.imageHeight) {
615
+ image.setAttribute('height', params.imageHeight);
 
616
  } else {
617
+ image.removeAttribute('height');
618
  }
619
 
620
+ image.className = swalClasses.image;
621
+ if (params.imageClass) {
622
+ addClass(image, params.imageClass);
 
 
623
  }
624
+ } else {
625
+ hide(image);
626
+ }
627
 
628
+ // Cancel button
629
+ if (params.showCancelButton) {
630
+ cancelButton.style.display = 'inline-block';
631
+ } else {
632
+ hide(cancelButton);
633
+ }
634
 
635
+ // Confirm button
636
+ if (params.showConfirmButton) {
637
+ removeStyleProperty(confirmButton, 'display');
638
+ } else {
639
+ hide(confirmButton);
640
+ }
641
 
642
+ // Buttons wrapper
643
+ if (!params.showConfirmButton && !params.showCancelButton) {
644
+ hide(buttonsWrapper);
645
+ } else {
646
+ show(buttonsWrapper);
647
+ }
648
 
649
+ // Edit text on cancel and confirm buttons
650
+ confirmButton.innerHTML = params.confirmButtonText;
651
+ cancelButton.innerHTML = params.cancelButtonText;
 
 
652
 
653
+ // Set buttons to selected background colors
654
+ if (params.buttonsStyling) {
655
+ confirmButton.style.backgroundColor = params.confirmButtonColor;
656
+ cancelButton.style.backgroundColor = params.cancelButtonColor;
657
+ }
 
 
658
 
659
+ // Add buttons custom classes
660
+ confirmButton.className = swalClasses.confirm;
661
+ addClass(confirmButton, params.confirmButtonClass);
662
+ cancelButton.className = swalClasses.cancel;
663
+ addClass(cancelButton, params.cancelButtonClass);
664
+
665
+ // Buttons styling
666
+ if (params.buttonsStyling) {
667
+ addClass(confirmButton, swalClasses.styled);
668
+ addClass(cancelButton, swalClasses.styled);
669
+ } else {
670
+ removeClass(confirmButton, swalClasses.styled);
671
+ removeClass(cancelButton, swalClasses.styled);
672
+
673
+ confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = '';
674
+ cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = '';
675
+ }
676
 
677
+ // CSS animation
678
+ if (params.animation === true) {
679
+ removeClass(modal, swalClasses.noanimation);
680
+ } else {
681
+ addClass(modal, swalClasses.noanimation);
682
+ }
683
+ };
684
 
685
+ /*
686
+ * Animations
687
+ */
688
+ var openModal = function openModal(animation, onComplete) {
689
+ var container = getContainer();
690
+ var modal = getModal();
691
+
692
+ if (animation) {
693
+ addClass(modal, swalClasses.show);
694
+ addClass(container, swalClasses.fade);
695
+ removeClass(modal, swalClasses.hide);
696
+ } else {
697
+ removeClass(modal, swalClasses.fade);
698
+ }
699
+ show(modal);
700
+
701
+ // scrolling is 'hidden' until animation is done, after that 'auto'
702
+ container.style.overflowY = 'hidden';
703
+ if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
704
+ modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
705
+ modal.removeEventListener(animationEndEvent, swalCloseEventFinished);
706
+ container.style.overflowY = 'auto';
707
+ });
708
+ } else {
709
+ container.style.overflowY = 'auto';
710
+ }
711
 
712
+ addClass(document.documentElement, swalClasses.shown);
713
+ addClass(document.body, swalClasses.shown);
714
+ addClass(container, swalClasses.shown);
715
+ fixScrollbar();
716
+ iOSfix();
717
+ states.previousActiveElement = document.activeElement;
718
+ if (onComplete !== null && typeof onComplete === 'function') {
719
+ setTimeout(function () {
720
+ onComplete(modal);
721
+ });
722
+ }
723
+ };
724
 
725
+ var fixScrollbar = function fixScrollbar() {
726
+ // for queues, do not do this more than once
727
+ if (states.previousBodyPadding !== null) {
728
+ return;
729
+ }
730
+ // if the body has overflow
731
+ if (document.body.scrollHeight > window.innerHeight) {
732
+ // add padding so the content doesn't shift after removal of scrollbar
733
+ states.previousBodyPadding = document.body.style.paddingRight;
734
+ document.body.style.paddingRight = measureScrollbar() + 'px';
735
+ }
736
+ };
737
 
738
+ var undoScrollbar = function undoScrollbar() {
739
+ if (states.previousBodyPadding !== null) {
740
+ document.body.style.paddingRight = states.previousBodyPadding;
741
+ states.previousBodyPadding = null;
742
+ }
743
+ };
744
+
745
+ // Fix iOS scrolling http://stackoverflow.com/q/39626302/1331425
746
+ var iOSfix = function iOSfix() {
747
+ var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
748
+ if (iOS && !hasClass(document.body, swalClasses.iosfix)) {
749
+ var offset = document.body.scrollTop;
750
+ document.body.style.top = offset * -1 + 'px';
751
+ addClass(document.body, swalClasses.iosfix);
752
+ }
753
+ };
754
+
755
+ var undoIOSfix = function undoIOSfix() {
756
+ if (hasClass(document.body, swalClasses.iosfix)) {
757
+ var offset = parseInt(document.body.style.top, 10);
758
+ removeClass(document.body, swalClasses.iosfix);
759
+ document.body.style.top = '';
760
+ document.body.scrollTop = offset * -1;
761
+ }
762
+ };
763
 
764
+ // SweetAlert entry point
765
+ var sweetAlert = function sweetAlert() {
766
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
767
+ args[_key] = arguments[_key];
768
+ }
769
 
770
+ if (args[0] === undefined) {
771
+ console.error('SweetAlert2 expects at least 1 attribute!');
772
+ return false;
773
+ }
774
 
775
+ var params = _extends({}, modalParams);
776
 
777
+ switch (_typeof(args[0])) {
778
+ case 'string':
779
+ params.title = args[0];
780
+ params.html = args[1];
781
+ params.type = args[2];
782
 
783
+ break;
784
 
785
+ case 'object':
786
+ _extends(params, args[0]);
787
+ params.extraParams = args[0].extraParams;
788
 
789
+ if (params.input === 'email' && params.inputValidator === null) {
790
+ params.inputValidator = function (email) {
791
+ return new Promise(function (resolve, reject) {
792
+ var emailRegex = /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
793
+ if (emailRegex.test(email)) {
794
+ resolve();
795
+ } else {
796
+ reject('Invalid email address');
797
+ }
798
+ });
799
+ };
800
+ }
801
 
802
+ if (params.input === 'url' && params.inputValidator === null) {
803
+ params.inputValidator = function (url) {
804
+ return new Promise(function (resolve, reject) {
805
+ // taken from https://stackoverflow.com/a/3809435/1331425
806
+ var urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/;
807
+ if (urlRegex.test(url)) {
808
+ resolve();
809
+ } else {
810
+ reject('Invalid URL');
811
+ }
812
+ });
813
+ };
814
+ }
815
+ break;
816
 
817
+ default:
818
+ console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got ' + _typeof(args[0]));
819
+ return false;
820
+ }
821
 
822
+ setParameters(params);
823
 
824
+ var container = getContainer();
825
+ var modal = getModal();
826
 
827
+ return new Promise(function (resolve, reject) {
828
+ // Close on timer
829
+ if (params.timer) {
830
+ modal.timeout = setTimeout(function () {
831
+ sweetAlert.closeModal(params.onClose);
832
+ if (params.useRejections) {
833
  reject('timer');
834
+ } else {
835
+ resolve({ dismiss: 'timer' });
836
+ }
837
+ }, params.timer);
838
+ }
839
+
840
+ // Get input element by specified type or, if type isn't specified, by params.input
841
+ var getInput = function getInput(inputType) {
842
+ inputType = inputType || params.input;
843
+ if (!inputType) {
844
+ return null;
845
  }
846
+ switch (inputType) {
847
+ case 'select':
848
+ case 'textarea':
849
+ case 'file':
850
+ return getChildByClass(modal, swalClasses[inputType]);
851
+ case 'checkbox':
852
+ return modal.querySelector('.' + swalClasses.checkbox + ' input');
853
+ case 'radio':
854
+ return modal.querySelector('.' + swalClasses.radio + ' input:checked') || modal.querySelector('.' + swalClasses.radio + ' input:first-child');
855
+ case 'range':
856
+ return modal.querySelector('.' + swalClasses.range + ' input');
857
+ default:
858
+ return getChildByClass(modal, swalClasses.input);
859
+ }
860
+ };
861
 
862
+ // Get the value of the modal input
863
+ var getInputValue = function getInputValue() {
864
+ var input = getInput();
865
+ if (!input) {
866
+ return null;
867
+ }
868
+ switch (params.input) {
869
+ case 'checkbox':
870
+ return input.checked ? 1 : 0;
871
+ case 'radio':
872
+ return input.checked ? input.value : null;
873
+ case 'file':
874
+ return input.files.length ? input.files[0] : null;
875
+ default:
876
+ return params.inputAutoTrim ? input.value.trim() : input.value;
877
+ }
878
+ };
879
+
880
+ // input autofocus
881
+ if (params.input) {
882
+ setTimeout(function () {
883
  var input = getInput();
884
+ if (input) {
885
+ focusInput(input);
 
 
 
 
 
 
 
886
  }
887
+ }, 0);
888
+ }
889
 
890
+ var confirm = function confirm(value) {
891
+ if (params.showLoaderOnConfirm) {
892
+ sweetAlert.showLoading();
 
 
 
 
893
  }
894
 
895
+ if (params.preConfirm) {
896
+ params.preConfirm(value, params.extraParams).then(function (preConfirmValue) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
897
  sweetAlert.closeModal(params.onClose);
898
+ resolve(preConfirmValue || value);
899
+ }, function (error) {
900
+ sweetAlert.hideLoading();
901
+ if (error) {
902
+ sweetAlert.showValidationError(error);
903
+ }
904
+ });
905
+ } else {
906
+ sweetAlert.closeModal(params.onClose);
907
+ if (params.useRejections) {
908
  resolve(value);
909
+ } else {
910
+ resolve({ value: value });
911
  }
912
+ }
913
+ };
914
+
915
+ // Mouse interactions
916
+ var onButtonEvent = function onButtonEvent(event) {
917
+ var e = event || window.event;
918
+ var target = e.target || e.srcElement;
919
+ var confirmButton = getConfirmButton();
920
+ var cancelButton = getCancelButton();
921
+ var targetedConfirm = confirmButton && (confirmButton === target || confirmButton.contains(target));
922
+ var targetedCancel = cancelButton && (cancelButton === target || cancelButton.contains(target));
923
+
924
+ switch (e.type) {
925
+ case 'mouseover':
926
+ case 'mouseup':
927
+ if (params.buttonsStyling) {
928
+ if (targetedConfirm) {
929
+ confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.1);
930
+ } else if (targetedCancel) {
931
+ cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.1);
 
932
  }
933
+ }
934
+ break;
935
+ case 'mouseout':
936
+ if (params.buttonsStyling) {
937
+ if (targetedConfirm) {
938
+ confirmButton.style.backgroundColor = params.confirmButtonColor;
939
+ } else if (targetedCancel) {
940
+ cancelButton.style.backgroundColor = params.cancelButtonColor;
941
  }
942
+ }
943
+ break;
944
+ case 'mousedown':
945
+ if (params.buttonsStyling) {
946
+ if (targetedConfirm) {
947
+ confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.2);
948
+ } else if (targetedCancel) {
949
+ cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.2);
950
  }
951
+ }
952
+ break;
953
+ case 'click':
954
+ // Clicked 'confirm'
955
+ if (targetedConfirm && sweetAlert.isVisible()) {
956
+ sweetAlert.disableButtons();
957
+ if (params.input) {
958
+ var inputValue = getInputValue();
959
+
960
+ if (params.inputValidator) {
961
+ sweetAlert.disableInput();
962
+ params.inputValidator(inputValue, params.extraParams).then(function () {
963
+ sweetAlert.enableButtons();
964
+ sweetAlert.enableInput();
 
 
 
 
 
 
 
 
965
  confirm(inputValue);
966
+ }, function (error) {
967
+ sweetAlert.enableButtons();
968
+ sweetAlert.enableInput();
969
+ if (error) {
970
+ sweetAlert.showValidationError(error);
971
+ }
972
+ });
973
  } else {
974
+ confirm(inputValue);
975
  }
976
+ } else {
977
+ confirm(true);
978
+ }
979
 
980
  // Clicked 'cancel'
981
+ } else if (targetedCancel && sweetAlert.isVisible()) {
982
+ sweetAlert.disableButtons();
983
+ sweetAlert.closeModal(params.onClose);
984
+ if (params.useRejections) {
985
  reject('cancel');
986
+ } else {
987
+ resolve({ dismiss: 'cancel' });
988
  }
989
+ }
990
+ break;
991
+ default:
 
 
 
 
 
 
 
 
 
 
992
  }
993
+ };
994
 
995
+ var buttons = modal.querySelectorAll('button');
996
+ for (var i = 0; i < buttons.length; i++) {
997
+ buttons[i].onclick = onButtonEvent;
998
+ buttons[i].onmouseover = onButtonEvent;
999
+ buttons[i].onmouseout = onButtonEvent;
1000
+ buttons[i].onmousedown = onButtonEvent;
1001
+ }
1002
+
1003
+ // Closing modal by close button
1004
+ getCloseButton().onclick = function () {
1005
+ sweetAlert.closeModal(params.onClose);
1006
+ if (params.useRejections) {
1007
  reject('close');
1008
+ } else {
1009
+ resolve({ dismiss: 'close' });
1010
+ }
1011
+ };
1012
 
1013
+ // Closing modal by overlay click
1014
+ container.onclick = function (e) {
1015
+ if (e.target !== container) {
1016
+ return;
1017
+ }
1018
+ if (params.allowOutsideClick) {
1019
+ sweetAlert.closeModal(params.onClose);
1020
+ if (params.useRejections) {
1021
  reject('overlay');
1022
+ } else {
1023
+ resolve({ dismiss: 'overlay' });
1024
  }
1025
+ }
1026
+ };
1027
 
1028
+ var buttonsWrapper = getButtonsWrapper();
1029
+ var confirmButton = getConfirmButton();
1030
+ var cancelButton = getCancelButton();
 
 
1031
 
1032
+ // Reverse buttons (Confirm on the right side)
1033
+ if (params.reverseButtons) {
1034
+ confirmButton.parentNode.insertBefore(cancelButton, confirmButton);
1035
+ } else {
1036
+ confirmButton.parentNode.insertBefore(confirmButton, cancelButton);
1037
+ }
1038
 
1039
+ // Focus handling
1040
+ var setFocus = function setFocus(index, increment) {
1041
+ var focusableElements = getFocusableElements(params.focusCancel);
1042
+ // search for visible elements and select the next possible match
1043
+ for (var _i3 = 0; _i3 < focusableElements.length; _i3++) {
1044
+ index = index + increment;
1045
 
1046
+ // rollover to first item
1047
+ if (index === focusableElements.length) {
1048
+ index = 0;
1049
 
1050
  // go to last item
1051
+ } else if (index === -1) {
1052
+ index = focusableElements.length - 1;
1053
+ }
1054
 
1055
+ // determine if element is visible
1056
+ var el = focusableElements[index];
1057
+ if (isVisible(el)) {
1058
+ return el.focus();
 
 
 
 
 
1059
  }
1060
  }
1061
+ };
1062
 
1063
+ var handleKeyDown = function handleKeyDown(event) {
1064
+ var e = event || window.event;
1065
+ var keyCode = e.keyCode || e.which;
1066
 
1067
+ if ([9, 13, 32, 27, 37, 38, 39, 40].indexOf(keyCode) === -1) {
1068
+ // Don't do work on keys we don't care about.
1069
+ return;
1070
+ }
1071
 
1072
+ var targetElement = e.target || e.srcElement;
1073
 
1074
+ var focusableElements = getFocusableElements(params.focusCancel);
1075
+ var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
1076
+ for (var _i4 = 0; _i4 < focusableElements.length; _i4++) {
1077
+ if (targetElement === focusableElements[_i4]) {
1078
+ btnIndex = _i4;
1079
+ break;
1080
  }
1081
+ }
1082
 
1083
+ // TAB
1084
+ if (keyCode === 9) {
1085
+ if (!e.shiftKey) {
1086
+ // Cycle to the next button
1087
+ setFocus(btnIndex, 1);
1088
+ } else {
1089
+ // Cycle to the prev button
1090
+ setFocus(btnIndex, -1);
1091
+ }
1092
+ e.stopPropagation();
1093
+ e.preventDefault();
1094
+
1095
+ // ARROWS - switch focus between buttons
1096
+ } else if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) {
1097
+ // focus Cancel button if Confirm button is currently focused
1098
+ if (document.activeElement === confirmButton && isVisible(cancelButton)) {
1099
+ cancelButton.focus();
1100
+ // and vice versa
1101
+ } else if (document.activeElement === cancelButton && isVisible(confirmButton)) {
1102
+ confirmButton.focus();
1103
+ }
1104
+
1105
+ // ENTER/SPACE
1106
+ } else if (keyCode === 13 || keyCode === 32) {
1107
+ if (btnIndex === -1 && params.allowEnterKey) {
1108
+ // ENTER/SPACE clicked outside of a button.
1109
+ if (params.focusCancel) {
1110
+ fireClick(cancelButton, e);
1111
  } else {
1112
+ fireClick(confirmButton, e);
 
1113
  }
1114
+ e.stopPropagation();
1115
+ e.preventDefault();
1116
+ }
1117
 
1118
+ // ESC
1119
+ } else if (keyCode === 27 && params.allowEscapeKey === true) {
1120
+ sweetAlert.closeModal(params.onClose);
1121
+ if (params.useRejections) {
1122
+ reject('esc');
1123
  } else {
1124
+ resolve({ dismiss: 'esc' });
 
 
 
 
 
 
 
 
1125
  }
1126
  }
1127
+ };
1128
 
1129
+ if (!window.onkeydown || window.onkeydown.toString() !== handleKeyDown.toString()) {
1130
  states.previousWindowKeyDown = window.onkeydown;
1131
  window.onkeydown = handleKeyDown;
1132
+ }
1133
 
1134
+ // Loading state
1135
+ if (params.buttonsStyling) {
1136
+ confirmButton.style.borderLeftColor = params.confirmButtonColor;
1137
+ confirmButton.style.borderRightColor = params.confirmButtonColor;
1138
+ }
1139
 
1140
+ /**
1141
+ * Show spinner instead of Confirm button and disable Cancel button
1142
+ */
1143
+ sweetAlert.hideLoading = sweetAlert.disableLoading = function () {
1144
+ if (!params.showConfirmButton) {
1145
+ hide(confirmButton);
1146
+ if (!params.showCancelButton) {
1147
+ hide(getButtonsWrapper());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1148
  }
1149
+ }
1150
+ removeClass(buttonsWrapper, swalClasses.loading);
1151
+ removeClass(modal, swalClasses.loading);
1152
+ confirmButton.disabled = false;
1153
+ cancelButton.disabled = false;
1154
+ };
1155
 
1156
+ sweetAlert.getTitle = function () {
1157
+ return getTitle();
1158
+ };
1159
+ sweetAlert.getContent = function () {
1160
+ return getContent();
1161
+ };
1162
+ sweetAlert.getInput = function () {
1163
+ return getInput();
1164
+ };
1165
+ sweetAlert.getImage = function () {
1166
+ return getImage();
1167
+ };
1168
+ sweetAlert.getButtonsWrapper = function () {
1169
+ return getButtonsWrapper();
1170
+ };
1171
+ sweetAlert.getConfirmButton = function () {
1172
+ return getConfirmButton();
1173
+ };
1174
+ sweetAlert.getCancelButton = function () {
1175
+ return getCancelButton();
1176
+ };
1177
 
1178
+ sweetAlert.enableButtons = function () {
1179
+ confirmButton.disabled = false;
1180
+ cancelButton.disabled = false;
1181
+ };
1182
 
1183
+ sweetAlert.disableButtons = function () {
1184
+ confirmButton.disabled = true;
1185
+ cancelButton.disabled = true;
1186
+ };
1187
 
1188
+ sweetAlert.enableConfirmButton = function () {
1189
+ confirmButton.disabled = false;
1190
+ };
1191
 
1192
+ sweetAlert.disableConfirmButton = function () {
1193
+ confirmButton.disabled = true;
1194
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1195
 
1196
+ sweetAlert.enableInput = function () {
1197
+ var input = getInput();
1198
+ if (!input) {
1199
+ return false;
1200
+ }
1201
+ if (input.type === 'radio') {
1202
+ var radiosContainer = input.parentNode.parentNode;
1203
+ var radios = radiosContainer.querySelectorAll('input');
1204
+ for (var _i5 = 0; _i5 < radios.length; _i5++) {
1205
+ radios[_i5].disabled = false;
1206
  }
1207
+ } else {
1208
+ input.disabled = false;
1209
+ }
1210
+ };
1211
 
1212
+ sweetAlert.disableInput = function () {
1213
+ var input = getInput();
1214
+ if (!input) {
1215
+ return false;
1216
  }
1217
+ if (input && input.type === 'radio') {
1218
+ var radiosContainer = input.parentNode.parentNode;
1219
+ var radios = radiosContainer.querySelectorAll('input');
1220
+ for (var _i6 = 0; _i6 < radios.length; _i6++) {
1221
+ radios[_i6].disabled = true;
1222
+ }
1223
+ } else {
1224
+ input.disabled = true;
1225
+ }
1226
+ };
1227
 
1228
+ // Set modal min-height to disable scrolling inside the modal
1229
+ sweetAlert.recalculateHeight = debounce(function () {
1230
+ var modal = getModal();
1231
+ if (!modal) {
1232
+ return;
1233
+ }
1234
+ var prevState = modal.style.display;
1235
+ modal.style.minHeight = '';
1236
+ show(modal);
1237
+ modal.style.minHeight = modal.scrollHeight + 1 + 'px';
1238
+ modal.style.display = prevState;
1239
+ }, 50);
1240
+
1241
+ // Show block with validation error
1242
+ sweetAlert.showValidationError = function (error) {
1243
+ var validationError = getValidationError();
1244
+ validationError.innerHTML = error;
1245
+ show(validationError);
1246
+
1247
+ var input = getInput();
1248
+ if (input) {
1249
+ focusInput(input);
1250
+ addClass(input, swalClasses.inputerror);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1251
  }
1252
+ };
1253
 
1254
+ // Hide block with validation error
1255
+ sweetAlert.resetValidationError = function () {
1256
+ var validationError = getValidationError();
1257
+ hide(validationError);
1258
+ sweetAlert.recalculateHeight();
1259
+
1260
+ var input = getInput();
1261
+ if (input) {
1262
+ removeClass(input, swalClasses.inputerror);
 
 
 
1263
  }
1264
+ };
1265
 
1266
+ sweetAlert.getProgressSteps = function () {
1267
+ return params.progressSteps;
1268
+ };
1269
 
1270
+ sweetAlert.setProgressSteps = function (progressSteps) {
1271
+ params.progressSteps = progressSteps;
1272
+ setParameters(params);
1273
+ };
1274
+
1275
+ sweetAlert.showProgressSteps = function () {
1276
+ show(getProgressSteps());
1277
+ };
1278
 
1279
+ sweetAlert.hideProgressSteps = function () {
1280
+ hide(getProgressSteps());
1281
+ };
 
 
1282
 
1283
+ sweetAlert.enableButtons();
1284
+ sweetAlert.hideLoading();
1285
+ sweetAlert.resetValidationError();
1286
+
1287
+ // inputs
1288
+ var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
1289
+ var input = void 0;
1290
+ for (var _i7 = 0; _i7 < inputTypes.length; _i7++) {
1291
+ var inputClass = swalClasses[inputTypes[_i7]];
1292
+ var inputContainer = getChildByClass(modal, inputClass);
1293
+ input = getInput(inputTypes[_i7]);
1294
+
1295
+ // set attributes
1296
+ if (input) {
1297
+ for (var j in input.attributes) {
1298
+ if (input.attributes.hasOwnProperty(j)) {
1299
+ var attrName = input.attributes[j].name;
1300
+ if (attrName !== 'type' && attrName !== 'value') {
1301
+ input.removeAttribute(attrName);
1302
+ }
1303
+ }
1304
+ }
1305
+ for (var attr in params.inputAttributes) {
1306
+ input.setAttribute(attr, params.inputAttributes[attr]);
1307
+ }
1308
+ }
1309
+
1310
+ // set class
1311
+ inputContainer.className = inputClass;
1312
+ if (params.inputClass) {
1313
+ addClass(inputContainer, params.inputClass);
1314
+ }
1315
+
1316
+ hide(inputContainer);
1317
  }
1318
 
1319
+ var populateInputOptions = void 0;
1320
+ switch (params.input) {
1321
+ case 'text':
1322
+ case 'email':
1323
+ case 'password':
1324
+ case 'number':
1325
+ case 'tel':
1326
+ case 'url':
1327
+ input = getChildByClass(modal, swalClasses.input);
1328
+ input.value = params.inputValue;
1329
+ input.placeholder = params.inputPlaceholder;
1330
+ input.type = params.input;
1331
+ show(input);
1332
+ break;
1333
+ case 'file':
1334
+ input = getChildByClass(modal, swalClasses.file);
1335
+ input.placeholder = params.inputPlaceholder;
1336
+ input.type = params.input;
1337
+ show(input);
1338
+ break;
1339
+ case 'range':
1340
+ var range = getChildByClass(modal, swalClasses.range);
1341
+ var rangeInput = range.querySelector('input');
1342
+ var rangeOutput = range.querySelector('output');
1343
+ rangeInput.value = params.inputValue;
1344
+ rangeInput.type = params.input;
1345
+ rangeOutput.value = params.inputValue;
1346
+ show(range);
1347
+ break;
1348
+ case 'select':
1349
+ var select = getChildByClass(modal, swalClasses.select);
1350
+ select.innerHTML = '';
1351
+ if (params.inputPlaceholder) {
1352
+ var placeholder = document.createElement('option');
1353
+ placeholder.innerHTML = params.inputPlaceholder;
1354
+ placeholder.value = '';
1355
+ placeholder.disabled = true;
1356
+ placeholder.selected = true;
1357
+ select.appendChild(placeholder);
1358
+ }
1359
+ populateInputOptions = function populateInputOptions(inputOptions) {
1360
+ for (var optionValue in inputOptions) {
1361
+ var option = document.createElement('option');
1362
+ option.value = optionValue;
1363
+ option.innerHTML = inputOptions[optionValue];
1364
+ if (params.inputValue === optionValue) {
1365
+ option.selected = true;
1366
+ }
1367
+ select.appendChild(option);
1368
+ }
1369
+ show(select);
1370
+ select.focus();
1371
+ };
1372
+ break;
1373
+ case 'radio':
1374
+ var radio = getChildByClass(modal, swalClasses.radio);
1375
+ radio.innerHTML = '';
1376
+ populateInputOptions = function populateInputOptions(inputOptions) {
1377
+ for (var radioValue in inputOptions) {
1378
+ var radioInput = document.createElement('input');
1379
+ var radioLabel = document.createElement('label');
1380
+ var radioLabelSpan = document.createElement('span');
1381
+ radioInput.type = 'radio';
1382
+ radioInput.name = swalClasses.radio;
1383
+ radioInput.value = radioValue;
1384
+ if (params.inputValue === radioValue) {
1385
+ radioInput.checked = true;
1386
+ }
1387
+ radioLabelSpan.innerHTML = inputOptions[radioValue];
1388
+ radioLabel.appendChild(radioInput);
1389
+ radioLabel.appendChild(radioLabelSpan);
1390
+ radioLabel.for = radioInput.id;
1391
+ radio.appendChild(radioLabel);
1392
+ }
1393
+ show(radio);
1394
+ var radios = radio.querySelectorAll('input');
1395
+ if (radios.length) {
1396
+ radios[0].focus();
1397
+ }
1398
+ };
1399
+ break;
1400
+ case 'checkbox':
1401
+ var checkbox = getChildByClass(modal, swalClasses.checkbox);
1402
+ var checkboxInput = getInput('checkbox');
1403
+ checkboxInput.type = 'checkbox';
1404
+ checkboxInput.value = 1;
1405
+ checkboxInput.id = swalClasses.checkbox;
1406
+ checkboxInput.checked = Boolean(params.inputValue);
1407
+ var label = checkbox.getElementsByTagName('span');
1408
+ if (label.length) {
1409
+ checkbox.removeChild(label[0]);
1410
+ }
1411
+ label = document.createElement('span');
1412
+ label.innerHTML = params.inputPlaceholder;
1413
+ checkbox.appendChild(label);
1414
+ show(checkbox);
1415
+ break;
1416
+ case 'textarea':
1417
+ var textarea = getChildByClass(modal, swalClasses.textarea);
1418
+ textarea.value = params.inputValue;
1419
+ textarea.placeholder = params.inputPlaceholder;
1420
+ show(textarea);
1421
+ break;
1422
+ case null:
1423
+ break;
1424
+ default:
1425
+ console.error('SweetAlert2: Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "' + params.input + '"');
1426
+ break;
1427
  }
1428
 
1429
+ if (params.input === 'select' || params.input === 'radio') {
1430
+ if (params.inputOptions instanceof Promise) {
1431
+ sweetAlert.showLoading();
1432
+ params.inputOptions.then(function (inputOptions) {
1433
+ sweetAlert.hideLoading();
1434
+ populateInputOptions(inputOptions);
1435
+ });
1436
+ } else if (_typeof(params.inputOptions) === 'object') {
1437
+ populateInputOptions(params.inputOptions);
1438
+ } else {
1439
+ console.error('SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got ' + _typeof(params.inputOptions));
1440
+ }
1441
+ }
1442
 
1443
+ openModal(params.animation, params.onOpen);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1444
 
1445
+ // Focus the first element (input or button)
1446
+ if (params.allowEnterKey) {
1447
+ setFocus(-1, 1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1448
  } else {
1449
+ if (document.activeElement) {
1450
+ document.activeElement.blur();
1451
+ }
1452
  }
1453
+
1454
+ // fix scroll
1455
+ getContainer().scrollTop = 0;
1456
+
1457
+ // Observe changes inside the modal and adjust height
1458
+ if (typeof MutationObserver !== 'undefined' && !swal2Observer) {
1459
+ swal2Observer = new MutationObserver(sweetAlert.recalculateHeight);
1460
+ swal2Observer.observe(modal, { childList: true, characterData: true, subtree: true });
1461
  }
1462
+ });
1463
+ };
1464
 
1465
+ /*
1466
+ * Global function to determine if swal2 modal is shown
1467
+ */
1468
+ sweetAlert.isVisible = function () {
1469
+ return !!getModal();
1470
+ };
1471
 
1472
+ /*
1473
+ * Global function for chaining sweetAlert modals
1474
+ */
1475
+ sweetAlert.queue = function (steps) {
1476
+ queue = steps;
1477
+ var resetQueue = function resetQueue() {
1478
+ queue = [];
1479
+ document.body.removeAttribute('data-swal2-queue-step');
1480
  };
1481
+ var queueResult = [];
1482
+ return new Promise(function (resolve, reject) {
1483
+ (function step(i, callback) {
1484
+ if (i < queue.length) {
1485
+ document.body.setAttribute('data-swal2-queue-step', i);
1486
+
1487
+ sweetAlert(queue[i]).then(function (result) {
1488
+ queueResult.push(result);
1489
+ step(i + 1, callback);
1490
+ }, function (dismiss) {
1491
+ resetQueue();
1492
+ reject(dismiss);
1493
+ });
1494
+ } else {
1495
+ resetQueue();
1496
+ resolve(queueResult);
1497
+ }
1498
+ })(0);
1499
+ });
1500
+ };
1501
 
1502
+ /*
1503
+ * Global function for getting the index of current modal in queue
1504
+ */
1505
+ sweetAlert.getQueueStep = function () {
1506
+ return document.body.getAttribute('data-swal2-queue-step');
1507
+ };
 
 
 
 
1508
 
1509
+ /*
1510
+ * Global function for inserting a modal to the queue
1511
+ */
1512
+ sweetAlert.insertQueueStep = function (step, index) {
1513
+ if (index && index < queue.length) {
1514
+ return queue.splice(index, 0, step);
1515
+ }
1516
+ return queue.push(step);
1517
+ };
1518
 
1519
+ /*
1520
+ * Global function for deleting a modal from the queue
1521
+ */
1522
+ sweetAlert.deleteQueueStep = function (index) {
1523
+ if (typeof queue[index] !== 'undefined') {
1524
+ queue.splice(index, 1);
1525
+ }
1526
+ };
1527
 
1528
+ /*
1529
+ * Global function to close sweetAlert
1530
+ */
1531
+ sweetAlert.close = sweetAlert.closeModal = function (onComplete) {
1532
+ var container = getContainer();
1533
+ var modal = getModal();
1534
+ if (!modal) {
1535
+ return;
1536
+ }
1537
+ removeClass(modal, swalClasses.show);
1538
+ addClass(modal, swalClasses.hide);
1539
+ clearTimeout(modal.timeout);
1540
 
1541
+ resetPrevState();
 
 
 
 
1542
 
1543
+ var removeModalAndResetState = function removeModalAndResetState() {
1544
+ if (container.parentNode) {
1545
+ container.parentNode.removeChild(container);
1546
+ }
1547
+ removeClass(document.documentElement, swalClasses.shown);
1548
+ removeClass(document.body, swalClasses.shown);
1549
+ undoScrollbar();
1550
+ undoIOSfix();
1551
+ };
1552
 
1553
+ // If animation is supported, animate
1554
+ if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
1555
+ modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
1556
+ modal.removeEventListener(animationEndEvent, swalCloseEventFinished);
1557
+ if (hasClass(modal, swalClasses.hide)) {
1558
+ removeModalAndResetState();
1559
  }
1560
+ });
1561
+ } else {
1562
+ // Otherwise, remove immediately
1563
+ removeModalAndResetState();
1564
+ }
1565
+ if (onComplete !== null && typeof onComplete === 'function') {
1566
+ setTimeout(function () {
1567
+ onComplete(modal);
1568
+ });
1569
+ }
1570
+ };
1571
 
1572
+ /*
1573
+ * Global function to click 'Confirm' button
1574
+ */
1575
+ sweetAlert.clickConfirm = function () {
1576
+ return getConfirmButton().click();
1577
+ };
1578
 
1579
+ /*
1580
+ * Global function to click 'Cancel' button
1581
+ */
1582
+ sweetAlert.clickCancel = function () {
1583
+ return getCancelButton().click();
1584
+ };
1585
 
1586
+ /**
1587
+ * Show spinner instead of Confirm button and disable Cancel button
1588
+ */
1589
+ sweetAlert.showLoading = sweetAlert.enableLoading = function () {
1590
+ var modal = getModal();
1591
+ if (!modal) {
1592
+ sweetAlert('');
1593
+ }
1594
+ var buttonsWrapper = getButtonsWrapper();
1595
+ var confirmButton = getConfirmButton();
1596
+ var cancelButton = getCancelButton();
1597
+
1598
+ show(buttonsWrapper);
1599
+ show(confirmButton, 'inline-block');
1600
+ addClass(buttonsWrapper, swalClasses.loading);
1601
+ addClass(modal, swalClasses.loading);
1602
+ confirmButton.disabled = true;
1603
+ cancelButton.disabled = true;
1604
+ };
1605
+
1606
+ /**
1607
+ * Set default params for each popup
1608
+ * @param {Object} userParams
1609
+ */
1610
+ sweetAlert.setDefaults = function (userParams) {
1611
+ if (!userParams || (typeof userParams === 'undefined' ? 'undefined' : _typeof(userParams)) !== 'object') {
1612
+ return console.error('SweetAlert2: the argument for setDefaults() is required and has to be a object');
1613
+ }
1614
 
1615
+ for (var param in userParams) {
1616
+ if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
1617
+ console.warn('SweetAlert2: Unknown parameter "' + param + '"');
1618
+ delete userParams[param];
 
 
 
 
 
 
1619
  }
1620
+ }
1621
 
1622
+ _extends(modalParams, userParams);
1623
+ };
1624
 
1625
+ /**
1626
+ * Reset default params for each popup
1627
+ */
1628
+ sweetAlert.resetDefaults = function () {
1629
+ modalParams = _extends({}, defaultParams);
1630
+ };
1631
 
1632
+ sweetAlert.noop = function () {};
1633
 
1634
+ sweetAlert.version = '6.6.6';
1635
 
1636
+ sweetAlert.default = sweetAlert;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1637
 
1638
+ return sweetAlert;
1639
 
1640
+ })));
1641
+ if (window.Sweetalert2) window.sweetAlert = window.swal = window.Sweetalert2;
assets/js/sweetalert2.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";function e(){if(void 0===arguments[0])return console.error("SweetAlert2 expects at least 1 attribute!"),!1;var e=c({},H);switch(typeof arguments[0]){case"string":e.title=arguments[0],e.text=arguments[1]||"",e.type=arguments[2]||"";break;case"object":c(e,arguments[0]),e.extraParams=arguments[0].extraParams,"email"===e.input&&null===e.inputValidator&&(e.inputValidator=function(e){return new Promise(function(t,n){var o=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;o.test(e)?t():n("Invalid email address")})});break;default:return console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]),!1}N(e);var o=f();return new Promise(function(r,a){function l(e,t){for(var n=0;n<V.length;n++)if(e+=t,e===V.length?e=0:-1===e&&(e=V.length-1),V[e].offsetWidth||V[e].offsetHeight||V[e].getClientRects().length)return void V[e].focus()}function c(n){var o=n||window.event,i=o.keyCode||o.which;if(-1!==[9,13,32,27].indexOf(i)){for(var r=o.target||o.srcElement,c=-1,s=0;s<V.length;s++)if(r===V[s]){c=s;break}9===i?(o.shiftKey?l(c,-1):l(c,1),T(o)):13===i||32===i?-1===c&&P(M,o):27===i&&e.allowEscapeKey===!0&&(t.closeModal(e.onClose),a("esc"))}}e.timer&&(o.timeout=setTimeout(function(){t.closeModal(e.onClose),a("timer")},e.timer));var u=function(){switch(e.input){case"select":return k(o,i.select);case"radio":return o.querySelector("."+i.radio+" input:checked")||o.querySelector("."+i.radio+" input:first-child");case"checkbox":return o.querySelector("#"+i.checkbox);case"textarea":return k(o,i.textarea);default:return k(o,i.input)}},p=function(){var t=u();switch(e.input){case"checkbox":return t.checked?1:0;case"radio":return t.checked?t.value:null;case"file":return t.files.length?t.files[0]:null;default:return e.inputAutoTrim?t.value.trim():t.value}};e.input&&setTimeout(function(){var e=u();e&&g(e)},0);var f,A=function(n){e.showLoaderOnConfirm&&t.showLoading(),e.preConfirm?e.preConfirm(n,e.extraParams).then(function(o){t.closeModal(e.onClose),r(o||n)},function(e){t.hideLoading(),e&&t.showValidationError(e)}):(t.closeModal(e.onClose),r(n))},L=function(n){var i=n||window.event,r=i.target||i.srcElement,l=v(),c=y(),u=l===r||l.contains(r),d=c===r||c.contains(r),f=b(o,"visible");switch(i.type){case"mouseover":case"mouseup":e.buttonsStyling&&(u?l.style.backgroundColor=s(e.confirmButtonColor,-.1):d&&(c.style.backgroundColor=s(e.cancelButtonColor,-.1)));break;case"mouseout":e.buttonsStyling&&(u?l.style.backgroundColor=e.confirmButtonColor:d&&(c.style.backgroundColor=e.cancelButtonColor));break;case"mousedown":e.buttonsStyling&&(u?l.style.backgroundColor=s(e.confirmButtonColor,-.2):d&&(c.style.backgroundColor=s(e.cancelButtonColor,-.2)));break;case"click":if(u&&f)if(e.input){var m=p();e.inputValidator?(t.disableInput(),e.inputValidator(m,e.extraParams).then(function(){t.enableInput(),A(m)},function(e){t.enableInput(),e&&t.showValidationError(e)})):A(m)}else A(!0);else d&&f&&(t.closeModal(e.onClose),a("cancel"))}},q=o.querySelectorAll("button");for(f=0;f<q.length;f++)q[f].onclick=L,q[f].onmouseover=L,q[f].onmouseout=L,q[f].onmousedown=L;h().onclick=function(){t.closeModal(e.onClose),a("close")},m().onclick=function(){e.allowOutsideClick&&(t.closeModal(e.onClose),a("overlay"))};var M=v(),O=y(),V=[M,O].concat(Array.prototype.slice.call(o.querySelectorAll("button:not([class^="+n+"]), input:not([type=hidden]), textarea, select")));e.reverseButtons&&M.parentNode.insertBefore(O,M),d.previousWindowKeyDown=window.onkeydown,window.onkeydown=c,e.buttonsStyling&&(M.style.borderLeftColor=e.confirmButtonColor,M.style.borderRightColor=e.confirmButtonColor),t.showLoading=t.enableLoading=function(){w(M,"loading"),w(o,"loading"),M.disabled=!0,O.disabled=!0},t.hideLoading=t.disableLoading=function(){C(M,"loading"),C(o,"loading"),M.disabled=!1,O.disabled=!1},t.enableButtons=function(){M.disabled=!1,O.disabled=!1},t.disableButtons=function(){M.disabled=!0,O.disabled=!0},t.enableConfirmButton=function(){M.disabled=!1},t.disableConfirmButton=function(){M.disabled=!0},t.enableInput=function(){var e=u();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!1;else e.disabled=!1},t.disableInput=function(){var e=u();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!0;else e.disabled=!0},t.showValidationError=function(e){var t=o.querySelector("."+i.validationerror);t.innerHTML=e,E(t);var n=u();g(n),w(n,"error")},t.resetValidationError=function(){var e=o.querySelector("."+i.validationerror);B(e);var t=u();t&&C(t,"error")},t.enableButtons(),t.hideLoading(),t.resetValidationError();var H,N=["input","select","radio","checkbox","textarea"];for(f=0;f<N.length;f++){var j=i[N[f]];for(H=k(o,j);H.attributes.length>0;)H.removeAttribute(H.attributes[0].name);for(var K in e.inputAttributes)H.setAttribute(K,e.inputAttributes[K]);H.className=j,e.inputClass&&w(H,e.inputClass),S(H)}var U;switch(e.input){case"text":case"email":case"password":case"file":H=k(o,i.input),H.value=e.inputValue,H.placeholder=e.inputPlaceholder,H.type=e.input,x(H);break;case"select":var W=k(o,i.select);if(W.innerHTML="",e.inputPlaceholder){var z=document.createElement("option");z.innerHTML=e.inputPlaceholder,z.value="",z.disabled=!0,z.selected=!0,W.appendChild(z)}U=function(t){for(var n in t){var o=document.createElement("option");o.value=n,o.innerHTML=t[n],e.inputValue===n&&(o.selected=!0),W.appendChild(o)}x(W),W.focus()};break;case"radio":var R=k(o,i.radio);R.innerHTML="",U=function(t){for(var n in t){var o=1,r=document.createElement("input"),a=document.createElement("label"),l=document.createElement("span");r.type="radio",r.name=i.radio,r.value=n,r.id=i.radio+"-"+o++,e.inputValue===n&&(r.checked=!0),l.innerHTML=t[n],a.appendChild(r),a.appendChild(l),a["for"]=r.id,R.appendChild(a)}x(R);var c=R.querySelectorAll("input");c.length&&c[0].focus()};break;case"checkbox":var Z=k(o,i.checkbox),$=o.querySelector("#"+i.checkbox);$.value=1,$.checked=Boolean(e.inputValue);var _=Z.getElementsByTagName("span");_.length&&Z.removeChild(_[0]),_=document.createElement("span"),_.innerHTML=e.inputPlaceholder,Z.appendChild(_),x(Z);break;case"textarea":var F=k(o,i.textarea);F.value=e.inputValue,F.placeholder=e.inputPlaceholder,x(F);break;case null:break;default:console.error('SweetAlert2: Unexpected type of input! Expected "text" or "email" or "password", "select", "checkbox", "textarea" or "file", got "'+e.input+'"')}"select"!==e.input&&"radio"!==e.input||(e.inputOptions instanceof Promise?(t.showLoading(),e.inputOptions.then(function(e){t.hideLoading(),U(e)})):"object"==typeof e.inputOptions?U(e.inputOptions):console.error("SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+typeof e.inputOptions)),I(),D(e.animation,e.onOpen),l(-1,1)})}function t(){var n=arguments,o=f();return null===o&&(t.init(),o=f()),b(o,"visible")&&V(),e.apply(this,n)}var n="swal2-",o=function(e){var t={};for(var o in e)t[e[o]]=n+e[o];return t},i=o(["container","modal","overlay","close","content","spacer","confirm","cancel","icon","image","input","select","radio","checkbox","textarea","validationerror"]),r=o(["success","warning","info","question","error"]),a={title:"",text:"",html:"",type:null,animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,onOpen:null,onClose:null},l='<div class="'+i.overlay+'" tabIndex="-1"></div><div class="'+i.modal+'" style="display: none" tabIndex="-1"><div class="'+i.icon+" "+r.error+'"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="'+i.icon+" "+r.question+'">?</div><div class="'+i.icon+" "+r.warning+'">!</div><div class="'+i.icon+" "+r.info+'">i</div><div class="'+i.icon+" "+r.success+'"><span class="line tip"></span> <span class="line long"></span><div class="placeholder"></div> <div class="fix"></div></div><img class="'+i.image+'"><h2></h2><div class="'+i.content+'"></div><input class="'+i.input+'"><select class="'+i.select+'"></select><div class="'+i.radio+'"></div><label for="'+i.checkbox+'" class="'+i.checkbox+'"><input type="checkbox" id="'+i.checkbox+'"></label><textarea class="'+i.textarea+'"></textarea><div class="'+i.validationerror+'"></div><hr class="'+i.spacer+'"><button class="'+i.confirm+'">OK</button><button class="'+i.cancel+'">Cancel</button><span class="'+i.close+'">&times;</span></div>',c=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},s=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;3>o;o++){var i=parseInt(e.substr(2*o,2),16);i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16),n+=("00"+i).substr(i.length)}return n},u=n+"mediaquery",d={previousWindowKeyDown:null,previousActiveElement:null},p=function(e){return document.querySelector("."+e)},f=function(){return p(i.modal)},m=function(){return p(i.overlay)},v=function(){return p(i.confirm)},y=function(){return p(i.cancel)},h=function(){return p(i.close)},b=function(e,t){return e.classList.contains(t)},g=function(e){e.focus();var t=e.value;e.value="",e.value=t},w=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.add(t)})}},C=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.remove(t)})}},k=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(b(e.childNodes[n],t))return e.childNodes[n]},x=function(e){e.style.opacity="",e.style.display="block"},E=function(e){if(e&&!e.length)return x(e);for(var t=0;t<e.length;++t)x(e[t])},S=function(e){e.style.opacity="",e.style.display="none"},B=function(e){if(e&&!e.length)return S(e);for(var t=0;t<e.length;++t)S(e[t])},A=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},L=function(e){var t=e.style.display;e.style.left="-9999px",e.style.display="block";var n=e.clientHeight;return e.style.left="",e.style.display=t,"-"+parseInt(n/2,10)+"px"},q=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var n=+new Date,o=function(){var i=+e.style.opacity+(new Date-n)/100;e.style.opacity=i>1?1:i,n=+new Date,+e.style.opacity<1&&setTimeout(o,t)};o()}},M=function(e,t){if(+e.style.opacity>0){t=t||16;var n=e.style.opacity,o=+new Date,i=function(){var r=new Date-o,a=+e.style.opacity-r/(100*n);e.style.opacity=a,o=+new Date,+e.style.opacity>0?setTimeout(i,t):S(e)};i()}},P=function(e){if("function"==typeof MouseEvent){var t=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});e.dispatchEvent(t)}else if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),e.dispatchEvent(n)}else document.createEventObject?e.fireEvent("onclick"):"function"==typeof e.onclick&&e.onclick()},T=function(e){"function"==typeof e.stopPropagation?(e.stopPropagation(),e.preventDefault()):window.event&&window.event.hasOwnProperty("cancelBubble")&&(window.event.cancelBubble=!0)},O=function(){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),V=function(){var e=f();window.onkeydown=d.previousWindowKeyDown,d.previousActiveElement&&d.previousActiveElement.focus(),clearTimeout(e.timeout);var t=document.getElementsByTagName("head")[0],n=document.getElementById(u);n&&t.removeChild(n)},H=c({},a),N=function(e){var t=f();for(var n in e)a.hasOwnProperty(n)||"extraParams"===n||console.warn('SweetAlert2: Unknown parameter "'+n+'"');t.style.width=e.width+"px",t.style.padding=e.padding+"px",t.style.marginLeft=-e.width/2+"px",t.style.background=e.background;var o=document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css",l.id=u;var c=5,s=e.width+parseInt(e.width*(c/100)*2,10);l.innerHTML="@media screen and (max-width: "+s+"px) {."+i.modal+" {width: auto !important;left: "+c+"% !important;right: "+c+"% !important;margin-left: 0 !important;}}",o.appendChild(l);var d=t.querySelector("h2"),p=t.querySelector("."+i.content),m=v(),h=y(),b=t.querySelector("."+i.spacer),g=t.querySelector("."+i.close);if(d.innerHTML=e.title.split("\n").join("<br>"),e.text||e.html){if("object"==typeof e.html)if(p.innerHTML="",0 in e.html)for(var k=0;k in e.html;k++)p.appendChild(e.html[k]);else p.appendChild(e.html);else p.innerHTML=e.html||e.text.split("\n").join("<br>");E(p)}else B(p);if(e.showCloseButton?E(g):B(g),t.className=i.modal,e.customClass&&w(t,e.customClass),B(t.querySelectorAll("."+i.icon)),e.type){var x=!1;for(var S in r)if(e.type===S){x=!0;break}if(!x)return console.error("SweetAlert2: Unknown alert type: "+e.type),!1;var L=t.querySelector("."+i.icon+"."+r[e.type]);switch(E(L),e.type){case"success":w(L,"animate"),w(L.querySelector(".tip"),"animate-success-tip"),w(L.querySelector(".long"),"animate-success-long");break;case"error":w(L,"animate-error-icon"),w(L.querySelector(".x-mark"),"animate-x-mark");break;case"warning":w(L,"pulse-warning")}}var q=t.querySelector("."+i.image);e.imageUrl?(q.setAttribute("src",e.imageUrl),E(q),e.imageWidth?q.setAttribute("width",e.imageWidth):q.removeAttribute("width"),e.imageHeight?q.setAttribute("height",e.imageHeight):q.removeAttribute("height"),e.imageClass&&w(q,e.imageClass)):B(q),e.showCancelButton?h.style.display="inline-block":B(h),e.showConfirmButton?A(m,"display"):B(m),e.showConfirmButton||e.showCancelButton?E(b):B(b),m.innerHTML=e.confirmButtonText,h.innerHTML=e.cancelButtonText,e.buttonsStyling&&(m.style.backgroundColor=e.confirmButtonColor,h.style.backgroundColor=e.cancelButtonColor),m.className=i.confirm,w(m,e.confirmButtonClass),h.className=i.cancel,w(h,e.cancelButtonClass),e.buttonsStyling?(w(m,"styled"),w(h,"styled")):(C(m,"styled"),C(h,"styled"),m.style.backgroundColor=m.style.borderLeftColor=m.style.borderRightColor="",h.style.backgroundColor=h.style.borderLeftColor=h.style.borderRightColor=""),e.animation===!0?C(t,"no-animation"):w(t,"no-animation")},D=function(e,t){var n=f();e?(q(m(),10),w(n,"show-swal2"),C(n,"hide-swal2")):E(m()),E(n),d.previousActiveElement=document.activeElement,w(n,"visible"),null!==t&&"function"==typeof t&&t.call(this,n)},I=function(){var e=f();e.style.marginTop=L(e)};return t.queue=function(e){return new Promise(function(n,o){!function i(r,a){r<e.length?t(e[r]).then(function(){i(r+1,a)},function(e){o(e)}):n()}(0)})},t.close=t.closeModal=function(e){var t=f();C(t,"show-swal2"),w(t,"hide-swal2"),C(t,"visible");var n=t.querySelector("."+i.icon+"."+r.success);C(n,"animate"),C(n.querySelector(".tip"),"animate-success-tip"),C(n.querySelector(".long"),"animate-success-long");var o=t.querySelector("."+i.icon+"."+r.error);C(o,"animate-error-icon"),C(o.querySelector(".x-mark"),"animate-x-mark");var a=t.querySelector("."+i.icon+"."+r.warning);C(a,"pulse-warning"),V(),O&&!b(t,"no-animation")?t.addEventListener(O,function l(){t.removeEventListener(O,l),b(t,"hide-swal2")&&(S(t),M(m(),0))}):(S(t),S(m())),null!==e&&"function"==typeof e&&e.call(this,t)},t.clickConfirm=function(){v().click()},t.clickCancel=function(){y().click()},t.init=function(){if("undefined"==typeof document)return void console.log("SweetAlert2 requires document to initialize");if(!document.getElementsByClassName(i.container).length){var e=document.createElement("div");e.className=i.container,e.innerHTML=l,document.body.appendChild(e);var n=f(),o=k(n,i.input),r=k(n,i.select),a=n.querySelector("#"+i.checkbox),c=k(n,i.textarea);o.oninput=function(){t.resetValidationError()},o.onkeyup=function(e){e.stopPropagation(),13===e.keyCode&&t.clickConfirm()},r.onchange=function(){t.resetValidationError()},a.onchange=function(){t.resetValidationError()},c.oninput=function(){t.resetValidationError()},window.addEventListener("resize",I,!1)}},t.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");c(H,e)},t.resetDefaults=function(){H=c({},a)},t.version="4.0.15",window.sweetAlert=window.swal=t,function(){"complete"===document.readyState||"interactive"===document.readyState&&document.body?t.init():document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e,!1),t.init()},!1)}(),"function"==typeof Promise&&(Promise.prototype.done=function(){return this["catch"](function(){})}),t});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";var e={title:"",titleText:"",text:"",html:"",type:null,customClass:"",target:"body",animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusCancel:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,progressSteps:[],currentProgressStep:null,progressStepsDistance:"40px",onOpen:null,onClose:null,useRejections:!0},t=function(e){var t={};for(var n in e)t[e[n]]="swal2-"+e[n];return t},n=t(["container","shown","iosfix","modal","overlay","fade","show","hide","noanimation","close","title","content","buttonswrapper","confirm","cancel","icon","image","input","file","range","select","radio","checkbox","textarea","inputerror","validationerror","progresssteps","activeprogressstep","progresscircle","progressline","loading","styled"]),o=t(["success","warning","info","question","error"]),r=function(e,t){(e=String(e).replace(/[^0-9a-f]/gi,"")).length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;o<3;o++){var r=parseInt(e.substr(2*o,2),16);n+=("00"+(r=Math.round(Math.min(Math.max(0,r+r*t),255)).toString(16))).substr(r.length)}return n},i=function(e){var t=[];for(var n in e)-1===t.indexOf(e[n])&&t.push(e[n]);return t},a={previousWindowKeyDown:null,previousActiveElement:null,previousBodyPadding:null},l=function(e){if("undefined"!=typeof document){var t=document.createElement("div");t.className=n.container,t.innerHTML=s;var o=document.querySelector(e.target);o||(console.warn("SweetAlert2: Can't find the target \""+e.target+'"'),o=document.body),o.appendChild(t);var r=c(),i=A(r,n.input),a=A(r,n.file),l=r.querySelector("."+n.range+" input"),u=r.querySelector("."+n.range+" output"),d=A(r,n.select),p=r.querySelector("."+n.checkbox+" input"),f=A(r,n.textarea);return i.oninput=function(){$.resetValidationError()},i.onkeydown=function(t){setTimeout(function(){13===t.keyCode&&e.allowEnterKey&&(t.stopPropagation(),$.clickConfirm())},0)},a.onchange=function(){$.resetValidationError()},l.oninput=function(){$.resetValidationError(),u.value=l.value},l.onchange=function(){$.resetValidationError(),l.previousSibling.value=l.value},d.onchange=function(){$.resetValidationError()},p.onchange=function(){$.resetValidationError()},f.oninput=function(){$.resetValidationError()},r}console.error("SweetAlert2 requires document to initialize")},s=('\n <div role="dialog" aria-labelledby="'+n.title+'" aria-describedby="'+n.content+'" class="'+n.modal+'" tabindex="-1">\n <ul class="'+n.progresssteps+'"></ul>\n <div class="'+n.icon+" "+o.error+'">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="'+n.icon+" "+o.question+'">?</div>\n <div class="'+n.icon+" "+o.warning+'">!</div>\n <div class="'+n.icon+" "+o.info+'">i</div>\n <div class="'+n.icon+" "+o.success+'">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="'+n.image+'" />\n <h2 class="'+n.title+'" id="'+n.title+'"></h2>\n <div id="'+n.content+'" class="'+n.content+'"></div>\n <input class="'+n.input+'" />\n <input type="file" class="'+n.file+'" />\n <div class="'+n.range+'">\n <output></output>\n <input type="range" />\n </div>\n <select class="'+n.select+'"></select>\n <div class="'+n.radio+'"></div>\n <label for="'+n.checkbox+'" class="'+n.checkbox+'">\n <input type="checkbox" />\n </label>\n <textarea class="'+n.textarea+'"></textarea>\n <div class="'+n.validationerror+'"></div>\n <div class="'+n.buttonswrapper+'">\n <button type="button" class="'+n.confirm+'">OK</button>\n <button type="button" class="'+n.cancel+'">Cancel</button>\n </div>\n <button type="button" class="'+n.close+'" aria-label="Close this dialog">×</button>\n </div>\n').replace(/(^|\n)\s*/g,""),u=function(){return document.body.querySelector("."+n.container)},c=function(){return u()?u().querySelector("."+n.modal):null},d=function(){return c().querySelectorAll("."+n.icon)},p=function(e){return u()?u().querySelector("."+e):null},f=function(){return p(n.title)},m=function(){return p(n.content)},v=function(){return p(n.image)},h=function(){return p(n.buttonswrapper)},g=function(){return p(n.progresssteps)},y=function(){return p(n.validationerror)},b=function(){return p(n.confirm)},w=function(){return p(n.cancel)},C=function(){return p(n.close)},k=function(e){var t=[b(),w()];e&&t.reverse();var n=t.concat(Array.prototype.slice.call(c().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, *[tabindex]:not([tabindex="-1"])')));return i(n)},x=function(e,t){return!!e.classList&&e.classList.contains(t)},S=function(e){if(e.focus(),"file"!==e.type){var t=e.value;e.value="",e.value=t}},E=function(e,t){e&&t&&t.split(/\s+/).filter(Boolean).forEach(function(t){e.classList.add(t)})},B=function(e,t){e&&t&&t.split(/\s+/).filter(Boolean).forEach(function(t){e.classList.remove(t)})},A=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(x(e.childNodes[n],t))return e.childNodes[n]},P=function(e,t){t||(t="block"),e.style.opacity="",e.style.display=t},T=function(e){e.style.opacity="",e.style.display="none"},L=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},M=function(e){return e.offsetWidth||e.offsetHeight||e.getClientRects().length},q=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},V=function(e){if(!M(e))return!1;if("function"==typeof MouseEvent){var t=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});e.dispatchEvent(t)}else if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),e.dispatchEvent(n)}else document.createEventObject?e.fireEvent("onclick"):"function"==typeof e.onclick&&e.onclick()},O=function(){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),H=function(){if(window.onkeydown=a.previousWindowKeyDown,a.previousActiveElement&&a.previousActiveElement.focus){var e=window.scrollX,t=window.scrollY;a.previousActiveElement.focus(),e&&t&&window.scrollTo(e,t)}},N=function(){if("ontouchstart"in window||navigator.msMaxTouchPoints)return 0;var e=document.createElement("div");e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e);var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t},j=function(e,t){var n=void 0;return function(){clearTimeout(n),n=setTimeout(function(){n=null,e()},t)}},R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},K=I({},e),D=[],W=void 0,U=function(t){var r=c()||l(t);for(var i in t)e.hasOwnProperty(i)||"extraParams"===i||console.warn('SweetAlert2: Unknown parameter "'+i+'"');r.style.width="number"==typeof t.width?t.width+"px":t.width,r.style.padding=t.padding+"px",r.style.background=t.background;for(var a=r.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),s=0;s<a.length;s++)a[s].style.background=t.background;var u=f(),p=m(),y=h(),k=b(),x=w(),S=C();if(t.titleText?u.innerText=t.titleText:u.innerHTML=t.title.split("\n").join("<br />"),t.text||t.html){if("object"===R(t.html))if(p.innerHTML="",0 in t.html)for(var A=0;A in t.html;A++)p.appendChild(t.html[A].cloneNode(!0));else p.appendChild(t.html.cloneNode(!0));else t.html?p.innerHTML=t.html:t.text&&(p.textContent=t.text);P(p)}else T(p);t.showCloseButton?P(S):T(S),r.className=n.modal,t.customClass&&E(r,t.customClass);var M=g(),V=parseInt(null===t.currentProgressStep?$.getQueueStep():t.currentProgressStep,10);t.progressSteps.length?(P(M),L(M),V>=t.progressSteps.length&&console.warn("SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),t.progressSteps.forEach(function(e,o){var r=document.createElement("li");if(E(r,n.progresscircle),r.innerHTML=e,o===V&&E(r,n.activeprogressstep),M.appendChild(r),o!==t.progressSteps.length-1){var i=document.createElement("li");E(i,n.progressline),i.style.width=t.progressStepsDistance,M.appendChild(i)}})):T(M);for(var O=d(),H=0;H<O.length;H++)T(O[H]);if(t.type){var N=!1;for(var j in o)if(t.type===j){N=!0;break}if(!N)return console.error("SweetAlert2: Unknown alert type: "+t.type),!1;var I=r.querySelector("."+n.icon+"."+o[t.type]);if(P(I),t.animation)switch(t.type){case"success":E(I,"swal2-animate-success-icon"),E(I.querySelector(".swal2-success-line-tip"),"swal2-animate-success-line-tip"),E(I.querySelector(".swal2-success-line-long"),"swal2-animate-success-line-long");break;case"error":E(I,"swal2-animate-error-icon"),E(I.querySelector(".swal2-x-mark"),"swal2-animate-x-mark")}}var K=v();t.imageUrl?(K.setAttribute("src",t.imageUrl),P(K),t.imageWidth?K.setAttribute("width",t.imageWidth):K.removeAttribute("width"),t.imageHeight?K.setAttribute("height",t.imageHeight):K.removeAttribute("height"),K.className=n.image,t.imageClass&&E(K,t.imageClass)):T(K),t.showCancelButton?x.style.display="inline-block":T(x),t.showConfirmButton?q(k,"display"):T(k),t.showConfirmButton||t.showCancelButton?P(y):T(y),k.innerHTML=t.confirmButtonText,x.innerHTML=t.cancelButtonText,t.buttonsStyling&&(k.style.backgroundColor=t.confirmButtonColor,x.style.backgroundColor=t.cancelButtonColor),k.className=n.confirm,E(k,t.confirmButtonClass),x.className=n.cancel,E(x,t.cancelButtonClass),t.buttonsStyling?(E(k,n.styled),E(x,n.styled)):(B(k,n.styled),B(x,n.styled),k.style.backgroundColor=k.style.borderLeftColor=k.style.borderRightColor="",x.style.backgroundColor=x.style.borderLeftColor=x.style.borderRightColor=""),!0===t.animation?B(r,n.noanimation):E(r,n.noanimation)},z=function(e,t){var o=u(),r=c();e?(E(r,n.show),E(o,n.fade),B(r,n.hide)):B(r,n.fade),P(r),o.style.overflowY="hidden",O&&!x(r,n.noanimation)?r.addEventListener(O,function e(){r.removeEventListener(O,e),o.style.overflowY="auto"}):o.style.overflowY="auto",E(document.documentElement,n.shown),E(document.body,n.shown),E(o,n.shown),Z(),Y(),a.previousActiveElement=document.activeElement,null!==t&&"function"==typeof t&&setTimeout(function(){t(r)})},Z=function(){null===a.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(a.previousBodyPadding=document.body.style.paddingRight,document.body.style.paddingRight=N()+"px")},Q=function(){null!==a.previousBodyPadding&&(document.body.style.paddingRight=a.previousBodyPadding,a.previousBodyPadding=null)},Y=function(){if(/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&!x(document.body,n.iosfix)){var e=document.body.scrollTop;document.body.style.top=-1*e+"px",E(document.body,n.iosfix)}},_=function(){if(x(document.body,n.iosfix)){var e=parseInt(document.body.style.top,10);B(document.body,n.iosfix),document.body.style.top="",document.body.scrollTop=-1*e}},$=function e(){for(var t=arguments.length,o=Array(t),i=0;i<t;i++)o[i]=arguments[i];if(void 0===o[0])return console.error("SweetAlert2 expects at least 1 attribute!"),!1;var l=I({},K);switch(R(o[0])){case"string":l.title=o[0],l.html=o[1],l.type=o[2];break;case"object":I(l,o[0]),l.extraParams=o[0].extraParams,"email"===l.input&&null===l.inputValidator&&(l.inputValidator=function(e){return new Promise(function(t,n){/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/.test(e)?t():n("Invalid email address")})}),"url"===l.input&&null===l.inputValidator&&(l.inputValidator=function(e){return new Promise(function(t,n){/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/.test(e)?t():n("Invalid URL")})});break;default:return console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+R(o[0])),!1}U(l);var s=u(),d=c();return new Promise(function(t,o){l.timer&&(d.timeout=setTimeout(function(){e.closeModal(l.onClose),l.useRejections?o("timer"):t({dismiss:"timer"})},l.timer));var i=function(e){if(!(e=e||l.input))return null;switch(e){case"select":case"textarea":case"file":return A(d,n[e]);case"checkbox":return d.querySelector("."+n.checkbox+" input");case"radio":return d.querySelector("."+n.radio+" input:checked")||d.querySelector("."+n.radio+" input:first-child");case"range":return d.querySelector("."+n.range+" input");default:return A(d,n.input)}},p=function(){var e=i();if(!e)return null;switch(l.input){case"checkbox":return e.checked?1:0;case"radio":return e.checked?e.value:null;case"file":return e.files.length?e.files[0]:null;default:return l.inputAutoTrim?e.value.trim():e.value}};l.input&&setTimeout(function(){var e=i();e&&S(e)},0);for(var x=function(n){l.showLoaderOnConfirm&&e.showLoading(),l.preConfirm?l.preConfirm(n,l.extraParams).then(function(o){e.closeModal(l.onClose),t(o||n)},function(t){e.hideLoading(),t&&e.showValidationError(t)}):(e.closeModal(l.onClose),t(l.useRejections?n:{value:n}))},L=function(n){var i=n||window.event,a=i.target||i.srcElement,s=b(),u=w(),c=s&&(s===a||s.contains(a)),d=u&&(u===a||u.contains(a));switch(i.type){case"mouseover":case"mouseup":l.buttonsStyling&&(c?s.style.backgroundColor=r(l.confirmButtonColor,-.1):d&&(u.style.backgroundColor=r(l.cancelButtonColor,-.1)));break;case"mouseout":l.buttonsStyling&&(c?s.style.backgroundColor=l.confirmButtonColor:d&&(u.style.backgroundColor=l.cancelButtonColor));break;case"mousedown":l.buttonsStyling&&(c?s.style.backgroundColor=r(l.confirmButtonColor,-.2):d&&(u.style.backgroundColor=r(l.cancelButtonColor,-.2)));break;case"click":if(c&&e.isVisible())if(e.disableButtons(),l.input){var f=p();l.inputValidator?(e.disableInput(),l.inputValidator(f,l.extraParams).then(function(){e.enableButtons(),e.enableInput(),x(f)},function(t){e.enableButtons(),e.enableInput(),t&&e.showValidationError(t)})):x(f)}else x(!0);else d&&e.isVisible()&&(e.disableButtons(),e.closeModal(l.onClose),l.useRejections?o("cancel"):t({dismiss:"cancel"}))}},q=d.querySelectorAll("button"),O=0;O<q.length;O++)q[O].onclick=L,q[O].onmouseover=L,q[O].onmouseout=L,q[O].onmousedown=L;C().onclick=function(){e.closeModal(l.onClose),l.useRejections?o("close"):t({dismiss:"close"})},s.onclick=function(n){n.target===s&&l.allowOutsideClick&&(e.closeModal(l.onClose),l.useRejections?o("overlay"):t({dismiss:"overlay"}))};var H=h(),N=b(),I=w();l.reverseButtons?N.parentNode.insertBefore(I,N):N.parentNode.insertBefore(N,I);var K=function(e,t){for(var n=k(l.focusCancel),o=0;o<n.length;o++){(e+=t)===n.length?e=0:-1===e&&(e=n.length-1);var r=n[e];if(M(r))return r.focus()}},D=function(n){var r=n||window.event,i=r.keyCode||r.which;if(-1!==[9,13,32,27,37,38,39,40].indexOf(i)){for(var a=r.target||r.srcElement,s=k(l.focusCancel),u=-1,c=0;c<s.length;c++)if(a===s[c]){u=c;break}9===i?(r.shiftKey?K(u,-1):K(u,1),r.stopPropagation(),r.preventDefault()):37===i||38===i||39===i||40===i?document.activeElement===N&&M(I)?I.focus():document.activeElement===I&&M(N)&&N.focus():13===i||32===i?-1===u&&l.allowEnterKey&&(V(l.focusCancel?I:N),r.stopPropagation(),r.preventDefault()):27===i&&!0===l.allowEscapeKey&&(e.closeModal(l.onClose),l.useRejections?o("esc"):t({dismiss:"esc"}))}};window.onkeydown&&window.onkeydown.toString()===D.toString()||(a.previousWindowKeyDown=window.onkeydown,window.onkeydown=D),l.buttonsStyling&&(N.style.borderLeftColor=l.confirmButtonColor,N.style.borderRightColor=l.confirmButtonColor),e.hideLoading=e.disableLoading=function(){l.showConfirmButton||(T(N),l.showCancelButton||T(h())),B(H,n.loading),B(d,n.loading),N.disabled=!1,I.disabled=!1},e.getTitle=function(){return f()},e.getContent=function(){return m()},e.getInput=function(){return i()},e.getImage=function(){return v()},e.getButtonsWrapper=function(){return h()},e.getConfirmButton=function(){return b()},e.getCancelButton=function(){return w()},e.enableButtons=function(){N.disabled=!1,I.disabled=!1},e.disableButtons=function(){N.disabled=!0,I.disabled=!0},e.enableConfirmButton=function(){N.disabled=!1},e.disableConfirmButton=function(){N.disabled=!0},e.enableInput=function(){var e=i();if(!e)return!1;if("radio"===e.type)for(var t=e.parentNode.parentNode.querySelectorAll("input"),n=0;n<t.length;n++)t[n].disabled=!1;else e.disabled=!1},e.disableInput=function(){var e=i();if(!e)return!1;if(e&&"radio"===e.type)for(var t=e.parentNode.parentNode.querySelectorAll("input"),n=0;n<t.length;n++)t[n].disabled=!0;else e.disabled=!0},e.recalculateHeight=j(function(){var e=c();if(e){var t=e.style.display;e.style.minHeight="",P(e),e.style.minHeight=e.scrollHeight+1+"px",e.style.display=t}},50),e.showValidationError=function(e){var t=y();t.innerHTML=e,P(t);var o=i();o&&(S(o),E(o,n.inputerror))},e.resetValidationError=function(){var t=y();T(t),e.recalculateHeight();var o=i();o&&B(o,n.inputerror)},e.getProgressSteps=function(){return l.progressSteps},e.setProgressSteps=function(e){l.progressSteps=e,U(l)},e.showProgressSteps=function(){P(g())},e.hideProgressSteps=function(){T(g())},e.enableButtons(),e.hideLoading(),e.resetValidationError();for(var Z=["input","file","range","select","radio","checkbox","textarea"],Q=void 0,Y=0;Y<Z.length;Y++){var _=n[Z[Y]],$=A(d,_);if(Q=i(Z[Y])){for(var J in Q.attributes)if(Q.attributes.hasOwnProperty(J)){var X=Q.attributes[J].name;"type"!==X&&"value"!==X&&Q.removeAttribute(X)}for(var F in l.inputAttributes)Q.setAttribute(F,l.inputAttributes[F])}$.className=_,l.inputClass&&E($,l.inputClass),T($)}var G=void 0;switch(l.input){case"text":case"email":case"password":case"number":case"tel":case"url":(Q=A(d,n.input)).value=l.inputValue,Q.placeholder=l.inputPlaceholder,Q.type=l.input,P(Q);break;case"file":(Q=A(d,n.file)).placeholder=l.inputPlaceholder,Q.type=l.input,P(Q);break;case"range":var ee=A(d,n.range),te=ee.querySelector("input"),ne=ee.querySelector("output");te.value=l.inputValue,te.type=l.input,ne.value=l.inputValue,P(ee);break;case"select":var oe=A(d,n.select);if(oe.innerHTML="",l.inputPlaceholder){var re=document.createElement("option");re.innerHTML=l.inputPlaceholder,re.value="",re.disabled=!0,re.selected=!0,oe.appendChild(re)}G=function(e){for(var t in e){var n=document.createElement("option");n.value=t,n.innerHTML=e[t],l.inputValue===t&&(n.selected=!0),oe.appendChild(n)}P(oe),oe.focus()};break;case"radio":var ie=A(d,n.radio);ie.innerHTML="",G=function(e){for(var t in e){var o=document.createElement("input"),r=document.createElement("label"),i=document.createElement("span");o.type="radio",o.name=n.radio,o.value=t,l.inputValue===t&&(o.checked=!0),i.innerHTML=e[t],r.appendChild(o),r.appendChild(i),r.for=o.id,ie.appendChild(r)}P(ie);var a=ie.querySelectorAll("input");a.length&&a[0].focus()};break;case"checkbox":var ae=A(d,n.checkbox),le=i("checkbox");le.type="checkbox",le.value=1,le.id=n.checkbox,le.checked=Boolean(l.inputValue);var se=ae.getElementsByTagName("span");se.length&&ae.removeChild(se[0]),(se=document.createElement("span")).innerHTML=l.inputPlaceholder,ae.appendChild(se),P(ae);break;case"textarea":var ue=A(d,n.textarea);ue.value=l.inputValue,ue.placeholder=l.inputPlaceholder,P(ue);break;case null:break;default:console.error('SweetAlert2: Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'+l.input+'"')}"select"!==l.input&&"radio"!==l.input||(l.inputOptions instanceof Promise?(e.showLoading(),l.inputOptions.then(function(t){e.hideLoading(),G(t)})):"object"===R(l.inputOptions)?G(l.inputOptions):console.error("SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+R(l.inputOptions))),z(l.animation,l.onOpen),l.allowEnterKey?K(-1,1):document.activeElement&&document.activeElement.blur(),u().scrollTop=0,"undefined"==typeof MutationObserver||W||(W=new MutationObserver(e.recalculateHeight)).observe(d,{childList:!0,characterData:!0,subtree:!0})})};return $.isVisible=function(){return!!c()},$.queue=function(e){D=e;var t=function(){D=[],document.body.removeAttribute("data-swal2-queue-step")},n=[];return new Promise(function(e,o){!function r(i,a){i<D.length?(document.body.setAttribute("data-swal2-queue-step",i),$(D[i]).then(function(e){n.push(e),r(i+1,a)},function(e){t(),o(e)})):(t(),e(n))}(0)})},$.getQueueStep=function(){return document.body.getAttribute("data-swal2-queue-step")},$.insertQueueStep=function(e,t){return t&&t<D.length?D.splice(t,0,e):D.push(e)},$.deleteQueueStep=function(e){void 0!==D[e]&&D.splice(e,1)},$.close=$.closeModal=function(e){var t=u(),o=c();if(o){B(o,n.show),E(o,n.hide),clearTimeout(o.timeout),H();var r=function(){t.parentNode&&t.parentNode.removeChild(t),B(document.documentElement,n.shown),B(document.body,n.shown),Q(),_()};O&&!x(o,n.noanimation)?o.addEventListener(O,function e(){o.removeEventListener(O,e),x(o,n.hide)&&r()}):r(),null!==e&&"function"==typeof e&&setTimeout(function(){e(o)})}},$.clickConfirm=function(){return b().click()},$.clickCancel=function(){return w().click()},$.showLoading=$.enableLoading=function(){var e=c();e||$("");var t=h(),o=b(),r=w();P(t),P(o,"inline-block"),E(t,n.loading),E(e,n.loading),o.disabled=!0,r.disabled=!0},$.setDefaults=function(t){if(!t||"object"!==(void 0===t?"undefined":R(t)))return console.error("SweetAlert2: the argument for setDefaults() is required and has to be a object");for(var n in t)e.hasOwnProperty(n)||"extraParams"===n||(console.warn('SweetAlert2: Unknown parameter "'+n+'"'),delete t[n]);I(K,t)},$.resetDefaults=function(){K=I({},e)},$.noop=function(){},$.version="6.6.6",$.default=$,$}),window.Sweetalert2&&(window.sweetAlert=window.swal=window.Sweetalert2);
assets/js/upload.js CHANGED
@@ -1,20 +1,18 @@
1
- /* globals ajaxurl: false, console: false, imagifyUpload: true, Chart: false */
2
-
3
  window.imagify = window.imagify || {
4
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
  log: function( content ) {
6
  if ( undefined !== console ) {
7
- console.log( content );
8
  }
9
  },
10
  info: function( content ) {
11
  if ( undefined !== console ) {
12
- console.info( content );
13
  }
14
  }
15
  };
16
 
17
- (function($, d, w, undefined) {
18
  /**
19
  * Add a "Imagify'em all" in the select list.
20
  */
@@ -35,25 +33,26 @@ window.imagify = window.imagify || {
35
  *
36
  * @param {element} canvas
37
  */
38
- function draw_me_a_chart( canvas ) {
39
  canvas.each( function() {
40
- var the_value = parseInt( $( this ).closest( '.imagify-chart' ).next( '.imagify-chart-value' ).text() ),
 
41
  overviewData = [
42
  {
43
- value: the_value,
44
  color: '#00B3D3'
45
  },
46
  {
47
- value: 100 - the_value,
48
  color: '#D8D8D8'
49
  }
50
  ];
51
 
52
- new Chart( $( this )[0].getContext( '2d' ) ).Doughnut( overviewData, {
53
- segmentStrokeColor : '#FFF',
54
- segmentStrokeWidth : 1,
55
- animateRotate : true,
56
- tooltipEvents : []
57
  } );
58
  } );
59
  }
@@ -67,7 +66,7 @@ window.imagify = window.imagify || {
67
  var value = $( this ).prev( 'select' ).val().split( '-' ),
68
  action, ids;
69
 
70
- if ( value[0] !== 'imagify' ) {
71
  return;
72
  }
73
 
@@ -102,13 +101,13 @@ window.imagify = window.imagify || {
102
  $parent.html( '<div class="button"><span class="imagify-spinner"></span>' + $obj.data( 'waiting-label' ) + '</div>' );
103
 
104
  $.get( href.replace( 'admin-post.php', 'admin-ajax.php' ) )
105
- .done( function( response ){
106
- $parent.html( response.data );
107
- $parent.find( '.imagify-datas-more-action a' ).addClass( 'is-open' ).find( '.the-text' ).text( $parent.find( '.imagify-datas-more-action a' ).data( 'close' ) );
108
- $parent.find( '.imagify-datas-details' ).addClass( 'is-open' );
109
 
110
- draw_me_a_chart( $parent.find( '.imagify-chart-container' ).find( 'canvas' ) );
111
- } );
112
  } );
113
 
114
  /**
@@ -153,7 +152,7 @@ window.imagify = window.imagify || {
153
 
154
  if ( $details.length ) {
155
  $details.hide();
156
- draw_me_a_chart( $( '#imagify-consumption-chart' ) );
157
  clearInterval( tempTimer );
158
  tempTimer = null;
159
  }
@@ -188,6 +187,6 @@ window.imagify = window.imagify || {
188
  }, 100);
189
  } );
190
 
191
- draw_me_a_chart( $( '.imagify-chart-container' ).find( 'canvas' ) );
192
 
193
  } )(jQuery, document, window);
 
 
1
  window.imagify = window.imagify || {
2
  concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
3
  log: function( content ) {
4
  if ( undefined !== console ) {
5
+ console.log( content ); // eslint-disable-line no-console
6
  }
7
  },
8
  info: function( content ) {
9
  if ( undefined !== console ) {
10
+ console.info( content ); // eslint-disable-line no-console
11
  }
12
  }
13
  };
14
 
15
+ (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
16
  /**
17
  * Add a "Imagify'em all" in the select list.
18
  */
33
  *
34
  * @param {element} canvas
35
  */
36
+ function drawMeAChart( canvas ) {
37
  canvas.each( function() {
38
+ var $this = $( this ),
39
+ theValue = parseInt( $this.closest( '.imagify-chart' ).next( '.imagify-chart-value' ).text() ),
40
  overviewData = [
41
  {
42
+ value: theValue,
43
  color: '#00B3D3'
44
  },
45
  {
46
+ value: 100 - theValue,
47
  color: '#D8D8D8'
48
  }
49
  ];
50
 
51
+ new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, { // eslint-disable-line new-cap
52
+ segmentStrokeColor: '#FFF',
53
+ segmentStrokeWidth: 1,
54
+ animateRotate: true,
55
+ tooltipEvents: []
56
  } );
57
  } );
58
  }
66
  var value = $( this ).prev( 'select' ).val().split( '-' ),
67
  action, ids;
68
 
69
+ if ( 'imagify' !== value[0] ) {
70
  return;
71
  }
72
 
101
  $parent.html( '<div class="button"><span class="imagify-spinner"></span>' + $obj.data( 'waiting-label' ) + '</div>' );
102
 
103
  $.get( href.replace( 'admin-post.php', 'admin-ajax.php' ) )
104
+ .done( function( response ){
105
+ $parent.html( response.data );
106
+ $parent.find( '.imagify-datas-more-action a' ).addClass( 'is-open' ).find( '.the-text' ).text( $parent.find( '.imagify-datas-more-action a' ).data( 'close' ) );
107
+ $parent.find( '.imagify-datas-details' ).addClass( 'is-open' );
108
 
109
+ drawMeAChart( $parent.find( '.imagify-chart-container' ).find( 'canvas' ) );
110
+ } );
111
  } );
112
 
113
  /**
152
 
153
  if ( $details.length ) {
154
  $details.hide();
155
+ drawMeAChart( $( '#imagify-consumption-chart' ) );
156
  clearInterval( tempTimer );
157
  tempTimer = null;
158
  }
187
  }, 100);
188
  } );
189
 
190
+ drawMeAChart( $( '.imagify-chart-container' ).find( 'canvas' ) );
191
 
192
  } )(jQuery, document, window);
assets/js/upload.min.js CHANGED
@@ -1 +1 @@
1
- window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){function e(b){b.each(function(){var b=parseInt(a(this).closest(".imagify-chart").next(".imagify-chart-value").text()),c=[{value:b,color:"#00B3D3"},{value:100-b,color:"#D8D8D8"}];new Chart(a(this)[0].getContext("2d")).Doughnut(c,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}var f,g,h;f='<option value="imagify-bulk-upload">'+imagifyUpload.bulkActionsLabels.optimize+"</option>",(imagifyUpload.backup_option||a(".attachment-has-backup").length)&&(f+='<option value="imagify-bulk-restore">'+imagifyUpload.bulkActionsLabels.restore+"</option>"),a('.bulkactions select[name="action"]').find("option:last-child").before(f),a('.bulkactions select[name="action2"]').find("option:last-child").before(f),a("#doaction").add("#doaction2").on("click",function(b){var c,d,e=a(this).prev("select").val().split("-");"imagify"===e[0]&&(b.preventDefault(),c=e[2],d=a('input[name^="media"]:checked').map(function(){return this.value}).get(),d.forEach(function(b,d){setTimeout(function(){a("#imagify-"+c+"-"+b).trigger("click")},300*d)}))}),a(b).on("click",".button-imagify-restore, .button-imagify-manual-upload, .button-imagify-manual-override-upload",function(b){var c=a(this),d=c.parents(".column-imagify_optimized_file, .compat-field-imagify .field"),f=c.attr("href");b.preventDefault(),d.length||(d=c.closest(".column")),d.html('<div class="button"><span class="imagify-spinner"></span>'+c.data("waiting-label")+"</div>"),a.get(f.replace("admin-post.php","admin-ajax.php")).done(function(a){d.html(a.data),d.find(".imagify-datas-more-action a").addClass("is-open").find(".the-text").text(d.find(".imagify-datas-more-action a").data("close")),d.find(".imagify-datas-details").addClass("is-open"),e(d.find(".imagify-chart-container").find("canvas"))})}),a(".imagify-datas-details").hide(),a(b).on("click",".imagify-datas-more-action a",function(b){var c=a(this);b.preventDefault(),c.hasClass("is-open")?(a(c.attr("href")).slideUp(300).removeClass("is-open"),c.removeClass("is-open").find(".the-text").text(c.data("open"))):(a(c.attr("href")).slideDown(300).addClass("is-open"),c.addClass("is-open").find(".the-text").text(c.data("close")))}),g=function(a){var b={};return c.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,c,d){b[c]=void 0!==d?d:""}),a?b[a]?b[a]:null:b},h=function(){var b=setInterval(function(){var c=a(".media-modal .imagify-datas-details");c.length&&(c.hide(),e(a("#imagify-consumption-chart")),clearInterval(b),b=null)},20)},a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){h()}),a(".upload-php").length&&g("item")&&h(),a("#insert-media-button").on("click.imagify",function(){var b=setInterval(function(){var c=a(".media-frame-content .attachments");c.length&&(c.on("click.imagify",".attachment",function(){h()}),clearInterval(b),b=null)},100)}),e(a(".imagify-chart-container").find("canvas"))}(jQuery,document,window);
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){function e(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-chart").next(".imagify-chart-value").text()),d=[{value:c,color:"#00B3D3"},{value:100-c,color:"#D8D8D8"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}var f,g,h;f='<option value="imagify-bulk-upload">'+imagifyUpload.bulkActionsLabels.optimize+"</option>",(imagifyUpload.backup_option||a(".attachment-has-backup").length)&&(f+='<option value="imagify-bulk-restore">'+imagifyUpload.bulkActionsLabels.restore+"</option>"),a('.bulkactions select[name="action"]').find("option:last-child").before(f),a('.bulkactions select[name="action2"]').find("option:last-child").before(f),a("#doaction").add("#doaction2").on("click",function(b){var c,d,e=a(this).prev("select").val().split("-");"imagify"===e[0]&&(b.preventDefault(),c=e[2],d=a('input[name^="media"]:checked').map(function(){return this.value}).get(),d.forEach(function(b,d){setTimeout(function(){a("#imagify-"+c+"-"+b).trigger("click")},300*d)}))}),a(b).on("click",".button-imagify-restore, .button-imagify-manual-upload, .button-imagify-manual-override-upload",function(b){var c=a(this),d=c.parents(".column-imagify_optimized_file, .compat-field-imagify .field"),f=c.attr("href");b.preventDefault(),d.length||(d=c.closest(".column")),d.html('<div class="button"><span class="imagify-spinner"></span>'+c.data("waiting-label")+"</div>"),a.get(f.replace("admin-post.php","admin-ajax.php")).done(function(a){d.html(a.data),d.find(".imagify-datas-more-action a").addClass("is-open").find(".the-text").text(d.find(".imagify-datas-more-action a").data("close")),d.find(".imagify-datas-details").addClass("is-open"),e(d.find(".imagify-chart-container").find("canvas"))})}),a(".imagify-datas-details").hide(),a(b).on("click",".imagify-datas-more-action a",function(b){var c=a(this);b.preventDefault(),c.hasClass("is-open")?(a(c.attr("href")).slideUp(300).removeClass("is-open"),c.removeClass("is-open").find(".the-text").text(c.data("open"))):(a(c.attr("href")).slideDown(300).addClass("is-open"),c.addClass("is-open").find(".the-text").text(c.data("close")))}),g=function(a){var b={};return c.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,c,d){b[c]=void 0!==d?d:""}),a?b[a]?b[a]:null:b},h=function(){var b=setInterval(function(){var c=a(".media-modal .imagify-datas-details");c.length&&(c.hide(),e(a("#imagify-consumption-chart")),clearInterval(b),b=null)},20)},a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){h()}),a(".upload-php").length&&g("item")&&h(),a("#insert-media-button").on("click.imagify",function(){var b=setInterval(function(){var c=a(".media-frame-content .attachments");c.length&&(c.on("click.imagify",".attachment",function(){h()}),clearInterval(b),b=null)},100)}),e(a(".imagify-chart-container").find("canvas"))}(jQuery,document,window);
imagify.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
- * Version: 1.6.8
7
  * Author: WP Media
8
  * Author URI: https://wp-media.me/
9
  * Licence: GPLv2
@@ -17,7 +17,7 @@
17
  defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
18
 
19
  // Imagify defines.
20
- define( 'IMAGIFY_VERSION' , '1.6.8' );
21
  define( 'IMAGIFY_SLUG' , 'imagify' );
22
  define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
23
  define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
@@ -42,6 +42,7 @@ define( 'IMAGIFY_ASSETS_JS_URL' , IMAGIFY_ASSETS_URL . 'js/' );
42
  define( 'IMAGIFY_ASSETS_CSS_URL' , IMAGIFY_ASSETS_URL . 'css/' );
43
  define( 'IMAGIFY_ASSETS_IMG_URL' , IMAGIFY_ASSETS_URL . 'images/' );
44
  define( 'IMAGIFY_MAX_BYTES' , 5242880 );
 
45
 
46
  add_action( 'plugins_loaded', '_imagify_init' );
47
  /**
@@ -97,6 +98,9 @@ function _imagify_init() {
97
  require( IMAGIFY_ADMIN_UI_PATH . 'options.php' );
98
  require( IMAGIFY_ADMIN_UI_PATH . 'bulk.php' );
99
  require( IMAGIFY_ADMIN_UI_PATH . 'notices.php' );
 
 
 
100
  }
101
 
102
  /**
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
+ * Version: 1.6.9
7
  * Author: WP Media
8
  * Author URI: https://wp-media.me/
9
  * Licence: GPLv2
17
  defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
18
 
19
  // Imagify defines.
20
+ define( 'IMAGIFY_VERSION' , '1.6.9' );
21
  define( 'IMAGIFY_SLUG' , 'imagify' );
22
  define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
23
  define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
42
  define( 'IMAGIFY_ASSETS_CSS_URL' , IMAGIFY_ASSETS_URL . 'css/' );
43
  define( 'IMAGIFY_ASSETS_IMG_URL' , IMAGIFY_ASSETS_URL . 'images/' );
44
  define( 'IMAGIFY_MAX_BYTES' , 5242880 );
45
+ define( 'IMAGIFY_INT_MAX' , PHP_INT_MAX - 30 );
46
 
47
  add_action( 'plugins_loaded', '_imagify_init' );
48
  /**
98
  require( IMAGIFY_ADMIN_UI_PATH . 'options.php' );
99
  require( IMAGIFY_ADMIN_UI_PATH . 'bulk.php' );
100
  require( IMAGIFY_ADMIN_UI_PATH . 'notices.php' );
101
+ require( IMAGIFY_CLASSES_PATH . 'class-imagify-rocket-infos.php' );
102
+
103
+ add_action( 'init', array( imagify_rocket_infos(), 'init' ) );
104
  }
105
 
106
  /**
inc/3rd-party/3rd-party.php CHANGED
@@ -2,7 +2,7 @@
2
  defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  require( IMAGIFY_3RD_PARTY_PATH . 'amazon-s3-and-cloudfront/amazon-s3-and-cloudfront.php' );
5
- require( IMAGIFY_3RD_PARTY_PATH . 'enable-media-replace.php' );
6
  require( IMAGIFY_3RD_PARTY_PATH . 'nextgen-gallery/nextgen-gallery.php' );
7
  require( IMAGIFY_3RD_PARTY_PATH . 'screets-lc.php' );
8
  require( IMAGIFY_3RD_PARTY_PATH . 'wp-retina-2x.php' );
2
  defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  require( IMAGIFY_3RD_PARTY_PATH . 'amazon-s3-and-cloudfront/amazon-s3-and-cloudfront.php' );
5
+ require( IMAGIFY_3RD_PARTY_PATH . 'enable-media-replace/enable-media-replace.php' );
6
  require( IMAGIFY_3RD_PARTY_PATH . 'nextgen-gallery/nextgen-gallery.php' );
7
  require( IMAGIFY_3RD_PARTY_PATH . 'screets-lc.php' );
8
  require( IMAGIFY_3RD_PARTY_PATH . 'wp-retina-2x.php' );
inc/3rd-party/amazon-s3-and-cloudfront/inc/classes/class-imagify-as3cf-attachment.php CHANGED
@@ -803,21 +803,4 @@ class Imagify_AS3CF_Attachment extends Imagify_Attachment {
803
 
804
  return false === $preserve;
805
  }
806
-
807
-
808
- /** ----------------------------------------------------------------------------------------- */
809
- /** VARIOUS TOOLS =========================================================================== */
810
- /** ----------------------------------------------------------------------------------------- */
811
-
812
- /**
813
- * Tell if the attachment has a supported mime type.
814
- *
815
- * @since 1.6.6
816
- * @author Grégory Viguier
817
- *
818
- * @return bool
819
- */
820
- public function is_mime_type_supported() {
821
- return imagify_is_attachment_mime_type_supported( $this->id );
822
- }
823
  }
803
 
804
  return false === $preserve;
805
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
806
  }
inc/3rd-party/enable-media-replace.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
-
4
- if ( function_exists( 'emr_delete_current_files' ) ) :
5
-
6
- add_action( 'enable-media-replace-upload-done', '_imagify_optimize_enable_media_replace' );
7
- /**
8
- * Re-Optimize an attachment after replace it with Enable Media Replace.
9
- *
10
- * @since 1.0
11
- *
12
- * @param string $guid A post guid.
13
- */
14
- function _imagify_optimize_enable_media_replace( $guid ) {
15
- global $wpdb;
16
- $attachment_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s';", $guid ) );
17
-
18
- // Stop if the attachment wasn't optimized yet by Imagify.
19
- if ( ! get_post_meta( $attachment_id, '_imagify_data', true ) ) {
20
- return;
21
- }
22
-
23
- $optimization_level = get_post_meta( $attachment_id, '_imagify_optimization_level', true );
24
- $class_name = get_imagify_attachment_class_name( 'wp', $attachment_id, 'enable-media-replace-upload-done' );
25
- $attachment = new $class_name( $attachment_id );
26
-
27
- // Remove old optimization data.
28
- $attachment->delete_imagify_data();
29
-
30
- // Optimize it!!!!!
31
- $attachment->optimize( $optimization_level );
32
- }
33
-
34
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/3rd-party/enable-media-replace/enable-media-replace.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ if ( function_exists( 'enable_media_replace' ) ) :
5
+
6
+ require( dirname( __FILE__ ) . '/inc/classes/class-imagify-enable-media-replace.php' );
7
+
8
+ add_filter( 'emr_unfiltered_get_attached_file', array( imagify_enable_media_replace(), 'init' ) );
9
+
10
+ endif;
inc/3rd-party/enable-media-replace/inc/classes/class-imagify-enable-media-replace.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Compat class for Enable Media Replace plugin.
6
+ *
7
+ * @since 1.6.9
8
+ * @author Grégory Viguier
9
+ */
10
+ class Imagify_Enable_Media_Replace {
11
+
12
+ /**
13
+ * Class version.
14
+ *
15
+ * @var string
16
+ */
17
+ const VERSION = '1.0';
18
+
19
+ /**
20
+ * The attachment ID.
21
+ *
22
+ * @var int
23
+ */
24
+ protected $attachment_id;
25
+
26
+ /**
27
+ * The attachment.
28
+ *
29
+ * @var object A Imagify_Attachment object (or any class extending it).
30
+ */
31
+ protected $attachment;
32
+
33
+ /**
34
+ * The path to the old backup file.
35
+ *
36
+ * @var string
37
+ */
38
+ protected $old_backup_path;
39
+
40
+ /**
41
+ * The single instance of the class.
42
+ *
43
+ * @var object
44
+ */
45
+ protected static $_instance;
46
+
47
+ /**
48
+ * Get the main instance.
49
+ *
50
+ * Ensures only one instance of class is loaded or can be loaded.
51
+ *
52
+ * @since 1.6.9
53
+ * @author Grégory Viguier
54
+ *
55
+ * @return object Main instance.
56
+ */
57
+ public static function get_instance() {
58
+ if ( ! isset( self::$_instance ) ) {
59
+ self::$_instance = new self();
60
+ }
61
+
62
+ return self::$_instance;
63
+ }
64
+
65
+ /**
66
+ * The class constructor.
67
+ *
68
+ * @since 1.6.9
69
+ * @author Grégory Viguier
70
+ */
71
+ protected function __construct() {}
72
+
73
+ /**
74
+ * Launch the hooks before the files and data are replaced.
75
+ *
76
+ * @since 1.6.9
77
+ * @author Grégory Viguier
78
+ *
79
+ * @param bool $unfiltered Whether to allow filters when retrieving the file path.
80
+ * @return bool The same value.
81
+ */
82
+ public function init( $unfiltered = true ) {
83
+ $this->attachment_id = ! empty( $_POST['ID'] ) ? absint( $_POST['ID'] ) : 0; // WPCS: CSRF ok.
84
+
85
+ if ( ! $this->attachment_id || empty( $_FILES['userfile']['tmp_name'] ) || ! is_uploaded_file( $_FILES['userfile']['tmp_name'] ) ) {
86
+ return $unfiltered;
87
+ }
88
+
89
+ // Remove the automatic optimization.
90
+ remove_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', PHP_INT_MAX );
91
+
92
+ // Store the old backup file path.
93
+ add_filter( 'emr_unique_filename', array( $this, 'store_old_backup_path' ), 10, 3 );
94
+ // Optimize and delete the old backup file.
95
+ add_action( 'emr_returnurl', array( $this, 'optimize' ) );
96
+
97
+ return $unfiltered;
98
+ }
99
+
100
+ /**
101
+ * When the user choose the change the file name, store the old backup file path. This path will be used later to delete the file.
102
+ *
103
+ * @since 1.6.9
104
+ * @author Grégory Viguier
105
+ * @see $this->optimize()
106
+ *
107
+ * @param string $new_filename The new file name.
108
+ * @param string $current_path The current file path.
109
+ * @param int $post_id The attachment ID.
110
+ * @return string The same file name.
111
+ */
112
+ public function store_old_backup_path( $new_filename, $current_path, $post_id ) {
113
+ if ( $post_id !== $this->attachment_id ) {
114
+ return $new_filename;
115
+ }
116
+
117
+ $backup_path = $this->get_attachment()->get_backup_path();
118
+
119
+ if ( $backup_path ) {
120
+ $this->old_backup_path = $backup_path;
121
+ }
122
+
123
+ return $new_filename;
124
+ }
125
+
126
+ /**
127
+ * Optimize the attachment files if the old ones were also optimized.
128
+ * Delete the old backup file.
129
+ *
130
+ * @since 1.6.9
131
+ * @author Grégory Viguier
132
+ * @see $this->store_old_backup_path()
133
+ *
134
+ * @param string $return_url The URL the user will be redirected to.
135
+ * @return string The same URL.
136
+ */
137
+ public function optimize( $return_url ) {
138
+ $attachment = $this->get_attachment();
139
+
140
+ if ( $attachment->get_data() ) {
141
+ /**
142
+ * The old images have been optimized in the past.
143
+ */
144
+ // Use the same otimization level for the new ones.
145
+ $optimization_level = $attachment->get_optimization_level();
146
+
147
+ // Remove old optimization data.
148
+ $attachment->delete_imagify_data();
149
+
150
+ // Optimize and overwrite the previous backup file if exists and needed.
151
+ add_filter( 'imagify_backup_overwrite_backup', '__return_true', 42 );
152
+ $attachment->optimize( $optimization_level );
153
+ remove_filter( 'imagify_backup_overwrite_backup', '__return_true', 42 );
154
+ }
155
+
156
+ /**
157
+ * Delete the old backup file.
158
+ */
159
+ $filesystem = imagify_get_filesystem();
160
+
161
+ if ( ! $this->old_backup_path || ! $filesystem->exists( $this->old_backup_path ) ) {
162
+ // The user didn't choose to rename the files, or there is no old backup.
163
+ $this->old_backup_path = null;
164
+ return $return_url;
165
+ }
166
+
167
+ $new_backup_path = $attachment->get_backup_path();
168
+
169
+ if ( $new_backup_path === $this->old_backup_path ) {
170
+ // We don't want to delete the new backup.
171
+ $this->old_backup_path = null;
172
+ return $return_url;
173
+ }
174
+
175
+ // Finally, delete the old backup file.
176
+ $filesystem->delete( $this->old_backup_path );
177
+
178
+ $this->old_backup_path = null;
179
+ return $return_url;
180
+ }
181
+
182
+ /**
183
+ * Get the attachment.
184
+ *
185
+ * @since 1.6.9
186
+ * @author Grégory Viguier
187
+ *
188
+ * @return object A Imagify_Attachment object (or any class extending it).
189
+ */
190
+ protected function get_attachment() {
191
+ if ( $this->attachment ) {
192
+ return $this->attachment;
193
+ }
194
+
195
+ $class_name = get_imagify_attachment_class_name( 'wp', $this->attachment_id, 'enable_media_replace' );
196
+ $this->attachment = new $class_name( $this->attachment_id );
197
+
198
+ return $this->attachment;
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Returns the main instance of the Imagify_Enable_Media_Replace class.
204
+ *
205
+ * @since 1.6.9
206
+ * @author Grégory Viguier
207
+ *
208
+ * @return object The Imagify_Enable_Media_Replace instance.
209
+ */
210
+ function imagify_enable_media_replace() {
211
+ return Imagify_Enable_Media_Replace::get_instance();
212
+ }
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-attachment.php CHANGED
@@ -14,7 +14,7 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
14
  *
15
  * @var string
16
  */
17
- const VERSION = '1.0.2';
18
 
19
  /**
20
  * The image object.
@@ -36,6 +36,17 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
36
  */
37
  public $row;
38
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * The constructor.
41
  *
@@ -66,19 +77,19 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
66
  }
67
 
68
  /**
69
- * Get the attachment backup filepath.
70
  *
71
- * @since 1.5
72
  * @author Jonathan Buttigieg
73
- *
74
  * @access public
75
- * @return string|bool The path. False on failure.
 
76
  */
77
  public function get_backup_path() {
78
  $file_path = $this->get_original_path();
79
  $backup_path = get_imagify_ngg_attachment_backup_path( $file_path );
80
 
81
- if ( file_exists( $backup_path ) ) {
82
  return $backup_path;
83
  }
84
 
@@ -178,6 +189,33 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
178
  return $this->image->imageURL;
179
  }
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  /**
182
  * Update the metadata size of the attachment.
183
  *
@@ -286,7 +324,7 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
286
  */
287
  public function optimize( $optimization_level = null, $metadata = array() ) {
288
  // Check if the attachment extension is allowed.
289
- if ( ! imagify_is_attachment_mime_type_supported( $this->id ) ) {
290
  return;
291
  }
292
 
@@ -391,6 +429,39 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
391
  */
392
  do_action( 'after_imagify_ngg_optimize_attachment', $this->id, $data );
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  delete_transient( 'imagify-ngg-async-in-progress-' . $this->id );
395
 
396
  return $data;
@@ -485,21 +556,45 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
485
  /**
486
  * Process an attachment restoration from the backup file.
487
  *
488
- * @since 1.5
 
 
489
  * @author Jonathan Buttigieg
490
  *
491
  * @access public
492
- * @return void
493
  */
494
  public function restore() {
495
  // Check if the attachment extension is allowed.
496
- if ( ! imagify_is_attachment_mime_type_supported( $this->id ) ) {
497
- return;
498
  }
499
 
500
  // Stop the process if there is no backup file to restore.
501
  if ( ! $this->has_backup() ) {
502
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  }
504
 
505
  /**
@@ -511,11 +606,160 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
511
  */
512
  do_action( 'before_imagify_ngg_restore_attachment', $this->id );
513
 
514
- // Create the original image from the backup.
515
- C_Gallery_Storage::get_instance()->recover_image( $this->id );
 
516
 
517
- // Remove old optimization data.
518
- imagify_ngg_db()->delete( $this->id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
 
520
  /**
521
  * Fires after restoring an attachment.
@@ -525,5 +769,7 @@ class Imagify_NGG_Attachment extends Imagify_Attachment {
525
  * @param int $id The attachment ID.
526
  */
527
  do_action( 'after_imagify_ngg_restore_attachment', $this->id );
 
 
528
  }
529
  }
14
  *
15
  * @var string
16
  */
17
+ const VERSION = '1.1.1';
18
 
19
  /**
20
  * The image object.
36
  */
37
  public $row;
38
 
39
+ /**
40
+ * Tell if the file mime type can be optimized by Imagify.
41
+ *
42
+ * @since 1.6.9
43
+ *
44
+ * @var bool
45
+ * @access protected
46
+ * see $this->is_mime_type_supported()
47
+ */
48
+ protected $is_mime_type_supported;
49
+
50
  /**
51
  * The constructor.
52
  *
77
  }
78
 
79
  /**
80
+ * Get the attachment backup file path.
81
  *
82
+ * @since 1.5
83
  * @author Jonathan Buttigieg
 
84
  * @access public
85
+ *
86
+ * @return string|false The file path. False if it doesn't exist.
87
  */
88
  public function get_backup_path() {
89
  $file_path = $this->get_original_path();
90
  $backup_path = get_imagify_ngg_attachment_backup_path( $file_path );
91
 
92
+ if ( $backup_path && file_exists( $backup_path ) ) {
93
  return $backup_path;
94
  }
95
 
189
  return $this->image->imageURL;
190
  }
191
 
192
+ /**
193
+ * Tell if the current file mime type is supported.
194
+ *
195
+ * @since 1.6.9
196
+ * @author Grégory Viguier
197
+ *
198
+ * @return bool
199
+ */
200
+ public function is_mime_type_supported() {
201
+ if ( isset( $this->is_mime_type_supported ) ) {
202
+ return $this->is_mime_type_supported;
203
+ }
204
+
205
+ $mime_type = imagify_get_mime_type_from_file( $this->get_original_path() );
206
+
207
+ if ( ! $mime_type ) {
208
+ $this->is_mime_type_supported = false;
209
+ return $this->is_mime_type_supported;
210
+ }
211
+
212
+ $mime_types = get_imagify_mime_type();
213
+ $mime_types = array_flip( $mime_types );
214
+
215
+ $this->is_mime_type_supported = isset( $mime_types[ $mime_type ] );
216
+ return $this->is_mime_type_supported;
217
+ }
218
+
219
  /**
220
  * Update the metadata size of the attachment.
221
  *
324
  */
325
  public function optimize( $optimization_level = null, $metadata = array() ) {
326
  // Check if the attachment extension is allowed.
327
+ if ( ! $this->is_mime_type_supported() ) {
328
  return;
329
  }
330
 
429
  */
430
  do_action( 'after_imagify_ngg_optimize_attachment', $this->id, $data );
431
 
432
+ /**
433
+ * Update NGG meta data.
434
+ */
435
+ $storage = C_Gallery_Storage::get_instance()->object;
436
+ $image = $storage->_image_mapper->find( $this->id );
437
+
438
+ if ( $image ) {
439
+ $dimensions = getimagesize( $attachment_path );
440
+ $md5 = md5_file( $attachment_path );
441
+
442
+ if ( ( $dimensions || $md5 ) && ( empty( $image->meta_data['full'] ) || ! is_array( $image->meta_data['full'] ) ) ) {
443
+ $image->meta_data['full'] = array(
444
+ 'width' => 0,
445
+ 'height' => 0,
446
+ 'md5' => '',
447
+ );
448
+ }
449
+
450
+ if ( $dimensions ) {
451
+ $image->meta_data['width'] = $dimensions[0];
452
+ $image->meta_data['height'] = $dimensions[1];
453
+ $image->meta_data['full']['width'] = $dimensions[0];
454
+ $image->meta_data['full']['height'] = $dimensions[1];
455
+ }
456
+
457
+ if ( $md5 ) {
458
+ $image->meta_data['md5'] = $md5;
459
+ $image->meta_data['full']['md5'] = $md5;
460
+ }
461
+
462
+ $storage->_image_mapper->save( $image );
463
+ }
464
+
465
  delete_transient( 'imagify-ngg-async-in-progress-' . $this->id );
466
 
467
  return $data;
556
  /**
557
  * Process an attachment restoration from the backup file.
558
  *
559
+ * @since 1.5
560
+ * @since 1.6.9 Doesn't use NGG's recover_image() anymore, these are fundamentally not the same things. This also prevents alt text, description, and tags deletion.
561
+ * @since 1.6.9 Return true or a WP_Error object.
562
  * @author Jonathan Buttigieg
563
  *
564
  * @access public
565
+ * @return bool|object True on success, a WP_Error object on error.
566
  */
567
  public function restore() {
568
  // Check if the attachment extension is allowed.
569
+ if ( ! $this->is_mime_type_supported() ) {
570
+ return new WP_Error( 'mime_not_type_supported', __( 'Mime type not supported.', 'imagify' ) );
571
  }
572
 
573
  // Stop the process if there is no backup file to restore.
574
  if ( ! $this->has_backup() ) {
575
+ return new WP_Error( 'no_backup', __( 'Backup image not found.', 'imagify' ) );
576
+ }
577
+
578
+ $storage = C_Gallery_Storage::get_instance()->object;
579
+ $image = $storage->_image_mapper->find( $this->id );
580
+
581
+ if ( ! $image ) {
582
+ return new WP_Error( 'no_image', __( 'Image not found in NextGen Gallery data.', 'imagify' ) );
583
+ }
584
+
585
+ /**
586
+ * Make some more tests before restoring the backup.
587
+ */
588
+ $filesystem = imagify_get_filesystem();
589
+ $full_abspath = $storage->get_image_abspath( $image );
590
+ $backup_abspath = $storage->get_image_abspath( $image, 'backup' );
591
+
592
+ if ( $backup_abspath === $full_abspath ) {
593
+ return new WP_Error( 'same_path', __( 'Image path and backup path are identical.', 'imagify' ) );
594
+ }
595
+
596
+ if ( ! $filesystem->is_writable( $full_abspath ) || ! $filesystem->is_writable( dirname( $full_abspath ) ) ) {
597
+ return new WP_Error( 'destination_not_writable', __( 'The image to replace is not writable.', 'imagify' ) );
598
  }
599
 
600
  /**
606
  */
607
  do_action( 'before_imagify_ngg_restore_attachment', $this->id );
608
 
609
+ if ( ! $filesystem->copy( $backup_abspath, $full_abspath, true, FS_CHMOD_FILE ) ) {
610
+ return new WP_Error( 'copy_failed', __( 'Restoration failed.', 'imagify' ) );
611
+ }
612
 
613
+ /**
614
+ * Remove Imagify data.
615
+ */
616
+ imagify_ngg_db()->delete( $image->pid );
617
+
618
+ /**
619
+ * Fill in the NGG meta data.
620
+ */
621
+ // 1- Meta data for the backup file.
622
+ $dimensions = getimagesize( $backup_abspath );
623
+ $backup_data = array(
624
+ 'backup' => array(
625
+ 'filename' => basename( $full_abspath ), // Yes, $full_abspath.
626
+ 'width' => 0,
627
+ 'height' => 0,
628
+ 'generated' => microtime(),
629
+ ),
630
+ );
631
+
632
+ if ( $dimensions ) {
633
+ $backup_data['backup']['width'] = $dimensions[0];
634
+ $backup_data['backup']['height'] = $dimensions[1];
635
+ }
636
+
637
+ // 2- Meta data for the full sized image.
638
+ $full_data = array(
639
+ 'width' => 0,
640
+ 'height' => 0,
641
+ 'md5' => '',
642
+ 'full' => array(
643
+ 'width' => 0,
644
+ 'height' => 0,
645
+ 'md5' => '',
646
+ ),
647
+ );
648
+
649
+ $dimensions = getimagesize( $full_abspath );
650
+
651
+ if ( $dimensions ) {
652
+ $full_data['width'] = $dimensions[0];
653
+ $full_data['height'] = $dimensions[1];
654
+ $full_data['full']['width'] = $dimensions[0];
655
+ $full_data['full']['height'] = $dimensions[1];
656
+ }
657
+
658
+ $md5 = md5_file( $full_abspath );
659
+
660
+ if ( $md5 ) {
661
+ $full_data['md5'] = $md5;
662
+ $full_data['full']['md5'] = $md5;
663
+ }
664
+
665
+ // 3- Thumbnails meta data.
666
+ $thumbnails_data = array();
667
+
668
+ // 4- Common meta data.
669
+ require_once( NGGALLERY_ABSPATH . '/lib/meta.php' );
670
+ $meta_obj = new nggMeta( $image );
671
+ $common_data = $meta_obj->get_common_meta();
672
+
673
+ if ( $common_data ) {
674
+ unset( $common_data['width'], $common_data['height'] );
675
+ } else {
676
+ $common_data = array(
677
+ 'aperture' => 0,
678
+ 'credit' => '',
679
+ 'camera' => '',
680
+ 'caption' => '',
681
+ 'created_timestamp' => 0,
682
+ 'copyright' => '',
683
+ 'focal_length' => 0,
684
+ 'iso' => 0,
685
+ 'shutter_speed' => 0,
686
+ 'flash' => 0,
687
+ 'title' => '',
688
+ 'keywords' => '',
689
+ );
690
+
691
+ if ( ! empty( $image->meta_data ) && is_array( $image->meta_data ) ) {
692
+ $image->meta_data = array_merge( $common_data, $image->meta_data );
693
+ $common_data = array_intersect_key( $image->meta_data, $common_data );
694
+ }
695
+ }
696
+
697
+ $common_data['saved'] = true;
698
+
699
+ /**
700
+ * Re-create non-fullsize image sizes and add related data.
701
+ */
702
+ $failed = array();
703
+
704
+ foreach ( $storage->get_image_sizes( $image ) as $named_size ) {
705
+ if ( 'full' === $named_size ) {
706
+ continue;
707
+ }
708
+
709
+ $params = $storage->get_image_size_params( $image, $named_size );
710
+ $thumbnail = $storage->generate_image_clone(
711
+ $backup_abspath,
712
+ $storage->get_image_abspath( $image, $named_size ),
713
+ $params
714
+ );
715
+
716
+ if ( ! $thumbnail ) {
717
+ // Failed.
718
+ $failed[] = $named_size;
719
+ continue;
720
+ }
721
+
722
+ $size_meta = array(
723
+ 'width' => 0,
724
+ 'height' => 0,
725
+ 'filename' => M_I18n::mb_basename( $thumbnail->fileName ),
726
+ 'generated' => microtime(),
727
+ );
728
+
729
+ $dimensions = getimagesize( $thumbnail->fileName );
730
+
731
+ if ( $dimensions ) {
732
+ $size_meta['width'] = $dimensions[0];
733
+ $size_meta['height'] = $dimensions[1];
734
+ }
735
+
736
+ if ( isset( $params['crop_frame'] ) ) {
737
+ $size_meta['crop_frame'] = $params['crop_frame'];
738
+ }
739
+
740
+ $thumbnails_data[ $named_size ] = $size_meta;
741
+ } // End foreach().
742
+
743
+ do_action( 'ngg_recovered_image', $image );
744
+
745
+ /**
746
+ * Save the meta data.
747
+ */
748
+ $image->meta_data = array_merge( $backup_data, $full_data, $thumbnails_data, $common_data );
749
+
750
+ $post_id = $storage->_image_mapper->save( $image );
751
+
752
+ if ( ! $post_id ) {
753
+ return new WP_Error( 'meta_data_not_saved', __( 'Related data could not be saved.', 'imagify' ) );
754
+ }
755
+
756
+ if ( $failed ) {
757
+ return new WP_Error(
758
+ 'thumbnail_restore_failed',
759
+ sprintf( _n( '%n thumbnail could not be restored.', '%n thumbnails could not be restored.', count( $failed ), 'imagify' ), count( $failed ) ),
760
+ array( 'failed_thumbnails' => $failed )
761
+ );
762
+ }
763
 
764
  /**
765
  * Fires after restoring an attachment.
769
  * @param int $id The attachment ID.
770
  */
771
  do_action( 'after_imagify_ngg_restore_attachment', $this->id );
772
+
773
+ return true;
774
  }
775
  }
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-db.php CHANGED
@@ -79,7 +79,7 @@ class Imagify_NGG_DB extends Imagify_Abstract_DB {
79
  'pid' => '%d',
80
  'optimization_level' => '%s',
81
  'status' => '%s',
82
- 'data' => '%s',
83
  );
84
  }
85
 
79
  'pid' => '%d',
80
  'optimization_level' => '%s',
81
  'status' => '%s',
82
+ 'data' => '%s',
83
  );
84
  }
85
 
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-storage.php CHANGED
@@ -68,7 +68,7 @@ class Imagify_NGG_Storage extends Mixin {
68
  }
69
 
70
  /**
71
- * Recover image from backup copy and reprocess it.
72
  *
73
  * @since 1.5
74
  * @author Jonathan Buttigieg
@@ -82,6 +82,10 @@ class Imagify_NGG_Storage extends Mixin {
82
  $image = $this->object->_image_mapper->find( $image );
83
  }
84
 
 
 
 
 
85
  // Remove Imagify data.
86
  if ( isset( $image->pid ) ) {
87
  imagify_ngg_db()->delete( $image->pid );
68
  }
69
 
70
  /**
71
+ * Recover image from backup.
72
  *
73
  * @since 1.5
74
  * @author Jonathan Buttigieg
82
  $image = $this->object->_image_mapper->find( $image );
83
  }
84
 
85
+ if ( ! $image ) {
86
+ return false;
87
+ }
88
+
89
  // Remove Imagify data.
90
  if ( isset( $image->pid ) ) {
91
  imagify_ngg_db()->delete( $image->pid );
inc/3rd-party/nextgen-gallery/inc/common/attachments.php CHANGED
@@ -20,7 +20,7 @@ function _imagify_ngg_optimize_attachment( $gallery_id, $image_ids ) {
20
 
21
  foreach ( $image_ids as $id ) {
22
  $body = array();
23
- $body['metadata'] = 1;
24
  $body['context'] = 'NGG';
25
  $body['attachment_id'] = $id;
26
  $body['action'] = 'imagify_async_optimize_upload_new_media';
20
 
21
  foreach ( $image_ids as $id ) {
22
  $body = array();
23
+ $body['metadata'] = 1;
24
  $body['context'] = 'NGG';
25
  $body['attachment_id'] = $id;
26
  $body['action'] = 'imagify_async_optimize_upload_new_media';
inc/3rd-party/wp-retina-2x.php CHANGED
@@ -70,7 +70,7 @@ if ( function_exists( 'wr2x_get_retina' ) ) :
70
  $do_retina = apply_filters( 'do_imagify_optimize_retina', true );
71
  $retina_path = wr2x_get_retina( $path );
72
 
73
- if ( empty( $retina_path )|| ! $do_retina ) {
74
  return $data;
75
  }
76
 
70
  $do_retina = apply_filters( 'do_imagify_optimize_retina', true );
71
  $retina_path = wr2x_get_retina( $path );
72
 
73
+ if ( empty( $retina_path ) || ! $do_retina ) {
74
  return $data;
75
  }
76
 
inc/admin/ajax.php CHANGED
@@ -127,7 +127,8 @@ function _do_admin_post_imagify_restore_upload() {
127
  }
128
 
129
  // Return the optimization button.
130
- $output = '<a id="imagify-upload-' . $attachment->id . '" href="' . esc_url( get_imagify_admin_url( 'manual-upload', array( 'attachment_id' => $attachment->id ) ) ) . '" class="button-primary button-imagify-manual-upload" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Optimize', 'imagify' ) . '</a>';
 
131
  wp_send_json_success( $output );
132
  }
133
 
@@ -176,7 +177,7 @@ function _do_wp_ajax_imagify_bulk_upload() {
176
  $data['original_size'] = $fullsize_data['original_size'];
177
  $data['new_size'] = $fullsize_data['optimized_size'];
178
  $data['percent'] = $fullsize_data['percent'];
179
- $data['overall_saving'] = $stats_data['original_size'] - $stats_data['optimized_size'];
180
  $data['original_overall_size'] = $stats_data['original_size'];
181
  $data['new_overall_size'] = $stats_data['optimized_size'];
182
  $data['thumbnails'] = $attachment->get_optimized_sizes_count();
127
  }
128
 
129
  // Return the optimization button.
130
+ $output = get_imagify_admin_url( 'manual-upload', array( 'attachment_id' => $attachment->id, 'context' => $context ) );
131
+ $output = '<a id="imagify-upload-' . $attachment->id . '" href="' . esc_url( $output ) . '" class="button-primary button-imagify-manual-upload" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Optimize', 'imagify' ) . '</a>';
132
  wp_send_json_success( $output );
133
  }
134
 
177
  $data['original_size'] = $fullsize_data['original_size'];
178
  $data['new_size'] = $fullsize_data['optimized_size'];
179
  $data['percent'] = $fullsize_data['percent'];
180
+ $data['overall_saving'] = $stats_data['original_size'] - $stats_data['optimized_size'];
181
  $data['original_overall_size'] = $stats_data['original_size'];
182
  $data['new_overall_size'] = $stats_data['optimized_size'];
183
  $data['thumbnails'] = $attachment->get_optimized_sizes_count();
inc/admin/enqueue.php CHANGED
@@ -20,7 +20,7 @@ function _imagify_admin_print_styles() {
20
  'imagify-css-sweetalert',
21
  IMAGIFY_ASSETS_CSS_URL . 'sweetalert2' . $css_ext,
22
  array(),
23
- '4.0.15'
24
  );
25
 
26
  /**
@@ -47,7 +47,7 @@ function _imagify_admin_print_styles() {
47
  'imagify-js-promise-polyfill',
48
  IMAGIFY_ASSETS_JS_URL . 'es6-promise.auto' . $js_ext,
49
  array(),
50
- '4.1.0',
51
  true
52
  );
53
 
@@ -55,7 +55,7 @@ function _imagify_admin_print_styles() {
55
  'imagify-js-sweetalert',
56
  IMAGIFY_ASSETS_JS_URL . 'sweetalert2' . $js_ext,
57
  array( 'jquery', 'imagify-js-promise-polyfill' ),
58
- '4.0.15',
59
  true
60
  );
61
 
@@ -71,7 +71,7 @@ function _imagify_admin_print_styles() {
71
  'imagify-js-event-move',
72
  IMAGIFY_ASSETS_JS_URL . 'jquery.event.move' . $js_ext,
73
  array( 'jquery' ),
74
- '1.3.6',
75
  true
76
  );
77
 
@@ -80,9 +80,9 @@ function _imagify_admin_print_styles() {
80
  */
81
  wp_register_script(
82
  'imagify-js-async',
83
- IMAGIFY_ASSETS_JS_URL . 'imagify' . $js_ext,
84
  array(),
85
- IMAGIFY_VERSION,
86
  true
87
  );
88
 
20
  'imagify-css-sweetalert',
21
  IMAGIFY_ASSETS_CSS_URL . 'sweetalert2' . $css_ext,
22
  array(),
23
+ '4.6.6'
24
  );
25
 
26
  /**
47
  'imagify-js-promise-polyfill',
48
  IMAGIFY_ASSETS_JS_URL . 'es6-promise.auto' . $js_ext,
49
  array(),
50
+ '4.1.1',
51
  true
52
  );
53
 
55
  'imagify-js-sweetalert',
56
  IMAGIFY_ASSETS_JS_URL . 'sweetalert2' . $js_ext,
57
  array( 'jquery', 'imagify-js-promise-polyfill' ),
58
+ '4.6.6',
59
  true
60
  );
61
 
71
  'imagify-js-event-move',
72
  IMAGIFY_ASSETS_JS_URL . 'jquery.event.move' . $js_ext,
73
  array( 'jquery' ),
74
+ '2.0.1',
75
  true
76
  );
77
 
80
  */
81
  wp_register_script(
82
  'imagify-js-async',
83
+ IMAGIFY_ASSETS_JS_URL . 'imagify-gulp' . $js_ext,
84
  array(),
85
+ '2017-07-28',
86
  true
87
  );
88
 
inc/admin/ui/bulk.php CHANGED
@@ -344,14 +344,18 @@ function _imagify_display_bulk_page() {
344
  </thead>
345
  <tfoot>
346
  <tr>
347
- <td class="imagify-cell-nb-files"> <?php
 
348
  /* translators: %s is a number. Don't use %d. */
349
  printf( _n( '%s file', '%s files', 0, 'imagify' ), '<span class="imagify-nb-files">0</span>' );
350
- ?></td>
351
- <td class="imagify-cell-errors"> <?php
 
 
352
  /* translators: %s is a number. Don't use %d. */
353
  printf( _n( '%s error', '%s errors', 0, 'imagify' ), '<span class="imagify-nb-errors">0</span>' );
354
- ?></td>
 
355
  <td class="imagify-cell-totaloriginal" colspan="4"><?php _e( 'Total:', 'imagify' ); ?><strong> <span class="imagify-total-original">0&nbsp;kB</span></strong></td>
356
  <td class="imagify-cell-totalgain"><?php _e( 'Gain:', 'imagify' ); ?><strong> <span class="imagify-total-gain">0&nbsp;kB</span></strong></td>
357
  </tr>
344
  </thead>
345
  <tfoot>
346
  <tr>
347
+ <td class="imagify-cell-nb-files">
348
+ <?php
349
  /* translators: %s is a number. Don't use %d. */
350
  printf( _n( '%s file', '%s files', 0, 'imagify' ), '<span class="imagify-nb-files">0</span>' );
351
+ ?>
352
+ </td>
353
+ <td class="imagify-cell-errors">
354
+ <?php
355
  /* translators: %s is a number. Don't use %d. */
356
  printf( _n( '%s error', '%s errors', 0, 'imagify' ), '<span class="imagify-nb-errors">0</span>' );
357
+ ?>
358
+ </td>
359
  <td class="imagify-cell-totaloriginal" colspan="4"><?php _e( 'Total:', 'imagify' ); ?><strong> <span class="imagify-total-original">0&nbsp;kB</span></strong></td>
360
  <td class="imagify-cell-totalgain"><?php _e( 'Gain:', 'imagify' ); ?><strong> <span class="imagify-total-gain">0&nbsp;kB</span></strong></td>
361
  </tr>
inc/admin/ui/notices.php CHANGED
@@ -291,7 +291,8 @@ function _imagify_warning_over_quota_notice() {
291
  </div>
292
  <div class="imagify-notice-content">
293
  <p class="imagify-notice-title"><strong><?php _e( 'Oops, It\'s Over!', 'imagify' ); ?></strong></p>
294
- <p><?php
 
295
  printf(
296
  /* translators: 1 is a "bold" tag start, 2 is a formatted data quota, 3 is a date, 4 is the "bold" tag end. */
297
  __( 'You have consumed all your credit for this month. You will have %1$s%2$s back on %3$s%4$s.', 'imagify' ),
@@ -307,7 +308,8 @@ function _imagify_warning_over_quota_notice() {
307
  '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription">',
308
  '</a>'
309
  );
310
- ?></p>
 
311
  </div>
312
  <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'free-over-quota' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
313
  </div>
@@ -408,7 +410,7 @@ function _imagify_rocket_notice() {
408
  <a href="<?php echo esc_url( $dismiss_url ); ?>" class="imagify-cross" target="_blank"><span class="dashicons dashicons-no"></span></a>
409
 
410
  <p class="imagify-rkt-logo">
411
- <img src="<?php echo IMAGIFY_ASSETS_IMG_URL ?>logo-wprocket.png" srcset="<?php echo IMAGIFY_ASSETS_IMG_URL ?>logo-wprocket2x.png 2x" alt="WP Rocket" width="118" height="32">
412
  </p>
413
  <p class="imagify-rkt-msg">
414
  <?php
@@ -462,7 +464,8 @@ function _imagify_rating_notice() {
462
  <img class="imagify-logo" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" width="138" height="16" alt="Imagify" />
463
  </div>
464
  <div class="imagify-notice-content">
465
- <p><?php
 
466
  printf(
467
  /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end, 3 is a formatted number (don't use %3$d). */
468
  __( '%1$sCongratulations%2$s, you have optimized %1$s%3$s images%2$s and improved your website\'s speed by reducing your images size.', 'imagify' ),
@@ -470,7 +473,8 @@ function _imagify_rating_notice() {
470
  '</strong>',
471
  number_format_i18n( $user_images_count )
472
  );
473
- ?></p>
 
474
  <p class="imagify-rate-us">
475
  <?php
476
  $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform';
291
  </div>
292
  <div class="imagify-notice-content">
293
  <p class="imagify-notice-title"><strong><?php _e( 'Oops, It\'s Over!', 'imagify' ); ?></strong></p>
294
+ <p>
295
+ <?php
296
  printf(
297
  /* translators: 1 is a "bold" tag start, 2 is a formatted data quota, 3 is a date, 4 is the "bold" tag end. */
298
  __( 'You have consumed all your credit for this month. You will have %1$s%2$s back on %3$s%4$s.', 'imagify' ),
308
  '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription">',
309
  '</a>'
310
  );
311
+ ?>
312
+ </p>
313
  </div>
314
  <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'free-over-quota' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
315
  </div>
410
  <a href="<?php echo esc_url( $dismiss_url ); ?>" class="imagify-cross" target="_blank"><span class="dashicons dashicons-no"></span></a>
411
 
412
  <p class="imagify-rkt-logo">
413
+ <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>logo-wprocket.png" srcset="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>logo-wprocket2x.png 2x" alt="WP Rocket" width="118" height="32">
414
  </p>
415
  <p class="imagify-rkt-msg">
416
  <?php
464
  <img class="imagify-logo" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" width="138" height="16" alt="Imagify" />
465
  </div>
466
  <div class="imagify-notice-content">
467
+ <p>
468
+ <?php
469
  printf(
470
  /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end, 3 is a formatted number (don't use %3$d). */
471
  __( '%1$sCongratulations%2$s, you have optimized %1$s%3$s images%2$s and improved your website\'s speed by reducing your images size.', 'imagify' ),
473
  '</strong>',
474
  number_format_i18n( $user_images_count )
475
  );
476
+ ?>
477
+ </p>
478
  <p class="imagify-rate-us">
479
  <?php
480
  $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform';
inc/admin/ui/options.php CHANGED
@@ -65,14 +65,16 @@ function _imagify_display_options_page() {
65
 
66
  <?php $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform'; ?>
67
  <p class="imagify-rate-us">
68
- <?php printf(
 
69
  /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end + a line break tag, 3 is a link tag start, 4 is the link tag end. */
70
  __( '%1$sDo you like this plugin?%2$s Please take a few seconds to %3$srate it on WordPress.org%4$s!', 'imagify' ),
71
  '<strong>',
72
  '</strong><br />',
73
  '<a href="' . $imagify_rate_url . '">',
74
  '</a>'
75
- ); ?>
 
76
  <br>
77
  <a class="stars" href="<?php echo $imagify_rate_url; ?>"><?php echo str_repeat( '<span class="dashicons dashicons-star-filled"></span>', 5 ); ?></a>
78
  </p>
@@ -109,7 +111,8 @@ function _imagify_display_options_page() {
109
  </span>
110
 
111
  <?php
112
- } elseif ( ! imagify_valid_key() && get_imagify_option( 'api_key', false ) ) { ?>
 
113
 
114
  <span id="imagify-check-api-container">
115
  <span class="dashicons dashicons-no"></span> <?php _e( 'Your API key isn\'t valid!', 'imagify' ); ?>
@@ -239,11 +242,13 @@ function _imagify_display_options_page() {
239
  <p class="imagify-checkbox-marged">
240
  <span class="imagify-info">
241
  <span class="dashicons dashicons-info"></span>
242
- <?php printf(
 
243
  /* translators: 1 is a number of pixels. */
244
  __( 'This option is recommended to reduce larger images. You can save up to 80%% after resizing. The new width should not be less than your largest thumbnail width, which is actually %dpx.', 'imagify' ),
245
  $max_sizes['width']
246
- ); ?>
 
247
  </span>
248
  </p>
249
  </td>
@@ -273,11 +278,13 @@ function _imagify_display_options_page() {
273
  <p>
274
  <?php _e( 'You can choose to compress different image sizes created by WordPress here.', 'imagify' ); ?>
275
  <br/>
276
- <?php printf(
 
277
  /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end. */
278
  __( 'The %1$soriginal size%2$s is %1$sautomatically optimized%2$s by Imagify.', 'imagify' ),
279
  '<strong>', '</strong>'
280
- ); ?>
 
281
  <br>
282
  <span class="imagify-important">
283
  <?php _e( 'Remember each additional image size will affect your Imagify monthly usage!', 'imagify' ); ?>
@@ -317,7 +324,8 @@ function _imagify_display_options_page() {
317
  <?php
318
  }
319
 
320
- if ( $select_all ) { ?>
 
321
  <em class="hide-if-no-js">
322
  <input id="imagify-toggle-check-thumbnail-sizes-2" type="checkbox" class="mini imagify-toggle-check" <?php checked( ! $has_disallowed ); ?>>
323
  <label for="imagify-toggle-check-thumbnail-sizes-2" onclick=""><?php _e( '(Un)Select All', 'imagify' ); ?></label>
@@ -373,14 +381,16 @@ function _imagify_display_options_page() {
373
  ?>
374
 
375
  <div class="imagify-bulk-info">
376
- <p><?php
 
377
  printf(
378
  /* translators: 1 is a link tag start, 2 is the link tag end. */
379
  __( 'Once your settings saved, optimize all your images by using the %1$sImagify Bulk Optimization%2$s feature.', 'imagify' ),
380
  '<a href="' . esc_url( get_admin_url() ) . 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization">',
381
  '</a>'
382
  );
383
- ?></p>
 
384
  </div>
385
  </div>
386
  </form>
65
 
66
  <?php $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform'; ?>
67
  <p class="imagify-rate-us">
68
+ <?php
69
+ printf(
70
  /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end + a line break tag, 3 is a link tag start, 4 is the link tag end. */
71
  __( '%1$sDo you like this plugin?%2$s Please take a few seconds to %3$srate it on WordPress.org%4$s!', 'imagify' ),
72
  '<strong>',
73
  '</strong><br />',
74
  '<a href="' . $imagify_rate_url . '">',
75
  '</a>'
76
+ );
77
+ ?>
78
  <br>
79
  <a class="stars" href="<?php echo $imagify_rate_url; ?>"><?php echo str_repeat( '<span class="dashicons dashicons-star-filled"></span>', 5 ); ?></a>
80
  </p>
111
  </span>
112
 
113
  <?php
114
+ } elseif ( ! imagify_valid_key() && get_imagify_option( 'api_key', false ) ) {
115
+ ?>
116
 
117
  <span id="imagify-check-api-container">
118
  <span class="dashicons dashicons-no"></span> <?php _e( 'Your API key isn\'t valid!', 'imagify' ); ?>
242
  <p class="imagify-checkbox-marged">
243
  <span class="imagify-info">
244
  <span class="dashicons dashicons-info"></span>
245
+ <?php
246
+ printf(
247
  /* translators: 1 is a number of pixels. */
248
  __( 'This option is recommended to reduce larger images. You can save up to 80%% after resizing. The new width should not be less than your largest thumbnail width, which is actually %dpx.', 'imagify' ),
249
  $max_sizes['width']
250
+ );
251
+ ?>
252
  </span>
253
  </p>
254
  </td>
278
  <p>
279
  <?php _e( 'You can choose to compress different image sizes created by WordPress here.', 'imagify' ); ?>
280
  <br/>
281
+ <?php
282
+ printf(
283
  /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end. */
284
  __( 'The %1$soriginal size%2$s is %1$sautomatically optimized%2$s by Imagify.', 'imagify' ),
285
  '<strong>', '</strong>'
286
+ );
287
+ ?>
288
  <br>
289
  <span class="imagify-important">
290
  <?php _e( 'Remember each additional image size will affect your Imagify monthly usage!', 'imagify' ); ?>
324
  <?php
325
  }
326
 
327
+ if ( $select_all ) {
328
+ ?>
329
  <em class="hide-if-no-js">
330
  <input id="imagify-toggle-check-thumbnail-sizes-2" type="checkbox" class="mini imagify-toggle-check" <?php checked( ! $has_disallowed ); ?>>
331
  <label for="imagify-toggle-check-thumbnail-sizes-2" onclick=""><?php _e( '(Un)Select All', 'imagify' ); ?></label>
381
  ?>
382
 
383
  <div class="imagify-bulk-info">
384
+ <p>
385
+ <?php
386
  printf(
387
  /* translators: 1 is a link tag start, 2 is the link tag end. */
388
  __( 'Once your settings saved, optimize all your images by using the %1$sImagify Bulk Optimization%2$s feature.', 'imagify' ),
389
  '<a href="' . esc_url( get_admin_url() ) . 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization">',
390
  '</a>'
391
  );
392
+ ?>
393
+ </p>
394
  </div>
395
  </div>
396
  </form>
inc/admin/upgrader.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- defined( 'ABSPATH' ) || die( 'Cheatin&#8217; uh?' );
3
 
4
  add_action( 'admin_init', '_imagify_upgrader' );
5
  /**
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin&#8217; uh?' );
3
 
4
  add_action( 'admin_init', '_imagify_upgrader' );
5
  /**
inc/classes/abstracts/class-imagify-abstract-attachment.php CHANGED
@@ -13,7 +13,7 @@ class Imagify_Abstract_Attachment {
13
  *
14
  * @var string
15
  */
16
- const VERSION = '1.0.2';
17
 
18
  /**
19
  * The attachment ID.
@@ -50,12 +50,12 @@ class Imagify_Abstract_Attachment {
50
  }
51
 
52
  /**
53
- * Get the attachment backup filepath.
54
  *
55
- * @since 1.0
56
  * @access public
57
  *
58
- * @return string|false
59
  */
60
  public function get_backup_path() {
61
  return '';
@@ -98,6 +98,18 @@ class Imagify_Abstract_Attachment {
98
  return pathinfo( $fullsize_path, PATHINFO_EXTENSION );
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  /**
102
  * Get the attachment error if there is one.
103
  *
13
  *
14
  * @var string
15
  */
16
+ const VERSION = '1.0.3';
17
 
18
  /**
19
  * The attachment ID.
50
  }
51
 
52
  /**
53
+ * Get the attachment backup file path.
54
  *
55
+ * @since 1.0
56
  * @access public
57
  *
58
+ * @return string|false The file path. False if it doesn't exist.
59
  */
60
  public function get_backup_path() {
61
  return '';
98
  return pathinfo( $fullsize_path, PATHINFO_EXTENSION );
99
  }
100
 
101
+ /**
102
+ * Tell if the current file mime type is supported.
103
+ *
104
+ * @since 1.6.9
105
+ * @author Grégory Viguier
106
+ *
107
+ * @return bool
108
+ */
109
+ public function is_mime_type_supported() {
110
+ return imagify_is_attachment_mime_type_supported( $this->id );
111
+ }
112
+
113
  /**
114
  * Get the attachment error if there is one.
115
  *
inc/classes/class-imagify-attachment.php CHANGED
@@ -13,21 +13,21 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
13
  *
14
  * @var string
15
  */
16
- const VERSION = '1.0.2';
17
 
18
  /**
19
- * Get the attachment backup filepath.
20
  *
21
- * @since 1.0
22
  * @access public
23
  *
24
- * @return string|bool
25
  */
26
  public function get_backup_path() {
27
  $file_path = $this->get_original_path();
28
  $backup_path = get_imagify_attachment_backup_path( $file_path );
29
 
30
- if ( file_exists( $backup_path ) ) {
31
  return $backup_path;
32
  }
33
 
@@ -56,7 +56,8 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
56
  * @return int
57
  */
58
  public function get_optimization_level() {
59
- return (int) get_post_meta( $this->id, '_imagify_optimization_level', true );
 
60
  }
61
 
62
  /**
@@ -106,7 +107,7 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
106
  */
107
  public function update_metadata_size() {
108
  // Check if the attachment extension is allowed.
109
- if ( ! imagify_is_attachment_mime_type_supported( $this->id ) ) {
110
  return false;
111
  }
112
 
@@ -205,7 +206,7 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
205
  */
206
  public function optimize( $optimization_level = null, $metadata = array() ) {
207
  // Check if the attachment extension is allowed.
208
- if ( ! imagify_is_attachment_mime_type_supported( $this->id ) ) {
209
  return;
210
  }
211
 
@@ -364,7 +365,7 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
364
  */
365
  public function restore() {
366
  // Check if the attachment extension is allowed.
367
- if ( ! imagify_is_attachment_mime_type_supported( $this->id ) ) {
368
  return;
369
  }
370
 
13
  *
14
  * @var string
15
  */
16
+ const VERSION = '1.0.3';
17
 
18
  /**
19
+ * Get the attachment backup file path.
20
  *
21
+ * @since 1.0
22
  * @access public
23
  *
24
+ * @return string|false The file path. False if it doesn't exist.
25
  */
26
  public function get_backup_path() {
27
  $file_path = $this->get_original_path();
28
  $backup_path = get_imagify_attachment_backup_path( $file_path );
29
 
30
+ if ( $backup_path && file_exists( $backup_path ) ) {
31
  return $backup_path;
32
  }
33
 
56
  * @return int
57
  */
58
  public function get_optimization_level() {
59
+ $level = get_post_meta( $this->id, '_imagify_optimization_level', true );
60
+ return false !== $level ? (int) $level : false;
61
  }
62
 
63
  /**
107
  */
108
  public function update_metadata_size() {
109
  // Check if the attachment extension is allowed.
110
+ if ( ! $this->is_mime_type_supported() ) {
111
  return false;
112
  }
113
 
206
  */
207
  public function optimize( $optimization_level = null, $metadata = array() ) {
208
  // Check if the attachment extension is allowed.
209
+ if ( ! $this->is_mime_type_supported() ) {
210
  return;
211
  }
212
 
365
  */
366
  public function restore() {
367
  // Check if the attachment extension is allowed.
368
+ if ( ! $this->is_mime_type_supported() ) {
369
  return;
370
  }
371
 
inc/classes/class-imagify-rocket-infos.php ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Class that handles WP Rocket infos in the "Add Plugins" screen.
6
+ *
7
+ * @since 1.6.9
8
+ */
9
+ class Imagify_Rocket_Infos {
10
+
11
+ /**
12
+ * Class version.
13
+ *
14
+ * @var string
15
+ */
16
+ const VERSION = '1.0';
17
+
18
+ /**
19
+ * The URL to request.
20
+ *
21
+ * @var string
22
+ */
23
+ const REQUEST_URL = 'https://wp-rocket.me/stat/1.0/wp-rocket/';
24
+
25
+ /**
26
+ * The name of the transient that stores the WP Rocket infos.
27
+ *
28
+ * @var string
29
+ */
30
+ const TRANSIENT_NAME = 'imagify_rocket_plugin_info';
31
+
32
+ /**
33
+ * Time until transient expiration in seconds.
34
+ *
35
+ * @access protected
36
+ * @var int
37
+ */
38
+ protected static $transient_expiration;
39
+
40
+ /**
41
+ * Time until transient expiration in seconds, in case of error.
42
+ *
43
+ * @access protected
44
+ * @var int
45
+ */
46
+ protected static $error_expiration;
47
+
48
+ /**
49
+ * The headers to send along the request.
50
+ *
51
+ * @access protected
52
+ * @var array
53
+ */
54
+ protected static $headers = array();
55
+
56
+ /**
57
+ * The plugin information.
58
+ *
59
+ * @access protected
60
+ * @var object
61
+ */
62
+ protected static $plugin_information;
63
+
64
+ /**
65
+ * The single instance of the class.
66
+ *
67
+ * @access protected
68
+ * @var object
69
+ */
70
+ protected static $_instance;
71
+
72
+
73
+ /** ----------------------------------------------------------------------------------------- */
74
+ /** INSTANCE, INIT ========================================================================== */
75
+ /** ----------------------------------------------------------------------------------------- */
76
+
77
+ /**
78
+ * Class constructor: set properties.
79
+ *
80
+ * @access protected
81
+ * @since 1.6.9
82
+ * @author Grégory Viguier
83
+ */
84
+ protected function __construct() {
85
+ self::$transient_expiration = 2 * WEEK_IN_SECONDS;
86
+ self::$error_expiration = 5 * MINUTE_IN_SECONDS;
87
+ self::$headers['X-Locale'] = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
88
+ }
89
+
90
+ /**
91
+ * Get the main Instance.
92
+ *
93
+ * @access public
94
+ * @since 1.6.9
95
+ * @author Grégory Viguier
96
+ *
97
+ * @return object Main instance.
98
+ */
99
+ public static function get_instance() {
100
+ if ( ! isset( self::$_instance ) ) {
101
+ self::$_instance = new self();
102
+ }
103
+
104
+ return self::$_instance;
105
+ }
106
+
107
+ /**
108
+ * Hooks init.
109
+ *
110
+ * @access public
111
+ * @since 1.6.9
112
+ * @author Grégory Viguier
113
+ */
114
+ public function init() {
115
+ global $wp_version;
116
+
117
+ // Filter the plugin API results to inject WP Rocket.
118
+ add_filter( 'plugins_api_result', array( $this, 'add_api_result' ), IMAGIFY_INT_MAX, 3 );
119
+
120
+ // Change order for the featured tab.
121
+ if ( is_network_admin() ) {
122
+ add_filter( 'views_plugin-install-network', array( $this, 'change_featured_items_order' ), IMAGIFY_INT_MAX );
123
+ } else {
124
+ add_filter( 'views_plugin-install', array( $this, 'change_featured_items_order' ), IMAGIFY_INT_MAX );
125
+ }
126
+
127
+ // Filter the iframe src to return WP Rocket's site URL (More Details popup).
128
+ if ( version_compare( $wp_version, '4.9' ) >= 0 ) {
129
+ add_filter( 'self_admin_url', array( $this, 'filter_iframe_src' ), 100, 2 );
130
+ } else {
131
+ add_filter( 'network_admin_url', array( $this, 'filter_iframe_src' ), 100, 2 );
132
+ add_filter( 'user_admin_url', array( $this, 'filter_iframe_src' ), 100, 2 );
133
+ add_filter( 'admin_url', array( $this, 'filter_iframe_src' ), 100, 2 );
134
+ }
135
+
136
+ // Filter the iframe action links to display a "Buy Now" button.
137
+ add_filter( 'plugin_install_action_links', array( $this, 'add_action_link' ), 10, 2 );
138
+ }
139
+
140
+
141
+ /** ----------------------------------------------------------------------------------------- */
142
+ /** HOOKS =================================================================================== */
143
+ /** ----------------------------------------------------------------------------------------- */
144
+
145
+ /**
146
+ * Filter the plugin API results to inject WP Rocket.
147
+ *
148
+ * @access public
149
+ * @since 1.6.9
150
+ * @author Grégory Viguier
151
+ *
152
+ * @param object $result Response object or WP_Error object.
153
+ * @param string $action The type of information being requested from the Plugin Install API.
154
+ * @param object $args Plugin API arguments.
155
+ * @return array|object Updated array of results or WP_Error object.
156
+ */
157
+ public function add_api_result( $result, $action, $args ) {
158
+ if ( is_wp_error( $result ) || empty( $args->browse ) ) {
159
+ return $result;
160
+ }
161
+
162
+ if ( 'featured' !== $args->browse && 'recommended' !== $args->browse && 'popular' !== $args->browse ) {
163
+ return $result;
164
+ }
165
+
166
+ if ( ! isset( $result->info['page'] ) || 1 < $result->info['page'] ) {
167
+ return $result;
168
+ }
169
+
170
+ if ( defined( 'WP_ROCKET_VERSION' ) || file_exists( WP_PLUGIN_DIR . '/wp-rocket/wp-rocket.php' ) ) {
171
+ return $result;
172
+ }
173
+
174
+ $plugin_info = $this->get_plugin_info();
175
+
176
+ if ( is_wp_error( $plugin_info ) ) {
177
+ return $result;
178
+ }
179
+
180
+ array_unshift( $result->plugins, $plugin_info );
181
+
182
+ if ( isset( $result->info['results'] ) ) {
183
+ ++$result->info['results'];
184
+ }
185
+
186
+ return $result;
187
+ }
188
+
189
+ /**
190
+ * Put WP Rocket back at the first place in the Featured tab.
191
+ * In the Featured tab, WP uses `uasort()` to reorder the items. But the order is made on a non-existing property (group), so as a result, the items are ramdomized.
192
+ *
193
+ * @access public
194
+ * @since 1.6.9
195
+ * @author Grégory Viguier
196
+ *
197
+ * @param array $views An array of available list table views.
198
+ * @return array The same array.
199
+ */
200
+ function change_featured_items_order( $views ) {
201
+ global $wp_list_table;
202
+
203
+ if ( 'group' !== $wp_list_table->orderby ) {
204
+ return $views;
205
+ }
206
+
207
+ foreach ( $wp_list_table->items as $i => $item ) {
208
+ $item = (object) $item;
209
+
210
+ if ( 'wp-rocket' === $item->slug ) {
211
+ unset( $wp_list_table->items[ $i ] );
212
+ array_unshift( $wp_list_table->items, $item );
213
+ break;
214
+ }
215
+ }
216
+
217
+ return $views;
218
+ }
219
+
220
+ /**
221
+ * Filter the iframe src to return WP Rocket's site URL (More Details popup).
222
+ *
223
+ * @access public
224
+ * @since 1.6.9
225
+ * @author Grégory Viguier
226
+ *
227
+ * @param string $url The complete URL including scheme and path.
228
+ * @param string $path Path relative to the URL. Blank string if no path is specified.
229
+ * @return string
230
+ */
231
+ public function filter_iframe_src( $url, $path ) {
232
+ if ( ! preg_match( '@/wp-admin/(?:network/user/)?plugin-install.php\?@', $url ) ) {
233
+ return $url;
234
+ }
235
+
236
+ $parsed_url = wp_parse_url( $url );
237
+
238
+ if ( empty( $parsed_url['query'] ) ) {
239
+ return $url;
240
+ }
241
+
242
+ $parsed_url['query'] = htmlspecialchars_decode( $parsed_url['query'] );
243
+ wp_parse_str( $parsed_url['query'], $params );
244
+
245
+ if ( ! isset( $params['tab'], $params['plugin'] ) || 'plugin-information' !== $params['tab'] || 'wp-rocket' !== $params['plugin'] ) {
246
+ return $url;
247
+ }
248
+
249
+ $url = imagify_get_wp_rocket_url( false, array(
250
+ 'utm_source' => 'wpaddplugins',
251
+ 'utm_medium' => 'imagify',
252
+ 'utm_campaign' => 'moredetails',
253
+ ) );
254
+
255
+ return $url . '#TB_iframe=true&width=772&height=712';
256
+ }
257
+
258
+ /**
259
+ * Filter the iframe action links to display a "Buy Now" button.
260
+ *
261
+ * @access public
262
+ * @since 1.6.9
263
+ * @author Grégory Viguier
264
+ *
265
+ * @param array $links Links for plugin.
266
+ * @param array $plugin Plugin data.
267
+ * @return array
268
+ */
269
+ public function add_action_link( $links, $plugin ) {
270
+ if ( empty( $plugin['slug'] ) || 'wp-rocket' !== $plugin['slug'] ) {
271
+ return $links;
272
+ }
273
+
274
+ // Remove the "Install Now" button.
275
+ if ( $links ) {
276
+ foreach ( $links as $i => $link ) {
277
+ if ( strpos( $link, 'install-now' ) !== false ) {
278
+ unset( $links[ $i ] );
279
+ break;
280
+ }
281
+ }
282
+ }
283
+
284
+ // Add the "Buy Now" button.
285
+ $link = '<a class="button" target="_blank" data-slug="wp-rocket" href="%s" aria-label="%s" data-name="WP Rocket">%s</a>';
286
+ $url = imagify_get_wp_rocket_url( false, array(
287
+ 'utm_source' => 'wpaddplugins',
288
+ 'utm_medium' => 'imagify',
289
+ 'utm_campaign' => 'imagify',
290
+ ) );
291
+
292
+ array_unshift( $links, sprintf(
293
+ $link,
294
+ esc_url( $url ),
295
+ /* translators: %s is a plugin name. */
296
+ esc_attr( sprintf( __( 'Buy %s now', 'imagify' ), 'WP Rocket' ) ),
297
+ __( 'Buy Now', 'imagify' )
298
+ ) );
299
+
300
+ return $links;
301
+ }
302
+
303
+
304
+ /** ----------------------------------------------------------------------------------------- */
305
+ /** TOOLS TO GET THE PLUGIN INFOS =========================================================== */
306
+ /** ----------------------------------------------------------------------------------------- */
307
+
308
+ /**
309
+ * Get the plugin infos.
310
+ *
311
+ * @access public
312
+ * @since 1.6.9
313
+ * @author Grégory Viguier
314
+ *
315
+ * @return object The plugin informations object or WP_Error object.
316
+ */
317
+ public function get_plugin_info() {
318
+ if ( ! isset( self::$plugin_information ) ) {
319
+ // Get the plugin info stored in a transient.
320
+ self::$plugin_information = $this->get_stored_data();
321
+ }
322
+
323
+ if ( self::$plugin_information ) {
324
+ // We have something.
325
+ return self::$plugin_information;
326
+ }
327
+
328
+ // Fetch new data.
329
+ self::$plugin_information = wp_remote_get( self::REQUEST_URL, array(
330
+ 'headers' => self::$headers,
331
+ 'timeout' => 15,
332
+ ) );
333
+
334
+ if ( is_wp_error( self::$plugin_information ) ) {
335
+ // Requests are blocked.
336
+ return $this->store_data();
337
+ }
338
+
339
+ $response_code = wp_remote_retrieve_response_code( self::$plugin_information );
340
+
341
+ if ( 200 !== $response_code ) {
342
+ // Trouble on the WP Rocket site's side.
343
+ self::$plugin_information = new WP_Error( 'imagify_response_code', 'Information about the plugin could not be retrieved.' );
344
+ return $this->store_data();
345
+ }
346
+
347
+ self::$plugin_information = maybe_unserialize( wp_remote_retrieve_body( self::$plugin_information ) );
348
+
349
+ if ( ! is_object( self::$plugin_information ) ) {
350
+ // Trouble on the WP Rocket site's side.
351
+ self::$plugin_information = new WP_Error( 'imagify_format', 'Information about the plugin could not be retrieved.' );
352
+ return $this->store_data();
353
+ }
354
+
355
+ self::$plugin_information->short_description = 'The best WordPress caching plugin to speed up your site, optimize your SEO and increase your conversions. It’s never been easier to improve your loading time in a few clicks.';
356
+
357
+ return $this->store_data();
358
+ }
359
+
360
+ /**
361
+ * Get the data stored in the database.
362
+ *
363
+ * @access public
364
+ * @since 1.6.9
365
+ * @author Grégory Viguier
366
+ *
367
+ * @return object The plugin informations object or WP_Error object.
368
+ */
369
+ protected function get_stored_data() {
370
+ self::$plugin_information = get_site_transient( self::TRANSIENT_NAME );
371
+ return $this->translate_informations();
372
+ }
373
+
374
+ /**
375
+ * Store the data into in the database.
376
+ *
377
+ * @access public
378
+ * @since 1.6.9
379
+ * @author Grégory Viguier
380
+ *
381
+ * @return object The plugin informations object or WP_Error object.
382
+ */
383
+ protected function store_data() {
384
+ $expiration = self::$transient_expiration;
385
+
386
+ if ( is_wp_error( self::$plugin_information ) ) {
387
+ $expiration = self::$error_expiration;
388
+ }
389
+
390
+ set_site_transient( self::TRANSIENT_NAME, self::$plugin_information, $expiration );
391
+
392
+ return $this->translate_informations();
393
+ }
394
+
395
+ /**
396
+ * Translate some of the plugin informations.
397
+ *
398
+ * @access public
399
+ * @since 1.6.9
400
+ * @author Grégory Viguier
401
+ *
402
+ * @return object The plugin informations object or WP_Error object.
403
+ */
404
+ protected function translate_informations() {
405
+ if ( ! self::$plugin_information || is_wp_error( self::$plugin_information ) ) {
406
+ return self::$plugin_information;
407
+ }
408
+
409
+ /* translators: %s is a WordPress version. */
410
+ self::$plugin_information->requires = preg_replace( '@([\d.]+) or higher@', sprintf( __( '%s or higher', 'imagify' ), '$1' ), self::$plugin_information->requires );
411
+ self::$plugin_information->requires = str_replace( 'Requires PHP:', __( 'Requires PHP:', 'imagify' ), self::$plugin_information->requires );
412
+ self::$plugin_information->homepage = imagify_get_wp_rocket_url( false, array(
413
+ 'utm_source' => 'wpaddplugins',
414
+ 'utm_medium' => 'imagify',
415
+ 'utm_campaign' => 'imagify',
416
+ ) );
417
+ self::$plugin_information->short_description = __( 'The best WordPress caching plugin to speed up your site, optimize your SEO and increase your conversions. It’s never been easier to improve your loading time in a few clicks.', 'imagify' );
418
+
419
+ return self::$plugin_information;
420
+ }
421
+ }
422
+
423
+ /**
424
+ * Returns the main instance of the Imagify_Rocket_Infos class.
425
+ *
426
+ * @since 1.6.9
427
+ * @author Grégory Viguier
428
+ *
429
+ * @return object The Imagify_Rocket_Infos instance.
430
+ */
431
+ function imagify_rocket_infos() {
432
+ return Imagify_Rocket_Infos::get_instance();
433
+ }
inc/classes/class-imagify.php CHANGED
@@ -393,7 +393,7 @@ class Imagify extends Imagify_Deprecated {
393
  * @author Grégory Viguier
394
  *
395
  * @param string $url The URL to call.
396
- * @param array $args The request args.
397
  * @return object
398
  */
399
  private function curl_http_call( $url, $args = array() ) {
@@ -402,6 +402,8 @@ class Imagify extends Imagify_Deprecated {
402
  return new WP_Error( 'curl', 'cURL isn\'t installed on the server.' );
403
  }
404
 
 
 
405
  try {
406
  $ch = curl_init();
407
 
@@ -417,7 +419,7 @@ class Imagify extends Imagify_Deprecated {
417
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $args['post_data'] );
418
  }
419
 
420
- curl_setopt( $ch, CURLOPT_URL, self::API_ENDPOINT . $url );
421
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
422
  curl_setopt( $ch, CURLOPT_HTTPHEADER, $this->headers );
423
  curl_setopt( $ch, CURLOPT_TIMEOUT, $args['timeout'] );
@@ -431,8 +433,37 @@ class Imagify extends Imagify_Deprecated {
431
 
432
  curl_close( $ch );
433
  } catch ( Exception $e ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  return new WP_Error( 'curl', 'Unknown error occurred' );
435
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
 
437
  return $this->handle_response( $response, $http_code, $error );
438
  }
393
  * @author Grégory Viguier
394
  *
395
  * @param string $url The URL to call.
396
+ * @param array $args The request arguments.
397
  * @return object
398
  */
399
  private function curl_http_call( $url, $args = array() ) {
402
  return new WP_Error( 'curl', 'cURL isn\'t installed on the server.' );
403
  }
404
 
405
+ $url = self::API_ENDPOINT . $url;
406
+
407
  try {
408
  $ch = curl_init();
409
 
419
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $args['post_data'] );
420
  }
421
 
422
+ curl_setopt( $ch, CURLOPT_URL, $url );
423
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
424
  curl_setopt( $ch, CURLOPT_HTTPHEADER, $this->headers );
425
  curl_setopt( $ch, CURLOPT_TIMEOUT, $args['timeout'] );
433
 
434
  curl_close( $ch );
435
  } catch ( Exception $e ) {
436
+ $args['headers'] = $this->headers;
437
+ /**
438
+ * Fires after a failed curl request.
439
+ *
440
+ * @since 1.6.9
441
+ * @author Grégory Viguier
442
+ *
443
+ * @param string $url The requested URL.
444
+ * @param array $args The request arguments.
445
+ * @param object $e The raised Exception.
446
+ */
447
+ do_action( 'imagify_curl_http_response', $url, $args, $e );
448
+
449
  return new WP_Error( 'curl', 'Unknown error occurred' );
450
+ } // End try().
451
+
452
+ $args['headers'] = $this->headers;
453
+
454
+ /**
455
+ * Fires after a successful curl request.
456
+ *
457
+ * @since 1.6.9
458
+ * @author Grégory Viguier
459
+ *
460
+ * @param string $url The requested URL.
461
+ * @param array $args The request arguments.
462
+ * @param string $response The request response.
463
+ * @param int $http_code The request HTTP code.
464
+ * @param string $error An error message.
465
+ */
466
+ do_action( 'imagify_curl_http_response', $url, $args, $response, $http_code, $error );
467
 
468
  return $this->handle_response( $response, $http_code, $error );
469
  }
inc/compat.php CHANGED
@@ -4,10 +4,11 @@ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
4
  if ( ! function_exists( 'curl_file_create' ) ) :
5
 
6
  /**
7
- * Create a CURLFile object.
8
  *
9
  * @since 1.0
10
  * @since PHP 5.5
 
11
  *
12
  * @param string $filename Path to the file which will be uploaded.
13
  * @param string $mimetype Mimetype of the file.
@@ -22,6 +23,39 @@ if ( ! function_exists( 'curl_file_create' ) ) :
22
 
23
  endif;
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  if ( ! function_exists( 'wp_json_encode' ) ) :
26
 
27
  /**
@@ -167,7 +201,7 @@ if ( ! function_exists( '_wp_json_sanity_check' ) ) :
167
  }
168
  }
169
  } elseif ( is_object( $data ) ) {
170
- $output = new stdClass;
171
  foreach ( $data as $id => $el ) {
172
  if ( is_string( $id ) ) {
173
  $clean_id = _wp_json_convert_string( $id );
@@ -258,3 +292,133 @@ if ( ! function_exists( 'wp_normalize_path' ) ) :
258
  }
259
 
260
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  if ( ! function_exists( 'curl_file_create' ) ) :
5
 
6
  /**
7
+ * PHP-agnostic version of curl_file_create(): create a CURLFile object.
8
  *
9
  * @since 1.0
10
  * @since PHP 5.5
11
+ * @see http://dk2.php.net/manual/en/function.curl-file-create.php
12
  *
13
  * @param string $filename Path to the file which will be uploaded.
14
  * @param string $mimetype Mimetype of the file.
23
 
24
  endif;
25
 
26
+ if ( ! function_exists( 'array_replace' ) ) :
27
+ /**
28
+ * PHP-agnostic version of array_replace(): replaces elements from passed arrays into the first array.
29
+ *
30
+ * @since 1.6.9
31
+ * @since PHP 5.3
32
+ * @see http://dk2.php.net/manual/en/function.array-replace.php
33
+ * @author Grégory Viguier
34
+ *
35
+ * @param array $target The array in which elements are replaced.
36
+ * @param array $replacements The array from which elements will be extracted.
37
+ * More arrays from which elements will be extracted. Values from later arrays overwrite the previous values.
38
+ * @return array|null The resulting array. Null if an error occurs.
39
+ */
40
+ function array_replace( $target = array(), $replacements = array() ) {
41
+ $replacements = func_get_args();
42
+ array_shift( $replacements );
43
+
44
+ foreach ( $replacements as $i => $add ) {
45
+ if ( ! is_array( $add ) ) {
46
+ trigger_error( __FUNCTION__ . '(): Argument #' . ( $i + 2 ) . ' is not an array', E_USER_WARNING );
47
+ return null;
48
+ }
49
+
50
+ foreach ( $add as $k => $v ) {
51
+ $target[ $k ] = $v;
52
+ }
53
+ }
54
+
55
+ return $target;
56
+ }
57
+ endif;
58
+
59
  if ( ! function_exists( 'wp_json_encode' ) ) :
60
 
61
  /**
201
  }
202
  }
203
  } elseif ( is_object( $data ) ) {
204
+ $output = new stdClass();
205
  foreach ( $data as $id => $el ) {
206
  if ( is_string( $id ) ) {
207
  $clean_id = _wp_json_convert_string( $id );
292
  }
293
 
294
  endif;
295
+
296
+
297
+ if ( ! function_exists( 'wp_parse_url' ) ) :
298
+ /**
299
+ * A wrapper for PHP's parse_url() function that handles consistency in the return
300
+ * values across PHP versions.
301
+ *
302
+ * PHP 5.4.7 expanded parse_url()'s ability to handle non-absolute url's, including
303
+ * schemeless and relative url's with :// in the path. This function works around
304
+ * those limitations providing a standard output on PHP 5.2~5.4+.
305
+ *
306
+ * Secondly, across various PHP versions, schemeless URLs starting containing a ":"
307
+ * in the query are being handled inconsistently. This function works around those
308
+ * differences as well.
309
+ *
310
+ * Error suppression is used as prior to PHP 5.3.3, an E_WARNING would be generated
311
+ * when URL parsing failed.
312
+ *
313
+ * @since 1.6.9
314
+ * @since WP 4.4.0
315
+ * @since WP 4.7.0 The $component parameter was added for parity with PHP's parse_url().
316
+ *
317
+ * @param (string) $url The URL to parse.
318
+ * @param (int) $component The specific component to retrieve. Use one of the PHP
319
+ * predefined constants to specify which one.
320
+ * Defaults to -1 (= return all parts as an array).
321
+ * @see http://php.net/manual/en/function.parse-url.php
322
+ *
323
+ * @return (mixed) False on parse failure; Array of URL components on success;
324
+ * When a specific component has been requested: null if the component
325
+ * doesn't exist in the given URL; a sting or - in the case of
326
+ * PHP_URL_PORT - integer when it does. See parse_url()'s return values.
327
+ */
328
+ function wp_parse_url( $url, $component = -1 ) {
329
+ $to_unset = array();
330
+ $url = strval( $url );
331
+
332
+ if ( '//' === substr( $url, 0, 2 ) ) {
333
+ $to_unset[] = 'scheme';
334
+ $url = 'placeholder:' . $url;
335
+ } elseif ( '/' === substr( $url, 0, 1 ) ) {
336
+ $to_unset[] = 'scheme';
337
+ $to_unset[] = 'host';
338
+ $url = 'placeholder://placeholder' . $url;
339
+ }
340
+
341
+ $parts = @parse_url( $url );
342
+
343
+ if ( false === $parts ) {
344
+ // Parsing failure.
345
+ return $parts;
346
+ }
347
+
348
+ // Remove the placeholder values.
349
+ if ( $to_unset ) {
350
+ foreach ( $to_unset as $key ) {
351
+ unset( $parts[ $key ] );
352
+ }
353
+ }
354
+
355
+ return _get_component_from_parsed_url_array( $parts, $component );
356
+ }
357
+ endif;
358
+
359
+
360
+ if ( ! function_exists( '_get_component_from_parsed_url_array' ) ) :
361
+ /**
362
+ * Retrieve a specific component from a parsed URL array.
363
+ *
364
+ * @since 1.6.9
365
+ * @since WP 4.7.0
366
+ *
367
+ * @param (array|false) $url_parts The parsed URL. Can be false if the URL failed to parse.
368
+ * @param (int) $component The specific component to retrieve. Use one of the PHP
369
+ * predefined constants to specify which one.
370
+ * Defaults to -1 (= return all parts as an array).
371
+ * @see http://php.net/manual/en/function.parse-url.php
372
+ *
373
+ * @return (mixed) False on parse failure; Array of URL components on success;
374
+ * When a specific component has been requested: null if the component
375
+ * doesn't exist in the given URL; a sting or - in the case of
376
+ * PHP_URL_PORT - integer when it does. See parse_url()'s return values.
377
+ */
378
+ function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) {
379
+ if ( -1 === $component ) {
380
+ return $url_parts;
381
+ }
382
+
383
+ $key = _wp_translate_php_url_constant_to_key( $component );
384
+
385
+ if ( false !== $key && is_array( $url_parts ) && isset( $url_parts[ $key ] ) ) {
386
+ return $url_parts[ $key ];
387
+ } else {
388
+ return null;
389
+ }
390
+ }
391
+ endif;
392
+
393
+
394
+ if ( ! function_exists( '_wp_translate_php_url_constant_to_key' ) ) :
395
+ /**
396
+ * Translate a PHP_URL_* constant to the named array keys PHP uses.
397
+ *
398
+ * @since 1.6.9
399
+ * @since WP 4.7.0
400
+ * @see http://php.net/manual/en/url.constants.php
401
+ *
402
+ * @param (int) $constant PHP_URL_* constant.
403
+ *
404
+ * @return (string|bool) The named key or false.
405
+ */
406
+ function _wp_translate_php_url_constant_to_key( $constant ) {
407
+ $translation = array(
408
+ PHP_URL_SCHEME => 'scheme',
409
+ PHP_URL_HOST => 'host',
410
+ PHP_URL_PORT => 'port',
411
+ PHP_URL_USER => 'user',
412
+ PHP_URL_PASS => 'pass',
413
+ PHP_URL_PATH => 'path',
414
+ PHP_URL_QUERY => 'query',
415
+ PHP_URL_FRAGMENT => 'fragment',
416
+ );
417
+
418
+ if ( isset( $translation[ $constant ] ) ) {
419
+ return $translation[ $constant ];
420
+ } else {
421
+ return false;
422
+ }
423
+ }
424
+ endif;
inc/functions/admin-ui.php CHANGED
@@ -181,7 +181,7 @@ function get_imagify_attachment_reoptimize_link( $attachment, $context = 'wp' )
181
  $args['optimization_level'] = 2;
182
  $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
183
  /* translators: %s is an optimization level. */
184
- $output .= '<span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Ultra', 'imagify' ) );
185
  $output .= '</a>';
186
  }
187
 
@@ -190,7 +190,7 @@ function get_imagify_attachment_reoptimize_link( $attachment, $context = 'wp' )
190
  $args['optimization_level'] = 1;
191
  $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
192
  /* translators: %s is an optimization level. */
193
- $output .= '<span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Aggressive', 'imagify' ) );
194
  $output .= '</a>';
195
  }
196
 
@@ -199,7 +199,7 @@ function get_imagify_attachment_reoptimize_link( $attachment, $context = 'wp' )
199
  $args['optimization_level'] = 0;
200
  $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
201
  /* translators: %s is an optimization level. */
202
- $output .= '<span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Normal', 'imagify' ) );
203
  $output .= '</a>';
204
  }
205
 
@@ -221,7 +221,7 @@ function get_imagify_media_column_content( $attachment, $context = 'wp' ) {
221
  $attachment_ext = $attachment->get_extension();
222
 
223
  // Check if the attachment extension is allowed.
224
- if ( 'wp' === $context && ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
225
  /* translators: %s is a file extension. */
226
  return sprintf( __( '%s can\'t be optimized', 'imagify' ), strtoupper( $attachment_ext ) );
227
  }
@@ -405,7 +405,7 @@ function imagify_payment_modal() {
405
  <label for="imagify-subscription-monthly"><?php esc_html_e( 'Monthly' , 'imagify' ); ?></label>
406
 
407
  <input id="imagify-subscription-yearly" type="radio" value="yearly" name="plan-subscription">
408
- <label for="imagify-subscription-yearly"><?php esc_html_e( 'Yearly' , 'imagify' ); ?><span class="imagify-2-free"><?php esc_html_e( '2 months free', 'imagify' ) ?></span></label>
409
  </div><!-- .imagify-radio-line -->
410
  </div><!-- .imagify-offer-header -->
411
 
@@ -519,7 +519,7 @@ function imagify_payment_modal() {
519
  <label for="imagify-coupon-code"><?php _e( 'If you have a <strong>coupon code</strong><br> use it there:', 'imagify' ); ?></label>
520
  </p>
521
  <p class="imagify-coupon-input">
522
- <input type="text" class="imagify-coupon-code" name="imagify-coupon-code" id="imagify-coupon-code" value="" placeholder="<?php _e( 'Coupon Code', 'imagify' ) ?>" autocomplete="off">
523
  <button type="button" class="button button-secondary imagify-button-secondary" id="imagify-coupon-validate"><?php _e( 'OK' ); ?></button>
524
  </p>
525
  </div>
@@ -571,7 +571,7 @@ function imagify_payment_modal() {
571
  <label for="imagify-pricing-montly"><?php esc_html_e( 'Monthly' , 'imagify' ); ?></label>
572
 
573
  <input id="imagify-pricing-yearly" type="radio" value="yearly" name="plan-pricing">
574
- <label for="imagify-pricing-yearly"><?php esc_html_e( 'Yearly' , 'imagify' ); ?><span class="imagify-2-free imagify-b-right"><?php esc_html_e( '2 months free', 'imagify' ) ?></span></label>
575
  </div><!-- .imagify-radio-line -->
576
 
577
 
@@ -632,7 +632,7 @@ function imagify_payment_modal() {
632
  </p>
633
  </div>
634
  <div class="imagify-col imagify-txt-end">
635
- <p><a class="button imagify-button-ghost imagify-button-medium imagify-mt1 imagify-mb1 imagify-mr1" href="https://imagify.io/<?php echo ( get_locale() === 'fr_FR' ? 'fr/' : '' ) ?>contact" target="_blank"><i class="dashicons dashicons-email" aria-hidden="true"></i>&nbsp;<?php esc_html_e( 'Contact Us', 'imagify' ); ?></a></p>
636
  </div>
637
  </div>
638
 
@@ -714,7 +714,7 @@ function imagify_payment_modal() {
714
 
715
  <div class="imagify-modal-sidebar">
716
  <div class="imagify-modal-sidebar-content imagify-txt-start">
717
- <p class="imagify-modal-sidebar-title"><?php esc_html_e( 'What do our user think about Imagify', 'imagify' ) ?></p>
718
 
719
  <div class="imagify-modal-testimony">
720
  <div class="imagify-modal-testimony-person">
181
  $args['optimization_level'] = 2;
182
  $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
183
  /* translators: %s is an optimization level. */
184
+ $output .= '<span class="dashicons dashicons-admin-generic"></span><span class="imagify-hide-if-small">' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), '</span>' . __( 'Ultra', 'imagify' ) . '<span class="imagify-hide-if-small">' ) . '</span>';
185
  $output .= '</a>';
186
  }
187
 
190
  $args['optimization_level'] = 1;
191
  $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
192
  /* translators: %s is an optimization level. */
193
+ $output .= '<span class="dashicons dashicons-admin-generic"></span><span class="imagify-hide-if-small">' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), '</span>' . __( 'Aggressive', 'imagify' ) . '<span class="imagify-hide-if-small">' ) . '</span>';
194
  $output .= '</a>';
195
  }
196
 
199
  $args['optimization_level'] = 0;
200
  $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
201
  /* translators: %s is an optimization level. */
202
+ $output .= '<span class="dashicons dashicons-admin-generic"></span><span class="imagify-hide-if-small">' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), '</span>' . __( 'Normal', 'imagify' ) . '<span class="imagify-hide-if-small">' ) . '</span>';
203
  $output .= '</a>';
204
  }
205
 
221
  $attachment_ext = $attachment->get_extension();
222
 
223
  // Check if the attachment extension is allowed.
224
+ if ( ! $attachment->is_mime_type_supported() ) {
225
  /* translators: %s is a file extension. */
226
  return sprintf( __( '%s can\'t be optimized', 'imagify' ), strtoupper( $attachment_ext ) );
227
  }
405
  <label for="imagify-subscription-monthly"><?php esc_html_e( 'Monthly' , 'imagify' ); ?></label>
406
 
407
  <input id="imagify-subscription-yearly" type="radio" value="yearly" name="plan-subscription">
408
+ <label for="imagify-subscription-yearly"><?php esc_html_e( 'Yearly' , 'imagify' ); ?><span class="imagify-2-free"><?php esc_html_e( '2 months free', 'imagify' ); ?></span></label>
409
  </div><!-- .imagify-radio-line -->
410
  </div><!-- .imagify-offer-header -->
411
 
519
  <label for="imagify-coupon-code"><?php _e( 'If you have a <strong>coupon code</strong><br> use it there:', 'imagify' ); ?></label>
520
  </p>
521
  <p class="imagify-coupon-input">
522
+ <input type="text" class="imagify-coupon-code" name="imagify-coupon-code" id="imagify-coupon-code" value="" placeholder="<?php _e( 'Coupon Code', 'imagify' ); ?>" autocomplete="off">
523
  <button type="button" class="button button-secondary imagify-button-secondary" id="imagify-coupon-validate"><?php _e( 'OK' ); ?></button>
524
  </p>
525
  </div>
571
  <label for="imagify-pricing-montly"><?php esc_html_e( 'Monthly' , 'imagify' ); ?></label>
572
 
573
  <input id="imagify-pricing-yearly" type="radio" value="yearly" name="plan-pricing">
574
+ <label for="imagify-pricing-yearly"><?php esc_html_e( 'Yearly' , 'imagify' ); ?><span class="imagify-2-free imagify-b-right"><?php esc_html_e( '2 months free', 'imagify' ); ?></span></label>
575
  </div><!-- .imagify-radio-line -->
576
 
577
 
632
  </p>
633
  </div>
634
  <div class="imagify-col imagify-txt-end">
635
+ <p><a class="button imagify-button-ghost imagify-button-medium imagify-mt1 imagify-mb1 imagify-mr1" href="https://imagify.io/<?php echo ( get_locale() === 'fr_FR' ? 'fr/' : '' ); ?>contact" target="_blank"><i class="dashicons dashicons-email" aria-hidden="true"></i>&nbsp;<?php esc_html_e( 'Contact Us', 'imagify' ); ?></a></p>
636
  </div>
637
  </div>
638
 
714
 
715
  <div class="imagify-modal-sidebar">
716
  <div class="imagify-modal-sidebar-content imagify-txt-start">
717
+ <p class="imagify-modal-sidebar-title"><?php esc_html_e( 'What do our user think about Imagify', 'imagify' ); ?></p>
718
 
719
  <div class="imagify-modal-testimony">
720
  <div class="imagify-modal-testimony-person">
inc/functions/admin.php CHANGED
@@ -52,7 +52,7 @@ function get_imagify_admin_url( $action = 'options-general', $arg = array() ) {
52
  case 'manual-upload':
53
  return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_manual_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-manual-upload' );
54
 
55
- case 'restore-upload' :
56
  return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_restore_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-restore-upload' );
57
 
58
  case 'dismiss-notice':
@@ -61,7 +61,7 @@ function get_imagify_admin_url( $action = 'options-general', $arg = array() ) {
61
  case 'bulk-optimization':
62
  return admin_url( 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization' );
63
 
64
- default :
65
  $page = imagify_is_active_for_network() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
66
  return $page . '?page=' . IMAGIFY_SLUG;
67
  }
@@ -156,13 +156,13 @@ function get_imagify_bulk_buffer_size() {
156
  $sizes = count( get_imagify_thumbnail_sizes() );
157
 
158
  switch ( true ) {
159
- case ( $sizes >= 10 ) :
160
  return 1;
161
 
162
- case ( $sizes >= 8 ) :
163
  return 2;
164
 
165
- case ( $sizes >= 6 ) :
166
  return 3;
167
 
168
  default:
@@ -227,13 +227,18 @@ function imagify_get_wpdb_metas( $metas, $ids ) {
227
  * The URL is localized and contains some utm_*** parameters.
228
  *
229
  * @since 1.6.8
 
230
  * @author Grégory Viguier
231
  *
 
 
232
  * @return string The URL.
233
  */
234
- function imagify_get_wp_rocket_url() {
235
  $wprocket_url = 'https://wp-rocket.me/';
236
- $locale = get_locale();
 
 
237
  $suffixes = array(
238
  'fr_FR' => 'fr',
239
  'es_ES' => 'es',
@@ -245,7 +250,37 @@ function imagify_get_wp_rocket_url() {
245
  $wprocket_url .= $suffixes[ $locale ] . '/';
246
  }
247
 
248
- $wprocket_url .= '?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
 
250
- return $wprocket_url;
251
  }
52
  case 'manual-upload':
53
  return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_manual_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-manual-upload' );
54
 
55
+ case 'restore-upload':
56
  return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_restore_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-restore-upload' );
57
 
58
  case 'dismiss-notice':
61
  case 'bulk-optimization':
62
  return admin_url( 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization' );
63
 
64
+ default:
65
  $page = imagify_is_active_for_network() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
66
  return $page . '?page=' . IMAGIFY_SLUG;
67
  }
156
  $sizes = count( get_imagify_thumbnail_sizes() );
157
 
158
  switch ( true ) {
159
+ case ( $sizes >= 10 ):
160
  return 1;
161
 
162
+ case ( $sizes >= 8 ):
163
  return 2;
164
 
165
+ case ( $sizes >= 6 ):
166
  return 3;
167
 
168
  default:
227
  * The URL is localized and contains some utm_*** parameters.
228
  *
229
  * @since 1.6.8
230
+ * @since 1.6.9 Added $path and $query parameters.
231
  * @author Grégory Viguier
232
  *
233
+ * @param string $path A path to add to the URL (URI). Not in use yet.
234
+ * @param array $query An array of query arguments (utm_*).
235
  * @return string The URL.
236
  */
237
+ function imagify_get_wp_rocket_url( $path = false, $query = array() ) {
238
  $wprocket_url = 'https://wp-rocket.me/';
239
+
240
+ // Locale.
241
+ $locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
242
  $suffixes = array(
243
  'fr_FR' => 'fr',
244
  'es_ES' => 'es',
250
  $wprocket_url .= $suffixes[ $locale ] . '/';
251
  }
252
 
253
+ // URI.
254
+ $paths = array(
255
+ 'pricing' => array(
256
+ 'default' => 'pricing',
257
+ 'fr_FR' => 'offres',
258
+ 'es_ES' => 'precios',
259
+ 'it_IT' => 'offerte',
260
+ 'de_DE' => 'preise',
261
+ ),
262
+ );
263
+
264
+ if ( $path ) {
265
+ $path = trim( $path, '/' );
266
+
267
+ if ( isset( $paths[ $path ] ) ) {
268
+ if ( isset( $paths[ $path ][ $locale ] ) ) {
269
+ $wprocket_url .= $paths[ $path ][ $locale ] . '/';
270
+ } else {
271
+ $wprocket_url .= $paths[ $path ]['default'] . '/';
272
+ }
273
+ } else {
274
+ $wprocket_url .= $path . '/';
275
+ }
276
+ }
277
+
278
+ // Query args.
279
+ $query = array_merge( array(
280
+ 'utm_source' => 'imagify-coupon',
281
+ 'utm_medium' => 'plugin',
282
+ 'utm_campaign' => 'imagify',
283
+ ), $query );
284
 
285
+ return add_query_arg( $query, $wprocket_url );
286
  }
inc/functions/attachments.php CHANGED
@@ -16,9 +16,45 @@ function get_imagify_mime_type() {
16
  );
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  /**
20
  * Tell if an attachment has a supported mime type.
21
  * Was previously Imagify_AS3CF::is_mime_type_supported() since 1.6.6.
 
22
  *
23
  * @since 1.6.8
24
  * @author Grégory Viguier
16
  );
17
  }
18
 
19
+ /**
20
+ * Get a file mime type.
21
+ *
22
+ * @since 1.6.9
23
+ * @author Grégory Viguier
24
+ *
25
+ * @param string $file_path A file path (prefered) or a filename.
26
+ * @return string|bool A mime type. False on failure: the last test is limited to mime types supported by Imagify.
27
+ */
28
+ function imagify_get_mime_type_from_file( $file_path ) {
29
+ if ( function_exists( 'exif_imagetype' ) ) {
30
+ $image_type = @exif_imagetype( $file_path );
31
+
32
+ if ( false !== $image_type ) {
33
+ return image_type_to_mime_type( $image_type );
34
+ }
35
+ }
36
+
37
+ if ( function_exists( 'getimagesize' ) ) {
38
+ $image_type = @getimagesize( $file_path );
39
+
40
+ if ( isset( $image_type[2] ) ) {
41
+ return image_type_to_mime_type( $image_type[2] );
42
+ }
43
+ }
44
+
45
+ $image_type = wp_check_filetype( $file_path, array(
46
+ 'jpg|jpeg|jpe' => 'image/jpeg',
47
+ 'png' => 'image/png',
48
+ 'gif' => 'image/gif',
49
+ ) );
50
+
51
+ return $image_type['type'];
52
+ }
53
+
54
  /**
55
  * Tell if an attachment has a supported mime type.
56
  * Was previously Imagify_AS3CF::is_mime_type_supported() since 1.6.6.
57
+ * Ironically, this function is used in Imagify::is_mime_type_supported() since 1.6.9.
58
  *
59
  * @since 1.6.8
60
  * @author Grégory Viguier
inc/functions/deprecated.php CHANGED
@@ -202,3 +202,39 @@ if ( class_exists( 'WpeCommon' ) ) :
202
  }
203
 
204
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
 
204
  endif;
205
+
206
+ if ( function_exists( 'emr_delete_current_files' ) ) :
207
+
208
+ /**
209
+ * Re-Optimize an attachment after replace it with Enable Media Replace.
210
+ *
211
+ * @since 1.0
212
+ * @since 1.6.9 Deprecated.
213
+ * @author Jonathan Buttigieg
214
+ *
215
+ * @param string $guid A post guid.
216
+ */
217
+ function _imagify_optimize_enable_media_replace( $guid ) {
218
+ global $wpdb;
219
+
220
+ _deprecated_function( __FUNCTION__ . '()', '1.6.9', 'imagify_enable_media_replace()->optimize()' );
221
+
222
+ $attachment_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s';", $guid ) );
223
+
224
+ // Stop if the attachment wasn't optimized yet by Imagify.
225
+ if ( ! get_post_meta( $attachment_id, '_imagify_data', true ) ) {
226
+ return;
227
+ }
228
+
229
+ $optimization_level = get_post_meta( $attachment_id, '_imagify_optimization_level', true );
230
+ $class_name = get_imagify_attachment_class_name( 'wp', $attachment_id, 'enable-media-replace-upload-done' );
231
+ $attachment = new $class_name( $attachment_id );
232
+
233
+ // Remove old optimization data.
234
+ $attachment->delete_imagify_data();
235
+
236
+ // Optimize it!!!!!
237
+ $attachment->optimize( $optimization_level );
238
+ }
239
+
240
+ endif;
inc/functions/process.php CHANGED
@@ -223,8 +223,20 @@ function imagify_backup_file( $file_path, $backup_path = null ) {
223
  // Create sub-directories.
224
  wp_mkdir_p( dirname( $backup_path ) );
225
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  // Copy the file.
227
- $filesystem->copy( $file_path, $backup_path, false, FS_CHMOD_FILE );
228
 
229
  // Make sure the backup copy exists.
230
  if ( ! $filesystem->exists( $backup_path ) ) {
223
  // Create sub-directories.
224
  wp_mkdir_p( dirname( $backup_path ) );
225
 
226
+ /**
227
+ * Allow to overwrite the backup file if it already exists.
228
+ *
229
+ * @since 1.6.9
230
+ * @author Grégory Viguier
231
+ *
232
+ * @param bool $overwrite Whether to overwrite the backup file.
233
+ * @param string $file_path The file path.
234
+ * @param string $backup_path The backup path.
235
+ */
236
+ $overwrite = apply_filters( 'imagify_backup_overwrite_backup', false, $file_path, $backup_path );
237
+
238
  // Copy the file.
239
+ $filesystem->copy( $file_path, $backup_path, $overwrite, FS_CHMOD_FILE );
240
 
241
  // Make sure the backup copy exists.
242
  if ( ! $filesystem->exists( $backup_path ) ) {
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: wp_media, GregLone
3
  Tags: compress image, images, performance, optimization, photos, upload, resize, gif, png, jpg, reduce image size, retina
4
  Requires at least: 3.7.0
5
- Tested up to: 4.8.0
6
- Stable tag: 1.6.8
7
 
8
  Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.
9
 
@@ -136,6 +136,16 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
136
  3. Media Page
137
 
138
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
139
  = 1.6.8 =
140
  * Improvement: don't display the restore bulk action in the medias list if there is nothing to restore.
141
  * Improvement: you can know select and unselect all image sizes at once in the settings page.
2
  Contributors: wp_media, GregLone
3
  Tags: compress image, images, performance, optimization, photos, upload, resize, gif, png, jpg, reduce image size, retina
4
  Requires at least: 3.7.0
5
+ Tested up to: 4.8.1
6
+ Stable tag: 1.6.9
7
 
8
  Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.
9
 
136
  3. Media Page
137
 
138
  == Changelog ==
139
+ = 1.6.9 =
140
+ * Improvement: the bulk optimization now stops as soon as the quota is fully consumed, instead of trying to optimize more images and getting error messages one after the other.
141
+ * Improvement: updated (almost) all JavaScript libraries we use. SweetAlert won't conflict with new versions anymore. Few code improvements.
142
+ * Improvement: in the medias list, improved the Imagify column behavior on small screens.
143
+ * Improvement: when optimizing in NextGen Gallery, update some NGG data.
144
+ * Bug Fix: revamped the whole Enable Media Replace plugin compatibility. Optimization, restoration, and backup should work properly now.
145
+ * Bug Fix: revamped the way to restore images in NextGen Gallery to prevent deletion of alt text, description, and tags.
146
+ * Regression fix: fixed optimization and restoration not working in NextGen Gallery.
147
+ * Regression fix: fixed the bulk optimization not working with PHP 5.2.
148
+
149
  = 1.6.8 =
150
  * Improvement: don't display the restore bulk action in the medias list if there is nothing to restore.
151
  * Improvement: you can know select and unselect all image sizes at once in the settings page.
uninstall.php CHANGED
@@ -11,6 +11,7 @@ delete_site_transient( 'imagify_check_licence_1' );
11
  delete_site_transient( 'imagify_bulk_optimization_level' );
12
  delete_site_transient( 'imagify_large_library' );
13
  delete_site_transient( 'imagify_max_image_size' );
 
14
 
15
  // Clear scheduled hooks.
16
  wp_clear_scheduled_hook( 'imagify_rating_event' );
11
  delete_site_transient( 'imagify_bulk_optimization_level' );
12
  delete_site_transient( 'imagify_large_library' );
13
  delete_site_transient( 'imagify_max_image_size' );
14
+ delete_site_transient( 'imagify_rocket_plugin_info' );
15
 
16
  // Clear scheduled hooks.
17
  wp_clear_scheduled_hook( 'imagify_rating_event' );