🏠 返回首頁 

Greasy Fork is available in English.

点击跳转到Keylol论坛tag页面 (SteamDB悬浮按钮)

添加一个悬浮按钮,点击后跳转到Keylol论坛的tag页面 (SteamDB)


安装此脚本?
  1. // ==UserScript==
  2. // @name 点击跳转到Keylol论坛tag页面 (SteamDB悬浮按钮)
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 添加一个悬浮按钮,点击后跳转到Keylol论坛的tag页面 (SteamDB)
  6. // @author You
  7. // @match https://steamdb.info/app/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant GM_setClipboard
  10. // @license MIT
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14. // 等待页面加载完成
  15. window.addEventListener('load', function() {
  16. // 获取当前页面的 appid
  17. const appid = window.location.pathname.split('/')[2]; // 提取 appid 部分
  18. console.log("当前appid:", appid);
  19. // 创建一个悬浮按钮
  20. let btn = document.createElement('button');
  21. btn.innerText = '跳转到Keylol论坛tag';
  22. btn.style.position = 'fixed'; // 固定位置
  23. btn.style.bottom = '30px'; // 距离页面底部20px
  24. btn.style.right = '20px'; // 距离页面右侧20px
  25. btn.style.padding = '15px 30px';
  26. btn.style.backgroundColor = '#1f1f1f';
  27. btn.style.color = '#fff';
  28. btn.style.border = 'none';
  29. btn.style.borderRadius = '5px';
  30. btn.style.cursor = 'pointer';
  31. btn.style.fontSize = '14px';
  32. btn.style.zIndex = '1000'; // 确保按钮显示在其他元素之上
  33. // 将按钮添加到页面中
  34. document.body.appendChild(btn);
  35. // 按钮点击事件
  36. btn.addEventListener('click', function(e) {
  37. e.preventDefault(); // 阻止默认行为
  38. // 构造跳转链接
  39. const redirectUrl = `https://keylol.com/plugin.php?id=keylol_tags:redirect&appid=${appid}`;
  40. console.log("跳转链接:", redirectUrl);
  41. // 跳转到 Keylol 论坛页面
  42. window.open(redirectUrl, '_blank');
  43. });
  44. });
  45. })();