audiofield-8.x-1.x-dev/js/wordpress.builder.js
js/wordpress.builder.js
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, once) {
'use strict';
Drupal.AudiofieldWordpress = {};
Drupal.AudiofieldWordpress.generate = function (context, file, settings) {
var autostartSetting = 'no';
if (!!settings.autoplay) {
autostartSetting = 'yes';
}
var elements = once('generate-waveform', '#wordpressaudioplayer_' + file.unique_id, context);
$.each(elements, function (index, item) {
AudioPlayer.embed($(item).attr('id'), {
soundFile: file.file,
titles: file.title,
autostart: autostartSetting,
loop: 'no',
initialvolume: settings.volume,
checkpolicy: 'yes',
animation: settings.animate
});
});
};
Drupal.behaviors.audiofieldwordpress = {
attach: function buildWordpressPlayers(context, settings) {
$.each(settings.audiofieldwordpress, function (key, settingEntry) {
AudioPlayer.setup('/libraries/wordpress-audio/player.swf', {
width: 400,
initialvolume: settingEntry.volume,
transparentpagebg: 'yes'
});
$.each(settingEntry.files, function (key2, fileEntry) {
Drupal.AudiofieldWordpress.generate(context, fileEntry, settingEntry);
});
});
}
};
})(jQuery, Drupal, once);