Diskusie » Vývoj

Need helping pulling images

§
Pridaný: 15.09.2014
Upravený: 15.09.2014

Need helping pulling images

Hey guys, hopefully someone can help me out. It's worth noting that I have next to no js experience, but I figured this was as good a project as any to start.

Currently I'm trying to develop a script for http://vndb.org/v/all in which when you hover over one of the links the program will show you a popup with the cover image for that game.

I believe the order of events in getting this to happen is:
- look for an < a title="..." href="..." > on the div where the mouse is being hovered over and copy the href link;
- look through that obtained link for the class="vnimg" and get the jpeg link; [Warning, covers are very likely to be nsfw]
- display that image in a popup.

From what I've seen of other scripts' codes I *think* I can handle the popup part. However, obtaining the image link I have no idea how to do. Could someone please help me out or perhaps link me to relevant pages where I could learn the necessary information? Alternatively if you know a script for another website that does the same thing that I could learn from, that could also work.

Thanks.

edit: Okay so I dug around a bunch more and found that vndb.org has a nifty API - api.vndb.org/d11. Problem is I have no previous experience with APIs and I'm having trouble interpreting the documentation and translating into actual functional code for either js or jquery. I'll keep on trying to decypher how these work but if anyone has some advice I'd appreciate it.

§
Pridaný: 29.09.2014

HI,

Do you still need help ? whether I could help you.

Regards
Reek

woxxomZablokovaný
§
Pridaný: 29.09.2014
Upravený: 29.09.2014

@Zinmill, if learning js is not your objective you can use Mouseover Popup Image Viewer userscript with a custom rule:

Description Rule
Cover image only {"d":"vndb.org","r":"vndb\\.org/v\\d+","q":".vnimg img","c":"#vntags"}
Screenshots only, cycled with J/K keys {"d":"vndb.org","r":"vndb\\.org/v\\d+","g":{"title":".alttitle","entry":"#screenshots a.scrlnk","image":"img","fix":"return s.replace('/st/','/sf/')"}}
Cover image + screenshots, cycled with J/K keys {"d":"vndb.org","r":"vndb\\.org/v\\d+","g":"doc=createDoc(text); g=[]; if(e=doc.querySelector('.alttitle'))g.title=e.textContent; if(e=doc.querySelector('.vnimg img'))g.push({url:e.src}); for(a=doc.querySelectorAll('#screenshots a.scrlnk'),i=0;i<a.length;i++) g.push({url:a[i].href}); return g"}

P.S. rules are added via your script manager's toolbar icon menu, e g. "User Script Commands" → "Set up Mouseover Popup Image Viewer" for Greasemonkey.

Pridať odpoveď

Aby ste mohli pridať odpoveď, prihláste sa.