fluby 0.5.2 → 0.5.3
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/Rakefile +1 -1
- data/lib/fluby.rb +1 -1
- data/lib/templates/swfobject.js +196 -196
- metadata +1 -1
data/Rakefile
CHANGED
@@ -5,6 +5,7 @@ require 'rake'
|
|
5
5
|
require 'rake/clean'
|
6
6
|
require 'rake/gempackagetask'
|
7
7
|
require 'rake/testtask'
|
8
|
+
require 'rake/contrib/sshpublisher'
|
8
9
|
|
9
10
|
require File.dirname(__FILE__) + '/lib/fluby.rb'
|
10
11
|
|
@@ -46,7 +47,6 @@ task :uninstall do
|
|
46
47
|
end
|
47
48
|
|
48
49
|
### Testing
|
49
|
-
|
50
50
|
Rake::TestTask.new(:test) do |test|
|
51
51
|
test.test_files = Dir['test/test_*.rb']
|
52
52
|
end
|
data/lib/fluby.rb
CHANGED
data/lib/templates/swfobject.js
CHANGED
@@ -9,217 +9,217 @@ if(typeof deconcept == "undefined") var deconcept = {};
|
|
9
9
|
if(typeof deconcept.util == "undefined") deconcept.util = {};
|
10
10
|
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
|
11
11
|
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
12
|
+
if (!document.getElementById) { return; }
|
13
|
+
this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
|
14
|
+
this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
|
15
|
+
this.params = {};
|
16
|
+
this.variables = {};
|
17
|
+
this.attributes = [];
|
18
|
+
if(swf) { this.setAttribute('swf', swf); }
|
19
|
+
if(id) { this.setAttribute('id', id); }
|
20
|
+
if(w) { this.setAttribute('width', w); }
|
21
|
+
if(h) { this.setAttribute('height', h); }
|
22
|
+
if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
|
23
|
+
this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
|
24
|
+
if (!window.opera && document.all && this.installedVer.major > 7) {
|
25
|
+
// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
|
26
|
+
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
|
27
|
+
if (!deconcept.unloadSet) {
|
28
|
+
deconcept.SWFObjectUtil.prepUnload = function() {
|
29
|
+
__flash_unloadHandler = function(){};
|
30
|
+
__flash_savedUnloadHandler = function(){};
|
31
|
+
window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
|
32
|
+
}
|
33
|
+
window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
|
34
|
+
deconcept.unloadSet = true;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
if(c) { this.addParam('bgcolor', c); }
|
38
|
+
var q = quality ? quality : 'high';
|
39
|
+
this.addParam('quality', q);
|
40
|
+
this.setAttribute('useExpressInstall', false);
|
41
|
+
this.setAttribute('doExpressInstall', false);
|
42
|
+
var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
|
43
|
+
this.setAttribute('xiRedirectUrl', xir);
|
44
|
+
this.setAttribute('redirectUrl', '');
|
45
|
+
if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
|
46
46
|
}
|
47
47
|
deconcept.SWFObject.prototype = {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
48
|
+
useExpressInstall: function(path) {
|
49
|
+
this.xiSWFPath = !path ? "expressinstall.swf" : path;
|
50
|
+
this.setAttribute('useExpressInstall', true);
|
51
|
+
},
|
52
|
+
setAttribute: function(name, value){
|
53
|
+
this.attributes[name] = value;
|
54
|
+
},
|
55
|
+
getAttribute: function(name){
|
56
|
+
return this.attributes[name] || "";
|
57
|
+
},
|
58
|
+
addParam: function(name, value){
|
59
|
+
this.params[name] = value;
|
60
|
+
},
|
61
|
+
getParams: function(){
|
62
|
+
return this.params;
|
63
|
+
},
|
64
|
+
addVariable: function(name, value){
|
65
|
+
this.variables[name] = value;
|
66
|
+
},
|
67
|
+
getVariable: function(name){
|
68
|
+
return this.variables[name] || "";
|
69
|
+
},
|
70
|
+
getVariables: function(){
|
71
|
+
return this.variables;
|
72
|
+
},
|
73
|
+
getVariablePairs: function(){
|
74
|
+
var variablePairs = [];
|
75
|
+
var key;
|
76
|
+
var variables = this.getVariables();
|
77
|
+
for(key in variables){
|
78
|
+
variablePairs[variablePairs.length] = key +"="+ variables[key];
|
79
|
+
}
|
80
|
+
return variablePairs;
|
81
|
+
},
|
82
|
+
getSWFHTML: function() {
|
83
|
+
var swfNode = "";
|
84
|
+
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
|
85
|
+
if (this.getAttribute("doExpressInstall")) {
|
86
|
+
this.addVariable("MMplayerType", "PlugIn");
|
87
|
+
this.setAttribute('swf', this.xiSWFPath);
|
88
|
+
}
|
89
|
+
swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'"';
|
90
|
+
swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
|
91
|
+
var params = this.getParams();
|
92
|
+
for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
|
93
|
+
var pairs = this.getVariablePairs().join("&");
|
94
|
+
if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
|
95
|
+
swfNode += '/>';
|
96
|
+
} else { // PC IE
|
97
|
+
if (this.getAttribute("doExpressInstall")) {
|
98
|
+
this.addVariable("MMplayerType", "ActiveX");
|
99
|
+
this.setAttribute('swf', this.xiSWFPath);
|
100
|
+
}
|
101
|
+
swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'">';
|
102
|
+
swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
|
103
|
+
var params = this.getParams();
|
104
|
+
for(var key in params) {
|
105
|
+
swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
|
106
|
+
}
|
107
|
+
var pairs = this.getVariablePairs().join("&");
|
108
|
+
if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
|
109
|
+
swfNode += "</object>";
|
110
|
+
}
|
111
|
+
return swfNode;
|
112
|
+
},
|
113
|
+
write: function(elementId){
|
114
|
+
if(this.getAttribute('useExpressInstall')) {
|
115
|
+
// check to see if we need to do an express install
|
116
|
+
var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
|
117
|
+
if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
|
118
|
+
this.setAttribute('doExpressInstall', true);
|
119
|
+
this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
|
120
|
+
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
|
121
|
+
this.addVariable("MMdoctitle", document.title);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
|
125
|
+
var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
|
126
|
+
n.innerHTML = this.getSWFHTML();
|
127
|
+
return true;
|
128
|
+
}else{
|
129
|
+
if(this.getAttribute('redirectUrl') != "") {
|
130
|
+
document.location.replace(this.getAttribute('redirectUrl'));
|
131
|
+
}
|
132
|
+
}
|
133
|
+
return false;
|
134
|
+
}
|
135
135
|
}
|
136
136
|
|
137
137
|
/* ---- detection functions ---- */
|
138
138
|
deconcept.SWFObjectUtil.getPlayerVersion = function(){
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
//
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
139
|
+
var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
|
140
|
+
if(navigator.plugins && navigator.mimeTypes.length){
|
141
|
+
var x = navigator.plugins["Shockwave Flash"];
|
142
|
+
if(x && x.description) {
|
143
|
+
PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
|
144
|
+
}
|
145
|
+
}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
|
146
|
+
var axo = 1;
|
147
|
+
var counter = 3;
|
148
|
+
while(axo) {
|
149
|
+
try {
|
150
|
+
counter++;
|
151
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
|
152
|
+
// document.write("player v: "+ counter);
|
153
|
+
PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
|
154
|
+
} catch (e) {
|
155
|
+
axo = null;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
} else { // Win IE (non mobile)
|
159
|
+
// do minor version lookup in IE, but avoid fp6 crashing issues
|
160
|
+
// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
|
161
|
+
try{
|
162
|
+
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
|
163
|
+
}catch(e){
|
164
|
+
try {
|
165
|
+
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
166
|
+
PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
|
167
|
+
axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
|
168
|
+
} catch(e) {
|
169
|
+
if (PlayerVersion.major == 6) {
|
170
|
+
return PlayerVersion;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
try {
|
174
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
|
175
|
+
} catch(e) {}
|
176
|
+
}
|
177
|
+
if (axo != null) {
|
178
|
+
PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
|
179
|
+
}
|
180
|
+
}
|
181
|
+
return PlayerVersion;
|
182
182
|
}
|
183
183
|
deconcept.PlayerVersion = function(arrVersion){
|
184
|
-
|
185
|
-
|
186
|
-
|
184
|
+
this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
|
185
|
+
this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
|
186
|
+
this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
|
187
187
|
}
|
188
188
|
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
189
|
+
if(this.major < fv.major) return false;
|
190
|
+
if(this.major > fv.major) return true;
|
191
|
+
if(this.minor < fv.minor) return false;
|
192
|
+
if(this.minor > fv.minor) return true;
|
193
|
+
if(this.rev < fv.rev) return false;
|
194
|
+
return true;
|
195
195
|
}
|
196
196
|
/* ---- get value of query string param ---- */
|
197
197
|
deconcept.util = {
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
198
|
+
getRequestParameter: function(param) {
|
199
|
+
var q = document.location.search || document.location.hash;
|
200
|
+
if (param == null) { return q; }
|
201
|
+
if(q) {
|
202
|
+
var pairs = q.substring(1).split("&");
|
203
|
+
for (var i=0; i < pairs.length; i++) {
|
204
|
+
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
|
205
|
+
return pairs[i].substring((pairs[i].indexOf("=")+1));
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
return "";
|
210
|
+
}
|
211
211
|
}
|
212
212
|
/* fix for video streaming bug */
|
213
213
|
deconcept.SWFObjectUtil.cleanupSWFs = function() {
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
214
|
+
var objects = document.getElementsByTagName("OBJECT");
|
215
|
+
for (var i = objects.length - 1; i >= 0; i--) {
|
216
|
+
objects[i].style.display = 'none';
|
217
|
+
for (var x in objects[i]) {
|
218
|
+
if (typeof objects[i][x] == 'function') {
|
219
|
+
objects[i][x] = function(){};
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
223
|
}
|
224
224
|
/* add document.getElementById if needed (mobile IE < 5) */
|
225
225
|
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
|
@@ -227,4 +227,4 @@ if (!document.getElementById && document.all) { document.getElementById = functi
|
|
227
227
|
/* add some aliases for ease of use/backwards compatibility */
|
228
228
|
var getQueryParamValue = deconcept.util.getRequestParameter;
|
229
229
|
var FlashObject = deconcept.SWFObject; // for legacy support
|
230
|
-
var SWFObject = deconcept.SWFObject;
|
230
|
+
var SWFObject = deconcept.SWFObject;
|