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 =terminal-font
// font metrics
font-family: 'Bitstream Vera Sans Mono', 'Courier New', monospace font-family: 'Bitstream Vera Sans Mono', 'Courier New', monospace
font-size: 12px font-size: 12px
// line metrics
line-height: 16px line-height: 16px
.line .line
@ -13,3 +9,11 @@
padding: 0 padding: 0
display: inline-block display: inline-block
height: 16px 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 .font-sample, .hud
+terminal-font +terminal-font
&.big-font
.font-sample, .hud
+terminal-font-big
.hud
height: 32px
bottom: 6px
left: 6px
right: 6px
.loading .loading
+player-overlay +player-overlay
background-image: url(image-path("loader.gif")) background-image: url(image-path("loader.gif"))
@ -64,9 +74,9 @@ $color5: #edc951
background-color: #eee background-color: #eee
opacity: 0 opacity: 0
position: absolute position: absolute
left: 2px left: 3px
right: 2px right: 3px
bottom: 2px bottom: 3px
height: 16px height: 16px
overflow: hidden overflow: hidden
color: black color: black

View File

@ -29,3 +29,9 @@ pre.terminal
.fg8, .fg9, .fg10, .fg11, .fg12, .fg13, .fg14, .fg15 .fg8, .fg9, .fg10, .fg11, .fg12, .fg13, .fg14, .fg15
font-weight: bold 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], container_width: params[:container_width],
renderer_class: renderer_class, renderer_class: renderer_class,
auto_play: options.key?(:auto_play) ? !!options[:auto_play] : false, 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 end

View File

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

View File

@ -30,7 +30,11 @@
container.style.overflow = 'hidden'; container.style.overflow = 'hidden';
container.style.padding = '0'; container.style.padding = '0';
insertAfter(scriptTag, container); insertAfter(scriptTag, container);
var containerWidth = container.offsetWidth; var params = 'container_width=' + 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 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>';
} }
})(); })();