Update: ATC callsign bookmarklet for fr24
Well today, flightradar24 decided to push a long-awaited update, which promptly broke my bookmarklet. I'm actually not mad, because the update makes the site significantly better. The overall style is nicer (big-up to Roboto), and there's the inclusion of a much-teased 3D view, which is beyond the scope of this post.
Here's the bookmarklet, drag to your bookmarks bar: fr24.js*
I have moved the display to the top of the sidebar, and re-styled it to fit the new theme, lots of in-line styles because I was testing it, and it worked, so I left it. I have also been able to remove the most dodgy code which involved trying a variety of places to grab the callsign. I've now found the callsign in a data-callsign attribute on one of the buttons, and am stealing it from there. The process to decide what to do currently looks like this:
- If the callsign is the same as the aircraft type, then it isn't a callsign, so it gets disregarded and nothing is shown
- Else, if the callsign is entirely letters, or is 'N' followed by some numbers, and maybe some letters (said more definitely with Regex, thank you Americans) then the entire callsign is simply phoneticised (replacing 'A' with 'ALPHA' for example).
- Else, if the callsign is three letters followed by one or more characters, look-up the three letters in the table to see what they like to call it on the radio (i.e. converting 'BAW' to 'SPEEDBIRD') and phoneticise the rest of the code.
- If none of those patterns are met, for now, drop it.
Then, if somethings been found, look the aircraft type up as well to see if it needs 'HEAVY' or 'SUPER' appended. Then put the callsign into the box.