Flash blocking with user stylesheet
Saturday, November 27, 2004 1:22:19 AM
Edit 2007-04-21: outdated, doesn't work in Opera 9. Use this userscript instead.
Entrepid Opera user Fabian has created this very cool Flash-blocker. In involves nothing more than adding a few lines to your user stylesheet:
embed[type="application/x-shockwave-flash"] {content:"Flash"; outline: 1px dotted gray; color: gray; background: black}
embed[type="application/x-shockwave-flash"].zichtbaar {content: normal; outline: none}
body:before {
position: absolute; visibility: hidden;
background-image: url("javascript:(function(){window.onclick=function(){var srcElem=window.event.srcElement;var tag=srcElem.tagName;if(tag=='EMBED') srcElem.className='zichtbaar'};})()");
content:""}
This will replace Flash movies with a black area with the word Flash on it, and clicking on the area will play the Flash movie. Depending on the HTML code of the page, the replacement block might collapse dimensions. This blocker will only block display, it wil not block loading the Flash, so on clicking the Flash immediately starts playing.
Get the code from this zip to be sure you are not fooled by linebreaks:
<http://my.opera.com/forums/attachment.php?postid=744450>
Maybe I should write something about the easiest way to work with custom stylesheets. Later!
Entrepid Opera user Fabian has created this very cool Flash-blocker. In involves nothing more than adding a few lines to your user stylesheet:
embed[type="application/x-shockwave-flash"] {content:"Flash"; outline: 1px dotted gray; color: gray; background: black}
embed[type="application/x-shockwave-flash"].zichtbaar {content: normal; outline: none}
body:before {
position: absolute; visibility: hidden;
background-image: url("javascript:(function(){window.onclick=function(){var srcElem=window.event.srcElement;var tag=srcElem.tagName;if(tag=='EMBED') srcElem.className='zichtbaar'};})()");
content:""}
This will replace Flash movies with a black area with the word Flash on it, and clicking on the area will play the Flash movie. Depending on the HTML code of the page, the replacement block might collapse dimensions. This blocker will only block display, it wil not block loading the Flash, so on clicking the Flash immediately starts playing.
Get the code from this zip to be sure you are not fooled by linebreaks:
<http://my.opera.com/forums/attachment.php?postid=744450>
Maybe I should write something about the easiest way to work with custom stylesheets. Later!






Moose # Saturday, November 27, 2004 1:22:19 AM
M.
Rijk # Saturday, November 27, 2004 1:22:19 AM
If you think JavaScript is dangerous, you should disable it. It doesn't matter whether you embed the script in a document with a script element, or in a more roundabout way with a stylesheet like this.
As it *is* a rather esoteric method, I doubt it will become popular. It is used in a user stylesheet here because there is no other way to bind behavior to third-party documents. If we would have userscript support, it wouldn't be needed.
saito # Saturday, November 27, 2004 1:22:19 AM
Do they use Flash at gmail.com? I don't think so, but after comment out the lines I added, it comes to work again on 760TP3.
saito # Saturday, November 27, 2004 1:22:19 AM
For a while, till 760 Release, will try to use 'Open in Firexxx' at GMail.
Hallvord R. M. Steenhallvors # Saturday, November 27, 2004 1:22:19 AM
The JS sets window.onclick - that probably overwrites GMail's own window.onclick and breaks things. The script should use
window.addEventListener('click' , function(){var srcElem=window.event.srcElement;var tag=srcElem.tagName;if(tag=='EMBED') srcElem.className='zichtbaar'}, false)
Gspusi # Saturday, November 27, 2004 1:22:19 AM
This script does the trick, thank you. :)
kiwibird # Saturday, November 27, 2004 1:22:19 AM
kiwibird # Saturday, November 27, 2004 1:22:19 AM
embed[type="application/x-shockwave-flash"] {content:"Flash"; outline: 1px dotted gray; color: gray; background: black}
embed[type="application/x-shockwave-flash"].zichtbaar {content: normal; outline: none}
body:before {
position: absolute; visibility: hidden;
/*
background-image: url("javascript:(function(){window.onclick=function(){var srcElem=window.event.srcElement;var tag=srcElem.tagName;if(tag=='EMBED') srcElem.className='zichtbaar'};})()");
*/
background-image: url("javascript:(function(){window.addEventListener('click', function(){var srcElem=window.event.srcElement;var tag=srcElem.tagName;if(tag=='EMBED') srcElem.className='zichtbaar'}, false);})");
content:""
}
jebediah # Saturday, November 27, 2004 1:22:19 AM
background-image: url("javascript:window.addEventListener('click', function(){var srcElem=window.event.srcElement;var tag=srcElem.tagName;if(tag=='EMBED') srcElem.className='zichtbaar';}, false)");
Samuel Murray-Smitleuce # Friday, October 7, 2005 8:09:46 AM
villianvilliansv # Saturday, October 29, 2005 2:21:40 AM
embed[type="application/x-shockwave-flash"] {content:"Flash"; outline: 1px dotted gray; color: gray; background: black}
embed[type="application/x-shockwave-flash"].zichtbaar {content: normal; outline: none}
body:before {
position: absolute; visibility: hidden;
background-image: url("javascript:window.addEventListener('click', function(){var srcElem=window.event.srcElement;var tag=srcElem.tagName;if(tag=='EMBED') srcElem.className='zichtbaar';}, false)");
content:""}
pretty much the same as listed above (i changed to window.addeventlistener since i was having problems with GMail too). however, i installed the opera 9 preview and a problem appeared. when browsing the my.opera.com forums, every time a page (of these forums) loads, opera takes up 100% of the cpu for about 5 seconds. i've isolated the problem to this piece of code above (as in, removing it from my user.css file means no problems, and having it in means they exist). can anyone look into it and find a solution? thank you inadvance.
EDIT: the problem was not present under opera 8.5 with the same setup.
EDIT 2: i believe the problem can be found in the http://my.opera.com/community/js/menu.js file, which also has something like addeventlistener in it. more than that i cannot help, i never wrote 2 lines of code in my life, but perhaps someone could alter the flashblock code a little so it works again?
Unregistered user # Wednesday, December 14, 2005 4:05:27 AM
Unregistered user # Saturday, April 15, 2006 4:36:13 AM
Rijk # Saturday, April 15, 2006 4:26:35 PM
Flash can be embedded with the EMBED or OBJECT elements, where the URL to the actual flash should be visible somewhere in the source code as an attribute on or nested in (PARAM element) these elements.
TroyIII # Monday, July 7, 2008 6:07:47 AM
CAN ANYBODY - P L E A S E - TELL ME, HOW TO REMOVE THE OPERA OUTLINE FROM MY BUTTONS???
I am building a page with enhanced accessibility functions, but Opera is giving me a major headache.
Is there anyway ( Opera way ) to remove the default outlining style and especially the FOCUS navy selection color from my navigation buttons please?
Many thanks in advance.
Rijk # Monday, July 7, 2008 9:28:37 AM