复制天眼查和国家企业信息公示系统企业信息

在天眼查网站和国家企业信用信息公示系统的网页上增加复制企业信息的按钮,以方便地复制这些信息到剪贴板

  1. // ==UserScript==
  2. // @name 复制天眼查和国家企业信息公示系统企业信息
  3. // @namespace http://www.patenthomes.com
  4. // @version 0.2
  5. // @description 在天眼查网站和国家企业信用信息公示系统的网页上增加复制企业信息的按钮,以方便地复制这些信息到剪贴板
  6. // @author 北溟之鲲
  7. // @match *://www.tianyancha.com/company/*
  8. // @match *://*.gsxt.gov.cn/*
  9. // @grant GM_setClipboard
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 定义选择器
  17. const currentDomain = window.location.hostname;
  18. var selectorName;
  19. var selectorDaima;
  20. var selectorDizhi;
  21. if(currentDomain.includes('tianyancha.com')) {
  22. selectorName = document.querySelector('#page-root > div.page-container.relative > div > div.layout_company-header__C4hcj > div.layout_company-header-main__nuikF > div.layout_company-header-right__oIUZw > div.index_company-header-content__Ayzr2 > div.index_header-top__JbFpN > div.index_header-top-content__Xt_KQ > div.index_header-wrap__YwG4E > div.index_header__uN4nR > h1').textContent;
  23. selectorDaima = document.querySelector('#page-root > div.page-container.relative > div > div.layout_company-header__C4hcj > div.layout_company-header-main__nuikF > div.layout_company-header-right__oIUZw > div.index_company-header-content__Ayzr2 > div.index_detail__JSmQM > div.index_detail-content__RCnTr > div.detail-item.index_detail-item-first__IS2_h > div:nth-child(1) > div > span').textContent;
  24. selectorDizhi = document.querySelector('#page-root > div.page-container.relative > div > div.layout_company-header__C4hcj > div.layout_company-header-main__nuikF > div.layout_company-header-right__oIUZw > div.index_company-header-content__Ayzr2 > div.index_detail__JSmQM > div.index_detail-content__RCnTr > div.detail-item.index_detail-item-second__0_Da1 > div:nth-child(4) > div > span.index_copy-text__ri7W6.index_detail-address-moretext__9R_Z1').textContent;
  25. } else {
  26. selectorName = document.querySelector('body > div.container > div.container1 > div.result > div.page > div.nameBox.clearfix > div.companyDetail.clearfix > div > h1').textContent.replace(/[\r\n\s\u00a0]/g, '');
  27. selectorDaima = document.querySelector('body > div.container > div.container1 > div.result > div.page > div.nameBox.clearfix > div.companyDetail.clearfix > span:nth-child(2) > span').textContent;
  28. selectorDizhi = document.querySelector('#primaryInfo > div > div.overview > dl:nth-child(9) > dd').textContent;
  29. }
  30. // 创建按钮
  31. const copyNameButton = document.createElement('button');
  32. copyNameButton.textContent = '复制企业名称';
  33. copyNameButton.style.position = 'fixed';
  34. copyNameButton.style.top = '85px';
  35. copyNameButton.style.right = '10px';
  36. copyNameButton.style.zIndex = '9999';
  37. copyNameButton.style.backgroundColor = '#4CAF50';
  38. copyNameButton.style.border = '1px solid blue';
  39. copyNameButton.style.color = 'white';
  40. copyNameButton.style.padding = '1px 5px 1px 5px';
  41.  
  42. const copyDaimaButton = document.createElement('button');
  43. copyDaimaButton.textContent = '复制信用代码';
  44. copyDaimaButton.style.position = 'fixed';
  45. copyDaimaButton.style.top = '110px';
  46. copyDaimaButton.style.right = '10px';
  47. copyDaimaButton.style.zIndex = '9999';
  48. copyDaimaButton.style.backgroundColor = '#4CAF50';
  49. copyDaimaButton.style.border = '1px solid blue';
  50. copyDaimaButton.style.color = 'white';
  51. copyDaimaButton.style.padding = '1px 5px 1px 5px';
  52.  
  53. const copyDizhiButton = document.createElement('button');
  54. copyDizhiButton.textContent = '复制企业地址';
  55. copyDizhiButton.style.position = 'fixed';
  56. copyDizhiButton.style.top = '135px';
  57. copyDizhiButton.style.right = '10px';
  58. copyDizhiButton.style.zIndex = '9999';
  59. copyDizhiButton.style.backgroundColor = '#4CAF50';
  60. copyDizhiButton.style.border = '1px solid blue';
  61. copyDizhiButton.style.color = 'white';
  62. copyDizhiButton.style.padding = '1px 5px 1px 5px';
  63.  
  64. // Add an event listener to the button
  65. copyNameButton.addEventListener('click', () => {
  66. GM_setClipboard(selectorName);
  67. });
  68. // Add an event listener to the button
  69. copyDaimaButton.addEventListener('click', () => {
  70. GM_setClipboard(selectorDaima);
  71. });
  72. // Add an event listener to the button
  73. copyDizhiButton.addEventListener('click', () => {
  74. GM_setClipboard(selectorDizhi);
  75. });
  76.  
  77. // Append the button to the body
  78. document.body.appendChild(copyNameButton);
  79. document.body.appendChild(copyDaimaButton);
  80. document.body.appendChild(copyDizhiButton);
  81. })();

QingJ © 2025

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