';this.div = document.querySelectorAll(this.divSelector)[0];this.div.appendChild(html);if(this.div.getElementsByClassName('app-badge-google').length > 0 && browser && browser.name && browser.name == 'ios') { this.div.getElementsByClassName('app-badge-google')[0].classList.add('hide');}jQuery('.play-button').first().clone().appendTo('.play-button-mobile');document.body.classList.add('has-livebar');document.body.classList.add('livebar-'+this.station_type);}// set heightthis.setHeight = function() { // TODO variable heightvar innerDocContentHeight = 80;this.div.style.height = innerDocContentHeight + "px";}this.removeUrlProtocol = function(url) { var newstr = url.replace('http://', '//'); return newstr;};// subscribe eventsthis.subscribeEvents = function() {var _this = this;for (var i in this.configChannels) {var channelName = this.configChannels[i];var channel = this.pusher.subscribe(channelName);for (var j in this.events) {var eventName = this.events[j];channel.bind(eventName, function(data) {_this.pusherEvent(channelName, eventName, data);});}_this.channels.push(channel);}};// process real time `cue` event from Pusher.comthis.pusherEvent = function(channelName, eventName, pusherData) {this.processTrackOrEvent(pusherData);};this.latestEpisode = function() {var episode = this.latest_episode;var data = {type: 'podcast',artist: '', // episode.podcast_title,trackName: this.truncate(episode.post_title, 71),art: episode.post_thumbnail,url: episode.url}this.processTrackOrEvent(data);}// grabs the latest track from the apithis.ajaxLatestTrack = function() {var endpoint = this.endpoint + '/hll_widget_livebar_cues.php';var data = {'limit': '1'};var _this = this;var httpRequest = new XMLHttpRequest();httpRequest.open('POST', endpoint);httpRequest.setRequestHeader("Content-type", "application/json");httpRequest.send(JSON.stringify(data));httpRequest.onreadystatechange = function () {if (httpRequest.readyState == 4 && httpRequest.status == 200) {var json = JSON.parse(httpRequest.responseText);_this.processTrackOrEvent(json.data.response[0]);}}};// grabs the latest event from the api this.ajaxLatestEvent = function() { var endpoint = this.endpoint + '/hll_widget_livebar_events.php'; var data = {'limit': '3'}; var _this = this; var httpRequest = new XMLHttpRequest(); httpRequest.open('POST', endpoint); httpRequest.setRequestHeader("Content-type", "application/json"); httpRequest.send(JSON.stringify(data)); httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4 && httpRequest.status == 200) { var json = JSON.parse(httpRequest.responseText); _this.processTrackOrEvent(json.data.response[0]); } } };// grabs the latest podcast episode from the wp-json api this.ajaxLatestEpisode = function() { var endpoint = '/wp-json/hbi/v1/liveplayer/latestepisode'; var _this = this; var httpRequest = new XMLHttpRequest(); httpRequest.open('GET', endpoint); httpRequest.setRequestHeader("Content-type", "application/json"); httpRequest.send(); httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4 && httpRequest.status == 200) { var episode = JSON.parse(httpRequest.responseText); var data = { type: 'podcast', artist: '', // episode.podcast_title, trackName: _this.truncate(episode.post_title, 71), art: episode.post_thumbnail, url: episode.url } _this.processTrackOrEvent(data); } } };// process the track or event data and update the HTMLthis.processTrackOrEvent = function(d) {// debug: print data to console// window.console.log('processTrackOrEvent',d);// workaround: ignore spots for nowvar type = d.type;if (type !== 'podcast' && type !== 'song' && type !== 'show' && type !== 'special-event' && type !== 'guest' && type !== 'other') {return;}if(type == 'song') {var trackId = d.data.musicbrainz_recording;var artist = d.data.artist || '';var trackName = d.data.description || '';var art = this.removeUrlProtocol(d.data.art_url || "https://www.kshe95.com/wp-content/plugins/hbi-player-widgets//assets/img/track.png");art = art + '?ver=3';}else if(type == 'podcast') {var artist = d.artist || '';var trackName = d.trackName || '';var art = this.removeUrlProtocol(d.art || "https://www.kshe95.com/wp-content/plugins/hbi-player-widgets//assets/img/track.png");this.setEpisodeTimer();}else { var trackId = d.id;var timeRange = function() {let start_date = moment(d.start_date);let end_date = moment(d.end_date);let default_format = 'h:mma';let start_day_format = (default_format);let end_day_format = (default_format);// If start and end dates both fall in AM or PM, make it brief// Example: 10:00-11:00am vs 10:00am-11:00amif(start_date.format('a') === end_date.format('a')) {start_day_format = 'h:mm';}// Remove minutes if 00if(start_date.minutes() == 0) { start_day_format = 'h';}if(end_date.minutes() == 0) { end_day_format = 'ha';}return start_date.format(start_day_format) + "-" + end_date.format(end_day_format); };var artist = timeRange();var trackName = d.name || '';var art = this.removeUrlProtocol(d.photo || "https://www.kshe95.com/wp-content/plugins/hbi-player-widgets//assets/img/event.png");// Start timer this.setEventTimer();}// This block retrieves art work as a blob so we can render it in the DOM// ... and additionally process its color swatches in a canvas context via Vibrant.js// ... with only ONE network request.// https://stackoverflow.com/questions/23013871/how-to-parse-into-base64-string-the-binary-image-from-response// https://stackoverflow.com/questions/33902299/using-jquery-ajax-to-download-a-binary-filefetchBlob(art, function(arrayBuffer) {var blob = new Blob([arrayBuffer], {type: "image/jpeg"});var url = URL.createObjectURL(blob);// Set artwork in DOMdocument.getElementsByClassName('album-art-img')[0].src=url;document.getElementsByClassName('album-art-img')[0].classList.remove('d-none');document.getElementsByClassName('live-player-background')[0].src=url;// Use live player button color if set in Customizerif(window.livePlayerButtonColor) {// set color of large and compact play buttons with customizer colorArray.from(document.getElementsByClassName('play-circle-outline-path')).forEach(function(element) {element.style.fill = window.livePlayerButtonColor;// display play button if hidden (avoids color flash on load)document.getElementById('play-button-column').classList.remove('invisible');});return;}// If live player button color is not manually set, automatically get album art color from vibrant.jsvar img = document.getElementsByClassName('album-art-img')[0];img.addEventListener('load', function() {var vibrant = new Vibrant(img);var swatches = vibrant.swatches();var swatch = swatches['LightVibrant'] || swatches['Vibrant'] || swatches['Muted'] || swatches['DarkMuted'];// trap edge case where Vibrant.js doesn't return a swatchif(swatch !== undefined) {// get hex from swatch libraryvar hex = swatch.getHex();// set color of large and compact play buttonsArray.from(document.getElementsByClassName('play-circle-outline-path')).forEach(function(element) {element.style.fill = hex;});}// display play button if hidden (avoids color flash on load)document.getElementById('play-button-column').classList.remove('invisible');});});this.div.getElementsByClassName('onair-artist')[0].innerHTML = artist;this.div.getElementsByClassName('onair-track')[0].innerHTML = trackName;// link to episode if live player is in podcast modeif(type == 'podcast') {jQuery('.play-button a, #circles, .album-art a, .track a').attr('href',d.url).removeAttr('target');jQuery('.onair-artist').hide();}// Skip TextFit step for podcast episodesif(this.station_type == 'podcast') {return;}// Dynamically size long track titles - https://github.com/STRML/textFit// var textFitOptions = {// alignVert: false, // if true, textFit will align vertically using css tables// alignHoriz: false, // if true, textFit will set text-align: center// multiLine: false, // if true, textFit will not set white-space: no-wrap// detectMultiLine: false, // disable to turn off automatic multi-line sensing// minFontSize: 11, // in px// maxFontSize: 40, // in px// reProcess: true, // if true, textFit will re-process already-fit nodes. Set to 'false' for better performance// widthOnly: false, // if true, textFit will fit text to element width, regardless of text height// alignVertWithFlexbox: false, // if true, textFit will use flexbox for vertical alignment// }if (textFit !== "undefined") {textFit(this.div.getElementsByClassName('onair-track')[0], {alignVert: false, // if true, textFit will align vertically using css tablesalignHoriz: false, // if true, textFit will set text-align: centermultiLine: false, // if true, textFit will not set white-space: no-wrapdetectMultiLine: false, // disable to turn off automatic multi-line sensingminFontSize: 13, // in pxmaxFontSize: 31, // in pxreProcess: true, // if true, textFit will re-process already-fit nodes. Set to 'false' for better performancewidthOnly: false, // if true, textFit will fit text to element width, regardless of text heightalignVertWithFlexbox: true, // if true, textFit will use flexbox for vertical alignment});textFit(this.div.getElementsByClassName('onair-artist')[0], {alignVert: false, // if true, textFit will align vertically using css tablesalignHoriz: false, // if true, textFit will set text-align: centermultiLine: false, // if true, textFit will not set white-space: no-wrapdetectMultiLine: false, // disable to turn off automatic multi-line sensingminFontSize: 11, // in pxmaxFontSize: 30, // in pxreProcess: true, // if true, textFit will re-process already-fit nodes. Set to 'false' for better performancewidthOnly: false, // if true, textFit will fit text to element width, regardless of text heightalignVertWithFlexbox: true, // if true, textFit will use flexbox for vertical alignment});}}// Set timer for event refresh this.setEventTimer = function() { var _this = this; setTimeout(function(){ _this.ajaxLatestEvent(); }, this.eventRefreshTime); };// Set timer for episode refresh this.setEpisodeTimer = function() { var _this = this; setTimeout(function(){ _this.ajaxLatestEpisode(); }, this.eventRefreshTime); }; // https://stackoverflow.com/questions/1199352/smart-way-to-truncate-long-strings this.truncate = function(str, n){ return (str.length > n) ? str.substr(0, n-1) + '…' : str; };// https://stackoverflow.com/questions/23013871/how-to-parse-into-base64-string-the-binary-image-from-responsefunction fetchBlob(uri, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', uri, true); xhr.responseType = 'arraybuffer'; xhr.onload = function(e) {if (this.status == 200) { var blob = this.response; if (callback) {callback(blob); }} }; xhr.send();};}// Set and intializevar hllLiveBarWidget = new hllLiveBarWidgetObject('player-widget-livebar');hllLiveBarWidget.init();
Address: 5789 Michel Vista, West Domenic, OR 80464-9452
Phone: +97313824072371
Job: Education Orchestrator
Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building
Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.
We notice you're using an ad blocker
Without advertising income, we can't keep making this site awesome for you.