Sleazy Fork is available in English.
Shows just fullsize Image with hotkeys & without pop-ups on many image-hosting sites
there is no image finding in lines you gave here, those just replace part of content
, 'finding' an image isn't about guessing it - it's about actually finding it - look for it in pages source and make a way for script to pick it.
That was just the last part :P
case "example.com":
i = document.head.querySelector('meta[property="og:image"]');
if(i){
i.src = i.content.replace('thumb','org'); // if it fails to build the image try
// i.src = i.content.replace('thumb','hd')
}
break;
Like building an array of possibilities and going through it. Is it possible?
i.tryIndex = 0;
i.rules = [['thumb', 'org'], ['thumb', 'hd']];
function nextRule() {
var index = i.tryIndex++;
if (index >= i.rules.length) {
console.error('I tried, give up.');
return ;
}
i.src = i.content.replace(i.rules[index][0], i.rules[index][1]);
};
i.onerror = nextRule;
nextRule ();
Not tested though... Don't know if it will fire standard onerror
event.
@JixunMoe Doesn't seem to be working. Would always use the first option in the array. Thank you for writing that though :)
Two possibilities
Is there a way to tell the script to try and if it fails to find an image try another.
example
i.src = i.content.replace('thumb','org')
if it fails tryi.src = i.content.replace('thumb','hd')