Douban

Something about douban.

  1. // ==UserScript==
  2. // @name Douban
  3. // @namespace impossible98/douban
  4. // @version 0.0.1
  5. // @author impossible98
  6. // @description Something about douban.
  7. // @license MIT
  8. // @icon https://vitejs.dev/logo.svg
  9. // @homepageURL https://plutodoc.coding.net/public/monkey/douban-extension/git/files
  10. // @match https://movie.douban.com/subject/*
  11. // @require https://cdn.jsdelivr.net/npm/react@18.3.1/umd/react.production.min.js
  12. // @require https://cdn.jsdelivr.net/npm/react-dom@18.3.1/umd/react-dom.production.min.js
  13. // @grant GM_addStyle
  14. // ==/UserScript==
  15.  
  16. (t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const e=document.createElement("style");e.textContent=t,document.head.append(e)})(" .i-icon{display:inline-block;color:inherit;font-style:normal;line-height:0;text-align:center;text-transform:none;vertical-align:-.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.i-icon-spin svg{animation:i-icon-spin 1s infinite linear}.i-icon-rtl{transform:scaleX(-1)}@keyframes i-icon-spin{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes i-icon-spin{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.App{background:#f4f4ec;padding:10px;margin-bottom:20px;word-wrap:break-word}div{display:block}button{margin-left:10px} ");
  17.  
  18. (function (React, require$$0) {
  19. 'use strict';
  20.  
  21. var jsxRuntime = { exports: {} };
  22. var reactJsxRuntime_production_min = {};
  23. /**
  24. * @license React
  25. * react-jsx-runtime.production.min.js
  26. *
  27. * Copyright (c) Facebook, Inc. and its affiliates.
  28. *
  29. * This source code is licensed under the MIT license found in the
  30. * LICENSE file in the root directory of this source tree.
  31. */
  32. var f = React, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m$1 = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
  33. function q(c, a, g) {
  34. var b, d = {}, e = null, h = null;
  35. void 0 !== g && (e = "" + g);
  36. void 0 !== a.key && (e = "" + a.key);
  37. void 0 !== a.ref && (h = a.ref);
  38. for (b in a) m$1.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
  39. if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
  40. return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
  41. }
  42. reactJsxRuntime_production_min.Fragment = l;
  43. reactJsxRuntime_production_min.jsx = q;
  44. reactJsxRuntime_production_min.jsxs = q;
  45. {
  46. jsxRuntime.exports = reactJsxRuntime_production_min;
  47. }
  48. var jsxRuntimeExports = jsxRuntime.exports;
  49. var client = {};
  50. var m = require$$0;
  51. {
  52. client.createRoot = m.createRoot;
  53. client.hydrateRoot = m.hydrateRoot;
  54. }
  55. var _excluded = ["size", "strokeWidth", "strokeLinecap", "strokeLinejoin", "theme", "fill", "className", "spin"];
  56. function ownKeys(object, enumerableOnly) {
  57. var keys = Object.keys(object);
  58. if (Object.getOwnPropertySymbols) {
  59. var symbols = Object.getOwnPropertySymbols(object);
  60. enumerableOnly && (symbols = symbols.filter(function(sym) {
  61. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  62. })), keys.push.apply(keys, symbols);
  63. }
  64. return keys;
  65. }
  66. function _objectSpread(target) {
  67. for (var i = 1; i < arguments.length; i++) {
  68. var source = null != arguments[i] ? arguments[i] : {};
  69. i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
  70. _defineProperty(target, key, source[key]);
  71. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
  72. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  73. });
  74. }
  75. return target;
  76. }
  77. function _defineProperty(obj, key, value) {
  78. if (key in obj) {
  79. Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  80. } else {
  81. obj[key] = value;
  82. }
  83. return obj;
  84. }
  85. function _objectWithoutProperties(source, excluded) {
  86. if (source == null) return {};
  87. var target = _objectWithoutPropertiesLoose(source, excluded);
  88. var key, i;
  89. if (Object.getOwnPropertySymbols) {
  90. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  91. for (i = 0; i < sourceSymbolKeys.length; i++) {
  92. key = sourceSymbolKeys[i];
  93. if (excluded.indexOf(key) >= 0) continue;
  94. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  95. target[key] = source[key];
  96. }
  97. }
  98. return target;
  99. }
  100. function _objectWithoutPropertiesLoose(source, excluded) {
  101. if (source == null) return {};
  102. var target = {};
  103. var sourceKeys = Object.keys(source);
  104. var key, i;
  105. for (i = 0; i < sourceKeys.length; i++) {
  106. key = sourceKeys[i];
  107. if (excluded.indexOf(key) >= 0) continue;
  108. target[key] = source[key];
  109. }
  110. return target;
  111. }
  112. var DEFAULT_ICON_CONFIGS = {
  113. size: "1em",
  114. strokeWidth: 4,
  115. strokeLinecap: "round",
  116. strokeLinejoin: "round",
  117. rtl: false,
  118. theme: "outline",
  119. colors: {
  120. outline: {
  121. fill: "#333",
  122. background: "transparent"
  123. },
  124. filled: {
  125. fill: "#333",
  126. background: "#FFF"
  127. },
  128. twoTone: {
  129. fill: "#333",
  130. twoTone: "#2F88FF"
  131. },
  132. multiColor: {
  133. outStrokeColor: "#333",
  134. outFillColor: "#2F88FF",
  135. innerStrokeColor: "#FFF",
  136. innerFillColor: "#43CCF8"
  137. }
  138. },
  139. prefix: "i"
  140. };
  141. function guid() {
  142. return "icon-" + ((1 + Math.random()) * 4294967296 | 0).toString(16).substring(1);
  143. }
  144. function IconConverter(id, icon, config) {
  145. var fill = typeof icon.fill === "string" ? [icon.fill] : icon.fill || [];
  146. var colors = [];
  147. var theme = icon.theme || config.theme;
  148. switch (theme) {
  149. case "outline":
  150. colors.push(typeof fill[0] === "string" ? fill[0] : "currentColor");
  151. colors.push("none");
  152. colors.push(typeof fill[0] === "string" ? fill[0] : "currentColor");
  153. colors.push("none");
  154. break;
  155. case "filled":
  156. colors.push(typeof fill[0] === "string" ? fill[0] : "currentColor");
  157. colors.push(typeof fill[0] === "string" ? fill[0] : "currentColor");
  158. colors.push("#FFF");
  159. colors.push("#FFF");
  160. break;
  161. case "two-tone":
  162. colors.push(typeof fill[0] === "string" ? fill[0] : "currentColor");
  163. colors.push(typeof fill[1] === "string" ? fill[1] : config.colors.twoTone.twoTone);
  164. colors.push(typeof fill[0] === "string" ? fill[0] : "currentColor");
  165. colors.push(typeof fill[1] === "string" ? fill[1] : config.colors.twoTone.twoTone);
  166. break;
  167. case "multi-color":
  168. colors.push(typeof fill[0] === "string" ? fill[0] : "currentColor");
  169. colors.push(typeof fill[1] === "string" ? fill[1] : config.colors.multiColor.outFillColor);
  170. colors.push(typeof fill[2] === "string" ? fill[2] : config.colors.multiColor.innerStrokeColor);
  171. colors.push(typeof fill[3] === "string" ? fill[3] : config.colors.multiColor.innerFillColor);
  172. break;
  173. }
  174. return {
  175. size: icon.size || config.size,
  176. strokeWidth: icon.strokeWidth || config.strokeWidth,
  177. strokeLinecap: icon.strokeLinecap || config.strokeLinecap,
  178. strokeLinejoin: icon.strokeLinejoin || config.strokeLinejoin,
  179. colors,
  180. id
  181. };
  182. }
  183. var IconContext = /* @__PURE__ */ React.createContext(DEFAULT_ICON_CONFIGS);
  184. IconContext.Provider;
  185. function IconWrapper(name, rtl, render) {
  186. return function(props) {
  187. var size = props.size, strokeWidth = props.strokeWidth, strokeLinecap = props.strokeLinecap, strokeLinejoin = props.strokeLinejoin, theme = props.theme, fill = props.fill, className = props.className, spin = props.spin, extra = _objectWithoutProperties(props, _excluded);
  188. var ICON_CONFIGS = React.useContext(IconContext);
  189. var id = React.useMemo(guid, []);
  190. var svgProps = IconConverter(id, {
  191. size,
  192. strokeWidth,
  193. strokeLinecap,
  194. strokeLinejoin,
  195. theme,
  196. fill
  197. }, ICON_CONFIGS);
  198. var cls = [ICON_CONFIGS.prefix + "-icon"];
  199. cls.push(ICON_CONFIGS.prefix + "-icon-" + name);
  200. if (ICON_CONFIGS.rtl) {
  201. cls.push(ICON_CONFIGS.prefix + "-icon-rtl");
  202. }
  203. if (spin) {
  204. cls.push(ICON_CONFIGS.prefix + "-icon-spin");
  205. }
  206. if (className) {
  207. cls.push(className);
  208. }
  209. return /* @__PURE__ */ React.createElement("span", _objectSpread(_objectSpread({}, extra), {}, {
  210. className: cls.join(" ")
  211. }), render(svgProps));
  212. };
  213. }
  214. const CopyOne = IconWrapper("copy-one", true, function(props) {
  215. return /* @__PURE__ */ React.createElement("svg", {
  216. width: props.size,
  217. height: props.size,
  218. viewBox: "0 0 48 48",
  219. fill: "none"
  220. }, /* @__PURE__ */ React.createElement("path", {
  221. d: "M13 38H41V16H30V4H13V38Z",
  222. fill: props.colors[1],
  223. stroke: props.colors[0],
  224. strokeWidth: props.strokeWidth,
  225. strokeLinecap: props.strokeLinecap,
  226. strokeLinejoin: props.strokeLinejoin
  227. }), /* @__PURE__ */ React.createElement("path", {
  228. d: "M30 4L41 16",
  229. stroke: props.colors[0],
  230. strokeWidth: props.strokeWidth,
  231. strokeLinecap: props.strokeLinecap,
  232. strokeLinejoin: props.strokeLinejoin
  233. }), /* @__PURE__ */ React.createElement("path", {
  234. d: "M7 20V44H28",
  235. stroke: props.colors[0],
  236. strokeWidth: props.strokeWidth,
  237. strokeLinecap: props.strokeLinecap,
  238. strokeLinejoin: props.strokeLinejoin
  239. }), /* @__PURE__ */ React.createElement("path", {
  240. d: "M19 20H23",
  241. stroke: props.colors[2],
  242. strokeWidth: props.strokeWidth,
  243. strokeLinecap: props.strokeLinecap
  244. }), /* @__PURE__ */ React.createElement("path", {
  245. d: "M19 28H31",
  246. stroke: props.colors[2],
  247. strokeWidth: props.strokeWidth,
  248. strokeLinecap: props.strokeLinecap
  249. }));
  250. });
  251. function App() {
  252. const [copySuccess, setCopySuccess] = React.useState(false);
  253. const contentElement = document.getElementById("content");
  254. const h1Element = contentElement == null ? void 0 : contentElement.getElementsByTagName("h1")[0];
  255. const spanElement = h1Element == null ? void 0 : h1Element.getElementsByTagName("span")[0];
  256. let text = "";
  257. if (spanElement !== null && spanElement !== void 0) {
  258. text = spanElement.innerText;
  259. }
  260. const targetURL = "https://tv.doutoutiao.cc/search.php";
  261. const targetURL2 = "https://www.themoviedb.org/search?query=" + text;
  262. const handleClick = async () => {
  263. await navigator.clipboard.writeText(text);
  264. setCopySuccess(true);
  265. setTimeout(() => setCopySuccess(false), 1e3);
  266. };
  267. return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "App", children: [
  268. /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: "Others" }),
  269. /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "bs", children: [
  270. /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
  271. /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: targetURL, target: "_blank", rel: "noopener noreferrer", children: "高清剧集网" }),
  272. /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { onClick: handleClick, children: [
  273. " ",
  274. /* @__PURE__ */ jsxRuntimeExports.jsx(CopyOne, { theme: "outline", size: "16", fill: "#333" })
  275. ] }),
  276. copySuccess && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Copy Success!" })
  277. ] }),
  278. /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: targetURL2, target: "_blank", rel: "noopener noreferrer", children: "TMDB" }) })
  279. ] })
  280. ] });
  281. }
  282. client.createRoot(
  283. (() => {
  284. var _a;
  285. const app = document.createElement("div");
  286. const element = document.querySelector(".gray_ad");
  287. (_a = element == null ? void 0 : element.parentNode) == null ? void 0 : _a.insertBefore(app, element.nextSibling);
  288. return app;
  289. })()
  290. ).render(
  291. /* @__PURE__ */ jsxRuntimeExports.jsx(React.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, {}) })
  292. );
  293.  
  294. })(React, ReactDOM);