Skip to content

Commit 83ecc42

Browse files
banner posts , bredcrumb moved pro to free
1 parent d36e3c6 commit 83ecc42

File tree

8 files changed

+2523
-17
lines changed

8 files changed

+2523
-17
lines changed

assets/js/widgets/post.js

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
(function ($) {
2+
const WCF_Feature_Posts = function ($scope, $) {
3+
const $popup_id = $scope.attr('data-id');
4+
let popup_content = $(`.wcf--popup-video-wrapper`).first();
5+
// Move popup content to body if not already moved
6+
if (!popup_content.parent().is('body'))
7+
{
8+
if (!$('body > .wcf--popup-video-wrapper').length) {
9+
popup_content.appendTo('body');
10+
}
11+
}
12+
13+
const open_popup = $(`.elementor-element-${$popup_id} .wcf-post-popup,.wcf-post-popup`);
14+
15+
open_popup.each(function (index) {
16+
17+
$(this).next('.wcf--popup-video-wrapper').remove();
18+
$(this).off('click').on('click', function () {
19+
let $_url = $(this).attr('data-src');
20+
21+
$(`.wcf--popup-video-wrapper`).find('.aae-popup-content-container').html('');
22+
23+
if ($(this).hasClass('audio')) {
24+
$('.wcf--popup-video-wrapper').find('.aae-popup-content-container').html(`<div class="audio wcf-audio-wrapper-clean">
25+
<audio controls>
26+
<source src="${$_url}" type="audio/mpeg">
27+
</audio>
28+
</div>`);
29+
}
30+
31+
if ($(this).hasClass('video')) {
32+
$('.wcf--popup-video-wrapper').find('.aae-popup-content-container').html(`<iframe src="${$_url}" ></iframe>`);
33+
}
34+
35+
if ($(this).hasClass('gallery')) {
36+
let gallery = $scope.find('.aae-post-gallery-wrapper').clone();
37+
$('.wcf--popup-video-wrapper').find('.aae-popup-content-container').html(gallery);
38+
const swiper = new Swiper(".aae-popup-content-container .gallery-slider", {
39+
'speed': '1500',
40+
navigation: {
41+
nextEl: ".btn-next",
42+
prevEl: ".btn-prev",
43+
},
44+
});
45+
}
46+
47+
window.VideoAnimation = gsap.timeline({defaults: {ease: "power2.inOut"}})
48+
.to(`body > .wcf--popup-video-wrapper`, {
49+
scaleY: 0.01,
50+
x: 1,
51+
opacity: 1,
52+
visibility: 'visible',
53+
duration: 0.4
54+
})
55+
.to(`body > .wcf--popup-video-wrapper`, {
56+
scaleY: 1,
57+
duration: 0.6
58+
})
59+
.to(`body > .wcf--popup-video-wrapper .wcf--popup-video`, {
60+
scaleY: 1,
61+
opacity: 1,
62+
visibility: 'visible',
63+
duration: 0.6
64+
}, "-=0.4");
65+
});
66+
});
67+
68+
// Calculate audio duration
69+
$('.audio-duration-wrapper', $scope).each(function () {
70+
const wrapper = $(this);
71+
const link = wrapper.attr('data-link');
72+
73+
if (link) {
74+
const audio = new Audio(link);
75+
76+
audio.addEventListener('loadedmetadata', function () {
77+
const totalDuration = Math.floor(audio.duration);
78+
const minutes = Math.floor(totalDuration / 60);
79+
const seconds = totalDuration % 60;
80+
81+
wrapper.find('.audio-duration').text(`${minutes}:${seconds < 10 ? '0' : ''}${seconds}`);
82+
});
83+
84+
wrapper.find('.audio-icon').on('click', function () {
85+
if (audio.paused) {
86+
audio.play();
87+
$(this).find('.play-icon').hide();
88+
$(this).find('.pause-icon').show();
89+
90+
const interval = setInterval(function () {
91+
const remainingTime = Math.floor(audio.duration - audio.currentTime);
92+
const minutes = Math.floor(remainingTime / 60);
93+
const seconds = remainingTime % 60;
94+
95+
wrapper.find('.audio-duration').text(`${minutes}:${seconds < 10 ? '0' : ''}${seconds}`);
96+
97+
if (remainingTime <= 0) {
98+
clearInterval(interval);
99+
wrapper.find('.play-icon').show();
100+
// wrapper.find('.play-icon').text('▶');
101+
}
102+
}, 1000);
103+
} else {
104+
audio.pause();
105+
$(this).find('.pause-icon').hide();
106+
$(this).find('.play-icon').show();
107+
}
108+
});
109+
110+
audio.addEventListener('error', function () {
111+
console.error(`Could not load audio from: ${link}`);
112+
wrapper.find('.audio-duration').text('Error');
113+
});
114+
}
115+
});
116+
117+
};
118+
119+
// Make sure you run this code under Elementor.
120+
$(window).on('elementor/frontend/init', function () {
121+
elementorFrontend.hooks.addAction('frontend/element_ready/wcf--feature-posts.default', WCF_Feature_Posts);
122+
elementorFrontend.hooks.addAction('frontend/element_ready/wcf--posts-pro.default', WCF_Feature_Posts);
123+
elementorFrontend.hooks.addAction('frontend/element_ready/wcf--banner-posts.default', WCF_Feature_Posts);
124+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--filterable-gallery.default`, WCF_Feature_Posts);
125+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--posts-filter.default`, WCF_Feature_Posts);
126+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--posts-slider.default`, WCF_Feature_Posts);
127+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--posts-timeline.default`, WCF_Feature_Posts);
128+
});
129+
130+
})(jQuery);

assets/js/widgets/post.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/src/js/widgets/post.js

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
(function ($) {
2+
const WCF_Feature_Posts = function ($scope, $) {
3+
const $popup_id = $scope.attr('data-id');
4+
let popup_content = $(`.wcf--popup-video-wrapper`).first();
5+
// Move popup content to body if not already moved
6+
if (!popup_content.parent().is('body'))
7+
{
8+
if (!$('body > .wcf--popup-video-wrapper').length) {
9+
popup_content.appendTo('body');
10+
}
11+
}
12+
13+
const open_popup = $(`.elementor-element-${$popup_id} .wcf-post-popup,.wcf-post-popup`);
14+
15+
open_popup.each(function (index) {
16+
17+
$(this).next('.wcf--popup-video-wrapper').remove();
18+
$(this).off('click').on('click', function () {
19+
let $_url = $(this).attr('data-src');
20+
21+
$(`.wcf--popup-video-wrapper`).find('.aae-popup-content-container').html('');
22+
23+
if ($(this).hasClass('audio')) {
24+
$('.wcf--popup-video-wrapper').find('.aae-popup-content-container').html(`<div class="audio wcf-audio-wrapper-clean">
25+
<audio controls>
26+
<source src="${$_url}" type="audio/mpeg">
27+
</audio>
28+
</div>`);
29+
}
30+
31+
if ($(this).hasClass('video')) {
32+
$('.wcf--popup-video-wrapper').find('.aae-popup-content-container').html(`<iframe src="${$_url}" ></iframe>`);
33+
}
34+
35+
if ($(this).hasClass('gallery')) {
36+
let gallery = $scope.find('.aae-post-gallery-wrapper').clone();
37+
$('.wcf--popup-video-wrapper').find('.aae-popup-content-container').html(gallery);
38+
const swiper = new Swiper(".aae-popup-content-container .gallery-slider", {
39+
'speed': '1500',
40+
navigation: {
41+
nextEl: ".btn-next",
42+
prevEl: ".btn-prev",
43+
},
44+
});
45+
}
46+
47+
window.VideoAnimation = gsap.timeline({defaults: {ease: "power2.inOut"}})
48+
.to(`body > .wcf--popup-video-wrapper`, {
49+
scaleY: 0.01,
50+
x: 1,
51+
opacity: 1,
52+
visibility: 'visible',
53+
duration: 0.4
54+
})
55+
.to(`body > .wcf--popup-video-wrapper`, {
56+
scaleY: 1,
57+
duration: 0.6
58+
})
59+
.to(`body > .wcf--popup-video-wrapper .wcf--popup-video`, {
60+
scaleY: 1,
61+
opacity: 1,
62+
visibility: 'visible',
63+
duration: 0.6
64+
}, "-=0.4");
65+
});
66+
});
67+
68+
// Calculate audio duration
69+
$('.audio-duration-wrapper', $scope).each(function () {
70+
const wrapper = $(this);
71+
const link = wrapper.attr('data-link');
72+
73+
if (link) {
74+
const audio = new Audio(link);
75+
76+
audio.addEventListener('loadedmetadata', function () {
77+
const totalDuration = Math.floor(audio.duration);
78+
const minutes = Math.floor(totalDuration / 60);
79+
const seconds = totalDuration % 60;
80+
81+
wrapper.find('.audio-duration').text(`${minutes}:${seconds < 10 ? '0' : ''}${seconds}`);
82+
});
83+
84+
wrapper.find('.audio-icon').on('click', function () {
85+
if (audio.paused) {
86+
audio.play();
87+
$(this).find('.play-icon').hide();
88+
$(this).find('.pause-icon').show();
89+
90+
const interval = setInterval(function () {
91+
const remainingTime = Math.floor(audio.duration - audio.currentTime);
92+
const minutes = Math.floor(remainingTime / 60);
93+
const seconds = remainingTime % 60;
94+
95+
wrapper.find('.audio-duration').text(`${minutes}:${seconds < 10 ? '0' : ''}${seconds}`);
96+
97+
if (remainingTime <= 0) {
98+
clearInterval(interval);
99+
wrapper.find('.play-icon').show();
100+
// wrapper.find('.play-icon').text('▶');
101+
}
102+
}, 1000);
103+
} else {
104+
audio.pause();
105+
$(this).find('.pause-icon').hide();
106+
$(this).find('.play-icon').show();
107+
}
108+
});
109+
110+
audio.addEventListener('error', function () {
111+
console.error(`Could not load audio from: ${link}`);
112+
wrapper.find('.audio-duration').text('Error');
113+
});
114+
}
115+
});
116+
117+
};
118+
119+
// Make sure you run this code under Elementor.
120+
$(window).on('elementor/frontend/init', function () {
121+
elementorFrontend.hooks.addAction('frontend/element_ready/wcf--feature-posts.default', WCF_Feature_Posts);
122+
elementorFrontend.hooks.addAction('frontend/element_ready/wcf--posts-pro.default', WCF_Feature_Posts);
123+
elementorFrontend.hooks.addAction('frontend/element_ready/wcf--banner-posts.default', WCF_Feature_Posts);
124+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--filterable-gallery.default`, WCF_Feature_Posts);
125+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--posts-filter.default`, WCF_Feature_Posts);
126+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--posts-slider.default`, WCF_Feature_Posts);
127+
elementorFrontend.hooks.addAction(`frontend/element_ready/wcf--posts-timeline.default`, WCF_Feature_Posts);
128+
});
129+
130+
})(jQuery);

class-plugin.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public static function get_widget_scripts()
331331
'dep' => ['jquery'],
332332
'version' => false,
333333
'arg' => true,
334-
],
334+
]
335335
]);
336336
}
337337

@@ -515,13 +515,13 @@ public static function get_widget_style()
515515
'version' => false,
516516
'media' => 'all',
517517
],
518-
'author-box' => [
518+
'author-box' => [
519519
'handler' => 'wcf--author-box',
520520
'src' => 'widgets/author-box.css',
521521
'dep' => [],
522522
'version' => false,
523523
'media' => 'all',
524-
],
524+
]
525525
];
526526
}
527527

@@ -542,19 +542,18 @@ public function register_widgets()
542542
if ($data['is_upcoming']) {
543543
continue;
544544
}
545-
545+
546546
if ($data['is_pro']) {
547547
continue;
548548
}
549549

550550
if (file_exists(__DIR__ . '/widgets/' . $slug . '/' . $slug . '.php') || file_exists(__DIR__ . '/widgets/' . $slug . '.php')) {
551-
551+
552552
if (! $data['is_pro'] && ! $data['is_extension']) {
553553
if (is_dir(__DIR__ . '/widgets/' . $slug)) {
554554
require_once(__DIR__ . '/widgets/' . $slug . '/' . $slug . '.php');
555555
} else {
556-
require_once(__DIR__ . '/widgets/' . $slug . '.php');
557-
556+
require_once(__DIR__ . '/widgets/' . $slug . '.php');
558557
}
559558

560559

@@ -566,7 +565,6 @@ public function register_widgets()
566565
}
567566
}
568567
}
569-
570568
}
571569

572570
/**
@@ -693,8 +691,8 @@ public function print_templates()
693691
$active_plugins = get_option('active_plugins');
694692
$dahsboard_link = admin_url('admin.php?page=wcf_addons_settings');
695693
?>
696-
<script type="text/template" id="tmpl-wcf-templates-header">
697-
<div class="dialog-header dialog-lightbox-header">
694+
<script type="text/template" id="tmpl-wcf-templates-header">
695+
<div class="dialog-header dialog-lightbox-header">
698696
<div class="elementor-templates-modal__header wcf-template-library--header">
699697
<div class="elementor-templates-modal__header__logo-area"></div>
700698
<div class="elementor-templates-modal__header__menu-area" data-disabled="false">
@@ -721,8 +719,8 @@ public function print_templates()
721719
</div>
722720
</div>
723721
</script>
724-
<script type="text/template" id="tmpl-wcf-templates">
725-
<div class="dialog-message dialog-lightbox-message">
722+
<script type="text/template" id="tmpl-wcf-templates">
723+
<div class="dialog-message dialog-lightbox-message">
726724
<div class="dialog-content dialog-lightbox-content">
727725
<div class="elementor-template-library-templates">
728726
<!--toolbar-->
@@ -820,8 +818,8 @@ public function print_templates()
820818
</div>
821819
</div>
822820
</script>
823-
<script type="text/template" id="tmpl-wcf-templates-single">
824-
<div class="dialog-header dialog-lightbox-header">
821+
<script type="text/template" id="tmpl-wcf-templates-single">
822+
<div class="dialog-header dialog-lightbox-header">
825823
<div class="elementor-templates-modal__header">
826824
<div id="wcf-template-library-header-preview-back">
827825
<i class="eicon-" aria-hidden="true"></i>
@@ -996,4 +994,4 @@ public function __construct()
996994
}
997995

998996
// Instantiate Plugin Class
999-
Plugin::instance();
997+
Plugin::instance();

config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@
10231023
'cTab' => 'all'
10241024
],
10251025
'is_active' => false,
1026-
'is_pro' => true,
1026+
'is_pro' => false,
10271027
'is_extension' => false,
10281028
'is_upcoming' => false,
10291029
'icon' => "wcf-icon-Banner-Posts",
@@ -1374,7 +1374,7 @@
13741374
'cTab' => 'all'
13751375
],
13761376
'is_upcoming' => false,
1377-
'is_pro' => true,
1377+
'is_pro' => false,
13781378
'is_extension' => false,
13791379
'icon' => "wcf-icon-Breadcrumbs",
13801380
'demo_url' => 'https://animation-addons.com/widgets/aae-breadcrumbs',

0 commit comments

Comments
 (0)