anything_slider_rails 0.0.1
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/.DS_Store +0 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/anything_slider_rails.gemspec +24 -0
- data/lib/anything_slider_rails/engine.rb +6 -0
- data/lib/anything_slider_rails/version.rb +3 -0
- data/lib/anything_slider_rails.rb +3 -0
- data/readme.MD +42 -0
- data/vendor/.DS_Store +0 -0
- data/vendor/assets/.DS_Store +0 -0
- data/vendor/assets/images/arrows-metallic.png +0 -0
- data/vendor/assets/images/arrows-minimalist.png +0 -0
- data/vendor/assets/images/construction.gif +0 -0
- data/vendor/assets/images/cs-portfolio.png +0 -0
- data/vendor/assets/images/default.png +0 -0
- data/vendor/assets/javascripts/jquery.anythingslider.fx.js +188 -0
- data/vendor/assets/javascripts/jquery.anythingslider.js +814 -0
- data/vendor/assets/javascripts/jquery.anythingslider.video.js +379 -0
- data/vendor/assets/javascripts/jquery.easing.1.2.js +140 -0
- data/vendor/assets/javascripts/swfobject.js +4 -0
- data/vendor/assets/stylesheets/animate.css +3813 -0
- data/vendor/assets/stylesheets/anythingslider-ie.css +65 -0
- data/vendor/assets/stylesheets/anythingslider.css.erb +202 -0
- data/vendor/assets/stylesheets/theme-construction.css.erb +142 -0
- data/vendor/assets/stylesheets/theme-cs-portfolio.css.erb +149 -0
- data/vendor/assets/stylesheets/theme-metallic.css.erb +146 -0
- data/vendor/assets/stylesheets/theme-minimalist-round.css.erb +144 -0
- data/vendor/assets/stylesheets/theme-minimalist-square.css.erb +144 -0
- metadata +109 -0
@@ -0,0 +1,379 @@
|
|
1
|
+
/*
|
2
|
+
* AnythingSlider Video Controller 1.3 beta for AnythingSlider v1.6+
|
3
|
+
* By Rob Garrison (aka Mottie & Fudgey)
|
4
|
+
* Dual licensed under the MIT and GPL licenses.
|
5
|
+
*/
|
6
|
+
(function($) {
|
7
|
+
$.fn.anythingSliderVideo = function(options){
|
8
|
+
|
9
|
+
//Set the default values, use comma to separate the settings, example:
|
10
|
+
var defaults = {
|
11
|
+
videoID : 'asvideo' // id prefix
|
12
|
+
};
|
13
|
+
|
14
|
+
return this.each(function(){
|
15
|
+
// make sure a AnythingSlider is attached
|
16
|
+
var video, tmp, service, sel, base = $(this).data('AnythingSlider');
|
17
|
+
if (!base) { return; }
|
18
|
+
video = base.video = {};
|
19
|
+
// Next update, I may just force users to call the video extension instead of it auto-running on window load
|
20
|
+
// then they can change the video options in that call instead of the base defaults, and maybe prevent the
|
21
|
+
// videos being initialized twice on startup (once as a regular video and second time with the API string)
|
22
|
+
video.options = $.extend({}, defaults, options);
|
23
|
+
|
24
|
+
// check if SWFObject is loaded
|
25
|
+
video.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && typeof(swfobject.embedSWF) === 'function') ? true : false;
|
26
|
+
|
27
|
+
video.list = {};
|
28
|
+
video.hasVid = false;
|
29
|
+
video.hasEmbed = false;
|
30
|
+
video.services = $.fn.anythingSliderVideo.services;
|
31
|
+
video.len = 0; // used to add a unique ID to videos "asvideo#"
|
32
|
+
video.hasEmbedCount = 0;
|
33
|
+
video.hasiframeCount = 0;
|
34
|
+
video.$items = base.$items.filter(':not(.cloned)');
|
35
|
+
|
36
|
+
// find and save all known videos
|
37
|
+
for (service in video.services) {
|
38
|
+
if (typeof(service) === 'string') {
|
39
|
+
sel = video.services[service].selector;
|
40
|
+
video.$items.find(sel).each(function(){
|
41
|
+
tmp = $(this);
|
42
|
+
// save panel and video selector in the list
|
43
|
+
tmp.attr('id', video.options.videoID + video.len);
|
44
|
+
video.list[video.len] = {
|
45
|
+
id : video.options.videoID + video.len++,
|
46
|
+
panel : tmp.closest('.panel')[0],
|
47
|
+
service : service,
|
48
|
+
selector : sel,
|
49
|
+
status : -1 // YouTube uses -1 to mean the video is unstarted
|
50
|
+
};
|
51
|
+
video.hasVid = true;
|
52
|
+
if (sel.match('embed|object')) {
|
53
|
+
video.hasEmbed = true;
|
54
|
+
video.hasEmbedCount++;
|
55
|
+
} else if (sel.match('iframe')) {
|
56
|
+
video.hasiframeCount++;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
// Initialize each video, as needed
|
63
|
+
$.each(video.list, function(i,s){
|
64
|
+
// s.id = ID, s.panel = slider panel (DOM), s.selector = 'jQuery selector'
|
65
|
+
var tmp, $tar, vidsrc, opts,
|
66
|
+
$vid = $(s.panel).find(s.selector),
|
67
|
+
service = video.services[s.service],
|
68
|
+
api = service.initAPI || '';
|
69
|
+
// Initialize embeded video javascript api using SWFObject, if loaded
|
70
|
+
if (video.hasEmbed && video.hasSwfo && s.selector.match('embed|object')) {
|
71
|
+
$vid.each(function(){
|
72
|
+
// Older IE doesn't have an object - just make sure we are wrapping the correct element
|
73
|
+
$tar = ($(this).parent()[0].tagName === 'OBJECT') ? $(this).parent() : $(this);
|
74
|
+
vidsrc = ($tar[0].tagName === 'EMBED') ? $tar.attr('src') : $tar.find('embed').attr('src') || $tar.children().filter('[name=movie]').attr('value');
|
75
|
+
opts = $.extend(true, {}, {
|
76
|
+
flashvars : null,
|
77
|
+
params : { allowScriptAccess: 'always', wmode : base.options.addWmodeToObject, allowfullscreen : true },
|
78
|
+
attr : { 'class' : $tar.attr('class'), 'style' : $tar.attr('style'), 'data-url' : vidsrc }
|
79
|
+
}, service.embedOpts);
|
80
|
+
$tar.wrap('<div id="' + s.id + '"></div>');
|
81
|
+
// use SWFObject if it exists, it replaces the wrapper with the object/embed
|
82
|
+
swfobject.embedSWF(vidsrc + (api === '' ? '': api + s.id), s.id,
|
83
|
+
$tar.attr('width'), $tar.attr('height'), '10', null,
|
84
|
+
opts.flashvars, opts.params, opts.attr, function(){
|
85
|
+
// run init code if it exists
|
86
|
+
if (service.hasOwnProperty('init')) {
|
87
|
+
video.list[i].player = service.init(base, s.id, i);
|
88
|
+
}
|
89
|
+
if (i >= video.hasEmbedCount) {
|
90
|
+
base.$el.trigger('swf_completed', base); // swf callback
|
91
|
+
}
|
92
|
+
}
|
93
|
+
);
|
94
|
+
});
|
95
|
+
} else if (s.selector.match('iframe')) {
|
96
|
+
$vid.each(function(i,v){
|
97
|
+
vidsrc = $(this).attr('src');
|
98
|
+
tmp = (vidsrc.match(/\?/g) ? '' : '?') + '&wmode=' + base.options.addWmodeToObject; // string connector & wmode
|
99
|
+
$(this).attr('src', function(i,r){ return r + tmp + (api === '' ? '': api + s.id); });
|
100
|
+
});
|
101
|
+
}
|
102
|
+
});
|
103
|
+
|
104
|
+
// Returns URL parameter; url: http://www.somesite.com?name=hello&id=11111
|
105
|
+
// Original code from Netlobo.com (http://www.netlobo.com/url_query_string_javascript.html)
|
106
|
+
video.gup = function(n,s){
|
107
|
+
n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
|
108
|
+
var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s || window.location.href);
|
109
|
+
return (p===null) ? "" : p[1];
|
110
|
+
};
|
111
|
+
|
112
|
+
// postMessage to iframe - http://benalman.com/projects/jquery-postmessage-plugin/ (FOR IE7)
|
113
|
+
video.postMsg = function(data, vid){
|
114
|
+
var $vid = $('#' + vid);
|
115
|
+
if ($vid.length){
|
116
|
+
$vid[0].contentWindow.postMessage(data, $vid.attr('src').split('?')[0]);
|
117
|
+
}
|
118
|
+
};
|
119
|
+
|
120
|
+
// receive message from iframe
|
121
|
+
// no way to figure out which iframe since the message is from the window
|
122
|
+
video.message = function(e){
|
123
|
+
if (e.data) {
|
124
|
+
if (/infoDelivery/g.test(e.data)) { return; } // ignore youtube video loading spam
|
125
|
+
var data = $.parseJSON(e.data);
|
126
|
+
$.each(video.list, function(i,s){
|
127
|
+
if (video.services[video.list[i].service].hasOwnProperty('message')) {
|
128
|
+
video.services[video.list[i].service].message(base, data);
|
129
|
+
}
|
130
|
+
});
|
131
|
+
}
|
132
|
+
};
|
133
|
+
|
134
|
+
// toDO = 'cont', 'pause' or 'isPlaying'
|
135
|
+
video.control = function(toDo){
|
136
|
+
var i,
|
137
|
+
s = video.list,
|
138
|
+
slide = (toDo === 'pause') ? base.$lastPage[0] : base.$currentPage[0],
|
139
|
+
isPlaying = false;
|
140
|
+
for (i=0; i < video.len; i++){
|
141
|
+
if (s[i].panel === slide && video.services[s[i].service].hasOwnProperty(toDo)){
|
142
|
+
isPlaying = video.services[s[i].service][toDo](base, s[i].id, i);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
return isPlaying;
|
146
|
+
};
|
147
|
+
|
148
|
+
// iframe event listener
|
149
|
+
if (video.hasiframeCount){
|
150
|
+
if (window.addEventListener){
|
151
|
+
window.addEventListener('message', video.message, false);
|
152
|
+
} else { // IE
|
153
|
+
window.attachEvent('onmessage', video.message, false);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
// bind to events
|
158
|
+
base.$el
|
159
|
+
.bind('slide_init', function(){
|
160
|
+
video.control('pause');
|
161
|
+
})
|
162
|
+
.bind('slide_complete', function(){
|
163
|
+
video.control('cont');
|
164
|
+
});
|
165
|
+
|
166
|
+
base.options.isVideoPlaying = function(){ return video.control('isPlaying'); };
|
167
|
+
|
168
|
+
});
|
169
|
+
};
|
170
|
+
|
171
|
+
/* Each video service is set up as follows
|
172
|
+
* service-name : {
|
173
|
+
* // initialization
|
174
|
+
* selector : 'object[data-url*=service], embed[src*=service]', // required: jQuery selector used to find the video ('video' or 'iframe[src*=service]' are other examples)
|
175
|
+
* initAPI : 'string added to the URL to initialize the API', // optional: the string must end with a parameter pointing to the video id (e.g. "&player_id=")
|
176
|
+
* embedOpts : { flashvars: {}, params: {}, attr: {} }, // optional: add any required flashvars, parameters or attributes to initialize the API
|
177
|
+
* // video startup functions
|
178
|
+
* init : function(base, vid, index){ }, // optional: include any additional initialization code here; function called AFTER the embeded video is added using SWFObject
|
179
|
+
* // required functions
|
180
|
+
* cont : function(base, vid, index){ }, // required: continue play if video was previously played
|
181
|
+
* pause : function(base, vid, index){ }, // required: pause ALL videos
|
182
|
+
* message : function(base, data){ }, // required for iframe: process data received from iframe and update the video status for the "isPlaying" function
|
183
|
+
* isPlaying : function(base, vid, index){ } // required: return true if video is playing and return false if not playing (paused or ended)
|
184
|
+
* }
|
185
|
+
*
|
186
|
+
* Function variables
|
187
|
+
* base (object) = plugin base, all video values/functions are stored in base.video
|
188
|
+
* vid (string) is the ID of the video: vid = "asvideo1"; so jQuery needs a "#" in front... "#" + videoID option default ("asvideo") + index (e.g. "1"); each video matching a service will have a unquie vid
|
189
|
+
* index (number) is the unique video number from the vid (starts from zero)
|
190
|
+
*
|
191
|
+
* var list = base.video.list[index]; list will contain:
|
192
|
+
* list.id = vid
|
193
|
+
* list.service = service name (e.g. 'video', 'vimeo1', 'vimeo2', etc)
|
194
|
+
* list.selector = 'jQuery selector' (e.g. 'video', 'object[data-url*=vimeo]', 'iframe[src*=vimeo]', etc)
|
195
|
+
* list.panel = AnythingSlider panel DOM object. So you can target the video using $(list[index].panel).find(list[index].service) or $('#' + vid)
|
196
|
+
* list.status = video status, updated by the iframe event listeners added in the video service "ready" function; see examples below
|
197
|
+
*/
|
198
|
+
|
199
|
+
$.fn.anythingSliderVideo.services = {
|
200
|
+
|
201
|
+
// *** HTML5 video ***
|
202
|
+
video : {
|
203
|
+
selector : 'video',
|
204
|
+
cont : function(base, vid, index){
|
205
|
+
var $vid = $('#' + vid);
|
206
|
+
if ($vid.length && $vid[0].paused && $vid[0].currentTime > 0 && !$vid[0].ended) {
|
207
|
+
$vid[0].play();
|
208
|
+
}
|
209
|
+
},
|
210
|
+
pause : function(base, vid){
|
211
|
+
// pause ALL videos on the page
|
212
|
+
$('video').each(function(){
|
213
|
+
if (typeof(this.pause) !== 'undefined') { this.pause(); } // throws an error in older ie without this
|
214
|
+
});
|
215
|
+
},
|
216
|
+
isPlaying : function(base, vid, index){
|
217
|
+
var $vid = $('#' + vid);
|
218
|
+
// media.paused seems to be the only way to determine if a video is playing
|
219
|
+
return ($vid.length && typeof($vid[0].pause) !== 'undefined' && !$vid[0].paused && !$vid[0].ended) ? true : false;
|
220
|
+
}
|
221
|
+
},
|
222
|
+
|
223
|
+
// *** Vimeo iframe *** isolated demo: http://jsfiddle.net/Mottie/GxwEX/
|
224
|
+
vimeo1 : {
|
225
|
+
selector : 'iframe[src*=vimeo]',
|
226
|
+
initAPI : '&api=1&player_id=', // video ID added to the end
|
227
|
+
cont : function(base, vid, index){
|
228
|
+
if (base.options.resumeOnVisible && base.video.list[index].status === 'pause'){
|
229
|
+
// Commands sent to the iframe originally had "JSON.stringify" applied to them,
|
230
|
+
// but not all browsers support this, so it's just as easy to wrap it in quotes.
|
231
|
+
base.video.postMsg('{"method":"play"}', vid);
|
232
|
+
}
|
233
|
+
},
|
234
|
+
pause : function(base, vid){
|
235
|
+
// pause ALL videos on the page
|
236
|
+
$('iframe[src*=vimeo]').each(function(){
|
237
|
+
base.video.postMsg('{"method":"pause"}', this.id);
|
238
|
+
});
|
239
|
+
},
|
240
|
+
message : function(base, data){
|
241
|
+
// *** VIMEO *** iframe uses data.player_id
|
242
|
+
var index, vid = data.player_id || ''; // vid = data.player_id (unique to vimeo)
|
243
|
+
if (vid !== ''){
|
244
|
+
index = vid.replace(base.video.options.videoID, '');
|
245
|
+
if (data.event === 'ready') {
|
246
|
+
// Vimeo ready, add additional event listeners for video status
|
247
|
+
base.video.postMsg('{"method":"addEventListener","value":"play"}', vid);
|
248
|
+
base.video.postMsg('{"method":"addEventListener","value":"pause"}', vid);
|
249
|
+
base.video.postMsg('{"method":"addEventListener","value":"finish"}', vid);
|
250
|
+
}
|
251
|
+
// update current status - vimeo puts it in data.event
|
252
|
+
if (base.video.list[index]) { base.video.list[index].status = data.event; }
|
253
|
+
}
|
254
|
+
},
|
255
|
+
isPlaying : function(base, vid, index){
|
256
|
+
return (base.video.list[index].status === 'play') ? true : false;
|
257
|
+
}
|
258
|
+
},
|
259
|
+
|
260
|
+
// *** Embeded Vimeo ***
|
261
|
+
// SWFObject adds the url to the object data
|
262
|
+
// using param as a selector, the script above looks for the parent if it sees "param"
|
263
|
+
vimeo2 : {
|
264
|
+
selector : 'object[data-url*=vimeo], embed[src*=vimeo]',
|
265
|
+
embedOpts : { flashvars : { api : 1 } },
|
266
|
+
cont : function(base, vid, index) {
|
267
|
+
if (base.options.resumeOnVisible) {
|
268
|
+
var $vid = $('#' + vid);
|
269
|
+
// continue video if previously played & not finished (api_finish doesn't seem to exist) - duration can be a decimal number, so subtract it and look at the difference (2 seconds here)
|
270
|
+
if (typeof($vid[0].api_play) === 'function' && $vid[0].api_paused() && $vid[0].api_getCurrentTime() !== 0 && ($vid[0].api_getDuration() - $vid[0].api_getCurrentTime()) > 2) {
|
271
|
+
$vid[0].api_play();
|
272
|
+
}
|
273
|
+
}
|
274
|
+
},
|
275
|
+
pause : function(base, vid){
|
276
|
+
// find ALL videos and pause them, just in case
|
277
|
+
$('object[data-url*=vimeo], embed[src*=vimeo]').each(function(){
|
278
|
+
var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
|
279
|
+
if (typeof(el.api_pause) === 'function') {
|
280
|
+
el.api_pause();
|
281
|
+
}
|
282
|
+
});
|
283
|
+
},
|
284
|
+
isPlaying : function(base, vid, index){
|
285
|
+
var $vid = $('#' + vid);
|
286
|
+
return (typeof($vid[0].api_paused) === 'function' && !$vid[0].api_paused()) ? true : false;
|
287
|
+
}
|
288
|
+
},
|
289
|
+
|
290
|
+
// *** iframe YouTube *** isolated demo: http://jsfiddle.net/Mottie/qk5MY/
|
291
|
+
youtube1 : {
|
292
|
+
selector : 'iframe[src*=youtube]',
|
293
|
+
// "iv_load_policy=3" should turn off annotations on init, but doesn't seem to
|
294
|
+
initAPI : '&iv_load_policy=3&enablejsapi=1&playerapiid=',
|
295
|
+
cont : function(base, vid, index){
|
296
|
+
if (base.options.resumeOnVisible && base.video.list[index].status === 2){
|
297
|
+
base.video.postMsg('{"event":"command","func":"playVideo"}', vid);
|
298
|
+
}
|
299
|
+
},
|
300
|
+
pause : function(base, vid, index){
|
301
|
+
// pause ALL videos on the page - in IE, pausing a video means it will continue when next seen =(
|
302
|
+
$('iframe[src*=youtube]').each(function(){
|
303
|
+
// if (this.id !== vid || (this.id === vid && base.video.list[index].status >= 0)) { // trying to fix the continue video problem; this only breaks it
|
304
|
+
base.video.postMsg('{"event":"command","func":"pauseVideo"}', vid);
|
305
|
+
// }
|
306
|
+
});
|
307
|
+
},
|
308
|
+
message : function(base, data){
|
309
|
+
if (data.event === 'infoDelivery') { return; } // ignore youtube video loading spam
|
310
|
+
// *** YouTube *** iframe returns an embeded url (data.info.videoUrl) but no video id...
|
311
|
+
if (data.info && data.info.videoUrl) {
|
312
|
+
// figure out vid for youtube
|
313
|
+
// data.info.videoURL = http://www.youtube.com/watch?v=###########&feature=player_embedded
|
314
|
+
var url = base.video.gup('v', data.info.videoUrl), // end up with ###########, now find it
|
315
|
+
v = $('iframe[src*=' + url + ']'), vid, index;
|
316
|
+
// iframe src changes when watching related videos; so there is no way to tell which video has an update
|
317
|
+
if (v.length) {
|
318
|
+
vid = v[0].id;
|
319
|
+
index = vid.replace(base.video.options.videoID, '');
|
320
|
+
// YouTube ready, add additional event listeners for video status. BUT this never fires off =(
|
321
|
+
// Fixing this may solve the continue problem
|
322
|
+
if (data.event === 'onReady') {
|
323
|
+
base.video.postMsg('{"event":"listening","func":"onStateChange"}', vid);
|
324
|
+
}
|
325
|
+
// Update status, so the "isPlaying" function can access it
|
326
|
+
if (data.event === 'onStateChange' && base.video.list[index]) {
|
327
|
+
// update list with current status; data.info.playerState = YouTube
|
328
|
+
base.video.list[index].status = data.info.playerState;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
332
|
+
},
|
333
|
+
isPlaying : function(base, vid, index){
|
334
|
+
var status = base.video.list[index].status;
|
335
|
+
// state: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
|
336
|
+
return (status === 1 || status > 2) ? true : false;
|
337
|
+
}
|
338
|
+
},
|
339
|
+
|
340
|
+
// *** Embeded YouTube ***
|
341
|
+
// include embed for IE; SWFObject adds the url to the object data attribute
|
342
|
+
youtube2 : {
|
343
|
+
selector : 'object[data-url*=youtube], embed[src*=youtube]',
|
344
|
+
initAPI : '&iv_load_policy=3&enablejsapi=1&version=3&playerapiid=', // video ID added to the end
|
345
|
+
// YouTube - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
|
346
|
+
cont : function(base, vid, index) {
|
347
|
+
if (base.options.resumeOnVisible) {
|
348
|
+
var $vid = $('#' + vid);
|
349
|
+
// continue video if previously played and not cued
|
350
|
+
if ($vid.length && typeof($vid[0].getPlayerState) === 'function' && $vid[0].getPlayerState() > 0) {
|
351
|
+
$vid[0].playVideo();
|
352
|
+
}
|
353
|
+
}
|
354
|
+
},
|
355
|
+
pause : function(base, vid){
|
356
|
+
// find ALL videos and pause them, just in case
|
357
|
+
$('object[data-url*=youtube], embed[src*=youtube]').each(function(){
|
358
|
+
var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
|
359
|
+
// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
|
360
|
+
if (typeof(el.getPlayerState) === 'function' && el.getPlayerState() > 0) {
|
361
|
+
// pause video if not autoplaying (if already initialized)
|
362
|
+
el.pauseVideo();
|
363
|
+
}
|
364
|
+
});
|
365
|
+
},
|
366
|
+
isPlaying : function(base, vid){
|
367
|
+
var $vid = $('#' + vid);
|
368
|
+
return (typeof($vid[0].getPlayerState) === 'function' && ($vid[0].getPlayerState() === 1 || $vid[0].getPlayerState() > 2)) ? true : false;
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
};
|
373
|
+
|
374
|
+
})(jQuery);
|
375
|
+
|
376
|
+
// Initialize video extension automatically
|
377
|
+
jQuery(window).load(function(){
|
378
|
+
jQuery('.anythingBase').anythingSliderVideo();
|
379
|
+
});
|
@@ -0,0 +1,140 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
|
3
|
+
*
|
4
|
+
* Uses the built In easIng capabilities added In jQuery 1.1
|
5
|
+
* to offer multiple easIng options
|
6
|
+
*
|
7
|
+
* Copyright (c) 2007 George Smith
|
8
|
+
* Licensed under the MIT License:
|
9
|
+
* http://www.opensource.org/licenses/mit-license.php
|
10
|
+
*/
|
11
|
+
|
12
|
+
// t: current time, b: begInnIng value, c: change In value, d: duration
|
13
|
+
|
14
|
+
jQuery.extend( jQuery.easing,
|
15
|
+
{
|
16
|
+
easeInQuad: function (x, t, b, c, d) {
|
17
|
+
return c*(t/=d)*t + b;
|
18
|
+
},
|
19
|
+
easeOutQuad: function (x, t, b, c, d) {
|
20
|
+
return -c *(t/=d)*(t-2) + b;
|
21
|
+
},
|
22
|
+
easeInOutQuad: function (x, t, b, c, d) {
|
23
|
+
if ((t/=d/2) < 1) return c/2*t*t + b;
|
24
|
+
return -c/2 * ((--t)*(t-2) - 1) + b;
|
25
|
+
},
|
26
|
+
easeInCubic: function (x, t, b, c, d) {
|
27
|
+
return c*(t/=d)*t*t + b;
|
28
|
+
},
|
29
|
+
easeOutCubic: function (x, t, b, c, d) {
|
30
|
+
return c*((t=t/d-1)*t*t + 1) + b;
|
31
|
+
},
|
32
|
+
easeInOutCubic: function (x, t, b, c, d) {
|
33
|
+
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
34
|
+
return c/2*((t-=2)*t*t + 2) + b;
|
35
|
+
},
|
36
|
+
easeInQuart: function (x, t, b, c, d) {
|
37
|
+
return c*(t/=d)*t*t*t + b;
|
38
|
+
},
|
39
|
+
easeOutQuart: function (x, t, b, c, d) {
|
40
|
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
41
|
+
},
|
42
|
+
easeInOutQuart: function (x, t, b, c, d) {
|
43
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
44
|
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
45
|
+
},
|
46
|
+
easeInQuint: function (x, t, b, c, d) {
|
47
|
+
return c*(t/=d)*t*t*t*t + b;
|
48
|
+
},
|
49
|
+
easeOutQuint: function (x, t, b, c, d) {
|
50
|
+
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
51
|
+
},
|
52
|
+
easeInOutQuint: function (x, t, b, c, d) {
|
53
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
54
|
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
55
|
+
},
|
56
|
+
easeInSine: function (x, t, b, c, d) {
|
57
|
+
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
58
|
+
},
|
59
|
+
easeOutSine: function (x, t, b, c, d) {
|
60
|
+
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
61
|
+
},
|
62
|
+
easeInOutSine: function (x, t, b, c, d) {
|
63
|
+
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
64
|
+
},
|
65
|
+
easeInExpo: function (x, t, b, c, d) {
|
66
|
+
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
67
|
+
},
|
68
|
+
easeOutExpo: function (x, t, b, c, d) {
|
69
|
+
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
70
|
+
},
|
71
|
+
easeInOutExpo: function (x, t, b, c, d) {
|
72
|
+
if (t==0) return b;
|
73
|
+
if (t==d) return b+c;
|
74
|
+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
75
|
+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
76
|
+
},
|
77
|
+
easeInCirc: function (x, t, b, c, d) {
|
78
|
+
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
79
|
+
},
|
80
|
+
easeOutCirc: function (x, t, b, c, d) {
|
81
|
+
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
82
|
+
},
|
83
|
+
easeInOutCirc: function (x, t, b, c, d) {
|
84
|
+
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
85
|
+
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
86
|
+
},
|
87
|
+
easeInElastic: function (x, t, b, c, d) {
|
88
|
+
var s=1.70158;var p=0;var a=c;
|
89
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
90
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
91
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
92
|
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
93
|
+
},
|
94
|
+
easeOutElastic: function (x, t, b, c, d) {
|
95
|
+
var s=1.70158;var p=0;var a=c;
|
96
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
97
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
98
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
99
|
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
100
|
+
},
|
101
|
+
easeInOutElastic: function (x, t, b, c, d) {
|
102
|
+
var s=1.70158;var p=0;var a=c;
|
103
|
+
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
104
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
105
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
106
|
+
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
107
|
+
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
108
|
+
},
|
109
|
+
easeInBack: function (x, t, b, c, d, s) {
|
110
|
+
if (s == undefined) s = 1.70158;
|
111
|
+
return c*(t/=d)*t*((s+1)*t - s) + b;
|
112
|
+
},
|
113
|
+
easeOutBack: function (x, t, b, c, d, s) {
|
114
|
+
if (s == undefined) s = 1.70158;
|
115
|
+
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
116
|
+
},
|
117
|
+
easeInOutBack: function (x, t, b, c, d, s) {
|
118
|
+
if (s == undefined) s = 1.70158;
|
119
|
+
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
120
|
+
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
121
|
+
},
|
122
|
+
easeInBounce: function (x, t, b, c, d) {
|
123
|
+
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
124
|
+
},
|
125
|
+
easeOutBounce: function (x, t, b, c, d) {
|
126
|
+
if ((t/=d) < (1/2.75)) {
|
127
|
+
return c*(7.5625*t*t) + b;
|
128
|
+
} else if (t < (2/2.75)) {
|
129
|
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
130
|
+
} else if (t < (2.5/2.75)) {
|
131
|
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
132
|
+
} else {
|
133
|
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
134
|
+
}
|
135
|
+
},
|
136
|
+
easeInOutBounce: function (x, t, b, c, d) {
|
137
|
+
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
138
|
+
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
139
|
+
}
|
140
|
+
});
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
2
|
+
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
3
|
+
*/
|
4
|
+
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
|