|
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 imgbyXP(s) finds the tag by the xPath s and assigns it to imgbyXPV(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 ithXP(s) finds the tag by the xPath s and returns ithXPV(s) works similar to hXP, but gets an attribute (es: href for an anchor)
|