Sign up | Lost password? | Help

[ advanced search ]

BlockIt, the User Javascript answer to NoScript

Forums » Opera Community » General Opera topics » User JavaScript


Go to last post

Sunday, 6. July 2008, 00:59:59

shoust

Operaised

avatar

Posts: 3013

United Kingdom

BlockIt, the User Javascript answer to NoScript

This is a userjs that almost mimics NoScript, but does one better!
NoScript is a firefox extension that allows selective blocking and unblocking of external scripts on the page which is its basics.
But when compared to my script, mine allows selective blocking and unblocking of Images, Iframes, and Embedded content on the page!

There is documentation of my script available here , which is probably better explained than here.

Enjoy :smile:

BlockIt.js

Some of you might notice that this is similar to a previous script I made, it is, it was called "Ultimate Blockage", but I've renamed it and reversed the blocking/unblocking process too, and now the old version of it lies hidden deep within the depths of this thread. :ninja:

Sunday, 6. July 2008, 09:45:26 (edited)

rfudk

Godlike!

avatar

Posts: 114

Denmark

Thanks dude, i'll grap it! I'll be back later :smile:

Is there a way to remove the imageblocking? Its kinda anoying on some sites (tested on facebook). I't could maybe be done by making it like modules? Well, i hope you could change/edit that. I rather use the build-in blocker in Opera for that.

*edit* Tried the script ofr some time now, its rocking!

Sunday, 6. July 2008, 23:59:43

shoust

Operaised

avatar

Posts: 3013

United Kingdom

Updated the script a little bit. Download from same location

Changelog: Fixed a bug where the the UI won't show properly if no scripts are in the page.
Added "imgblockIt","mediablockIt" and "iframeblockIt" variables to the script, allows blocking of images, media or iframes to be turned off altogether respectively.

Monday, 7. July 2008, 20:20:24

rfudk

Godlike!

avatar

Posts: 114

Denmark

Just one word to say mate:

THANKS!

Nice with the new update, i really love this script, its helping me alot!

Monday, 7. July 2008, 22:46:25

shoust

Operaised

avatar

Posts: 3013

United Kingdom

Updated the script a bit more. Download from same location

Changelog:
Speeded up blocking of elements in the page a bit. So images should disappear quicker.
Added detection so the script doesn't run on images or text files.
Removed some redundant code.
Tidied up a bit of the CSS in the file, overall the file should be a bit smaller now.

Tuesday, 8. July 2008, 13:31:38

shoust
On this page, "button" created by BlockIt.js looks not very much correctly.

Tuesday, 8. July 2008, 22:23:21 (edited)

Sk0l

avatar

Posts: 346

shoust, can you adjust for work together with Google Translation in tooltip?

Wednesday, 9. July 2008, 00:48:58

shoust

Operaised

avatar

Posts: 3013

United Kingdom

Updated the script a bit more. Download from same location

Changelog:
A little further tweaking so elements are blocked a little faster.
Now the UserInterface has a more prominent style, which fixes the styling problem on Lex1's page.
New feature, if Alt key is held while clicking on either "block/unblock", "all", or "server" settings aren't written to cookie, that is so you can view an element in the page quickly without the sometimes needless cookies.

Wednesday, 9. July 2008, 06:04:11

Really nice script. Thanx alot!:up:

Wednesday, 9. July 2008, 14:21:23 (edited)

Jammet

avatar

Posts: 87

Thank you for this very nice script! =)

edit:

I'm sorry, but after using this for several hours I have to admit - again - that I am obviously too stupid a user to use this. Even with the help page you have provided. I don't know who wrote it or made it, but even after reading it three times over I don't get it.

Could you enable tooltips with useful information for the popup buttons? I keep having to look up which meta key does what.

Or could you restructure that popup gui so it is more intuitive?

Give people an option so they can hide/disable stuff that is on the same server as well, selectively (the second number in the "(3,7)" indicator?

And generally be clear about what will happen when I click Unblock, or Block? (Because ... sometimes when something is selected and the button is showing me "Unblock" I can still see the element in the page, and vice versa. It confuses me to no end.)

I'd rather have really long tooltip helptexts or another help button readily available instead having to return to the tutorial bookmark.

Sorry for probably sounding so negative, I do not mean to :smile:. Your work is very very much appreciated! It's just .. I've fiddled with tech and computer stuff for years on end, compiled gazillions of programs after editing countless Makefiles, I can do the Rock'n Roll while building a Linux from scratch by now, but I am too stupid to use this? It bothers me.

I have gallery pages with thumpnails I can't see, I fail to set things up so I can see thumpnails in youtube either. Even with your tutorial (Ctrl+Server. When I did that, the lil' thumpnails showed up, but now - sometimes they're there, but only for half a second before they are wiped off the screen again. It's like the script never deletes prefs and only stacks them up and does *everything* in the stock, one by one.

For now, I'm going back to the older version of your script that only disables javascripts I don't want. But I will come back to read up on what's happening. Perhaps try again.

Wednesday, 9. July 2008, 14:21:10

rfudk

Godlike!

avatar

Posts: 114

Denmark

Well, I dont think its fair that you critisize so much, maybe you really are to stupid for this great tool then? Sorry to say. I can't see how it could be more documented than it allready is? I've been using this from day 1, never had a single problem! Well, that was not to be harsch! Sorry.

Originally posted by Jammet:

I have gallery pages with thumpnails I can't see, I fail to set things up so I can see thumpnails in youtube either. Sometimes they're there, but when I reload the page they are gone again. I'm going back to the older version of your script that only disables javascripts I don't want.

You could set imgblockIt to false in the script, just like you can set iframeblockIt and mediablockIt to false also. If you do like this:
    var imgblockIt = false;
    var iframeblockIt = false;
    var mediablockIt = false;
that will only block javascript, but its a shame, its a great tool. Can you give out some more examples were it fucks up for you? I will love to help you dude, thats why were here :raider:

Wednesday, 9. July 2008, 14:53:15 (edited)

Jammet

avatar

Posts: 87

Originally posted by rfudk:

Well, I dont think its fair that you critisize so much, maybe you really are to stupid for this great tool then? Sorry to say. I can't see how it could be more documented than it allready is? I've been using this from day 1, never had a single problem! Well, that was not to be harsch! Sorry.



Please allow me to criticise, I don't feel like I have been overly unfair. And yes, chances are that I am simply too stupid :wink:. Of course it will work fine for you if you use it from day one. Things we grow up with become second nature.

I will go over the situation again. Let's say you go to youtube and you find the page looks ... almost blank. You want the preview thumpnails at the very least.

I would normally, by intuitition assume that the "Server" button basically switches between what you describe as var imgblockIt = false / var imgblockIt = true;. Or that it simply allows even off-server images to pass and be displayed. Sorta like an On/Off switch for the mode you are in, and saves that setting for the domain you are at: in my case that's images from youtube.com.

But it works different, I couldn't quite follow the description.

Whenever I reload a page, the userjs BlockIt goes back to script unblock or block mode. Mistakenly thinking I was still in image block/unblock mode, I clicked on Ctrl+Server. Realising my mistake, I did that again, thinking that'd simply undo it. It doesn't, right? Here is probably where my intuition fails me again, because I just assumed it would correct my mistake.

I reload youtube. "This time I am going to do it right." I think, and I select Image mode first, and then click Ctrl+Server. Nothing happens. I try various combinatons .. probably saving lots of instructions into the cookies. I keep reloading, I keep deleting cookies. I keep coming back, accidentally repeating my first mistake about confusing Script mode with Image mode a few times. By now, the thumpnails show - or some of them do - for a split second before they are wiped off the screen again. By that time I am frustrated, and I give up at that point.

:wait:

I might keep the script around for blocking media, inlines and other javascripts, but I will most likely disable it managing the images, because - for me - the built in image blocker seems to do better, and that in conjuction with the good old AdBlocker.css file did work fine for several years now.

Saturday, 12. July 2008, 08:10:16

rfudk

Godlike!

avatar

Posts: 114

Denmark

Well, its not that difficult to use. The button i use most is the "server" button which unblocks all from the same "server". Just like you I disabled the imgblocker because i use the build-in. Here it works fine in Youtube, try set imgblock to false, then all the pictures should work fine? Are you sure your cookie is saved correctly? You could try send me your cookie for youtube and let me see?

Sunday, 13. July 2008, 00:34:17

Jammet

avatar

Posts: 87

Thanks for your help, I am happy about what the script can do, so no worries. It might be easy to use once you get the gist of it, but believe me, at first I was quite dumbfounded.

After disabling the image handling like I said I would (like you also have) everything works out pretty nicely. No problems anymore whatsoever.

Sunday, 13. July 2008, 07:28:17

rfudk

Godlike!

avatar

Posts: 114

Denmark

Originally posted by Jammet:

No problems anymore whatsoever.

Glad to hear that, let me know if you need futher help.

Tuesday, 15. July 2008, 13:42:51

selavi

avatar

Posts: 95

Wow, nice!

Thanks for what you've created :up:

Saturday, 19. July 2008, 20:08:56

CogitoErgoSum

avatar

Posts: 16

Excuse my ignorance, how do I specifically go about editing or changing the BlockIt file settings. Thanks in advance.


Peace & Gratitude,

CogitoErgoSum

Saturday, 19. July 2008, 20:58:44

rfudk

Godlike!

avatar

Posts: 114

Denmark

Originally posted by CogitoErgoSum:

Excuse my ignorance, how do I specifically go about editing or changing the BlockIt file settings.

Do you mean the settings we're talked about some post's up? Just open the file in a editor like notepad (i used notepad2) you could also use notepad++ .. the regular notepad always shows the file uncorrect :\

Did i misunderstand you?

Saturday, 19. July 2008, 22:17:23

CogitoErgoSum

avatar

Posts: 16

Originally posted by rfudk:

Originally posted by CogitoErgoSum:

Excuse my ignorance, how do I specifically go about editing or changing the BlockIt file settings.

Do you mean the settings we're talked about some post's up? Just open the file in a editor like notepad (i used notepad2) you could also use notepad++ .. the regular notepad always shows the file uncorrect :\

Did i misunderstand you?



Hello rfudk,

Thanks for the help. Now it is clear.


Peace & Gratitude,

CogitoErgoSum

Sunday, 20. July 2008, 05:49:00

rfudk

Godlike!

avatar

Posts: 114

Denmark

Glad I could help you CogitoErgoSum

Monday, 21. July 2008, 06:43:48

Keep updating, bro :yes:
I'd love it much :x

Monday, 21. July 2008, 17:16:42

I have notice that your script stops the customisegoogle_prefs scipt from working.

Thought you would like to know.

Saturday, 9. August 2008, 07:18:51 (edited)

flanker

avatar

Posts: 29

shoust: I'd like to thank you for your excellent work here. I offered some criticisms of your earlier approach in the other thread, and those have all been addressed by this new script. :up:

Honestly, I wasn't sure if it was possible to achieve NoScript functionality with Opera's current userJS model. I'm very happy to be back on Opera after several years. Thanks again for your hard work. I hope the Opera developers incorporate this into version 10 (or at least send you a cake!). :hat:

EDIT: I've been playing around with this for a day now, and I'm noticing that some media/scripts are still able to sneak past this userJS. For example, the media on http://www.jakeandamir.com is not blocked in Opera+BlockIt, but Firefox+NoScript stops it. Can you take a closer look at your method when you get a chance?

Sunday, 10. August 2008, 00:41:34

flanker

avatar

Posts: 29

Originally posted by flanker:

EDIT: I've been playing around with this for a day now, and I'm noticing that some media/scripts are still able to sneak past this userJS. For example, the media on http://www.jakeandamir.com is not blocked in Opera+BlockIt, but Firefox+NoScript stops it. Can you take a closer look at your method when you get a chance?



Maybe this failure is because there is no explicit blocking of <object> elements?

Wednesday, 20. August 2008, 12:19:23

cradlebin

avatar

Posts: 18

Hmm, there are some glitches on sites I tested.
For example: on www.vrtnieuws.net (Belgian news site) not all scripts and images are shown in the list. The embedded flash, which is probably triggered by a javascript (determined from a quick glance at the source, might be wrong) is also not shown in the list of blockable elements.

Apart from that, it seems nice, keep it up :smile:.

Saturday, 23. August 2008, 08:41:22

agath

avatar

Posts: 39

Any idea how to move that BlockIT icon to the status bar?

Monday, 1. September 2008, 21:37:45

badnonsense

avatar

Posts: 3

HEllO: I have read some of the above posts and I cannot find where, within my browser it shows up.

According to the file, the default location is at the bottom right corner...it doesn't show up there.

Nor does it show up when I change the location. Currently, the location is set at: var cornerposition = 2

I have gone to TOOLS>PREFS and I don't find anything there with respect to it { blockit icon} showing up.

I have the blocki.js file located in C>PROGRAM FILES>OPERA>PROFILE

I also recycled or re-started Opera several times with no apparent luck to have the BlockIt icon display anywhere in any corner.
No luck.



Monday, 1. September 2008, 23:56:50 (edited)

kslee

avatar

Posts:

@badnonsense:
First, create a folder exclusively for user js. anywhre you like if you don't have one, with any name you like, and save Blockit.js and others (if you have) to that folder. Then go to "Tool > Preferences > Advanced > Content > Javascript Options > User Javascript files > Choose" to the location of the folder. That's it. And you don't have to restart. Just reload the page and you'll see the button. Enjoy! I really like it.
If you have other tabs open before doing this, you should reload them at first.

Thank you very much! shoust.

Tuesday, 2. September 2008, 03:47:57 (edited)

badnonsense

avatar

Posts: 3

@kslee:

Thanks very much. It worked exactly as you instructed.

Though I had to restart the browser rather than refresh it. Nevertheless, the icon does show up. Thanks again. :smile:

Though I have one more question.

How does one remove the Redirection Status message that appears stating the following:

The URL was redirected to . Please click the link to go there. You can enable the automatic redirection in Preferences

I have also looked inside the prefs and can't find much, or at least I am unfamiliar with what to check or uncheck there.

Tuesday, 2. September 2008, 09:47:10

kslee

avatar

Posts:

Originally posted by badnonsense:

@kslee:
Though I had to restart the browser rather than refresh it.


Strange! It' been a long time since created my js folder so I tried a new, moving, changing folder but reloading works.
Anyway, glad to hear it's working now.

Originally posted by badnonsense:

You can enable the automatic redirection in Preferences


Tools > Preferences > Advanced > Netwok > tick 'Enable automatic redirection'



Tuesday, 2. September 2008, 22:48:13

badnonsense

avatar

Posts: 3

I believe that I do have "'Enable automatic redirection'" ticked. It only seems to happen with some websites, though. Not all.

I just wanted to say 'thank you' for your help.

Thursday, 4. September 2008, 15:04:53

selavi

avatar

Posts: 95

I tested BlockIt with these tests:

http://gemal.dk/browserspy/

And it appears that the real reason for blocking javascript is not fulfilled. All the info could still be obtained with blocking the scripts through BlockIt.


Thursday, 11. September 2008, 11:11:05

sturgess

avatar

Posts: 65

Hi started a thread about cross-site scripting and how NoScript warns and stops these exploits http://my.opera.com/community/forums/topic.dml?id=249268 Was pointed in the direction of your thread as a possible solution, have read all that is posted but can find no mention of blocking cross-site scripting. Perhaps it's me, old and feeble now alas, so if it is indeed a solution to my problem would very much like to hear from you :sherlock:

Wednesday, 24. September 2008, 12:19:58

Hy.

I like the script a lot, but i would like a version that works in the opposite way. What i mean by that is that it doesn't block anything at first and i have to select what gets blocked (as in it uses a "BlackList", not a "WhiteList" like it does now).
Is it hard to modify it that way ? maybe add a flag in the config part so you can choose which way you want it to work (block everything and you choose what to allow or allow everything and you choose what to block).

Friday, 14. November 2008, 12:24:58

Hell-o
I have trouble logging in yahoo mail. Any ideas?

Monday, 24. November 2008, 15:00:47 (edited)

moirob

I'll tell all my friends

avatar

Posts: 184

Spain

Good work.

I was just going through all your noscript.js stuff on the other posting so nice to see an up-up-up to date js. Like the Preview button as I was never sure if the defualt block was blocking anything.

[UPDATE]
Actually I have come across one problem.
On gmail I dont have any icon in the bottom corner of the page. One of the google igadgets I have set up in gmail (for remember the milk) is not showing up.
All it says at the bottom of the google gadget window is "BlockIt can't be viewed at this width"

How do I get the icon back? (It is showing up for every other website I visit excpet this.) Can I "Switch off" BlockIt for a particular website? Any other way of a work around?
I have tried using the bookmarklet you put in your documentation but same results.

I have incuded a screen shot.RtM_BlockIt_Capture.PNG

Friday, 19. December 2008, 06:21:05

Derick1023

avatar

Posts: 35

I like BlockIt but it's slowing my browser down (It's also slower than the NoScript). Is it it just me? Have you guys experience any bit of slow down after applying this User JavaScript.

Monday, 12. January 2009, 22:31:30

schonok

avatar

Posts: 1

Germany

Hello Simon

while using your script for quite a while now I had the problem that my girlfriend is not good enough in english, and so I decided to translate it for my use.

Well, almost everything was easy to find out and it works really good exept for the block/unblock toggle button. When used once it won´t change back. I translated only the a.value entries. Any idea what other part should be translated?

BTW, maybe it would be a good idea if we could have your guide to blockit in german language too. If you´re interested I could assist you
in translating it.

Cheers
thomas/schonok
www.schonok.de

Friday, 23. January 2009, 08:18:14

viewy21

avatar

Posts: 54

Originally posted by agath:

Any idea how to move that BlockIT icon to the status bar?



Nice script! I'm very much for the minimalist look though and that icon catches my eye too easily. Changing it to a button/widget would be awesome. At the very least, how do I change the icon size or the icon itself? Can I make it transparent? :D Thanks in advance for helping me out!

-Viewy

Friday, 23. January 2009, 08:36:57

viewy21

avatar

Posts: 54

Nvm on minimizing the interface, that was actually pretty easily done. :D In any case, is it possible to block certain parts of a script written explicitly in the page? i.e. block:

   if (blockedReferrer  )
      document.write ("&amp;referer=" + escape(blockedReferrer  ));


It's found inside the <body> then <script> tag of the page.

Possible? Alternatives? Any ideas?

-Viewy

Friday, 13. March 2009, 18:10:55

twl845

avatar

Posts: 88

USA

Originally posted by shoust:

This is a userjs that almost mimics NoScript, but does one better!
NoScript is a firefox extension that allows selective blocking and unblocking of external scripts on the page which is its basics.
But when compared to my script, mine allows selective blocking and unblocking of Images, Iframes, and Embedded content on the page!

There is documentation of my script available here , which is probably better explained than here.

Enjoy :smile:

BlockIt.js

Some of you might notice that this is similar to a previous script I made, it is, it was called "Ultimate Blockage", but I've renamed it and reversed the blocking/unblocking process too, and now the old version of it lies hidden deep within the depths of this thread. :ninja:

Hi, I am a new Opera user, and would like to use your Block-it. I see your instructions for using it, but don't see a place to download the app. How do I install Block-it? Thanks

Wednesday, 18. March 2009, 15:09:32

Copy BlockIt.js to userjs folder
( see Tools -> Preferences -> Advanced -> Content -> JavaScript options)

Friday, 12. June 2009, 23:10:15

browzer1

avatar

Posts: 60

Hi shoust .. thank you for Blockit. A quick question ... I noticed YOU have not posted in some time which makes me wonder why there are no updates. Firefoxs' NOSCRIPT is updated quite regularly. Or does the program not require updates?

In any case again, thank you for the work you put into this.

Harry

Saturday, 13. June 2009, 09:50:55

mine allows selective blocking and unblocking of ... Iframes


«display:none» does not block Iframes, only hides the content.

viewy21

is it possible to block certain parts of a script written explicitly in the page?


Yes, use BeforeScript.

browzer1

Firefoxs' NOSCRIPT is updated quite regularly.


1) NoScript has advanced features such as the «Anti-XSS protection» that require fairly frequent updates.
2) With each update, it shows the author's page containing the advertisement. Frequently updated -> more money :smile:

Saturday, 13. June 2009, 11:55:16

viewy21

avatar

Posts: 54

Thanks Lex1 for the tip! So, to prevent:
 if (blockedReferrer  )
      document.write ("&referer=" + escape(blockedReferrer  ));
from running, I use a user javascript file containing a BeforeScript event listener to catch it and make return a blank or render it null. I understand the concept, but I'm not sure how to add the above code into the BeforeScript syntax. Can you guys help me out on this? Thank you in advance!

-Viewy

Side note: @Lex1: Your Adblock.js is awesome! I think the 10 beta's directories have now changed and now Adblock doesnt work anymore? (or maybe I screwed something up...)

Saturday, 13. June 2009, 14:21:05

viewy21
if(location.hostname.replace(/^www\./, '') == 'site.com'){
opera.addEventListener('BeforeScript', function (e){
   if(e.element.text.indexOf('escape(blockedReferrer') != -1)e.preventDefault();
}, false);
};


10 beta's directories have now changed and now Adblock doesnt work anymore?


The installer has been updated.

Saturday, 13. June 2009, 22:49:29

viewy21

avatar

Posts: 54

Thanks of the quick reply Lex1! The BeforeScript works perfectly and fixes many sites! And you're right, the Adblock installer is updated. I think my css file became corrupted so it wasn't working. In any case, I reinstalled it and it's fine now. :smile:

-Viewy

Saturday, 11. July 2009, 21:32:16

martina14

avatar

Posts: 1

Thank you so much for this, shoust! I switched from firefox to opera a few days ago and I was looking for a noscript equivalent. Yours worked perfectly for me once I adjusted the default settings a bit: only "external scripts" and iframes are blocked by default. In my experience these two are enough to get rid of most of the "garbage" while keeping the funcionality of majority of the sites, though I needed to make use of the server button in a good number of cases, but that's not much of a hassle compared to the alternative. I'll handle unwanted images and media with opera's built-in content blocking feature (in this case it helps when you can actually see the stuff you're blocking :D ).

Tuesday, 21. July 2009, 21:37:44

operausb

avatar

Posts: 10

Some ideas, don't know what is possible:
1. A list with scripts which are always allowed. It's a little bit annoying to accept a script/server/page every and every time.
2. A button for toolbars instead the one in the corner. (Perhaps short click: show options like now; long click: show the whitelist and an option to enable/disable BlockIt completely)

Best regards

Wednesday, 22. July 2009, 08:09:59

shoust

Operaised

avatar

Posts: 3013

United Kingdom

1. Not possible with current implementation, which uses cookies.

2. Semi-possible, however there isn't a way to show options in the browser ui, or indicate if there are any scripts in the page, in operas ui

Forums » Opera Community » General Opera topics » User JavaScript