Craigslist image preview

By Jeffrey Palm Last update Aug 9, 2011 — Installed 72,351 times.

bug fix and my personal modifications

in
Subscribe to bug fix and my personal modifications 5 posts, 4 voices



dado User
FirefoxMacintosh

This is my fix for when the image has extra attributes (i.e. border) between "img" and "src".
Just modify the pattern and add "[^>]*" before "src",
e.g. /img [^>]*src=\"([^\"]+)\"/gi
The reason I didn't use .* is that some posts have multiple images on the same line and I don't think javascript supports non greedy matches.

I've also added a few modifications to suit my needs.
I'm looking for rentals an San Francisco's North Bay. There are a few towns I'm sure I don't want to move to so I've added a list of ignoredTowns and the code yanks those out of the page.

Also, some realtors include logos and other crap. I'm filtering those images out too, but I need to add to that list every now and then (i.e. requires some maintenance)

The last thing I'm still working on is to filter out over posting by some realtors.
The only consistent commonality between the posts are the images, so I'm storing their md5 and removing subsequent matches.

All this is hardcoded. I might release my fixes if/when I expose all that in the UI.
That is, if there's any interest.

 
Jeffrey Palm Script's Author
FirefoxMacintosh

Thanks a lot, I've uploaded the new version to userscripts and to my site: http://jeffpalm.com/craigslist/...thanks, again.

 
slwf User
FirefoxWindows

You missed a place when adding the regex pattern. You need to also add it to line 89.
s = s.replace(/img [^>]*src=/g,"");

I also added the space between the img and the [^ on line 73.
if (m = details.responseText.match(/img [^>]*src=\"([^\"]+)\"/gi)) {

 
Jeffrey Palm Script's Author
FirefoxMacintosh

New version is uploaded here and on my site. Thanks for the feedback, hope it's helpful for you.

 
remarkable Scriptwright
ChromeMacintosh

Can thee be an option to not show pictures with width larger than 2x the height (obvious banner ads, etc)? that way its only photographs being shown?

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