shining 1.1.8 → 1.2.0

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.8
1
+ 1.2.0
@@ -13,8 +13,11 @@
13
13
  all: function() { return this._slides },
14
14
  first: function() { return this._slides[0] },
15
15
  last: function() { return this._slides[ this._slides.length - 1 ] },
16
- next: function() { return this._slides[ this._slides.indexOf(this.current()) + 1 ] },
17
- previous: function() {
16
+ next: function() {
17
+ window.sli = this._slides;
18
+ return this._slides[ this._slides.indexOf(this.current()) + 1 ]
19
+ },
20
+ previous: function() {
18
21
  var previous = this._slides[ this._slides.indexOf(this.current()) - 1 ];
19
22
  return previous ? previous : this.first();
20
23
  },
@@ -72,7 +75,7 @@
72
75
  break;
73
76
  }
74
77
  }
75
-
78
+
76
79
  function slice() {
77
80
  var width = $('#stage').width() / 10;
78
81
  for (var i = 0; i <= 10; i++) {
@@ -82,23 +85,23 @@
82
85
  left: (i * width) - 10
83
86
  }).delay(i * 100).animate({width: width + 1})
84
87
  );
85
- }
88
+ }
86
89
  }
87
-
90
+
88
91
  function unslice() {
89
92
  var reversed = Array.prototype.reverse.call($('#stage .slice'));
90
93
  for (var i = 0; i < reversed.length; i++) {
91
94
  $(reversed[i]).delay(i * 100).animate({width: '0'})
92
95
  }
93
96
  }
94
-
97
+
95
98
  String.prototype.markup = function() { return this + '.html' };
96
99
  String.prototype.script = function() { return this + '.js' };
97
100
  String.prototype.style = function() { return this + '.css' };
98
-
101
+
99
102
  var KEY = { SPACE: 32, RIGHT: 39, LEFT: 37 };
100
103
 
101
- $.fn.effect = function(name) { return this.each(function() { applyEffect(this, name) }); }
104
+ $.fn.effect = function(name) { return this.each(function() { applyEffect(this, name) }); };
102
105
  $.fn.hasClasses = function(classes) {
103
106
  var classes = classes.split(/\s+/), yes = true, element = this.get(0);
104
107
  for (var i = 0; i < classes.length && yes; i++) { yes = $(element).hasClass(classes[i]) }
@@ -108,19 +111,20 @@
108
111
  $.extend($.shining, {
109
112
  firstSlide: function() { getSlide($.shining.slides.first()) },
110
113
  lastSlide: function() { getSlide($.shining.slides.last() ) },
111
- nextSlide: function() {
114
+ nextSlide: function() {
112
115
  if ($.shining.slides.next()) {
113
116
  document.location.hash = $.shining.slides.next();
114
117
  trigger('next');
115
118
  }
116
119
  },
117
- previousSlide: function() {
120
+ previousSlide: function() {
118
121
  if ($.shining.slides.previous()) {
119
122
  document.location.hash = $.shining.slides.previous();
120
123
  trigger('previous');
121
124
  }
122
125
  },
123
- getSlide: function(slide) { getSlide(slide) }
126
+ getSlide: function(slide) { getSlide(slide) },
127
+ help: help
124
128
  });
125
129
 
126
130
  var FILTERS = {
@@ -130,33 +134,30 @@
130
134
 
131
135
  function init() {
132
136
  $(document).ready(function() {
137
+ $(window).resize(function() { $('#stage').centralize() });
133
138
  $('#stage').centralize();
134
- });
135
- $(window).resize(function() { $('#stage').centralize() });
136
- bindKeys();
137
- loadConfig(function() {
138
- var startAt = document.location.hash.replace('#', ''),
139
- firstSlide = startAt ? startAt : $.shining.slides.current();
140
- loadSlide(firstSlide, function() { playSlide(firstSlide) });
141
- if (!local() && !$.shining.config.preventPreload) preloadSlides();
142
- setTitle($.shining.config.title);
143
- setTheme($.shining.config.theme);
144
- parseEffects();
145
- trigger('init.shining');
146
- help('← (previous slide), → or SPACE BAR (next slide)', 3000);
139
+ bindKeys();
140
+ loadConfig(function() {
141
+ var startAt = document.location.hash.replace('#', ''),
142
+ first = startAt ? startAt : $.shining.slides.current();
143
+ loadSlide(first, function() { playSlide(first) });
144
+ if (!local() && !($.shining.config.help == false)) preloadSlides();
145
+ setTitle($.shining.config.title);
146
+ setTheme($.shining.config.theme);
147
+ trigger('init.shining');
148
+ help('← (previous slide), → or SPACE BAR (next slide)', 3000);
149
+ });
147
150
  });
148
151
  }
149
-
152
+
150
153
  function trigger(event, data) {
151
154
  $(document).trigger(event + '.shining', data);
152
155
  }
153
-
156
+
154
157
  function bind(event, method) {
155
158
  $(document).bind(event + '.shining', method);
156
159
  }
157
-
158
- $.shining.help = help;
159
-
160
+
160
161
  function applyEffect(element, name) {
161
162
  if (name in FILTERS) {
162
163
  if ($(element).hasClasses(FILTERS[name].when)) $(element).removeClass(FILTERS[name].remove)
@@ -170,14 +171,14 @@
170
171
  applyTransition(
171
172
  function() { loadSlide(name, function() { playSlide(name) }) },
172
173
  function() {
173
- $.shining.scripts.run($.shining.slides._loaded[$.shining.slides.current()].script)
174
+ $.shining.scripts.run($.shining.slides._loaded[$.shining.slides.current()].script)
174
175
  }
175
176
  )
176
177
  }
177
178
 
178
179
  function setTitle(title) {
179
- if (!title) { return false };
180
- $('title').text(title);
180
+ if (!title || title == '') return false;
181
+ $.browser.msie ? document.title = title : $('title').text(title);
181
182
  }
182
183
 
183
184
  function setTheme(name) {
@@ -189,7 +190,7 @@
189
190
  function slide(name) {
190
191
  return 'slides/' + name;
191
192
  }
192
-
193
+
193
194
  function loadSlide(name, afterLoad) {
194
195
  if (!$.shining.slides.loaded(name)) {
195
196
  $.get(
@@ -202,19 +203,19 @@
202
203
  loadSlideStyle(name);
203
204
  }
204
205
  }
205
- );
206
+ );
206
207
  } else {
207
208
  if ($.isFunction(afterLoad)) afterLoad.call();
208
- loadSlideStyle(name);
209
+ loadSlideStyle(name);
209
210
  }
210
211
  }
211
-
212
+
212
213
  function preloadSlides() {
213
214
  $($.shining.config.slides).each(function() {
214
215
  loadSlide(this);
215
216
  })
216
217
  }
217
-
218
+
218
219
  function playSlide(name) {
219
220
  var slide = $.shining.slides._loaded[name];
220
221
  $('#stage .contents').html(slide.markup);
@@ -229,7 +230,7 @@
229
230
  $.shining.slides._loaded[name].script = script;
230
231
  },
231
232
  complete: function() {
232
- if ($.isFunction(afterLoad)) afterLoad.call();
233
+ if ($.isFunction(afterLoad)) afterLoad.call();
233
234
  }
234
235
  })
235
236
  }
@@ -246,9 +247,9 @@
246
247
  callback.call();
247
248
  });
248
249
  }
249
-
250
+
250
251
  function bindKeys() {
251
- $(window).keydown(function(event) {
252
+ $(document).keydown(function(event) {
252
253
  switch(event.keyCode) {
253
254
  case KEY.RIGHT:
254
255
  case KEY.SPACE:
@@ -260,7 +261,7 @@
260
261
  }
261
262
  })
262
263
  }
263
-
264
+
264
265
  function help(message, duration) {
265
266
  if ($.shining.config.help == false) return false;
266
267
  var duration = duration || 500;
@@ -273,17 +274,11 @@
273
274
  .delay(duration)
274
275
  .fadeOut(200, function() { $('#help').remove() })
275
276
  }
276
-
277
+
277
278
  function local() {
278
279
  document.location.protocol == 'file:'
279
280
  }
280
281
 
281
- function parseEffects() {
282
- $.get($('link[href$=effects.css]').attr('href'),
283
- function(css) { $.shining.effects = $.parseCSS(css) }
284
- );
285
- }
286
-
287
282
  $.shining.scripts = {
288
283
  LINE: /^(\d[.\d]*),[\s]*(.*)/,
289
284
  parsed: [], processes: [],
@@ -323,9 +318,9 @@
323
318
  return $.shining.scripts.processes = [];
324
319
  }
325
320
  }
326
-
327
- bind('previous', function() { help('←') });
328
- bind('next', function() { help('→') });
321
+
322
+ bind('previous', function() { help('←') });
323
+ bind('next', function() { help('→') });
329
324
 
330
325
  init();
331
326
  }
@@ -347,17 +342,6 @@
347
342
  // centralizes an element vertically
348
343
  (function($){$.fn.centralize=function(){var self=this.get(0);windowHeight=document.documentElement.clientHeight,elementHeight=(self.offsetHeight+$(self).padding().top+$(self).padding().bottom);$(self).css('position','relative').css('top',(windowHeight/2)-(elementHeight/2)+'px');};})(jQuery);
349
344
 
350
- // Trimmed down/modified version of the original Javascript/jQuery CSS parser
351
- // by Danny.
352
- // http://bililite.com/blog/2009/01/16/jquery-css-parser/
353
- (function($){$.parseCSS=function(str){var ret={};str=munge(str).replace(/@(([^;`]|`[^b]|`b[^%])*(`b%)?);?/g,function(s,rule){return'';});$.each(str.split('`b%'),function(i,css){css=css.split('%b`');if(css.length<2)return;css[0]=restore(css[0]);ret[css[0]]=$.extend(ret[css[0]]||{},parsedeclarations(css[1]));});return ret;};$.parseCSS.mediumApplies=(window.media&&window.media.query)||function(str){if(!str)return true;if(str in media)return media[str];var style=$('<style media="'+str+'">body {position: relative; z-index: 1;}</style>').appendTo('head');return media[str]=[$('body').css('z-index')==1,style.remove()][0];};$.parseCSS.parseArguments=function(str){if(!str)return[];var ret=[],mungedArguments=munge(str,true).split(/\s+/);for(var i=0;i<mungedArguments.length;++i){var a=restore(mungedArguments[i]);try{ret.push(eval('('+a+')'));}catch(err){ret.push(a);}}
354
- return ret;};var media={};var munged={};function parsedeclarations(index){var str=munged[index].replace(/^{|}$/g,'');str=munge(str);var parsed={};$.each(str.split(';'),function(i,decl){decl=decl.split(':');if(decl.length<2)return;parsed[restore(decl[0])]=restore(decl[1]);});return parsed;}
355
- var REbraces=/{[^{}]*}/,REfull=/\[[^\[\]]*\]|{[^{}]*}|\([^()]*\)|function(\s+\w+)?(\s*%b`\d+`b%){2}/,REatcomment=/\/\*@((?:[^\*]|\*[^\/])*)\*\//g,REcomment_string=/(?:\/\*(?:[^\*]|\*[^\/])*\*\/)|(\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*')/g,REmunged=/%\w`(\d+)`\w%/,uid=0;function munge(str,full){str=str.replace(REatcomment,'$1').replace(REcomment_string,function(s,string){if(!string)return'';var replacement='%s`'+(++uid)+'`s%';munged[uid]=string.replace(/^\\/,'');return replacement;});var RE=full?REfull:REbraces;while(match=RE.exec(str)){replacement='%b`'+(++uid)+'`b%';munged[uid]=match[0];str=str.replace(RE,replacement);}
356
- return str;}
357
- function restore(str){if(str===undefined)return str;while(match=REmunged.exec(str)){str=str.replace(REmunged,munged[match[1]]);}
358
- return $.trim(str);}
359
- var RESGMLcomment=/<!--([^-]|-[^-])*-->/g;var REnotATag=/(>)[^<]*/g;var REtag=/<(\w+)([^>]*)>/g;})(jQuery);
360
-
361
345
  /*
362
346
  * jQuery hashchange event - v1.2 - 2/11/2010
363
347
  * http://benalman.com/projects/jquery-hashchange-plugin/
@@ -368,7 +352,10 @@ var RESGMLcomment=/<!--([^-]|-[^-])*-->/g;var REnotATag=/(>)[^<]*/g;var REtag=/<
368
352
  */
369
353
  (function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
370
354
 
355
+ // IE Array.prototype.indexOf fix
356
+ if(!Array.prototype.indexOf){Array.prototype.indexOf=function(elt,from){var len=this.length;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0)from+=len;for(;from<len;from++){if(from in this&&this[from]===elt)return from;} return-1;};}
357
+
371
358
  $(window).bind('hashchange', function(event) {
372
359
  var slide = document.location.hash.replace('#', '');
373
360
  if (slide) { $.shining.getSlide(slide) };
374
- });
361
+ });
data/lib/shining.rb CHANGED
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__))
1
+ $:.unshift File.dirname(__FILE__)
2
2
 
3
3
  require 'rubygems'
4
4
  require 'ext/string'
@@ -6,14 +6,12 @@ require 'ext/filemethods'
6
6
  require 'shining/preso'
7
7
  require 'shining/player'
8
8
  require 'shining/heroku'
9
- require 'term/ansicolor'
10
9
 
11
10
  module Shining
12
- extend Term::ANSIColor
13
11
 
14
12
  class << self
15
13
  def say something
16
- STDOUT.puts(blue(something)) unless defined?(Spec) # shush when running tests
14
+ STDOUT.puts(something) unless defined?(Spec) # shush when running tests
17
15
  yield if block_given?
18
16
  end
19
17
 
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.8"
8
+ s.version = "1.2.0"
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-22}
12
+ s.date = %q{2010-04-23}
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"]
data/templates/index.html CHANGED
@@ -14,8 +14,8 @@
14
14
  <script type="text/javascript" charset="utf-8" src="<%= vendorized? ? 'vendor' : Shining.root %>/lib/jquery.shining.js"></script>
15
15
  </head>
16
16
  <body>
17
- <section id="stage">
17
+ <div id="stage">
18
18
  <div class="contents"></div>
19
- </section>
19
+ </div>
20
20
  </body>
21
21
  </html>
data/themes/default.css CHANGED
@@ -1,4 +1,6 @@
1
- body { background-color: rgb(48, 48, 48) }
1
+ body {
2
+ background-color: #303030;
3
+ }
2
4
  #stage {
3
5
  -webkit-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.6);
4
6
  -webkit-border-radius: 5px;
@@ -8,9 +10,15 @@ body { background-color: rgb(48, 48, 48) }
8
10
  border-radius: 5px;
9
11
  }
10
12
 
11
- h1, h2, h3, p, li { color: rgb(238, 238, 238); text-shadow: rgb(0, 0, 0) 2px 2px 4px }
12
- a { color: rgb(73, 157, 255); text-decoration: none }
13
- ul { list-style-type: disc }
13
+ h1, h2, h3, p, li {
14
+ color: #EEEEEE;
15
+ text-shadow: #000 2px 2px 4px
16
+ }
17
+ a {
18
+ color: #499DFF;
19
+ text-decoration: none
20
+ }
21
+ ul { list-style-type: disc }
14
22
 
15
23
  em { color: rgb(73, 255, 80) }
16
24
  strong { color: rgb(255, 171, 73); font-weight: bold }
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
8
- - 8
9
- version: 1.1.8
7
+ - 2
8
+ - 0
9
+ version: 1.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Julio Cesar Ody
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-22 00:00:00 +10:00
17
+ date: 2010-04-23 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency