SMNET GitHub
当前为
// ==UserScript==
// @name GitHub Auto-Fill Form
// @version 2024-02-18
// @description SMNET GitHub
// @author SMNET 2311676378
// @license MIT
// @grant GM_xmlhttpRequest
// @match https://github.com/github-copilot/signup/billing?*
// @namespace https://greasyfork.org/users/1218336
// ==/UserScript==
function fillForm(data) {
let firstName = data.address.Full_Name.split(" ")[0];
let lastName = data.address.Full_Name.split(" ")[1] || firstName;
document.getElementById('account_screening_profile_first_name').value = firstName;
document.getElementById('account_screening_profile_last_name').value = lastName;
document.getElementById('account_screening_profile_address1').value = data.address.Address;
document.getElementById('account_screening_profile_city').value = data.address.City;
document.getElementById('account_screening_profile_region').value = data.address.State_Full;
let countrySelect = document.getElementById('account_screening_profile_country_code');
for(let i=0; i<countrySelect.options.length; i++){
if(countrySelect.options[i].innerText === 'United States of America'){
countrySelect.value = countrySelect.options[i].value;
break;
}
}
document.getElementById('account_screening_profile_postal_code').value = data.address.Zip_Code;
}
window.onload = () => {
GM_xmlhttpRequest({
method: 'POST',
url: 'https://www.meiguodizhi.com/api/v1/dz',
headers: {
'Content-Type': 'application/json',
},
data: JSON.stringify({
"city": "",
"path": "/",
"method": "refresh"
}),
onload: (response) => {
var data = JSON.parse(response.responseText);
fillForm(data);
},
onerror: (error) => {
console.error('Error during request:', error);
}
});
};