您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
- // ==UserScript==
- // @name GitHub Auto-Fill Form
- // @version 2024-02-19
- // @description try to take over the world!
- // @author SMNET
- // @license MIT
- // @grant GM_xmlhttpRequest
- // @match https://github.com/github-copilot/signup/billing?*
- // @namespace https://greasyfork.org/users/1218336
- // ==/UserScript==
- function fillForm1(data) {
- let firstName = data.address.Full_Name.split(" ")[0];
- let lastName = data.address.Full_Name.split(" ")[1] || firstName;
- document.querySelector('input[name="user_contact_info[first_name]"]').value = firstName;
- document.querySelector('input[name="user_contact_info[last_name]"]').value = lastName;
- let countrySelect1 = document.querySelector('select[name="user_contact_info[country]"]');
- for(let i=0; i<countrySelect1.options.length; i++){
- if(countrySelect1.options[i].innerText === 'United States of America'){
- countrySelect1.value = countrySelect1.options[i].value;
- break;
- }
- }
- }
- function fillForm2(data) {
- let firstName = data.address.Full_Name.split(" ")[0];
- let lastName = data.address.Full_Name.split(" ")[1] || firstName;
- document.querySelector('input[name="account_screening_profile[first_name]"]').value = firstName;
- document.querySelector('input[name="account_screening_profile[last_name]"]').value = lastName;
- document.querySelector('input[name="account_screening_profile[address1]"]').value = data.address.Address;
- document.querySelector('input[name="account_screening_profile[city]"]').value = data.address.City;
- document.querySelector('input[name="account_screening_profile[region]"]').value = data.address.State;
- document.querySelector('input[name="account_screening_profile[postal_code]"]').value = data.address.Zip_Code;
- let countrySelect2 = document.querySelector('select[name="account_screening_profile[country_code]"]');
- for(let i=0; i<countrySelect2.options.length; i++){
- if(countrySelect2.options[i].innerText === 'United States of America'){
- countrySelect2.value = countrySelect2.options[i].value;
- break;
- }
- }
- let checkElement = document.querySelector('h4.mb-3');
- if(checkElement && checkElement.innerText.trim() === 'Payment method') {
- return;
- } else {
- let saveButton = [...document.querySelectorAll('button')].filter(button => button.innerText.trim() === 'Save')[0];
- if (saveButton) saveButton.click();
- }
- }
- 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);
- let specificElement = document.querySelector('input[name="user_contact_info[first_name]"]');
- if (specificElement) {
- fillForm1(data);
- } else {
- fillForm2(data);
- }
- },
- onerror: (error) => {
- console.error('Error during request:', error);
- }
- });
- };