Forked from shininglion/gist:f86bdf8bbb30d7a18cf8
Last active
August 29, 2015 14:19
-
-
Save johnroyer/68730b1ba1aed3037760 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name railwayTicketFormAutoField | |
// @namespace http://railway.hinet.net/ctno1.htm | |
// @description Change some element on login page | |
// @include http://*railway.hinet.net/ctno1.htm | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js | |
// ==/UserScript== | |
var personalId = 'A123456789'; // 身份正字號 | |
var fromStation = '100'; // 台北 | |
var toStation = '129'; // 台中港 | |
var trainNo = '111'; // 車次 | |
// 乘車日期、訂票張數需要手動改一下 | |
// 填入身分證字號 | |
$('input[name=person_id]').val(personalId); | |
// 選擇起站地點 | |
$('select[name=from_station] option').prop('selected', false).filter('[value="'+ fromStation +'"]').prop('selected', true); | |
// 選擇到站地點 | |
$('select[name=to_station] option').prop('selected', false).filter('[value="' + toStation + '"]').prop('selected', true); | |
// 選擇日期 | |
$('select[name=getin_date] option').prop('selected', false).filter('[value^="2014/07/20"]').prop('selected', true); | |
// 填入車次 | |
$('input[name=train_no]').val(trainNo); | |
// 一般無桌形座位車廂 | |
$('select[name=order_qty_str] option').prop('selected', false).filter('[value="1"]').prop('selected', true); | |
// 有桌形座位車廂 (普悠瑪) | |
$('select[name=n_order_qty_str] option').prop('selected', false).filter('[value="1"]').prop('selected', true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment