summaryrefslogtreecommitdiffstats
path: root/application/controllers/file.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-06-07 16:48:16 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-07-12 19:04:40 +0200
commit4650df72898250c027976a4335faef0bc33a4a16 (patch)
treecb2e1dd721a67199881281415d667d31583da914 /application/controllers/file.php
parent03d21abe6f2b092837f9c7b18958f6d78f29ce59 (diff)
Add asciinema support
This bypasses require.js for asciinema because apparently require.js can't deal with the embedded React library. The result is that React is not loaded properly and the asciinema player is unable to find it. Just load it like upstream tells you to. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/file.php')
-rw-r--r--application/controllers/file.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 1888b7c06..c26ae0420 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -229,9 +229,13 @@ class File extends MY_Controller {
}
}
- $this->output_cache->add_function(function() use ($filedata, $lexer, $is_multipaste) {
- $this->_highlight_file($filedata, $lexer, $is_multipaste);
- });
+ if ($lexer == "asciinema") {
+ $this->output_cache->add(array("filedata" => $filedata), "file/fragments/asciinema-player");
+ } else {
+ $this->output_cache->add_function(function() use ($filedata, $lexer, $is_multipaste) {
+ $this->_highlight_file($filedata, $lexer, $is_multipaste);
+ });
+ }
}
// TODO: move lexers json to dedicated URL