gfish: (Default)
gfish ([personal profile] gfish) wrote2007-10-24 09:16 am

(no subject)

I know this won't be useful to many of you, but I wanted to get it indexed as a public service.

If you want to create a link to Vancouver TransLink's NextBus page that will always load for right now (as compared to the time when you happened to bookmark it), add a bookmark with the following URL:

javascript:d = new Date(); document.location = "http://tripplanning.translink.bc.ca/hiwire?.a=iNextBusFind&.s=%7B%24SID%7D&ShowTimes=1&NumStopTimes=5&LineDirId=&GetSchedules=1&Geocode=0&FormState=0&StopAbbr=XXXXX&FromHourDropDown=" + d.getHours() * 100 + "&FromMinuteDropDown=" + d.getMinutes() + "&FromMeridiemDropDown=" + (d.getHours() >= 12 ? 'p' : 'a') + "&SB=Search&.a=iTripPlanning";

Replace XXXXX with whatever stop number you're interested in. Boom, quick and easy way to check for the next bus arrival.

[identity profile] hpapillon.livejournal.com 2007-10-24 04:34 pm (UTC)(link)
yer stretching my friends page. can that go in a cut? :)

[identity profile] anansi133.livejournal.com 2007-10-24 05:54 pm (UTC)(link)
Oh, and the link itself doesn't copy/paste in its current form. The 3rd line somehow got excluded

Wha?!?!

[identity profile] avicado.livejournal.com 2007-10-24 06:48 pm (UTC)(link)
That doesn't look like a URL I can copy & paste. That looks like some badly-formatted javascript code. Unless you meant for us to just C&P the URL part?

Re: Wha?!?!

[identity profile] gfish.livejournal.com 2007-10-24 06:58 pm (UTC)(link)
You can use javascript as a URL; that's what the 'javascript:' at the beginning does. Instead of going somewhere, it executes the code. (Depending on exact security settings, of course.) In this case, the code then dynamically generates a real URL and sends you there.

That makes more sense, but still...

[identity profile] avicado.livejournal.com 2007-10-24 07:05 pm (UTC)(link)
...if you're going to include javascript, can't you just have it pop up with some kind of form that asks you for the XXXXX stop number, instead of having to manually change the URL every single time? I mean, that extra stuff at the end looks like it adds some parameters that would make it relevant for right now, but when I click on the link, it gives me the right-now time anyway... so why the extra code if it does that anyway?

Just wondering...

Re: That makes more sense, but still...

[identity profile] gfish.livejournal.com 2007-10-24 07:08 pm (UTC)(link)
I meant, change XXXXX in the saved bookmark. Most people only use a handful of stops regularly, so it makes sense to make a quick and easy bookmark for each.

Re: That makes more sense, but still...

[identity profile] gfish.livejournal.com 2007-10-24 07:11 pm (UTC)(link)
If you visit the NextBus page, the form defaults to right now. But the search results have the time hardcoded into the URL, so if you bookmark that page, every time you visit it the results will be for the same time. Using the javascript lets you jump directly to the search results for right now. It's very silly that I have to do this -- the page should have a 'right now' option. But transit website tend to suck that way.

Parsed!

[identity profile] avicado.livejournal.com 2007-10-24 07:32 pm (UTC)(link)
That computes. And as much as I like silliness, it's nice to know I have friends out there who are good at dispelling this particular sort of silliness. Another blow struck for the cause of disgruntled public transportation users - huzzah!

&:þ

[identity profile] grinninfoole.livejournal.com 2007-10-24 07:07 pm (UTC)(link)
You, and the internet, have made Team Aguilar's vacation better. We're about to hop a bus to UBC to check out the Museum of Anthropology and maybe catch some BSG locations. You're link made that much easier for us to do. Thanks!