Martin Kadlec blogging

AdBlock

I quite liked AdBlock from Lex1 (http://my.opera.com/Lex1/blog/adblock-for-opera-analogue-of-adblock-plus-element-hiding-helper). But in my opinion it's really hard to make any changes here. So I created my own version of this AdBlock with upgraded "Edit Options".

Here is the user script: http://files.myopera.com/BS-Harou/files/AdBlock2.0.js

How it looks like:


In case you want have AdBlock in Right Click Context Menu, go to Preferences>Advanced>Toolbars and duplicate "Menu setup". Than go in windows to [Profile]/Application Data/Opera/[version of opera]/menu and open "standard_menu (1).ini"

Find there [Document Popup Menu] and Add this:
Submenu, "AdBlock", AdBlock Menu

And than you have to create this menu:
[AdBlock Menu]
Item, "Block"="Go to page, "javascript:window.navigator.ujs_adblock.block()",,,"Blank""
Item, "Unblock Last"="Go to page, "javascript:window.navigator.ujs_adblock.unblock(true)",,,"Blank""
Item, "Unblock All"="Go to page, "javascript:window.navigator.ujs_adblock.unblock()",,,"Blank""
Item, "Edit"="Go to page, "javascript:window.navigator.ujs_adblock.edit()",,,"Blank""

Comments
Please login to post comments.
Avatar
29.07.2010 13:07
A couple more suggestions>

Blocking:
1. Clicking button "Block"
2. Hold down CTRL and marking elements to hide...
3. Pressed ESC and all marked items disappeared ...

Unlocking:
1. Clicking "Unblock"
2. Hold down CTRL marking elements to unblock without the need each time you click "Unblock"
3. Press ESC and went out of mode unlock
Avatar
29.07.2010 11:07
okey dokey =)
Avatar
29.07.2010 08:07
in Lex1's version there're two block actions:
1. ujs_adblock.block (true)
2. ujs_adblock.block ()

#1 blocks elements block elements
#2 blocks elements block elements, use :nth-child

When you blocking element (without using :nth-child), all the items falling under the rule are highlighted.

There's no confirmation dialog in your version and it turns out that I'm singling out one element for blocking, and with it blocked more elements...

So, i want for when you hover on the element (ujs_adblock.block (true)) to provide all the elements that will be blocked

thnx
Avatar
28.07.2010 13:07
Thanks for your feedback. Unfortunately I don't have much time now... But I know there is lots of things that should be done about this userJS, so perhaps I will one day make some updates =)

BTW I don't get what do you mean in point one, can you please reformulated it? Thank you =)
Avatar
28.07.2010 11:07

With original script you can always block only one element and then you had to click on "Block" or use "ALT+SHIFT+B" again to block another.



Excellent!
That I really did not have enough in the version Lex1

But there are downsides - in your version there is no point
Item, "Block" = "Go to page," javascript: window.navigator.ujs_adblock.block (true )",,," Blank ""
and it is not very convenient because those blocks that can be locked with a single click - accounted for one block (I block 5, and tomorrow will be 6-th)

It is understandable that you specifically it was removed so that the user does not accidentally blocked all the content, but nevertheless it is convenient, so that>

Feedback + Suggestions
1. Item, "Block" = "Go to page," javascript: window.navigator.ujs_adblock.block (true )",,," Blank "" when you move immediately to show what other elements fall under the rule;
2. Make a window to moveable (like http://ruzanow.ru/userjs/google-translate.js) and when you click on the rule displayed blocked element
3. The rules do not fit in the window + make nicer and neat this window
Avatar
26.03.2010 10:03

Originally posted by rolandb313:

Where do we find this option? Couldn't find it in opera:config nor Advanced Preferences.


Go to menu bar Tools/Delete private data

Avatar
26.03.2010 09:03

Originally posted by BS-Harou:

It's not possible, I recommend you to have unchecked "Delete Web Storage databases" =)

Where do we find this option? Couldn't find it in opera:config nor Advanced Preferences.

Thanks for the filestube one, but it still wouldn't work, even after refresh. It deleted the ad, but when I refreshed, it came back, and alt-shift-e showed nothing, as if I'm not able to save anything for that site.
Avatar
20.03.2010 10:03

Originally posted by ZAHEK:

Can we change locastorage file path for a spesific web site not t odelete it when we deleted our private information..



It's not possible, I recommend you to have unchecked "Delete Web Storage databases" =)


Originally posted by rolandb313:

ctrl-shift-e showed 2 different things being blocked as being the same


Try to delete them in the alt+shift+e dialog, click on add and create your own. Sometimes the best options is to ADD just something simple like: DIV[id="advert"]
Avatar
20.03.2010 10:03

Originally posted by rolandb313:

I can give 1 site which doesn't work:



For files tube I use this (you can put it in by insert button in alt+shift+e dialog):

A[href="http://www.filestube.com/helpus.html"],IMG[src="http://static.filestube.com/files/images/feedback.gif"],HTML>BODY>DIV[class="content"]:nth-child(3)>DIV[id="results_box"]:nth-child(8)>DIV[class="resultadv2"]:nth-child(3),HTML>BODY>DIV[class="content"]:nth-child(3)>DIV[id="results_box"]:nth-child(8)>DIV[class="results"][id="results"]:nth-child(1)>DIV[class="other_adv2"]:nth-child(2),HTML>BODY>DIV[class="content"]:nth-child(3)>DIV:nth-child(10)


This one is working for me even after refresh =)
Avatar
19.03.2010 23:03
I can give 1 site which doesn't work:
http://www.filestube.com/search.html?q=hello&select=All

Actually, that's the main reason I asked, I wanted to do it manually since it wasn't working for some sites. Also, wanted to try identify patterns and do a wildcard block of some sort, but ctrl-shift-e showed 2 different things being blocked as being the same, so wasn't totally reliable.

Also have the problem that new things I block rarely stay blocked forever.
Avatar
19.03.2010 22:03
Can we change locastorage file path for a spesific web site not t odelete it when we deleted our private information..
Avatar
19.03.2010 16:03
z@h3k: localStorage in O10.5, cookies in O10.10

On some sites from unknown reasons it really doesn't save the advertises. Sometimes it may be caused because there is javascript in blocked element.

You can try this one http://my.opera.com/Lex1/blog/adblock-for-opera-analogue-of-adblock-plus-element-hiding-helper and if this one works and mine not, than write me please on which site! =)
Avatar
19.03.2010 15:03
Thanks. Where does it save blocking content?
And it seems when the page reload , advertises go back...
Avatar
17.03.2010 13:03
metude: thank you, I reuploaded it on my Opera. The link should be working now =)
Avatar
17.03.2010 09:03
The link is broken.

"The requested URL /jaffove/ostatni/opera/AdBlock2.0.js was not found on this server."
Avatar
13.03.2010 14:03
rolandb313: Everything is stored in the localStorage (or cookies in O10.10). But you can edit it with ALT+SHIFT+E

(sorry for late answer - I was away from PC for week)
Avatar
09.03.2010 14:03
This is awesome, but where is the css file so I can custom edit it?
Thanks!
Avatar
09.02.2010 18:02
Thats so cool!! Thanks!! And alas I dunno!!
Avatar
09.02.2010 17:02
nice one!! but after i block an element, the pointer keeps showing blue background (i mean its ready to block if i click), how can i confirm that blocking is over??
Avatar
09.02.2010 17:02
Escape key on the keyboard
Avatar
09.02.2010 17:02
With original script you can always block only one element and then you had to click on "Block" or use "ALT+SHIFT+B" again to block another. So I decided to do it this way, that you can block how many elements you want and then just press the "Esc" .. but it would be obviously good idea to create another more visible Stop blocking function. Do you have any idea how to do that?