Using block content to disable scripts
Thursday, 15. January 2009, 23:07:02
This is more of a working hack because block content works with images etc.
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:
with this:
Enjoy
EDIT: Changed it so the image alt is shown, and if there are many scripts, there is a scroll list.
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.Ruzanov # 16. January 2009, 12:52
Add address in alt? It's work.
Hmm.. Why not simple «document.getElementsByTagName('script')»?
Simon Houston # 16. January 2009, 14:01
Also getting scripts from DOM doesn't always work, eg whole page could be rewritten without script tags.
A.Ruzanov # 16. January 2009, 14:17
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 Houston # 17. January 2009, 22:40
Phred # 18. January 2009, 20:27
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.Ruzanov # 14. April 2009, 12:49
Dragon2fly # 21. August 2009, 15:36
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 Houston # 21. August 2009, 17:36
Dragon2fly # 23. August 2009, 02:40
This script is very cool! Some flash are also advertisements. Could the bar shows the link to flash, too?