summaryrefslogtreecommitdiffstats
path: root/data/js/util.js
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-04-19 01:21:28 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-05 12:21:27 +0200
commitf0be7e7412721039cdd37798fe294dd5cb41d216 (patch)
tree7b0c731174da32296d2e061f867af0393f401a66 /data/js/util.js
parentc6448f49018ba88d5b2525b224415e6d7fd2b4fe (diff)
Refactor linewrap toggle
Diffstat (limited to 'data/js/util.js')
-rw-r--r--data/js/util.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/data/js/util.js b/data/js/util.js
index 6c88edb2d..af3635673 100644
--- a/data/js/util.js
+++ b/data/js/util.js
@@ -43,6 +43,16 @@ define(['jquery'], function () {
},
setTabwidthFromLocalStorage: function () {
this.setTabwidth(localStorage.getItem('tabwidth'));
+ },
+ setLineWrap: function (lines_wrapped) {
+ var whitespaceMode = lines_wrapped ? 'pre-wrap' : 'pre';
+ $('.highlight > pre').css('white-space', whitespaceMode);
+ localStorage.setItem('lines_wrapped', lines_wrapped);
+ },
+ toggleLineWrap: function() {
+ this.setLineWrap(
+ localStorage.getItem('lines_wrapped') !== 'true'
+ );
}
};
return Util;