~ubuntu-branches/ubuntu/lucid/flashblock/lucid-proposed

« back to all changes in this revision

Viewing changes to chrome/flashblock.jar!/content/flashblock/flashblock.xml

  • Committer: Bazaar Package Importer
  • Author(s): Alexander GQ Gerasiov
  • Date: 2009-11-30 01:21:27 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091130012127-ngxo3jqkddn3smi1
Tags: 1.5.11-2
* Fixed typo in debian/copyright.
* Using new dpkg v3 format, it rocks.
* Package description updated (taken from extension's homepage).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
 
 
3
<bindings
 
4
   xmlns="http://www.mozilla.org/xbl"
 
5
   xmlns:html="http://www.w3.org/1999/xhtml"
 
6
>
 
7
 
 
8
<binding id="flash">
 
9
  <implementation>
 
10
    <constructor>
 
11
        <![CDATA[
 
12
 
 
13
//From Jesse's XPCNativeWrapper: http://mavra.perilith.com/~luser/content/native.js
 
14
function nativeMethod(untrustedObject, methodName)
 
15
{
 
16
  // happier stack traces and faster multiple calls
 
17
  var fun = Components.lookupMethod(untrustedObject, methodName);
 
18
  
 
19
  return function()
 
20
  {
 
21
    return fun.apply(untrustedObject, arguments);
 
22
  }
 
23
}
 
24
 
 
25
function flashblockCreatePlaceholder(isStandalone) {
 
26
        // Create placeholder
 
27
        var flashblockCreateElement = nativeMethod(document, "createElementNS");
 
28
        var placeholder = flashblockCreateElement("http://www.w3.org/1999/xhtml", "div");
 
29
        placeholder.isStandalone = isStandalone;
 
30
        return placeholder;
 
31
}
 
32
 
 
33
// Substitute the animation with a placeholder
 
34
function flashblockShowPlaceholder() {
 
35
        // Just in case the object has been moved away from under our feet during
 
36
        // the timeout, re-assign the parent node. See bug 13680
 
37
        // parent = current.parentNode;
 
38
        var newParent = current.parentNode;
 
39
        parent = newParent ? newParent : parent;
 
40
        parent.insertBefore(placeholder, current);
 
41
        if(placeholder.isStandalone) {
 
42
                placeholder.flashblock = "frame";
 
43
                if ("StopPlay" in current)
 
44
                        current.StopPlay();
 
45
                if ("LoadMovie" in current)
 
46
                        current.LoadMovie(0, "");
 
47
                current.prevWidth = current.width;
 
48
                current.prevHeight = current.height;
 
49
                current.width = current.height = 0;
 
50
        } else {
 
51
                placeholder.flashblock = "normal";
 
52
                parent.removeChild(current); 
 
53
        }
 
54
}
 
55
 
 
56
// Show the original animation
 
57
function flashblockShowFlash(event) {
 
58
    if( event.type == "keypress" && event.keyCode != KeyEvent.DOM_VK_RETURN)
 
59
      return false;
 
60
        event.stopPropagation();
 
61
        if(placeholder.flashblock == "frame") {
 
62
                current.height = current.prevHeight;
 
63
                current.width = current.prevWidth;
 
64
                current.src = placeholder.title;
 
65
                if ("LoadMovie" in current)
 
66
                        current.LoadMovie(0, current.src);
 
67
        } else {
 
68
                parent.insertBefore(current, placeholder);
 
69
                if (placeholder.hasAttribute("srcAttribute")) {
 
70
                        current.setAttribute("src", placeholder.getAttribute("srcAttribute"));
 
71
                }
 
72
                if (placeholder.hasAttribute("movieAttribute")) {
 
73
                        current.setAttribute("movie", placeholder.getAttribute("movieAttribute"));
 
74
                }
 
75
                if (placeholder.hasAttribute("dataAttribute")) {
 
76
                        current.setAttribute("data", placeholder.getAttribute("dataAttribute"));
 
77
                }
 
78
                if (placeholder.movieParam) {
 
79
                        var mparam = placeholder.movieParam;
 
80
                        mparam[0].value = mparam[1];
 
81
                }
 
82
                if (placeholder.hasAttribute("embedsrc")) {
 
83
                        var embeds = current.getElementsByTagName("embed");
 
84
                        if (embeds && embeds.length > 0) {
 
85
                                embeds[0].setAttribute("src", placeholder.getAttribute("embedsrc"));
 
86
                        }
 
87
                }
 
88
        }
 
89
        parent.removeChild(placeholder);
 
90
}
 
91
 
 
92
function flashblockIsWhitelisted() {
 
93
        // Check if the page that loaded the Flash site is whitelisted
 
94
        // Thanks to Neil on #mozilla for suggesting this method, I would never have
 
95
        // thought of it on my own. :-)
 
96
        // Lor 20041215: Use "UIEvents" to make it work in post-1.0 FF
 
97
        // (thanks to Neil again)
 
98
        var flashblockEvent = document.createEvent("UIEvents");
 
99
 
 
100
        if(flashblockEvent) {
 
101
                flashblockEvent.initEvent("flashblockCheckLoad", true, true);
 
102
                document.dispatchEvent(flashblockEvent);
 
103
                if(flashblockEvent.getPreventDefault() == true) {
 
104
                        // Whitelisted
 
105
                        return true;
 
106
                }
 
107
        }
 
108
        return false;
 
109
}
 
110
 
 
111
function flashblockSetImage(placeholder, type) {
 
112
        var inactiveurl = "url(chrome://flashblock/content/" + type + ".png) no-repeat center";
 
113
        var activeurl = "url(chrome://flashblock/content/flashplay.png) no-repeat center";
 
114
        placeholder.setAttribute("bgInactive", inactiveurl);
 
115
        placeholder.setAttribute("bgActive", activeurl);
 
116
        placeholder.style.background = inactiveurl;
 
117
}
 
118
 
 
119
function flashblockStylePlaceholder(flash, placeholder, isStandalone) {
 
120
        // If object's size was relative, use that.
 
121
        // Otherwise, set size to minimum 32x32 px
 
122
        placeholder.style.setProperty("min-width", "32px", "important");
 
123
        placeholder.style.setProperty("min-height", "32px", "important");
 
124
        // The size and positioning may come from a class
 
125
        var fClass = flash.getAttribute("class");
 
126
        if (fClass)
 
127
                placeholder.setAttribute("class", fClass);
 
128
 
 
129
        var fStyle = window.getComputedStyle(flash, "");
 
130
 
 
131
        var fWidth = fStyle.getPropertyValue("width");
 
132
        var width = parseInt(flash.width || flash.style.width);
 
133
        if (fWidth && parseInt(fWidth) > 32)
 
134
                width = fWidth;
 
135
        else if(flash.width.match("%$"))
 
136
                width = flash.width;
 
137
        else if (width)
 
138
                        width = Math.max(width,32) + "px";
 
139
        else
 
140
                width = "32px"
 
141
        placeholder.style.width = width;
 
142
 
 
143
        var fHeight = fStyle.getPropertyValue("height");
 
144
        var height = parseInt(flash.height || flash.style.height);
 
145
        if (fHeight && parseInt(fHeight) > 32)
 
146
                height = fHeight;
 
147
        else if(flash.height.match("%$"))
 
148
                height = flash.height;
 
149
        else if (height)
 
150
                height = Math.max(height,32) + "px";
 
151
        else 
 
152
                height = "32px"
 
153
        placeholder.style.height = height;
 
154
 
 
155
        // Add styling rules to placeholder div.
 
156
        placeholder.style.border = "1px solid #dfdfdf";
 
157
        placeholder.style.cursor = "pointer";
 
158
        placeholder.style.overflow = "hidden";
 
159
        var disp = fStyle.getPropertyValue("display");
 
160
        placeholder.style.display = disp == "block" ? "block" : "inline-block";
 
161
        placeholder.style.setProperty("visibility", "visible", "important");
 
162
 
 
163
        // The size of the placeholder should include borders too,
 
164
        // otherwise scrollbars appear for blocked standalone objects
 
165
        placeholder.style.MozBoxSizing = "border-box";
 
166
 
 
167
        // Make some style adjustments since the placeholder is a <div>
 
168
        // element instead of a <embed>, <object>, ... element.
 
169
        // An <embed> will be centered if the parent has
 
170
        // 'text-align: center' but a <div> will not. This code fixes that.
 
171
        var parentStyle = window.getComputedStyle(flash.parentNode, "");
 
172
        if (parentStyle.getPropertyValue("text-align") == "center") {
 
173
                placeholder.style.marginRight = "auto";
 
174
                placeholder.style.marginLeft = "auto";
 
175
        }
 
176
}
 
177
 
 
178
function flashblockSetTitle(current, placeholder, isStandalone) {
 
179
        // non-null "about:blank" value to prevent OS/2 crashing
 
180
        var fakeURI = "about:blank";
 
181
        if (isStandalone) {
 
182
                placeholder.title = current.src;
 
183
                current.src = fakeURI;
 
184
        }
 
185
        else if (current.hasAttribute("src") ||
 
186
                        current.hasAttribute("data") ||
 
187
                        current.hasAttribute("movie") ) {
 
188
                var srcURI = current.getAttribute("src") ||
 
189
                        current.getAttribute("movie") ||
 
190
                        current.getAttribute("data") ;
 
191
                placeholder.title = srcURI;
 
192
                if (current.hasAttribute("src")) {
 
193
                        placeholder.setAttribute("srcAttribute", current.getAttribute("src"));
 
194
                        current.setAttribute("src", fakeURI);
 
195
                }
 
196
                if (current.hasAttribute("data")) {
 
197
                        placeholder.setAttribute("dataAttribute", current.getAttribute("data"));
 
198
                        current.setAttribute("data", fakeURI);
 
199
                }
 
200
                if (current.hasAttribute("movie")) {
 
201
                        placeholder.setAttribute("movieAttribute", current.getAttribute("movie"));
 
202
                        current.setAttribute("movie", fakeURI);
 
203
                }
 
204
        }
 
205
        else {
 
206
                var params = current.getElementsByTagName("param");
 
207
                for (var ii = 0; ii < params.length; ii++) {
 
208
                        if (params[ii].getAttribute("name") == "movie" &&
 
209
                                params[ii].hasAttribute("value")) {
 
210
                                placeholder.title = params[ii].value;
 
211
                                placeholder.movieParam = [ params[ii], placeholder.title ];
 
212
                                params[ii].value = fakeURI;
 
213
                                break;
 
214
                        }
 
215
                }
 
216
        }
 
217
}
 
218
 
 
219
if(flashblockIsWhitelisted())
 
220
        return;
 
221
 
 
222
var current = this;
 
223
var parent = current.parentNode;
 
224
 
 
225
// Check parent too (case of working EMBED inside broken OBJECT)
 
226
if (current.overrideCTV || parentNode.overrideCTV) {
 
227
        return;
 
228
}
 
229
current.overrideCTV = true;
 
230
 
 
231
// Create placeholder div
 
232
var isStandalone = ("src" in current && current.src == current.ownerDocument.location);
 
233
var placeholder = flashblockCreatePlaceholder(isStandalone);
 
234
 
 
235
// Set placeholder image
 
236
var type = this.flashblockType ? this.flashblockType : "flash"
 
237
flashblockSetImage(placeholder, type);
 
238
 
 
239
flashblockStylePlaceholder(current, placeholder, isStandalone);
 
240
 
 
241
flashblockSetTitle(current, placeholder, isStandalone);
 
242
 
 
243
// Replace the flash document with a placeholder.
 
244
var flashblockSetTimeout = nativeMethod(window, "setTimeout");
 
245
flashblockSetTimeout(flashblockShowPlaceholder, 0);
 
246
 
 
247
// Change the placeholder background when the mouse enters/exits the div.
 
248
placeholder.addEventListener("mouseover",
 
249
function(event) { event.target.style.background = event.target.getAttribute("bgActive"); },
 
250
"false"
 
251
);
 
252
placeholder.addEventListener("mouseout",
 
253
function(event) { event.target.style.background = event.target.getAttribute("bgInactive"); },
 
254
"false"
 
255
);
 
256
 
 
257
// Replace the placeholder with the flash document.
 
258
placeholder.addEventListener("click", flashblockShowFlash, "false");
 
259
 
 
260
// Accessibility
 
261
placeholder.setAttribute("tabindex", "0");
 
262
placeholder.setAttribute("role", "button");
 
263
placeholder.addEventListener("keypress", flashblockShowFlash, "false");
 
264
 
 
265
        ]]>
 
266
    </constructor>
 
267
  </implementation>
 
268
</binding>
 
269
 
 
270
<binding id="director" extends="#flash">
 
271
  <implementation>
 
272
    <field name="flashblockType">"director"</field>
 
273
  </implementation>
 
274
</binding>
 
275
 
 
276
<binding id="authorware" extends="#flash">
 
277
  <implementation>
 
278
    <field name="flashblockType">"authorware"</field>
 
279
  </implementation>
 
280
</binding>
 
281
 
 
282
<binding id="brokenobject">
 
283
  <implementation>
 
284
 
 
285
    <field name="brokenObject">"yes"</field>
 
286
 
 
287
    <constructor>
 
288
        <![CDATA[
 
289
 
 
290
//From Jesse's XPCNativeWrapper: http://mavra.perilith.com/~luser/content/native.js
 
291
function nativeMethod(untrustedObject, methodName)
 
292
{
 
293
  // happier stack traces and faster multiple calls
 
294
  var fun = Components.lookupMethod(untrustedObject, methodName);
 
295
  
 
296
  return function()
 
297
  {
 
298
    return fun.apply(untrustedObject, arguments);
 
299
  }
 
300
}
 
301
 
 
302
function flashblockCreatePlaceholder(isStandalone) {
 
303
        // Create placeholder
 
304
        var flashblockCreateElement = nativeMethod(document, "createElementNS");
 
305
        var placeholder = flashblockCreateElement("http://www.w3.org/1999/xhtml", "div");
 
306
        placeholder.isStandalone = isStandalone;
 
307
        return placeholder;
 
308
}
 
309
 
 
310
// Substitute the animation with a placeholder
 
311
function flashblockShowPlaceholder() {
 
312
        // Just in case the object has been moved away from under our feet during
 
313
        // the timeout, re-assign the parent node. See bug 13680
 
314
        // parent = current.parentNode;
 
315
        var newParent = current.parentNode;
 
316
        parent = newParent ? newParent : parent;
 
317
        parent.insertBefore(placeholder, current);
 
318
        if(placeholder.isStandalone) {
 
319
                placeholder.flashblock = "frame";
 
320
                if ("StopPlay" in current)
 
321
                        current.StopPlay();
 
322
                if ("LoadMovie" in current)
 
323
                        current.LoadMovie(0, "");
 
324
                current.prevWidth = current.width;
 
325
                current.prevHeight = current.height;
 
326
                current.width = current.height = 0;
 
327
        } else {
 
328
                placeholder.flashblock = "normal";
 
329
                parent.removeChild(current); 
 
330
        }
 
331
}
 
332
 
 
333
// Show the original animation
 
334
function flashblockShowFlash(event) {
 
335
    if( event.type == "keypress" && event.keyCode != KeyEvent.DOM_VK_RETURN)
 
336
      return false;
 
337
        event.stopPropagation();
 
338
        if(placeholder.flashblock == "frame") {
 
339
                current.height = current.prevHeight;
 
340
                current.width = current.prevWidth;
 
341
                current.src = placeholder.title;
 
342
                if ("LoadMovie" in current)
 
343
                        current.LoadMovie(0, current.src);
 
344
        } else {
 
345
                parent.insertBefore(current, placeholder);
 
346
                if (placeholder.hasAttribute("srcAttribute")) {
 
347
                        current.setAttribute("src", placeholder.getAttribute("srcAttribute"));
 
348
                }
 
349
                if (placeholder.hasAttribute("movieAttribute")) {
 
350
                        current.setAttribute("movie", placeholder.getAttribute("movieAttribute"));
 
351
                }
 
352
                if (placeholder.hasAttribute("dataAttribute")) {
 
353
                        current.setAttribute("data", placeholder.getAttribute("dataAttribute"));
 
354
                }
 
355
                if (placeholder.movieParam) {
 
356
                        var mparam = placeholder.movieParam;
 
357
                        mparam[0].value = mparam[1];
 
358
                }
 
359
                if (placeholder.hasAttribute("embedsrc")) {
 
360
                        var embeds = current.getElementsByTagName("embed");
 
361
                        if (embeds && embeds.length > 0) {
 
362
                                embeds[0].setAttribute("src", placeholder.getAttribute("embedsrc"));
 
363
                        }
 
364
                }
 
365
        }
 
366
        parent.removeChild(placeholder);
 
367
}
 
368
 
 
369
function flashblockIsWhitelisted() {
 
370
        // Check if the page that loaded the Flash site is whitelisted
 
371
        // Thanks to Neil on #mozilla for suggesting this method, I would never have
 
372
        // thought of it on my own. :-)
 
373
        // Lor 20041215: Use "UIEvents" to make it work in post-1.0 FF
 
374
        // (thanks to Neil again)
 
375
        var flashblockEvent = document.createEvent("UIEvents");
 
376
 
 
377
        if(flashblockEvent) {
 
378
                flashblockEvent.initEvent("flashblockCheckLoad", true, true);
 
379
                document.dispatchEvent(flashblockEvent);
 
380
                if(flashblockEvent.getPreventDefault() == true) {
 
381
                        // Whitelisted
 
382
                        return true;
 
383
                }
 
384
        }
 
385
        return false;
 
386
}
 
387
 
 
388
function flashblockSetImage(placeholder, type) {
 
389
        var inactiveurl = "url(chrome://flashblock/content/" + type + ".png) no-repeat center";
 
390
        var activeurl = "url(chrome://flashblock/content/flashplay.png) no-repeat center";
 
391
        placeholder.setAttribute("bgInactive", inactiveurl);
 
392
        placeholder.setAttribute("bgActive", activeurl);
 
393
        placeholder.style.background = inactiveurl;
 
394
}
 
395
 
 
396
function flashblockStylePlaceholder(flash, placeholder, isStandalone) {
 
397
        // If object's size was relative, use that.
 
398
        // Otherwise, set size to minimum 32x32 px
 
399
        placeholder.style.setProperty("min-width", "32px", "important");
 
400
        placeholder.style.setProperty("min-height", "32px", "important");
 
401
        // The size and positioning may come from a class
 
402
        var fClass = flash.getAttribute("class");
 
403
        if (fClass)
 
404
                placeholder.setAttribute("class", fClass);
 
405
 
 
406
        var fStyle = window.getComputedStyle(flash, "");
 
407
 
 
408
        var fWidth = fStyle.getPropertyValue("width");
 
409
        var width = parseInt(flash.width || flash.style.width);
 
410
        if (fWidth && parseInt(fWidth) > 32)
 
411
                width = fWidth;
 
412
        else if(flash.width.match("%$"))
 
413
                width = flash.width;
 
414
        else if (width)
 
415
                        width = Math.max(width,32) + "px";
 
416
        else
 
417
                width = "32px"
 
418
        placeholder.style.width = width;
 
419
 
 
420
        var fHeight = fStyle.getPropertyValue("height");
 
421
        var height = parseInt(flash.height || flash.style.height);
 
422
        if (fHeight && parseInt(fHeight) > 32)
 
423
                height = fHeight;
 
424
        else if(flash.height.match("%$"))
 
425
                height = flash.height;
 
426
        else if (height)
 
427
                height = Math.max(height,32) + "px";
 
428
        else 
 
429
                height = "32px"
 
430
        placeholder.style.height = height;
 
431
 
 
432
        // Add styling rules to placeholder div.
 
433
        placeholder.style.border = "1px solid #dfdfdf";
 
434
        placeholder.style.cursor = "pointer";
 
435
        placeholder.style.overflow = "hidden";
 
436
        var disp = fStyle.getPropertyValue("display");
 
437
        placeholder.style.display = disp == "block" ? "block" : "inline-block";
 
438
        placeholder.style.setProperty("visibility", "visible", "important");
 
439
 
 
440
        // The size of the placeholder should include borders too,
 
441
        // otherwise scrollbars appear for blocked standalone objects
 
442
        placeholder.style.MozBoxSizing = "border-box";
 
443
 
 
444
        // Make some style adjustments since the placeholder is a <div>
 
445
        // element instead of a <embed>, <object>, ... element.
 
446
        // An <embed> will be centered if the parent has
 
447
        // 'text-align: center' but a <div> will not. This code fixes that.
 
448
        var parentStyle = window.getComputedStyle(flash.parentNode, "");
 
449
        if (parentStyle.getPropertyValue("text-align") == "center") {
 
450
                placeholder.style.marginRight = "auto";
 
451
                placeholder.style.marginLeft = "auto";
 
452
        }
 
453
}
 
454
 
 
455
function flashblockSetTitle(current, placeholder, isStandalone) {
 
456
        // non-null "about:blank" value to prevent OS/2 crashing
 
457
        var fakeURI = "about:blank";
 
458
        if (isStandalone) {
 
459
                placeholder.title = current.src;
 
460
                current.src = fakeURI;
 
461
        }
 
462
        else if (current.hasAttribute("src") ||
 
463
                        current.hasAttribute("data") ||
 
464
                        current.hasAttribute("movie") ) {
 
465
                var srcURI = current.getAttribute("src") ||
 
466
                        current.getAttribute("movie") ||
 
467
                        current.getAttribute("data") ;
 
468
                placeholder.title = srcURI;
 
469
                if (current.hasAttribute("src")) {
 
470
                        placeholder.setAttribute("srcAttribute", current.getAttribute("src"));
 
471
                        current.setAttribute("src", fakeURI);
 
472
                }
 
473
                if (current.hasAttribute("data")) {
 
474
                        placeholder.setAttribute("dataAttribute", current.getAttribute("data"));
 
475
                        current.setAttribute("data", fakeURI);
 
476
                }
 
477
                if (current.hasAttribute("movie")) {
 
478
                        placeholder.setAttribute("movieAttribute", current.getAttribute("movie"));
 
479
                        current.setAttribute("movie", fakeURI);
 
480
                }
 
481
        }
 
482
        else {
 
483
                var params = current.getElementsByTagName("param");
 
484
                for (var ii = 0; ii < params.length; ii++) {
 
485
                        if (params[ii].getAttribute("name") == "movie" &&
 
486
                                params[ii].hasAttribute("value")) {
 
487
                                placeholder.title = params[ii].value;
 
488
                                placeholder.movieParam = [ params[ii], placeholder.title ];
 
489
                                params[ii].value = fakeURI;
 
490
                                break;
 
491
                        }
 
492
                }
 
493
        }
 
494
}
 
495
 
 
496
if(flashblockIsWhitelisted())
 
497
        return;
 
498
 
 
499
var current = this;
 
500
var parent = current.parentNode;
 
501
 
 
502
// Check parent too (case of working EMBED inside broken OBJECT)
 
503
if (current.overrideCTV || parentNode.overrideCTV) {
 
504
        return;
 
505
}
 
506
current.overrideCTV = true;
 
507
 
 
508
var params = this.getElementsByTagName("param");
 
509
var isFlash = false;
 
510
for (var ii = 0; ii < params.length; ii++) {
 
511
        var pvalue = params[ii].getAttribute("value");
 
512
        if (/\.swf/i.test(pvalue)) {
 
513
                isFlash = true;
 
514
                break;
 
515
        }
 
516
}
 
517
var embeds = this.getElementsByTagName("embed");
 
518
for (var jj = 0; jj < embeds.length; jj++) {
 
519
        var embed = embeds[jj];
 
520
        if (/x-shockwave-flash/i.test(embed.getAttribute("type")) ||
 
521
                /\.swf/i.test(embed.getAttribute("src"))) {
 
522
                isFlash = true;
 
523
                break;
 
524
        }
 
525
}
 
526
if (!isFlash) {return;}
 
527
 
 
528
// Create placeholder div
 
529
var isStandalone = ("src" in current && current.src == current.ownerDocument.location);
 
530
var placeholder = flashblockCreatePlaceholder(isStandalone);
 
531
 
 
532
// Set placeholder image
 
533
var type = this.flashblockType ? this.flashblockType : "flash"
 
534
flashblockSetImage(placeholder, type);
 
535
 
 
536
flashblockStylePlaceholder(current, placeholder, isStandalone);
 
537
 
 
538
flashblockSetTitle(current, placeholder, isStandalone);
 
539
 
 
540
// Replace the flash document with a placeholder.
 
541
var flashblockSetTimeout = nativeMethod(window, "setTimeout");
 
542
flashblockSetTimeout(flashblockShowPlaceholder, 0);
 
543
 
 
544
// Change the placeholder background when the mouse enters/exits the div.
 
545
placeholder.addEventListener("mouseover",
 
546
function(event) { event.target.style.background = event.target.getAttribute("bgActive"); },
 
547
"false"
 
548
);
 
549
placeholder.addEventListener("mouseout",
 
550
function(event) { event.target.style.background = event.target.getAttribute("bgInactive"); },
 
551
"false"
 
552
);
 
553
 
 
554
// Replace the placeholder with the flash document.
 
555
placeholder.addEventListener("click", flashblockShowFlash, "false");
 
556
 
 
557
// Accessibility
 
558
placeholder.setAttribute("tabindex", "0");
 
559
placeholder.setAttribute("role", "button");
 
560
placeholder.addEventListener("keypress", flashblockShowFlash, "false");
 
561
 
 
562
        ]]>
 
563
    </constructor>
 
564
  </implementation>
 
565
</binding>
 
566
 
 
567
<binding id="sifr-replaced">
 
568
  <implementation>
 
569
    <constructor>
 
570
        <![CDATA[
 
571
event = document.createEvent("UIEvents");
 
572
 
 
573
if(event) {
 
574
        event.initEvent("flashblockCheckLoad", true, true);
 
575
        document.dispatchEvent(event);
 
576
        if(event.getPreventDefault() == true) {
 
577
                // Whitelisted
 
578
                return;
 
579
        }
 
580
}
 
581
 
 
582
this.style.height = 0;
 
583
this.style.width = 0;
 
584
this.style.setProperty("display", "none", "important");
 
585
this.style.position ="absolute";
 
586
this.style.overflow ="hidden";
 
587
        ]]>
 
588
    </constructor>
 
589
  </implementation>
 
590
</binding>
 
591
 
 
592
<binding id="sifr-alternate">
 
593
  <implementation>
 
594
    <constructor>
 
595
        <![CDATA[
 
596
var event = document.createEvent("UIEvents");
 
597
 
 
598
if(event) {
 
599
        event.initEvent("flashblockCheckLoad", true, true);
 
600
        document.dispatchEvent(event);
 
601
        if(event.getPreventDefault() == true) {
 
602
                // Whitelisted
 
603
                return;
 
604
        }
 
605
}
 
606
 
 
607
this.style.setProperty("visibility", "visible", "important");
 
608
this.style.setProperty("display", "block", "important");
 
609
this.style.setProperty("left", "auto", "important");
 
610
this.style.setProperty("top", "auto", "important");
 
611
this.style.setProperty("height", "auto", "important");
 
612
this.style.setProperty("width", "auto", "important");
 
613
//this.style.position = "static";
 
614
        ]]>
 
615
    </constructor>
 
616
  </implementation>
 
617
</binding>
 
618
 
 
619
</bindings>