LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How does Firefox Linux differ from Firefox Windows? (https://www.linuxquestions.org/questions/linux-software-2/how-does-firefox-linux-differ-from-firefox-windows-753715/)

Tom Austin 09-08-2009 09:52 PM

How does Firefox Linux differ from Firefox Windows?
 
Hi, I'm new here. I'm trying to get Firefox to allow me to selectively block javascript without blocking the whole page. I'm trying to reply to a posting on this, but as a new member I see I must post this first.

Thanks.

Tom Austin

irishbitte 09-08-2009 10:48 PM

Hi there and welcome. Most things in firefox, be it windows or linux are accomplished with add-ons, which allow you to do many things, not least of which is your question. There is an addon called NoScript listed here: http://www.makeuseof.com/tag/best-fi...y-and-privacy/ might be what you're looking for?

Tom Austin 09-09-2009 12:04 PM

Thanks, I use NoScript, and it allows blocking all or none. I want to block only certain parts of the javascript, such as javascript animations.

Surely there's a way to accomplish this?

Thanks!

Tom

GrapefruiTgirl 09-09-2009 12:13 PM

Can you be specific about the animations, and/or point us to a link where we can SEE an example of what you want to kill?

For example, I would like to know if you wish to kill animated GIF's (I don't know if these even require javascript :scratch: ). If so, there's a firefox built-in configuration option for configuring animated GIF behavior.

Also, AdBlock is more than just an adblocker -- http://adblockplus.org/en/filters shows some examples of how to use AdBlock to block other elements in webpages besides just Ads.

Sorry if I'm over/under simplifying the issue, but as I asked, an example would be great :)

Thanks,
Sasha

Tom Austin 09-09-2009 07:40 PM

Thank you for asking. Here's a perfect example:

http://eanesisd.hcms.schoolfusion.us/

Viewing source reveals the following javascript slide show that I want to disable:

<div id="slideshow"><!--start rotating image system on right-->
<script language='javascript' src='/includes/js/slideshow.js.php?bgcolor=ffffff&folder=slideshow2&defaultShow=t&sessionid=a5c969d0938912c8fbb5f9738f 240044'></script><script language='javascript'>
new fadeshow(fadeimages, 515, 196, 0, 4000, 1, "R");
</script> </div>

I've tried AdBlock, but all it will do is block the blank png file under the fill pictures. I've tried to locate the fill pictures, and I can't find them to block them individually. I've tried creating a user.js file to block it, and I can't even get that to work. (see http://www.mozilla.org/projects/secu...figPolicy.html)

NoScript blocks all or none, not selective javascript on a page.

I know there must be a way! THANKS!

Tom

GrapefruiTgirl 09-09-2009 07:52 PM

Is that the stupid image-changing thing in the top right corner?

Do this:

Open your Adblock preferences, select "Add Filter" and enter the following:

Code:

schoolfusion.us##div[id^="slideshow"]
And tell us how that works :)
Sasha

nathanpc 09-09-2009 07:54 PM

Tom Austin put the code tags!

nathanpc 09-09-2009 07:55 PM

As i know it differ in some plugins for it!

Tom Austin 09-09-2009 08:06 PM

AdBlock did it, with your help. I had no idea it was so powerful.

I had to click the icon to get to the right menu, and I added the FF extension to help identify the blockable items, though that wasn't necessary, as the slideshow pictures showed up in the list of blockable items. I would never have been able to find them myself!

Thanks for solving my problem!


Tom

GrapefruiTgirl 09-09-2009 08:10 PM

:)

No problem, happy to help.

While it can be a bit of a chore, I generally just go to "View Source" of a page, and search down to locate the type of tags surrounding the offending item. Maybe (probably) there's an easy way (like that FF extension you mention) but either way, it works out the same, though if you get good with that extension you mention, it'd probably be a few seconds job (ok, maybe 10 or 20 seconds :p ).

I think I put the link above, but I'll again put the link here for you, which is where I figured out (with some trial and error) how to make this filter and similar ones.

Adblock element filtering: http://adblockplus.org/en/filters

Happy browsing!
Sasha

Tom Austin 09-09-2009 08:21 PM

Sasha, then I read your post about the div id blocking. That works too. Question:

How did you to use brackets around the div id? The page source has this:

<div id="slideshow"> but the AdBlock rule is this: schoolfusion.us##div[id^="slideshow"]

The link you provided suggests leaving out the brackets and carat...

How did you know you didn't have to include the whole path, just school fusion? Where can I learn the syntax to use the carat and enclose in brackets? This is good stuff. Thanks again.

Tom

GrapefruiTgirl 09-09-2009 08:34 PM

The [brackets], carat, etc., comprise a "Regular Expression", otherwise commonly known as a "regex".

AdBlock allows for, and supports to a great degree, regular expressions; this allows for matching to multiple strings, which all share the matching criteria, as opposed to the default behaviour, which as you found out, tends to block in an "all or nothing" manner, which we sometimes don't want.

A basic regular expression, depending on the exact context where it's being used, is often enclosed in [brackets] or surrounded by /slashes/ like so.

In the example I gave you for that slideshow, the regex matches anything where the <div> tag's "id" section begins with "slideshow". The carat means "at the beginning of", while a $ sign means "at the end of"

I should also point out, that regex's are a very important of day to day Linux commandline activities; most/many linux commands/tools, like sed, awk, gawk, grep, and on and on, can match regular expressions for the data you feed them.

In the slideshow example, you could use:

^slidesh

and get the same result; it would block anything matching "slidesh*" regardless what came next. If you had slideshow1, slideshow2, and slideshow3, but you only wanted to see 1 & 2, you could use ^slideshow3 to block number 3.

Google up some "regular expression" tutorials, or "Bash regular expressions" for full details.

Sasha

GrapefruiTgirl 09-09-2009 08:56 PM

PS -- you had asked about the domain name too, so:

somesite.org = a domain name
hello.somesite.org = a subdomain.
food.hello.somesite.org = a sub-sub domain.

So, in the case of your slideshow thing, I chose to block the slideshow at the domain level; this means that even if the slideshow comes from any sub-domain of somesite.org, it will get blocked.

If you only wanted to block stuff from hello.somesite.org, but not from the main domain, then you would need to put that subdomain (hello) at the start of the domain path. That would block slideshows from hello.somesite.org, but NOT from somesite.org or any other subdomain other than 'hello'.

Hope that's clear :)

Sasha

Tom Austin 09-09-2009 09:35 PM

Very clear, thank you. I've learned a lot on this thread. You write well and this is an excellent welcome!

Tom

GrapefruiTgirl 09-09-2009 09:46 PM

LOL :p

I didn't even realize I had basically been addressing your other firefox thread issue, but replying in THIS thread. Heh, silly me :) and as a result I've helped you take this thread way off the original topic of "how FF differs in Win vs. Linux". So...

I'm going to ask another moderator who deals with merges and moves of threads/posts for this forum (Linux - Software), to take our posts about the regex's & javascript & AdBlocking stuff, and merge them over onto that other thread you started, where they are certainly more appropriate :) -- or maybe we'll just merge the two together, and rename it "Firefox: AdBlock javascript elements using regex" -- what do you think?

You don't have to do a thing, but if you like, hit the report button and provide a suggestion if you would like to influence how the thread(s) get merged; and sorry for the crossposting folks! ;)

Sasha


All times are GMT -5. The time now is 10:01 AM.