// (c) 2010-2011 Jeremy Ashkenas, DocumentCloud Inc. // (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Backbone may be freely distributed under the MIT license. // Copyright (c)2014 Derick Bailey, Muted Solutions, LLC. // Distributed under MIT license /*! * Includes BabySitter * https://github.com/marionettejs/backbone.babysitter/ * * Includes Wreqr * https://github.com/marionettejs/backbone.wreqr/ */ /** @license * * SoundManager 2: JavaScript Sound for the Web * ---------------------------------------------- * https://schillmania.com/projects/soundmanager2/ * * Copyright (c) 2007, Scott Schiller. All rights reserved. * Code provided under the BSD License: * https://schillmania.com/projects/soundmanager2/license.txt * * V2.97a.20131201 */ /** * @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: https://github.com/requirejs/text for details */ /*! Copyright (c) 2013 Brandon Aaron (https://brandon.aaron.sh) * Licensed under the MIT License (LICENSE.txt). * * Version: 3.1.9 * * Requires: jQuery 1.2.2+ */ /*! * jScrollPane - v2.0.19 - 2013-11-16 * https://jscrollpane.kelvinluck.com/ * * Copyright (c) 2013 Kelvin Luck * Dual licensed under the MIT or GPL licenses. */ function replaceURLWithHTMLLinks(e){var t=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;return e.replace(t,"$1")}function pad(e,t){for(var n=e+"";n.lengthl;l++)if(e=o[l],s=this._events[e]){if(this._events[e]=a=[],t||i)for(c=0,d=s.length;d>c;c++)r=s[c],(t&&t!==r.callback&&t!==r.callback._callback||i&&i!==r.context)&&a.push(r);a.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=s.call(arguments,1);if(!u(this,"trigger",e,t))return this;var n=this._events[e],i=this._events.all;return n&&p(n,t),i&&p(i,arguments),this},stopListening:function(e,t,i){var a=this._listeningTo;if(!a)return this;var r=!t&&!i;i||"object"!=typeof t||(i=this),e&&((a={})[e._listenId]=e);for(var s in a)e=a[s],e.off(t,i,this),(r||n.isEmpty(e._events))&&delete this._listeningTo[s];return this}},l=/\s+/,u=function(e,t,n,i){if(!n)return!0;if("object"==typeof n){for(var a in n)e[t].apply(e,[a,n[a]].concat(i));return!1}if(l.test(n)){for(var r=n.split(l),s=0,o=r.length;o>s;s++)e[t].apply(e,[r[s]].concat(i));return!1}return!0},p=function(e,t){var n,i=-1,a=e.length,r=t[0],s=t[1],o=t[2];switch(t.length){case 0:for(;++id;d++)this.trigger("change:"+o[d],this,c[o[d]],i)}if(u)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,n.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var i in this.attributes)t[i]=void 0;return this.set(t,n.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!n.isEmpty(this.changed):n.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?n.clone(this.changed):!1;var t,i=!1,a=this._changing?this._previousAttributes:this.attributes;for(var r in e)n.isEqual(a[r],t=e[r])||((i||(i={}))[r]=t);return i},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(e){e=e?n.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,i=e.success;return e.success=function(n){return t.set(t.parse(n,e),e)?(i&&i(t,n,e),void t.trigger("sync",t,n,e)):!1},H(this,e),this.sync("read",this,e)},save:function(e,t,i){var a,r,s,o=this.attributes;if(null==e||"object"==typeof e?(a=e,i=t):(a={})[e]=t,i=n.extend({validate:!0},i),a&&!i.wait){if(!this.set(a,i))return!1}else if(!this._validate(a,i))return!1;a&&i.wait&&(this.attributes=n.extend({},o,a)),void 0===i.parse&&(i.parse=!0);var l=this,u=i.success;return i.success=function(e){l.attributes=o;var t=l.parse(e,i);return i.wait&&(t=n.extend(a||{},t)),n.isObject(t)&&!l.set(t,i)?!1:(u&&u(l,e,i),void l.trigger("sync",l,e,i))},H(this,i),r=this.isNew()?"create":i.patch?"patch":"update","patch"===r&&(i.attrs=a),s=this.sync(r,this,i),a&&i.wait&&(this.attributes=o),s},destroy:function(e){e=e?n.clone(e):{};var t=this,i=e.success,a=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(n){(e.wait||t.isNew())&&a(),i&&i(t,n,e),t.isNew()||t.trigger("sync",t,n,e)},this.isNew())return e.success(),!1;H(this,e);var r=this.sync("delete",this,e);return e.wait||a(),r},url:function(){var e=n.result(this,"urlRoot")||n.result(this.collection,"url")||$();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(e){return this._validate({},n.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=n.extend({},this.attributes,e);var i=this.validationError=this.validate(e,t)||null;return i?(this.trigger("invalid",this,i,n.extend(t,{validationError:i})),!1):!0}});var h=["keys","values","pairs","invert","pick","omit"];n.each(h,function(e){d.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.attributes),n[e].apply(n,t)}});var f=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,n.extend({silent:!0},t))},m={add:!0,remove:!0,merge:!0},g={add:!0,remove:!1};n.extend(f.prototype,o,{model:d,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,n.extend({merge:!1},t,g))},remove:function(e,t){var i=!n.isArray(e);e=i?[e]:n.clone(e),t||(t={});var a,r,s,o;for(a=0,r=e.length;r>a;a++)o=e[a]=this.get(e[a]),o&&(delete this._byId[o.id],delete this._byId[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o));return i?e[0]:e},set:function(e,t){t=n.defaults({},t,m),t.parse&&(e=this.parse(e,t));var i=!n.isArray(e);e=i?e?[e]:[]:n.clone(e);var a,r,s,o,l,u,p,c=t.at,h=this.model,f=this.comparator&&null==c&&t.sort!==!1,g=n.isString(this.comparator)?this.comparator:null,v=[],y=[],_={},w=t.add,b=t.merge,k=t.remove,C=!f&&w&&k?[]:!1;for(a=0,r=e.length;r>a;a++){if(l=e[a],s=l instanceof d?o=l:l[h.prototype.idAttribute],u=this.get(s))k&&(_[u.cid]=!0),b&&(l=l===o?o.attributes:l,t.parse&&(l=u.parse(l,t)),u.set(l,t),f&&!p&&u.hasChanged(g)&&(p=!0)),e[a]=u;else if(w){if(o=e[a]=this._prepareModel(l,t),!o)continue;v.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,null!=o.id&&(this._byId[o.id]=o)}C&&C.push(u||o)}if(k){for(a=0,r=this.length;r>a;++a)_[(o=this.models[a]).cid]||y.push(o);y.length&&this.remove(y,t)}if(v.length||C&&C.length)if(f&&(p=!0),this.length+=v.length,null!=c)for(a=0,r=v.length;r>a;a++)this.models.splice(c+a,0,v[a]);else{C&&(this.models.length=0);var P=C||v;for(a=0,r=P.length;r>a;a++)this.models.push(P[a])}if(p&&this.sort({silent:!0}),!t.silent){for(a=0,r=v.length;r>a;a++)(o=v[a]).trigger("add",o,this,t);(p||C&&C.length)&&this.trigger("sort",this,t)}return i?e[0]:e},reset:function(e,t){t||(t={});for(var i=0,a=this.models.length;a>i;i++)this._removeReference(this.models[i]);return t.previousModels=this.models,this._reset(),e=this.add(e,n.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,n.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,n.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return s.apply(this.models,arguments)},get:function(e){return null==e?void 0:this._byId[e.id]||this._byId[e.cid]||this._byId[e]},at:function(e){return this.models[e]},where:function(e,t){return n.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),n.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(n.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return n.invoke(this.models,"get",e)},fetch:function(e){e=e?n.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,i=this;return e.success=function(n){var a=e.reset?"reset":"set";i[a](n,e),t&&t(i,n,e),i.trigger("sync",i,n,e)},H(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?n.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var i=this,a=t.success;return t.success=function(e,t,n){n.wait&&i.add(e,n),a&&a(e,t,n)},e.save(null,t),e},parse:function(e){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof d)return e.collection||(e.collection=this),e;t=t?n.clone(t):{},t.collection=this;var i=new this.model(e,t);return i.validationError?(this.trigger("invalid",this,i.validationError,t),!1):i},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,i){("add"!==e&&"remove"!==e||n===this)&&("destroy"===e&&this.remove(t,i),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var v=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];n.each(v,function(e){f.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.models),n[e].apply(n,t)}});var y=["groupBy","countBy","sortBy"];n.each(y,function(e){f.prototype[e]=function(t,i){var a=n.isFunction(t)?t:function(e){return e.get(t)};return n[e](this.models,a,i)}});var _=t.View=function(e){this.cid=n.uniqueId("view"),e||(e={}),n.extend(this,n.pick(e,b)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},w=/^(\S+)\s*(.*)$/,b=["model","collection","el","id","attributes","className","tagName","events"];n.extend(_.prototype,o,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,n){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],n!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=n.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var i=e[t];if(n.isFunction(i)||(i=this[e[t]]),i){var a=t.match(w),r=a[1],s=a[2];i=n.bind(i,this),r+=".delegateEvents"+this.cid,""===s?this.$el.on(r,i):this.$el.on(r,s,i)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(this.el)this.setElement(n.result(this,"el"),!1);else{var e=n.extend({},n.result(this,"attributes"));this.id&&(e.id=n.result(this,"id")),this.className&&(e["class"]=n.result(this,"className"));var i=t.$("<"+n.result(this,"tagName")+">").attr(e);this.setElement(i,!1)}}}),t.sync=function(e,i,a){var r=C[e];n.defaults(a||(a={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var s={type:r,dataType:"json"};if(a.url||(s.url=n.result(i,"url")||$()),null!=a.data||!i||"create"!==e&&"update"!==e&&"patch"!==e||(s.contentType="application/json",s.data=JSON.stringify(a.attrs||i.toJSON(a))),a.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),a.emulateHTTP&&("PUT"===r||"DELETE"===r||"PATCH"===r)){s.type="POST",a.emulateJSON&&(s.data._method=r);var o=a.beforeSend;a.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",r),o?o.apply(this,arguments):void 0}}"GET"===s.type||a.emulateJSON||(s.processData=!1),"PATCH"===s.type&&k&&(s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=a.xhr=t.ajax(n.extend(s,a));return i.trigger("request",i,l,a),l};var k=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),C={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var P=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},M=/\((.*?)\)/g,T=/(\(\?)?:\w+/g,x=/\*\w+/g,O=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(P.prototype,o,{initialize:function(){},route:function(e,i,a){n.isRegExp(e)||(e=this._routeToRegExp(e)),n.isFunction(i)&&(a=i,i=""),a||(a=this[i]);var r=this;return t.history.route(e,function(n){var s=r._extractParameters(e,n);a&&a.apply(r,s),r.trigger.apply(r,["route:"+i].concat(s)),r.trigger("route",i,s),t.history.trigger("route",r,i,s)}),this},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var e,t=n.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(O,"\\$&").replace(M,"(?:$1)?").replace(T,function(e,t){return t?e:"([^/]+)"}).replace(x,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var i=e.exec(t).slice(1);return n.map(i,function(e){return e?decodeURIComponent(e):null})}});var A=t.History=function(){this.handlers=[],n.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},j=/^[#\/]|\s+$/g,I=/^\/+|\/+$/g,S=/msie [\w.]+/,E=/\/$/,R=/[?#].*$/;A.started=!1,n.extend(A.prototype,o,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(E,"");e.indexOf(n)||(e=e.slice(n.length))}else e=this.getHash();return e.replace(j,"")},start:function(e){if(A.started)throw new Error("Backbone.history has already been started");A.started=!0,this.options=n.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var i=this.getFragment(),a=document.documentMode,r=S.exec(navigator.userAgent.toLowerCase())&&(!a||7>=a);this.root=("/"+this.root+"/").replace(I,"/"),r&&this._wantsHashChange&&(this.iframe=t.$('\r\n \r\n\r\n'}),define("apps/smart-podcast-player/track-details/view",["app","text!templates/track-details-template.html"],function(e,t){return e.module("AskPatPlayerApp.TrackDetails.View",function(e,n,i,a,r,s){e.TrackDetails=a.Layout.extend({template:s.template(t),className:"spp-track-details",triggers:{"click .spp-play-pause-btn":"play","click .spp-button-download":"track:download","click .spp-previous-btn":"track:previous","click .spp-next-btn":"track:next","click .spp-currently-playing":"track:current","click .details-btn":"content:toggle"},events:{"click .spp-player-tag":"filterTag","click .spp-progress-container":"seek","click .spp-share-btn":"share"},initialize:function(){var e=this;r(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")},socialPopup:function(e,t){window.open(t,"pinterest","screenX=100,screenY=100,height=360,width=730"),e.preventDefault(),e.stopPropagation()},share:function(e){var t=this,n=t.model.get("data"),i=r(e.currentTarget),a=""!=n.fallback_permalink&&null!=n.fallback_permalink&&void 0!=n.fallback_permalink?n.fallback_permalink:""!=n.permalink_url?n.permalink_url:"";if(i.hasClass("spp-facebook")&&this.socialPopup(e,"https://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(a)+"&p[images][0]=&p[title]="+encodeURIComponent(n.title)),i.hasClass("spp-twitter")){var s=encodeURIComponent(n.title)+" "+encodeURIComponent(a);""!=n.hashtag&&void 0!=n.hashtag&&(s=s+" "+encodeURIComponent("#"+n.hashtag)),this.socialPopup(e,"https://twitter.com/home?status="+s)}i.hasClass("spp-gplus")&&this.socialPopup(e,"https://plus.google.com/share?url="+encodeURIComponent(a)),i.hasClass("spp-stumble")&&this.socialPopup(e,"https://www.stumbleupon.com/submit?url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title)),i.hasClass("spp-pinterest")&&this.socialPopup(e,"https://pinterest.com/pin/create/button/?url="+encodeURIComponent(a)),i.hasClass("spp-linkedin")&&this.socialPopup(e,"https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title))},seek:function(e){function t(){n.bytesLoaded/n.bytesTotal>p&&(n.pause(),n.setPosition(p*l),n.spp-play(),clearInterval(u))}var n=soundManager.getSoundById("track_"+this.model.get("id")),i=e.offsetX,a=e.offsetY,s=r(e.currentTarget).width(),o=n.spp-o,l=this.model.get("duration");void 0==i&&(i=e.pageX-this.$(".spp-progress-container").offset().left),void 0==a&&(a=e.pageY-this.$(".spp-progress-container").offset().top);var u,p=i/s;if(n.bytesLoaded/n.bytesTotal>p)n.pause(),n.setPosition(p*l),n.spp-play();else{this.$el.hasClass("playing")||n.spp-play(),n.pause();var c=100*p+"%";r(e.currentTarget).find(".spp-progress-icon").css({left:c}),u=setInterval(t,250)}},filterTag:function(e){this.trigger("playlist:filter",this,r(e.currentTarget).text())},onRender:function(){var e=this.model.get("data"),t=e.tags,n="";r.each(t,function(e,t){n+='
  • '+t+"
  • "}),this.$(".spp-tag-list").html(n)}})}),e.AskPatPlayerApp.TrackDetails.View}),define("apps/smart-podcast-player/track-details/controller",["app","apps/smart-podcast-player/track-details/view","entities/podcast-track","soundmanager2","vendor/jquery.jscrollpane.min","vendor/jquery.mousewheel"],function(e,t){return e.module("AskPatPlayerApp.TrackDetails",function(e,n,i,a,r){var s=[];e.Controller={init:function(e){var i=e.model.get("region"),a=(e.model.get("options"),n.request("track:entity:current",e)),o=new t.TrackDetails({model:a});o.on("show",function(){window.innerWidth>768&&o.$el.jScrollPane()}),o.on("playlist:filter",function(t,i){n.trigger("playlist:filter",e,i)}),o.on("resize",function(){window.innerWidth>768&&r(".spp-player .spp-track-details-container").show(),o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove(),o.render(),window.innerWidth>768&&o.$el.jScrollPane()}),o.on("track:download",function(e){var t=e.model.get("data"),n=t.download_url;"https:"===location.protocol&&(n=n.replace(/^http:\/\//i,"https://"));var i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if(i||"soundcloud"==t.method&&("http:"!==location.protocol||i))window.location=n+"?consumer_key="+AP_Player.soundcloudConsumerKey;else{var a="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:AP_Player.homeUrl+"?spp_download="+n;e.view.$(".spp-downloader").prop("src",a)}}),o.on("track:current",function(){var t=n.request("track:entity:current",e);o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove(),this.model=t,this.render(),window.innerWidth>768&&this.$el.jScrollPane()}),o.on("render",function(){o.$el.removeClass("spp-current"),window.innerWidth>768?o.$el.jScrollPane():(o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove());var t=n.request("track:entity:current",e);t.attributes.data.id===o.model.attributes.data.id&&o.$el.addClass("spp-current")}),e.trackDetailsRegion.show(o),s[i]=o},show:function(e,t){var n=e.model.get("region"),i=s[n];i.$el.removeData("jsp").removeClass("jspScrollable"),i.$el.attr("style","").attr("tabindex",""),i.$(".jspContainer").remove(),i.model=t,i.render(),window.innerWidth>768&&i.$el.jScrollPane()}}}),e.AskPatPlayerApp.TrackDetails.Controller}),define("apps/smart-podcast-player/player/view",["app","text!templates/player-template.html"],function(e,t){return e.module("AskPatPlayerApp.Player.View",function(e,n,i,a,r,s){e.Player=a.ItemView.extend({template:s.template(t),className:"spp-player",triggers:{"click .spp-play":"track:play","click .spp-next":"track:next","click .spp-previous":"track:previous","click .spp-speed":"track:speed","click .spp-show-notes-button":"track:show-notes"},events:{"mousemove .spp-track":"cursorMove","mouseout .spp-track":"cursorOut","click .spp-track":"seek"},initialize:function(){this.hover=!1;var e=this;r(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")},seek:function(e){this.trigger("track:seek",e)},cursorMove:function(e){this.trigger("cursor:move",e)},cursorOut:function(e){this.trigger("cursor:out",e)},onRender:function(){}})}),e.AskPatPlayerApp.Player.View}),define("apps/smart-podcast-player/player/controller",["app","apps/smart-podcast-player/player/view","entities/podcast-player","entities/podcast-track","soundmanager2"],function(e,t){return e.module("AskPatPlayerApp.Player",function(e,n,i,a,r){var s=[],o=[],l=[];e.Controller={init:function(e){var i=e.model.get("region"),a=e.model.get("options"),u=n.request("player:entity",e);l[i]=new t.Player({model:u});var p=0,c=n.request("track:entities",e);c.each(function(e){var t=e.get("data");p+="number"==typeof t.playback_count?t.playback_count:0}),l[i].on("resize",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide()}),l[i].on("track:show-notes",function(){this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").is(":visible")?(this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").hide(),l[i].$(".spp-show-notes-button").text("Show Notes")):(this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").show(),l[i].$(".spp-show-notes-button").text("Hide Notes"))}),l[i].on("show",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide();if(p){var n=p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" Listens";""!=e.show_name&&void 0!==e.show_name&&(n=" • "+n),l[i].$(".spp-show-count").text(n)}}),l[i].on("render",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide();if(p){var n=p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" Listens";""!=e.show_name&&void 0!==e.show_name&&(n=" • "+n),l[i].$(".spp-show-count").text(n)}}),l[i].on("track:play",function(t){var i=this.$el.hasClass("spp-playing"),a=(t.model.get("data"),"track_"+t.model.cid);r(".spp-track, .smart-track-player").removeClass("spp-playing"),i?(r(".spp-player").removeClass("spp-playing"),this.$(".spp-player-playlist .spp-track").removeClass("spp-active"),soundManager.pauseAll(),n.request("track:entities:set",e,"playing",!1)):(soundManager.pauseAll(),soundManager.play(a),this.$el.addClass("spp-playing"),n.request("track:entities:set",e,"playing",!1),n.request("track:entity:set",e,t.model,"playing",!0),r('.spp-track[data-tid="'+a+'"]').addClass("spp-playing"))}),l[i].on("track:speed",function(t){var i=this.$el.hasClass("spp-playing"),a=(t.model.get("data"),"track_"+t.model.cid),s=soundManager.getSoundById(a);r(".spp-track, .smart-track-player").removeClass("spp-playing"),i||(soundManager.pauseAll(),soundManager.play(a),this.$el.addClass("spp-playing"),n.request("track:entities:set",e,"playing",!1),n.request("track:entity:set",e,t.model,"playing",!0),r('.spp-track[data-tid="'+a+'"]').addClass("spp-playing")),s.isHTML5&&(.5==s._a.playbackRate?(this.$el.hasClass("spp-speeding-half")&&this.$el.removeClass("spp-speeding-half"),s._a.playbackRate=1):1==s._a.playbackRate?(this.$el.addClass("spp-speeding-onehalf"),s._a.playbackRate=1.5):1.5==s._a.playbackRate?(this.$el.hasClass("spp-speeding-onehalf")&&this.$el.removeClass("spp-speeding-onehalf"),this.$el.addClass("spp-speeding-two"),s._a.playbackRate=2):2==s._a.playbackRate?(this.$el.hasClass("spp-speeding-two")&&this.$el.removeClass("spp-speeding-two"),this.$el.addClass("spp-speeding-three"),s._a.playbackRate=3):3==s._a.playbackRate?(this.$el.hasClass("spp-speeding-three")&&this.$el.removeClass("spp-speeding-three"),this.$el.addClass("spp-speeding-half"),s._a.playbackRate=.5):s._a.playbackRate=1)}),l[i].on("track:seek",function(e){function t(){a.bytesLoaded/a.bytesTotal>c&&(a.setPosition(c*a.durationEstimate),a.play(),clearInterval(p))}if(window.innerWidth>768){{var n=l[i].model.get("data"),a=soundManager.getSoundById("track_"+l[i].model.cid),s=l[i].$(".spp-track").offset(),o=e.pageX-s.left,u=r(e.currentTarget).outerWidth();a.position,n.durationEstimate}void 0==o&&(o=e.pageX-this.$(".spp-track").offset().left);var p,c=o/u;a.bytesLoaded/a.bytesTotal>c?(a.pause(),a.setPosition(c*a.durationEstimate),a.play()):(this.$el.hasClass("spp-playing")||a.play(),a.pause(),p=setInterval(t,250))}}),l[i].on("cursor:move",function(e){if(window.innerWidth>768){l[i].$el.addClass("spp-hover");var t=l[i].$(".spp-track").offset(),n=e.pageX-t.left;this.$(".spp-position").css({left:n+"px"})}}),l[i].on("cursor:out",function(){if(window.innerWidth>768){var e=l[i].model.get("data"),t=soundManager.getSoundById("track_"+l[i].model.cid);if(t){var n=t.position,a=e.duration,r=n/a*100;l[i].$(".spp-position").css({left:r+"%"})}l[i].$el.removeClass("spp-hover")}}),l[i].on("track:next",function(t){var u=t.model,p=(u.get("data"),"track_"+u.cid);soundManager.pauseAll(),soundManager.unload(p),r(".spp-player").removeClass("spp-playing"),s[i]=n.request("track:entities:current",e),o[i]=n.request("track:entities:paged",e,s[i],a.current_page,a.tracks_per_page);var c=s[i].indexOf(u),d=c+1,h=s[i].length-1,f=s[i].at(h>d?d:0);n.trigger("playlist:paging:track",e,f),l[i].trigger("track:update",f)}),l[i].on("track:previous",function(t){var r=t.model,u=(r.get("data"),"track_"+r.cid);soundManager.pauseAll(),soundManager.unload(u),s[i]=n.request("track:entities:current",e),o[i]=n.request("track:entities:paged",e,s[i],a.current_page,a.tracks_per_page);var p=s[i].indexOf(r),c=p-1,d=s[i].length-1,h=s[i].at(0>c?d:c);n.trigger("playlist:paging:track",e,h),l[i].trigger("track:update",h)}),l[i].on("track:update",function(t){{var a=(t.get("data"),"track_"+t.cid),s=(l[i].model.get("data"),"track_"+l[i].model.cid);this.$el.hasClass("spp-playing")}r(".spp-player").removeClass("spp-playing"),r(".spp-track").removeClass("spp-active"),s==a?l[i].trigger("track:play",this):(r('.spp-track[data-tid="'+s+'"]').addClass("spp-active"),soundManager.pauseAll(),soundManager.unload(s),l[i].model=t,l[i].render(),l[i].trigger("track:play",this),n.trigger("playlist:paging:update",e),n.trigger("track-details:show",e,t))}),e.playerRegion.show(l[i])},playTrack:function(e,t){var n=e.model.get("region");l[n].trigger("track:update",t)}}}),e.AskPatPlayerApp.Player.Controller}),define("apps/smart-podcast-player/app",["app"],function(e){return e.module("AskPatPlayerApp",function(e,t){var n={initCore:function(e){require(["apps/smart-podcast-player/core/controller"],function(t){t.init(e)})},setupColors:function(e){require(["apps/smart-podcast-player/core/controller"],function(t){t.setupColors(e)})},initPlaylist:function(e){require(["apps/smart-podcast-player/playlist/controller"],function(t){t.init(e)})},updatePlaylistPaging:function(e){require(["apps/smart-podcast-player/playlist/controller"],function(t){t.updatePaging(e)})},gotoPlaylistTrackPage:function(e,t){require(["apps/smart-podcast-player/playlist/controller"],function(n){n.gotoPlaylistTrackPage(e,t)})},filterPlaylist:function(e,t){require(["apps/smart-podcast-player/playlist/controller"],function(n){n.filter(e,t)})},initTrackDetails:function(e){require(["apps/smart-podcast-player/track-details/controller"],function(t){t.init(e)})},showTrack:function(e,t){require(["apps/smart-podcast-player/track-details/controller"],function(n){n.show(e,t)})},initPlayer:function(e){require(["apps/smart-podcast-player/player/controller"],function(t){t.init(e)})},playTrack:function(e,t){require(["apps/smart-podcast-player/player/controller"],function(n){n.playTrack(e,t)})}};t.on("app:core:init",function(){n.initCore()}),t.on("core:color:setup",function(){n.setupColors()}),t.on("player:track:play",function(e,t){n.playTrack(e,t)}),t.on("player:init",function(e){n.initPlayer(e)}),t.on("playlist:paging:update",function(e){n.updatePlaylistPaging(e)}),t.on("playlist:paging:track",function(e,t){n.gotoPlaylistTrackPage(e,t)}),t.on("playlist:init",function(e){n.initPlaylist(e)}),t.on("playlist:filter",function(e,t){n.filterPlaylist(e,t)}),t.on("track-details:init",function(e){n.initTrackDetails(e)}),t.on("track-details:show",function(e,t){n.showTrack(e,t)})}),e.PlaylistApp}),define("app",["jquery","marionette","soundmanager2"],function(e,t){var n=new t.Application;return n.options={},n.options.current_page=1,n.options.tracks_per_page=10,n.on("initialize:after",function(){(jQuery(".smart-podcast-player").length>0||jQuery(".smart-track-player").length>0)&&require(["apps/smart-podcast-player/app"],function(){soundManager.setup({url:AP_Player.baseUrl+"vendor/SoundManager2/swf/",flashVersion:9,useHighPerformance:!0,wmode:"transparent",useHTML5Audio:!0,preferFlash:!1,onready:function(){n.trigger("app:core:init")}})})}),n}),define("text!templates/track-template.html",[],function(){return'<% if ( data.show_logo != undefined && data.show_logo != null ) { %>\r\n \r\n<% } %>\r\n\r\n
    \r\n <% if ( data.artist != undefined && data.artist != null ) { %>\r\n

    <%= data.artist %>

    \r\n <% } %> \r\n\r\n

    <%= data.title %>

    \r\n

    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n\r\n
    \r\n
    \r\n
    \r\n\r\n
    \r\n <% if ( data.paid == true ) { %>\r\n <% if ( data.speedcontrol == true ) { %>\r\n \r\n <% } %>\r\n <% if ( data.social == true ) { %>\r\n \r\n
    \r\n <% if ( data.social_twitter == true ) { %>\r\n Share\r\n <% } %>\r\n <% if ( data.social_facebook == true ) { %>\r\n Share\r\n <% } %>\r\n <% if ( data.social_gplus == true ) { %>\r\n Share\r\n <% } %>\r\n <% if ( data.social_linkedin == true ) { %>\r\n Share\r\n <% } %>\r\n <% if ( data.social_stumble == true ) { %>\r\n Share\r\n <% } %>\r\n <% if ( data.social_pinterest == true ) { %>\r\n Share\r\n <% } %>\r\n
    \r\n
    \r\n <% } %>\r\n <% } %>\r\n\r\n <% var adl = document.createElement(\'a\'); %>\r\n <% var adloff = /Firefox/i.test(navigator.userAgent); %>\r\n\r\n <% if ( data.download == true && (typeof adl.download != "undefined") && (!adloff) && data.method != \'soundcloud\' ) { %><% } %>\r\n <% if ( data.download == true && (typeof adl.download == "undefined" || (adloff) || data.method == \'soundcloud\' ) ) { %><% } %>\r\n \r\n
    \r\n\r\n \r\n \r\n
    \r\n\r\n<%if ( data.paid != true ) { %>\r\n \r\n<% } %>\r\n'}),define("apps/smart-track-player/player/view",["app","text!templates/track-template.html"],function(e,t){return e.module("SmartTrackPlayerApp.Player.View",function(e,n,i,a,r,s){e.Player=a.ItemView.extend({template:s.template(t),className:"smart-track-player",events:{"mousemove .spp-track":"cursorMove","mouseout .spp-track":"cursorOut","click .spp-position":"seek","click .spp-play":"play","click .spp-button-download":"download","click .spp-dload":"download","click .spp-speed":"speed","hover .spp-play":"shareOut","hover .spp-button-download":"shareOut","hover .spp-dload":"shareOut","hover .spp-dloada":"shareOut","hover .spp-speed":"shareOut","hover .spp-share":"shareOn","hover .spp-share-options":"shareOn","click .spp-share":"shareOn","click .spp-share-icon":"share","mouseleave .spp-controls":"shareOut"},initialize:function(){this.hover=!1;var e=this;r(window).on("resize",function(){e.resize()})},download:function(e){e.preventDefault();var t=this.model.get("data"),n=t.download_url;"https:"===location.protocol&&(n=n.replace(/^http:\/\//i,"https://"));var i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if(i||"soundcloud"==t.method&&("http:"!==location.protocol||i)){var a="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:n;window.location=a}else{var a="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:AP_Player.homeUrl+"?spp_download="+n;this.$(".spp-downloader").prop("src",a)}},resize:function(){var e=this.model.get("data");if(window.innerWidth>768){var t=r(".smart-track-player").first().outerWidth();null===e.artwork_url||void 0===e.artwork_url||(t-=100),this.$(".spp-track").css({width:t+"px"})}else this.$(".spp-track").css({width:"100%"})},socialPopup:function(e,t){window.open(t,"pinterest","screenX=100,screenY=100,height=360,width=730"),e.preventDefault(),e.stopPropagation()},shareOn:function(){this.$(".spp-share-options").css("display","block")},shareOut:function(){this.$(".spp-share-options").css("display","none")},share:function(e){var t=this,n=t.model.get("data"),i=r(e.currentTarget),a=window.location.href;if((i.hasClass("spp-facebook")||i.hasClass("spp-fb-btn"))&&this.socialPopup(e,"https://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(a)+"&p[images][0]=&p[title]="+encodeURIComponent(n.title)),i.hasClass("spp-twitter")||i.hasClass("spp-twitter-btn")){var s=encodeURIComponent(n.title)+" "+encodeURIComponent(a);""!=n.hashtag&&void 0!=n.hashtag&&(s=s+" "+encodeURIComponent("#"+n.hashtag)),this.socialPopup(e,"https://twitter.com/home?status="+s)}(i.hasClass("spp-gplus")||i.hasClass("spp-gplus-btn"))&&this.socialPopup(e,"https://plus.google.com/share?url="+encodeURIComponent(a)),(i.hasClass("spp-stumble")||i.hasClass("spp-stumble-btn"))&&this.socialPopup(e,"https://www.stumbleupon.com/submit?url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title)),(i.hasClass("spp-pinterest")||i.hasClass("spp-pinterest-btn"))&&this.socialPopup(e,"https://pinterest.com/pin/create/button/?url="+encodeURIComponent(a)),(i.hasClass("spp-linkedin")||i.hasClass("spp-linkedin-btn"))&&this.socialPopup(e,"https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title))},stop:function(){this.$el.removeClass("spp-playing")},seek:function(e){function t(){a.bytesLoaded/a.bytesTotal>d&&(p=null!==a.duration?a.duration:a.durationEstimate,s.pause(),a.setPosition(d*p),s.play(),clearInterval(c))}if(r(window).outerWidth()>768){var n=this.model.get("data"),i="smart_track_"+n.track_uid+"_"+this.model.cid,a=soundManager.getSoundById(i),s=this;void 0===a&&(a=this.createSound(),a.load());var o=this.$(".spp-track").offset(),l=e.pageX-o.left,u=this.$(".spp-track").outerWidth(),p=null!==a.duration?a.duration:a.durationEstimate;void 0==l&&(l=e.pageX-this.$(".spp-track").offset().left);var c,d=l/u;a.bytesLoaded/a.bytesTotal>d&&null!==p?(p=null!==a.duration?a.duration:a.durationEstimate,this.$el.hasClass("spp-playing")&&this.pause(),a.setPosition(d*p),this.play()):(this.pause(),c=setInterval(t,250))}},cursorMove:function(e){if(this.trigger("cursor:move",e),window.innerWidth>768){this.hover=!0;var t=this.$(".spp-track").offset(),n=e.pageX-t.left;this.$(".spp-position").css({left:n+"px"})}},cursorOut:function(){if(window.innerWidth>768){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);if(n){var i=n.position,a=n.duration,r=i/a*100;this.$(".spp-position").css({left:r+"%"})}this.hover=!1}},onRender:function(){{var e=this.model.get("data");"smart_track_"+e.track_uid+"_"+this.model.cid}if(window.innerWidth>768){var t=r(".smart-track-player").first().outerWidth();null===e.show_logo||void 0===e.show_logo||(t-=60),this.$(".spp-track").css({width:t+"px"})}else this.$(".spp-track").css({width:"100%"}),this.$(".spp-show-logo").hide();void 0!==e.download&&this.$el.addClass("spp-has-download"),void 0!==e.color&&this.$el.addClass("stp-color-"+e.color),void 0!==e.get&&0!=e.get&&"file"==e.method&&this.fetchTrackData(e.url)},fetchTrackData:function(e){var t=this,n={action:"fetch_track_data",url:e};console.log("Getting track data"),r.post(AP_Player.ajaxurl,n,function(e){var n=t.model.get("data");e=JSON.parse(e),"0"!=e?(void 0===typeof e.title||void 0!=n.title&&'Getting file data...'!=n.title||(n.title=e.title),void 0!==typeof e.artist&&void 0==n.artist&&(n.artist=e.artist),n.get=!1,t.model.set({data:n}),void 0!==typeof e.title&&t.$(".spp-track-title").text(n.title),void 0!==typeof e.artist&&(t.$(".spp-artist").length>0?t.$(".spp-artist").text(n.artist):t.$(".spp-track-title").before('

    '+n.artist+"

    ")),void 0!=t.loading_timer&&clearInterval(t.loading_timer),t.render()):(n.title="Unable to retrieve track data",n.get=!1,t.model.set({data:n}),t.render())})},pause:function(){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);n.pause(),this.$el.removeClass("spp-playing")},speed:function(){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);if(void 0===n)n=this.createSound(),this.play();else{var i=this.$el.hasClass("spp-playing");i||this.play()}n.isHTML5&&(.5==n._a.playbackRate?(this.$el.hasClass("spp-speeding-half")&&this.$el.removeClass("spp-speeding-half"),n._a.playbackRate=1):1==n._a.playbackRate?(this.$el.addClass("spp-speeding-onehalf"),n._a.playbackRate=1.5):1.5==n._a.playbackRate?(this.$el.hasClass("spp-speeding-onehalf")&&this.$el.removeClass("spp-speeding-onehalf"),this.$el.addClass("spp-speeding-two"),n._a.playbackRate=2):2==n._a.playbackRate?(this.$el.hasClass("spp-speeding-two")&&this.$el.removeClass("spp-speeding-two"),this.$el.addClass("spp-speeding-three"),n._a.playbackRate=3):3==n._a.playbackRate?(this.$el.hasClass("spp-speeding-three")&&this.$el.removeClass("spp-speeding-three"),this.$el.addClass("spp-speeding-half"),n._a.playbackRate=.5):n._a.playbackRate=1)},play:function(){var e=this.$el.hasClass("spp-playing"),t=this.model.get("data"),n="smart_track_"+t.track_uid+"_"+this.model.cid,i=soundManager.getSoundById(n);void 0===i&&(i=this.createSound()),r(".spp-track").removeClass("spp-playing"),e?(this.$el.removeClass("spp-playing"),soundManager.pauseAll()):(soundManager.pauseAll(),i.play(),this.$el.addClass("spp-playing"))},createSound:function(){var e=this,t=this.model,n=t.get("data"),i="smart_track_"+n.track_uid+"_"+this.model.cid,a=soundManager.createSound({id:i,url:n.url,type:"audio/mp3",onload:function(){},onresume:function(){},onplay:function(){},onid3:function(){},onfinish:function(){e.stop()},whileloading:function(){var t=this.bytesLoaded/this.bytesTotal*100+"%";e.$(".spp-loaded").width(t),this.bytesLoaded/this.bytesTotal==1&&e.$(".spp-loaded-container").fadeOut("slow")},whileplaying:function(){var t,n,i,a,r=this.durationEstimate,s=this.position,o=r-s;t=s/1e3,n=t/60,i=n/60,a=Math.floor(i)+":"+pad(Math.floor(n%60),2)+":"+pad(Math.floor(t%60),2),t=o/1e3,n=t/60,i=n/60,remaining_time=pad(Math.floor(n),2)+":"+pad(Math.floor(t%60),2),e.$(".spp-duration").text("-"+remaining_time);var l=s/r*100;e.$(".spp-current-time").css({width:l+"%"}),e.hover===!1&&e.$(".spp-position").css({left:l+"%"})}});return a}})}),e.SmartTrackPlayerApp.Player.View}),define("entities/player-track",["app"],function(e){e.module("Entities",function(e,t,n){e.Player=n.Model.extend({defaults:{data:{}}}),e.Track=n.Model.extend({defaults:{data:{active:!1,artwork_url:"",attachments_uri:"",bpm:null,comment_count:0,commentable:!0,created_at:"",current_time:"0:00:00",description:"",download_count:0,download_url:"",downloadable:!0,duration:0,duration_time:"0:00:00",episode_number:0,embeddable_by:"all",favoritings_count:0,filename:"",genre:"",id:0,isrc:"",key_signature:"",kind:"track",label_id:null,label_name:"",license:"",original_content_size:0,original_format:"mp3",permalink:"",permalink_url:"",playing:!1,playback_count:0,purchase_title:null,purchase_url:null,release:"",release_day:null,release_month:null,release_year:null,sharing:"",show_name:"",state:"",stream_url:"",streamable:!0,tag_list:"",tags:"",tag_string:"",title:"",track_type:"",uri:"",user:{avatar_url:"",id:0,kind:"user",permalink:"",permalink_url:"",uri:"",username:""},user_id:0,video_url:null,waveform_url:"",show_notes:""}}})})}),define("entities/player",["app","entities/player-track"],function(e){return e.module("Entities",function(e,t){var n=[],i=function(e){var i=e.model.get("region");n[i]=t.request("track:entity:current",e)},a={getPlayerEntities:function(e){var t=e.model.get("region");return void 0===n[t]&&i(e),n[t]}};t.reqres.setHandler("player:entity",function(e){return a.getPlayerEntities(e)})}),e.Entities}),define("apps/smart-track-player/player/controller",["app-player","apps/smart-track-player/player/view","entities/player","entities/player-track","soundmanager2"],function(e,t){return e.module("SmartTrackPlayerApp.Player",function(e,n,i,a,r){e.Controller={init:function(){r(".smart-track-player").length>0&&n.trigger("core:color:setup"),r(".smart-track-player").each(function(e,n){var a=r(n).data("url"),s={url:a,track_uid:r(n).data("uid"),show_logo:r(n).data("image"),download:r(n).data("download"),download_url:a,color:r(n).data("color"),title:r(n).data("title"),artist:r(n).data("artist"),filename:"",social:r(n).data("social"),social_twitter:r(n).data("social_twitter"),social_facebook:r(n).data("social_facebook"),social_gplus:r(n).data("social_gplus"),social_linkedin:r(n).data("social_linkedin"),social_stumble:r(n).data("social_stumble"),social_pinterest:r(n).data("social_pinterest"),social_email:r(n).data("social_email"),speedcontrol:r(n).data("speedcontrol"),paid:r(n).data("paid"),get:r(n).data("get"),method:"file"},o=document.createElement("a"); o.href=a;var l=o.hostname;if(l.indexOf("soundcloud.com")>-1){var u="",p={action:"get_soundcloud_track",stream:a};r.ajax({url:AP_Player.ajaxurl,dataType:"json",async:!1,type:"POST",data:p,success:function(e){u=e}}),s.method="soundcloud",s.url=u.stream_url+"?consumer_key="+AP_Player.soundcloudConsumerKey,s.title=s.title?s.title:u.title,s.download_url=u.download_url,s.filename=u.permalink+".mp3";var c=new i.Model({data:s}),d=new t.Player({model:c});d.render(),r(n).after(d.$el);var h="?spp_view=1";h+="&type=track",h+="&url="+s.url,h+="&download="+(void 0!=s.download?encodeURIComponent(s.download):""),h+="&title="+(void 0!=s.title?encodeURIComponent(s.title):""),h+="&artist="+(void 0!=s.artist?encodeURIComponent(s.artist):""),h+="&image="+(void 0!=s.image?encodeURIComponent(s.image):""),h+="&color="+(void 0!=s.color?encodeURIComponent(s.color):""),r(n).remove()}else{void 0!=s.get&&void 0==s.title&&(s.title='Getting file data...'),s.filename=s.url.replace(/^.*[\\\/]/,"");var c=new i.Model({data:s}),d=new t.Player({model:c});d.on("render",function(){if(this.$(".spp-loading-ellipsis").length>0){var e=this,t=0;this.loading_timer=setInterval(function(){t++;var n=new Array(t%5).join(".");e.$(".spp-loading-ellipsis").text("."+n)},300)}}),d.render(),r(n).after(d.$el);var h="?spp_view=1";h+="&type=track",h+="&url="+s.url,h+="&download="+(void 0!=s.download?encodeURIComponent(s.download):""),h+="&image="+(void 0!=s.image?encodeURIComponent(s.image):""),h+="&color="+(void 0!=s.color?encodeURIComponent(s.color):""),r(n).remove()}})},setupColors:function(){var e=new Array;r(".smart-track-player").each(function(t,n){var i=r(n).attr("class"),a=i.trim().split(/\s+/);r.each(a,function(t,n){var i=n.indexOf("stp-color-");if(i>-1){var a=n.replace("stp-color-","");-1==r.inArray(a,e)&&e.push(a)}})});var t={action:"get_colors",stp_colors:e};r.post(AP_Player.ajaxurl,t,function(e){r("head").append(e)})}}}),e.SmartTrackPlayerApp.Player.Controller}),define("apps/smart-track-player/app",["app-player"],function(e){return e.module("SmartTrackPlayerApp",function(e,t){var n={initPlayer:function(){require(["apps/smart-track-player/player/controller"],function(e){e.init()})},setupColors:function(e){require(["apps/smart-track-player/player/controller"],function(t){t.setupColors(e)})}};t.on("player:init",function(){n.initPlayer()}),t.on("core:color:setup",function(){n.setupColors()})}),e.SmartTrackPlayerApp}),define("app-player",["marionette","soundmanager2"],function(e){var t=new e.Application;return t.options={},t.on("initialize:after",function(){jQuery(".smart-track-player").length>0&&require(["apps/smart-track-player/app"],function(){soundManager.setup({url:AP_Player.baseUrl+"vendor/SoundManager2/swf/",flashVersion:9,wmode:"transparent",useHTML5Audio:!0,preferFlash:!1,onready:function(){t.trigger("player:init")}})})}),t}),"function"==typeof jQuery&&define("jquery",function(){return jQuery}),"function"==typeof _&&define("underscore",function(){return _}),require.config({name:"AP_Player_App",baseUrl:"/wp-content/plugins/smart-podcast-player/assets/js/",urlArgs:"bust="+(new Date).getTime(),paths:{backbone:"vendor/amdjs/backbone","backbone.wreqr":"vendor/amdjs/backbone.wreqr","backbone.babysitter":"vendor/amdjs/backbone.babysitter",marionette:"vendor/amdjs/marionette",soundmanager2:"vendor/soundmanager2-jsmin","mwheel-intent":"vendor/mwheelIntent"},shim:{soundmanager2:{exports:"soundManager"},"vendor/jquery.mousewheel":["jquery","mwheel-intent"],"vendor/jquery.jscrollpane.min":["jquery","vendor/jquery.mousewheel","mwheel-intent"]}}),require(["jquery","app"],function(e,t){var n=jQuery(window).width(),i=jQuery(window).height();jQuery(window).on("resize",function(){(n!=jQuery(window).width()||i!=jQuery(window).height())&&(n=jQuery(window).width(),i=jQuery(window).height(),jQuery(window).trigger("spp_resize"))}),e(window).resize(function(){e(".smart-podcast-player").each(function(){var t=e(this).parent(),n=e(t).width(),i=e(window).width();768>n||768>i?t.addClass("spp-player-small"):t.removeClass("spp-player-small")})}),e(".smart-podcast-player").each(function(){var t=e(this).parent(),n=e(t).width(),i=e(window).width();(768>n||768>i)&&t.addClass("spp-player-small")}),t.start()}),require(["jquery","app-player"],function(e,t){jQuery(".smart-track-player ").length>0&&t.start()}),define("main",function(){});