;(function($,_,undefined){"use strict";let sbselectors=['[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="mp3"]:not([data-sbplayer])','[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="MP3"]:not([data-sbplayer])','[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="ogg"]:not([data-sbplayer])','[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="OGG"]:not([data-sbplayer])','[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="wav"]:not([data-sbplayer])','[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="WAV"]:not([data-sbplayer])','[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="flac"]:not([data-sbplayer])','[data-role="commentContent"] a.ipsAttachLink.ipsAttachLink_block[data-fileext="FLAC"]:not([data-sbplayer])'];var sbselects=sbselectors.join(", ");ips.controller.mixin('sbaudiobits','core.front.core.comment',true,function(){this.before('quoteComment',function(e){$(".sbAttachPlayer").remove();$("[data-sbfileid]").remove();$("a.ipsAttachLink.ipsAttachLink_block").removeAttr("data-sbplayer");});this.before('multiQuoteComment',function(){$(".sbAttachPlayer").remove();$("[data-sbfileid]").remove();$("a.ipsAttachLink.ipsAttachLink_block").removeAttr("data-sbplayer");});this.after('saveEditCommentDone',function(){let soundboard_playable_attachments=ips.getSetting('soundboard_playable_attachments');let jsmedia=window.jsmediatags;if(soundboard_playable_attachments==1){let fileid;let attachment_sound;let audio;let ext;let audiotype;$(sbselects).each(function(index,element){fileid=$(this).data('fileid');ips.getAjax()('?app=soundboard&module=soundboard&controller=managesounds&do=returnAttachmentSound&sound='+fileid).done(function(response){attachment_sound=response;fileid=$(element).data('fileid');ext=$(element).data('fileext').toUpperCase();switch(ext){case'WAV':audiotype='audio/wav';break;case'OGG':audiotype='audio/ogg';break;case'FLAC':audiotype='audio/flac';break;default:audiotype='audio/mpeg';}
audio=$('<audio />',{id:'audio'+fileid+'-'+Math.random().toString(36).substr(2,5),src:attachment_sound,type:audiotype,controls:true,controlsList:'nodownload'});audio.addClass("sbAttachPlayer");$(element).attr("data-sbplayer",1).append('<br>').append(audio);jsmedia.read(attachment_sound,{onSuccess:function(tag){if(tag.tags.title){$(element).append(ips.templates.render('core.attachments.sbMetaData',{id:fileid,title:tag.tags.title,artist:tag.tags.artist,album:tag.tags.album,year:tag.tags.year}));}}});});});}});});ips.controller.mixin('moresbaudiobits','core.front.core.commentFeed',true,function(){this.after('_getResultsDone',function(){let soundboard_playable_attachments=ips.getSetting('soundboard_playable_attachments');let jsmedia=window.jsmediatags;if(soundboard_playable_attachments==1){let fileid;let attachment_sound;let audio;let ext;let audiotype;$(sbselects).each(function(index,element){fileid=$(this).data('fileid');ips.getAjax()('?app=soundboard&module=soundboard&controller=managesounds&do=returnAttachmentSound&sound='+fileid).done(function(response){attachment_sound=response;fileid=$(element).data('fileid');ext=$(element).data('fileext').toUpperCase();switch(ext){case'WAV':audiotype='audio/wav';break;case'OGG':audiotype='audio/ogg';break;case'FLAC':audiotype='audio/flac';break;default:audiotype='audio/mpeg';}
audio=$('<audio />',{id:'audio'+fileid+'-'+Math.random().toString(36).substr(2,5),src:attachment_sound,type:audiotype,controls:true,controlsList:'nodownload'});audio.addClass("sbAttachPlayer");$(element).attr("data-sbplayer",1).append('<br>').append(audio);jsmedia.read(attachment_sound,{onSuccess:function(tag){if(tag.tags.title){$(element).append(ips.templates.render('core.attachments.sbMetaData',{id:fileid,title:tag.tags.title,artist:tag.tags.artist,album:tag.tags.album,year:tag.tags.year}));}}});});});}});this.after('addToCommentFeed',function(){let soundboard_playable_attachments=ips.getSetting('soundboard_playable_attachments');let jsmedia=window.jsmediatags;if(soundboard_playable_attachments==1){let fileid;let attachment_sound;let audio;let ext;let audiotype;$(sbselects).each(function(index,element){fileid=$(this).data('fileid');ips.getAjax()('?app=soundboard&module=soundboard&controller=managesounds&do=returnAttachmentSound&sound='+fileid).done(function(response){attachment_sound=response;fileid=$(element).data('fileid');ext=$(element).data('fileext').toUpperCase();switch(ext){case'WAV':audiotype='audio/wav';break;case'OGG':audiotype='audio/ogg';break;case'FLAC':audiotype='audio/flac';break;default:audiotype='audio/mpeg';}
audio=$('<audio />',{id:'audio'+fileid+'-'+Math.random().toString(36).substr(2,5),src:attachment_sound,type:audiotype,controls:true,controlsList:'nodownload'});audio.addClass("sbAttachPlayer");$(element).attr("data-sbplayer",1).append('<br>').append(audio);jsmedia.read(attachment_sound,{onSuccess:function(tag){if(tag.tags.title){$(element).append(ips.templates.render('core.attachments.sbMetaData',{id:fileid,title:tag.tags.title,artist:tag.tags.artist,album:tag.tags.album,year:tag.tags.year}));}}});});});}});});$(document).ready(function(){let fileid;let attachment_sound;let audio;let ext;let audiotype;let jsmedia=window.jsmediatags;$(sbselects).each(function(index,element){fileid=$(this).data('fileid');ips.getAjax()('?app=soundboard&module=soundboard&controller=managesounds&do=returnAttachmentSound&sound='+fileid).done(function(response){attachment_sound=response;fileid=$(element).data('fileid');ext=$(element).data('fileext').toUpperCase();switch(ext){case'WAV':audiotype='audio/wav';break;case'OGG':audiotype='audio/ogg';break;case'FLAC':audiotype='audio/flac';break;default:audiotype='audio/mpeg';}
audio=$('<audio />',{id:'audio'+fileid+'-'+Math.random().toString(36).substr(2,5),src:attachment_sound,type:audiotype,controls:true,controlsList:'nodownload'});audio.addClass("sbAttachPlayer");$(element).attr("data-sbplayer",1).append('<br>').append(audio);jsmedia.read(attachment_sound,{onSuccess:function(tag){Debug.log("TAG");Debug.log(tag);if(tag.tags.title){$(element).append(ips.templates.render('core.attachments.sbMetaData',{id:fileid,title:tag.tags.title,artist:tag.tags.artist,album:tag.tags.album,year:tag.tags.year}));}}});});});});}(jQuery,_));;
;(function($,_,undefined){"use strict";var originalps=ips.utils.notification.playSound;ips.utils.notification.playSound=function(){let soundboard_sound='';let soundboard_defaultsound=ips.getSetting('soundboard_defaultsound')||'';ips.getAjax()('?app=soundboard&module=soundboard&controller=managesounds&do=returnAjaxSoundboardSound').done(function(response){soundboard_sound=response;if(soundboard_sound||soundboard_defaultsound){for(let i=0,l=Howler._howls.length;i<l;i++){for(let x=0,l=Howler._howls[i]._src.length;x<l;x++){if(Howler._howls[i]._src[x]===ips.getSetting('baseURL')+'applications/core/interface/sounds/notification.mp3'){if(soundboard_sound){Howler._howls[i]._src[x]=soundboard_sound;let ext=soundboard_sound.substr(soundboard_sound.lastIndexOf('.')+1);if(ext!=="mp3"&&ext!=="ogg"){ext="wav";}
Debug.log(ext);Howler._howls[i]._format=[ext];}
else if(soundboard_defaultsound){Howler._howls[i]._src[x]=soundboard_defaultsound;let ext=soundboard_defaultsound.substr(soundboard_defaultsound.lastIndexOf('.')+1);if(ext!=="mp3"&&ext!=="ogg"){ext="wav";}
Debug.log(ext);Howler._howls[i]._format=[ext];}}}}}
return originalps(arguments);});}}(jQuery,_));;