Version Description
- Improves the fade-out effect and the module that calculates the duration of audios.
Download this release
Release Info
Developer | codepeople |
Plugin | Music Player for WooCommerce |
Version | 1.0.171 |
Comparing to | |
See all releases |
Code changes from version 1.0.170 to 1.0.171
- js/public.js +14 -13
- js/public_src.js +35 -20
- readme.txt +5 -1
- wcmp.php +2 -2
js/public.js
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
-
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(
|
2 |
-
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(
|
3 |
-
$jscomp.polyfill=function(
|
4 |
-
(function(){var
|
5 |
-
|
6 |
-
"*",function(
|
7 |
-
1*wcmp_global_settings.fade_out:!0,p="undefined"!=typeof wcmp_global_settings&&"ios_controls"in wcmp_global_settings&&1*wcmp_global_settings.ios_controls?!0:!1;
|
8 |
-
"undefined"!=typeof b
|
9 |
-
!(4<a
|
10 |
-
|
11 |
-
|
12 |
-
function(){delete window.generated_the_wcmp;generate_the_wcmp(!0)};jQuery(generate_the_wcmp);jQuery(window).on("load",function(){generate_the_wcmp(!0);var
|
13 |
-
|
|
1 |
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,c){a instanceof String&&(a=String(a));for(var h=a.length,g=0;g<h;g++){var d=a[g];if(e.call(c,d,g,a))return{i:g,v:d}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
|
2 |
+
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,c){a!=Array.prototype&&a!=Object.prototype&&(a[e]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
|
3 |
+
$jscomp.polyfill=function(a,e,c,h){if(e){c=$jscomp.global;a=a.split(".");for(h=0;h<a.length-1;h++){var g=a[h];g in c||(c[g]={});c=c[g]}a=a[a.length-1];h=c[a];e=e(h);e!=h&&null!=e&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:e})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
|
4 |
+
(function(){var a=[],e=0;window.generate_the_wcmp=function(c){function h(b,l){if(b+1<e||l){var f=b+1;!l||f!=e&&0!=d('[playernumber="'+f+'"]').closest("[data-loop]").length&&d('[playernumber="'+f+'"]').closest("[data-loop]")[0]==d('[playernumber="'+b+'"]').closest("[data-loop]")[0]||(f=d('[playernumber="'+b+'"]').closest("[data-loop]").find("[playernumber]:first").attr("playernumber"));a[f]instanceof d&&a[f].is("a")?a[f].is(":visible")?a[f].click():h(b+1,l):d(a[f].container).is(":visible")?a[f].play():
|
5 |
+
h(b+1,l)}}function g(b){var a=b.data("product"),f=d("img.product-"+a);f.length&&1==d('[data-product="'+a+'"]').length&&(a=f.offset(),b=b.closest("div.wcmp-player"),b.css({position:"absolute","z-index":999999}).offset({left:a.left+(f.width()-b.width())/2,top:a.top+(f.height()-b.height())/2}))}if(!("boolean"!==typeof c&&"undefined"!=typeof wcmp_global_settings&&1*wcmp_global_settings.onload)&&"undefined"===typeof generated_the_wcmp){generated_the_wcmp=!0;var d=jQuery;d(".wcmp-player-container").on("click",
|
6 |
+
"*",function(b){b.preventDefault();b.stopPropagation();return!1});d.expr[":"].regex=function(b,a,f){a=f[3].split(",");var c=/^(data|css):/;f=a[0].match(c)?a[0].split(":")[0]:"attr";c=a.shift().replace(c,"");return(new RegExp(a.join("").replace(/^\s+|\s+$/g,""),"ig")).test(d(b)[f](c))};var q="undefined"!=typeof wcmp_global_settings?wcmp_global_settings.play_all:!0,k="undefined"!=typeof wcmp_global_settings?!(1*wcmp_global_settings.play_simultaneously):!0,n="undefined"!=typeof wcmp_global_settings?
|
7 |
+
1*wcmp_global_settings.fade_out:!0,p="undefined"!=typeof wcmp_global_settings&&"ios_controls"in wcmp_global_settings&&1*wcmp_global_settings.ios_controls?!0:!1;c=d("audio.wcmp-player:not(.track):not([playernumber])");var r=d("audio.wcmp-player.track:not([playernumber])"),m={pauseOtherPlayers:k,iPadUseNativeControls:p,iPhoneUseNativeControls:p,success:function(b,c){var f=d(c).data("duration"),e=d(c).data("estimated_duration"),g=d(c).attr("playernumber");"undefined"!=typeof e&&(b.getDuration=function(){return e});
|
8 |
+
"undefined"!=typeof f&&setTimeout(function(b,c){return function(){a[b].updateDuration=function(){d(this.media).closest(".wcmp-player").find(".mejs-duration").html(c)};a[b].updateDuration()}}(g,f),50);d(c).attr("volume")&&(b.setVolume(parseFloat(d(c).attr("volume"))),0==b.volume&&b.setMuted(!0));b.addEventListener("timeupdate",function(a){a=b.getDuration();isNaN(b.currentTime)||isNaN(a)||(n&&4>a-b.currentTime?b.setVolume(b.volume-b.volume/3):b.currentTime&&("undefined"==typeof b.bkVolume&&(b.bkVolume=
|
9 |
+
parseFloat(d(b).find("audio,video").attr("volume")||b.volume)),b.setVolume(b.bkVolume),0==b.bkVolume&&b.setMuted(!0)))});b.addEventListener("volumechange",function(a){a=b.getDuration();isNaN(b.currentTime)||isNaN(a)||!(4<a-b.currentTime)&&n||!b.currentTime||(b.bkVolume=b.volume)});b.addEventListener("ended",function(a){a=d(b).closest('[data-loop="1"]');b.currentTime=0;if(1*q||a.length){var c=1*d(b).attr("playernumber");isNaN(c)&&(c=1*d(b).find("[playernumber]").attr("playernumber"));h(c,a.length)}})}};
|
10 |
+
k=".product-type-grouped :regex(name,quantity\\[\\d+\\])";c.each(function(){var b=d(this);b.find("source").attr("src");b.attr("playernumber",e);m.audioVolume="vertical";try{a[e]=new MediaElementPlayer(b[0],m)}catch(l){"console"in window&&console.log(l)}e++});r.each(function(){var b=d(this);b.find("source").attr("src");b.attr("playernumber",e);m.features=["playpause"];try{a[e]=new MediaElementPlayer(b[0],m)}catch(l){"console"in window&&console.log(l)}e++;g(b);d(window).resize(function(){g(b)})});d(k).length||
|
11 |
+
(k=".product-type-grouped [data-product_id]");d(k).length||(k=".woocommerce-grouped-product-list [data-product_id]");d(k).length||(k='.woocommerce-grouped-product-list [id*="product-"]');d(k).each(function(){try{var b=d(this),a=(b.data("product_id")||b.attr("name")||b.attr("id")).replace(/[^\d]/g,""),c=d(".wcmp-player-list.merge_in_grouped_products .product-"+a+":first .wcmp-player-title"),e=d("<table></table>");c.length&&!c.closest(".wcmp-first-in-product").length&&(c.closest("tr").addClass("wcmp-first-in-product"),
|
12 |
+
0==c.closest("form").length&&c.closest(".wcmp-player-list").prependTo(b.closest("form")),e.append(b.closest("tr").prepend("<td>"+c.html()+"</td>")),c.html("").append(e))}catch(t){}})}};window.wcmp_force_init=function(){delete window.generated_the_wcmp;generate_the_wcmp(!0)};jQuery(generate_the_wcmp);jQuery(window).on("load",function(){generate_the_wcmp(!0);var a=jQuery,e=window.navigator.userAgent;a("[data-lazyloading]").each(function(){var c=a(this);c.attr("preload",c.data("lazyloading"))});if(e.match(/iPad/i)||
|
13 |
+
e.match(/iPhone/i))if("undefined"!=typeof wcmp_global_settings?wcmp_global_settings.play_all:1)a(".wcmp-player .mejs-play button").one("click",function(){if("undefined"==typeof wcmp_preprocessed_players){wcmp_preprocessed_players=!0;var c=a(this);a(".wcmp-player audio").each(function(){this.play();this.pause()});setTimeout(function(){c.click()},500)}})}).on("popstate",function(){jQuery("audio[data-product]:not([playernumber])").length&&wcmp_force_init()});jQuery(document).on("scroll wpfAjaxSuccess woof_ajax_done yith-wcan-ajax-filtered wpf_ajax_success berocket_ajax_products_loaded berocket_ajax_products_infinite_loaded",
|
14 |
+
wcmp_force_init)})();
|
js/public_src.js
CHANGED
@@ -93,27 +93,42 @@
|
|
93 |
iPadUseNativeControls: ios_controls,
|
94 |
iPhoneUseNativeControls: ios_controls,
|
95 |
success: function( media, dom ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
if($(dom).attr('volume'))
|
97 |
{
|
98 |
media.setVolume(parseFloat($(dom).attr('volume')));
|
99 |
if(media.volume == 0) media.setMuted(true);
|
100 |
}
|
101 |
-
var update_duration = function(t){
|
102 |
-
var duration = $(t).find('audio,video').data('duration');
|
103 |
-
if(typeof duration != 'undefined')
|
104 |
-
{
|
105 |
-
$(t).closest('.wcmp-player-container')
|
106 |
-
.find('.mejs-duration')
|
107 |
-
.html(duration);
|
108 |
-
}
|
109 |
-
};
|
110 |
|
111 |
media.addEventListener( 'timeupdate', function( evt ){
|
112 |
-
var e = media;
|
113 |
-
|
114 |
-
if(!isNaN( e.currentTime ) && !isNaN( e.duration ))
|
115 |
{
|
116 |
-
if( fade_out &&
|
117 |
{
|
118 |
e.setVolume( e.volume - e.volume / 3 );
|
119 |
}
|
@@ -132,26 +147,26 @@
|
|
132 |
});
|
133 |
|
134 |
media.addEventListener( 'volumechange', function( evt ){
|
135 |
-
var e = media;
|
136 |
-
if(!isNaN( e.currentTime ) && !isNaN(
|
137 |
{
|
138 |
-
if( (
|
139 |
}
|
140 |
});
|
141 |
|
142 |
media.addEventListener( 'ended', function( evt ){
|
143 |
var e = media,
|
144 |
c = $(e).closest('[data-loop="1"]');
|
|
|
|
|
145 |
if( play_all*1 || c.length)
|
146 |
{
|
147 |
var playernumber = $(e).attr('playernumber')*1;
|
|
|
|
|
148 |
_playNext( playernumber, c.length);
|
149 |
}
|
150 |
});
|
151 |
-
|
152 |
-
media.addEventListener('loadedmetadata', function(){
|
153 |
-
update_duration(media);
|
154 |
-
});
|
155 |
}
|
156 |
},
|
157 |
selector = '.product-type-grouped :regex(name,quantity\\[\\d+\\])';
|
93 |
iPadUseNativeControls: ios_controls,
|
94 |
iPhoneUseNativeControls: ios_controls,
|
95 |
success: function( media, dom ){
|
96 |
+
var duration = $(dom).data('duration'),
|
97 |
+
estimated_duration = $(dom).data('estimated_duration'),
|
98 |
+
player_index = $(dom).attr('playernumber');
|
99 |
+
|
100 |
+
if(typeof estimated_duration != 'undefined')
|
101 |
+
{
|
102 |
+
media.getDuration = function(){
|
103 |
+
return estimated_duration;
|
104 |
+
};
|
105 |
+
}
|
106 |
+
|
107 |
+
if(typeof duration != 'undefined')
|
108 |
+
{
|
109 |
+
setTimeout((function(player_index, duration){
|
110 |
+
return function(){
|
111 |
+
wcmp_players[ player_index ].updateDuration = function(){
|
112 |
+
$(this.media).closest('.wcmp-player')
|
113 |
+
.find('.mejs-duration')
|
114 |
+
.html(duration);
|
115 |
+
};
|
116 |
+
wcmp_players[ player_index ].updateDuration();
|
117 |
+
};
|
118 |
+
})(player_index, duration), 50);
|
119 |
+
}
|
120 |
+
|
121 |
if($(dom).attr('volume'))
|
122 |
{
|
123 |
media.setVolume(parseFloat($(dom).attr('volume')));
|
124 |
if(media.volume == 0) media.setMuted(true);
|
125 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
media.addEventListener( 'timeupdate', function( evt ){
|
128 |
+
var e = media, duration = e.getDuration();
|
129 |
+
if(!isNaN( e.currentTime ) && !isNaN( duration ))
|
|
|
130 |
{
|
131 |
+
if( fade_out && duration - e.currentTime < 4 )
|
132 |
{
|
133 |
e.setVolume( e.volume - e.volume / 3 );
|
134 |
}
|
147 |
});
|
148 |
|
149 |
media.addEventListener( 'volumechange', function( evt ){
|
150 |
+
var e = media, duration = e.getDuration();
|
151 |
+
if(!isNaN( e.currentTime ) && !isNaN(duration ))
|
152 |
{
|
153 |
+
if( ( duration - e.currentTime > 4 || !fade_out) && e.currentTime ) e[ 'bkVolume' ] = e.volume;
|
154 |
}
|
155 |
});
|
156 |
|
157 |
media.addEventListener( 'ended', function( evt ){
|
158 |
var e = media,
|
159 |
c = $(e).closest('[data-loop="1"]');
|
160 |
+
e.currentTime = 0;
|
161 |
+
|
162 |
if( play_all*1 || c.length)
|
163 |
{
|
164 |
var playernumber = $(e).attr('playernumber')*1;
|
165 |
+
if(isNaN(playernumber))
|
166 |
+
playernumber = $(e).find('[playernumber]').attr('playernumber')*1;
|
167 |
_playNext( playernumber, c.length);
|
168 |
}
|
169 |
});
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
},
|
172 |
selector = '.product-type-grouped :regex(name,quantity\\[\\d+\\])';
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: codepeople
|
|
3 |
Donate link: https://wcmp.dwbooster.com
|
4 |
Tags:WooCommerce,music player,audio,music,song,player,audio player,media player,mp3,m3u,m3u8,wav,oga,ogg,dokan,wcfm
|
5 |
Requires at least: 3.5.0
|
6 |
-
Tested up to:
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -226,6 +226,10 @@ Each time save the data of a product, the files for demo are deleted and generat
|
|
226 |
|
227 |
== Changelog ==
|
228 |
|
|
|
|
|
|
|
|
|
229 |
= 1.0.170 =
|
230 |
|
231 |
* Fixes an issue with the volume when the default value is zero.
|
3 |
Donate link: https://wcmp.dwbooster.com
|
4 |
Tags:WooCommerce,music player,audio,music,song,player,audio player,media player,mp3,m3u,m3u8,wav,oga,ogg,dokan,wcfm
|
5 |
Requires at least: 3.5.0
|
6 |
+
Tested up to: 6.0
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
226 |
|
227 |
== Changelog ==
|
228 |
|
229 |
+
= 1.0.171 =
|
230 |
+
|
231 |
+
* Improves the fade-out effect and the module that calculates the duration of audios.
|
232 |
+
|
233 |
= 1.0.170 =
|
234 |
|
235 |
* Fixes an issue with the volume when the default value is zero.
|
wcmp.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Music Player for WooCommerce
|
4 |
Plugin URI: https://wcmp.dwbooster.com
|
5 |
-
Version: 1.0.
|
6 |
Text Domain: music-player-for-woocommerce
|
7 |
Author: CodePeople
|
8 |
Author URI: https://wcmp.dwbooster.com
|
@@ -433,7 +433,7 @@ if ( !class_exists( 'WooCommerceMusicPlayer' ) ) {
|
|
433 |
wp_enqueue_style( 'wcmp-style', plugin_dir_url(__FILE__).'css/style.css' );
|
434 |
wp_enqueue_script('jquery');
|
435 |
wp_enqueue_script('wp-mediaelement');
|
436 |
-
wp_enqueue_script('wcmp-script', plugin_dir_url(__FILE__).'js/public.js', array('jquery', 'wp-mediaelement'), '1.0.
|
437 |
|
438 |
$play_all = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr(
|
439 |
'_wcmp_play_all',
|
2 |
/*
|
3 |
Plugin Name: Music Player for WooCommerce
|
4 |
Plugin URI: https://wcmp.dwbooster.com
|
5 |
+
Version: 1.0.171
|
6 |
Text Domain: music-player-for-woocommerce
|
7 |
Author: CodePeople
|
8 |
Author URI: https://wcmp.dwbooster.com
|
433 |
wp_enqueue_style( 'wcmp-style', plugin_dir_url(__FILE__).'css/style.css' );
|
434 |
wp_enqueue_script('jquery');
|
435 |
wp_enqueue_script('wp-mediaelement');
|
436 |
+
wp_enqueue_script('wcmp-script', plugin_dir_url(__FILE__).'js/public.js', array('jquery', 'wp-mediaelement'), '1.0.171');
|
437 |
|
438 |
$play_all = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr(
|
439 |
'_wcmp_play_all',
|