Permalink
Browse files

Merge branch 'master' of github.com:schacon/showoff

Conflicts:
	lib/showoff.rb
  • Loading branch information...
2 parents 4554fcf + 6e08e1f commit f1194820f96d28dbad55edd5eaa03c921c86d998 @goncalossilva goncalossilva committed Nov 20, 2011
View
@@ -204,6 +204,7 @@ custom event:
* *showoff:show* will be triggered as soon as you enter a page
* *showoff:next* will be triggered when you switch to the next page
+* *showoff:incr* will be triggered when you advance to the next increment on the page
* *showoff:prev* will be triggered when you switch to the previous page
These events are triggered on the "div.content" child of the slide, so you must
@@ -4,7 +4,7 @@
class CommandlineParser < Parslet::Parser
rule(:prompt) do
- str('$') | str('#')
+ str('$') | str('#') | str('>>')
end
rule(:text) do
View
@@ -31,8 +31,6 @@
class ShowOff < Sinatra::Application
- Version = VERSION = '0.7.0'
-
attr_reader :cached_image_size
set :views, File.dirname(__FILE__) + '/../views'
@@ -188,7 +186,7 @@ def update_image_paths(path, slide, static=false, pdf=false)
path = paths.join('/')
replacement_prefix = static ?
( pdf ? %(img src="file://#{settings.pres_dir}/#{path}) : %(img src="./file/#{path}) ) :
- %(img src="/image/#{path})
+ %(img src="#{@asset_path}image/#{path})
slide.gsub(/img src=\"([^\/].*?)\"/) do |s|
img_path = File.join(path, $1)
w, h = get_image_size(img_path)
@@ -203,7 +201,7 @@ def update_image_paths(path, slide, static=false, pdf=false)
if defined?(Magick)
def get_image_size(path)
if !cached_image_size.key?(path)
- img = Magick::Image.ping(path).first
+ img = Magick::Image.ping(File.join(@asset_path, path)).first
# don't set a size for svgs so they can expand to fit their container
if img.mime_type == 'image/svg+xml'
cached_image_size[path] = [nil, nil]
@@ -406,6 +404,7 @@ def self.do_static(what)
end
name = showoff.instance_variable_get(:@pres_name)
path = showoff.instance_variable_get(:@root_path)
+ logger = showoff.instance_variable_get(:@logger)
data = showoff.send(what, true)
if data.is_a?(File)
FileUtils.cp(data.path, "#{name}.pdf")
@@ -451,7 +450,7 @@ def self.do_static(what)
File.open(css_path) do |file|
data = file.read
data.scan(/url\((.*)\)/).flatten.each do |path|
- @logger.debug path
+ logger.debug path
dir = File.dirname(path)
FileUtils.makedirs(File.join(file_dir, dir))
FileUtils.copy(File.join(pres_dir, path), File.join(file_dir, path))
@@ -483,6 +482,7 @@ def eval_ruby code
@title = ShowOffUtils.showoff_title
what = params[:captures].first
what = 'index' if "" == what
+ @asset_path = (env['SCRIPT_NAME'] || '').gsub(/\/?$/, '/').gsub(/^\//, '')
if (what != "favicon.ico")
data = send(what)
if data.is_a?(File)
View
@@ -0,0 +1,3 @@
+# No namespace here since ShowOff is a class and I'd have to inherit from
+# Sinatra::Application (which we don't want to load here)
+SHOWOFF_VERSION = '0.7.0'
View
@@ -278,14 +278,21 @@ def self.showoff_title(dir = '.')
end
def self.showoff_pdf_options(dir = '.')
- get_config_option(dir, 'pdf_options', {:page_size => 'Letter', :orientation => 'Landscape'})
+ opts = get_config_option(dir, 'pdf_options', {:page_size => 'Letter', :orientation => 'Landscape'})
+ Hash[opts.map {|k, v| [k.to_sym, v]}] # keys must be symbols
end
def self.get_config_option(dir, option, default = nil)
index = File.join(dir, ShowOffUtils.presentation_config_file)
if File.exists?(index)
data = JSON.parse(File.read(index))
- data.is_a?(Hash) && data[option] || default
+ if data.is_a?(Hash)
+ if default.is_a?(Hash)
+ default.merge(data[option])
+ else
+ data[option] || default
+ end
+ end
end
end
View
@@ -335,6 +335,10 @@ a.fg-button { float:left; }
background-color: yellow;
}
+.executing:hover {
+ cursor: pointer;
+}
+
#tips, #preshow_timer {
display:inline;
background-color:#000;
View
@@ -2,7 +2,7 @@
var w = null;
$(function(){
- w = window.open('/');
+ w = window.open('/' + window.location.search);
// side menu accordian crap
$("#preso").bind("showoff:loaded", function (event) {
$(".menu > ul ul").hide()
View
@@ -50,7 +50,7 @@ function setupPreso(load_slides, prefix) {
function loadSlides(load_slides, prefix) {
//load slides offscreen, wait for images and then initialize
if (load_slides) {
- $("#slides").load("slides", false, function(){
+ $("#slides").load(loadSlidesPrefix + "slides", false, function(){
$("#slides img").batchImageLoad({
loadingCompleteCallback: initializePresentation(prefix)
})
@@ -252,6 +252,16 @@ function determineIncremental()
})
}
+function showIncremental(incr)
+{
+ elem = incrElem.eq(incrCurr)
+ if (incrCode && elem.hasClass('command')) {
+ incrElem.eq(incrCurr).css('visibility', 'visible').jTypeWriter({duration:1.0})
+ } else {
+ incrElem.eq(incrCurr).css('visibility', 'visible')
+ }
+}
+
function prevStep()
{
@@ -277,13 +287,12 @@ function nextStep()
slidenum++
return showSlide()
} else {
- elem = incrElem.eq(incrCurr)
- if (incrCode && elem.hasClass('command')) {
- incrElem.eq(incrCurr).css('visibility', 'visible').jTypeWriter({duration:1.0})
- } else {
- incrElem.eq(incrCurr).css('visibility', 'visible')
- }
- incrCurr++
+ showIncremental(incrCurr);
+ var incrEvent = jQuery.Event("showoff:incr");
+ incrEvent.slidenum = slidenum;
+ incrEvent.incr = incrCurr;
+ $(currentSlide).find(".content").trigger(incrEvent);
+ incrCurr++;
}
}
View
@@ -1,7 +1,9 @@
-require './lib/showoff'
+$:.unshift File.expand_path("../lib", __FILE__)
+require 'showoff/version'
+
Gem::Specification.new do |s|
s.name = "showoff"
- s.version = ShowOff::Version
+ s.version = SHOWOFF_VERSION
s.date = "2011-09-10"
s.summary = "The best damn presentation software a developer could ever love."
s.homepage = "http://github.com/schacon/showoff"
View
@@ -26,11 +26,11 @@
<link type="text/css" href="<%= @asset_path %>css/sh_style.css" rel="stylesheet" >
<% css_files.each do |css_file| %>
- <link rel="stylesheet" href="file/<%= css_file %>" type="text/css"/>
+ <link rel="stylesheet" href="<%= @asset_path %>file/<%= css_file %>" type="text/css"/>
<% end %>
<% js_files.each do |js_file| %>
- <script type="text/javascript" src="file/<%= js_file %>"></script>
+ <script type="text/javascript" src="<%= @asset_path %>file/<%= js_file %>"></script>
<% end %>
<script type="text/javascript">

0 comments on commit f119482

Please sign in to comment.