Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name NewCompte TagPro Volume slider
- // @namespace http://www.reddit.com/user/NewCompte
- // @description Adds a volume slider to TagPro
- // @include http://tagpro-*.koalabeast.com*
- // @license WTFPL
- // @author NewCompte
- // @version 0.3
- // ==/UserScript==
- function myScript()
- {
- tagpro.ready( function () {
- setTimeout( function () {
- var oldsound = tagpro.playSound;
- tagpro.playSound = function (s, v) {
- oldsound(s, v * tagpro.globalvolume);
- };
- }, 500);
- });
- function changeVolume (value, s, v)
- {
- tagpro.globalvolume = Math.pow(10, value/20);
- tagpro.playSound(s, v);
- localStorage.setItem("volume", value);
- }
- var volumerange = document.getElementById("volume");
- volumerange.value = (localStorage.getItem("volume") || 0) * 1;
- tagpro.globalvolume = Math.pow(10, volumerange.value/20);
- volumerange.addEventListener("change", function () {changeVolume(volumerange.value, "click", 0.5); });
- volumerange.addEventListener("mouseup", function () {changeVolume(volumerange.value, "pop", 1); });
- }
- var volumerange = document.createElement('input');
- volumerange.value = 0;
- volumerange.type = "range";
- volumerange.id = "volume";
- volumerange.min = -30;
- volumerange.max = 0;
- volumerange.style.width ="64px";
- document.getElementById("sound").appendChild(volumerange);
- var source = "(" + myScript + ")()";
- var thescript = document.createElement('script');
- thescript.setAttribute("type", "application/javascript");
- thescript.textContent = source;
- document.body.appendChild(thescript);
Add Comment
Please, Sign In to add comment