From ec7f138dccfea109b77945a84883367cb1966892 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 27 Nov 2011 14:24:12 +0100 Subject: [PATCH] Create JS player instance in template instead of in JS --- app/assets/javascripts/player.js | 2 -- app/helpers/asciicasts_helper.rb | 16 +++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/player.js b/app/assets/javascripts/player.js index c3eabb4..32d3d66 100644 --- a/app/assets/javascripts/player.js +++ b/app/assets/javascripts/player.js @@ -69,5 +69,3 @@ $(function() { } }); }); - -$(function() { new SP.Player(cols, lines, data, time) }); diff --git a/app/helpers/asciicasts_helper.rb b/app/helpers/asciicasts_helper.rb index c5adf85..57553f2 100644 --- a/app/helpers/asciicasts_helper.rb +++ b/app/helpers/asciicasts_helper.rb @@ -13,13 +13,15 @@ module AsciicastsHelper end var_time = "[#{time_lines.join(',')}]" - out = "" - out.html_safe + < + var data = #{var_data}; + var time = #{j var_time}; + var cols = #{asciicast.terminal_columns}; + var lines = #{asciicast.terminal_lines}; + $(function() { new SP.Player(cols, lines, data, time); }); + +EOS end end