Add support to embed script for making the terminal font 2x bigger

This commit is contained in:
Marcin Kulik 2013-10-12 15:48:51 +02:00
parent f689595446
commit 90954c03b6
6 changed files with 37 additions and 12 deletions

View File

@ -1,11 +1,7 @@
=terminal-font
// font metrics
font-family: 'Bitstream Vera Sans Mono', 'Courier New', monospace
font-size: 12px
// line metrics
line-height: 16px
.line
@ -13,3 +9,11 @@
padding: 0
display: inline-block
height: 16px
=terminal-font-big
font-size: 24px
line-height: 32px
.line
span
height: 32px

View File

@ -27,6 +27,16 @@ $color5: #edc951
.font-sample, .hud
+terminal-font
&.big-font
.font-sample, .hud
+terminal-font-big
.hud
height: 32px
bottom: 6px
left: 6px
right: 6px
.loading
+player-overlay
background-image: url(image-path("loader.gif"))
@ -64,9 +74,9 @@ $color5: #edc951
background-color: #eee
opacity: 0
position: absolute
left: 2px
right: 2px
bottom: 2px
left: 3px
right: 3px
bottom: 3px
height: 16px
overflow: hidden
color: black

View File

@ -29,3 +29,9 @@ pre.terminal
.fg8, .fg9, .fg10, .fg11, .fg12, .fg13, .fg14, .fg15
font-weight: bold
.big-font
pre.terminal
+terminal-font-big
padding: 6px

View File

@ -21,7 +21,8 @@ module AsciicastsHelper
container_width: params[:container_width],
renderer_class: renderer_class,
auto_play: options.key?(:auto_play) ? !!options[:auto_play] : false,
hud: options.key?(:hud) ? !!options[:hud] : true
hud: options.key?(:hud) ? !!options[:hud] : true,
size: params[:size] || 'small'
}
end

View File

@ -1,4 +1,4 @@
.player
.player class="#{size}-font"
javascript:
$(function() {

View File

@ -30,7 +30,11 @@
container.style.overflow = 'hidden';
container.style.padding = '0';
insertAfter(scriptTag, container);
var containerWidth = container.offsetWidth;
container.innerHTML = '<iframe src="http://<%= request.host_with_port %>/a/<%= @asciicast.id %>/raw?container_width=' + containerWidth + '" name="asciicast-iframe-<%= @asciicast.id %>" id="asciicast-iframe-<%= @asciicast.id %>" width="600" height="300" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="display: block; float: none; visibility: hidden;" onload="this.style.visibility=\'visible\';"></iframe>';
var params = 'container_width=' + container.offsetWidth;
var size = scriptTag.getAttribute('data-size');
if (size) {
params += '&size=' + size;
}
container.innerHTML = '<iframe src="http://<%= request.host_with_port %>/a/<%= @asciicast.id %>/raw?' + params + '" name="asciicast-iframe-<%= @asciicast.id %>" id="asciicast-iframe-<%= @asciicast.id %>" width="300" height="300" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="display: block; float: none; visibility: hidden;" onload="this.style.visibility=\'visible\';"></iframe>';
}
})();