Custom CSS

This commit is contained in:
Jiiks 2015-11-28 05:17:39 +02:00
parent 7f15dc8d57
commit cf5c4ffa9b
5 changed files with 42 additions and 7 deletions

View File

@ -48,6 +48,9 @@ Only display voice channels
**Public Servers:** **Public Servers:**
A menu for displaying public servers. [Serverlist](https://github.com/Jiiks/BetterDiscordApp/blob/master/serverlist.json) A menu for displaying public servers. [Serverlist](https://github.com/Jiiks/BetterDiscordApp/blob/master/serverlist.json)
**Custom CSS**
BetterDiscord supports custom CSS for styling Discord to your liking.
**Spoilers** **Spoilers**
Add spoilers to your chat, simply add [!s] to your message. Add spoilers to your chat, simply add [!s] to your message.

View File

@ -1,3 +1,9 @@
#custom-css-ta {
background: #D8D8D8;
height: 200px;
font-family: "Consolas";
}
.spoiler { .spoiler {
color:transparent !important; color:transparent !important;
} }

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -683,6 +683,16 @@ SettingsPanel.prototype.init = function() {
}; };
SettingsPanel.prototype.applyCustomCss = function(css) {
if($("#customcss").length == 0) {
$("head").append('<style id="customcss"></style>');
}
$("#customcss").html(css);
localStorage.setItem("bdcustomcss", btoa(css));
};
SettingsPanel.prototype.construct = function() { SettingsPanel.prototype.construct = function() {
var self = this; var self = this;
@ -724,30 +734,46 @@ SettingsPanel.prototype.construct = function() {
}); });
settingsWrapper.append(controlGroups); settingsWrapper.append(controlGroups);
/*settingsWrapper.append(controlGroups2);*/ settingsWrapper.append(controlGroups2);
var featuresGroup = $("<div/>", { var featuresGroup = $("<div/>", {
class: "control-group" class: "control-group"
}); });
var upcomingGroup = $("<div/>", { var customCssGroup = $("<div/>", {
class: "control-group" class: "control-group"
}); });
controlGroups.append(featuresGroup); controlGroups.append(featuresGroup);
controlGroups2.append(upcomingGroup); controlGroups2.append(customCssGroup);
featuresGroup.append($("<label/>", { featuresGroup.append($("<label/>", {
text: "BetterDiscord Settings" text: "BetterDiscord Settings"
})); }));
upcomingGroup.append($("<label/>", { customCssGroup.append($("<label/>", {
text: "Upcoming Features" text: "Custom CSS"
})); }));
var ta = $("<textarea/>", {
id: "custom-css-ta"
});
var decode = atob(localStorage.getItem("bdcustomcss"));
self.applyCustomCss(decode);
ta.val(decode);
customCssGroup.append(ta);
ta.on("input propertychange", function() {
self.applyCustomCss($(this).val());
});
var featuresCheckboxGroup = $("<ul/>", { var featuresCheckboxGroup = $("<ul/>", {
class: "checkbox-group" class: "checkbox-group"
}); });
function updateSetting() { function updateSetting() {
var cb = $(this).children().find('input[type="checkbox"]'); var cb = $(this).children().find('input[type="checkbox"]');
var enabled = !cb.is(":checked"); var enabled = !cb.is(":checked");

2
js/main.min.js vendored

File diff suppressed because one or more lines are too long