Greasy Fork is available in English.

Dailymotion Fix Sexy Images

Restores preview images of adult videos

< Valutazione su Dailymotion Fix Sexy Images

Domanda/commento

§
Pubblicato: 15/09/2014

Nuking "preview" class too?

Just some (minor) quibbles about your UserScript....

You test for the "blurred" images like this:

if (imgs[i].className == "preview blurred") {
 ...
}

That's probably a little more fragile than it needs to be. Something like this might be better:

if ((new RegExp('(\\s|^)blurred(\\s|$)')).test(imgs[i].className)) {
 ...
}

And you remove it like this:

imgs[i].className = null;

That doesn't seem to break the page visually, but it *is* dropping the "preview" class.

I only mention it because some other UserScripts (i.e: mine) might rely on finding those previews using that className :-)

You might like to do this instead:

imgs[i].className = "preview";
§
Pubblicato: 15/09/2014
Modificato: 15/09/2014

Or, you can use: imgs[i].classList.remove('blurred');
And, to check whether it has a class-name, you can use imgs[i].classList.contains('blurred');

§
Pubblicato: 17/09/2014

Thanks for the comments! I've updated the script accordingly :)

I didn't actually think this was going to be useful when I uploaded it. I thought I was simply missing a configuration setting :D

Pubblica risposta

Accedi per pubblicare una risposta.