|
1 | 1 | // ==UserScript== |
2 | 2 | // @name Rabbit toggle controls |
3 | 3 | // @namespace https://github.com/ZashIn/rabbit-extensions |
4 | | -// @version 2.0 |
| 4 | +// @version 2.1 |
5 | 5 | // @description Toggles rabb.it controls on fullscreen change and with # (default key). Does also hide the custom black bars (letterbox). |
6 | 6 | // @author Zash |
7 | 7 | // @updateURL https://github.com/ZashIn/rabbit-extensions/raw/master/rabbit_toggle_controls.user.js |
|
12 | 12 | // ==/UserScript== |
13 | 13 |
|
14 | 14 | /* |
| 15 | +See settings below: |
15 | 16 | - fullscreen: options |
16 | 17 | - enter = disable controls - exceptions |
17 | 18 | - leave = enable controls - exceptions |
|
20 | 21 |
|
21 | 22 | (function() { |
22 | 23 | 'use strict'; |
| 24 | + |
23 | 25 | // Options enum per setting, use for e.g. as: opt.toggle |
24 | 26 | var opt = Object.freeze({ |
25 | 27 | unchanged:1 // Does not change the element |
|
28 | 30 | ,toggle:4 // Toggles the element on/off |
29 | 31 | }); |
30 | 32 | // Settings and controls definitions // |
31 | | - var settings; |
| 33 | + var settings = {}; |
32 | 34 | { |
33 | | - let fullscreen = { |
| 35 | + let fs = |
| 36 | + settings.fullscreen = { |
34 | 37 | enabled: true // true = toggles (enables/disables) on fullscreen change |
35 | 38 | // Use the opt enum to toggle / disable (permanent) / enable (permanent) / not change the following elements |
36 | 39 | ,HD: opt.enabled // Enables hd |
|
39 | 42 | ,blackBarsBackground: opt.toggle // Video black bars (letterbox) background image (not fully black): toggle |
40 | 43 | ,chat: opt.toggle |
41 | 44 | }; |
42 | | - settings = { fullscreen: fullscreen |
43 | | - ,hotkey: { |
| 45 | + settings.hotkey = { |
44 | 46 | enabled: true // true = hotkey to toggle controls |
45 | 47 | ,hotkeyTest: e => ( |
46 | 48 | e.key === '#' |
47 | 49 | && e.altKey === false |
48 | 50 | && e.shiftKey === false |
49 | 51 | && e.ctrlKey === false |
50 | 52 | ) |
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 | + } |
59 | 61 |
|
60 | 62 | /** |
61 | 63 | * Control class |
|
0 commit comments