Last active
August 29, 2015 14:04
-
-
Save cjmoeller/cb0717f047c2c980304b to your computer and use it in GitHub Desktop.
Peda B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name My Fancy New Userscript | |
// @namespace http://whatsremote.com/ | |
// @version 0.1 | |
// @description Peda B's house | |
// @match http://tampermonkey.net/ | |
// @copyright 2014, PedaB | |
// ==/UserScript== | |
function loadScript(url, callback) | |
{ | |
// Adding the script tag to the head as suggested before | |
var head = document.getElementsByTagName('head')[0]; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = url; | |
// Then bind the event to the callback function. | |
// There are several events for cross browser compatibility. | |
script.onreadystatechange = callback; | |
script.onload = callback; | |
// Fire the loading | |
head.appendChild(script); | |
} | |
function endsWith(str, suffix) { | |
return str.indexOf(suffix, str.length - suffix.length) !== -1; | |
} | |
var temp = 0; | |
function update() { | |
urls = document.getElementsByTagName("a"); | |
for ( var i = 0; i < urls.length; i++) { | |
if (endsWith(urls[i].href, "aac")) { | |
if (!(urls[i].hasAttribute("id"))) { | |
console.log("Replacing: "+ "player"+temp); | |
urls[i].setAttribute("id", "player"+temp); | |
jwplayer(urls[i].id).setup({ | |
file: urls[i].href, | |
width: 302, | |
height: 30 | |
}); | |
} | |
} | |
temp++; | |
} | |
} | |
function ready() | |
{ | |
var _sampleRate = (function() { | |
var AudioContext = (window.AudioContext || window.webkitAudioContext); | |
if (!AudioContext) | |
return 44100; | |
return new AudioContext().sampleRate; | |
}()); | |
setInterval(update, 1000); | |
} | |
loadScript("http://audiocogs.org/codecs/js/aac.js", loadScript("https://jwpsrv.com/library/eI6zhBszEeS89yIACtqXBA.js", loadScript("http://audiocogs.org/codecs/js/aurora.js", ready))); | |
console.log("Peda"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment