pcs_vegas 0.0.1.beta
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.
- data/.gitignore +19 -0
- data/.rvmrc +2 -0
- data/Gemfile +4 -0
- data/README.md +38 -0
- data/Rakefile +2 -0
- data/lib/pcs_vegas.rb +8 -0
- data/lib/pcs_vegas/generators/install_generator.rb +14 -0
- data/lib/pcs_vegas/version.rb +3 -0
- data/pcs_vegas.gemspec +19 -0
- data/vendor/assets/images/loading.gif +0 -0
- data/vendor/assets/images/overlays/01.png +0 -0
- data/vendor/assets/images/overlays/02.png +0 -0
- data/vendor/assets/images/overlays/03.png +0 -0
- data/vendor/assets/images/overlays/04.png +0 -0
- data/vendor/assets/images/overlays/05.png +0 -0
- data/vendor/assets/images/overlays/06.png +0 -0
- data/vendor/assets/images/overlays/07.png +0 -0
- data/vendor/assets/images/overlays/08.png +0 -0
- data/vendor/assets/images/overlays/09.png +0 -0
- data/vendor/assets/images/overlays/10.png +0 -0
- data/vendor/assets/images/overlays/11.png +0 -0
- data/vendor/assets/images/overlays/12.png +0 -0
- data/vendor/assets/images/overlays/13.png +0 -0
- data/vendor/assets/images/overlays/14.png +0 -0
- data/vendor/assets/images/overlays/15.png +0 -0
- data/vendor/assets/javascripts/vegas/index.js +1 -0
- data/vendor/assets/javascripts/vegas/jquery.vegas.js +480 -0
- data/vendor/assets/stylesheets/vegas/index.css +3 -0
- data/vendor/assets/stylesheets/vegas/jquery.vegas.css.erb +24 -0
- metadata +76 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# pcs_vegas
|
|
2
|
+
|
|
3
|
+
## Preamble
|
|
4
|
+
|
|
5
|
+
`pcs_vegas` is a gem that packages the asset files used in Jay Salvat's [Vegas Background jQuery plugin](http://vegas.jaysalvat.com/).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
In a Rails 3.1.x project add the gem to your assets group in your `Gemfile`. It is currently in pre-release:
|
|
11
|
+
|
|
12
|
+
gem "pcs_vegas", "~> 0.0.1.alpha"
|
|
13
|
+
|
|
14
|
+
Bundle the gem using bundler:
|
|
15
|
+
|
|
16
|
+
bundle
|
|
17
|
+
|
|
18
|
+
Once your bundle is updated, you can automatically add the assets to your CSS and Javascript manifest files using the generator:
|
|
19
|
+
|
|
20
|
+
rails generate vegas:install
|
|
21
|
+
|
|
22
|
+
Alternatively, you can manually require the assets by adding:
|
|
23
|
+
|
|
24
|
+
//= require vegas
|
|
25
|
+
|
|
26
|
+
to your `application.js` and
|
|
27
|
+
|
|
28
|
+
*= require vegas
|
|
29
|
+
|
|
30
|
+
to your `application.css`.
|
|
31
|
+
|
|
32
|
+
You may need to restart your application for the changes to reflect (I find this behaviour a bit odd and am looking in to why).
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Once the setup is complete, you'll be able to use the plugin. You can learn more about it from the [plugin website](http://vegas.jaysalvat.com/).
|
|
37
|
+
|
|
38
|
+
Enjoy!
|
data/Rakefile
ADDED
data/lib/pcs_vegas.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module Vegas
|
|
4
|
+
module Generators
|
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
|
7
|
+
|
|
8
|
+
def add_assets
|
|
9
|
+
insert_into_file "app/assets/javascripts/application.js", "//= require vegas\n", :after => "jquery_ujs\n"
|
|
10
|
+
insert_into_file "app/assets/stylesheets/application.css", " *= require vegas\n", :after => "require_self\n"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/pcs_vegas.gemspec
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path('../lib/pcs_vegas/version', __FILE__)
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |gem|
|
|
5
|
+
gem.authors = ["Silumesii Maboshe"]
|
|
6
|
+
gem.email = ["silumesii@pencilcasestudios.com"]
|
|
7
|
+
gem.description = %q{Package the assets for the Vegas Background jQuery plugin by Jay Salvat as a gem.}
|
|
8
|
+
gem.summary = %q{This gem allows you to use the Vegas Background jQuery plugin by Jay Salvat with the Rails 3.1.x asset pipline.}
|
|
9
|
+
gem.homepage = "http://github.com/smaboshe/pcs_vegas"
|
|
10
|
+
|
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
14
|
+
gem.name = "pcs_vegas"
|
|
15
|
+
gem.require_paths = ["lib"]
|
|
16
|
+
gem.version = Vegas::VERSION
|
|
17
|
+
|
|
18
|
+
#gem.add_development_dependency "rspec", "~> 2.6"
|
|
19
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//= require_tree .
|
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
// Vegas - jQuery plugin
|
|
3
|
+
// Add awesome fullscreen backgrounds to your webpages.
|
|
4
|
+
// v 1.x
|
|
5
|
+
// Dual licensed under the MIT and GPL licenses.
|
|
6
|
+
// http://vegas.jaysalvat.com/
|
|
7
|
+
// ----------------------------------------------------------------------------
|
|
8
|
+
// Copyright (C) 2011 Jay Salvat
|
|
9
|
+
// http://jaysalvat.com/
|
|
10
|
+
// ----------------------------------------------------------------------------
|
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
// of this software and associated documentation files ( the "Software" ), to deal
|
|
13
|
+
// in the Software without restriction, including without limitation the rights
|
|
14
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
// furnished to do so, subject to the following conditions:
|
|
17
|
+
//
|
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
|
19
|
+
// all copies or substantial portions of the Software.
|
|
20
|
+
//
|
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
27
|
+
// THE SOFTWARE.
|
|
28
|
+
// ----------------------------------------------------------------------------
|
|
29
|
+
( function( $ ){
|
|
30
|
+
var $background = $( '<img />' ).addClass( 'vegas-background' ),
|
|
31
|
+
$overlay = $( '<div />' ).addClass( 'vegas-overlay' ),
|
|
32
|
+
$loading = $( '<div />' ).addClass( 'vegas-loading' ),
|
|
33
|
+
$current = $(),
|
|
34
|
+
paused = null,
|
|
35
|
+
backgrounds = [],
|
|
36
|
+
step = 0,
|
|
37
|
+
delay = 5000,
|
|
38
|
+
walk = function() {},
|
|
39
|
+
timer,
|
|
40
|
+
methods = {
|
|
41
|
+
|
|
42
|
+
// Init plugin
|
|
43
|
+
init : function( settings ) {
|
|
44
|
+
var options = {
|
|
45
|
+
src: getBackground(),
|
|
46
|
+
align: 'center',
|
|
47
|
+
valign: 'center',
|
|
48
|
+
fade: 0,
|
|
49
|
+
loading: true,
|
|
50
|
+
load: function() {},
|
|
51
|
+
complete: function() {}
|
|
52
|
+
}
|
|
53
|
+
$.extend( options, $.vegas.defaults.background, settings );
|
|
54
|
+
|
|
55
|
+
if ( options.loading ) {
|
|
56
|
+
loading();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var $new = $background.clone();
|
|
60
|
+
$new.css( {
|
|
61
|
+
'position': 'fixed',
|
|
62
|
+
'left': '0px',
|
|
63
|
+
'top': '0px'
|
|
64
|
+
})
|
|
65
|
+
.imagesLoadedForVegas( function() {
|
|
66
|
+
if ( $new == $current ) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
$( window ).bind( 'resize.vegas', function( e ) {
|
|
71
|
+
resize( $new, options );
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if ( $current.is( 'img' ) ) {
|
|
75
|
+
|
|
76
|
+
$current.stop();
|
|
77
|
+
|
|
78
|
+
$new.hide()
|
|
79
|
+
.insertAfter( $current )
|
|
80
|
+
.fadeIn( options.fade, function() {
|
|
81
|
+
$('.vegas-background')
|
|
82
|
+
.not(this)
|
|
83
|
+
.remove();
|
|
84
|
+
$( 'body' ).trigger( 'vegascomplete', [ this, step - 1 ] );
|
|
85
|
+
options.complete.apply( $new, [ step - 1 ] );
|
|
86
|
+
});
|
|
87
|
+
} else {
|
|
88
|
+
$new.hide()
|
|
89
|
+
.prependTo( 'body' )
|
|
90
|
+
.fadeIn( options.fade, function() {
|
|
91
|
+
$( 'body' ).trigger( 'vegascomplete', [ this, step - 1 ] );
|
|
92
|
+
options.complete.apply( this, [ step - 1 ] );
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
$current = $new;
|
|
97
|
+
|
|
98
|
+
resize( $current, options );
|
|
99
|
+
|
|
100
|
+
if ( options.loading ) {
|
|
101
|
+
loaded();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
$( 'body' ).trigger( 'vegasload', [ $current.get(0), step - 1 ] );
|
|
105
|
+
options.load.apply( $current.get(0), [ step - 1 ] );
|
|
106
|
+
|
|
107
|
+
if ( step ) {
|
|
108
|
+
$( 'body' ).trigger( 'vegaswalk', [ $current.get(0), step - 1 ] );
|
|
109
|
+
options.walk.apply( $current.get(0), [ step - 1 ] );
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
.attr( 'src', options.src );
|
|
113
|
+
|
|
114
|
+
return $.vegas;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
// Destroy background and/or overlay
|
|
118
|
+
destroy: function( what ) {
|
|
119
|
+
if ( !what || what == 'background') {
|
|
120
|
+
$( '.vegas-background, .vegas-loading' ).remove();
|
|
121
|
+
$( window ).unbind( 'resize.vegas' );
|
|
122
|
+
$current = null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if ( what == 'overlay') {
|
|
126
|
+
$( '.vegas-overlay' ).remove();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return $.vegas;
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
// Display the pattern overlay
|
|
133
|
+
overlay: function( settings ) {
|
|
134
|
+
var options = {
|
|
135
|
+
src: null,
|
|
136
|
+
opacity: null
|
|
137
|
+
};
|
|
138
|
+
$.extend( options, $.vegas.defaults.overlay, settings );
|
|
139
|
+
|
|
140
|
+
$overlay.remove();
|
|
141
|
+
|
|
142
|
+
$overlay
|
|
143
|
+
.css( {
|
|
144
|
+
'margin': '0',
|
|
145
|
+
'padding': '0',
|
|
146
|
+
'position': 'fixed',
|
|
147
|
+
'left': '0px',
|
|
148
|
+
'top': '0px',
|
|
149
|
+
'width': '100%',
|
|
150
|
+
'height': '100%'
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
if ( options.src ) {
|
|
154
|
+
$overlay.css( 'backgroundImage', 'url(' + options.src + ')' );
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if ( options.opacity ) {
|
|
158
|
+
$overlay.css( 'opacity', options.opacity );
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
$overlay.prependTo( 'body' );
|
|
162
|
+
|
|
163
|
+
return $.vegas;
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// Start/restart slideshow
|
|
167
|
+
slideshow: function( settings, keepPause ) {
|
|
168
|
+
var options = {
|
|
169
|
+
step: step,
|
|
170
|
+
delay: delay,
|
|
171
|
+
preload: false,
|
|
172
|
+
backgrounds: backgrounds,
|
|
173
|
+
walk: walk
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
$.extend( options, $.vegas.defaults.slideshow, settings );
|
|
177
|
+
|
|
178
|
+
if ( options.backgrounds != backgrounds ) {
|
|
179
|
+
if ( !settings.step ) {
|
|
180
|
+
options.step = 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if ( !settings.walk ) {
|
|
184
|
+
options.walk = function() {};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if ( options.preload ) {
|
|
188
|
+
$.vegas( 'preload', options.backgrounds );
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
backgrounds = options.backgrounds;
|
|
193
|
+
delay = options.delay;
|
|
194
|
+
step = options.step;
|
|
195
|
+
walk = options.walk;
|
|
196
|
+
|
|
197
|
+
clearInterval( timer );
|
|
198
|
+
|
|
199
|
+
if ( !backgrounds.length ) {
|
|
200
|
+
return $.vegas;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
var doSlideshow = function() {
|
|
204
|
+
if ( step < 0 ) {
|
|
205
|
+
step = backgrounds.length - 1;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if ( step >= backgrounds.length || !backgrounds[ step - 1 ] ) {
|
|
209
|
+
step = 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
var settings = backgrounds[ step++ ];
|
|
213
|
+
settings.walk = options.walk;
|
|
214
|
+
|
|
215
|
+
if ( settings.fade > options.delay ) {
|
|
216
|
+
settings.fade = options.delay;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
$.vegas( settings );
|
|
220
|
+
}
|
|
221
|
+
doSlideshow();
|
|
222
|
+
|
|
223
|
+
if ( !keepPause ) {
|
|
224
|
+
paused = false;
|
|
225
|
+
|
|
226
|
+
$( 'body' ).trigger( 'vegasstart', [ $current.get(0), step - 1 ] );
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if ( !paused ) {
|
|
230
|
+
timer = setInterval( doSlideshow, options.delay );
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return $.vegas;
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
// Jump to the next background in the current slideshow
|
|
237
|
+
next: function() {
|
|
238
|
+
var from = step;
|
|
239
|
+
|
|
240
|
+
if ( step ) {
|
|
241
|
+
$.vegas( 'slideshow', { step: step }, true );
|
|
242
|
+
|
|
243
|
+
$( 'body' ).trigger( 'vegasnext', [ $current.get(0), step - 1, from - 1 ] );
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return $.vegas;
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
// Jump to the previous background in the current slideshow
|
|
250
|
+
previous: function() {
|
|
251
|
+
var from = step;
|
|
252
|
+
|
|
253
|
+
if ( step ) {
|
|
254
|
+
$.vegas( 'slideshow', { step: step - 2 }, true );
|
|
255
|
+
|
|
256
|
+
$( 'body' ).trigger( 'vegasprevious', [ $current.get(0), step - 1, from - 1 ] );
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return $.vegas;
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
// Jump to a specific background in the current slideshow
|
|
263
|
+
jump: function( s ) {
|
|
264
|
+
var from = step;
|
|
265
|
+
|
|
266
|
+
if ( step ) {
|
|
267
|
+
$.vegas( 'slideshow', { step: s }, true );
|
|
268
|
+
|
|
269
|
+
$( 'body' ).trigger( 'vegasjump', [ $current.get(0), step - 1, from - 1 ] );
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return $.vegas;
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
// Stop slideshow
|
|
276
|
+
stop: function() {
|
|
277
|
+
var from = step;
|
|
278
|
+
step = 0;
|
|
279
|
+
paused = null;
|
|
280
|
+
clearInterval( timer );
|
|
281
|
+
|
|
282
|
+
$( 'body' ).trigger( 'vegasstop', [ $current.get(0), from - 1 ] );
|
|
283
|
+
|
|
284
|
+
return $.vegas;
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
// Pause slideShow
|
|
288
|
+
pause: function() {
|
|
289
|
+
paused = true;
|
|
290
|
+
clearInterval( timer );
|
|
291
|
+
|
|
292
|
+
$( 'body' ).trigger( 'vegaspause', [ $current.get(0), step - 1 ] );
|
|
293
|
+
|
|
294
|
+
return $.vegas;
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
// Get some useful values or objects
|
|
298
|
+
get: function( what ) {
|
|
299
|
+
if ( what == null || what == 'background' ) {
|
|
300
|
+
return $current.get(0);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if ( what == 'overlay' ) {
|
|
304
|
+
return $overlay.get(0);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if ( what == 'step' ) {
|
|
308
|
+
return step - 1;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if ( what == 'paused' ) {
|
|
312
|
+
return paused;
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
// Preload an array of backgrounds
|
|
317
|
+
preload: function( backgrounds ) {
|
|
318
|
+
for( var i in backgrounds ) {
|
|
319
|
+
if ( backgrounds[ i ].src ) {
|
|
320
|
+
$('<img src="' + backgrounds[ i ].src + '">');
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return $.vegas;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Resize the background
|
|
329
|
+
function resize( $img, settings ) {
|
|
330
|
+
var options = {
|
|
331
|
+
align: 'center',
|
|
332
|
+
valign: 'center'
|
|
333
|
+
}
|
|
334
|
+
$.extend( options, settings );
|
|
335
|
+
|
|
336
|
+
var ww = $( window ).width(),
|
|
337
|
+
wh = $( window ).height(),
|
|
338
|
+
iw = $img.width(),
|
|
339
|
+
ih = $img.height(),
|
|
340
|
+
rw = wh / ww,
|
|
341
|
+
ri = ih / iw,
|
|
342
|
+
newWidth, newHeight,
|
|
343
|
+
newLeft, newTop,
|
|
344
|
+
properties;
|
|
345
|
+
|
|
346
|
+
if ( rw > ri ) {
|
|
347
|
+
newWidth = wh / ri;
|
|
348
|
+
newHeight = wh;
|
|
349
|
+
} else {
|
|
350
|
+
newWidth = ww;
|
|
351
|
+
newHeight = ww * ri;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
properties = {
|
|
355
|
+
'width': newWidth + 'px',
|
|
356
|
+
'height': newHeight + 'px',
|
|
357
|
+
'top': 'auto',
|
|
358
|
+
'bottom': 'auto',
|
|
359
|
+
'left': 'auto',
|
|
360
|
+
'right': 'auto'
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if ( !isNaN( parseInt( options.valign ) ) ) {
|
|
364
|
+
properties[ 'top' ] = ( 0 - ( newHeight - wh ) / 100 * parseInt( options.valign ) ) + 'px';
|
|
365
|
+
} else if ( options.valign == 'top' ) {
|
|
366
|
+
properties[ 'top' ] = 0;
|
|
367
|
+
} else if ( options.valign == 'bottom' ) {
|
|
368
|
+
properties[ 'bottom' ] = 0;
|
|
369
|
+
} else {
|
|
370
|
+
properties[ 'top' ] = ( wh - newHeight ) / 2;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if ( !isNaN( parseInt( options.align ) ) ) {
|
|
374
|
+
properties[ 'left' ] = ( 0 - ( newWidth - ww ) / 100 * parseInt( options.align ) ) + 'px';
|
|
375
|
+
} else if ( options.align == 'left' ) {
|
|
376
|
+
properties[ 'left' ] = 0;
|
|
377
|
+
} else if ( options.align == 'right' ) {
|
|
378
|
+
properties[ 'right' ] = 0;
|
|
379
|
+
} else {
|
|
380
|
+
properties[ 'left' ] = ( ww - newWidth ) / 2 ;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
$img.css( properties );
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Display the loading indicator
|
|
387
|
+
function loading() {
|
|
388
|
+
$loading.prependTo( 'body' ).fadeIn();
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Hide the loading indicator
|
|
392
|
+
function loaded() {
|
|
393
|
+
$loading.fadeOut( 'fast', function() {
|
|
394
|
+
$( this ).remove();
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// Get the background image from the body
|
|
399
|
+
function getBackground() {
|
|
400
|
+
if ( $( 'body' ).css( 'backgroundImage' ) ) {
|
|
401
|
+
return $( 'body' ).css( 'backgroundImage' ).replace( /url\("?(.*?)"?\)/i, '$1' );
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// The plugin
|
|
406
|
+
$.vegas = function( method ) {
|
|
407
|
+
if ( methods[ method ] ) {
|
|
408
|
+
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
|
|
409
|
+
} else if ( typeof method === 'object' || !method ) {
|
|
410
|
+
return methods.init.apply( this, arguments );
|
|
411
|
+
} else {
|
|
412
|
+
$.error( 'Method ' + method + ' does not exist' );
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
// Global parameters
|
|
417
|
+
$.vegas.defaults = {
|
|
418
|
+
background: {
|
|
419
|
+
// src: string
|
|
420
|
+
// align: string/int
|
|
421
|
+
// valign: string/int
|
|
422
|
+
// fade: int
|
|
423
|
+
// loading bool
|
|
424
|
+
// load: function
|
|
425
|
+
// complete: function
|
|
426
|
+
},
|
|
427
|
+
slideshow: {
|
|
428
|
+
// step: int
|
|
429
|
+
// delay: int
|
|
430
|
+
// backgrounds: array
|
|
431
|
+
// preload: bool
|
|
432
|
+
// walk: function
|
|
433
|
+
},
|
|
434
|
+
overlay: {
|
|
435
|
+
// src: string
|
|
436
|
+
// opacity: float
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/*!
|
|
441
|
+
* jQuery imagesLoaded plugin v1.0.3
|
|
442
|
+
* http://github.com/desandro/imagesloaded
|
|
443
|
+
*
|
|
444
|
+
* MIT License. by Paul Irish et al.
|
|
445
|
+
*/
|
|
446
|
+
$.fn.imagesLoadedForVegas = function( callback ) {
|
|
447
|
+
var $this = this,
|
|
448
|
+
$images = $this.find('img').add( $this.filter('img') ),
|
|
449
|
+
len = $images.length,
|
|
450
|
+
blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
|
|
451
|
+
|
|
452
|
+
function triggerCallback() {
|
|
453
|
+
callback.call( $this, $images );
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function imgLoaded() {
|
|
457
|
+
if ( --len <= 0 && this.src !== blank ){
|
|
458
|
+
setTimeout( triggerCallback );
|
|
459
|
+
$images.unbind( 'load error', imgLoaded );
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if ( !len ) {
|
|
464
|
+
triggerCallback();
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
$images.bind( 'load error', imgLoaded ).each( function() {
|
|
468
|
+
// cached images don't fire load sometimes, so we reset src.
|
|
469
|
+
if (this.complete || this.complete === undefined){
|
|
470
|
+
var src = this.src;
|
|
471
|
+
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
|
|
472
|
+
// data uri bypasses webkit log warning (thx doug jones)
|
|
473
|
+
this.src = blank;
|
|
474
|
+
this.src = src;
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
return $this;
|
|
479
|
+
};
|
|
480
|
+
})( jQuery );
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.vegas-loading {
|
|
2
|
+
/* Loading Gif by http://preloaders.net/ */
|
|
3
|
+
-moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px;
|
|
4
|
+
background:#000 url(<%= image_path("loading.gif") %>) no-repeat center center;
|
|
5
|
+
background:rgba(0, 0, 0, 0.7) url(<%= image_path("loading.gif") %>) no-repeat center center;
|
|
6
|
+
height:32px;
|
|
7
|
+
left:20px;
|
|
8
|
+
position:fixed;
|
|
9
|
+
top:20px;
|
|
10
|
+
width:32px;
|
|
11
|
+
z-index:0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.vegas-overlay {
|
|
15
|
+
background:transparent url(<%= image_path("overlays/01.png") %>);
|
|
16
|
+
opacity:0.5;
|
|
17
|
+
z-index:-1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.vegas-background {
|
|
21
|
+
image-rendering: optimizeQuality;
|
|
22
|
+
-ms-interpolation-mode: bicubic;
|
|
23
|
+
z-index:-2;
|
|
24
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: pcs_vegas
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1.beta
|
|
5
|
+
prerelease: 6
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Silumesii Maboshe
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2011-11-11 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: Package the assets for the Vegas Background jQuery plugin by Jay Salvat
|
|
15
|
+
as a gem.
|
|
16
|
+
email:
|
|
17
|
+
- silumesii@pencilcasestudios.com
|
|
18
|
+
executables: []
|
|
19
|
+
extensions: []
|
|
20
|
+
extra_rdoc_files: []
|
|
21
|
+
files:
|
|
22
|
+
- .gitignore
|
|
23
|
+
- .rvmrc
|
|
24
|
+
- Gemfile
|
|
25
|
+
- README.md
|
|
26
|
+
- Rakefile
|
|
27
|
+
- lib/pcs_vegas.rb
|
|
28
|
+
- lib/pcs_vegas/generators/install_generator.rb
|
|
29
|
+
- lib/pcs_vegas/version.rb
|
|
30
|
+
- pcs_vegas.gemspec
|
|
31
|
+
- vendor/assets/images/loading.gif
|
|
32
|
+
- vendor/assets/images/overlays/01.png
|
|
33
|
+
- vendor/assets/images/overlays/02.png
|
|
34
|
+
- vendor/assets/images/overlays/03.png
|
|
35
|
+
- vendor/assets/images/overlays/04.png
|
|
36
|
+
- vendor/assets/images/overlays/05.png
|
|
37
|
+
- vendor/assets/images/overlays/06.png
|
|
38
|
+
- vendor/assets/images/overlays/07.png
|
|
39
|
+
- vendor/assets/images/overlays/08.png
|
|
40
|
+
- vendor/assets/images/overlays/09.png
|
|
41
|
+
- vendor/assets/images/overlays/10.png
|
|
42
|
+
- vendor/assets/images/overlays/11.png
|
|
43
|
+
- vendor/assets/images/overlays/12.png
|
|
44
|
+
- vendor/assets/images/overlays/13.png
|
|
45
|
+
- vendor/assets/images/overlays/14.png
|
|
46
|
+
- vendor/assets/images/overlays/15.png
|
|
47
|
+
- vendor/assets/javascripts/vegas/index.js
|
|
48
|
+
- vendor/assets/javascripts/vegas/jquery.vegas.js
|
|
49
|
+
- vendor/assets/stylesheets/vegas/index.css
|
|
50
|
+
- vendor/assets/stylesheets/vegas/jquery.vegas.css.erb
|
|
51
|
+
homepage: http://github.com/smaboshe/pcs_vegas
|
|
52
|
+
licenses: []
|
|
53
|
+
post_install_message:
|
|
54
|
+
rdoc_options: []
|
|
55
|
+
require_paths:
|
|
56
|
+
- lib
|
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
59
|
+
requirements:
|
|
60
|
+
- - ! '>='
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
|
+
none: false
|
|
65
|
+
requirements:
|
|
66
|
+
- - ! '>'
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 1.3.1
|
|
69
|
+
requirements: []
|
|
70
|
+
rubyforge_project:
|
|
71
|
+
rubygems_version: 1.8.11
|
|
72
|
+
signing_key:
|
|
73
|
+
specification_version: 3
|
|
74
|
+
summary: This gem allows you to use the Vegas Background jQuery plugin by Jay Salvat
|
|
75
|
+
with the Rails 3.1.x asset pipline.
|
|
76
|
+
test_files: []
|