Using block content to disable scripts
Thursday, January 15, 2009 11:07:02 PM
I made changes to the contentblock.css file so I could include my own "bar" with script images at the top of the page.
And I made a userjs to list the scripts faked as images in that bar, so when clicking them, opera's block content feature actually blocks it.
contentblock.css
Scriptblock.js
By default, the bar is always on, as you can hover over the items to see their addresses, however its not possible for me to show the addresses before blocking them in blocked content(css hover doesn't work, neither does mouseoever/out events). So be careful what you block.
If you want the bar hidden by default, replace line 7, shown below:
scriptslist.style='display:block;position:fixed;top:0;left:0;max-height:62px;overflow:auto;background-color:beige;border:1px dotted black;width:100%;font-size:10px !important;z-index:9999 !important';
with this:
scriptslist.style='display:none;position:fixed;top:0;left:0;max-height:62px;overflow:auto;background-color:beige;border:1px dotted black;width:100%;font-size:10px !important;z-index:9999 !important';
Enjoy

EDIT: Changed it so the image alt is shown, and if there are many scripts, there is a scroll list.


A.RuzanovLex1 # Friday, January 16, 2009 12:52:36 PM
Add address in alt? It's work.
var scriptz=[]; opera.addEventListener('BeforeExternalScript',Hmm.. Why not simple «document.getElementsByTagName('script')»?
Simon Houstonshoust # Friday, January 16, 2009 2:01:34 PM
Also getting scripts from DOM doesn't always work, eg whole page could be rewritten without script tags.
A.RuzanovLex1 # Friday, January 16, 2009 2:17:19 PM
http://files.myopera.com/Lex1/files/block.png
Maybe, but this method wrong work on http://operafan.net/forum/.
On page is 5 scripts
but shows only 3.
Simon Houstonshoust # Saturday, January 17, 2009 10:40:32 PM
MyOpera team, please fix this!fearphage # Sunday, January 18, 2009 8:27:54 PM
Originally posted by shoust:
would this include css hover effects?.stuff:hover:before { content: attr(alt) }Originally posted by shoust:
BeforeExternalScript doesn't fire for blocked elements... if i remember correctly. That would explain the counts being off.A.RuzanovLex1 # Tuesday, April 14, 2009 12:49:52 PM
Dragon2flybachhoakhai # Friday, August 21, 2009 3:36:11 PM
Do I have to download contentblock.css & Scriptblock.js together?
If I have to use 2 of them, how can I install contentblock.css?
Simon Houstonshoust # Friday, August 21, 2009 5:36:09 PM
Dragon2flybachhoakhai # Sunday, August 23, 2009 2:40:27 AM
This script is very cool! Some flash are also advertisements. Could the bar shows the link to flash, too?
G.SandlerCreat0R # Tuesday, September 7, 2010 2:42:19 AM
Hi,
Can you please add a header to the script, something like that:
Because my UserJS Manager have a feature to update scripts, and this script can not be updated properly without the header (@version and @download is requierd).
Thanks.