闲鱼链接&口令转换(cover:去你大爷的闲鱼口令)

在 https://www.v2ex.com/t/686313 的基础上做了细微的修改,将 V2EX 帖子中的闲鱼口令/淘口令/链接转换为可直接访问的链接,使您可一键直达闲鱼/淘宝。

  1. // ==UserScript==
  2. // @name 闲鱼链接&口令转换(cover:去你大爷的闲鱼口令)
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.1
  5. // @description 在 https://www.v2ex.com/t/686313 的基础上做了细微的修改,将 V2EX 帖子中的闲鱼口令/淘口令/链接转换为可直接访问的链接,使您可一键直达闲鱼/淘宝。
  6. // @author Wood, Liby
  7. // @match https://*.v2ex.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. const text = document.body.innerText;
  14. const aTagCollection = document.body.getElementsByTagName('a');
  15. const tkl = text.match(/[€|¥][A-Za-z0-9]+[€|¥]/g);
  16. const marketUrlCollection = text.match(/https:\/\/market.m.taobao.com\/.*/gm);
  17.  
  18. function createNode(url) {
  19. const template = `<span onclick="addIframe('${url}')" style="color: red; padding: 0 .5em; font-weight: 500; cursor: pointer;">点击查看</span>`;
  20. let tempNode = document.createElement('div');
  21. tempNode.innerHTML = template;
  22. return tempNode.firstChild;
  23. }
  24.  
  25. window.addIframe = (url) => {
  26. const viewDom = document.getElementById("viewGoods");
  27. viewDom && viewDom.remove();
  28. let div = document.createElement("div");
  29. div.setAttribute("id", "viewGoods");
  30. div.innerHTML = `
  31. <div><span onclick="document.getElementById('viewGoods').remove()" style="width: 60px;height: 30px;color: white;background: red;display: inline-block;text-align: center;line-height: 30px;float: right;cursor: pointer;">关闭</span></div>
  32. <iframe src=${url}" style="width: 300px;height: 540px;background: white;">`;
  33. div.style.position = "fixed";
  34. div.style.bottom = "3em";
  35. div.style.right = "4em";
  36. document.body.appendChild(div);
  37. }
  38.  
  39. for (let i = 0; i < aTagCollection.length; i += 1) {
  40. if (marketUrlCollection?.includes(aTagCollection?.[i]?.href)) {
  41. const newNode = createNode(aTagCollection[i].href);
  42. aTagCollection[i].parentNode.replaceChild(newNode, aTagCollection[i]);
  43. }
  44. }
  45.  
  46. tkl?.forEach(item => {
  47. if (fetch) {
  48. fetch(`https://jckhj8su.demo.wood-is.top/tkl/tkljm?apikey=ZwuJXDIBef&tkl=${item}`)
  49. .then(res => {
  50. res.json()
  51. .then(data => {
  52. const {content, url} = data;
  53. document.body.innerHTML = document.body.innerHTML.replace(item, `<span title="${content}" onclick="addIframe('${url}')" style="color: red; padding: 0 .5em; font-weight: 500; cursor: pointer;">${item}</span>`)
  54. })
  55. })
  56. }
  57. });
  58. })();

QingJ © 2025

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