Large

Show Just Image 2

By timendum Last update Jun 24, 2011 — Installed 298,729 times.

How Show Just Image 2 works and how to help

in
Subscribe to How Show Just Image 2 works and how to help 1 post, 1 voice

timendum Script's Author
FirefoxX11

On 11-03-2011 i re-writed some core code of Show Just Image, so now i write this post to explain how the script works now (and so what had changed, in section 5)

1 The include
This is simple, Greasemonkey requires a section, the "UserScript metadata" in which there is a line for every url where the script works.
So if you want to add a site, add a "// @include" line in alphabetic order.

2 The domain
For 99% of the sites, the domain guess is ok, but i suggest you to check if the extension of the domain in the list on the line var domain = location.hostname.match....

3 Macro-category
in the script there are some big category of sites, first check if you site is in one, simply by checking if their code works ;)

4 A new case
It your site doesn't belong to a macro-category, add a new case, based on the domain, insert it in alphabetic order :)
There you have to assign one between img and imgURL, img must point to the <img> tag where the image is; imgURL is the url of the full size image.
PS remember to add a "break"!

5 Helper functions
I strongly suggest you to use helper functions to do your job easily:

  • byId(s) finds the html tag with id = s and assigns it to img
  • byXP(s) finds the tag by the xPath s and assigns it to img
  • byXPV(s) works similar to byXP, but get an attribute (es: href for an anchor) and assigns it to imgURL

These cover 90% of the cases, but there are other 3 functions, that find the same element but returns you without assigning to img or imgURL.
  • hId(s) finds the html tag with id = s and returns it
  • hXP(s) finds the tag by the xPath s and returns it
  • hXPV(s) works similar to hXP, but gets an attribute (es: href for an anchor)