jqtools-rails 0.1.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/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +34 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/jqtools-rails.gemspec +81 -0
- data/lib/jqtools-rails.rb +5 -0
- data/spec/jqtools-rails_spec.rb +7 -0
- data/spec/spec_helper.rb +12 -0
- data/vendor/assets/javascripts/dateinput/dateinput.js +791 -0
- data/vendor/assets/javascripts/jquery.tools.min.js +39 -0
- data/vendor/assets/javascripts/overlay/overlay.apple.js +155 -0
- data/vendor/assets/javascripts/overlay/overlay.js +293 -0
- data/vendor/assets/javascripts/rangeinput/rangeinput.js +471 -0
- data/vendor/assets/javascripts/scrollable/scrollable.autoscroll.js +96 -0
- data/vendor/assets/javascripts/scrollable/scrollable.js +368 -0
- data/vendor/assets/javascripts/scrollable/scrollable.navigator.js +134 -0
- data/vendor/assets/javascripts/tabs/tabs.js +319 -0
- data/vendor/assets/javascripts/tabs/tabs.slideshow.js +191 -0
- data/vendor/assets/javascripts/toolbox/toolbox.expose.js +224 -0
- data/vendor/assets/javascripts/toolbox/toolbox.flashembed.js +301 -0
- data/vendor/assets/javascripts/toolbox/toolbox.history.js +108 -0
- data/vendor/assets/javascripts/toolbox/toolbox.mousewheel.js +65 -0
- data/vendor/assets/javascripts/tooltip/tooltip.dynamic.js +154 -0
- data/vendor/assets/javascripts/tooltip/tooltip.js +358 -0
- data/vendor/assets/javascripts/tooltip/tooltip.slide.js +78 -0
- data/vendor/assets/javascripts/validator/validator.js +598 -0
- metadata +135 -0
@@ -0,0 +1,191 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* jQuery Tools @VERSION Slideshow - Extend it.
|
4
|
+
*
|
5
|
+
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
|
6
|
+
*
|
7
|
+
* http://flowplayer.org/tools/tabs/slideshow.html
|
8
|
+
*
|
9
|
+
* Since: September 2009
|
10
|
+
* Date: @DATE
|
11
|
+
*/
|
12
|
+
(function($) {
|
13
|
+
|
14
|
+
var tool;
|
15
|
+
|
16
|
+
tool = $.tools.tabs.slideshow = {
|
17
|
+
|
18
|
+
conf: {
|
19
|
+
next: '.forward',
|
20
|
+
prev: '.backward',
|
21
|
+
disabledClass: 'disabled',
|
22
|
+
autoplay: false,
|
23
|
+
autopause: true,
|
24
|
+
interval: 3000,
|
25
|
+
clickable: true,
|
26
|
+
api: false
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
function Slideshow(root, conf) {
|
31
|
+
|
32
|
+
var self = this,
|
33
|
+
fire = root.add(this),
|
34
|
+
tabs = root.data("tabs"),
|
35
|
+
timer,
|
36
|
+
stopped = true;
|
37
|
+
|
38
|
+
// next / prev buttons
|
39
|
+
function find(query) {
|
40
|
+
var el = $(query);
|
41
|
+
return el.length < 2 ? el : root.parent().find(query);
|
42
|
+
}
|
43
|
+
|
44
|
+
var nextButton = find(conf.next).click(function() {
|
45
|
+
tabs.next();
|
46
|
+
});
|
47
|
+
|
48
|
+
var prevButton = find(conf.prev).click(function() {
|
49
|
+
tabs.prev();
|
50
|
+
});
|
51
|
+
|
52
|
+
/**
|
53
|
+
*
|
54
|
+
* Similar fix for autoscroll animation queue problem
|
55
|
+
*/
|
56
|
+
function next(){
|
57
|
+
timer = setTimeout(function(){
|
58
|
+
tabs.next();
|
59
|
+
}, conf.interval);
|
60
|
+
}
|
61
|
+
|
62
|
+
// extend the Tabs API with slideshow methods
|
63
|
+
$.extend(self, {
|
64
|
+
|
65
|
+
// return tabs API
|
66
|
+
getTabs: function() {
|
67
|
+
return tabs;
|
68
|
+
},
|
69
|
+
|
70
|
+
getConf: function() {
|
71
|
+
return conf;
|
72
|
+
},
|
73
|
+
|
74
|
+
play: function() {
|
75
|
+
|
76
|
+
// do not start additional timer if already exists
|
77
|
+
if (timer) { return self; }
|
78
|
+
|
79
|
+
// onBeforePlay
|
80
|
+
var e = $.Event("onBeforePlay");
|
81
|
+
fire.trigger(e);
|
82
|
+
if (e.isDefaultPrevented()) { return self; }
|
83
|
+
|
84
|
+
stopped = false;
|
85
|
+
|
86
|
+
// onPlay
|
87
|
+
fire.trigger("onPlay");
|
88
|
+
|
89
|
+
fire.bind('onClick', next);
|
90
|
+
next();
|
91
|
+
|
92
|
+
return self;
|
93
|
+
},
|
94
|
+
|
95
|
+
pause: function() {
|
96
|
+
|
97
|
+
if (!timer) { return self; }
|
98
|
+
|
99
|
+
// onBeforePause
|
100
|
+
var e = $.Event("onBeforePause");
|
101
|
+
fire.trigger(e);
|
102
|
+
if (e.isDefaultPrevented()) { return self; }
|
103
|
+
|
104
|
+
timer = clearTimeout(timer);
|
105
|
+
|
106
|
+
// onPause
|
107
|
+
fire.trigger("onPause");
|
108
|
+
|
109
|
+
fire.unbind('onClick', next);
|
110
|
+
|
111
|
+
return self;
|
112
|
+
},
|
113
|
+
|
114
|
+
// resume playing if not stopped
|
115
|
+
resume: function() {
|
116
|
+
stopped || self.play();
|
117
|
+
},
|
118
|
+
|
119
|
+
// when stopped - mouseover won't restart
|
120
|
+
stop: function() {
|
121
|
+
self.pause();
|
122
|
+
stopped = true;
|
123
|
+
}
|
124
|
+
|
125
|
+
});
|
126
|
+
|
127
|
+
// callbacks
|
128
|
+
$.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","), function(i, name) {
|
129
|
+
|
130
|
+
// configuration
|
131
|
+
if ($.isFunction(conf[name])) {
|
132
|
+
$(self).bind(name, conf[name]);
|
133
|
+
}
|
134
|
+
|
135
|
+
// API methods
|
136
|
+
self[name] = function(fn) {
|
137
|
+
return $(self).bind(name, fn);
|
138
|
+
};
|
139
|
+
});
|
140
|
+
|
141
|
+
|
142
|
+
/* when mouse enters, slideshow stops */
|
143
|
+
if (conf.autopause) {
|
144
|
+
tabs.getTabs().add(nextButton).add(prevButton).add(tabs.getPanes()).hover(self.pause, self.resume);
|
145
|
+
}
|
146
|
+
|
147
|
+
if (conf.autoplay) {
|
148
|
+
self.play();
|
149
|
+
}
|
150
|
+
|
151
|
+
if (conf.clickable) {
|
152
|
+
tabs.getPanes().click(function() {
|
153
|
+
tabs.next();
|
154
|
+
});
|
155
|
+
}
|
156
|
+
|
157
|
+
// manage disabling of next/prev buttons
|
158
|
+
if (!tabs.getConf().rotate) {
|
159
|
+
|
160
|
+
var disabled = conf.disabledClass;
|
161
|
+
|
162
|
+
if (!tabs.getIndex()) {
|
163
|
+
prevButton.addClass(disabled);
|
164
|
+
}
|
165
|
+
|
166
|
+
tabs.onBeforeClick(function(e, i) {
|
167
|
+
prevButton.toggleClass(disabled, !i);
|
168
|
+
nextButton.toggleClass(disabled, i == tabs.getTabs().length -1);
|
169
|
+
});
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
// jQuery plugin implementation
|
174
|
+
$.fn.slideshow = function(conf) {
|
175
|
+
|
176
|
+
// return existing instance
|
177
|
+
var el = this.data("slideshow");
|
178
|
+
if (el) { return el; }
|
179
|
+
|
180
|
+
conf = $.extend({}, tool.conf, conf);
|
181
|
+
|
182
|
+
this.each(function() {
|
183
|
+
el = new Slideshow($(this), conf);
|
184
|
+
$(this).data("slideshow", el);
|
185
|
+
});
|
186
|
+
|
187
|
+
return conf.api ? el : this;
|
188
|
+
};
|
189
|
+
|
190
|
+
})(jQuery);
|
191
|
+
|
@@ -0,0 +1,224 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* jQuery Tools @VERSION / Expose - Dim the lights
|
4
|
+
*
|
5
|
+
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
|
6
|
+
*
|
7
|
+
* http://flowplayer.org/tools/toolbox/expose.html
|
8
|
+
*
|
9
|
+
* Since: Mar 2010
|
10
|
+
* Date: @DATE
|
11
|
+
*/
|
12
|
+
(function($) {
|
13
|
+
|
14
|
+
// static constructs
|
15
|
+
$.tools = $.tools || {version: '@VERSION'};
|
16
|
+
|
17
|
+
var tool;
|
18
|
+
|
19
|
+
tool = $.tools.expose = {
|
20
|
+
|
21
|
+
conf: {
|
22
|
+
maskId: 'exposeMask',
|
23
|
+
loadSpeed: 'slow',
|
24
|
+
closeSpeed: 'fast',
|
25
|
+
closeOnClick: true,
|
26
|
+
closeOnEsc: true,
|
27
|
+
|
28
|
+
// css settings
|
29
|
+
zIndex: 9998,
|
30
|
+
opacity: 0.8,
|
31
|
+
startOpacity: 0,
|
32
|
+
color: '#fff',
|
33
|
+
|
34
|
+
// callbacks
|
35
|
+
onLoad: null,
|
36
|
+
onClose: null
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
40
|
+
/* one of the greatest headaches in the tool. finally made it */
|
41
|
+
function viewport() {
|
42
|
+
|
43
|
+
// the horror case
|
44
|
+
if ($.browser.msie) {
|
45
|
+
|
46
|
+
// if there are no scrollbars then use window.height
|
47
|
+
var d = $(document).height(), w = $(window).height();
|
48
|
+
|
49
|
+
return [
|
50
|
+
window.innerWidth || // ie7+
|
51
|
+
document.documentElement.clientWidth || // ie6
|
52
|
+
document.body.clientWidth, // ie6 quirks mode
|
53
|
+
d - w < 20 ? w : d
|
54
|
+
];
|
55
|
+
}
|
56
|
+
|
57
|
+
// other well behaving browsers
|
58
|
+
return [$(document).width(), $(document).height()];
|
59
|
+
}
|
60
|
+
|
61
|
+
function call(fn) {
|
62
|
+
if (fn) { return fn.call($.mask); }
|
63
|
+
}
|
64
|
+
|
65
|
+
var mask, exposed, loaded, config, overlayIndex;
|
66
|
+
|
67
|
+
|
68
|
+
$.mask = {
|
69
|
+
|
70
|
+
load: function(conf, els) {
|
71
|
+
|
72
|
+
// already loaded ?
|
73
|
+
if (loaded) { return this; }
|
74
|
+
|
75
|
+
// configuration
|
76
|
+
if (typeof conf == 'string') {
|
77
|
+
conf = {color: conf};
|
78
|
+
}
|
79
|
+
|
80
|
+
// use latest config
|
81
|
+
conf = conf || config;
|
82
|
+
|
83
|
+
config = conf = $.extend($.extend({}, tool.conf), conf);
|
84
|
+
|
85
|
+
// get the mask
|
86
|
+
mask = $("#" + conf.maskId);
|
87
|
+
|
88
|
+
// or create it
|
89
|
+
if (!mask.length) {
|
90
|
+
mask = $('<div/>').attr("id", conf.maskId);
|
91
|
+
$("body").append(mask);
|
92
|
+
}
|
93
|
+
|
94
|
+
// set position and dimensions
|
95
|
+
var size = viewport();
|
96
|
+
|
97
|
+
mask.css({
|
98
|
+
position:'absolute',
|
99
|
+
top: 0,
|
100
|
+
left: 0,
|
101
|
+
width: size[0],
|
102
|
+
height: size[1],
|
103
|
+
display: 'none',
|
104
|
+
opacity: conf.startOpacity,
|
105
|
+
zIndex: conf.zIndex
|
106
|
+
});
|
107
|
+
|
108
|
+
if (conf.color) {
|
109
|
+
mask.css("backgroundColor", conf.color);
|
110
|
+
}
|
111
|
+
|
112
|
+
// onBeforeLoad
|
113
|
+
if (call(conf.onBeforeLoad) === false) {
|
114
|
+
return this;
|
115
|
+
}
|
116
|
+
|
117
|
+
// esc button
|
118
|
+
if (conf.closeOnEsc) {
|
119
|
+
$(document).bind("keydown.mask", function(e) {
|
120
|
+
if (e.keyCode == 27) {
|
121
|
+
$.mask.close(e);
|
122
|
+
}
|
123
|
+
});
|
124
|
+
}
|
125
|
+
|
126
|
+
// mask click closes
|
127
|
+
if (conf.closeOnClick) {
|
128
|
+
mask.bind("click.mask", function(e) {
|
129
|
+
$.mask.close(e);
|
130
|
+
});
|
131
|
+
}
|
132
|
+
|
133
|
+
// resize mask when window is resized
|
134
|
+
$(window).bind("resize.mask", function() {
|
135
|
+
$.mask.fit();
|
136
|
+
});
|
137
|
+
|
138
|
+
// exposed elements
|
139
|
+
if (els && els.length) {
|
140
|
+
|
141
|
+
overlayIndex = els.eq(0).css("zIndex");
|
142
|
+
|
143
|
+
// make sure element is positioned absolutely or relatively
|
144
|
+
$.each(els, function() {
|
145
|
+
var el = $(this);
|
146
|
+
if (!/relative|absolute|fixed/i.test(el.css("position"))) {
|
147
|
+
el.css("position", "relative");
|
148
|
+
}
|
149
|
+
});
|
150
|
+
|
151
|
+
// make elements sit on top of the mask
|
152
|
+
exposed = els.css({ zIndex: Math.max(conf.zIndex + 1, overlayIndex == 'auto' ? 0 : overlayIndex)});
|
153
|
+
}
|
154
|
+
|
155
|
+
// reveal mask
|
156
|
+
mask.css({display: 'block'}).fadeTo(conf.loadSpeed, conf.opacity, function() {
|
157
|
+
$.mask.fit();
|
158
|
+
call(conf.onLoad);
|
159
|
+
loaded = "full";
|
160
|
+
});
|
161
|
+
|
162
|
+
loaded = true;
|
163
|
+
return this;
|
164
|
+
},
|
165
|
+
|
166
|
+
close: function() {
|
167
|
+
if (loaded) {
|
168
|
+
|
169
|
+
// onBeforeClose
|
170
|
+
if (call(config.onBeforeClose) === false) { return this; }
|
171
|
+
|
172
|
+
mask.fadeOut(config.closeSpeed, function() {
|
173
|
+
call(config.onClose);
|
174
|
+
if (exposed) {
|
175
|
+
exposed.css({zIndex: overlayIndex});
|
176
|
+
}
|
177
|
+
loaded = false;
|
178
|
+
});
|
179
|
+
|
180
|
+
// unbind various event listeners
|
181
|
+
$(document).unbind("keydown.mask");
|
182
|
+
mask.unbind("click.mask");
|
183
|
+
$(window).unbind("resize.mask");
|
184
|
+
}
|
185
|
+
|
186
|
+
return this;
|
187
|
+
},
|
188
|
+
|
189
|
+
fit: function() {
|
190
|
+
if (loaded) {
|
191
|
+
var size = viewport();
|
192
|
+
mask.css({width: size[0], height: size[1]});
|
193
|
+
}
|
194
|
+
},
|
195
|
+
|
196
|
+
getMask: function() {
|
197
|
+
return mask;
|
198
|
+
},
|
199
|
+
|
200
|
+
isLoaded: function(fully) {
|
201
|
+
return fully ? loaded == 'full' : loaded;
|
202
|
+
},
|
203
|
+
|
204
|
+
getConf: function() {
|
205
|
+
return config;
|
206
|
+
},
|
207
|
+
|
208
|
+
getExposed: function() {
|
209
|
+
return exposed;
|
210
|
+
}
|
211
|
+
};
|
212
|
+
|
213
|
+
$.fn.mask = function(conf) {
|
214
|
+
$.mask.load(conf);
|
215
|
+
return this;
|
216
|
+
};
|
217
|
+
|
218
|
+
$.fn.expose = function(conf) {
|
219
|
+
$.mask.load(conf, this);
|
220
|
+
return this;
|
221
|
+
};
|
222
|
+
|
223
|
+
|
224
|
+
})(jQuery);
|
@@ -0,0 +1,301 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* jQuery Tools @VERSION / Flashembed - New wave Flash embedding
|
4
|
+
*
|
5
|
+
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
|
6
|
+
*
|
7
|
+
* http://flowplayer.org/tools/toolbox/flashembed.html
|
8
|
+
*
|
9
|
+
* Since : March 2008
|
10
|
+
* Date : @DATE
|
11
|
+
*/
|
12
|
+
(function() {
|
13
|
+
|
14
|
+
var IE = document.all,
|
15
|
+
URL = 'http://www.adobe.com/go/getflashplayer',
|
16
|
+
JQUERY = typeof jQuery == 'function',
|
17
|
+
RE = /(\d+)[^\d]+(\d+)[^\d]*(\d*)/,
|
18
|
+
GLOBAL_OPTS = {
|
19
|
+
// very common opts
|
20
|
+
width: '100%',
|
21
|
+
height: '100%',
|
22
|
+
id: "_" + ("" + Math.random()).slice(9),
|
23
|
+
|
24
|
+
// flashembed defaults
|
25
|
+
allowfullscreen: true,
|
26
|
+
allowscriptaccess: 'always',
|
27
|
+
quality: 'high',
|
28
|
+
|
29
|
+
// flashembed specific options
|
30
|
+
version: [3, 0],
|
31
|
+
onFail: null,
|
32
|
+
expressInstall: null,
|
33
|
+
w3c: false,
|
34
|
+
cachebusting: false
|
35
|
+
};
|
36
|
+
|
37
|
+
// version 9 bugfix: (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
|
38
|
+
if (window.attachEvent) {
|
39
|
+
window.attachEvent("onbeforeunload", function() {
|
40
|
+
__flash_unloadHandler = function() {};
|
41
|
+
__flash_savedUnloadHandler = function() {};
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
// simple extend
|
46
|
+
function extend(to, from) {
|
47
|
+
if (from) {
|
48
|
+
for (var key in from) {
|
49
|
+
if (from.hasOwnProperty(key)) {
|
50
|
+
to[key] = from[key];
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return to;
|
55
|
+
}
|
56
|
+
|
57
|
+
// used by asString method
|
58
|
+
function map(arr, func) {
|
59
|
+
var newArr = [];
|
60
|
+
for (var i in arr) {
|
61
|
+
if (arr.hasOwnProperty(i)) {
|
62
|
+
newArr[i] = func(arr[i]);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return newArr;
|
66
|
+
}
|
67
|
+
|
68
|
+
window.flashembed = function(root, opts, conf) {
|
69
|
+
|
70
|
+
// root must be found / loaded
|
71
|
+
if (typeof root == 'string') {
|
72
|
+
root = document.getElementById(root.replace("#", ""));
|
73
|
+
}
|
74
|
+
|
75
|
+
// not found
|
76
|
+
if (!root) { return; }
|
77
|
+
|
78
|
+
if (typeof opts == 'string') {
|
79
|
+
opts = {src: opts};
|
80
|
+
}
|
81
|
+
|
82
|
+
return new Flash(root, extend(extend({}, GLOBAL_OPTS), opts), conf);
|
83
|
+
};
|
84
|
+
|
85
|
+
// flashembed "static" API
|
86
|
+
var f = extend(window.flashembed, {
|
87
|
+
|
88
|
+
conf: GLOBAL_OPTS,
|
89
|
+
|
90
|
+
getVersion: function() {
|
91
|
+
var fo, ver;
|
92
|
+
|
93
|
+
try {
|
94
|
+
ver = navigator.plugins["Shockwave Flash"].description.slice(16);
|
95
|
+
} catch(e) {
|
96
|
+
|
97
|
+
try {
|
98
|
+
fo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
|
99
|
+
ver = fo && fo.GetVariable("$version");
|
100
|
+
|
101
|
+
} catch(err) {
|
102
|
+
try {
|
103
|
+
fo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
104
|
+
ver = fo && fo.GetVariable("$version");
|
105
|
+
} catch(err2) { }
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
ver = RE.exec(ver);
|
110
|
+
return ver ? [ver[1], ver[3]] : [0, 0];
|
111
|
+
},
|
112
|
+
|
113
|
+
asString: function(obj) {
|
114
|
+
|
115
|
+
if (obj === null || obj === undefined) { return null; }
|
116
|
+
var type = typeof obj;
|
117
|
+
if (type == 'object' && obj.push) { type = 'array'; }
|
118
|
+
|
119
|
+
switch (type){
|
120
|
+
|
121
|
+
case 'string':
|
122
|
+
obj = obj.replace(new RegExp('(["\\\\])', 'g'), '\\$1');
|
123
|
+
|
124
|
+
// flash does not handle %- characters well. transforms "50%" to "50pct" (a dirty hack, I admit)
|
125
|
+
obj = obj.replace(/^\s?(\d+\.?\d*)%/, "$1pct");
|
126
|
+
return '"' +obj+ '"';
|
127
|
+
|
128
|
+
case 'array':
|
129
|
+
return '['+ map(obj, function(el) {
|
130
|
+
return f.asString(el);
|
131
|
+
}).join(',') +']';
|
132
|
+
|
133
|
+
case 'function':
|
134
|
+
return '"function()"';
|
135
|
+
|
136
|
+
case 'object':
|
137
|
+
var str = [];
|
138
|
+
for (var prop in obj) {
|
139
|
+
if (obj.hasOwnProperty(prop)) {
|
140
|
+
str.push('"'+prop+'":'+ f.asString(obj[prop]));
|
141
|
+
}
|
142
|
+
}
|
143
|
+
return '{'+str.join(',')+'}';
|
144
|
+
}
|
145
|
+
|
146
|
+
// replace ' --> " and remove spaces
|
147
|
+
return String(obj).replace(/\s/g, " ").replace(/\'/g, "\"");
|
148
|
+
},
|
149
|
+
|
150
|
+
getHTML: function(opts, conf) {
|
151
|
+
|
152
|
+
opts = extend({}, opts);
|
153
|
+
|
154
|
+
/******* OBJECT tag and it's attributes *******/
|
155
|
+
var html = '<object width="' + opts.width +
|
156
|
+
'" height="' + opts.height +
|
157
|
+
'" id="' + opts.id +
|
158
|
+
'" name="' + opts.id + '"';
|
159
|
+
|
160
|
+
if (opts.cachebusting) {
|
161
|
+
opts.src += ((opts.src.indexOf("?") != -1 ? "&" : "?") + Math.random());
|
162
|
+
}
|
163
|
+
|
164
|
+
if (opts.w3c || !IE) {
|
165
|
+
html += ' data="' +opts.src+ '" type="application/x-shockwave-flash"';
|
166
|
+
} else {
|
167
|
+
html += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
|
168
|
+
}
|
169
|
+
|
170
|
+
html += '>';
|
171
|
+
|
172
|
+
/******* nested PARAM tags *******/
|
173
|
+
if (opts.w3c || IE) {
|
174
|
+
html += '<param name="movie" value="' +opts.src+ '" />';
|
175
|
+
}
|
176
|
+
|
177
|
+
// not allowed params
|
178
|
+
opts.width = opts.height = opts.id = opts.w3c = opts.src = null;
|
179
|
+
opts.onFail = opts.version = opts.expressInstall = null;
|
180
|
+
|
181
|
+
for (var key in opts) {
|
182
|
+
if (opts[key]) {
|
183
|
+
html += '<param name="'+ key +'" value="'+ opts[key] +'" />';
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
/******* FLASHVARS *******/
|
188
|
+
var vars = "";
|
189
|
+
|
190
|
+
if (conf) {
|
191
|
+
for (var k in conf) {
|
192
|
+
if (conf[k]) {
|
193
|
+
var val = conf[k];
|
194
|
+
vars += k +'='+ encodeURIComponent(/function|object/.test(typeof val) ? f.asString(val) : val) + '&';
|
195
|
+
}
|
196
|
+
}
|
197
|
+
vars = vars.slice(0, -1);
|
198
|
+
html += '<param name="flashvars" value=\'' + vars + '\' />';
|
199
|
+
}
|
200
|
+
|
201
|
+
html += "</object>";
|
202
|
+
|
203
|
+
return html;
|
204
|
+
},
|
205
|
+
|
206
|
+
isSupported: function(ver) {
|
207
|
+
return VERSION[0] > ver[0] || VERSION[0] == ver[0] && VERSION[1] >= ver[1];
|
208
|
+
}
|
209
|
+
|
210
|
+
});
|
211
|
+
|
212
|
+
var VERSION = f.getVersion();
|
213
|
+
|
214
|
+
function Flash(root, opts, conf) {
|
215
|
+
|
216
|
+
// version is ok
|
217
|
+
if (f.isSupported(opts.version)) {
|
218
|
+
root.innerHTML = f.getHTML(opts, conf);
|
219
|
+
|
220
|
+
// express install
|
221
|
+
} else if (opts.expressInstall && f.isSupported([6, 65])) {
|
222
|
+
root.innerHTML = f.getHTML(extend(opts, {src: opts.expressInstall}), {
|
223
|
+
MMredirectURL: location.href,
|
224
|
+
MMplayerType: 'PlugIn',
|
225
|
+
MMdoctitle: document.title
|
226
|
+
});
|
227
|
+
|
228
|
+
} else {
|
229
|
+
|
230
|
+
// fail #2.1 custom content inside container
|
231
|
+
if (!root.innerHTML.replace(/\s/g, '')) {
|
232
|
+
root.innerHTML =
|
233
|
+
"<h2>Flash version " + opts.version + " or greater is required</h2>" +
|
234
|
+
"<h3>" +
|
235
|
+
(VERSION[0] > 0 ? "Your version is " + VERSION : "You have no flash plugin installed") +
|
236
|
+
"</h3>" +
|
237
|
+
|
238
|
+
(root.tagName == 'A' ? "<p>Click here to download latest version</p>" :
|
239
|
+
"<p>Download latest version from <a href='" + URL + "'>here</a></p>");
|
240
|
+
|
241
|
+
if (root.tagName == 'A') {
|
242
|
+
root.onclick = function() {
|
243
|
+
location.href = URL;
|
244
|
+
};
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
// onFail
|
249
|
+
if (opts.onFail) {
|
250
|
+
var ret = opts.onFail.call(this);
|
251
|
+
if (typeof ret == 'string') { root.innerHTML = ret; }
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
// http://flowplayer.org/forum/8/18186#post-18593
|
256
|
+
if (IE) {
|
257
|
+
window[opts.id] = document.getElementById(opts.id);
|
258
|
+
}
|
259
|
+
|
260
|
+
// API methods for callback
|
261
|
+
extend(this, {
|
262
|
+
|
263
|
+
getRoot: function() {
|
264
|
+
return root;
|
265
|
+
},
|
266
|
+
|
267
|
+
getOptions: function() {
|
268
|
+
return opts;
|
269
|
+
},
|
270
|
+
|
271
|
+
|
272
|
+
getConf: function() {
|
273
|
+
return conf;
|
274
|
+
},
|
275
|
+
|
276
|
+
getApi: function() {
|
277
|
+
return root.firstChild;
|
278
|
+
}
|
279
|
+
|
280
|
+
});
|
281
|
+
}
|
282
|
+
|
283
|
+
// setup jquery support
|
284
|
+
if (JQUERY) {
|
285
|
+
|
286
|
+
// tools version number
|
287
|
+
jQuery.tools = jQuery.tools || {version: '@VERSION'};
|
288
|
+
|
289
|
+
jQuery.tools.flashembed = {
|
290
|
+
conf: GLOBAL_OPTS
|
291
|
+
};
|
292
|
+
|
293
|
+
jQuery.fn.flashembed = function(opts, conf) {
|
294
|
+
return this.each(function() {
|
295
|
+
jQuery(this).data("flashembed", flashembed(this, opts, conf));
|
296
|
+
});
|
297
|
+
};
|
298
|
+
}
|
299
|
+
|
300
|
+
})();
|
301
|
+
|