Version Description
- June 8th, 2016 =
- Improvements to upgrade process from versions 2.1 and 2.2. Process should now be much smoother.
- Added support for installing addons where FTP access is required.
- Shortcode HTML output is now minified to avoid issues related to other plugins parsing post content and injecting markup.
- Slight tweaks to Javascript that should improve accuracy of responsive slider width calculations.
- Slides are now centered when container is set to 100% fluid width.
Download this release
Release Info
Developer | MatthewRuddy |
Plugin | Easing Slider |
Version | 3.0.5 |
Comparing to | |
See all releases |
Code changes from version 3.0.3 to 3.0.5
- assets/css/public.css +1 -0
- assets/css/public.min.css +1 -1
- assets/js/admin.js +84 -3
- assets/js/admin.min.js +1 -1
- assets/js/public.js +1 -1
- assets/js/public.min.js +1 -1
- bower.json +1 -1
- easing-slider.php +2 -2
- languages/easingslider.pot +27 -17
- package.json +1 -1
- readme.txt +12 -1
- resources/assets/css/public.css +1 -0
- resources/assets/js/admin.js +84 -3
- resources/assets/js/public.js +1 -1
- src/Foundation/Repositories/PostType.php +3 -0
- src/Plugin/Admin/Assets/Assets.php +1 -0
- src/Plugin/Admin/Upgrades/UpgradeTo220.php +287 -0
- src/Plugin/Admin/Upgrades/UpgradeTo300.php +184 -113
- src/Plugin/Admin/Upgrades/UpgradeTo305.php +75 -0
- src/Plugin/Admin/Upgrades/Upgrader.php +2 -0
- src/Plugin/Models/Slider.php +0 -1
- src/Plugin/Shortcodes/Slider.php +46 -12
- src/Plugin/Widgets/Slider.php +1 -1
- src/Plugin/legacy.php +35 -0
- vendor/composer/autoload_files.php +1 -0
assets/css/public.css
CHANGED
@@ -243,6 +243,7 @@
|
|
243 |
-------------------------------------------------------------- */
|
244 |
.easingslider-slide {
|
245 |
background-color: #fff;
|
|
|
246 |
}
|
247 |
|
248 |
/* Images
|
243 |
-------------------------------------------------------------- */
|
244 |
.easingslider-slide {
|
245 |
background-color: #fff;
|
246 |
+
text-align: center;
|
247 |
}
|
248 |
|
249 |
/* Images
|
assets/css/public.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.easingslider-container .easingslider-wrapper:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}.easingslider-container,.easingslider-container .easingslider-wrapper{display:none;position:relative}.easingslider-container{width:100%;-ms-touch-action:pan-y}.easingslider-container .easingslider-wrapper-outer{overflow:hidden;position:relative;width:100%}.easingslider-container .easingslider-wrapper-outer.autoHeight{-webkit-transition:height .5s ease-in-out;-moz-transition:height .5s ease-in-out;-ms-transition:height .5s ease-in-out;-o-transition:height .5s ease-in-out;transition:height .5s ease-in-out}.easingslider-container .easingslider-item{float:left}.easingslider-controls .easingslider-buttons div,.easingslider-controls .easingslider-page{cursor:pointer}.easingslider-controls{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.grabbing{cursor:url(grabbing.png) 8 8,move}.easingslider-container .easingslider-item,.easingslider-container .easingslider-wrapper{-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.easingslider-origin{-webkit-perspective:1200px;-webkit-perspective-origin-x:50%;-webkit-perspective-origin-y:50%;-moz-perspective:1200px;-moz-perspective-origin-x:50%;-moz-perspective-origin-y:50%;perspective:1200px}.easingslider-fade-out{z-index:10;-webkit-animation:fadeOut .7s both ease;-moz-animation:fadeOut .7s both ease;animation:fadeOut .7s both ease}.easingslider-fade-in{-webkit-animation:fadeIn .7s both ease;-moz-animation:fadeIn .7s both ease;animation:fadeIn .7s both ease}.easingslider-backSlide-out{-webkit-animation:backSlideOut 1s both ease;-moz-animation:backSlideOut 1s both ease;animation:backSlideOut 1s both ease}.easingslider-backSlide-in{-webkit-animation:backSlideIn 1s both ease;-moz-animation:backSlideIn 1s both ease;animation:backSlideIn 1s both ease}.easingslider-goDown-out{-webkit-animation:scaleToFade .7s ease both;-moz-animation:scaleToFade .7s ease both;animation:scaleToFade .7s ease both}.easingslider-goDown-in{-webkit-animation:goDown .6s ease both;-moz-animation:goDown .6s ease both;animation:goDown .6s ease both}.easingslider-fadeUp-in{-webkit-animation:scaleUpFrom .5s ease both;-moz-animation:scaleUpFrom .5s ease both;animation:scaleUpFrom .5s ease both}.easingslider-fadeUp-out{-webkit-animation:scaleUpTo .5s ease both;-moz-animation:scaleUpTo .5s ease both;animation:scaleUpTo .5s ease both}@-webkit-keyframes empty{0%{opacity:1}}@-moz-keyframes empty{0%{opacity:1}}@keyframes empty{0%{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-moz-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes backSlideOut{25%{opacity:.5;-webkit-transform:translateZ(-500px)}100%,75%{opacity:.5;-webkit-transform:translateZ(-500px) translateX(-200%)}}@-moz-keyframes backSlideOut{25%{opacity:.5;-moz-transform:translateZ(-500px)}100%,75%{opacity:.5;-moz-transform:translateZ(-500px) translateX(-200%)}}@keyframes backSlideOut{25%{opacity:.5;transform:translateZ(-500px)}100%,75%{opacity:.5;transform:translateZ(-500px) translateX(-200%)}}@-webkit-keyframes backSlideIn{0%,25%{opacity:.5;-webkit-transform:translateZ(-500px) translateX(200%)}75%{opacity:.5;-webkit-transform:translateZ(-500px)}100%{opacity:1;-webkit-transform:translateZ(0) translateX(0)}}@-moz-keyframes backSlideIn{0%,25%{opacity:.5;-moz-transform:translateZ(-500px) translateX(200%)}75%{opacity:.5;-moz-transform:translateZ(-500px)}100%{opacity:1;-moz-transform:translateZ(0) translateX(0)}}@keyframes backSlideIn{0%,25%{opacity:.5;transform:translateZ(-500px) translateX(200%)}75%{opacity:.5;transform:translateZ(-500px)}100%{opacity:1;transform:translateZ(0) translateX(0)}}@-webkit-keyframes scaleToFade{to{opacity:0;-webkit-transform:scale(.8)}}@-moz-keyframes scaleToFade{to{opacity:0;-moz-transform:scale(.8)}}@keyframes scaleToFade{to{opacity:0;transform:scale(.8)}}@-webkit-keyframes goDown{from{-webkit-transform:translateY(-100%)}}@-moz-keyframes goDown{from{-moz-transform:translateY(-100%)}}@keyframes goDown{from{transform:translateY(-100%)}}@-webkit-keyframes scaleUpFrom{from{opacity:0;-webkit-transform:scale(1.5)}}@-moz-keyframes scaleUpFrom{from{opacity:0;-moz-transform:scale(1.5)}}@keyframes scaleUpFrom{from{opacity:0;transform:scale(1.5)}}@-webkit-keyframes scaleUpTo{to{opacity:0;-webkit-transform:scale(1.5)}}@-moz-keyframes scaleUpTo{to{opacity:0;-moz-transform:scale(1.5)}}@keyframes scaleUpTo{to{opacity:0;transform:scale(1.5)}}.easingslider-resizing-enabled .easingslider-image{width:100%}.easingslider-slide{background-color:#fff}.easingslider-image{margin-top:0!important;margin-bottom:0!important;padding:0!important}.easingslider-link{display:block}.easingslider-item.loading{background-image:url(../images/loading.gif);background-repeat:no-repeat;background-position:center center;background-color:#fff}.easingslider-next,.easingslider-prev{position:absolute;top:50%;width:30px;height:30px;margin-top:-15px;background-repeat:no-repeat;z-index:40;cursor:pointer}.easingslider-next{background-image:url(../images/nav-arrow-next.png);background-position:top right}.easingslider-prev{background-image:url(../images/nav-arrow-prev.png);background-position:top left}.easingslider-arrows-inside .easingslider-next{right:10px}.easingslider-arrows-inside .easingslider-prev{left:10px}.easingslider-arrows-outside .easingslider-next{right:-40px;padding-left:20px}.easingslider-arrows-outside .easingslider-prev{left:-40px;padding-right:20px}.easingslider-arrows-hover .easingslider-next,.easingslider-arrows-hover .easingslider-prev{opacity:0;-webkit-transition:opacity .3s ease,-webkit-transform .1s ease-in;-moz-transition:opacity .3s ease,-moz-transform .1s ease-in;-ms-transition:opacity .3s ease,-ms-transform .1s ease-in;-o-transition:opacity .3s ease,-o-transform .1s ease-in;transition:opacity .3s ease,transform .1s ease-in}.easingslider-arrows-hover .easingslider-prev{-webkit-transform:translate3d(-10px,0,0);-moz-transform:translate3d(-10px,0,0);-ms-transform:translate3d(-10px,0,0);-o-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0)}.easingslider-arrows-hover .easingslider-next{-webkit-transform:translate3d(10px,0,0);-moz-transform:translate3d(10px,0,0);-ms-transform:translate3d(10px,0,0);-o-transform:translate3d(10px,0,0);transform:translate3d(10px,0,0)}.easingslider-arrows-hover:hover .easingslider-next,.easingslider-arrows-hover:hover .easingslider-prev{opacity:1;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.easingslider-pagination{position:absolute;height:17px;z-index:40}.easingslider-pagination .easingslider-page{display:inline-block;zoom:1}.easingslider-pagination .easingslider-page span{width:15px;height:15px;margin:0 2px 0 0;padding:0;background-image:url(../images/nav-icon-inactive.png);background-repeat:no-repeat;background-position:0 0;display:block;z-index:40;cursor:pointer}.easingslider-pagination .easingslider-page:last-child span{margin-right:0}.easingslider-pagination .easingslider-page.active span{background-image:url(../images/nav-icon-active.png)}.easingslider-pagination-inside.easingslider-pagination-bottom-left .easingslider-pagination{bottom:10px;left:10px}.easingslider-pagination-inside.easingslider-pagination-bottom-right .easingslider-pagination{bottom:10px;right:10px}.easingslider-pagination-inside.easingslider-pagination-bottom-center .easingslider-pagination{bottom:10px;left:0;width:100%;text-align:center}.easingslider-pagination-inside.easingslider-pagination-top-left .easingslider-pagination{top:10px;left:10px}.easingslider-pagination-inside.easingslider-pagination-top-right .easingslider-pagination{top:10px;right:10px}.easingslider-pagination-inside.easingslider-pagination-top-center .easingslider-pagination{top:10px;left:0;right:0;width:100%;text-align:center}.easingslider-pagination-outside.easingslider-pagination-bottom-left .easingslider-pagination{bottom:-25px;left:0;padding-top:20px}.easingslider-pagination-outside.easingslider-pagination-bottom-right .easingslider-pagination{bottom:-25px;right:0;padding-top:20px}.easingslider-pagination-outside.easingslider-pagination-bottom-center .easingslider-pagination{bottom:-25px;left:0;right:0;width:100%;text-align:center;padding-top:20px}.easingslider-pagination-outside.easingslider-pagination-top-left .easingslider-pagination{top:-25px;left:0;padding-bottom:20px}.easingslider-pagination-outside.easingslider-pagination-top-right .easingslider-pagination{top:-25px;right:0;padding-bottom:20px}.easingslider-pagination-outside.easingslider-pagination-top-center .easingslider-pagination{top:-25px;left:0;width:100%;text-align:center;padding-bottom:20px}.easingslider-pagination-hover .easingslider-pagination{opacity:0;-webkit-transition:opacity .3s ease;-moz-transition:opacity .3s ease;-ms-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease}.easingslider-pagination-hover:hover .easingslider-pagination{opacity:1}
|
1 |
+
.easingslider-container .easingslider-wrapper:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}.easingslider-container,.easingslider-container .easingslider-wrapper{display:none;position:relative}.easingslider-container{width:100%;-ms-touch-action:pan-y}.easingslider-container .easingslider-wrapper-outer{overflow:hidden;position:relative;width:100%}.easingslider-container .easingslider-wrapper-outer.autoHeight{-webkit-transition:height .5s ease-in-out;-moz-transition:height .5s ease-in-out;-ms-transition:height .5s ease-in-out;-o-transition:height .5s ease-in-out;transition:height .5s ease-in-out}.easingslider-container .easingslider-item{float:left}.easingslider-controls .easingslider-buttons div,.easingslider-controls .easingslider-page{cursor:pointer}.easingslider-controls{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.grabbing{cursor:url(grabbing.png) 8 8,move}.easingslider-container .easingslider-item,.easingslider-container .easingslider-wrapper{-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.easingslider-origin{-webkit-perspective:1200px;-webkit-perspective-origin-x:50%;-webkit-perspective-origin-y:50%;-moz-perspective:1200px;-moz-perspective-origin-x:50%;-moz-perspective-origin-y:50%;perspective:1200px}.easingslider-fade-out{z-index:10;-webkit-animation:fadeOut .7s both ease;-moz-animation:fadeOut .7s both ease;animation:fadeOut .7s both ease}.easingslider-fade-in{-webkit-animation:fadeIn .7s both ease;-moz-animation:fadeIn .7s both ease;animation:fadeIn .7s both ease}.easingslider-backSlide-out{-webkit-animation:backSlideOut 1s both ease;-moz-animation:backSlideOut 1s both ease;animation:backSlideOut 1s both ease}.easingslider-backSlide-in{-webkit-animation:backSlideIn 1s both ease;-moz-animation:backSlideIn 1s both ease;animation:backSlideIn 1s both ease}.easingslider-goDown-out{-webkit-animation:scaleToFade .7s ease both;-moz-animation:scaleToFade .7s ease both;animation:scaleToFade .7s ease both}.easingslider-goDown-in{-webkit-animation:goDown .6s ease both;-moz-animation:goDown .6s ease both;animation:goDown .6s ease both}.easingslider-fadeUp-in{-webkit-animation:scaleUpFrom .5s ease both;-moz-animation:scaleUpFrom .5s ease both;animation:scaleUpFrom .5s ease both}.easingslider-fadeUp-out{-webkit-animation:scaleUpTo .5s ease both;-moz-animation:scaleUpTo .5s ease both;animation:scaleUpTo .5s ease both}@-webkit-keyframes empty{0%{opacity:1}}@-moz-keyframes empty{0%{opacity:1}}@keyframes empty{0%{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-moz-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes backSlideOut{25%{opacity:.5;-webkit-transform:translateZ(-500px)}100%,75%{opacity:.5;-webkit-transform:translateZ(-500px) translateX(-200%)}}@-moz-keyframes backSlideOut{25%{opacity:.5;-moz-transform:translateZ(-500px)}100%,75%{opacity:.5;-moz-transform:translateZ(-500px) translateX(-200%)}}@keyframes backSlideOut{25%{opacity:.5;transform:translateZ(-500px)}100%,75%{opacity:.5;transform:translateZ(-500px) translateX(-200%)}}@-webkit-keyframes backSlideIn{0%,25%{opacity:.5;-webkit-transform:translateZ(-500px) translateX(200%)}75%{opacity:.5;-webkit-transform:translateZ(-500px)}100%{opacity:1;-webkit-transform:translateZ(0) translateX(0)}}@-moz-keyframes backSlideIn{0%,25%{opacity:.5;-moz-transform:translateZ(-500px) translateX(200%)}75%{opacity:.5;-moz-transform:translateZ(-500px)}100%{opacity:1;-moz-transform:translateZ(0) translateX(0)}}@keyframes backSlideIn{0%,25%{opacity:.5;transform:translateZ(-500px) translateX(200%)}75%{opacity:.5;transform:translateZ(-500px)}100%{opacity:1;transform:translateZ(0) translateX(0)}}@-webkit-keyframes scaleToFade{to{opacity:0;-webkit-transform:scale(.8)}}@-moz-keyframes scaleToFade{to{opacity:0;-moz-transform:scale(.8)}}@keyframes scaleToFade{to{opacity:0;transform:scale(.8)}}@-webkit-keyframes goDown{from{-webkit-transform:translateY(-100%)}}@-moz-keyframes goDown{from{-moz-transform:translateY(-100%)}}@keyframes goDown{from{transform:translateY(-100%)}}@-webkit-keyframes scaleUpFrom{from{opacity:0;-webkit-transform:scale(1.5)}}@-moz-keyframes scaleUpFrom{from{opacity:0;-moz-transform:scale(1.5)}}@keyframes scaleUpFrom{from{opacity:0;transform:scale(1.5)}}@-webkit-keyframes scaleUpTo{to{opacity:0;-webkit-transform:scale(1.5)}}@-moz-keyframes scaleUpTo{to{opacity:0;-moz-transform:scale(1.5)}}@keyframes scaleUpTo{to{opacity:0;transform:scale(1.5)}}.easingslider-resizing-enabled .easingslider-image{width:100%}.easingslider-slide{background-color:#fff;text-align:center}.easingslider-image{margin-top:0!important;margin-bottom:0!important;padding:0!important}.easingslider-link{display:block}.easingslider-item.loading{background-image:url(../images/loading.gif);background-repeat:no-repeat;background-position:center center;background-color:#fff}.easingslider-next,.easingslider-prev{position:absolute;top:50%;width:30px;height:30px;margin-top:-15px;background-repeat:no-repeat;z-index:40;cursor:pointer}.easingslider-next{background-image:url(../images/nav-arrow-next.png);background-position:top right}.easingslider-prev{background-image:url(../images/nav-arrow-prev.png);background-position:top left}.easingslider-arrows-inside .easingslider-next{right:10px}.easingslider-arrows-inside .easingslider-prev{left:10px}.easingslider-arrows-outside .easingslider-next{right:-40px;padding-left:20px}.easingslider-arrows-outside .easingslider-prev{left:-40px;padding-right:20px}.easingslider-arrows-hover .easingslider-next,.easingslider-arrows-hover .easingslider-prev{opacity:0;-webkit-transition:opacity .3s ease,-webkit-transform .1s ease-in;-moz-transition:opacity .3s ease,-moz-transform .1s ease-in;-ms-transition:opacity .3s ease,-ms-transform .1s ease-in;-o-transition:opacity .3s ease,-o-transform .1s ease-in;transition:opacity .3s ease,transform .1s ease-in}.easingslider-arrows-hover .easingslider-prev{-webkit-transform:translate3d(-10px,0,0);-moz-transform:translate3d(-10px,0,0);-ms-transform:translate3d(-10px,0,0);-o-transform:translate3d(-10px,0,0);transform:translate3d(-10px,0,0)}.easingslider-arrows-hover .easingslider-next{-webkit-transform:translate3d(10px,0,0);-moz-transform:translate3d(10px,0,0);-ms-transform:translate3d(10px,0,0);-o-transform:translate3d(10px,0,0);transform:translate3d(10px,0,0)}.easingslider-arrows-hover:hover .easingslider-next,.easingslider-arrows-hover:hover .easingslider-prev{opacity:1;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.easingslider-pagination{position:absolute;height:17px;z-index:40}.easingslider-pagination .easingslider-page{display:inline-block;zoom:1}.easingslider-pagination .easingslider-page span{width:15px;height:15px;margin:0 2px 0 0;padding:0;background-image:url(../images/nav-icon-inactive.png);background-repeat:no-repeat;background-position:0 0;display:block;z-index:40;cursor:pointer}.easingslider-pagination .easingslider-page:last-child span{margin-right:0}.easingslider-pagination .easingslider-page.active span{background-image:url(../images/nav-icon-active.png)}.easingslider-pagination-inside.easingslider-pagination-bottom-left .easingslider-pagination{bottom:10px;left:10px}.easingslider-pagination-inside.easingslider-pagination-bottom-right .easingslider-pagination{bottom:10px;right:10px}.easingslider-pagination-inside.easingslider-pagination-bottom-center .easingslider-pagination{bottom:10px;left:0;width:100%;text-align:center}.easingslider-pagination-inside.easingslider-pagination-top-left .easingslider-pagination{top:10px;left:10px}.easingslider-pagination-inside.easingslider-pagination-top-right .easingslider-pagination{top:10px;right:10px}.easingslider-pagination-inside.easingslider-pagination-top-center .easingslider-pagination{top:10px;left:0;right:0;width:100%;text-align:center}.easingslider-pagination-outside.easingslider-pagination-bottom-left .easingslider-pagination{bottom:-25px;left:0;padding-top:20px}.easingslider-pagination-outside.easingslider-pagination-bottom-right .easingslider-pagination{bottom:-25px;right:0;padding-top:20px}.easingslider-pagination-outside.easingslider-pagination-bottom-center .easingslider-pagination{bottom:-25px;left:0;right:0;width:100%;text-align:center;padding-top:20px}.easingslider-pagination-outside.easingslider-pagination-top-left .easingslider-pagination{top:-25px;left:0;padding-bottom:20px}.easingslider-pagination-outside.easingslider-pagination-top-right .easingslider-pagination{top:-25px;right:0;padding-bottom:20px}.easingslider-pagination-outside.easingslider-pagination-top-center .easingslider-pagination{top:-25px;left:0;width:100%;text-align:center;padding-bottom:20px}.easingslider-pagination-hover .easingslider-pagination{opacity:0;-webkit-transition:opacity .3s ease;-moz-transition:opacity .3s ease;-ms-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease}.easingslider-pagination-hover:hover .easingslider-pagination{opacity:1}
|
assets/js/admin.js
CHANGED
@@ -2100,8 +2100,9 @@ _.extend(EasingSlider.Admin, {
|
|
2100 |
|
2101 |
// Establish variables
|
2102 |
var $button = $(this);
|
2103 |
-
var $
|
2104 |
-
var $
|
|
|
2105 |
|
2106 |
// Remove errors
|
2107 |
$('.action-error').remove();
|
@@ -2129,6 +2130,86 @@ _.extend(EasingSlider.Admin, {
|
|
2129 |
return false;
|
2130 |
}
|
2131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2132 |
// The Ajax request was successful, update the button.
|
2133 |
$button
|
2134 |
.attr('data-plugin', response.plugin)
|
@@ -2140,7 +2221,7 @@ _.extend(EasingSlider.Admin, {
|
|
2140 |
$message.text(_easingsliderAdminL10n.messages.inactive);
|
2141 |
|
2142 |
// Change status
|
2143 |
-
$
|
2144 |
|
2145 |
},
|
2146 |
error: function(xhr, textStatus, event) {
|
2100 |
|
2101 |
// Establish variables
|
2102 |
var $button = $(this);
|
2103 |
+
var $addons = $button.parents('.addons');
|
2104 |
+
var $status = $button.parents('.addon-status');
|
2105 |
+
var $message = $status.find('.status-message');
|
2106 |
|
2107 |
// Remove errors
|
2108 |
$('.action-error').remove();
|
2130 |
return false;
|
2131 |
}
|
2132 |
|
2133 |
+
// Ask for credentials if needed
|
2134 |
+
if ( response.form ) {
|
2135 |
+
|
2136 |
+
// Hide addons temporarily
|
2137 |
+
$addons.hide();
|
2138 |
+
|
2139 |
+
// Display the form to ask for user credentials
|
2140 |
+
$addons.after('<div class="action-error error">' + response.form + '</div>');
|
2141 |
+
|
2142 |
+
// Add a disabled attribute the install button
|
2143 |
+
$button.attr('disabled', true);
|
2144 |
+
|
2145 |
+
// Act when "Proceed" with FTP credentials button is clicked
|
2146 |
+
$(document).on('click', '#upgrade', function(event) {
|
2147 |
+
event.preventDefault();
|
2148 |
+
|
2149 |
+
// Get FTP credentials
|
2150 |
+
var $proceedButton = $(this);
|
2151 |
+
var $connectForm = $proceedButton.parent().parent().parent().parent();
|
2152 |
+
var hostname = $proceedButton.parent().parent().find('#hostname').val();
|
2153 |
+
var username = $proceedButton.parent().parent().find('#username').val();
|
2154 |
+
var password = $proceedButton.parent().parent().find('#password').val();
|
2155 |
+
|
2156 |
+
// Now let's attempt the Ajax request again
|
2157 |
+
$.ajax({
|
2158 |
+
url: ajaxurl,
|
2159 |
+
type: 'post',
|
2160 |
+
async: true,
|
2161 |
+
cache: false,
|
2162 |
+
dataType: 'json',
|
2163 |
+
data: {
|
2164 |
+
action: 'easingslider_install_addon',
|
2165 |
+
nonce: _easingsliderAdminL10n.nonces.install,
|
2166 |
+
plugin: $button.attr('data-plugin'),
|
2167 |
+
hostname: hostname,
|
2168 |
+
username: username,
|
2169 |
+
password: password
|
2170 |
+
},
|
2171 |
+
success: function(response) {
|
2172 |
+
|
2173 |
+
// If there is a WP Error instance, output it here and quit the script.
|
2174 |
+
if ( response.error ) {
|
2175 |
+
$button
|
2176 |
+
.attr('data-plugin', response.plugin)
|
2177 |
+
.text(_easingsliderAdminL10n.buttons.activate)
|
2178 |
+
.removeClass('js-install-addon')
|
2179 |
+
.addClass('js-activate-addon');
|
2180 |
+
|
2181 |
+
return false;
|
2182 |
+
}
|
2183 |
+
|
2184 |
+
if ( response.form ) {
|
2185 |
+
$addons.after('<div class="action-error error"><p>'+ _easingsliderAdminL10n.ftp_error +'</p></div>');
|
2186 |
+
return false;
|
2187 |
+
}
|
2188 |
+
|
2189 |
+
// Hide the FTP connection form
|
2190 |
+
$connectForm.remove();
|
2191 |
+
|
2192 |
+
// Show addons again
|
2193 |
+
$addons.show();
|
2194 |
+
|
2195 |
+
// Update message
|
2196 |
+
$message.text(_easingsliderAdminL10n.messages.inactive);
|
2197 |
+
|
2198 |
+
// Change status
|
2199 |
+
$status.removeClass('not-installed').addClass('is-inactive');
|
2200 |
+
|
2201 |
+
},
|
2202 |
+
error: function(xhr, textStatus, event) {
|
2203 |
+
return false;
|
2204 |
+
}
|
2205 |
+
});
|
2206 |
+
});
|
2207 |
+
|
2208 |
+
// No need to continue.
|
2209 |
+
return;
|
2210 |
+
|
2211 |
+
}
|
2212 |
+
|
2213 |
// The Ajax request was successful, update the button.
|
2214 |
$button
|
2215 |
.attr('data-plugin', response.plugin)
|
2221 |
$message.text(_easingsliderAdminL10n.messages.inactive);
|
2222 |
|
2223 |
// Change status
|
2224 |
+
$status.removeClass('not-installed').addClass('is-inactive');
|
2225 |
|
2226 |
},
|
2227 |
error: function(xhr, textStatus, event) {
|
assets/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
window.EasingSlider=window.EasingSlider||{},window.EasingSlider.Admin=window.EasingSlider.Admin||{},_.extend(EasingSlider.Admin,{model:{},collection:{},controller:{},frame:{},view:{},toolbar:{},router:{},Router:{}}),function(a){var b=window.EasingSlider.Admin;b.model.Slide={get:function(a){return"undefined"!=typeof b.model.Slide[a.type]?new b.model.Slide[a.type](a):new b.model.Slide.base(a)}},b.model.Slide.base=Backbone.Model.extend(),b.model.Slide.image=b.model.Slide.base.extend({attachment:!1,defaults:{attachment_id:null,type:"image",alt:"",link:"none",linkUrl:"",linkTargetBlank:!1,title:"",url:null}}),b.collection.Slides=Backbone.Collection.extend({model:b.model.Slide.get,initialize:function(){this.on("add",this._resetIDs,this),this.on("remove",this._resetIDs,this),this.on("reset",this._resetIDs,this)},comparator:function(a){return a.get("id")},_resetIDs:function(){var a=new Backbone.Collection;_.each(this.models,function(b,c){b.set({id:c+1}),a.add(b)}),this.reset(a.models,{silent:!0})},reposition:function(a,b){return this.remove(a,{silent:!0}),this.add(a,{at:b,silent:!0}),this._resetIDs(),this},sync:function(){var a=this,b=[];_.each(this.models,function(a){a.has("attachment_id")&&b.push(a.get("attachment_id"))},this);var c=wp.media.query({post__in:b,posts_per_page:-1});return c.more().done(function(){_.each(c.models,function(b){var c=a.where({attachment_id:b.get("id")});_.each(c,function(a){a.attachment=b})}),a.trigger("sync:done")}),this}}),b.controller.AddSlide={get:function(a){return"undefined"!=typeof b.controller.AddSlide[a.type]?new b.controller.AddSlide[a.type](a):new b.controller.AddSlide.base(a)}},b.controller.AddSlide.base=wp.media.controller.State.extend({initialize:function(){this.props=new b.model.Slide.get({type:this.get("type")})}}),b.controller.AddSlide.image=wp.media.controller.Library.extend(),b.controller.EditSlide={get:function(a){return"undefined"!=typeof b.controller.EditSlide[a.type]?new b.controller.EditSlide[a.type](a):new b.controller.EditSlide.base(a)}},b.controller.EditSlide.base=wp.media.controller.State.extend({defaults:_.defaults({id:"edit-slide",title:_easingsliderAdminL10n.media_upload.title,content:"edit-slide",menu:!1,router:!1,toolbar:"edit-slide",editing:!1,priority:60},wp.media.controller.State.defaults)}),b.controller.EditSlide.image=b.controller.EditSlide.base.extend(),b.frame.AddSlide=wp.media.view.MediaFrame.Post.extend({initialize:function(){_.defaults(this.options,{multiple:!0}),wp.media.view.MediaFrame.Post.prototype.initialize.apply(this,arguments)},bindHandlers:function(){this.on("close",this.updateRouter,this),this.on("content:render:browse",this.removeSidebar,this),this.on("toolbar:create:insert-slide",this.createToolbar,this),this.on("toolbar:render:insert-slide",this.insertToolbar,this),wp.media.view.MediaFrame.Post.prototype.bindHandlers.apply(this,arguments)},browseContent:function(a){var c=this.state();this.$el.removeClass("hide-toolbar"),a.view=new b.view.AddSlide.image({controller:this,collection:c.get("library"),selection:c.get("selection"),model:c,sortable:c.get("sortable"),search:c.get("searchable"),filters:c.get("filterable"),date:c.get("date"),display:c.has("display")?c.get("display"):c.get("displaySettings"),dragInfo:c.get("dragInfo"),idealColumnWidth:c.get("idealColumnWidth"),suggestedWidth:c.get("suggestedWidth"),suggestedHeight:c.get("suggestedHeight"),AttachmentView:c.get("AttachmentView")})},removeSidebar:function(a){a.sidebar.remove("details"),a.$el.addClass("hide-sidebar")},createStates:function(){this.states.add([new b.controller.AddSlide.image({id:"insert",type:"image",title:_easingsliderAdminL10n.media_upload.image_from_media,priority:20,toolbar:"insert-slide",filterable:!1,library:wp.media.query({type:"image"}),multiple:!0,editable:!0,allowLocalEdits:!0,displaySettings:!1,displayUserSettings:!0})])},createIframeStates:function(){return this},insertToolbar:function(a){var b=this;a.set("insert-slide",{style:"primary",priority:80,text:_easingsliderAdminL10n.media_upload.insert_into_slider,requires:{selection:!1},click:function(){b.close().trigger("insert",b.getSelection()).reset()}})},getSelection:function(a){var c=new wp.media.model.Selection(null,{multiple:!0}),d=this.state().get("type"),a=this.state().get("selection");return _.each(a.models,function(a){var e=new b.model.Slide.get({type:d});a.get("id")?(e.attachment=a,e.set({attachment_id:a.get("id")},{silent:!0})):e.set(a,{silent:!0}),c.add(e)},this),c},updateRouter:function(){b.Router.navigate(_easingsliderAdminL10n.base_url)}}),b.frame.EditSlide={get:function(a){return"undefined"!=typeof b.frame.EditSlide[a.model.get("type")]?new(b.frame.EditSlide[a.model.get("type")])(a):new b.frame.EditSlide.base(a)}},b.frame.EditSlide.base=wp.media.view.MediaFrame.Select.extend({className:"edit-slide-frame media-frame",template:wp.template("easingslider-edit-slide-frame"),events:_.defaults({"click .left":"previousSlide","click .right":"nextSlide"},wp.media.view.MediaFrame.Select.prototype.events),initialize:function(){this.options.state="edit-slide",this.options.selection=new wp.media.model.Selection({},{multiple:!1}),wp.media.view.MediaFrame.Select.prototype.initialize.apply(this,arguments)},bindHandlers:function(){this.on("close",this.updateRouter,this),this.on("content:create:edit-slide",this.createView,this),this.on("toolbar:render:edit-slide",this.createToolbar,this),wp.media.view.MediaFrame.Select.prototype.bindHandlers.apply(this,arguments)},createView:function(a){a.view=new b.view.EditSlide.get({type:this.model.get("type"),model:this.model,controller:this})},createToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{select:{style:"primary",text:_easingsliderAdminL10n.media_upload.update,priority:80,click:function(){var a=this.controller,b=a.state();a.close(),b.trigger("update",a.model.toJSON()),a.setState(a.options.state),a.reset()}}}}))},createStates:function(){this.states.add([new b.controller.EditSlide.get({type:this.model.get("type")})]),wp.media.view.MediaFrame.Select.prototype.createStates.apply(this,arguments)},render:function(){return wp.media.view.MediaFrame.Select.prototype.render.apply(this,arguments),this.toggleNav(),this},rerender:function(){return this.content.render(),this.toggleNav(),this},toggleNav:function(){return this.$(".left").removeProp("disabled").removeClass("disabled"),this.$(".right").removeProp("disabled").removeClass("disabled"),this.hasPrevious()||this.$(".left").prop("disabled","disabled").addClass("disabled"),this.hasNext()||this.$(".right").prop("disabled","disabled").addClass("disabled"),this},previousSlide:function(){return this.hasPrevious()?(this.model=this.collection.at(this.collection.indexOf(this.model)-1),this.rerender(),void this.$(".left").focus()):void this.$(".left").blur()},nextSlide:function(){return this.hasNext()?(this.model=this.collection.at(this.collection.indexOf(this.model)+1),this.rerender(),void this.$(".right").focus()):void this.$(".right").blur()},hasNext:function(){return this.collection.indexOf(this.model)+1<this.collection.length},hasPrevious:function(){return this.collection.indexOf(this.model)-1>-1},updateRouter:function(){b.Router.navigate(_easingsliderAdminL10n.base_url)}}),b.frame.EditSlide.image=b.frame.EditSlide.base.extend({initialize:function(){this.image=new wp.media.model.PostImage(this.model.attributes),b.frame.EditSlide.base.prototype.initialize.apply(this,arguments)},bindHandlers:function(){this.on("content:create:browse",this.modifyBrowseFilters,this),this.on("content:render:browse",this.removeBrowseSidebar,this),this.on("content:render:edit-slide",this.showNav,this),this.on("content:render:edit-image",this.renderEditImageContent,this),this.on("toolbar:render:replace",this.hideNav,this),this.on("toolbar:render:replace",this.renderReplaceImageToolbar,this),this.state("replace-image").on("replace",this.replaceImage,this),b.frame.EditSlide.base.prototype.bindHandlers.apply(this,arguments)},createStates:function(){b.frame.EditSlide.base.prototype.createStates.apply(this,arguments),this.states.add([new wp.media.controller.ReplaceImage({id:"replace-image",library:wp.media.query({type:"image"}),image:this.image,multiple:!1,title:_easingsliderAdminL10n.media_upload.replace_image,toolbar:"replace",priority:80,displaySettings:!0}),new wp.media.controller.EditImage({image:this.image,selection:this.options.selection})])},modifyBrowseFilters:function(a){this.state().set("filterable",!0)},removeBrowseSidebar:function(a){a.sidebar.remove("details"),a.$el.addClass("hide-sidebar")},showNav:function(){this.$(".left, .right").show(),a(".media-modal-close").removeClass("no-border")},hideNav:function(){this.$(".left, .right").hide(),a(".media-modal-close").addClass("no-border")},renderEditImageContent:function(){var a,b=this.state(),c=b.get("image");c&&(a=new wp.media.view.EditImage({model:c,controller:this}).render(),this.content.set(a),a.loadEditor())},renderReplaceImageToolbar:function(){var a=this,b=a.lastState(),c=b&&b.id;this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{back:{text:_easingsliderAdminL10n.media_upload.back,priority:20,click:function(){c?a.setState(c):a.close()}},replace:{style:"primary",text:_easingsliderAdminL10n.media_upload.replace,priority:80,click:function(){var a=this.controller,b=a.state(),c=b.get("selection"),d=c.single();a.close(),a.image.changeAttachment(d,b.display(d)),b.trigger("replace",a.image.toJSON()),a.setState(a.options.state),a.reset()}}}}))},replaceImage:function(){this.model.set({attachment_id:this.image.attachment.id}),this.model.attachment.set(this.image.attachment.attributes)}}),b.view.Editor=Backbone.View.extend({el:".wrap",events:{"click #add-slides":"_addSlide","click #select-all":"_selectAll","click #delete-slides":"_clickBulkDelete","click #save":"_clickSave","click .toolbar .edit":"_clickEdit","click .toolbar .remove":"_clickDelete","click .show-advanced-options":"_clickAdvancedOptions","click .thumbnail":"_clickThumb","click .select-mode-toggle-button":"_toggleMode","click .sidebar-name":"_toggleWidget"},initialize:function(){this.subviews={AddSlide:new b.frame.AddSlide,Slides:new b.view.Slides({collection:this.collection})},this.collection.on("sync:done",this.render,this),this.collection.on("sync:done",this._enableSave,this),this.collection.on("sync:done",this._handleNoSlides,this),this.collection.on("add",this._handleNoSlides,this),this.collection.on("remove",this._handleNoSlides,this),this.subviews.AddSlide.on("insert",this._handleInsert,this),a(window).on("resize",this._setColumns.bind(this)),this._selectMode=!1,this._setColumns(),this._showSpinner()},_showSpinner:function(){this.$("#slides-browser").append('<div class="spinner"></div>')},_hideSpinner:function(){this.$("#slides-browser .spinner").remove()},_enableSave:function(){this.$("#save").prop("disabled",!1)},_clickSave:function(){this.$("#publishing-action .spinner").css({display:"block"})},_setColumns:function(){var a=this.$(".media-frame-content"),b=a.attr("data-columns"),c=a.width();if(c){var d=Math.min(Math.round(c/145),12)||1;b&&b===d||a.attr("data-columns",d)}},_handleNoSlides:function(){0==this.collection.length?this.$("form").prepend('<input type="hidden" id="slides" name="slides" value="[]" />'):this.$('input[name="slides"]').remove()},_handleInsert:function(a){this.collection.add(a.models)},_clickThumb:function(a){a.preventDefault(),this._selectMode?this._toggleSelect(a):this._editSlide(a)},_clickEdit:function(a){a.preventDefault(),this._editSlide(a)},_clickDelete:function(b){if(b.preventDefault(),confirm(_easingsliderAdminL10n.warn)){var c=a(b.currentTarget).parents(".attachment").attr("data-id");this.collection.remove(c)}},_clickBulkDelete:function(a){a.preventDefault(),confirm(_easingsliderAdminL10n.warn)&&(this._deleteSlides(a),this._toggleMode(a))},_clickAdvancedOptions:function(b){b.preventDefault();var c=a(b.currentTarget).parent().find(".advanced-options");c.toggleClass("hide")},_toggleMode:function(a){a.preventDefault(),this._selectMode?this._selectMode=!1:this._selectMode=!0,this.$(".attachment").removeClass("selected details"),this.$(".media-frame").toggleClass("mode-select"),this.$(".media-toolbar div *").toggleClass("hide")},_toggleSelect:function(b){b.preventDefault(),a(b.currentTarget).parents(".attachment").toggleClass("selected details")},_toggleWidget:function(b){b.preventDefault();var c=a(b.currentTarget).parent(),d=c.find(".sidebar-content");c.hasClass("fixed")||(this.$(".widgets-holder-wrap").each(function(){var b=a(this);b.hasClass("fixed")||b.find(".sidebar-content").slideUp(200,function(){b.addClass("closed")})}),c.hasClass("closed")&&d.slideDown(200,function(){c.removeClass("closed")}))},_selectAll:function(a){a.preventDefault(),this.$(".attachment").addClass("selected details")},_deleteSlides:function(b){b.preventDefault();var c=this.collection,d=[];this.$(".attachment").each(function(b){a(this).hasClass("selected")&&d.push(c.at(b))}),this.collection.remove(d)},_addSlide:function(a){a.preventDefault(),this.addSlide(),b.Router.navigate(_easingsliderAdminL10n.base_url+"&add=true")},addSlide:function(){return this.subviews.AddSlide.open(),this},_editSlide:function(c){c.preventDefault();var d=a(c.currentTarget).parents(".attachment").attr("data-id");this.editSlide(d),b.Router.navigate(_easingsliderAdminL10n.base_url+"&slide="+d)},editSlide:function(a){return this.subviews.EditSlide=new b.frame.EditSlide.get({collection:this.collection,model:this.collection.get(a)}),this.subviews.EditSlide.open(),this},newAddSlideFrame:function(a){var c=this.subviews.AddSlide;c.states.add([new b.controller.AddSlide.get(a)]),c.on("content:render:"+a.content,function(){var c=new b.view.AddSlide.get({type:a.content,model:this.state().props,controller:this});this.content.set(c)},c),c.on("toolbar:render:"+a.toolbar,function(){var c=new b.toolbar.AddSlide.get({type:a.toolbar,controller:this});this.toolbar.set(c)},c)},render:function(){this._hideSpinner();var a=this.subviews.Slides.render().el;return this.$("#slides-browser").append(a),this}}),b.view.Slides=Backbone.View.extend({tagName:"ul",attributes:{"class":"attachments ui-sortable",tabindex:"-1"},initialize:function(){this.subviews=[],this.collection.on("add",this.add,this),this.collection.on("remove",this.render,this),this.collection.on("reset",this.render,this),this.$el.sortable({items:".attachment",containment:"parent",tolerance:"pointer",stop:this._sort.bind(this)})},_sort:function(a,b){var c=this.collection.get(b.item.context.dataset.id);this.collection.reposition(c,b.item.index())},add:function(a){var c=new b.view.Slide({model:a});return this.subviews.push(c),this.$el.append(c.render().$el),this},render:function(){return this.subviews=[],this.$el.empty(),_.each(this.collection.models,function(a){this.add(a)},this),this}}),b.view.Slide=Backbone.View.extend({tagName:"li",attributes:function(){return{role:"checkbox","class":"attachment save-ready",tabindex:"0","data-id":this.model.id}},template:wp.media.template("easingslider-slide"),initialize:function(){this.model.on("change",this._setData,this),this.model.on("change:id",this._updateID,this),this.model.on("change:url",this.render,this),this.model.on("change:poster",this.render,this),this.model.on("change:attachment_id",this.render,this),this.model.attachment&&this.model.attachment.on("change",this.render,this)},_setData:function(){this.$('input[name="slides[]"]').val(JSON.stringify(this.model.attributes))},_updateID:function(a,b){this.$el.attr("data-id",b),this.attributes["data-id"]=b},render:function(){var a={model:this.model.toJSON()};return this.model.attachment&&(a.attachment=this.model.attachment.toJSON()),this.$el.html(this.template(a)),this}}),b.view.AddSlide={get:function(a){return"undefined"!=typeof b.view.AddSlide[a.type]?new b.view.AddSlide[a.type](a):new b.view.AddSlide.base(a)}},b.view.AddSlide.base=wp.media.View.extend(),b.view.AddSlide.image=wp.media.view.AttachmentsBrowser.extend(),b.view.EditSlide={get:function(a){return"undefined"!=typeof b.view.EditSlide[a.type]?new b.view.EditSlide[a.type](a):new b.view.EditSlide.base(a)}},b.view.EditSlide.base=wp.media.view.Settings.extend({className:"edit-attachment-frame attachment-details mode-select",template:wp.media.template("easingslider-edit-slide"),initialize:function(){wp.media.view.Settings.prototype.initialize.apply(this,arguments),this.model.on("change:link",this.toggleLinkSettings,this),this.model.on("change:link",this.updateLinkTo,this)},prepare:function(){var a=!1;return this.model.attachment&&(a=this.model.attachment.toJSON()),_.defaults({model:this.model.toJSON(),attachment:a},this.options)},toggleLinkSettings:function(){"none"===this.model.get("link")?this.$(".link-options").addClass("hide"):this.$(".link-options").removeClass("hide")},updateLinkTo:function(){var a=this.model.get("link"),b=this.$(".link-to-custom");if(this.model.attachment){if("none"===a||"embed"===a||!this.model.attachment&&"custom"!==a)return void b.addClass("hidden");this.model.attachment&&("post"===a?b.val(this.model.attachment.get("link")):"file"===a?b.val(this.model.attachment.get("url")):this.model.get("linkUrl")||b.val("http://"),b.prop("readonly","custom"!==a)),b.removeClass("hidden"),!wp.media.isTouchDevice&&b.is(":visible")&&b.focus()[0].select()}},render:function(){return wp.media.view.Settings.prototype.render.apply(this,arguments),this.toggleLinkSettings(),this.updateLinkTo(),this}}),b.view.EditSlide.image=b.view.EditSlide.base.extend({events:_.defaults({"click .edit-attachment":"editAttachment","click .replace-attachment":"replaceAttachment"},b.view.EditSlide.base.prototype.events),initialize:function(){b.view.EditSlide.base.prototype.initialize.apply(this,arguments),this.model.on("change:url",this.updateImage,this)},editAttachment:function(a){var b=this.controller.states.get("edit-image");window.imageEdit&&b&&(a.preventDefault(),b.set("image",this.model.attachment),this.controller.setState("edit-image"))},replaceAttachment:function(a){a.preventDefault(),this.controller.setState("replace-image")},updateImage:function(){this.$(".details-image").attr("src",this.model.get("url"))}}),b.toolbar.AddSlide={get:function(a){return"undefined"!=typeof b.toolbar.AddSlide[a.type]?new b.toolbar.AddSlide[a.type](a):new b.toolbar.AddSlide.base(a)}},b.toolbar.AddSlide.base=wp.media.view.Toolbar.extend(),b.router=Backbone.Router.extend({routes:{"admin.php?page=:page&edit=:id&slide=:slide":"editSlide","admin.php?page=:page&edit=:id&add=true":"addSlide","admin.php?page=:page&edit=:id":"editor","admin.php?page=easingslider-add-new":"editor"},initialize:function(){var a="undefined"==typeof window.slides?"[]":window.slides;this.view=new b.view.Editor({collection:new b.collection.Slides(JSON.parse(a))})},editSlide:function(a,b,c){return this.editor(),this.view.collection.on("sync:done",function(){this.view.editSlide(c)},this),this},addSlide:function(a,b){return this.editor(),this.view.collection.on("sync:done",function(){this.view.addSlide()},this),this},editor:function(a){return this.view.collection.sync(),this}}),a(document).ready(function(){b.Router=new b.router,Backbone.history.start({root:window._easingsliderAdminL10n.admin_url,pushState:!0}),a(".delete").each(function(){a(this).on("click",function(){return confirm(_easingsliderAdminL10n.warn)?void 0:!1})}),a('select[name="type"]').on("change",function(){a("*[data-type]").addClass("hidden"),a('*[data-type="'+this.value+'"]').removeClass("hidden"),"media"!=this.value?a(".media-toolbar-primary").addClass("hidden"):a(".media-toolbar-primary").removeClass("hidden")}),a(document).on("click",".js-activate-addon",function(b){b.preventDefault();var c=a(this),d=c.parents(".addon-status"),e=d.find(".status-message");a(".action-error").remove(),c.text(_easingsliderAdminL10n.buttons.activating);var f={url:ajaxurl,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"easingslider_activate_addon",nonce:_easingsliderAdminL10n.nonces.activate,plugin:c.attr("data-plugin")},success:function(a){return a&&!0!==a?(c.after('<div class="action-error error"><strong>'+a.error+"</strong></div>"),!1):(c.text(_easingsliderAdminL10n.buttons.deactivate).removeClass("js-activate-addon").addClass("js-deactivate-addon"),e.text(_easingsliderAdminL10n.messages.active),void d.removeClass("is-inactive").addClass("is-active"))},error:function(a,b,c){return!1}};a.ajax(f)}),a(document).on("click",".js-deactivate-addon",function(b){b.preventDefault();var c=a(this),d=c.parents(".addon-status"),e=d.find(".status-message");a(".action-error").remove(),c.text(_easingsliderAdminL10n.buttons.deactivating);var f={url:ajaxurl,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"easingslider_deactivate_addon",nonce:_easingsliderAdminL10n.nonces.deactivate,plugin:c.attr("data-plugin")},success:function(a){return a&&!0!==a?(c.after('<div class="action-error error"><strong>'+a.error+"</strong></div>"),!1):(c.text(_easingsliderAdminL10n.buttons.activate).removeClass("js-deactivate-addon").addClass("js-activate-addon"),e.text(_easingsliderAdminL10n.messages.inactive),void d.removeClass("is-active").addClass("is-inactive"))},error:function(a,b,c){return!1}};a.ajax(f)}),a(document).on("click",".js-install-addon",function(b){b.preventDefault();var c=a(this),d=c.parents(".addon-status"),e=d.find(".status-message");a(".action-error").remove(),c.text(_easingsliderAdminL10n.buttons.installing);var f={url:ajaxurl,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"easingslider_install_addon",nonce:_easingsliderAdminL10n.nonces.install,plugin:c.attr("data-plugin")},success:function(a){return a.error?(c.after('<div class="action-error error"><strong>'+a.error+"</strong></div>"),!1):(c.attr("data-plugin",a.plugin).text(_easingsliderAdminL10n.buttons.activate).removeClass("js-install-addon").addClass("js-activate-addon"),e.text(_easingsliderAdminL10n.messages.inactive),void d.removeClass("not-installed").addClass("is-inactive"))},error:function(a,b,c){return!1}};a.ajax(f)})})}(jQuery);
|
1 |
+
window.EasingSlider=window.EasingSlider||{},window.EasingSlider.Admin=window.EasingSlider.Admin||{},_.extend(EasingSlider.Admin,{model:{},collection:{},controller:{},frame:{},view:{},toolbar:{},router:{},Router:{}}),function(a){var b=window.EasingSlider.Admin;b.model.Slide={get:function(a){return"undefined"!=typeof b.model.Slide[a.type]?new b.model.Slide[a.type](a):new b.model.Slide.base(a)}},b.model.Slide.base=Backbone.Model.extend(),b.model.Slide.image=b.model.Slide.base.extend({attachment:!1,defaults:{attachment_id:null,type:"image",alt:"",link:"none",linkUrl:"",linkTargetBlank:!1,title:"",url:null}}),b.collection.Slides=Backbone.Collection.extend({model:b.model.Slide.get,initialize:function(){this.on("add",this._resetIDs,this),this.on("remove",this._resetIDs,this),this.on("reset",this._resetIDs,this)},comparator:function(a){return a.get("id")},_resetIDs:function(){var a=new Backbone.Collection;_.each(this.models,function(b,c){b.set({id:c+1}),a.add(b)}),this.reset(a.models,{silent:!0})},reposition:function(a,b){return this.remove(a,{silent:!0}),this.add(a,{at:b,silent:!0}),this._resetIDs(),this},sync:function(){var a=this,b=[];_.each(this.models,function(a){a.has("attachment_id")&&b.push(a.get("attachment_id"))},this);var c=wp.media.query({post__in:b,posts_per_page:-1});return c.more().done(function(){_.each(c.models,function(b){var c=a.where({attachment_id:b.get("id")});_.each(c,function(a){a.attachment=b})}),a.trigger("sync:done")}),this}}),b.controller.AddSlide={get:function(a){return"undefined"!=typeof b.controller.AddSlide[a.type]?new b.controller.AddSlide[a.type](a):new b.controller.AddSlide.base(a)}},b.controller.AddSlide.base=wp.media.controller.State.extend({initialize:function(){this.props=new b.model.Slide.get({type:this.get("type")})}}),b.controller.AddSlide.image=wp.media.controller.Library.extend(),b.controller.EditSlide={get:function(a){return"undefined"!=typeof b.controller.EditSlide[a.type]?new b.controller.EditSlide[a.type](a):new b.controller.EditSlide.base(a)}},b.controller.EditSlide.base=wp.media.controller.State.extend({defaults:_.defaults({id:"edit-slide",title:_easingsliderAdminL10n.media_upload.title,content:"edit-slide",menu:!1,router:!1,toolbar:"edit-slide",editing:!1,priority:60},wp.media.controller.State.defaults)}),b.controller.EditSlide.image=b.controller.EditSlide.base.extend(),b.frame.AddSlide=wp.media.view.MediaFrame.Post.extend({initialize:function(){_.defaults(this.options,{multiple:!0}),wp.media.view.MediaFrame.Post.prototype.initialize.apply(this,arguments)},bindHandlers:function(){this.on("close",this.updateRouter,this),this.on("content:render:browse",this.removeSidebar,this),this.on("toolbar:create:insert-slide",this.createToolbar,this),this.on("toolbar:render:insert-slide",this.insertToolbar,this),wp.media.view.MediaFrame.Post.prototype.bindHandlers.apply(this,arguments)},browseContent:function(a){var c=this.state();this.$el.removeClass("hide-toolbar"),a.view=new b.view.AddSlide.image({controller:this,collection:c.get("library"),selection:c.get("selection"),model:c,sortable:c.get("sortable"),search:c.get("searchable"),filters:c.get("filterable"),date:c.get("date"),display:c.has("display")?c.get("display"):c.get("displaySettings"),dragInfo:c.get("dragInfo"),idealColumnWidth:c.get("idealColumnWidth"),suggestedWidth:c.get("suggestedWidth"),suggestedHeight:c.get("suggestedHeight"),AttachmentView:c.get("AttachmentView")})},removeSidebar:function(a){a.sidebar.remove("details"),a.$el.addClass("hide-sidebar")},createStates:function(){this.states.add([new b.controller.AddSlide.image({id:"insert",type:"image",title:_easingsliderAdminL10n.media_upload.image_from_media,priority:20,toolbar:"insert-slide",filterable:!1,library:wp.media.query({type:"image"}),multiple:!0,editable:!0,allowLocalEdits:!0,displaySettings:!1,displayUserSettings:!0})])},createIframeStates:function(){return this},insertToolbar:function(a){var b=this;a.set("insert-slide",{style:"primary",priority:80,text:_easingsliderAdminL10n.media_upload.insert_into_slider,requires:{selection:!1},click:function(){b.close().trigger("insert",b.getSelection()).reset()}})},getSelection:function(a){var c=new wp.media.model.Selection(null,{multiple:!0}),d=this.state().get("type"),a=this.state().get("selection");return _.each(a.models,function(a){var e=new b.model.Slide.get({type:d});a.get("id")?(e.attachment=a,e.set({attachment_id:a.get("id")},{silent:!0})):e.set(a,{silent:!0}),c.add(e)},this),c},updateRouter:function(){b.Router.navigate(_easingsliderAdminL10n.base_url)}}),b.frame.EditSlide={get:function(a){return"undefined"!=typeof b.frame.EditSlide[a.model.get("type")]?new(b.frame.EditSlide[a.model.get("type")])(a):new b.frame.EditSlide.base(a)}},b.frame.EditSlide.base=wp.media.view.MediaFrame.Select.extend({className:"edit-slide-frame media-frame",template:wp.template("easingslider-edit-slide-frame"),events:_.defaults({"click .left":"previousSlide","click .right":"nextSlide"},wp.media.view.MediaFrame.Select.prototype.events),initialize:function(){this.options.state="edit-slide",this.options.selection=new wp.media.model.Selection({},{multiple:!1}),wp.media.view.MediaFrame.Select.prototype.initialize.apply(this,arguments)},bindHandlers:function(){this.on("close",this.updateRouter,this),this.on("content:create:edit-slide",this.createView,this),this.on("toolbar:render:edit-slide",this.createToolbar,this),wp.media.view.MediaFrame.Select.prototype.bindHandlers.apply(this,arguments)},createView:function(a){a.view=new b.view.EditSlide.get({type:this.model.get("type"),model:this.model,controller:this})},createToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{select:{style:"primary",text:_easingsliderAdminL10n.media_upload.update,priority:80,click:function(){var a=this.controller,b=a.state();a.close(),b.trigger("update",a.model.toJSON()),a.setState(a.options.state),a.reset()}}}}))},createStates:function(){this.states.add([new b.controller.EditSlide.get({type:this.model.get("type")})]),wp.media.view.MediaFrame.Select.prototype.createStates.apply(this,arguments)},render:function(){return wp.media.view.MediaFrame.Select.prototype.render.apply(this,arguments),this.toggleNav(),this},rerender:function(){return this.content.render(),this.toggleNav(),this},toggleNav:function(){return this.$(".left").removeProp("disabled").removeClass("disabled"),this.$(".right").removeProp("disabled").removeClass("disabled"),this.hasPrevious()||this.$(".left").prop("disabled","disabled").addClass("disabled"),this.hasNext()||this.$(".right").prop("disabled","disabled").addClass("disabled"),this},previousSlide:function(){return this.hasPrevious()?(this.model=this.collection.at(this.collection.indexOf(this.model)-1),this.rerender(),void this.$(".left").focus()):void this.$(".left").blur()},nextSlide:function(){return this.hasNext()?(this.model=this.collection.at(this.collection.indexOf(this.model)+1),this.rerender(),void this.$(".right").focus()):void this.$(".right").blur()},hasNext:function(){return this.collection.indexOf(this.model)+1<this.collection.length},hasPrevious:function(){return this.collection.indexOf(this.model)-1>-1},updateRouter:function(){b.Router.navigate(_easingsliderAdminL10n.base_url)}}),b.frame.EditSlide.image=b.frame.EditSlide.base.extend({initialize:function(){this.image=new wp.media.model.PostImage(this.model.attributes),b.frame.EditSlide.base.prototype.initialize.apply(this,arguments)},bindHandlers:function(){this.on("content:create:browse",this.modifyBrowseFilters,this),this.on("content:render:browse",this.removeBrowseSidebar,this),this.on("content:render:edit-slide",this.showNav,this),this.on("content:render:edit-image",this.renderEditImageContent,this),this.on("toolbar:render:replace",this.hideNav,this),this.on("toolbar:render:replace",this.renderReplaceImageToolbar,this),this.state("replace-image").on("replace",this.replaceImage,this),b.frame.EditSlide.base.prototype.bindHandlers.apply(this,arguments)},createStates:function(){b.frame.EditSlide.base.prototype.createStates.apply(this,arguments),this.states.add([new wp.media.controller.ReplaceImage({id:"replace-image",library:wp.media.query({type:"image"}),image:this.image,multiple:!1,title:_easingsliderAdminL10n.media_upload.replace_image,toolbar:"replace",priority:80,displaySettings:!0}),new wp.media.controller.EditImage({image:this.image,selection:this.options.selection})])},modifyBrowseFilters:function(a){this.state().set("filterable",!0)},removeBrowseSidebar:function(a){a.sidebar.remove("details"),a.$el.addClass("hide-sidebar")},showNav:function(){this.$(".left, .right").show(),a(".media-modal-close").removeClass("no-border")},hideNav:function(){this.$(".left, .right").hide(),a(".media-modal-close").addClass("no-border")},renderEditImageContent:function(){var a,b=this.state(),c=b.get("image");c&&(a=new wp.media.view.EditImage({model:c,controller:this}).render(),this.content.set(a),a.loadEditor())},renderReplaceImageToolbar:function(){var a=this,b=a.lastState(),c=b&&b.id;this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{back:{text:_easingsliderAdminL10n.media_upload.back,priority:20,click:function(){c?a.setState(c):a.close()}},replace:{style:"primary",text:_easingsliderAdminL10n.media_upload.replace,priority:80,click:function(){var a=this.controller,b=a.state(),c=b.get("selection"),d=c.single();a.close(),a.image.changeAttachment(d,b.display(d)),b.trigger("replace",a.image.toJSON()),a.setState(a.options.state),a.reset()}}}}))},replaceImage:function(){this.model.set({attachment_id:this.image.attachment.id}),this.model.attachment.set(this.image.attachment.attributes)}}),b.view.Editor=Backbone.View.extend({el:".wrap",events:{"click #add-slides":"_addSlide","click #select-all":"_selectAll","click #delete-slides":"_clickBulkDelete","click #save":"_clickSave","click .toolbar .edit":"_clickEdit","click .toolbar .remove":"_clickDelete","click .show-advanced-options":"_clickAdvancedOptions","click .thumbnail":"_clickThumb","click .select-mode-toggle-button":"_toggleMode","click .sidebar-name":"_toggleWidget"},initialize:function(){this.subviews={AddSlide:new b.frame.AddSlide,Slides:new b.view.Slides({collection:this.collection})},this.collection.on("sync:done",this.render,this),this.collection.on("sync:done",this._enableSave,this),this.collection.on("sync:done",this._handleNoSlides,this),this.collection.on("add",this._handleNoSlides,this),this.collection.on("remove",this._handleNoSlides,this),this.subviews.AddSlide.on("insert",this._handleInsert,this),a(window).on("resize",this._setColumns.bind(this)),this._selectMode=!1,this._setColumns(),this._showSpinner()},_showSpinner:function(){this.$("#slides-browser").append('<div class="spinner"></div>')},_hideSpinner:function(){this.$("#slides-browser .spinner").remove()},_enableSave:function(){this.$("#save").prop("disabled",!1)},_clickSave:function(){this.$("#publishing-action .spinner").css({display:"block"})},_setColumns:function(){var a=this.$(".media-frame-content"),b=a.attr("data-columns"),c=a.width();if(c){var d=Math.min(Math.round(c/145),12)||1;b&&b===d||a.attr("data-columns",d)}},_handleNoSlides:function(){0==this.collection.length?this.$("form").prepend('<input type="hidden" id="slides" name="slides" value="[]" />'):this.$('input[name="slides"]').remove()},_handleInsert:function(a){this.collection.add(a.models)},_clickThumb:function(a){a.preventDefault(),this._selectMode?this._toggleSelect(a):this._editSlide(a)},_clickEdit:function(a){a.preventDefault(),this._editSlide(a)},_clickDelete:function(b){if(b.preventDefault(),confirm(_easingsliderAdminL10n.warn)){var c=a(b.currentTarget).parents(".attachment").attr("data-id");this.collection.remove(c)}},_clickBulkDelete:function(a){a.preventDefault(),confirm(_easingsliderAdminL10n.warn)&&(this._deleteSlides(a),this._toggleMode(a))},_clickAdvancedOptions:function(b){b.preventDefault();var c=a(b.currentTarget).parent().find(".advanced-options");c.toggleClass("hide")},_toggleMode:function(a){a.preventDefault(),this._selectMode?this._selectMode=!1:this._selectMode=!0,this.$(".attachment").removeClass("selected details"),this.$(".media-frame").toggleClass("mode-select"),this.$(".media-toolbar div *").toggleClass("hide")},_toggleSelect:function(b){b.preventDefault(),a(b.currentTarget).parents(".attachment").toggleClass("selected details")},_toggleWidget:function(b){b.preventDefault();var c=a(b.currentTarget).parent(),d=c.find(".sidebar-content");c.hasClass("fixed")||(this.$(".widgets-holder-wrap").each(function(){var b=a(this);b.hasClass("fixed")||b.find(".sidebar-content").slideUp(200,function(){b.addClass("closed")})}),c.hasClass("closed")&&d.slideDown(200,function(){c.removeClass("closed")}))},_selectAll:function(a){a.preventDefault(),this.$(".attachment").addClass("selected details")},_deleteSlides:function(b){b.preventDefault();var c=this.collection,d=[];this.$(".attachment").each(function(b){a(this).hasClass("selected")&&d.push(c.at(b))}),this.collection.remove(d)},_addSlide:function(a){a.preventDefault(),this.addSlide(),b.Router.navigate(_easingsliderAdminL10n.base_url+"&add=true")},addSlide:function(){return this.subviews.AddSlide.open(),this},_editSlide:function(c){c.preventDefault();var d=a(c.currentTarget).parents(".attachment").attr("data-id");this.editSlide(d),b.Router.navigate(_easingsliderAdminL10n.base_url+"&slide="+d)},editSlide:function(a){return this.subviews.EditSlide=new b.frame.EditSlide.get({collection:this.collection,model:this.collection.get(a)}),this.subviews.EditSlide.open(),this},newAddSlideFrame:function(a){var c=this.subviews.AddSlide;c.states.add([new b.controller.AddSlide.get(a)]),c.on("content:render:"+a.content,function(){var c=new b.view.AddSlide.get({type:a.content,model:this.state().props,controller:this});this.content.set(c)},c),c.on("toolbar:render:"+a.toolbar,function(){var c=new b.toolbar.AddSlide.get({type:a.toolbar,controller:this});this.toolbar.set(c)},c)},render:function(){this._hideSpinner();var a=this.subviews.Slides.render().el;return this.$("#slides-browser").append(a),this}}),b.view.Slides=Backbone.View.extend({tagName:"ul",attributes:{"class":"attachments ui-sortable",tabindex:"-1"},initialize:function(){this.subviews=[],this.collection.on("add",this.add,this),this.collection.on("remove",this.render,this),this.collection.on("reset",this.render,this),this.$el.sortable({items:".attachment",containment:"parent",tolerance:"pointer",stop:this._sort.bind(this)})},_sort:function(a,b){var c=this.collection.get(b.item.context.dataset.id);this.collection.reposition(c,b.item.index())},add:function(a){var c=new b.view.Slide({model:a});return this.subviews.push(c),this.$el.append(c.render().$el),this},render:function(){return this.subviews=[],this.$el.empty(),_.each(this.collection.models,function(a){this.add(a)},this),this}}),b.view.Slide=Backbone.View.extend({tagName:"li",attributes:function(){return{role:"checkbox","class":"attachment save-ready",tabindex:"0","data-id":this.model.id}},template:wp.media.template("easingslider-slide"),initialize:function(){this.model.on("change",this._setData,this),this.model.on("change:id",this._updateID,this),this.model.on("change:url",this.render,this),this.model.on("change:poster",this.render,this),this.model.on("change:attachment_id",this.render,this),this.model.attachment&&this.model.attachment.on("change",this.render,this)},_setData:function(){this.$('input[name="slides[]"]').val(JSON.stringify(this.model.attributes))},_updateID:function(a,b){this.$el.attr("data-id",b),this.attributes["data-id"]=b},render:function(){var a={model:this.model.toJSON()};return this.model.attachment&&(a.attachment=this.model.attachment.toJSON()),this.$el.html(this.template(a)),this}}),b.view.AddSlide={get:function(a){return"undefined"!=typeof b.view.AddSlide[a.type]?new b.view.AddSlide[a.type](a):new b.view.AddSlide.base(a)}},b.view.AddSlide.base=wp.media.View.extend(),b.view.AddSlide.image=wp.media.view.AttachmentsBrowser.extend(),b.view.EditSlide={get:function(a){return"undefined"!=typeof b.view.EditSlide[a.type]?new b.view.EditSlide[a.type](a):new b.view.EditSlide.base(a)}},b.view.EditSlide.base=wp.media.view.Settings.extend({className:"edit-attachment-frame attachment-details mode-select",template:wp.media.template("easingslider-edit-slide"),initialize:function(){wp.media.view.Settings.prototype.initialize.apply(this,arguments),this.model.on("change:link",this.toggleLinkSettings,this),this.model.on("change:link",this.updateLinkTo,this)},prepare:function(){var a=!1;return this.model.attachment&&(a=this.model.attachment.toJSON()),_.defaults({model:this.model.toJSON(),attachment:a},this.options)},toggleLinkSettings:function(){"none"===this.model.get("link")?this.$(".link-options").addClass("hide"):this.$(".link-options").removeClass("hide")},updateLinkTo:function(){var a=this.model.get("link"),b=this.$(".link-to-custom");if(this.model.attachment){if("none"===a||"embed"===a||!this.model.attachment&&"custom"!==a)return void b.addClass("hidden");this.model.attachment&&("post"===a?b.val(this.model.attachment.get("link")):"file"===a?b.val(this.model.attachment.get("url")):this.model.get("linkUrl")||b.val("http://"),b.prop("readonly","custom"!==a)),b.removeClass("hidden"),!wp.media.isTouchDevice&&b.is(":visible")&&b.focus()[0].select()}},render:function(){return wp.media.view.Settings.prototype.render.apply(this,arguments),this.toggleLinkSettings(),this.updateLinkTo(),this}}),b.view.EditSlide.image=b.view.EditSlide.base.extend({events:_.defaults({"click .edit-attachment":"editAttachment","click .replace-attachment":"replaceAttachment"},b.view.EditSlide.base.prototype.events),initialize:function(){b.view.EditSlide.base.prototype.initialize.apply(this,arguments),this.model.on("change:url",this.updateImage,this)},editAttachment:function(a){var b=this.controller.states.get("edit-image");window.imageEdit&&b&&(a.preventDefault(),b.set("image",this.model.attachment),this.controller.setState("edit-image"))},replaceAttachment:function(a){a.preventDefault(),this.controller.setState("replace-image")},updateImage:function(){this.$(".details-image").attr("src",this.model.get("url"))}}),b.toolbar.AddSlide={get:function(a){return"undefined"!=typeof b.toolbar.AddSlide[a.type]?new b.toolbar.AddSlide[a.type](a):new b.toolbar.AddSlide.base(a)}},b.toolbar.AddSlide.base=wp.media.view.Toolbar.extend(),b.router=Backbone.Router.extend({routes:{"admin.php?page=:page&edit=:id&slide=:slide":"editSlide","admin.php?page=:page&edit=:id&add=true":"addSlide","admin.php?page=:page&edit=:id":"editor","admin.php?page=easingslider-add-new":"editor"},initialize:function(){var a="undefined"==typeof window.slides?"[]":window.slides;this.view=new b.view.Editor({collection:new b.collection.Slides(JSON.parse(a))})},editSlide:function(a,b,c){return this.editor(),this.view.collection.on("sync:done",function(){this.view.editSlide(c)},this),this},addSlide:function(a,b){return this.editor(),this.view.collection.on("sync:done",function(){this.view.addSlide()},this),this},editor:function(a){return this.view.collection.sync(),this}}),a(document).ready(function(){b.Router=new b.router,Backbone.history.start({root:window._easingsliderAdminL10n.admin_url,pushState:!0}),a(".delete").each(function(){a(this).on("click",function(){return confirm(_easingsliderAdminL10n.warn)?void 0:!1})}),a('select[name="type"]').on("change",function(){a("*[data-type]").addClass("hidden"),a('*[data-type="'+this.value+'"]').removeClass("hidden"),"media"!=this.value?a(".media-toolbar-primary").addClass("hidden"):a(".media-toolbar-primary").removeClass("hidden")}),a(document).on("click",".js-activate-addon",function(b){b.preventDefault();var c=a(this),d=c.parents(".addon-status"),e=d.find(".status-message");a(".action-error").remove(),c.text(_easingsliderAdminL10n.buttons.activating);var f={url:ajaxurl,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"easingslider_activate_addon",nonce:_easingsliderAdminL10n.nonces.activate,plugin:c.attr("data-plugin")},success:function(a){return a&&!0!==a?(c.after('<div class="action-error error"><strong>'+a.error+"</strong></div>"),!1):(c.text(_easingsliderAdminL10n.buttons.deactivate).removeClass("js-activate-addon").addClass("js-deactivate-addon"),e.text(_easingsliderAdminL10n.messages.active),void d.removeClass("is-inactive").addClass("is-active"))},error:function(a,b,c){return!1}};a.ajax(f)}),a(document).on("click",".js-deactivate-addon",function(b){b.preventDefault();var c=a(this),d=c.parents(".addon-status"),e=d.find(".status-message");a(".action-error").remove(),c.text(_easingsliderAdminL10n.buttons.deactivating);var f={url:ajaxurl,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"easingslider_deactivate_addon",nonce:_easingsliderAdminL10n.nonces.deactivate,plugin:c.attr("data-plugin")},success:function(a){return a&&!0!==a?(c.after('<div class="action-error error"><strong>'+a.error+"</strong></div>"),!1):(c.text(_easingsliderAdminL10n.buttons.activate).removeClass("js-deactivate-addon").addClass("js-activate-addon"),e.text(_easingsliderAdminL10n.messages.inactive),void d.removeClass("is-active").addClass("is-inactive"))},error:function(a,b,c){return!1}};a.ajax(f)}),a(document).on("click",".js-install-addon",function(b){b.preventDefault();var c=a(this),d=c.parents(".addons"),e=c.parents(".addon-status"),f=e.find(".status-message");a(".action-error").remove(),c.text(_easingsliderAdminL10n.buttons.installing);var g={url:ajaxurl,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"easingslider_install_addon",nonce:_easingsliderAdminL10n.nonces.install,plugin:c.attr("data-plugin")},success:function(b){return b.error?(c.after('<div class="action-error error"><strong>'+b.error+"</strong></div>"),!1):b.form?(d.hide(),d.after('<div class="action-error error">'+b.form+"</div>"),c.attr("disabled",!0),void a(document).on("click","#upgrade",function(b){b.preventDefault();var g=a(this),h=g.parent().parent().parent().parent(),i=g.parent().parent().find("#hostname").val(),j=g.parent().parent().find("#username").val(),k=g.parent().parent().find("#password").val();a.ajax({url:ajaxurl,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"easingslider_install_addon",nonce:_easingsliderAdminL10n.nonces.install,plugin:c.attr("data-plugin"),hostname:i,username:j,password:k},success:function(a){return a.error?(c.attr("data-plugin",a.plugin).text(_easingsliderAdminL10n.buttons.activate).removeClass("js-install-addon").addClass("js-activate-addon"),!1):a.form?(d.after('<div class="action-error error"><p>'+_easingsliderAdminL10n.ftp_error+"</p></div>"),!1):(h.remove(),d.show(),f.text(_easingsliderAdminL10n.messages.inactive),void e.removeClass("not-installed").addClass("is-inactive"))},error:function(a,b,c){return!1}})})):(c.attr("data-plugin",b.plugin).text(_easingsliderAdminL10n.buttons.activate).removeClass("js-install-addon").addClass("js-activate-addon"),f.text(_easingsliderAdminL10n.messages.inactive),void e.removeClass("not-installed").addClass("is-inactive"))},error:function(a,b,c){return!1}};a.ajax(g)})})}(jQuery);
|
assets/js/public.js
CHANGED
@@ -1610,7 +1610,7 @@ if (typeof Object.create !== "function") {
|
|
1610 |
}
|
1611 |
|
1612 |
// Prevent subpixel rendering by rounding width
|
1613 |
-
outerWrapper.css({ 'width': Math.floor(outerWrapper.
|
1614 |
|
1615 |
return base;
|
1616 |
|
1610 |
}
|
1611 |
|
1612 |
// Prevent subpixel rendering by rounding width
|
1613 |
+
outerWrapper.css({ 'width': Math.floor(outerWrapper.width()) +'px' });
|
1614 |
|
1615 |
return base;
|
1616 |
|
assets/js/public.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a,b,c){var d={init:function(b,c){var d=this;d.$elem=a(c),d.options=a.extend({},a.fn.easingSlider.options,d.$elem.data(),b),d.userOptions=b,d.loadContent()},loadContent:function(){function b(a){var b,c="";if("function"==typeof d.options.jsonSuccess)d.options.jsonSuccess.apply(this,[a]);else{for(b in a.easingslider)a.easingslider.hasOwnProperty(b)&&(c+=a.easingslider[b].item);d.$elem.html(c)}d.logIn()}var c,d=this;"function"==typeof d.options.beforeInit&&d.options.beforeInit.apply(this,[d.$elem]),"string"==typeof d.options.jsonPath?(c=d.options.jsonPath,a.getJSON(c,b)):d.logIn()},logIn:function(){var a=this;a.$elem.data("easingslider-originalStyles",a.$elem.attr("style")).data("easingslider-originalClasses",a.$elem.attr("class")),a.$elem.css({opacity:0}),a.orignalItems=a.options.items,a.checkBrowser(),a.wrapperWidth=0,a.checkVisible=null,a.setVars()},setVars:function(){var a=this;return 0===a.$elem.children().length?!1:(a.baseClass(),a.eventTypes(),a.$userItems=a.$elem.children(),a.itemsAmount=a.$userItems.length,a.wrapItems(),a.$easingsliderItems=a.$elem.find(".easingslider-item"),a.$easingsliderWrapper=a.$elem.find(".easingslider-wrapper"),a.playDirection="next",a.prevItem=0,a.prevArr=[0],a.currentItem=0,a.customEvents(),void a.onStartup())},onStartup:function(){var a=this;a.updateItems(),a.calculateAll(),a.buildControls(),a.updateControls(),a.response(),a.moveEvents(),a.stopOnHover(),a.easingsliderStatus(),a.options.transitionStyle!==!1&&a.transitionTypes(a.options.transitionStyle),a.options.autoPlay===!0&&(a.options.autoPlay=5e3),a.play(),a.$elem.find(".easingslider-wrapper").css("display","block"),a.$elem.is(":visible")?a.$elem.css("opacity",1):a.watchVisibility(),a.onstartup=!1,a.eachMoveUpdate(),"function"==typeof a.options.afterInit&&a.options.afterInit.apply(this,[a.$elem])},eachMoveUpdate:function(){var a=this;a.options.lazyLoad===!0&&a.lazyLoad(),a.options.autoHeight===!0&&a.autoHeight(),a.onVisibleItems(),"function"==typeof a.options.afterAction&&a.options.afterAction.apply(this,[a.$elem])},updateVars:function(){var a=this;"function"==typeof a.options.beforeUpdate&&a.options.beforeUpdate.apply(this,[a.$elem]),a.watchVisibility(),a.updateItems(),a.calculateAll(),a.updatePosition(),a.updateControls(),a.eachMoveUpdate(),"function"==typeof a.options.afterUpdate&&a.options.afterUpdate.apply(this,[a.$elem])},reload:function(){var a=this;b.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;return a.$elem.is(":visible")!==!1?!1:(a.$elem.css({opacity:0}),b.clearInterval(a.autoPlayInterval),b.clearInterval(a.checkVisible),void(a.checkVisible=b.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),b.clearInterval(a.checkVisible))},500)))},wrapItems:function(){var a=this;a.$userItems.wrapAll('<div class="easingslider-wrapper">').wrap('<div class="easingslider-item"></div>'),a.$elem.find(".easingslider-wrapper").wrap('<div class="easingslider-wrapper-outer">'),a.wrapperOuter=a.$elem.find(".easingslider-wrapper-outer"),a.$elem.css("display","block")},baseClass:function(){var a=this,b=a.$elem.hasClass(a.options.baseClass),c=a.$elem.hasClass(a.options.theme);b||a.$elem.addClass(a.options.baseClass),c||a.$elem.addClass(a.options.theme)},updateItems:function(){var b,c,d=this;if(d.options.responsive===!1)return!1;if(d.options.singleItem===!0)return d.options.items=d.orignalItems=1,d.options.itemsCustom=!1,d.options.itemsDesktop=!1,d.options.itemsDesktopSmall=!1,d.options.itemsTablet=!1,d.options.itemsTabletSmall=!1,d.options.itemsMobile=!1,!1;if(b=a(d.options.responsiveBaseWidth).width(),b>(d.options.itemsDesktop[0]||d.orignalItems)&&(d.options.items=d.orignalItems),d.options.itemsCustom!==!1)for(d.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),c=0;c<d.options.itemsCustom.length;c+=1)d.options.itemsCustom[c][0]<=b&&(d.options.items=d.options.itemsCustom[c][1]);else b<=d.options.itemsDesktop[0]&&d.options.itemsDesktop!==!1&&(d.options.items=d.options.itemsDesktop[1]),b<=d.options.itemsDesktopSmall[0]&&d.options.itemsDesktopSmall!==!1&&(d.options.items=d.options.itemsDesktopSmall[1]),b<=d.options.itemsTablet[0]&&d.options.itemsTablet!==!1&&(d.options.items=d.options.itemsTablet[1]),b<=d.options.itemsTabletSmall[0]&&d.options.itemsTabletSmall!==!1&&(d.options.items=d.options.itemsTabletSmall[1]),b<=d.options.itemsMobile[0]&&d.options.itemsMobile!==!1&&(d.options.items=d.options.itemsMobile[1]);d.options.items>d.itemsAmount&&d.options.itemsScaleUp===!0&&(d.options.items=d.itemsAmount)},response:function(){var c,d,e=this;return e.options.responsive!==!0?!1:(d=a(b).width(),e.resizer=function(){a(b).width()!==d&&(e.options.autoPlay!==!1&&b.clearInterval(e.autoPlayInterval),b.clearTimeout(c),c=b.setTimeout(function(){d=a(b).width(),e.updateVars()},e.options.responsiveRefreshRate))},void a(b).resize(e.resizer))},updatePosition:function(){var a=this;a.jumpTo(a.currentItem),a.options.autoPlay!==!1&&a.checkAp()},appendItemsSizes:function(){var b=this,c=0,d=b.itemsAmount-b.options.items;b.$easingsliderItems.each(function(e){var f=a(this);f.css({width:b.itemWidth}).data("easingslider-item",Number(e)),e%b.options.items!==0&&e!==d||e>d||(c+=1),f.data("easingslider-roundPages",c)})},appendWrapperSizes:function(){var a=this,b=a.$easingsliderItems.length*a.itemWidth;a.$easingsliderWrapper.css({width:2*b,left:0}),a.appendItemsSizes()},calculateAll:function(){var a=this;a.calculateWidth(),a.appendWrapperSizes(),a.loops(),a.max()},calculateWidth:function(){var a=this;a.itemWidth=Math.round(a.$elem.width()/a.options.items)},max:function(){var a=this,b=-1*(a.itemsAmount*a.itemWidth-a.options.items*a.itemWidth);return a.options.items>a.itemsAmount?(a.maximumItem=0,b=0,a.maximumPixels=0):(a.maximumItem=a.itemsAmount-a.options.items,a.maximumPixels=b),b},min:function(){return 0},loops:function(){var b,c,d,e=this,f=0,g=0;for(e.positionsInArray=[0],e.pagesInArray=[],b=0;b<e.itemsAmount;b+=1)g+=e.itemWidth,e.positionsInArray.push(-g),e.options.scrollPerPage===!0&&(c=a(e.$easingsliderItems[b]),d=c.data("easingslider-roundPages"),d!==f&&(e.pagesInArray[f]=e.positionsInArray[b],f=d))},buildControls:function(){var b=this;b.options.navigation!==!0&&b.options.pagination!==!0||(b.easingsliderControls=a('<div class="easingslider-controls"/>').toggleClass("clickable",!b.browser.isTouch).appendTo(b.$elem)),b.options.pagination===!0&&b.buildPagination(),b.options.navigation===!0&&b.buildButtons()},buildButtons:function(){var b=this,c=a('<div class="easingslider-buttons"/>');b.easingsliderControls.append(c),b.buttonPrev=a("<div/>",{"class":"easingslider-prev",html:b.options.navigationText[0]||""}),b.buttonNext=a("<div/>",{"class":"easingslider-next",html:b.options.navigationText[1]||""}),c.append(b.buttonPrev).append(b.buttonNext),c.on("touchstart.easingsliderControls mousedown.easingsliderControls",'div[class^="easingslider"]',function(a){a.preventDefault()}),c.on("touchend.easingsliderControls mouseup.easingsliderControls",'div[class^="easingslider"]',function(c){c.preventDefault(),a(this).hasClass("easingslider-next")?b.next():b.prev()})},buildPagination:function(){var b=this;b.paginationWrapper=a('<div class="easingslider-pagination"/>'),b.easingsliderControls.append(b.paginationWrapper),b.paginationWrapper.on("touchend.easingsliderControls mouseup.easingsliderControls",".easingslider-page",function(c){c.preventDefault(),Number(a(this).data("easingslider-page"))!==b.currentItem&&b.goTo(Number(a(this).data("easingslider-page")),!0)})},updatePagination:function(){var b,c,d,e,f,g,h=this;if(h.options.pagination===!1)return!1;for(h.paginationWrapper.html(""),b=0,c=h.itemsAmount-h.itemsAmount%h.options.items,e=0;e<h.itemsAmount;e+=1)e%h.options.items===0&&(b+=1,c===e&&(d=h.itemsAmount-h.options.items),f=a("<div/>",{"class":"easingslider-page"}),g=a("<span></span>",{text:h.options.paginationNumbers===!0?b:"","class":h.options.paginationNumbers===!0?"easingslider-numbers":""}),f.append(g),f.data("easingslider-page",c===e?d:e),f.data("easingslider-roundPages",b),h.paginationWrapper.append(f));h.checkPagination()},checkPagination:function(){var b=this;return b.options.pagination===!1?!1:void b.paginationWrapper.find(".easingslider-page").each(function(){a(this).data("easingslider-roundPages")===a(b.$easingsliderItems[b.currentItem]).data("easingslider-roundPages")&&(b.paginationWrapper.find(".easingslider-page").removeClass("active"),a(this).addClass("active"))})},checkNavigation:function(){var a=this;return a.options.navigation===!1?!1:void(a.options.rewindNav===!1&&(0===a.currentItem&&0===a.maximumItem?(a.buttonPrev.addClass("disabled"),a.buttonNext.addClass("disabled")):0===a.currentItem&&0!==a.maximumItem?(a.buttonPrev.addClass("disabled"),a.buttonNext.removeClass("disabled")):a.currentItem===a.maximumItem?(a.buttonPrev.removeClass("disabled"),a.buttonNext.addClass("disabled")):0!==a.currentItem&&a.currentItem!==a.maximumItem&&(a.buttonPrev.removeClass("disabled"),a.buttonNext.removeClass("disabled"))))},updateControls:function(){var a=this;a.updatePagination(),a.checkNavigation(),a.easingsliderControls&&(a.options.items>=a.itemsAmount?a.easingsliderControls.hide():a.easingsliderControls.show())},destroyControls:function(){var a=this;a.easingsliderControls&&a.easingsliderControls.remove()},next:function(a){var b=this;if(b.isTransition)return!1;if(b.currentItem+=b.options.scrollPerPage===!0?b.options.items:1,b.currentItem>b.maximumItem+(b.options.scrollPerPage===!0?b.options.items-1:0)){if(b.options.rewindNav!==!0)return b.currentItem=b.maximumItem,!1;b.currentItem=0,a="rewind"}b.goTo(b.currentItem,a)},prev:function(a){var b=this;if(b.isTransition)return!1;if(b.options.scrollPerPage===!0&&b.currentItem>0&&b.currentItem<b.options.items?b.currentItem=0:b.currentItem-=b.options.scrollPerPage===!0?b.options.items:1,b.currentItem<0){if(b.options.rewindNav!==!0)return b.currentItem=0,!1;b.currentItem=b.maximumItem,a="rewind"}b.goTo(b.currentItem,a)},goTo:function(a,c,d){var e,f=this;return f.isTransition?!1:("function"==typeof f.options.beforeMove&&f.options.beforeMove.apply(this,[f.$elem]),a>=f.maximumItem?a=f.maximumItem:0>=a&&(a=0),f.currentItem=f.easingslider.currentItem=a,f.options.transitionStyle!==!1&&"drag"!==d&&1===f.options.items&&f.browser.support3d===!0?(f.swapSpeed(0),f.browser.support3d===!0?f.transition3d(f.positionsInArray[a]):f.css2slide(f.positionsInArray[a],1),f.afterGo(),f.singleItemTransition(),!1):(e=f.positionsInArray[a],f.browser.support3d===!0?(f.isCss3Finish=!1,c===!0?(f.swapSpeed("paginationSpeed"),b.setTimeout(function(){f.isCss3Finish=!0},f.options.paginationSpeed)):"rewind"===c?(f.swapSpeed(f.options.rewindSpeed),b.setTimeout(function(){f.isCss3Finish=!0},f.options.rewindSpeed)):(f.swapSpeed("slideSpeed"),b.setTimeout(function(){f.isCss3Finish=!0},f.options.slideSpeed)),f.transition3d(e)):c===!0?f.css2slide(e,f.options.paginationSpeed):"rewind"===c?f.css2slide(e,f.options.rewindSpeed):f.css2slide(e,f.options.slideSpeed),void f.afterGo()))},jumpTo:function(a){var b=this;"function"==typeof b.options.beforeMove&&b.options.beforeMove.apply(this,[b.$elem]),a>=b.maximumItem||-1===a?a=b.maximumItem:0>=a&&(a=0),b.swapSpeed(0),b.browser.support3d===!0?b.transition3d(b.positionsInArray[a]):b.css2slide(b.positionsInArray[a],1),b.currentItem=b.easingslider.currentItem=a,b.afterGo()},afterGo:function(){var a=this;a.prevArr.push(a.currentItem),a.prevItem=a.easingslider.prevItem=a.prevArr[a.prevArr.length-2],a.prevArr.shift(0),a.prevItem!==a.currentItem&&(a.checkPagination(),a.checkNavigation(),a.eachMoveUpdate(),a.options.autoPlay!==!1&&a.checkAp()),"function"==typeof a.options.afterMove&&a.prevItem!==a.currentItem&&a.options.afterMove.apply(this,[a.$elem])},stop:function(){var a=this;a.apStatus="stop",b.clearInterval(a.autoPlayInterval)},checkAp:function(){var a=this;"stop"!==a.apStatus&&a.play()},play:function(){var a=this;return a.apStatus="play",a.options.autoPlay===!1?!1:(b.clearInterval(a.autoPlayInterval),void(a.autoPlayInterval=b.setInterval(function(){a.next(!0)},a.options.autoPlay)))},swapSpeed:function(a){var b=this;"slideSpeed"===a?b.$easingsliderWrapper.css(b.addCssSpeed(b.options.slideSpeed)):"paginationSpeed"===a?b.$easingsliderWrapper.css(b.addCssSpeed(b.options.paginationSpeed)):"string"!=typeof a&&b.$easingsliderWrapper.css(b.addCssSpeed(a))},addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){var b=this;b.$easingsliderWrapper.css(b.doTranslate(a))},css2move:function(a){var b=this;b.$easingsliderWrapper.css({left:a})},css2slide:function(a,b){var c=this;c.isCssFinish=!1,c.$easingsliderWrapper.stop(!0,!0).animate({left:a},{duration:b||c.options.slideSpeed,complete:function(){c.isCssFinish=!0}})},checkBrowser:function(){var a,d,e,f,g=this,h="translate3d(0px, 0px, 0px)",i=c.createElement("div");i.style.cssText=" -moz-transform:"+h+"; -ms-transform:"+h+"; -o-transform:"+h+"; -webkit-transform:"+h+"; transform:"+h,a=/translate3d\(0px, 0px, 0px\)/g,d=i.style.cssText.match(a),e=null!==d&&1===d.length,f="ontouchstart"in b||b.navigator.msMaxTouchPoints,g.browser={support3d:e,isTouch:f}},moveEvents:function(){var a=this;a.options.mouseDrag===!1&&a.options.touchDrag===!1||(a.gestures(),a.disabledEvents())},eventTypes:function(){var a=this,b=["s","e","x"];a.ev_types={},a.options.mouseDrag===!0&&a.options.touchDrag===!0?b=["touchstart.easingslider mousedown.easingslider","touchmove.easingslider mousemove.easingslider","touchend.easingslider touchcancel.easingslider mouseup.easingslider"]:a.options.mouseDrag===!1&&a.options.touchDrag===!0?b=["touchstart.easingslider","touchmove.easingslider","touchend.easingslider touchcancel.easingslider"]:a.options.mouseDrag===!0&&a.options.touchDrag===!1&&(b=["mousedown.easingslider","mousemove.easingslider","mouseup.easingslider"]),a.ev_types.start=b[0],a.ev_types.move=b[1],a.ev_types.end=b[2]},disabledEvents:function(){var b=this;b.$elem.on("dragstart.easingslider",function(a){a.preventDefault()}),b.$elem.on("mousedown.disableTextSelect",function(b){return a(b.target).is("input, textarea, select, option")})},gestures:function(){function d(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function e(b){"on"===b?(a(c).on(i.ev_types.move,g),a(c).on(i.ev_types.end,h)):"off"===b&&(a(c).off(i.ev_types.move),a(c).off(i.ev_types.end))}function f(c){var f,g=c.originalEvent||c||b.event;if(3===g.which)return!1;if(!(i.itemsAmount<=i.options.items)){if(i.isCssFinish===!1&&!i.options.dragBeforeAnimFinish)return!1;if(i.isCss3Finish===!1&&!i.options.dragBeforeAnimFinish)return!1;i.options.autoPlay!==!1&&b.clearInterval(i.autoPlayInterval),i.browser.isTouch===!0||i.$easingsliderWrapper.hasClass("grabbing")||i.$easingsliderWrapper.addClass("grabbing"),i.newPosX=0,i.newRelativeX=0,a(this).css(i.removeTransition()),f=a(this).position(),j.relativePos=f.left,j.offsetX=d(g).x-f.left,j.offsetY=d(g).y-f.top,e("on"),j.sliding=!1,j.targetElement=g.target||g.srcElement}}function g(e){var f,g,h=e.originalEvent||e||b.event;i.newPosX=d(h).x-j.offsetX,i.newPosY=d(h).y-j.offsetY,i.newRelativeX=i.newPosX-j.relativePos,"function"==typeof i.options.startDragging&&j.dragging!==!0&&0!==i.newRelativeX&&(j.dragging=!0,i.options.startDragging.apply(i,[i.$elem])),(i.newRelativeX>8||i.newRelativeX<-8)&&i.browser.isTouch===!0&&(void 0!==h.preventDefault?h.preventDefault():h.returnValue=!1,j.sliding=!0),(i.newPosY>10||i.newPosY<-10)&&j.sliding===!1&&a(c).off("touchmove.easingslider"),f=function(){return i.newRelativeX/5},g=function(){return i.maximumPixels+i.newRelativeX/5},i.newPosX=Math.max(Math.min(i.newPosX,f()),g()),i.browser.support3d===!0?i.transition3d(i.newPosX):i.css2move(i.newPosX)}function h(c){var d,f,g,h=c.originalEvent||c||b.event;h.target=h.target||h.srcElement,j.dragging=!1,i.browser.isTouch!==!0&&i.$easingsliderWrapper.removeClass("grabbing"),i.newRelativeX<0?i.dragDirection=i.easingslider.dragDirection="left":i.dragDirection=i.easingslider.dragDirection="right",0!==i.newRelativeX&&(d=i.getNewPosition(),i.goTo(d,!1,"drag"),j.targetElement===h.target&&i.browser.isTouch!==!0&&(a(h.target).on("click.disable",function(b){b.stopImmediatePropagation(),b.stopPropagation(),b.preventDefault(),a(b.target).off("click.disable")}),f=a._data(h.target,"events").click,g=f.pop(),f.splice(0,0,g))),e("off")}var i=this,j={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};i.isCssFinish=!0,i.$elem.on(i.ev_types.start,".easingslider-wrapper",f)},getNewPosition:function(){var a=this,b=a.closestItem();return b>a.maximumItem?(a.currentItem=a.maximumItem,b=a.maximumItem):a.newPosX>=0&&(b=0,a.currentItem=0),b},closestItem:function(){var b=this,c=b.options.scrollPerPage===!0?b.pagesInArray:b.positionsInArray,d=b.newPosX,e=null;return a.each(c,function(f,g){d-b.itemWidth/20>c[f+1]&&d-b.itemWidth/20<g&&"left"===b.moveDirection()?(e=g,b.options.scrollPerPage===!0?b.currentItem=a.inArray(e,b.positionsInArray):b.currentItem=f):d+b.itemWidth/20<g&&d+b.itemWidth/20>(c[f+1]||c[f]-b.itemWidth)&&"right"===b.moveDirection()&&(b.options.scrollPerPage===!0?(e=c[f+1]||c[c.length-1],b.currentItem=a.inArray(e,b.positionsInArray)):(e=c[f+1],b.currentItem=f+1))}),b.currentItem},moveDirection:function(){var a,b=this;return b.newRelativeX<0?(a="right",b.playDirection="next"):(a="left",b.playDirection="prev"),a},customEvents:function(){var a=this;a.$elem.on("easingslider.next",function(){a.next()}),a.$elem.on("easingslider.prev",function(){a.prev()}),a.$elem.on("easingslider.play",function(b,c){a.options.autoPlay=c,a.play(),a.hoverStatus="play"}),a.$elem.on("easingslider.stop",function(){a.stop(),a.hoverStatus="stop"}),a.$elem.on("easingslider.goTo",function(b,c){a.goTo(c)}),a.$elem.on("easingslider.jumpTo",function(b,c){a.jumpTo(c)})},stopOnHover:function(){var a=this;a.options.stopOnHover===!0&&a.browser.isTouch!==!0&&a.options.autoPlay!==!1&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var b,c,d,e,f,g=this;if(g.options.lazyLoad===!1)return!1;for(b=0;b<g.itemsAmount;b+=1)c=a(g.$easingsliderItems[b]),"loaded"!==c.data("easingslider-loaded")&&(d=c.data("easingslider-item"),e=c.find(".easingslider-lazy"),"string"==typeof e.data("src")?(void 0===c.data("easingslider-loaded")&&(e.hide(),c.addClass("loading").data("easingslider-loaded","checked")),f=g.options.lazyFollow===!0?d>=g.currentItem:!0,f&&d<g.currentItem+g.options.items&&e.length&&g.lazyPreload(c,e)):c.data("easingslider-loaded","loaded"))},lazyPreload:function(a,c){function d(){a.data("easingslider-loaded","loaded").removeClass("loading"),c.removeAttr("data-src"),"fade"===g.options.lazyEffect?c.fadeIn(400):c.show(),"function"==typeof g.options.afterLazyLoad&&g.options.afterLazyLoad.apply(this,[g.$elem])}function e(){h+=1,g.completeImg(c.get(0))||f===!0?d():100>=h?b.setTimeout(e,100):d()}var f,g=this,h=0;"DIV"===c.prop("tagName")?(c.css("background-image","url("+c.data("src")+")"),f=!0):c[0].src=c.data("src"),e()},autoHeight:function(){function c(){var c=a(f.$easingsliderItems[f.currentItem]).height();f.wrapperOuter.css("height",c+"px"),f.wrapperOuter.hasClass("autoHeight")||b.setTimeout(function(){f.wrapperOuter.addClass("autoHeight")},0)}function d(){e+=1,f.completeImg(g.get(0))?c():100>=e?b.setTimeout(d,100):f.wrapperOuter.css("height","")}var e,f=this,g=a(f.$easingsliderItems[f.currentItem]).find("img");void 0!==g.get(0)?(e=0,d()):c()},completeImg:function(a){var b;return a.complete?(b=typeof a.naturalWidth,"undefined"===b||0!==a.naturalWidth):!1},onVisibleItems:function(){var b,c=this;for(c.options.addClassActive===!0&&c.$easingsliderItems.removeClass("active"),c.visibleItems=[],b=c.currentItem;b<c.currentItem+c.options.items;b+=1)c.visibleItems.push(b),c.options.addClassActive===!0&&a(c.$easingsliderItems[b]).addClass("active");c.easingslider.visibleItems=c.visibleItems},transitionTypes:function(a){var b=this;b.outClass="easingslider-"+a+"-out",b.inClass="easingslider-"+a+"-in"},singleItemTransition:function(){function a(a){return{position:"relative",left:a+"px"}}var b=this,c=b.outClass,d=b.inClass,e=b.$easingsliderItems.eq(b.currentItem),f=b.$easingsliderItems.eq(b.prevItem),g=Math.abs(b.positionsInArray[b.currentItem])+b.positionsInArray[b.prevItem],h=Math.abs(b.positionsInArray[b.currentItem])+b.itemWidth/2,i="webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend";b.isTransition=!0,b.$easingsliderWrapper.addClass("easingslider-origin").css({"-webkit-transform-origin":h+"px","-moz-perspective-origin":h+"px","perspective-origin":h+"px"}),f.css(a(g,10)).addClass(c).on(i,function(){b.endPrev=!0,f.off(i),b.clearTransStyle(f,c)}),e.addClass(d).on(i,function(){b.endCurrent=!0,e.off(i),b.clearTransStyle(e,d)})},clearTransStyle:function(a,b){var c=this;a.css({position:"",left:""}).removeClass(b),c.endPrev&&c.endCurrent&&(c.$easingsliderWrapper.removeClass("easingslider-origin"),c.endPrev=!1,c.endCurrent=!1,c.isTransition=!1)},easingsliderStatus:function(){var a=this;a.easingslider={userOptions:a.userOptions,baseElement:a.$elem,userItems:a.$userItems,easingsliderItems:a.$easingsliderItems,currentItem:a.currentItem,prevItem:a.prevItem,visibleItems:a.visibleItems,isTouch:a.browser.isTouch,browser:a.browser,dragDirection:a.dragDirection}},clearEvents:function(){var d=this;d.$elem.off(".easingslider easingslider mousedown.disableTextSelect"),a(c).off(".easingslider easingslider"),a(b).off("resize",d.resizer)},unWrap:function(){var a=this;0!==a.$elem.children().length&&(a.$easingsliderWrapper.unwrap(),a.$userItems.unwrap().unwrap(),a.easingsliderControls&&a.easingsliderControls.remove()),a.clearEvents(),a.$elem.attr("style",a.$elem.data("easingslider-originalStyles")||"").attr("class",a.$elem.data("easingslider-originalClasses"))},destroy:function(){var a=this;a.stop(),b.clearInterval(a.checkVisible),a.unWrap(),a.$elem.removeData()},reinit:function(b){var c=this,d=a.extend({},c.userOptions,b);c.unWrap(),c.init(d,c.$elem)},addItem:function(a,b){var c,d=this;return a?0===d.$elem.children().length?(d.$elem.append(a),d.setVars(),!1):(d.unWrap(),c=void 0===b||-1===b?-1:b,c>=d.$userItems.length||-1===c?d.$userItems.eq(-1).after(a):d.$userItems.eq(c).before(a),void d.setVars()):!1},removeItem:function(a){var b,c=this;return 0===c.$elem.children().length?!1:(b=void 0===a||-1===a?-1:a,c.unWrap(),c.$userItems.eq(b).remove(),void c.setVars())}};a.fn.easingSlider=function(b){return this.each(function(){if(a(this).data("easingslider-init")===!0)return!1;a(this).data("easingslider-init",!0);var c=Object.create(d);c.init(b,this),a.data(this,"easingSlider",c)})},a.fn.easingSlider.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1e3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1,responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:b,baseClass:"easingslider",theme:"easingslider-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}}(jQuery,window,document),function(a){a.EasingSlider=function(b){var c=this;c.el=b,c.$el=a(c.el),c.options=window["EasingSlider"+c.$el.attr("data-id")],c._clickEvent="ontouchstart"in document.documentElement?"touchstart":"click",c.$el.data("easingslider",c),c.initSlider=function(){c.$el.easingSlider(a.extend(c.options,{afterInit:function(){c._maybeResize()},afterUpdate:function(){c._maybeResize()},afterAction:function(){c.$el.trigger("changeSlide",this.currentItem)}}))},c._maybeResize=function(){return c.$el.hasClass("easingslider-aspect-ratio")&&c.doResize(),c},c.doResize=function(){var a=c.$el,b=a.find(".easingslider-wrapper"),d=a.find(".easingslider-item"),e=a.find(".easingslider-image"),f=a.outerWidth(),g=a.find(".easingslider-wrapper-outer");if(f<=c.options.width){var h=Math.floor(f/c.options.width*c.options.height);a.css({height:h+"px"}),d.css({height:h+"px"}),b.css({height:h+"px"}),e.css({"max-height":h+"px"})}else a.css({height:c.options.height+"px"}),b.css({height:c.options.height+"px"}),$item.css({height:c.options.height+"px"}),e.css({"max-height":c.options.height+"px"});return g.css({width:Math.floor(g.outerWidth())+"px"}),c},c.initSlider()},a.fn.EasingSlider=function(){return this.each(function(){new a.EasingSlider(this)})},a(document).ready(function(){a(".easingslider").EasingSlider()})}(jQuery);
|
1 |
+
"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a,b,c){var d={init:function(b,c){var d=this;d.$elem=a(c),d.options=a.extend({},a.fn.easingSlider.options,d.$elem.data(),b),d.userOptions=b,d.loadContent()},loadContent:function(){function b(a){var b,c="";if("function"==typeof d.options.jsonSuccess)d.options.jsonSuccess.apply(this,[a]);else{for(b in a.easingslider)a.easingslider.hasOwnProperty(b)&&(c+=a.easingslider[b].item);d.$elem.html(c)}d.logIn()}var c,d=this;"function"==typeof d.options.beforeInit&&d.options.beforeInit.apply(this,[d.$elem]),"string"==typeof d.options.jsonPath?(c=d.options.jsonPath,a.getJSON(c,b)):d.logIn()},logIn:function(){var a=this;a.$elem.data("easingslider-originalStyles",a.$elem.attr("style")).data("easingslider-originalClasses",a.$elem.attr("class")),a.$elem.css({opacity:0}),a.orignalItems=a.options.items,a.checkBrowser(),a.wrapperWidth=0,a.checkVisible=null,a.setVars()},setVars:function(){var a=this;return 0===a.$elem.children().length?!1:(a.baseClass(),a.eventTypes(),a.$userItems=a.$elem.children(),a.itemsAmount=a.$userItems.length,a.wrapItems(),a.$easingsliderItems=a.$elem.find(".easingslider-item"),a.$easingsliderWrapper=a.$elem.find(".easingslider-wrapper"),a.playDirection="next",a.prevItem=0,a.prevArr=[0],a.currentItem=0,a.customEvents(),void a.onStartup())},onStartup:function(){var a=this;a.updateItems(),a.calculateAll(),a.buildControls(),a.updateControls(),a.response(),a.moveEvents(),a.stopOnHover(),a.easingsliderStatus(),a.options.transitionStyle!==!1&&a.transitionTypes(a.options.transitionStyle),a.options.autoPlay===!0&&(a.options.autoPlay=5e3),a.play(),a.$elem.find(".easingslider-wrapper").css("display","block"),a.$elem.is(":visible")?a.$elem.css("opacity",1):a.watchVisibility(),a.onstartup=!1,a.eachMoveUpdate(),"function"==typeof a.options.afterInit&&a.options.afterInit.apply(this,[a.$elem])},eachMoveUpdate:function(){var a=this;a.options.lazyLoad===!0&&a.lazyLoad(),a.options.autoHeight===!0&&a.autoHeight(),a.onVisibleItems(),"function"==typeof a.options.afterAction&&a.options.afterAction.apply(this,[a.$elem])},updateVars:function(){var a=this;"function"==typeof a.options.beforeUpdate&&a.options.beforeUpdate.apply(this,[a.$elem]),a.watchVisibility(),a.updateItems(),a.calculateAll(),a.updatePosition(),a.updateControls(),a.eachMoveUpdate(),"function"==typeof a.options.afterUpdate&&a.options.afterUpdate.apply(this,[a.$elem])},reload:function(){var a=this;b.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;return a.$elem.is(":visible")!==!1?!1:(a.$elem.css({opacity:0}),b.clearInterval(a.autoPlayInterval),b.clearInterval(a.checkVisible),void(a.checkVisible=b.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),b.clearInterval(a.checkVisible))},500)))},wrapItems:function(){var a=this;a.$userItems.wrapAll('<div class="easingslider-wrapper">').wrap('<div class="easingslider-item"></div>'),a.$elem.find(".easingslider-wrapper").wrap('<div class="easingslider-wrapper-outer">'),a.wrapperOuter=a.$elem.find(".easingslider-wrapper-outer"),a.$elem.css("display","block")},baseClass:function(){var a=this,b=a.$elem.hasClass(a.options.baseClass),c=a.$elem.hasClass(a.options.theme);b||a.$elem.addClass(a.options.baseClass),c||a.$elem.addClass(a.options.theme)},updateItems:function(){var b,c,d=this;if(d.options.responsive===!1)return!1;if(d.options.singleItem===!0)return d.options.items=d.orignalItems=1,d.options.itemsCustom=!1,d.options.itemsDesktop=!1,d.options.itemsDesktopSmall=!1,d.options.itemsTablet=!1,d.options.itemsTabletSmall=!1,d.options.itemsMobile=!1,!1;if(b=a(d.options.responsiveBaseWidth).width(),b>(d.options.itemsDesktop[0]||d.orignalItems)&&(d.options.items=d.orignalItems),d.options.itemsCustom!==!1)for(d.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),c=0;c<d.options.itemsCustom.length;c+=1)d.options.itemsCustom[c][0]<=b&&(d.options.items=d.options.itemsCustom[c][1]);else b<=d.options.itemsDesktop[0]&&d.options.itemsDesktop!==!1&&(d.options.items=d.options.itemsDesktop[1]),b<=d.options.itemsDesktopSmall[0]&&d.options.itemsDesktopSmall!==!1&&(d.options.items=d.options.itemsDesktopSmall[1]),b<=d.options.itemsTablet[0]&&d.options.itemsTablet!==!1&&(d.options.items=d.options.itemsTablet[1]),b<=d.options.itemsTabletSmall[0]&&d.options.itemsTabletSmall!==!1&&(d.options.items=d.options.itemsTabletSmall[1]),b<=d.options.itemsMobile[0]&&d.options.itemsMobile!==!1&&(d.options.items=d.options.itemsMobile[1]);d.options.items>d.itemsAmount&&d.options.itemsScaleUp===!0&&(d.options.items=d.itemsAmount)},response:function(){var c,d,e=this;return e.options.responsive!==!0?!1:(d=a(b).width(),e.resizer=function(){a(b).width()!==d&&(e.options.autoPlay!==!1&&b.clearInterval(e.autoPlayInterval),b.clearTimeout(c),c=b.setTimeout(function(){d=a(b).width(),e.updateVars()},e.options.responsiveRefreshRate))},void a(b).resize(e.resizer))},updatePosition:function(){var a=this;a.jumpTo(a.currentItem),a.options.autoPlay!==!1&&a.checkAp()},appendItemsSizes:function(){var b=this,c=0,d=b.itemsAmount-b.options.items;b.$easingsliderItems.each(function(e){var f=a(this);f.css({width:b.itemWidth}).data("easingslider-item",Number(e)),e%b.options.items!==0&&e!==d||e>d||(c+=1),f.data("easingslider-roundPages",c)})},appendWrapperSizes:function(){var a=this,b=a.$easingsliderItems.length*a.itemWidth;a.$easingsliderWrapper.css({width:2*b,left:0}),a.appendItemsSizes()},calculateAll:function(){var a=this;a.calculateWidth(),a.appendWrapperSizes(),a.loops(),a.max()},calculateWidth:function(){var a=this;a.itemWidth=Math.round(a.$elem.width()/a.options.items)},max:function(){var a=this,b=-1*(a.itemsAmount*a.itemWidth-a.options.items*a.itemWidth);return a.options.items>a.itemsAmount?(a.maximumItem=0,b=0,a.maximumPixels=0):(a.maximumItem=a.itemsAmount-a.options.items,a.maximumPixels=b),b},min:function(){return 0},loops:function(){var b,c,d,e=this,f=0,g=0;for(e.positionsInArray=[0],e.pagesInArray=[],b=0;b<e.itemsAmount;b+=1)g+=e.itemWidth,e.positionsInArray.push(-g),e.options.scrollPerPage===!0&&(c=a(e.$easingsliderItems[b]),d=c.data("easingslider-roundPages"),d!==f&&(e.pagesInArray[f]=e.positionsInArray[b],f=d))},buildControls:function(){var b=this;b.options.navigation!==!0&&b.options.pagination!==!0||(b.easingsliderControls=a('<div class="easingslider-controls"/>').toggleClass("clickable",!b.browser.isTouch).appendTo(b.$elem)),b.options.pagination===!0&&b.buildPagination(),b.options.navigation===!0&&b.buildButtons()},buildButtons:function(){var b=this,c=a('<div class="easingslider-buttons"/>');b.easingsliderControls.append(c),b.buttonPrev=a("<div/>",{"class":"easingslider-prev",html:b.options.navigationText[0]||""}),b.buttonNext=a("<div/>",{"class":"easingslider-next",html:b.options.navigationText[1]||""}),c.append(b.buttonPrev).append(b.buttonNext),c.on("touchstart.easingsliderControls mousedown.easingsliderControls",'div[class^="easingslider"]',function(a){a.preventDefault()}),c.on("touchend.easingsliderControls mouseup.easingsliderControls",'div[class^="easingslider"]',function(c){c.preventDefault(),a(this).hasClass("easingslider-next")?b.next():b.prev()})},buildPagination:function(){var b=this;b.paginationWrapper=a('<div class="easingslider-pagination"/>'),b.easingsliderControls.append(b.paginationWrapper),b.paginationWrapper.on("touchend.easingsliderControls mouseup.easingsliderControls",".easingslider-page",function(c){c.preventDefault(),Number(a(this).data("easingslider-page"))!==b.currentItem&&b.goTo(Number(a(this).data("easingslider-page")),!0)})},updatePagination:function(){var b,c,d,e,f,g,h=this;if(h.options.pagination===!1)return!1;for(h.paginationWrapper.html(""),b=0,c=h.itemsAmount-h.itemsAmount%h.options.items,e=0;e<h.itemsAmount;e+=1)e%h.options.items===0&&(b+=1,c===e&&(d=h.itemsAmount-h.options.items),f=a("<div/>",{"class":"easingslider-page"}),g=a("<span></span>",{text:h.options.paginationNumbers===!0?b:"","class":h.options.paginationNumbers===!0?"easingslider-numbers":""}),f.append(g),f.data("easingslider-page",c===e?d:e),f.data("easingslider-roundPages",b),h.paginationWrapper.append(f));h.checkPagination()},checkPagination:function(){var b=this;return b.options.pagination===!1?!1:void b.paginationWrapper.find(".easingslider-page").each(function(){a(this).data("easingslider-roundPages")===a(b.$easingsliderItems[b.currentItem]).data("easingslider-roundPages")&&(b.paginationWrapper.find(".easingslider-page").removeClass("active"),a(this).addClass("active"))})},checkNavigation:function(){var a=this;return a.options.navigation===!1?!1:void(a.options.rewindNav===!1&&(0===a.currentItem&&0===a.maximumItem?(a.buttonPrev.addClass("disabled"),a.buttonNext.addClass("disabled")):0===a.currentItem&&0!==a.maximumItem?(a.buttonPrev.addClass("disabled"),a.buttonNext.removeClass("disabled")):a.currentItem===a.maximumItem?(a.buttonPrev.removeClass("disabled"),a.buttonNext.addClass("disabled")):0!==a.currentItem&&a.currentItem!==a.maximumItem&&(a.buttonPrev.removeClass("disabled"),a.buttonNext.removeClass("disabled"))))},updateControls:function(){var a=this;a.updatePagination(),a.checkNavigation(),a.easingsliderControls&&(a.options.items>=a.itemsAmount?a.easingsliderControls.hide():a.easingsliderControls.show())},destroyControls:function(){var a=this;a.easingsliderControls&&a.easingsliderControls.remove()},next:function(a){var b=this;if(b.isTransition)return!1;if(b.currentItem+=b.options.scrollPerPage===!0?b.options.items:1,b.currentItem>b.maximumItem+(b.options.scrollPerPage===!0?b.options.items-1:0)){if(b.options.rewindNav!==!0)return b.currentItem=b.maximumItem,!1;b.currentItem=0,a="rewind"}b.goTo(b.currentItem,a)},prev:function(a){var b=this;if(b.isTransition)return!1;if(b.options.scrollPerPage===!0&&b.currentItem>0&&b.currentItem<b.options.items?b.currentItem=0:b.currentItem-=b.options.scrollPerPage===!0?b.options.items:1,b.currentItem<0){if(b.options.rewindNav!==!0)return b.currentItem=0,!1;b.currentItem=b.maximumItem,a="rewind"}b.goTo(b.currentItem,a)},goTo:function(a,c,d){var e,f=this;return f.isTransition?!1:("function"==typeof f.options.beforeMove&&f.options.beforeMove.apply(this,[f.$elem]),a>=f.maximumItem?a=f.maximumItem:0>=a&&(a=0),f.currentItem=f.easingslider.currentItem=a,f.options.transitionStyle!==!1&&"drag"!==d&&1===f.options.items&&f.browser.support3d===!0?(f.swapSpeed(0),f.browser.support3d===!0?f.transition3d(f.positionsInArray[a]):f.css2slide(f.positionsInArray[a],1),f.afterGo(),f.singleItemTransition(),!1):(e=f.positionsInArray[a],f.browser.support3d===!0?(f.isCss3Finish=!1,c===!0?(f.swapSpeed("paginationSpeed"),b.setTimeout(function(){f.isCss3Finish=!0},f.options.paginationSpeed)):"rewind"===c?(f.swapSpeed(f.options.rewindSpeed),b.setTimeout(function(){f.isCss3Finish=!0},f.options.rewindSpeed)):(f.swapSpeed("slideSpeed"),b.setTimeout(function(){f.isCss3Finish=!0},f.options.slideSpeed)),f.transition3d(e)):c===!0?f.css2slide(e,f.options.paginationSpeed):"rewind"===c?f.css2slide(e,f.options.rewindSpeed):f.css2slide(e,f.options.slideSpeed),void f.afterGo()))},jumpTo:function(a){var b=this;"function"==typeof b.options.beforeMove&&b.options.beforeMove.apply(this,[b.$elem]),a>=b.maximumItem||-1===a?a=b.maximumItem:0>=a&&(a=0),b.swapSpeed(0),b.browser.support3d===!0?b.transition3d(b.positionsInArray[a]):b.css2slide(b.positionsInArray[a],1),b.currentItem=b.easingslider.currentItem=a,b.afterGo()},afterGo:function(){var a=this;a.prevArr.push(a.currentItem),a.prevItem=a.easingslider.prevItem=a.prevArr[a.prevArr.length-2],a.prevArr.shift(0),a.prevItem!==a.currentItem&&(a.checkPagination(),a.checkNavigation(),a.eachMoveUpdate(),a.options.autoPlay!==!1&&a.checkAp()),"function"==typeof a.options.afterMove&&a.prevItem!==a.currentItem&&a.options.afterMove.apply(this,[a.$elem])},stop:function(){var a=this;a.apStatus="stop",b.clearInterval(a.autoPlayInterval)},checkAp:function(){var a=this;"stop"!==a.apStatus&&a.play()},play:function(){var a=this;return a.apStatus="play",a.options.autoPlay===!1?!1:(b.clearInterval(a.autoPlayInterval),void(a.autoPlayInterval=b.setInterval(function(){a.next(!0)},a.options.autoPlay)))},swapSpeed:function(a){var b=this;"slideSpeed"===a?b.$easingsliderWrapper.css(b.addCssSpeed(b.options.slideSpeed)):"paginationSpeed"===a?b.$easingsliderWrapper.css(b.addCssSpeed(b.options.paginationSpeed)):"string"!=typeof a&&b.$easingsliderWrapper.css(b.addCssSpeed(a))},addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){var b=this;b.$easingsliderWrapper.css(b.doTranslate(a))},css2move:function(a){var b=this;b.$easingsliderWrapper.css({left:a})},css2slide:function(a,b){var c=this;c.isCssFinish=!1,c.$easingsliderWrapper.stop(!0,!0).animate({left:a},{duration:b||c.options.slideSpeed,complete:function(){c.isCssFinish=!0}})},checkBrowser:function(){var a,d,e,f,g=this,h="translate3d(0px, 0px, 0px)",i=c.createElement("div");i.style.cssText=" -moz-transform:"+h+"; -ms-transform:"+h+"; -o-transform:"+h+"; -webkit-transform:"+h+"; transform:"+h,a=/translate3d\(0px, 0px, 0px\)/g,d=i.style.cssText.match(a),e=null!==d&&1===d.length,f="ontouchstart"in b||b.navigator.msMaxTouchPoints,g.browser={support3d:e,isTouch:f}},moveEvents:function(){var a=this;a.options.mouseDrag===!1&&a.options.touchDrag===!1||(a.gestures(),a.disabledEvents())},eventTypes:function(){var a=this,b=["s","e","x"];a.ev_types={},a.options.mouseDrag===!0&&a.options.touchDrag===!0?b=["touchstart.easingslider mousedown.easingslider","touchmove.easingslider mousemove.easingslider","touchend.easingslider touchcancel.easingslider mouseup.easingslider"]:a.options.mouseDrag===!1&&a.options.touchDrag===!0?b=["touchstart.easingslider","touchmove.easingslider","touchend.easingslider touchcancel.easingslider"]:a.options.mouseDrag===!0&&a.options.touchDrag===!1&&(b=["mousedown.easingslider","mousemove.easingslider","mouseup.easingslider"]),a.ev_types.start=b[0],a.ev_types.move=b[1],a.ev_types.end=b[2]},disabledEvents:function(){var b=this;b.$elem.on("dragstart.easingslider",function(a){a.preventDefault()}),b.$elem.on("mousedown.disableTextSelect",function(b){return a(b.target).is("input, textarea, select, option")})},gestures:function(){function d(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function e(b){"on"===b?(a(c).on(i.ev_types.move,g),a(c).on(i.ev_types.end,h)):"off"===b&&(a(c).off(i.ev_types.move),a(c).off(i.ev_types.end))}function f(c){var f,g=c.originalEvent||c||b.event;if(3===g.which)return!1;if(!(i.itemsAmount<=i.options.items)){if(i.isCssFinish===!1&&!i.options.dragBeforeAnimFinish)return!1;if(i.isCss3Finish===!1&&!i.options.dragBeforeAnimFinish)return!1;i.options.autoPlay!==!1&&b.clearInterval(i.autoPlayInterval),i.browser.isTouch===!0||i.$easingsliderWrapper.hasClass("grabbing")||i.$easingsliderWrapper.addClass("grabbing"),i.newPosX=0,i.newRelativeX=0,a(this).css(i.removeTransition()),f=a(this).position(),j.relativePos=f.left,j.offsetX=d(g).x-f.left,j.offsetY=d(g).y-f.top,e("on"),j.sliding=!1,j.targetElement=g.target||g.srcElement}}function g(e){var f,g,h=e.originalEvent||e||b.event;i.newPosX=d(h).x-j.offsetX,i.newPosY=d(h).y-j.offsetY,i.newRelativeX=i.newPosX-j.relativePos,"function"==typeof i.options.startDragging&&j.dragging!==!0&&0!==i.newRelativeX&&(j.dragging=!0,i.options.startDragging.apply(i,[i.$elem])),(i.newRelativeX>8||i.newRelativeX<-8)&&i.browser.isTouch===!0&&(void 0!==h.preventDefault?h.preventDefault():h.returnValue=!1,j.sliding=!0),(i.newPosY>10||i.newPosY<-10)&&j.sliding===!1&&a(c).off("touchmove.easingslider"),f=function(){return i.newRelativeX/5},g=function(){return i.maximumPixels+i.newRelativeX/5},i.newPosX=Math.max(Math.min(i.newPosX,f()),g()),i.browser.support3d===!0?i.transition3d(i.newPosX):i.css2move(i.newPosX)}function h(c){var d,f,g,h=c.originalEvent||c||b.event;h.target=h.target||h.srcElement,j.dragging=!1,i.browser.isTouch!==!0&&i.$easingsliderWrapper.removeClass("grabbing"),i.newRelativeX<0?i.dragDirection=i.easingslider.dragDirection="left":i.dragDirection=i.easingslider.dragDirection="right",0!==i.newRelativeX&&(d=i.getNewPosition(),i.goTo(d,!1,"drag"),j.targetElement===h.target&&i.browser.isTouch!==!0&&(a(h.target).on("click.disable",function(b){b.stopImmediatePropagation(),b.stopPropagation(),b.preventDefault(),a(b.target).off("click.disable")}),f=a._data(h.target,"events").click,g=f.pop(),f.splice(0,0,g))),e("off")}var i=this,j={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};i.isCssFinish=!0,i.$elem.on(i.ev_types.start,".easingslider-wrapper",f)},getNewPosition:function(){var a=this,b=a.closestItem();return b>a.maximumItem?(a.currentItem=a.maximumItem,b=a.maximumItem):a.newPosX>=0&&(b=0,a.currentItem=0),b},closestItem:function(){var b=this,c=b.options.scrollPerPage===!0?b.pagesInArray:b.positionsInArray,d=b.newPosX,e=null;return a.each(c,function(f,g){d-b.itemWidth/20>c[f+1]&&d-b.itemWidth/20<g&&"left"===b.moveDirection()?(e=g,b.options.scrollPerPage===!0?b.currentItem=a.inArray(e,b.positionsInArray):b.currentItem=f):d+b.itemWidth/20<g&&d+b.itemWidth/20>(c[f+1]||c[f]-b.itemWidth)&&"right"===b.moveDirection()&&(b.options.scrollPerPage===!0?(e=c[f+1]||c[c.length-1],b.currentItem=a.inArray(e,b.positionsInArray)):(e=c[f+1],b.currentItem=f+1))}),b.currentItem},moveDirection:function(){var a,b=this;return b.newRelativeX<0?(a="right",b.playDirection="next"):(a="left",b.playDirection="prev"),a},customEvents:function(){var a=this;a.$elem.on("easingslider.next",function(){a.next()}),a.$elem.on("easingslider.prev",function(){a.prev()}),a.$elem.on("easingslider.play",function(b,c){a.options.autoPlay=c,a.play(),a.hoverStatus="play"}),a.$elem.on("easingslider.stop",function(){a.stop(),a.hoverStatus="stop"}),a.$elem.on("easingslider.goTo",function(b,c){a.goTo(c)}),a.$elem.on("easingslider.jumpTo",function(b,c){a.jumpTo(c)})},stopOnHover:function(){var a=this;a.options.stopOnHover===!0&&a.browser.isTouch!==!0&&a.options.autoPlay!==!1&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var b,c,d,e,f,g=this;if(g.options.lazyLoad===!1)return!1;for(b=0;b<g.itemsAmount;b+=1)c=a(g.$easingsliderItems[b]),"loaded"!==c.data("easingslider-loaded")&&(d=c.data("easingslider-item"),e=c.find(".easingslider-lazy"),"string"==typeof e.data("src")?(void 0===c.data("easingslider-loaded")&&(e.hide(),c.addClass("loading").data("easingslider-loaded","checked")),f=g.options.lazyFollow===!0?d>=g.currentItem:!0,f&&d<g.currentItem+g.options.items&&e.length&&g.lazyPreload(c,e)):c.data("easingslider-loaded","loaded"))},lazyPreload:function(a,c){function d(){a.data("easingslider-loaded","loaded").removeClass("loading"),c.removeAttr("data-src"),"fade"===g.options.lazyEffect?c.fadeIn(400):c.show(),"function"==typeof g.options.afterLazyLoad&&g.options.afterLazyLoad.apply(this,[g.$elem])}function e(){h+=1,g.completeImg(c.get(0))||f===!0?d():100>=h?b.setTimeout(e,100):d()}var f,g=this,h=0;"DIV"===c.prop("tagName")?(c.css("background-image","url("+c.data("src")+")"),f=!0):c[0].src=c.data("src"),e()},autoHeight:function(){function c(){var c=a(f.$easingsliderItems[f.currentItem]).height();f.wrapperOuter.css("height",c+"px"),f.wrapperOuter.hasClass("autoHeight")||b.setTimeout(function(){f.wrapperOuter.addClass("autoHeight")},0)}function d(){e+=1,f.completeImg(g.get(0))?c():100>=e?b.setTimeout(d,100):f.wrapperOuter.css("height","")}var e,f=this,g=a(f.$easingsliderItems[f.currentItem]).find("img");void 0!==g.get(0)?(e=0,d()):c()},completeImg:function(a){var b;return a.complete?(b=typeof a.naturalWidth,"undefined"===b||0!==a.naturalWidth):!1},onVisibleItems:function(){var b,c=this;for(c.options.addClassActive===!0&&c.$easingsliderItems.removeClass("active"),c.visibleItems=[],b=c.currentItem;b<c.currentItem+c.options.items;b+=1)c.visibleItems.push(b),c.options.addClassActive===!0&&a(c.$easingsliderItems[b]).addClass("active");c.easingslider.visibleItems=c.visibleItems},transitionTypes:function(a){var b=this;b.outClass="easingslider-"+a+"-out",b.inClass="easingslider-"+a+"-in"},singleItemTransition:function(){function a(a){return{position:"relative",left:a+"px"}}var b=this,c=b.outClass,d=b.inClass,e=b.$easingsliderItems.eq(b.currentItem),f=b.$easingsliderItems.eq(b.prevItem),g=Math.abs(b.positionsInArray[b.currentItem])+b.positionsInArray[b.prevItem],h=Math.abs(b.positionsInArray[b.currentItem])+b.itemWidth/2,i="webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend";b.isTransition=!0,b.$easingsliderWrapper.addClass("easingslider-origin").css({"-webkit-transform-origin":h+"px","-moz-perspective-origin":h+"px","perspective-origin":h+"px"}),f.css(a(g,10)).addClass(c).on(i,function(){b.endPrev=!0,f.off(i),b.clearTransStyle(f,c)}),e.addClass(d).on(i,function(){b.endCurrent=!0,e.off(i),b.clearTransStyle(e,d)})},clearTransStyle:function(a,b){var c=this;a.css({position:"",left:""}).removeClass(b),c.endPrev&&c.endCurrent&&(c.$easingsliderWrapper.removeClass("easingslider-origin"),c.endPrev=!1,c.endCurrent=!1,c.isTransition=!1)},easingsliderStatus:function(){var a=this;a.easingslider={userOptions:a.userOptions,baseElement:a.$elem,userItems:a.$userItems,easingsliderItems:a.$easingsliderItems,currentItem:a.currentItem,prevItem:a.prevItem,visibleItems:a.visibleItems,isTouch:a.browser.isTouch,browser:a.browser,dragDirection:a.dragDirection}},clearEvents:function(){var d=this;d.$elem.off(".easingslider easingslider mousedown.disableTextSelect"),a(c).off(".easingslider easingslider"),a(b).off("resize",d.resizer)},unWrap:function(){var a=this;0!==a.$elem.children().length&&(a.$easingsliderWrapper.unwrap(),a.$userItems.unwrap().unwrap(),a.easingsliderControls&&a.easingsliderControls.remove()),a.clearEvents(),a.$elem.attr("style",a.$elem.data("easingslider-originalStyles")||"").attr("class",a.$elem.data("easingslider-originalClasses"))},destroy:function(){var a=this;a.stop(),b.clearInterval(a.checkVisible),a.unWrap(),a.$elem.removeData()},reinit:function(b){var c=this,d=a.extend({},c.userOptions,b);c.unWrap(),c.init(d,c.$elem)},addItem:function(a,b){var c,d=this;return a?0===d.$elem.children().length?(d.$elem.append(a),d.setVars(),!1):(d.unWrap(),c=void 0===b||-1===b?-1:b,c>=d.$userItems.length||-1===c?d.$userItems.eq(-1).after(a):d.$userItems.eq(c).before(a),void d.setVars()):!1},removeItem:function(a){var b,c=this;return 0===c.$elem.children().length?!1:(b=void 0===a||-1===a?-1:a,c.unWrap(),c.$userItems.eq(b).remove(),void c.setVars())}};a.fn.easingSlider=function(b){return this.each(function(){if(a(this).data("easingslider-init")===!0)return!1;a(this).data("easingslider-init",!0);var c=Object.create(d);c.init(b,this),a.data(this,"easingSlider",c)})},a.fn.easingSlider.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1e3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1,responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:b,baseClass:"easingslider",theme:"easingslider-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}}(jQuery,window,document),function(a){a.EasingSlider=function(b){var c=this;c.el=b,c.$el=a(c.el),c.options=window["EasingSlider"+c.$el.attr("data-id")],c._clickEvent="ontouchstart"in document.documentElement?"touchstart":"click",c.$el.data("easingslider",c),c.initSlider=function(){c.$el.easingSlider(a.extend(c.options,{afterInit:function(){c._maybeResize()},afterUpdate:function(){c._maybeResize()},afterAction:function(){c.$el.trigger("changeSlide",this.currentItem)}}))},c._maybeResize=function(){return c.$el.hasClass("easingslider-aspect-ratio")&&c.doResize(),c},c.doResize=function(){var a=c.$el,b=a.find(".easingslider-wrapper"),d=a.find(".easingslider-item"),e=a.find(".easingslider-image"),f=a.outerWidth(),g=a.find(".easingslider-wrapper-outer");if(f<=c.options.width){var h=Math.floor(f/c.options.width*c.options.height);a.css({height:h+"px"}),d.css({height:h+"px"}),b.css({height:h+"px"}),e.css({"max-height":h+"px"})}else a.css({height:c.options.height+"px"}),b.css({height:c.options.height+"px"}),$item.css({height:c.options.height+"px"}),e.css({"max-height":c.options.height+"px"});return g.css({width:Math.floor(g.width())+"px"}),c},c.initSlider()},a.fn.EasingSlider=function(){return this.each(function(){new a.EasingSlider(this)})},a(document).ready(function(){a(".easingslider").EasingSlider()})}(jQuery);
|
bower.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
"name": "Easing Slider",
|
3 |
-
"version": "3.0.
|
4 |
"homepage": "https://github.com/easingslider/easing-slider",
|
5 |
"authors": [
|
6 |
"MatthewRuddy <info@matthewruddy.com>"
|
1 |
{
|
2 |
"name": "Easing Slider",
|
3 |
+
"version": "3.0.5",
|
4 |
"homepage": "https://github.com/easingslider/easing-slider",
|
5 |
"authors": [
|
6 |
"MatthewRuddy <info@matthewruddy.com>"
|
easing-slider.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Easing Slider
|
4 |
* Plugin URI: http://easingslider.com/
|
5 |
* Description: A simple WordPress plugin for creating beautiful sliders.
|
6 |
-
* Version: 3.0.
|
7 |
* Author: Matthew Ruddy
|
8 |
* Author URI: http://matthewruddy.com
|
9 |
* License: GPL2
|
@@ -25,7 +25,7 @@ if ( ! defined('ABSPATH')) {
|
|
25 |
/**
|
26 |
* Define constants
|
27 |
*/
|
28 |
-
define('EASINGSLIDER_VERSION', '3.0.
|
29 |
define('EASINGSLIDER_NAME', 'Easing Slider');
|
30 |
define('EASINGSLIDER_API_URL', 'http://easingslider.com/');
|
31 |
define('EASINGSLIDER_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
3 |
* Plugin Name: Easing Slider
|
4 |
* Plugin URI: http://easingslider.com/
|
5 |
* Description: A simple WordPress plugin for creating beautiful sliders.
|
6 |
+
* Version: 3.0.5
|
7 |
* Author: Matthew Ruddy
|
8 |
* Author URI: http://matthewruddy.com
|
9 |
* License: GPL2
|
25 |
/**
|
26 |
* Define constants
|
27 |
*/
|
28 |
+
define('EASINGSLIDER_VERSION', '3.0.5');
|
29 |
define('EASINGSLIDER_NAME', 'Easing Slider');
|
30 |
define('EASINGSLIDER_API_URL', 'http://easingslider.com/');
|
31 |
define('EASINGSLIDER_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
languages/easingslider.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPL2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Easing Slider 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easing-slider\n"
|
7 |
-
"POT-Creation-Date: 2016-06-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -117,59 +117,65 @@ msgid ""
|
|
117 |
"reversed."
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
121 |
-
msgid "
|
|
|
|
|
122 |
msgstr ""
|
123 |
|
124 |
#: src/Plugin/Admin/Assets/Assets.php:79
|
125 |
-
msgid "
|
126 |
msgstr ""
|
127 |
|
128 |
#: src/Plugin/Admin/Assets/Assets.php:80
|
129 |
-
msgid "
|
130 |
msgstr ""
|
131 |
|
132 |
#: src/Plugin/Admin/Assets/Assets.php:81
|
133 |
-
msgid "
|
134 |
msgstr ""
|
135 |
|
136 |
#: src/Plugin/Admin/Assets/Assets.php:82
|
137 |
-
msgid "Replace
|
138 |
msgstr ""
|
139 |
|
140 |
#: src/Plugin/Admin/Assets/Assets.php:83
|
141 |
-
msgid "Image
|
142 |
msgstr ""
|
143 |
|
144 |
#: src/Plugin/Admin/Assets/Assets.php:84
|
|
|
|
|
|
|
|
|
145 |
msgid "Insert into Slider"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
149 |
msgid "Activate Addon"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
153 |
msgid "Deactivate Addon"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
157 |
msgid "Activating..."
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
161 |
msgid "Deactivating..."
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
165 |
msgid "Installing..."
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
169 |
msgid "Status: Active"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: src/Plugin/Admin/Assets/Assets.php:
|
173 |
msgid "Status: Inactive"
|
174 |
msgstr ""
|
175 |
|
@@ -397,7 +403,11 @@ msgstr ""
|
|
397 |
msgid "There was an error installing the addon. Please try again."
|
398 |
msgstr ""
|
399 |
|
400 |
-
#: src/Plugin/
|
|
|
|
|
|
|
|
|
401 |
msgid "<p><strong>The slider specified (ID #%d) could not be found.</strong></p>"
|
402 |
msgstr ""
|
403 |
|
2 |
# This file is distributed under the GPL2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Easing Slider 3.0.5\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easing-slider\n"
|
7 |
+
"POT-Creation-Date: 2016-06-08 01:05:08+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
117 |
"reversed."
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: src/Plugin/Admin/Assets/Assets.php:77
|
121 |
+
msgid ""
|
122 |
+
"Unable to connect via FTP. Please make sure your credentials are correct "
|
123 |
+
"and try again."
|
124 |
msgstr ""
|
125 |
|
126 |
#: src/Plugin/Admin/Assets/Assets.php:79
|
127 |
+
msgid "Edit Slide"
|
128 |
msgstr ""
|
129 |
|
130 |
#: src/Plugin/Admin/Assets/Assets.php:80
|
131 |
+
msgid "Back"
|
132 |
msgstr ""
|
133 |
|
134 |
#: src/Plugin/Admin/Assets/Assets.php:81
|
135 |
+
msgid "Update"
|
136 |
msgstr ""
|
137 |
|
138 |
#: src/Plugin/Admin/Assets/Assets.php:82
|
139 |
+
msgid "Replace"
|
140 |
msgstr ""
|
141 |
|
142 |
#: src/Plugin/Admin/Assets/Assets.php:83
|
143 |
+
msgid "Replace Image"
|
144 |
msgstr ""
|
145 |
|
146 |
#: src/Plugin/Admin/Assets/Assets.php:84
|
147 |
+
msgid "Image from Media"
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: src/Plugin/Admin/Assets/Assets.php:85
|
151 |
msgid "Insert into Slider"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: src/Plugin/Admin/Assets/Assets.php:88
|
155 |
msgid "Activate Addon"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: src/Plugin/Admin/Assets/Assets.php:89
|
159 |
msgid "Deactivate Addon"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: src/Plugin/Admin/Assets/Assets.php:90
|
163 |
msgid "Activating..."
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: src/Plugin/Admin/Assets/Assets.php:91
|
167 |
msgid "Deactivating..."
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: src/Plugin/Admin/Assets/Assets.php:92
|
171 |
msgid "Installing..."
|
172 |
msgstr ""
|
173 |
|
174 |
+
#: src/Plugin/Admin/Assets/Assets.php:95
|
175 |
msgid "Status: Active"
|
176 |
msgstr ""
|
177 |
|
178 |
+
#: src/Plugin/Admin/Assets/Assets.php:96
|
179 |
msgid "Status: Inactive"
|
180 |
msgstr ""
|
181 |
|
403 |
msgid "There was an error installing the addon. Please try again."
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: src/Plugin/Admin/Upgrades/UpgradeTo220.php:144
|
407 |
+
msgid "Easing Slider \"Lite\""
|
408 |
+
msgstr ""
|
409 |
+
|
410 |
+
#: src/Plugin/Shortcodes/Slider.php:116
|
411 |
msgid "<p><strong>The slider specified (ID #%d) could not be found.</strong></p>"
|
412 |
msgstr ""
|
413 |
|
package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"name": "easing-slider",
|
3 |
"title": "Easing Slider",
|
4 |
-
"version": "3.0.
|
5 |
"devDependencies": {
|
6 |
"grunt": "0.4.5",
|
7 |
"grunt-contrib-concat": "^0.5.1",
|
1 |
{
|
2 |
"name": "easing-slider",
|
3 |
"title": "Easing Slider",
|
4 |
+
"version": "3.0.5",
|
5 |
"devDependencies": {
|
6 |
"grunt": "0.4.5",
|
7 |
"grunt-contrib-concat": "^0.5.1",
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: MatthewRuddy
|
|
4 |
Tags: slider, wordpress slider, carousel, image slider, responsive slider, slide, slider, slideshow, wordpress slideshow, youtube slider, photo slider, banner rotator, best slider, content slider, fullwidth slider, gallery, hardware accelerate, mobile slider,post slider, swipe, touch slider, page slider, slider plugin, slider shortcode
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.6
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -89,6 +89,17 @@ This is easy. When editing a slider in the "All Sliders" admin area, simply clic
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= 3.0.3 - June 4th, 2016 =
|
93 |
* Fixed issue that caused template function not to display unless echoed.
|
94 |
* Fixed `Fatal error: Can't inherit abstract function` related issues (known PHP bug https://bugs.php.net/bug.php?id=66818)
|
4 |
Tags: slider, wordpress slider, carousel, image slider, responsive slider, slide, slider, slideshow, wordpress slideshow, youtube slider, photo slider, banner rotator, best slider, content slider, fullwidth slider, gallery, hardware accelerate, mobile slider,post slider, swipe, touch slider, page slider, slider plugin, slider shortcode
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 3.0.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 3.0.5 - June 8th, 2016 =
|
93 |
+
* Improvements to upgrade process from versions 2.1 and 2.2. Process should now be much smoother.
|
94 |
+
* Added support for installing addons where FTP access is required.
|
95 |
+
* Shortcode HTML output is now minified to avoid issues related to other plugins parsing post content and injecting markup.
|
96 |
+
* Slight tweaks to Javascript that should improve accuracy of responsive slider width calculations.
|
97 |
+
* Slides are now centered when container is set to 100% fluid width.
|
98 |
+
|
99 |
+
= 3.0.4 - June 6th, 2016 =
|
100 |
+
* Added additional legacy functionality for users upgrading from v2.1.*.
|
101 |
+
* Fixed issue that would cause widget not to display.
|
102 |
+
|
103 |
= 3.0.3 - June 4th, 2016 =
|
104 |
* Fixed issue that caused template function not to display unless echoed.
|
105 |
* Fixed `Fatal error: Can't inherit abstract function` related issues (known PHP bug https://bugs.php.net/bug.php?id=66818)
|
resources/assets/css/public.css
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
-------------------------------------------------------------- */
|
9 |
.easingslider-slide {
|
10 |
background-color: #fff;
|
|
|
11 |
}
|
12 |
|
13 |
/* Images
|
8 |
-------------------------------------------------------------- */
|
9 |
.easingslider-slide {
|
10 |
background-color: #fff;
|
11 |
+
text-align: center;
|
12 |
}
|
13 |
|
14 |
/* Images
|
resources/assets/js/admin.js
CHANGED
@@ -2100,8 +2100,9 @@ _.extend(EasingSlider.Admin, {
|
|
2100 |
|
2101 |
// Establish variables
|
2102 |
var $button = $(this);
|
2103 |
-
var $
|
2104 |
-
var $
|
|
|
2105 |
|
2106 |
// Remove errors
|
2107 |
$('.action-error').remove();
|
@@ -2129,6 +2130,86 @@ _.extend(EasingSlider.Admin, {
|
|
2129 |
return false;
|
2130 |
}
|
2131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2132 |
// The Ajax request was successful, update the button.
|
2133 |
$button
|
2134 |
.attr('data-plugin', response.plugin)
|
@@ -2140,7 +2221,7 @@ _.extend(EasingSlider.Admin, {
|
|
2140 |
$message.text(_easingsliderAdminL10n.messages.inactive);
|
2141 |
|
2142 |
// Change status
|
2143 |
-
$
|
2144 |
|
2145 |
},
|
2146 |
error: function(xhr, textStatus, event) {
|
2100 |
|
2101 |
// Establish variables
|
2102 |
var $button = $(this);
|
2103 |
+
var $addons = $button.parents('.addons');
|
2104 |
+
var $status = $button.parents('.addon-status');
|
2105 |
+
var $message = $status.find('.status-message');
|
2106 |
|
2107 |
// Remove errors
|
2108 |
$('.action-error').remove();
|
2130 |
return false;
|
2131 |
}
|
2132 |
|
2133 |
+
// Ask for credentials if needed
|
2134 |
+
if ( response.form ) {
|
2135 |
+
|
2136 |
+
// Hide addons temporarily
|
2137 |
+
$addons.hide();
|
2138 |
+
|
2139 |
+
// Display the form to ask for user credentials
|
2140 |
+
$addons.after('<div class="action-error error">' + response.form + '</div>');
|
2141 |
+
|
2142 |
+
// Add a disabled attribute the install button
|
2143 |
+
$button.attr('disabled', true);
|
2144 |
+
|
2145 |
+
// Act when "Proceed" with FTP credentials button is clicked
|
2146 |
+
$(document).on('click', '#upgrade', function(event) {
|
2147 |
+
event.preventDefault();
|
2148 |
+
|
2149 |
+
// Get FTP credentials
|
2150 |
+
var $proceedButton = $(this);
|
2151 |
+
var $connectForm = $proceedButton.parent().parent().parent().parent();
|
2152 |
+
var hostname = $proceedButton.parent().parent().find('#hostname').val();
|
2153 |
+
var username = $proceedButton.parent().parent().find('#username').val();
|
2154 |
+
var password = $proceedButton.parent().parent().find('#password').val();
|
2155 |
+
|
2156 |
+
// Now let's attempt the Ajax request again
|
2157 |
+
$.ajax({
|
2158 |
+
url: ajaxurl,
|
2159 |
+
type: 'post',
|
2160 |
+
async: true,
|
2161 |
+
cache: false,
|
2162 |
+
dataType: 'json',
|
2163 |
+
data: {
|
2164 |
+
action: 'easingslider_install_addon',
|
2165 |
+
nonce: _easingsliderAdminL10n.nonces.install,
|
2166 |
+
plugin: $button.attr('data-plugin'),
|
2167 |
+
hostname: hostname,
|
2168 |
+
username: username,
|
2169 |
+
password: password
|
2170 |
+
},
|
2171 |
+
success: function(response) {
|
2172 |
+
|
2173 |
+
// If there is a WP Error instance, output it here and quit the script.
|
2174 |
+
if ( response.error ) {
|
2175 |
+
$button
|
2176 |
+
.attr('data-plugin', response.plugin)
|
2177 |
+
.text(_easingsliderAdminL10n.buttons.activate)
|
2178 |
+
.removeClass('js-install-addon')
|
2179 |
+
.addClass('js-activate-addon');
|
2180 |
+
|
2181 |
+
return false;
|
2182 |
+
}
|
2183 |
+
|
2184 |
+
if ( response.form ) {
|
2185 |
+
$addons.after('<div class="action-error error"><p>'+ _easingsliderAdminL10n.ftp_error +'</p></div>');
|
2186 |
+
return false;
|
2187 |
+
}
|
2188 |
+
|
2189 |
+
// Hide the FTP connection form
|
2190 |
+
$connectForm.remove();
|
2191 |
+
|
2192 |
+
// Show addons again
|
2193 |
+
$addons.show();
|
2194 |
+
|
2195 |
+
// Update message
|
2196 |
+
$message.text(_easingsliderAdminL10n.messages.inactive);
|
2197 |
+
|
2198 |
+
// Change status
|
2199 |
+
$status.removeClass('not-installed').addClass('is-inactive');
|
2200 |
+
|
2201 |
+
},
|
2202 |
+
error: function(xhr, textStatus, event) {
|
2203 |
+
return false;
|
2204 |
+
}
|
2205 |
+
});
|
2206 |
+
});
|
2207 |
+
|
2208 |
+
// No need to continue.
|
2209 |
+
return;
|
2210 |
+
|
2211 |
+
}
|
2212 |
+
|
2213 |
// The Ajax request was successful, update the button.
|
2214 |
$button
|
2215 |
.attr('data-plugin', response.plugin)
|
2221 |
$message.text(_easingsliderAdminL10n.messages.inactive);
|
2222 |
|
2223 |
// Change status
|
2224 |
+
$status.removeClass('not-installed').addClass('is-inactive');
|
2225 |
|
2226 |
},
|
2227 |
error: function(xhr, textStatus, event) {
|
resources/assets/js/public.js
CHANGED
@@ -98,7 +98,7 @@
|
|
98 |
}
|
99 |
|
100 |
// Prevent subpixel rendering by rounding width
|
101 |
-
outerWrapper.css({ 'width': Math.floor(outerWrapper.
|
102 |
|
103 |
return base;
|
104 |
|
98 |
}
|
99 |
|
100 |
// Prevent subpixel rendering by rounding width
|
101 |
+
outerWrapper.css({ 'width': Math.floor(outerWrapper.width()) +'px' });
|
102 |
|
103 |
return base;
|
104 |
|
src/Foundation/Repositories/PostType.php
CHANGED
@@ -106,6 +106,9 @@ abstract class PostType implements RepositoryContract
|
|
106 |
*/
|
107 |
public function create($data = array())
|
108 |
{
|
|
|
|
|
|
|
109 |
// Create the post
|
110 |
$id = wp_insert_post($this->purgeMetaData($data));
|
111 |
|
106 |
*/
|
107 |
public function create($data = array())
|
108 |
{
|
109 |
+
// Merge data with defaults
|
110 |
+
$data = array_merge($this->defaultPostData(), $data);
|
111 |
+
|
112 |
// Create the post
|
113 |
$id = wp_insert_post($this->purgeMetaData($data));
|
114 |
|
src/Plugin/Admin/Assets/Assets.php
CHANGED
@@ -74,6 +74,7 @@ class Assets extends BaseAssets
|
|
74 |
'base_url' => easingslider_get_admin_base_url(),
|
75 |
'delete_slide' => __('Are you sure you wish to delete this slide? This cannot be reversed.', 'easingslider'),
|
76 |
'delete_slides' => __('Are you sure you wish to delete all of this slider\'s images? This cannot be reversed.', 'easingslider'),
|
|
|
77 |
'media_upload' => array(
|
78 |
'title' => __('Edit Slide', 'easingslider'),
|
79 |
'back' => __('Back', 'easingslider'),
|
74 |
'base_url' => easingslider_get_admin_base_url(),
|
75 |
'delete_slide' => __('Are you sure you wish to delete this slide? This cannot be reversed.', 'easingslider'),
|
76 |
'delete_slides' => __('Are you sure you wish to delete all of this slider\'s images? This cannot be reversed.', 'easingslider'),
|
77 |
+
'ftp_error' => __('Unable to connect via FTP. Please make sure your credentials are correct and try again.', 'easingslider'),
|
78 |
'media_upload' => array(
|
79 |
'title' => __('Edit Slide', 'easingslider'),
|
80 |
'back' => __('Back', 'easingslider'),
|
src/Plugin/Admin/Upgrades/UpgradeTo220.php
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace EasingSlider\Plugin\Admin\Upgrades;
|
4 |
+
|
5 |
+
use EasingSlider\Foundation\Admin\Upgrades\Upgrade;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Exit if accessed directly
|
9 |
+
*/
|
10 |
+
if ( ! defined('ABSPATH')) {
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
|
14 |
+
class UpgradeTo220 extends Upgrade
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* The version we're upgrading from (or greater)
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
protected $upgradeFrom = '2.1';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The version we're upgrading too
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
protected $upgradeTo = '2.2';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Possible option prefixes through v2.1.* Easing Slider "Lite" lifespan
|
32 |
+
*
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
protected $optionPrefixes = array('easingsliderlite', 'rivasliderlite');
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Upgrade Flag
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
protected $upgradeFlag = 'easingslider_upgraded_from_lite';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Reference ID
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
protected $referenceId = 'easingslider_lite_slider_id';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Checks if the provided version is eligible for an upgrade
|
53 |
+
*
|
54 |
+
* We've hijacked this method here as our data structures were vastly different
|
55 |
+
* previously and not compatible with our new upgrade sequence
|
56 |
+
*
|
57 |
+
* @param string $version
|
58 |
+
* @return boolean
|
59 |
+
*/
|
60 |
+
public function isEligible($version)
|
61 |
+
{
|
62 |
+
if ($this->hasAlreadyUpgraded()) {
|
63 |
+
return false;
|
64 |
+
}
|
65 |
+
|
66 |
+
if ($this->liteVersionIsEligible()) {
|
67 |
+
return true;
|
68 |
+
}
|
69 |
+
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Checks if our "Easing Slider 'Lite'" version is eligible for an upgrade
|
75 |
+
*
|
76 |
+
* @return boolean
|
77 |
+
*/
|
78 |
+
protected function liteVersionIsEligible()
|
79 |
+
{
|
80 |
+
// Hijack version with old version option
|
81 |
+
$version = $this->getLiteOption('version');
|
82 |
+
|
83 |
+
// Do the comparison and run the upgrade if version is eligible
|
84 |
+
if ($version) {
|
85 |
+
return parent::isEligible($version);
|
86 |
+
}
|
87 |
+
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Delets an Easing Slider "Lite" option
|
93 |
+
*
|
94 |
+
* @param string $name
|
95 |
+
* @return void
|
96 |
+
*/
|
97 |
+
protected function deleteLiteOption($name)
|
98 |
+
{
|
99 |
+
foreach ($this->optionPrefixes as $prefix) {
|
100 |
+
delete_option("{$prefix}_{$name}");
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Gets an Easing Slider "Lite" option
|
106 |
+
*
|
107 |
+
* @param string $name
|
108 |
+
* @return mixed|false
|
109 |
+
*/
|
110 |
+
protected function getLiteOption($name)
|
111 |
+
{
|
112 |
+
foreach ($this->optionPrefixes as $prefix) {
|
113 |
+
$value = get_option("{$prefix}_{$name}", false);
|
114 |
+
|
115 |
+
if ($value) {
|
116 |
+
return $value;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
return false;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Gets the "Easing Slider 'Lite'" slider
|
125 |
+
*
|
126 |
+
* @return object|false
|
127 |
+
*/
|
128 |
+
protected function getLiteSlider()
|
129 |
+
{
|
130 |
+
return $this->getLiteOption('slideshow');
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Creates the upgraded "Lite" slider
|
135 |
+
*
|
136 |
+
* @param object $liteSlider
|
137 |
+
* @return int
|
138 |
+
*/
|
139 |
+
protected function createUpgradedSlider($liteSlider)
|
140 |
+
{
|
141 |
+
// Create the post
|
142 |
+
$postId = wp_insert_post(array(
|
143 |
+
'post_type' => 'easingslider',
|
144 |
+
'post_title' => __('Easing Slider "Lite"', 'easingslider'),
|
145 |
+
'post_status' => 'publish',
|
146 |
+
));
|
147 |
+
|
148 |
+
// Add post meta
|
149 |
+
add_post_meta($postId, '_easingslider_slides', $this->transformLiteSlides($liteSlider->slides));
|
150 |
+
add_post_meta($postId, '_easingslider_general', $liteSlider->general);
|
151 |
+
add_post_meta($postId, '_easingslider_dimensions', $liteSlider->dimensions);
|
152 |
+
add_post_meta($postId, '_easingslider_transitions', $liteSlider->transitions);
|
153 |
+
add_post_meta($postId, '_easingslider_navigation', $liteSlider->navigation);
|
154 |
+
add_post_meta($postId, '_easingslider_playback', $liteSlider->playback);
|
155 |
+
|
156 |
+
return $postId;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Transforms our "Lite" slides into our new slide data structure
|
161 |
+
*
|
162 |
+
* @param array $liteSlides
|
163 |
+
* @return array
|
164 |
+
*/
|
165 |
+
protected function transformLiteSlides($liteSlides)
|
166 |
+
{
|
167 |
+
global $wpdb;
|
168 |
+
|
169 |
+
$slides = array();
|
170 |
+
|
171 |
+
// Transform each slide
|
172 |
+
foreach ($liteSlides as $liteSlide) {
|
173 |
+
|
174 |
+
// Query the guid
|
175 |
+
$attachmentQuery = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s'", $liteSlide->url);
|
176 |
+
|
177 |
+
// Attempt to get the attachment of this image
|
178 |
+
$attachmentId = $wpdb->get_var($attachmentQuery);
|
179 |
+
|
180 |
+
// Populate the slide
|
181 |
+
$slide = (object) array(
|
182 |
+
'type' => 'image',
|
183 |
+
'id' => absint($liteSlide->id),
|
184 |
+
'attachment_id' => absint($attachmentId),
|
185 |
+
'alt' => sanitize_text_field($liteSlide->alt),
|
186 |
+
'link' => ($liteSlide->link) ? 'custom' : 'none',
|
187 |
+
'linkUrl' => sanitize_text_field($liteSlide->link),
|
188 |
+
'linkTargetBlank' => ('_blank' == $liteSlide->linkTarget) ? true : false,
|
189 |
+
'title' => sanitize_text_field($liteSlide->title),
|
190 |
+
'url' => null
|
191 |
+
);
|
192 |
+
|
193 |
+
// Add an image URL if we aren't using an attachment
|
194 |
+
if ( ! $attachmentId) {
|
195 |
+
$slide->url = sanitize_text_field($liteSlide->url);
|
196 |
+
}
|
197 |
+
|
198 |
+
// Add the slide
|
199 |
+
$slides[] = $slide;
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
return $slides;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Sets the reference ID
|
208 |
+
*
|
209 |
+
* @param int $id
|
210 |
+
* @return void
|
211 |
+
*/
|
212 |
+
protected function setReferenceId($id)
|
213 |
+
{
|
214 |
+
update_option($this->referenceId, $id);
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Marks the upgrade as complete
|
219 |
+
*
|
220 |
+
* @return void
|
221 |
+
*/
|
222 |
+
protected function markAsUpgraded()
|
223 |
+
{
|
224 |
+
update_option($this->upgradeFlag, true);
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Checks if the upgrade has already been performed
|
229 |
+
*
|
230 |
+
* @return boolean
|
231 |
+
*/
|
232 |
+
protected function hasAlreadyUpgraded()
|
233 |
+
{
|
234 |
+
return get_option($this->upgradeFlag, false);
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Deletes all "Easing Slider 'Lite'" options that are no longer used
|
239 |
+
*
|
240 |
+
* @return void
|
241 |
+
*/
|
242 |
+
protected function cleanupOptions()
|
243 |
+
{
|
244 |
+
$this->deleteLiteOption('customizations');
|
245 |
+
$this->deleteLiteOption('disable_welcome_panel');
|
246 |
+
$this->deleteLiteOption('major_upgrade');
|
247 |
+
$this->deleteLiteOption('settings');
|
248 |
+
$this->deleteLiteOption('slideshow');
|
249 |
+
$this->deleteLiteOption('version');
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Upgrades the "Lite" slider
|
254 |
+
*
|
255 |
+
* @return void
|
256 |
+
*/
|
257 |
+
public function upgradeSlider()
|
258 |
+
{
|
259 |
+
$liteSlider = $this->getLiteSlider();
|
260 |
+
|
261 |
+
if ($liteSlider) {
|
262 |
+
|
263 |
+
// Create the upgraded slider
|
264 |
+
$sliderId = $this->createUpgradedSlider($liteSlider);
|
265 |
+
|
266 |
+
// Set the reference ID so we can continue to use the `[easingsliderlite`] shortcode
|
267 |
+
$this->setReferenceId($sliderId);
|
268 |
+
|
269 |
+
// Mark the upgrade as complete so it doesn't occur again
|
270 |
+
$this->markAsUpgraded();
|
271 |
+
|
272 |
+
// Cleanup "Lite" plugin options as they are now redundant
|
273 |
+
// $this->cleanupOptions(); // Temporarily disabling this to allow users time to revert.
|
274 |
+
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Executes the upgrade
|
280 |
+
*
|
281 |
+
* @return void
|
282 |
+
*/
|
283 |
+
public function upgrade()
|
284 |
+
{
|
285 |
+
$this->upgradeSlider();
|
286 |
+
}
|
287 |
+
}
|
src/Plugin/Admin/Upgrades/UpgradeTo300.php
CHANGED
@@ -5,9 +5,11 @@ namespace EasingSlider\Plugin\Admin\Upgrades;
|
|
5 |
use WP_Roles;
|
6 |
use WP_Query;
|
7 |
use EasingSlider\Foundation\Admin\Upgrades\Upgrade;
|
|
|
8 |
use EasingSlider\Plugin\Contracts\Options\License;
|
9 |
use EasingSlider\Plugin\Contracts\Options\Settings;
|
10 |
|
|
|
11 |
/**
|
12 |
* Exit if accessed directly
|
13 |
*/
|
@@ -17,6 +19,13 @@ if ( ! defined('ABSPATH')) {
|
|
17 |
|
18 |
class UpgradeTo300 extends Upgrade
|
19 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* Settings
|
22 |
*
|
@@ -45,26 +54,184 @@ class UpgradeTo300 extends Upgrade
|
|
45 |
*/
|
46 |
protected $upgradeTo = '3.0.0';
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
/**
|
49 |
* Constructor
|
50 |
*
|
51 |
-
* @param \EasingSlider\
|
52 |
-
* @param \EasingSlider\Plugin\Contracts\Options\
|
|
|
53 |
* @return void
|
54 |
*/
|
55 |
-
public function __construct(Settings $settings, License $license)
|
56 |
{
|
|
|
57 |
$this->settings = $settings;
|
58 |
$this->license = $license;
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
/**
|
62 |
* Sets an option telling us that this user has upgraded from a previous version to v3.0.0.
|
63 |
* This allows us to conditionally display an notice providing information related to the upgrade.
|
64 |
*
|
65 |
* @return void
|
66 |
*/
|
67 |
-
|
68 |
{
|
69 |
add_option('easingslider_upgraded_from_v2', true);
|
70 |
}
|
@@ -74,7 +241,7 @@ class UpgradeTo300 extends Upgrade
|
|
74 |
*
|
75 |
* @return void
|
76 |
*/
|
77 |
-
|
78 |
{
|
79 |
// Set the license key
|
80 |
$this->license['key'] = get_option('easingslider_license_key');
|
@@ -91,7 +258,7 @@ class UpgradeTo300 extends Upgrade
|
|
91 |
*
|
92 |
* @return void
|
93 |
*/
|
94 |
-
|
95 |
{
|
96 |
// Get new settings array of defaults
|
97 |
$settings = $this->settings->getDefaults();
|
@@ -119,7 +286,7 @@ class UpgradeTo300 extends Upgrade
|
|
119 |
*
|
120 |
* @return void
|
121 |
*/
|
122 |
-
|
123 |
{
|
124 |
global $wp_roles;
|
125 |
|
@@ -166,11 +333,8 @@ class UpgradeTo300 extends Upgrade
|
|
166 |
*
|
167 |
* @return void
|
168 |
*/
|
169 |
-
|
170 |
{
|
171 |
-
// Get sliders
|
172 |
-
$sliders = Easing_Slider()->sliders();
|
173 |
-
|
174 |
// Get old sliders
|
175 |
$oldSliders = $this->getOldSliders();
|
176 |
|
@@ -180,111 +344,18 @@ class UpgradeTo300 extends Upgrade
|
|
180 |
*/
|
181 |
foreach ($oldSliders as $oldSlider) {
|
182 |
|
183 |
-
//
|
184 |
-
$data =
|
185 |
-
|
186 |
-
// Map linear values
|
187 |
-
$data['post_title'] = get_the_title($oldSlider->ID);
|
188 |
-
$data['type'] = 'media';
|
189 |
-
$data['slides'] = $oldSlider->slides;
|
190 |
-
$data['responsive'] = true;
|
191 |
-
$data['image_resizing'] = true;
|
192 |
-
$data['auto_height'] = false;
|
193 |
-
$data['lazy_loading'] = true;
|
194 |
-
|
195 |
-
// Map dynamic values
|
196 |
-
$data = $this->setSliderAttribute($data, 'randomize', $oldSlider, 'general', 'randomize');
|
197 |
-
$data = $this->setSliderAttribute($data, 'width', $oldSlider, 'dimensions', 'width');
|
198 |
-
$data = $this->setSliderAttribute($data, 'height', $oldSlider, 'dimensions', 'height');
|
199 |
-
$data = $this->setSliderAttribute($data, 'full_width', $oldSlider, 'dimensions', 'full_width');
|
200 |
-
$data = $this->setSliderAttribute($data, 'background_images', $oldSlider, 'dimensions', 'background_images');
|
201 |
-
$data = $this->setSliderAttribute($data, 'transition_effect', $oldSlider, 'transitions', 'effect');
|
202 |
-
$data = $this->setSliderAttribute($data, 'transition_duration', $oldSlider, 'transitions', 'duration');
|
203 |
-
$data = $this->setSliderAttribute($data, 'arrows', $oldSlider, 'navigation', 'arrows');
|
204 |
-
$data = $this->setSliderAttribute($data, 'arrows_hover', $oldSlider, 'navigation', 'arrows_hover');
|
205 |
-
$data = $this->setSliderAttribute($data, 'arrows_position', $oldSlider, 'navigation', 'arrows_position');
|
206 |
-
$data = $this->setSliderAttribute($data, 'pagination', $oldSlider, 'navigation', 'pagination');
|
207 |
-
$data = $this->setSliderAttribute($data, 'pagination_hover', $oldSlider, 'navigation', 'pagination_hover');
|
208 |
-
$data = $this->setSliderAttribute($data, 'pagination_position', $oldSlider, 'navigation', 'pagination_position');
|
209 |
-
$data = $this->setSliderAttribute($data, 'pagination_location', $oldSlider, 'navigation', 'pagination_location');
|
210 |
-
$data = $this->setSliderAttribute($data, 'playback_enabled', $oldSlider, 'playback', 'enabled');
|
211 |
-
$data = $this->setSliderAttribute($data, 'playback_pause', $oldSlider, 'playback', 'pause');
|
212 |
|
213 |
// Update the slider with new data
|
214 |
-
$sliders->update($oldSlider->ID, $data);
|
215 |
|
216 |
-
// Delete old slider meta
|
217 |
-
|
218 |
-
delete_post_meta($oldSlider->ID,
|
219 |
-
|
220 |
-
delete_post_meta($oldSlider->ID, '_easingslider_transitions', true);
|
221 |
-
delete_post_meta($oldSlider->ID, '_easingslider_navigation', true);
|
222 |
-
delete_post_meta($oldSlider->ID, '_easingslider_playback', true);
|
223 |
-
|
224 |
-
}
|
225 |
-
}
|
226 |
|
227 |
-
/**
|
228 |
-
* Sets a slider attribute, if the old slider value exists.
|
229 |
-
*
|
230 |
-
* @param array $slider
|
231 |
-
* @param string $key
|
232 |
-
* @param object $oldSlider
|
233 |
-
* @param string $oldSection
|
234 |
-
* @param string $oldKey
|
235 |
-
* @return array
|
236 |
-
*/
|
237 |
-
protected function setSliderAttribute($slider, $key, $oldSlider, $oldSection, $oldValue)
|
238 |
-
{
|
239 |
-
if (isset($oldSlider->{$oldSection}->{$oldValue})) {
|
240 |
-
$slider[$key] = $oldSlider->{$oldSection}->{$oldValue};
|
241 |
}
|
242 |
-
|
243 |
-
return $slider;
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Gets the old sliders
|
248 |
-
*
|
249 |
-
* @return array
|
250 |
-
*/
|
251 |
-
protected function getOldSliders()
|
252 |
-
{
|
253 |
-
// Get sliders
|
254 |
-
$sliders = array();
|
255 |
-
|
256 |
-
// Query posts
|
257 |
-
$wpQuery = new WP_Query(array('post_type' => 'easingslider'));
|
258 |
-
|
259 |
-
// Loop through each post
|
260 |
-
if ($wpQuery->have_posts()) {
|
261 |
-
while($wpQuery->have_posts()) {
|
262 |
-
|
263 |
-
$wpQuery->the_post();
|
264 |
-
|
265 |
-
// Get post ID
|
266 |
-
$id = get_the_ID();
|
267 |
-
|
268 |
-
// Get slider
|
269 |
-
$slider = (object) array(
|
270 |
-
'ID' => $id
|
271 |
-
);
|
272 |
-
|
273 |
-
// Add metadata
|
274 |
-
$slider->slides = get_post_meta($id, '_easingslider_slides', true);
|
275 |
-
$slider->general = get_post_meta($id, '_easingslider_general', true);
|
276 |
-
$slider->dimensions = get_post_meta($id, '_easingslider_dimensions', true);
|
277 |
-
$slider->transitions = get_post_meta($id, '_easingslider_transitions', true);
|
278 |
-
$slider->navigation = get_post_meta($id, '_easingslider_navigation', true);
|
279 |
-
$slider->playback = get_post_meta($id, '_easingslider_playback', true);
|
280 |
-
|
281 |
-
// Add to sliders
|
282 |
-
$sliders[] = $slider;
|
283 |
-
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
return $sliders;
|
288 |
}
|
289 |
|
290 |
/**
|
@@ -294,11 +365,11 @@ class UpgradeTo300 extends Upgrade
|
|
294 |
*/
|
295 |
public function upgrade()
|
296 |
{
|
297 |
-
$this->
|
298 |
|
299 |
$this->migrateLicense();
|
300 |
|
301 |
-
$this->
|
302 |
|
303 |
$this->upgradeSettings();
|
304 |
|
5 |
use WP_Roles;
|
6 |
use WP_Query;
|
7 |
use EasingSlider\Foundation\Admin\Upgrades\Upgrade;
|
8 |
+
use EasingSlider\Foundation\Contracts\Repositories\Repository;
|
9 |
use EasingSlider\Plugin\Contracts\Options\License;
|
10 |
use EasingSlider\Plugin\Contracts\Options\Settings;
|
11 |
|
12 |
+
|
13 |
/**
|
14 |
* Exit if accessed directly
|
15 |
*/
|
19 |
|
20 |
class UpgradeTo300 extends Upgrade
|
21 |
{
|
22 |
+
/**
|
23 |
+
* Sliders
|
24 |
+
*
|
25 |
+
* @var \EasingSlider\Foundation\Contracts\Repositories\Repository
|
26 |
+
*/
|
27 |
+
protected $sliders;
|
28 |
+
|
29 |
/**
|
30 |
* Settings
|
31 |
*
|
54 |
*/
|
55 |
protected $upgradeTo = '3.0.0';
|
56 |
|
57 |
+
/**
|
58 |
+
* Old Slider Meta Keys
|
59 |
+
*
|
60 |
+
* @var array
|
61 |
+
*/
|
62 |
+
protected $oldSliderMetaKeys = array(
|
63 |
+
'slides' => '_easingslider_slides',
|
64 |
+
'general' => '_easingslider_general',
|
65 |
+
'dimensions' => '_easingslider_dimensions',
|
66 |
+
'transitions' => '_easingslider_transitions',
|
67 |
+
'navigation' => '_easingslider_navigation',
|
68 |
+
'playback' => '_easingslider_playback'
|
69 |
+
);
|
70 |
+
|
71 |
/**
|
72 |
* Constructor
|
73 |
*
|
74 |
+
* @param \EasingSlider\Foundation\Contracts\Repositories\Repository $sliders
|
75 |
+
* @param \EasingSlider\Plugin\Contracts\Options\Settings $settings
|
76 |
+
* @param \EasingSlider\Plugin\Contracts\Options\License $license
|
77 |
* @return void
|
78 |
*/
|
79 |
+
public function __construct(Repository $sliders, Settings $settings, License $license)
|
80 |
{
|
81 |
+
$this->sliders = $sliders;
|
82 |
$this->settings = $settings;
|
83 |
$this->license = $license;
|
84 |
}
|
85 |
|
86 |
+
/**
|
87 |
+
* Sets a slider data attribute, only if the old slider value exists.
|
88 |
+
*
|
89 |
+
* @param array $slider
|
90 |
+
* @param string $key
|
91 |
+
* @param object $oldSlider
|
92 |
+
* @param string $oldSection
|
93 |
+
* @param string $oldKey
|
94 |
+
* @return array
|
95 |
+
*/
|
96 |
+
protected function setAttributeIfExists($slider, $key, $oldSlider, $oldSection, $oldValue)
|
97 |
+
{
|
98 |
+
if (isset($oldSlider->{$oldSection}->{$oldValue})) {
|
99 |
+
$slider[$key] = $oldSlider->{$oldSection}->{$oldValue};
|
100 |
+
}
|
101 |
+
|
102 |
+
return $slider;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Transforms the old slider data into our new data structure
|
107 |
+
*
|
108 |
+
* @param object $oldSlider
|
109 |
+
* @return array
|
110 |
+
*/
|
111 |
+
protected function transformOldSliderData($oldSlider)
|
112 |
+
{
|
113 |
+
$data = array();
|
114 |
+
|
115 |
+
// Map linear values
|
116 |
+
$data['post_title'] = get_the_title($oldSlider->ID);
|
117 |
+
$data['type'] = 'media';
|
118 |
+
$data['image_resizing'] = true;
|
119 |
+
$data['auto_height'] = false;
|
120 |
+
$data['lazy_loading'] = true;
|
121 |
+
|
122 |
+
// Map dynamic values
|
123 |
+
$data = $this->setAttributeIfExists($data, 'randomize', $oldSlider, 'general', 'randomize');
|
124 |
+
$data = $this->setAttributeIfExists($data, 'width', $oldSlider, 'dimensions', 'width');
|
125 |
+
$data = $this->setAttributeIfExists($data, 'height', $oldSlider, 'dimensions', 'height');
|
126 |
+
$data = $this->setAttributeIfExists($data, 'full_width', $oldSlider, 'dimensions', 'full_width');
|
127 |
+
$data = $this->setAttributeIfExists($data, 'background_images', $oldSlider, 'dimensions', 'background_images');
|
128 |
+
$data = $this->setAttributeIfExists($data, 'transition_effect', $oldSlider, 'transitions', 'effect');
|
129 |
+
$data = $this->setAttributeIfExists($data, 'transition_duration', $oldSlider, 'transitions', 'duration');
|
130 |
+
$data = $this->setAttributeIfExists($data, 'arrows', $oldSlider, 'navigation', 'arrows');
|
131 |
+
$data = $this->setAttributeIfExists($data, 'arrows_hover', $oldSlider, 'navigation', 'arrows_hover');
|
132 |
+
$data = $this->setAttributeIfExists($data, 'arrows_position', $oldSlider, 'navigation', 'arrows_position');
|
133 |
+
$data = $this->setAttributeIfExists($data, 'pagination', $oldSlider, 'navigation', 'pagination');
|
134 |
+
$data = $this->setAttributeIfExists($data, 'pagination_hover', $oldSlider, 'navigation', 'pagination_hover');
|
135 |
+
$data = $this->setAttributeIfExists($data, 'pagination_position', $oldSlider, 'navigation', 'pagination_position');
|
136 |
+
$data = $this->setAttributeIfExists($data, 'pagination_location', $oldSlider, 'navigation', 'pagination_location');
|
137 |
+
$data = $this->setAttributeIfExists($data, 'playback_enabled', $oldSlider, 'playback', 'enabled');
|
138 |
+
$data = $this->setAttributeIfExists($data, 'playback_pause', $oldSlider, 'playback', 'pause');
|
139 |
+
|
140 |
+
// Transform old slides
|
141 |
+
$data['slides'] = $this->transformOldSlides($oldSlider->slides);
|
142 |
+
|
143 |
+
return $data;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Transforms our old slides into our new slide data structure
|
148 |
+
*
|
149 |
+
* @param array $oldSlides
|
150 |
+
* @return array
|
151 |
+
*/
|
152 |
+
protected function transformOldSlides($oldSlides)
|
153 |
+
{
|
154 |
+
global $wpdb;
|
155 |
+
|
156 |
+
$slides = array();
|
157 |
+
|
158 |
+
// Transform each slide
|
159 |
+
foreach ($oldSlides as $oldSlide) {
|
160 |
+
|
161 |
+
// Populate the slide
|
162 |
+
$slide = (object) array(
|
163 |
+
'type' => 'image',
|
164 |
+
'id' => absint($oldSlide->id),
|
165 |
+
'attachment_id' => absint($oldSlide->attachment_id),
|
166 |
+
'alt' => sanitize_text_field($oldSlide->alt),
|
167 |
+
'link' => sanitize_text_field($oldSlide->link),
|
168 |
+
'linkUrl' => sanitize_text_field($oldSlide->linkUrl),
|
169 |
+
'linkTargetBlank' => (true == $oldSlide->linkTargetBlank) ? true : false,
|
170 |
+
'title' => sanitize_text_field($oldSlide->title),
|
171 |
+
'url' => null
|
172 |
+
);
|
173 |
+
|
174 |
+
// Add an image URL if we aren't using an attachment
|
175 |
+
if ( ! $oldSlide->attachment_id) {
|
176 |
+
$slide->url = $oldSlide->url;
|
177 |
+
}
|
178 |
+
|
179 |
+
// Add the slide
|
180 |
+
$slides[] = $slide;
|
181 |
+
|
182 |
+
}
|
183 |
+
|
184 |
+
return $slides;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Gets the old sliders
|
189 |
+
*
|
190 |
+
* @return array
|
191 |
+
*/
|
192 |
+
protected function getOldSliders()
|
193 |
+
{
|
194 |
+
// Get sliders
|
195 |
+
$sliders = array();
|
196 |
+
|
197 |
+
// Query posts
|
198 |
+
$wpQuery = new WP_Query(array('post_type' => 'easingslider'));
|
199 |
+
|
200 |
+
// Loop through each post
|
201 |
+
if ($wpQuery->have_posts()) {
|
202 |
+
while($wpQuery->have_posts()) {
|
203 |
+
|
204 |
+
$wpQuery->the_post();
|
205 |
+
|
206 |
+
// Get post ID
|
207 |
+
$id = get_the_ID();
|
208 |
+
|
209 |
+
// Get slider
|
210 |
+
$slider = (object) array(
|
211 |
+
'ID' => $id
|
212 |
+
);
|
213 |
+
|
214 |
+
// Add metadata
|
215 |
+
foreach ($this->oldSliderMetaKeys as $settingsKey => $metaKey) {
|
216 |
+
$slider->{$settingsKey} = get_post_meta($id, $metaKey, true);
|
217 |
+
}
|
218 |
+
|
219 |
+
// Add to sliders
|
220 |
+
$sliders[] = $slider;
|
221 |
+
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
return $sliders;
|
226 |
+
}
|
227 |
+
|
228 |
/**
|
229 |
* Sets an option telling us that this user has upgraded from a previous version to v3.0.0.
|
230 |
* This allows us to conditionally display an notice providing information related to the upgrade.
|
231 |
*
|
232 |
* @return void
|
233 |
*/
|
234 |
+
public function setupUpgradeInfoNotice()
|
235 |
{
|
236 |
add_option('easingslider_upgraded_from_v2', true);
|
237 |
}
|
241 |
*
|
242 |
* @return void
|
243 |
*/
|
244 |
+
public function migrateLicense()
|
245 |
{
|
246 |
// Set the license key
|
247 |
$this->license['key'] = get_option('easingslider_license_key');
|
258 |
*
|
259 |
* @return void
|
260 |
*/
|
261 |
+
public function upgradeSettings()
|
262 |
{
|
263 |
// Get new settings array of defaults
|
264 |
$settings = $this->settings->getDefaults();
|
286 |
*
|
287 |
* @return void
|
288 |
*/
|
289 |
+
public function transferCapabilities()
|
290 |
{
|
291 |
global $wp_roles;
|
292 |
|
333 |
*
|
334 |
* @return void
|
335 |
*/
|
336 |
+
public function upgradeSliders()
|
337 |
{
|
|
|
|
|
|
|
338 |
// Get old sliders
|
339 |
$oldSliders = $this->getOldSliders();
|
340 |
|
344 |
*/
|
345 |
foreach ($oldSliders as $oldSlider) {
|
346 |
|
347 |
+
// Transform data
|
348 |
+
$data = $this->transformOldSliderData($oldSlider);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
|
350 |
// Update the slider with new data
|
351 |
+
$this->sliders->update($oldSlider->ID, $data);
|
352 |
|
353 |
+
// Delete old slider meta data
|
354 |
+
// foreach ($this->oldSliderMetaKeys as $metaKey) {
|
355 |
+
// delete_post_meta($oldSlider->ID, $metaKey, true); // Temporarily disable this to allow users to revert back if they have issues.
|
356 |
+
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
}
|
360 |
|
361 |
/**
|
365 |
*/
|
366 |
public function upgrade()
|
367 |
{
|
368 |
+
$this->setupUpgradeInfoNotice();
|
369 |
|
370 |
$this->migrateLicense();
|
371 |
|
372 |
+
$this->transferCapabilities();
|
373 |
|
374 |
$this->upgradeSettings();
|
375 |
|
src/Plugin/Admin/Upgrades/UpgradeTo305.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace EasingSlider\Plugin\Admin\Upgrades;
|
4 |
+
|
5 |
+
use EasingSlider\Foundation\Admin\Upgrades\Upgrade;
|
6 |
+
use EasingSlider\Foundation\Contracts\Plugin;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Exit if accessed directly
|
10 |
+
*/
|
11 |
+
if ( ! defined('ABSPATH')) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
class UpgradeTo305 extends Upgrade
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Plugin
|
19 |
+
*
|
20 |
+
* @var \EasingSlider\Foundation\Contracts\Plugin
|
21 |
+
*/
|
22 |
+
protected $plugin;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The version we're upgrading from (or greater)
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
protected $upgradeFrom = '3.0.4';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The version we're upgrading too
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
protected $upgradeTo = '3.0.5';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Constructor
|
40 |
+
*
|
41 |
+
* @param \EasingSlider\Foundation\Contracts\Plugin $plugin
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
+
public function __construct(Plugin $plugin)
|
45 |
+
{
|
46 |
+
$this->plugin = $plugin;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* We had some issues with our v3.0.4 upgrade process due to a bug.
|
51 |
+
* Consequently we pulled the update and worked on a fix.
|
52 |
+
*
|
53 |
+
* Unfortunately some users would still have a semi-broken plugin as a result.
|
54 |
+
* Re-running the v3.0.0 upgrade should resolve the issue and regenerate any missing options.
|
55 |
+
* We also have to re-transfer the capabilities as these were also affected by the bug.
|
56 |
+
*
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function fixBrokenUpgrade()
|
60 |
+
{
|
61 |
+
$upgrade = $this->plugin->make('\EasingSlider\Plugin\Admin\Upgrades\UpgradeTo300');
|
62 |
+
$upgrade->transferCapabilities();
|
63 |
+
$upgrade->upgradeSliders();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Executes the upgrade
|
68 |
+
*
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
public function upgrade()
|
72 |
+
{
|
73 |
+
$this->fixBrokenUpgrade();
|
74 |
+
}
|
75 |
+
}
|
src/Plugin/Admin/Upgrades/Upgrader.php
CHANGED
@@ -20,6 +20,8 @@ class Upgrader extends BaseUpgrader
|
|
20 |
*/
|
21 |
protected function boot()
|
22 |
{
|
|
|
23 |
$this->upgrades[] = $this->plugin->make('\EasingSlider\Plugin\Admin\Upgrades\UpgradeTo300');
|
|
|
24 |
}
|
25 |
}
|
20 |
*/
|
21 |
protected function boot()
|
22 |
{
|
23 |
+
$this->upgrades[] = $this->plugin->make('\EasingSlider\Plugin\Admin\Upgrades\UpgradeTo220');
|
24 |
$this->upgrades[] = $this->plugin->make('\EasingSlider\Plugin\Admin\Upgrades\UpgradeTo300');
|
25 |
+
$this->upgrades[] = $this->plugin->make('\EasingSlider\Plugin\Admin\Upgrades\UpgradeTo305');
|
26 |
}
|
27 |
}
|
src/Plugin/Models/Slider.php
CHANGED
@@ -26,7 +26,6 @@ class Slider extends Model
|
|
26 |
'randomize' => false,
|
27 |
'width' => 640,
|
28 |
'height' => 400,
|
29 |
-
'responsive' => true,
|
30 |
'full_width' => false,
|
31 |
'image_resizing' => true,
|
32 |
'auto_height' => false,
|
26 |
'randomize' => false,
|
27 |
'width' => 640,
|
28 |
'height' => 400,
|
|
|
29 |
'full_width' => false,
|
30 |
'image_resizing' => true,
|
31 |
'auto_height' => false,
|
src/Plugin/Shortcodes/Slider.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
namespace EasingSlider\Plugin\Shortcodes;
|
4 |
|
|
|
5 |
use EasingSlider\Foundation\Contracts\Repositories\Repository;
|
6 |
use EasingSlider\Foundation\Shortcodes\Shortcode;
|
7 |
use EasingSlider\Plugin\Views\Slider as SliderView;
|
@@ -42,6 +43,46 @@ class Slider extends Shortcode
|
|
42 |
parent::__construct();
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* Renders the shortcode
|
47 |
*
|
@@ -62,22 +103,15 @@ class Slider extends Shortcode
|
|
62 |
// Find the slider
|
63 |
$slider = $this->sliders->find($atts->id);
|
64 |
|
65 |
-
// Continue if we have a slider
|
66 |
if ($slider) {
|
67 |
|
68 |
-
//
|
69 |
-
|
70 |
-
|
71 |
-
// Display the slider
|
72 |
-
$view = new SliderView($slider);
|
73 |
-
$view->display();
|
74 |
-
|
75 |
-
// Return output buffer
|
76 |
-
return ob_get_clean();
|
77 |
|
78 |
} else {
|
79 |
-
|
80 |
-
//
|
81 |
if (is_super_admin()) {
|
82 |
return sprintf(__('<p><strong>The slider specified (ID #%d) could not be found.</strong></p>', 'easingslider'), $atts->id);
|
83 |
}
|
2 |
|
3 |
namespace EasingSlider\Plugin\Shortcodes;
|
4 |
|
5 |
+
use EasingSlider\Foundation\Contracts\Models\Model;
|
6 |
use EasingSlider\Foundation\Contracts\Repositories\Repository;
|
7 |
use EasingSlider\Foundation\Shortcodes\Shortcode;
|
8 |
use EasingSlider\Plugin\Views\Slider as SliderView;
|
43 |
parent::__construct();
|
44 |
}
|
45 |
|
46 |
+
/**
|
47 |
+
* Minifies the HTML output. Some plugins have a habit of
|
48 |
+
* parsing post HTML content, and injecting nasty `<code>` and `<pre>` tags into the markup.
|
49 |
+
*
|
50 |
+
* This in turn breaks Easing Slider. Minifying the HTML can prevent this.
|
51 |
+
*
|
52 |
+
* @param string $content
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
protected function minifyOutput($content)
|
56 |
+
{
|
57 |
+
$content = preg_replace('!/\*.*?\*/!s', '', $content);
|
58 |
+
$content = preg_replace('/\n\s*\n/', "\n", $content);
|
59 |
+
$content = str_replace(array("\r\n", "\r", "\t", "\n"), '', $content);
|
60 |
+
|
61 |
+
return $content;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Renders the view for this shortcode
|
66 |
+
*
|
67 |
+
* @param \EasingSlider\Foundation\Contracts\Models\Model $slider
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
protected function renderView(Model $slider)
|
71 |
+
{
|
72 |
+
// Start output buffer
|
73 |
+
ob_start();
|
74 |
+
|
75 |
+
// Display the slider
|
76 |
+
$view = new SliderView($slider);
|
77 |
+
$view->display();
|
78 |
+
|
79 |
+
// Get content from output buffer
|
80 |
+
$content = ob_get_clean();
|
81 |
+
|
82 |
+
// Minify & return
|
83 |
+
return $this->minifyOutput($content);
|
84 |
+
}
|
85 |
+
|
86 |
/**
|
87 |
* Renders the shortcode
|
88 |
*
|
103 |
// Find the slider
|
104 |
$slider = $this->sliders->find($atts->id);
|
105 |
|
106 |
+
// Continue if we have a slider
|
107 |
if ($slider) {
|
108 |
|
109 |
+
// Render and return view
|
110 |
+
return $this->renderView($slider);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
} else {
|
113 |
+
|
114 |
+
// Tell user no slider has been found (admins only)
|
115 |
if (is_super_admin()) {
|
116 |
return sprintf(__('<p><strong>The slider specified (ID #%d) could not be found.</strong></p>', 'easingslider'), $atts->id);
|
117 |
}
|
src/Plugin/Widgets/Slider.php
CHANGED
@@ -121,7 +121,7 @@ class Slider extends Widget
|
|
121 |
public function display($instance)
|
122 |
{
|
123 |
if ( ! empty($instance['id'])) {
|
124 |
-
$this->shortcode->render(array('id' => $instance['id']));
|
125 |
}
|
126 |
}
|
127 |
}
|
121 |
public function display($instance)
|
122 |
{
|
123 |
if ( ! empty($instance['id'])) {
|
124 |
+
echo $this->shortcode->render(array('id' => $instance['id']));
|
125 |
}
|
126 |
}
|
127 |
}
|
src/Plugin/legacy.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Exit if accessed directly
|
5 |
+
*/
|
6 |
+
if ( ! defined('ABSPATH')) {
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
if ( ! function_exists('easingsliderlite')) {
|
11 |
+
/**
|
12 |
+
* Displays the "Easing Slider 'Lite'" slider
|
13 |
+
*
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
function easingsliderlite()
|
17 |
+
{
|
18 |
+
echo do_shortcode('[easingsliderlite]');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
if ( ! function_exists('easingsliderlite_shortcode')) {
|
23 |
+
/**
|
24 |
+
* Displays the "Easing Slider 'Lite'" slider by shortcode
|
25 |
+
*
|
26 |
+
* @return void
|
27 |
+
*/
|
28 |
+
function easingsliderlite_shortcode()
|
29 |
+
{
|
30 |
+
$liteSliderId = absint(get_option('easingslider_lite_slider_id'));
|
31 |
+
|
32 |
+
echo do_shortcode("[easingslider id=\"{$liteSliderId}\"]");
|
33 |
+
}
|
34 |
+
add_shortcode('easingsliderlite', 'easingsliderlite_shortcode');
|
35 |
+
}
|
vendor/composer/autoload_files.php
CHANGED
@@ -8,4 +8,5 @@ $baseDir = dirname($vendorDir);
|
|
8 |
return array(
|
9 |
'aeb63d164f6cca31ad3c0b587e63813b' => $baseDir . '/src/Foundation/helpers.php',
|
10 |
'8820040b8131984b49e14e759290eb43' => $baseDir . '/src/Plugin/helpers.php',
|
|
|
11 |
);
|
8 |
return array(
|
9 |
'aeb63d164f6cca31ad3c0b587e63813b' => $baseDir . '/src/Foundation/helpers.php',
|
10 |
'8820040b8131984b49e14e759290eb43' => $baseDir . '/src/Plugin/helpers.php',
|
11 |
+
'd782bda2a4ad2f46f68d9f8f32084f2c' => $baseDir . '/src/Plugin/legacy.php',
|
12 |
);
|