Skip to content

Commit 9494a4c

Browse files
committed
KillWindowlessFlash:
* Add "@include *" to make this work with Scriptish, which doesn't run the script at all by default. * Reinsert a clone of the node instead of reinserting the node itself, as the latter doesn't reload Flash with the latest Firefox and Flash.
1 parent f55d4b8 commit 9494a4c

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

KillWindowlessFlash.user.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@
33
// @namespace http://www.jantrid.net/axSGrease/
44
// @description Makes windowless (transparent or opaque) Adobe Flash objects windowed so they have a chance of being accessible.
55
// @author James Teh <jamie@jantrid.net>
6-
// @copyright 2011 James Teh
6+
// @copyright 2011-2012 James Teh
77
// @license GNU General Public License version 2.0
8-
// @version 0.20111126.02
8+
// @version 0.20120709.01
9+
// @include *
910
// ==/UserScript==
1011

12+
function reloadFlash(elm) {
13+
// We need to remove the node from the document and add it again to reload Flash.
14+
// In some cases, it's not sufficient to simply replace with the same node,
15+
// as this seems to get optimised and does nothing.
16+
// Therefore, use a clone of the node.
17+
elm.parentNode.replaceChild(elm.cloneNode(), elm);
18+
}
19+
1120
function killWindowlessFlash() {
1221
// First, deal with embed elements.
1322
var elms = document.getElementsByTagName("embed");
@@ -18,9 +27,8 @@ function killWindowlessFlash() {
1827
if (elm.getAttribute("wmode") == "window")
1928
continue;
2029
elm.setAttribute("wmode", "window");
21-
// Parameters are only read when Flash is loaded,
22-
// so reinsert the element to reload it.
23-
elm.parentNode.replaceChild(elm, elm);
30+
// Parameters are only read when Flash is loaded.
31+
reloadFlash(elm);
2432
}
2533

2634
// Now, deal with object elements.
@@ -37,9 +45,8 @@ function killWindowlessFlash() {
3745
if (param.getAttribute("value") == "window")
3846
continue;
3947
param.setAttribute("value", "window");
40-
// Parameters are only read when Flash is loaded,
41-
// so reinsert the element to reload it.
42-
elm.parentNode.replaceChild(elm, elm);
48+
// Parameters are only read when Flash is loaded.
49+
reloadFlash(elm);
4350
break;
4451
}
4552
}

0 commit comments

Comments
 (0)