Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit cd5a972

Browse files
committed
Better settings syntax.
1 parent 7d12e7b commit cd5a972

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

rabbit_toggle_controls.user.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name Rabbit toggle controls
33
// @namespace https://github.com/ZashIn/rabbit-extensions
4-
// @version 2.0
4+
// @version 2.1
55
// @description Toggles rabb.it controls on fullscreen change and with # (default key). Does also hide the custom black bars (letterbox).
66
// @author Zash
77
// @updateURL https://github.com/ZashIn/rabbit-extensions/raw/master/rabbit_toggle_controls.user.js
@@ -12,6 +12,7 @@
1212
// ==/UserScript==
1313

1414
/*
15+
See settings below:
1516
- fullscreen: options
1617
- enter = disable controls - exceptions
1718
- leave = enable controls - exceptions
@@ -20,6 +21,7 @@
2021

2122
(function() {
2223
'use strict';
24+
2325
// Options enum per setting, use for e.g. as: opt.toggle
2426
var opt = Object.freeze({
2527
unchanged:1 // Does not change the element
@@ -28,9 +30,10 @@
2830
,toggle:4 // Toggles the element on/off
2931
});
3032
// Settings and controls definitions //
31-
var settings;
33+
var settings = {};
3234
{
33-
let fullscreen = {
35+
let fs =
36+
settings.fullscreen = {
3437
enabled: true // true = toggles (enables/disables) on fullscreen change
3538
// Use the opt enum to toggle / disable (permanent) / enable (permanent) / not change the following elements
3639
,HD: opt.enabled // Enables hd
@@ -39,23 +42,22 @@
3942
,blackBarsBackground: opt.toggle // Video black bars (letterbox) background image (not fully black): toggle
4043
,chat: opt.toggle
4144
};
42-
settings = { fullscreen: fullscreen
43-
,hotkey: {
45+
settings.hotkey = {
4446
enabled: true // true = hotkey to toggle controls
4547
,hotkeyTest: e => (
4648
e.key === '#'
4749
&& e.altKey === false
4850
&& e.shiftKey === false
4951
&& e.ctrlKey === false
5052
)
51-
// See fullscreen above. Change here for different settings using the hotkey.
52-
,HD: fullscreen.HD
53-
,bubbles: fullscreen.bubbles
54-
,controls: fullscreen.controls
55-
,blackBarsBackground: fullscreen.blackBarsBackground
56-
,chat: fullscreen.chat
57-
}
58-
};}
53+
// See fs = fullscreen above. Change here for different settings using the hotkey.
54+
,HD: fs.HD
55+
,bubbles: fs.bubbles
56+
,controls: fs.controls
57+
,blackBarsBackground: fs.blackBarsBackground
58+
,chat: fs.chat
59+
};
60+
}
5961

6062
/**
6163
* Control class

0 commit comments

Comments
 (0)