PestPac Phone Number to tel: Link

Convert data-phonenumber to tel links

目前为 2025-02-21 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name PestPac Phone Number to tel: Link
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Convert data-phonenumber to tel links
  6. // @match https://app.pestpac.com/location/detail.asp*
  7. // @grant none
  8. // @license MIT
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Function to convert data-phonenumber to tel links
  15. function convertPhoneNumbers() {
  16. const phoneElements = document.querySelectorAll('[data-phonenumber]');
  17. phoneElements.forEach(element => {
  18. const phoneNumber = element.getAttribute('data-phonenumber');
  19. if (phoneNumber) {
  20. const telLink = document.createElement('a');
  21. telLink.href = `tel:${phoneNumber}`;
  22. telLink.textContent = phoneNumber;
  23. element.parentNode.replaceChild(telLink, element);
  24. }
  25. });
  26. }
  27.  
  28. // Run the conversion when the page loads
  29. window.addEventListener('load', convertPhoneNumbers);
  30. })();

QingJ © 2025

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