wordpress.builder.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. (function ($, Drupal) {
  8. 'use strict';
  9. Drupal.AudiofieldWordpress = {};
  10. Drupal.AudiofieldWordpress.generate = function (context, file, settings) {
  11. var autostartSetting = 'no';
  12. if (!!settings.autoplay) {
  13. autostartSetting = 'yes';
  14. }
  15. $.each($(context).find('#wordpressaudioplayer_' + file.unique_id).once('generate-waveform'), function (index, item) {
  16. AudioPlayer.embed($(item).attr('id'), {
  17. soundFile: file.file,
  18. titles: file.title,
  19. autostart: autostartSetting,
  20. loop: 'no',
  21. initialvolume: settings.volume,
  22. checkpolicy: 'yes',
  23. animation: settings.animate
  24. });
  25. });
  26. };
  27. Drupal.behaviors.audiofieldwordpress = {
  28. attach: function buildWordpressPlayers(context, settings) {
  29. $.each(settings.audiofieldwordpress, function (key, settingEntry) {
  30. AudioPlayer.setup('/libraries/wordpress-audio/player.swf', {
  31. width: 400,
  32. initialvolume: settingEntry.volume,
  33. transparentpagebg: 'yes'
  34. });
  35. $.each(settingEntry.files, function (key2, fileEntry) {
  36. Drupal.AudiofieldWordpress.generate(context, fileEntry, settingEntry);
  37. });
  38. });
  39. }
  40. };
  41. })(jQuery, Drupal);