Last active
August 9, 2017 05:14
-
-
Save royalgarter/fc135b694a9595c99554f2655be99361 to your computer and use it in GitHub Desktop.
VCB CITAD Transfer
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
const fnOnload = () => { | |
if (!~window.location.href.indexOf('Transfer.aspx')) return; | |
let citad = localStorage.getItem('ATADI-CK-CITAD'); | |
if (!citad) { | |
const $input = $('<input type="button" value="Nhập CITAD" id="btcitad"/>'); | |
if ($('#btcitad').length <= 0) $input.appendTo($('[class="tbllisting hasborder"]')); | |
$('#btcitad').one('click', x => { | |
let citad = prompt("Nhập số CITAD here", "").trim(); | |
if (!citad || citad.length != 8) return alert('CITAD Invalid'); | |
console.log('CITAD', citad); | |
localStorage.setItem('ATADI-CK-CITAD', citad); | |
return fnOnload(); | |
}); | |
} else { | |
citad = { | |
raw: citad, | |
province: citad.substr(0, 2), | |
type: citad.substr(2, 1), | |
bank:citad.substr(2, 3), | |
branch: citad.substr(5), | |
} | |
const ids = { | |
type: '#ctl00_Content_BenBankList_VNBank_BenBankTypeList_VNB', | |
bank: '#ctl00_Content_BenBankList_VNBank_BenBankList_VNB', | |
province: '#ctl00_Content_BenBankList_VNBank_ProvinceList_VNB', | |
branch: '#ctl00_Content_BenBankList_VNBank_BranchBankList_VNB', | |
} | |
console.log('CITAD', citad); | |
if ($(ids.type).val() == 0) return $(ids.type).val(citad.type).change(); | |
if ($(ids.bank).val() == 0) return $(ids.bank).val(citad.bank).change(); | |
if ($(ids.province).val() == 0) return $(ids.province).val(citad.province).change(); | |
if ($(ids.branch).val() == 0) { | |
$(ids.branch).val(citad.raw).change(); | |
localStorage.removeItem('ATADI-CK-CITAD'); | |
} | |
} | |
} | |
$( document ).ready(fnOnload); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment