GitHub Auto-Fill Form

try to take over the world!

  1. // ==UserScript==
  2. // @name GitHub Auto-Fill Form
  3. // @version 2024-02-25
  4. // @description try to take over the world!
  5. // @author SMNET
  6. // @license MIT
  7. // @grant GM_xmlhttpRequest
  8. // @match https://github.com/github-copilot/signup/billing?*
  9. // @match https://github.com/github-copilot/signup/success
  10. // @match https://github.com/github-copilot/signup/settings
  11. // @match https://github.com/join/welcome
  12. // @namespace https://gf.qytechs.cn/users/1218336
  13. // ==/UserScript==
  14.  
  15. function fillForm3() {
  16. let summaryElement = document.querySelector('summary[data-view-component="true"]');
  17. if(summaryElement) {
  18. summaryElement.click();
  19. setTimeout(() => {
  20. let allowedButton = document.querySelector('button[value="allowed"]');
  21. if(allowedButton) {
  22. allowedButton.click();
  23. setTimeout(() => {
  24. let saveButton = document.getElementById('copilot_settings_submit');
  25. if(saveButton) {
  26. saveButton.click();
  27. } else {
  28. console.error('Could not find the "Save and complete setup" button');
  29. }
  30. }, 100);
  31. } else {
  32. console.error('Could not find the "Allowed" button');
  33. }
  34. }, 100);
  35. } else {
  36. console.error('Could not find the summary element');
  37. }
  38. }
  39. function fillForm1(data) {
  40. let firstName = data.address.Full_Name.split(" ")[0];
  41. let lastName = data.address.Full_Name.split(" ")[1] || firstName;
  42. document.querySelector('input[name="user_contact_info[first_name]"]').value = firstName;
  43. document.querySelector('input[name="user_contact_info[last_name]"]').value = lastName;
  44. let countrySelect1 = document.querySelector('select[name="user_contact_info[country]"]');
  45. for(let i=0; i<countrySelect1.options.length; i++){
  46. if(countrySelect1.options[i].innerText === 'United States of America'){
  47. countrySelect1.value = countrySelect1.options[i].value;
  48. break;
  49. }
  50. }
  51. let submitButton = document.querySelector('button.btn-primary.btn.width-full.mt-3');
  52. if(submitButton) {
  53. submitButton.click();
  54. } else {
  55. console.error('Could not find the "Submit" button');
  56. }
  57. }
  58. function fillForm2(data) {
  59. let firstName = data.address.Full_Name.split(" ")[0];
  60. let lastName = data.address.Full_Name.split(" ")[1] || firstName;
  61. document.querySelector('input[name="account_screening_profile[first_name]"]').value = firstName;
  62. document.querySelector('input[name="account_screening_profile[last_name]"]').value = lastName;
  63. document.querySelector('input[name="account_screening_profile[address1]"]').value = data.address.Address;
  64. document.querySelector('input[name="account_screening_profile[city]"]').value = data.address.City;
  65. document.querySelector('input[name="account_screening_profile[region]"]').value = data.address.State;
  66. document.querySelector('input[name="account_screening_profile[postal_code]"]').value = data.address.Zip_Code;
  67. let countrySelect2 = document.querySelector('select[name="account_screening_profile[country_code]"]');
  68. for(let i=0; i<countrySelect2.options.length; i++){
  69. if(countrySelect2.options[i].innerText === 'United States of America'){
  70. countrySelect2.value = countrySelect2.options[i].value;
  71. break;
  72. }
  73. }
  74. let checkElement = document.querySelector('h4.mb-3');
  75. if(checkElement && checkElement.innerText.trim() === 'Payment method') {
  76. return;
  77. } else {
  78. let saveButton = document.querySelector('button[name="submit"][type="submit"]');
  79. if (saveButton) saveButton.click();
  80. }
  81. }
  82. window.onload = () => {
  83. let currentUrl = window.location.href;
  84. let specificElement = document.querySelector('#copilot_settings_telemetry');
  85.  
  86.  
  87. if (currentUrl === "https://github.com/github-copilot/signup/settings") {
  88. window.location.href = "https://cocopilot.org/copilot/token";
  89. }
  90. else if (currentUrl === "https://github.com/join/welcome") {
  91. window.location.href = "https://github.com/github-copilot/signup/billing?payment_duration=monthly";
  92. }
  93. else if (specificElement) {
  94. return fillForm3();
  95. } else {
  96. GM_xmlhttpRequest({
  97. method: 'POST',
  98. url: 'https://www.meiguodizhi.com/api/v1/dz',
  99. headers: {
  100. 'Content-Type': 'application/json',
  101. },
  102. data: JSON.stringify({
  103. "city": "",
  104. "path": "/",
  105. "method": "refresh"
  106. }),
  107. onload: (response) => {
  108. var data = JSON.parse(response.responseText);
  109. specificElement = document.querySelector('input[name="user_contact_info[first_name]"]');
  110. if (specificElement) {
  111. fillForm1(data);
  112. } else {
  113. fillForm2(data);
  114. }
  115. },
  116. onerror: (error) => {
  117. console.error('Error during request:', error);
  118. }
  119. });
  120. }
  121. };

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址