Custom host rules (cheat sheet)
Property | (meaning) | Syntax (and examples) |
---|---|---|
"r" | regular expression | |
"q" | query | {"r":"imagebam\\.com/image/", "q":"img[id]"} |
"c" | text caption | {"r":"pinterest\\.com/pin/", "q":".pinImage", "c":"meta[property='og:description']"} |
Property | (meaning) | Syntax (and examples) |
---|---|---|
"s" | substitution | {"r":"hotimg\\.com/image/([a-z0-9]+)", "s":"http://www.hotimg.com/direct/$1"} |
vim/sed syntax | {"r":"hotimg\\.com/image", "s":"/image/direct/"} |
|
list of subst. patterns | {"r":"example\\.com/pics", "s":["/small/large/", "/small/medium/"]} |
|
"html":true | search inside HTML source (instead of href and src attributes of links and images.) |
By default, the regular expression is applied on href and src attributes of links and images. MPIV looks at thumbnail locations first and surrounding links second. Insert If |
"xhr":true | images will be downloaded in an alternative way which should circumvent obnoxious protections. |
Some sites (usually the ones with money-making schemes and obnoxious ads) force users to view their images directly on their site by prohibiting hotlinking. Insert the property
|
"e" | process elements other than <a> and <img>, e.g. <li> |
f you want MPIV to process elements other than <a> and <img> because a site uses let's say <li> elements with CSS backgrounds as thumbnails, you need to specify a selector for them in property "e". Keep in mind that even now regular expressions will only be applied on href and src attributes. That means if the matching element lacks href and src attributes, you need to set Property "e" can also be used as an elegant alternative to "r".
|
"d" | site's domain |
In order to avoid needless evaluation of rules that make only sense on a single website, write the site's domain (or a part of it) in property "d".
|
Advanced Use | ||
---|---|---|
Rule properties "s", "q" and "c" may contain JavaScript code which provides a maximum of flexibility. While "s" and "q" can either return a single URL or an array of URLs, "c" is expected to return a descriptive text string.
If "s" returns false, MPIV will proceed to the next rule. If "s" returns '' (empty string), no further rule will be evaluated. |
||
"s" | substitution |
"s" available variables:
|
"q" | query |
"q" and "c" available variables:
|
"c" | text caption | |
"follow":true |
Property
|
|
"rect" | A few sites clip their thumbnails by putting them in containers smaller than the thumbnails themselves. As a result, MPIV's popup stays open longer than you would expect because your mouse cursor hasn't left the invisible part of the thumbnail yet. If you encounter a situation like this, write a CSS selector in property "rect" to guide MPIV to an ancestor node whose bounding rectangle makes more sense to you. |
|
"manual":true | Insert property "manual":true to disable automatic popup activation on a case-by-case basis. |
|
"css" |
Use property "css" to apply CSS styling to the page in case the rule gets chosen.
|
|
"g" | gallery |
(from here) For function mode the parameters are:
For declarative syntax:
|
"e" | parent-child |
(from here)
|
MPIV has basic support for HTML5 video. Host rules may point to source elements and return URLs ending in webm/mp4. |