mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-01 15:38:31 +00:00
Dark Mode
This commit is contained in:
parent
4c3b9217a8
commit
2fa93b0a8e
8 changed files with 268 additions and 13 deletions
|
@ -113,6 +113,15 @@ FFZ.prototype.render_badge = function(view) {
|
|||
var badge = data.badges[slot],
|
||||
full_badge = this.badges[badge.id] || {};
|
||||
|
||||
if ( full_badge.visible !== undefined ) {
|
||||
var visible = full_badge.visible;
|
||||
if ( typeof visible == "function" )
|
||||
try { visible = visible.bind(this)(room_id, user); } catch(err) { }
|
||||
|
||||
if ( ! visible )
|
||||
continue;
|
||||
}
|
||||
|
||||
var el = document.createElement('div');
|
||||
el.className = 'badge float-left tooltip ffz-badge-' + badge.id;
|
||||
el.setAttribute('title', badge.title || full_badge.title);
|
||||
|
@ -145,16 +154,26 @@ FFZ.prototype.render_badge = function(view) {
|
|||
// Legacy Support
|
||||
// --------------------
|
||||
|
||||
FFZ.known_bots = ["quoteconut", "quoconut", "zenwan", "nightbot", "moobot", "xanbot"];
|
||||
|
||||
FFZ.prototype._legacy_add_donors = function(tries) {
|
||||
this.badges[1] = {id: 1, title: "FFZ Donor", color: "#755000", image: "//cdn.frankerfacez.com/channel/global/donoricon.png"};
|
||||
utils.update_css(this._badge_style, 1, badge_css(this.badges[1]));
|
||||
|
||||
// Developer Badges
|
||||
// TODO: Upload the badge to the proper CDN.
|
||||
this.badges[0] = {id: 0, title: "FFZ Developer", color: "#FAAF19", image: "//cdn.frankerfacez.com/channel/global/devicon.png"};
|
||||
utils.update_css(this._badge_style, 0, badge_css(this.badges[0]));
|
||||
this.users.sirstendec = {badges: {0: {id:0}}};
|
||||
|
||||
// Bot Badges
|
||||
/*this.badges[2] = {id: 2, title: "Bot", color: "#595959", image: "//cdn.frankerfacez.com/channel/global/boticon.png",
|
||||
visible: function(r,user) { return !(this.has_bttv && FFZ.bttv_known_bots[user]); }};
|
||||
utils.update_css(this._badge_style, 2, badge_css(this.badges[2]));
|
||||
|
||||
for(var i=0;i<FFZ.known_bots.length;i++)
|
||||
this.users[FFZ.known_bots[i]] = {badges: {1: {id:2}}};*/
|
||||
|
||||
|
||||
jQuery.ajax(constants.SERVER + "script/donors.txt", {cache: false, context: this})
|
||||
.done(function(data) {
|
||||
this._legacy_parse_donors(data);
|
||||
|
|
|
@ -2,6 +2,8 @@ var FFZ = window.FrankerFaceZ,
|
|||
SENDER_REGEX = /(\sdata-sender="[^"]*"(?=>))/;
|
||||
|
||||
|
||||
FFZ.bttv_known_bots = ["nightbot","moobot","sourbot","xanbot","manabot","mtgbot","ackbot","baconrobot","tardisbot","deejbot","valuebot","stahpbot"];
|
||||
|
||||
// --------------------
|
||||
// Initialization
|
||||
// --------------------
|
||||
|
|
|
@ -132,7 +132,7 @@ require('./ext/emote_menu');
|
|||
require('./featurefriday');
|
||||
|
||||
require('./ui/styles');
|
||||
//require('./ui/dark');
|
||||
require('./ui/dark');
|
||||
require('./ui/notifications');
|
||||
require('./ui/viewer_count');
|
||||
|
||||
|
@ -182,7 +182,7 @@ FFZ.prototype.setup_ember = function(delay) {
|
|||
this.load_settings();
|
||||
|
||||
// Start this early, for quick loading.
|
||||
//this.setup_dark();
|
||||
this.setup_dark();
|
||||
|
||||
this.ws_create();
|
||||
this.setup_emoticons();
|
||||
|
|
|
@ -6,22 +6,36 @@ var FFZ = window.FrankerFaceZ,
|
|||
// Settings
|
||||
// ---------------------
|
||||
|
||||
FFZ.settings_info.twitch_chat_dark = {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
visible: false
|
||||
};
|
||||
|
||||
|
||||
FFZ.settings_info.dark_twitch = {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
|
||||
visible: function() { return ! this.has_bttv },
|
||||
|
||||
name: "Dark Twitch",
|
||||
help: "View the entire site with a dark theme.",
|
||||
name: "Dark Twitch <span>Beta</span>",
|
||||
help: "Apply a dark background to channels and other related pages for easier viewing.",
|
||||
|
||||
on_update: function(val) {
|
||||
if ( this.has_bttv )
|
||||
return;
|
||||
|
||||
document.body.classList.toggle("ffz-dark", val);
|
||||
if ( val )
|
||||
|
||||
var model = App.__container__.lookup('controller:settings').get('model');
|
||||
|
||||
if ( val ) {
|
||||
this._load_dark_css();
|
||||
this.settings.set('twitch_chat_dark', model.get('darkMode'));
|
||||
model.set('darkMode', true);
|
||||
} else
|
||||
model.set('darkMode', this.settings.twitch_chat_dark);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -35,6 +49,9 @@ FFZ.prototype.setup_dark = function() {
|
|||
return;
|
||||
|
||||
document.body.classList.toggle("ffz-dark", this.settings.dark_twitch);
|
||||
if ( this.settings.dark_twitch )
|
||||
App.__container__.lookup('controller:settings').set('model.darkMode', true);
|
||||
|
||||
if ( this.settings.dark_twitch )
|
||||
this._load_dark_css();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue