From e36c3ab68634ef76ea06a6fed5b2cb0d5cbd97ed Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 29 Oct 2012 00:01:40 +0100 Subject: Add button to wrap long lines in code view Since wrapping would break the line numbers we hide them. Signed-off-by: Florian Pritz --- data/js/script.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'data/js') diff --git a/data/js/script.js b/data/js/script.js index 744722145..5faad3899 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -59,6 +59,18 @@ function fixedEncodeURIComponent (str) { return this; }); + window.lines_wrapped = false; + $('#linewrap').click(function() { + if (window.lines_wrapped == true) { + $(".content .numbers").show(); + $(".content .code > .highlight > pre").css("white-space", "pre"); + } else { + $(".content .numbers").hide(); + $(".content .code > .highlight > pre").css("white-space", "pre-wrap"); + } + window.lines_wrapped = !window.lines_wrapped; + }); + // check file size before uploading if browser support html5 if (window.File && window.FileList) { function checkFileUpload(evt) { -- cgit v1.2.3-24-g4f1b