slideoff 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a283925d99d7189d3016753e28952ea15014410f
4
- data.tar.gz: 3f75827bbf04cc0073fd4125080a68c98fdd6c49
3
+ metadata.gz: 292dc9e44e4bdb71dd13dec1241465452a029329
4
+ data.tar.gz: f9b232e08f19cd6edec6c21bbf950bf199721a54
5
5
  SHA512:
6
- metadata.gz: c59a73be6e9301c96858704e6158224fd9fc42058bf00a66fb9fd13ba8636e775a8e6109d76abae76831395c3b33b3a6d11477ae47b4c4983dea1bf3cd2842db
7
- data.tar.gz: 0a15722c6c4df02968202566b862a451c1ca66b4508ac8a9e8c1e3073ea11f1d13b8ec5e0f65f13e3169129905f49d5cae07a57052edb9a21ecff14dd10ac514
6
+ metadata.gz: 4ef62a3b328560f2d65191ac6644bb6fd35fd5066978b7cc47033710d611d6d7dd0b036e6f4dd5eeded0020f70e4f28e515ba7783eb9d869ee13564709f4943f
7
+ data.tar.gz: 73a568350aa9a9b942816898d277a6c6a645b503130ca2cb0f6db9d63acbcb4b5c83a1f5ae369f9fd944109bb377fad64f132e581c3c2666021c48fe99d222dc
@@ -43,7 +43,7 @@ module Slideoff
43
43
  Dir[ "#{CONFIG.pwd}#{asset}"].first ||
44
44
  Dir[ "#{theme.dir}#{asset}"].first ||
45
45
  Dir[ "#{common.dir}#{asset}"].first ||
46
- (Dir["#{CONFIG.pwd}/**#{asset}"] - Dir["#{CONFIG.static_dir}/**#{asset}"]).first
46
+ lookup_recursive_without_static(asset).first
47
47
  end
48
48
 
49
49
  def convert_styles(dir)
@@ -54,6 +54,12 @@ module Slideoff
54
54
 
55
55
  protected
56
56
 
57
+ def lookup_recursive_without_static(path)
58
+ found_paths = Dir["#{File.absolute_path(CONFIG.pwd)}/**#{path}"]
59
+ found_static_paths = Dir["#{File.absolute_path(CONFIG.static_dir)}/**#{path}"]
60
+ found_paths - found_static_paths
61
+ end
62
+
57
63
  def build_theme(title)
58
64
  Theme.new.tap do |t|
59
65
  dir = File.expand_path("#{CONFIG.dir}/themes/#{title}")
data/lib/slideoff.rb CHANGED
@@ -11,5 +11,5 @@ module Slideoff
11
11
  autoload :FlickrAPI, "slideoff/flickr_api"
12
12
 
13
13
  CONFIG = ConfigBuilder.new(Dir.pwd)
14
- VERSION = "0.3.3"
14
+ VERSION = "0.3.4"
15
15
  end
@@ -300,36 +300,50 @@ class Slide
300
300
 
301
301
  containsInactive: -> @firstInactiveElement().length > 0
302
302
 
303
+ containsCurrent: -> @firstCurrentElement().length > 0
304
+
305
+ containsVisited: -> @html().find('.visited').length > 0
306
+
303
307
  firstInactiveElement: -> @html().find('.inactive').first()
304
308
 
305
- removePresentElement: -> @html().find('.current').first().removeClass('current')
309
+ firstCurrentElement: -> @html().find('.current').first()
306
310
 
307
- nextInactive: ->
308
- @html().removeClass('incr') unless @containsInactive()
309
- element = @firstInactiveElement()
310
- @html().find('.current').first().addClass('visited')
311
- @removePresentElement()
311
+ prevInteractive: ->
312
+ @firstCurrentElement().removeClass('current').addClass('inactive')
313
+
314
+ unless @containsVisited()
315
+ @prev().goto()
316
+ return
317
+
318
+ @html().find('.visited').last().removeClass('visited').addClass('current')
319
+ @decrementStep() if @html().hasClass('step-0')
320
+
321
+ nextInteractive: ->
322
+ @firstCurrentElement().removeClass('current').addClass('visited')
323
+
324
+ unless @containsInactive()
325
+ @next().goto()
326
+ return
312
327
 
313
- element.removeClass('inactive')
328
+ element = @firstInactiveElement()
329
+ element.removeClass('inactive').addClass('current')
314
330
  if element.is("pre[data-lang=sh] code")
315
331
  element.typewriter()
316
332
  else
317
- element.addClass('current')
318
333
  @incrementStep()
319
334
 
320
- resetStep: ->
321
- currentHtml = Slide.current().html()
322
- step = 0
323
- while currentHtml.hasClass("step-#{step}")
324
- currentHtml.removeClass("step-#{step}")
325
- step = step + 1
335
+ decrementStep: ->
336
+ max_steps = @html().find('.step').length
337
+ step = max_steps
338
+ while step >= 0 && step <= max_steps && !@html().hasClass("step-#{step}")
339
+ step = step - 1
340
+ @html().removeClass("step-#{step}")
326
341
 
327
342
  incrementStep: ->
328
- currentHtml = Slide.current().html()
329
343
  step = 0
330
- while currentHtml.hasClass("step-#{step}")
344
+ while @html().hasClass("step-#{step}")
331
345
  step = step + 1
332
- currentHtml.addClass("step-#{step}")
346
+ @html().addClass("step-#{step}")
333
347
 
334
348
  # private
335
349
 
@@ -366,17 +380,23 @@ class UserInterface
366
380
  Slide.last().goto()
367
381
 
368
382
  @nextStep: ->
383
+ return unless Mode.isSlideMode()
384
+
369
385
  slide = Slide.current()
370
- if Mode.isSlideMode() and slide.containsInactive()
371
- slide.nextInactive()
386
+ if slide.containsInactive() or slide.containsCurrent()
387
+ slide.nextInteractive()
372
388
  else
373
389
  slide.html().removeClass('incr')
374
- slide.removePresentElement()
375
- slide.resetStep()
376
390
  slide.next().goto()
377
391
 
378
392
  @prevStep: ->
379
- Slide.current().prev().goto()
393
+ return unless Mode.isSlideMode()
394
+
395
+ slide = Slide.current()
396
+ if slide.containsVisited() or slide.containsCurrent()
397
+ slide.prevInteractive()
398
+ else
399
+ slide.prev().goto()
380
400
 
381
401
  @nextBigStep: ->
382
402
  Slide.current().nextSection().goto()
@@ -420,51 +420,67 @@ Slide = (function() {
420
420
  return this.firstInactiveElement().length > 0;
421
421
  };
422
422
 
423
+ Slide.prototype.containsCurrent = function() {
424
+ return this.firstCurrentElement().length > 0;
425
+ };
426
+
427
+ Slide.prototype.containsVisited = function() {
428
+ return this.html().find('.visited').length > 0;
429
+ };
430
+
423
431
  Slide.prototype.firstInactiveElement = function() {
424
432
  return this.html().find('.inactive').first();
425
433
  };
426
434
 
427
- Slide.prototype.removePresentElement = function() {
428
- return this.html().find('.current').first().removeClass('current');
435
+ Slide.prototype.firstCurrentElement = function() {
436
+ return this.html().find('.current').first();
429
437
  };
430
438
 
431
- Slide.prototype.nextInactive = function() {
439
+ Slide.prototype.prevInteractive = function() {
440
+ this.firstCurrentElement().removeClass('current').addClass('inactive');
441
+ if (!this.containsVisited()) {
442
+ this.prev().goto();
443
+ return;
444
+ }
445
+ this.html().find('.visited').last().removeClass('visited').addClass('current');
446
+ if (this.html().hasClass('step-0')) {
447
+ return this.decrementStep();
448
+ }
449
+ };
450
+
451
+ Slide.prototype.nextInteractive = function() {
432
452
  var element;
453
+ this.firstCurrentElement().removeClass('current').addClass('visited');
433
454
  if (!this.containsInactive()) {
434
- this.html().removeClass('incr');
455
+ this.next().goto();
456
+ return;
435
457
  }
436
458
  element = this.firstInactiveElement();
437
- this.html().find('.current').first().addClass('visited');
438
- this.removePresentElement();
439
- element.removeClass('inactive');
459
+ element.removeClass('inactive').addClass('current');
440
460
  if (element.is("pre[data-lang=sh] code")) {
441
461
  return element.typewriter();
442
462
  } else {
443
- element.addClass('current');
444
463
  return this.incrementStep();
445
464
  }
446
465
  };
447
466
 
448
- Slide.prototype.resetStep = function() {
449
- var currentHtml, step, _results;
450
- currentHtml = Slide.current().html();
451
- step = 0;
452
- _results = [];
453
- while (currentHtml.hasClass("step-" + step)) {
454
- currentHtml.removeClass("step-" + step);
455
- _results.push(step = step + 1);
467
+ Slide.prototype.decrementStep = function() {
468
+ var max_steps, step;
469
+ max_steps = this.html().find('.step').length;
470
+ step = max_steps;
471
+ while (step >= 0 && step <= max_steps && !this.html().hasClass("step-" + step)) {
472
+ step = step - 1;
456
473
  }
457
- return _results;
474
+ return this.html().removeClass("step-" + step);
458
475
  };
459
476
 
460
477
  Slide.prototype.incrementStep = function() {
461
- var currentHtml, step;
462
- currentHtml = Slide.current().html();
478
+ var step;
463
479
  step = 0;
464
- while (currentHtml.hasClass("step-" + step)) {
480
+ while (this.html().hasClass("step-" + step)) {
465
481
  step = step + 1;
466
482
  }
467
- return currentHtml.addClass("step-" + step);
483
+ return this.html().addClass("step-" + step);
468
484
  };
469
485
 
470
486
  Slide.prototype.slideList = function() {
@@ -523,19 +539,29 @@ UserInterface = (function() {
523
539
 
524
540
  UserInterface.nextStep = function() {
525
541
  var slide;
542
+ if (!Mode.isSlideMode()) {
543
+ return;
544
+ }
526
545
  slide = Slide.current();
527
- if (Mode.isSlideMode() && slide.containsInactive()) {
528
- return slide.nextInactive();
546
+ if (slide.containsInactive() || slide.containsCurrent()) {
547
+ return slide.nextInteractive();
529
548
  } else {
530
549
  slide.html().removeClass('incr');
531
- slide.removePresentElement();
532
- slide.resetStep();
533
550
  return slide.next().goto();
534
551
  }
535
552
  };
536
553
 
537
554
  UserInterface.prevStep = function() {
538
- return Slide.current().prev().goto();
555
+ var slide;
556
+ if (!Mode.isSlideMode()) {
557
+ return;
558
+ }
559
+ slide = Slide.current();
560
+ if (slide.containsVisited() || slide.containsCurrent()) {
561
+ return slide.prevInteractive();
562
+ } else {
563
+ return slide.prev().goto();
564
+ }
539
565
  };
540
566
 
541
567
  UserInterface.nextBigStep = function() {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - DSIW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-05 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: goliath