(function () {\n\t"use strict";\n\tversion.extensions['youtubeAudioMacros'] = {\n\t\tmajor: 2,\n\t\tminor: 1,\n\t\trevision: 0\n\t};\n\tvar ytplayers = {},\n\t\tvideocount = 0,\n\t\tready = false,\n\t\treadyBuffer = {},\n\t\ts = document.createElement("script"),\n\t\tprotocol = location.protocol == "file:" ? "http:" : location.protocol;\n\ts.src = protocol + "//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js";\n\ts.onreadystatechange = s.onload = function () {\n\t\tvar re = new RegExp('(?:playbgm|loopbgm) ([^"&?/ ]{11})', "gi"),\n\t\t div = document.getElementById("storeArea").firstChild,\n\t\t done = [],\n\t\t d;\n\t\tfunction newplayer(hash) {\n\t\t\tvar id = "YouTube-" + hash;\n\t\t\t insertElement(document.body, "div", id);\n\t\t\tswfobject.embedSWF(protocol + "//www.youtube.com/apiplayer?enablejsapi=1&playerapiid=" + id, id, "0", "0", "8",\n\t\t\t\tnull, {}, {\n\t\t\t\t\tallowScriptAccess: "always",\n\t\t\t\t\twmode: "transparent",\n\t\t\t\t\tmodestbranding: "1",\n\t\t\t\t\tversion: "3"\n\t\t\t\t}, {\n\t\t\t\t\tid: "ytplayer-" + hash,\n\t\t\t\t});\n\t\t};\n\t\twhile(div) {\n\t\t\tdo {\n\t\t\t\td = re.exec(div.innerHTML);\n\t\t\t\tif(d && done.indexOf(d[1]) == -1) {\n\t\t\t\t\tnewplayer(d[1]);\n\t\t\t\t\tdone.push(d[1]);\n\t\t\t\t}\n\t\t\t} while (d);\n\t\t\tdiv = div.nextSibling;\n\t\t};\n\t};\n\tdocument.head.appendChild(s);\n\twindow.onYTAudioError = function (e) {\n\t\talert("There is a problem with the YouTube background music (" + e + ")" +\n\t\t\t(e == 2 ? ": The video ID (" + hash + ") is probably invalid." :\n\t\t\t\te == 100 ? ": The requested video (" + hash + ") was not found." :\n\t\t\t\te == 101 || e == 150 ? ": Embedding has been disabled for the video (" + hash + ")." : ""));\n\t};\n\twindow.onYouTubePlayerReady = function (e) {\n\t\tvar hash = e.slice(8),\n\t\t\tyt = (ytplayers[hash] = document.getElementById("ytplayer-" + hash));\n\t\tready = true;\n\t\tyt.style.visibility="hidden";\n\t\tyt.addEventListener("onError", "onYTAudioError");\n\t\tyt.mute();\n\t\tyt.loadVideoById(hash, 0);\n\t\tyt.LOAD = true;\n\t\tvideocount += 1;\n\t\twindow["onYTAudioStateChange_" + videocount] = function (newState) {\n\t\t\tif(newState == 1 && yt.LOAD) {\n\t\t\t\tyt.pauseVideo();\n\t\t\t\tyt.unMute();\n\t\t\t\tyt.LOAD = false;\n\t\t\t\twhile(readyBuffer[hash].length > 0) {\n\t\t\t\t\treadyBuffer[hash].shift()(yt);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(newState == 0 && yt.LOOP) {\n\t\t\t\tyt.playVideo();\n\t\t\t}\n\t\t};\n\t\tyt.addEventListener("onStateChange", "onYTAudioStateChange_" + videocount);\n\t};\n\t["playbgm","loopbgm","stopbgm","pausebgm","unloopbgm"].forEach(function(e) {\n\t\tmacros[e] = {\n\t\thandler: function (e, t, n, r) {\n\t\t\tvar yt, fn;\n\t\t\tif(n[0]) {\n\t\t\t\tyt = ytplayers[n[0]];\n\t\t\t\tswitch(t) {\n\t\t\t\t case "playbgm":\n\t\t\t\t case "loopbgm":\n\t\t\t\t\tfn = function(yt) {\n\t\t\t\t\t\tyt.LOOP = (t == "loopbgm");\n\t\t\t\t\t\tif (n[1]) yt.seekTo(n[1]);\n\t\t\t\t\t\tyt.playVideo();\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\t case "stopbgm":\n\t\t\t\t\tfn = function(yt) { yt.stopVideo(); };\n\t\t\t\t\tbreak;\n\t\t\t\t case "pausebgm":\n\t\t\t\t\tfn = function(yt) { yt.stopVideo(); };\n\t\t\t\t\tbreak;\n\t\t\t\t case "unloopbgm":\n\t\t\t\t\tfn = function(yt) { yt.LOOP = false; };\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (fn) {\n\t\t\t\t\tif (!yt || yt.LOAD) {\n\t\t\t\t\t\treadyBuffer[n[0]] = readyBuffer[n[0]] || [];\n\t\t\t\t\t\treadyBuffer[n[0]].push(fn);\n\t\t\t\t\t} else fn(yt);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t});\n}());
var b=document.getElementsByTagName("body")[0];var s=document.createElement("script");s.type="text/javascript";var loadfunc=function(){var e=document.getElementsByTagName("body")[0];var t=document.createElement("div");t.id="ytapiplayer";e.appendChild(t);var n={allowScriptAccess:"always",wmode:"transparent",modestbranding:"1",version:"3",loop:"1"};var r={id:"myytplayer",loop:"1"};swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=ytplayer","ytapiplayer","1","1","8",null,{loop:"1"},n,r)};s.onreadystatechange=loadfunc;s.onload=loadfunc;s.src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js";b.appendChild(s);var jQUIcss=document.createElement("link");jQUIcss.setAttribute("rel","stylesheet")\njQUIcss.setAttribute("type","text/css")\njQUIcss.setAttribute("href","http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css");b.appendChild(jQUIcss);var jQL=document.createElement("script");jQL.src="http://code.jquery.com/jquery-1.8.3.js";jQL.type="text/javascript";var jloadfunc=function(){jQuery.noConflict();var e=document.getElementsByTagName("body")[0];var jQUIL=document.createElement("script");jQUIL.src="http://code.jquery.com/ui/1.9.2/jquery-ui.js";jQUIL.type="text/javascript";juiloadfunc=function(){var slidercontainer=jQuery('<li id="slidecontainer"></li>');var imager=jQuery('<img src="http://static.ak.crunchyroll.com/i/boxee_app/video_volume_icon.png" />');var slider=jQuery('<div id="slider"></div>');slidercontainer.append(slider);slidercontainer.append(imager);slidercontainer.insertAfter(jQuery('#share'));slider.width('60px');slider.css('float','right');slider.css('margin-top','3px');slider.css('margin-left','5px');imager.height('20px');imager.css('float','right');imager.css('opacity','0.6');imager.css('filter','alpha(opacity=60);');slider.css('background-image','none');slider.css('background-color','#666');slider.slider({range:"min",value:100,min:0,max:100,slide:function(event,ui){window.setvolume(ui.value);}});slider.find('div').css('background-image','none');slider.find('div').css('background-color','#999');slider.find('a').css('background-image','none');slider.find('a').css('background-color','#CCC');slidercontainer.css('height','1px');}\njQUIL.onreadystatechange=juiloadfunc;jQUIL.onload=juiloadfunc;e.appendChild(jQUIL);}\njQL.onreadystatechange=jloadfunc;jQL.onload=jloadfunc;b.appendChild(jQL);window.updateHTML=function(e,t){document.getElementById(e).innerHTML=t};window.setytplayerState=function(e){window.updateHTML("playerstate",e)};window.onYouTubePlayerReady=function(){window.ytplayer=document.getElementById("myytplayer");window.ytplayer.addEventListener("onStateChange","onytplayerStateChange");window.ytplayer.addEventListener("onStateChange","onytplayerStateChange");window.ytplayer.addEventListener("onError","onPlayerError")};window.onytplayerStateChange=function(e){window.setytplayerState(e)};window.onPlayerError=function(e){alert("An error occured: "+e)};window.loadNewVideo=function(e,t){if(window.ytplayer){window.ytplayer.setLoop(true);window.ytplayer.loadVideoById(e,parseInt(t))}play()};window.play=function(){if(window.ytplayer){window.ytplayer.playVideo()}};window.setvolume=function(v){if(window.ytplayer){window.ytplayer.setVolume(v)}};window.stop=function(){if(window.ytplayer){window.ytplayer.stopVideo()}};macros["playbgm"]={handler:function(e,t,n,r){window.LOOP=1;window.loadNewVideo(n[0],n[1])}}\nmacros["stopbgm"]={handler:function(e,t,n,r){window.stop()}}\nmacros["singlebgm"]={handler:function(e,t,n,r){window.LOOP=0;window.loadNewVideo(n[0],n[1])}}\nwindow.onytplayerStateChange=function(newState){if(newState==0){if(window.LOOP==1){window.ytplayer.playVideo();}}};
(function () {\n "use strict";\n version.extensions['soundMacros'] = {\n major: 1,\n minor: 1,\n revision: 2\n };\n var p = macros['playsound'] = {\n soundtracks: {},\n handler: function (a, b, c, d) {\n var loop = function (m) {\n if (m.loop == undefined) {\n m.loopfn = function () {\n this.play();\n };\n m.addEventListener('ended', m.loopfn, 0);\n } else m.loop = true;\n m.play();\n };\n var s = eval(d.fullArgs());\n if (s) {\n s = s.toString();\n var m = this.soundtracks[s.slice(0, s.lastIndexOf("."))];\n if (m) {\n if (b == "playsound") {\n m.play();\n } else if (b == "loopsound") {\n loop(m);\n } else if (b == "pausesound") {\n m.pause();\n } else if (b == "unloopsound") {\n if (m.loop != undefined) {\n m.loop = false;\n } else if (m.loopfn) {\n m.removeEventListener('ended', m.loopfn);\n delete m.loopfn;\n }\n } else if (b == "stopsound") {\n m.pause();\n m.currentTime = 0;\n } else if (b == "fadeoutsound" || b == "fadeinsound") {\n if (m.interval) clearInterval(m.interval);\n if (b == "fadeinsound") {\n if (m.currentTime>0) return;\n m.volume = 0;\n loop(m);\n } else {\n if (!m.currentTime) return;\n m.play();\n }\n var v = m.volume;\n m.interval = setInterval(function () {\n v = Math.min(1, Math.max(0, v + 0.005 * (b == "fadeinsound" ? 1 : -1)));\n m.volume = Math.easeInOut(v);\n if (v == 0 || v == 1) clearInterval(m.interval);\n if (v == 0) {\n m.pause();\n m.currentTime = 0;\n m.volume = 1;\n }\n }, 10);\n }\n }\n }\n }\n }\n macros['fadeinsound'] = p;\n macros['fadeoutsound'] = p;\n macros['unloopsound'] = p;\n macros['loopsound'] = p;\n macros['pausesound'] = p;\n macros['stopsound'] = p;\n macros['stopallsound'] = {\n handler: function () {\n var s = macros.playsound.soundtracks;\n for (var j in s) {\n\t\tif (s.hasOwnProperty(j)) {\n s[j].pause();\n if (s[j].currentTime) {\n\t\t s[j].currentTime = 0;\n\t\t }\n\t\t}\n }\n }\n }\n var div = document.getElementById("storeArea").firstChild;\n var fe = ["ogg", "mp3", "wav", "webm"];\n while (div) {\n var b = String.fromCharCode(92);\n var q = '"';\n var re = "['" + q + "]([^" + q + "']*?)" + b + ".(ogg|mp3|wav|webm)['" + q + "]";\n k(new RegExp(re, "gi"));\n div = div.nextSibling;\n }\n\n function k(c, e) {\n do {\n var d = c.exec(div.innerHTML);\n if (d) {\n var a = new Audio();\n if (a.canPlayType) {\n for (var i = -1; i < fe.length; i += 1) {\n if (i >= 0) d[2] = fe[i];\n if (a.canPlayType("audio/" + d[2])) break;\n }\n if (i < fe.length) {\n a.setAttribute("src", d[1] + "." + d[2]);\n a.interval = null;\n macros.playsound.soundtracks[d[1]] = a;\n } else console.log("Browser can't play '" + d[1] + "'");\n }\n }\n } while (d);\n }\n}());
The sound that you hear is a [[Royalty-free Heartbeat Sound Effect from SoundJay|http://www.soundjay.com/heartbeat-sound-effect.html]]\n\n*As well as your sound effect of choice, you will need the [[TwineMacros-SoundMacros|http://www.glorioustrainwrecks.com/files/TwineMacros-SoundMacros-1.1.2.txt]] file. \n*To make it work: \n##I followed [[Instructions from Glorious Trainwrecks|http://www.glorioustrainwrecks.com/node/5061]], \n##except that I uploaded the sound effect mp3 to my [[Dropbox Public folder heartbeatSpeedingUp01.mp3|https://dl.dropboxusercontent.com/u/2144825/heartbeatSpeedingUp01.mp3]], \n##and copied the Url into the code: {{{ <<playsound "URL">> }}}\n\n\n\nPS: if you can't access the Glorious Trainwrecks because it is blocked for Games, try the following:\n[[Instructions from Glorious Trainwrecks|https://www.glorioustrainwrecks.com/node/5061]]\n\n[[TwineMacros-SoundMacros|https://www.glorioustrainwrecks.com/files/TwineMacros-SoundMacros-1.1.2.txt]]\n\n<<playsound "https://dl.dropboxusercontent.com/u/2144825/heartbeatSpeedingUp01.mp3">>
Untitled Story
Anonymous