V2Next

V2Next - 一个好用的V2EX脚本! 已适配移动端

当前为 2024-01-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name V2Next
  3. // @namespace http://tampermonkey.net/
  4. // @version 8.0.2
  5. // @author zyronon
  6. // @description V2Next - 一个好用的V2EX脚本! 已适配移动端
  7. // @license GPL License
  8. // @icon https://v2next.netlify.app/favicon.ico
  9. // @homepage https://github.com/zyronon/web-scripts
  10. // @homepageURL https://github.com/zyronon/web-scripts
  11. // @supportURL https://update.gf.qytechs.cn/scripts/458024/V2Next.user.js
  12. // @match https://v2ex.com/
  13. // @match https://v2ex.com/?tab=*
  14. // @match https://v2ex.com/t/*
  15. // @match https://v2ex.com/recent*
  16. // @match https://v2ex.com/go/*
  17. // @match https://v2ex.com/member/*
  18. // @match https://v2ex.com/changes*
  19. // @match https://*.v2ex.com/
  20. // @match https://*.v2ex.com/?tab=*
  21. // @match https://*.v2ex.com/t/*
  22. // @match https://*.v2ex.com/recent*
  23. // @match https://*.v2ex.com/go/*
  24. // @match https://*.v2ex.com/member/*
  25. // @match https://*.v2ex.com/changes*
  26. // @require https://cdn.jsdelivr.net/npm/vue@3.4.14/dist/vue.global.prod.js
  27. // @grant GM_addStyle
  28. // @grant GM_notification
  29. // @grant GM_openInTab
  30. // @grant GM_registerMenuCommand
  31. // ==/UserScript==
  32.  
  33.  
  34. (function (vue) {
  35. 'use strict';
  36.  
  37. var PageType = /* @__PURE__ */ ((PageType2) => {
  38. PageType2["Home"] = "Home";
  39. PageType2["Node"] = "Node";
  40. PageType2["Post"] = "Post";
  41. PageType2["Member"] = "Member";
  42. PageType2["Changes"] = "Changes";
  43. return PageType2;
  44. })(PageType || {});
  45. var CommentDisplayType = /* @__PURE__ */ ((CommentDisplayType2) => {
  46. CommentDisplayType2[CommentDisplayType2["FloorInFloor"] = 0] = "FloorInFloor";
  47. CommentDisplayType2[CommentDisplayType2["FloorInFloorNoCallUser"] = 4] = "FloorInFloorNoCallUser";
  48. CommentDisplayType2[CommentDisplayType2["FloorInFloorNested"] = 5] = "FloorInFloorNested";
  49. CommentDisplayType2[CommentDisplayType2["Like"] = 1] = "Like";
  50. CommentDisplayType2[CommentDisplayType2["V2exOrigin"] = 2] = "V2exOrigin";
  51. CommentDisplayType2[CommentDisplayType2["OnlyOp"] = 3] = "OnlyOp";
  52. CommentDisplayType2[CommentDisplayType2["New"] = 6] = "New";
  53. return CommentDisplayType2;
  54. })(CommentDisplayType || {});
  55. const MAX_REPLY_LIMIT = 400;
  56. const _sfc_main$k = {
  57. name: "Tooltip",
  58. props: {
  59. title: {
  60. type: String,
  61. default() {
  62. return "";
  63. }
  64. },
  65. disabled: {
  66. type: Boolean,
  67. default() {
  68. return false;
  69. }
  70. }
  71. },
  72. data() {
  73. return {
  74. show: false
  75. };
  76. },
  77. methods: {
  78. showPop(e2) {
  79. if (this.disabled)
  80. return;
  81. if (!this.title)
  82. return;
  83. e2.stopPropagation();
  84. let rect = e2.target.getBoundingClientRect();
  85. this.show = true;
  86. vue.nextTick(() => {
  87. var _a, _b;
  88. let tip = (_b = (_a = this.$refs) == null ? void 0 : _a.tip) == null ? void 0 : _b.getBoundingClientRect();
  89. if (!tip)
  90. return;
  91. if (rect.top < 50) {
  92. this.$refs.tip.style.top = rect.top + rect.height + 10 + "px";
  93. } else {
  94. this.$refs.tip.style.top = rect.top - tip.height - 10 + "px";
  95. }
  96. let tipWidth = tip.width;
  97. let rectWidth = rect.width;
  98. this.$refs.tip.style.left = rect.left - (tipWidth - rectWidth) / 2 + "px";
  99. });
  100. }
  101. },
  102. render() {
  103. let Vnode = this.$slots.default()[0];
  104. return vue.createVNode(vue.Fragment, null, [this.show && this.title && vue.createVNode(vue.Teleport, {
  105. "to": "body"
  106. }, {
  107. default: () => [vue.createVNode(vue.Transition, {
  108. "name": "fade"
  109. }, {
  110. default: () => [vue.createVNode("div", {
  111. "ref": "tip",
  112. "className": "tip"
  113. }, [this.title])]
  114. })]
  115. }), vue.createVNode(Vnode, {
  116. "onClick": () => this.show = false,
  117. "onmouseenter": (e2) => this.showPop(e2),
  118. "onmouseleave": () => this.show = false
  119. }, null)]);
  120. }
  121. };
  122. const _export_sfc = (sfc, props) => {
  123. const target = sfc.__vccOpts || sfc;
  124. for (const [key, val] of props) {
  125. target[key] = val;
  126. }
  127. return target;
  128. };
  129. const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-ee672411"]]);
  130. const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
  131. __name: "BaseSwitch",
  132. props: {
  133. modelValue: { type: Boolean }
  134. },
  135. emits: ["update:modelValue"],
  136. setup(__props, { emit: __emit }) {
  137. return (_ctx, _cache) => {
  138. return vue.openBlock(), vue.createElementBlock("div", {
  139. class: vue.normalizeClass(["switch", { active: _ctx.modelValue }]),
  140. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", !_ctx.modelValue))
  141. }, null, 2);
  142. };
  143. }
  144. });
  145. const BaseSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-e7c0fbef"]]);
  146. var _GM_notification = /* @__PURE__ */ (() => typeof GM_notification != "undefined" ? GM_notification : void 0)();
  147. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  148. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  149. const DefaultPost = {
  150. allReplyUsers: [],
  151. content_rendered: "",
  152. createDate: "",
  153. createDateAgo: "",
  154. fr: "",
  155. replyList: [],
  156. nestedReplies: [],
  157. nestedRedundReplies: [],
  158. username: "",
  159. url: "",
  160. member: {},
  161. node: {
  162. title: "",
  163. url: ""
  164. },
  165. headerTemplate: "",
  166. title: "",
  167. id: "",
  168. type: "post",
  169. once: "",
  170. replyCount: 0,
  171. clickCount: 0,
  172. thankCount: 0,
  173. collectCount: 0,
  174. lastReadFloor: 0,
  175. isFavorite: false,
  176. isIgnore: false,
  177. isThanked: false,
  178. isReport: false,
  179. inList: false
  180. };
  181. const DefaultUser = {
  182. tagPrefix: "--用户标签--",
  183. tags: {},
  184. tagsId: "",
  185. username: "",
  186. avatar: "",
  187. readPrefix: "--已读楼层--",
  188. readNoteItemId: "",
  189. readList: {},
  190. imgurPrefix: "--imgur图片删除hash--",
  191. imgurList: {},
  192. imgurNoteId: ""
  193. };
  194. const DefaultConfig = {
  195. showToolbar: true,
  196. showPreviewBtn: true,
  197. autoOpenDetail: true,
  198. openTag: false,
  199. //给用户打标签
  200. clickPostItemOpenDetail: true,
  201. closePostDetailBySpace: true,
  202. //点击空白处关闭详情
  203. contentAutoCollapse: true,
  204. //正文超长自动折叠
  205. viewType: "table",
  206. commentDisplayType: CommentDisplayType.FloorInFloorNoCallUser,
  207. newTabOpen: false,
  208. //新标签打开
  209. base64: true,
  210. //base功能
  211. sov2ex: false,
  212. postWidth: "",
  213. showTopReply: true,
  214. topReplyLoveMinCount: 3,
  215. topReplyCount: 3,
  216. autoJumpLastReadFloor: false,
  217. rememberLastReadFloor: false,
  218. autoSignin: true,
  219. customBgColor: "",
  220. version: 1,
  221. collectBrowserNotice: false,
  222. fontSizeType: "normal"
  223. };
  224. const DefaultVal = {
  225. pageType: void 0,
  226. pageData: { pageNo: 1 },
  227. targetUserName: "",
  228. currentVersion: 1,
  229. isNight: false,
  230. cb: null,
  231. stopMe: null,
  232. postList: [],
  233. git: "https://github.com/zyronon/web-scripts",
  234. shortGit: "zyronon/web-scripts",
  235. issue: "https://github.com/zyronon/web-scripts/issues",
  236. pcLog: "https://gf.qytechs.cn/zh-CN/scripts/458024/versions",
  237. pcScript: "https://gf.qytechs.cn/zh-CN/scripts/458024",
  238. mobileScript: "https://gf.qytechs.cn/zh-CN/scripts/485356",
  239. homeUrl: "https://v2next.netlify.app/"
  240. };
  241. const functions = {
  242. //获取所有回复
  243. getAllReply(repliesMap = []) {
  244. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  245. pre = pre.concat(i.replyList);
  246. return pre;
  247. }, []);
  248. },
  249. //查找子回复
  250. findChildren(item, endList, all) {
  251. var _a;
  252. const fn = (child, endList2, parent) => {
  253. child.level = parent.level + 1;
  254. let rIndex = all.findIndex((v) => v.floor === child.floor);
  255. if (rIndex > -1) {
  256. all[rIndex].isUse = true;
  257. }
  258. parent.children.push(this.findChildren(child, endList2, all));
  259. };
  260. item.children = [];
  261. let floorReplyList = [];
  262. for (let i = 0; i < endList.length; i++) {
  263. let currentItem = endList[i];
  264. if (currentItem.isUse)
  265. continue;
  266. if (currentItem.replyFloor === item.floor) {
  267. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  268. currentItem.isUse = true;
  269. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  270. } else {
  271. currentItem.isWrong = true;
  272. }
  273. }
  274. }
  275. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  276. fn(currentItem, endList2, item);
  277. });
  278. let nextMeIndex = endList.findIndex((v) => {
  279. var _a2;
  280. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  281. });
  282. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  283. for (let i = 0; i < findList.length; i++) {
  284. let currentItem = findList[i];
  285. if (currentItem.isUse)
  286. continue;
  287. if (currentItem.replyUsers.length === 1) {
  288. if (currentItem.replyFloor !== -1) {
  289. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  290. continue;
  291. }
  292. }
  293. let endList2 = endList.slice(i + 1);
  294. if (currentItem.username === item.username) {
  295. if (currentItem.replyUsers[0] === item.username) {
  296. fn(currentItem, endList2, item);
  297. }
  298. break;
  299. } else {
  300. if (currentItem.replyUsers[0] === item.username) {
  301. fn(currentItem, endList2, item);
  302. }
  303. }
  304. } else {
  305. if (currentItem.username === item.username)
  306. break;
  307. }
  308. }
  309. item.children = item.children.sort((a, b) => a.floor - b.floor);
  310. return item;
  311. },
  312. //生成嵌套回复
  313. createNestedList(allList = []) {
  314. if (!allList.length)
  315. return [];
  316. let list = window.clone(allList);
  317. let nestedList = [];
  318. list.map((item, index) => {
  319. let startList = list.slice(0, index);
  320. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  321. let endList = list.slice(index + 1);
  322. if (index === 0) {
  323. nestedList.push(this.findChildren(item, endList, list));
  324. } else {
  325. if (!item.isUse) {
  326. let isOneLevelReply = false;
  327. if (item.replyUsers.length) {
  328. if (item.replyUsers.length > 1) {
  329. isOneLevelReply = true;
  330. } else {
  331. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  332. }
  333. } else {
  334. isOneLevelReply = true;
  335. }
  336. if (isOneLevelReply) {
  337. item.level = 0;
  338. nestedList.push(this.findChildren(item, endList, list));
  339. }
  340. }
  341. }
  342. });
  343. return nestedList;
  344. },
  345. //生成嵌套冗余回复
  346. createNestedRedundantList(allList = []) {
  347. if (!allList.length)
  348. return [];
  349. let list = window.clone(allList);
  350. let nestedList = [];
  351. list.map((item, index) => {
  352. let startList = list.slice(0, index);
  353. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  354. let endList = list.slice(index + 1);
  355. if (index === 0) {
  356. nestedList.push(this.findChildren(item, endList, list));
  357. } else {
  358. if (!item.isUse) {
  359. let isOneLevelReply = false;
  360. if (item.replyUsers.length) {
  361. if (item.replyUsers.length > 1) {
  362. isOneLevelReply = true;
  363. } else {
  364. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  365. }
  366. } else {
  367. isOneLevelReply = true;
  368. }
  369. if (isOneLevelReply) {
  370. item.level = 0;
  371. nestedList.push(this.findChildren(item, endList, list));
  372. }
  373. } else {
  374. let newItem = window.clone(item);
  375. newItem.children = [];
  376. newItem.level = 0;
  377. newItem.isDup = true;
  378. nestedList.push(newItem);
  379. }
  380. }
  381. });
  382. return nestedList;
  383. },
  384. //解析A标签
  385. parseA(a) {
  386. let href = a.href;
  387. let id;
  388. if (href.includes("/t/")) {
  389. id = a.pathname.substring("/t/".length);
  390. }
  391. return { href, id, title: a.innerText };
  392. },
  393. //图片链接转Img标签
  394. checkPhotoLink2Img(str) {
  395. if (!str)
  396. return;
  397. try {
  398. let imgWebs = [
  399. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  400. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  401. ];
  402. imgWebs.map((v, i) => {
  403. let has = str.matchAll(v);
  404. let res2 = [...has];
  405. res2.map((r2) => {
  406. let p = i === 0 ? r2[4] : r2[5];
  407. if (p) {
  408. let link = p.toLowerCase();
  409. let src = p;
  410. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  411. } else {
  412. src = p + ".png";
  413. }
  414. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  415. }
  416. });
  417. });
  418. } catch (e2) {
  419. console.log("正则解析html里面的a标签的图片链接出错了");
  420. }
  421. return str;
  422. },
  423. //检测帖子回复长度
  424. async checkPostReplies(id, needOpen = true) {
  425. return new Promise(async (resolve) => {
  426. var _a;
  427. let showJsonUrl = `${location.origin}/api/topics/show.json?id=${id}`;
  428. let r2 = await fetch(showJsonUrl);
  429. if (r2) {
  430. let res = await r2.json();
  431. if (res) {
  432. if (((_a = res[0]) == null ? void 0 : _a.replies) > MAX_REPLY_LIMIT) {
  433. if (needOpen) {
  434. window.parse.openNewTab(`https://www.v2ex.com/t/${id}?p=1&script=1`);
  435. }
  436. return resolve(true);
  437. }
  438. }
  439. }
  440. resolve(false);
  441. });
  442. },
  443. async sleep(time) {
  444. return new Promise((resolve) => {
  445. setTimeout(resolve, time);
  446. });
  447. },
  448. //打开新标签页
  449. openNewTab(href) {
  450. _GM_openInTab(href, { active: false });
  451. },
  452. async cbChecker(val, count = 0) {
  453. if (window.cb) {
  454. window.cb(val);
  455. } else {
  456. while (!window.cb && count < 30) {
  457. await functions.sleep(500);
  458. count++;
  459. }
  460. window.cb && window.cb(val);
  461. }
  462. },
  463. //初始化脚本菜单
  464. initMonkeyMenu() {
  465. try {
  466. _GM_registerMenuCommand("脚本设置", () => {
  467. functions.cbChecker({ type: "openSetting" });
  468. });
  469. _GM_registerMenuCommand("仓库地址", () => {
  470. functions.openNewTab(window.const.git);
  471. });
  472. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  473. } catch (e2) {
  474. console.error("无法使用Tampermonkey");
  475. }
  476. },
  477. clone(val) {
  478. return JSON.parse(JSON.stringify(val));
  479. },
  480. feedback() {
  481. functions.openNewTab(DefaultVal.issue);
  482. },
  483. //检测页面类型
  484. checkPageType() {
  485. let l = window.location;
  486. if (l.pathname === "/") {
  487. window.pageType = PageType.Home;
  488. } else if (l.pathname === "/changes") {
  489. window.pageType = PageType.Changes;
  490. } else if (l.pathname === "/recent") {
  491. window.pageType = PageType.Changes;
  492. } else if (l.href.match(/.com\/?tab=/)) {
  493. window.pageType = PageType.Home;
  494. } else if (l.href.match(/.com\/go\//)) {
  495. if (!l.href.includes("/links")) {
  496. window.pageType = PageType.Node;
  497. }
  498. } else if (l.href.match(/.com\/member/)) {
  499. window.pageType = PageType.Member;
  500. } else {
  501. let r2 = l.href.match(/.com\/t\/([\d]+)/);
  502. if (r2) {
  503. window.pageType = PageType.Post;
  504. window.pageData.id = r2[1];
  505. if (l.search) {
  506. let pr = l.href.match(/\?p=([\d]+)/);
  507. if (pr)
  508. window.pageData.pageNo = Number(pr[1]);
  509. }
  510. }
  511. }
  512. }
  513. };
  514. const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
  515. const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
  516. const colonSeparated = value.split(":");
  517. if (value.slice(0, 1) === "@") {
  518. if (colonSeparated.length < 2 || colonSeparated.length > 3) {
  519. return null;
  520. }
  521. provider = colonSeparated.shift().slice(1);
  522. }
  523. if (colonSeparated.length > 3 || !colonSeparated.length) {
  524. return null;
  525. }
  526. if (colonSeparated.length > 1) {
  527. const name2 = colonSeparated.pop();
  528. const prefix = colonSeparated.pop();
  529. const result = {
  530. // Allow provider without '@': "provider:prefix:name"
  531. provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
  532. prefix,
  533. name: name2
  534. };
  535. return validate && !validateIconName(result) ? null : result;
  536. }
  537. const name = colonSeparated[0];
  538. const dashSeparated = name.split("-");
  539. if (dashSeparated.length > 1) {
  540. const result = {
  541. provider,
  542. prefix: dashSeparated.shift(),
  543. name: dashSeparated.join("-")
  544. };
  545. return validate && !validateIconName(result) ? null : result;
  546. }
  547. if (allowSimpleName && provider === "") {
  548. const result = {
  549. provider,
  550. prefix: "",
  551. name
  552. };
  553. return validate && !validateIconName(result, allowSimpleName) ? null : result;
  554. }
  555. return null;
  556. };
  557. const validateIconName = (icon, allowSimpleName) => {
  558. if (!icon) {
  559. return false;
  560. }
  561. return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
  562. };
  563. const defaultIconDimensions = Object.freeze(
  564. {
  565. left: 0,
  566. top: 0,
  567. width: 16,
  568. height: 16
  569. }
  570. );
  571. const defaultIconTransformations = Object.freeze({
  572. rotate: 0,
  573. vFlip: false,
  574. hFlip: false
  575. });
  576. const defaultIconProps = Object.freeze({
  577. ...defaultIconDimensions,
  578. ...defaultIconTransformations
  579. });
  580. const defaultExtendedIconProps = Object.freeze({
  581. ...defaultIconProps,
  582. body: "",
  583. hidden: false
  584. });
  585. function mergeIconTransformations(obj1, obj2) {
  586. const result = {};
  587. if (!obj1.hFlip !== !obj2.hFlip) {
  588. result.hFlip = true;
  589. }
  590. if (!obj1.vFlip !== !obj2.vFlip) {
  591. result.vFlip = true;
  592. }
  593. const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
  594. if (rotate) {
  595. result.rotate = rotate;
  596. }
  597. return result;
  598. }
  599. function mergeIconData(parent, child) {
  600. const result = mergeIconTransformations(parent, child);
  601. for (const key in defaultExtendedIconProps) {
  602. if (key in defaultIconTransformations) {
  603. if (key in parent && !(key in result)) {
  604. result[key] = defaultIconTransformations[key];
  605. }
  606. } else if (key in child) {
  607. result[key] = child[key];
  608. } else if (key in parent) {
  609. result[key] = parent[key];
  610. }
  611. }
  612. return result;
  613. }
  614. function getIconsTree(data, names) {
  615. const icons = data.icons;
  616. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  617. const resolved = /* @__PURE__ */ Object.create(null);
  618. function resolve(name) {
  619. if (icons[name]) {
  620. return resolved[name] = [];
  621. }
  622. if (!(name in resolved)) {
  623. resolved[name] = null;
  624. const parent = aliases[name] && aliases[name].parent;
  625. const value = parent && resolve(parent);
  626. if (value) {
  627. resolved[name] = [parent].concat(value);
  628. }
  629. }
  630. return resolved[name];
  631. }
  632. (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
  633. return resolved;
  634. }
  635. function internalGetIconData(data, name, tree) {
  636. const icons = data.icons;
  637. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  638. let currentProps = {};
  639. function parse(name2) {
  640. currentProps = mergeIconData(
  641. icons[name2] || aliases[name2],
  642. currentProps
  643. );
  644. }
  645. parse(name);
  646. tree.forEach(parse);
  647. return mergeIconData(data, currentProps);
  648. }
  649. function parseIconSet(data, callback) {
  650. const names = [];
  651. if (typeof data !== "object" || typeof data.icons !== "object") {
  652. return names;
  653. }
  654. if (data.not_found instanceof Array) {
  655. data.not_found.forEach((name) => {
  656. callback(name, null);
  657. names.push(name);
  658. });
  659. }
  660. const tree = getIconsTree(data);
  661. for (const name in tree) {
  662. const item = tree[name];
  663. if (item) {
  664. callback(name, internalGetIconData(data, name, item));
  665. names.push(name);
  666. }
  667. }
  668. return names;
  669. }
  670. const optionalPropertyDefaults = {
  671. provider: "",
  672. aliases: {},
  673. not_found: {},
  674. ...defaultIconDimensions
  675. };
  676. function checkOptionalProps(item, defaults) {
  677. for (const prop in defaults) {
  678. if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
  679. return false;
  680. }
  681. }
  682. return true;
  683. }
  684. function quicklyValidateIconSet(obj) {
  685. if (typeof obj !== "object" || obj === null) {
  686. return null;
  687. }
  688. const data = obj;
  689. if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
  690. return null;
  691. }
  692. if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
  693. return null;
  694. }
  695. const icons = data.icons;
  696. for (const name in icons) {
  697. const icon = icons[name];
  698. if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
  699. icon,
  700. defaultExtendedIconProps
  701. )) {
  702. return null;
  703. }
  704. }
  705. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  706. for (const name in aliases) {
  707. const icon = aliases[name];
  708. const parent = icon.parent;
  709. if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
  710. icon,
  711. defaultExtendedIconProps
  712. )) {
  713. return null;
  714. }
  715. }
  716. return data;
  717. }
  718. const dataStorage = /* @__PURE__ */ Object.create(null);
  719. function newStorage(provider, prefix) {
  720. return {
  721. provider,
  722. prefix,
  723. icons: /* @__PURE__ */ Object.create(null),
  724. missing: /* @__PURE__ */ new Set()
  725. };
  726. }
  727. function getStorage(provider, prefix) {
  728. const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
  729. return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
  730. }
  731. function addIconSet(storage2, data) {
  732. if (!quicklyValidateIconSet(data)) {
  733. return [];
  734. }
  735. return parseIconSet(data, (name, icon) => {
  736. if (icon) {
  737. storage2.icons[name] = icon;
  738. } else {
  739. storage2.missing.add(name);
  740. }
  741. });
  742. }
  743. function addIconToStorage(storage2, name, icon) {
  744. try {
  745. if (typeof icon.body === "string") {
  746. storage2.icons[name] = { ...icon };
  747. return true;
  748. }
  749. } catch (err) {
  750. }
  751. return false;
  752. }
  753. let simpleNames = false;
  754. function allowSimpleNames(allow) {
  755. if (typeof allow === "boolean") {
  756. simpleNames = allow;
  757. }
  758. return simpleNames;
  759. }
  760. function getIconData(name) {
  761. const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
  762. if (icon) {
  763. const storage2 = getStorage(icon.provider, icon.prefix);
  764. const iconName = icon.name;
  765. return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
  766. }
  767. }
  768. function addIcon(name, data) {
  769. const icon = stringToIcon(name, true, simpleNames);
  770. if (!icon) {
  771. return false;
  772. }
  773. const storage2 = getStorage(icon.provider, icon.prefix);
  774. return addIconToStorage(storage2, icon.name, data);
  775. }
  776. function addCollection(data, provider) {
  777. if (typeof data !== "object") {
  778. return false;
  779. }
  780. if (typeof provider !== "string") {
  781. provider = data.provider || "";
  782. }
  783. if (simpleNames && !provider && !data.prefix) {
  784. let added = false;
  785. if (quicklyValidateIconSet(data)) {
  786. data.prefix = "";
  787. parseIconSet(data, (name, icon) => {
  788. if (icon && addIcon(name, icon)) {
  789. added = true;
  790. }
  791. });
  792. }
  793. return added;
  794. }
  795. const prefix = data.prefix;
  796. if (!validateIconName({
  797. provider,
  798. prefix,
  799. name: "a"
  800. })) {
  801. return false;
  802. }
  803. const storage2 = getStorage(provider, prefix);
  804. return !!addIconSet(storage2, data);
  805. }
  806. const defaultIconSizeCustomisations = Object.freeze({
  807. width: null,
  808. height: null
  809. });
  810. const defaultIconCustomisations = Object.freeze({
  811. // Dimensions
  812. ...defaultIconSizeCustomisations,
  813. // Transformations
  814. ...defaultIconTransformations
  815. });
  816. const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
  817. const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
  818. function calculateSize(size, ratio, precision) {
  819. if (ratio === 1) {
  820. return size;
  821. }
  822. precision = precision || 100;
  823. if (typeof size === "number") {
  824. return Math.ceil(size * ratio * precision) / precision;
  825. }
  826. if (typeof size !== "string") {
  827. return size;
  828. }
  829. const oldParts = size.split(unitsSplit);
  830. if (oldParts === null || !oldParts.length) {
  831. return size;
  832. }
  833. const newParts = [];
  834. let code = oldParts.shift();
  835. let isNumber = unitsTest.test(code);
  836. while (true) {
  837. if (isNumber) {
  838. const num = parseFloat(code);
  839. if (isNaN(num)) {
  840. newParts.push(code);
  841. } else {
  842. newParts.push(Math.ceil(num * ratio * precision) / precision);
  843. }
  844. } else {
  845. newParts.push(code);
  846. }
  847. code = oldParts.shift();
  848. if (code === void 0) {
  849. return newParts.join("");
  850. }
  851. isNumber = !isNumber;
  852. }
  853. }
  854. const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
  855. function iconToSVG(icon, customisations) {
  856. const fullIcon = {
  857. ...defaultIconProps,
  858. ...icon
  859. };
  860. const fullCustomisations = {
  861. ...defaultIconCustomisations,
  862. ...customisations
  863. };
  864. const box = {
  865. left: fullIcon.left,
  866. top: fullIcon.top,
  867. width: fullIcon.width,
  868. height: fullIcon.height
  869. };
  870. let body = fullIcon.body;
  871. [fullIcon, fullCustomisations].forEach((props) => {
  872. const transformations = [];
  873. const hFlip = props.hFlip;
  874. const vFlip = props.vFlip;
  875. let rotation = props.rotate;
  876. if (hFlip) {
  877. if (vFlip) {
  878. rotation += 2;
  879. } else {
  880. transformations.push(
  881. "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
  882. );
  883. transformations.push("scale(-1 1)");
  884. box.top = box.left = 0;
  885. }
  886. } else if (vFlip) {
  887. transformations.push(
  888. "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
  889. );
  890. transformations.push("scale(1 -1)");
  891. box.top = box.left = 0;
  892. }
  893. let tempValue;
  894. if (rotation < 0) {
  895. rotation -= Math.floor(rotation / 4) * 4;
  896. }
  897. rotation = rotation % 4;
  898. switch (rotation) {
  899. case 1:
  900. tempValue = box.height / 2 + box.top;
  901. transformations.unshift(
  902. "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  903. );
  904. break;
  905. case 2:
  906. transformations.unshift(
  907. "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
  908. );
  909. break;
  910. case 3:
  911. tempValue = box.width / 2 + box.left;
  912. transformations.unshift(
  913. "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  914. );
  915. break;
  916. }
  917. if (rotation % 2 === 1) {
  918. if (box.left !== box.top) {
  919. tempValue = box.left;
  920. box.left = box.top;
  921. box.top = tempValue;
  922. }
  923. if (box.width !== box.height) {
  924. tempValue = box.width;
  925. box.width = box.height;
  926. box.height = tempValue;
  927. }
  928. }
  929. if (transformations.length) {
  930. body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
  931. }
  932. });
  933. const customisationsWidth = fullCustomisations.width;
  934. const customisationsHeight = fullCustomisations.height;
  935. const boxWidth = box.width;
  936. const boxHeight = box.height;
  937. let width;
  938. let height;
  939. if (customisationsWidth === null) {
  940. height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  941. width = calculateSize(height, boxWidth / boxHeight);
  942. } else {
  943. width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
  944. height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  945. }
  946. const attributes = {};
  947. const setAttr = (prop, value) => {
  948. if (!isUnsetKeyword(value)) {
  949. attributes[prop] = value.toString();
  950. }
  951. };
  952. setAttr("width", width);
  953. setAttr("height", height);
  954. attributes.viewBox = box.left.toString() + " " + box.top.toString() + " " + boxWidth.toString() + " " + boxHeight.toString();
  955. return {
  956. attributes,
  957. body
  958. };
  959. }
  960. const regex = /\sid="(\S+)"/g;
  961. const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
  962. let counter = 0;
  963. function replaceIDs(body, prefix = randomPrefix) {
  964. const ids = [];
  965. let match;
  966. while (match = regex.exec(body)) {
  967. ids.push(match[1]);
  968. }
  969. if (!ids.length) {
  970. return body;
  971. }
  972. const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  973. ids.forEach((id) => {
  974. const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
  975. const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  976. body = body.replace(
  977. // Allowed characters before id: [#;"]
  978. // Allowed characters after id: [)"], .[a-z]
  979. new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
  980. "$1" + newID + suffix + "$3"
  981. );
  982. });
  983. body = body.replace(new RegExp(suffix, "g"), "");
  984. return body;
  985. }
  986. const storage = /* @__PURE__ */ Object.create(null);
  987. function setAPIModule(provider, item) {
  988. storage[provider] = item;
  989. }
  990. function getAPIModule(provider) {
  991. return storage[provider] || storage[""];
  992. }
  993. function createAPIConfig(source) {
  994. let resources;
  995. if (typeof source.resources === "string") {
  996. resources = [source.resources];
  997. } else {
  998. resources = source.resources;
  999. if (!(resources instanceof Array) || !resources.length) {
  1000. return null;
  1001. }
  1002. }
  1003. const result = {
  1004. // API hosts
  1005. resources,
  1006. // Root path
  1007. path: source.path || "/",
  1008. // URL length limit
  1009. maxURL: source.maxURL || 500,
  1010. // Timeout before next host is used.
  1011. rotate: source.rotate || 750,
  1012. // Timeout before failing query.
  1013. timeout: source.timeout || 5e3,
  1014. // Randomise default API end point.
  1015. random: source.random === true,
  1016. // Start index
  1017. index: source.index || 0,
  1018. // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
  1019. dataAfterTimeout: source.dataAfterTimeout !== false
  1020. };
  1021. return result;
  1022. }
  1023. const configStorage = /* @__PURE__ */ Object.create(null);
  1024. const fallBackAPISources = [
  1025. "https://api.simplesvg.com",
  1026. "https://api.unisvg.com"
  1027. ];
  1028. const fallBackAPI = [];
  1029. while (fallBackAPISources.length > 0) {
  1030. if (fallBackAPISources.length === 1) {
  1031. fallBackAPI.push(fallBackAPISources.shift());
  1032. } else {
  1033. if (Math.random() > 0.5) {
  1034. fallBackAPI.push(fallBackAPISources.shift());
  1035. } else {
  1036. fallBackAPI.push(fallBackAPISources.pop());
  1037. }
  1038. }
  1039. }
  1040. configStorage[""] = createAPIConfig({
  1041. resources: ["https://api.iconify.design"].concat(fallBackAPI)
  1042. });
  1043. function addAPIProvider(provider, customConfig) {
  1044. const config2 = createAPIConfig(customConfig);
  1045. if (config2 === null) {
  1046. return false;
  1047. }
  1048. configStorage[provider] = config2;
  1049. return true;
  1050. }
  1051. function getAPIConfig(provider) {
  1052. return configStorage[provider];
  1053. }
  1054. const detectFetch = () => {
  1055. let callback;
  1056. try {
  1057. callback = fetch;
  1058. if (typeof callback === "function") {
  1059. return callback;
  1060. }
  1061. } catch (err) {
  1062. }
  1063. };
  1064. let fetchModule = detectFetch();
  1065. function calculateMaxLength(provider, prefix) {
  1066. const config2 = getAPIConfig(provider);
  1067. if (!config2) {
  1068. return 0;
  1069. }
  1070. let result;
  1071. if (!config2.maxURL) {
  1072. result = 0;
  1073. } else {
  1074. let maxHostLength = 0;
  1075. config2.resources.forEach((item) => {
  1076. const host = item;
  1077. maxHostLength = Math.max(maxHostLength, host.length);
  1078. });
  1079. const url = prefix + ".json?icons=";
  1080. result = config2.maxURL - maxHostLength - config2.path.length - url.length;
  1081. }
  1082. return result;
  1083. }
  1084. function shouldAbort(status) {
  1085. return status === 404;
  1086. }
  1087. const prepare = (provider, prefix, icons) => {
  1088. const results = [];
  1089. const maxLength = calculateMaxLength(provider, prefix);
  1090. const type = "icons";
  1091. let item = {
  1092. type,
  1093. provider,
  1094. prefix,
  1095. icons: []
  1096. };
  1097. let length = 0;
  1098. icons.forEach((name, index) => {
  1099. length += name.length + 1;
  1100. if (length >= maxLength && index > 0) {
  1101. results.push(item);
  1102. item = {
  1103. type,
  1104. provider,
  1105. prefix,
  1106. icons: []
  1107. };
  1108. length = name.length;
  1109. }
  1110. item.icons.push(name);
  1111. });
  1112. results.push(item);
  1113. return results;
  1114. };
  1115. function getPath(provider) {
  1116. if (typeof provider === "string") {
  1117. const config2 = getAPIConfig(provider);
  1118. if (config2) {
  1119. return config2.path;
  1120. }
  1121. }
  1122. return "/";
  1123. }
  1124. const send = (host, params, callback) => {
  1125. if (!fetchModule) {
  1126. callback("abort", 424);
  1127. return;
  1128. }
  1129. let path = getPath(params.provider);
  1130. switch (params.type) {
  1131. case "icons": {
  1132. const prefix = params.prefix;
  1133. const icons = params.icons;
  1134. const iconsList = icons.join(",");
  1135. const urlParams = new URLSearchParams({
  1136. icons: iconsList
  1137. });
  1138. path += prefix + ".json?" + urlParams.toString();
  1139. break;
  1140. }
  1141. case "custom": {
  1142. const uri = params.uri;
  1143. path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
  1144. break;
  1145. }
  1146. default:
  1147. callback("abort", 400);
  1148. return;
  1149. }
  1150. let defaultError = 503;
  1151. fetchModule(host + path).then((response) => {
  1152. const status = response.status;
  1153. if (status !== 200) {
  1154. setTimeout(() => {
  1155. callback(shouldAbort(status) ? "abort" : "next", status);
  1156. });
  1157. return;
  1158. }
  1159. defaultError = 501;
  1160. return response.json();
  1161. }).then((data) => {
  1162. if (typeof data !== "object" || data === null) {
  1163. setTimeout(() => {
  1164. if (data === 404) {
  1165. callback("abort", data);
  1166. } else {
  1167. callback("next", defaultError);
  1168. }
  1169. });
  1170. return;
  1171. }
  1172. setTimeout(() => {
  1173. callback("success", data);
  1174. });
  1175. }).catch(() => {
  1176. callback("next", defaultError);
  1177. });
  1178. };
  1179. const fetchAPIModule = {
  1180. prepare,
  1181. send
  1182. };
  1183. function sortIcons(icons) {
  1184. const result = {
  1185. loaded: [],
  1186. missing: [],
  1187. pending: []
  1188. };
  1189. const storage2 = /* @__PURE__ */ Object.create(null);
  1190. icons.sort((a, b) => {
  1191. if (a.provider !== b.provider) {
  1192. return a.provider.localeCompare(b.provider);
  1193. }
  1194. if (a.prefix !== b.prefix) {
  1195. return a.prefix.localeCompare(b.prefix);
  1196. }
  1197. return a.name.localeCompare(b.name);
  1198. });
  1199. let lastIcon = {
  1200. provider: "",
  1201. prefix: "",
  1202. name: ""
  1203. };
  1204. icons.forEach((icon) => {
  1205. if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
  1206. return;
  1207. }
  1208. lastIcon = icon;
  1209. const provider = icon.provider;
  1210. const prefix = icon.prefix;
  1211. const name = icon.name;
  1212. const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
  1213. const localStorage2 = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
  1214. let list;
  1215. if (name in localStorage2.icons) {
  1216. list = result.loaded;
  1217. } else if (prefix === "" || localStorage2.missing.has(name)) {
  1218. list = result.missing;
  1219. } else {
  1220. list = result.pending;
  1221. }
  1222. const item = {
  1223. provider,
  1224. prefix,
  1225. name
  1226. };
  1227. list.push(item);
  1228. });
  1229. return result;
  1230. }
  1231. function removeCallback(storages, id) {
  1232. storages.forEach((storage2) => {
  1233. const items = storage2.loaderCallbacks;
  1234. if (items) {
  1235. storage2.loaderCallbacks = items.filter((row) => row.id !== id);
  1236. }
  1237. });
  1238. }
  1239. function updateCallbacks(storage2) {
  1240. if (!storage2.pendingCallbacksFlag) {
  1241. storage2.pendingCallbacksFlag = true;
  1242. setTimeout(() => {
  1243. storage2.pendingCallbacksFlag = false;
  1244. const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
  1245. if (!items.length) {
  1246. return;
  1247. }
  1248. let hasPending = false;
  1249. const provider = storage2.provider;
  1250. const prefix = storage2.prefix;
  1251. items.forEach((item) => {
  1252. const icons = item.icons;
  1253. const oldLength = icons.pending.length;
  1254. icons.pending = icons.pending.filter((icon) => {
  1255. if (icon.prefix !== prefix) {
  1256. return true;
  1257. }
  1258. const name = icon.name;
  1259. if (storage2.icons[name]) {
  1260. icons.loaded.push({
  1261. provider,
  1262. prefix,
  1263. name
  1264. });
  1265. } else if (storage2.missing.has(name)) {
  1266. icons.missing.push({
  1267. provider,
  1268. prefix,
  1269. name
  1270. });
  1271. } else {
  1272. hasPending = true;
  1273. return true;
  1274. }
  1275. return false;
  1276. });
  1277. if (icons.pending.length !== oldLength) {
  1278. if (!hasPending) {
  1279. removeCallback([storage2], item.id);
  1280. }
  1281. item.callback(
  1282. icons.loaded.slice(0),
  1283. icons.missing.slice(0),
  1284. icons.pending.slice(0),
  1285. item.abort
  1286. );
  1287. }
  1288. });
  1289. });
  1290. }
  1291. }
  1292. let idCounter = 0;
  1293. function storeCallback(callback, icons, pendingSources) {
  1294. const id = idCounter++;
  1295. const abort = removeCallback.bind(null, pendingSources, id);
  1296. if (!icons.pending.length) {
  1297. return abort;
  1298. }
  1299. const item = {
  1300. id,
  1301. icons,
  1302. callback,
  1303. abort
  1304. };
  1305. pendingSources.forEach((storage2) => {
  1306. (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
  1307. });
  1308. return abort;
  1309. }
  1310. function listToIcons(list, validate = true, simpleNames2 = false) {
  1311. const result = [];
  1312. list.forEach((item) => {
  1313. const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
  1314. if (icon) {
  1315. result.push(icon);
  1316. }
  1317. });
  1318. return result;
  1319. }
  1320. var defaultConfig = {
  1321. resources: [],
  1322. index: 0,
  1323. timeout: 2e3,
  1324. rotate: 750,
  1325. random: false,
  1326. dataAfterTimeout: false
  1327. };
  1328. function sendQuery(config2, payload, query, done) {
  1329. const resourcesCount = config2.resources.length;
  1330. const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
  1331. let resources;
  1332. if (config2.random) {
  1333. let list = config2.resources.slice(0);
  1334. resources = [];
  1335. while (list.length > 1) {
  1336. const nextIndex = Math.floor(Math.random() * list.length);
  1337. resources.push(list[nextIndex]);
  1338. list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
  1339. }
  1340. resources = resources.concat(list);
  1341. } else {
  1342. resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
  1343. }
  1344. const startTime = Date.now();
  1345. let status = "pending";
  1346. let queriesSent = 0;
  1347. let lastError;
  1348. let timer = null;
  1349. let queue = [];
  1350. let doneCallbacks = [];
  1351. if (typeof done === "function") {
  1352. doneCallbacks.push(done);
  1353. }
  1354. function resetTimer() {
  1355. if (timer) {
  1356. clearTimeout(timer);
  1357. timer = null;
  1358. }
  1359. }
  1360. function abort() {
  1361. if (status === "pending") {
  1362. status = "aborted";
  1363. }
  1364. resetTimer();
  1365. queue.forEach((item) => {
  1366. if (item.status === "pending") {
  1367. item.status = "aborted";
  1368. }
  1369. });
  1370. queue = [];
  1371. }
  1372. function subscribe(callback, overwrite) {
  1373. if (overwrite) {
  1374. doneCallbacks = [];
  1375. }
  1376. if (typeof callback === "function") {
  1377. doneCallbacks.push(callback);
  1378. }
  1379. }
  1380. function getQueryStatus() {
  1381. return {
  1382. startTime,
  1383. payload,
  1384. status,
  1385. queriesSent,
  1386. queriesPending: queue.length,
  1387. subscribe,
  1388. abort
  1389. };
  1390. }
  1391. function failQuery() {
  1392. status = "failed";
  1393. doneCallbacks.forEach((callback) => {
  1394. callback(void 0, lastError);
  1395. });
  1396. }
  1397. function clearQueue() {
  1398. queue.forEach((item) => {
  1399. if (item.status === "pending") {
  1400. item.status = "aborted";
  1401. }
  1402. });
  1403. queue = [];
  1404. }
  1405. function moduleResponse(item, response, data) {
  1406. const isError = response !== "success";
  1407. queue = queue.filter((queued) => queued !== item);
  1408. switch (status) {
  1409. case "pending":
  1410. break;
  1411. case "failed":
  1412. if (isError || !config2.dataAfterTimeout) {
  1413. return;
  1414. }
  1415. break;
  1416. default:
  1417. return;
  1418. }
  1419. if (response === "abort") {
  1420. lastError = data;
  1421. failQuery();
  1422. return;
  1423. }
  1424. if (isError) {
  1425. lastError = data;
  1426. if (!queue.length) {
  1427. if (!resources.length) {
  1428. failQuery();
  1429. } else {
  1430. execNext();
  1431. }
  1432. }
  1433. return;
  1434. }
  1435. resetTimer();
  1436. clearQueue();
  1437. if (!config2.random) {
  1438. const index = config2.resources.indexOf(item.resource);
  1439. if (index !== -1 && index !== config2.index) {
  1440. config2.index = index;
  1441. }
  1442. }
  1443. status = "completed";
  1444. doneCallbacks.forEach((callback) => {
  1445. callback(data);
  1446. });
  1447. }
  1448. function execNext() {
  1449. if (status !== "pending") {
  1450. return;
  1451. }
  1452. resetTimer();
  1453. const resource = resources.shift();
  1454. if (resource === void 0) {
  1455. if (queue.length) {
  1456. timer = setTimeout(() => {
  1457. resetTimer();
  1458. if (status === "pending") {
  1459. clearQueue();
  1460. failQuery();
  1461. }
  1462. }, config2.timeout);
  1463. return;
  1464. }
  1465. failQuery();
  1466. return;
  1467. }
  1468. const item = {
  1469. status: "pending",
  1470. resource,
  1471. callback: (status2, data) => {
  1472. moduleResponse(item, status2, data);
  1473. }
  1474. };
  1475. queue.push(item);
  1476. queriesSent++;
  1477. timer = setTimeout(execNext, config2.rotate);
  1478. query(resource, payload, item.callback);
  1479. }
  1480. setTimeout(execNext);
  1481. return getQueryStatus;
  1482. }
  1483. function initRedundancy(cfg) {
  1484. const config2 = {
  1485. ...defaultConfig,
  1486. ...cfg
  1487. };
  1488. let queries = [];
  1489. function cleanup() {
  1490. queries = queries.filter((item) => item().status === "pending");
  1491. }
  1492. function query(payload, queryCallback, doneCallback) {
  1493. const query2 = sendQuery(
  1494. config2,
  1495. payload,
  1496. queryCallback,
  1497. (data, error) => {
  1498. cleanup();
  1499. if (doneCallback) {
  1500. doneCallback(data, error);
  1501. }
  1502. }
  1503. );
  1504. queries.push(query2);
  1505. return query2;
  1506. }
  1507. function find(callback) {
  1508. return queries.find((value) => {
  1509. return callback(value);
  1510. }) || null;
  1511. }
  1512. const instance = {
  1513. query,
  1514. find,
  1515. setIndex: (index) => {
  1516. config2.index = index;
  1517. },
  1518. getIndex: () => config2.index,
  1519. cleanup
  1520. };
  1521. return instance;
  1522. }
  1523. function emptyCallback$1() {
  1524. }
  1525. const redundancyCache = /* @__PURE__ */ Object.create(null);
  1526. function getRedundancyCache(provider) {
  1527. if (!redundancyCache[provider]) {
  1528. const config2 = getAPIConfig(provider);
  1529. if (!config2) {
  1530. return;
  1531. }
  1532. const redundancy = initRedundancy(config2);
  1533. const cachedReundancy = {
  1534. config: config2,
  1535. redundancy
  1536. };
  1537. redundancyCache[provider] = cachedReundancy;
  1538. }
  1539. return redundancyCache[provider];
  1540. }
  1541. function sendAPIQuery(target, query, callback) {
  1542. let redundancy;
  1543. let send2;
  1544. if (typeof target === "string") {
  1545. const api = getAPIModule(target);
  1546. if (!api) {
  1547. callback(void 0, 424);
  1548. return emptyCallback$1;
  1549. }
  1550. send2 = api.send;
  1551. const cached = getRedundancyCache(target);
  1552. if (cached) {
  1553. redundancy = cached.redundancy;
  1554. }
  1555. } else {
  1556. const config2 = createAPIConfig(target);
  1557. if (config2) {
  1558. redundancy = initRedundancy(config2);
  1559. const moduleKey = target.resources ? target.resources[0] : "";
  1560. const api = getAPIModule(moduleKey);
  1561. if (api) {
  1562. send2 = api.send;
  1563. }
  1564. }
  1565. }
  1566. if (!redundancy || !send2) {
  1567. callback(void 0, 424);
  1568. return emptyCallback$1;
  1569. }
  1570. return redundancy.query(query, send2, callback)().abort;
  1571. }
  1572. const browserCacheVersion = "iconify2";
  1573. const browserCachePrefix = "iconify";
  1574. const browserCacheCountKey = browserCachePrefix + "-count";
  1575. const browserCacheVersionKey = browserCachePrefix + "-version";
  1576. const browserStorageHour = 36e5;
  1577. const browserStorageCacheExpiration = 168;
  1578. function getStoredItem(func, key) {
  1579. try {
  1580. return func.getItem(key);
  1581. } catch (err) {
  1582. }
  1583. }
  1584. function setStoredItem(func, key, value) {
  1585. try {
  1586. func.setItem(key, value);
  1587. return true;
  1588. } catch (err) {
  1589. }
  1590. }
  1591. function removeStoredItem(func, key) {
  1592. try {
  1593. func.removeItem(key);
  1594. } catch (err) {
  1595. }
  1596. }
  1597. function setBrowserStorageItemsCount(storage2, value) {
  1598. return setStoredItem(storage2, browserCacheCountKey, value.toString());
  1599. }
  1600. function getBrowserStorageItemsCount(storage2) {
  1601. return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
  1602. }
  1603. const browserStorageConfig = {
  1604. local: true,
  1605. session: true
  1606. };
  1607. const browserStorageEmptyItems = {
  1608. local: /* @__PURE__ */ new Set(),
  1609. session: /* @__PURE__ */ new Set()
  1610. };
  1611. let browserStorageStatus = false;
  1612. function setBrowserStorageStatus(status) {
  1613. browserStorageStatus = status;
  1614. }
  1615. let _window = typeof window === "undefined" ? {} : window;
  1616. function getBrowserStorage(key) {
  1617. const attr = key + "Storage";
  1618. try {
  1619. if (_window && _window[attr] && typeof _window[attr].length === "number") {
  1620. return _window[attr];
  1621. }
  1622. } catch (err) {
  1623. }
  1624. browserStorageConfig[key] = false;
  1625. }
  1626. function iterateBrowserStorage(key, callback) {
  1627. const func = getBrowserStorage(key);
  1628. if (!func) {
  1629. return;
  1630. }
  1631. const version = getStoredItem(func, browserCacheVersionKey);
  1632. if (version !== browserCacheVersion) {
  1633. if (version) {
  1634. const total2 = getBrowserStorageItemsCount(func);
  1635. for (let i = 0; i < total2; i++) {
  1636. removeStoredItem(func, browserCachePrefix + i.toString());
  1637. }
  1638. }
  1639. setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
  1640. setBrowserStorageItemsCount(func, 0);
  1641. return;
  1642. }
  1643. const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
  1644. const parseItem = (index) => {
  1645. const name = browserCachePrefix + index.toString();
  1646. const item = getStoredItem(func, name);
  1647. if (typeof item !== "string") {
  1648. return;
  1649. }
  1650. try {
  1651. const data = JSON.parse(item);
  1652. if (typeof data === "object" && typeof data.cached === "number" && data.cached > minTime && typeof data.provider === "string" && typeof data.data === "object" && typeof data.data.prefix === "string" && // Valid item: run callback
  1653. callback(data, index)) {
  1654. return true;
  1655. }
  1656. } catch (err) {
  1657. }
  1658. removeStoredItem(func, name);
  1659. };
  1660. let total = getBrowserStorageItemsCount(func);
  1661. for (let i = total - 1; i >= 0; i--) {
  1662. if (!parseItem(i)) {
  1663. if (i === total - 1) {
  1664. total--;
  1665. setBrowserStorageItemsCount(func, total);
  1666. } else {
  1667. browserStorageEmptyItems[key].add(i);
  1668. }
  1669. }
  1670. }
  1671. }
  1672. function initBrowserStorage() {
  1673. if (browserStorageStatus) {
  1674. return;
  1675. }
  1676. setBrowserStorageStatus(true);
  1677. for (const key in browserStorageConfig) {
  1678. iterateBrowserStorage(key, (item) => {
  1679. const iconSet = item.data;
  1680. const provider = item.provider;
  1681. const prefix = iconSet.prefix;
  1682. const storage2 = getStorage(
  1683. provider,
  1684. prefix
  1685. );
  1686. if (!addIconSet(storage2, iconSet).length) {
  1687. return false;
  1688. }
  1689. const lastModified = iconSet.lastModified || -1;
  1690. storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
  1691. return true;
  1692. });
  1693. }
  1694. }
  1695. function updateLastModified(storage2, lastModified) {
  1696. const lastValue = storage2.lastModifiedCached;
  1697. if (
  1698. // Matches or newer
  1699. lastValue && lastValue >= lastModified
  1700. ) {
  1701. return lastValue === lastModified;
  1702. }
  1703. storage2.lastModifiedCached = lastModified;
  1704. if (lastValue) {
  1705. for (const key in browserStorageConfig) {
  1706. iterateBrowserStorage(key, (item) => {
  1707. const iconSet = item.data;
  1708. return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
  1709. });
  1710. }
  1711. }
  1712. return true;
  1713. }
  1714. function storeInBrowserStorage(storage2, data) {
  1715. if (!browserStorageStatus) {
  1716. initBrowserStorage();
  1717. }
  1718. function store(key) {
  1719. let func;
  1720. if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
  1721. return;
  1722. }
  1723. const set = browserStorageEmptyItems[key];
  1724. let index;
  1725. if (set.size) {
  1726. set.delete(index = Array.from(set).shift());
  1727. } else {
  1728. index = getBrowserStorageItemsCount(func);
  1729. if (!setBrowserStorageItemsCount(func, index + 1)) {
  1730. return;
  1731. }
  1732. }
  1733. const item = {
  1734. cached: Math.floor(Date.now() / browserStorageHour),
  1735. provider: storage2.provider,
  1736. data
  1737. };
  1738. return setStoredItem(
  1739. func,
  1740. browserCachePrefix + index.toString(),
  1741. JSON.stringify(item)
  1742. );
  1743. }
  1744. if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
  1745. return;
  1746. }
  1747. if (!Object.keys(data.icons).length) {
  1748. return;
  1749. }
  1750. if (data.not_found) {
  1751. data = Object.assign({}, data);
  1752. delete data.not_found;
  1753. }
  1754. if (!store("local")) {
  1755. store("session");
  1756. }
  1757. }
  1758. function emptyCallback() {
  1759. }
  1760. function loadedNewIcons(storage2) {
  1761. if (!storage2.iconsLoaderFlag) {
  1762. storage2.iconsLoaderFlag = true;
  1763. setTimeout(() => {
  1764. storage2.iconsLoaderFlag = false;
  1765. updateCallbacks(storage2);
  1766. });
  1767. }
  1768. }
  1769. function loadNewIcons(storage2, icons) {
  1770. if (!storage2.iconsToLoad) {
  1771. storage2.iconsToLoad = icons;
  1772. } else {
  1773. storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
  1774. }
  1775. if (!storage2.iconsQueueFlag) {
  1776. storage2.iconsQueueFlag = true;
  1777. setTimeout(() => {
  1778. storage2.iconsQueueFlag = false;
  1779. const { provider, prefix } = storage2;
  1780. const icons2 = storage2.iconsToLoad;
  1781. delete storage2.iconsToLoad;
  1782. let api;
  1783. if (!icons2 || !(api = getAPIModule(provider))) {
  1784. return;
  1785. }
  1786. const params = api.prepare(provider, prefix, icons2);
  1787. params.forEach((item) => {
  1788. sendAPIQuery(provider, item, (data) => {
  1789. if (typeof data !== "object") {
  1790. item.icons.forEach((name) => {
  1791. storage2.missing.add(name);
  1792. });
  1793. } else {
  1794. try {
  1795. const parsed = addIconSet(
  1796. storage2,
  1797. data
  1798. );
  1799. if (!parsed.length) {
  1800. return;
  1801. }
  1802. const pending = storage2.pendingIcons;
  1803. if (pending) {
  1804. parsed.forEach((name) => {
  1805. pending.delete(name);
  1806. });
  1807. }
  1808. storeInBrowserStorage(storage2, data);
  1809. } catch (err) {
  1810. console.error(err);
  1811. }
  1812. }
  1813. loadedNewIcons(storage2);
  1814. });
  1815. });
  1816. });
  1817. }
  1818. }
  1819. const loadIcons = (icons, callback) => {
  1820. const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
  1821. const sortedIcons = sortIcons(cleanedIcons);
  1822. if (!sortedIcons.pending.length) {
  1823. let callCallback = true;
  1824. if (callback) {
  1825. setTimeout(() => {
  1826. if (callCallback) {
  1827. callback(
  1828. sortedIcons.loaded,
  1829. sortedIcons.missing,
  1830. sortedIcons.pending,
  1831. emptyCallback
  1832. );
  1833. }
  1834. });
  1835. }
  1836. return () => {
  1837. callCallback = false;
  1838. };
  1839. }
  1840. const newIcons = /* @__PURE__ */ Object.create(null);
  1841. const sources = [];
  1842. let lastProvider, lastPrefix;
  1843. sortedIcons.pending.forEach((icon) => {
  1844. const { provider, prefix } = icon;
  1845. if (prefix === lastPrefix && provider === lastProvider) {
  1846. return;
  1847. }
  1848. lastProvider = provider;
  1849. lastPrefix = prefix;
  1850. sources.push(getStorage(provider, prefix));
  1851. const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
  1852. if (!providerNewIcons[prefix]) {
  1853. providerNewIcons[prefix] = [];
  1854. }
  1855. });
  1856. sortedIcons.pending.forEach((icon) => {
  1857. const { provider, prefix, name } = icon;
  1858. const storage2 = getStorage(provider, prefix);
  1859. const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
  1860. if (!pendingQueue.has(name)) {
  1861. pendingQueue.add(name);
  1862. newIcons[provider][prefix].push(name);
  1863. }
  1864. });
  1865. sources.forEach((storage2) => {
  1866. const { provider, prefix } = storage2;
  1867. if (newIcons[provider][prefix].length) {
  1868. loadNewIcons(storage2, newIcons[provider][prefix]);
  1869. }
  1870. });
  1871. return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
  1872. };
  1873. function mergeCustomisations(defaults, item) {
  1874. const result = {
  1875. ...defaults
  1876. };
  1877. for (const key in item) {
  1878. const value = item[key];
  1879. const valueType = typeof value;
  1880. if (key in defaultIconSizeCustomisations) {
  1881. if (value === null || value && (valueType === "string" || valueType === "number")) {
  1882. result[key] = value;
  1883. }
  1884. } else if (valueType === typeof result[key]) {
  1885. result[key] = key === "rotate" ? value % 4 : value;
  1886. }
  1887. }
  1888. return result;
  1889. }
  1890. const separator = /[\s,]+/;
  1891. function flipFromString(custom, flip) {
  1892. flip.split(separator).forEach((str) => {
  1893. const value = str.trim();
  1894. switch (value) {
  1895. case "horizontal":
  1896. custom.hFlip = true;
  1897. break;
  1898. case "vertical":
  1899. custom.vFlip = true;
  1900. break;
  1901. }
  1902. });
  1903. }
  1904. function rotateFromString(value, defaultValue = 0) {
  1905. const units = value.replace(/^-?[0-9.]*/, "");
  1906. function cleanup(value2) {
  1907. while (value2 < 0) {
  1908. value2 += 4;
  1909. }
  1910. return value2 % 4;
  1911. }
  1912. if (units === "") {
  1913. const num = parseInt(value);
  1914. return isNaN(num) ? 0 : cleanup(num);
  1915. } else if (units !== value) {
  1916. let split = 0;
  1917. switch (units) {
  1918. case "%":
  1919. split = 25;
  1920. break;
  1921. case "deg":
  1922. split = 90;
  1923. }
  1924. if (split) {
  1925. let num = parseFloat(value.slice(0, value.length - units.length));
  1926. if (isNaN(num)) {
  1927. return 0;
  1928. }
  1929. num = num / split;
  1930. return num % 1 === 0 ? cleanup(num) : 0;
  1931. }
  1932. }
  1933. return defaultValue;
  1934. }
  1935. function iconToHTML(body, attributes) {
  1936. let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  1937. for (const attr in attributes) {
  1938. renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
  1939. }
  1940. return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
  1941. }
  1942. function encodeSVGforURL(svg) {
  1943. return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
  1944. }
  1945. function svgToData(svg) {
  1946. return "data:image/svg+xml," + encodeSVGforURL(svg);
  1947. }
  1948. function svgToURL(svg) {
  1949. return 'url("' + svgToData(svg) + '")';
  1950. }
  1951. const defaultExtendedIconCustomisations = {
  1952. ...defaultIconCustomisations,
  1953. inline: false
  1954. };
  1955. const svgDefaults = {
  1956. "xmlns": "http://www.w3.org/2000/svg",
  1957. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  1958. "aria-hidden": true,
  1959. "role": "img"
  1960. };
  1961. const commonProps = {
  1962. display: "inline-block"
  1963. };
  1964. const monotoneProps = {
  1965. backgroundColor: "currentColor"
  1966. };
  1967. const coloredProps = {
  1968. backgroundColor: "transparent"
  1969. };
  1970. const propsToAdd = {
  1971. Image: "var(--svg)",
  1972. Repeat: "no-repeat",
  1973. Size: "100% 100%"
  1974. };
  1975. const propsToAddTo = {
  1976. webkitMask: monotoneProps,
  1977. mask: monotoneProps,
  1978. background: coloredProps
  1979. };
  1980. for (const prefix in propsToAddTo) {
  1981. const list = propsToAddTo[prefix];
  1982. for (const prop in propsToAdd) {
  1983. list[prefix + prop] = propsToAdd[prop];
  1984. }
  1985. }
  1986. const customisationAliases = {};
  1987. ["horizontal", "vertical"].forEach((prefix) => {
  1988. const attr = prefix.slice(0, 1) + "Flip";
  1989. customisationAliases[prefix + "-flip"] = attr;
  1990. customisationAliases[prefix.slice(0, 1) + "-flip"] = attr;
  1991. customisationAliases[prefix + "Flip"] = attr;
  1992. });
  1993. function fixSize(value) {
  1994. return value + (value.match(/^[-0-9.]+$/) ? "px" : "");
  1995. }
  1996. const render = (icon, props) => {
  1997. const customisations = mergeCustomisations(defaultExtendedIconCustomisations, props);
  1998. const componentProps = { ...svgDefaults };
  1999. const mode = props.mode || "svg";
  2000. const style = {};
  2001. const propsStyle = props.style;
  2002. const customStyle = typeof propsStyle === "object" && !(propsStyle instanceof Array) ? propsStyle : {};
  2003. for (let key in props) {
  2004. const value = props[key];
  2005. if (value === void 0) {
  2006. continue;
  2007. }
  2008. switch (key) {
  2009. case "icon":
  2010. case "style":
  2011. case "onLoad":
  2012. case "mode":
  2013. break;
  2014. case "inline":
  2015. case "hFlip":
  2016. case "vFlip":
  2017. customisations[key] = value === true || value === "true" || value === 1;
  2018. break;
  2019. case "flip":
  2020. if (typeof value === "string") {
  2021. flipFromString(customisations, value);
  2022. }
  2023. break;
  2024. case "color":
  2025. style.color = value;
  2026. break;
  2027. case "rotate":
  2028. if (typeof value === "string") {
  2029. customisations[key] = rotateFromString(value);
  2030. } else if (typeof value === "number") {
  2031. customisations[key] = value;
  2032. }
  2033. break;
  2034. case "ariaHidden":
  2035. case "aria-hidden":
  2036. if (value !== true && value !== "true") {
  2037. delete componentProps["aria-hidden"];
  2038. }
  2039. break;
  2040. default: {
  2041. const alias = customisationAliases[key];
  2042. if (alias) {
  2043. if (value === true || value === "true" || value === 1) {
  2044. customisations[alias] = true;
  2045. }
  2046. } else if (defaultExtendedIconCustomisations[key] === void 0) {
  2047. componentProps[key] = value;
  2048. }
  2049. }
  2050. }
  2051. }
  2052. const item = iconToSVG(icon, customisations);
  2053. const renderAttribs = item.attributes;
  2054. if (customisations.inline) {
  2055. style.verticalAlign = "-0.125em";
  2056. }
  2057. if (mode === "svg") {
  2058. componentProps.style = {
  2059. ...style,
  2060. ...customStyle
  2061. };
  2062. Object.assign(componentProps, renderAttribs);
  2063. let localCounter = 0;
  2064. let id = props.id;
  2065. if (typeof id === "string") {
  2066. id = id.replace(/-/g, "_");
  2067. }
  2068. componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyVue");
  2069. return vue.h("svg", componentProps);
  2070. }
  2071. const { body, width, height } = icon;
  2072. const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
  2073. const html = iconToHTML(body, {
  2074. ...renderAttribs,
  2075. width: width + "",
  2076. height: height + ""
  2077. });
  2078. componentProps.style = {
  2079. ...style,
  2080. "--svg": svgToURL(html),
  2081. "width": fixSize(renderAttribs.width),
  2082. "height": fixSize(renderAttribs.height),
  2083. ...commonProps,
  2084. ...useMask ? monotoneProps : coloredProps,
  2085. ...customStyle
  2086. };
  2087. return vue.h("span", componentProps);
  2088. };
  2089. allowSimpleNames(true);
  2090. setAPIModule("", fetchAPIModule);
  2091. if (typeof document !== "undefined" && typeof window !== "undefined") {
  2092. initBrowserStorage();
  2093. const _window2 = window;
  2094. if (_window2.IconifyPreload !== void 0) {
  2095. const preload = _window2.IconifyPreload;
  2096. const err = "Invalid IconifyPreload syntax.";
  2097. if (typeof preload === "object" && preload !== null) {
  2098. (preload instanceof Array ? preload : [preload]).forEach((item) => {
  2099. try {
  2100. if (
  2101. // Check if item is an object and not null/array
  2102. typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
  2103. typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
  2104. !addCollection(item)
  2105. ) {
  2106. console.error(err);
  2107. }
  2108. } catch (e2) {
  2109. console.error(err);
  2110. }
  2111. });
  2112. }
  2113. }
  2114. if (_window2.IconifyProviders !== void 0) {
  2115. const providers = _window2.IconifyProviders;
  2116. if (typeof providers === "object" && providers !== null) {
  2117. for (let key in providers) {
  2118. const err = "IconifyProviders[" + key + "] is invalid.";
  2119. try {
  2120. const value = providers[key];
  2121. if (typeof value !== "object" || !value || value.resources === void 0) {
  2122. continue;
  2123. }
  2124. if (!addAPIProvider(key, value)) {
  2125. console.error(err);
  2126. }
  2127. } catch (e2) {
  2128. console.error(err);
  2129. }
  2130. }
  2131. }
  2132. }
  2133. }
  2134. const emptyIcon = {
  2135. ...defaultIconProps,
  2136. body: ""
  2137. };
  2138. const Icon = vue.defineComponent({
  2139. // Do not inherit other attributes: it is handled by render()
  2140. inheritAttrs: false,
  2141. // Set initial data
  2142. data() {
  2143. return {
  2144. // Mounted status
  2145. iconMounted: false,
  2146. // Callback counter to trigger re-render
  2147. counter: 0
  2148. };
  2149. },
  2150. mounted() {
  2151. this._name = "";
  2152. this._loadingIcon = null;
  2153. this.iconMounted = true;
  2154. },
  2155. unmounted() {
  2156. this.abortLoading();
  2157. },
  2158. methods: {
  2159. abortLoading() {
  2160. if (this._loadingIcon) {
  2161. this._loadingIcon.abort();
  2162. this._loadingIcon = null;
  2163. }
  2164. },
  2165. // Get data for icon to render or null
  2166. getIcon(icon, onload) {
  2167. if (typeof icon === "object" && icon !== null && typeof icon.body === "string") {
  2168. this._name = "";
  2169. this.abortLoading();
  2170. return {
  2171. data: icon
  2172. };
  2173. }
  2174. let iconName;
  2175. if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) {
  2176. this.abortLoading();
  2177. return null;
  2178. }
  2179. const data = getIconData(iconName);
  2180. if (!data) {
  2181. if (!this._loadingIcon || this._loadingIcon.name !== icon) {
  2182. this.abortLoading();
  2183. this._name = "";
  2184. if (data !== null) {
  2185. this._loadingIcon = {
  2186. name: icon,
  2187. abort: loadIcons([iconName], () => {
  2188. this.counter++;
  2189. })
  2190. };
  2191. }
  2192. }
  2193. return null;
  2194. }
  2195. this.abortLoading();
  2196. if (this._name !== icon) {
  2197. this._name = icon;
  2198. if (onload) {
  2199. onload(icon);
  2200. }
  2201. }
  2202. const classes = ["iconify"];
  2203. if (iconName.prefix !== "") {
  2204. classes.push("iconify--" + iconName.prefix);
  2205. }
  2206. if (iconName.provider !== "") {
  2207. classes.push("iconify--" + iconName.provider);
  2208. }
  2209. return { data, classes };
  2210. }
  2211. },
  2212. // Render icon
  2213. render() {
  2214. this.counter;
  2215. const props = this.$attrs;
  2216. const icon = this.iconMounted ? this.getIcon(props.icon, props.onLoad) : null;
  2217. if (!icon) {
  2218. return render(emptyIcon, props);
  2219. }
  2220. let newProps = props;
  2221. if (icon.classes) {
  2222. newProps = {
  2223. ...props,
  2224. class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ")
  2225. };
  2226. }
  2227. return render({
  2228. ...defaultIconProps,
  2229. ...icon.data
  2230. }, newProps);
  2231. }
  2232. });
  2233. const _hoisted_1$h = { class: "display-type" };
  2234. const _hoisted_2$e = { style: { "position": "relative" } };
  2235. const _hoisted_3$b = {
  2236. key: 0,
  2237. class: "type-list"
  2238. };
  2239. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  2240. __name: "BaseSelect",
  2241. props: {
  2242. displayType: {}
  2243. },
  2244. emits: ["update:displayType"],
  2245. setup(__props, { emit: __emit }) {
  2246. const props = __props;
  2247. const emit = __emit;
  2248. let state = vue.reactive({
  2249. showChangeDisplayType: false,
  2250. lastDisplayType: null
  2251. });
  2252. function changeOption(item) {
  2253. if (![CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2254. state.lastDisplayType = props.displayType;
  2255. }
  2256. emit("update:displayType", item);
  2257. state.showChangeDisplayType = false;
  2258. }
  2259. function clickDisplayType() {
  2260. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2261. return changeOption(state.lastDisplayType ?? CommentDisplayType.FloorInFloorNoCallUser);
  2262. }
  2263. state.showChangeDisplayType = !state.showChangeDisplayType;
  2264. }
  2265. const currentDisplayType = vue.computed(() => {
  2266. let judge = props.displayType;
  2267. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2268. judge = state.lastDisplayType;
  2269. }
  2270. switch (judge) {
  2271. case CommentDisplayType.FloorInFloorNoCallUser:
  2272. return "楼中楼";
  2273. case CommentDisplayType.FloorInFloor:
  2274. return "楼中楼(@)";
  2275. case CommentDisplayType.FloorInFloorNested:
  2276. return "冗余楼中楼";
  2277. case CommentDisplayType.V2exOrigin:
  2278. return "V2原版";
  2279. case CommentDisplayType.OnlyOp:
  2280. return "只看楼主";
  2281. default:
  2282. return "楼中楼";
  2283. }
  2284. });
  2285. return (_ctx, _cache) => {
  2286. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
  2287. vue.createElementVNode("div", {
  2288. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).New && "active"]),
  2289. onClick: _cache[0] || (_cache[0] = ($event) => changeOption(vue.unref(CommentDisplayType).New))
  2290. }, "最新 ", 2),
  2291. vue.createElementVNode("div", {
  2292. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).Like && "active"]),
  2293. onClick: _cache[1] || (_cache[1] = ($event) => changeOption(vue.unref(CommentDisplayType).Like))
  2294. }, "最热 ", 2),
  2295. vue.createElementVNode("div", _hoisted_2$e, [
  2296. vue.createElementVNode("div", {
  2297. class: vue.normalizeClass(["type", ![vue.unref(CommentDisplayType).New, vue.unref(CommentDisplayType).Like].includes(_ctx.displayType) && "active"]),
  2298. onClick: clickDisplayType
  2299. }, [
  2300. vue.createElementVNode("span", null, vue.toDisplayString(currentDisplayType.value), 1),
  2301. vue.createVNode(vue.unref(Icon), { icon: "mingcute:down-line" })
  2302. ], 2),
  2303. vue.unref(state).showChangeDisplayType ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$b, [
  2304. vue.createElementVNode("div", {
  2305. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNoCallUser && "active"]),
  2306. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNoCallUser), ["stop"]))
  2307. }, "楼中楼 ", 2),
  2308. vue.createElementVNode("div", {
  2309. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloor && "active"]),
  2310. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloor), ["stop"]))
  2311. }, "楼中楼(@) ", 2),
  2312. vue.createElementVNode("div", {
  2313. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNested && "active"]),
  2314. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNested), ["stop"]))
  2315. }, "冗余楼中楼 ", 2),
  2316. vue.createElementVNode("div", {
  2317. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).OnlyOp && "active"]),
  2318. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).OnlyOp), ["stop"]))
  2319. }, "只看楼主 ", 2),
  2320. vue.createElementVNode("div", {
  2321. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).V2exOrigin && "active"]),
  2322. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).V2exOrigin), ["stop"]))
  2323. }, "V2原版 ", 2)
  2324. ])) : vue.createCommentVNode("", true)
  2325. ])
  2326. ]);
  2327. };
  2328. }
  2329. });
  2330. const BaseSelect = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-a920fba8"]]);
  2331. const _sfc_main$h = {
  2332. name: "Setting",
  2333. components: {
  2334. Icon,
  2335. BaseSelect,
  2336. BaseSwitch,
  2337. Tooltip
  2338. },
  2339. inject: ["isNight"],
  2340. props: {
  2341. modelValue: {
  2342. type: Object,
  2343. default() {
  2344. return {};
  2345. }
  2346. },
  2347. show: {
  2348. type: Boolean,
  2349. default() {
  2350. return false;
  2351. }
  2352. }
  2353. },
  2354. data() {
  2355. return {
  2356. tabIndex: 0,
  2357. config: window.clone(this.modelValue)
  2358. };
  2359. },
  2360. computed: {
  2361. DefaultVal() {
  2362. return DefaultVal;
  2363. },
  2364. CommentDisplayType() {
  2365. return CommentDisplayType;
  2366. },
  2367. isNew() {
  2368. return this.config.version < window.currentVersion;
  2369. }
  2370. },
  2371. watch: {
  2372. config: {
  2373. handler(n2) {
  2374. n2.topReplyLoveMinCount = Math.trunc(n2.topReplyLoveMinCount);
  2375. if (n2.topReplyLoveMinCount < 0) {
  2376. n2.topReplyLoveMinCount = 1;
  2377. }
  2378. this.$emit("update:modelValue", n2);
  2379. },
  2380. deep: true
  2381. }
  2382. },
  2383. methods: {
  2384. close() {
  2385. this.config.version = window.currentVersion;
  2386. this.$emit("update:show", false);
  2387. }
  2388. }
  2389. };
  2390. const _withScopeId$9 = (n2) => (vue.pushScopeId("data-v-03cabff3"), n2 = n2(), vue.popScopeId(), n2);
  2391. const _hoisted_1$g = {
  2392. key: 0,
  2393. class: "setting-modal modal"
  2394. };
  2395. const _hoisted_2$d = { class: "modal-root" };
  2396. const _hoisted_3$a = { class: "modal-header" };
  2397. const _hoisted_4$a = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 脚本设置 ", -1));
  2398. const _hoisted_5$7 = { class: "body" };
  2399. const _hoisted_6$7 = { class: "left" };
  2400. const _hoisted_7$6 = { class: "tabs" };
  2401. const _hoisted_8$6 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "列表设置", -1));
  2402. const _hoisted_9$6 = [
  2403. _hoisted_8$6
  2404. ];
  2405. const _hoisted_10$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "帖子设置", -1));
  2406. const _hoisted_11$5 = [
  2407. _hoisted_10$5
  2408. ];
  2409. const _hoisted_12$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "其他设置", -1));
  2410. const _hoisted_13$5 = [
  2411. _hoisted_12$5
  2412. ];
  2413. const _hoisted_14$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "关于脚本", -1));
  2414. const _hoisted_15$4 = [
  2415. _hoisted_14$5
  2416. ];
  2417. const _hoisted_16$4 = { class: "modal-content" };
  2418. const _hoisted_17$4 = { class: "scroll" };
  2419. const _hoisted_18$4 = { key: 0 };
  2420. const _hoisted_19$3 = { class: "row" };
  2421. const _hoisted_20$2 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表展示方式", -1));
  2422. const _hoisted_21$2 = { class: "wrapper" };
  2423. const _hoisted_22$2 = { class: "radio-group2" };
  2424. const _hoisted_23$2 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  2425. const _hoisted_24$2 = { class: "row" };
  2426. const _hoisted_25$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表hover时显示预览按钮", -1));
  2427. const _hoisted_26$1 = { class: "wrapper" };
  2428. const _hoisted_27$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  2429. const _hoisted_28$1 = { class: "row" };
  2430. const _hoisted_29$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "帖子弹框显示", -1));
  2431. const _hoisted_30$1 = { class: "wrapper" };
  2432. const _hoisted_31$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 开启此选项后,帖子始终会以弹框的方式显示。优先级大于“新标签页打开链接” ", -1));
  2433. const _hoisted_32$1 = { class: "row" };
  2434. const _hoisted_33$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "新标签页打开链接", -1));
  2435. const _hoisted_34$1 = { class: "wrapper" };
  2436. const _hoisted_35$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 网页上所有链接通过新标签页打开 ", -1));
  2437. const _hoisted_36$1 = { key: 1 };
  2438. const _hoisted_37$1 = { class: "row" };
  2439. const _hoisted_38$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示回复展示方式", -1));
  2440. const _hoisted_39$1 = { class: "wrapper" };
  2441. const _hoisted_40$1 = { class: "row" };
  2442. const _hoisted_41$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "回复展示方式", -1));
  2443. const _hoisted_42$1 = { class: "wrapper" };
  2444. const _hoisted_43$1 = { class: "row" };
  2445. const _hoisted_44$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "单独打开帖子时默认显示楼中楼", -1));
  2446. const _hoisted_45$1 = { class: "wrapper" };
  2447. const _hoisted_46$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 单独打开这种地址 https://v2ex.com/t/xxxx 时,是否默认显示楼中楼 ", -1));
  2448. const _hoisted_47$1 = { class: "row" };
  2449. const _hoisted_48 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "点击左右两侧透明处关闭帖子详情弹框", -1));
  2450. const _hoisted_49 = { class: "wrapper" };
  2451. const _hoisted_50 = { class: "row" };
  2452. const _hoisted_51 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "正文超长自动折叠", -1));
  2453. const _hoisted_52 = { class: "wrapper" };
  2454. const _hoisted_53 = { class: "row" };
  2455. const _hoisted_54 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "帖子宽度", -1));
  2456. const _hoisted_55 = { class: "wrapper" };
  2457. const _hoisted_56 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  2458. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则默认宽度为77rem。接受合法的width值: "),
  2459. /* @__PURE__ */ vue.createElementVNode("a", {
  2460. href: "https://vue3js.cn/interview/css/em_px_rem_vh_vw.html#%E4%BA%8C%E3%80%81%E5%8D%95%E4%BD%8D",
  2461. target: "_blank"
  2462. }, "rem、px、vw、vh(点此查看)"),
  2463. /* @__PURE__ */ vue.createTextVNode("。 vw代表屏幕百分比,如想要屏幕的66%,请填写66vw ")
  2464. ], -1));
  2465. const _hoisted_57 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 提示:此项设置以后,单独打开详情页时会出现帖子突然变宽(窄)的问题,暂时无解 ", -1));
  2466. const _hoisted_58 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  2467. const _hoisted_59 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2468. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "高赞回复")
  2469. ], -1));
  2470. const _hoisted_60 = { class: "row" };
  2471. const _hoisted_61 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示高赞回复", -1));
  2472. const _hoisted_62 = { class: "wrapper" };
  2473. const _hoisted_63 = { class: "row" };
  2474. const _hoisted_64 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最多显示多少个高赞回复", -1));
  2475. const _hoisted_65 = { class: "wrapper" };
  2476. const _hoisted_66 = { class: "row" };
  2477. const _hoisted_67 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最少需要多少赞才能被判定为高赞", -1));
  2478. const _hoisted_68 = { class: "wrapper" };
  2479. const _hoisted_69 = { key: 2 };
  2480. const _hoisted_70 = { class: "row" };
  2481. const _hoisted_71 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "用户打标签(跨平台,数据保存在自己的记事本):", -1));
  2482. const _hoisted_72 = { class: "wrapper" };
  2483. const _hoisted_73 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 2024-01-27提示:此功能暂时无法使用 ", -1));
  2484. const _hoisted_74 = { class: "row" };
  2485. const _hoisted_75 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "划词显示Base64解码框", -1));
  2486. const _hoisted_76 = { class: "wrapper" };
  2487. const _hoisted_77 = { class: "row" };
  2488. const _hoisted_78 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自动签到", -1));
  2489. const _hoisted_79 = { class: "wrapper" };
  2490. const _hoisted_80 = { class: "row" };
  2491. const _hoisted_81 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自定义背景", -1));
  2492. const _hoisted_82 = { class: "wrapper" };
  2493. const _hoisted_83 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  2494. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则背景颜色默认为 #e2e2e2。接受一个合法的css color值:例如"),
  2495. /* @__PURE__ */ vue.createElementVNode("a", {
  2496. href: "https://developer.mozilla.org/zh-CN/docs/Web/CSS/color_value",
  2497. target: "_blank"
  2498. }, "red、#ffffff、rgb(222,222,22)(点此查看)"),
  2499. /* @__PURE__ */ vue.createTextVNode("等等。 ")
  2500. ], -1));
  2501. const _hoisted_84 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  2502. const _hoisted_85 = { class: "row" };
  2503. const _hoisted_86 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "收藏时提醒添加到书签", -1));
  2504. const _hoisted_87 = { class: "wrapper" };
  2505. const _hoisted_88 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " V站帐号一旦被封禁,则无法登录(不可用),无法查看账号收藏了 ", -1));
  2506. const _hoisted_89 = { key: 3 };
  2507. const _hoisted_90 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("h1", null, "V2EX Next", -1));
  2508. const _hoisted_91 = { class: "project-desc" };
  2509. const _hoisted_92 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", null, [
  2510. /* @__PURE__ */ vue.createTextVNode(" 本项目完全开源,已支持移动端!"),
  2511. /* @__PURE__ */ vue.createElementVNode("b", null, "好用请大家多多点Star!")
  2512. ], -1));
  2513. const _hoisted_93 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  2514. const _hoisted_94 = { style: { "line-height": "1.5" } };
  2515. const _hoisted_95 = ["href"];
  2516. const _hoisted_96 = ["href"];
  2517. const _hoisted_97 = ["href"];
  2518. const _hoisted_98 = ["href"];
  2519. const _hoisted_99 = ["href"];
  2520. const _hoisted_100 = ["href"];
  2521. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  2522. const _component_Icon = vue.resolveComponent("Icon");
  2523. const _component_BaseSwitch = vue.resolveComponent("BaseSwitch");
  2524. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  2525. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  2526. default: vue.withCtx(() => [
  2527. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  2528. vue.createElementVNode("div", {
  2529. class: "mask",
  2530. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  2531. }),
  2532. vue.createElementVNode("div", _hoisted_2$d, [
  2533. vue.createElementVNode("div", _hoisted_3$a, [
  2534. _hoisted_4$a,
  2535. vue.createVNode(_component_Icon, {
  2536. icon: "ic:round-close",
  2537. onClick: $options.close
  2538. }, null, 8, ["onClick"])
  2539. ]),
  2540. vue.createElementVNode("div", _hoisted_5$7, [
  2541. vue.createElementVNode("div", _hoisted_6$7, [
  2542. vue.createElementVNode("div", _hoisted_7$6, [
  2543. vue.createElementVNode("div", {
  2544. class: vue.normalizeClass(["tab", $data.tabIndex === 0 && "active"]),
  2545. onClick: _cache[1] || (_cache[1] = ($event) => $data.tabIndex = 0)
  2546. }, _hoisted_9$6, 2),
  2547. vue.createElementVNode("div", {
  2548. class: vue.normalizeClass(["tab", $data.tabIndex === 1 && "active"]),
  2549. onClick: _cache[2] || (_cache[2] = ($event) => $data.tabIndex = 1)
  2550. }, _hoisted_11$5, 2),
  2551. vue.createElementVNode("div", {
  2552. class: vue.normalizeClass(["tab", $data.tabIndex === 2 && "active"]),
  2553. onClick: _cache[3] || (_cache[3] = ($event) => $data.tabIndex = 2)
  2554. }, _hoisted_13$5, 2),
  2555. vue.createElementVNode("div", {
  2556. class: vue.normalizeClass(["tab", $data.tabIndex === 3 && "active"]),
  2557. onClick: _cache[4] || (_cache[4] = ($event) => $data.tabIndex = 3)
  2558. }, _hoisted_15$4, 2)
  2559. ])
  2560. ]),
  2561. vue.createElementVNode("div", _hoisted_16$4, [
  2562. vue.createElementVNode("div", _hoisted_17$4, [
  2563. $data.tabIndex === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$4, [
  2564. vue.createElementVNode("div", _hoisted_19$3, [
  2565. _hoisted_20$2,
  2566. vue.createElementVNode("div", _hoisted_21$2, [
  2567. vue.createElementVNode("div", _hoisted_22$2, [
  2568. vue.createElementVNode("div", {
  2569. class: vue.normalizeClass(["radio", $data.config.viewType === "simple" ? "active" : ""]),
  2570. onClick: _cache[5] || (_cache[5] = ($event) => $data.config.viewType = "simple")
  2571. }, "简洁 ", 2),
  2572. vue.createElementVNode("div", {
  2573. class: vue.normalizeClass(["radio", $data.config.viewType === "table" ? "active" : ""]),
  2574. onClick: _cache[6] || (_cache[6] = ($event) => $data.config.viewType = "table")
  2575. }, "表格 ", 2),
  2576. vue.createElementVNode("div", {
  2577. class: vue.normalizeClass(["radio", $data.config.viewType === "card" ? "active" : ""]),
  2578. onClick: _cache[7] || (_cache[7] = ($event) => $data.config.viewType = "card")
  2579. }, "卡片 ", 2)
  2580. ])
  2581. ])
  2582. ]),
  2583. _hoisted_23$2,
  2584. vue.createElementVNode("div", _hoisted_24$2, [
  2585. _hoisted_25$1,
  2586. vue.createElementVNode("div", _hoisted_26$1, [
  2587. vue.createVNode(_component_BaseSwitch, {
  2588. modelValue: $data.config.showPreviewBtn,
  2589. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.config.showPreviewBtn = $event)
  2590. }, null, 8, ["modelValue"])
  2591. ])
  2592. ]),
  2593. _hoisted_27$1,
  2594. vue.createElementVNode("div", _hoisted_28$1, [
  2595. _hoisted_29$1,
  2596. vue.createElementVNode("div", _hoisted_30$1, [
  2597. vue.createVNode(_component_BaseSwitch, {
  2598. modelValue: $data.config.clickPostItemOpenDetail,
  2599. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.config.clickPostItemOpenDetail = $event)
  2600. }, null, 8, ["modelValue"])
  2601. ])
  2602. ]),
  2603. _hoisted_31$1,
  2604. vue.createElementVNode("div", _hoisted_32$1, [
  2605. _hoisted_33$1,
  2606. vue.createElementVNode("div", _hoisted_34$1, [
  2607. vue.createVNode(_component_BaseSwitch, {
  2608. modelValue: $data.config.newTabOpen,
  2609. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.config.newTabOpen = $event)
  2610. }, null, 8, ["modelValue"])
  2611. ])
  2612. ]),
  2613. _hoisted_35$1
  2614. ])) : vue.createCommentVNode("", true),
  2615. $data.tabIndex === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_36$1, [
  2616. vue.createElementVNode("div", _hoisted_37$1, [
  2617. _hoisted_38$1,
  2618. vue.createElementVNode("div", _hoisted_39$1, [
  2619. vue.createVNode(_component_BaseSwitch, {
  2620. modelValue: $data.config.showToolbar,
  2621. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.config.showToolbar = $event)
  2622. }, null, 8, ["modelValue"])
  2623. ])
  2624. ]),
  2625. vue.createElementVNode("div", _hoisted_40$1, [
  2626. _hoisted_41$1,
  2627. vue.createElementVNode("div", _hoisted_42$1, [
  2628. vue.createVNode(_component_BaseSelect, {
  2629. "display-type": $data.config.commentDisplayType,
  2630. "onUpdate:displayType": _cache[12] || (_cache[12] = ($event) => $data.config.commentDisplayType = $event)
  2631. }, null, 8, ["display-type"])
  2632. ])
  2633. ]),
  2634. vue.createElementVNode("div", _hoisted_43$1, [
  2635. _hoisted_44$1,
  2636. vue.createElementVNode("div", _hoisted_45$1, [
  2637. vue.createVNode(_component_BaseSwitch, {
  2638. modelValue: $data.config.autoOpenDetail,
  2639. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.config.autoOpenDetail = $event)
  2640. }, null, 8, ["modelValue"])
  2641. ])
  2642. ]),
  2643. _hoisted_46$1,
  2644. vue.createElementVNode("div", _hoisted_47$1, [
  2645. _hoisted_48,
  2646. vue.createElementVNode("div", _hoisted_49, [
  2647. vue.createVNode(_component_BaseSwitch, {
  2648. modelValue: $data.config.closePostDetailBySpace,
  2649. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.config.closePostDetailBySpace = $event)
  2650. }, null, 8, ["modelValue"])
  2651. ])
  2652. ]),
  2653. vue.createElementVNode("div", _hoisted_50, [
  2654. _hoisted_51,
  2655. vue.createElementVNode("div", _hoisted_52, [
  2656. vue.createVNode(_component_BaseSwitch, {
  2657. modelValue: $data.config.contentAutoCollapse,
  2658. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => $data.config.contentAutoCollapse = $event)
  2659. }, null, 8, ["modelValue"])
  2660. ])
  2661. ]),
  2662. vue.createElementVNode("div", _hoisted_53, [
  2663. _hoisted_54,
  2664. vue.createElementVNode("div", _hoisted_55, [
  2665. vue.withDirectives(vue.createElementVNode("input", {
  2666. type: "text",
  2667. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => $data.config.postWidth = $event)
  2668. }, null, 512), [
  2669. [vue.vModelText, $data.config.postWidth]
  2670. ])
  2671. ])
  2672. ]),
  2673. _hoisted_56,
  2674. _hoisted_57,
  2675. _hoisted_58,
  2676. _hoisted_59,
  2677. vue.createElementVNode("div", _hoisted_60, [
  2678. _hoisted_61,
  2679. vue.createElementVNode("div", _hoisted_62, [
  2680. vue.createVNode(_component_BaseSwitch, {
  2681. modelValue: $data.config.showTopReply,
  2682. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => $data.config.showTopReply = $event)
  2683. }, null, 8, ["modelValue"])
  2684. ])
  2685. ]),
  2686. vue.createElementVNode("div", _hoisted_63, [
  2687. _hoisted_64,
  2688. vue.createElementVNode("div", _hoisted_65, [
  2689. vue.withDirectives(vue.createElementVNode("input", {
  2690. type: "number",
  2691. min: "1",
  2692. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => $data.config.topReplyCount = $event)
  2693. }, null, 512), [
  2694. [vue.vModelText, $data.config.topReplyCount]
  2695. ])
  2696. ])
  2697. ]),
  2698. vue.createElementVNode("div", _hoisted_66, [
  2699. _hoisted_67,
  2700. vue.createElementVNode("div", _hoisted_68, [
  2701. vue.withDirectives(vue.createElementVNode("input", {
  2702. type: "number",
  2703. min: "1",
  2704. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => $data.config.topReplyLoveMinCount = $event)
  2705. }, null, 512), [
  2706. [vue.vModelText, $data.config.topReplyLoveMinCount]
  2707. ])
  2708. ])
  2709. ])
  2710. ])) : vue.createCommentVNode("", true),
  2711. $data.tabIndex === 2 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_69, [
  2712. vue.createElementVNode("div", _hoisted_70, [
  2713. _hoisted_71,
  2714. vue.createElementVNode("div", _hoisted_72, [
  2715. vue.createVNode(_component_BaseSwitch, {
  2716. modelValue: $data.config.openTag,
  2717. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => $data.config.openTag = $event)
  2718. }, null, 8, ["modelValue"])
  2719. ])
  2720. ]),
  2721. _hoisted_73,
  2722. vue.createElementVNode("div", _hoisted_74, [
  2723. _hoisted_75,
  2724. vue.createElementVNode("div", _hoisted_76, [
  2725. vue.createVNode(_component_BaseSwitch, {
  2726. modelValue: $data.config.base64,
  2727. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => $data.config.base64 = $event)
  2728. }, null, 8, ["modelValue"])
  2729. ])
  2730. ]),
  2731. vue.createElementVNode("div", _hoisted_77, [
  2732. _hoisted_78,
  2733. vue.createElementVNode("div", _hoisted_79, [
  2734. vue.createVNode(_component_BaseSwitch, {
  2735. modelValue: $data.config.autoSignin,
  2736. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => $data.config.autoSignin = $event)
  2737. }, null, 8, ["modelValue"])
  2738. ])
  2739. ]),
  2740. vue.createElementVNode("div", _hoisted_80, [
  2741. _hoisted_81,
  2742. vue.createElementVNode("div", _hoisted_82, [
  2743. vue.withDirectives(vue.createElementVNode("input", {
  2744. type: "text",
  2745. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => $data.config.customBgColor = $event)
  2746. }, null, 512), [
  2747. [vue.vModelText, $data.config.customBgColor]
  2748. ])
  2749. ])
  2750. ]),
  2751. _hoisted_83,
  2752. _hoisted_84,
  2753. vue.createElementVNode("div", _hoisted_85, [
  2754. _hoisted_86,
  2755. vue.createElementVNode("div", _hoisted_87, [
  2756. vue.createVNode(_component_BaseSwitch, {
  2757. modelValue: $data.config.collectBrowserNotice,
  2758. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => $data.config.collectBrowserNotice = $event)
  2759. }, null, 8, ["modelValue"])
  2760. ])
  2761. ]),
  2762. _hoisted_88
  2763. ])) : vue.createCommentVNode("", true),
  2764. $data.tabIndex === 3 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_89, [
  2765. _hoisted_90,
  2766. vue.createElementVNode("div", _hoisted_91, [
  2767. _hoisted_92,
  2768. _hoisted_93,
  2769. vue.createElementVNode("div", _hoisted_94, [
  2770. vue.createElementVNode("div", null, [
  2771. vue.createTextVNode("官网:"),
  2772. vue.createElementVNode("a", {
  2773. href: $options.DefaultVal.homeUrl,
  2774. target: "_blank"
  2775. }, vue.toDisplayString($options.DefaultVal.homeUrl), 9, _hoisted_95)
  2776. ]),
  2777. vue.createElementVNode("div", null, [
  2778. vue.createTextVNode("GitHub地址:"),
  2779. vue.createElementVNode("a", {
  2780. href: $options.DefaultVal.git,
  2781. target: "_blank"
  2782. }, vue.toDisplayString($options.DefaultVal.git), 9, _hoisted_96)
  2783. ]),
  2784. vue.createElementVNode("div", null, [
  2785. vue.createTextVNode("PC脚本地址:"),
  2786. vue.createElementVNode("a", {
  2787. href: $options.DefaultVal.pcScript,
  2788. target: "_blank"
  2789. }, vue.toDisplayString($options.DefaultVal.pcScript), 9, _hoisted_97)
  2790. ]),
  2791. vue.createElementVNode("div", null, [
  2792. vue.createTextVNode("移动端脚本地址:"),
  2793. vue.createElementVNode("a", {
  2794. href: $options.DefaultVal.mobileScript,
  2795. target: "_blank"
  2796. }, vue.toDisplayString($options.DefaultVal.mobileScript), 9, _hoisted_98)
  2797. ]),
  2798. vue.createElementVNode("div", null, [
  2799. vue.createTextVNode("反馈: "),
  2800. vue.createElementVNode("a", {
  2801. href: $options.DefaultVal.issue,
  2802. target: "_blank"
  2803. }, vue.toDisplayString($options.DefaultVal.issue), 9, _hoisted_99)
  2804. ]),
  2805. vue.createElementVNode("div", null, [
  2806. vue.createTextVNode("更新日志:"),
  2807. vue.createElementVNode("a", {
  2808. href: $options.DefaultVal.pcLog,
  2809. target: "_blank"
  2810. }, vue.toDisplayString($options.DefaultVal.pcLog), 9, _hoisted_100)
  2811. ])
  2812. ])
  2813. ])
  2814. ])) : vue.createCommentVNode("", true)
  2815. ])
  2816. ])
  2817. ])
  2818. ])
  2819. ])) : vue.createCommentVNode("", true)
  2820. ]),
  2821. _: 1
  2822. });
  2823. }
  2824. const Setting = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$8], ["__scopeId", "data-v-03cabff3"]]);
  2825. const eventBus = {
  2826. eventMap: /* @__PURE__ */ new Map(),
  2827. on(eventType, cb) {
  2828. let cbs = this.eventMap.get(eventType);
  2829. if (cbs) {
  2830. cbs.push(cb);
  2831. } else {
  2832. cbs = [cb];
  2833. }
  2834. this.eventMap.set(eventType, cbs);
  2835. },
  2836. emit(eventType, val) {
  2837. let cbs = this.eventMap.get(eventType);
  2838. if (cbs) {
  2839. cbs.map((cb) => cb(val));
  2840. }
  2841. },
  2842. off(eventType) {
  2843. let cbs = this.eventMap.has(eventType);
  2844. if (cbs) {
  2845. this.eventMap.delete(eventType);
  2846. }
  2847. },
  2848. clear() {
  2849. this.eventMap = /* @__PURE__ */ new Map();
  2850. }
  2851. };
  2852. const CMD = {
  2853. SHOW_TOOLTIP: "SHOW_TOOLTIP",
  2854. SHOW_MSG: "SHOW_MSG",
  2855. SET_CALL: "SET_CALL",
  2856. SHOW_CALL: "SHOW_CALL",
  2857. REFRESH_ONCE: "REFRESH_ONCE",
  2858. ADD_REPLY: "ADD_REPLY",
  2859. IGNORE: "IGNORE",
  2860. MERGE: "MERGE",
  2861. REMOVE: "REMOVE",
  2862. CHANGE_COMMENT_THANK: "CHANGE_COMMENT_THANK",
  2863. CHANGE_POST_THANK: "CHANGE_POST_THANK",
  2864. ADD_TAG: "ADD_TAG",
  2865. REMOVE_TAG: "REMOVE_TAG",
  2866. RELATION_REPLY: "RELATION_REPLY",
  2867. JUMP: "JUMP",
  2868. REFRESH_POST: "REFRESH_POST"
  2869. };
  2870. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  2871. __name: "BaseLoading",
  2872. props: {
  2873. size: { default: "normal" }
  2874. },
  2875. setup(__props) {
  2876. return (_ctx, _cache) => {
  2877. return vue.openBlock(), vue.createElementBlock("div", {
  2878. class: vue.normalizeClass(["loading", [_ctx.size]])
  2879. }, null, 2);
  2880. };
  2881. }
  2882. });
  2883. const BaseLoading = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-2697baa2"]]);
  2884. const _hoisted_1$f = {
  2885. key: 1,
  2886. class: "key-notice"
  2887. };
  2888. const _hoisted_2$c = { class: "key" };
  2889. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  2890. __name: "BaseButton",
  2891. props: {
  2892. keyboard: {},
  2893. active: { type: Boolean },
  2894. disabled: { type: Boolean },
  2895. loading: { type: Boolean },
  2896. size: { default: "normal" },
  2897. type: { default: "primary" }
  2898. },
  2899. emits: ["click"],
  2900. setup(__props) {
  2901. return (_ctx, _cache) => {
  2902. return vue.openBlock(), vue.createBlock(Tooltip, {
  2903. disabled: !_ctx.keyboard,
  2904. title: `快捷键: ${_ctx.keyboard}`
  2905. }, {
  2906. default: vue.withCtx(() => [
  2907. vue.createElementVNode("div", vue.mergeProps({ class: "base-button" }, _ctx.$attrs, {
  2908. onClick: _cache[0] || (_cache[0] = (e2) => !_ctx.disabled && !_ctx.loading && _ctx.$emit("click", e2)),
  2909. class: [
  2910. _ctx.active && "active",
  2911. _ctx.size,
  2912. _ctx.type,
  2913. (_ctx.disabled || _ctx.loading) && "disabled",
  2914. !_ctx.disabled && "hvr-grow"
  2915. ]
  2916. }), [
  2917. vue.createElementVNode("span", {
  2918. style: vue.normalizeStyle({ opacity: _ctx.loading ? 0 : 1 })
  2919. }, [
  2920. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  2921. ], 4),
  2922. _ctx.loading ? (vue.openBlock(), vue.createBlock(BaseLoading, {
  2923. key: 0,
  2924. size: "small"
  2925. })) : vue.createCommentVNode("", true),
  2926. _ctx.keyboard ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
  2927. vue.createElementVNode("span", _hoisted_2$c, vue.toDisplayString(_ctx.keyboard), 1)
  2928. ])) : vue.createCommentVNode("", true)
  2929. ], 16)
  2930. ]),
  2931. _: 3
  2932. }, 8, ["disabled", "title"]);
  2933. };
  2934. }
  2935. });
  2936. const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-5a7d79ba"]]);
  2937. const _sfc_main$e = {
  2938. name: "PopConfirm",
  2939. components: { BaseButton },
  2940. props: {
  2941. title: {
  2942. type: String,
  2943. default() {
  2944. return "";
  2945. }
  2946. },
  2947. disabled: {
  2948. type: Boolean,
  2949. default() {
  2950. return false;
  2951. }
  2952. }
  2953. },
  2954. data() {
  2955. return {
  2956. show: false
  2957. };
  2958. },
  2959. methods: {
  2960. showPop(e2) {
  2961. if (this.disabled)
  2962. return;
  2963. let rect = e2.target.getBoundingClientRect();
  2964. this.show = true;
  2965. vue.nextTick(() => {
  2966. this.$refs.tip.style.top = rect.top + "px";
  2967. this.$refs.tip.style.left = rect.left + rect.width / 2 - 50 + "px";
  2968. });
  2969. },
  2970. confirm() {
  2971. this.show = false;
  2972. this.$emit("confirm");
  2973. }
  2974. }
  2975. };
  2976. const _hoisted_1$e = { class: "pop-confirm" };
  2977. const _hoisted_2$b = {
  2978. key: 0,
  2979. ref: "tip",
  2980. class: "pop-confirm-content"
  2981. };
  2982. const _hoisted_3$9 = { class: "text" };
  2983. const _hoisted_4$9 = { class: "options" };
  2984. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  2985. const _component_BaseButton = vue.resolveComponent("BaseButton");
  2986. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
  2987. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  2988. vue.createVNode(vue.Transition, null, {
  2989. default: vue.withCtx(() => [
  2990. $data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$b, [
  2991. vue.createElementVNode("div", _hoisted_3$9, vue.toDisplayString($props.title), 1),
  2992. vue.createElementVNode("div", _hoisted_4$9, [
  2993. vue.createVNode(_component_BaseButton, {
  2994. type: "link",
  2995. size: "small",
  2996. onClick: _cache[0] || (_cache[0] = ($event) => $data.show = false)
  2997. }, {
  2998. default: vue.withCtx(() => [
  2999. vue.createTextVNode("取消")
  3000. ]),
  3001. _: 1
  3002. }),
  3003. vue.createVNode(_component_BaseButton, {
  3004. size: "small",
  3005. onClick: $options.confirm
  3006. }, {
  3007. default: vue.withCtx(() => [
  3008. vue.createTextVNode("确认")
  3009. ]),
  3010. _: 1
  3011. }, 8, ["onClick"])
  3012. ])
  3013. ], 512)) : vue.createCommentVNode("", true)
  3014. ]),
  3015. _: 1
  3016. })
  3017. ])),
  3018. vue.createElementVNode("span", {
  3019. onClick: _cache[1] || (_cache[1] = (...args) => $options.showPop && $options.showPop(...args))
  3020. }, [
  3021. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  3022. ])
  3023. ]);
  3024. }
  3025. const PopConfirm = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$7], ["__scopeId", "data-v-05424197"]]);
  3026. const _sfc_main$d = {
  3027. name: "Point",
  3028. components: { PopConfirm, Icon },
  3029. inject: ["post", "isLogin"],
  3030. props: {
  3031. item: {
  3032. type: Object,
  3033. default() {
  3034. return {};
  3035. }
  3036. },
  3037. apiUrl: ""
  3038. },
  3039. computed: {
  3040. disabled() {
  3041. return this.item.username === window.user.username || this.item.isThanked || !this.isLogin;
  3042. }
  3043. },
  3044. methods: {
  3045. thankError() {
  3046. if (!this.isLogin) {
  3047. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录(不可用)!" });
  3048. }
  3049. if (this.item.username === window.user.username) {
  3050. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  3051. }
  3052. if (this.item.isThanked) {
  3053. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  3054. }
  3055. },
  3056. async thank() {
  3057. this.$emit("addThank");
  3058. let url = `${window.baseUrl}/thank/${this.apiUrl}?once=${this.post.once}`;
  3059. $.post(url).then((res) => {
  3060. if (!res.success) {
  3061. this.$emit("recallThank");
  3062. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  3063. }
  3064. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  3065. }, (err) => {
  3066. this.$emit("recallThank");
  3067. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  3068. eventBus.emit(CMD.REFRESH_ONCE);
  3069. });
  3070. }
  3071. }
  3072. };
  3073. const _hoisted_1$d = {
  3074. key: 2,
  3075. class: "link-num"
  3076. };
  3077. const _hoisted_2$a = { key: 3 };
  3078. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  3079. const _component_Icon = vue.resolveComponent("Icon");
  3080. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3081. return vue.openBlock(), vue.createBlock(_component_PopConfirm, {
  3082. disabled: $options.disabled,
  3083. title: `确认花费 10 个铜币向 @${$props.item.username} 的这条回复发送感谢?`,
  3084. onConfirm: $options.thank
  3085. }, {
  3086. default: vue.withCtx(() => [
  3087. vue.createElementVNode("div", {
  3088. class: vue.normalizeClass(["tool", [$options.disabled && "disabled"]]),
  3089. onClick: _cache[0] || (_cache[0] = (...args) => $options.thankError && $options.thankError(...args))
  3090. }, [
  3091. $props.item.isThanked ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3092. key: 0,
  3093. color: "rgb(224,42,42)",
  3094. icon: "icon-park-solid:like"
  3095. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  3096. key: 1,
  3097. color: !$props.item.thankCount ? null : "rgb(224,42,42)",
  3098. icon: "icon-park-outline:like"
  3099. }, null, 8, ["color"])),
  3100. $props.item.thankCount ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$d, vue.toDisplayString($props.item.thankCount), 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$a, "感谢"))
  3101. ], 2)
  3102. ]),
  3103. _: 1
  3104. }, 8, ["disabled", "title", "onConfirm"]);
  3105. }
  3106. const Point = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$6]]);
  3107. const _sfc_main$c = {
  3108. name: "Author",
  3109. components: { PopConfirm, Point, Icon },
  3110. inject: ["isLogin", "tags", "config", "isNight"],
  3111. props: {
  3112. modelValue: false,
  3113. comment: {
  3114. type: Object,
  3115. default() {
  3116. return {};
  3117. }
  3118. },
  3119. type: {
  3120. type: String,
  3121. default() {
  3122. return "list";
  3123. }
  3124. }
  3125. },
  3126. computed: {
  3127. isDev() {
  3128. return false;
  3129. },
  3130. pointInfo() {
  3131. return {
  3132. isThanked: this.comment.isThanked,
  3133. thankCount: this.comment.thankCount,
  3134. username: this.comment.username
  3135. };
  3136. },
  3137. myTags() {
  3138. return this.tags[this.comment.username] ?? [];
  3139. },
  3140. context() {
  3141. return this.comment.replyUsers.length;
  3142. }
  3143. },
  3144. methods: {
  3145. jump() {
  3146. eventBus.emit(CMD.JUMP, this.comment.floor);
  3147. },
  3148. showRelationReply() {
  3149. if (!this.comment.replyUsers.length) {
  3150. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "该回复无上下文" });
  3151. return;
  3152. }
  3153. eventBus.emit(CMD.RELATION_REPLY, {
  3154. left: this.comment.replyUsers,
  3155. right: this.comment.username,
  3156. rightFloor: this.comment.floor
  3157. });
  3158. },
  3159. addTag() {
  3160. eventBus.emit(CMD.ADD_TAG, this.comment.username);
  3161. },
  3162. removeTag(tag) {
  3163. eventBus.emit(CMD.REMOVE_TAG, { username: this.comment.username, tag });
  3164. },
  3165. checkIsLogin(emitName = "") {
  3166. if (!this.isLogin) {
  3167. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录(不可用)!" });
  3168. return false;
  3169. }
  3170. this.$emit(emitName);
  3171. return true;
  3172. },
  3173. addThank() {
  3174. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "add" });
  3175. },
  3176. recallThank() {
  3177. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "recall" });
  3178. }
  3179. }
  3180. };
  3181. const _withScopeId$8 = (n2) => (vue.pushScopeId("data-v-53261a54"), n2 = n2(), vue.popScopeId(), n2);
  3182. const _hoisted_1$c = { class: "Author-left" };
  3183. const _hoisted_2$9 = ["href"];
  3184. const _hoisted_3$8 = ["src"];
  3185. const _hoisted_4$8 = { class: "texts" };
  3186. const _hoisted_5$6 = ["href"];
  3187. const _hoisted_6$6 = {
  3188. key: 0,
  3189. class: "owner"
  3190. };
  3191. const _hoisted_7$5 = {
  3192. key: 1,
  3193. class: "dup"
  3194. };
  3195. const _hoisted_8$5 = {
  3196. key: 2,
  3197. class: "mod"
  3198. };
  3199. const _hoisted_9$5 = { class: "ago" };
  3200. const _hoisted_10$4 = { class: "my-tag" };
  3201. const _hoisted_11$4 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3202. const _hoisted_12$4 = ["onClick"];
  3203. const _hoisted_13$4 = { class: "Author-right" };
  3204. const _hoisted_14$4 = {
  3205. key: 0,
  3206. class: "toolbar"
  3207. };
  3208. const _hoisted_15$3 = { class: "tool" };
  3209. const _hoisted_16$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "隐藏", -1));
  3210. const _hoisted_17$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上下文", -1));
  3211. const _hoisted_18$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  3212. const _hoisted_19$2 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  3213. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  3214. const _component_Icon = vue.resolveComponent("Icon");
  3215. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3216. const _component_Point = vue.resolveComponent("Point");
  3217. return vue.openBlock(), vue.createElementBlock("div", {
  3218. class: vue.normalizeClass(["Author", { expand: !$props.modelValue }])
  3219. }, [
  3220. vue.createElementVNode("div", _hoisted_1$c, [
  3221. !$props.modelValue ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3222. key: 0,
  3223. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", true)),
  3224. color: "#177EC9",
  3225. class: "expand-icon",
  3226. icon: "gravity-ui:chevrons-expand-up-right"
  3227. })) : vue.createCommentVNode("", true),
  3228. $options.config.viewType !== "simple" ? (vue.openBlock(), vue.createElementBlock("a", {
  3229. key: 1,
  3230. class: "avatar",
  3231. href: `/member/${$props.comment.username}`
  3232. }, [
  3233. vue.createElementVNode("img", {
  3234. src: $props.comment.avatar,
  3235. alt: ""
  3236. }, null, 8, _hoisted_3$8)
  3237. ], 8, _hoisted_2$9)) : vue.createCommentVNode("", true),
  3238. vue.createElementVNode("span", _hoisted_4$8, [
  3239. vue.createElementVNode("strong", null, [
  3240. vue.createElementVNode("a", {
  3241. href: `/member/${$props.comment.username}`,
  3242. class: vue.normalizeClass(["username", { "dark": $options.isNight }])
  3243. }, vue.toDisplayString($props.comment.username), 11, _hoisted_5$6)
  3244. ]),
  3245. $props.comment.isOp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$6, "OP")) : vue.createCommentVNode("", true),
  3246. $props.comment.isDup ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$5, "DUP")) : vue.createCommentVNode("", true),
  3247. $props.comment.isMod ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$5, "MOD")) : vue.createCommentVNode("", true),
  3248. vue.createElementVNode("span", _hoisted_9$5, vue.toDisplayString($props.comment.date), 1),
  3249. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  3250. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  3251. return vue.openBlock(), vue.createElementBlock("span", _hoisted_10$4, [
  3252. _hoisted_11$4,
  3253. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  3254. vue.createElementVNode("i", {
  3255. class: "fa fa-trash-o remove",
  3256. onClick: ($event) => $options.removeTag(i)
  3257. }, null, 8, _hoisted_12$4)
  3258. ]);
  3259. }), 256)),
  3260. vue.createElementVNode("span", {
  3261. class: "add-tag ago",
  3262. onClick: _cache[1] || (_cache[1] = (...args) => $options.addTag && $options.addTag(...args)),
  3263. title: "添加标签"
  3264. }, "+")
  3265. ], 64)) : vue.createCommentVNode("", true)
  3266. ])
  3267. ]),
  3268. vue.createElementVNode("div", _hoisted_13$4, [
  3269. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$4, [
  3270. vue.createVNode(_component_PopConfirm, {
  3271. title: "确认隐藏这条回复?",
  3272. onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
  3273. }, {
  3274. default: vue.withCtx(() => [
  3275. vue.createElementVNode("div", _hoisted_15$3, [
  3276. vue.createVNode(_component_Icon, { icon: "fluent:eye-hide-24-regular" }),
  3277. _hoisted_16$3
  3278. ])
  3279. ]),
  3280. _: 1
  3281. }),
  3282. $options.context ? (vue.openBlock(), vue.createElementBlock("div", {
  3283. key: 0,
  3284. class: "tool",
  3285. onClick: _cache[3] || (_cache[3] = (...args) => $options.showRelationReply && $options.showRelationReply(...args))
  3286. }, [
  3287. vue.createVNode(_component_Icon, { icon: "iconoir:page-search" }),
  3288. _hoisted_17$3
  3289. ])) : vue.createCommentVNode("", true),
  3290. $props.type === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  3291. key: 1,
  3292. class: "tool",
  3293. onClick: _cache[4] || (_cache[4] = (...args) => $options.jump && $options.jump(...args))
  3294. }, [
  3295. vue.createVNode(_component_Icon, { icon: "icon-park-outline:to-bottom" }),
  3296. _hoisted_18$3
  3297. ])) : vue.createCommentVNode("", true),
  3298. vue.createElementVNode("div", {
  3299. class: "tool",
  3300. onClick: _cache[5] || (_cache[5] = ($event) => $options.checkIsLogin("reply"))
  3301. }, [
  3302. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  3303. _hoisted_19$2
  3304. ]),
  3305. vue.withDirectives(vue.createVNode(_component_Point, {
  3306. item: $options.pointInfo,
  3307. onAddThank: $options.addThank,
  3308. onRecallThank: $options.recallThank,
  3309. "api-url": "reply/" + $props.comment.id
  3310. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3311. [vue.vShow, !$props.comment.thankCount]
  3312. ])
  3313. ])) : vue.createCommentVNode("", true),
  3314. vue.withDirectives(vue.createVNode(_component_Point, {
  3315. item: $options.pointInfo,
  3316. onAddThank: $options.addThank,
  3317. onRecallThank: $options.recallThank,
  3318. "api-url": "reply/" + $props.comment.id
  3319. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3320. [vue.vShow, $props.comment.thankCount]
  3321. ]),
  3322. vue.createElementVNode("div", {
  3323. class: vue.normalizeClass(["floor", { isDev: $options.isDev }])
  3324. }, vue.toDisplayString($props.comment.floor), 3)
  3325. ])
  3326. ], 2);
  3327. }
  3328. const Author = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$5], ["__scopeId", "data-v-53261a54"]]);
  3329. const _withScopeId$7 = (n2) => (vue.pushScopeId("data-v-1638aeb6"), n2 = n2(), vue.popScopeId(), n2);
  3330. const _hoisted_1$b = { class: "get-cursor" };
  3331. const _hoisted_2$8 = ["innerHTML"];
  3332. const _hoisted_3$7 = { class: "toolbar" };
  3333. const _hoisted_4$7 = { class: "left" };
  3334. const _hoisted_5$5 = { class: "upload" };
  3335. const _hoisted_6$5 = {
  3336. key: 0,
  3337. style: { "color": "black", "font-size": "1.4rem" }
  3338. };
  3339. const _hoisted_7$4 = { class: "right" };
  3340. const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, "经典表情", -1));
  3341. const _hoisted_9$4 = { class: "list" };
  3342. const _hoisted_10$3 = ["src", "onClick"];
  3343. const _hoisted_11$3 = { class: "emoji" };
  3344. const _hoisted_12$3 = { class: "title" };
  3345. const _hoisted_13$3 = { class: "list" };
  3346. const _hoisted_14$3 = ["onClick"];
  3347. const _sfc_main$b = {
  3348. __name: "PostEditor",
  3349. props: {
  3350. replyUser: null,
  3351. replyFloor: null,
  3352. useType: {
  3353. type: String,
  3354. default() {
  3355. return "reply-comment";
  3356. }
  3357. }
  3358. },
  3359. emits: ["close"],
  3360. setup(__props, { expose: __expose, emit: __emit }) {
  3361. const props = __props;
  3362. const { replyUser, replyFloor, useType } = props;
  3363. const replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  3364. const emits = __emit;
  3365. const post = vue.inject("post");
  3366. const show = vue.inject("show");
  3367. const isNight = vue.inject("isNight");
  3368. vue.inject("pageType");
  3369. const allReplyUsers = vue.inject("allReplyUsers");
  3370. let isFocus = vue.ref(false);
  3371. const loading = vue.ref(false);
  3372. const uploadLoading = vue.ref(false);
  3373. const isShowEmoticons = vue.ref(false);
  3374. const editorId = vue.ref("editorId_" + Date.now());
  3375. const content = vue.ref(replyInfo);
  3376. const txtRef = vue.ref(null);
  3377. const cursorRef = vue.ref(null);
  3378. const emoticonsRef = vue.ref(null);
  3379. const none = vue.ref('<span style="white-space:pre-wrap;"> </span>');
  3380. const emojiEmoticons = [
  3381. {
  3382. title: "小黄脸",
  3383. list: [
  3384. "😀",
  3385. "😁",
  3386. "😂",
  3387. "🤣",
  3388. "😅",
  3389. "😊",
  3390. "😋",
  3391. "😘",
  3392. "🥰",
  3393. "😗",
  3394. "🤩",
  3395. "🤔",
  3396. "🤨",
  3397. "😐",
  3398. "😑",
  3399. "🙄",
  3400. "😏",
  3401. "😪",
  3402. "😫",
  3403. "🥱",
  3404. "😜",
  3405. "😒",
  3406. "😔",
  3407. "😨",
  3408. "😰",
  3409. "😱",
  3410. "🥵",
  3411. "😡",
  3412. "🥳",
  3413. "🥺",
  3414. "🤭",
  3415. "🧐",
  3416. "😎",
  3417. "🤓",
  3418. "😭",
  3419. "🤑",
  3420. "🤮"
  3421. ]
  3422. },
  3423. {
  3424. title: "手势",
  3425. list: [
  3426. "🙋",
  3427. "🙎",
  3428. "🙅",
  3429. "🙇",
  3430. "🤷",
  3431. "🤏",
  3432. "👉",
  3433. "✌️",
  3434. "🤘",
  3435. "🤙",
  3436. "👌",
  3437. "🤌",
  3438. "👍",
  3439. "👎",
  3440. "👋",
  3441. "🤝",
  3442. "🙏",
  3443. "👏"
  3444. ]
  3445. },
  3446. {
  3447. title: "庆祝",
  3448. list: ["✨", "🎉", "🎊"]
  3449. },
  3450. {
  3451. title: "其他",
  3452. list: ["👻", "🤡", "🐔", "👀", "💩", "🐴", "🦄", "🐧", "🐶", "🐒", "🙈", "🙉", "🙊", "🐵"]
  3453. }
  3454. ];
  3455. const classicsEmoticons = [
  3456. {
  3457. name: "[狗头]",
  3458. low: "https://i.imgur.com/io2SM1h.png",
  3459. high: "https://i.imgur.com/0icl60r.png"
  3460. },
  3461. {
  3462. name: "[马]",
  3463. low: "https://i.imgur.com/8EKZv7I.png",
  3464. high: "https://i.imgur.com/ANFUX52.png"
  3465. },
  3466. {
  3467. name: "[不高兴]",
  3468. low: "https://i.imgur.com/huX6coX.png",
  3469. high: "https://i.imgur.com/N7JEuvc.png"
  3470. },
  3471. {
  3472. name: "[呵呵]",
  3473. low: "https://i.imgur.com/RvoLAbX.png",
  3474. high: "https://i.imgur.com/xSzIqrK.png"
  3475. },
  3476. {
  3477. name: "[真棒]",
  3478. low: "https://i.imgur.com/xr1UOz1.png",
  3479. high: "https://i.imgur.com/w8YEw9Q.png"
  3480. },
  3481. {
  3482. name: "[鄙视]",
  3483. low: "https://i.imgur.com/u6jlqVq.png",
  3484. high: "https://i.imgur.com/8JFNANq.png"
  3485. },
  3486. {
  3487. name: "[疑问]",
  3488. low: "https://i.imgur.com/F29pmQ6.png",
  3489. high: "https://i.imgur.com/EbbTQAR.png"
  3490. },
  3491. {
  3492. name: "[吐舌]",
  3493. low: "https://i.imgur.com/InmIzl9.png",
  3494. high: "https://i.imgur.com/Ovj56Cd.png"
  3495. },
  3496. // {
  3497. // name: '[嘲笑]',
  3498. // low: 'https://i.imgur.com/BaWcsMR.png',
  3499. // high: 'https://i.imgur.com/0OGfJw4.png'
  3500. // },
  3501. // {
  3502. // name: '[滑稽]',
  3503. // low: 'https://i.imgur.com/lmbN0yI.png',
  3504. // high: 'https://i.imgur.com/Pc0wH85.png'
  3505. // },
  3506. {
  3507. name: "[笑眼]",
  3508. low: "https://i.imgur.com/ZveiiGy.png",
  3509. high: "https://i.imgur.com/PI1CfEr.png"
  3510. },
  3511. {
  3512. name: "[狂汗]",
  3513. low: "https://i.imgur.com/veWihk6.png",
  3514. high: "https://i.imgur.com/3LtHdQv.png"
  3515. },
  3516. {
  3517. name: "[大哭]",
  3518. low: "https://i.imgur.com/hu4oR6C.png",
  3519. high: "https://i.imgur.com/b4X9XLE.png"
  3520. },
  3521. {
  3522. name: "[喷]",
  3523. low: "https://i.imgur.com/bkw3VRr.png",
  3524. high: "https://i.imgur.com/wnZL13L.png"
  3525. },
  3526. {
  3527. name: "[苦笑]",
  3528. low: "https://i.imgur.com/VUWFktU.png",
  3529. high: "https://i.imgur.com/NAfspZ1.png"
  3530. },
  3531. {
  3532. name: "[喝酒]",
  3533. low: "https://i.imgur.com/2ZZSapE.png",
  3534. high: "https://i.imgur.com/rVbSVak.png"
  3535. },
  3536. {
  3537. name: "[吃瓜]",
  3538. low: "https://i.imgur.com/ee8Lq7H.png",
  3539. high: "https://i.imgur.com/0L26og9.png"
  3540. },
  3541. {
  3542. name: "[捂脸]",
  3543. low: "https://i.imgur.com/krir4IG.png",
  3544. high: "https://i.imgur.com/qqBqgVm.png"
  3545. },
  3546. {
  3547. name: "[呕]",
  3548. low: "https://i.imgur.com/6CUiUxv.png",
  3549. high: "https://i.imgur.com/kgdxRsG.png"
  3550. },
  3551. {
  3552. name: "[阴险]",
  3553. low: "https://i.imgur.com/MA8YqTP.png",
  3554. high: "https://i.imgur.com/e94jbaT.png"
  3555. },
  3556. {
  3557. name: "[怒]",
  3558. low: "https://i.imgur.com/n4kWfGB.png",
  3559. high: "https://i.imgur.com/iMXxNxh.png"
  3560. },
  3561. {
  3562. name: "[衰]",
  3563. low: "https://i.imgur.com/voHFDyQ.png",
  3564. high: "https://i.imgur.com/XffE6gu.png"
  3565. },
  3566. {
  3567. name: "[合十]",
  3568. low: "https://i.imgur.com/I8x3ang.png",
  3569. high: "https://i.imgur.com/T4rJVee.png"
  3570. },
  3571. {
  3572. name: "[赞]",
  3573. low: "https://i.imgur.com/lG44yUl.png",
  3574. high: "https://i.imgur.com/AoF5PLp.png"
  3575. },
  3576. {
  3577. name: "[踩]",
  3578. low: "https://i.imgur.com/cJp0uKZ.png",
  3579. high: "https://i.imgur.com/1XYGfXj.png"
  3580. },
  3581. {
  3582. name: "[爱心]",
  3583. low: "https://i.imgur.com/sLENaF5.png",
  3584. high: "https://i.imgur.com/dND56oX.png"
  3585. },
  3586. {
  3587. name: "[心碎]",
  3588. low: "https://i.imgur.com/AZxJzve.png",
  3589. high: "https://i.imgur.com/RiUsPci.png"
  3590. }
  3591. ];
  3592. const imgurClientIdPool = [
  3593. "3107b9ef8b316f3",
  3594. "442b04f26eefc8a",
  3595. "59cfebe717c09e4",
  3596. "60605aad4a62882",
  3597. "6c65ab1d3f5452a",
  3598. "83e123737849aa9",
  3599. "9311f6be1c10160",
  3600. "c4a4a563f698595",
  3601. "81be04b9e4a08ce"
  3602. ];
  3603. __expose({ content, isFocus: () => isFocus.value });
  3604. const editorClass = vue.computed(() => {
  3605. return [useType, isFocus.value ? "isFocus" : "", isNight.value ? "isNight" : ""];
  3606. });
  3607. const cursorHtml = vue.computed(() => {
  3608. var _a;
  3609. if (!txtRef.value || !content.value)
  3610. return "";
  3611. let index = ((_a = txtRef.value) == null ? void 0 : _a.selectionStart) || 0;
  3612. return content.value.substring(0, index).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>").replace(/\s/g, none.value);
  3613. });
  3614. const disabled = vue.computed(() => {
  3615. if (content.value) {
  3616. return content.value === replyInfo;
  3617. } else {
  3618. return true;
  3619. }
  3620. });
  3621. function drop(e2) {
  3622. e2.preventDefault();
  3623. upload(e2.dataTransfer.files[0]);
  3624. }
  3625. async function upload(file) {
  3626. if (!file)
  3627. return;
  3628. if (uploadLoading.value)
  3629. return;
  3630. uploadLoading.value = true;
  3631. const formData = new FormData();
  3632. formData.append("image", file);
  3633. const randomIndex = Math.floor(Math.random() * imgurClientIdPool.length);
  3634. const clidenId = imgurClientIdPool[randomIndex];
  3635. const res = await fetch("https://api.imgur.com/3/upload", {
  3636. method: "POST",
  3637. headers: { Authorization: `Client-ID ${clidenId}` },
  3638. body: formData
  3639. });
  3640. uploadLoading.value = false;
  3641. if (res.ok) {
  3642. const resData = await res.json();
  3643. if (resData.success) {
  3644. return insert(" " + resData.data.link + " ");
  3645. }
  3646. }
  3647. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "上传失败" });
  3648. }
  3649. async function submit() {
  3650. if (disabled.value || loading.value)
  3651. return;
  3652. loading.value = true;
  3653. let submit_content = content.value.replace(/\[((?!\[).)+\]/g, function(match) {
  3654. let item2 = classicsEmoticons.find((v) => v.name === match);
  3655. if (item2) {
  3656. return item2.low + " ";
  3657. }
  3658. return match;
  3659. });
  3660. let show_content = content.value.replace(/https?:\/\/(i\.)?imgur\.com\/((?!http).)+\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG)/g, function(match) {
  3661. return `<img src="${match}" data-originUrl="${match}" data-notice="这个img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`;
  3662. });
  3663. show_content = show_content.replace(/\[((?!\[).)+\]/g, function(match) {
  3664. let item2 = classicsEmoticons.find((v) => v.name === match);
  3665. if (item2) {
  3666. return `<a target="_blank" href="${item2.low}" rel="nofollow noopener"><img src="${item2.low}" class="embedded_image" rel="noreferrer"></a> `;
  3667. }
  3668. return match;
  3669. });
  3670. let matchUsers = show_content.match(/@([\w]+?[\s])/g);
  3671. if (matchUsers) {
  3672. matchUsers.map((i) => {
  3673. let username = i.replace("@", "").replace(" ", "");
  3674. show_content = show_content.replace(username, `<a href="/member/${username}">${username}</a>`);
  3675. });
  3676. }
  3677. show_content = show_content.replaceAll("\n", "<br/>");
  3678. let item = {
  3679. thankCount: 0,
  3680. isThanked: false,
  3681. isOp: post.value.username === window.user.username,
  3682. isDup: false,
  3683. id: Date.now(),
  3684. username: window.user.username,
  3685. avatar: window.user.avatar,
  3686. date: "几秒前",
  3687. floor: post.value.replyCount + 1,
  3688. reply_content: show_content ?? "",
  3689. children: [],
  3690. replyUsers: replyUser ? [replyUser] : [],
  3691. replyFloor: replyFloor || -1,
  3692. level: useType === "reply-comment" ? 1 : 0
  3693. };
  3694. item.hideCallUserReplyContent = item.reply_content;
  3695. if (item.replyUsers.length === 1) {
  3696. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  3697. }
  3698. console.log("回复", item);
  3699. let url = `${window.baseUrl}/t/${post.value.id}`;
  3700. $.post(url, { content: submit_content, once: post.value.once }).then(
  3701. // $.post(url, {content: submit_content, once: 123}).then(
  3702. (res) => {
  3703. loading.value = false;
  3704. let r2 = res.search("你上一条回复的内容和这条相同");
  3705. if (r2 > -1)
  3706. return eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你上一条回复的内容和这条相同" });
  3707. r2 = res.search("请不要在每一个回复中都包括外链,这看起来像是在 spamming");
  3708. if (r2 > -1)
  3709. return eventBus.emit(CMD.SHOW_MSG, {
  3710. type: "error",
  3711. text: "请不要在每一个回复中都包括外链,这看起来像是在 spamming"
  3712. });
  3713. let r22 = res.search("创建新回复");
  3714. if (r22 > -1) {
  3715. eventBus.emit(CMD.REFRESH_ONCE, res);
  3716. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复出现了问题,请使用原版进行回复" });
  3717. let clientWidth = window.document.body.clientWidth;
  3718. let windowWidth = 1200;
  3719. let left = clientWidth / 2 - windowWidth / 2;
  3720. let newWin = window.open("创建新回复", "", `width=${windowWidth},height=600,left=${left},top=100`);
  3721. newWin.document.write(res);
  3722. let loop = setInterval(function() {
  3723. if (newWin.closed) {
  3724. clearInterval(loop);
  3725. eventBus.emit(CMD.REFRESH_POST);
  3726. }
  3727. }, 1e3);
  3728. return;
  3729. }
  3730. content.value = replyInfo;
  3731. emits("close");
  3732. eventBus.emit(CMD.REFRESH_ONCE, res);
  3733. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "回复成功" });
  3734. eventBus.emit(CMD.ADD_REPLY, item);
  3735. },
  3736. (err) => {
  3737. console.log("err", err);
  3738. loading.value = false;
  3739. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  3740. }
  3741. ).catch((r2) => {
  3742. console.log("catch", r2);
  3743. });
  3744. }
  3745. function showEmoticons(e2) {
  3746. if (isShowEmoticons.value) {
  3747. return isShowEmoticons.value = false;
  3748. }
  3749. let rect = e2.currentTarget.getBoundingClientRect();
  3750. emoticonsRef.value.style.left = rect.left + 30 + "px";
  3751. emoticonsRef.value.style.bottom = window.innerHeight - rect.top - 20 + "px";
  3752. isShowEmoticons.value = true;
  3753. }
  3754. function off() {
  3755. eventBus.emit(CMD.SHOW_CALL, { show: false });
  3756. eventBus.off(CMD.SET_CALL);
  3757. }
  3758. function checkHeight2() {
  3759. txtRef.value.style.height = 0;
  3760. txtRef.value.style.height = txtRef.value.scrollHeight + "px";
  3761. }
  3762. function insert(str) {
  3763. let cursorPos = txtRef.value.selectionStart;
  3764. let start = content.value.slice(0, cursorPos);
  3765. let end = content.value.slice(cursorPos, content.value.length);
  3766. content.value = start + str + end;
  3767. let moveCursorPos = start.length + str.length;
  3768. setTimeout(() => {
  3769. txtRef.value.focus();
  3770. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3771. checkHeight2();
  3772. });
  3773. }
  3774. function showCallPopover(text) {
  3775. let r2 = cursorRef.value.getBoundingClientRect();
  3776. eventBus.emit(CMD.SHOW_CALL, { show: true, top: r2.top, left: r2.left, text });
  3777. eventBus.off(CMD.SET_CALL);
  3778. eventBus.on(CMD.SET_CALL, (e2) => {
  3779. let cursorPos = txtRef.value.selectionStart;
  3780. let start = content.value.slice(0, cursorPos);
  3781. let end = content.value.slice(cursorPos, content.value.length);
  3782. let lastCallPos = start.lastIndexOf("@");
  3783. start = content.value.slice(0, lastCallPos + 1);
  3784. if (e2 === "管理员") {
  3785. e2 = "Livid @Kai @Olivia @GordianZ @sparanoid";
  3786. }
  3787. if (e2 === "所有人") {
  3788. e2 = allReplyUsers.value.map((v, i) => {
  3789. if (i)
  3790. return "@" + v;
  3791. else
  3792. return v;
  3793. }).join(" ");
  3794. }
  3795. content.value = start + e2 + " " + end;
  3796. let moveCursorPos = start.length + e2.length + 1;
  3797. setTimeout(() => {
  3798. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3799. checkHeight2();
  3800. });
  3801. eventBus.off(CMD.SET_CALL);
  3802. });
  3803. }
  3804. function onKeydown(e2) {
  3805. let code = e2.keyCode;
  3806. switch (code) {
  3807. case 8:
  3808. if (content.value === "@") {
  3809. off();
  3810. }
  3811. break;
  3812. case 37:
  3813. case 38:
  3814. case 39:
  3815. case 40:
  3816. setTimeout(() => onInput({ data: "" }), 100);
  3817. break;
  3818. case 27:
  3819. e2.preventDefault();
  3820. e2.stopPropagation();
  3821. e2.stopImmediatePropagation();
  3822. return false;
  3823. case 13:
  3824. if (e2.ctrlKey)
  3825. submit();
  3826. if (e2.metaKey)
  3827. submit();
  3828. break;
  3829. }
  3830. }
  3831. function onInput(e2) {
  3832. let cursorPos = txtRef.value.selectionStart;
  3833. if (!content.value)
  3834. return;
  3835. if (e2.data === " ") {
  3836. return off();
  3837. }
  3838. if (e2.data === "@") {
  3839. if (content.value.length !== 1) {
  3840. if (content.value[cursorPos - 2] === " " || content.value[cursorPos - 2] === "\n") {
  3841. return showCallPopover("");
  3842. }
  3843. } else {
  3844. return showCallPopover("");
  3845. }
  3846. off();
  3847. } else {
  3848. let judgeStr = content.value.slice(0, cursorPos);
  3849. let lastCallPos = judgeStr.lastIndexOf("@");
  3850. if (lastCallPos === -1) {
  3851. return off();
  3852. }
  3853. let callStr = judgeStr.slice(lastCallPos, cursorPos);
  3854. let hasSpace = callStr.includes(" ");
  3855. if (hasSpace) {
  3856. off();
  3857. } else {
  3858. if (lastCallPos === 0) {
  3859. return showCallPopover(callStr.replace("@", ""));
  3860. }
  3861. if (content.value.length !== 1) {
  3862. if (content.value[lastCallPos - 1] === " " || content.value[lastCallPos - 1] === "\n") {
  3863. return showCallPopover(callStr.replace("@", ""));
  3864. }
  3865. } else {
  3866. return showCallPopover(callStr.replace("@", ""));
  3867. }
  3868. off();
  3869. }
  3870. }
  3871. }
  3872. function onPaste(e2) {
  3873. const dataTransferItemList = e2.clipboardData.items;
  3874. const items = [].slice.call(dataTransferItemList).filter(function(item) {
  3875. return item.type.indexOf("image") !== -1;
  3876. });
  3877. if (items.length === 0) {
  3878. return;
  3879. }
  3880. const dataTransferItem = items[0];
  3881. const blob = dataTransferItem.getAsFile();
  3882. upload(blob);
  3883. }
  3884. function onBlur() {
  3885. document.removeEventListener("paste", onPaste);
  3886. isFocus.value = false;
  3887. }
  3888. function onFocusin() {
  3889. document.addEventListener("paste", onPaste);
  3890. }
  3891. vue.watch(() => show, (n2) => {
  3892. if (n2.value)
  3893. isShowEmoticons.value = false;
  3894. }, { deep: true });
  3895. vue.onMounted(() => {
  3896. $(`.${editorId.value}`).each(function() {
  3897. this.setAttribute("style", "height:" + this.scrollHeight + "px;overflow-y:hidden;");
  3898. }).on("input", function() {
  3899. this.style.height = 0;
  3900. this.style.height = this.scrollHeight + "px";
  3901. });
  3902. if (useType === "reply-comment") {
  3903. txtRef.value && txtRef.value.focus();
  3904. }
  3905. });
  3906. vue.onBeforeUnmount(() => {
  3907. $(`.${editorId.value}`).off();
  3908. });
  3909. return (_ctx, _cache) => {
  3910. return vue.openBlock(), vue.createElementBlock("div", {
  3911. class: vue.normalizeClass(["post-editor-wrapper", editorClass.value])
  3912. }, [
  3913. vue.withDirectives(vue.createElementVNode("textarea", {
  3914. class: vue.normalizeClass(["post-editor", editorId.value]),
  3915. ref_key: "txtRef",
  3916. ref: txtRef,
  3917. onFocus: _cache[0] || (_cache[0] = ($event) => vue.isRef(isFocus) ? isFocus.value = true : isFocus = true),
  3918. onBlur,
  3919. onFocusin,
  3920. placeholder: "请尽量让自己的回复能够对别人有帮助",
  3921. onInput,
  3922. onKeydown,
  3923. onDrop: drop,
  3924. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event)
  3925. }, null, 34), [
  3926. [vue.vModelText, content.value]
  3927. ]),
  3928. vue.createElementVNode("div", _hoisted_1$b, [
  3929. vue.createElementVNode("span", { innerHTML: cursorHtml.value }, null, 8, _hoisted_2$8),
  3930. vue.createElementVNode("span", {
  3931. class: "cursor",
  3932. ref_key: "cursorRef",
  3933. ref: cursorRef
  3934. }, "|", 512)
  3935. ]),
  3936. vue.createElementVNode("div", _hoisted_3$7, [
  3937. vue.createElementVNode("div", _hoisted_4$7, [
  3938. vue.createVNode(vue.unref(Icon), {
  3939. onClick: showEmoticons,
  3940. icon: "fxemoji:smiletongue"
  3941. }),
  3942. vue.createElementVNode("div", _hoisted_5$5, [
  3943. vue.createElementVNode("input", {
  3944. type: "file",
  3945. accept: "image/*",
  3946. onChange: _cache[2] || (_cache[2] = (e2) => upload(e2.currentTarget.files[0]))
  3947. }, null, 32),
  3948. vue.createVNode(vue.unref(Icon), { icon: "lets-icons:img-load-box-fill" })
  3949. ]),
  3950. uploadLoading.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$5, "上传中.....")) : vue.createCommentVNode("", true)
  3951. ]),
  3952. vue.createElementVNode("div", _hoisted_7$4, [
  3953. vue.unref(useType) === "reply-comment" ? (vue.openBlock(), vue.createBlock(BaseButton, {
  3954. key: 0,
  3955. type: "link",
  3956. size: "small",
  3957. style: { "margin-right": "1rem", "cursor": "pointer" },
  3958. onClick: _cache[3] || (_cache[3] = ($event) => emits("close"))
  3959. }, {
  3960. default: vue.withCtx(() => [
  3961. vue.createTextVNode(" 关闭 ")
  3962. ]),
  3963. _: 1
  3964. })) : vue.createCommentVNode("", true),
  3965. vue.createVNode(BaseButton, {
  3966. size: "small",
  3967. disabled: disabled.value,
  3968. loading: loading.value,
  3969. onClick: submit
  3970. }, {
  3971. default: vue.withCtx(() => [
  3972. vue.createTextVNode("回复 ")
  3973. ]),
  3974. _: 1
  3975. }, 8, ["disabled", "loading"])
  3976. ])
  3977. ]),
  3978. vue.withDirectives(vue.createElementVNode("div", {
  3979. class: "emoticon-pack",
  3980. ref_key: "emoticonsRef",
  3981. ref: emoticonsRef
  3982. }, [
  3983. vue.createVNode(vue.unref(Icon), {
  3984. icon: "ic:round-close",
  3985. onClick: _cache[4] || (_cache[4] = ($event) => isShowEmoticons.value = false)
  3986. }),
  3987. _hoisted_8$4,
  3988. vue.createElementVNode("div", _hoisted_9$4, [
  3989. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(classicsEmoticons, (item) => {
  3990. return vue.createElementVNode("img", {
  3991. src: item.high,
  3992. onClick: ($event) => {
  3993. insert(item.name);
  3994. isShowEmoticons.value = false;
  3995. }
  3996. }, null, 8, _hoisted_10$3);
  3997. }), 64))
  3998. ]),
  3999. vue.createElementVNode("div", _hoisted_11$3, [
  4000. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(emojiEmoticons, (item) => {
  4001. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  4002. vue.createElementVNode("div", _hoisted_12$3, vue.toDisplayString(item.title), 1),
  4003. vue.createElementVNode("div", _hoisted_13$3, [
  4004. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.list, (emoji) => {
  4005. return vue.openBlock(), vue.createElementBlock("span", {
  4006. onClick: ($event) => {
  4007. insert(emoji);
  4008. isShowEmoticons.value = false;
  4009. }
  4010. }, vue.toDisplayString(emoji), 9, _hoisted_14$3);
  4011. }), 256))
  4012. ])
  4013. ], 64);
  4014. }), 64))
  4015. ])
  4016. ], 512), [
  4017. [vue.vShow, isShowEmoticons.value]
  4018. ])
  4019. ], 2);
  4020. };
  4021. }
  4022. };
  4023. const PostEditor = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-1638aeb6"]]);
  4024. const _hoisted_1$a = {
  4025. key: 0,
  4026. class: "html-wrapper"
  4027. };
  4028. const _hoisted_2$7 = ["innerHTML"];
  4029. const checkHeight = 900;
  4030. const _sfc_main$a = {
  4031. __name: "BaseHtmlRender",
  4032. props: ["html"],
  4033. setup(__props) {
  4034. const config2 = vue.inject("config");
  4035. const props = __props;
  4036. const contentRef = vue.ref(null);
  4037. const mask = vue.ref(false);
  4038. const handOpen = vue.ref(false);
  4039. function mouseup(e2) {
  4040. if (!config2.value.base64)
  4041. return;
  4042. let selectionText = window.win().getSelection().toString();
  4043. if (selectionText) {
  4044. let r2 = selectionText.match(/([A-Za-z0-9+/=]+)/g);
  4045. if (r2) {
  4046. if (r2[0].length < 4)
  4047. return;
  4048. eventBus.emit(CMD.SHOW_TOOLTIP, { text: r2[0], e: e2 });
  4049. }
  4050. }
  4051. }
  4052. vue.watch(config2.value, (newVale) => {
  4053. if (!newVale.contentAutoCollapse) {
  4054. mask.value = false;
  4055. }
  4056. });
  4057. vue.watch([() => contentRef.value, () => props.html], () => {
  4058. if (!contentRef.value || !props.html)
  4059. return;
  4060. if (!config2.value.contentAutoCollapse)
  4061. return;
  4062. contentRef.value.querySelectorAll("img").forEach((item) => {
  4063. item.removeEventListener("load", checkContentHeight);
  4064. item.addEventListener("load", checkContentHeight);
  4065. });
  4066. checkContentHeight();
  4067. }, { immediate: true, flush: "post" });
  4068. function checkContentHeight() {
  4069. if (handOpen.value)
  4070. return;
  4071. let rect = contentRef.value.getBoundingClientRect();
  4072. mask.value = rect.height >= checkHeight;
  4073. }
  4074. return (_ctx, _cache) => {
  4075. return props.html ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
  4076. vue.createElementVNode("div", {
  4077. class: vue.normalizeClass({ mask: mask.value })
  4078. }, [
  4079. vue.createElementVNode("div", {
  4080. ref_key: "contentRef",
  4081. ref: contentRef,
  4082. innerHTML: props.html,
  4083. onMouseup: mouseup
  4084. }, null, 40, _hoisted_2$7)
  4085. ], 2),
  4086. mask.value ? (vue.openBlock(), vue.createElementBlock("div", {
  4087. key: 0,
  4088. class: "expand",
  4089. onClick: _cache[0] || (_cache[0] = ($event) => {
  4090. mask.value = false;
  4091. handOpen.value = true;
  4092. })
  4093. }, "展开")) : vue.createCommentVNode("", true)
  4094. ])) : vue.createCommentVNode("", true);
  4095. };
  4096. }
  4097. };
  4098. const BaseHtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-2c9a538c"]]);
  4099. const _sfc_main$9 = {
  4100. name: "Comment",
  4101. components: { BaseHtmlRender, Author, PostEditor, Point },
  4102. inject: ["post", "postDetailWidth", "show", "isNight", "config"],
  4103. props: {
  4104. modelValue: {
  4105. reply_content: ""
  4106. },
  4107. type: {
  4108. type: String,
  4109. default() {
  4110. return "list";
  4111. }
  4112. }
  4113. },
  4114. data() {
  4115. return {
  4116. showOrigin: false,
  4117. edit: false,
  4118. ding: false,
  4119. expand: true,
  4120. expandWrong: false,
  4121. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  4122. cssStyle: null,
  4123. floor: this.modelValue.floor
  4124. };
  4125. },
  4126. watch: {
  4127. show(e2) {
  4128. if (e2) {
  4129. this.edit = false;
  4130. }
  4131. },
  4132. postDetailWidth(n2, o) {
  4133. this.checkIsTooLong(n2);
  4134. }
  4135. },
  4136. computed: {
  4137. CommentDisplayType() {
  4138. return CommentDisplayType;
  4139. },
  4140. myClass() {
  4141. return {
  4142. isOp: this.modelValue.isOp,
  4143. isSimple: this.config.viewType === "simple",
  4144. ding: this.ding,
  4145. isLevelOne: this.modelValue.level === 0,
  4146. ["c_" + this.floor]: this.type !== "top"
  4147. };
  4148. }
  4149. },
  4150. mounted() {
  4151. this.checkIsTooLong(this.postDetailWidth);
  4152. },
  4153. methods: {
  4154. checkIsTooLong(postDetailWidth) {
  4155. if (postDetailWidth !== 0) {
  4156. let rect = this.$refs.comment.getBoundingClientRect();
  4157. let ban = postDetailWidth / 2;
  4158. if (ban < rect.width && rect.width < ban + 25 && this.modelValue.children.length) {
  4159. this.expand = false;
  4160. let padding = 2;
  4161. this.cssStyle = {
  4162. padding: "1rem 0",
  4163. width: `calc(${postDetailWidth}px - ${padding}rem)`,
  4164. transform: `translateX(calc(${rect.width - postDetailWidth}px + ${padding}rem))`,
  4165. background: this.isNight ? "#18222d" : "white"
  4166. };
  4167. }
  4168. }
  4169. },
  4170. //高亮一下
  4171. showDing() {
  4172. this.ding = true;
  4173. setTimeout(() => {
  4174. this.ding = false;
  4175. }, 2e3);
  4176. },
  4177. hide() {
  4178. let url = `${window.baseUrl}/ignore/reply/${this.modelValue.id}?once=${this.post.once}`;
  4179. eventBus.emit(CMD.REMOVE, this.modelValue.floor);
  4180. $.post(url).then((res) => {
  4181. eventBus.emit(CMD.REFRESH_ONCE);
  4182. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "隐藏成功" });
  4183. }, (err) => {
  4184. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "隐藏成功,仅本次有效(接口调用失败!)" });
  4185. });
  4186. },
  4187. toggle() {
  4188. this.expand = !this.expand;
  4189. },
  4190. toggleContent() {
  4191. if (this.modelValue.level === 0 && this.modelValue.replyUsers.length === 0)
  4192. return;
  4193. this.showOrigin = !this.showOrigin;
  4194. }
  4195. }
  4196. };
  4197. const _withScopeId$6 = (n2) => (vue.pushScopeId("data-v-888958af"), n2 = n2(), vue.popScopeId(), n2);
  4198. const _hoisted_1$9 = ["data-floor"];
  4199. const _hoisted_2$6 = { class: "comment-content" };
  4200. const _hoisted_3$6 = { class: "right" };
  4201. const _hoisted_4$6 = { class: "w" };
  4202. const _hoisted_5$4 = {
  4203. key: 0,
  4204. class: "wrong-wrapper"
  4205. };
  4206. const _hoisted_6$4 = ["href"];
  4207. const _hoisted_7$3 = { class: "del-line" };
  4208. const _hoisted_8$3 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("i", {
  4209. class: "fa fa-question-circle-o wrong-icon",
  4210. "aria-hidden": "true"
  4211. }, null, -1));
  4212. const _hoisted_9$3 = {
  4213. key: 0,
  4214. class: "warning"
  4215. };
  4216. const _hoisted_10$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4217. const _hoisted_11$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4218. const _hoisted_12$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4219. const _hoisted_13$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4220. const _hoisted_14$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4221. const _hoisted_15$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("a", {
  4222. href: "https://github.com/zyronon/web-scripts/issues",
  4223. target: "_blank"
  4224. }, "这里", -1));
  4225. const _hoisted_16$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("p", null, "---原文---", -1));
  4226. const _hoisted_17$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("p", null, "-----------", -1));
  4227. const _hoisted_18$2 = { class: "simple-wrapper" };
  4228. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  4229. const _component_Author = vue.resolveComponent("Author");
  4230. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  4231. const _component_PostEditor = vue.resolveComponent("PostEditor");
  4232. const _component_Comment = vue.resolveComponent("Comment", true);
  4233. return vue.openBlock(), vue.createElementBlock("div", {
  4234. class: vue.normalizeClass(["comment", $options.myClass]),
  4235. ref: "comment",
  4236. "data-floor": $data.floor
  4237. }, [
  4238. vue.createVNode(_component_Author, {
  4239. modelValue: $data.expand,
  4240. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  4241. comment: $props.modelValue,
  4242. onReply: _cache[1] || (_cache[1] = ($event) => $data.edit = !$data.edit),
  4243. type: $props.type,
  4244. onHide: $options.hide
  4245. }, null, 8, ["modelValue", "comment", "type", "onHide"]),
  4246. $data.cssStyle && !$data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4247. key: 0,
  4248. class: "more ago",
  4249. onClick: _cache[2] || (_cache[2] = ($event) => $data.expand = !$data.expand)
  4250. }, " 由于嵌套回复层级太深,自动将后续回复隐藏 ")) : vue.createCommentVNode("", true),
  4251. $data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4252. key: 1,
  4253. class: "comment-content-w",
  4254. style: vue.normalizeStyle($data.cssStyle)
  4255. }, [
  4256. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4257. key: 0,
  4258. class: "more ago",
  4259. onClick: _cache[3] || (_cache[3] = ($event) => $data.expand = !$data.expand)
  4260. }, " 由于嵌套回复层级太深,自动将以下回复移至可见范围 ")) : vue.createCommentVNode("", true),
  4261. vue.createElementVNode("div", _hoisted_2$6, [
  4262. vue.createElementVNode("div", {
  4263. class: "left expand-line",
  4264. onClick: _cache[4] || (_cache[4] = (...args) => $options.toggle && $options.toggle(...args))
  4265. }),
  4266. vue.createElementVNode("div", _hoisted_3$6, [
  4267. vue.createElementVNode("div", _hoisted_4$6, [
  4268. $props.modelValue.isWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$4, [
  4269. vue.createElementVNode("span", {
  4270. onClick: _cache[5] || (_cache[5] = ($event) => $data.expandWrong = !$data.expandWrong),
  4271. title: "点击楼层号查看提示"
  4272. }, [
  4273. vue.createElementVNode("a", {
  4274. href: "/member/" + $props.modelValue.replyUsers[0]
  4275. }, "@" + vue.toDisplayString($props.modelValue.replyUsers[0]) + "  ", 9, _hoisted_6$4),
  4276. vue.createElementVNode("span", _hoisted_7$3, "#" + vue.toDisplayString($props.modelValue.replyFloor), 1),
  4277. _hoisted_8$3
  4278. ]),
  4279. $data.expandWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$3, [
  4280. vue.createTextVNode(" 这条回复似乎有点问题,指定的楼层号与@的人对应不上 "),
  4281. _hoisted_10$2,
  4282. vue.createTextVNode(" 原因可能有下面几种: "),
  4283. _hoisted_11$2,
  4284. vue.createTextVNode(" 一、屏蔽用户导致楼层塌陷:你屏蔽了A,自A以后的回复的楼层号都会减1 "),
  4285. _hoisted_12$2,
  4286. vue.createTextVNode(" 二、忽略回复导致楼层塌陷:原理同上 "),
  4287. _hoisted_13$2,
  4288. vue.createTextVNode(" 三、层主回复时指定错了楼层号(同一,层主屏蔽了别人,导致楼层塌陷) "),
  4289. _hoisted_14$2,
  4290. vue.createTextVNode(" 四、脚本解析错误,请在 "),
  4291. _hoisted_15$2,
  4292. vue.createTextVNode("反馈 ")
  4293. ])) : vue.createCommentVNode("", true)
  4294. ])) : vue.createCommentVNode("", true),
  4295. $options.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser && this.type !== "top" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4296. $data.showOrigin ? (vue.openBlock(), vue.createElementBlock("div", {
  4297. key: 0,
  4298. onDblclick: _cache[6] || (_cache[6] = (...args) => $options.toggleContent && $options.toggleContent(...args))
  4299. }, [
  4300. _hoisted_16$2,
  4301. vue.createVNode(_component_BaseHtmlRender, {
  4302. class: "reply_content",
  4303. html: $props.modelValue.reply_content
  4304. }, null, 8, ["html"]),
  4305. _hoisted_17$2
  4306. ], 32)) : vue.createCommentVNode("", true),
  4307. vue.createVNode(_component_BaseHtmlRender, {
  4308. class: "reply_content",
  4309. onDblclick: $options.toggleContent,
  4310. html: $props.modelValue.hideCallUserReplyContent
  4311. }, null, 8, ["onDblclick", "html"])
  4312. ], 64)) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4313. key: 2,
  4314. class: "reply_content",
  4315. html: $props.modelValue.reply_content
  4316. }, null, 8, ["html"])),
  4317. $data.edit ? (vue.openBlock(), vue.createBlock(_component_PostEditor, {
  4318. key: 3,
  4319. onClose: _cache[7] || (_cache[7] = ($event) => $data.edit = false),
  4320. replyInfo: $data.replyInfo,
  4321. replyUser: $props.modelValue.username,
  4322. replyFloor: $props.modelValue.floor
  4323. }, null, 8, ["replyInfo", "replyUser", "replyFloor"])) : vue.createCommentVNode("", true)
  4324. ]),
  4325. vue.createElementVNode("div", _hoisted_18$2, [
  4326. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index) => {
  4327. return vue.openBlock(), vue.createBlock(_component_Comment, {
  4328. modelValue: $props.modelValue.children[index],
  4329. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4330. key: index
  4331. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4332. }), 128))
  4333. ])
  4334. ])
  4335. ]),
  4336. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4337. key: 1,
  4338. class: "more ago",
  4339. onClick: _cache[8] || (_cache[8] = ($event) => $data.expand = !$data.expand)
  4340. }, " 由于嵌套回复层级太深,自动将以上回复移至可见范围 ")) : vue.createCommentVNode("", true)
  4341. ], 4)) : vue.createCommentVNode("", true)
  4342. ], 10, _hoisted_1$9);
  4343. }
  4344. const Comment = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4], ["__scopeId", "data-v-888958af"]]);
  4345. const _sfc_main$8 = {
  4346. name: "Toolbar",
  4347. components: { Icon, BaseLoading },
  4348. inject: [
  4349. "isLogin",
  4350. "post",
  4351. "pageType"
  4352. ],
  4353. data() {
  4354. return {
  4355. timer: null,
  4356. loading: false,
  4357. loading2: false,
  4358. loading3: false
  4359. };
  4360. },
  4361. methods: {
  4362. checkIsLogin(emitName = "") {
  4363. if (!this.isLogin) {
  4364. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录(不可用)!" });
  4365. return false;
  4366. }
  4367. this.$emit(emitName);
  4368. return true;
  4369. },
  4370. tweet() {
  4371. var _a;
  4372. let username = ((_a = window.user) == null ? void 0 : _a.username) ?? "";
  4373. let url = `https://twitter.com/intent/tweet?url=${location.origin}/t/${this.post.id}?r=${username}&related=v2ex&text=${this.post.title}`;
  4374. window.open(url, "_blank", "width=550,height=370");
  4375. },
  4376. async report() {
  4377. if (!this.checkIsLogin())
  4378. return;
  4379. if (this.loading3)
  4380. return;
  4381. let isReport = this.post.isReport;
  4382. if (isReport) {
  4383. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4384. return;
  4385. }
  4386. let url = `${location.origin}/report/topic/${this.post.id}?once=${this.post.once}`;
  4387. this.loading3 = true;
  4388. let apiRes = await fetch(url);
  4389. this.loading3 = false;
  4390. if (apiRes.redirected) {
  4391. let htmlText = await apiRes.text();
  4392. if (htmlText.search("你已对本主题进行了报告")) {
  4393. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4394. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4395. eventBus.emit(CMD.MERGE, { isReport: !isReport });
  4396. return;
  4397. }
  4398. }
  4399. eventBus.emit(CMD.REFRESH_ONCE);
  4400. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4401. },
  4402. async toggleIgnore() {
  4403. if (!this.checkIsLogin())
  4404. return;
  4405. let url = `${window.baseUrl}/${this.post.isIgnore ? "unignore" : "ignore"}/topic/${this.post.id}?once=${this.post.once}`;
  4406. if (this.pageType === PageType.Post) {
  4407. this.loading2 = true;
  4408. let apiRes = await window.win().fetch(url);
  4409. if (apiRes.redirected) {
  4410. if (!this.post.isIgnore) {
  4411. window.win().location = window.baseUrl;
  4412. }
  4413. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4414. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4415. } else {
  4416. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略失败" });
  4417. }
  4418. this.loading2 = false;
  4419. } else {
  4420. if (this.post.isIgnore) {
  4421. this.loading2 = true;
  4422. } else {
  4423. eventBus.emit(CMD.IGNORE);
  4424. }
  4425. let apiRes = await window.win().fetch(url);
  4426. if (apiRes.redirected) {
  4427. if (this.post.isIgnore) {
  4428. eventBus.emit(CMD.REFRESH_ONCE);
  4429. }
  4430. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4431. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4432. } else {
  4433. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略成功,仅本次有效(接口调用失败!)" });
  4434. }
  4435. this.loading2 = false;
  4436. }
  4437. },
  4438. async toggleFavorite() {
  4439. if (!this.checkIsLogin())
  4440. return;
  4441. if (this.loading)
  4442. return;
  4443. let isFavorite = this.post.isFavorite;
  4444. if (!isFavorite && config.collectBrowserNotice) {
  4445. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记按Command/Cmd/CTRL + D添加到书签哦" });
  4446. }
  4447. let url = `${location.origin}/${isFavorite ? "unfavorite" : "favorite"}/topic/${this.post.id}?once=${this.post.once}`;
  4448. this.loading = true;
  4449. let apiRes = await fetch(url);
  4450. this.loading = false;
  4451. if (apiRes.redirected) {
  4452. let htmlText = await apiRes.text();
  4453. if (htmlText.search(isFavorite ? "加入收藏" : "取消收藏")) {
  4454. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  4455. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? this.post.collectCount - 1 : this.post.collectCount + 1 });
  4456. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4457. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  4458. return;
  4459. }
  4460. }
  4461. eventBus.emit(CMD.REFRESH_ONCE);
  4462. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败" });
  4463. }
  4464. }
  4465. };
  4466. const _withScopeId$5 = (n2) => (vue.pushScopeId("data-v-10da4d66"), n2 = n2(), vue.popScopeId(), n2);
  4467. const _hoisted_1$8 = { class: "toolbar" };
  4468. const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  4469. const _hoisted_3$5 = {
  4470. key: 0,
  4471. class: "tool no-hover"
  4472. };
  4473. const _hoisted_4$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "Tweet", -1));
  4474. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  4475. const _component_Icon = vue.resolveComponent("Icon");
  4476. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  4477. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
  4478. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
  4479. vue.createElementVNode("div", {
  4480. class: "tool",
  4481. onClick: _cache[0] || (_cache[0] = ($event) => $options.checkIsLogin("reply"))
  4482. }, [
  4483. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  4484. _hoisted_2$5
  4485. ]),
  4486. vue.createElementVNode("div", {
  4487. class: vue.normalizeClass(["tool", { disabled: $data.loading }]),
  4488. onClick: _cache[1] || (_cache[1] = (...args) => $options.toggleFavorite && $options.toggleFavorite(...args))
  4489. }, [
  4490. $data.loading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4491. key: 0,
  4492. size: "small"
  4493. })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4494. $options.post.isFavorite ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  4495. key: 0,
  4496. color: "rgb(224,42,42)",
  4497. icon: "iconoir:star-solid"
  4498. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4499. key: 1,
  4500. icon: "iconoir:star"
  4501. }))
  4502. ], 64)),
  4503. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isFavorite ? "取消" : "") + "收藏", 1)
  4504. ], 2),
  4505. $options.post.collectCount !== 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
  4506. vue.createElementVNode("span", null, vue.toDisplayString($options.post.collectCount + "人收藏"), 1)
  4507. ])) : vue.createCommentVNode("", true),
  4508. vue.createElementVNode("div", {
  4509. class: "tool",
  4510. onClick: _cache[2] || (_cache[2] = (...args) => $options.tweet && $options.tweet(...args))
  4511. }, [
  4512. vue.createVNode(_component_Icon, { icon: "uil:share" }),
  4513. _hoisted_4$5
  4514. ]),
  4515. vue.createElementVNode("div", {
  4516. class: vue.normalizeClass(["tool", { "disabled": $data.loading2 }]),
  4517. onClick: _cache[3] || (_cache[3] = (...args) => $options.toggleIgnore && $options.toggleIgnore(...args))
  4518. }, [
  4519. $data.loading2 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4520. key: 0,
  4521. size: "small"
  4522. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4523. key: 1,
  4524. icon: "fluent:eye-hide-24-regular"
  4525. })),
  4526. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isIgnore ? "取消忽略" : "忽略"), 1)
  4527. ], 2),
  4528. vue.createElementVNode("div", {
  4529. class: vue.normalizeClass(["tool", { "disabled": $data.loading3 }]),
  4530. onClick: _cache[4] || (_cache[4] = (...args) => $options.report && $options.report(...args))
  4531. }, [
  4532. $data.loading3 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4533. key: 0,
  4534. size: "small"
  4535. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4536. key: 1,
  4537. class: "black",
  4538. icon: "solar:danger-triangle-outline"
  4539. })),
  4540. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isReport ? "你已对本主题进行了报告" : "报告"), 1)
  4541. ], 2)
  4542. ]);
  4543. }
  4544. const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$3], ["__scopeId", "data-v-10da4d66"]]);
  4545. const _withScopeId$4 = (n2) => (vue.pushScopeId("data-v-87050bc7"), n2 = n2(), vue.popScopeId(), n2);
  4546. const _hoisted_1$7 = ["href"];
  4547. const _hoisted_2$4 = ["src"];
  4548. const _hoisted_3$4 = { class: "texts" };
  4549. const _hoisted_4$4 = {
  4550. key: 0,
  4551. class: "point"
  4552. };
  4553. const _hoisted_5$3 = { class: "link-num" };
  4554. const _hoisted_6$3 = { class: "my-tag" };
  4555. const _hoisted_7$2 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  4556. const _hoisted_8$2 = {
  4557. key: 2,
  4558. class: "ago"
  4559. };
  4560. const _hoisted_9$2 = {
  4561. key: 3,
  4562. class: "mod"
  4563. };
  4564. const _hoisted_10$1 = {
  4565. key: 4,
  4566. class: "owner"
  4567. };
  4568. const _hoisted_11$1 = ["href"];
  4569. const _hoisted_12$1 = {
  4570. key: 5,
  4571. class: "owner"
  4572. };
  4573. const _hoisted_13$1 = {
  4574. key: 6,
  4575. class: "mod"
  4576. };
  4577. const _hoisted_14$1 = {
  4578. key: 7,
  4579. class: "ago"
  4580. };
  4581. const _hoisted_15$1 = { class: "my-tag" };
  4582. const _hoisted_16$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  4583. const _hoisted_17$1 = {
  4584. key: 9,
  4585. class: "point"
  4586. };
  4587. const _hoisted_18$1 = { class: "link-num" };
  4588. const _hoisted_19$1 = ["href"];
  4589. const _hoisted_20$1 = ["src"];
  4590. const _hoisted_21$1 = { class: "Author-right" };
  4591. const _hoisted_22$1 = { class: "floor" };
  4592. const _hoisted_23$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  4593. const _hoisted_24$1 = [
  4594. _hoisted_23$1
  4595. ];
  4596. const _sfc_main$7 = {
  4597. __name: "SingleComment",
  4598. props: {
  4599. comment: {
  4600. reply_content: ""
  4601. },
  4602. isRight: {
  4603. type: Boolean,
  4604. default() {
  4605. return false;
  4606. }
  4607. }
  4608. },
  4609. setup(__props) {
  4610. const config2 = vue.inject("config");
  4611. const isLogin = vue.inject("isLogin");
  4612. const tags = vue.inject("tags");
  4613. const props = __props;
  4614. const myTags = vue.computed(() => {
  4615. return tags[props.comment.username] ?? [];
  4616. });
  4617. function jump() {
  4618. eventBus.emit(CMD.JUMP, props.comment.floor);
  4619. }
  4620. return (_ctx, _cache) => {
  4621. return vue.openBlock(), vue.createElementBlock("div", {
  4622. class: vue.normalizeClass(["comment", { isSimple: vue.unref(config2).viewType === "simple" }]),
  4623. ref: "comment"
  4624. }, [
  4625. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  4626. key: 0,
  4627. class: "avatar",
  4628. href: `/member/${__props.comment.username}`
  4629. }, [
  4630. vue.createElementVNode("img", {
  4631. src: __props.comment.avatar,
  4632. alt: ""
  4633. }, null, 8, _hoisted_2$4)
  4634. ], 8, _hoisted_1$7)) : vue.createCommentVNode("", true),
  4635. vue.createElementVNode("div", {
  4636. class: vue.normalizeClass(["comment-body", { isRight: __props.isRight }])
  4637. }, [
  4638. vue.createElementVNode("div", _hoisted_3$4, [
  4639. __props.comment.thankCount && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
  4640. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4641. key: 0,
  4642. color: "rgb(224,42,42)",
  4643. icon: "icon-park-solid:like"
  4644. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4645. key: 1,
  4646. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  4647. icon: "icon-park-outline:like"
  4648. }, null, 8, ["color"])),
  4649. vue.createElementVNode("div", _hoisted_5$3, vue.toDisplayString(__props.comment.thankCount), 1)
  4650. ])) : vue.createCommentVNode("", true),
  4651. vue.unref(isLogin) && vue.unref(config2).openTag && __props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(myTags.value, (i) => {
  4652. return vue.openBlock(), vue.createElementBlock("span", _hoisted_6$3, [
  4653. _hoisted_7$2,
  4654. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  4655. ]);
  4656. }), 256)) : vue.createCommentVNode("", true),
  4657. __props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$2, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  4658. __props.comment.isMod && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$2, "MOD")) : vue.createCommentVNode("", true),
  4659. __props.comment.isOp && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$1, "OP")) : vue.createCommentVNode("", true),
  4660. vue.createElementVNode("a", {
  4661. href: `/member/${__props.comment.username}`,
  4662. class: "username"
  4663. }, vue.toDisplayString(__props.comment.username), 9, _hoisted_11$1),
  4664. __props.comment.isOp && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$1, "OP")) : vue.createCommentVNode("", true),
  4665. __props.comment.isMod && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$1, "MOD")) : vue.createCommentVNode("", true),
  4666. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14$1, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  4667. vue.unref(isLogin) && vue.unref(config2).openTag && !__props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 8 }, vue.renderList(myTags.value, (i) => {
  4668. return vue.openBlock(), vue.createElementBlock("span", _hoisted_15$1, [
  4669. _hoisted_16$1,
  4670. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  4671. ]);
  4672. }), 256)) : vue.createCommentVNode("", true),
  4673. __props.comment.thankCount && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, [
  4674. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4675. key: 0,
  4676. color: "rgb(224,42,42)",
  4677. icon: "icon-park-solid:like"
  4678. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4679. key: 1,
  4680. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  4681. icon: "icon-park-outline:like"
  4682. }, null, 8, ["color"])),
  4683. vue.createElementVNode("div", _hoisted_18$1, vue.toDisplayString(__props.comment.thankCount), 1)
  4684. ])) : vue.createCommentVNode("", true)
  4685. ]),
  4686. vue.createVNode(BaseHtmlRender, {
  4687. class: "reply_content",
  4688. html: __props.comment.reply_content
  4689. }, null, 8, ["html"])
  4690. ], 2),
  4691. __props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  4692. key: 1,
  4693. class: "avatar",
  4694. href: `/member/${__props.comment.username}`
  4695. }, [
  4696. vue.createElementVNode("img", {
  4697. src: __props.comment.avatar,
  4698. alt: ""
  4699. }, null, 8, _hoisted_20$1)
  4700. ], 8, _hoisted_19$1)) : vue.createCommentVNode("", true),
  4701. vue.createElementVNode("div", _hoisted_21$1, [
  4702. vue.createElementVNode("div", _hoisted_22$1, vue.toDisplayString(__props.comment.floor), 1),
  4703. vue.createElementVNode("div", {
  4704. class: "tool jump",
  4705. onClick: jump
  4706. }, _hoisted_24$1)
  4707. ])
  4708. ], 2);
  4709. };
  4710. }
  4711. };
  4712. const SingleComment = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-87050bc7"]]);
  4713. const _sfc_main$6 = {
  4714. name: "detail",
  4715. components: {
  4716. BaseSelect,
  4717. BaseButton,
  4718. SingleComment,
  4719. PopConfirm,
  4720. Comment,
  4721. PostEditor,
  4722. Point,
  4723. Toolbar,
  4724. BaseHtmlRender,
  4725. Tooltip,
  4726. BaseLoading,
  4727. Icon
  4728. },
  4729. inject: ["allReplyUsers", "post", "isMobile", "tags", "isLogin", "config", "pageType", "isNight"],
  4730. provide() {
  4731. return {
  4732. postDetailWidth: vue.computed(() => this.postDetailWidth)
  4733. };
  4734. },
  4735. props: {
  4736. modelValue: {
  4737. type: Boolean,
  4738. default() {
  4739. return false;
  4740. }
  4741. },
  4742. loading: {
  4743. type: Boolean,
  4744. default() {
  4745. return false;
  4746. }
  4747. },
  4748. refreshLoading: {
  4749. type: Boolean,
  4750. default() {
  4751. return false;
  4752. }
  4753. },
  4754. displayType: CommentDisplayType.FloorInFloorNoCallUser
  4755. },
  4756. data() {
  4757. return {
  4758. isSticky: false,
  4759. selectCallIndex: 0,
  4760. postDetailWidth: 0,
  4761. showCallList: false,
  4762. showRelationReply: false,
  4763. replyText: "",
  4764. callStyle: {
  4765. top: 0,
  4766. left: 0
  4767. },
  4768. targetUser: {
  4769. left: [],
  4770. right: "",
  4771. rightFloor: -1
  4772. },
  4773. currentFloor: "",
  4774. showOpTag: false
  4775. };
  4776. },
  4777. computed: {
  4778. isMy() {
  4779. return this.post.member.username === window.user.username;
  4780. },
  4781. myTags() {
  4782. return this.tags[this.post.member.username] ?? [];
  4783. },
  4784. CommentDisplayType() {
  4785. return CommentDisplayType;
  4786. },
  4787. isPost() {
  4788. return this.pageType === PageType.Post;
  4789. },
  4790. filterCallList() {
  4791. if (this.showCallList) {
  4792. let list = ["管理员", "所有人"].concat(this.allReplyUsers);
  4793. if (this.replyText)
  4794. return list.filter((i) => i.search(this.replyText) > -1);
  4795. return list;
  4796. }
  4797. return [];
  4798. },
  4799. topReply() {
  4800. return this.post.replyList.filter((v) => v.thankCount >= this.config.topReplyLoveMinCount).sort((a, b) => b.thankCount - a.thankCount).slice(0, this.config.topReplyCount);
  4801. },
  4802. replyList() {
  4803. if ([CommentDisplayType.FloorInFloor, CommentDisplayType.FloorInFloorNoCallUser].includes(this.displayType))
  4804. return this.post.nestedReplies;
  4805. if (this.displayType === CommentDisplayType.Like) {
  4806. return window.clone(this.post.nestedReplies).sort((a, b) => b.thankCount - a.thankCount);
  4807. }
  4808. if (this.displayType === CommentDisplayType.New) {
  4809. return window.clone(this.post.replyList).reverse();
  4810. }
  4811. if (this.displayType === CommentDisplayType.V2exOrigin)
  4812. return this.post.replyList;
  4813. if (this.displayType === CommentDisplayType.FloorInFloorNested)
  4814. return this.post.nestedRedundReplies;
  4815. if (this.displayType === CommentDisplayType.OnlyOp)
  4816. return this.post.replyList.filter((v) => {
  4817. var _a;
  4818. return v.username === ((_a = this.post.member) == null ? void 0 : _a.username);
  4819. });
  4820. return [];
  4821. },
  4822. //关联回复
  4823. relationReply() {
  4824. if (this.targetUser.left.length && this.targetUser.right) {
  4825. return this.post.replyList.filter((v) => {
  4826. if (this.targetUser.left.includes(v.username)) {
  4827. if (v.floor > this.targetUser.rightFloor) {
  4828. if (v.replyUsers.includes(this.targetUser.right)) {
  4829. return true;
  4830. }
  4831. } else {
  4832. return true;
  4833. }
  4834. }
  4835. if (v.username === this.targetUser.right) {
  4836. for (let i = 0; i < this.targetUser.left.length; i++) {
  4837. if (v.replyUsers.includes(this.targetUser.left[i])) {
  4838. return true;
  4839. }
  4840. }
  4841. }
  4842. });
  4843. }
  4844. return [];
  4845. }
  4846. },
  4847. watch: {
  4848. "post.id"(n2, o) {
  4849. if (this.$refs["post-editor"]) {
  4850. this.$refs["post-editor"].content = "";
  4851. vue.nextTick(() => {
  4852. var _a, _b;
  4853. (_b = (_a = this.$refs) == null ? void 0 : _a.detail) == null ? void 0 : _b.scrollTo({ top: 0 });
  4854. });
  4855. }
  4856. },
  4857. "post.headerTemplate"(n2, o) {
  4858. let mountEl = document.querySelector(".main-wrapper .post-wrapper .html-wrapper .header");
  4859. if (mountEl) {
  4860. this.showOpTag = true;
  4861. }
  4862. },
  4863. modelValue: {
  4864. handler(newVal) {
  4865. if (this.isPost) {
  4866. return;
  4867. }
  4868. if (newVal) {
  4869. document.body.style.overflow = "hidden";
  4870. if (!window.history.state) {
  4871. window.history.pushState({}, 0, this.post.href);
  4872. }
  4873. this.currentFloor = "";
  4874. vue.nextTick(() => {
  4875. var _a, _b;
  4876. window.document.title = this.post.title ?? "V2EX";
  4877. (_b = (_a = this.$refs) == null ? void 0 : _a.main) == null ? void 0 : _b.focus();
  4878. });
  4879. } else {
  4880. document.body.style.overflow = "unset";
  4881. window.document.title = "V2EX";
  4882. this.isSticky = false;
  4883. this.showRelationReply = false;
  4884. if (window.history.state) {
  4885. window.history.back();
  4886. }
  4887. }
  4888. }
  4889. }
  4890. },
  4891. mounted() {
  4892. setTimeout(() => {
  4893. var _a;
  4894. this.postDetailWidth = ((_a = this.$refs.mainWrapper) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
  4895. });
  4896. if (this.isLogin) {
  4897. const observer = new IntersectionObserver(
  4898. ([e2]) => e2.target.toggleAttribute("stuck", e2.intersectionRatio < 1),
  4899. { threshold: [1] }
  4900. );
  4901. observer.observe(this.$refs.replyBox);
  4902. window.addEventListener("keydown", this.onKeyDown);
  4903. }
  4904. eventBus.on(CMD.SHOW_CALL, (val) => {
  4905. if (val.show) {
  4906. this.showCallList = true;
  4907. this.replyText = val.text;
  4908. if (this.isPost) {
  4909. this.callStyle.top = val.top + $(window.win()).scrollTop() + -40 + "px";
  4910. } else {
  4911. this.callStyle.top = val.top + $(".post-detail").scrollTop() + 15 + "px";
  4912. }
  4913. this.callStyle.left = val.left - $(".main")[0].getBoundingClientRect().left + 10 + "px";
  4914. if (this.selectCallIndex >= this.filterCallList.length) {
  4915. this.selectCallIndex = 0;
  4916. }
  4917. } else {
  4918. this.replyText = "";
  4919. this.showCallList = false;
  4920. this.selectCallIndex = 0;
  4921. }
  4922. });
  4923. eventBus.on(CMD.RELATION_REPLY, (val) => {
  4924. this.targetUser = val;
  4925. this.showRelationReply = true;
  4926. });
  4927. eventBus.on(CMD.JUMP, this.jump);
  4928. if (this.isPost) {
  4929. window.addEventListener("scroll", this.debounceScroll);
  4930. }
  4931. },
  4932. beforeUnmount() {
  4933. window.removeEventListener("keydown", this.onKeyDown);
  4934. eventBus.off(CMD.SHOW_CALL);
  4935. },
  4936. methods: {
  4937. addTag() {
  4938. eventBus.emit(CMD.ADD_TAG, this.post.member.username);
  4939. },
  4940. removeTag(tag) {
  4941. eventBus.emit(CMD.REMOVE_TAG, { username: this.post.member.username, tag });
  4942. },
  4943. stop(e2) {
  4944. },
  4945. jump(floor) {
  4946. let lastItem = this.replyList[this.replyList.length - 1];
  4947. if (floor === "") {
  4948. floor = lastItem.floor;
  4949. } else {
  4950. try {
  4951. floor = Number(floor);
  4952. } catch (e2) {
  4953. floor = lastItem.floor;
  4954. }
  4955. if (floor === 0) {
  4956. floor = 1;
  4957. }
  4958. if (floor > lastItem.floor)
  4959. floor = lastItem.floor;
  4960. }
  4961. if (!this.post.replyList.length) {
  4962. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "没有回复可跳转!" });
  4963. return;
  4964. }
  4965. if (floor > this.post.replyList.length) {
  4966. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  4967. return;
  4968. }
  4969. let comment = $(`.c_${floor}`);
  4970. if (!comment.length) {
  4971. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  4972. return;
  4973. }
  4974. comment[0].scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
  4975. comment.addClass("ding");
  4976. this.currentFloor = floor + 1;
  4977. setTimeout(() => {
  4978. comment.removeClass("ding");
  4979. }, 2e3);
  4980. },
  4981. collapseTopReplyList() {
  4982. $(this.$refs.topReply).slideToggle("fast");
  4983. },
  4984. goBottom() {
  4985. this.isSticky = false;
  4986. setTimeout(() => {
  4987. if (this.isPost) {
  4988. let body = $("body , html");
  4989. let scrollHeight = body.prop("scrollHeight");
  4990. body.animate({ scrollTop: scrollHeight - 850 }, 300);
  4991. } else {
  4992. this.$refs.detail.scrollTo({ top: this.$refs.detail.scrollHeight, behavior: "smooth" });
  4993. }
  4994. });
  4995. },
  4996. close(from) {
  4997. if (this.isPost)
  4998. return;
  4999. if (from === "space") {
  5000. if (this.config.closePostDetailBySpace) {
  5001. this.$emit("update:modelValue", false);
  5002. }
  5003. } else {
  5004. this.$emit("update:modelValue", false);
  5005. }
  5006. },
  5007. setCall(e2) {
  5008. eventBus.emit(CMD.SET_CALL, e2);
  5009. this.showCallList = false;
  5010. },
  5011. onKeyDown(e2) {
  5012. if (!this.modelValue)
  5013. return;
  5014. if (!this.showCallList)
  5015. return;
  5016. let length = this.filterCallList.slice(0, 10).length;
  5017. if (e2.keyCode === 13) {
  5018. this.setCall(this.filterCallList[this.selectCallIndex]);
  5019. e2.preventDefault();
  5020. }
  5021. if (e2.keyCode === 38) {
  5022. this.selectCallIndex--;
  5023. if (this.selectCallIndex < 0) {
  5024. this.selectCallIndex = length - 1;
  5025. }
  5026. e2.preventDefault();
  5027. }
  5028. if (e2.keyCode === 40) {
  5029. this.selectCallIndex++;
  5030. if (this.selectCallIndex > length - 1) {
  5031. this.selectCallIndex = 0;
  5032. }
  5033. e2.preventDefault();
  5034. }
  5035. },
  5036. changeOption(item) {
  5037. this.$emit("update:displayType", item);
  5038. },
  5039. addThank() {
  5040. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "add" });
  5041. },
  5042. recallThank() {
  5043. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "recall" });
  5044. },
  5045. scrollTop() {
  5046. if (this.isPost) {
  5047. $("body , html").animate({ scrollTop: 0 }, 300);
  5048. } else {
  5049. this.$refs.detail.scrollTo({ top: 0, behavior: "smooth" });
  5050. }
  5051. }
  5052. }
  5053. };
  5054. const _withScopeId$3 = (n2) => (vue.pushScopeId("data-v-4b9c84df"), n2 = n2(), vue.popScopeId(), n2);
  5055. const _hoisted_1$6 = { class: "my-box post-wrapper" };
  5056. const _hoisted_2$3 = { class: "header" };
  5057. const _hoisted_3$3 = { class: "fr" };
  5058. const _hoisted_4$3 = ["href"];
  5059. const _hoisted_5$2 = ["src", "alt"];
  5060. const _hoisted_6$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("a", { href: "/" }, "V2EX", -1));
  5061. const _hoisted_7$1 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "chevron" }, "  ›  ", -1));
  5062. const _hoisted_8$1 = ["href"];
  5063. const _hoisted_9$1 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "sep10" }, null, -1));
  5064. const _hoisted_10 = ["id"];
  5065. const _hoisted_11 = ["onclick"];
  5066. const _hoisted_12 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-up" }, null, -1));
  5067. const _hoisted_13 = ["onclick"];
  5068. const _hoisted_14 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-down" }, null, -1));
  5069. const _hoisted_15 = [
  5070. _hoisted_14
  5071. ];
  5072. const _hoisted_16 = { class: "gray" };
  5073. const _hoisted_17 = ["href"];
  5074. const _hoisted_18 = ["title"];
  5075. const _hoisted_19 = ["href"];
  5076. const _hoisted_20 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-info-circle" }, null, -1));
  5077. const _hoisted_21 = [
  5078. _hoisted_20
  5079. ];
  5080. const _hoisted_22 = ["href"];
  5081. const _hoisted_23 = { class: "my-tag" };
  5082. const _hoisted_24 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5083. const _hoisted_25 = ["onClick"];
  5084. const _hoisted_26 = {
  5085. key: 0,
  5086. class: "my-box"
  5087. };
  5088. const _hoisted_27 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "高赞回复", -1));
  5089. const _hoisted_28 = { class: "top-reply" };
  5090. const _hoisted_29 = { class: "tool" };
  5091. const _hoisted_30 = { ref: "topReply" };
  5092. const _hoisted_31 = {
  5093. key: 1,
  5094. class: "my-box my-cell"
  5095. };
  5096. const _hoisted_32 = ["innerHTML"];
  5097. const _hoisted_33 = { class: "my-box comment-wrapper" };
  5098. const _hoisted_34 = {
  5099. key: 0,
  5100. class: "my-cell flex"
  5101. };
  5102. const _hoisted_35 = { key: 0 };
  5103. const _hoisted_36 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("strong", { class: "snow" }, "•", -1));
  5104. const _hoisted_37 = ["innerHTML"];
  5105. const _hoisted_38 = {
  5106. key: 0,
  5107. class: "loading-wrapper"
  5108. };
  5109. const _hoisted_39 = {
  5110. key: 1,
  5111. class: "comments"
  5112. };
  5113. const _hoisted_40 = {
  5114. key: 2,
  5115. id: "no-comments-yet"
  5116. };
  5117. const _hoisted_41 = { class: "my-cell flex" };
  5118. const _hoisted_42 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "添加一条新回复", -1));
  5119. const _hoisted_43 = { class: "notice-right gray" };
  5120. const _hoisted_44 = { class: "p1" };
  5121. const _hoisted_45 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "gray" }, "上下文", -1));
  5122. const _hoisted_46 = { class: "top-reply" };
  5123. const _hoisted_47 = ["onClick"];
  5124. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  5125. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  5126. const _component_Point = vue.resolveComponent("Point");
  5127. const _component_Toolbar = vue.resolveComponent("Toolbar");
  5128. const _component_Icon = vue.resolveComponent("Icon");
  5129. const _component_Tooltip = vue.resolveComponent("Tooltip");
  5130. const _component_Comment = vue.resolveComponent("Comment");
  5131. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  5132. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  5133. const _component_PostEditor = vue.resolveComponent("PostEditor");
  5134. const _component_SingleComment = vue.resolveComponent("SingleComment");
  5135. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  5136. class: vue.normalizeClass(["post-detail", [$options.isNight ? "isNight" : "", $options.pageType, $options.isMobile ? "mobile" : ""]]),
  5137. ref: "detail",
  5138. onKeydown: _cache[19] || (_cache[19] = vue.withKeys(($event) => $options.close(), ["esc"])),
  5139. onScroll: _cache[20] || (_cache[20] = (...args) => _ctx.debounceScroll && _ctx.debounceScroll(...args)),
  5140. onClick: _cache[21] || (_cache[21] = ($event) => $options.close("space"))
  5141. }, [
  5142. vue.createElementVNode("div", {
  5143. ref: "main",
  5144. class: "main",
  5145. tabindex: "1",
  5146. onClick: _cache[18] || (_cache[18] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  5147. }, [
  5148. vue.createElementVNode("div", {
  5149. class: "main-wrapper",
  5150. ref: "mainWrapper",
  5151. style: vue.normalizeStyle({ width: $options.config.postWidth })
  5152. }, [
  5153. vue.createElementVNode("div", _hoisted_1$6, [
  5154. vue.createElementVNode("div", _hoisted_2$3, [
  5155. vue.createElementVNode("div", _hoisted_3$3, [
  5156. vue.createElementVNode("a", {
  5157. href: `/member/${$options.post.member.username}`,
  5158. style: { "width": "73px", "height": "73px", "display": "inline-block" }
  5159. }, [
  5160. $options.post.member.avatar_large ? (vue.openBlock(), vue.createElementBlock("img", {
  5161. key: 0,
  5162. src: $options.post.member.avatar_large,
  5163. class: "avatar",
  5164. style: { "width": "73px", "height": "73px" },
  5165. border: "0",
  5166. align: "default",
  5167. alt: $options.post.member.username
  5168. }, null, 8, _hoisted_5$2)) : vue.createCommentVNode("", true)
  5169. ], 8, _hoisted_4$3)
  5170. ]),
  5171. _hoisted_6$2,
  5172. _hoisted_7$1,
  5173. vue.createElementVNode("a", {
  5174. href: $options.post.node.url
  5175. }, vue.toDisplayString($options.post.node.title), 9, _hoisted_8$1),
  5176. _hoisted_9$1,
  5177. vue.createElementVNode("h1", null, vue.toDisplayString($options.post.title), 1),
  5178. !$options.isMobile ? (vue.openBlock(), vue.createElementBlock("div", {
  5179. key: 0,
  5180. id: `topic_${$options.post.id}_votes`,
  5181. class: "votes"
  5182. }, [
  5183. vue.createElementVNode("a", {
  5184. href: "javascript:",
  5185. onclick: `upVoteTopic(${$options.post.id});`,
  5186. class: "vote"
  5187. }, [
  5188. _hoisted_12,
  5189. vue.createTextVNode("   ")
  5190. ], 8, _hoisted_11),
  5191. vue.createTextVNode("   "),
  5192. vue.createElementVNode("a", {
  5193. href: "javascript:",
  5194. onclick: `downVoteTopic(${$options.post.id});`,
  5195. class: "vote"
  5196. }, _hoisted_15, 8, _hoisted_13)
  5197. ], 8, _hoisted_10)) : vue.createCommentVNode("", true),
  5198. vue.createTextVNode("   "),
  5199. vue.createElementVNode("small", _hoisted_16, [
  5200. vue.createElementVNode("a", {
  5201. href: `/member/${$options.post.member.username}`
  5202. }, vue.toDisplayString($options.post.member.username), 9, _hoisted_17),
  5203. vue.createTextVNode(" · "),
  5204. $options.post.member.createDate ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5205. vue.createElementVNode("span", {
  5206. class: vue.normalizeClass($options.post.member.isNew && "danger")
  5207. }, vue.toDisplayString($options.post.member.createDate), 3),
  5208. vue.createTextVNode(" · ")
  5209. ], 64)) : vue.createCommentVNode("", true),
  5210. $options.post.createDateAgo ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5211. vue.createElementVNode("span", {
  5212. title: $options.post.createDate
  5213. }, vue.toDisplayString($options.post.createDateAgo), 9, _hoisted_18),
  5214. vue.createTextVNode(" · ")
  5215. ], 64)) : vue.createCommentVNode("", true),
  5216. vue.createTextVNode(" " + vue.toDisplayString($options.post.clickCount) + " 次点击 ", 1),
  5217. $options.isMy ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  5218. vue.createTextVNode("   "),
  5219. vue.createElementVNode("a", {
  5220. href: `/t/${$options.post.id}/info`
  5221. }, _hoisted_21, 8, _hoisted_19),
  5222. vue.createTextVNode("   "),
  5223. vue.createElementVNode("a", {
  5224. href: `/append/topic/${$options.post.id}`,
  5225. class: "op"
  5226. }, "APPEND", 8, _hoisted_22)
  5227. ], 64)) : vue.createCommentVNode("", true)
  5228. ]),
  5229. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5230. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  5231. return vue.openBlock(), vue.createElementBlock("span", _hoisted_23, [
  5232. _hoisted_24,
  5233. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  5234. vue.createElementVNode("i", {
  5235. class: "fa fa-trash-o remove",
  5236. onClick: ($event) => $options.removeTag(i)
  5237. }, null, 8, _hoisted_25)
  5238. ]);
  5239. }), 256)),
  5240. vue.createElementVNode("span", {
  5241. class: "add-tag ago",
  5242. onClick: _cache[0] || (_cache[0] = (...args) => $options.addTag && $options.addTag(...args)),
  5243. title: "添加标签"
  5244. }, "+")
  5245. ], 64)) : vue.createCommentVNode("", true)
  5246. ]),
  5247. $options.post.headerTemplate ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5248. key: 0,
  5249. html: $options.post.headerTemplate
  5250. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5251. key: 1,
  5252. html: $options.post.jsonContent
  5253. }, null, 8, ["html"])),
  5254. vue.createVNode(_component_Toolbar, {
  5255. onReply: _cache[1] || (_cache[1] = ($event) => $data.isSticky = !$data.isSticky)
  5256. }, {
  5257. default: vue.withCtx(() => [
  5258. vue.createVNode(_component_Point, {
  5259. onAddThank: $options.addThank,
  5260. onRecallThank: $options.recallThank,
  5261. item: {
  5262. isThanked: $options.post.isThanked,
  5263. thankCount: $options.post.thankCount,
  5264. username: $options.post.username
  5265. },
  5266. "api-url": "topic/" + $options.post.id
  5267. }, null, 8, ["onAddThank", "onRecallThank", "item", "api-url"])
  5268. ]),
  5269. _: 1
  5270. })
  5271. ]),
  5272. $options.topReply.length && $options.config.showTopReply ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_26, [
  5273. vue.createElementVNode("div", {
  5274. class: "my-cell flex",
  5275. onClick: _cache[2] || (_cache[2] = (...args) => $options.collapseTopReplyList && $options.collapseTopReplyList(...args))
  5276. }, [
  5277. _hoisted_27,
  5278. vue.createElementVNode("div", _hoisted_28, [
  5279. vue.createVNode(_component_Tooltip, { title: "收起高赞回复" }, {
  5280. default: vue.withCtx(() => [
  5281. vue.createElementVNode("div", _hoisted_29, [
  5282. vue.createVNode(_component_Icon, { icon: "gravity-ui:chevrons-collapse-vertical" })
  5283. ])
  5284. ]),
  5285. _: 1
  5286. })
  5287. ])
  5288. ]),
  5289. vue.createElementVNode("div", _hoisted_30, [
  5290. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.topReply, (item, index) => {
  5291. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5292. key: item.floor,
  5293. type: "top",
  5294. modelValue: $options.topReply[index],
  5295. "onUpdate:modelValue": ($event) => $options.topReply[index] = $event
  5296. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5297. }), 128))
  5298. ], 512)
  5299. ])) : vue.createCommentVNode("", true),
  5300. $options.isMobile ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_31, [
  5301. vue.createElementVNode("div", {
  5302. class: "inner",
  5303. innerHTML: $options.post.fr
  5304. }, null, 8, _hoisted_32)
  5305. ])) : vue.createCommentVNode("", true),
  5306. vue.createElementVNode("div", _hoisted_33, [
  5307. $options.post.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_34, [
  5308. vue.createElementVNode("div", null, [
  5309. vue.createTextVNode(vue.toDisplayString($options.post.replyCount) + " 条回复 ", 1),
  5310. $options.post.createDate ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_35, [
  5311. vue.createTextVNode("  "),
  5312. _hoisted_36,
  5313. vue.createTextVNode("  " + vue.toDisplayString($options.post.createDate), 1)
  5314. ])) : vue.createCommentVNode("", true)
  5315. ]),
  5316. $options.config.showToolbar ? (vue.openBlock(), vue.createBlock(_component_BaseSelect, {
  5317. key: 0,
  5318. "display-type": $props.displayType,
  5319. "onUpdate:displayType": _cache[3] || (_cache[3] = (e2) => _ctx.$emit("update:displayType", e2))
  5320. }, null, 8, ["display-type"])) : (vue.openBlock(), vue.createElementBlock("div", {
  5321. key: 1,
  5322. class: "fr",
  5323. innerHTML: $options.post.fr
  5324. }, null, 8, _hoisted_37))
  5325. ])) : vue.createCommentVNode("", true),
  5326. $options.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5327. $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_38, [
  5328. vue.createVNode(_component_BaseLoading, { size: "large" })
  5329. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_39, [
  5330. $props.modelValue ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList($options.replyList, (item, index) => {
  5331. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5332. key: item.floor,
  5333. modelValue: $options.replyList[index],
  5334. "onUpdate:modelValue": ($event) => $options.replyList[index] = $event
  5335. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5336. }), 128)) : vue.createCommentVNode("", true)
  5337. ]))
  5338. ], 64)) : vue.createCommentVNode("", true)
  5339. ]),
  5340. !($options.replyList.length || $props.loading) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_40, "目前尚无回复")) : vue.createCommentVNode("", true),
  5341. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", {
  5342. key: 3,
  5343. class: vue.normalizeClass(["my-box", { "sticky": $data.isSticky }]),
  5344. ref: "replyBox"
  5345. }, [
  5346. vue.createElementVNode("div", _hoisted_41, [
  5347. _hoisted_42,
  5348. vue.createElementVNode("div", _hoisted_43, [
  5349. $data.isSticky ? (vue.openBlock(), vue.createElementBlock("a", {
  5350. key: 0,
  5351. style: { "margin-right": "2rem" },
  5352. onClick: _cache[4] || (_cache[4] = ($event) => $data.isSticky = false)
  5353. }, "取消回复框停靠")) : vue.createCommentVNode("", true),
  5354. vue.createElementVNode("a", {
  5355. onClick: _cache[5] || (_cache[5] = (...args) => $options.scrollTop && $options.scrollTop(...args))
  5356. }, "回到顶部")
  5357. ])
  5358. ]),
  5359. vue.createElementVNode("div", _hoisted_44, [
  5360. vue.createVNode(_component_PostEditor, {
  5361. onClose: $options.goBottom,
  5362. ref: "post-editor",
  5363. useType: "reply-post",
  5364. onClick: _cache[6] || (_cache[6] = ($event) => $data.isSticky = true)
  5365. }, null, 8, ["onClose"])
  5366. ])
  5367. ], 2)) : vue.createCommentVNode("", true)
  5368. ], 4),
  5369. $data.showRelationReply ? (vue.openBlock(), vue.createElementBlock("div", {
  5370. key: 0,
  5371. class: "relationReply",
  5372. onClick: _cache[10] || (_cache[10] = ($event) => $options.close("space"))
  5373. }, [
  5374. vue.createElementVNode("div", {
  5375. class: "my-cell flex",
  5376. onClick: _cache[8] || (_cache[8] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  5377. }, [
  5378. _hoisted_45,
  5379. vue.createElementVNode("div", _hoisted_46, [
  5380. vue.createVNode(_component_Icon, {
  5381. icon: "ic:round-close",
  5382. onClick: _cache[7] || (_cache[7] = ($event) => $data.showRelationReply = false)
  5383. })
  5384. ])
  5385. ]),
  5386. vue.createElementVNode("div", {
  5387. class: "comments",
  5388. onClick: _cache[9] || (_cache[9] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  5389. }, [
  5390. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.relationReply, (item, index) => {
  5391. return vue.openBlock(), vue.createBlock(_component_SingleComment, {
  5392. "is-right": item.username === $data.targetUser.right,
  5393. key: item.floor,
  5394. comment: item
  5395. }, null, 8, ["is-right", "comment"]);
  5396. }), 128))
  5397. ])
  5398. ])) : vue.createCommentVNode("", true),
  5399. $data.showCallList && $options.filterCallList.length ? (vue.openBlock(), vue.createElementBlock("div", {
  5400. key: 1,
  5401. class: "call-list",
  5402. style: vue.normalizeStyle($data.callStyle)
  5403. }, [
  5404. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.filterCallList, (item, index) => {
  5405. return vue.openBlock(), vue.createElementBlock("div", {
  5406. class: vue.normalizeClass(["call-item", { select: index === $data.selectCallIndex }]),
  5407. onClick: ($event) => $options.setCall(item)
  5408. }, [
  5409. vue.createElementVNode("a", null, vue.toDisplayString(item), 1)
  5410. ], 10, _hoisted_47);
  5411. }), 256))
  5412. ], 4)) : vue.createCommentVNode("", true),
  5413. vue.createElementVNode("div", {
  5414. class: "close-btn",
  5415. onClick: _cache[11] || (_cache[11] = ($event) => $options.close("btn"))
  5416. }, [
  5417. vue.createVNode(_component_Icon, { icon: "fontisto:close-a" })
  5418. ]),
  5419. vue.createElementVNode("div", {
  5420. class: "scroll-top gray",
  5421. onClick: _cache[12] || (_cache[12] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  5422. }, [
  5423. vue.createVNode(_component_Icon, { icon: "lucide:move-up" })
  5424. ]),
  5425. vue.createElementVNode("div", {
  5426. class: "refresh gray",
  5427. onClick: _cache[13] || (_cache[13] = vue.withModifiers(($event) => _ctx.$emit("refresh"), ["stop"]))
  5428. }, [
  5429. $props.refreshLoading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  5430. key: 1,
  5431. icon: "material-symbols:refresh"
  5432. }))
  5433. ]),
  5434. vue.createElementVNode("div", {
  5435. class: "scroll-to gray",
  5436. onClick: _cache[17] || (_cache[17] = vue.withModifiers(($event) => $options.jump($data.currentFloor), ["stop"]))
  5437. }, [
  5438. vue.createVNode(_component_Icon, { icon: "lucide:move-down" }),
  5439. vue.withDirectives(vue.createElementVNode("input", {
  5440. type: "text",
  5441. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.currentFloor = $event),
  5442. onClick: _cache[15] || (_cache[15] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"])),
  5443. onKeydown: _cache[16] || (_cache[16] = vue.withKeys(($event) => $options.jump($data.currentFloor), ["enter"]))
  5444. }, null, 544), [
  5445. [vue.vModelText, $data.currentFloor]
  5446. ])
  5447. ])
  5448. ], 512)
  5449. ], 34)), [
  5450. [vue.vShow, $props.modelValue]
  5451. ]);
  5452. }
  5453. const PostDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-4b9c84df"]]);
  5454. const _hoisted_1$5 = { key: 1 };
  5455. const _sfc_main$5 = {
  5456. __name: "Base64Tooltip",
  5457. setup(__props) {
  5458. const tooltip = vue.ref(null);
  5459. const show = vue.ref(false);
  5460. const originalText = vue.ref("");
  5461. const decodeText = vue.ref("");
  5462. const styleObject = vue.reactive({
  5463. left: "-100vw",
  5464. top: "-100vh"
  5465. });
  5466. vue.onMounted(() => {
  5467. eventBus.on(CMD.SHOW_TOOLTIP, ({ text, e: e2 }) => {
  5468. setTimeout(() => show.value = true);
  5469. originalText.value = text;
  5470. decodeText.value = "";
  5471. styleObject.left = e2.clientX + "px";
  5472. styleObject.top = e2.clientY + 20 + "px";
  5473. });
  5474. window.addEventListener("click", (e2) => {
  5475. if (!tooltip.value)
  5476. return;
  5477. if (!tooltip.value.contains(e2.target) && show.value) {
  5478. show.value = false;
  5479. }
  5480. }, { capture: true });
  5481. const fn = () => show.value && (show.value = false);
  5482. $(".post-detail", window.win().doc).on("scroll", fn);
  5483. });
  5484. function copy() {
  5485. if (window.win().navigator.clipboard) {
  5486. window.win().navigator.clipboard.writeText(decodeText.value);
  5487. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "复制成功" });
  5488. } else {
  5489. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "复制失败!浏览器不支持!" });
  5490. }
  5491. }
  5492. function base64ToArrayBuffer(base64) {
  5493. let binary_string = window.atob(base64);
  5494. let len = binary_string.length;
  5495. let bytes = new Uint8Array(len);
  5496. for (let i = 0; i < len; i++) {
  5497. bytes[i] = binary_string.charCodeAt(i);
  5498. }
  5499. return bytes.buffer;
  5500. }
  5501. function decode() {
  5502. try {
  5503. new Blob([base64ToArrayBuffer(originalText.value)]).text().then((r2) => {
  5504. decodeText.value = r2;
  5505. });
  5506. } catch (e2) {
  5507. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "Base64解码失败!不是标准数据!" });
  5508. }
  5509. }
  5510. return (_ctx, _cache) => {
  5511. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  5512. class: "base64_tooltip",
  5513. style: vue.normalizeStyle(styleObject),
  5514. onClick: decode,
  5515. ref_key: "tooltip",
  5516. ref: tooltip
  5517. }, [
  5518. !decodeText.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5519. vue.createTextVNode(" Base64解码:" + vue.toDisplayString(originalText.value) + " ", 1),
  5520. vue.createVNode(vue.unref(Icon), { icon: "system-uicons:translate" })
  5521. ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
  5522. vue.createElementVNode("span", null, vue.toDisplayString(decodeText.value), 1),
  5523. vue.createVNode(BaseButton, {
  5524. class: "btn",
  5525. size: "small",
  5526. onClick: copy
  5527. }, {
  5528. default: vue.withCtx(() => [
  5529. vue.createTextVNode("点击复制")
  5530. ]),
  5531. _: 1
  5532. })
  5533. ]))
  5534. ], 4)), [
  5535. [vue.vShow, show.value]
  5536. ]);
  5537. };
  5538. }
  5539. };
  5540. const Base64Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c50fb66c"]]);
  5541. const _sfc_main$4 = {
  5542. name: "Msg",
  5543. components: { Icon },
  5544. props: {
  5545. type: "",
  5546. text: ""
  5547. },
  5548. created() {
  5549. setTimeout(() => {
  5550. this.$emit("close");
  5551. }, 3e3);
  5552. }
  5553. };
  5554. const _hoisted_1$4 = { class: "right" };
  5555. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  5556. const _component_Icon = vue.resolveComponent("Icon");
  5557. return vue.openBlock(), vue.createElementBlock("div", {
  5558. class: vue.normalizeClass(["msg", $props.type])
  5559. }, [
  5560. vue.createElementVNode("div", {
  5561. class: "left",
  5562. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  5563. }, [
  5564. vue.createVNode(_component_Icon, { icon: "ic:round-close" })
  5565. ]),
  5566. vue.createElementVNode("div", _hoisted_1$4, vue.toDisplayString($props.text), 1)
  5567. ], 2);
  5568. }
  5569. const Msg = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-8bf692ea"]]);
  5570. const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-674b86aa"), n2 = n2(), vue.popScopeId(), n2);
  5571. const _hoisted_1$3 = {
  5572. key: 0,
  5573. class: "tag-modal modal"
  5574. };
  5575. const _hoisted_2$2 = { class: "wrapper" };
  5576. const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  5577. const _hoisted_4$2 = { class: "option" };
  5578. const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("span", null, "用户:", -1));
  5579. const _hoisted_6$1 = { class: "btns" };
  5580. const _sfc_main$3 = {
  5581. __name: "TagModal",
  5582. props: ["tags"],
  5583. emits: ["update:tags"],
  5584. setup(__props, { emit: __emit }) {
  5585. const tagModal = vue.reactive({
  5586. show: false,
  5587. currentUsername: "",
  5588. tag: ""
  5589. });
  5590. const props = __props;
  5591. const emit = __emit;
  5592. const inputRef = vue.ref();
  5593. vue.onMounted(() => {
  5594. eventBus.on(CMD.ADD_TAG, (username) => {
  5595. tagModal.currentUsername = username;
  5596. tagModal.show = true;
  5597. vue.nextTick(() => {
  5598. inputRef.value.focus();
  5599. });
  5600. });
  5601. });
  5602. async function addTag() {
  5603. if (!tagModal.tag) {
  5604. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请输入标签" });
  5605. return;
  5606. }
  5607. let oldTag = window.clone(props.tags);
  5608. let tempTag = window.clone(props.tags);
  5609. let userTags = tempTag[tagModal.currentUsername] ?? [];
  5610. let rIndex = userTags.findIndex((v) => v === tagModal.tag);
  5611. if (rIndex > -1) {
  5612. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "标签已存在!" });
  5613. return;
  5614. } else {
  5615. userTags.push(tagModal.tag);
  5616. }
  5617. tempTag[tagModal.currentUsername] = userTags;
  5618. emit("update:tags", tempTag);
  5619. tagModal.tag = "";
  5620. tagModal.show = false;
  5621. let res = await window.parse.saveTags(tempTag);
  5622. if (!res) {
  5623. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签添加失败!" });
  5624. emit("update:tags", oldTag);
  5625. }
  5626. }
  5627. return (_ctx, _cache) => {
  5628. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  5629. default: vue.withCtx(() => [
  5630. tagModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  5631. vue.createElementVNode("div", {
  5632. class: "mask",
  5633. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => tagModal.show = false, ["stop"]))
  5634. }),
  5635. vue.createElementVNode("div", _hoisted_2$2, [
  5636. _hoisted_3$2,
  5637. vue.createElementVNode("div", _hoisted_4$2, [
  5638. _hoisted_5$1,
  5639. vue.createElementVNode("div", null, [
  5640. vue.createElementVNode("b", null, vue.toDisplayString(tagModal.currentUsername), 1)
  5641. ])
  5642. ]),
  5643. vue.withDirectives(vue.createElementVNode("input", {
  5644. type: "text",
  5645. ref_key: "inputRef",
  5646. ref: inputRef,
  5647. style: { "width": "100%" },
  5648. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tagModal.tag = $event),
  5649. onKeydown: vue.withKeys(addTag, ["enter"])
  5650. }, null, 544), [
  5651. [vue.vModelText, tagModal.tag]
  5652. ]),
  5653. vue.createElementVNode("div", _hoisted_6$1, [
  5654. vue.createVNode(BaseButton, {
  5655. type: "link",
  5656. onClick: _cache[2] || (_cache[2] = ($event) => tagModal.show = false)
  5657. }, {
  5658. default: vue.withCtx(() => [
  5659. vue.createTextVNode("取消")
  5660. ]),
  5661. _: 1
  5662. }),
  5663. vue.createVNode(BaseButton, { onClick: addTag }, {
  5664. default: vue.withCtx(() => [
  5665. vue.createTextVNode("确定")
  5666. ]),
  5667. _: 1
  5668. })
  5669. ])
  5670. ])
  5671. ])) : vue.createCommentVNode("", true)
  5672. ]),
  5673. _: 1
  5674. });
  5675. };
  5676. }
  5677. };
  5678. const TagModal = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-674b86aa"]]);
  5679. const _hoisted_1$2 = { class: "msgs" };
  5680. const _sfc_main$2 = {
  5681. __name: "MsgModal",
  5682. setup(__props) {
  5683. const msgList = vue.reactive([
  5684. // {type: 'success', text: '123', id: Date.now()}
  5685. ]);
  5686. vue.onMounted(() => {
  5687. eventBus.on(CMD.SHOW_MSG, (val) => {
  5688. msgList.push({ ...val, id: Date.now() });
  5689. });
  5690. });
  5691. function removeMsg(id) {
  5692. let rIndex = msgList.findIndex((item) => item.id === id);
  5693. if (rIndex > -1) {
  5694. msgList.splice(rIndex, 1);
  5695. }
  5696. }
  5697. return (_ctx, _cache) => {
  5698. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
  5699. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(msgList, (v) => {
  5700. return vue.openBlock(), vue.createBlock(Msg, {
  5701. key: v.id,
  5702. type: v.type,
  5703. text: v.text,
  5704. onClose: ($event) => removeMsg(v.id)
  5705. }, null, 8, ["type", "text", "onClose"]);
  5706. }), 128))
  5707. ]);
  5708. };
  5709. }
  5710. };
  5711. const MsgModal = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-b73f4332"]]);
  5712. let u = ".__cf_email__", f = "data-cfemail", d = document.createElement("div");
  5713. function e(e2) {
  5714. console.error(e2);
  5715. }
  5716. function r(e2, t) {
  5717. let r2 = e2.substr(t, 2);
  5718. return parseInt(r2, 16);
  5719. }
  5720. function n(href, index) {
  5721. let o = "", a = r(href, index);
  5722. for (let i = index + 2; i < href.length; i += 2) {
  5723. let l = r(href, i) ^ a;
  5724. o += String.fromCharCode(l);
  5725. }
  5726. try {
  5727. o = decodeURIComponent(escape(o));
  5728. } catch (u2) {
  5729. e(u2);
  5730. }
  5731. d.innerHTML = '<a href="' + o.replace(/"/g, "&quot;") + '"></a>';
  5732. return d.childNodes[0].getAttribute("href") || "";
  5733. }
  5734. function decodeEmail(body) {
  5735. try {
  5736. let as = body.find(u);
  5737. as.each(function() {
  5738. try {
  5739. let o = this, a = o.parentNode, i = o.getAttribute(f);
  5740. if (i) {
  5741. let l = n(i, 0), d2 = document.createTextNode(l);
  5742. a.replaceChild(d2, o);
  5743. }
  5744. } catch (h2) {
  5745. e(h2);
  5746. }
  5747. });
  5748. } catch (s) {
  5749. e(s);
  5750. }
  5751. }
  5752. const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-882b932b"), n2 = n2(), vue.popScopeId(), n2);
  5753. const _hoisted_1$1 = {
  5754. key: 0,
  5755. class: "tag-modal modal"
  5756. };
  5757. const _hoisted_2$1 = { class: "modal-root" };
  5758. const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 提醒系统 ", -1));
  5759. const _hoisted_4$1 = ["innerHTML"];
  5760. const _sfc_main$1 = {
  5761. __name: "NotificationModal",
  5762. props: ["modelValue", "h"],
  5763. emits: ["update:modelValue"],
  5764. setup(__props, { emit: __emit }) {
  5765. const emit = __emit;
  5766. vue.onMounted(() => {
  5767. });
  5768. function close() {
  5769. emit("update:modelValue", false);
  5770. }
  5771. return (_ctx, _cache) => {
  5772. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  5773. default: vue.withCtx(() => [
  5774. __props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
  5775. vue.createElementVNode("div", {
  5776. class: "mask",
  5777. onClick: vue.withModifiers(close, ["stop"])
  5778. }),
  5779. vue.createElementVNode("div", _hoisted_2$1, [
  5780. vue.createElementVNode("div", { class: "modal-header" }, [
  5781. _hoisted_3$1,
  5782. vue.createElementVNode("i", {
  5783. class: "fa fa-times",
  5784. onClick: close
  5785. })
  5786. ]),
  5787. vue.createElementVNode("div", {
  5788. innerHTML: __props.h,
  5789. class: "modal-body"
  5790. }, null, 8, _hoisted_4$1)
  5791. ])
  5792. ])) : vue.createCommentVNode("", true)
  5793. ]),
  5794. _: 1
  5795. });
  5796. };
  5797. }
  5798. };
  5799. const NotificationModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-882b932b"]]);
  5800. const _sfc_main = {
  5801. components: {
  5802. BaseButton,
  5803. NotificationModal,
  5804. BaseLoading,
  5805. BaseSwitch,
  5806. MsgModal,
  5807. TagModal,
  5808. Tooltip,
  5809. Setting,
  5810. PostDetail,
  5811. Base64Tooltip,
  5812. Msg
  5813. },
  5814. provide() {
  5815. return {
  5816. isMobile: vue.computed(() => window.vals.isMobile),
  5817. isLogin: vue.computed(() => this.isLogin),
  5818. isNight: vue.computed(() => this.isNight),
  5819. pageType: vue.computed(() => this.pageType),
  5820. tags: vue.computed(() => this.tags),
  5821. show: vue.computed(() => this.show),
  5822. post: vue.computed(() => this.current),
  5823. config: vue.computed(() => this.config),
  5824. allReplyUsers: vue.computed(() => {
  5825. var _a, _b, _c;
  5826. if ((_a = this.current) == null ? void 0 : _a.replyList) {
  5827. return Array.from(new Set(((_c = (_b = this.current) == null ? void 0 : _b.replyList) == null ? void 0 : _c.map((v) => v.username)) ?? []));
  5828. }
  5829. return [];
  5830. }),
  5831. showConfig: this.showConfig
  5832. };
  5833. },
  5834. data() {
  5835. return {
  5836. loading: window.pageType === PageType.Post,
  5837. refreshLoading: false,
  5838. loadMore: false,
  5839. isLogin: !!window.user.username,
  5840. pageType: window.pageType,
  5841. isNight: window.isNight,
  5842. stopMe: window.stopMe,
  5843. //停止使用脚本
  5844. show: false,
  5845. current: window.clone(window.initPost),
  5846. list: [],
  5847. config: window.clone(window.config),
  5848. tags: window.user.tags,
  5849. configModal: {
  5850. show: false
  5851. },
  5852. notificationModal: {
  5853. show: false,
  5854. h: ""
  5855. }
  5856. };
  5857. },
  5858. computed: {
  5859. targetUserTags() {
  5860. return this.tags[window.targetUserName] ?? [];
  5861. },
  5862. isList() {
  5863. return [PageType.Home, PageType.Node].includes(this.pageType);
  5864. },
  5865. isPost() {
  5866. return this.pageType === PageType.Post;
  5867. },
  5868. isMember() {
  5869. return this.pageType === PageType.Member;
  5870. }
  5871. },
  5872. watch: {
  5873. config: {
  5874. handler(newVal) {
  5875. let config2 = { [window.user.username ?? "default"]: newVal };
  5876. localStorage.setItem("v2ex-config", JSON.stringify(config2));
  5877. window.config = newVal;
  5878. },
  5879. deep: true
  5880. },
  5881. tags(newVal) {
  5882. window.user.tags = newVal;
  5883. },
  5884. "config.viewType"(newVal) {
  5885. if (!newVal)
  5886. return;
  5887. if (newVal === "card") {
  5888. $(".post-item").each(function() {
  5889. $(this).addClass("preview");
  5890. });
  5891. } else {
  5892. $(".post-item").each(function() {
  5893. $(this).removeClass("preview");
  5894. });
  5895. }
  5896. }
  5897. },
  5898. created() {
  5899. let that = this;
  5900. this.initEvent();
  5901. window.cb = this.winCb;
  5902. if (!window.canParseV2exPage)
  5903. return;
  5904. $(document).on("click", "a", this.clickA);
  5905. $(document).on("click", ".post-item", function(e2) {
  5906. if (e2.currentTarget.getAttribute("script"))
  5907. return;
  5908. if (that.stopMe)
  5909. return true;
  5910. if (this.classList.contains("preview")) {
  5911. if (e2.target.tagName !== "A" && e2.target.tagName !== "IMG" && !e2.target.classList.contains("toggle")) {
  5912. console.log("点空白处", this);
  5913. let id = this.dataset["id"];
  5914. let href = this.dataset["href"];
  5915. if (id) {
  5916. that.clickPost(e2, id, href);
  5917. } else {
  5918. if (href)
  5919. location.href = href;
  5920. }
  5921. }
  5922. }
  5923. });
  5924. $(document).on("click", ".toggle", (e2) => {
  5925. if (this.stopMe)
  5926. return true;
  5927. let id = e2.currentTarget.dataset["id"];
  5928. let itemDom = window.win().query(`.id_${id}`);
  5929. if (itemDom.classList.contains("preview")) {
  5930. itemDom.classList.remove("preview");
  5931. } else {
  5932. itemDom.classList.add("preview");
  5933. }
  5934. });
  5935. window.onpopstate = (event) => {
  5936. if (event.state) {
  5937. if (!this.show)
  5938. this.show = true;
  5939. } else {
  5940. if (this.show)
  5941. this.show = false;
  5942. }
  5943. };
  5944. window.deleteNotification = (nId, token) => {
  5945. console.log("deleteNotification", nId, token);
  5946. let item = $("#n_" + nId);
  5947. item.slideUp("fast");
  5948. $.post({
  5949. url: "/delete/notification/" + nId + "?once=" + token,
  5950. success() {
  5951. $.get({
  5952. url: "/notifications/below/" + window.notificationBottom,
  5953. success(data, status, request) {
  5954. item.remove();
  5955. $("#notifications").append(data);
  5956. window.notificationBottom = request.getResponseHeader("X-V2EX-New-Notification-Bottom");
  5957. },
  5958. error() {
  5959. item.slideDown("fast");
  5960. }
  5961. });
  5962. },
  5963. error() {
  5964. item.slideDown("fast");
  5965. }
  5966. });
  5967. };
  5968. },
  5969. beforeUnmount() {
  5970. eventBus.clear();
  5971. $(document).off("click", "a", this.clickA);
  5972. },
  5973. methods: {
  5974. async getUnreadMessagesCount() {
  5975. var _a, _b;
  5976. const res = await fetch(`${location.origin}/mission`);
  5977. const htmlText = await res.text();
  5978. const $page = $(htmlText);
  5979. const text = $page.find('#Rightbar a[href^="/notifications"]').text();
  5980. if (text.includes("未读提醒")) {
  5981. const countStr = (_a = text.match(/\d+/)) == null ? void 0 : _a.at(0);
  5982. if (countStr) {
  5983. return Number((_b = text.match(/\d+/)) == null ? void 0 : _b.at(0));
  5984. }
  5985. } else {
  5986. return 0;
  5987. }
  5988. throw new Error("无法获取未读消息数量");
  5989. },
  5990. clickA(e2) {
  5991. let that = this;
  5992. if (e2.currentTarget.getAttribute("script"))
  5993. return;
  5994. if (that.stopMe)
  5995. return true;
  5996. let { href, id, title } = window.parse.parseA(e2.currentTarget);
  5997. if (href.includes("/settings/night/toggle"))
  5998. return;
  5999. if (href.includes("/?tab="))
  6000. return;
  6001. if (href.includes("/go"))
  6002. return;
  6003. if (href === window.origin + "/#;")
  6004. return;
  6005. if (href === window.origin + "/")
  6006. return;
  6007. if (href.includes("/notifications"))
  6008. ;
  6009. if (id) {
  6010. that.clickPost(e2, id, href, title);
  6011. } else {
  6012. if (that.config.newTabOpen) {
  6013. that.stopEvent(e2);
  6014. functions.openNewTab(href);
  6015. }
  6016. }
  6017. },
  6018. stopEvent(e2) {
  6019. e2.preventDefault();
  6020. e2.stopPropagation();
  6021. },
  6022. async clickPost(e2, id, href, title = "") {
  6023. if (id) {
  6024. if (this.config.clickPostItemOpenDetail) {
  6025. this.stopEvent(e2);
  6026. let index = this.list.findIndex((v) => v.id == id);
  6027. let postItem = this.clone(window.initPost);
  6028. if (index > -1) {
  6029. postItem = this.list[index];
  6030. }
  6031. if (!postItem.title)
  6032. postItem.title = title ?? "加载中";
  6033. postItem.id = id;
  6034. postItem.href = href;
  6035. this.getPostDetail(postItem);
  6036. return;
  6037. }
  6038. if (this.config.newTabOpen) {
  6039. this.stopEvent(e2);
  6040. functions.openNewTab(`https://www.v2ex.com/t/${id}?p=1`);
  6041. }
  6042. }
  6043. },
  6044. showPost() {
  6045. this.show = true;
  6046. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6047. $(this).hide();
  6048. });
  6049. },
  6050. showConfig() {
  6051. this.configModal.show = true;
  6052. },
  6053. async winCb({ type, value }) {
  6054. if (type === "openSetting") {
  6055. this.showConfig();
  6056. }
  6057. if (type === "syncData") {
  6058. this.list = window.postList;
  6059. this.config = window.config;
  6060. this.stopMe = window.stopMe;
  6061. this.tags = window.user.tags;
  6062. }
  6063. if (type === "warningNotice") {
  6064. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: value });
  6065. }
  6066. if (this.stopMe)
  6067. return;
  6068. if (type === "restorePost") {
  6069. this.show = false;
  6070. this.loading = false;
  6071. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "脚本无法查看此页面!" });
  6072. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6073. $(this).show();
  6074. });
  6075. }
  6076. if (type === "postContent") {
  6077. this.current = Object.assign(this.current, value);
  6078. this.current.inList = true;
  6079. if (this.config.autoOpenDetail) {
  6080. this.showPost();
  6081. }
  6082. }
  6083. if (type === "postReplies") {
  6084. this.current = Object.assign(this.current, value);
  6085. this.list.push(this.clone(this.current));
  6086. this.loading = false;
  6087. }
  6088. },
  6089. clone(val) {
  6090. return window.clone(val);
  6091. },
  6092. regenerateReplyList() {
  6093. if (this.current.replyList.length) {
  6094. this.current.replyCount = this.current.replyList.length;
  6095. let res = window.parse.createNestedList(this.current.replyList);
  6096. if (res) {
  6097. this.current.nestedReplies = res;
  6098. }
  6099. let dup_res = window.parse.createNestedRedundantList(this.current.replyList);
  6100. if (dup_res) {
  6101. this.current.nestedRedundReplies = dup_res;
  6102. }
  6103. } else {
  6104. this.current.replyCount = 0;
  6105. this.current.nestedReplies = [];
  6106. this.current.nestedRedundReplies = [];
  6107. }
  6108. if (this.list.length) {
  6109. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6110. if (rIndex > -1) {
  6111. this.list[rIndex] = this.clone(this.current);
  6112. }
  6113. }
  6114. },
  6115. initEvent() {
  6116. eventBus.on(CMD.CHANGE_COMMENT_THANK, (val) => {
  6117. console.log("CHANGE_COMMENT_THANK", val);
  6118. const { id, type } = val;
  6119. let currentI = this.current.replyList.findIndex((i) => i.id === id);
  6120. if (currentI > -1) {
  6121. this.current.replyList[currentI].isThanked = type === "add";
  6122. if (type === "add") {
  6123. this.current.replyList[currentI].thankCount++;
  6124. } else {
  6125. this.current.replyList[currentI].thankCount--;
  6126. }
  6127. this.regenerateReplyList();
  6128. }
  6129. });
  6130. eventBus.on(CMD.CHANGE_POST_THANK, (val) => {
  6131. const { id, type } = val;
  6132. this.current.isThanked = type === "add";
  6133. if (type === "add") {
  6134. this.current.thankCount++;
  6135. } else {
  6136. this.current.thankCount--;
  6137. }
  6138. let currentI = this.list.findIndex((i) => i.id === id);
  6139. if (currentI > -1) {
  6140. this.list[currentI].isThanked = type === "add";
  6141. if (type === "add") {
  6142. this.list[currentI].thankCount++;
  6143. } else {
  6144. this.list[currentI].thankCount++;
  6145. }
  6146. }
  6147. });
  6148. eventBus.on(CMD.REMOVE, (val) => {
  6149. let removeIndex = this.current.replyList.findIndex((i) => i.floor === val);
  6150. if (removeIndex > -1) {
  6151. this.current.replyList.splice(removeIndex, 1);
  6152. }
  6153. this.regenerateReplyList();
  6154. });
  6155. eventBus.on(CMD.IGNORE, () => {
  6156. this.show = false;
  6157. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6158. if (rIndex > -1) {
  6159. this.list.splice(rIndex, 1);
  6160. }
  6161. this.current = this.clone(window.initPost);
  6162. });
  6163. eventBus.on(CMD.MERGE, (val) => {
  6164. this.current = Object.assign(this.current, val);
  6165. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6166. if (rIndex > -1) {
  6167. this.list[rIndex] = this.clone(this.current);
  6168. }
  6169. });
  6170. eventBus.on(CMD.ADD_REPLY, (item) => {
  6171. this.current.replyList.push(item);
  6172. this.regenerateReplyList();
  6173. });
  6174. eventBus.on(CMD.REFRESH_ONCE, async (once) => {
  6175. if (once) {
  6176. if (typeof once === "string") {
  6177. let res = once.match(/var once = "([\d]+)";/);
  6178. if (res && res[1]) {
  6179. this.current.once = Number(res[1]);
  6180. return;
  6181. }
  6182. }
  6183. if (typeof once === "number") {
  6184. this.current.once = once;
  6185. return;
  6186. }
  6187. }
  6188. window.fetchOnce().then((r2) => {
  6189. this.current.once = r2;
  6190. });
  6191. });
  6192. eventBus.on(CMD.REMOVE_TAG, async ({ username, tag }) => {
  6193. let oldTag = this.clone(this.tags);
  6194. let tags = this.tags[username] ?? [];
  6195. let rIndex = tags.findIndex((v) => v === tag);
  6196. if (rIndex > -1) {
  6197. tags.splice(rIndex, 1);
  6198. }
  6199. this.tags[username] = tags;
  6200. let res = await window.parse.saveTags(this.tags);
  6201. if (!res) {
  6202. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签删除失败!" });
  6203. this.tags = oldTag;
  6204. }
  6205. });
  6206. eventBus.on(CMD.REFRESH_POST, () => this.getPostDetail(this.current));
  6207. },
  6208. async getPostDetail(post) {
  6209. this.current = post;
  6210. this.show = true;
  6211. let url = window.baseUrl + "/t/" + this.current.id;
  6212. this.current.url = url;
  6213. let alreadyHasReply = this.current.replyList.length;
  6214. if (alreadyHasReply) {
  6215. this.refreshLoading = true;
  6216. } else {
  6217. this.loading = true;
  6218. let showJsonUrl = `${location.origin}/api/topics/show.json?id=${this.current.id}`;
  6219. fetch(showJsonUrl).then(async (r2) => {
  6220. if (r2.status === 200) {
  6221. let res = await r2.json();
  6222. if (res) {
  6223. let d2 = res[0];
  6224. d2.replyCount = d2.replies;
  6225. this.current = Object.assign(this.current, d2);
  6226. if (this.current.replyCount > MAX_REPLY_LIMIT) {
  6227. functions.openNewTab(`${location.origin}/t/${this.current.id}?p=1&script=1`);
  6228. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "由于回复数量较多,已为您单独打开此主题" });
  6229. this.loading = this.show = false;
  6230. return;
  6231. } else {
  6232. this.current.jsonContent = `
  6233. <div class="cell">
  6234. <div class="topic_content">
  6235. <div class="markdown_body">
  6236. ${(d2 == null ? void 0 : d2.content_rendered) ?? ""}
  6237. </div>
  6238. </div>
  6239. </div>`;
  6240. }
  6241. }
  6242. }
  6243. });
  6244. }
  6245. let apiRes = await window.fetch(url + "?p=1");
  6246. if (apiRes.status === 404) {
  6247. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "主题未找到" });
  6248. return this.refreshLoading = this.loading = false;
  6249. }
  6250. if (apiRes.status === 403) {
  6251. this.refreshLoading = this.show = this.loading = false;
  6252. functions.openNewTab(`${location.origin}/t/${post.id}?p=1&script=0`);
  6253. return;
  6254. }
  6255. if (apiRes.redirected) {
  6256. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有权限" });
  6257. return this.refreshLoading = this.loading = false;
  6258. }
  6259. let htmlText = await apiRes.text();
  6260. let hasPermission = htmlText.search("你要查看的页面需要先登录(不可用)");
  6261. if (hasPermission > -1) {
  6262. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你要查看的页面需要先登录(不可用)" });
  6263. return this.refreshLoading = this.loading = false;
  6264. }
  6265. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6266. let body = $(bodyText[0]);
  6267. decodeEmail(body);
  6268. await window.parse.getPostDetail(this.current, body, htmlText);
  6269. let index = this.list.findIndex((v) => v.id == this.current.id);
  6270. if (index > -1) {
  6271. this.list[index] = this.clone(this.current);
  6272. } else {
  6273. this.list.push(this.clone(this.current));
  6274. }
  6275. this.refreshLoading = this.loading = false;
  6276. await window.parse.parseOp(this.current);
  6277. console.log("当前帖子", this.current);
  6278. },
  6279. addTargetUserTag() {
  6280. eventBus.emit(CMD.ADD_TAG, window.targetUserName);
  6281. },
  6282. removeTargetUserTag(tag) {
  6283. eventBus.emit(CMD.REMOVE_TAG, { username: window.targetUserName, tag });
  6284. }
  6285. }
  6286. };
  6287. const _withScopeId = (n2) => (vue.pushScopeId("data-v-9cd5c940"), n2 = n2(), vue.popScopeId(), n2);
  6288. const _hoisted_1 = {
  6289. key: 0,
  6290. class: "target-user-tags p1"
  6291. };
  6292. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "标签:", -1));
  6293. const _hoisted_3 = { class: "my-tag" };
  6294. const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  6295. const _hoisted_5 = ["onClick"];
  6296. const _hoisted_6 = {
  6297. key: 1,
  6298. class: "my-box p2",
  6299. style: { "margin-top": "2rem" }
  6300. };
  6301. const _hoisted_7 = {
  6302. key: 0,
  6303. class: "flex flex-center"
  6304. };
  6305. const _hoisted_8 = {
  6306. key: 1,
  6307. class: "loaded"
  6308. };
  6309. const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "楼中楼解析完成", -1));
  6310. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  6311. const _component_Setting = vue.resolveComponent("Setting");
  6312. const _component_TagModal = vue.resolveComponent("TagModal");
  6313. const _component_PostDetail = vue.resolveComponent("PostDetail");
  6314. const _component_Base64Tooltip = vue.resolveComponent("Base64Tooltip");
  6315. const _component_MsgModal = vue.resolveComponent("MsgModal");
  6316. const _component_NotificationModal = vue.resolveComponent("NotificationModal");
  6317. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  6318. const _component_BaseButton = vue.resolveComponent("BaseButton");
  6319. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  6320. vue.createVNode(_component_Setting, {
  6321. modelValue: $data.config,
  6322. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.config = $event),
  6323. show: $data.configModal.show,
  6324. "onUpdate:show": _cache[1] || (_cache[1] = ($event) => $data.configModal.show = $event)
  6325. }, null, 8, ["modelValue", "show"]),
  6326. vue.createVNode(_component_TagModal, {
  6327. tags: $data.tags,
  6328. "onUpdate:tags": _cache[2] || (_cache[2] = ($event) => $data.tags = $event)
  6329. }, null, 8, ["tags"]),
  6330. vue.createVNode(_component_PostDetail, {
  6331. modelValue: $data.show,
  6332. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.show = $event),
  6333. ref: "postDetail",
  6334. displayType: $data.config.commentDisplayType,
  6335. "onUpdate:displayType": _cache[4] || (_cache[4] = ($event) => $data.config.commentDisplayType = $event),
  6336. onRefresh: _cache[5] || (_cache[5] = ($event) => $options.getPostDetail($data.current)),
  6337. loading: $data.loading,
  6338. refreshLoading: $data.refreshLoading
  6339. }, null, 8, ["modelValue", "displayType", "loading", "refreshLoading"]),
  6340. vue.createVNode(_component_Base64Tooltip),
  6341. vue.createVNode(_component_MsgModal),
  6342. vue.createVNode(_component_NotificationModal, {
  6343. modelValue: $data.notificationModal.show,
  6344. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.notificationModal.show = $event),
  6345. h: $data.notificationModal.h
  6346. }, null, 8, ["modelValue", "h"]),
  6347. !$data.stopMe ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  6348. $options.isMember && $data.isLogin && $data.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  6349. _hoisted_2,
  6350. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.targetUserTags, (i) => {
  6351. return vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
  6352. _hoisted_4,
  6353. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  6354. vue.createElementVNode("i", {
  6355. class: "fa fa-trash-o remove",
  6356. onClick: ($event) => $options.removeTargetUserTag(i)
  6357. }, null, 8, _hoisted_5)
  6358. ]);
  6359. }), 256)),
  6360. vue.createElementVNode("span", {
  6361. class: "add-tag ago",
  6362. onClick: _cache[7] || (_cache[7] = (...args) => $options.addTargetUserTag && $options.addTargetUserTag(...args)),
  6363. title: "添加标签"
  6364. }, "+")
  6365. ])) : vue.createCommentVNode("", true),
  6366. $options.isPost && !$data.show && $data.config.autoOpenDetail ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
  6367. $data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
  6368. vue.createVNode(_component_BaseLoading)
  6369. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
  6370. _hoisted_9,
  6371. vue.createVNode(_component_BaseButton, {
  6372. size: "small",
  6373. onClick: $options.showPost
  6374. }, {
  6375. default: vue.withCtx(() => [
  6376. vue.createTextVNode("点击显示")
  6377. ]),
  6378. _: 1
  6379. }, 8, ["onClick"])
  6380. ]))
  6381. ])) : vue.createCommentVNode("", true)
  6382. ], 64)) : vue.createCommentVNode("", true)
  6383. ], 64);
  6384. }
  6385. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9cd5c940"]]);
  6386. let isMobile = !document.querySelector("#Rightbar");
  6387. let $section = document.createElement("section");
  6388. $section.id = "app";
  6389. function run() {
  6390. window.baseUrl = location.origin;
  6391. window.initPost = DefaultPost;
  6392. window.win = function() {
  6393. return window;
  6394. };
  6395. window.win().doc = window.win().document;
  6396. window.win().query = (v) => window.win().document.querySelector(v);
  6397. window.query = (v) => window.win().document.querySelector(v);
  6398. window.clone = (val) => JSON.parse(JSON.stringify(val));
  6399. window.user = DefaultUser;
  6400. window.targetUserName = "";
  6401. window.pageType = void 0;
  6402. window.pageData = { pageNo: 1 };
  6403. window.config = DefaultConfig;
  6404. window.const = {
  6405. git: "https://github.com/zyronon/v2ex-script",
  6406. issue: "https://github.com/zyronon/v2ex-script/issues"
  6407. };
  6408. window.currentVersion = 1;
  6409. window.isNight = $(".Night").length === 1;
  6410. window.cb = null;
  6411. window.stopMe = false;
  6412. window.postList = [];
  6413. window.parse = {
  6414. //解析帖子内容
  6415. async parsePostContent(post, body, htmlText) {
  6416. let once = htmlText.match(/var once = "([\d]+)";/);
  6417. if (once && once[1]) {
  6418. post.once = once[1];
  6419. }
  6420. post.isReport = htmlText.includes("你已对本主题进行了报告");
  6421. let wrapper = body.find("#Main");
  6422. if (!post.title || !post.content_rendered) {
  6423. let h1 = wrapper.find("h1");
  6424. if (h1) {
  6425. post.title = h1[0].innerText;
  6426. }
  6427. }
  6428. let as = wrapper.find(".header > a");
  6429. if (as.length) {
  6430. post.node.title = as[1].innerText;
  6431. post.node.url = as[1].href;
  6432. }
  6433. let aName = wrapper.find(".header small.gray a:nth-child(1)");
  6434. if (aName) {
  6435. post.member.username = aName[0].innerText;
  6436. }
  6437. let spanEl = wrapper.find(".header small.gray span");
  6438. if (spanEl) {
  6439. post.createDateAgo = spanEl[0].innerText;
  6440. }
  6441. let avatarEl = wrapper.find(".header .avatar");
  6442. if (avatarEl) {
  6443. post.member.avatar_large = avatarEl[0].src;
  6444. }
  6445. let topic_buttons = body.find(".topic_buttons");
  6446. if (topic_buttons.length) {
  6447. let favoriteNode = topic_buttons.find(".tb:first");
  6448. if (favoriteNode.length) {
  6449. post.isFavorite = favoriteNode[0].innerText === "取消收藏";
  6450. }
  6451. let ignoreNode = topic_buttons.find(".tb:nth-child(3)");
  6452. if (ignoreNode.length) {
  6453. post.isIgnore = ignoreNode[0].innerText === "取消忽略";
  6454. }
  6455. let thankNode = topic_buttons.find("#topic_thank .tb");
  6456. if (!thankNode.length) {
  6457. post.isThanked = true;
  6458. }
  6459. let topic_stats = topic_buttons.find(".topic_stats");
  6460. if (topic_stats.length) {
  6461. let text = topic_stats[0].innerText;
  6462. let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g);
  6463. let collectCountReg = [...reg1];
  6464. if (collectCountReg.length) {
  6465. post.collectCount = Number(collectCountReg[0][1]);
  6466. }
  6467. reg1 = text.matchAll(/([\d]+)[\s]*likes/g);
  6468. collectCountReg = [...reg1];
  6469. if (collectCountReg.length) {
  6470. post.collectCount = Number(collectCountReg[0][1]);
  6471. }
  6472. let reg2 = text.matchAll(/([\d]+)[\s]*人感谢/g);
  6473. let thankCountReg = [...reg2];
  6474. if (thankCountReg.length) {
  6475. post.thankCount = Number(thankCountReg[0][1]);
  6476. }
  6477. let reg3 = text.matchAll(/([\d]+)[\s]*次点击/g);
  6478. let clickCountReg = [...reg3];
  6479. if (clickCountReg.length) {
  6480. post.clickCount = Number(clickCountReg[0][1]);
  6481. }
  6482. reg3 = text.matchAll(/([\d]+)[\s]*views/g);
  6483. clickCountReg = [...reg3];
  6484. if (clickCountReg.length) {
  6485. post.clickCount = Number(clickCountReg[0][1]);
  6486. }
  6487. }
  6488. }
  6489. let header = body.find(`#Main .box`).first();
  6490. let temp = header.clone();
  6491. temp.find(".topic_buttons").remove();
  6492. temp.find(".inner").remove();
  6493. temp.find(".header").remove();
  6494. let html = temp.html();
  6495. html = this.checkPhotoLink2Img(html);
  6496. post.headerTemplate = html;
  6497. return post;
  6498. },
  6499. //解析OP信息
  6500. async parseOp(post) {
  6501. if (!post.member.id) {
  6502. let userRes = await fetch(window.baseUrl + "/api/members/show.json?username=" + post.member.username);
  6503. if (userRes.status === 200) {
  6504. post.member = await userRes.json();
  6505. }
  6506. }
  6507. if (post.member.id) {
  6508. let date = new Date(post.member.created * 1e3);
  6509. let createStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
  6510. date.setHours(0);
  6511. date.setMinutes(0);
  6512. date.setSeconds(0);
  6513. date.setMilliseconds(0);
  6514. let now = /* @__PURE__ */ new Date();
  6515. now.setHours(0);
  6516. now.setMinutes(0);
  6517. now.setSeconds(0);
  6518. now.setMilliseconds(0);
  6519. let d2 = now.getTime() - date.getTime();
  6520. let isNew = d2 <= 1e3 * 60 * 60 * 24 * 7;
  6521. post.member.createDate = createStr + " 注册(不可用)";
  6522. post.member.isNew = isNew;
  6523. } else {
  6524. post.member.createDate = "用户已被注销/封禁";
  6525. post.member.isNew = true;
  6526. }
  6527. return post;
  6528. },
  6529. //获取帖子所有回复
  6530. async getPostAllReplies(post, body, htmlText, pageNo = 1) {
  6531. var _a, _b;
  6532. if (body.find("#no-comments-yet").length) {
  6533. return post;
  6534. }
  6535. let boxs = body.find(`#Main .box`);
  6536. let box = boxs[1];
  6537. let cells = box.querySelectorAll(".cell");
  6538. if (cells && cells.length) {
  6539. post.fr = cells[0].querySelector(".cell .fr").innerHTML;
  6540. cells = Array.from(cells);
  6541. let snow = cells[0].querySelector(".snow");
  6542. post.createDate = ((_b = (_a = snow == null ? void 0 : snow.nextSibling) == null ? void 0 : _a.nodeValue) == null ? void 0 : _b.trim()) || "";
  6543. let repliesMap = [];
  6544. if (cells[1].id) {
  6545. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(1)) });
  6546. let replyList = this.getAllReply(repliesMap);
  6547. post.replyList = replyList;
  6548. post.replyCount = replyList.length;
  6549. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  6550. let nestedList = this.createNestedList(replyList);
  6551. let nestedRedundantList = this.createNestedRedundantList(replyList);
  6552. if (nestedList)
  6553. post.nestedReplies = nestedList;
  6554. if (nestedRedundantList)
  6555. post.nestedRedundReplies = nestedRedundantList;
  6556. return post;
  6557. } else {
  6558. let promiseList = [];
  6559. return new Promise((resolve, reject) => {
  6560. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  6561. let pages = cells[1].querySelectorAll("a.page_normal");
  6562. pages = Array.from(pages);
  6563. let url = window.baseUrl + "/t/" + post.id;
  6564. for (let i = 0; i < pages.length; i++) {
  6565. let currentPageNo = Number(pages[i].innerText);
  6566. promiseList.push(this.fetchPostOtherPageReplies(url + "?p=" + currentPageNo, currentPageNo));
  6567. }
  6568. Promise.allSettled(promiseList).then(
  6569. (results) => {
  6570. results.filter((result) => result.status === "fulfilled").map((v) => repliesMap.push(v.value));
  6571. let replyList = this.getAllReply(repliesMap);
  6572. post.replyList = replyList;
  6573. post.replyCount = replyList.length;
  6574. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  6575. let nestedList = this.createNestedList(replyList);
  6576. let nestedRedundantList = this.createNestedRedundantList(replyList);
  6577. if (nestedList)
  6578. post.nestedReplies = nestedList;
  6579. if (nestedRedundantList)
  6580. post.nestedRedundReplies = nestedRedundantList;
  6581. resolve(post);
  6582. }
  6583. );
  6584. });
  6585. }
  6586. }
  6587. },
  6588. //请求帖子其他页的回复
  6589. fetchPostOtherPageReplies(href, pageNo) {
  6590. return new Promise((resolve) => {
  6591. $.get(href).then((res) => {
  6592. let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6593. let box = $(s[0]).find("#Main .box")[1];
  6594. let cells = box.querySelectorAll(".cell");
  6595. cells = Array.from(cells);
  6596. resolve({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  6597. }).catch((r2) => {
  6598. if (r2.status === 403) {
  6599. cbChecker({ type: "restorePost", value: null });
  6600. }
  6601. });
  6602. });
  6603. },
  6604. //解析页面的回复
  6605. parsePageReplies(nodes) {
  6606. let replyList = [];
  6607. nodes.forEach((node, index) => {
  6608. if (!node.id)
  6609. return;
  6610. let item = {
  6611. level: 0,
  6612. thankCount: 0,
  6613. isThanked: false,
  6614. isOp: false,
  6615. isDup: false,
  6616. id: node.id.replace("r_", "")
  6617. };
  6618. let reply_content = node.querySelector(".reply_content");
  6619. item.reply_content = this.checkPhotoLink2Img(reply_content.innerHTML);
  6620. item.reply_text = reply_content.textContent;
  6621. let { users, floor } = this.parseReplyContent(item.reply_content);
  6622. item.hideCallUserReplyContent = item.reply_content;
  6623. if (users.length === 1) {
  6624. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  6625. }
  6626. item.replyUsers = users;
  6627. item.replyFloor = floor;
  6628. let ago = node.querySelector(".ago");
  6629. item.date = ago.textContent;
  6630. let userNode = node.querySelector("strong a");
  6631. item.username = userNode.textContent;
  6632. let avatar = node.querySelector("td img");
  6633. item.avatar = avatar.src;
  6634. let no = node.querySelector(".no");
  6635. item.floor = Number(no.textContent);
  6636. let thank_area = node.querySelector(".thank_area");
  6637. if (thank_area) {
  6638. item.isThanked = thank_area.classList.contains("thanked");
  6639. }
  6640. let small = node.querySelector(".small");
  6641. if (small) {
  6642. item.thankCount = Number(small.textContent);
  6643. }
  6644. let op = node.querySelector(".op");
  6645. if (op) {
  6646. item.isOp = true;
  6647. }
  6648. let mod = node.querySelector(".mod");
  6649. if (mod) {
  6650. item.isMod = true;
  6651. }
  6652. replyList.push(item);
  6653. });
  6654. return replyList;
  6655. },
  6656. //解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
  6657. parseReplyContent(str) {
  6658. if (!str)
  6659. return;
  6660. let users = [];
  6661. let getUsername = (userStr) => {
  6662. let endIndex = userStr.indexOf('">');
  6663. if (endIndex > -1) {
  6664. let user = userStr.substring(0, endIndex);
  6665. if (!users.find((i) => i === user)) {
  6666. users.push(user);
  6667. }
  6668. }
  6669. };
  6670. let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g;
  6671. let has = str.matchAll(userReg);
  6672. let res2 = [...has];
  6673. if (res2.length > 1) {
  6674. res2.map((item) => {
  6675. getUsername(item[1]);
  6676. });
  6677. }
  6678. if (res2.length === 1) {
  6679. getUsername(res2[0][1]);
  6680. }
  6681. let floor = -1;
  6682. if (users.length === 1) {
  6683. let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g;
  6684. let hasFloor = str.matchAll(floorReg);
  6685. let res = [...hasFloor];
  6686. if (res.length) {
  6687. floor = Number(res[0][1]);
  6688. }
  6689. }
  6690. return { users, floor };
  6691. },
  6692. //获取帖子详情
  6693. async getPostDetail(post, body, htmlText, pageNo = 1) {
  6694. post = await this.parsePostContent(post, body, htmlText);
  6695. return await this.getPostAllReplies(post, body, htmlText, pageNo);
  6696. },
  6697. //获取所有回复
  6698. getAllReply(repliesMap = []) {
  6699. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  6700. pre = pre.concat(i.replyList);
  6701. return pre;
  6702. }, []);
  6703. },
  6704. //生成嵌套回复
  6705. createNestedList(allList = []) {
  6706. if (!allList.length)
  6707. return [];
  6708. let list = window.clone(allList);
  6709. let nestedList = [];
  6710. list.map((item, index) => {
  6711. let startList = list.slice(0, index);
  6712. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  6713. let endList = list.slice(index + 1);
  6714. if (index === 0) {
  6715. nestedList.push(this.findChildren(item, endList, list));
  6716. } else {
  6717. if (!item.isUse) {
  6718. let isOneLevelReply = false;
  6719. if (item.replyUsers.length) {
  6720. if (item.replyUsers.length > 1) {
  6721. isOneLevelReply = true;
  6722. } else {
  6723. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  6724. }
  6725. } else {
  6726. isOneLevelReply = true;
  6727. }
  6728. if (isOneLevelReply) {
  6729. item.level = 0;
  6730. nestedList.push(this.findChildren(item, endList, list));
  6731. }
  6732. }
  6733. }
  6734. });
  6735. return nestedList;
  6736. },
  6737. //生成嵌套冗余回复
  6738. createNestedRedundantList(allList = []) {
  6739. if (!allList.length)
  6740. return [];
  6741. let list = window.clone(allList);
  6742. let nestedList = [];
  6743. list.map((item, index) => {
  6744. let startList = list.slice(0, index);
  6745. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  6746. let endList = list.slice(index + 1);
  6747. if (index === 0) {
  6748. nestedList.push(this.findChildren(item, endList, list));
  6749. } else {
  6750. if (!item.isUse) {
  6751. let isOneLevelReply = false;
  6752. if (item.replyUsers.length) {
  6753. if (item.replyUsers.length > 1) {
  6754. isOneLevelReply = true;
  6755. } else {
  6756. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  6757. }
  6758. } else {
  6759. isOneLevelReply = true;
  6760. }
  6761. if (isOneLevelReply) {
  6762. item.level = 0;
  6763. nestedList.push(this.findChildren(item, endList, list));
  6764. }
  6765. } else {
  6766. let newItem = window.clone(item);
  6767. newItem.children = [];
  6768. newItem.level = 0;
  6769. newItem.isDup = true;
  6770. nestedList.push(newItem);
  6771. }
  6772. }
  6773. });
  6774. return nestedList;
  6775. },
  6776. //查找子回复
  6777. findChildren(item, endList, all) {
  6778. var _a;
  6779. const fn = (child, endList2, parent) => {
  6780. child.level = parent.level + 1;
  6781. let rIndex = all.findIndex((v) => v.floor === child.floor);
  6782. if (rIndex > -1) {
  6783. all[rIndex].isUse = true;
  6784. }
  6785. parent.children.push(this.findChildren(child, endList2, all));
  6786. };
  6787. item.children = [];
  6788. let floorReplyList = [];
  6789. for (let i = 0; i < endList.length; i++) {
  6790. let currentItem = endList[i];
  6791. if (currentItem.isUse)
  6792. continue;
  6793. if (currentItem.replyFloor === item.floor) {
  6794. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  6795. currentItem.isUse = true;
  6796. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  6797. } else {
  6798. currentItem.isWrong = true;
  6799. }
  6800. }
  6801. }
  6802. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  6803. fn(currentItem, endList2, item);
  6804. });
  6805. let nextMeIndex = endList.findIndex((v) => {
  6806. var _a2;
  6807. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  6808. });
  6809. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  6810. for (let i = 0; i < findList.length; i++) {
  6811. let currentItem = findList[i];
  6812. if (currentItem.isUse)
  6813. continue;
  6814. if (currentItem.replyUsers.length === 1) {
  6815. if (currentItem.replyFloor !== -1) {
  6816. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  6817. continue;
  6818. }
  6819. }
  6820. let endList2 = endList.slice(i + 1);
  6821. if (currentItem.username === item.username) {
  6822. if (currentItem.replyUsers[0] === item.username) {
  6823. fn(currentItem, endList2, item);
  6824. }
  6825. break;
  6826. } else {
  6827. if (currentItem.replyUsers[0] === item.username) {
  6828. fn(currentItem, endList2, item);
  6829. }
  6830. }
  6831. } else {
  6832. if (currentItem.username === item.username)
  6833. break;
  6834. }
  6835. }
  6836. item.children = item.children.sort((a, b) => a.floor - b.floor);
  6837. return item;
  6838. },
  6839. //解析页面帖子列表
  6840. parsePagePostList(list, box) {
  6841. list.forEach((itemDom) => {
  6842. let item = window.clone(window.initPost);
  6843. let item_title = itemDom.querySelector(".item_title a");
  6844. let { href, id } = window.parse.parseA(item_title);
  6845. item.id = id;
  6846. item.href = href;
  6847. item.url = location.origin + "/api/topics/show.json?id=" + item.id;
  6848. itemDom.classList.add("post-item");
  6849. itemDom.classList.add(`id_${id}`);
  6850. itemDom.dataset["href"] = href;
  6851. itemDom.dataset["id"] = id;
  6852. window.postList.push(item);
  6853. });
  6854. Promise.allSettled(window.postList.map((item) => $.get(item.url))).then((res) => {
  6855. let ok = res.filter((r2) => r2.status === "fulfilled").map((v) => v.value[0]);
  6856. box.style.boxShadow = "unset";
  6857. box.style.background = "unset";
  6858. if (window.config.viewType === "card") {
  6859. list.forEach((itemDom) => itemDom.classList.add("preview"));
  6860. }
  6861. ok.map((postItem) => {
  6862. var _a;
  6863. if (postItem == null ? void 0 : postItem.id) {
  6864. let itemDom = box.querySelector(`.id_${postItem.id}`);
  6865. if (window.config.showPreviewBtn) {
  6866. let td = itemDom.querySelector("td:nth-child(4)");
  6867. td.style.position = "relative";
  6868. let toggle = document.createElement("div");
  6869. toggle.dataset["id"] = postItem.id;
  6870. toggle.classList.add("toggle");
  6871. toggle.innerText = "点击展开/收起";
  6872. td.append(toggle);
  6873. }
  6874. let index = window.postList.findIndex((v) => v.id == postItem.id);
  6875. if (index > -1) {
  6876. let obj = window.postList[index];
  6877. postItem.replyCount = postItem.replies;
  6878. window.postList[index] = Object.assign({}, obj, postItem);
  6879. if (postItem.content_rendered) {
  6880. let a = document.createElement("a");
  6881. a.href = obj.href;
  6882. a.classList.add("post-content");
  6883. let div = document.createElement("div");
  6884. div.innerHTML = postItem.content_rendered;
  6885. a.append(div);
  6886. itemDom.append(a);
  6887. if (div.clientHeight < 172) {
  6888. a.classList.add("show-all");
  6889. } else {
  6890. let showMore = document.createElement("div");
  6891. showMore.classList.add("show-more");
  6892. showMore.innerHTML = "显示更多/收起";
  6893. showMore.onclick = function(e2) {
  6894. e2.stopPropagation();
  6895. a.classList.toggle("show-all");
  6896. };
  6897. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  6898. }
  6899. }
  6900. }
  6901. }
  6902. });
  6903. cbChecker({ type: "syncData" });
  6904. });
  6905. },
  6906. //解析A标签
  6907. parseA(a) {
  6908. let href = a.href;
  6909. let id;
  6910. if (href.includes("/t/")) {
  6911. id = a.pathname.substring("/t/".length);
  6912. }
  6913. return { href, id, title: a.innerText };
  6914. },
  6915. //创建记事本子条目
  6916. async createNoteItem(itemName) {
  6917. return;
  6918. },
  6919. //编辑记事本子条目
  6920. async editNoteItem(val, id) {
  6921. return;
  6922. },
  6923. //标签操作
  6924. async saveTags(val) {
  6925. return;
  6926. },
  6927. //已读楼层操作
  6928. async saveReadList(val) {
  6929. return;
  6930. },
  6931. //imgur图片删除hash操作
  6932. async saveImgurList(val) {
  6933. return;
  6934. },
  6935. //图片链接转Img标签
  6936. checkPhotoLink2Img(str) {
  6937. if (!str)
  6938. return;
  6939. try {
  6940. let imgWebs = [
  6941. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  6942. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  6943. ];
  6944. imgWebs.map((v, i) => {
  6945. let has = str.matchAll(v);
  6946. let res2 = [...has];
  6947. res2.map((r2) => {
  6948. let p = i === 0 ? r2[4] : r2[5];
  6949. if (p) {
  6950. let link = p.toLowerCase();
  6951. let src = p;
  6952. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  6953. } else {
  6954. src = p + ".png";
  6955. }
  6956. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  6957. }
  6958. });
  6959. });
  6960. } catch (e2) {
  6961. console.log("正则解析html里面的a标签的图片链接出错了");
  6962. }
  6963. return str;
  6964. },
  6965. //检测帖子回复长度
  6966. async checkPostReplies(id, needOpen = true) {
  6967. return new Promise(async (resolve) => {
  6968. var _a;
  6969. let showJsonUrl = `${location.origin}/api/topics/show.json?id=${id}`;
  6970. let r2 = await fetch(showJsonUrl);
  6971. if (r2) {
  6972. let res = await r2.json();
  6973. if (res) {
  6974. if (((_a = res[0]) == null ? void 0 : _a.replies) > MAX_REPLY_LIMIT) {
  6975. if (needOpen) {
  6976. functions.openNewTab(`https://www.v2ex.com/t/${id}?p=1&script=1`);
  6977. }
  6978. return resolve(true);
  6979. }
  6980. }
  6981. }
  6982. resolve(false);
  6983. });
  6984. }
  6985. };
  6986. window.vals = {
  6987. isMobile: !document.querySelector("#Rightbar")
  6988. };
  6989. window.functions = {};
  6990. async function sleep(time) {
  6991. return new Promise((resolve) => {
  6992. setTimeout(resolve, time);
  6993. });
  6994. }
  6995. async function cbChecker(val, count = 0) {
  6996. if (window.cb) {
  6997. window.cb(val);
  6998. } else {
  6999. while (!window.cb && count < 30) {
  7000. await sleep(500);
  7001. count++;
  7002. }
  7003. window.cb && window.cb(val);
  7004. }
  7005. }
  7006. function initMonkeyMenu() {
  7007. try {
  7008. _GM_registerMenuCommand("脚本设置", () => {
  7009. cbChecker({ type: "openSetting" });
  7010. });
  7011. _GM_registerMenuCommand("仓库地址", () => {
  7012. functions.openNewTab(DefaultVal.git);
  7013. });
  7014. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  7015. } catch (e2) {
  7016. console.error("无法使用Tampermonkey");
  7017. }
  7018. }
  7019. function initStyle() {
  7020. let style2 = `
  7021. html, body {
  7022. font-size: 62.5%;
  7023. }
  7024.  
  7025. :root{
  7026. --box-border-radius:8px;
  7027. }
  7028. .box{
  7029. box-shadow:rgba(0, 0, 0, 0.08) 0px 4px 12px;
  7030. }
  7031. #Tabs{
  7032. border-top-left-radius: var(--box-border-radius) !important;
  7033. border-top-right-radius: var(--box-border-radius) !important;
  7034. }
  7035. #Main .cell .count_livid {
  7036. font-size: 14px;
  7037. font-weight: bold;
  7038. padding: 3px 10px;
  7039. border-radius: 5px;
  7040. }
  7041.  
  7042. #Wrapper {
  7043. height: unset !important;
  7044. width: unset !important;
  7045. }
  7046.  
  7047. #Wrapper > .content {
  7048. height: unset !important;
  7049. width: unset !important;
  7050. max-width:1100px !important;
  7051. }
  7052.  
  7053. .post-item {
  7054. background: white;
  7055. }
  7056.  
  7057. .post-item > .post-content {
  7058. height: 0;
  7059. margin-top: 0;
  7060. }
  7061.  
  7062. .post-item:hover .toggle {
  7063. display: flex;
  7064. }
  7065.  
  7066. .toggle {
  7067. position: absolute;
  7068. right: ${window.config.viewType === "simple" ? "5rem" : 0};
  7069. top: 0.5rem;
  7070. width: 9rem;
  7071. height: 100%;
  7072. display: flex;
  7073. justify-content: flex-end;
  7074. align-items: flex-end;
  7075. cursor: pointer;
  7076. font-size: 1.2rem;
  7077. color: #ccc;
  7078. display: none;
  7079. }
  7080.  
  7081. .preview {
  7082. margin: 1rem 0;
  7083. border: 1px solid transparent;
  7084. border-radius: var(--box-border-radius);
  7085. cursor: pointer;
  7086. }
  7087.  
  7088. .preview:hover {
  7089. border: 1px solid #c8c8c8;
  7090. }
  7091.  
  7092. .preview > .post-content {
  7093. height: unset !important;
  7094. margin-top: 0.5rem !important;
  7095. }
  7096.  
  7097. .preview > .post-content.show-all {
  7098. max-height: unset;
  7099. -webkit-mask-image:none;
  7100. }
  7101.  
  7102. .preview .topic-link:link {
  7103. color: black !important;
  7104. }
  7105.  
  7106. .post-content {
  7107. margin-top: 0.5rem;
  7108. display: block;
  7109. max-height: 20rem;
  7110. overflow: hidden;
  7111. text-decoration: unset !important;
  7112. line-break: anywhere;
  7113. -webkit-mask-image: linear-gradient(180deg,#000 60%,transparent);
  7114. }
  7115.  
  7116. .show-more {
  7117. display: none;
  7118. }
  7119.  
  7120. .preview > .show-more {
  7121. font-size: 1.3rem;
  7122. text-align: right;
  7123. height: 3rem;
  7124. display: flex;
  7125. align-items: center;
  7126. justify-content: center;
  7127. position: relative;
  7128. z-index: 9;
  7129. }
  7130.  
  7131. .post-content:visited {
  7132. color: #afb9c1 !important;
  7133. }
  7134.  
  7135. .post-content:link {
  7136. color: #494949;
  7137. }
  7138.  
  7139.  
  7140. .Night .post-item {
  7141. background: #18222d !important;
  7142. }
  7143.  
  7144. .Night .preview {
  7145. border: 1px solid #3b536e;
  7146. }
  7147.  
  7148. .Night .preview > .post-content:link {
  7149. color: #d1d5d9;
  7150. }
  7151.  
  7152. .Night .preview > .post-content:visited {
  7153. color: #393f4e !important;
  7154. }
  7155. .Night .preview .topic-link:link {
  7156. color: #c0dbff !important;
  7157. }
  7158. ${window.config.viewType === "simple" ? `
  7159. ${window.pageType !== PageType.Member ? `
  7160. .item table tr td:first-child{display:none;}
  7161. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  7162. .item table tr td .sep5{display:none;}
  7163. .item table tr td .topic_info{display:none;}
  7164. .item {border-bottom:none;}
  7165. .avatar,#avatar{display:none;}
  7166. ` : ""}
  7167. #Logo {background-image:url('https://i.imgur.com/i9VgUtM.png');}
  7168. .bigger a, .top:nth-last-child(5){color: transparent!important;text-shadow: #b0b0b0 0 0 6px;user-select: none;}
  7169. // .bigger a:before,.top:nth-last-child(5):before{content:'Mona Lisa';position: absolute;background: white;}
  7170. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  7171. ` : ""}
  7172.  
  7173. ${window.config.customBgColor ? `#Wrapper {
  7174. background-color: ${window.config.customBgColor} !important;
  7175. background-image: unset !important;
  7176. }` : ""}
  7177. .top{
  7178. position:relative;
  7179. }
  7180. .new:before{
  7181. content:'new';
  7182. position: absolute;
  7183. background: red;
  7184. font-size: 10px;
  7185. border-radius: 4px;
  7186. padding: 0px 2px;
  7187. color: white;
  7188. right: -9px;
  7189. top: -3px;
  7190. }
  7191. }
  7192.  
  7193. `;
  7194. let addStyle2 = document.createElement("style");
  7195. addStyle2.rel = "stylesheet";
  7196. addStyle2.type = "text/css";
  7197. addStyle2.innerHTML = style2;
  7198. window.document.head.append(addStyle2);
  7199. }
  7200. function qianDao() {
  7201. let timeNow = (/* @__PURE__ */ new Date()).getUTCFullYear() + "/" + ((/* @__PURE__ */ new Date()).getUTCMonth() + 1) + "/" + (/* @__PURE__ */ new Date()).getUTCDate();
  7202. if (window.pageType === PageType.Home) {
  7203. let qiandao = window.query('.box .inner a[href="/mission/daily"]');
  7204. if (qiandao) {
  7205. qianDao_(qiandao, timeNow);
  7206. } else if (window.win().doc.getElementById("gift_v2excellent")) {
  7207. window.win().doc.getElementById("gift_v2excellent").click();
  7208. localStorage.setItem("menu_clockInTime", timeNow);
  7209. console.info("[V2EX - 超级增强] 自动签到完成!");
  7210. } else {
  7211. console.info("[V2EX - 超级增强] 自动签到完成!");
  7212. }
  7213. } else {
  7214. let timeOld = localStorage.getItem("menu_clockInTime");
  7215. if (!timeOld || timeOld != timeNow) {
  7216. qianDaoStatus_(timeNow);
  7217. } else {
  7218. console.info("[V2EX - 超级增强] 自动签到完成!");
  7219. }
  7220. }
  7221. }
  7222. function qianDao_(qiandao, timeNow) {
  7223. let url = window.baseUrl + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector("div#Top .tools, #menu-body").innerHTML)[0];
  7224. console.log("url", url);
  7225. $.get(url).then((r2) => {
  7226. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7227. let html = $(bodyText[0]);
  7228. if (html.find("li.fa.fa-ok-sign").length) {
  7229. html = html.find("#Main").text().match(/已连续登录(不可用) (\d+?) 天/)[0];
  7230. localStorage.setItem("menu_clockInTime", timeNow);
  7231. console.info("[V2EX - 超级增强] 自动签到完成!");
  7232. if (qiandao) {
  7233. qiandao.textContent = `自动签到完成!${html}`;
  7234. qiandao.href = "javascript:void(0);";
  7235. }
  7236. } else {
  7237. _GM_notification({
  7238. text: "自动签到失败!请关闭其他插件或脚本。\n如果连续几天都签到失败,请联系作者解决!",
  7239. timeout: 4e3,
  7240. onclick() {
  7241. functions.feedback();
  7242. }
  7243. });
  7244. console.warn("[V2EX 增强] 自动签到失败!请关闭其他插件或脚本。如果连续几天都签到失败,请联系作者解决!");
  7245. if (qiandao)
  7246. qiandao.textContent = "自动签到失败!请尝试手动签到!";
  7247. }
  7248. });
  7249. }
  7250. function qianDaoStatus_(timeNow) {
  7251. $.get(window.baseUrl + "/mission/daily").then((r2) => {
  7252. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7253. let html = $(bodyText[0]);
  7254. if (html.find('input[value^="领取"]').length) {
  7255. qianDao_(null, timeNow);
  7256. } else {
  7257. console.info("[V2EX 增强] 已经签过到了。");
  7258. localStorage.setItem("menu_clockInTime", timeNow);
  7259. }
  7260. });
  7261. }
  7262. function initConfig() {
  7263. return new Promise((resolve) => {
  7264. let configStr = window.localStorage.getItem("v2ex-config");
  7265. if (configStr) {
  7266. let configObj = JSON.parse(configStr);
  7267. configObj = configObj[window.user.username ?? "default"];
  7268. if (configObj) {
  7269. window.config = Object.assign(window.config, configObj);
  7270. }
  7271. }
  7272. resolve(window.config);
  7273. });
  7274. }
  7275. function addSettingText() {
  7276. let setting = $(`<a href="javascript:void 0;" class="top ${window.config.version < window.currentVersion ? "new" : ""}">脚本设置</a>`);
  7277. setting.on("click", function() {
  7278. this.classList.remove("new");
  7279. cbChecker({ type: "openSetting" });
  7280. });
  7281. $(".tools").prepend(setting);
  7282. }
  7283. async function init() {
  7284. window.addEventListener("error", (e2) => {
  7285. let dom = e2.target;
  7286. let originImgUrl = dom.getAttribute("data-originurl");
  7287. if (originImgUrl) {
  7288. let a = document.createElement("a");
  7289. a.href = originImgUrl;
  7290. a.setAttribute("notice", "此标签由v2ex超级增强脚本转换图片失败后恢复");
  7291. a.innerText = originImgUrl;
  7292. dom.parentNode.replaceChild(a, dom);
  7293. }
  7294. }, true);
  7295. if (window.isNight) {
  7296. document.documentElement.classList.add("dark");
  7297. }
  7298. functions.checkPageType();
  7299. initMonkeyMenu();
  7300. let top2 = document.querySelector(".tools .top:nth-child(2)");
  7301. if (top2 && top2.textContent !== "注册(不可用)") {
  7302. window.user.username = top2.textContent;
  7303. window.user.avatar = $("#Rightbar .box .avatar").attr("src");
  7304. }
  7305. initConfig().then((r2) => {
  7306. addSettingText();
  7307. initStyle();
  7308. try {
  7309. if (window.config.autoSignin && window.user.username) {
  7310. qianDao();
  7311. }
  7312. } catch (e2) {
  7313. console.log("签到失败");
  7314. }
  7315. if (window.user.username)
  7316. ;
  7317. });
  7318. let box;
  7319. let list;
  7320. console.log(window.pageType);
  7321. switch (window.pageType) {
  7322. case PageType.Changes:
  7323. box = document.querySelector("#Wrapper #Main .box");
  7324. list = box.querySelectorAll(".item");
  7325. list[0].before($section);
  7326. break;
  7327. case PageType.Node:
  7328. box = document.querySelectorAll("#Wrapper #Main .box");
  7329. let topics = box[1].querySelector("#TopicsNode");
  7330. list = topics.querySelectorAll(".cell");
  7331. list[0].before($section);
  7332. break;
  7333. case PageType.Home:
  7334. box = document.querySelector("#Wrapper #Main .box");
  7335. list = box.querySelectorAll(".item");
  7336. list[0].before($section);
  7337. break;
  7338. case PageType.Post:
  7339. box = document.querySelector("#Wrapper #Main .box");
  7340. box.after($section);
  7341. if (window.config.postWidth) {
  7342. let Main = $("#Main");
  7343. Main.css({
  7344. "width": window.config.postWidth,
  7345. margin: "unset"
  7346. });
  7347. $("#Wrapper > .content").css({
  7348. "max-width": "unset",
  7349. display: "flex",
  7350. "justify-content": "center",
  7351. gap: "20px"
  7352. });
  7353. Main.after($("#Rightbar"));
  7354. }
  7355. let post = window.clone(window.initPost);
  7356. post.id = window.pageData.id;
  7357. let body = $(window.document.body);
  7358. let htmlText = window.document.documentElement.outerHTML;
  7359. window.parse.parsePostContent(
  7360. post,
  7361. body,
  7362. htmlText
  7363. ).then(async (res) => {
  7364. await functions.cbChecker({ type: "postContent", value: res });
  7365. await window.parse.parseOp(res);
  7366. });
  7367. window.parse.getPostAllReplies(
  7368. post,
  7369. body,
  7370. htmlText,
  7371. window.pageData.pageNo
  7372. ).then(async (res1) => {
  7373. await functions.cbChecker({ type: "postReplies", value: res1 });
  7374. });
  7375. break;
  7376. case PageType.Member:
  7377. box = document.querySelector("#Wrapper #Main .box");
  7378. window.targetUserName = box[0].querySelector("h1").textContent;
  7379. if (window.config.openTag) {
  7380. box[0].style.borderBottom = "none";
  7381. box[0].style["border-bottom-left-radius"] = "0";
  7382. box[0].style["border-bottom-right-radius"] = "0";
  7383. }
  7384. list = box[1].querySelectorAll(".cell");
  7385. box[0].after($section);
  7386. break;
  7387. default:
  7388. window.stopMe = true;
  7389. cbChecker({ type: "syncData" });
  7390. console.error("未知页面");
  7391. break;
  7392. }
  7393. }
  7394. window.canParseV2exPage = !window.location.search.includes("script");
  7395. if (window.canParseV2exPage) {
  7396. init();
  7397. } else {
  7398. let box = document.querySelector("#Wrapper #Main .box");
  7399. box.after($section);
  7400. window.stopMe = true;
  7401. cbChecker({ type: "syncData" });
  7402. if (window.location.search.includes("script=0")) {
  7403. cbChecker({ type: "warningNotice", value: "脚本无法查看此主题,已为您单独打开此主题" });
  7404. }
  7405. if (window.location.search.includes("script=1")) {
  7406. cbChecker({ type: "warningNotice", value: "由于回复数量较多,已为您单独打开此主题并停止解析楼中楼" });
  7407. }
  7408. }
  7409. }
  7410. if (!isMobile) {
  7411. (o=>{if(typeof GM_addStyle=="function"){GM_addStyle(o);return}const r=document.createElement("style");r.textContent=o,document.head.append(r)})(' .tip[data-v-ee672411]{position:fixed;font-size:1.6rem;z-index:9999;max-width:10rem;border-radius:.5rem;padding:1rem;color:var(--color-font-8);background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow)}.v-enter-active[data-v-e7c0fbef],.v-leave-active[data-v-e7c0fbef]{transition:opacity .3s ease}.v-enter-from[data-v-e7c0fbef],.v-leave-to[data-v-e7c0fbef]{opacity:0}.username[data-v-e7c0fbef]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-e7c0fbef]{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner[data-v-e7c0fbef]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod[data-v-e7c0fbef]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag[data-v-e7c0fbef]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-e7c0fbef]{display:inline}.my-tag .remove[data-v-e7c0fbef]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-e7c0fbef]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-e7c0fbef]{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-e7c0fbef]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark[data-v-e7c0fbef]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html[data-v-e7c0fbef],body[data-v-e7c0fbef]{font-size:62.5%}[data-v-e7c0fbef]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-e7c0fbef]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-e7c0fbef]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-e7c0fbef]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-e7c0fbef]{justify-content:flex-end}.flex-center[data-v-e7c0fbef]{justify-content:center}.p1[data-v-e7c0fbef]{padding:1rem}.p2[data-v-e7c0fbef]{padding:2rem}.p0[data-v-e7c0fbef]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-e7c0fbef]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-e7c0fbef]{text-decoration:none;cursor:pointer}a[data-v-e7c0fbef]:hover{text-decoration:underline}.tool[data-v-e7c0fbef]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-e7c0fbef]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-e7c0fbef]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-e7c0fbef]{cursor:default}.tool.no-hover[data-v-e7c0fbef]:hover{background:unset!important}.tool.disabled[data-v-e7c0fbef]{cursor:not-allowed}.tool.disabled[data-v-e7c0fbef]:hover{background:unset!important}.my-node[data-v-e7c0fbef]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-e7c0fbef]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-e7c0fbef]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-e7c0fbef]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-e7c0fbef]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-e7c0fbef]{position:fixed;z-index:100;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-e7c0fbef]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-e7c0fbef]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-e7c0fbef]{position:relative}.modal .mask[data-v-e7c0fbef]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-e7c0fbef]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-e7c0fbef]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-e7c0fbef]:first-child{border-left:none}.radio-group2 .active[data-v-e7c0fbef]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-e7c0fbef]{position:relative;display:inline-flex;justify-content:center}input[data-v-e7c0fbef]{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-e7c0fbef]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-e7c0fbef]:focus{border:1px solid var(--color-active)}.danger[data-v-e7c0fbef]{color:red!important}.switch[data-v-e7c0fbef]{width:4.5rem;height:2.2rem;border-radius:2rem;position:relative;display:flex;align-items:center;background:var(--color-swtich-bg);transition:all .3s}.switch.active[data-v-e7c0fbef]{background:var(--color-active)}.switch.active[data-v-e7c0fbef]:before{right:.2rem}.switch[data-v-e7c0fbef]:before{position:absolute;content:" ";transition:all .3s;right:calc(100% - 2rem);width:1.8rem;height:1.8rem;background:white;border-radius:50%}.display-type[data-v-a920fba8]{height:3rem;padding:0 .3rem;background:var(--color-sp-btn-bg);border-radius:1rem;display:flex;font-size:1.4rem;align-items:center;color:#a9a9a9}.display-type .type[data-v-a920fba8]{border-radius:.8rem;padding:0 1.3rem;height:2.8rem;align-items:center;display:flex;position:relative;cursor:pointer}.display-type .type.active[data-v-a920fba8]{background:var(--color-second-bg);color:var(--color-font-pure);box-shadow:0 0 6px 0 var(--color-tooltip-shadow)}.display-type .type-list[data-v-a920fba8]{position:absolute;background:white;right:0;top:3rem;font-size:1.4rem;box-shadow:0 0 6px 0 var(--color-tooltip-shadow);border-radius:.6rem;z-index:9;color:var(--color-font)}.display-type .type-list .item[data-v-a920fba8]{word-break:keep-all;padding:.8rem 1rem;cursor:pointer}.display-type .type-list .item.active[data-v-a920fba8],.display-type .type-list .item[data-v-a920fba8]:hover{color:var(--color-font-pure)}.display-type svg[data-v-a920fba8]{width:1.5rem}.setting-modal .modal-root[data-v-03cabff3]{z-index:9;background:var(--color-main-bg);border-radius:1.6rem;font-size:1.4rem;overflow:hidden;color:var(--color-font-pure)}.setting-modal .modal-root .modal-header[data-v-03cabff3]{padding:2.4rem;display:flex;justify-content:space-between}.setting-modal .modal-root .modal-header .title[data-v-03cabff3]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.setting-modal .modal-root .modal-header svg[data-v-03cabff3]{cursor:pointer;font-size:2.6rem}.setting-modal .modal-root .body[data-v-03cabff3]{width:45vw;height:70vh;display:flex}.setting-modal .modal-root .body .left[data-v-03cabff3]{display:flex;flex-direction:column;justify-content:space-between;align-items:center;font-size:1.8rem}.setting-modal .modal-root .body .left .tabs[data-v-03cabff3]{padding:1rem 2rem;display:flex;flex-direction:column;gap:1rem}.setting-modal .modal-root .body .left .tabs .tab[data-v-03cabff3]{cursor:pointer;padding:1rem 1.5rem;border-radius:.8rem;display:flex;align-items:center;gap:1rem}.setting-modal .modal-root .body .left .tabs .tab.active[data-v-03cabff3]{background:var(--color-item-bg)}.setting-modal .modal-root .body .modal-content[data-v-03cabff3]{background:var(--color-second-bg);flex:1;height:100%;box-sizing:border-box;padding:1rem 1rem 1rem 2rem;border-radius:1.6rem;display:flex}.setting-modal .modal-root .body .modal-content .scroll[data-v-03cabff3]{flex:1;padding-right:1rem;overflow:auto}.setting-modal .modal-root .body .modal-content .scroll .row[data-v-03cabff3]{min-height:5rem;display:flex;justify-content:space-between;align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper[data-v-03cabff3]{height:3rem;flex:1;display:flex;justify-content:flex-end;align-items:center;gap:var(--space)}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper span[data-v-03cabff3]{text-align:right;font-size:1.4rem;color:gray}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key[data-v-03cabff3]{align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key input[data-v-03cabff3]{width:15rem;box-sizing:border-box;margin-right:1rem;height:2.8rem;outline:none;font-size:1.6rem;border:1px solid gray;border-radius:.3rem;padding:0 .5rem;background:var(--color-second-bg);color:var(--color-font-1)}.setting-modal .modal-root .body .modal-content .scroll .row .main-title[data-v-03cabff3]{font-size:2.2rem;font-weight:700;color:var(--color-font-8)}.setting-modal .modal-root .body .modal-content .scroll .row .item-title[data-v-03cabff3]{font-size:1.8rem}.setting-modal .modal-root .body .modal-content .scroll .desc[data-v-03cabff3]{margin-bottom:1rem;font-size:1.4rem;text-align:left;color:var(--color-font)}.setting-modal .modal-root .body .modal-content .scroll .project-desc[data-v-03cabff3]{text-align:start;font-size:1.6rem;padding-bottom:10rem}.setting-modal .modal-root .body .modal-content .scroll .line[data-v-03cabff3]{border-bottom:1px solid #c4c3c3}.loading[data-v-2697baa2]{border:2px solid;border-color:var(--color-loading-2) var(--color-loading-1) var(--color-loading-1) var(--color-loading-1);border-radius:100%;animation:circle-2697baa2 infinite 1s linear;width:2rem;height:2rem}.loading.small[data-v-2697baa2]{width:1.2rem;height:1.2rem}.loading.large[data-v-2697baa2]{width:3rem;height:3rem}@keyframes circle-2697baa2{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.base-button[data-v-5a7d79ba]{cursor:pointer;border-radius:.6rem;padding:0 1.5rem;display:inline-flex;align-items:center;justify-content:center;transition:all .3s;height:3.6rem;line-height:1;position:relative}.base-button .loading[data-v-5a7d79ba]{position:absolute}.base-button.disabled[data-v-5a7d79ba]{opacity:.6;cursor:not-allowed;-webkit-user-select:none;user-select:none}.base-button.small[data-v-5a7d79ba]{height:3rem}.base-button.small>span[data-v-5a7d79ba]{font-size:1.3rem}.base-button.large[data-v-5a7d79ba]{height:5rem;font-size:1.8rem;padding:0 2.2rem}.base-button.large>span[data-v-5a7d79ba]{font-size:1.8rem}.base-button[data-v-5a7d79ba]:hover:not(.link){opacity:.7}.base-button.primary[data-v-5a7d79ba]{background:var(--color-active)}.base-button.primary>span[data-v-5a7d79ba]{color:#fff}.base-button.gary[data-v-5a7d79ba]{background:#4b5563}.base-button.link[data-v-5a7d79ba]{border-radius:0;border-bottom:2px solid transparent}.base-button.link>span[data-v-5a7d79ba]{color:var(--color-font-8)}.base-button.link[data-v-5a7d79ba]:hover{border-bottom:2px solid var(--color-font-8)}.base-button.active[data-v-5a7d79ba]{opacity:.4}.key-notice[data-v-5a7d79ba]{margin-left:1rem;display:flex;align-items:center;justify-content:center;font-size:1.2rem;color:#fff}.key-notice .key[data-v-5a7d79ba]{transform:scale(.8)}.pop-confirm-content[data-v-05424197]{position:fixed;background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow);color:var(--color-font-8);padding:1.5rem;border-radius:.8rem;transform:translate(-50%,calc(-100% - 1rem));z-index:999}.pop-confirm-content .text[data-v-05424197]{text-align:start;font-size:1.6rem;width:15rem;min-width:15rem}.pop-confirm-content .options[data-v-05424197]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1rem}.Author[data-v-53261a54]{display:flex;align-items:center;justify-content:space-between;font-size:1.2rem;position:relative}.Author.expand[data-v-53261a54]{margin-bottom:0}.Author .Author-left[data-v-53261a54]{display:flex;align-items:center;max-width:65%;word-break:break-all}.Author .Author-left .username[data-v-53261a54]{font-size:1.4rem;margin-right:1rem}.Author .Author-left .expand-icon[data-v-53261a54]{cursor:pointer;margin-right:.8rem;width:2rem;height:2rem;transform:rotate(90deg)}.Author .Author-left .avatar[data-v-53261a54]{margin-right:1rem;display:flex}.Author .Author-left .avatar img[data-v-53261a54]{width:2.8rem;height:2.8rem;border-radius:.4rem}.Author .Author-left .texts[data-v-53261a54]{flex:1}.Author .Author-left .owner[data-v-53261a54]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.Author .Author-left .dup[data-v-53261a54]{display:inline-block;background-color:transparent;color:red;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid red;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.Author .Author-left .mod[data-v-53261a54]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.Author:hover .add-tag[data-v-53261a54]{display:inline-block}.Author .Author-right[data-v-53261a54]{position:absolute;right:0;display:flex;align-items:center}.Author .Author-right .toolbar[data-v-53261a54]{display:flex;align-items:center;color:var(--color-gray);opacity:0;gap:.5rem}.Author .Author-right .toolbar[data-v-53261a54]:hover{opacity:1}.post-editor-wrapper[data-v-1638aeb6]{width:100%;box-sizing:border-box;position:relative;overflow:hidden;transition:all .3s;color:var(--color-font)}.post-editor-wrapper.reply-post .post-editor[data-v-1638aeb6]{border:1px solid var(--color-line)}.post-editor-wrapper.reply-post.isFocus .post-editor[data-v-1638aeb6]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment[data-v-1638aeb6]{border-radius:var(--box-border-radius);overflow:hidden;border:1px solid var(--color-line)}.post-editor-wrapper.reply-comment.isFocus[data-v-1638aeb6]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment .toolbar[data-v-1638aeb6]{background:var(--color-editor-toolbar)}.post-editor-wrapper .post-editor[data-v-1638aeb6]{border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);border:1px solid transparent}.post-editor-wrapper .toolbar[data-v-1638aeb6]{box-sizing:border-box;padding:.5rem 1rem;width:100%;position:relative;display:flex;justify-content:space-between;align-items:center}.post-editor-wrapper .toolbar .left[data-v-1638aeb6]{display:flex;align-items:center;gap:1rem;font-size:2.5rem}.post-editor-wrapper .toolbar .left svg[data-v-1638aeb6]{cursor:pointer}.post-editor-wrapper .toolbar .left .upload[data-v-1638aeb6]{width:2.6rem;height:2.6rem;overflow:hidden}.post-editor-wrapper .toolbar .left .upload input[data-v-1638aeb6]{width:2.6rem;height:2.6rem;cursor:pointer;position:absolute;opacity:0}.post-editor-wrapper .toolbar span[data-v-1638aeb6]{color:gray;font-size:1.3rem}.post-editor-wrapper .get-cursor[data-v-1638aeb6]{border-radius:var(--box-border-radius);transition:border .3s;width:100%;max-width:100%;padding:.6rem 1.4rem;box-sizing:border-box;outline:none;font-family:Avenir,Helvetica,Arial,sans-serif;font-size:1.4rem;min-height:13rem;resize:none;background:var(--box-background-color);color:var(--color-font-pure);border:1px solid transparent;position:absolute;top:0;z-index:-100}.post-editor-wrapper .emoticon-pack[data-v-1638aeb6]{z-index:999999999;border-radius:1rem;padding:1rem;width:31rem;max-width:31rem;height:30rem;max-height:30rem;overflow:auto;background:var(--color-third-bg);border:1px solid var(--color-font-3);box-shadow:0 9px 24px -3px #0000000f,0 4px 8px -1px #0000001f;position:fixed;bottom:11rem;left:14rem}.post-editor-wrapper .emoticon-pack svg[data-v-1638aeb6]{cursor:pointer;position:absolute;right:.8rem;font-size:2.4rem}.post-editor-wrapper .emoticon-pack .list[data-v-1638aeb6]{margin:1rem 0}.post-editor-wrapper .emoticon-pack img[data-v-1638aeb6]{cursor:pointer;width:3rem;height:3rem;padding:.5rem}.post-editor-wrapper .emoticon-pack span[data-v-1638aeb6]{display:inline-block;cursor:pointer;font-size:2.3rem;padding:.5rem}.v-enter-active[data-v-2c9a538c],.v-leave-active[data-v-2c9a538c]{transition:opacity .3s ease}.v-enter-from[data-v-2c9a538c],.v-leave-to[data-v-2c9a538c]{opacity:0}.username[data-v-2c9a538c]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-2c9a538c]{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner[data-v-2c9a538c]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod[data-v-2c9a538c]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag[data-v-2c9a538c]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-2c9a538c]{display:inline}.my-tag .remove[data-v-2c9a538c]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-2c9a538c]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-2c9a538c]{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-2c9a538c]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark[data-v-2c9a538c]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html[data-v-2c9a538c],body[data-v-2c9a538c]{font-size:62.5%}[data-v-2c9a538c]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-2c9a538c]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-2c9a538c]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-2c9a538c]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-2c9a538c]{justify-content:flex-end}.flex-center[data-v-2c9a538c]{justify-content:center}.p1[data-v-2c9a538c]{padding:1rem}.p2[data-v-2c9a538c]{padding:2rem}.p0[data-v-2c9a538c]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-2c9a538c]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-2c9a538c]{text-decoration:none;cursor:pointer}a[data-v-2c9a538c]:hover{text-decoration:underline}.tool[data-v-2c9a538c]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-2c9a538c]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-2c9a538c]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-2c9a538c]{cursor:default}.tool.no-hover[data-v-2c9a538c]:hover{background:unset!important}.tool.disabled[data-v-2c9a538c]{cursor:not-allowed}.tool.disabled[data-v-2c9a538c]:hover{background:unset!important}.my-node[data-v-2c9a538c]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-2c9a538c]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-2c9a538c]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-2c9a538c]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-2c9a538c]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-2c9a538c]{position:fixed;z-index:100;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-2c9a538c]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-2c9a538c]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-2c9a538c]{position:relative}.modal .mask[data-v-2c9a538c]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-2c9a538c]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-2c9a538c]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-2c9a538c]:first-child{border-left:none}.radio-group2 .active[data-v-2c9a538c]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-2c9a538c]{position:relative;display:inline-flex;justify-content:center}input[data-v-2c9a538c]{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-2c9a538c]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-2c9a538c]:focus{border:1px solid var(--color-active)}.danger[data-v-2c9a538c]{color:red!important}.html-wrapper[data-v-2c9a538c]{position:relative}.html-wrapper .mask[data-v-2c9a538c]{max-height:90rem;overflow:hidden;-webkit-mask-image:linear-gradient(180deg,#000 80%,transparent)}.html-wrapper .expand[data-v-2c9a538c]{position:absolute;z-index:1;bottom:2rem;padding:.2rem 1.5rem;border-radius:2rem;border:1px solid gray;background:white;color:gray;left:50%;transform:translate(-50%);cursor:pointer}.comment[data-v-888958af]{width:100%;box-sizing:border-box;margin-top:.6rem}.comment.isLevelOne[data-v-888958af]{border-bottom:1px solid var(--color-line);padding:.8rem 1rem;margin-top:0}.comment.ding[data-v-888958af]{background:rgba(255,255,0,.3)!important}.comment.isSimple .avatar[data-v-888958af],.comment.isSimple .expand-line[data-v-888958af]{display:none}.comment.isSimple .simple-wrapper[data-v-888958af]{padding-left:2.8rem}.comment.isSimple .w[data-v-888958af]{padding-left:0!important;padding-top:.5rem}.comment .comment-content-w .more[data-v-888958af]{text-align:center;margin:2rem 0}.comment .comment-content[data-v-888958af]{display:flex;position:relative}.comment .comment-content .expand-line[data-v-888958af]{cursor:pointer;margin-top:.6rem;width:2.8rem;min-width:2.8rem;position:relative}.comment .comment-content .expand-line[data-v-888958af]:after{position:absolute;left:50%;content:" ";height:100%;width:0;border-right:1px solid var(--color-line)}.comment .comment-content .expand-line[data-v-888958af]:hover:after{border-right:2px solid var(--color-active)}.comment .comment-content .right[data-v-888958af]{flex:1;width:calc(100% - 3rem)}.comment .comment-content .right .w[data-v-888958af]{padding-left:1rem}.comment .comment-content .right .w .post-editor-wrapper[data-v-888958af]{margin-top:1rem}.wrong-wrapper[data-v-888958af]{font-size:1.4rem;margin-bottom:1rem}.wrong-wrapper span[data-v-888958af]{cursor:pointer}.wrong-wrapper .del-line[data-v-888958af]{text-decoration:line-through}.wrong-wrapper .wrong-icon[data-v-888958af]{margin-left:.5rem}.wrong-wrapper .warning[data-v-888958af]{border-top:1px solid #e1e1e1;border-bottom:1px solid #e1e1e1;padding:1rem 0;margin-top:1rem;font-size:1.2rem;color:red}.toolbar[data-v-10da4d66]{border-top:1px solid var(--color-line);height:3.8rem;padding-left:.6rem;display:flex;align-items:center;color:var(--color-gray);font-size:1.2rem;gap:.5rem}.comment[data-v-87050bc7]{width:100%;box-sizing:border-box;display:flex;gap:1rem;padding:1rem;border-bottom:1px solid var(--color-line)}.comment.isSimple .avatar[data-v-87050bc7]{display:none}.comment.isSimple .reply_content[data-v-87050bc7]{margin-top:.5rem!important}.comment .avatar[data-v-87050bc7]{display:flex}.comment .avatar img[data-v-87050bc7]{width:3.8rem;height:3.8rem;border-radius:.3rem}.comment .comment-body[data-v-87050bc7]{flex:1;display:flex;flex-direction:column}.comment .comment-body .texts[data-v-87050bc7]{display:flex;align-items:center}.comment .comment-body .reply_content[data-v-87050bc7]{margin-top:1rem;max-width:calc(100% - 5rem)}.comment .isRight[data-v-87050bc7]{align-items:flex-end}.comment .isRight .owner[data-v-87050bc7],.comment .isRight .mod[data-v-87050bc7],.comment .isRight .username[data-v-87050bc7]{margin:0 0 0 1rem}.comment .Author-right[data-v-87050bc7]{display:flex;flex-direction:column;align-items:center}.comment .Author-right .floor[data-v-87050bc7]{margin-left:0}.comment .Author-right .jump[data-v-87050bc7]{color:#929596;margin-top:.4rem;font-size:1.4rem}.comment .point[data-v-87050bc7]{margin:0 .5rem;font-size:1.6rem;display:flex;gap:.5rem;align-items:center;font-weight:700;color:#000}.sticky{position:sticky;bottom:-2px;z-index:2;background:var(--box-background-hover-color)!important}.sticky[stuck]{box-shadow:0 2px 20px #00000059!important}.v-enter-active[data-v-4b9c84df],.v-leave-active[data-v-4b9c84df]{transition:opacity .3s ease}.v-enter-from[data-v-4b9c84df],.v-leave-to[data-v-4b9c84df]{opacity:0}.username[data-v-4b9c84df]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-4b9c84df]{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner[data-v-4b9c84df]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod[data-v-4b9c84df]{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag[data-v-4b9c84df]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-4b9c84df]{display:inline}.my-tag .remove[data-v-4b9c84df]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-4b9c84df]{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor[data-v-4b9c84df]{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}[data-v-4b9c84df]:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark[data-v-4b9c84df]{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html[data-v-4b9c84df],body[data-v-4b9c84df]{font-size:62.5%}[data-v-4b9c84df]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-4b9c84df]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-4b9c84df]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-4b9c84df]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-4b9c84df]{justify-content:flex-end}.flex-center[data-v-4b9c84df]{justify-content:center}.p1[data-v-4b9c84df]{padding:1rem}.p2[data-v-4b9c84df]{padding:2rem}.p0[data-v-4b9c84df]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-4b9c84df]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a[data-v-4b9c84df]{text-decoration:none;cursor:pointer}a[data-v-4b9c84df]:hover{text-decoration:underline}.tool[data-v-4b9c84df]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-4b9c84df]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-4b9c84df]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-4b9c84df]{cursor:default}.tool.no-hover[data-v-4b9c84df]:hover{background:unset!important}.tool.disabled[data-v-4b9c84df]{cursor:not-allowed}.tool.disabled[data-v-4b9c84df]:hover{background:unset!important}.my-node[data-v-4b9c84df]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-4b9c84df]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-4b9c84df]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-4b9c84df]{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell[data-v-4b9c84df]{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal[data-v-4b9c84df]{position:fixed;z-index:100;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-4b9c84df]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-4b9c84df]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-4b9c84df]{position:relative}.modal .mask[data-v-4b9c84df]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-4b9c84df]{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio[data-v-4b9c84df]{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio[data-v-4b9c84df]:first-child{border-left:none}.radio-group2 .active[data-v-4b9c84df]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-4b9c84df]{position:relative;display:inline-flex;justify-content:center}input[data-v-4b9c84df]{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input[data-v-4b9c84df]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-4b9c84df]:focus{border:1px solid var(--color-active)}.danger[data-v-4b9c84df]{color:red!important}.Post[data-v-4b9c84df]{position:unset!important;background:transparent!important;overflow:unset!important}.Post .main[data-v-4b9c84df]{background:transparent!important;padding:unset!important;width:100%!important}.Post .close-btn[data-v-4b9c84df]{display:none}.post-detail[data-v-4b9c84df]{text-align:start;position:fixed;z-index:99;left:0;right:0;bottom:0;top:0;background:rgba(46,47,48,.8);overflow:auto;font-size:1.4rem;display:flex;justify-content:center;flex-wrap:wrap}.post-detail[data-v-4b9c84df] .subtle{background-color:#ecfdf5e6;border-left:4px solid #a7f3d0}.post-detail.isNight[data-v-4b9c84df] .subtle{background-color:#1a3332;border-left:4px solid #047857}.post-detail .main[data-v-4b9c84df]{display:flex;justify-content:flex-end;padding:3rem 8rem 15rem;background:var(--color-main-bg);position:relative;outline:none}.post-detail .main .main-wrapper[data-v-4b9c84df]{width:77rem;padding-bottom:2rem;display:flex;flex-direction:column;align-items:center;position:relative}.post-detail .main .main-wrapper .post-wrapper .header:hover .add-tag[data-v-4b9c84df]{display:inline-block}.post-detail .main .main-wrapper .loading-wrapper[data-v-4b9c84df]{height:20rem;display:flex;justify-content:center;align-items:center}.post-detail .main .main-wrapper #no-comments-yet[data-v-4b9c84df]{color:#a9a9a9;font-weight:700;text-align:center;width:100%;margin-bottom:2rem;box-sizing:border-box}.post-detail .main .relationReply[data-v-4b9c84df]{position:fixed;width:25vw;top:6.5rem;bottom:15rem;z-index:100;transform:translate(calc(100% + 2rem));font-size:2rem;overflow:hidden}.post-detail .main .relationReply .my-cell[data-v-4b9c84df]{background:var(--color-second-bg);border-radius:var(--box-border-radius) var(--box-border-radius) 0 0}.post-detail .main .relationReply .comments[data-v-4b9c84df]{max-height:calc(100% - 4.2rem);overflow:auto;background:var(--color-second-bg);border-radius:0 0 var(--box-border-radius) var(--box-border-radius)}.post-detail .main .call-list[data-v-4b9c84df]{z-index:9;position:absolute;top:12rem;border:1px solid var(--color-main-bg);background:var(--color-call-list-bg);box-shadow:0 5px 15px #0000001a;overflow:auto;max-height:30rem;border-radius:var(--box-border-radius);min-width:8rem;box-sizing:content-box}.post-detail .main .call-list .call-item[data-v-4b9c84df]{border-top:1px solid var(--color-main-bg);height:3rem;display:flex;padding:0 1rem;align-items:center;cursor:pointer;font-size:14px;box-sizing:border-box}.post-detail .main .call-list .call-item .select[data-v-4b9c84df],.post-detail .main .call-list .call-item[data-v-4b9c84df]:hover,.post-detail .main .call-list .call-item.select[data-v-4b9c84df]{background:var(--color-main-bg);text-decoration:none}.post-detail .main .call-list .call-item[data-v-4b9c84df]:nth-child(1){border-top:1px solid transparent}@media screen and (max-width: 1500px){.post-detail .main-wrapper[data-v-4b9c84df]{width:65vw!important}}@media screen and (max-width: 1280px){.post-detail .main-wrapper[data-v-4b9c84df]{width:75vw!important}}@media screen and (max-width: 960px){.post-detail .main-wrapper[data-v-4b9c84df]{width:100vw!important}}.post-detail .scroll-top[data-v-4b9c84df]{cursor:pointer;position:fixed;border-radius:.6rem;display:flex;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.2rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);color:var(--color-font-3)}.post-detail .scroll-top svg[data-v-4b9c84df]{font-size:2.4rem}.post-detail .refresh[data-v-4b9c84df]{cursor:pointer;position:fixed;border-radius:.6rem;display:flex;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.2rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);color:var(--color-font-3);bottom:23.5rem}.post-detail .refresh svg[data-v-4b9c84df]{font-size:2.4rem}.post-detail .scroll-to[data-v-4b9c84df]{cursor:pointer;position:fixed;border-radius:.6rem;align-items:center;justify-content:center;bottom:10rem;z-index:99;padding:.8rem 0;gap:1rem;width:4.2rem;transform:translate(6rem);font-size:2rem;background:var(--color-sp-btn-bg);color:var(--color-font-3);bottom:15rem;display:flex;flex-direction:column}.post-detail .scroll-to svg[data-v-4b9c84df]{font-size:2.4rem}.post-detail .scroll-to input[data-v-4b9c84df]{height:2.6rem;width:3.6rem;font-size:1.4rem;text-align:center;color:gray}.post-detail .close-btn[data-v-4b9c84df]{color:var(--color-font-3);cursor:pointer;position:fixed;top:3rem;transform:translate(4rem);font-size:1.6rem}.post-detail .top-reply[data-v-4b9c84df]{color:var(--color-font-3);cursor:pointer;font-size:2rem;display:flex}.base64_tooltip[data-v-c50fb66c]{box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background:var(--color-third-bg);min-height:2.2rem;max-width:20rem;padding:1rem;position:fixed;z-index:9998;display:flex;align-items:center;border-radius:.5rem;cursor:pointer;line-break:anywhere;font-size:1.4rem;color:var(--color-font-8)}.base64_tooltip svg[data-v-c50fb66c]{margin-left:1rem;font-size:3rem;color:var(--color-gray)}.base64_tooltip[data-v-c50fb66c] .base-button{margin-left:1rem;margin-top:1rem}.msg[data-v-8bf692ea]{cursor:default;margin-bottom:2rem;display:flex;font-size:1.4rem;box-sizing:border-box;border-radius:var(--box-border-radius);color:var(--color-font-8);background:var(--color-tooltip-bg);box-shadow:0 0 6px 1px var(--color-tooltip-shadow)}.msg.success .left[data-v-8bf692ea]{background:var(--color-active)}.msg.warning .left[data-v-8bf692ea]{background:#c8c002}.msg.error .left[data-v-8bf692ea]{background:red}.msg .left[data-v-8bf692ea]{border-radius:var(--box-border-radius) 0 0 var(--box-border-radius);display:flex;align-items:center;background:var(--color-active);color:#fff;width:3.6rem;font-size:2.4rem;justify-content:center}.msg .left svg[data-v-8bf692ea]{cursor:pointer}.msg .right[data-v-8bf692ea]{flex:1;padding:1rem 2rem;display:flex;justify-content:space-between;align-items:center}.tag-modal .wrapper[data-v-674b86aa]{z-index:9;background:var(--color-main-bg);color:var(--color-font-8);border-radius:1.6rem;font-size:1.4rem;padding:2rem 4rem;width:25rem}.tag-modal .wrapper .title[data-v-674b86aa]{font-weight:700}.tag-modal .wrapper .btns[data-v-674b86aa]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.msgs[data-v-b73f4332]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.tag-modal .modal-root[data-v-882b932b]{z-index:9;background:var(--color-second-bg);color:var(--color-font-8);border-radius:1.6rem;font-size:1.4rem;width:50vw;height:70vh;display:flex;flex-direction:column}.tag-modal .modal-root .modal-header[data-v-882b932b]{padding:2.4rem;display:flex;justify-content:space-between}.tag-modal .modal-root .modal-header .title[data-v-882b932b]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.tag-modal .modal-root .modal-header i[data-v-882b932b]{cursor:pointer;font-size:2.2rem}.tag-modal .modal-root .modal-body[data-v-882b932b]{padding:2rem;padding-top:0;flex:1;overflow:auto}.tag-modal .modal-root .modal-body[data-v-882b932b] .cell{padding:2rem}.v-enter-active,.v-leave-active{transition:opacity .3s ease}.v-enter-from,.v-leave-to{opacity:0}.username{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;margin-right:1rem;transform:scale(.8)}.mod{display:inline-block;background-color:transparent;color:#1484cd;border-radius:.3rem;padding:0 .3rem;cursor:default;border:2px solid #1484cd;font-size:1.2rem;font-weight:700;transform:scale(.8);background:#1484cd;color:#fff;margin-right:1rem}.my-tag{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove{display:inline}.my-tag .remove{cursor:pointer;margin-left:.5rem;display:none}.add-tag{font-size:2.4rem;transform:translateY(.2rem);line-height:1rem;display:inline-block;margin-left:1rem;cursor:pointer;position:absolute;display:none}.floor{margin-left:1rem;font-size:1.1rem;line-height:1rem;border-radius:.5rem;display:inline-block;background-color:var(--color-floor);color:var(--color-floor-font);padding:3px 9px;cursor:default}:root{--color-main-bg: #e2e2e2;--color-second-bg: white;--color-third-bg: #e2e2e2;--color-item-bg: white;--color-swtich-bg: #dcdfe6;--color-active: #409eff;--color-font: #999;--color-font-8: rgba(0, 0, 0, .8);--color-font-3: rgba(0, 0, 0, .3);--color-font-pure: black;--color-input-bg: white;--color-input-border: #e2e2e2;--color-input-border-hover: #a3a6ad;--color-radio-border: #e2e2e2;--color-tooltip-bg: white;--color-tooltip-shadow: #bbbbbb;--color-scrollbar: #93ade3;--color-line: #e2e2e2;--color-loading-1: #00000033;--color-loading-2: #000;--color-floor: #f0f0f0;--color-floor-font: #bdbdbd;--color-editor-toolbar: #f6f7f8;--color-sp-btn-bg: #f1f1f1;--color-call-list-bg: white}html.dark{--color-main-bg: #22303f;--color-second-bg: #18222d;--color-third-bg: #31475e;--color-item-bg: #18222d;--color-swtich-bg: #4c4d4f;--color-active: #409eff;--color-font: rgba(255, 255, 255, .5);--color-font-8: rgba(255, 255, 255, .8);--color-font-3: rgba(255, 255, 255, .3);--color-font-pure: white;--color-input-bg: #333333;--color-input-border: #6c6e72;--color-input-border-hover: #a3a6ad;--color-radio-border: #454847;--color-tooltip-bg: #31475e;--color-tooltip-shadow: #3b3b3b;--color-scrollbar: #5c5d5e;--color-line: var(--box-border-color);--color-loading-1: rgba(178, 177, 177, .2);--color-loading-2: #ffffff;--color-floor: #293b4d;--color-floor-font: rgba(255, 255, 255, .3);--color-editor-toolbar: var(--box-background-hover-color);--color-sp-btn-bg: #31475e;--color-call-list-bg: #31475e}html,body{font-size:62.5%}::-webkit-scrollbar{width:1rem;height:1rem}::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex{display:flex;align-items:center;justify-content:space-between}.flex-end{justify-content:flex-end}.flex-center{justify-content:center}.p1{padding:1rem}.p2{padding:2rem}.p0{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http]{text-underline-offset:.46ex;color:currentcolor;text-decoration:underline 1.5px}a{text-decoration:none;cursor:pointer}a:hover{text-decoration:underline}.tool{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg{width:1.6rem!important;height:1.6rem!important}.tool:hover{background:var(--color-third-bg)}.tool.no-hover{cursor:default}.tool.no-hover:hover{background:unset!important}.tool.disabled{cursor:not-allowed}.tool.disabled:hover{background:unset!important}.my-node{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node:hover{text-decoration:none;background:#e2e2e2}.msgs{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box{box-shadow:0 2px 3px #0000001a;box-shadow:#00000014 0 4px 12px;border-radius:var(--box-border-radius);background:var(--box-background-color);margin-bottom:2rem;width:100%;box-sizing:border-box;transition:background-color .3s}.my-cell{color:var(--color-font);padding:.8rem 1rem;font-size:1.4rem;line-height:150%;text-align:left;border-bottom:1px solid var(--color-line)}.modal{position:fixed;z-index:100;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option{display:flex;align-items:center;padding:.6rem 0}.modal .option>span{position:relative}.modal .mask{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2{display:inline-flex;border-radius:.5rem;overflow:hidden;border:1px solid var(--color-radio-border);background:var(--box-background-alt-color)}.radio-group2 .radio{cursor:pointer;background:transparent;padding:.5rem 1.2rem;border-left:1px solid var(--color-radio-border);font-size:1.3rem;color:var(--color-gray)}.radio-group2 .radio:first-child{border-left:none}.radio-group2 .active{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm{position:relative;display:inline-flex;justify-content:center}input{height:3rem;outline:unset;border:1px solid var(--color-input-border);padding:0 .5rem;border-radius:5px;box-sizing:border-box;transition:all .3s;background:var(--color-input-bg);color:var(--color-font)}input:hover{border:1px solid var(--color-input-border-hover)}input:focus{border:1px solid var(--color-active)}.danger{color:red!important}.target-user-tags[data-v-9cd5c940]{background:var(--color-second-bg);color:var(--color-font);word-break:break-all;text-align:start;font-size:1.4rem;box-shadow:0 2px 3px #0000001a;border-bottom-left-radius:3px;border-bottom-right-radius:3px}.target-user-tags .add-tag[data-v-9cd5c940]{display:inline-block}.loaded[data-v-9cd5c940]{font-size:1.4rem;display:flex;align-items:center;gap:1rem} ');
  7412. console.log("V2EX PC端");
  7413. run();
  7414. let vueApp = vue.createApp(App);
  7415. vueApp.config.unwrapInjectedRef = true;
  7416. vueApp.mount($section);
  7417. }
  7418.  
  7419. })(Vue);

QingJ © 2025

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