Skip to content

Instantly share code, notes, and snippets.

@earthchie
Last active April 12, 2023 17:16
Show Gist options
  • Save earthchie/f11250b898fcc187bd3de65f13cac1ba to your computer and use it in GitHub Desktop.
Save earthchie/f11250b898fcc187bd3de65f13cac1ba to your computer and use it in GitHub Desktop.
ระบบช่วยกรอกข้อมูล จองทะเบียนรถ ที่ https://reserve.dlt.go.th/reserve/s.php (อ่านรายละเอียดที่คอมเมนต์ด้านล่าง)
DLT_applyFields({
id: '1122334455667',
prefix: 'นาย', // ต้องสะกดให้เหมือนตัวเลือกใน dropdown เป้ะๆ
name: 'ธนารัตน์',
lname: 'นักจองทะเบียน',
phone: '0812345678',
brand: 'LAMBORGHINI', // ต้องสะกดให้เหมือนตัวเลือกใน dropdown เป้ะๆ
cassis: 'MR1234567890',
number: '999' // แนะนำให้แก้โค้ดส่วนนี้ ปรับให้อ่านค่าจาก localStorage จะได้ไม่ต้องรันเลขเองด้วยมือทุกครั้ง
});
function DLT_applyFields(data) {
isbody = 999; // bypass validation
const fields = document.querySelectorAll('input,select')
let f = {
number: document.querySelector('#number')
};
let n = [18,19,20,21,22,23,24];
for(i = 18; i <= 24; i++){
// prefix, name, lastname
if(fields[i].id === 'prefixZQ'){
f.prefix = fields[i];
f.name = fields[i+1];
f.lname = fields[i+2];
let index = n.indexOf(i);
if (index !== -1) {
n.splice(index, 3);
}
}
// brand
if(fields[i].tagName === 'SELECT' && fields[i].id !== 'prefixZQ'){
f.brand = fields[i];
let index = n.indexOf(i);
if (index !== -1) {
n.splice(index, 1);
}
}
// phone number
if(fields[i].onkeypress != null && fields[i].onkeypress.toString() == 'function onkeypress(event) {\ncheck_number()\n}'){
f.phone = fields[i];
let index = n.indexOf(i);
if (index !== -1) {
n.splice(index, 1);
}
}
// cassis number
if(fields[i].onkeypress != null && fields[i].onkeypress.toString() == 'function onkeypress(event) {\ncheck_number1()\n}'){
f.cassis = fields[i];
let index = n.indexOf(i);
if (index !== -1) {
n.splice(index, 1);
}
}
}
console.log(n, fields)
f.id = fields[n.shift()]; // id card
//apply data if provided
Object.keys(data).forEach(i=>{
f[i].value = data[i];
})
return f; // return all fields in case you need it
}
@earthchie
Copy link
Author

earthchie commented Aug 29, 2022

ระบบช่วยกรอกข้อมูล จองทะเบียนรถ ที่ https://reserve.dlt.go.th/reserve/s.php กดเข้าหน้า form ที่ปุ่มยอมรับหลักเกณฑ์ ต้องกดด้วยมือเราเอง เพื่อรับ session จากนั้นที่หน้าแบบฟอร์ม อย่าเพิ่งรัน script ต้องทิ้งเวลา 30 วิถึงจะรันได้ (จำลองว่าพิมพ์เอง) ไม่งั้น server จะจับได้ (จาก session ว่าไวเกินมนุษย์พิมพ์) แล้วมันจะเตะออกเป็นหน้าขาวๆ ถ้าเจอหน้าขาวคือโดนจับได้แล้วว่าใช้ script ต้องปิดหน้าต่างนั้นแล้วเริ่มใหม่เลย เพื่อเคลียร์ session ทิ้ง

เลขประมูลที่ไม่เปิดให้จอง มีทั้งหมด 291 เลข

const reserved = [
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  11,
  22,
  33,
  44,
  55,
  66,
  77,
  88,
  99,
  111,
  123,
  222,
  234,
  333,
  345,
  444,
  456,
  555,
  567,
  666,
  678,
  777,
  789,
  888,
  999,
  1001,
  1010,
  1100,
  1111,
  1122,
  1133,
  1144,
  1155,
  1166,
  1177,
  1188,
  1199,
  1212,
  1221,
  1234,
  1313,
  1331,
  1414,
  1441,
  1515,
  1551,
  1616,
  1661,
  1717,
  1771,
  1818,
  1881,
  1919,
  1991,
  2002,
  2020,
  2112,
  2121,
  2200,
  2211,
  2222,
  2233,
  2244,
  2255,
  2266,
  2277,
  2288,
  2299,
  2323,
  2332,
  2345,
  2424,
  2442,
  2525,
  2552,
  2626,
  2662,
  2727,
  2772,
  2828,
  2882,
  2929,
  2992,
  3003,
  3030,
  3113,
  3131,
  3223,
  3232,
  3300,
  3311,
  3322,
  3333,
  3344,
  3355,
  3366,
  3377,
  3388,
  3399,
  3434,
  3443,
  3456,
  3535,
  3553,
  3636,
  3663,
  3737,
  3773,
  3838,
  3883,
  3939,
  3993,
  4004,
  4040,
  4114,
  4141,
  4224,
  4242,
  4334,
  4343,
  4400,
  4411,
  4422,
  4433,
  4444,
  4455,
  4466,
  4477,
  4488,
  4499,
  4545,
  4554,
  4567,
  4646,
  4664,
  4747,
  4774,
  4848,
  4884,
  4949,
  4994,
  5005,
  5050,
  5115,
  5151,
  5225,
  5252,
  5335,
  5353,
  5445,
  5454,
  5500,
  5511,
  5533,
  5544,
  5555,
  5566,
  5577,
  5588,
  5599,
  5656,
  5665,
  5678,
  5757,
  5775,
  5858,
  5885,
  5959,
  5995,
  6006,
  6060,
  6116,
  6161,
  6226,
  6262,
  6336,
  6363,
  6446,
  6464,
  6556,
  6565,
  6600,
  6611,
  6622,
  6633,
  6644,
  6655,
  6666,
  6677,
  6688,
  6699,
  6767,
  6776,
  6789,
  6868,
  6886,
  6969,
  6996,
  7007,
  7070,
  7117,
  7171,
  7227,
  7272,
  7337,
  7373,
  7447,
  7474,
  7557,
  7575,
  7667,
  7676,
  7700,
  7711,
  7722,
  7733,
  7744,
  7755,
  7766,
  7777,
  7788,
  7799,
  7878,
  7887,
  7979,
  7997,
  8008,
  8080,
  8118,
  8181,
  8228,
  8282,
  8338,
  8383,
  8448,
  8484,
  8558,
  8585,
  8668,
  8686,
  8778,
  8787,
  8800,
  8811,
  8822,
  8833,
  8844,
  8855,
  8866,
  8877,
  8888,
  8899,
  8989,
  8998,
  9009,
  9090,
  9119,
  9191,
  9229,
  9292,
  9339,
  9393,
  9449,
  9494,
  9559,
  9595,
  9669,
  9696,
  9779,
  9797,
  9889,
  9898,
  9900,
  9911,
  9922,
  9933,
  9944,
  9955,
  9966,
  9977,
  9988,
  9999
];

@kntphu
Copy link

kntphu commented Mar 22, 2023

สวัสดีครับ ลองใช้ Code นี้ดูครับ

var v_chase = 'MR0AB3GSX02559035';
var v_cardid = '0105561210237';
var v_fname = 'จองทะเบียน';
var v_lname = 'รถยนต์';
var v_tel = '021212000';
var v_title = 'นาย';
var v_brand = 'TOYOTA';
var v_number = '9989';

isbody = v_chase.length;

$('td:empty').remove();
$('tr:empty').remove();

var $id1 = $('td:contains(เลขบัตรประชาชน)');
$id1.closest('tr').next('tr').find('input[type="text"]:visible').val(v_cardid);

var $name1 = $('td:contains(ชื่อ)');
$name1.closest('tr').next('tr').find('input[type="text"]:visible').val(v_fname);

var $name1 = $('td:contains(นามสกุล)');
$name1.closest('tr').next('tr').find('input[type="text"]:visible').val(v_lname);

var $name1 = $('td:contains(โทรศัพท์)');
$name1.closest('tr').next('tr').find('input[type="text"]:visible').val(v_tel);

var $name1 = $('td:contains(เลขตัวถัง)');
$name1.closest('tr').next('tr').find('input[type="text"]:visible').val(v_chase);

$('option[value="นาย"]').closest('select').val(v_title);
$('option[value="HONDA"]').closest('select').val(v_brand);

$('#number').val(v_number);

@kntphu
Copy link

kntphu commented Mar 22, 2023

ต้องทำเพิ่มในส่วน Auto Refresh เมื่อเวลาเจอ Error Service Unavailable ครับ

@githubhub9
Copy link

githubhub9 commented Apr 12, 2023

มีตัวฉบับสามารถใช้งานได้ให้ลองไหมครับ

Code ที่ให้มาใช้ยังไงครับ

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