To see less ads Register or Login ----- Daily Fantasy Sports games 18+

Greasemonkey script to display team data on FPL league page

A Fantasy Football forum for news on fantasy football games run by the Premierleague (FPL).
Post Reply
User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league p

Post by nickchild »

Have just updated the script as it had stopped working for me - part of the HTML code on the team page had changed and was stopping me from grabbing some data. Fortunately it was redundant data (team and player name that I was originally using as an ID) so I have been able to fix it easily.

This update also contains the rollovers for the bench (and starting) players showing their points for the week.

Also fixed a bug that required the 'Live total' to be activated in order to display the gameweek transfer hit points

User avatar
Surprised
FISO Jedi Knight
Posts: 26528
Joined: 13 Oct 2005, 18:32
Location: Home
FS Record: TFFOSM MotW in 2008 and MotM in 2003. 78th overall in TFFO for 2002/3 and 2003/4

Re: Greasemonkey script to display team data on FPL league p

Post by Surprised »

It's stopped updating automatically for me again

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: MOUSEOVER INFO!!!

Post by nickchild »

snakzz wrote:
MoSe wrote:
snakzz wrote:How does this work?
for instance in the image attached in my yesterday post above, you just click on the red/green arrows on the left
mind, they're not rollover: you click to switch a line on, click again to switch it off
Ah AWESOME :D

Any way that I can press one button do to this for all teams?
Have added this option in.

There is now a 'T' in the 1st column header. This will toggle all the teams on/off.

User avatar
liquidfootball2
Dumbledore
Posts: 8672
Joined: 05 Jan 2012, 16:14
FS Record: Best fpl finish 233 in 14/15

Re: MOUSEOVER INFO!!!

Post by liquidfootball2 »

nickchild wrote:
snakzz wrote:
MoSe wrote:
snakzz wrote:How does this work?
for instance in the image attached in my yesterday post above, you just click on the red/green arrows on the left
mind, they're not rollover: you click to switch a line on, click again to switch it off
Ah AWESOME :D

Any way that I can press one button do to this for all teams?
Have added this option in.

There is now a 'T' in the 1st column header. This will toggle all the teams on/off.
Great stuff Nick.

User avatar
sstaffsw
Grumpy Old Man
Posts: 1917
Joined: 08 Dec 2011, 10:47
Location: Wolverhampton

Re: Greasemonkey script to display team data on FPL league p

Post by sstaffsw »

Seems to have stopped working for me on Firefox. Anyone else? Brilliant stuff when it's working, hats off to Nick.

User avatar
From4corners
FISO Jedi Knight
Posts: 20210
Joined: 24 Aug 2009, 22:32
Location: London

Re: Greasemonkey script to display team data on FPL league p

Post by From4corners »

It stopped working for me two days ago, downloaded the newer version and working as a charm again. So helpful :D

User avatar
sstaffsw
Grumpy Old Man
Posts: 1917
Joined: 08 Dec 2011, 10:47
Location: Wolverhampton

Re: Greasemonkey script to display team data on FPL league p

Post by sstaffsw »

Downloading the new version worked for me, thanks.

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league p

Post by nickchild »

sstaffsw wrote:Downloading the new version worked for me, thanks.
This may happen from time to time as my script looks for certain markers in the code (tables, element id's, headings etc) in order to pull the data out.

So if FPL change/move/remove one of these markers the script will break. It's likely this won't be the last time but I will do my best to fix it ASAP.

Leave a message on this thread if you notice before I do...

User avatar
Taff Murray
Grumpy Old Man
Posts: 1584
Joined: 23 Jul 2011, 17:19
Location: No.1 At the end of the bar
FS Record: FISO 5AS FA Cup Winner 2016/17, FISO 5AS Champions League Winner 2018/19 Best FPL Pos 11/12 - 9959th

Re: Greasemonkey script to display team data on FPL league p

Post by Taff Murray »

I am assuming with certain details like Captain choice and transfers this script is not pulling the current choice or can you get at that before the GW deadline passes. i.e. Like normal you cannot view transfers and captain until the GW is active. The assumption is from me that until the deadline passes I am looking at effectively last weeks data. Correct?

User avatar
Mav3rick
FISO Jedi Knight
Posts: 20858
Joined: 20 Jul 2009, 20:35
FS Record: FPL: 1082, 1201, 1800, 10203

The stats are dark and full of errors.

Re: Greasemonkey script to display team data on FPL league p

Post by Mav3rick »

Taff Murray wrote:I am assuming with certain details like Captain choice and transfers this script is not pulling the current choice or can you get at that before the GW deadline passes. i.e. Like normal you cannot view transfers and captain until the GW is active. The assumption is from me that until the deadline passes I am looking at effectively last weeks data. Correct?
Yeah that's correct... Would be pretty unfair otherwise :lol:

User avatar
Taff Murray
Grumpy Old Man
Posts: 1584
Joined: 23 Jul 2011, 17:19
Location: No.1 At the end of the bar
FS Record: FISO 5AS FA Cup Winner 2016/17, FISO 5AS Champions League Winner 2018/19 Best FPL Pos 11/12 - 9959th

Re: Greasemonkey script to display team data on FPL league p

Post by Taff Murray »

Mav3rick wrote:
Yeah that's correct... Would be pretty unfair otherwise :lol:
:shock:

And the problem with that is what precisely? :wink: :lol:

As somebody once told me "If you are not cheating, you are not trying hard enough!!!" :twisted:

User avatar
SuperGrover
Grumpy Old Man
Posts: 1540
Joined: 12 Sep 2012, 15:38
Location: Chicago, USA

Re: Greasemonkey script to display team data on FPL league p

Post by SuperGrover »

nickchild wrote:
SuperGrover wrote:This is awesome. Helps so much. Great work and I say that as a former dev myself!

Quick question as you are in the "FPL dev space" (if that even exists):

Have you seen a tool that can show you the difference in your players and your league mates? Something that shows count of similar players/starters? I have been contemplating writing one myself but wondered if one existed out there already.

Again, kudos on the plug-in. I absolutely love it.
I was thinking about adding a summary window, showing most selected players along with any differentials. I could take this further to show all players selection counts but not sure how to display the data to make it useful...

Another option would be to have a free-text field allowing the user to search for a specific player with an extra column showing if this player is in the starting xi / bench / captain / vice.

Something like this almost needs a separate GUI
Yeah I don't see how you could keep it within the same GUI. Be too cluttered IMO, but I was always terrible at GUI design anyway.

I have a couple more scrapers i want to code and then might take a look at this next week, unless you do something first! :)

User avatar
jeffmcgow
Dumbledore
Posts: 7624
Joined: 13 Oct 2005, 18:44
FS Record: FPL - FISO Mirror League 1st 2015-16 | Sun - Cheap as Chips Conference 1st 2014-15 & 2015-16

Re: Greasemonkey script to display team data on FPL league p

Post by jeffmcgow »

Hi Nick. You've done some fantastic work with league-page enhancements. It really addictive, as soon as I fire up FPL I'm straight on to the league page to see whose made transfers or played a wildcard. :)

What is the possiblility of showing the Selling Price of a team as well as the TV? I can't see anywhere on the site where an opponent's selling price is shown so maybe this won't be possible.

It's something I'd find useful since it would allow me to see the buying power that rivals have, especially when they come to use their wildcard.

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league p

Post by nickchild »

No problem Jeff, I'm please you like it!

Unfortunately the data required to see the selling price is not available on the team page.

If the player price change data was available on FPL I could figure it out based on a users transfer history but the best I can get is the players price at the end of a gameweek. This would not give accurate results. Using the CTC data would make it more accurate but as this is on a different URL it is not possible to call that site within this script.

Sorry!

User avatar
jeffmcgow
Dumbledore
Posts: 7624
Joined: 13 Oct 2005, 18:44
FS Record: FPL - FISO Mirror League 1st 2015-16 | Sun - Cheap as Chips Conference 1st 2014-15 & 2015-16

Re: Greasemonkey script to display team data on FPL league p

Post by jeffmcgow »

nickchild wrote:No problem Jeff, I'm please you like it!

Unfortunately the data required to see the selling price is not available on the team page.

If the player price change data was available on FPL I could figure it out based on a users transfer history but the best I can get is the players price at the end of a gameweek. This would not give accurate results. Using the CTC data would make it more accurate but as this is on a different URL it is not possible to call that site within this script.

Sorry!
No problem, Nick. It's good of you to have given it consideration.

User avatar
SuperGrover
Grumpy Old Man
Posts: 1540
Joined: 12 Sep 2012, 15:38
Location: Chicago, USA

Re: Greasemonkey script to display team data on FPL league p

Post by SuperGrover »

Just noticed the tool tip listing of players under P, TP and DNP columns. This is a brilliant way to communicate rosters for each team. Very well done!

User avatar
MoSe
Dumbledore
Posts: 9562
Joined: 10 Sep 2014, 12:25
Location: next door S.Siro stadium
FS Record: FISODAS CUP Winner Season 25
FISO H2H Winner: 15/16 Div2 - 16/17 Div1
FISO Mirror: 16/17 PL Winner

Re: Greasemonkey script to display team data on FPL league p

Post by MoSe »

if you read back, nick also added a toggle on the up/down arrows in leftmost column, to show a team whole roster
the topleft T toggles the whole table

User avatar
Carlos Kickaball
Dumbledore
Posts: 7801
Joined: 04 Sep 2013, 18:02

Re: Greasemonkey script to display team data on FPL league p

Post by Carlos Kickaball »

Nick I was wondering if it would be possible if a script could assemble a league of players using their IDs?

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league p

Post by nickchild »

Carlos Kickaball wrote:Nick I was wondering if it would be possible if a script could assemble a league of players using their IDs?
Could you elaborate...?

It's definitely possible but would probably be better as a standalone page.

Why can you not just create a new league?

User avatar
MoSe
Dumbledore
Posts: 9562
Joined: 10 Sep 2014, 12:25
Location: next door S.Siro stadium
FS Record: FISODAS CUP Winner Season 25
FISO H2H Winner: 15/16 Div2 - 16/17 Div1
FISO Mirror: 16/17 PL Winner

Re: Greasemonkey script to display team data on FPL league p

Post by MoSe »

didn't dare to ask for it....
because not all players in a run-by-hand sidegame would bother to join a ML for it :oops:

User avatar
Carlos Kickaball
Dumbledore
Posts: 7801
Joined: 04 Sep 2013, 18:02

Re: Greasemonkey script to display team data on FPL league p

Post by Carlos Kickaball »

nickchild wrote:
Carlos Kickaball wrote:Nick I was wondering if it would be possible if a script could assemble a league of players using their IDs?
Could you elaborate...?

It's definitely possible but would probably be better as a standalone page.

Why can you not just create a new league?
Mostly because people won't join a league just for my convenience, as they are:

Members of Fiso who don't wish to share there team ID with everyone.
Members of Fiso who don't wish to join a mini league for other reasons.
Non members of Fiso who woulden't want to join a league just because I've told them it's a league of people whose teams I'm interested in.

One thing I had wondered, is personally as a Greasemonkey idiot, how do I know Greasemonkey scripts are safe?

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league p

Post by nickchild »

Carlos Kickaball wrote:Non members of Fiso who woulden't want to join a league just because I've told them it's a league of people whose teams I'm interested in.
:lol:
Carlos Kickaball wrote:One thing I had wondered, is personally as a Greasemonkey idiot, how do I know Greasemonkey scripts are safe?
http://stackoverflow.com/questions/3163 ... easemonkey" onclick="window.open(this.href);return false;
The biggest issue you could have is someone stealing a password, but the Greasemonkey script would have be running on the login page of the site. You can check in your Greasemonkey settings which URLs are including each script.

Mine for example only runs when accessing the league pages: http://fantasy.premierleague.com/my-leagues*" onclick="window.open(this.href);return false;

User avatar
MoSe
Dumbledore
Posts: 9562
Joined: 10 Sep 2014, 12:25
Location: next door S.Siro stadium
FS Record: FISODAS CUP Winner Season 25
FISO H2H Winner: 15/16 Div2 - 16/17 Div1
FISO Mirror: 16/17 PL Winner

Re: Greasemonkey script to display team data on FPL league p

Post by MoSe »

Hi Nick,
going on making great use of your script(s) :)

reading in the Overall rank topic here, I thought it'd have been cool to gather the rank of all FISO members who entered the Official Fiso FPL Minileague 2014-15 (league name shows as "the FISO forum")

so I said to myself, Hey, I could use the wonderful nickchild script to easily list all the rankings...
then I realised your table doesn't report GR (Gameweek Rank) and OR (Overall Rank) which are tho available in individual GW History pages.

I know, this is a bit out of the purpose of your table, and the extra two columns would risk to clutter too much the display only to add a statistical curiosity.
So I figure I'll have to forsake for the moment the plan to chart the overall ranking of the 1,051 members of the FISO forum ML
(individually clicking 1k teams is out of question even for a statpervert like me :oops: )

User avatar
liquidfootball2
Dumbledore
Posts: 8672
Joined: 05 Jan 2012, 16:14
FS Record: Best fpl finish 233 in 14/15

Re: Greasemonkey script to display team data on FPL league p

Post by liquidfootball2 »

Nick, now that the leaders in some leagues, and certainly the overall leaders, are over 1,000 points there is an error occurring in the live "total" field.

Once a person reaches 1,000 points the live "total" field just shows the number "1" from the "1,000", so a person with 999 points will have "999" displayed but the person ahead with 1,000 or more only "1".

I'd hope this is just a minor change to expand the column field size to cope with the extra digit(s).

Kleurijke
Cheetah
Posts: 3
Joined: 20 Dec 2014, 19:41

Re: Greasemonkey script to display team data on FPL league p

Post by Kleurijke »

Same thing happened to me today after some heavy point gains. It happens because FPL adds a comma when a number is larger than 1000 and the script can't read it properly. Go to line 705 (or around there) and find a line containing:

totalScore = parseInt(rowtds[5].innerHTML, 10);

And just replace this with:

totalScore = rowtds[5].innerHTML; totalScore = parseInt(totalScore.replace(/\,/g,''), 10);

User avatar
SuperGrover
Grumpy Old Man
Posts: 1540
Joined: 12 Sep 2012, 15:38
Location: Chicago, USA

Re: Greasemonkey script to display team data on FPL league p

Post by SuperGrover »

Thank you sir. I didn't feel like troubleshooting the code. Been a long time since I looked at Javascript!

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league p

Post by nickchild »

Had just spotted this myself and have made the fix this morning. Have used similar code as shown above but am also formatting the nuber to re-add the commas as per FPL's display.

Will be back soon to add the bonus wildcard stats in.

Merry Christmas everyone!

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league p

Post by nickchild »

MoSe wrote:Hi Nick,
going on making great use of your script(s) :)

reading in the Overall rank topic here, I thought it'd have been cool to gather the rank of all FISO members who entered the Official Fiso FPL Minileague 2014-15 (league name shows as "the FISO forum")

so I said to myself, Hey, I could use the wonderful nickchild script to easily list all the rankings...
then I realised your table doesn't report GR (Gameweek Rank) and OR (Overall Rank) which are tho available in individual GW History pages.

I know, this is a bit out of the purpose of your table, and the extra two columns would risk to clutter too much the display only to add a statistical curiosity.
So I figure I'll have to forsake for the moment the plan to chart the overall ranking of the 1,051 members of the FISO forum ML
(individually clicking 1k teams is out of question even for a statpervert like me :oops: )
Interesting idea. I will try to add this in at some point over the festive break...!

t88
Treebeard
Posts: 261
Joined: 01 Dec 2010, 23:05

Re: Greasemonkey script to display team data on FPL league page

Post by t88 »

nickchild
This is AWESOME, truely awesome!! This will give me the overview I needed and save me thousands of clicks! Btw, since we're in the middle of a DGW. Is there any update planned that would show the TP (players to play) who are expected to have another match coming?

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild »

Have updated the script to reflect DGW players. They will remain in the TP (To Play) column until their 2nd game has started. They should also not move to the DNP (Did Not Play) column unless they have played 0 minutes in both games. There will now also be an indicator in the rollover of the TP column showing if a player has multiple games left in the gameweek.

View Latest: 1 Day View Your posts
Post Reply

Return to “Fantasy PremierLeague.com (FPL)”