text: $(function(){function e(t,s){if(t.length){let a=t.shift();i(a[1],a[2],function(i){M[a[0]]=i,e(t,s)})}else s&&s(!0)}function i(e,i,t){if(e){let s=new Audio(w+"sfx/"+e);s.volume=i,s.load(),s.onloadeddata=function(){t&&t(s)}}else t&&t(void 0)}function t(e){M.hasOwnProperty(e)&&M[e]&&M[e].play()}function s(e){let i=e?window.enemyData.filter(function(e){return e.boss}):window.enemyData.filter(function(e){return!e.boss});return i[Math.floor(Math.random()*i.length)]}function a(){let e=[];for(let i=0;i<window.enemyData.length;i++)for(let t=0;t<window.enemyData[i].hypno;t++)e.push(window.enemyData[i]);return e[Math.floor(Math.random()*e.length)]}function n(){if(z.data("amount"))switch(z.data("currency")){case"dollars":return 100*z.data("amount").substr(1);case"months":return 100*z.data("amount");default:return parseInt(z.data("amount"))}}function o(e,i,s,a){function n(){if(0==r&&t(s),r<e.length){if(" "==e[r]&&0!=r){let t=$(i).parent().innerWidth(),s=$(i).html().split("<br>").pop().trim();nextWord=e.substr(r+1).split(" ")[0],$("#string-test").html(s+" "+nextWord),$("#string-test").innerWidth()>t&&$(i).html($(i).html()+"<br>")}$(i).html($(i).html()+e[r++]),setTimeout(n,o)}else a&&a()}let o=20,r=0;n()}function r(e){if(window.enemyDisplayed)return(window.enemyDisplayed.the?e?"The ":"the ":"")+window.enemyDisplayed.name}function m(){window.music.volume=.5,window.music.src=w+"music/"+window.musicTracks[window.enemyDisplayed.music],window.music.load();let e=document.createElement("video");z.append(e),e.onloadeddata=(()=>{e.play(),t("raid"),setTimeout(()=>{let i=$("#alert-span").clone();$(e).fadeOut(()=>{$("#container").empty()}),$("#alert-text-wrap, #alert-image-wrap").show(),window.music.volume=.5,window.music.play(),o(" raided the stream!","#alert-span",null,()=>{setTimeout(()=>{$("#alert-span").html(i.html()),h(),o(" called for help.","#alert-span","attack",()=>{setTimeout(()=>{$("#alert-span").text(z.html()),$("#alert-span").html(z.data("amount")),o(" raiders showed up!","#alert-span","help",()=>{})},2e3)})},2e3)})},4e3)}),e.src=w+"anim/"+z.data("raid-animation")}function l(){o(z.data("startup-message"),"#alert-span","startup",()=>{setTimeout(p,600)})}function p(){let e=z.data("attack-animation"),i=0|parseInt(z.data("attack-length"));e?(S.onloadeddata=(()=>{S.play(),t("attack"),setTimeout(()=>{g()},i)}),S.src=w+"anim/"+e):(t("attack"),setTimeout(()=>{g()},i))}function g(){switch($("#alert-span").empty(),z.data("followup-animation")){case"hypnotize":d();break;case"hit":u();break;case"hitdie":u(c);break;case"booststats":y()}}function d(){o(r(!0)+" fell asleep!","#alert-span",null,()=>{t("status")})}function h(){function e(){i++<t?(k.style.opacity=i%2==0?"1":"0",setTimeout(e,s)):k.style.opacity="1"}let i=0,t=5,s=50;e()}function u(e){h(),t("hit"),o(n()+" HP damage to "+r(!1)+".","#alert-span",null,()=>{e&&setTimeout(e,500)})}function c(){t("enemyDie"),$("#main-sprite").fadeOut(400,function(){$("#white-sprite").fadeOut(100,function(){$("#black-sprite").fadeOut(200,function(){z.data("victory-message")&&setTimeout(b,250)})})})}function y(){o("Oceanity's viewers increased!","#alert-span",null,()=>{})}function b(){window.music.paused||window.music.pause(),$("#alert-span").empty(),t(window.enemyDisplayed.boss?"defeatedBoss":"defeatedEnemy"),$("#alert-text").removeClass("bullet"),$("#alert-message").addClass("victory").html(f(z.data("victory-message"))).show(),$("#alert-user-message").show()}function f(e){let i=z.data("amount")?parseInt(z.data("amount")):0;return e.replace("{s}",i>1?"s":"")}window.enemyData||(window.enemyData=[{boss:!0,the:!1,name:"Captain Strong",hypno:5,size:"big",sprite:"Captain%20Strong.gif",music:102},{boss:!0,the:!1,name:"Carbon Dog",hypno:1,size:"big",sprite:"Carbon%20Dog.gif",music:103},{boss:!0,the:!1,name:"Clumsy Robot",hypno:1,size:"small",sprite:"Clumsy%20Robot.gif",music:148},{boss:!0,the:!1,name:"Dept. Store Spook",hypno:5,size:"big",sprite:"Department%20Store%20Spook.gif",music:102},{boss:!0,the:!1,name:"Diamond Dog",hypno:1,size:"big",sprite:"Diamond%20Dog.gif",music:97},{boss:!0,the:!1,name:"Electro Specter",hypno:1,size:"big",sprite:"Electro%20Specter.gif",music:104},{boss:!0,the:!1,name:"Everdred",hypno:5,size:"big",sprite:"Everdred.gif",music:98},{boss:!0,the:!1,name:"Evil Mani-Mani",hypno:5,size:"big",sprite:"Evil%20Mani%20Mani.gif",music:148},{boss:!0,the:!1,name:"Frank",hypno:5,size:"big",sprite:"Frank.gif",music:100},{boss:!0,the:!1,name:"Frankystein Mark II",hypno:1,size:"big",sprite:"Frankystein%20Mark%20II.gif",music:102},{boss:!0,the:!0,name:"Guardian Digger",hypno:1,size:"big",sprite:"Guardian%20Digger.gif",music:103},{boss:!0,the:!0,name:"Guardian General",hypno:5,size:"big",sprite:"Guardian%20General.gif",music:103},{boss:!0,the:!1,name:"Giygas",hypno:0,size:"big",sprite:"Giygas.gif",music:105},{boss:!0,the:!1,name:"Heavily Armed Pokey",hypno:5,size:"big",sprite:"Heavily%20Armored%20Pokey.gif",music:0},{boss:!0,the:!1,name:"Kraken",hypno:1,size:"big",sprite:"Kraken.gif",music:104},{boss:!0,the:!1,name:"Oceanity's Nightmare",hypno:5,size:"big",sprite:"Ness%27s%20Nightmare.gif",music:148},{boss:!0,the:!1,name:"Master Barf",hypno:5,size:"big",sprite:"Master%20Barf.gif",music:99},{boss:!0,the:!1,name:"Master Belch",hypno:10,size:"big",sprite:"Master%20Belch.gif",music:99},{boss:!0,the:!0,name:"Mini Barf",hypno:1,size:"small",sprite:"Minibarf.gif",music:99},{boss:!0,the:!1,name:"Mondo Mole",hypno:1,size:"big",sprite:"Mondo%20Mole.gif",music:103},{boss:!0,the:!1,name:"Mr. Carpainter",hypno:5,size:"big",sprite:"Carpainter.gif",music:148},{boss:!0,the:!1,name:"Plague Rat of Doom",hypno:1,size:"big",sprite:"Plague%20Rat%20of%20Doom.gif",music:103},{boss:!0,the:!0,name:"Shrooom!",hypno:5,size:"big",sprite:"Shrooom%21.gif",music:103},{boss:!0,the:!0,name:"Starman Deluxe",hypno:1,size:"big",sprite:"Starman%20Deluxe.gif",music:97},{boss:!0,the:!0,name:"Starman Junior",hypno:1,size:"big",sprite:"Starman%20Junior.gif",music:148},{boss:!0,the:!1,name:"Thunder and Storm",hypno:5,size:"big",sprite:"Thunder%20and%20Storm.gif",music:104},{boss:!0,the:!1,name:"Titanic Ant",hypno:5,size:"big",sprite:"Titanic%20Ant.gif",music:103},{boss:!0,the:!1,name:"Trillionage Sprout",hypno:1,size:"big",sprite:"Trillionage%20Sprout.gif",music:103},{boss:!1,the:!0,name:"Abstract Art",hypno:1,size:"big",sprite:"Abstract%20Art.gif"},{boss:!1,the:!0,name:"Annoying Old Party Man",hypno:5,size:"big",sprite:"Annoying%20Old%20Party%20Man.gif"},{boss:!1,the:!0,name:"Annoying Reveler",hypno:5,size:"big",sprite:"Annoying%20Reveler.gif"},{boss:!1,the:!0,name:"Arachnid!!!",hypno:0,size:"small",sprite:"Arachnid%21%21%21.gif"},{boss:!1,the:!0,name:"Arachnid!",hypno:0,size:"small",sprite:"Arachnid%21%21.gif"},{boss:!1,the:!0,name:"Armored Frog",hypno:5,size:"small",sprite:"Armored%20Frog.gif"},{boss:!1,the:!0,name:"Atomic Power Robot",hypno:1,size:"big",sprite:"Atomic%20Power%20Robot.gif"},{boss:!1,the:!0,name:"Attack Slug",hypno:0,size:"small",sprite:"Attack%20Slug.gif"},{boss:!1,the:!0,name:"Bad Buffalo",hypno:1,size:"big",sprite:"Bad%20Buffalo.gif"},{boss:!1,the:!0,name:"Beautiful UFO",hypno:0,size:"small",sprite:"Beautiful%20UFO.gif"},{boss:!1,the:!0,name:"Big Pile of Puke",hypno:5,size:"big",sprite:"Big%20Pile%20of%20Puke.gif"},{boss:!1,the:!0,name:"Bionic Kraken",hypno:1,size:"big",sprite:"Bionic%20Kraken.gif"},{boss:!1,the:!0,name:"Black Antoid",hypno:10,size:"small",sprite:"Black%20Antoid.gif"},{boss:!1,the:!0,name:"Care Free Bomb",hypno:1,size:"big",sprite:"Carefree%20Bomb.gif"},{boss:!1,the:!0,name:"Cave Boy",hypno:1,size:"big",sprite:"Cave%20Boy.gif"},{boss:!1,the:!0,name:"Chomposaur",hypno:5,size:"big",sprite:"Chomposaur.gif"},{boss:!1,the:!0,name:"Coil Snake",hypno:10,size:"big",sprite:"Coil%20Snake.gif"},{boss:!1,the:!0,name:"Conducting Menace",hypno:1,size:"big",sprite:"Conducting%20Menace.gif"},{boss:!1,the:!0,name:"Conducting Spirit",hypno:1,size:"big",sprite:"Conducting%20Spirit.gif"},{boss:!1,the:!0,name:"Cop",hypno:5,size:"big",sprite:"Cop.gif"},{boss:!1,the:!0,name:"Cranky Lady",hypno:5,size:"big",sprite:"Cranky%20Lady.gif"},{boss:!1,the:!0,name:"Crazed Sign",hypno:10,size:"big",sprite:"Crazed%20Sign.gif"},{boss:!1,the:!0,name:"Crested Booka",hypno:10,size:"big",sprite:"Crested%20Booka.gif"},{boss:!1,the:!0,name:"Criminal Caterpillar",hypno:10,size:"big",sprite:"Criminal%20Caterpillar.gif"},{boss:!1,the:!0,name:"Cute Li'l UFO",hypno:0,size:"small",sprite:"Cute%20Li%27l%20UFO.gif"},{boss:!1,the:!0,name:"Fobby",hypno:0,size:"small",sprite:"Fobby.gif"},{boss:!1,the:!0,name:"Li'l UFO",hypno:0,size:"small",sprite:"Li%27l%20UFO.gif"},{boss:!1,the:!0,name:"Mobile Sprout",hypno:0,size:"small",sprite:"Mobile%20Sprout.gif"},{boss:!1,the:!0,name:"Mole Playing Rough",hypno:1,size:"small",sprite:"Mole%20Playing%20Rough.gif"},{boss:!1,the:!0,name:"Mr. Batty",hypno:0,size:"small",sprite:"Mr%20Batty.gif"},{boss:!1,the:!0,name:"Runaway Dog",hypno:10,size:"small",sprite:"Runaway%20Dog.gif"},{boss:!1,the:!0,name:"Spiteful Crow",hypno:5,size:"small",sprite:"Spiteful%20Crow.gif"},{boss:!1,the:!0,name:"Starman",hypno:5,size:"big",sprite:"Starman.gif"},{boss:!1,the:!0,name:"Yes Man Junior",hypno:5,size:"big",sprite:"Yes%20Man%20Junior.gif"}]),window.musicTracks||(window.musicTracks={0:"raid-pokey-means-business.ogg",96:"raid-battle-weird-opponent.ogg",97:"raid-battle-machine.ogg",98:"raid-battle-mobile-opponent.ogg",99:"raid-battle-belch.ogg",100:"raid-franky.ogg",101:"raid-battle-weak-opponent.ogg",102:"raid-battle-unsettling-opponent.ogg",103:"raid-sanctuary-guardian.ogg",104:"raid-kraken.ogg",105:"raid-giygas-is-wounded.ogg",148:"raid-otherworldly-foe.ogg"}),window.music||(window.music=new Audio);let w="https://oceanity.github.io/stream/alerts/eb/",z=$("#container"),k=document.getElementById("enemy-image"),C=document.createElement("span");stringTest=document.createElement("div"),C.id="alert-span",stringTest.id="string-test",z.append(stringTest);let D=[["raid",z.data("raid-sound"),.4],["help","help.ogg",.3],["startup",z.data("startup-sound"),.4],["attack",z.data("attack-sound"),.3],["hit","enemyhit.ogg",.3],["status","ailment.ogg",.3],["enemyDie","enemydie.ogg",.3],["defeatedEnemy","defeatenemy.ogg",.3],["defeatedBoss","defeatboss.ogg",.3]],M={};switch(z.data("enemy")){case"hypnotizable":window.enemyDisplayed=a();break;case"boss":window.enemyDisplayed=s(!0);break;default:window.enemyDisplayed=s(!1)}let S=document.createElement("video"),B=document.createElement("img");if(z.data("raid"))$("#alert-text-wrap, #alert-image-wrap").hide();else{let e=$("#alert-image");e.append(S),z.data("shield")&&(S.classList="shield")}$(function(){$("html").removeClass(),$("body style:not([id])").remove(),$("#alert-text").addClass("bullet"),$("#alert-message, #alert-user-message").removeAttr("style"),$("#victory-message").hide(),C.innerHTML=$("#alert-message").html(),$("#alert-message").empty().append(C),B.id="main-sprite",k.classList=window.enemyDisplayed.size,B.onload=(()=>{z.data("raid")?e(D,m):e(D,l)}),B.src=w+"img/"+window.enemyDisplayed.sprite,k.appendChild(B);const i=["white-sprite","black-sprite","position-sprite"];for(let e in i){let t=B.cloneNode();t.id=i[e],k.appendChild(t)}})});