Haaretz Enhancer

By Lior Zur Last update Oct 11, 2008 — Installed 7,714 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 23 posts, 14 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
pagis User

Great script Lior,
I've been using it for a couple of years and it makes a huge difference. Thanks so much!
Now, with the new Haaretz website (god knows why they changed it) I have to surf TheMarker to read financial news.
Any chance you can make this work on TheMarker?

And thanks again for writing this script :)

 
dirkhaim User

Wonderful. I can scroll again! Thanks

I think Haaretz's website is a very good example of very bad programming. Nothing to be done about it.

I hope Lior will put a fix to this issue into the next version of the scripts.

 
benleevolk Scriptwright

@dirkhaim - you're right again. The problem is not a frame but a wrapping "div" element around the entire content, which for him the overflow property is set to "scroll", while the overflow property of the <body> and <html> is set to "hidden" (that's an outstanding example for poor programming). I've managed to fix it by re-constructing the DOM tree and altering the script as follows.
Insert the following block immediately after the //#### Improve main page line:

	// fix scrolling 
	contentDiv=$("content");
	for(i=contentDiv.childNodes.length-1;i>=0;i--) {
		insertAfter(contentDiv.childNodes[i], contentDiv);
		removeNode(contentDiv.childNodes[i]);
	}
	removeNode(contentDiv);
	document.body.style.overflow="auto";
	document.body.style.textAlign="-moz-center";
	htmlElement=document.getElementsByTagName("HTML");
	htmlElement[0].style.overflow="auto";

Now that's supposed to solve your problem. It might make the page load slower than usual, but a good side-effect of this fix is that it makes the "Open articles inside this page (Haaretz Enhancer feature)" checkbox visible again.

Not sure whether that's the best solution - perhaps other people will have better ideas.</html></body>

 
dirkhaim User

Thanks. That does the trick.

Now I am left with one issue in Haaretz's website. When the website loads and I want to page down with a 'space', it seems like the page is made out of a few frames with the content being in one of them. This causes a pagedown but not in the content. You can try to get to this situation by loading the website and after it loads, just press the space-bar. This one is really annoying.

I would love to see the script fixes this problem, if it's possible.

 
benleevolk Scriptwright

@dirkhaim:
The change I made was copying the following block:

//## Stop auto-refresh of the page.
//	Taken and modified from Pirateshark's http://userscripts.org/scripts/show/3587
//	who in turn took it from http://dunck.us/collab/DisableAutoRefresh
allElements = $x("//meta[@http-equiv='Refresh']|//meta[@http-equiv='refresh']|//meta[@http-equiv='REFRESH']");
allElements.forEach (function(e){
	var content = e.getAttribute("content");
	var stopTimer = window.setTimeout("window.stop();",(content-1)*1000); // in case load hasn't finished when the refresh fires
	window.addEventListener("load", function(){ try { window.clearTimeout(stopTimer); } catch(ex) {} window.stop(); }, true);
});

And moving it above the following lines:
//feature is active only inside main page + printed list articles.
if ( (isSectionPage || isMainPage) || (isCaptainMain || isCaptainSection) ){

For me, at least, it works well and doesn't cause any other bugs - but since I'm not familiar with the entire script as well as Lior I won't upload a "fixed" script and wait for him to do it. If anything get mixed up you can always restore changes by re-installing the script from this page.

 
dirkhaim User

benleevolk, any chance you can put a link to the modified version or maybe paste the diff here?

Thanks

 
benleevolk Scriptwright

Hi Lior,
A small fix: the code segment which removes the auto-refresh is within the scope of the following if statement:
if ( (isSectionPage || isMainPage) || (isCaptainMain || isCaptainSection) ), the therefore only applies for the main page and section pages, and not for article pages.
(Although one can argue there's no need for it on article pages since you can open articles in the main page, I personally like sometimes to open sole articles in seperate tabs.)
I moved the code segment on my machine from outside the scope of the if statement and now it applies for all pages on haaretz - perhaps this fix will help other uses as well.

Thanks for the wonderful script! :)

 
Matan Scriptwright

Thank you Lior, I have converted many people to greaseMonkey by showing them before and after versions of the Haaretz site. Your script makes that site so much better. A real killer app for Hebrew readers.

 
Dov User

To eliminate the frame obscuring the first talk-backs, just add www.chart.co.il to adblock as a filter.
enjoy

 
Lior Zur Script's Author

Zaphod: Excellent, thank you. I coded the script so that quick solutions like yours are easy to create, and I'm glad it works. I'll incorporate your change.

 
Zaph0d User

I've added these lines to the main block (let's say, after the end of "if (isPrintArticleList) {" block).
----Code start----
//#### Remove ads_frame
removeElements("//iframe[@id='ads_frame']");
-----Code end-----

This solves the talkback being hidden problem.

As the Blue Raja says: "Cheerio!"

 
Lior Zur Script's Author

"me": the ad you're complaining about can be eliminated using Adblock. Just set Adblock to block this iframe.

 
me User

this is very nice. can you also do something about the text ads at the bottom of haaretz articles. the ads overwrite the first few talkbacks... this is in firefox 2 on windows. thanks!

 
lycralout User

This is *so* useful. Makes the Ha'aretz site actually readable. Kol hakavod.

 
Lior Zur Script's Author

Hi Anonymous One, I appreciate your effort, but I can't understand exactly what you fixed. Why don't you e-mail me with precise details? I'm at liorzur -at- yahoo -dot- youknowwhat.

 
mar 1 Scriptwright
Sorry, I'm logged in through BugMeNot. I hope line breaks will work this time.

Here is an example article that doesn't get patched:
http://www.haaretz.co.il/hasite/spages/776414.html

I haven't noticed if all articles are like this,
or only the article above which I wanted.
I've solved this, and here is the diff:

65c65
< var reListPrintEdition = /^http:\/\/www\.haaretz\.co\.il\/hasite\/spages/;
---
> var reListPrintEdition = /^http:\/\/www\.haaretz\.co\.il\/hasite\/pages\/LiArtPE/;
215c215
< "//td[@width='280']",
---
> "//td[@width='120']",
228c228
< "//td[@width='470']|//td[@width='470']/descendant::*[@width='470']",
---
> "//td[@width='468']|//td[@width='468']/descendant::*[@width='468']",
232c232
< thisElement.setAttribute("width","760");
---
> thisElement.setAttribute("width","588");

 
mar 1 Scriptwright

Sorry, I'm logged in through BugMeNot

Here is an example article that doesn't get patched:
http://www.haaretz.co.il/hasite/spages/776414.html

I haven't noticed if all articles are like this, or only the article above which I wanted.

I've solved this, and here is the diff:

65c65
< var reListPrintEdition = /^http:\/\/www\.haaretz\.co\.il\/hasite\/spages/;
---
> var reListPrintEdition = /^http:\/\/www\.haaretz\.co\.il\/hasite\/pages\/LiArtPE/;
215c215
< "//td[@width='280']",
---
> "//td[@width='120']",
228c228
< "//td[@width='470']|//td[@width='470']/descendant::*[@width='470']",
---
> "//td[@width='468']|//td[@width='468']/descendant::*[@width='468']",
232c232
< thisElement.setAttribute("width","760");
---
> thisElement.setAttribute("width","588");

 
Yuval Hager User

This is an amazing script. It actually makes this site readable!

Very good work.

I install this on every computer I arrive, and if I get to view haaretz' site using explorer.. baah..

I think that these kind initiatives shows the power of having an extendible, open-source browser.

Yishar Koah!

 
Eyal User

Hi Lior! Thanks for the script. Works fine so far. My only problem is that the pages other than the main page are opened with wrong encoding (Hebrew Visual instead of Hebrew (Windows - 1255)), so numbers and words get a bit mixed up.
Haven't had any problems with Haaretz, by the way, with FF 1.0.7.
Keep up with the good work!

 
mishu User

Anak!!! :))
This script makes Haaretz so much nicer and easier to read! I'll spread the word ;)

by the way, the first article had this message: "Sorry, there was a problem loading the article. Please try again, or try another link. If you conclude the script has broken, report to me." All the other articles were ok!
Also, sometimes the site opens as a blank page. But again, the idea is great :)

 
Lior Zur Script's Author

Hi mishu, thanks for informing me. It seems the script wasn't compatible with the new Firefox 1.5 and its new greasemonkey. I tried to update it, and should work now. It's still in beta, so tell me of any further problems. You should note that Haaretz's site is a bit messy, so some problems in Firefox 1.5 are its own fault.

 
mishu User

Hey there, came across your script here that looks really promising- but unfortunately apart of expanding the columns of the main page, for some reason it doesn't work, and I'd love to see the outcome. the idea of reading articles in the body of the main page is great!!!
Any ideas what may be the problem? I have tried saving the script on my comp. and then opened it in the monkey (in edit) and replaced with the one I saved- still it doesn't work... :(

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel