From 04cbdfb6313bbc60d5740a2177a2e5b3ca3f0adc Mon Sep 17 00:00:00 2001 From: calzoneman Date: Wed, 7 Aug 2013 14:25:08 -0400 Subject: [PATCH] Add volume slider for soundcloud because their widget is crap --- www/assets/css/ytsync.css | 8 ++++++++ www/assets/js/player.js | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/www/assets/css/ytsync.css b/www/assets/css/ytsync.css index d7de8f72..d152fc3e 100644 --- a/www/assets/css/ytsync.css +++ b/www/assets/css/ytsync.css @@ -331,3 +331,11 @@ html, body { #customembed_code { font-family: Monospace; } + +#sc_volume .ui-slider-range { + background: rgb(255, 195, 0); +} + +#sc_volume .ui-slider-handle { + border-color: rgb(255, 195, 0); +} diff --git a/www/assets/js/player.js b/www/assets/js/player.js index 2a951963..40661b5c 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -12,6 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI var VIMEO_FLASH = false; function removeOld(replace) { + $("#sc_volume").remove(); replace = replace || $("
"); var old = $("#ytapiplayer"); replace.insertBefore(old); @@ -349,6 +350,17 @@ var SoundcloudPlayer = function (data) { iframe.css("width", "100%").attr("height", "166"); iframe.css("border", "none"); + var volslider = $("
").attr("id", "sc_volume") + .insertAfter(iframe); + + volslider.slider({ + range: "min", + value: 100, + stop: function (event, ui) { + self.player.setVolume(ui.value); + } + }); + self.player = SC.Widget("ytapiplayer"); self.player.bind(SC.Widget.Events.READY, function () {