Greasy Fork is available in English.

Dailymotion Fix Sexy Images

Restores preview images of adult videos

< Обсуждения Dailymotion Fix Sexy Images

Вопрос/комментарий

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";
Jixun.MoeМод
§
Создано: 15.09.2014
Отредактировано: 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');

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

Ответить

Войдите, чтобы ответить.