// ==UserScript== // @name Bandcamp Volume Bar // @version 1.0 // @description adds a volume bar to Bandcamp // @author @Mranth0ny62 // @match *://*.bandcamp.com/* // @exclude *://*.bandcamp.com/ // @grant GM_addStyle // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.js // @namespace https://greasyfork.org/users/13403 // @downloadURL none // ==/UserScript== //Awesome Tags! $("audio").attr("id", "audioSource"); $("body").append("
"); $(".volume").append(""); //CSS Time! var css = ".volumeInner {" + "position: absolute;" + "display: block;" + "bottom: 0;" + "width: 20px;" + "height: 50%;" + "background-color: #262626;" + "}" + ".volume {" + "position: fixed;" + "top: 250px;" + "left: 50px;" + "width: 20px;" + "height: 100px;" + "cursor: pointer;" + "background-color: #ffffff;" + "border: 1px solid #666666;"; GM_addStyle(css); //Sexy Script! function changeVolume(e) { var clickPos = -((e.pageY) - ($(".volume").offset().top+$(".volume").height())); var maxHeight = $(".volume").height(); var percentage = clickPos / maxHeight * 100; $(".volumeInner").css("height", percentage + "%"); audioSource.volume = percentage/100; } $(".volume").mousedown(function(e){ changeVolume(e); $(".volume").mousemove(function(e){ changeVolume(e); }); }); $(document).mouseup(function(){ $(".volume").off("mousemove"); });