summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/views/file/html_header.php1
-rw-r--r--data/js/script.js12
2 files changed, 13 insertions, 0 deletions
diff --git a/application/views/file/html_header.php b/application/views/file/html_header.php
index dc9bb05ad..e14bad6f5 100644
--- a/application/views/file/html_header.php
+++ b/application/views/file/html_header.php
@@ -74,6 +74,7 @@ include(FCPATH."application/views/header.php"); ?>
</li>
</ul>
<div class="btn-group pull-right" style="margin-top: 7px; margin-right:-10px;">
+ <a id="linewrap" class="btn btn-small" rel="tooltip" title="Wrap long lines">Linewrap</a>
<a href="<?php echo site_url($id."/plain") ?>" class="btn btn-small" rel="tooltip" title="View as plain text">Plain</a>
<a href="<?php echo site_url($id) ?>" class="btn btn-small" rel="tooltip" title="View as raw file (org. mime type)">Raw</a>
<?php if ($current_highlight === 'rmd') { ?>
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) {