Copy ASF Code Button

Adds a button to copy ASF code to clipboard

  1. // ==UserScript==
  2. // @name Copy ASF Code Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.01
  5. // @description Adds a button to copy ASF code to clipboard
  6. // @author 祈之羽
  7. // @match https://keylol.com/*
  8. // @grant GM_setClipboard
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var hasSteamAppPaths = Array.from(document.querySelectorAll('a[href]')).some(link => link.href.includes('store.steampowered.com/app/'));
  15. if (hasSteamAppPaths) {
  16. var copyButton = document.createElement('button');
  17. copyButton.innerHTML = 'Copy ASF Code';
  18. copyButton.style.position = 'fixed';
  19. copyButton.style.top = '20px';
  20. copyButton.style.left = '20px';
  21. copyButton.style.zIndex = '9999';
  22. copyButton.addEventListener('click', function() {
  23. var links = document.querySelectorAll('a[href]');
  24. var numbers = new Set();
  25. links.forEach(function(link) {
  26. var match = link.href.match(/store\.steampowered\.com\/app\/(\d+)/);
  27. if (match) {
  28. numbers.add(match[1]);
  29. }
  30. });
  31. var asfCode = '!addlicense asf ' + Array.from(numbers).map(number => 'a/' + number).join(',');
  32. GM_setClipboard(asfCode);
  33. alert('ASF code copied to clipboard!');
  34. });
  35. document.body.appendChild(copyButton);
  36. }
  37. })();

QingJ © 2025

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