1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-03 11:50:56 +00:00

Replace all the process_value functions with a helper from utilities. Hide creative tags on the channel page.

This commit is contained in:
SirStendec 2016-10-01 14:11:49 -04:00
parent 7d35b5c8c3
commit 91051d2a11
15 changed files with 197 additions and 339 deletions

View file

@ -2,6 +2,7 @@
<ul class="chat-menu-content menu-side-padding"> <ul class="chat-menu-content menu-side-padding">
<li>Added: Shortcuts to GitHub's Issues pages to the FFZ About menu so people can submit bugs and ideas.</li> <li>Added: Shortcuts to GitHub's Issues pages to the FFZ About menu so people can submit bugs and ideas.</li>
<li>Added: Seperate option to hide the banner at the top of channel pages.</li> <li>Added: Seperate option to hide the banner at the top of channel pages.</li>
<li>Changed: Allow tab-completion of global emoticons by default.</li>
<li>Fixed: Automatic Theater Mode was broken.</li> <li>Fixed: Automatic Theater Mode was broken.</li>
<li>Fixed: Incorrect darkening of a Twitch Prime page.</li> <li>Fixed: Incorrect darkening of a Twitch Prime page.</li>
</ul> </ul>

View file

@ -1538,3 +1538,8 @@ body.ffz-dark:not([data-page="teams#show"]),
.ffz-dark .subscription-modal__bar { .ffz-dark .subscription-modal__bar {
border-color: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.2);
} }
.ffz-dark .balloon .filter-bar__balloon-link--active {
color: #fff !important;
background-color: #6441a5 !important;
}

View file

@ -156,15 +156,7 @@ FFZ.settings_info.legacy_badges = {
name: "Legacy Badges", name: "Legacy Badges",
help: "Use the old, pre-vector chat badges from Twitch in place of the new.", help: "Use the old, pre-vector chat badges from Twitch in place of the new.",
process_value: function(val) { process_value: utils.process_int(0, 0, 3),
if ( val === false )
return 0;
else if ( val === true )
return 3;
else if ( typeof val === "string" )
return parseInt(val || "0");
return val;
},
on_update: function(val) { on_update: function(val) {
this.toggle_style('badges-legacy', val === 3); this.toggle_style('badges-legacy', val === 3);
@ -193,15 +185,7 @@ FFZ.settings_info.transparent_badges = {
name: "Badge Style", name: "Badge Style",
help: "Make badges appear rounded, completely circular, or transparent with no background at all.", help: "Make badges appear rounded, completely circular, or transparent with no background at all.",
process_value: function(val) { process_value: utils.process_int(0, 0, 5),
if ( val === false )
return 0;
else if ( val === true )
return 5;
else if ( typeof val === "string" )
return parseInt(val || "0");
return val;
},
on_update: function(val) { on_update: function(val) {
if ( this.has_bttv ) if ( this.has_bttv )

View file

@ -57,20 +57,7 @@ FFZ.settings_info.fix_color = {
name: "Username Colors", name: "Username Colors",
help: "Ensure that username colors contrast with the background enough to be readable.", help: "Ensure that username colors contrast with the background enough to be readable.",
process_value: function(val) { process_value: utils.process_int(6, 0, 6),
// Load legacy setting.
if ( val === false )
return 0;
else if ( val === true )
return 1;
else if ( typeof val === "string" ) {
val = parseInt(val);
if ( Number.isNaN(val) || ! Number.isFinite(val) )
val = 6;
}
return val;
},
on_update: function(val) { on_update: function(val) {
this.toggle_style('chat-colors-gray', !this.has_bttv && val === -1); this.toggle_style('chat-colors-gray', !this.has_bttv && val === -1);

View file

@ -1236,15 +1236,7 @@ FFZ.settings_info.stream_uptime = {
}, },
value: 1, value: 1,
process_value: function(val) { process_value: utils.process_int(1, 0, 2),
if ( val === false )
return 0;
if ( val === true )
return 2;
if ( typeof val === "string" )
return parseInt(val || "0") || 0;
return val;
},
no_mobile: true, no_mobile: true,
category: "Channel Metadata", category: "Channel Metadata",
@ -1370,14 +1362,7 @@ FFZ.settings_info.channel_title_top = {
}, },
value: 0, value: 0,
process_value: function(val) { process_value: utils.process_int(0),
if ( typeof val === "string" ) {
val = parseInt(val);
if ( isNaN(val) || ! isFinite(val) )
val = 0;
}
return val;
},
no_bttv: true, no_bttv: true,
no_mobile: true, no_mobile: true,

View file

@ -100,13 +100,9 @@ FFZ.settings_info.input_complete_emotes = {
2: "All Emoticons" 2: "All Emoticons"
}, },
value: 1, value: 2,
process_value: function(val) { process_value: utils.process_int(2),
if ( typeof val === 'string' )
return parseInt(val) || 0;
return val;
},
category: "Chat Input", category: "Chat Input",
no_bttv: true, no_bttv: true,
@ -131,11 +127,7 @@ FFZ.settings_info.input_complete_aliases = {
value: 1, value: 1,
process_value: function(val) { process_value: utils.process_int(1),
if ( typeof val === 'string' )
return parseInt(val) || 0;
return val;
},
category: "Chat Input", category: "Chat Input",
no_bttv: true, no_bttv: true,

View file

@ -61,15 +61,7 @@ FFZ.settings_info.minimal_chat = {
name: "Minimalistic Chat", name: "Minimalistic Chat",
help: "Hide all of the chat user interface, only showing messages and an input box.", help: "Hide all of the chat user interface, only showing messages and an input box.",
process_value: function(val) { process_value: utils.process_int(0, 0, 3),
if ( val === false )
return 0;
else if ( val === true )
return 3;
else if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
on_update: function(val) { on_update: function(val) {
document.body.classList.toggle("ffz-minimal-chat-head", val === 1 || val === 3); document.body.classList.toggle("ffz-minimal-chat-head", val === 1 || val === 3);
@ -122,11 +114,7 @@ FFZ.settings_info.chat_batching = {
name: "Chat Message Batching", name: "Chat Message Batching",
help: "Display chat messages in batches to improve performance in <em>extremely</em> fast chats.", help: "Display chat messages in batches to improve performance in <em>extremely</em> fast chats.",
process_value: function(val) { process_value: utils.process_int(0),
if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
on_update: function(val) { on_update: function(val) {
if ( this._roomv ) if ( this._roomv )
@ -158,11 +146,7 @@ FFZ.settings_info.chat_delay = {
name: "Artificial Chat Delay", name: "Artificial Chat Delay",
help: "Delay the appearance of chat messages to allow for moderation before you see them.", help: "Delay the appearance of chat messages to allow for moderation before you see them.",
process_value: function(val) { process_value: utils.process_int(-1),
if ( typeof val === "string" )
return parseInt(val || "0");
return val;
},
on_update: function (val) { on_update: function (val) {
for(var room_id in this.rooms) { for(var room_id in this.rooms) {
@ -288,15 +272,7 @@ FFZ.settings_info.group_tabs = {
value: 0, value: 0,
process_value: function(val) { process_value: utils.process_int(0, 0, 3),
if ( val === false )
return 0;
else if ( val === true )
return 3;
else if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
no_bttv: true, no_bttv: true,

View file

@ -157,11 +157,7 @@ FFZ.settings_info.directory_host_menus = {
}, },
value: 1, value: 1,
process_value: function(val) { process_value: utils.process_int(1),
if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
category: "Directory", category: "Directory",
no_mobile: true, no_mobile: true,

View file

@ -17,16 +17,7 @@ FFZ.settings_info.portrait_mode = {
}, },
value: 0, value: 0,
process_value: utils.process_int(0, 0, 1),
process_value: function(val) {
if ( val === false )
return 0;
if ( val === true )
return 1;
if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
category: "Appearance", category: "Appearance",
no_mobile: true, no_mobile: true,

View file

@ -41,16 +41,7 @@ FFZ.settings_info.username_display = {
help: "How a user's name should be rendered when their display name differs from the username.", help: "How a user's name should be rendered when their display name differs from the username.",
value: 3, value: 3,
process_value: utils.process_int(3),
process_value: function(val) {
if ( typeof val === "string" ) {
val = parseInt(val);
if ( isNaN(val) || ! isFinite(val) )
val = 3;
}
return val;
},
on_update: function(val) { on_update: function(val) {
var CL = utils.ember_resolve('component:chat/chat-line'), var CL = utils.ember_resolve('component:chat/chat-line'),
@ -119,16 +110,7 @@ FFZ.settings_info.parse_emoji = {
}, },
value: 1, value: 1,
process_value: utils.process_int(1, 0, 1),
process_value: function(val) {
if ( val === false )
return 0;
if ( val === true )
return 1;
if ( typeof val === "string" )
return parseInt(val || "0");
return val;
},
category: "Chat Appearance", category: "Chat Appearance",
@ -375,21 +357,13 @@ FFZ.settings_info.chat_separators = {
3: "3D Line (2px groove inset)", 3: "3D Line (2px groove inset)",
4: "Wide Line (2px solid)" 4: "Wide Line (2px solid)"
}, },
value: 0,
category: "Chat Appearance", value: 0,
process_value: utils.process_int(0, 0, 1),
no_bttv: true, no_bttv: true,
process_value: function(val) { category: "Chat Appearance",
if ( val === false )
return 0;
else if ( val === true )
return 1;
else if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
name: "Chat Line Separators", name: "Chat Line Separators",
help: "Display thin lines between chat messages for further visual separation.", help: "Display thin lines between chat messages for further visual separation.",
@ -455,13 +429,8 @@ FFZ.settings_info.high_contrast_chat = {
'112': "Background + Bold", '112': "Background + Bold",
'111': 'All' '111': 'All'
}, },
value: '222', value: '222',
category: "Chat Appearance",
name: "High Contrast",
help: "Display chat using white and black for maximum contrast. This is suitable for capturing and chroma keying chat to display on stream.",
process_value: function(val) { process_value: function(val) {
if ( val === false ) if ( val === false )
return '222'; return '222';
@ -470,6 +439,11 @@ FFZ.settings_info.high_contrast_chat = {
return val; return val;
}, },
category: "Chat Appearance",
name: "High Contrast",
help: "Display chat using white and black for maximum contrast. This is suitable for capturing and chroma keying chat to display on stream.",
on_update: function(val) { on_update: function(val) {
this.toggle_style('chat-hc-text', val[2] === '1'); this.toggle_style('chat-hc-text', val[2] === '1');
this.toggle_style('chat-hc-bold', val[1] === '1'); this.toggle_style('chat-hc-bold', val[1] === '1');

View file

@ -104,11 +104,7 @@ FFZ.settings_info.chat_mod_icon_visibility = {
return this.settings.get_twitch("showModIcons") ? 1 : 0; return this.settings.get_twitch("showModIcons") ? 1 : 0;
}, },
process_value: function(val) { process_value: utils.process_int(0),
if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
no_bttv: true, no_bttv: true,
@ -139,17 +135,9 @@ FFZ.settings_info.chat_hover_pause = {
8: "Alt or Hover", 8: "Alt or Hover",
9: "Shift or Hover" 9: "Shift or Hover"
}, },
value: 0,
process_value: function(val) { value: 0,
if ( val === true ) process_value: utils.process_int(0, 0, 1),
return 1;
else if ( val === false )
return 0;
else if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
no_bttv: true, no_bttv: true,
@ -180,8 +168,8 @@ FFZ.settings_info.short_commands = {
value: true, value: true,
no_bttv: true, no_bttv: true,
category: "Chat Moderation",
category: "Chat Moderation",
name: "Short Moderation Commands", name: "Short Moderation Commands",
help: "Use /t, /b, and /u in chat in place of /timeout, /ban, /unban for quicker moderation, and use /p for 1 second timeouts." help: "Use /t, /b, and /u in chat in place of /timeout, /ban, /unban for quicker moderation, and use /p for 1 second timeouts."
}; };
@ -192,8 +180,8 @@ FFZ.settings_info.mod_card_hotkeys = {
value: false, value: false,
no_bttv: true, no_bttv: true,
category: "Chat Moderation",
category: "Chat Moderation",
name: "Moderation Card Hotkeys", name: "Moderation Card Hotkeys",
help: "With a moderation card selected, press B to ban the user, T to time them out for 10 minutes, P to time them out for 1 second, or U to unban them. ESC closes the card." help: "With a moderation card selected, press B to ban the user, T to time them out for 10 minutes, P to time them out for 1 second, or U to unban them. ESC closes the card."
}; };
@ -204,8 +192,8 @@ FFZ.settings_info.mod_card_info = {
value: true, value: true,
no_bttv: true, no_bttv: true,
category: "Chat Moderation",
category: "Chat Moderation",
name: "Moderation Card Additional Information", name: "Moderation Card Additional Information",
help: "Display a channel's follower count, view count, and account age on moderation cards." help: "Display a channel's follower count, view count, and account age on moderation cards."
}; };
@ -220,15 +208,11 @@ FFZ.settings_info.timeout_notices = {
}, },
value: 1, value: 1,
process_value: function(val) { process_value: utils.process_int(1),
if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
no_bttv: true, no_bttv: true,
category: "Chat Moderation",
category: "Chat Moderation",
name: "Display Timeout / Ban Notices", name: "Display Timeout / Ban Notices",
help: "Display notices in chat when a user is timed out or banned. (You always see your own bans.)" help: "Display notices in chat when a user is timed out or banned. (You always see your own bans.)"
}; };
@ -268,21 +252,14 @@ FFZ.settings_info.mod_button_context = {
}, },
value: 3, value: 3,
process_value: function(val) { process_value: utils.process_int(3),
if ( typeof val === "string" ) {
val = parseInt(val);
if ( isNaN(val) || ! isFinite(val) )
val = 3;
}
return val;
},
category: "Chat Moderation",
no_bttv: true, no_bttv: true,
category: "Chat Moderation",
name: "Mod Icon Context Menus", name: "Mod Icon Context Menus",
help: "Choose the available options when right-clicking an in-line moderation icon." help: "Choose the available options when right-clicking an in-line moderation icon."
} };
FFZ.settings_info.mod_card_reasons = { FFZ.settings_info.mod_card_reasons = {
@ -340,9 +317,9 @@ FFZ.settings_info.mod_buttons = {
// integer = Timeout (that amount of time) // integer = Timeout (that amount of time)
value: [['', false, false], ['',600, false]], //, ['', 1, false]], value: [['', false, false], ['',600, false]], //, ['', 1, false]],
category: "Chat Moderation",
no_bttv: true, no_bttv: true,
category: "Chat Moderation",
name: "Custom In-Line Moderation Icons", name: "Custom In-Line Moderation Icons",
help: "Change out the different in-line moderation icons to use any command quickly.", help: "Change out the different in-line moderation icons to use any command quickly.",

View file

@ -68,11 +68,7 @@ FFZ.settings_info.player_pause_hosts = {
}, },
value: 1, value: 1,
process_value: function(val) { process_value: utils.process_int(1),
if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
category: "Player", category: "Player",
name: "Auto-Pause Hosted Channels", name: "Auto-Pause Hosted Channels",

View file

@ -20,15 +20,11 @@ FFZ.settings_info.sidebar_followed_games = {
}, },
value: 5, value: 5,
process_value: function(val) { process_value: utils.process_int(5),
if ( typeof val === "string" )
return parseInt(val) || 0;
return val;
},
category: "Sidebar",
no_mobile: true, no_mobile: true,
category: "Sidebar",
name: "Followed Games", name: "Followed Games",
help: "Display this number of followed games on the sidebar.", help: "Display this number of followed games on the sidebar.",
@ -63,18 +59,11 @@ FFZ.settings_info.sidebar_hide_prime = {
}, },
value: 0, value: 0,
process_value: function(val) { process_value: utils.process_int(0),
if ( typeof val === "string" ) {
val = parseInt(val);
if ( isNaN(val) || ! isFinite(val) )
val = 0;
}
return val;
},
category: "Sidebar",
no_mobile: true, no_mobile: true,
category: "Sidebar",
name: "Hide Twitch Prime Offers", name: "Hide Twitch Prime Offers",
help: "Hide the Free with Prime section from the sidebar.", help: "Hide the Free with Prime section from the sidebar.",

View file

@ -328,9 +328,13 @@ module.exports = FFZ.utils = {
// Other Stuff // Other Stuff
process_int: function(default_value) { process_int: function(default_value, false_value, true_value) {
return function(val) { return function(val) {
if ( typeof val === "string" ) { if ( val === false && false_value !== undefined )
val = false_value;
else if ( val === true && true_value !== undefined )
val = true_value;
else if ( typeof val === "string" ) {
val = parseInt(val); val = parseInt(val);
if ( isNaN(val) || ! isFinite(val) ) if ( isNaN(val) || ! isFinite(val) )
val = default_value; val = default_value;

View file

@ -2908,6 +2908,7 @@ body:not(.ffz-top-conversations) .conversations-list-bottom-bar {
body:not(.ffz-tags-on-channel) .tw-title--tall { height: 60px } body:not(.ffz-tags-on-channel) .tw-title--tall { height: 60px }
body:not(.ffz-tags-on-channel) #broadcast-meta .ct-tags, body:not(.ffz-tags-on-channel) #broadcast-meta .ct-tags,
.cn-metabar__title .ct-tags,
/*body:not(.ffz-creative-showcase) .ct-banner-handler .tower > div:last-child,*/ /*body:not(.ffz-creative-showcase) .ct-banner-handler .tower > div:last-child,*/
body:not(.ffz-creative-showcase) .ct-spotlight-container { display: none; } body:not(.ffz-creative-showcase) .ct-spotlight-container { display: none; }