shining 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.4
@@ -14,9 +14,13 @@
14
14
  first: function() { return this._slides[0] },
15
15
  last: function() { return this._slides[ this._slides.length - 1 ] },
16
16
  next: function() { return this._slides[ this._slides.indexOf(this.current()) + 1 ] },
17
- previous: function() { return this._slides[ this._slides.indexOf(this.current()) - 1 ] },
17
+ previous: function() {
18
+ var previous = this._slides[ this._slides.indexOf(this.current()) - 1 ];
19
+ return previous ? previous : this.first();
20
+ },
18
21
  add: function(slides) { return Array.prototype.push.apply(this._slides, slides) },
19
22
  _slides: [],
23
+ _loaded: {},
20
24
  _current: 0
21
25
  };
22
26
 
@@ -122,8 +126,9 @@
122
126
  });
123
127
  $(window).resize(function() { $('#stage').centralize() });
124
128
  loadConfig(function() {
125
- var startAt = document.location.hash.replace('#', '');
126
- loadSlide(startAt ? startAt : $.shining.slides.current(), true);
129
+ var startAt = document.location.hash.replace('#', ''),
130
+ firstSlide = startAt ? startAt : $.shining.slides.current();
131
+ loadSlide(firstSlide, function() { playSlide(firstSlide) });
127
132
  setTitle($.shining.config.title);
128
133
  setTheme($.shining.config.theme);
129
134
  parseEffects();
@@ -142,9 +147,9 @@
142
147
  function getSlide(name) {
143
148
  if (!name) return false;
144
149
  applyTransition(
145
- function() { loadSlide(name) },
150
+ function() { loadSlide(name, function() { playSlide(name) }) },
146
151
  function() {
147
- $.shining.scripts.run($.shining.currentScript)
152
+ $.shining.scripts.run($.shining.slides._loaded[$.shining.slides.current()].script)
148
153
  }
149
154
  )
150
155
  }
@@ -160,37 +165,41 @@
160
165
  return $('link.theme').attr('href', path);
161
166
  }
162
167
 
163
- // private
164
168
  function slide(name) {
165
169
  return 'slides/' + name;
166
170
  }
167
-
168
- function vendored() {
169
- return $('script:first').attr('src').match(/^vendor/);
170
- }
171
-
172
- function loadSlide(name, runScript) {
173
- $('#stage .contents').load(
171
+
172
+ function loadSlide(name, afterLoad) {
173
+ $.get(
174
174
  slide(name).markup(),
175
175
  function(data) {
176
- $.shining.slides.current(name);
177
- $('link.slide').remove(); // remove now previous slide styles
178
- if (SyntaxHighlighter) SyntaxHighlighter.highlight();
179
- $('#stage').centralize();
180
- $.shining.scripts.reap();
181
- updateControlAnchors();
176
+ $.shining.slides._loaded[name] = {};
177
+ $.shining.slides._loaded[name].markup = data;
182
178
  if (data) {
183
- loadSlideScript(name, runScript);
179
+ loadSlideScript(name, afterLoad);
184
180
  loadSlideStyle(name);
185
181
  }
186
182
  }
187
183
  );
188
184
  }
185
+
186
+ function playSlide(name) {
187
+ var slide = $.shining.slides._loaded[name];
188
+ $('#stage .contents').html(slide.markup);
189
+ $.shining.scripts.run(slide.script);
190
+ updateControlAnchors();
191
+ }
189
192
 
190
- function loadSlideScript(name, run) {
191
- $.get(slide(name).script(), function(script) {
192
- $.shining.currentScript = script;
193
- if (run) $.shining.scripts.run($.shining.currentScript);
193
+ function loadSlideScript(name, afterLoad) {
194
+ $.ajax({
195
+ url: slide(name).script(),
196
+ type: 'GET',
197
+ success: function(script) {
198
+ $.shining.slides._loaded[name].script = script;
199
+ },
200
+ complete: function() {
201
+ if ($.isFunction(afterLoad)) afterLoad.call();
202
+ }
194
203
  })
195
204
  }
196
205
 
@@ -205,6 +214,10 @@
205
214
  callback.call();
206
215
  });
207
216
  }
217
+
218
+ function local() {
219
+ document.location.protocol == 'file:'
220
+ }
208
221
 
209
222
  function parseEffects() {
210
223
  $.get($('link[href$=effects.css]').attr('href'),
@@ -246,6 +259,7 @@
246
259
  return parsed;
247
260
  },
248
261
  run: function(script) {
262
+ if (typeof script == 'undefined' || script == '') return false;
249
263
  var parsed = $.shining.scripts.parse(script), all = [];
250
264
  for (var i = 0; parsed.length > i; i += 2) {
251
265
  all.push(["at(", parsed[i], ", function() { ", parsed[i+1], " })"].join(''));
data/shining.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shining}
8
- s.version = "1.1.3"
8
+ s.version = "1.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julio Cesar Ody"]
12
- s.date = %q{2010-04-12}
12
+ s.date = %q{2010-04-16}
13
13
  s.description = %q{Webkit + CSS + Javascript = awesome presos}
14
14
  s.email = %q{julio.ody@gmail.com}
15
15
  s.executables = ["console", "shine"]
@@ -1,4 +1,5 @@
1
1
  {
2
2
  "slides": ["welcome"],
3
+ "title": "Your presentation",
3
4
  "transitions": "fade"
4
5
  }
data/templates/index.html CHANGED
@@ -16,7 +16,6 @@
16
16
  <body>
17
17
  <section id="stage">
18
18
  <div class="contents"></div>
19
-
20
19
  </section>
21
20
  <nav id="controls" class="transparent">
22
21
  <a id="first"><<</a>
@@ -1,4 +1,4 @@
1
1
  <h1 class="centered">Welcome to your preso!</h1>
2
2
  <p class="centered">
3
- Lorem Ipsum is hard to understand.
3
+ Bettlejuice! Bettlejuice! Bettlejuice!
4
4
  </p>
data/themes/default.css CHANGED
@@ -2,6 +2,10 @@ body { background-color: rgb(48, 48, 48) }
2
2
  #stage {
3
3
  -webkit-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.6);
4
4
  -webkit-border-radius: 5px;
5
+ -moz-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.6);
6
+ -moz-border-radius: 5px;
7
+ box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.6);
8
+ border-radius: 5px;
5
9
  }
6
10
 
7
11
  h1, h2, h3, p, li { color: rgb(238, 238, 238); text-shadow: rgb(0, 0, 0) 2px 2px 4px }
@@ -16,6 +20,9 @@ ul { list-style-type: disc }
16
20
  background-color: rgba(0, 0, 0, 0.5);
17
21
  -webkit-border-top-left-radius: 5px;
18
22
  -webkit-border-top-right-radius: 5px;
23
+ -moz-border-radius-topleft: 5px;
24
+ -moz-border-radius-topright: 5px;
25
+
19
26
  }
20
27
  #controls a { display: inline-block; width: 75px; padding: 5px 0; font-weight: bold; color: #fff; }
21
28
  em { color: rgb(73, 255, 80) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shining
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julio Cesar Ody
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-04-12 00:00:00 +10:00
12
+ date: 2010-04-16 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency