04-23-2013, 03:41 PM | #1 |
FFR Wiki Admin
Wiki Administrator
|
Java/Greasemonkey problem resolved
So, I've installed a Greasemonkey script on a website and I want to give it some modifications.
The website is rateyourmusic.com and the script in question can be downloaded here : http://userscripts.org/scripts/show/151158. Basically, the script automatically calculates the average rating of an artist page. I was able to modify it a little bit (adding more decimals and having it to calculate the bootlegs/videos and tribute releases) but I also want to have the total number of releases of the artist. Last picture gives you an idea of what I mean : Oh yeah, and there's some credit saved for anybody that helps me. :)
__________________
Last edited by noname219; 06-1-2013 at 08:16 PM.. |
04-24-2013, 10:38 AM | #2 |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Bump, who here wants 50k credits ?
__________________
|
04-24-2013, 12:10 PM | #3 |
stepmania archaeologist
Join Date: Aug 2005
Age: 34
Posts: 4,090
|
Re: Java/Greasemonkey problem
Can't you just make a global counter (e.g. albumCnt) and add one for each album you find (e.g. albumCnt++; before ratingCtr = ratingCtr + ratings;)?
__________________
Best AAA: Policy In The Sky [Oni] (81) Best SDG: PANTS (86) Best FC: Future Invasion (93) |
04-24-2013, 12:24 PM | #4 |
D6 Challeneged
Join Date: Aug 2012
Age: 31
Posts: 1,267
|
Re: Java/Greasemonkey problem
|
04-24-2013, 12:24 PM | #5 |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
The thing is, I know nothing at all about Java. I was able to modify the script by trial and error and that's about it.
I tried messing a bit with the code again but so far, I'm stuck.
__________________
|
04-24-2013, 12:28 PM | #6 |
stepmania archaeologist
Join Date: Aug 2005
Age: 34
Posts: 4,090
|
Re: Java/Greasemonkey problem
This doesn't even look like Java. More like JavaScript (which is a totally different thing btw).
__________________
Best AAA: Policy In The Sky [Oni] (81) Best SDG: PANTS (86) Best FC: Future Invasion (93) |
04-24-2013, 12:30 PM | #7 | |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Quote:
Thanks for helping btw.
__________________
|
|
04-24-2013, 04:44 PM | #8 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Java/Greasemonkey problem
qqwref is correct. Java isn't actually what you're asking for help with. you're working with JavaScript.
I'll take a really quick stab at it. no guarantees, but hopefully I can point you in the right direction. I'll check back in tomorrow. edit: oops I suck. code incoming ctrl+f "danceguy" to see where the changes were Last edited by dAnceguy117; 04-24-2013 at 05:02 PM.. |
04-24-2013, 08:07 PM | #9 |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Gives me no number of releases, just an "undefined" value.
You can also add this at rows 99-101 (so it will calculate bootlegs, videos and tributes) : Code:
parseAlbum('album_disc_b'); parseAlbum('album_disc_d'); parseAlbum('album_disc_t');
__________________
Last edited by noname219; 04-24-2013 at 08:10 PM.. |
04-25-2013, 01:39 AM | #10 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Java/Greasemonkey problem
ohh wow, I misread everything. qq had it right.
let me know how this one goes. I'm not testing anything, haha. |
04-25-2013, 07:30 AM | #11 |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Copypasting everything gives me 3 albums for Broken Bells. (should be 6 albums instead)
(http://rateyourmusic.com/artist/broken_bells_f1)
__________________
Last edited by noname219; 04-25-2013 at 07:47 AM.. |
04-25-2013, 09:39 AM | #12 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Java/Greasemonkey problem
interesting. let's try fudging the numbers, lmfao. these should be correct for Broken Bells but probably won't work for other artists.
replace the line that's spaced out near the top with one of these at a time. Code:
// get number of albums. danceguy sucks at coding numAlbums = albums.length + 1; Code:
// get number of albums. danceguy sucks at coding numAlbums = (albums.length - 2) * 2; hmmm. now that I look at the link in your above post, I think this problem could be pretty tricky. which six releases are the ones you want included? |
04-25-2013, 09:52 AM | #13 | ||
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Quote:
Quote:
Broken Bells (album) Meyrin Fields EP The High Road The Ghost Inside October Meyrin Fields The MySpace Transmissions (no appearances, but they shouldn't be included by default) You should add this in the code : Code:
parseAlbum('album_disc_b'); parseAlbum('album_disc_d'); parseAlbum('album_disc_t');
__________________
Last edited by noname219; 04-25-2013 at 10:06 AM.. |
||
04-25-2013, 12:10 PM | #14 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Java/Greasemonkey problem
I'm an idiot
give this one a shot. extra parseAlbum lines included, but I removed parseAlbum('album_disc_c'); because I don't think you want to include the compilations. right? edit: the magic number here should be 8. excluding anything with "Appears on" would be the finishing touch. if it gives you 4 albums for Broken Bells, let me know. that's an easy fix. Last edited by dAnceguy117; 04-25-2013 at 12:15 PM.. |
04-25-2013, 12:17 PM | #15 |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Gives me a NaN...
And compilations will get included as well, but if you remove it, you'll affect the average rating at the same time.
__________________
|
04-25-2013, 12:24 PM | #16 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Java/Greasemonkey problem
oops I grabbed the wrong version lmfao. compilations put back in, so you should get 11.
Last edited by dAnceguy117; 04-25-2013 at 12:27 PM.. |
04-25-2013, 12:30 PM | #17 |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Awww yeah. :) Gives me the exact number on every page.
Only thing left is to remove the appearances and everything will be perfect.
__________________
|
04-25-2013, 12:40 PM | #18 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Java/Greasemonkey problem
sweeeet hahah. I'll take a crack at the final changes over the weekend.
unless someone else wants to! QQ, I KNOW YOU'RE WATCHING |
05-20-2013, 07:38 PM | #19 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Java/Greasemonkey problem
bump, sorry again for the holdup. can't believe it's been a month, what the...
noname, where do you put this script/run it from? knocking this out would probably be 10x faster if I could test it myself |
05-20-2013, 07:46 PM | #20 |
FFR Wiki Admin
Wiki Administrator
|
Re: Java/Greasemonkey problem
Not sure if I understand your question.
This is the website : http://rateyourmusic.com/ The script acts everytime you load an artist page. (supposing you already have downloaded the Greasemonkey extension for Firefox/Chrome)
__________________
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|