From 4650df72898250c027976a4335faef0bc33a4a16 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 7 Jun 2016 16:48:16 +0200 Subject: 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 --- application/controllers/file.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'application/controllers/file.php') 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 -- cgit v1.2.3-24-g4f1b