Dailymotion Fix Sexy Images

Restores preview images of adult videos

< 脚本Dailymotion Fix Sexy Images的反馈

提问/评论

§
发表于:2014-09-15

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管理员
§
发表于:2014-09-15
编辑于:2014-09-15

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');

§
发表于:2014-09-17

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

发表回复

登录以发表回复。