Skip to content

Commit

Permalink
Use 'white-space: pre-line' for multi-line compliment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ubertao committed Sep 24, 2018
1 parent d76c924 commit ba428c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 4 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ sup {
text-overflow: ellipsis;
}

.pre-line {
white-space: pre-line;
}

/**
* Region Definitions.
*/
Expand Down
11 changes: 3 additions & 8 deletions modules/default/compliments/compliments.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,10 @@ Module.register("compliments", {
getDom: function() {
var complimentText = this.randomCompliment();

var compliment = document.createTextNode(complimentText);
var wrapper = document.createElement("div");
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright";
complimentText.split("\n").forEach(function(line, index) {
if (index > 0) {
wrapper.appendChild(document.createElement("br"));
}
wrapper.appendChild(document.createTextNode(line));

});
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line";
wrapper.appendChild(compliment);

return wrapper;
},
Expand Down

0 comments on commit ba428c6

Please sign in to comment.