Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am quite aware that javascript is just a language and there are likely no simple "animation calls" that could be instantly targeted. But I suspect that most sites that use code to do animation use similar techniques- like moving a bitmap on the screen, fading something from one level of transparency to another, or perhaps even some type of typical looping. Those types of operations might be identifiable. Or maybe even just how much CPU a site is using while a user isn't doing anything, before it triggers a javascript pause or something.
As for "just don't go there"- unfortunately, I can't control what websites my users need to use, nor can I control what those websites do. Other sites we can't avoid, because we *have* to use them, since they are part of normal business.
It isn't just because we use thin clients. Others could benefit from some type of control over animation too. Not only can animation be very annoying, but, for example, on laptops or handhelds it can noticeably drain the battery through lots of additional CPU load.
Well, still not much good to report. Time goes by and more and more and more sites find that they just HAVE to add all kinds of strange and annoying animation to their sites.
I keep hoping for some new addon to come along that will somehow monitor for animation and stop it. I was thinking one way would be to monitor for scripts that are active or in sleep loops and target those.... since most animation I have seen does something (like scroll or fade, wait, then do it again, over and over again). Another useful technique would be to monitor for script that are using more than X amount of CPU and zap those... but I doubt the browser will have access to that type of info. Yet another thing that would be helpful is to suspect scripts when the window or tab doesn't have focus.
In the meantime, I have found this simple addon that does help some:
It is called "JS Switch". It does nothing but add a "JS" icon on the taskbar or status bar. One click and all javascript is instantly disabled or re-enabled. Unfortunately, it affects all tabs and windows. Also unfortunately, the existing scripts do not restart when you re-enable javascript again, requiring a page reload (although sometimes it is nice- you can just double click on "JS" and it disables then re-enables, stopping most animation and you don't have to remember to turn it back on again)
But, it is an immediate way to stop those extremely annoying pages with movement. The Noscript addon remains a 1,000 pound gorilla, which I find creates more problems than it solves (for me).
Funny you bring this up today. I just installed a Firefox add-on that is supposed to target certain javascript actions, which it does, just not the actions I need. It's Controle de Scripts.
What we need is an add-on that you can copy js commands from the View Source pane, enter the URL and block that specific script.
I know nothing about developing XPIs, so maybe I can suggest this to FF developers as building into FF.
I went to newspaper site (statesman.com) where they have a js image rotator. I can turn it off with NoScript, but of course, that blocks other text content that for whatever reason requires js just to be visible.
So I used AdBlock Plus to get rid of the div that contained the rotating images. Problem is, it also got rid of the underlying headlines associated with those images.
That's why we need something to selectively block js, or at least change the timing sequences from four seconds to two minutes.
I tried "Controle de Scripts" and found it to be pretty much useless for what I need to do.
I doubt it would be built into FF, it would probably always be in the addon type category. I would make suggestions to "them" to, but I don't know where or really to whom. Except maybe to the developers of something SIMILAR, like Noscript.
Glenn, can you elaborate on how "Base second level domains" can stop animations?
I spent some time trying to figure out Greasemonkey. I've not been able to make it work. Here's a selection of animation code that rotates headlines on our newspaper site www.statesman.com.
I've tried and tried to get Greasemonkey to block it and have yet to get it to work. I've even tried replacing the delay time with 400000 (400 seconds) to no avail. Any help from those who know scripting will be very much appreciated.
<script type="text/javascript">
function theRotator() {
theInterval = null;
delay = 4000; // 4 seconds
//Set the opacity of all images to 0
jQuery('div#imageRotator ul li').css({opacity: 0.0});
jQuery('div#tabRotator ul li').addClass('off');
//Get the first image and display it (gets set to full opacity)
jQuery('div#imageRotator ul li:first').css({opacity: 1.0});
jQuery('div#tabRotator ul li:first').addClass('show');
//Call the rotator function to run the slideshow
theInterval = setInterval('rotate()',delay);
};
jQuery('#tabRotator').hover(function() {
stopSlideShow();
}, function() {
startSlideShow();
});
jQuery('#imageRotator').hover(function() {
stopSlideShow();
}, function() {
startSlideShow();
});
function stopSlideShow() {
if(theInterval) clearInterval(theInterval);
hoverTabs();
};
I, too, would be interested. About the only thing I think might be something that could be effectively and generically targeted to stop most animation without overly interfering with other code that makes forms and selectors and such work, is to find sleeps within loops. But how to find and modify such things?
I can almost guarantee there is no code I want running on MY browser that has a loop with a sleep in it- it guarantees that it will be doing something over and over again, consuming CPU time, slowing down the browser, probably facilitating movement on the screen, fadein/out transitions, and/or reloading objects. A "kill javascript animations" addon using this technique might be the ticket.... something that finds such sleeps, replaces them with extremely long values, and pops up an icon on the status bar letting the user know it was zapped and to click on it to restore the original code.
This would be EXTREMELY useful for people who are annoyed by animation, are using slower machines, are using remote machines, or are trying to use thin clients.
Glenn, I am afraid that wouldn't help much. Would likely break javascript that is necessary for the site coming from other areas of the site. Adblock will take care of most of the rest.
I was thinking about it some more and ran some tests and I think I found a pretty good concept. Something that doesn't require any configuration or management and with a very low probability of breaking anything...
It is based on the "JS Switch" addon. If you load a page, and then click on JS twice, it will stop any running scripts (and that is mostly animation loops), then enable scripts to run again right afterward. After restarting javascript, the code causing the animation will not restart (which is good), unless a roll-over brings that back to life. I tested this on many sites and it seems to work 100% of the time without breaking anything of value.
If that were combined with the ability to also stop running scripts when the browser window loses focus, it would be even more powerful (since a rollover or self-reload might activate a running script again).
This method can be done without it needing to inspect or or modify any of the javascript code, it just has to know when the page has finished loading so it can deactivate and reactivate javascript (and for the second part, know when the window loses focus).
What do you think? Pros? Cons?
EDIT: I found that perhaps my stop/start thing doesn't work on as many sites as I thought.... but not sure why
Last edited by crxssi; 02-11-2010 at 10:31 PM.
Reason: new info
cons, any connected user would have to know what you know to make it usable network wide.
Because it requires "live" user intervention. So It would (probably) not be used by normal users who don't care about your networking loads and/or costs.
<edit>
In my experience, most, but not all adds, come from links to the web page from outside the domain of the viewed webpage,
noscript allows me to trial these links, and block (temporarily or/and then after inspection permanently) those specific add links.
</edit>
cheers, and all the best, Glenn
Last edited by GlennsPref; 02-11-2010 at 10:05 PM.
Reason: edit
I learned something about NoScript. First, I already used it to block a div that contained the offending javascript elements. Problem is, it blocked all the content in that div that I'd like to see static, not moving.
So I disabled that filter and opened up the list of blockable items in NoScript. I found several scripts that could be blocked, which included the offending material. It worked, causing the moving material to remain on the page as static material, which is better than just blocking the whole div. The problem is, when I block one, it automatically blocks others (four total) in that category, so there is other content that is blocked that I don't want blocked. It's beyond me why a web developer would use JS to simply display a block of text.
I think we're getting closer to understanding what it would take. Part if it may be getting to know the capabilities of existing extensions. It would help if such solutions were compiled all in one place that can be easily searched. I'm having a devil of a time getting Greasemonkey to work with this.
Just gotta BMG a bit again... First, a few days ago I notice the main (thin client) server at work being pegged all day and not sure why. Well, it was Google's attempt at humor with their (now famous) very annoying PacMan banner crap.
Months ago Office Depot added one of those annoying full width animated scroller things on their home page (so did CDW and lots of other sites), and I start getting complaints from users "why is the Office Depot site so incredibly slow?".
They just added "Featured Apps" section on the right, and it is on EVERY PAGE of the site. Constant smooth animation. 1/2 of my home CPU is completely consumed by that crap and I can find no way to block it. And so distracting, just to read the articles, I had to resort to resizing the window to the size of the text column on the left.
First we had animated GIF's- extremely annoying, easily blocked.
Then we had animated Flash banners- extremely annoying, uses lots of CPU,
easily blocked with Flashblock or whatnot.
It would appear that all this crappy AJAX/2.0/javascript/whatever animation crap is the 2010 version of animated GIF's, with the bonus of being nearly impossible to block and using 10,000 times more CPU.
why not use ad block and no-script
they get ride of 99% of them .now some sites do need "java-script" running to work ( you get a " we are sorry but no-script was detected" page
why not use ad block and no-script
they get ride of 99% of them .now some sites do need "java-script" running to work ( you get a " we are sorry but no-script was detected" page
See the rest of the thread... I do use adblock, No-script I have tried before and it really is a nightmare. Sites rely on Javascript for just about everything now. Plus they keep changing. About the only thing that is going to work is a plugin/addon that has some type of loop detection and disablement.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.