「Z-Blog」插件工具 For 视频云点播

用于快捷得到`[cloudVideo:tencent:${strID}]${strTitle}[/cloudVideo]`格式的代码;

  1. // ==UserScript==
  2. // @name 「Z-Blog」插件工具 For 视频云点播
  3. // @namespace https://www.wdssmq.com/
  4. // @version 0.3
  5. // @author 沉冰浮水
  6. // @description 用于快捷得到`[cloudVideo:tencent:${strID}]${strTitle}[/cloudVideo]`格式的代码;
  7. // @null ----------------------------
  8. // @contributionURL https://github.com/wdssmq#%E4%BA%8C%E7%BB%B4%E7%A0%81
  9. // @contributionAmount 5.93
  10. // @null ----------------------------
  11. // @link https://github.com/wdssmq/userscript
  12. // @link https://afdian.net/@wdssmq
  13. // @link https://gf.qytechs.cn/zh-CN/users/6865-wdssmq
  14. // @null ----------------------------
  15. // @match https://console.cloud.tencent.com/vod/media*
  16. // @match https://vod.console.aliyun.com/*
  17. // @grant GM_setClipboard
  18. // ==/UserScript==
  19.  
  20. /* jshint esversion:6 */
  21. (function () {
  22. "use strict";
  23. "esversion: 6";
  24. function $n(e) {
  25. return document.querySelector(e);
  26. }
  27. function $na(e) {
  28. return document.querySelectorAll(e);
  29. }
  30. // 直觉应该用 mouseenter,然而并不是
  31. $n("body").addEventListener(
  32. "mouseover",
  33. function (e) {
  34. // console.log(e.target);
  35. // console.log(e.target.nodeName);
  36. // console.log(e.target.className || "class为空");
  37.  
  38. // 实际代码
  39. let elThis = e.target;
  40. if (location.host.indexOf("aliyun.com") > -1) {
  41. fnAliyun(elThis);
  42. } else {
  43. fnTencent(elThis);
  44. }
  45. },
  46. false,
  47. );
  48. // 阿里
  49. function fnAliyun(elThis) {
  50. if (elThis.nodeName !== "TD") {
  51. return;
  52. }
  53. if (elThis.dataset.done === "1") {
  54. return;
  55. }
  56. if (!elThis.querySelector(".mod-component-video-item")) {
  57. return;
  58. }
  59. const elInfo = elThis.querySelector(".video-info");
  60. let strTitle = elInfo.querySelector(".video-info-title").innerHTML.trim();
  61. let strID = elInfo
  62. .querySelector("dd:nth-of-type(2)")
  63. .innerHTML.replace(/ID:/, "")
  64. .trim();
  65. let strCode = `[cloudVideo:aliyun:${strID}]${strTitle}[/cloudVideo]`;
  66. console.log(strCode);
  67.  
  68. // 复制按钮
  69. let elA = document.createElement("a");
  70. elA.style.paddingLeft = "1em";
  71. elA.href = "javascript:;";
  72. elA.innerHTML = "「cvp-复制代码」";
  73. elA.addEventListener("click", function (e) {
  74. elA.innerHTML = "「cvp-复制成功」";
  75. GM_setClipboard(strCode);
  76. });
  77. elThis.querySelector(".video-info-title").appendChild(elA);
  78. elThis.dataset.done = "1";
  79. }
  80. // 腾讯
  81. function fnTencent(elThis) {
  82. if (elThis.nodeName !== "TD") {
  83. return;
  84. }
  85. if (elThis.dataset.done === "1") {
  86. return;
  87. }
  88. if (!elThis.querySelector(".app-vod-media")) {
  89. return;
  90. }
  91. let strTitle = elThis.querySelector(".media-name").innerHTML.trim();
  92. let strID = elThis
  93. .querySelector(".app-vod-media__body p")
  94. .innerHTML.replace(/ID:/, "")
  95. .trim();
  96. let strCode = `[cloudVideo:tencent:${strID}]${strTitle}[/cloudVideo]`;
  97. console.log(strCode);
  98.  
  99. // 复制按钮
  100. let elA = document.createElement("a");
  101. // elA.style.paddingLeft = "1em";
  102. elA.href = "javascript:;";
  103. elA.innerHTML = "「cvp-复制代码」";
  104. elA.setAttribute("class", "text-vm");
  105. elA.addEventListener("click", function (e) {
  106. elA.innerHTML = "「cvp-复制成功」";
  107. GM_setClipboard(strCode);
  108. });
  109. elThis.querySelector(".app-vod-media__body").appendChild(elA);
  110. elThis.dataset.done = "1";
  111. }
  112. })();

QingJ © 2025

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