PixivAutoPager

By Suiren Last update Oct 1, 2010 — Installed 4,797 times.

Minor fix

in
Subscribe to Minor fix 6 posts, 2 voices



hentaku User

There was bug when profile's with "_s" or "_m" in their name would cause the direct image link to 404. This will work for all profile names unless the name ends in "_s" or "_m". I am quite new to java and regex so this was the best i could do for now.

( Old Code )
Search for: full_img.href = links[i].firstChild.src.replace(/_s|_m/, "");

( New Code )
Replace with: full_img.href = links[i].firstChild.src.replace(/_s\b|_m\b/, "");

 
hentaku User

It's line number 83 for those who need to know.

 
Suiren Script's Author

Hi hentaku, Thank you for advice me.
I didn't notice until it was teach by you.

So, I fixed this Bug that

(Old Code)
full_img.href = links[i].firstChild.src.replace(/_s|_m/, "");

(New Code)
full_img.href = links[i].firstChild.src.replace(/_s.|_m./, ".");

 
hentaku User

Hi Suiren,

Thanks for taking the time to respond. I tried your code but it still wasn't working for me on accounts whose name ends in "_s" or "_m". So i did some more research on regex and java and did learn enough to make the correct code for it to work all around. I also took the liberty of consolidating the regex statement as well.

full_img.href = links[i].firstChild.src.replace(/_[sm]\./, ".");

 
Suiren Script's Author

Hi hentaku. Thank you for your advice!
I had a misunderstanding about REGEX.
When I replace "_s." to "." , I must code REGEX "\.".
"." means 'match single word'...I mistaked.

So I fixed this Bug by using your code.
Thank you very match.

(New Code)
full_img.href = links[i].firstChild.src.replace(/_[ms]\./, ".");

_[sm] to _[ms] because that is just alphabetical order.

 
hentaku User

No problem! Glad i could help make this script a little better, even if by a very small bit.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel