Premium Addons for Elementor - Version 2.8.8

Version Description

  • Tweak: Vertical Scroll JS separated from the main JS file to enhance plugin performance.
  • Fixed: Prevent page body scroll when modal is opened on mobile phones in Premium Modal Box widget.
Download this release

Release Info

Developer leap13
Plugin Icon 128x128 Premium Addons for Elementor
Version 2.8.8
Comparing to
See all releases

Code changes from version 2.8.7 to 2.8.8

admin/settings/version-control.php CHANGED
@@ -79,7 +79,7 @@ class PA_Version_Control {
79
<tr class="pa-roll-row">
80
<th>Rollback Version</th>
81
<td>
82
- <div><?php echo sprintf( '<a target="_blank" href="%s" class="button pa-btn pa-rollback-button elementor-button-spinner">Reinstall Version 2.8.6</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ) ); ?> </div>
83
<p class="pa-roll-desc"><span>Warning: Please backup your database before making the rollback.</span></p>
84
</td>
85
</tr>
79
<tr class="pa-roll-row">
80
<th>Rollback Version</th>
81
<td>
82
+ <div><?php echo sprintf( '<a target="_blank" href="%s" class="button pa-btn pa-rollback-button elementor-button-spinner">Reinstall Version 2.8.7</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ) ); ?> </div>
83
<p class="pa-roll-desc"><span>Warning: Please backup your database before making the rollback.</span></p>
84
</td>
85
</tr>
assets/js/lib/modal.js CHANGED
@@ -1 +1 @@
1
- if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||e[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),function(t){"use strict";var e=function(e,i){this.options=i,this.$body=t(document.body),this.$element=t(e),this.$dialog=this.$element.find(".premium-modal-box-modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".premium-modal-box-modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function i(i,o){return this.each(function(){var s=t(this),n=s.data("bs.modal"),r=t.extend({},e.DEFAULTS,s.data(),"object"==typeof i&&i);n||s.data("bs.modal",n=new e(this,r)),"string"==typeof i?n[i](o):r.show&&n.show(o)})}e.VERSION="3.3.7",e.TRANSITION_DURATION=300,e.BACKDROP_TRANSITION_DURATION=150,e.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},e.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},e.prototype.show=function(e){var i=this,o=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(o),this.isShown||o.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("premium-modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="premium-modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){i.$element.one("mouseup.dismiss.bs.modal",function(e){t(e.target).is(i.$element)&&(i.ignoreBackdropClick=!0)})}),this.backdrop(function(){var o=t.support.transition&&i.$element.hasClass("premium-modal-fade");i.$element.parent().length||i.$element.appendTo(i.$body),i.$element.show().scrollTop(0),i.adjustDialog(),o&&i.$element[0].offsetWidth,i.$element.addClass("premium-in"),i.enforceFocus();var s=t.Event("shown.bs.modal",{relatedTarget:e});i.$element.trigger("focus").trigger(s)}))},e.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("premium-in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),this.hideModal())},e.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},e.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},e.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},e.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("premium-modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},e.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},e.prototype.backdrop=function(e){var i=this,o=this.$element.hasClass("premium-modal-fade")?"premium-modal-fade":"";if(this.isShown&&this.options.backdrop){var s=t.support.transition&&o;if(this.$backdrop=t(document.createElement("div")).addClass("premium-modal-backdrop "+o),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("premium-in"),!e)return;e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("premium-in");i.removeBackdrop(),e&&e()}else e&&e()},e.prototype.handleUpdate=function(){this.adjustDialog()},e.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},e.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},e.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},e.prototype.setScrollbar=function(){parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||""},e.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},e.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="premium-modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var o=t.fn.modal;t.fn.modal=i,t.fn.modal.Constructor=e,t.fn.modal.noConflict=function(){return t.fn.modal=o,this};var s,n=0;t(document).on("click.bs.modal.data-api",'[data-toggle="premium-modal"]',function(e){var o=t(this),r=o.attr("href"),a=t(o.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),d=a.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(r)&&r},a.data(),o.data());o.is("a")&&e.preventDefault(),a.one("show.bs.modal",function(e){0===n&&(s=t(this).find("iframe").attr("src")),e.isDefaultPrevented()||a.one("hidden.bs.modal",function(){var e=t(this).find(".premium-video-box-container").data("type");t(this).find("iframe").attr("src",s),"self"===e&&t(this).find("video").get(0).pause(),n++,o.is(":visible")&&o.trigger("focus")})}),i.call(a,d,this)})}(jQuery);
1
+ if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||e[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),function(t){"use strict";var e=function(e,i){this.options=i,this.$body=t(document.body),this.$html=t(document.documentElement),this.$element=t(e),this.$dialog=this.$element.find(".premium-modal-box-modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".premium-modal-box-modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function i(i,o){return this.each(function(){var s=t(this),n=s.data("bs.modal"),r=t.extend({},e.DEFAULTS,s.data(),"object"==typeof i&&i);n||s.data("bs.modal",n=new e(this,r)),"string"==typeof i?n[i](o):r.show&&n.show(o)})}e.VERSION="3.3.7",e.TRANSITION_DURATION=300,e.BACKDROP_TRANSITION_DURATION=150,e.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},e.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},e.prototype.show=function(e){var i=this,o=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(o),this.isShown||o.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("premium-modal-open"),this.$html.addClass("premium-modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="premium-modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){i.$element.one("mouseup.dismiss.bs.modal",function(e){t(e.target).is(i.$element)&&(i.ignoreBackdropClick=!0)})}),this.backdrop(function(){var o=t.support.transition&&i.$element.hasClass("premium-modal-fade");i.$element.parent().length||i.$element.appendTo(i.$body),i.$element.show().scrollTop(0),i.adjustDialog(),o&&i.$element[0].offsetWidth,i.$element.addClass("premium-in"),i.enforceFocus();var s=t.Event("shown.bs.modal",{relatedTarget:e});i.$element.trigger("focus").trigger(s)}))},e.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("premium-in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),this.hideModal())},e.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},e.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},e.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},e.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("premium-modal-open"),t.$html.removeClass("premium-modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},e.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},e.prototype.backdrop=function(e){var i=this,o=this.$element.hasClass("premium-modal-fade")?"premium-modal-fade":"";if(this.isShown&&this.options.backdrop){var s=t.support.transition&&o;if(this.$backdrop=t(document.createElement("div")).addClass("premium-modal-backdrop "+o),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("premium-in"),!e)return;e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("premium-in");i.removeBackdrop(),e&&e()}else e&&e()},e.prototype.handleUpdate=function(){this.adjustDialog()},e.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},e.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},e.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},e.prototype.setScrollbar=function(){parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||""},e.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},e.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="premium-modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var o=t.fn.modal;t.fn.modal=i,t.fn.modal.Constructor=e,t.fn.modal.noConflict=function(){return t.fn.modal=o,this};var s,n=0;t(document).on("click.bs.modal.data-api",'[data-toggle="premium-modal"]',function(e){var o=t(this),r=o.attr("href"),a=t(o.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),d=a.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(r)&&r},a.data(),o.data());o.is("a")&&e.preventDefault(),a.one("show.bs.modal",function(e){0===n&&(s=t(this).find("iframe").attr("src")),e.isDefaultPrevented()||a.one("hidden.bs.modal",function(){var e=t(this).find(".premium-video-box-container").data("type");t(this).find("iframe").attr("src",s),"self"===e&&t(this).find("video").get(0).pause(),n++,o.is(":visible")&&o.trigger("focus")})}),i.call(a,d,this)})}(jQuery);
assets/js/premium-addons.js CHANGED
@@ -1,837 +1,572 @@
1
- (function($){
2
- //Premium Progress Bar Handler
3
- var PremiumProgressBarWidgetHandler = function ($scope,$){
4
- var progressbarElement = $scope.find('.premium-progressbar-progress-bar').each(function(){
5
-
6
- var settings = $(this).data('settings'),
7
- length = settings['progress_length'],
8
- speed = settings['speed'];
9
-
10
- $(this).animate({width: length + '%'} , speed);
11
});
12
- };
13
- //Premium Progress Bar on Scroll Handler
14
- var PremiumProgressBarScrollWidgetHandler = function ($scope,$){
15
- elementorFrontend.waypoint($scope, function (direction) {
16
- PremiumProgressBarWidgetHandler($(this), $);
17
- }, {
18
- offset: $.waypoints('viewportHeight') - 150,
19
- triggerOnce: true
20
- });
21
- };
22
- //Premium Video Box Handler
23
- var PremiumVideoBoxWidgetHandler = function($scope,$){
24
- var videoBoxElement = $scope.find('.premium-video-box-container'),
25
- type = videoBoxElement.data('type'),
26
- video,
27
- vidSrc,
28
- checkRel;
29
- videoBoxElement.on( "click", function(){
30
- $( this ).children( ".premium-video-box-video-container" ).css(
31
- {
32
- 'opacity': '1',
33
- 'visibility': 'visible'
34
- } );
35
- setTimeout(function(){
36
- video = videoBoxElement.find("iframe, video");
37
- vidSrc = video.attr('src');
38
- if('self' === type) {
39
- $(video).get(0).play();
40
- }
41
- checkRel = vidSrc.indexOf('rel=0');
42
- // if( -1 !== checkRel ) {
43
- // videoBoxElement.find("iframe").attr('src', videoBoxElement.find("iframe").attr('src') + '&autoplay=1');
44
- // } else {
45
- videoBoxElement.find("iframe").attr('src', videoBoxElement.find("iframe").attr('src') + '&autoplay=1');
46
- // }
47
- },600);
48
- });
49
- };
50
- //Premium Grid Handler
51
- var PremiumGridWidgetHandler = function($scope,$){
52
- if ($().isotope === undefined) {
53
- return;
54
}
55
- var gridElement = $scope.find('.premium-img-gallery');
56
- if (gridElement.length === 0) {
57
- return;
58
}
59
- var htmlContent = $scope.find('.premium-gallery-container');
60
- var isotopeOptions = htmlContent.data('settings');
61
- if(isotopeOptions['img_size'] === 'original'){
62
- htmlContent.isotope({
63
- // options
64
- itemSelector: '.premium-gallery-item',
65
- percentPosition: true,
66
- animationOptions: {
67
- duration: 750,
68
- easing: 'linear',
69
- queue: false
70
- }
71
- });
72
- htmlContent.imagesLoaded(function () {
73
- setTimeout(function(){
74
- htmlContent.isotope({
75
- layoutMode: 'masonry',
76
- filter: isotopeOptions['active_cat']
77
- });
78
- }, 1000);
79
-
80
- });
81
- } else if(isotopeOptions['img_size'] === 'one_size'){
82
-
83
- htmlContent.isotope({
84
- // options
85
- itemSelector: '.premium-gallery-item',
86
- percentPosition: true,
87
- animationOptions: {
88
- duration: 750,
89
- easing: 'linear',
90
- queue: false
91
- }
92
- });
93
- setTimeout(function() {
94
- htmlContent.isotope({
95
- layoutMode: 'fitRows',
96
- filter: isotopeOptions['active_cat']
97
- });
98
- }, 1000);
99
- // htmlContent.isotope({layoutMode: 'fitRows'});
100
- $(window).on('load', function(){
101
- setTimeout(function() {
102
- htmlContent.isotope({
103
- layoutMode: 'fitRows',
104
- filter: isotopeOptions['active_cat']
105
- });
106
- }, 1000);
107
- });
108
}
109
110
- $scope.find('.premium-gallery-cats-container li a').click(function(e){
111
- e.preventDefault();
112
- $scope.find('.premium-gallery-cats-container li .active').removeClass('active');
113
- $(this).addClass('active');
114
- var selector = $(this).attr('data-filter');
115
- console.log(selector);
116
- htmlContent.isotope({filter: selector});
117
- return false;
118
});
119
- $(".premium-img-gallery a[data-rel^='prettyPhoto']").prettyPhoto({
120
- theme: 'pp_default',
121
- hook: 'data-rel',
122
- opacity: 0.7,
123
- show_title: false,
124
- deeplinking: false,
125
- overlay_gallery: false,
126
- custom_markup: '',
127
- default_width: 900,
128
- default_height: 506,
129
- social_tools: ''
130
});
131
- };
132
- //Premium Counter Handler
133
- var PremiumCounterHandler = function($scope,$){
134
- var counterElement = $scope.find('.premium-counter').each(function(){
135
- var counterSettings = $(this).data('settings');
136
-
137
- var counter_offset = $(this).offset().top;
138
- var counter = new CountUp(
139
- 'counter-' + counterSettings['id'],
140
- 0,
141
- counterSettings['value'],
142
- counterSettings['d_after'],
143
- counterSettings['speed'],
144
- {
145
- useEasing: true,
146
- separator: counterSettings['separator'],
147
- decimal: counterSettings['decimal']
148
}
149
- );
150
- if(counter_offset < $(window).outerHeight() - 150) {
151
- counter.start();
152
- }
153
- function start_counter(){
154
- if($(window).scrollTop() > counter_offset - 600 ) {
155
- counter.start();
156
}
157
}
158
- function isScrolledIntoView(elem) {
159
- var docViewTop = $(window).scrollTop();
160
- var docViewBottom = docViewTop + $(window).height();
161
- var elemTop = elem.offset().top;
162
- var elemBottom = elemTop + elem.height();
163
- return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
164
- }
165
- function addAnimation() {
166
- $('.premium-counter-init').each( function() {
167
- var $this = $(this),
168
- parentId = $this.parents('.premium-counter-area').attr('id'),
169
- iconClass = $('#' + parentId ).find('.icon'),
170
- animation = iconClass.data('animation');
171
- if( iconClass.length ) {
172
- if( isScrolledIntoView( iconClass ) ) {
173
- if( ! iconClass.hasClass('animated') ) {
174
- $('#' + parentId ).find('.icon').addClass('animated ' + animation );
175
- }
176
- }
177
- }
178
- });
179
- }
180
- addAnimation();
181
- $(document).ready(function(){
182
- $(window).on('scroll', function() {
183
- addAnimation();
184
- start_counter();
185
- });
186
- });
187
- });
188
- };
189
- //Premium Fancy Text Handler
190
- var PremiumFancyTextHandler = function($scope,$){
191
- var fancyTextElement = $scope.find('.premium-fancy-text-wrapper');
192
- var fancyTextSettings = fancyTextElement.data('settings');
193
- function escapeHtml(unsafe) {
194
- return unsafe
195
- .replace(/&/g, "&amp;")
196
- .replace(/</g, "&lt;")
197
- .replace(/>/g, "&gt;")
198
- .replace(/"/g, "&quot;")
199
- .replace(/'/g, "&#039;");
200
}
201
- if(fancyTextSettings['effect'] === 'typing'){
202
- var fancyStrings = [];
203
- fancyTextSettings['strings'].forEach(function(item){
204
- fancyStrings.push(escapeHtml(item));
205
- });
206
- fancyTextElement.find('.premium-fancy-text').typed( {
207
- strings: fancyStrings,
208
- typeSpeed: fancyTextSettings['typeSpeed'],
209
- backSpeed: fancyTextSettings['backSpeed'],
210
- startDelay:fancyTextSettings['startDelay'],
211
- backDelay: fancyTextSettings['backDelay'],
212
- showCursor:fancyTextSettings['showCursor'],
213
- cursorChar:fancyTextSettings['cursorChar'],
214
- loop: fancyTextSettings['loop']
215
- } );
216
- } else {
217
- fancyTextElement.find('.premium-fancy-text').vTicker( {
218
- speed: fancyTextSettings['speed'],
219
- showItems: fancyTextSettings['showItems'],
220
- pause: fancyTextSettings['pause'],
221
- mousePause : fancyTextSettings['mousePause'],
222
- direction: "up"
223
- });
224
}
225
- };
226
- //Premium Countdown Handler
227
- var PremiumCountDownHandler = function ($scope,$){
228
- var countDownElement = $scope.find('.premium-countdown').each(function(){
229
- var countDownSettings = $(this).data('settings');
230
- var label1 = countDownSettings['label1'],
231
- label2 = countDownSettings['label2'],
232
- newLabe1 = label1.split(','),
233
- newLabe2 = label2.split(',');
234
- if(countDownSettings['event'] === 'onExpiry'){
235
- $(this).find('.premium-countdown-init').pre_countdown({
236
- labels : newLabe2,
237
- labels1 : newLabe1,
238
- until : new Date( countDownSettings['until'] ),
239
- format : countDownSettings['format'],
240
- padZeroes : true,
241
- onExpiry : function() {
242
- $(this).html(countDownSettings['text']);
243
- },
244
- serverSync : function() { return new Date(countDownSettings['serverSync']); }
245
- });
246
- } else if(countDownSettings['event'] === 'expiryUrl') {
247
- $(this).find('.premium-countdown-init').pre_countdown({
248
- labels : newLabe2,
249
- labels1 : newLabe1,
250
- until : new Date( countDownSettings['until'] ),
251
- format : countDownSettings['format'],
252
- padZeroes : true,
253
- expiryUrl : countDownSettings['text'],
254
- serverSync : function() { return new Date(countDownSettings['serverSync']); }
255
- });
256
- }
257
- times = $(this).find('.premium-countdown-init').pre_countdown('getTimes');
258
- function runTimer( el ) {
259
- return el == 0;
260
- }
261
- if( times.every( runTimer ) ) {
262
- if( countDownSettings['event'] === 'onExpiry' ){
263
- $(this).find('.premium-countdown-init').html(countDownSettings['text']);
264
- }
265
- if( countDownSettings['event'] === 'expiryUrl' ){
266
- var editMode = $('body').find('#elementor').length;
267
- if( editMode > 0 ) {
268
- $(this).find('.premium-countdown-init').html( '<h1>You can not redirect url from elementor Editor!!</h1>' );
269
- } else {
270
- window.location.href = countDownSettings['text'];
271
- }
272
- }
273
- }
274
});
275
- };
276
- //Premium Carousel Handler
277
- var PremiumCarouselHandler = function ($scope,$){
278
- var carouselElement = $scope.find('.premium-carousel-wrapper').each(function(){
279
- var carouselSettings = $(this).data('settings');
280
- function slideToShow( slick ) {
281
- slidesToShow = slick.options.slidesToShow;
282
-
283
- windowWidth = jQuery( window ).width();
284
- if ( windowWidth < 1025 ) {
285
- slidesToShow = carouselSettings['slidesDesk'];
286
}
287
- if ( windowWidth < 769 ) {
288
- slidesToShow = carouselSettings['slidesTab'];
289
}
290
- if ( windowWidth < 481 ) {
291
- slidesToShow = carouselSettings['slidesMob'];
292
}
293
- return slidesToShow;
294
}
295
- $(this).on('init', function (event, slick ) {
296
- event.preventDefault();
297
- $(this).find('item-wrapper.slick-active').each(function (index, el) {
298
- $this = $(this);
299
- $this.addClass($this.data('animation'));
300
- });
301
- $('.slick-track').addClass('translate');
302
- });
303
- $(this).find('.premium-carousel-inner').slick({
304
- vertical : carouselSettings['vertical'],
305
- slidesToScroll : carouselSettings['slidesToScroll'],
306
- slidesToShow : carouselSettings['slidesToShow'],
307
- responsive : [{breakpoint: 1025,settings: {slidesToShow: carouselSettings['slidesDesk'],slidesToScroll: carouselSettings['slidesToScroll']}},{breakpoint: 769,settings: {slidesToShow: carouselSettings['slidesTab'],slidesToScroll: carouselSettings['slidesTab']}},{breakpoint: 481,settings: {slidesToShow: carouselSettings['slidesMob'],slidesToScroll: carouselSettings['slidesMob']}}],
308
- infinite : carouselSettings['infinite'],
309
- speed : carouselSettings['speed'],
310
- autoplay : carouselSettings['autoplay'],
311
- autoplaySpeed : carouselSettings['autoplaySpeed'],
312
- draggable : carouselSettings['draggable'],
313
- touchMove : carouselSettings['touchMove'],
314
- rtl : carouselSettings['rtl'],
315
- useTransform : false,
316
- adaptiveHeight : carouselSettings['adaptiveHeight'],
317
- pauseOnHover : carouselSettings['pauseOnHover'],
318
- centerMode : carouselSettings['centerMode'],
319
- centerPadding : carouselSettings['centerPadding'],
320
- arrows : carouselSettings['arrows'],
321
- nextArrow : carouselSettings['nextArrow'],
322
- prevArrow : carouselSettings['prevArrow'],
323
- dots : carouselSettings['dots'],
324
- customPaging : function(slider, i) {return '<i class="' + carouselSettings['customPaging'] + '"></i>';}
325
- });
326
- $(this).on('afterChange', function (event, slick, currentSlide, nextSlide) {
327
- slidesScrolled = slick.options.slidesToScroll;
328
- slidesToShow = slideToShow( slick );
329
- centerMode = slick.options.centerMode;
330
- $currentParent = slick.$slider[0].parentElement.id;
331
- slideToAnimate = currentSlide + slidesToShow - 1;
332
- if (slidesScrolled == 1) {
333
- if ( centerMode == true ) {
334
- animate = slideToAnimate - 2;
335
- $inViewPort = $( '#' + $currentParent + " [data-slick-index='" + animate + "']");
336
- $inViewPort.addClass($inViewPort.data('animation'));
337
- } else {
338
- $inViewPort = $( '#' + $currentParent + " [data-slick-index='" + slideToAnimate + "']");
339
- $inViewPort.addClass($inViewPort.data('animation'));
340
- }
341
- } else {
342
- for (var i = slidesScrolled + currentSlide; i >= 0; i--) {
343
- $inViewPort = $( '#' + $currentParent + " [data-slick-index='" + i + "']");
344
- $inViewPort.addClass($inViewPort.data('animation'));
345
- }
346
- }
347
- });
348
- $(this).on('beforeChange', function (event, slick, currentSlide) {
349
- $inViewPort = $("[data-slick-index='" + currentSlide + "']");
350
- $inViewPort.siblings().removeClass($inViewPort.data('animation'));
351
- });
352
- if( carouselSettings['vertical']) {
353
- var maxHeight = -1;
354
- $('.slick-slide').each(function() {
355
- if ($(this).height() > maxHeight) {
356
- maxHeight = $(this).height();
357
- }
358
- });
359
- $('.slick-slide').each(function() {
360
- if ($(this).height() < maxHeight) {
361
- $(this).css('margin', Math.ceil((maxHeight-$(this).height())/2) + 'px 0');
362
- }
363
- });
364
- }
365
- var marginFix = {
366
- element : $('a.ver-carousel-arrow'),
367
- getWidth : function() {
368
- var width = this.element.outerWidth();
369
- return width / 2;
370
- },
371
- setWidth : function( type ) {
372
- type = type || 'vertical';
373
- if( type == 'vertical' ) {
374
- this.element.css( 'margin-left', '-' + this.getWidth() + 'px' );
375
- } else {
376
- this.element.css( 'margin-top', '-' + this.getWidth() + 'px' );
377
- }
378
-
379
- }
380
- }
381
- marginFix.setWidth();
382
- marginFix.element = $('a.carousel-arrow');
383
- marginFix.setWidth('horizontal');
384
- });
385
- };
386
- //Premium Banner Handler
387
- var PremiumBannerHandler = function ($scope,$){
388
- var bannerElement = $scope.find('.premium_banner');
389
- bannerElement.find('.premium_addons-banner-ib').hover(
390
- function() {
391
- $(this).find('.premium_addons-banner-ib-img').addClass('active');
392
- },
393
- function() {
394
- $(this).find('.premium_addons-banner-ib-img').removeClass('active');
395
- });
396
- };
397
- //Premium Modal Box Handler
398
- var PremiumModalBoxHandler = function ($scope,$){
399
- var modalBoxElement = $scope.find('.premium-modal-box-container'),
400
- modalBoxSettings = modalBoxElement.data('settings');
401
-
402
- if(modalBoxElement.length > 0) {
403
- if(modalBoxSettings['trigger'] === 'pageload'){
404
- $(document).ready(function($){
405
- setTimeout( function(){
406
- modalBoxElement.find('.premium-modal-box-modal').modal();
407
- }, modalBoxSettings['delay'] * 1000);
408
- });
409
}
410
- }
411
- };
412
- //Premium Blog Handler
413
- var PremiumBlogHandler = function ($scope,$){
414
- var blogElement = $scope.find('.premium-blog-wrap'),
415
- masonryBlog = blogElement.data('pa-masonry');
416
- if ( masonryBlog ) {
417
- blogElement.imagesLoaded(function(){
418
- blogElement.isotope({
419
- itemSelector: '.premium-blog-post-container',
420
- percentPosition: true,
421
- animationOptions: {
422
- duration: 750,
423
- easing: 'linear',
424
- queue: false
425
- }
426
- });
427
- });
428
}
429
- };
430
-
431
- //Premium Vertical Scroll Handler
432
- var PremiumVerticalScrollHandler = function($scope,$){
433
-
434
- var vScrollElem = $scope.find('.premium-vscroll-wrap'),
435
- instance = null,
436
- vScrollSettings = vScrollElem.data('settings');
437
-
438
- instance = new premiumVerticalScroll( vScrollElem, vScrollSettings );
439
- instance.init();
440
-
441
- };
442
-
443
- window.premiumVerticalScroll = function( $selector, settings ) {
444
- var self = this,
445
- $window = $( window ),
446
- $instance = $selector,
447
- checkTemps = $selector.find('.premium-vscroll-sections-wrap').length,
448
- $htmlBody = $( 'html, body' ),
449
- $itemsList = $( '.premium-vscroll-dot-item', $instance ),
450
- $menuItems = $( '.premium-vscroll-nav-item', $instance ),
451
- sectionList = [],
452
- defaultSettings = {
453
- speed: 700,
454
- offset: 1,
455
- fullSection: true
456
- },
457
- settings = $.extend( {}, defaultSettings, settings ),
458
- sections = {},
459
- currentSection = null,
460
- isScrolling = false;
461
-
462
- jQuery.extend( jQuery.easing, {
463
- easeInOutCirc: function (x, t, b, c, d) {
464
- if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
465
- return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
466
- }
467
- });
468
-
469
- self.checkNextSection = function( object, key ) {
470
- var keys = Object.keys( object ),
471
- idIndex = keys.indexOf( key ),
472
- nextIndex = idIndex += 1;
473
-
474
- if( nextIndex >= keys.length ) {
475
- return false;
476
- }
477
-
478
- var nextKey = keys[ nextIndex ];
479
-
480
- return nextKey;
481
- };
482
-
483
- self.checkPrevSection = function( object, key ) {
484
- var keys = Object.keys( object ),
485
- idIndex = keys.indexOf( key ),
486
- prevIndex = idIndex -= 1;
487
-
488
- if ( 0 > idIndex ) {
489
- return false;
490
- }
491
-
492
- var prevKey = keys[ prevIndex ];
493
-
494
- return prevKey;
495
- };
496
-
497
- self.debounce = function( threshold, callback ) {
498
- var timeout;
499
-
500
- return function debounced( $event ) {
501
- function delayed() {
502
- callback.call( this, $event );
503
- timeout = null;
504
- }
505
-
506
- if ( timeout ) {
507
- clearTimeout( timeout );
508
- }
509
-
510
- timeout = setTimeout( delayed, threshold );
511
- };
512
- };
513
-
514
- self.init = function() {
515
- self.setSectionsData();
516
- $itemsList.on( 'click.premiumVerticalScroll', self.onNavDotChange );
517
- $menuItems.on( 'click.premiumVerticalScroll', self.onNavDotChange );
518
-
519
-
520
- $itemsList.on( 'mouseenter.premiumVerticalScroll', self.onNavDotEnter );
521
-
522
- $itemsList.on( 'mouseleave.premiumVerticalScroll', self.onNavDotLeave );
523
-
524
- $window.on( 'scroll.premiumVerticalScroll', self.onWheel );
525
- $window.on( 'resize.premiumVerticalScroll orientationchange.premiumVerticalScroll', self.debounce( 50, self.onResize ) );
526
- $window.on( 'load', function() { self.setSectionsData(); } );
527
-
528
- $( document ).keydown( function( event ) {
529
-
530
- if ( 38 == event.keyCode ) {
531
- self.onKeyUp( event, 'up' );
532
- }
533
-
534
- if ( 40 == event.keyCode ) {
535
- self.onKeyUp( event, 'down' );
536
- }
537
- } );
538
- if ( settings.fullSection ) {
539
- var vSection = document.getElementById($instance.attr('id'));
540
- if( checkTemps ){
541
- document.addEventListener?(vSection.addEventListener("wheel",self.onWheel,!1)):vSection.attachEvent("onmousewheel",self.onWheel);
542
- } else {
543
- document.addEventListener?(document.addEventListener("wheel",self.onWheel,!1)):document.attachEvent("onmousewheel",self.onWheel);
544
- }
545
- }
546
-
547
- for ( var section in sections ) {
548
-
549
- var $section = sections[section].selector;
550
- elementorFrontend.waypoint( $section, function( direction ) {
551
- var $this = $( this ),
552
- sectionId = $this.attr( 'id' );
553
- if ( 'down' === direction && ! isScrolling ) {
554
- currentSection = sectionId;
555
- $itemsList.removeClass( 'active' );
556
- $menuItems.removeClass( 'active' );
557
- $( '[data-menuanchor=' + sectionId + ']', $instance ).addClass( 'active' );
558
- }
559
- }, {
560
- offset: '95%',
561
- triggerOnce: false
562
- } );
563
-
564
- elementorFrontend.waypoint( $section, function( direction ) {
565
- var $this = $( this ),
566
- sectionId = $this.attr( 'id' );
567
- if ( 'up' === direction && ! isScrolling ) {
568
- currentSection = sectionId;
569
- $itemsList.removeClass( 'active' );
570
- $menuItems.removeClass( 'active' );
571
- $( '[data-menuanchor=' + sectionId + ']', $instance ).addClass( 'active' );
572
- }
573
- }, {
574
- offset: '0%',
575
- triggerOnce: false
576
- } );
577
- }
578
- };
579
-
580
- self.setSectionsData = function() {
581
- $itemsList.each( function() {
582
- var $this = $( this ),
583
- sectionId = $this.data('menuanchor'),
584
- $section = $( '#' + sectionId );
585
- if ( $section[0] ) {
586
- sections[ sectionId ] = {
587
- selector: $section,
588
- offset: Math.round( $section.offset().top ),
589
- height: $section.outerHeight()
590
- };
591
- }
592
- } );
593
- };
594
-
595
- self.onNavDotEnter = function() {
596
- var $this = $( this ),
597
- index = $this.data("index");
598
- if( settings.tooltips ) {
599
- $('<div class="premium-vscroll-tooltip"><span>' + settings.dotsText[index] + "</span></div>").hide().appendTo($this).fadeIn(200);
600
- }
601
- };
602
-
603
- self.onNavDotLeave = function() {
604
- $(".premium-vscroll-tooltip").fadeOut(200, function() {
605
- $(this).remove();
606
- });
607
- };
608
-
609
- self.onNavDotChange = function( event ) {
610
- var $this = $( this ),
611
- index = $this.index(),
612
- sectionId = $this.data('menuanchor'),
613
- offset = null;
614
-
615
- if ( ! sections.hasOwnProperty( sectionId ) ) {
616
- return false;
617
- }
618
-
619
- offset = sections[sectionId].offset - settings.offset;
620
-
621
- if ( ! isScrolling ) {
622
- isScrolling = true;
623
- // window.history.pushState( null, null, '#' + sectionId );
624
- currentSection = sectionId;
625
- $menuItems.removeClass('active');
626
- $itemsList.removeClass( 'active' );
627
-
628
- if($this.hasClass("premium-vscroll-nav-item")) {
629
- $($itemsList[index]).addClass('active');
630
- } else {
631
- $($menuItems[index]).addClass('active');
632
- }
633
-
634
- $this.addClass( 'active' );
635
-
636
- $htmlBody.stop().clearQueue().animate( { 'scrollTop': offset }, settings.speed, 'easeInOutCirc', function() {
637
- isScrolling = false;
638
- } );
639
- }
640
- };
641
-
642
- self.onKeyUp = function( event, direction ) {
643
- var direction = direction || 'up',
644
- sectionId,
645
- nextItem = $( '.premium-vscroll-dot-item[data-menuanchor=' + currentSection + ']', $instance ).next(),
646
- prevItem = $( '.premium-vscroll-dot-item[data-menuanchor=' + currentSection + ']', $instance ).prev();
647
-
648
- event.preventDefault();
649
-
650
- if ( isScrolling ) {
651
- return false;
652
- }
653
-
654
- if ( 'up' === direction ) {
655
- if ( prevItem[0] ) {
656
- prevItem.trigger( 'click.premiumVerticalScroll' );
657
- }
658
- }
659
-
660
- if ( 'down' === direction ) {
661
- if ( nextItem[0] ) {
662
- nextItem.trigger( 'click.premiumVerticalScroll' );
663
- }
664
- }
665
- };
666
-
667
- self.onScroll = function( event ) {
668
- /* On Scroll Event */
669
- if ( isScrolling ) {
670
- event.preventDefault();
671
- }
672
- };
673
-
674
- function getFirstSection( object ) {
675
- return Object.keys( object )[0];
676
- };
677
-
678
- function getLastSection( object ) {
679
- return Object.keys( object )[ Object.keys( object ).length - 1 ];
680
- };
681
-
682
- function getDirection(e){
683
- e = window.event || e;
684
- var t = Math.max( -1, Math.min( 1, ( e.wheelDelta || -e.deltaY || -e.detail ) ) );
685
- return t;
686
}
687
-
688
- self.onWheel = function( event ) {
689
- if ( isScrolling ) {
690
- event.preventDefault();
691
- return false;
692
- }
693
-
694
- var $target = $( event.target ),
695
- sectionSelector = checkTemps ? '.premium-vscroll-temp' : '.elementor-top-section',
696
- $section = $target.closest( sectionSelector ),
697
- $vTarget = $instance.visible(true,false,'vertical'),
698
- sectionId = $section.attr( 'id' ),
699
- offset = 0,
700
- newSectionId = false,
701
- prevSectionId = false,
702
- nextSectionId = false,
703
- delta = getDirection(event),
704
- direction = ( 0 > delta ) ? 'down' : 'up',
705
- windowScrollTop = $window.scrollTop(),
706
- deviceType = $( 'body' ).data('elementor-device-mode'),
707
- dotIndex = $('.premium-vscroll-dot-item.active').index();
708
- if('mobile' === deviceType || 'tablet' === deviceType ) {
709
- $(".premium-vscroll-tooltip").hide();
710
- if( dotIndex === $itemsList.length - 1 && ! $vTarget ) {
711
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass('premium-vscroll-dots-hide');
712
- } else if( dotIndex === 0 && ! $vTarget ) {
713
- if( $instance.offset().top - $(document).scrollTop() > 200 ) {
714
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass('premium-vscroll-dots-hide');
715
- }
716
- } else {
717
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").removeClass('premium-vscroll-dots-hide');
718
- }
719
-
720
- }
721
-
722
- if ( beforeCheck() ) {
723
- sectionId = getFirstSection( sections );
724
- }
725
-
726
- if ( afterCheck() ) {
727
- sectionId = getLastSection( sections );
728
- }
729
- if ( sectionId && sections.hasOwnProperty( sectionId ) ) {
730
- prevSectionId = self.checkPrevSection( sections, sectionId );
731
- nextSectionId = self.checkNextSection( sections, sectionId );
732
- if ( 'up' === direction ) {
733
- if ( ! nextSectionId && sections[sectionId].offset < windowScrollTop ) {
734
- newSectionId = sectionId;
735
- } else {
736
- newSectionId = prevSectionId;
737
- }
738
- }
739
-
740
- if ( 'down' === direction ) {
741
- if ( ! prevSectionId && sections[sectionId].offset > windowScrollTop + 5 ) {
742
- newSectionId = sectionId;
743
- } else {
744
- newSectionId = nextSectionId;
745
- }
746
- }
747
-
748
- if ( newSectionId ) {
749
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").removeClass('premium-vscroll-dots-hide');
750
- event.preventDefault();
751
- offset = sections[newSectionId].offset - settings.offset;
752
- currentSection = newSectionId;
753
- $itemsList.removeClass( 'active' );
754
- $menuItems.removeClass( 'active' );
755
- $( '[data-menuanchor=' + newSectionId + ']', $instance ).addClass( 'active' );
756
-
757
- isScrolling = true;
758
- self.scrollStop();
759
- $htmlBody.animate( { 'scrollTop': offset }, settings.speed, 'easeInOutCirc', function() {
760
- isScrolling = false;
761
- } );
762
- } else {
763
- var $lastselector = checkTemps ? $instance : $('#' + sectionId);
764
- if('down' === direction ) {
765
- if( ( $lastselector.offset().top + $lastselector.innerHeight() ) - $(document).scrollTop() > 600 ) {
766
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass('premium-vscroll-dots-hide');
767
- }
768
- } else if('up' === direction) {
769
- if( $lastselector.offset().top - $(document).scrollTop() > 200 ) {
770
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass('premium-vscroll-dots-hide');
771
- }
772
- }
773
- }
774
- }
775
-
776
- };
777
-
778
- function beforeCheck ( event ) {
779
- var windowScrollTop = $window.scrollTop(),
780
- firstSectionId = getFirstSection( sections ),
781
- offset = sections[ firstSectionId ].offset,
782
- topBorder = windowScrollTop + $window.outerHeight(),
783
- visible = $instance.visible(true,false,'vertical');
784
-
785
- if ( topBorder > offset ) {
786
- return false;
787
- } else if( visible ) {
788
- return true;
789
- }
790
- return false;
791
- };
792
-
793
- function afterCheck( event ) {
794
- var windowScrollTop = $window.scrollTop(),
795
- lastSectionId = getLastSection( sections ),
796
- offset = sections[ lastSectionId ].offset,
797
- bottomBorder = sections[ lastSectionId ].offset + sections[ lastSectionId ].height,
798
- visible = $instance.visible(true,false,'vertical');
799
-
800
- if ( windowScrollTop < bottomBorder ) {
801
- return false;
802
- } else if ( visible ) {
803
- return true;
804
- }
805
-
806
- return false;
807
- };
808
-
809
- self.onResize = function( event ) {
810
- self.setSectionsData();
811
- };
812
-
813
- self.scrollStop = function() {
814
- $htmlBody.stop( true );
815
- };
816
-
817
- };
818
-
819
- //Elementor JS Hooks
820
- $(window).on('elementor/frontend/init', function () {
821
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-video-box.default',PremiumVideoBoxWidgetHandler);
822
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-img-gallery.default',PremiumGridWidgetHandler);
823
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-fancy-text.default',PremiumFancyTextHandler);
824
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-counter.default',PremiumCounterHandler);
825
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-countdown-timer.default',PremiumCountDownHandler);
826
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-carousel-widget.default',PremiumCarouselHandler);
827
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-banner.default',PremiumBannerHandler);
828
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-modal-box.default',PremiumModalBoxHandler);
829
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-blog.default',PremiumBlogHandler);
830
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-vscroll.default',PremiumVerticalScrollHandler);
831
- if(elementorFrontend.isEditMode()){
832
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-progressbar.default', PremiumProgressBarWidgetHandler);
833
- } else {
834
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-progressbar.default', PremiumProgressBarScrollWidgetHandler);
835
}
836
- });
837
- })(jQuery);
1
+ (function($) {
2
+ /****** Premium Progress Bar Handler ******/
3
+ var PremiumProgressBarWidgetHandler = function($scope, $) {
4
+ var progressbarElement = $scope
5
+ .find(".premium-progressbar-progress-bar")
6
+ .each(function() {
7
+ var settings = $(this).data("settings"),
8
+ length = settings["progress_length"],
9
+ speed = settings["speed"];
10
+
11
+ $(this).animate({ width: length + "%" }, speed);
12
+ });
13
+ };
14
+
15
+ /****** Premium Progress Bar Scroll Handler *****/
16
+ var PremiumProgressBarScrollWidgetHandler = function($scope, $) {
17
+ elementorFrontend.waypoint(
18
+ $scope,
19
+ function(direction) {
20
+ PremiumProgressBarWidgetHandler($(this), $);
21
+ },
22
+ {
23
+ offset: $.waypoints("viewportHeight") - 150,
24
+ triggerOnce: true
25
+ }
26
+ );
27
+ };
28
+
29
+ /****** Premium Video Box Handler ******/
30
+ var PremiumVideoBoxWidgetHandler = function($scope, $) {
31
+ var videoBoxElement = $scope.find(".premium-video-box-container"),
32
+ type = videoBoxElement.data("type"),
33
+ video,
34
+ vidSrc,
35
+ checkRel;
36
+ videoBoxElement.on("click", function() {
37
+ $(this)
38
+ .children(".premium-video-box-video-container")
39
+ .css({
40
+ opacity: "1",
41
+ visibility: "visible"
42
});
43
+ setTimeout(function() {
44
+ video = videoBoxElement.find("iframe, video");
45
+ vidSrc = video.attr("src");
46
+ if ("self" === type) {
47
+ $(video)
48
+ .get(0)
49
+ .play();
50
}
51
+ checkRel = vidSrc.indexOf("rel=0");
52
+
53
+ videoBoxElement
54
+ .find("iframe")
55
+ .attr(
56
+ "src",
57
+ videoBoxElement.find("iframe").attr("src") + "&autoplay=1"
58
+ );
59
+ }, 600);
60
+ });
61
+ };
62
+
63
+ /****** Premium Grid Handler ******/
64
+ var PremiumGridWidgetHandler = function($scope, $) {
65
+ if ($().isotope === undefined) {
66
+ return;
67
+ }
68
+ var gridElement = $scope.find(".premium-img-gallery");
69
+ if (gridElement.length === 0) {
70
+ return;
71
+ }
72
+ var htmlContent = $scope.find(".premium-gallery-container");
73
+ var isotopeOptions = htmlContent.data("settings");
74
+ if (isotopeOptions["img_size"] === "original") {
75
+ htmlContent.isotope({
76
+ // options
77
+ itemSelector: ".premium-gallery-item",
78
+ percentPosition: true,
79
+ animationOptions: {
80
+ duration: 750,
81
+ easing: "linear",
82
+ queue: false
83
}
84
+ });
85
+ htmlContent.imagesLoaded(function() {
86
+ setTimeout(function() {
87
+ htmlContent.isotope({
88
+ layoutMode: "masonry",
89
+ filter: isotopeOptions["active_cat"]
90
+ });
91
+ }, 1000);
92
+ });
93
+ } else if (isotopeOptions["img_size"] === "one_size") {
94
+ htmlContent.isotope({
95
+ // options
96
+ itemSelector: ".premium-gallery-item",
97
+ percentPosition: true,
98
+ animationOptions: {
99
+ duration: 750,
100
+ easing: "linear",
101
+ queue: false
102
}
103
+ });
104
+ setTimeout(function() {
105
+ htmlContent.isotope({
106
+ layoutMode: "fitRows",
107
+ filter: isotopeOptions["active_cat"]
108
+ });
109
+ }, 1000);
110
+ // htmlContent.isotope({layoutMode: 'fitRows'});
111
+ $(window).on("load", function() {
112
+ setTimeout(function() {
113
+ htmlContent.isotope({
114
+ layoutMode: "fitRows",
115
+ filter: isotopeOptions["active_cat"]
116
+ });
117
+ }, 1000);
118
+ });
119
+ }
120
+
121
+ $scope.find(".premium-gallery-cats-container li a").click(function(e) {
122
+ e.preventDefault();
123
+ $scope
124
+ .find(".premium-gallery-cats-container li .active")
125
+ .removeClass("active");
126
+ $(this).addClass("active");
127
+ var selector = $(this).attr("data-filter");
128
+ console.log(selector);
129
+ htmlContent.isotope({ filter: selector });
130
+ return false;
131
+ });
132
133
+ $(".premium-img-gallery a[data-rel^='prettyPhoto']").prettyPhoto({
134
+ theme: "pp_default",
135
+ hook: "data-rel",
136
+ opacity: 0.7,
137
+ show_title: false,
138
+ deeplinking: false,
139
+ overlay_gallery: false,
140
+ custom_markup: "",
141
+ default_width: 900,
142
+ default_height: 506,
143
+ social_tools: ""
144
+ });
145
+ };
146
+
147
+ /****** Premium Counter Handler ******/
148
+ var PremiumCounterHandler = function($scope, $) {
149
+ var counterElement = $scope.find(".premium-counter").each(function() {
150
+ var counterSettings = $(this).data("settings");
151
+
152
+ var counter_offset = $(this).offset().top;
153
+ var counter = new CountUp(
154
+ "counter-" + counterSettings["id"],
155
+ 0,
156
+ counterSettings["value"],
157
+ counterSettings["d_after"],
158
+ counterSettings["speed"],
159
+ {
160
+ useEasing: true,
161
+ separator: counterSettings["separator"],
162
+ decimal: counterSettings["decimal"]
163
+ }
164
+ );
165
+ if (counter_offset < $(window).outerHeight() - 150) {
166
+ counter.start();
167
+ }
168
+ function start_counter() {
169
+ if ($(window).scrollTop() > counter_offset - 600) {
170
+ counter.start();
171
+ }
172
+ }
173
+ function isScrolledIntoView(elem) {
174
+ var docViewTop = $(window).scrollTop();
175
+ var docViewBottom = docViewTop + $(window).height();
176
+ var elemTop = elem.offset().top;
177
+ var elemBottom = elemTop + elem.height();
178
+ return elemBottom <= docViewBottom && elemTop >= docViewTop;
179
+ }
180
+ function addAnimation() {
181
+ $(".premium-counter-init").each(function() {
182
+ var $this = $(this),
183
+ parentId = $this.parents(".premium-counter-area").attr("id"),
184
+ iconClass = $("#" + parentId).find(".icon"),
185
+ animation = iconClass.data("animation");
186
+ if (iconClass.length) {
187
+ if (isScrolledIntoView(iconClass)) {
188
+ if (!iconClass.hasClass("animated")) {
189
+ $("#" + parentId)
190
+ .find(".icon")
191
+ .addClass("animated " + animation);
192
+ }
193
+ }
194
+ }
195
});
196
+ }
197
+ addAnimation();
198
+ $(document).ready(function() {
199
+ $(window).on("scroll", function() {
200
+ addAnimation();
201
+ start_counter();
202
});
203
+ });
204
+ });
205
+ };
206
+
207
+ /****** Premium Fancy Text Handler ******/
208
+ var PremiumFancyTextHandler = function($scope, $) {
209
+ var fancyTextElement = $scope.find(".premium-fancy-text-wrapper");
210
+ var fancyTextSettings = fancyTextElement.data("settings");
211
+ function escapeHtml(unsafe) {
212
+ return unsafe
213
+ .replace(/&/g, "&amp;")
214
+ .replace(/</g, "&lt;")
215
+ .replace(/>/g, "&gt;")
216
+ .replace(/"/g, "&quot;")
217
+ .replace(/'/g, "&#039;");
218
+ }
219
+ if (fancyTextSettings["effect"] === "typing") {
220
+ var fancyStrings = [];
221
+ fancyTextSettings["strings"].forEach(function(item) {
222
+ fancyStrings.push(escapeHtml(item));
223
+ });
224
+ fancyTextElement.find(".premium-fancy-text").typed({
225
+ strings: fancyStrings,
226
+ typeSpeed: fancyTextSettings["typeSpeed"],
227
+ backSpeed: fancyTextSettings["backSpeed"],
228
+ startDelay: fancyTextSettings["startDelay"],
229
+ backDelay: fancyTextSettings["backDelay"],
230
+ showCursor: fancyTextSettings["showCursor"],
231
+ cursorChar: fancyTextSettings["cursorChar"],
232
+ loop: fancyTextSettings["loop"]
233
+ });
234
+ } else {
235
+ fancyTextElement.find(".premium-fancy-text").vTicker({
236
+ speed: fancyTextSettings["speed"],
237
+ showItems: fancyTextSettings["showItems"],
238
+ pause: fancyTextSettings["pause"],
239
+ mousePause: fancyTextSettings["mousePause"],
240
+ direction: "up"
241
+ });
242
+ }
243
+ };
244
+
245
+ /****** Premium Countdown Handler ******/
246
+ var PremiumCountDownHandler = function($scope, $) {
247
+ var countDownElement = $scope.find(".premium-countdown").each(function() {
248
+ var countDownSettings = $(this).data("settings");
249
+ var label1 = countDownSettings["label1"],
250
+ label2 = countDownSettings["label2"],
251
+ newLabe1 = label1.split(","),
252
+ newLabe2 = label2.split(",");
253
+ if (countDownSettings["event"] === "onExpiry") {
254
+ $(this)
255
+ .find(".premium-countdown-init")
256
+ .pre_countdown({
257
+ labels: newLabe2,
258
+ labels1: newLabe1,
259
+ until: new Date(countDownSettings["until"]),
260
+ format: countDownSettings["format"],
261
+ padZeroes: true,
262
+ onExpiry: function() {
263
+ $(this).html(countDownSettings["text"]);
264
+ },
265
+ serverSync: function() {
266
+ return new Date(countDownSettings["serverSync"]);
267
}
268
+ });
269
+ } else if (countDownSettings["event"] === "expiryUrl") {
270
+ $(this)
271
+ .find(".premium-countdown-init")
272
+ .pre_countdown({
273
+ labels: newLabe2,
274
+ labels1: newLabe1,
275
+ until: new Date(countDownSettings["until"]),
276
+ format: countDownSettings["format"],
277
+ padZeroes: true,
278
+ expiryUrl: countDownSettings["text"],
279
+ serverSync: function() {
280
+ return new Date(countDownSettings["serverSync"]);
281
}
282
+ });
283
+ }
284
+ times = $(this)
285
+ .find(".premium-countdown-init")
286
+ .pre_countdown("getTimes");
287
+ function runTimer(el) {
288
+ return el == 0;
289
+ }
290
+ if (times.every(runTimer)) {
291
+ if (countDownSettings["event"] === "onExpiry") {
292
+ $(this)
293
+ .find(".premium-countdown-init")
294
+ .html(countDownSettings["text"]);
295
}
296
+ if (countDownSettings["event"] === "expiryUrl") {
297
+ var editMode = $("body").find("#elementor").length;
298
+ if (editMode > 0) {
299
+ $(this)
300
+ .find(".premium-countdown-init")
301
+ .html(
302
+ "<h1>You can not redirect url from elementor Editor!!</h1>"
303
+ );
304
+ } else {
305
+ window.location.href = countDownSettings["text"];
306
+ }
307
}
308
+ }
309
+ });
310
+ };
311
+
312
+ /****** Premium Carousel Handler ******/
313
+ var PremiumCarouselHandler = function($scope, $) {
314
+ var carouselElement = $scope
315
+ .find(".premium-carousel-wrapper")
316
+ .each(function() {
317
+ var carouselSettings = $(this).data("settings");
318
+ function slideToShow(slick) {
319
+ slidesToShow = slick.options.slidesToShow;
320
+
321
+ windowWidth = jQuery(window).width();
322
+ if (windowWidth < 1025) {
323
+ slidesToShow = carouselSettings["slidesDesk"];
324
+ }
325
+ if (windowWidth < 769) {
326
+ slidesToShow = carouselSettings["slidesTab"];
327
+ }
328
+ if (windowWidth < 481) {
329
+ slidesToShow = carouselSettings["slidesMob"];
330
+ }
331
+ return slidesToShow;
332
}
333
+ $(this).on("init", function(event, slick) {
334
+ event.preventDefault();
335
+ $(this)
336
+ .find("item-wrapper.slick-active")
337
+ .each(function(index, el) {
338
+ $this = $(this);
339
+ $this.addClass($this.data("animation"));
340
});
341
+ $(".slick-track").addClass("translate");
342
+ });
343
+ $(this)
344
+ .find(".premium-carousel-inner")
345
+ .slick({
346
+ vertical: carouselSettings["vertical"],
347
+ slidesToScroll: carouselSettings["slidesToScroll"],
348
+ slidesToShow: carouselSettings["slidesToShow"],
349
+ responsive: [
350
+ {
351
+ breakpoint: 1025,
352
+ settings: {
353
+ slidesToShow: carouselSettings["slidesDesk"],
354
+ slidesToScroll: carouselSettings["slidesToScroll"]
355
}
356
+ },
357
+ {
358
+ breakpoint: 769,
359
+ settings: {
360
+ slidesToShow: carouselSettings["slidesTab"],
361
+ slidesToScroll: carouselSettings["slidesTab"]
362
}
363
+ },
364
+ {
365
+ breakpoint: 481,
366
+ settings: {
367
+ slidesToShow: carouselSettings["slidesMob"],
368
+ slidesToScroll: carouselSettings["slidesMob"]
369
}
370
+ }
371
+ ],
372
+ infinite: carouselSettings["infinite"],
373
+ speed: carouselSettings["speed"],
374
+ autoplay: carouselSettings["autoplay"],
375
+ autoplaySpeed: carouselSettings["autoplaySpeed"],
376
+ draggable: carouselSettings["draggable"],
377
+ touchMove: carouselSettings["touchMove"],
378
+ rtl: carouselSettings["rtl"],
379
+ useTransform: false,
380
+ adaptiveHeight: carouselSettings["adaptiveHeight"],
381
+ pauseOnHover: carouselSettings["pauseOnHover"],
382
+ centerMode: carouselSettings["centerMode"],
383
+ centerPadding: carouselSettings["centerPadding"],
384
+ arrows: carouselSettings["arrows"],
385
+ nextArrow: carouselSettings["nextArrow"],
386
+ prevArrow: carouselSettings["prevArrow"],
387
+ dots: carouselSettings["dots"],
388
+ customPaging: function(slider, i) {
389
+ return '<i class="' + carouselSettings["customPaging"] + '"></i>';
390
}
391
+ });
392
+ $(this).on("afterChange", function(
393
+ event,
394
+ slick,
395
+ currentSlide,
396
+ nextSlide
397
+ ) {
398
+ slidesScrolled = slick.options.slidesToScroll;
399
+ slidesToShow = slideToShow(slick);
400
+ centerMode = slick.options.centerMode;
401
+ $currentParent = slick.$slider[0].parentElement.id;
402
+ slideToAnimate = currentSlide + slidesToShow - 1;
403
+ if (slidesScrolled == 1) {
404
+ if (centerMode == true) {
405
+ animate = slideToAnimate - 2;
406
+ $inViewPort = $(
407
+ "#" + $currentParent + " [data-slick-index='" + animate + "']"
408
+ );
409
+ $inViewPort.addClass($inViewPort.data("animation"));
410
+ } else {
411
+ $inViewPort = $(
412
+ "#" +
413
+ $currentParent +
414
+ " [data-slick-index='" +
415
+ slideToAnimate +
416
+ "']"
417
+ );
418
+ $inViewPort.addClass($inViewPort.data("animation"));
419
}
420
+ } else {
421
+ for (var i = slidesScrolled + currentSlide; i >= 0; i--) {
422
+ $inViewPort = $(
423
+ "#" + $currentParent + " [data-slick-index='" + i + "']"
424
+ );
425
+ $inViewPort.addClass($inViewPort.data("animation"));
426
}
427
+ }
428
+ });
429
+ $(this).on("beforeChange", function(event, slick, currentSlide) {
430
+ $inViewPort = $("[data-slick-index='" + currentSlide + "']");
431
+ $inViewPort.siblings().removeClass($inViewPort.data("animation"));
432
+ });
433
+ if (carouselSettings["vertical"]) {
434
+ var maxHeight = -1;
435
+ $(".slick-slide").each(function() {
436
+ if ($(this).height() > maxHeight) {
437
+ maxHeight = $(this).height();
438
}
439
+ });
440
+ $(".slick-slide").each(function() {
441
+ if ($(this).height() < maxHeight) {
442
+ $(this).css(
443
+ "margin",
444
+ Math.ceil((maxHeight - $(this).height()) / 2) + "px 0"
445
+ );
446
+ }
447
+ });
448
}
449
+ var marginFix = {
450
+ element: $("a.ver-carousel-arrow"),
451
+ getWidth: function() {
452
+ var width = this.element.outerWidth();
453
+ return width / 2;
454
+ },
455
+ setWidth: function(type) {
456
+ type = type || "vertical";
457
+ if (type == "vertical") {
458
+ this.element.css("margin-left", "-" + this.getWidth() + "px");
459
+ } else {
460
+ this.element.css("margin-top", "-" + this.getWidth() + "px");
461
+ }
462
+ }
463
+ };
464
+ marginFix.setWidth();
465
+ marginFix.element = $("a.carousel-arrow");
466
+ marginFix.setWidth("horizontal");
467
+ });
468
+ };
469
+
470
+ /****** Premium Banner Handler ******/
471
+ var PremiumBannerHandler = function($scope, $) {
472
+ var bannerElement = $scope.find(".premium_banner");
473
+ bannerElement.find(".premium_addons-banner-ib").hover(
474
+ function() {
475
+ $(this)
476
+ .find(".premium_addons-banner-ib-img")
477
+ .addClass("active");
478
+ },
479
+ function() {
480
+ $(this)
481
+ .find(".premium_addons-banner-ib-img")
482
+ .removeClass("active");
483
+ }
484
+ );
485
+ };
486
+
487
+ /****** Premium Modal Box Handler ******/
488
+ var PremiumModalBoxHandler = function($scope, $) {
489
+ var modalBoxElement = $scope.find(".premium-modal-box-container"),
490
+ modalBoxSettings = modalBoxElement.data("settings");
491
+
492
+ if (modalBoxElement.length > 0) {
493
+ if (modalBoxSettings["trigger"] === "pageload") {
494
+ $(document).ready(function($) {
495
+ setTimeout(function() {
496
+ modalBoxElement.find(".premium-modal-box-modal").modal();
497
+ }, modalBoxSettings["delay"] * 1000);
498
+ });
499
+ }
500
+ }
501
+ };
502
+
503
+ /****** Premium Blog Handler ******/
504
+ var PremiumBlogHandler = function($scope, $) {
505
+ var blogElement = $scope.find(".premium-blog-wrap"),
506
+ masonryBlog = blogElement.data("pa-masonry");
507
+ if (masonryBlog) {
508
+ blogElement.imagesLoaded(function() {
509
+ blogElement.isotope({
510
+ itemSelector: ".premium-blog-post-container",
511
+ percentPosition: true,
512
+ animationOptions: {
513
+ duration: 750,
514
+ easing: "linear",
515
+ queue: false
516
+ }
517
+ });
518
+ });
519
+ }
520
+ };
521
+
522
+ //Elementor JS Hooks
523
+ $(window).on("elementor/frontend/init", function() {
524
+ elementorFrontend.hooks.addAction(
525
+ "frontend/element_ready/premium-addon-video-box.default",
526
+ PremiumVideoBoxWidgetHandler
527
+ );
528
+ elementorFrontend.hooks.addAction(
529
+ "frontend/element_ready/premium-img-gallery.default",
530
+ PremiumGridWidgetHandler
531
+ );
532
+ elementorFrontend.hooks.addAction(
533
+ "frontend/element_ready/premium-addon-fancy-text.default",
534
+ PremiumFancyTextHandler
535
+ );
536
+ elementorFrontend.hooks.addAction(
537
+ "frontend/element_ready/premium-counter.default",
538
+ PremiumCounterHandler
539
+ );
540
+ elementorFrontend.hooks.addAction(
541
+ "frontend/element_ready/premium-countdown-timer.default",
542
+ PremiumCountDownHandler
543
+ );
544
+ elementorFrontend.hooks.addAction(
545
+ "frontend/element_ready/premium-carousel-widget.default",
546
+ PremiumCarouselHandler
547
+ );
548
+ elementorFrontend.hooks.addAction(
549
+ "frontend/element_ready/premium-addon-banner.default",
550
+ PremiumBannerHandler
551
+ );
552
+ elementorFrontend.hooks.addAction(
553
+ "frontend/element_ready/premium-addon-modal-box.default",
554
+ PremiumModalBoxHandler
555
+ );
556
+ elementorFrontend.hooks.addAction(
557
+ "frontend/element_ready/premium-addon-blog.default",
558
+ PremiumBlogHandler
559
+ );
560
+ if (elementorFrontend.isEditMode()) {
561
+ elementorFrontend.hooks.addAction(
562
+ "frontend/element_ready/premium-addon-progressbar.default",
563
+ PremiumProgressBarWidgetHandler
564
+ );
565
+ } else {
566
+ elementorFrontend.hooks.addAction(
567
+ "frontend/element_ready/premium-addon-progressbar.default",
568
+ PremiumProgressBarScrollWidgetHandler
569
+ );
570
+ }
571
+ });
572
+ })(jQuery);
assets/js/premium-maps-address.js CHANGED
@@ -1,39 +1,81 @@
1
function getAddress(ob) {
2
- var address = $(ob).parent().find('input').attr('value');
3
- if(address!=''){
4
- geocoder = new google.maps.Geocoder();
5
- geocoder.geocode({ 'address': address }, function(results, status) {
6
- if (status == google.maps.GeocoderStatus.OK) {
7
- var output = $(ob).parent().find('.premium-address-result'),
8
- latiude = results[0].geometry.location.lat(),
9
- longitude = results[0].geometry.location.lng();
10
-
11
- $(output).html("Latitude: " + latiude + "<br>Longitude: " + longitude + "<br>(Copy and Paste your Latitude & Longitude value below)");
12
- $(ob).parents('.elementor-control-premium_map_notice').nextAll('.elementor-control-premium_maps_center_lat').find("input").val(latiude).trigger("input");
13
- $(ob).parents('.elementor-control-premium_map_notice').nextAll('.elementor-control-premium_maps_center_long').find("input").val(longitude).trigger("input");
14
- } else {
15
- alert("Geocode was not successful for the following reason: " + status);
16
- }
17
- });
18
- }
19
}
20
21
function getPinAddress(ob) {
22
- var address = $(ob).parent().find('input').attr('value');
23
- if(address!=''){
24
- geocoder = new google.maps.Geocoder();
25
- geocoder.geocode({ 'address': address }, function(results, status) {
26
- if (status == google.maps.GeocoderStatus.OK) {
27
- var output = $(ob).parent().find('.premium-address-result'),
28
- latiude = results[0].geometry.location.lat(),
29
- longitude = results[0].geometry.location.lng();
30
-
31
- $(output).html("Latitude: " + latiude + "<br>Longitude: " + longitude + "<br>(Copy and Paste your Latitude & Longitude value below)");
32
- $(ob).parents('.elementor-control-premium_map_pin_notice').nextAll('.elementor-control-map_latitude').find("input").val(latiude).trigger("input");
33
- $(ob).parents('.elementor-control-premium_map_pin_notice').nextAll('.elementor-control-map_longitude').find("input").val(longitude).trigger("input");
34
- } else {
35
- alert("Geocode was not successful for the following reason: " + status);
36
- }
37
- });
38
- }
39
- }
1
function getAddress(ob) {
2
+ var address = $(ob)
3
+ .parent()
4
+ .find("input")
5
+ .attr("value");
6
+ if (address != "") {
7
+ geocoder = new google.maps.Geocoder();
8
+ geocoder.geocode({ address: address }, function(results, status) {
9
+ if (status == google.maps.GeocoderStatus.OK) {
10
+ var output = $(ob)
11
+ .parent()
12
+ .find(".premium-address-result"),
13
+ latiude = results[0].geometry.location.lat(),
14
+ longitude = results[0].geometry.location.lng();
15
+
16
+ $(output).html(
17
+ "Latitude: " +
18
+ latiude +
19
+ "<br>Longitude: " +
20
+ longitude +
21
+ "<br>(Copy and Paste your Latitude & Longitude value below)"
22
+ );
23
+ $(ob)
24
+ .parents(".elementor-control-premium_map_notice")
25
+ .nextAll(".elementor-control-premium_maps_center_lat")
26
+ .find("input")
27
+ .val(latiude)
28
+ .trigger("input");
29
+ $(ob)
30
+ .parents(".elementor-control-premium_map_notice")
31
+ .nextAll(".elementor-control-premium_maps_center_long")
32
+ .find("input")
33
+ .val(longitude)
34
+ .trigger("input");
35
+ } else {
36
+ alert("Geocode was not successful for the following reason: " + status);
37
+ }
38
+ });
39
+ }
40
}
41
42
function getPinAddress(ob) {
43
+ var address = $(ob)
44
+ .parent()
45
+ .find("input")
46
+ .attr("value");
47
+ if (address != "") {
48
+ geocoder = new google.maps.Geocoder();
49
+ geocoder.geocode({ address: address }, function(results, status) {
50
+ if (status == google.maps.GeocoderStatus.OK) {
51
+ var output = $(ob)
52
+ .parent()
53
+ .find(".premium-address-result"),
54
+ latiude = results[0].geometry.location.lat(),
55
+ longitude = results[0].geometry.location.lng();
56
+
57
+ $(output).html(
58
+ "Latitude: " +
59
+ latiude +
60
+ "<br>Longitude: " +
61
+ longitude +
62
+ "<br>(Copy and Paste your Latitude & Longitude value below)"
63
+ );
64
+ $(ob)
65
+ .parents(".elementor-control-premium_map_pin_notice")
66
+ .nextAll(".elementor-control-map_latitude")
67
+ .find("input")
68
+ .val(latiude)
69
+ .trigger("input");
70
+ $(ob)
71
+ .parents(".elementor-control-premium_map_pin_notice")
72
+ .nextAll(".elementor-control-map_longitude")
73
+ .find("input")
74
+ .val(longitude)
75
+ .trigger("input");
76
+ } else {
77
+ alert("Geocode was not successful for the following reason: " + status);
78
+ }
79
+ });
80
+ }
81
+ }
assets/js/premium-maps.js CHANGED
@@ -1,116 +1,118 @@
1
- jQuery(window).on('elementor/frontend/init',function(){
2
-
3
- elementorFrontend.hooks.addAction('frontend/element_ready/premium-addon-maps.default',function($scope,$){
4
-
5
- var mapElement = $scope.find('.premium_maps_map_height');
6
-
7
- var mapSettings = mapElement.data('settings');
8
-
9
- var mapStyle = mapElement.data('style');
10
-
11
- var premiumMapMarkers = [];
12
-
13
- premiumMap = newMap(mapElement,mapSettings,mapStyle);
14
-
15
- var markerCluster = JSON.parse(mapSettings['cluster']);
16
-
17
- function newMap(map,settings,mapStyle){
18
-
19
- var scrollwheel = JSON.parse(settings['scrollwheel']);
20
- var streetViewControl = JSON.parse(settings['streetViewControl']);
21
- var fullscreenControl = JSON.parse(settings['fullScreen']);
22
- var zoomControl = JSON.parse(settings['zoomControl']);
23
- var mapTypeControl = JSON.parse(settings['typeControl']);
24
- var centerLat = JSON.parse(settings['centerlat']);
25
- var centerLong = JSON.parse(settings['centerlong']);
26
- var autoOpen = JSON.parse(settings['automaticOpen']);
27
- var hoverOpen = JSON.parse(settings['hoverOpen']);
28
- var hoverClose = JSON.parse(settings['hoverClose']);
29
- var args = {
30
- zoom: settings['zoom'],
31
- mapTypeId: settings['maptype'],
32
- center: {lat: centerLat, lng: centerLong},
33
- scrollwheel: scrollwheel,
34
- streetViewControl: streetViewControl,
35
- fullscreenControl: fullscreenControl,
36
- zoomControl: zoomControl,
37
- mapTypeControl: mapTypeControl,
38
- styles: mapStyle
39
- };
40
-
41
- var markers = map.find(".premium-pin");
42
-
43
- var map = new google.maps.Map( map[0], args);
44
-
45
- map.markers = [];
46
- // add markers
47
- markers.each(function(){
48
- add_marker( jQuery(this), map, autoOpen, hoverOpen, hoverClose );
49
- });
50
-
51
- return map;
52
}
53
-
54
-
55
- function add_marker( pin, map ,autoOpen, hoverOpen, hoverClose ) {
56
-
57
- var latlng = new google.maps.LatLng( pin.attr('data-lat'), pin.attr('data-lng') ),
58
- icon_img = pin.attr('data-icon'),
59
- maxWidth = pin.attr('data-max-width');
60
-
61
- if(icon_img != ''){
62
- var icon = {
63
- url : pin.attr('data-icon')
64
- };
65
- }
66
67
- // create marker
68
- var marker = new google.maps.Marker({
69
- position : latlng,
70
- map : map,
71
- icon : icon
72
});
73
-
74
- // add to array
75
- map.markers.push( marker );
76
-
77
- premiumMapMarkers.push( marker );
78
-
79
- // if marker contains HTML, add it to an infoWindow
80
-
81
- if( pin.find('.premium-maps-info-title').html() || pin.find('.premium-maps-info-desc').html() )
82
- {
83
- // create info window
84
- var infowindow = new google.maps.InfoWindow({
85
- maxWidth : maxWidth,
86
- content : pin.html()
87
- });
88
- if(autoOpen){
89
- infowindow.open( map, marker );
90
- }
91
- if(hoverOpen){
92
- google.maps.event.addListener(marker, 'mouseover', function() {
93
- infowindow.open( map, marker );
94
- });
95
- if(hoverClose){
96
- google.maps.event.addListener(marker, 'mouseout', function() {
97
- infowindow.close( map, marker );
98
- });
99
- }
100
- }
101
- // show info window when marker is clicked
102
- google.maps.event.addListener(marker, 'click', function() {
103
- infowindow.open( map, marker );
104
- });
105
}
106
-
107
}
108
-
109
- if(markerCluster){
110
- var markerCluster = new MarkerClusterer(premiumMap, premiumMapMarkers,
111
- {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
112
- }
113
-
114
- });
115
-
116
- });
1
+ jQuery(window).on("elementor/frontend/init", function() {
2
+ elementorFrontend.hooks.addAction(
3
+ "frontend/element_ready/premium-addon-maps.default",
4
+ function($scope, $) {
5
+ var mapElement = $scope.find(".premium_maps_map_height");
6
+
7
+ var mapSettings = mapElement.data("settings");
8
+
9
+ var mapStyle = mapElement.data("style");
10
+
11
+ var premiumMapMarkers = [];
12
+
13
+ premiumMap = newMap(mapElement, mapSettings, mapStyle);
14
+
15
+ var markerCluster = JSON.parse(mapSettings["cluster"]);
16
+
17
+ function newMap(map, settings, mapStyle) {
18
+ var scrollwheel = JSON.parse(settings["scrollwheel"]);
19
+ var streetViewControl = JSON.parse(settings["streetViewControl"]);
20
+ var fullscreenControl = JSON.parse(settings["fullScreen"]);
21
+ var zoomControl = JSON.parse(settings["zoomControl"]);
22
+ var mapTypeControl = JSON.parse(settings["typeControl"]);
23
+ var centerLat = JSON.parse(settings["centerlat"]);
24
+ var centerLong = JSON.parse(settings["centerlong"]);
25
+ var autoOpen = JSON.parse(settings["automaticOpen"]);
26
+ var hoverOpen = JSON.parse(settings["hoverOpen"]);
27
+ var hoverClose = JSON.parse(settings["hoverClose"]);
28
+ var args = {
29
+ zoom: settings["zoom"],
30
+ mapTypeId: settings["maptype"],
31
+ center: { lat: centerLat, lng: centerLong },
32
+ scrollwheel: scrollwheel,
33
+ streetViewControl: streetViewControl,
34
+ fullscreenControl: fullscreenControl,
35
+ zoomControl: zoomControl,
36
+ mapTypeControl: mapTypeControl,
37
+ styles: mapStyle
38
+ };
39
+
40
+ var markers = map.find(".premium-pin");
41
+
42
+ var map = new google.maps.Map(map[0], args);
43
+
44
+ map.markers = [];
45
+ // add markers
46
+ markers.each(function() {
47
+ add_marker(jQuery(this), map, autoOpen, hoverOpen, hoverClose);
48
+ });
49
+
50
+ return map;
51
+ }
52
+
53
+ function add_marker(pin, map, autoOpen, hoverOpen, hoverClose) {
54
+ var latlng = new google.maps.LatLng(
55
+ pin.attr("data-lat"),
56
+ pin.attr("data-lng")
57
+ ),
58
+ icon_img = pin.attr("data-icon"),
59
+ maxWidth = pin.attr("data-max-width");
60
+
61
+ if (icon_img != "") {
62
+ var icon = {
63
+ url: pin.attr("data-icon")
64
+ };
65
}
66
67
+ // create marker
68
+ var marker = new google.maps.Marker({
69
+ position: latlng,
70
+ map: map,
71
+ icon: icon
72
+ });
73
+
74
+ // add to array
75
+ map.markers.push(marker);
76
+
77
+ premiumMapMarkers.push(marker);
78
+
79
+ // if marker contains HTML, add it to an infoWindow
80
+
81
+ if (
82
+ pin.find(".premium-maps-info-title").html() ||
83
+ pin.find(".premium-maps-info-desc").html()
84
+ ) {
85
+ // create info window
86
+ var infowindow = new google.maps.InfoWindow({
87
+ maxWidth: maxWidth,
88
+ content: pin.html()
89
+ });
90
+ if (autoOpen) {
91
+ infowindow.open(map, marker);
92
+ }
93
+ if (hoverOpen) {
94
+ google.maps.event.addListener(marker, "mouseover", function() {
95
+ infowindow.open(map, marker);
96
});
97
+ if (hoverClose) {
98
+ google.maps.event.addListener(marker, "mouseout", function() {
99
+ infowindow.close(map, marker);
100
+ });
101
}
102
+ }
103
+ // show info window when marker is clicked
104
+ google.maps.event.addListener(marker, "click", function() {
105
+ infowindow.open(map, marker);
106
+ });
107
}
108
+ }
109
+
110
+ if (markerCluster) {
111
+ var markerCluster = new MarkerClusterer(premiumMap, premiumMapMarkers, {
112
+ imagePath:
113
+ "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m"
114
+ });
115
+ }
116
+ }
117
+ );
118
+ });
assets/js/premium-vscroll.js ADDED
@@ -0,0 +1,459 @@
1
+ (function($) {
2
+ /****** Premium Vertical Scroll Handler ******/
3
+ var PremiumVerticalScrollHandler = function($scope, $) {
4
+ var vScrollElem = $scope.find(".premium-vscroll-wrap"),
5
+ instance = null,
6
+ vScrollSettings = vScrollElem.data("settings");
7
+
8
+ instance = new premiumVerticalScroll(vScrollElem, vScrollSettings);
9
+ instance.init();
10
+ };
11
+
12
+ window.premiumVerticalScroll = function($selector, settings) {
13
+ var self = this,
14
+ $window = $(window),
15
+ $instance = $selector,
16
+ checkTemps = $selector.find(".premium-vscroll-sections-wrap").length,
17
+ $htmlBody = $("html, body"),
18
+ $itemsList = $(".premium-vscroll-dot-item", $instance),
19
+ $menuItems = $(".premium-vscroll-nav-item", $instance),
20
+ defaultSettings = {
21
+ speed: 700,
22
+ offset: 1,
23
+ fullSection: true
24
+ },
25
+ settings = $.extend({}, defaultSettings, settings),
26
+ sections = {},
27
+ currentSection = null,
28
+ isScrolling = false;
29
+
30
+ jQuery.extend(jQuery.easing, {
31
+ easeInOutCirc: function(x, t, b, c, d) {
32
+ if ((t /= d / 2) < 1) return (-c / 2) * (Math.sqrt(1 - t * t) - 1) + b;
33
+ return (c / 2) * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
34
+ }
35
+ });
36
+
37
+ self.checkNextSection = function(object, key) {
38
+ var keys = Object.keys(object),
39
+ idIndex = keys.indexOf(key),
40
+ nextIndex = (idIndex += 1);
41
+
42
+ if (nextIndex >= keys.length) {
43
+ return false;
44
+ }
45
+
46
+ var nextKey = keys[nextIndex];
47
+
48
+ return nextKey;
49
+ };
50
+
51
+ self.checkPrevSection = function(object, key) {
52
+ var keys = Object.keys(object),
53
+ idIndex = keys.indexOf(key),
54
+ prevIndex = (idIndex -= 1);
55
+
56
+ if (0 > idIndex) {
57
+ return false;
58
+ }
59
+
60
+ var prevKey = keys[prevIndex];
61
+
62
+ return prevKey;
63
+ };
64
+
65
+ self.debounce = function(threshold, callback) {
66
+ var timeout;
67
+
68
+ return function debounced($event) {
69
+ function delayed() {
70
+ callback.call(this, $event);
71
+ timeout = null;
72
+ }
73
+
74
+ if (timeout) {
75
+ clearTimeout(timeout);
76
+ }
77
+
78
+ timeout = setTimeout(delayed, threshold);
79
+ };
80
+ };
81
+
82
+ self.init = function() {
83
+ self.setSectionsData();
84
+ $itemsList.on("click.premiumVerticalScroll", self.onNavDotChange);
85
+ $menuItems.on("click.premiumVerticalScroll", self.onNavDotChange);
86
+
87
+ $itemsList.on("mouseenter.premiumVerticalScroll", self.onNavDotEnter);
88
+
89
+ $itemsList.on("mouseleave.premiumVerticalScroll", self.onNavDotLeave);
90
+
91
+ $window.on("scroll.premiumVerticalScroll", self.onWheel);
92
+ $window.on(
93
+ "resize.premiumVerticalScroll orientationchange.premiumVerticalScroll",
94
+ self.debounce(50, self.onResize)
95
+ );
96
+ $window.on("load", function() {
97
+ self.setSectionsData();
98
+ });
99
+
100
+ $(document).keydown(function(event) {
101
+ if (38 == event.keyCode) {
102
+ self.onKeyUp(event, "up");
103
+ }
104
+
105
+ if (40 == event.keyCode) {
106
+ self.onKeyUp(event, "down");
107
+ }
108
+ });
109
+ if (settings.fullSection) {
110
+ var vSection = document.getElementById($instance.attr("id"));
111
+ if (checkTemps) {
112
+ document.addEventListener
113
+ ? vSection.addEventListener("wheel", self.onWheel, !1)
114
+ : vSection.attachEvent("onmousewheel", self.onWheel);
115
+ } else {
116
+ document.addEventListener
117
+ ? document.addEventListener("wheel", self.onWheel, !1)
118
+ : document.attachEvent("onmousewheel", self.onWheel);
119
+ }
120
+ }
121
+
122
+ for (var section in sections) {
123
+ var $section = sections[section].selector;
124
+ elementorFrontend.waypoint(
125
+ $section,
126
+ function(direction) {
127
+ var $this = $(this),
128
+ sectionId = $this.attr("id");
129
+ if ("down" === direction && !isScrolling) {
130
+ currentSection = sectionId;
131
+ $itemsList.removeClass("active");
132
+ $menuItems.removeClass("active");
133
+ $("[data-menuanchor=" + sectionId + "]", $instance).addClass(
134
+ "active"
135
+ );
136
+ }
137
+ },
138
+ {
139
+ offset: "95%",
140
+ triggerOnce: false
141
+ }
142
+ );
143
+
144
+ elementorFrontend.waypoint(
145
+ $section,
146
+ function(direction) {
147
+ var $this = $(this),
148
+ sectionId = $this.attr("id");
149
+ if ("up" === direction && !isScrolling) {
150
+ currentSection = sectionId;
151
+ $itemsList.removeClass("active");
152
+ $menuItems.removeClass("active");
153
+ $("[data-menuanchor=" + sectionId + "]", $instance).addClass(
154
+ "active"
155
+ );
156
+ }
157
+ },
158
+ {
159
+ offset: "0%",
160
+ triggerOnce: false
161
+ }
162
+ );
163
+ }
164
+ };
165
+
166
+ self.setSectionsData = function() {
167
+ $itemsList.each(function() {
168
+ var $this = $(this),
169
+ sectionId = $this.data("menuanchor"),
170
+ $section = $("#" + sectionId);
171
+ if ($section[0]) {
172
+ sections[sectionId] = {
173
+ selector: $section,
174
+ offset: Math.round($section.offset().top),
175
+ height: $section.outerHeight()
176
+ };
177
+ }
178
+ });
179
+ };
180
+
181
+ self.onNavDotEnter = function() {
182
+ var $this = $(this),
183
+ index = $this.data("index");
184
+ if (settings.tooltips) {
185
+ $(
186
+ '<div class="premium-vscroll-tooltip"><span>' +
187
+ settings.dotsText[index] +
188
+ "</span></div>"
189
+ )
190
+ .hide()
191
+ .appendTo($this)
192
+ .fadeIn(200);
193
+ }
194
+ };
195
+
196
+ self.onNavDotLeave = function() {
197
+ $(".premium-vscroll-tooltip").fadeOut(200, function() {
198
+ $(this).remove();
199
+ });
200
+ };
201
+
202
+ self.onNavDotChange = function(event) {
203
+ var $this = $(this),
204
+ index = $this.index(),
205
+ sectionId = $this.data("menuanchor"),
206
+ offset = null;
207
+
208
+ if (!sections.hasOwnProperty(sectionId)) {
209
+ return false;
210
+ }
211
+
212
+ offset = sections[sectionId].offset - settings.offset;
213
+
214
+ if (!isScrolling) {
215
+ isScrolling = true;
216
+
217
+ currentSection = sectionId;
218
+ $menuItems.removeClass("active");
219
+ $itemsList.removeClass("active");
220
+
221
+ if ($this.hasClass("premium-vscroll-nav-item")) {
222
+ $($itemsList[index]).addClass("active");
223
+ } else {
224
+ $($menuItems[index]).addClass("active");
225
+ }
226
+
227
+ $this.addClass("active");
228
+
229
+ $htmlBody
230
+ .stop()
231
+ .clearQueue()
232
+ .animate(
233
+ { scrollTop: offset },
234
+ settings.speed,
235
+ "easeInOutCirc",
236
+ function() {
237
+ isScrolling = false;
238
+ }
239
+ );
240
+ }
241
+ };
242
+
243
+ self.onKeyUp = function(event, direction) {
244
+ var direction = direction || "up",
245
+ sectionId,
246
+ nextItem = $(
247
+ ".premium-vscroll-dot-item[data-menuanchor=" + currentSection + "]",
248
+ $instance
249
+ ).next(),
250
+ prevItem = $(
251
+ ".premium-vscroll-dot-item[data-menuanchor=" + currentSection + "]",
252
+ $instance
253
+ ).prev();
254
+
255
+ event.preventDefault();
256
+
257
+ if (isScrolling) {
258
+ return false;
259
+ }
260
+
261
+ if ("up" === direction) {
262
+ if (prevItem[0]) {
263
+ prevItem.trigger("click.premiumVerticalScroll");
264
+ }
265
+ }
266
+
267
+ if ("down" === direction) {
268
+ if (nextItem[0]) {
269
+ nextItem.trigger("click.premiumVerticalScroll");
270
+ }
271
+ }
272
+ };
273
+
274