Set wmode="transparent" for flash players. Please.

Subscribe to Set wmode="transparent" for flash players. Please. 10 posts, 6 voices

 
Álber User

I ·seriously· need this tweak.
I know almost nothing about userscripts, but I suspect what I'm asking would not be much difficult, so I'll just beg for some help.

I need to set wmode="transparent" for flash (mostly, YouTube & JW) players.
I've been testing it, and I just need a userscript that would add wmode="transparent" right after <embed.

Even if wmode is already set elsewhere (for example, <embed wmode="transparent" wmode="window"), it will work fine, so I'd say it's a pretty simple script.

AFAIK, the trick won't work in the proper youtube video page, because the player does not seem to be in an embed tag, but I think it would be too much to ask you to find a way to also apply wmode="transparent" there. I'd be very happy with the <embed wmode="transparent" script.

Thanks. Please help me.

 
Mikado Scriptwright

But what kind of result are you expecting? I see no difference after setting wmode="transparent".

 
Álber User

Long story short, my Firefox 3 refuses to scroll when mouse is over most Flash players (http://forums.techguy.org/all-other-software/73...).

BUT

It doesn't happen with wmode="transparent" Flash Players.
Just like that.

I've tried all the textbook troubleshooting options, during last hell of a week and a half: research the problem, try to think it through, reinstall Flash (countless times), check FF safe-mode, FF blank-profile, Portable FF, crosscheck against other browsers, write to 3 support forums, carefully check npswf32.dll registry keys, etcetera, etcetera, etcetera, etcetera, and at the end I came out empty-handed, exhausted and sick of it. Really sick of it.

That simple script would be a dirty, tricky, ugly way to patch it, I know, but it would really help me for the time being, until <strike> a magic fairy comes down to my PC and</strike> I manage to find a real solution for that.

That's why I'm asking here instead of trying to reverse-engineer YT userscripts and make it myself without bothering anyone: I just can't. I have to ´get it out of my mind. I ·seriously· need this tweak.

 
znerp Scriptwright

I've not tested it, but if you just want it after every embed, then this should work...

embeds = document.getElementsByTagName("embed")
for (i = 0; i < embeds.length; i++)
  embeds[i].setAttribute("wmode", "transparent")

 
Álber User

Thank you, Znerp, but sadly it doesn't seem to work like I expected.

I am testing it with http://htmlsandbox.com: I add the script after an embed code, and it works as it should. The wmode is transparent, and I can scroll it with the mouse wheel.

But for some reason it clashes with @import url styles, which seem to be heavily used in Blogger. It's not the only thing that makes the code not work in the real websites I've tested -I have been all these hours trying to isolate the sources of error, rather unsuccessfully-, but, bottom line, there are many pages where it doesn't make visible changes.

...But, even on those cases, if I just write wmode="transparent" after <embed, any problem disappears... Which makes me wonder if there may be some way to just append one after the other... Maybe with regex and some kind of replace? I don't know how Greasemonkey works, and I have no idea about Javascript commands, so I'm not sure if that's possibe, and if it would work better.

Thank you very much anyway.

 
Mikado Scriptwright

Almost direct copy-paste from another thread:

for (var ems = document.embeds, i = 0, em; em = ems[i]; i++) {
	em.setAttribute('wmode', 'transparent');
	var nx = em.nextSibling, pn = em.parentNode;
	pn.removeChild(em);
	pn.insertBefore(em, nx);
}

Tried it on YT. In my ff2 it only makes sense when embed is focused: until I click the player I can scroll with cursor over it without any wmode set.

Sadly this trick doesn't allow keyboard shortcuts to work: I hate having to click outside of flash before ctrl+w`ing the tab.

 
Álber User

¡FUNCIONA!¡¡¡¡FUNCIONAAA!!!
(IT WORKS! IT WORKKKS!!!!!!)

Oh my God! Oh my God! I'm! I'm! I'm gonna do the Dance of The Ultimate Victory now.
It's perfect. I can scroll now.
I.. Wow. Thank you.
I can scroll.
I'm so happy. Thanks.

PS: It even works in Youtube.com. Dancing again.

 
itsjareds Scriptwright

Lol. Difference made.

 
twb User

I believe this is a very common problem (I have it, Vista, Firefox 3.0.3), and this is the only place I've found anyone claiming to have a solution. At first I couldn't get it to work, probably because I never used Greasemonkey before deciding to try this solution.

But I educated myself a bit about script syntax, and I finally got it working. Here's the complete script that seems to work for me, in case any other newbies are trying to install it but (like me a few minutes ago) don't even realize that you have to expand the command into a function:

// ==UserScript==
// @name           scroll_flash
// @namespace      http://userscripts.org/forums/2/topics/3090#posts-15687
// ==/UserScript==

(function() {
for (var ems = document.embeds, i = 0, em; em = ems[i]; i++) {
	em.setAttribute('wmode', 'transparent');
	var nx = em.nextSibling, pn = em.parentNode;
	pn.removeChild(em);
	pn.insertBefore(em, nx);
}
}) ();

 
JoeSimmons Scriptwright

// ==UserScript==
// @name           Wmode transparent
// @namespace      http://userscripts.org/users/23652
// @description    Wmode transparent
// @include        *
// ==/UserScript==

var i, e, newE, embeds = document.evaluate("//embed",document,null,6,null);

for(i=0; i<embeds.snapshotLength; i++) {
e=embeds.snapshotItem(i);
newE = e.cloneNode(true);
newE.setAttribute('wmode', 'transparent');
e.parentNode.replaceChild(newE, e);
}