[TBA]: Greasemonkey Chief Delphi?

A random idea:

Wouldn’t it be neat if a Greasemonkey script existed that added a hyperlink to The Blue Alliance’s team page every time someone wrote “Team ####” on Chief Delphi?

I don’t have time right now, and I’ve never worked with Greasemonkey, but if anyone wants to give it a go…

[Edit]
Testing:
Team 177
[/Edit]

Done, here you go.

http://divergentdave.googlepages.com/tbalinker.user.js

Chief Delphi TBA Autolinker

Divergentdave wrote a Greasemonkey script to auto convert when someone writes “Team ####” in a Chief Delphi post to be a link to the corresponding team page on The Blue Alliance.

Installing

  1. Get or use Mozilla Firefox.
  2. Install Greasemonkey. It will make you restart Firefox.
  3. Click the link to divergentdave’s Chief Delphi TBA Autolinker script.
  4. Greasemonkey will ask you if you want to install the script. Say yes to the default options.
  5. You’re done! Any time someone says “team ####” on Chief Delphi, it will link to the corresponding team page on The Blue Alliance!

Thanks divergentdave!

The linker can also be used in Opera (v8.0 and higher)!

To install:

  • Save divergentdave’s Chief Delphi TBA Autolinker script (Right click, Save target as)
  • In Opera, go to Tools -> Preferences
  • In the “Advanced” tab, select “Content”
  • Click the “Javascript Options” button, and enter the directory of the saved script under “User JavaScript Files”
  • Hit OK - no restart required! :slight_smile:

Would there be any way to have the javascript enable another tab to be opened in FF when you click the team number link instead of opening in the same tab?

Other than that, it seems to be working fine!

That would most likely be a very simple fix.

In this part of the script:

var a = document.createElement("a");
a.setAttribute("href", 'http://www.thebluealliance.net/tbatv/team.php?team=' + match[2]);
a.appendChild(document.createTextNode(match[0]));
span.appendChild(a);

Add in one extra line:

var a = document.createElement(“a”);
a.setAttribute(“href”, ‘http://www.thebluealliance.net/tbatv/team.php?team=’ + match[2]);
a.setAttribute(“target”,‘_blank’);
a.appendChild(document.createTextNode(match[0]));
span.appendChild(a);

Note that I have not tested this yet.

This should force the browser to open the link in a new window, which Firefox should default to open in a new tab instead. (Yeah, yeah, I know the target attribute is depreciated in XHTML, but I really don’t care when it comes to Javascript until the new CSS3 standards come out, when they actually plan to implement a target-new: tab; CSS property for links.)

Yup, I added that line, works fine. Thanks divergentdave and artdutra04!

Is there any way to disable this feature in FTC forums on CD?
I recently saw & clicked a link to a team mentioned in the FTC forums, & it was linking to an FRC team with the same number as the FTC team the person was talking about. :eek:

Minor tweak… right?? :wink: