Skip to content

Instantly share code, notes, and snippets.

@stefanw
Created November 29, 2012 16:17
Show Gist options
  • Save stefanw/4170091 to your computer and use it in GitHub Desktop.
Save stefanw/4170091 to your computer and use it in GitHub Desktop.
Bookmarklet to generate VBB permalinks of routings
var from = document.getElementById('HFS_from').value;
var to = document.getElementById('HFS_to').value;
var time = document.getElementById('HFS_time_REQ0').value;
var date = document.getElementById('HFS_date_REQ0').value;
var timesel = !!document.getElementById('HFS_timesel_REQ0_1').checked ? 'depart' : 'arrive';
var details = document.getElementsByClassName('details');
for(var i = 0; i < details.length; i += 1) {
if (details[i].className.indexOf('menuLinks') !== -1 || details[i].className.indexOf('hide') !== -1) {
continue;
}
var hwai = details[i].id.substring(2);
break;
}
history.pushState({}, "", 'dn?From=' + from + '%21&To=' + to + '%21&time=' + time + '&date=' + date + '&start=1&timesel=' + timesel + '&HWAI=CONNECTION$' + hwai + '!id=' + hwai + '!HwaiConId=' + hwai + '!HwaiDetailStatus=details');
@westberliner
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment