function setupKoBootstrap(n,t){"use strict";var i=function(n){return function(){return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}}(function(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)});t.fn.outerHtml||(t.fn.outerHtml=function(){var n,i,r;return this.length===0?!1:(n=this[0],i=n.tagName.toLowerCase(),n.outerHTML)?n.outerHTML:(r=t.map(n.attributes,function(n){return n.name+'="'+n.value+'"'}),"<"+i+(r.length>0?" "+r.join(" "):"")+">"+n.innerHTML+"<\/"+i+">")});n.bindingHandlers.typeahead={init:function(i,r,u){var o=t(i),f=u(),s=function(n){return function(i,r){var u,f;u=[];f=new RegExp(i,"i");t.each(n,function(n,t){f.test(t)&&u.push({value:t})});r(u)}},e={source:s(n.utils.unwrapObservable(r()))};f.typeaheadOptions&&t.each(f.typeaheadOptions,function(t,i){e[t]=n.utils.unwrapObservable(i)});o.attr("autocomplete","off").typeahead({hint:!0,highlight:!0,minLength:1},e)}};n.bindingHandlers.progress={init:function(r,u,f,e){var o=t(r),s=t("<div/>",{"class":"progress-bar","data-bind":"style: { width:"+u()+" }"});o.attr("id",i()).addClass("progress progress-info").append(s);n.applyBindingsToDescendants(e,o[0])}};n.bindingHandlers.alert={init:function(i,r){var f=t(i),u=n.utils.unwrapObservable(r()),e=t("<button/>",{type:"button","class":"close","data-dismiss":"alert"}).html("&times;"),o=t("<p/>").html(u.message);f.addClass("alert alert-"+u.priority).append(e).append(o)}};n.bindingHandlers.tooltip={update:function(i,r){var u,f,o,e,s;if(f=n.utils.unwrapObservable(r()),u=t(i),n.isObservable(f.title)){e=!1;u.on("show.bs.tooltip",function(){e=!0});u.on("hide.bs.tooltip",function(){e=!1});s=f.animation||!0;f.title.subscribe(function(){e&&(u.data("bs.tooltip").options.animation=!1,u.tooltip("fixTitle").tooltip("show"),u.data("bs.tooltip").options.animation=s)})}o=u.data("bs.tooltip");o?t.extend(o.options,f):u.tooltip(f)}};n.bindingHandlers.popover={init:function(i,r,u,f){var c=t(i),e=n.utils.unwrapObservable(r()),o=e.template||!1,s=e.options||{title:"popover"},h=e.data||!1;o!==!1&&(s.content=h?"<!-- ko template: { name: template, if: data, data: data } --><!-- /ko -->":t("#"+o).html(),s.html=!0);c.on("shown.bs.popover",function(i){var l=t(i.target).data(),r=l["bs.popover"].$tip,a=l["bs.popover"].options||{},c=t(i.target),u=c.position(),s={x:c.outerWidth(),y:c.outerHeight()},e;h?n.applyBindings({template:o,data:h},r[0]):n.applyBindings(f,r[0]);e={x:r.outerWidth(),y:r.outerHeight()};r.find('button[data-dismiss="popover"]').click(function(){c.popover("hide")});switch(a.placement){case"right":r.css({left:s.x+u.left,top:s.y/2+u.top-e.y/2});break;case"left":r.css({left:u.left-e.x,top:s.y/2+u.top-e.y/2});break;case"top":r.css({left:u.left+(s.x/2-e.x/2),top:u.top-e.y});break;case"bottom":r.css({left:u.left+(s.x/2-e.x/2),top:u.top+s.y})}});return c.popover(s),{controlsDescendantBindings:!0}}};n.bindingHandlers.modal={init:function(i,r,u,f){var v=t(i),o=n.utils.unwrapObservable(r()),c=o.template||!1,l=o.options||{},s=o.data||!1,y=o.fade||!1,a=o.openModal||!1,h,e;l.show=!1;h={"class":"modal"+(y?" fade":""),"tab-index":"-1",role:"dialog","aria-hidden":"true"};s&&(h["data-bind"]="template: { name: template, if: data, data: data }");e=t("<div/>",h);s||e.html(t("#"+c).html());e.modal(l);v.on("click",function(){s?n.applyBindings({template:c,data:s},e[0]):n.applyBindings(f,e[0]);e.modal("show");a&&a();t(".modal-backdrop").css({height:t(window).height(),position:"fixed"})});return{controlsDescendantBindings:!0}}}}window.common=function(){function t(n){var u={},f,t,i,e,o,s,h,r;if(n===null)return u;for(f=n.split("&"),r=0;r<f.length;r++)t=f[r],i=t.indexOf("="),i===-1?(e=t,o=null):(e=t.substr(0,i),o=t.substr(i+1)),s=decodeURIComponent(e),h=decodeURIComponent(o),u[s]=h;return u}var n={};return n.getFragment=function(){return window.location.hash.indexOf("#")===0?t(window.location.hash.substr(1)):{}},n}(),function(n,t,i,r){"use strict";r(t,{href:{update:function(n,i){t.attr.update(n,function(){return{href:i()}})}},src:{update:function(n,i){t.attr.update(n,function(){return{src:i()}})}},hidden:{update:function(n,r){var u=i(r());t.visible.update(n,function(){return!u})}},instantValue:{init:function(i,u,f){t.value.init(i,u,n.observable(r(f(),{valueUpdate:"afterkeydown"})))},update:t.value.update},toggle:{init:function(t,i){var r=i();n.applyBindingsToNode(t,{click:function(){r(!r())}})}},stopBinding:{init:function(){return{controlsDescendantBindings:!0}}},toJSON:{update:function(i,r){return t.text.update(i,function(){return n.toJSON(r(),null,2)})}},timeAgo:{dateToTimeAgo:function(n){var i=((new Date).getTime()-n.getTime())/1e3,t=Math.floor(i/86400);return t===0&&(i<60&&"just now"||i<120&&"a minute ago"||i<3600&&Math.floor(i/60)+" minutes ago"||i<7200&&"an hour ago"||i<86400&&Math.floor(i/3600)+" hours ago")||t===1&&"yesterday"||t<31&&t+" days ago"||t<60&&"one month ago"||t<365&&Math.ceil(t/30)+" months ago"||t<730&&"one year ago"||Math.ceil(t/365)+" years ago"},update:function(n,r){var u=i(r()),f=new Date(u),e=t.timeAgo.toTimeAgo(f);return t.html.update(n,function(){return'<time datetime="'+encodeURIComponent(u)+'">'+e+"<\/time>"})}},jPlayer:{init:function(t,i,r){var u=n.utils.unwrapObservable(i()),e=r(),f=[],o;u[0]&&f.push({file:u[0]});u[1]&&f.push({file:u[1]});u[2]&&f.push({file:u[2]});o={playlist:[{image:e.posterUrl(),sources:f}],height:450,width:800};jPlayer(e.playerId).setup(o)},update:function(t,i,r){var u=n.utils.unwrapObservable(i()),e=r(),f=[],o;u[0]&&f.push({file:u[0]});u[1]&&f.push({file:u[1]});u[2]&&f.push({file:u[2]});o=[{image:e.posterUrl(),sources:f}];jPlayer(e.playerId).onReady(function(){jPlayer(e.playerId).load(o)})}}});n.virtualElements.allowedBindings.stopBinding=!0}(ko,ko.bindingHandlers,ko.utils.unwrapObservable,ko.utils.extend),function(n){"use strict";typeof define=="function"&&define.amd?define(["require","exports","knockout","jquery"],function(t,i,r,u){n(r,u)}):n(window.ko,jQuery)}(setupKoBootstrap);com.dotnetrocks.logger=function(){function t(t,i){toastr.error(t,i);n("Error: "+t)}function i(t,i){toastr.info(t,i);n("Info: "+t)}function r(t,i){toastr.success(t,i);n("Success: "+t)}function u(t,i){toastr.warning(t,i);n("Warning: "+t)}function n(){var n=window.console;!!n&&n.log&&n.log.apply&&n.log.apply(n,arguments)}toastr.options.timeOut=4e3;toastr.options.positionClass="toast-bottom-right";return{error:t,info:i,success:r,warning:u,log:n}}();com.dotnetrocks.models=function(){function t(t){t.addEntityType({shortName:"Show",namespace:"DotNetRocksvNext",dataProperties:{ShowID:{dataType:n.Int32,isPartOfKey:!0},ShowNumber:{dataType:n.Int32},ShowTitle:{dataType:n.String},ShowHeader:{dataType:n.String},Description:{dataType:n.String},DatePublished:{dataType:n.DateTime},DisplayableDatePublished:{dataType:n.String},DownloadUrl:{dataType:n.String},ShowUrl:{dataType:n.String},Minutes:{dataType:n.Int32},TotalCount:{dataType:n.Int32},ROWNUM:{dataType:n.Int64}}})}var n=breeze.DataType;return{initialize:t}}();com.dotnetrocks.dataservice=function(n,t,i){function s(t,i,f){var e=n.EntityQuery.from("shows-paged/"+i+"/"+t+"/"+f);return r.executeQuery(e).then(u)}function h(t,i,f){var e=n.EntityQuery.from("shows-paged-post").withParameters({$method:"POST",$encoding:"JSON",$data:{Page:i,PageSize:t,SearchString:f}});return r.executeQuery(e).then(u)}function c(t){var i=n.EntityQuery.from("shows/"+t+"/top");return r.executeQuery(i).then(u)}function l(){var t=n.EntityQuery.from("shows/upcoming");return r.executeQuery(t).then(u)}function a(t){var i=n.EntityQuery.from("shows/"+t+"/info");return r.executeQuery(i).then(u)}function v(){var t=n.EntityQuery.from("shows/get-tags");return r.executeQuery(t).then(u)}function u(n){return n.results}function y(n,t,i,u,e,o,s){console.log("Creating new show object: "+i);var h=r.createEntity(f,{ShowID:n,ShowNumber:t,ShowTitle:i,DownloadUrl:u,DatePublished:e,DisplayableDatePublished:o,Minutes:s});return console.log(h.ShowNumber()),h}var e=com.dotnetrocks.vars.app_base+"/api/";console.log("Dataservice initialized");var f,o=new n.DataService({serviceName:e,hasServerMetadata:!1}),r=new n.EntityManager({dataService:o}),i=com.dotnetrocks.models;return i.initialize(r.metadataStore),f=r.metadataStore.getEntityType("Show"),{getShows:s,getShowsPost:h,getTopShows:c,createNewShow:y,getShowDetails:a,getUpcomingShows:l,getTags:v}}(breeze,com.dotnetrocks.logger);com.dotnetrocks.showviewModel=function(n,t){function o(){this.ShowID="";this.ShowNumber="";this.ShowTitle="";this.ShowHeader="";this.Description="";this.DatePublished="";this.DisplayableDatePublished="";this.DownloadUrl="";this.ShowUrl="";this.Minutes=""}function s(n,t,i){var r=this;r.Tag=ko.observable(n);r.Number=ko.observable(t);r.Score=ko.observable(i);r.Selected=ko.observable(!1)}function h(){r()}function u(n){$("#show_pop").modal("hide").promise().done(function(){$.ajaxPrefilter(function(n){n.async=!0});$("#show_pop .modal-content").load(i.modalUrlBase+n,function(t,r){r==="success"&&(i.displayedShowNumber(n),$("#show_pop").modal({backdrop:jQuery.usingSafari(!0)?"static":!0,show:!0}))})})}function r(r,u){function y(n){r&&r===!0||u&&u===!0?i.items(n):i.items(i.items().concat(n));n[0]?i.totalRecords(parseInt(n[0].TotalCount)):i.totalRecords(0);i.initialized()===!1&&c();i.filteredTags(i.selectedTags())}function p(t){n.error(t.message,"Could not retrieve latest shows");Raygun.send("Latest shows query failed: "+t.message)}var e,o,h,s,l,v;try{if(e=i.search(),i.initialized()===!1&&(o=f("tags"),o!=null&&o!=""))for(h=o.split(","),s=0;s<h.length;s++)i.selectedTags.push(h[s]);l=i.selectedTags();l.length>0&&(e+="||"+l);i.pageNumber(i.pageNumber()+1);v=i.pageSize();r&&r===!0?(i.pageSize(1e4),i.pageNumber(1)):i.pageSize(10);u&&u===!0&&i.pageNumber(1);t.getShowsPost(i.pageSize(),i.pageNumber(),e).then(y).fail(p)}catch(a){n.error(a.message,"Could not retrieve latest shows");Raygun.send(a,{issue:"Latest shows query failed",searchText:e,pageNumber:i.pageNumber(),pageSize:i.pageSize()})}}function c(){var n=i.items().length,t;if(n>0)for(n>5&&(n=5),t=0;t<=n;t++)i.playlist.push(i.items()[t]);l()}function l(){function e(n){i.upcomingItems(n);var t=f("show");t!=null&&t!=""?u(t):(t=f("showNum"),t!=null&&t!=""&&u(t))}function o(t){n.error(t.message,"Could not retrieve upcoming shows");Raygun.send("Upcoming shows query failed: "+t.message)}try{t.getUpcomingShows().then(e).fail(o).fin(a)}catch(r){n.error(r.message,"Could not retrieve upcoming shows");Raygun.send(r,{issue:"Upcoming shows query failed"})}}function a(){function r(n){var r,t;if(n&&(r=n.length-1,r>0))for(t=0;t<=r;t++)i.tags.push(new s(n[t].Tag,n[t].Number,n[t].Score))}function u(t){n.error(t.message,"Could not retrieve list of show tags.");Raygun.send(e,{issue:"Get Show tags query failed"})}try{t.getTags().then(r).fail(u)}catch(e){n.error(e.message,"Could not retrieve list of show tags.");Raygun.send(e,{issue:"Get Show tags query failed"})}i.initialized(!0)}function f(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i="[\\?&]"+n+"=([^&#]*)",r=new RegExp(i,"i"),t=r.exec(window.location.search);return t===null?"":decodeURIComponent(t[1].replace(/\+/g," "))}var i={items:ko.observableArray(),playlist:ko.observableArray(),upcomingItems:ko.observableArray(),show:ko.observable(),displayedShowNumber:ko.observable(""),playingShowNumber:ko.observable(""),trackPaused:ko.observable(!1),showDetails:ko.observable(),pageSize:ko.observable(10),pageNumber:ko.observable(0),totalRecords:ko.observable(0),search:ko.observable(""),tags:ko.observableArray(),selectedTags:ko.observableArray(),filteredTags:ko.observableArray(),showTagsFilter:ko.observable(!1),selectedRSSTags:ko.observableArray(),modalUrlBase:com.dotnetrocks.vars.app_base+"Home/ShowDetailsModal/",upcomingShowImgUrlBase:com.dotnetrocks.vars.app_base+"Content/img/guests/upcoming/",openModal:function(){},initialized:ko.observable(!1),playTrack:function(t){try{var r=this.playlist.indexOf(t);com.dotnetrocks.vars.werock.play(r)}catch(i){n.error(i.message,"Unable to play track");Raygun.send(i,{issue:"Unable to play track (com.dotnetrocks.showviewModel.playTrack failed)",trackData:t})}},playTrackDirect:function(n){try{com.dotnetrocks.vars.playaPlay(n.ShowTitle,n.DownloadUrl,n.ShowNumber)}catch(t){Raygun.send(t,{issue:"Unable to play track directly (com.dotnetrocks.showviewModel.playTrackDirect failed)",trackData:n})}},addToPlaylist:function(n){this.addShowToPlaylist(n.ShowNumber,n.ShowID,n.ShowTitle,n.DownloadUrl,n.DatePublished,n.DisplayableDatePublished,n.Minutes)},addShowToPlaylist:function(t,r,u,f,e,s,h){var l,c;try{l=ko.utils.arrayFirst(i.playlist(),function(n){return parseInt(n.ShowNumber)===parseInt(t)});l===null?(c=new o,c.ShowID=r,c.ShowNumber=t,c.ShowTitle=u,c.DownloadUrl=f,c.DatePublished=e,c.DisplayableDatePublished=s,c.Minutes=h,n.info("Added show #"+t+" to the playlist"),i.playlist.push(c),i.displayedShowNumber().length===0):n.warning("The show is already in your playlist!")}catch(a){n.error(a.message,"Could not add show to the playlist");Raygun.send(a,{issue:"Unable to add show to playlist (com.dotnetrocks.showviewModel.addShowToPlaylist failed)",ShowNumber:t,ShowId:r,ShowTitle:u,DownloadUrl:f,DatePublished:e,DisplayableDatePublished:s,Minutes:h})}},showDetails:function(n){u(n.ShowNumber)},showDetailsFromId:function(n){u(n)},addMoreShows:function(n,t){r(n,t)},clearFilter:function(){i.search("");r(!1,!0)},clearTagsFilter:function(){i.selectedTags.removeAll();r(!1,!0)},filterTags:function(n){i.showTagsFilter(n)},toggleTagFilter:function(){i.showTagsFilter(!i.showTagsFilter())},displayShowsByTagFromModal:function(n){$("#show_pop").modal("hide");i.search("");i.selectedTags.removeAll();i.selectedTags.push(n);r(!1,!0)},openRSSModal:function(n){$("#show_pop").modal("hide");$("#rss_pop").modal("hide");n===!0&&i.selectedRSSTags(i.selectedTags());$("#rss_pop").modal("show")},createRSSFeedFromTags:function(){var t=i.selectedRSSTags(),n="";return t.length>0&&(n=i.selectedRSSTagsFormatted()),"http://www.pwop.com/feed.aspx?show=dotnetrocks&filetype=master&tags="+n},createRSSFeedMaster:function(){return"http://www.pwop.com/feed.aspx?show=dotnetrocks&filetype=master"}};return i.playlist.subscribe(function(n){n.forEach(function(n){if(n.status==="added"){var t={};t.title=ko.unwrap(n.value.ShowTitle);t.artist=ko.unwrap(n.value.ShowNumber);t.mp3=ko.unwrap(n.value.DownloadUrl);com.dotnetrocks.vars.werock.add(t)}else n.status==="deleted"})},null,"arrayChange"),i.pages=ko.computed(function(){return Math.ceil(this.totalRecords()/this.pageSize())},i),i.morePages=ko.computed(function(){return this.pageNumber()<this.pages()},i),i.selectedTagsFormatted=ko.computed(function(){return encodeURIComponent(this.selectedTags()).replace(/'/g,"%27").replace(/"/g,"%22")},i),i.selectedRSSTagsFormatted=ko.computed(function(){return encodeURIComponent(this.selectedRSSTags()).replace(/'/g,"%27").replace(/"/g,"%22")},i),h(),i}(com.dotnetrocks.logger,com.dotnetrocks.dataservice);$(document).ready(function(){ko.applyBindings(com.dotnetrocks.showviewModel)});$(document).ready(function(){$(".music_widget").on("click",".play_it",function(n){n.preventDefault();var t=ko.contextFor(this);t.$parent.playTrack(ko.dataFor(this))});$(".music_widget").on("click",".btn_details",function(n){n.preventDefault();var t=ko.contextFor(this);t.$parent.showDetails(ko.dataFor(this))})});$(document).ready(function(){$(".shows_widget").on("click",".latest_shows_play_track",function(n){n.preventDefault();var t=ko.contextFor(this);t.$parent.playTrackDirect(ko.dataFor(this))});$(".shows_widget").on("click",".latest_shows_add_playlist",function(n){n.preventDefault();var t=ko.contextFor(this);t.$parent.addToPlaylist(ko.dataFor(this))});$(".shows_widget").on("click",".btn_details",function(n){n.preventDefault();var t=ko.contextFor(this);t.$parent.showDetails(ko.dataFor(this))});$(".shows_widget").on("click",".btn_load_more",function(n){n.preventDefault();com.dotnetrocks.showviewModel.addMoreShows(!1)});$(".shows_widget").on("click",".btn_load_all",function(n){n.preventDefault();com.dotnetrocks.showviewModel.addMoreShows(!0)});$("#section_1").on("click",".btn_search",function(n){n.preventDefault();com.dotnetrocks.showviewModel.addMoreShows(!1,!0)});$("#section_1").on("click",".btn_apply_filter",function(n){n.preventDefault();com.dotnetrocks.showviewModel.addMoreShows(!1,!0);com.dotnetrocks.showviewModel.filterTags(!1)});$("#section_1").on("click",".btn_create_rss",function(n){n.preventDefault();com.dotnetrocks.showviewModel.openRSSModal(!0)});$("#section_1").on("click",".btn_copy_filter",function(n){n.preventDefault();$(this).data("bs.popover")||($("#tags-link").text(com.dotnetrocks.vars.app_base+"/?tags="+com.dotnetrocks.showviewModel.selectedTagsFormatted()),$(this).popover({html:!0,content:function(){return $(".copy-link-to-tags-container").html()}}));$(this).popover("toggle");$("#copy-link-to-tags-close").on("click",function(n){n.preventDefault();$(".btn_copy_filter").popover("hide")});$("#tags-link").focus(function(){return this.setSelectionRange(0,9999),!1}).mouseup(function(){return!1})});$("#section_1").on("shown.bs.popover",".btn_copy_filter",function(){document.getElementById("tags-link").setSelectionRange(0,9999)});$("#section_1").on("keypress","#search-box",function(n){var t=n.which||n.keyCode;return t!==13?!0:($("#search-box").blur(),console.log("searching shows..."),com.dotnetrocks.showviewModel.addMoreShows(!1,!0),!1)});$(".shows_widget").on("click",".clear-filter",function(n){n.preventDefault();com.dotnetrocks.showviewModel.clearFilter()});$(".shows_widget").on("click",".clear-tags-filter",function(n){n.preventDefault();com.dotnetrocks.showviewModel.clearTagsFilter()});$("#section_1").on("click",".btn_tags",function(n){n.preventDefault();com.dotnetrocks.showviewModel.toggleTagFilter()});$("#section_1").on("click","#btn_close_tags",function(n){n.preventDefault();com.dotnetrocks.showviewModel.filterTags(!1)});$("#section_1").on("click",".btn_close_filter",function(n){n.preventDefault();com.dotnetrocks.showviewModel.filterTags(!1)});$(".navbar-nav").on("click","#nav-tags",function(){com.dotnetrocks.showviewModel.filterTags(!0)})});$(document).ready(function(){$("#rss_pop").on("click",".btn_apply_filter",function(n){n.preventDefault();var t=com.dotnetrocks.showviewModel.createRSSFeedFromTags(),i='<a href="'+t+'" target="_blank"><span class="fa-stack fa-lg"><i class="fa fa-square fa-stack-2x"><\/i><i class="fa fa-rss fa-stack-1x fa-inverse"><\/i><\/span><span style="font-size:1.2em">&nbsp;&nbsp;Click here for your personalized feed!<\/span><\/a>';$("#custom-rss-link").html(i);$("#custom-rss-link").show()});$("#rss_pop").on("click",".btn_master_feed",function(n){n.preventDefault();var t=com.dotnetrocks.showviewModel.createRSSFeedMaster(),i='<a href="'+t+'" target="_blank"><span class="fa-stack fa-lg"><i class="fa fa-square fa-stack-2x"><\/i><i class="fa fa-rss fa-stack-1x fa-inverse"><\/i><\/span><span style="font-size:1.2em">&nbsp;&nbsp;Click here for the master feed!<\/span><\/a>';$("#custom-rss-link").html(i);$("#custom-rss-link").show()});$("#rss_pop").on("hidden.bs.modal",function(){$("#custom-rss-link").hide();com.dotnetrocks.showviewModel.selectedRSSTags.removeAll()})})