1 (function($) { 2 3 "use strict"; 4 5 $(document).ready(function() { 6 7 var player = $('.wp-block-audio audio, .powerpress_player audio, audio.wp-audio-shortcode'); 8 player.mediaelementplayer({ 9 'classPrefix': 'mejs-', 10 'isVideo': false, 11 'setDimensions': false, 12 'preload': 'none', 13 'pauseOtherPlayers': true, 14 'alwaysShowControls': true, 15 // 'audioVolume': 'vertical', // add into customizer? 16 'startVolume': 0.8, 17 'skipBackInterval': 30, 18 'jumpForwardInterval': 30, 19 'timeAndDurationSeparator': '<span> / </span>', 20 'features': ['skipback', 'playpause', 'jumpforward', 'current', 'progress', 'duration', 'tracks', 'volume', 'speed'], 21 'speeds': ['2', '1.5', '1.25', '0.75'], 22 'defaultSpeed': '1', 23 success: function (mediaElement) { mediaElement.pause(); } 24 }) 25 26 var video = $('.powerpress_player video, video.wp-video-shortcode'); 27 video.mediaelementplayer({ 28 'classPrefix': 'mejs-', 29 'isVideo': true, 30 'setDimensions': true, 31 'preload': 'none', 32 'pauseOtherPlayers': true, 33 'alwaysShowControls': false, 34 'audioVolume': 'vertical', 35 'startVolume': 0.8, 36 'timeAndDurationSeparator': '<span> / </span>', 37 'features': ['playpause', 'current', 'progress', 'duration', 'volume', 'fullscreen'], 38 success: function (mediaElement) { mediaElement.pause(); } 39 }) 40 41 42 $('.wp-playlist:not(:has(.mejs-container))').each(function() { 43 $(this).addClass('secondline_playlist'); 44 var playlist_script = $(this).find('.wp-playlist-script'); 45 var secondline_audio_playlist = $(playlist_script).html(); 46 var json = $.parseJSON(secondline_audio_playlist); 47 var tracks = json.tracks; 48 var self = $(this).find('audio'); 49 self.attr('controls="controls"'); 50 $(tracks).each(function() { 51 if(this !== null) { 52 var source = this.src; 53 var length = this.meta.length_formatted; 54 var artist = this.meta.artist; 55 var album = this.meta.album; 56 var genre = this.meta.genre; 57 var year = this.meta.year; 58 var type = this.type; 59 var title = this.title; 60 if(this.thumb) { 61 if(this.thumb.src == null || this.thumb.src.indexOf('wp-includes/images/media/audio.png') >= 0) { 62 var thumbnail = ''; 63 } else { 64 var thumbnail = this.thumb.src; 65 } 66 } else { 67 var thumbnail = ''; 68 } 69 var description = this.description; 70 description = description.replace(/\"/g,''); 71 72 jQuery(self).append('<source class="wp-playlist-item" src="' + source + '" type="' + type + '" title="' + title + '" data-playlist-description="' + description + '" data-playlist-thumbnail="' + thumbnail + '" year="' + year + '" genre="' + genre + '" album="' + album + '" artist="' + artist + '" length="' + length + '">'); 73 } 74 75 }) 76 77 $(this).find('audio').mediaelementplayer({ 78 'classPrefix': 'mejs-', 79 'isVideo': false, 80 'playlist': true, 81 playlistposition: 'bottom', 82 features: ['playlistfeature', 'prevtrack', 'playpause', 'nexttrack', 'current', 'progress', 'duration', 'volume', 'skipback', 'jumpforward', 'speed', 'playlist'], 83 prevText: 'Previous', 84 nextText: 'Next', 85 playlistTitle: '', 86 currentMessage: '', 87 }) 88 89 90 $(this).find('ul.mejs-playlist-selector-list').each(function() { 91 $(this).addClass('wp-playlist-tracks'); 92 $(this).find('li.mejs-playlist-selector-list-item').addClass('wp-playlist-item'); 93 $(this).find('.mejs-playlist-selector-label').addClass('wp-playlist-item-title'); 94 }); 95 96 var playlistHeight = $(this).find('.mejs-layers ul.mejs-playlist-selector-list').height(); 97 $(this).height(playlistHeight + 200); 98 $(this).find('.mejs-controls').append('<button class="playlist-toggle"><i class="fas fa-bars"></i></button>'); 99 $(this).find('.wp-playlist-item .mejs-playlist-item-inner:not(:has(.mejs-playlist-item-thumbnail))').prepend( '<i class="no-thumb-slt fas fa-image"></i></button>' ); 100 $(this).find('.playlist-toggle').on("click", function() { 101 $(this).parents('.secondline_playlist').find('.mejs-container').toggleClass('playlist_hidden'); 102 $(this).parents('.secondline_playlist').toggleClass('fluid_playlist_height'); 103 }); 104 105 106 }); 107 108 }); 109 })(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.