From e84878d2153c6fbf951d840f6aad9abad0c454b5 Mon Sep 17 00:00:00 2001 From: Gabriel Mawhinney Date: Wed, 22 May 2019 05:23:22 +0100 Subject: [PATCH] Add feature to change controller opacity (#478) * Add option for changing controller opacity --- inject.js | 5 ++++- options.html | 6 +++++- options.js | 4 ++++ shadow.css | 1 - 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/inject.js b/inject.js index 223b55a8..9d888ca6 100644 --- a/inject.js +++ b/inject.js @@ -9,6 +9,7 @@ rememberSpeed: false, // default: false audioBoolean: false, // default: false startHidden: false, // default: false + controllerOpacity: 0.3, // default: 0.3 keyBindings: [], blacklist: ` www.instagram.com @@ -75,6 +76,7 @@ rememberSpeed: tc.settings.rememberSpeed, audioBoolean: tc.settings.audioBoolean, startHidden: tc.settings.startHidden, + controllerOpacity: tc.settings.controllerOpacity, blacklist: tc.settings.blacklist.replace(regStrip, '') }); } @@ -83,6 +85,7 @@ tc.settings.rememberSpeed = Boolean(storage.rememberSpeed); tc.settings.audioBoolean = Boolean(storage.audioBoolean); tc.settings.startHidden = Boolean(storage.startHidden); + tc.settings.controllerOpacity = Number(storage.controllerOpacity); tc.settings.blacklist = String(storage.blacklist); initializeWhenReady(document); @@ -213,7 +216,7 @@ @import "${chrome.runtime.getURL('shadow.css')}"; -
+
${speed} diff --git a/options.html b/options.html index 0119bd86..102906ff 100644 --- a/options.html +++ b/options.html @@ -81,7 +81,7 @@

Shortcuts

-

Other

+

Other

@@ -94,6 +94,10 @@

Other

+
+ + +
diff --git a/options.js b/options.js index 6071d0a5..eed88a4d 100644 --- a/options.js +++ b/options.js @@ -6,6 +6,7 @@ var tcDefaults = { rememberSpeed: false, // default: false audioBoolean: false, // default: false startHidden: false, // default: false + controllerOpacity: 0.3, // default: 0.3 keyBindings: [ {action: "slower", key: 83, value: 0.1, force: false, predefined: true}, // S {action: "faster", key: 68, value: 0.1, force: false, predefined: true}, // D @@ -151,6 +152,7 @@ function save_options() { var rememberSpeed = document.getElementById('rememberSpeed').checked; var audioBoolean = document.getElementById('audioBoolean').checked; var startHidden = document.getElementById('startHidden').checked; + var controllerOpacity = document.getElementById('controllerOpacity').value; var blacklist = document.getElementById('blacklist').value; displayKeyCode = isNaN(displayKeyCode) ? tcDefaults.displayKeyCode : displayKeyCode; @@ -161,6 +163,7 @@ function save_options() { rememberSpeed: rememberSpeed, audioBoolean: audioBoolean, startHidden: startHidden, + controllerOpacity: controllerOpacity, keyBindings: keyBindings, blacklist: blacklist.replace(regStrip,'') }, function() { @@ -180,6 +183,7 @@ function restore_options() { document.getElementById('rememberSpeed').checked = storage.rememberSpeed; document.getElementById('audioBoolean').checked = storage.audioBoolean; document.getElementById('startHidden').checked = storage.startHidden; + document.getElementById('controllerOpacity').value = storage.controllerOpacity; document.getElementById('blacklist').value = storage.blacklist; for (let i in storage.keyBindings) { diff --git a/shadow.css b/shadow.css index da965192..3b9a7e1e 100644 --- a/shadow.css +++ b/shadow.css @@ -22,7 +22,6 @@ cursor: default; z-index: 9999999; - opacity: 0.3; } #controller:hover {