V2Next

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

当前为 2024-02-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name V2Next
  3. // @namespace http://tampermonkey.net/
  4. // @version 8.0.9
  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.greasyfork.org/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$l = {
  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$l, [["__scopeId", "data-v-ee672411"]]);
  130. const _sfc_main$k = /* @__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$k, [["__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 functions = {
  150. //获取所有回复
  151. getAllReply(repliesMap = []) {
  152. return repliesMap.sort((a, b) => a.i - b.i).reduce((pre, i) => {
  153. pre = pre.concat(i.replyList);
  154. return pre;
  155. }, []);
  156. },
  157. //查找子回复
  158. findChildren(item, endList, all) {
  159. var _a;
  160. const fn = (child, endList2, parent) => {
  161. child.level = parent.level + 1;
  162. let rIndex = all.findIndex((v) => v.floor === child.floor);
  163. if (rIndex > -1) {
  164. all[rIndex].isUse = true;
  165. }
  166. parent.children.push(this.findChildren(child, endList2, all));
  167. };
  168. item.children = [];
  169. let floorReplyList = [];
  170. for (let i = 0; i < endList.length; i++) {
  171. let currentItem = endList[i];
  172. if (currentItem.isUse)
  173. continue;
  174. if (currentItem.replyFloor === item.floor) {
  175. if (currentItem.replyUsers.length === 1 && currentItem.replyUsers[0] === item.username) {
  176. currentItem.isUse = true;
  177. floorReplyList.push({ endList: endList.slice(i + 1), currentItem });
  178. } else {
  179. currentItem.isWrong = true;
  180. }
  181. }
  182. }
  183. floorReplyList.reverse().map(({ currentItem, endList: endList2 }) => {
  184. fn(currentItem, endList2, item);
  185. });
  186. let nextMeIndex = endList.findIndex((v) => {
  187. var _a2;
  188. return v.username === item.username && ((_a2 = v.replyUsers) == null ? void 0 : _a2[0]) !== item.username;
  189. });
  190. let findList = nextMeIndex > -1 ? endList.slice(0, nextMeIndex) : endList;
  191. for (let i = 0; i < findList.length; i++) {
  192. let currentItem = findList[i];
  193. if (currentItem.isUse)
  194. continue;
  195. if (currentItem.replyUsers.length === 1) {
  196. if (currentItem.replyFloor !== -1) {
  197. if (((_a = all[currentItem.replyFloor - 1]) == null ? void 0 : _a.username) === currentItem.replyUsers[0]) {
  198. continue;
  199. }
  200. }
  201. let endList2 = endList.slice(i + 1);
  202. if (currentItem.username === item.username) {
  203. if (currentItem.replyUsers[0] === item.username) {
  204. fn(currentItem, endList2, item);
  205. }
  206. break;
  207. } else {
  208. if (currentItem.replyUsers[0] === item.username) {
  209. fn(currentItem, endList2, item);
  210. }
  211. }
  212. } else {
  213. if (currentItem.username === item.username)
  214. break;
  215. }
  216. }
  217. item.children = item.children.sort((a, b) => a.floor - b.floor);
  218. return item;
  219. },
  220. //生成嵌套回复
  221. createNestedList(allList = []) {
  222. if (!allList.length)
  223. return [];
  224. let list = window.clone(allList);
  225. let nestedList = [];
  226. list.map((item, index) => {
  227. let startList = list.slice(0, index);
  228. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  229. let endList = list.slice(index + 1);
  230. if (index === 0) {
  231. nestedList.push(this.findChildren(item, endList, list));
  232. } else {
  233. if (!item.isUse) {
  234. let isOneLevelReply = false;
  235. if (item.replyUsers.length) {
  236. if (item.replyUsers.length > 1) {
  237. isOneLevelReply = true;
  238. } else {
  239. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  240. }
  241. } else {
  242. isOneLevelReply = true;
  243. }
  244. if (isOneLevelReply) {
  245. item.level = 0;
  246. nestedList.push(this.findChildren(item, endList, list));
  247. }
  248. }
  249. }
  250. });
  251. return nestedList;
  252. },
  253. //生成嵌套冗余回复
  254. createNestedRedundantList(allList = []) {
  255. if (!allList.length)
  256. return [];
  257. let list = window.clone(allList);
  258. let nestedList = [];
  259. list.map((item, index) => {
  260. let startList = list.slice(0, index);
  261. let startReplyUsers = Array.from(new Set(startList.map((v) => v.username)));
  262. let endList = list.slice(index + 1);
  263. if (index === 0) {
  264. nestedList.push(this.findChildren(item, endList, list));
  265. } else {
  266. if (!item.isUse) {
  267. let isOneLevelReply = false;
  268. if (item.replyUsers.length) {
  269. if (item.replyUsers.length > 1) {
  270. isOneLevelReply = true;
  271. } else {
  272. isOneLevelReply = !startReplyUsers.find((v) => v === item.replyUsers[0]);
  273. }
  274. } else {
  275. isOneLevelReply = true;
  276. }
  277. if (isOneLevelReply) {
  278. item.level = 0;
  279. nestedList.push(this.findChildren(item, endList, list));
  280. }
  281. } else {
  282. let newItem = window.clone(item);
  283. newItem.children = [];
  284. newItem.level = 0;
  285. newItem.isDup = true;
  286. nestedList.push(newItem);
  287. }
  288. }
  289. });
  290. return nestedList;
  291. },
  292. //解析A标签
  293. parseA(a) {
  294. let href = a.href;
  295. let id;
  296. if (href.includes("/t/")) {
  297. id = a.pathname.substring("/t/".length);
  298. }
  299. return { href, id, title: a.innerText };
  300. },
  301. //图片链接转Img标签
  302. checkPhotoLink2Img(str) {
  303. if (!str)
  304. return;
  305. try {
  306. let imgWebs = [
  307. /<a((?!<a).)*href="https?:\/\/((?!<a).)*imgur.com((?!<a).)*>(((?!<a).)*)<\/a>/g,
  308. /<a((?!<a).)*href="https?:\/\/((?!<a).)*\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG) ((?!<a).)*>(((?!<a).)*)<\/a>/g
  309. ];
  310. imgWebs.map((v, i) => {
  311. let has = str.matchAll(v);
  312. let res2 = [...has];
  313. res2.map((r2) => {
  314. let p = i === 0 ? r2[4] : r2[5];
  315. if (p) {
  316. let link = p.toLowerCase();
  317. let src = p;
  318. if (link.includes(".png") || link.includes(".jpg") || link.includes(".jpeg") || link.includes(".gif")) {
  319. } else {
  320. src = p + ".png";
  321. }
  322. str = str.replace(r2[0], `<img src="${src}" data-originUrl="${p}" data-notice="此img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`);
  323. }
  324. });
  325. });
  326. } catch (e2) {
  327. console.log("正则解析html里面的a标签的图片链接出错了");
  328. }
  329. return str;
  330. },
  331. //检测帖子回复长度
  332. async checkPostReplies(id, needOpen = true) {
  333. return new Promise(async (resolve) => {
  334. let res = await functions.getPostDetailByApi(id);
  335. if ((res == null ? void 0 : res.replies) > MAX_REPLY_LIMIT) {
  336. if (needOpen) {
  337. functions.openNewTab(`https://${location.origin}/t/${id}?p=1&script=1`);
  338. }
  339. return resolve(true);
  340. }
  341. resolve(false);
  342. });
  343. },
  344. async sleep(time) {
  345. return new Promise((resolve) => {
  346. setTimeout(resolve, time);
  347. });
  348. },
  349. //打开新标签页
  350. openNewTab(href, active = false) {
  351. _GM_openInTab(href, { active });
  352. },
  353. async cbChecker(val, count = 0) {
  354. if (window.cb) {
  355. window.cb(val);
  356. } else {
  357. while (!window.cb && count < 30) {
  358. await functions.sleep(500);
  359. count++;
  360. }
  361. window.cb && window.cb(val);
  362. }
  363. },
  364. //初始化脚本菜单
  365. initMonkeyMenu() {
  366. try {
  367. _GM_registerMenuCommand("脚本设置", () => {
  368. functions.cbChecker({ type: "openSetting" });
  369. });
  370. _GM_registerMenuCommand("仓库地址", () => {
  371. functions.openNewTab(window.const.git);
  372. });
  373. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  374. } catch (e2) {
  375. console.error("无法使用Tampermonkey");
  376. }
  377. },
  378. clone(val) {
  379. return JSON.parse(JSON.stringify(val));
  380. },
  381. feedback() {
  382. functions.openNewTab(DefaultVal.issue);
  383. },
  384. //检测页面类型
  385. checkPageType() {
  386. let l = window.location;
  387. if (l.pathname === "/") {
  388. window.pageType = PageType.Home;
  389. } else if (l.pathname === "/changes") {
  390. window.pageType = PageType.Changes;
  391. } else if (l.pathname === "/recent") {
  392. window.pageType = PageType.Changes;
  393. } else if (l.href.match(/.com\/?tab=/)) {
  394. window.pageType = PageType.Home;
  395. } else if (l.href.match(/.com\/go\//)) {
  396. if (!l.href.includes("/links")) {
  397. window.pageType = PageType.Node;
  398. }
  399. } else if (l.href.match(/.com\/member/)) {
  400. window.pageType = PageType.Member;
  401. } else {
  402. let r2 = l.href.match(/.com\/t\/([\d]+)/);
  403. if (r2 && !location.pathname.includes("review") && !location.pathname.includes("info")) {
  404. window.pageType = PageType.Post;
  405. window.pageData.id = r2[1];
  406. if (l.search) {
  407. let pr = l.href.match(/\?p=([\d]+)/);
  408. if (pr)
  409. window.pageData.pageNo = Number(pr[1]);
  410. }
  411. }
  412. }
  413. },
  414. //通过api获取主题详情
  415. getPostDetailByApi(id) {
  416. return new Promise((resolve) => {
  417. fetch(`${location.origin}/api/topics/show.json?id=${id}`).then(async (r2) => {
  418. if (r2.status === 200) {
  419. let res = await r2.json();
  420. if (res) {
  421. let d2 = res[0];
  422. resolve(d2);
  423. }
  424. }
  425. });
  426. });
  427. },
  428. appendPostContent(res, el) {
  429. let a = document.createElement("a");
  430. a.href = res.href;
  431. a.classList.add("post-content");
  432. let div = document.createElement("div");
  433. div.innerHTML = res.content_rendered;
  434. a.append(div);
  435. el.append(a);
  436. const checkHeight2 = () => {
  437. var _a;
  438. if (div.clientHeight < 300) {
  439. a.classList.add("show-all");
  440. } else {
  441. let showMore = document.createElement("div");
  442. showMore.classList.add("show-more");
  443. showMore.innerHTML = "显示更多/收起";
  444. showMore.onclick = function(e2) {
  445. e2.stopPropagation();
  446. a.classList.toggle("show-all");
  447. };
  448. (_a = a.parentNode) == null ? void 0 : _a.append(showMore);
  449. }
  450. };
  451. checkHeight2();
  452. },
  453. //从本地读取配置
  454. initConfig() {
  455. return new Promise((resolve) => {
  456. let configStr = localStorage.getItem("v2ex-config");
  457. if (configStr) {
  458. let configObj = JSON.parse(configStr);
  459. configObj = configObj[window.user.username ?? "default"];
  460. if (configObj) {
  461. window.config = Object.assign(window.config, configObj);
  462. }
  463. }
  464. resolve(window.config);
  465. });
  466. }
  467. };
  468. const DefaultPost = {
  469. allReplyUsers: [],
  470. content_rendered: "",
  471. createDate: "",
  472. createDateAgo: "",
  473. fr: "",
  474. replyList: [],
  475. nestedReplies: [],
  476. nestedRedundReplies: [],
  477. username: "",
  478. url: "",
  479. href: "",
  480. member: {},
  481. node: {
  482. title: "",
  483. url: ""
  484. },
  485. headerTemplate: "",
  486. title: "",
  487. id: "",
  488. type: "post",
  489. once: "",
  490. replyCount: 0,
  491. clickCount: 0,
  492. thankCount: 0,
  493. collectCount: 0,
  494. lastReadFloor: 0,
  495. isFavorite: false,
  496. isIgnore: false,
  497. isThanked: false,
  498. isReport: false,
  499. inList: false
  500. };
  501. const getDefaultPost = (val = {}) => {
  502. return Object.assign(functions.clone(DefaultPost), val);
  503. };
  504. const DefaultUser = {
  505. tagPrefix: "--用户标签--",
  506. tags: {},
  507. tagsId: "",
  508. username: "",
  509. avatar: "",
  510. readPrefix: "--已读楼层--",
  511. readNoteItemId: "",
  512. readList: {},
  513. imgurPrefix: "--imgur图片删除hash--",
  514. imgurList: {},
  515. imgurNoteId: ""
  516. };
  517. const DefaultConfig = {
  518. showToolbar: true,
  519. autoOpenDetail: true,
  520. openTag: false,
  521. //给用户打标签
  522. clickPostItemOpenDetail: true,
  523. closePostDetailBySpace: true,
  524. //点击空白处关闭详情
  525. contentAutoCollapse: true,
  526. //正文超长自动折叠
  527. viewType: "table",
  528. commentDisplayType: CommentDisplayType.FloorInFloorNoCallUser,
  529. newTabOpen: false,
  530. //新标签打开
  531. newTabOpenActive: false,
  532. base64: true,
  533. //base功能
  534. sov2ex: false,
  535. postWidth: "",
  536. showTopReply: true,
  537. topReplyLoveMinCount: 3,
  538. topReplyCount: 3,
  539. autoJumpLastReadFloor: false,
  540. rememberLastReadFloor: false,
  541. autoSignin: true,
  542. customBgColor: "",
  543. version: 1,
  544. collectBrowserNotice: false,
  545. fontSizeType: "normal"
  546. };
  547. const DefaultVal = {
  548. pageType: void 0,
  549. pageData: { pageNo: 1 },
  550. targetUserName: "",
  551. currentVersion: 1,
  552. isNight: false,
  553. cb: null,
  554. stopMe: null,
  555. postList: [],
  556. git: "https://github.com/zyronon/web-scripts",
  557. shortGit: "zyronon/web-scripts",
  558. issue: "https://github.com/zyronon/web-scripts/issues",
  559. pcLog: "https://greasyfork.org/zh-CN/scripts/458024/versions",
  560. pcScript: "https://greasyfork.org/zh-CN/scripts/458024",
  561. mobileScript: "https://greasyfork.org/zh-CN/scripts/485356",
  562. homeUrl: "https://v2next.netlify.app/"
  563. };
  564. const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
  565. const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
  566. const colonSeparated = value.split(":");
  567. if (value.slice(0, 1) === "@") {
  568. if (colonSeparated.length < 2 || colonSeparated.length > 3) {
  569. return null;
  570. }
  571. provider = colonSeparated.shift().slice(1);
  572. }
  573. if (colonSeparated.length > 3 || !colonSeparated.length) {
  574. return null;
  575. }
  576. if (colonSeparated.length > 1) {
  577. const name2 = colonSeparated.pop();
  578. const prefix = colonSeparated.pop();
  579. const result = {
  580. // Allow provider without '@': "provider:prefix:name"
  581. provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
  582. prefix,
  583. name: name2
  584. };
  585. return validate && !validateIconName(result) ? null : result;
  586. }
  587. const name = colonSeparated[0];
  588. const dashSeparated = name.split("-");
  589. if (dashSeparated.length > 1) {
  590. const result = {
  591. provider,
  592. prefix: dashSeparated.shift(),
  593. name: dashSeparated.join("-")
  594. };
  595. return validate && !validateIconName(result) ? null : result;
  596. }
  597. if (allowSimpleName && provider === "") {
  598. const result = {
  599. provider,
  600. prefix: "",
  601. name
  602. };
  603. return validate && !validateIconName(result, allowSimpleName) ? null : result;
  604. }
  605. return null;
  606. };
  607. const validateIconName = (icon, allowSimpleName) => {
  608. if (!icon) {
  609. return false;
  610. }
  611. return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
  612. };
  613. const defaultIconDimensions = Object.freeze(
  614. {
  615. left: 0,
  616. top: 0,
  617. width: 16,
  618. height: 16
  619. }
  620. );
  621. const defaultIconTransformations = Object.freeze({
  622. rotate: 0,
  623. vFlip: false,
  624. hFlip: false
  625. });
  626. const defaultIconProps = Object.freeze({
  627. ...defaultIconDimensions,
  628. ...defaultIconTransformations
  629. });
  630. const defaultExtendedIconProps = Object.freeze({
  631. ...defaultIconProps,
  632. body: "",
  633. hidden: false
  634. });
  635. function mergeIconTransformations(obj1, obj2) {
  636. const result = {};
  637. if (!obj1.hFlip !== !obj2.hFlip) {
  638. result.hFlip = true;
  639. }
  640. if (!obj1.vFlip !== !obj2.vFlip) {
  641. result.vFlip = true;
  642. }
  643. const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
  644. if (rotate) {
  645. result.rotate = rotate;
  646. }
  647. return result;
  648. }
  649. function mergeIconData(parent, child) {
  650. const result = mergeIconTransformations(parent, child);
  651. for (const key in defaultExtendedIconProps) {
  652. if (key in defaultIconTransformations) {
  653. if (key in parent && !(key in result)) {
  654. result[key] = defaultIconTransformations[key];
  655. }
  656. } else if (key in child) {
  657. result[key] = child[key];
  658. } else if (key in parent) {
  659. result[key] = parent[key];
  660. }
  661. }
  662. return result;
  663. }
  664. function getIconsTree(data, names) {
  665. const icons = data.icons;
  666. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  667. const resolved = /* @__PURE__ */ Object.create(null);
  668. function resolve(name) {
  669. if (icons[name]) {
  670. return resolved[name] = [];
  671. }
  672. if (!(name in resolved)) {
  673. resolved[name] = null;
  674. const parent = aliases[name] && aliases[name].parent;
  675. const value = parent && resolve(parent);
  676. if (value) {
  677. resolved[name] = [parent].concat(value);
  678. }
  679. }
  680. return resolved[name];
  681. }
  682. (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
  683. return resolved;
  684. }
  685. function internalGetIconData(data, name, tree) {
  686. const icons = data.icons;
  687. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  688. let currentProps = {};
  689. function parse(name2) {
  690. currentProps = mergeIconData(
  691. icons[name2] || aliases[name2],
  692. currentProps
  693. );
  694. }
  695. parse(name);
  696. tree.forEach(parse);
  697. return mergeIconData(data, currentProps);
  698. }
  699. function parseIconSet(data, callback) {
  700. const names = [];
  701. if (typeof data !== "object" || typeof data.icons !== "object") {
  702. return names;
  703. }
  704. if (data.not_found instanceof Array) {
  705. data.not_found.forEach((name) => {
  706. callback(name, null);
  707. names.push(name);
  708. });
  709. }
  710. const tree = getIconsTree(data);
  711. for (const name in tree) {
  712. const item = tree[name];
  713. if (item) {
  714. callback(name, internalGetIconData(data, name, item));
  715. names.push(name);
  716. }
  717. }
  718. return names;
  719. }
  720. const optionalPropertyDefaults = {
  721. provider: "",
  722. aliases: {},
  723. not_found: {},
  724. ...defaultIconDimensions
  725. };
  726. function checkOptionalProps(item, defaults) {
  727. for (const prop in defaults) {
  728. if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
  729. return false;
  730. }
  731. }
  732. return true;
  733. }
  734. function quicklyValidateIconSet(obj) {
  735. if (typeof obj !== "object" || obj === null) {
  736. return null;
  737. }
  738. const data = obj;
  739. if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
  740. return null;
  741. }
  742. if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
  743. return null;
  744. }
  745. const icons = data.icons;
  746. for (const name in icons) {
  747. const icon = icons[name];
  748. if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
  749. icon,
  750. defaultExtendedIconProps
  751. )) {
  752. return null;
  753. }
  754. }
  755. const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
  756. for (const name in aliases) {
  757. const icon = aliases[name];
  758. const parent = icon.parent;
  759. if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
  760. icon,
  761. defaultExtendedIconProps
  762. )) {
  763. return null;
  764. }
  765. }
  766. return data;
  767. }
  768. const dataStorage = /* @__PURE__ */ Object.create(null);
  769. function newStorage(provider, prefix) {
  770. return {
  771. provider,
  772. prefix,
  773. icons: /* @__PURE__ */ Object.create(null),
  774. missing: /* @__PURE__ */ new Set()
  775. };
  776. }
  777. function getStorage(provider, prefix) {
  778. const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
  779. return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
  780. }
  781. function addIconSet(storage2, data) {
  782. if (!quicklyValidateIconSet(data)) {
  783. return [];
  784. }
  785. return parseIconSet(data, (name, icon) => {
  786. if (icon) {
  787. storage2.icons[name] = icon;
  788. } else {
  789. storage2.missing.add(name);
  790. }
  791. });
  792. }
  793. function addIconToStorage(storage2, name, icon) {
  794. try {
  795. if (typeof icon.body === "string") {
  796. storage2.icons[name] = { ...icon };
  797. return true;
  798. }
  799. } catch (err) {
  800. }
  801. return false;
  802. }
  803. let simpleNames = false;
  804. function allowSimpleNames(allow) {
  805. if (typeof allow === "boolean") {
  806. simpleNames = allow;
  807. }
  808. return simpleNames;
  809. }
  810. function getIconData(name) {
  811. const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
  812. if (icon) {
  813. const storage2 = getStorage(icon.provider, icon.prefix);
  814. const iconName = icon.name;
  815. return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
  816. }
  817. }
  818. function addIcon(name, data) {
  819. const icon = stringToIcon(name, true, simpleNames);
  820. if (!icon) {
  821. return false;
  822. }
  823. const storage2 = getStorage(icon.provider, icon.prefix);
  824. return addIconToStorage(storage2, icon.name, data);
  825. }
  826. function addCollection(data, provider) {
  827. if (typeof data !== "object") {
  828. return false;
  829. }
  830. if (typeof provider !== "string") {
  831. provider = data.provider || "";
  832. }
  833. if (simpleNames && !provider && !data.prefix) {
  834. let added = false;
  835. if (quicklyValidateIconSet(data)) {
  836. data.prefix = "";
  837. parseIconSet(data, (name, icon) => {
  838. if (icon && addIcon(name, icon)) {
  839. added = true;
  840. }
  841. });
  842. }
  843. return added;
  844. }
  845. const prefix = data.prefix;
  846. if (!validateIconName({
  847. provider,
  848. prefix,
  849. name: "a"
  850. })) {
  851. return false;
  852. }
  853. const storage2 = getStorage(provider, prefix);
  854. return !!addIconSet(storage2, data);
  855. }
  856. const defaultIconSizeCustomisations = Object.freeze({
  857. width: null,
  858. height: null
  859. });
  860. const defaultIconCustomisations = Object.freeze({
  861. // Dimensions
  862. ...defaultIconSizeCustomisations,
  863. // Transformations
  864. ...defaultIconTransformations
  865. });
  866. const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
  867. const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
  868. function calculateSize(size, ratio, precision) {
  869. if (ratio === 1) {
  870. return size;
  871. }
  872. precision = precision || 100;
  873. if (typeof size === "number") {
  874. return Math.ceil(size * ratio * precision) / precision;
  875. }
  876. if (typeof size !== "string") {
  877. return size;
  878. }
  879. const oldParts = size.split(unitsSplit);
  880. if (oldParts === null || !oldParts.length) {
  881. return size;
  882. }
  883. const newParts = [];
  884. let code = oldParts.shift();
  885. let isNumber = unitsTest.test(code);
  886. while (true) {
  887. if (isNumber) {
  888. const num = parseFloat(code);
  889. if (isNaN(num)) {
  890. newParts.push(code);
  891. } else {
  892. newParts.push(Math.ceil(num * ratio * precision) / precision);
  893. }
  894. } else {
  895. newParts.push(code);
  896. }
  897. code = oldParts.shift();
  898. if (code === void 0) {
  899. return newParts.join("");
  900. }
  901. isNumber = !isNumber;
  902. }
  903. }
  904. const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
  905. function iconToSVG(icon, customisations) {
  906. const fullIcon = {
  907. ...defaultIconProps,
  908. ...icon
  909. };
  910. const fullCustomisations = {
  911. ...defaultIconCustomisations,
  912. ...customisations
  913. };
  914. const box = {
  915. left: fullIcon.left,
  916. top: fullIcon.top,
  917. width: fullIcon.width,
  918. height: fullIcon.height
  919. };
  920. let body = fullIcon.body;
  921. [fullIcon, fullCustomisations].forEach((props) => {
  922. const transformations = [];
  923. const hFlip = props.hFlip;
  924. const vFlip = props.vFlip;
  925. let rotation = props.rotate;
  926. if (hFlip) {
  927. if (vFlip) {
  928. rotation += 2;
  929. } else {
  930. transformations.push(
  931. "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
  932. );
  933. transformations.push("scale(-1 1)");
  934. box.top = box.left = 0;
  935. }
  936. } else if (vFlip) {
  937. transformations.push(
  938. "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
  939. );
  940. transformations.push("scale(1 -1)");
  941. box.top = box.left = 0;
  942. }
  943. let tempValue;
  944. if (rotation < 0) {
  945. rotation -= Math.floor(rotation / 4) * 4;
  946. }
  947. rotation = rotation % 4;
  948. switch (rotation) {
  949. case 1:
  950. tempValue = box.height / 2 + box.top;
  951. transformations.unshift(
  952. "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  953. );
  954. break;
  955. case 2:
  956. transformations.unshift(
  957. "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
  958. );
  959. break;
  960. case 3:
  961. tempValue = box.width / 2 + box.left;
  962. transformations.unshift(
  963. "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
  964. );
  965. break;
  966. }
  967. if (rotation % 2 === 1) {
  968. if (box.left !== box.top) {
  969. tempValue = box.left;
  970. box.left = box.top;
  971. box.top = tempValue;
  972. }
  973. if (box.width !== box.height) {
  974. tempValue = box.width;
  975. box.width = box.height;
  976. box.height = tempValue;
  977. }
  978. }
  979. if (transformations.length) {
  980. body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
  981. }
  982. });
  983. const customisationsWidth = fullCustomisations.width;
  984. const customisationsHeight = fullCustomisations.height;
  985. const boxWidth = box.width;
  986. const boxHeight = box.height;
  987. let width;
  988. let height;
  989. if (customisationsWidth === null) {
  990. height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  991. width = calculateSize(height, boxWidth / boxHeight);
  992. } else {
  993. width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
  994. height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
  995. }
  996. const attributes = {};
  997. const setAttr = (prop, value) => {
  998. if (!isUnsetKeyword(value)) {
  999. attributes[prop] = value.toString();
  1000. }
  1001. };
  1002. setAttr("width", width);
  1003. setAttr("height", height);
  1004. attributes.viewBox = box.left.toString() + " " + box.top.toString() + " " + boxWidth.toString() + " " + boxHeight.toString();
  1005. return {
  1006. attributes,
  1007. body
  1008. };
  1009. }
  1010. const regex = /\sid="(\S+)"/g;
  1011. const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
  1012. let counter = 0;
  1013. function replaceIDs(body, prefix = randomPrefix) {
  1014. const ids = [];
  1015. let match;
  1016. while (match = regex.exec(body)) {
  1017. ids.push(match[1]);
  1018. }
  1019. if (!ids.length) {
  1020. return body;
  1021. }
  1022. const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  1023. ids.forEach((id) => {
  1024. const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
  1025. const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  1026. body = body.replace(
  1027. // Allowed characters before id: [#;"]
  1028. // Allowed characters after id: [)"], .[a-z]
  1029. new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
  1030. "$1" + newID + suffix + "$3"
  1031. );
  1032. });
  1033. body = body.replace(new RegExp(suffix, "g"), "");
  1034. return body;
  1035. }
  1036. const storage = /* @__PURE__ */ Object.create(null);
  1037. function setAPIModule(provider, item) {
  1038. storage[provider] = item;
  1039. }
  1040. function getAPIModule(provider) {
  1041. return storage[provider] || storage[""];
  1042. }
  1043. function createAPIConfig(source) {
  1044. let resources;
  1045. if (typeof source.resources === "string") {
  1046. resources = [source.resources];
  1047. } else {
  1048. resources = source.resources;
  1049. if (!(resources instanceof Array) || !resources.length) {
  1050. return null;
  1051. }
  1052. }
  1053. const result = {
  1054. // API hosts
  1055. resources,
  1056. // Root path
  1057. path: source.path || "/",
  1058. // URL length limit
  1059. maxURL: source.maxURL || 500,
  1060. // Timeout before next host is used.
  1061. rotate: source.rotate || 750,
  1062. // Timeout before failing query.
  1063. timeout: source.timeout || 5e3,
  1064. // Randomise default API end point.
  1065. random: source.random === true,
  1066. // Start index
  1067. index: source.index || 0,
  1068. // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
  1069. dataAfterTimeout: source.dataAfterTimeout !== false
  1070. };
  1071. return result;
  1072. }
  1073. const configStorage = /* @__PURE__ */ Object.create(null);
  1074. const fallBackAPISources = [
  1075. "https://api.simplesvg.com",
  1076. "https://api.unisvg.com"
  1077. ];
  1078. const fallBackAPI = [];
  1079. while (fallBackAPISources.length > 0) {
  1080. if (fallBackAPISources.length === 1) {
  1081. fallBackAPI.push(fallBackAPISources.shift());
  1082. } else {
  1083. if (Math.random() > 0.5) {
  1084. fallBackAPI.push(fallBackAPISources.shift());
  1085. } else {
  1086. fallBackAPI.push(fallBackAPISources.pop());
  1087. }
  1088. }
  1089. }
  1090. configStorage[""] = createAPIConfig({
  1091. resources: ["https://api.iconify.design"].concat(fallBackAPI)
  1092. });
  1093. function addAPIProvider(provider, customConfig) {
  1094. const config2 = createAPIConfig(customConfig);
  1095. if (config2 === null) {
  1096. return false;
  1097. }
  1098. configStorage[provider] = config2;
  1099. return true;
  1100. }
  1101. function getAPIConfig(provider) {
  1102. return configStorage[provider];
  1103. }
  1104. const detectFetch = () => {
  1105. let callback;
  1106. try {
  1107. callback = fetch;
  1108. if (typeof callback === "function") {
  1109. return callback;
  1110. }
  1111. } catch (err) {
  1112. }
  1113. };
  1114. let fetchModule = detectFetch();
  1115. function calculateMaxLength(provider, prefix) {
  1116. const config2 = getAPIConfig(provider);
  1117. if (!config2) {
  1118. return 0;
  1119. }
  1120. let result;
  1121. if (!config2.maxURL) {
  1122. result = 0;
  1123. } else {
  1124. let maxHostLength = 0;
  1125. config2.resources.forEach((item) => {
  1126. const host = item;
  1127. maxHostLength = Math.max(maxHostLength, host.length);
  1128. });
  1129. const url = prefix + ".json?icons=";
  1130. result = config2.maxURL - maxHostLength - config2.path.length - url.length;
  1131. }
  1132. return result;
  1133. }
  1134. function shouldAbort(status) {
  1135. return status === 404;
  1136. }
  1137. const prepare = (provider, prefix, icons) => {
  1138. const results = [];
  1139. const maxLength = calculateMaxLength(provider, prefix);
  1140. const type = "icons";
  1141. let item = {
  1142. type,
  1143. provider,
  1144. prefix,
  1145. icons: []
  1146. };
  1147. let length = 0;
  1148. icons.forEach((name, index) => {
  1149. length += name.length + 1;
  1150. if (length >= maxLength && index > 0) {
  1151. results.push(item);
  1152. item = {
  1153. type,
  1154. provider,
  1155. prefix,
  1156. icons: []
  1157. };
  1158. length = name.length;
  1159. }
  1160. item.icons.push(name);
  1161. });
  1162. results.push(item);
  1163. return results;
  1164. };
  1165. function getPath(provider) {
  1166. if (typeof provider === "string") {
  1167. const config2 = getAPIConfig(provider);
  1168. if (config2) {
  1169. return config2.path;
  1170. }
  1171. }
  1172. return "/";
  1173. }
  1174. const send = (host, params, callback) => {
  1175. if (!fetchModule) {
  1176. callback("abort", 424);
  1177. return;
  1178. }
  1179. let path = getPath(params.provider);
  1180. switch (params.type) {
  1181. case "icons": {
  1182. const prefix = params.prefix;
  1183. const icons = params.icons;
  1184. const iconsList = icons.join(",");
  1185. const urlParams = new URLSearchParams({
  1186. icons: iconsList
  1187. });
  1188. path += prefix + ".json?" + urlParams.toString();
  1189. break;
  1190. }
  1191. case "custom": {
  1192. const uri = params.uri;
  1193. path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
  1194. break;
  1195. }
  1196. default:
  1197. callback("abort", 400);
  1198. return;
  1199. }
  1200. let defaultError = 503;
  1201. fetchModule(host + path).then((response) => {
  1202. const status = response.status;
  1203. if (status !== 200) {
  1204. setTimeout(() => {
  1205. callback(shouldAbort(status) ? "abort" : "next", status);
  1206. });
  1207. return;
  1208. }
  1209. defaultError = 501;
  1210. return response.json();
  1211. }).then((data) => {
  1212. if (typeof data !== "object" || data === null) {
  1213. setTimeout(() => {
  1214. if (data === 404) {
  1215. callback("abort", data);
  1216. } else {
  1217. callback("next", defaultError);
  1218. }
  1219. });
  1220. return;
  1221. }
  1222. setTimeout(() => {
  1223. callback("success", data);
  1224. });
  1225. }).catch(() => {
  1226. callback("next", defaultError);
  1227. });
  1228. };
  1229. const fetchAPIModule = {
  1230. prepare,
  1231. send
  1232. };
  1233. function sortIcons(icons) {
  1234. const result = {
  1235. loaded: [],
  1236. missing: [],
  1237. pending: []
  1238. };
  1239. const storage2 = /* @__PURE__ */ Object.create(null);
  1240. icons.sort((a, b) => {
  1241. if (a.provider !== b.provider) {
  1242. return a.provider.localeCompare(b.provider);
  1243. }
  1244. if (a.prefix !== b.prefix) {
  1245. return a.prefix.localeCompare(b.prefix);
  1246. }
  1247. return a.name.localeCompare(b.name);
  1248. });
  1249. let lastIcon = {
  1250. provider: "",
  1251. prefix: "",
  1252. name: ""
  1253. };
  1254. icons.forEach((icon) => {
  1255. if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
  1256. return;
  1257. }
  1258. lastIcon = icon;
  1259. const provider = icon.provider;
  1260. const prefix = icon.prefix;
  1261. const name = icon.name;
  1262. const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
  1263. const localStorage2 = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
  1264. let list;
  1265. if (name in localStorage2.icons) {
  1266. list = result.loaded;
  1267. } else if (prefix === "" || localStorage2.missing.has(name)) {
  1268. list = result.missing;
  1269. } else {
  1270. list = result.pending;
  1271. }
  1272. const item = {
  1273. provider,
  1274. prefix,
  1275. name
  1276. };
  1277. list.push(item);
  1278. });
  1279. return result;
  1280. }
  1281. function removeCallback(storages, id) {
  1282. storages.forEach((storage2) => {
  1283. const items = storage2.loaderCallbacks;
  1284. if (items) {
  1285. storage2.loaderCallbacks = items.filter((row) => row.id !== id);
  1286. }
  1287. });
  1288. }
  1289. function updateCallbacks(storage2) {
  1290. if (!storage2.pendingCallbacksFlag) {
  1291. storage2.pendingCallbacksFlag = true;
  1292. setTimeout(() => {
  1293. storage2.pendingCallbacksFlag = false;
  1294. const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
  1295. if (!items.length) {
  1296. return;
  1297. }
  1298. let hasPending = false;
  1299. const provider = storage2.provider;
  1300. const prefix = storage2.prefix;
  1301. items.forEach((item) => {
  1302. const icons = item.icons;
  1303. const oldLength = icons.pending.length;
  1304. icons.pending = icons.pending.filter((icon) => {
  1305. if (icon.prefix !== prefix) {
  1306. return true;
  1307. }
  1308. const name = icon.name;
  1309. if (storage2.icons[name]) {
  1310. icons.loaded.push({
  1311. provider,
  1312. prefix,
  1313. name
  1314. });
  1315. } else if (storage2.missing.has(name)) {
  1316. icons.missing.push({
  1317. provider,
  1318. prefix,
  1319. name
  1320. });
  1321. } else {
  1322. hasPending = true;
  1323. return true;
  1324. }
  1325. return false;
  1326. });
  1327. if (icons.pending.length !== oldLength) {
  1328. if (!hasPending) {
  1329. removeCallback([storage2], item.id);
  1330. }
  1331. item.callback(
  1332. icons.loaded.slice(0),
  1333. icons.missing.slice(0),
  1334. icons.pending.slice(0),
  1335. item.abort
  1336. );
  1337. }
  1338. });
  1339. });
  1340. }
  1341. }
  1342. let idCounter = 0;
  1343. function storeCallback(callback, icons, pendingSources) {
  1344. const id = idCounter++;
  1345. const abort = removeCallback.bind(null, pendingSources, id);
  1346. if (!icons.pending.length) {
  1347. return abort;
  1348. }
  1349. const item = {
  1350. id,
  1351. icons,
  1352. callback,
  1353. abort
  1354. };
  1355. pendingSources.forEach((storage2) => {
  1356. (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
  1357. });
  1358. return abort;
  1359. }
  1360. function listToIcons(list, validate = true, simpleNames2 = false) {
  1361. const result = [];
  1362. list.forEach((item) => {
  1363. const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
  1364. if (icon) {
  1365. result.push(icon);
  1366. }
  1367. });
  1368. return result;
  1369. }
  1370. var defaultConfig = {
  1371. resources: [],
  1372. index: 0,
  1373. timeout: 2e3,
  1374. rotate: 750,
  1375. random: false,
  1376. dataAfterTimeout: false
  1377. };
  1378. function sendQuery(config2, payload, query, done) {
  1379. const resourcesCount = config2.resources.length;
  1380. const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
  1381. let resources;
  1382. if (config2.random) {
  1383. let list = config2.resources.slice(0);
  1384. resources = [];
  1385. while (list.length > 1) {
  1386. const nextIndex = Math.floor(Math.random() * list.length);
  1387. resources.push(list[nextIndex]);
  1388. list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
  1389. }
  1390. resources = resources.concat(list);
  1391. } else {
  1392. resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
  1393. }
  1394. const startTime = Date.now();
  1395. let status = "pending";
  1396. let queriesSent = 0;
  1397. let lastError;
  1398. let timer = null;
  1399. let queue = [];
  1400. let doneCallbacks = [];
  1401. if (typeof done === "function") {
  1402. doneCallbacks.push(done);
  1403. }
  1404. function resetTimer() {
  1405. if (timer) {
  1406. clearTimeout(timer);
  1407. timer = null;
  1408. }
  1409. }
  1410. function abort() {
  1411. if (status === "pending") {
  1412. status = "aborted";
  1413. }
  1414. resetTimer();
  1415. queue.forEach((item) => {
  1416. if (item.status === "pending") {
  1417. item.status = "aborted";
  1418. }
  1419. });
  1420. queue = [];
  1421. }
  1422. function subscribe(callback, overwrite) {
  1423. if (overwrite) {
  1424. doneCallbacks = [];
  1425. }
  1426. if (typeof callback === "function") {
  1427. doneCallbacks.push(callback);
  1428. }
  1429. }
  1430. function getQueryStatus() {
  1431. return {
  1432. startTime,
  1433. payload,
  1434. status,
  1435. queriesSent,
  1436. queriesPending: queue.length,
  1437. subscribe,
  1438. abort
  1439. };
  1440. }
  1441. function failQuery() {
  1442. status = "failed";
  1443. doneCallbacks.forEach((callback) => {
  1444. callback(void 0, lastError);
  1445. });
  1446. }
  1447. function clearQueue() {
  1448. queue.forEach((item) => {
  1449. if (item.status === "pending") {
  1450. item.status = "aborted";
  1451. }
  1452. });
  1453. queue = [];
  1454. }
  1455. function moduleResponse(item, response, data) {
  1456. const isError = response !== "success";
  1457. queue = queue.filter((queued) => queued !== item);
  1458. switch (status) {
  1459. case "pending":
  1460. break;
  1461. case "failed":
  1462. if (isError || !config2.dataAfterTimeout) {
  1463. return;
  1464. }
  1465. break;
  1466. default:
  1467. return;
  1468. }
  1469. if (response === "abort") {
  1470. lastError = data;
  1471. failQuery();
  1472. return;
  1473. }
  1474. if (isError) {
  1475. lastError = data;
  1476. if (!queue.length) {
  1477. if (!resources.length) {
  1478. failQuery();
  1479. } else {
  1480. execNext();
  1481. }
  1482. }
  1483. return;
  1484. }
  1485. resetTimer();
  1486. clearQueue();
  1487. if (!config2.random) {
  1488. const index = config2.resources.indexOf(item.resource);
  1489. if (index !== -1 && index !== config2.index) {
  1490. config2.index = index;
  1491. }
  1492. }
  1493. status = "completed";
  1494. doneCallbacks.forEach((callback) => {
  1495. callback(data);
  1496. });
  1497. }
  1498. function execNext() {
  1499. if (status !== "pending") {
  1500. return;
  1501. }
  1502. resetTimer();
  1503. const resource = resources.shift();
  1504. if (resource === void 0) {
  1505. if (queue.length) {
  1506. timer = setTimeout(() => {
  1507. resetTimer();
  1508. if (status === "pending") {
  1509. clearQueue();
  1510. failQuery();
  1511. }
  1512. }, config2.timeout);
  1513. return;
  1514. }
  1515. failQuery();
  1516. return;
  1517. }
  1518. const item = {
  1519. status: "pending",
  1520. resource,
  1521. callback: (status2, data) => {
  1522. moduleResponse(item, status2, data);
  1523. }
  1524. };
  1525. queue.push(item);
  1526. queriesSent++;
  1527. timer = setTimeout(execNext, config2.rotate);
  1528. query(resource, payload, item.callback);
  1529. }
  1530. setTimeout(execNext);
  1531. return getQueryStatus;
  1532. }
  1533. function initRedundancy(cfg) {
  1534. const config2 = {
  1535. ...defaultConfig,
  1536. ...cfg
  1537. };
  1538. let queries = [];
  1539. function cleanup() {
  1540. queries = queries.filter((item) => item().status === "pending");
  1541. }
  1542. function query(payload, queryCallback, doneCallback) {
  1543. const query2 = sendQuery(
  1544. config2,
  1545. payload,
  1546. queryCallback,
  1547. (data, error) => {
  1548. cleanup();
  1549. if (doneCallback) {
  1550. doneCallback(data, error);
  1551. }
  1552. }
  1553. );
  1554. queries.push(query2);
  1555. return query2;
  1556. }
  1557. function find(callback) {
  1558. return queries.find((value) => {
  1559. return callback(value);
  1560. }) || null;
  1561. }
  1562. const instance = {
  1563. query,
  1564. find,
  1565. setIndex: (index) => {
  1566. config2.index = index;
  1567. },
  1568. getIndex: () => config2.index,
  1569. cleanup
  1570. };
  1571. return instance;
  1572. }
  1573. function emptyCallback$1() {
  1574. }
  1575. const redundancyCache = /* @__PURE__ */ Object.create(null);
  1576. function getRedundancyCache(provider) {
  1577. if (!redundancyCache[provider]) {
  1578. const config2 = getAPIConfig(provider);
  1579. if (!config2) {
  1580. return;
  1581. }
  1582. const redundancy = initRedundancy(config2);
  1583. const cachedReundancy = {
  1584. config: config2,
  1585. redundancy
  1586. };
  1587. redundancyCache[provider] = cachedReundancy;
  1588. }
  1589. return redundancyCache[provider];
  1590. }
  1591. function sendAPIQuery(target, query, callback) {
  1592. let redundancy;
  1593. let send2;
  1594. if (typeof target === "string") {
  1595. const api = getAPIModule(target);
  1596. if (!api) {
  1597. callback(void 0, 424);
  1598. return emptyCallback$1;
  1599. }
  1600. send2 = api.send;
  1601. const cached = getRedundancyCache(target);
  1602. if (cached) {
  1603. redundancy = cached.redundancy;
  1604. }
  1605. } else {
  1606. const config2 = createAPIConfig(target);
  1607. if (config2) {
  1608. redundancy = initRedundancy(config2);
  1609. const moduleKey = target.resources ? target.resources[0] : "";
  1610. const api = getAPIModule(moduleKey);
  1611. if (api) {
  1612. send2 = api.send;
  1613. }
  1614. }
  1615. }
  1616. if (!redundancy || !send2) {
  1617. callback(void 0, 424);
  1618. return emptyCallback$1;
  1619. }
  1620. return redundancy.query(query, send2, callback)().abort;
  1621. }
  1622. const browserCacheVersion = "iconify2";
  1623. const browserCachePrefix = "iconify";
  1624. const browserCacheCountKey = browserCachePrefix + "-count";
  1625. const browserCacheVersionKey = browserCachePrefix + "-version";
  1626. const browserStorageHour = 36e5;
  1627. const browserStorageCacheExpiration = 168;
  1628. function getStoredItem(func, key) {
  1629. try {
  1630. return func.getItem(key);
  1631. } catch (err) {
  1632. }
  1633. }
  1634. function setStoredItem(func, key, value) {
  1635. try {
  1636. func.setItem(key, value);
  1637. return true;
  1638. } catch (err) {
  1639. }
  1640. }
  1641. function removeStoredItem(func, key) {
  1642. try {
  1643. func.removeItem(key);
  1644. } catch (err) {
  1645. }
  1646. }
  1647. function setBrowserStorageItemsCount(storage2, value) {
  1648. return setStoredItem(storage2, browserCacheCountKey, value.toString());
  1649. }
  1650. function getBrowserStorageItemsCount(storage2) {
  1651. return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
  1652. }
  1653. const browserStorageConfig = {
  1654. local: true,
  1655. session: true
  1656. };
  1657. const browserStorageEmptyItems = {
  1658. local: /* @__PURE__ */ new Set(),
  1659. session: /* @__PURE__ */ new Set()
  1660. };
  1661. let browserStorageStatus = false;
  1662. function setBrowserStorageStatus(status) {
  1663. browserStorageStatus = status;
  1664. }
  1665. let _window = typeof window === "undefined" ? {} : window;
  1666. function getBrowserStorage(key) {
  1667. const attr = key + "Storage";
  1668. try {
  1669. if (_window && _window[attr] && typeof _window[attr].length === "number") {
  1670. return _window[attr];
  1671. }
  1672. } catch (err) {
  1673. }
  1674. browserStorageConfig[key] = false;
  1675. }
  1676. function iterateBrowserStorage(key, callback) {
  1677. const func = getBrowserStorage(key);
  1678. if (!func) {
  1679. return;
  1680. }
  1681. const version = getStoredItem(func, browserCacheVersionKey);
  1682. if (version !== browserCacheVersion) {
  1683. if (version) {
  1684. const total2 = getBrowserStorageItemsCount(func);
  1685. for (let i = 0; i < total2; i++) {
  1686. removeStoredItem(func, browserCachePrefix + i.toString());
  1687. }
  1688. }
  1689. setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
  1690. setBrowserStorageItemsCount(func, 0);
  1691. return;
  1692. }
  1693. const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
  1694. const parseItem = (index) => {
  1695. const name = browserCachePrefix + index.toString();
  1696. const item = getStoredItem(func, name);
  1697. if (typeof item !== "string") {
  1698. return;
  1699. }
  1700. try {
  1701. const data = JSON.parse(item);
  1702. 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
  1703. callback(data, index)) {
  1704. return true;
  1705. }
  1706. } catch (err) {
  1707. }
  1708. removeStoredItem(func, name);
  1709. };
  1710. let total = getBrowserStorageItemsCount(func);
  1711. for (let i = total - 1; i >= 0; i--) {
  1712. if (!parseItem(i)) {
  1713. if (i === total - 1) {
  1714. total--;
  1715. setBrowserStorageItemsCount(func, total);
  1716. } else {
  1717. browserStorageEmptyItems[key].add(i);
  1718. }
  1719. }
  1720. }
  1721. }
  1722. function initBrowserStorage() {
  1723. if (browserStorageStatus) {
  1724. return;
  1725. }
  1726. setBrowserStorageStatus(true);
  1727. for (const key in browserStorageConfig) {
  1728. iterateBrowserStorage(key, (item) => {
  1729. const iconSet = item.data;
  1730. const provider = item.provider;
  1731. const prefix = iconSet.prefix;
  1732. const storage2 = getStorage(
  1733. provider,
  1734. prefix
  1735. );
  1736. if (!addIconSet(storage2, iconSet).length) {
  1737. return false;
  1738. }
  1739. const lastModified = iconSet.lastModified || -1;
  1740. storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
  1741. return true;
  1742. });
  1743. }
  1744. }
  1745. function updateLastModified(storage2, lastModified) {
  1746. const lastValue = storage2.lastModifiedCached;
  1747. if (
  1748. // Matches or newer
  1749. lastValue && lastValue >= lastModified
  1750. ) {
  1751. return lastValue === lastModified;
  1752. }
  1753. storage2.lastModifiedCached = lastModified;
  1754. if (lastValue) {
  1755. for (const key in browserStorageConfig) {
  1756. iterateBrowserStorage(key, (item) => {
  1757. const iconSet = item.data;
  1758. return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
  1759. });
  1760. }
  1761. }
  1762. return true;
  1763. }
  1764. function storeInBrowserStorage(storage2, data) {
  1765. if (!browserStorageStatus) {
  1766. initBrowserStorage();
  1767. }
  1768. function store(key) {
  1769. let func;
  1770. if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
  1771. return;
  1772. }
  1773. const set = browserStorageEmptyItems[key];
  1774. let index;
  1775. if (set.size) {
  1776. set.delete(index = Array.from(set).shift());
  1777. } else {
  1778. index = getBrowserStorageItemsCount(func);
  1779. if (!setBrowserStorageItemsCount(func, index + 1)) {
  1780. return;
  1781. }
  1782. }
  1783. const item = {
  1784. cached: Math.floor(Date.now() / browserStorageHour),
  1785. provider: storage2.provider,
  1786. data
  1787. };
  1788. return setStoredItem(
  1789. func,
  1790. browserCachePrefix + index.toString(),
  1791. JSON.stringify(item)
  1792. );
  1793. }
  1794. if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
  1795. return;
  1796. }
  1797. if (!Object.keys(data.icons).length) {
  1798. return;
  1799. }
  1800. if (data.not_found) {
  1801. data = Object.assign({}, data);
  1802. delete data.not_found;
  1803. }
  1804. if (!store("local")) {
  1805. store("session");
  1806. }
  1807. }
  1808. function emptyCallback() {
  1809. }
  1810. function loadedNewIcons(storage2) {
  1811. if (!storage2.iconsLoaderFlag) {
  1812. storage2.iconsLoaderFlag = true;
  1813. setTimeout(() => {
  1814. storage2.iconsLoaderFlag = false;
  1815. updateCallbacks(storage2);
  1816. });
  1817. }
  1818. }
  1819. function loadNewIcons(storage2, icons) {
  1820. if (!storage2.iconsToLoad) {
  1821. storage2.iconsToLoad = icons;
  1822. } else {
  1823. storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
  1824. }
  1825. if (!storage2.iconsQueueFlag) {
  1826. storage2.iconsQueueFlag = true;
  1827. setTimeout(() => {
  1828. storage2.iconsQueueFlag = false;
  1829. const { provider, prefix } = storage2;
  1830. const icons2 = storage2.iconsToLoad;
  1831. delete storage2.iconsToLoad;
  1832. let api;
  1833. if (!icons2 || !(api = getAPIModule(provider))) {
  1834. return;
  1835. }
  1836. const params = api.prepare(provider, prefix, icons2);
  1837. params.forEach((item) => {
  1838. sendAPIQuery(provider, item, (data) => {
  1839. if (typeof data !== "object") {
  1840. item.icons.forEach((name) => {
  1841. storage2.missing.add(name);
  1842. });
  1843. } else {
  1844. try {
  1845. const parsed = addIconSet(
  1846. storage2,
  1847. data
  1848. );
  1849. if (!parsed.length) {
  1850. return;
  1851. }
  1852. const pending = storage2.pendingIcons;
  1853. if (pending) {
  1854. parsed.forEach((name) => {
  1855. pending.delete(name);
  1856. });
  1857. }
  1858. storeInBrowserStorage(storage2, data);
  1859. } catch (err) {
  1860. console.error(err);
  1861. }
  1862. }
  1863. loadedNewIcons(storage2);
  1864. });
  1865. });
  1866. });
  1867. }
  1868. }
  1869. const loadIcons = (icons, callback) => {
  1870. const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
  1871. const sortedIcons = sortIcons(cleanedIcons);
  1872. if (!sortedIcons.pending.length) {
  1873. let callCallback = true;
  1874. if (callback) {
  1875. setTimeout(() => {
  1876. if (callCallback) {
  1877. callback(
  1878. sortedIcons.loaded,
  1879. sortedIcons.missing,
  1880. sortedIcons.pending,
  1881. emptyCallback
  1882. );
  1883. }
  1884. });
  1885. }
  1886. return () => {
  1887. callCallback = false;
  1888. };
  1889. }
  1890. const newIcons = /* @__PURE__ */ Object.create(null);
  1891. const sources = [];
  1892. let lastProvider, lastPrefix;
  1893. sortedIcons.pending.forEach((icon) => {
  1894. const { provider, prefix } = icon;
  1895. if (prefix === lastPrefix && provider === lastProvider) {
  1896. return;
  1897. }
  1898. lastProvider = provider;
  1899. lastPrefix = prefix;
  1900. sources.push(getStorage(provider, prefix));
  1901. const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
  1902. if (!providerNewIcons[prefix]) {
  1903. providerNewIcons[prefix] = [];
  1904. }
  1905. });
  1906. sortedIcons.pending.forEach((icon) => {
  1907. const { provider, prefix, name } = icon;
  1908. const storage2 = getStorage(provider, prefix);
  1909. const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
  1910. if (!pendingQueue.has(name)) {
  1911. pendingQueue.add(name);
  1912. newIcons[provider][prefix].push(name);
  1913. }
  1914. });
  1915. sources.forEach((storage2) => {
  1916. const { provider, prefix } = storage2;
  1917. if (newIcons[provider][prefix].length) {
  1918. loadNewIcons(storage2, newIcons[provider][prefix]);
  1919. }
  1920. });
  1921. return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
  1922. };
  1923. function mergeCustomisations(defaults, item) {
  1924. const result = {
  1925. ...defaults
  1926. };
  1927. for (const key in item) {
  1928. const value = item[key];
  1929. const valueType = typeof value;
  1930. if (key in defaultIconSizeCustomisations) {
  1931. if (value === null || value && (valueType === "string" || valueType === "number")) {
  1932. result[key] = value;
  1933. }
  1934. } else if (valueType === typeof result[key]) {
  1935. result[key] = key === "rotate" ? value % 4 : value;
  1936. }
  1937. }
  1938. return result;
  1939. }
  1940. const separator = /[\s,]+/;
  1941. function flipFromString(custom, flip) {
  1942. flip.split(separator).forEach((str) => {
  1943. const value = str.trim();
  1944. switch (value) {
  1945. case "horizontal":
  1946. custom.hFlip = true;
  1947. break;
  1948. case "vertical":
  1949. custom.vFlip = true;
  1950. break;
  1951. }
  1952. });
  1953. }
  1954. function rotateFromString(value, defaultValue = 0) {
  1955. const units = value.replace(/^-?[0-9.]*/, "");
  1956. function cleanup(value2) {
  1957. while (value2 < 0) {
  1958. value2 += 4;
  1959. }
  1960. return value2 % 4;
  1961. }
  1962. if (units === "") {
  1963. const num = parseInt(value);
  1964. return isNaN(num) ? 0 : cleanup(num);
  1965. } else if (units !== value) {
  1966. let split = 0;
  1967. switch (units) {
  1968. case "%":
  1969. split = 25;
  1970. break;
  1971. case "deg":
  1972. split = 90;
  1973. }
  1974. if (split) {
  1975. let num = parseFloat(value.slice(0, value.length - units.length));
  1976. if (isNaN(num)) {
  1977. return 0;
  1978. }
  1979. num = num / split;
  1980. return num % 1 === 0 ? cleanup(num) : 0;
  1981. }
  1982. }
  1983. return defaultValue;
  1984. }
  1985. function iconToHTML(body, attributes) {
  1986. let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  1987. for (const attr in attributes) {
  1988. renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
  1989. }
  1990. return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
  1991. }
  1992. function encodeSVGforURL(svg) {
  1993. return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
  1994. }
  1995. function svgToData(svg) {
  1996. return "data:image/svg+xml," + encodeSVGforURL(svg);
  1997. }
  1998. function svgToURL(svg) {
  1999. return 'url("' + svgToData(svg) + '")';
  2000. }
  2001. const defaultExtendedIconCustomisations = {
  2002. ...defaultIconCustomisations,
  2003. inline: false
  2004. };
  2005. const svgDefaults = {
  2006. "xmlns": "http://www.w3.org/2000/svg",
  2007. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  2008. "aria-hidden": true,
  2009. "role": "img"
  2010. };
  2011. const commonProps = {
  2012. display: "inline-block"
  2013. };
  2014. const monotoneProps = {
  2015. backgroundColor: "currentColor"
  2016. };
  2017. const coloredProps = {
  2018. backgroundColor: "transparent"
  2019. };
  2020. const propsToAdd = {
  2021. Image: "var(--svg)",
  2022. Repeat: "no-repeat",
  2023. Size: "100% 100%"
  2024. };
  2025. const propsToAddTo = {
  2026. webkitMask: monotoneProps,
  2027. mask: monotoneProps,
  2028. background: coloredProps
  2029. };
  2030. for (const prefix in propsToAddTo) {
  2031. const list = propsToAddTo[prefix];
  2032. for (const prop in propsToAdd) {
  2033. list[prefix + prop] = propsToAdd[prop];
  2034. }
  2035. }
  2036. const customisationAliases = {};
  2037. ["horizontal", "vertical"].forEach((prefix) => {
  2038. const attr = prefix.slice(0, 1) + "Flip";
  2039. customisationAliases[prefix + "-flip"] = attr;
  2040. customisationAliases[prefix.slice(0, 1) + "-flip"] = attr;
  2041. customisationAliases[prefix + "Flip"] = attr;
  2042. });
  2043. function fixSize(value) {
  2044. return value + (value.match(/^[-0-9.]+$/) ? "px" : "");
  2045. }
  2046. const render = (icon, props) => {
  2047. const customisations = mergeCustomisations(defaultExtendedIconCustomisations, props);
  2048. const componentProps = { ...svgDefaults };
  2049. const mode = props.mode || "svg";
  2050. const style = {};
  2051. const propsStyle = props.style;
  2052. const customStyle = typeof propsStyle === "object" && !(propsStyle instanceof Array) ? propsStyle : {};
  2053. for (let key in props) {
  2054. const value = props[key];
  2055. if (value === void 0) {
  2056. continue;
  2057. }
  2058. switch (key) {
  2059. case "icon":
  2060. case "style":
  2061. case "onLoad":
  2062. case "mode":
  2063. break;
  2064. case "inline":
  2065. case "hFlip":
  2066. case "vFlip":
  2067. customisations[key] = value === true || value === "true" || value === 1;
  2068. break;
  2069. case "flip":
  2070. if (typeof value === "string") {
  2071. flipFromString(customisations, value);
  2072. }
  2073. break;
  2074. case "color":
  2075. style.color = value;
  2076. break;
  2077. case "rotate":
  2078. if (typeof value === "string") {
  2079. customisations[key] = rotateFromString(value);
  2080. } else if (typeof value === "number") {
  2081. customisations[key] = value;
  2082. }
  2083. break;
  2084. case "ariaHidden":
  2085. case "aria-hidden":
  2086. if (value !== true && value !== "true") {
  2087. delete componentProps["aria-hidden"];
  2088. }
  2089. break;
  2090. default: {
  2091. const alias = customisationAliases[key];
  2092. if (alias) {
  2093. if (value === true || value === "true" || value === 1) {
  2094. customisations[alias] = true;
  2095. }
  2096. } else if (defaultExtendedIconCustomisations[key] === void 0) {
  2097. componentProps[key] = value;
  2098. }
  2099. }
  2100. }
  2101. }
  2102. const item = iconToSVG(icon, customisations);
  2103. const renderAttribs = item.attributes;
  2104. if (customisations.inline) {
  2105. style.verticalAlign = "-0.125em";
  2106. }
  2107. if (mode === "svg") {
  2108. componentProps.style = {
  2109. ...style,
  2110. ...customStyle
  2111. };
  2112. Object.assign(componentProps, renderAttribs);
  2113. let localCounter = 0;
  2114. let id = props.id;
  2115. if (typeof id === "string") {
  2116. id = id.replace(/-/g, "_");
  2117. }
  2118. componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyVue");
  2119. return vue.h("svg", componentProps);
  2120. }
  2121. const { body, width, height } = icon;
  2122. const useMask = mode === "mask" || (mode === "bg" ? false : body.indexOf("currentColor") !== -1);
  2123. const html = iconToHTML(body, {
  2124. ...renderAttribs,
  2125. width: width + "",
  2126. height: height + ""
  2127. });
  2128. componentProps.style = {
  2129. ...style,
  2130. "--svg": svgToURL(html),
  2131. "width": fixSize(renderAttribs.width),
  2132. "height": fixSize(renderAttribs.height),
  2133. ...commonProps,
  2134. ...useMask ? monotoneProps : coloredProps,
  2135. ...customStyle
  2136. };
  2137. return vue.h("span", componentProps);
  2138. };
  2139. allowSimpleNames(true);
  2140. setAPIModule("", fetchAPIModule);
  2141. if (typeof document !== "undefined" && typeof window !== "undefined") {
  2142. initBrowserStorage();
  2143. const _window2 = window;
  2144. if (_window2.IconifyPreload !== void 0) {
  2145. const preload = _window2.IconifyPreload;
  2146. const err = "Invalid IconifyPreload syntax.";
  2147. if (typeof preload === "object" && preload !== null) {
  2148. (preload instanceof Array ? preload : [preload]).forEach((item) => {
  2149. try {
  2150. if (
  2151. // Check if item is an object and not null/array
  2152. typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
  2153. typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
  2154. !addCollection(item)
  2155. ) {
  2156. console.error(err);
  2157. }
  2158. } catch (e2) {
  2159. console.error(err);
  2160. }
  2161. });
  2162. }
  2163. }
  2164. if (_window2.IconifyProviders !== void 0) {
  2165. const providers = _window2.IconifyProviders;
  2166. if (typeof providers === "object" && providers !== null) {
  2167. for (let key in providers) {
  2168. const err = "IconifyProviders[" + key + "] is invalid.";
  2169. try {
  2170. const value = providers[key];
  2171. if (typeof value !== "object" || !value || value.resources === void 0) {
  2172. continue;
  2173. }
  2174. if (!addAPIProvider(key, value)) {
  2175. console.error(err);
  2176. }
  2177. } catch (e2) {
  2178. console.error(err);
  2179. }
  2180. }
  2181. }
  2182. }
  2183. }
  2184. const emptyIcon = {
  2185. ...defaultIconProps,
  2186. body: ""
  2187. };
  2188. const Icon = vue.defineComponent({
  2189. // Do not inherit other attributes: it is handled by render()
  2190. inheritAttrs: false,
  2191. // Set initial data
  2192. data() {
  2193. return {
  2194. // Mounted status
  2195. iconMounted: false,
  2196. // Callback counter to trigger re-render
  2197. counter: 0
  2198. };
  2199. },
  2200. mounted() {
  2201. this._name = "";
  2202. this._loadingIcon = null;
  2203. this.iconMounted = true;
  2204. },
  2205. unmounted() {
  2206. this.abortLoading();
  2207. },
  2208. methods: {
  2209. abortLoading() {
  2210. if (this._loadingIcon) {
  2211. this._loadingIcon.abort();
  2212. this._loadingIcon = null;
  2213. }
  2214. },
  2215. // Get data for icon to render or null
  2216. getIcon(icon, onload) {
  2217. if (typeof icon === "object" && icon !== null && typeof icon.body === "string") {
  2218. this._name = "";
  2219. this.abortLoading();
  2220. return {
  2221. data: icon
  2222. };
  2223. }
  2224. let iconName;
  2225. if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) {
  2226. this.abortLoading();
  2227. return null;
  2228. }
  2229. const data = getIconData(iconName);
  2230. if (!data) {
  2231. if (!this._loadingIcon || this._loadingIcon.name !== icon) {
  2232. this.abortLoading();
  2233. this._name = "";
  2234. if (data !== null) {
  2235. this._loadingIcon = {
  2236. name: icon,
  2237. abort: loadIcons([iconName], () => {
  2238. this.counter++;
  2239. })
  2240. };
  2241. }
  2242. }
  2243. return null;
  2244. }
  2245. this.abortLoading();
  2246. if (this._name !== icon) {
  2247. this._name = icon;
  2248. if (onload) {
  2249. onload(icon);
  2250. }
  2251. }
  2252. const classes = ["iconify"];
  2253. if (iconName.prefix !== "") {
  2254. classes.push("iconify--" + iconName.prefix);
  2255. }
  2256. if (iconName.provider !== "") {
  2257. classes.push("iconify--" + iconName.provider);
  2258. }
  2259. return { data, classes };
  2260. }
  2261. },
  2262. // Render icon
  2263. render() {
  2264. this.counter;
  2265. const props = this.$attrs;
  2266. const icon = this.iconMounted ? this.getIcon(props.icon, props.onLoad) : null;
  2267. if (!icon) {
  2268. return render(emptyIcon, props);
  2269. }
  2270. let newProps = props;
  2271. if (icon.classes) {
  2272. newProps = {
  2273. ...props,
  2274. class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ")
  2275. };
  2276. }
  2277. return render({
  2278. ...defaultIconProps,
  2279. ...icon.data
  2280. }, newProps);
  2281. }
  2282. });
  2283. const _hoisted_1$i = { class: "display-type" };
  2284. const _hoisted_2$f = { style: { "position": "relative" } };
  2285. const _hoisted_3$c = {
  2286. key: 0,
  2287. class: "type-list"
  2288. };
  2289. const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
  2290. __name: "BaseSelect",
  2291. props: {
  2292. displayType: {}
  2293. },
  2294. emits: ["update:displayType"],
  2295. setup(__props, { emit: __emit }) {
  2296. const props = __props;
  2297. const emit = __emit;
  2298. let state = vue.reactive({
  2299. showChangeDisplayType: false,
  2300. lastDisplayType: null
  2301. });
  2302. function changeOption(item) {
  2303. if (![CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2304. state.lastDisplayType = props.displayType;
  2305. }
  2306. emit("update:displayType", item);
  2307. state.showChangeDisplayType = false;
  2308. }
  2309. function clickDisplayType() {
  2310. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2311. return changeOption(state.lastDisplayType ?? CommentDisplayType.FloorInFloorNoCallUser);
  2312. }
  2313. state.showChangeDisplayType = !state.showChangeDisplayType;
  2314. }
  2315. const currentDisplayType = vue.computed(() => {
  2316. let judge = props.displayType;
  2317. if ([CommentDisplayType.New, CommentDisplayType.Like].includes(props.displayType)) {
  2318. judge = state.lastDisplayType;
  2319. }
  2320. switch (judge) {
  2321. case CommentDisplayType.FloorInFloorNoCallUser:
  2322. return "楼中楼";
  2323. case CommentDisplayType.FloorInFloor:
  2324. return "楼中楼(@)";
  2325. case CommentDisplayType.FloorInFloorNested:
  2326. return "冗余楼中楼";
  2327. case CommentDisplayType.V2exOrigin:
  2328. return "V2原版";
  2329. case CommentDisplayType.OnlyOp:
  2330. return "只看楼主";
  2331. default:
  2332. return "楼中楼";
  2333. }
  2334. });
  2335. return (_ctx, _cache) => {
  2336. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
  2337. vue.createElementVNode("div", {
  2338. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).New && "active"]),
  2339. onClick: _cache[0] || (_cache[0] = ($event) => changeOption(vue.unref(CommentDisplayType).New))
  2340. }, "最新 ", 2),
  2341. vue.createElementVNode("div", {
  2342. class: vue.normalizeClass(["type", _ctx.displayType === vue.unref(CommentDisplayType).Like && "active"]),
  2343. onClick: _cache[1] || (_cache[1] = ($event) => changeOption(vue.unref(CommentDisplayType).Like))
  2344. }, "最热 ", 2),
  2345. vue.createElementVNode("div", _hoisted_2$f, [
  2346. vue.createElementVNode("div", {
  2347. class: vue.normalizeClass(["type", ![vue.unref(CommentDisplayType).New, vue.unref(CommentDisplayType).Like].includes(_ctx.displayType) && "active"]),
  2348. onClick: clickDisplayType
  2349. }, [
  2350. vue.createElementVNode("span", null, vue.toDisplayString(currentDisplayType.value), 1),
  2351. vue.createVNode(vue.unref(Icon), { icon: "mingcute:down-line" })
  2352. ], 2),
  2353. vue.unref(state).showChangeDisplayType ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$c, [
  2354. vue.createElementVNode("div", {
  2355. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNoCallUser && "active"]),
  2356. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNoCallUser), ["stop"]))
  2357. }, "楼中楼 ", 2),
  2358. vue.createElementVNode("div", {
  2359. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloor && "active"]),
  2360. onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloor), ["stop"]))
  2361. }, "楼中楼(@) ", 2),
  2362. vue.createElementVNode("div", {
  2363. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).FloorInFloorNested && "active"]),
  2364. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).FloorInFloorNested), ["stop"]))
  2365. }, "冗余楼中楼 ", 2),
  2366. vue.createElementVNode("div", {
  2367. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).OnlyOp && "active"]),
  2368. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).OnlyOp), ["stop"]))
  2369. }, "只看楼主 ", 2),
  2370. vue.createElementVNode("div", {
  2371. class: vue.normalizeClass(["item", _ctx.displayType === vue.unref(CommentDisplayType).V2exOrigin && "active"]),
  2372. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => changeOption(vue.unref(CommentDisplayType).V2exOrigin), ["stop"]))
  2373. }, "V2原版 ", 2)
  2374. ])) : vue.createCommentVNode("", true)
  2375. ])
  2376. ]);
  2377. };
  2378. }
  2379. });
  2380. const BaseSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-e4f684be"]]);
  2381. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  2382. __name: "BaseLoading",
  2383. props: {
  2384. size: { default: "normal" }
  2385. },
  2386. setup(__props) {
  2387. return (_ctx, _cache) => {
  2388. return vue.openBlock(), vue.createElementBlock("div", {
  2389. class: vue.normalizeClass(["loading", [_ctx.size]])
  2390. }, null, 2);
  2391. };
  2392. }
  2393. });
  2394. const BaseLoading = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-2697baa2"]]);
  2395. const _hoisted_1$h = {
  2396. key: 1,
  2397. class: "key-notice"
  2398. };
  2399. const _hoisted_2$e = { class: "key" };
  2400. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  2401. __name: "BaseButton",
  2402. props: {
  2403. keyboard: {},
  2404. active: { type: Boolean },
  2405. disabled: { type: Boolean },
  2406. loading: { type: Boolean },
  2407. size: { default: "normal" },
  2408. type: { default: "primary" }
  2409. },
  2410. emits: ["click"],
  2411. setup(__props) {
  2412. return (_ctx, _cache) => {
  2413. return vue.openBlock(), vue.createBlock(Tooltip, {
  2414. disabled: !_ctx.keyboard,
  2415. title: `快捷键: ${_ctx.keyboard}`
  2416. }, {
  2417. default: vue.withCtx(() => [
  2418. vue.createElementVNode("div", vue.mergeProps({ class: "base-button" }, _ctx.$attrs, {
  2419. onClick: _cache[0] || (_cache[0] = (e2) => !_ctx.disabled && !_ctx.loading && _ctx.$emit("click", e2)),
  2420. class: [
  2421. _ctx.active && "active",
  2422. _ctx.size,
  2423. _ctx.type,
  2424. (_ctx.disabled || _ctx.loading) && "disabled",
  2425. !_ctx.disabled && "hvr-grow"
  2426. ]
  2427. }), [
  2428. vue.createElementVNode("span", {
  2429. style: vue.normalizeStyle({ opacity: _ctx.loading ? 0 : 1 })
  2430. }, [
  2431. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  2432. ], 4),
  2433. _ctx.loading ? (vue.openBlock(), vue.createBlock(BaseLoading, {
  2434. key: 0,
  2435. size: "small"
  2436. })) : vue.createCommentVNode("", true),
  2437. _ctx.keyboard ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
  2438. vue.createElementVNode("span", _hoisted_2$e, vue.toDisplayString(_ctx.keyboard), 1)
  2439. ])) : vue.createCommentVNode("", true)
  2440. ], 16)
  2441. ]),
  2442. _: 3
  2443. }, 8, ["disabled", "title"]);
  2444. };
  2445. }
  2446. });
  2447. const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-5a7d79ba"]]);
  2448. const _sfc_main$g = {
  2449. name: "PopConfirm",
  2450. components: { BaseButton },
  2451. props: {
  2452. title: {
  2453. type: String,
  2454. default() {
  2455. return "";
  2456. }
  2457. },
  2458. disabled: {
  2459. type: Boolean,
  2460. default() {
  2461. return false;
  2462. }
  2463. }
  2464. },
  2465. data() {
  2466. return {
  2467. show: false
  2468. };
  2469. },
  2470. methods: {
  2471. showPop(e2) {
  2472. if (this.disabled)
  2473. return;
  2474. let rect = e2.target.getBoundingClientRect();
  2475. this.show = true;
  2476. vue.nextTick(() => {
  2477. this.$refs.tip.style.top = rect.top + "px";
  2478. this.$refs.tip.style.left = rect.left + rect.width / 2 - 50 + "px";
  2479. });
  2480. },
  2481. confirm() {
  2482. this.show = false;
  2483. this.$emit("confirm");
  2484. },
  2485. cancel() {
  2486. this.show = false;
  2487. this.$emit("cancel");
  2488. }
  2489. }
  2490. };
  2491. const _hoisted_1$g = { class: "pop-confirm" };
  2492. const _hoisted_2$d = {
  2493. key: 0,
  2494. ref: "tip",
  2495. class: "pop-confirm-content"
  2496. };
  2497. const _hoisted_3$b = { class: "text" };
  2498. const _hoisted_4$b = { class: "options" };
  2499. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  2500. const _component_BaseButton = vue.resolveComponent("BaseButton");
  2501. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  2502. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
  2503. vue.createVNode(vue.Transition, null, {
  2504. default: vue.withCtx(() => [
  2505. $data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$d, [
  2506. vue.createElementVNode("div", _hoisted_3$b, vue.toDisplayString($props.title), 1),
  2507. vue.createElementVNode("div", _hoisted_4$b, [
  2508. vue.createVNode(_component_BaseButton, {
  2509. type: "link",
  2510. size: "small",
  2511. onClick: $options.cancel
  2512. }, {
  2513. default: vue.withCtx(() => [
  2514. vue.createTextVNode("取消")
  2515. ]),
  2516. _: 1
  2517. }, 8, ["onClick"]),
  2518. vue.createVNode(_component_BaseButton, {
  2519. size: "small",
  2520. onClick: $options.confirm
  2521. }, {
  2522. default: vue.withCtx(() => [
  2523. vue.createTextVNode("确认")
  2524. ]),
  2525. _: 1
  2526. }, 8, ["onClick"])
  2527. ])
  2528. ], 512)) : vue.createCommentVNode("", true)
  2529. ]),
  2530. _: 1
  2531. })
  2532. ])),
  2533. vue.createElementVNode("span", {
  2534. onClick: _cache[0] || (_cache[0] = (...args) => $options.showPop && $options.showPop(...args))
  2535. }, [
  2536. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  2537. ])
  2538. ]);
  2539. }
  2540. const PopConfirm = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$9], ["__scopeId", "data-v-7d29b3cc"]]);
  2541. const _sfc_main$f = {
  2542. name: "Setting",
  2543. components: {
  2544. BaseButton,
  2545. PopConfirm,
  2546. Icon,
  2547. BaseSelect,
  2548. BaseSwitch,
  2549. Tooltip
  2550. },
  2551. inject: ["isNight"],
  2552. props: {
  2553. show: {
  2554. type: Boolean,
  2555. default() {
  2556. return false;
  2557. }
  2558. }
  2559. },
  2560. data() {
  2561. return {
  2562. tabIndex: 0
  2563. };
  2564. },
  2565. methods: {
  2566. confirm() {
  2567. this.close();
  2568. this.$emit("confirm");
  2569. },
  2570. close() {
  2571. this.$emit("update:show", false);
  2572. }
  2573. }
  2574. };
  2575. const _withScopeId$a = (n2) => (vue.pushScopeId("data-v-cb13d533"), n2 = n2(), vue.popScopeId(), n2);
  2576. const _hoisted_1$f = {
  2577. key: 0,
  2578. class: "setting-modal modal"
  2579. };
  2580. const _hoisted_2$c = { class: "modal-root" };
  2581. const _hoisted_3$a = { class: "modal-header" };
  2582. const _hoisted_4$a = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 使用需知 ", -1));
  2583. const _hoisted_5$8 = { class: "body" };
  2584. const _hoisted_6$8 = /* @__PURE__ */ _withScopeId$a(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "modal-content" }, [
  2585. /* @__PURE__ */ vue.createElementVNode("div", null, "开启此功能会带来以下影响"),
  2586. /* @__PURE__ */ vue.createElementVNode("div", null, "缺点"),
  2587. /* @__PURE__ */ vue.createElementVNode("div", { style: { "color": "red" } }, [
  2588. /* @__PURE__ */ vue.createElementVNode("div", null, "1、你的IP可能会被封禁"),
  2589. /* @__PURE__ */ vue.createElementVNode("div", null, "2、消耗更多流量,给服务器带来更大的负担"),
  2590. /* @__PURE__ */ vue.createElementVNode("div", null, "3、你的V站浏览进度条会变快")
  2591. ]),
  2592. /* @__PURE__ */ vue.createElementVNode("div", null, "优点"),
  2593. /* @__PURE__ */ vue.createElementVNode("div", null, "1、卡片模式,无需打开主题即可查看内容"),
  2594. /* @__PURE__ */ vue.createElementVNode("div", null, "2、打开主题时提前预览正文内容,无需等待加载"),
  2595. /* @__PURE__ */ vue.createElementVNode("div", null, "原理"),
  2596. /* @__PURE__ */ vue.createElementVNode("div", null, "1、解析列表所有主题ID,批量调用show.json接口,获取对应主题的正文"),
  2597. /* @__PURE__ */ vue.createElementVNode("div", null, "2、请求的主题数据会缓存到本地,不会重复请求,超过3天的数据会删除"),
  2598. /* @__PURE__ */ vue.createElementVNode("div", null, "3、前面4条会并发请求,4条以后的一秒请求一条")
  2599. ], -1));
  2600. const _hoisted_7$7 = { class: "btns" };
  2601. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  2602. const _component_Icon = vue.resolveComponent("Icon");
  2603. const _component_BaseButton = vue.resolveComponent("BaseButton");
  2604. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  2605. default: vue.withCtx(() => [
  2606. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
  2607. vue.createElementVNode("div", {
  2608. class: "mask",
  2609. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  2610. }),
  2611. vue.createElementVNode("div", _hoisted_2$c, [
  2612. vue.createElementVNode("div", _hoisted_3$a, [
  2613. _hoisted_4$a,
  2614. vue.createVNode(_component_Icon, {
  2615. icon: "ic:round-close",
  2616. onClick: $options.close
  2617. }, null, 8, ["onClick"])
  2618. ]),
  2619. vue.createElementVNode("div", _hoisted_5$8, [
  2620. _hoisted_6$8,
  2621. vue.createElementVNode("div", _hoisted_7$7, [
  2622. vue.createVNode(_component_BaseButton, {
  2623. type: "link",
  2624. onClick: $options.close
  2625. }, {
  2626. default: vue.withCtx(() => [
  2627. vue.createTextVNode("不同意")
  2628. ]),
  2629. _: 1
  2630. }, 8, ["onClick"]),
  2631. vue.createVNode(_component_BaseButton, { onClick: $options.confirm }, {
  2632. default: vue.withCtx(() => [
  2633. vue.createTextVNode("同意")
  2634. ]),
  2635. _: 1
  2636. }, 8, ["onClick"])
  2637. ])
  2638. ])
  2639. ])
  2640. ])) : vue.createCommentVNode("", true)
  2641. ]),
  2642. _: 1
  2643. });
  2644. }
  2645. const NoticeModal = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$8], ["__scopeId", "data-v-cb13d533"]]);
  2646. const _sfc_main$e = {
  2647. name: "Setting",
  2648. components: {
  2649. NoticeModal,
  2650. PopConfirm,
  2651. Icon,
  2652. BaseSelect,
  2653. BaseSwitch,
  2654. Tooltip
  2655. },
  2656. inject: ["isNight"],
  2657. props: {
  2658. modelValue: {
  2659. type: Object,
  2660. default() {
  2661. return {};
  2662. }
  2663. },
  2664. show: {
  2665. type: Boolean,
  2666. default() {
  2667. return false;
  2668. }
  2669. }
  2670. },
  2671. data() {
  2672. return {
  2673. tabIndex: 0,
  2674. config: window.clone(this.modelValue),
  2675. showNotice: false
  2676. };
  2677. },
  2678. computed: {
  2679. DefaultVal() {
  2680. return DefaultVal;
  2681. },
  2682. CommentDisplayType() {
  2683. return CommentDisplayType;
  2684. },
  2685. isNew() {
  2686. return this.config.version < DefaultVal.currentVersion;
  2687. }
  2688. },
  2689. watch: {
  2690. config: {
  2691. handler(n2) {
  2692. n2.topReplyLoveMinCount = Math.trunc(n2.topReplyLoveMinCount);
  2693. if (n2.topReplyLoveMinCount < 0) {
  2694. n2.topReplyLoveMinCount = 1;
  2695. }
  2696. this.$emit("update:modelValue", n2);
  2697. },
  2698. deep: true
  2699. }
  2700. },
  2701. methods: {
  2702. close() {
  2703. this.config.version = DefaultVal.currentVersion;
  2704. this.$emit("update:show", false);
  2705. }
  2706. }
  2707. };
  2708. const _withScopeId$9 = (n2) => (vue.pushScopeId("data-v-df0e0e8f"), n2 = n2(), vue.popScopeId(), n2);
  2709. const _hoisted_1$e = {
  2710. key: 0,
  2711. class: "setting-modal modal"
  2712. };
  2713. const _hoisted_2$b = { class: "modal-root" };
  2714. const _hoisted_3$9 = { class: "modal-header" };
  2715. const _hoisted_4$9 = { class: "title" };
  2716. const _hoisted_5$7 = { class: "small" };
  2717. const _hoisted_6$7 = ["href"];
  2718. const _hoisted_7$6 = { class: "body" };
  2719. const _hoisted_8$6 = { class: "left" };
  2720. const _hoisted_9$6 = { class: "tabs" };
  2721. const _hoisted_10$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "列表设置", -1));
  2722. const _hoisted_11$5 = [
  2723. _hoisted_10$5
  2724. ];
  2725. const _hoisted_12$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "主题设置", -1));
  2726. const _hoisted_13$5 = [
  2727. _hoisted_12$5
  2728. ];
  2729. const _hoisted_14$5 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "其他设置", -1));
  2730. const _hoisted_15$4 = [
  2731. _hoisted_14$5
  2732. ];
  2733. const _hoisted_16$4 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("span", null, "关于脚本", -1));
  2734. const _hoisted_17$3 = [
  2735. _hoisted_16$4
  2736. ];
  2737. const _hoisted_18$3 = { class: "icons" };
  2738. const _hoisted_19$3 = ["href"];
  2739. const _hoisted_20$2 = ["href"];
  2740. const _hoisted_21$2 = { class: "modal-content" };
  2741. const _hoisted_22$2 = { class: "scroll" };
  2742. const _hoisted_23$2 = { key: 0 };
  2743. const _hoisted_24$2 = { class: "row" };
  2744. const _hoisted_25$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "列表展示方式", -1));
  2745. const _hoisted_26$1 = { class: "wrapper" };
  2746. const _hoisted_27$1 = { class: "radio-group2" };
  2747. const _hoisted_28$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  2748. const _hoisted_29$1 = { class: "row" };
  2749. const _hoisted_30$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "主题弹框显示", -1));
  2750. const _hoisted_31$1 = { class: "wrapper" };
  2751. const _hoisted_32$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  2752. /* @__PURE__ */ vue.createTextVNode(" 开启此选项后,主题会"),
  2753. /* @__PURE__ */ vue.createElementVNode("span", { class: "danger" }, "始终"),
  2754. /* @__PURE__ */ vue.createTextVNode("以弹框的方式显示。优先级大于“新标签页打开链接” ")
  2755. ], -1));
  2756. const _hoisted_33$1 = { class: "row" };
  2757. const _hoisted_34$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "新标签页打开链接", -1));
  2758. const _hoisted_35$1 = { class: "wrapper" };
  2759. const _hoisted_36$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 网页上所有链接通过新标签页打开 ", -1));
  2760. const _hoisted_37$1 = { class: "row" };
  2761. const _hoisted_38$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "打开新标签页时立即切换过去", -1));
  2762. const _hoisted_39$1 = { class: "wrapper" };
  2763. const _hoisted_40$1 = { key: 1 };
  2764. const _hoisted_41$1 = { class: "row" };
  2765. const _hoisted_42$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示回复展示方式", -1));
  2766. const _hoisted_43$1 = { class: "wrapper" };
  2767. const _hoisted_44$1 = { class: "row" };
  2768. const _hoisted_45$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "回复展示方式", -1));
  2769. const _hoisted_46$1 = { class: "wrapper" };
  2770. const _hoisted_47$1 = { class: "row" };
  2771. const _hoisted_48$1 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "单独打开主题时默认显示楼中楼", -1));
  2772. const _hoisted_49$1 = { class: "wrapper" };
  2773. const _hoisted_50 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 单独打开这种地址 https://v2ex.com/t/xxxx 时,是否默认显示楼中楼 ", -1));
  2774. const _hoisted_51 = { class: "row" };
  2775. const _hoisted_52 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "点击左右两侧透明处关闭主题详情弹框", -1));
  2776. const _hoisted_53 = { class: "wrapper" };
  2777. const _hoisted_54 = { class: "row" };
  2778. const _hoisted_55 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "正文超长自动折叠", -1));
  2779. const _hoisted_56 = { class: "wrapper" };
  2780. const _hoisted_57 = { class: "row" };
  2781. const _hoisted_58 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "主题宽度", -1));
  2782. const _hoisted_59 = { class: "wrapper" };
  2783. const _hoisted_60 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  2784. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则默认宽度为77rem。接受合法的width值: "),
  2785. /* @__PURE__ */ vue.createElementVNode("a", {
  2786. href: "https://vue3js.cn/interview/css/em_px_rem_vh_vw.html#%E4%BA%8C%E3%80%81%E5%8D%95%E4%BD%8D",
  2787. target: "_blank"
  2788. }, "rem、px、vw、vh(点此查看)"),
  2789. /* @__PURE__ */ vue.createTextVNode("。 vw代表屏幕百分比,如想要屏幕的66%,请填写66vw ")
  2790. ], -1));
  2791. const _hoisted_61 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " 提示:此项设置以后,单独打开详情页时会出现主题突然变宽(窄)的问题,暂时无解 ", -1));
  2792. const _hoisted_62 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  2793. const _hoisted_63 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "row" }, [
  2794. /* @__PURE__ */ vue.createElementVNode("label", { class: "main-title" }, "高赞回复")
  2795. ], -1));
  2796. const _hoisted_64 = { class: "row" };
  2797. const _hoisted_65 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "显示高赞回复", -1));
  2798. const _hoisted_66 = { class: "wrapper" };
  2799. const _hoisted_67 = { class: "row" };
  2800. const _hoisted_68 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最多显示多少个高赞回复", -1));
  2801. const _hoisted_69 = { class: "wrapper" };
  2802. const _hoisted_70 = { class: "row" };
  2803. const _hoisted_71 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "最少需要多少赞才能被判定为高赞", -1));
  2804. const _hoisted_72 = { class: "wrapper" };
  2805. const _hoisted_73 = { key: 2 };
  2806. const _hoisted_74 = { class: "row" };
  2807. const _hoisted_75 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "用户打标签(跨平台,数据保存在自己的记事本):", -1));
  2808. const _hoisted_76 = { class: "wrapper" };
  2809. const _hoisted_77 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 2024-01-27提示:此功能暂时无法使用 ", -1));
  2810. const _hoisted_78 = { class: "row" };
  2811. const _hoisted_79 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "划词显示Base64解码框", -1));
  2812. const _hoisted_80 = { class: "wrapper" };
  2813. const _hoisted_81 = { class: "row" };
  2814. const _hoisted_82 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自动签到", -1));
  2815. const _hoisted_83 = { class: "wrapper" };
  2816. const _hoisted_84 = { class: "row" };
  2817. const _hoisted_85 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "自定义背景", -1));
  2818. const _hoisted_86 = { class: "wrapper" };
  2819. const _hoisted_87 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, [
  2820. /* @__PURE__ */ vue.createTextVNode(" 未设定此值时,则背景颜色默认为 #e2e2e2。接受一个合法的css color值:例如"),
  2821. /* @__PURE__ */ vue.createElementVNode("a", {
  2822. href: "https://developer.mozilla.org/zh-CN/docs/Web/CSS/color_value",
  2823. target: "_blank"
  2824. }, "red、#ffffff、rgb(222,222,22)(点此查看)"),
  2825. /* @__PURE__ */ vue.createTextVNode("等等。 ")
  2826. ], -1));
  2827. const _hoisted_88 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc danger" }, " 提示:此项需要刷新页面才能生效 ", -1));
  2828. const _hoisted_89 = { class: "row" };
  2829. const _hoisted_90 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("label", { class: "item-title" }, "收藏时提醒添加到书签", -1));
  2830. const _hoisted_91 = { class: "wrapper" };
  2831. const _hoisted_92 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "desc" }, " V站帐号一旦被封禁,则无法登录,无法查看账号收藏了 ", -1));
  2832. const _hoisted_93 = { key: 3 };
  2833. const _hoisted_94 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("h1", null, "V2EX Next", -1));
  2834. const _hoisted_95 = { class: "project-desc" };
  2835. const _hoisted_96 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("div", null, [
  2836. /* @__PURE__ */ vue.createTextVNode(" 本项目完全开源,已支持移动端!"),
  2837. /* @__PURE__ */ vue.createElementVNode("b", null, "好用请大家多多点Star!")
  2838. ], -1));
  2839. const _hoisted_97 = /* @__PURE__ */ _withScopeId$9(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  2840. const _hoisted_98 = { style: { "line-height": "2" } };
  2841. const _hoisted_99 = ["href"];
  2842. const _hoisted_100 = ["href"];
  2843. const _hoisted_101 = ["href"];
  2844. const _hoisted_102 = ["href"];
  2845. const _hoisted_103 = ["href"];
  2846. const _hoisted_104 = ["href"];
  2847. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  2848. const _component_Icon = vue.resolveComponent("Icon");
  2849. const _component_BaseSwitch = vue.resolveComponent("BaseSwitch");
  2850. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  2851. const _component_NoticeModal = vue.resolveComponent("NoticeModal");
  2852. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  2853. default: vue.withCtx(() => [
  2854. $props.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
  2855. vue.createElementVNode("div", {
  2856. class: "mask",
  2857. onClick: _cache[0] || (_cache[0] = (...args) => $options.close && $options.close(...args))
  2858. }),
  2859. vue.createElementVNode("div", _hoisted_2$b, [
  2860. vue.createElementVNode("div", _hoisted_3$9, [
  2861. vue.createElementVNode("div", _hoisted_4$9, [
  2862. vue.createTextVNode(" 脚本设置 "),
  2863. vue.createElementVNode("div", _hoisted_5$7, [
  2864. vue.createElementVNode("a", {
  2865. href: $options.DefaultVal.mobileScript,
  2866. target: "_blank"
  2867. }, "(脚本现已支持移动端!)", 8, _hoisted_6$7)
  2868. ])
  2869. ]),
  2870. vue.createVNode(_component_Icon, {
  2871. icon: "ic:round-close",
  2872. onClick: $options.close
  2873. }, null, 8, ["onClick"])
  2874. ]),
  2875. vue.createElementVNode("div", _hoisted_7$6, [
  2876. vue.createElementVNode("div", _hoisted_8$6, [
  2877. vue.createElementVNode("div", _hoisted_9$6, [
  2878. vue.createElementVNode("div", {
  2879. class: vue.normalizeClass(["tab", $data.tabIndex === 0 && "active"]),
  2880. onClick: _cache[1] || (_cache[1] = ($event) => $data.tabIndex = 0)
  2881. }, _hoisted_11$5, 2),
  2882. vue.createElementVNode("div", {
  2883. class: vue.normalizeClass(["tab", $data.tabIndex === 1 && "active"]),
  2884. onClick: _cache[2] || (_cache[2] = ($event) => $data.tabIndex = 1)
  2885. }, _hoisted_13$5, 2),
  2886. vue.createElementVNode("div", {
  2887. class: vue.normalizeClass(["tab", $data.tabIndex === 2 && "active"]),
  2888. onClick: _cache[3] || (_cache[3] = ($event) => $data.tabIndex = 2)
  2889. }, _hoisted_15$4, 2),
  2890. vue.createElementVNode("div", {
  2891. class: vue.normalizeClass(["tab", $data.tabIndex === 3 && "active"]),
  2892. onClick: _cache[4] || (_cache[4] = ($event) => $data.tabIndex = 3)
  2893. }, _hoisted_17$3, 2)
  2894. ]),
  2895. vue.createElementVNode("div", _hoisted_18$3, [
  2896. vue.createElementVNode("a", {
  2897. href: $options.DefaultVal.git,
  2898. target: "_blank"
  2899. }, [
  2900. vue.createVNode(_component_Icon, { icon: "mdi:github" })
  2901. ], 8, _hoisted_19$3),
  2902. vue.createElementVNode("a", {
  2903. href: $options.DefaultVal.homeUrl,
  2904. target: "_blank"
  2905. }, [
  2906. vue.createVNode(_component_Icon, { icon: "iconamoon:home-light" })
  2907. ], 8, _hoisted_20$2)
  2908. ])
  2909. ]),
  2910. vue.createElementVNode("div", _hoisted_21$2, [
  2911. vue.createElementVNode("div", _hoisted_22$2, [
  2912. $data.tabIndex === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_23$2, [
  2913. vue.createElementVNode("div", _hoisted_24$2, [
  2914. _hoisted_25$1,
  2915. vue.createElementVNode("div", _hoisted_26$1, [
  2916. vue.createElementVNode("div", _hoisted_27$1, [
  2917. vue.createElementVNode("div", {
  2918. class: vue.normalizeClass(["radio", $data.config.viewType === "simple" ? "active" : ""]),
  2919. onClick: _cache[5] || (_cache[5] = ($event) => $data.config.viewType = "simple")
  2920. }, "简洁 ", 2),
  2921. vue.createElementVNode("div", {
  2922. class: vue.normalizeClass(["radio", $data.config.viewType === "table" ? "active" : ""]),
  2923. onClick: _cache[6] || (_cache[6] = ($event) => $data.config.viewType = "table")
  2924. }, "表格 ", 2),
  2925. vue.createElementVNode("div", {
  2926. class: vue.normalizeClass(["radio", $data.config.viewType === "card" ? "active" : ""]),
  2927. onClick: _cache[7] || (_cache[7] = ($event) => $data.showNotice = true)
  2928. }, "卡片 ", 2)
  2929. ])
  2930. ])
  2931. ]),
  2932. _hoisted_28$1,
  2933. vue.createElementVNode("div", _hoisted_29$1, [
  2934. _hoisted_30$1,
  2935. vue.createElementVNode("div", _hoisted_31$1, [
  2936. vue.createVNode(_component_BaseSwitch, {
  2937. modelValue: $data.config.clickPostItemOpenDetail,
  2938. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.config.clickPostItemOpenDetail = $event)
  2939. }, null, 8, ["modelValue"])
  2940. ])
  2941. ]),
  2942. _hoisted_32$1,
  2943. vue.createElementVNode("div", _hoisted_33$1, [
  2944. _hoisted_34$1,
  2945. vue.createElementVNode("div", _hoisted_35$1, [
  2946. vue.createVNode(_component_BaseSwitch, {
  2947. modelValue: $data.config.newTabOpen,
  2948. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.config.newTabOpen = $event)
  2949. }, null, 8, ["modelValue"])
  2950. ])
  2951. ]),
  2952. _hoisted_36$1,
  2953. vue.createElementVNode("div", _hoisted_37$1, [
  2954. _hoisted_38$1,
  2955. vue.createElementVNode("div", _hoisted_39$1, [
  2956. vue.createVNode(_component_BaseSwitch, {
  2957. modelValue: $data.config.newTabOpenActive,
  2958. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.config.newTabOpenActive = $event)
  2959. }, null, 8, ["modelValue"])
  2960. ])
  2961. ])
  2962. ])) : vue.createCommentVNode("", true),
  2963. $data.tabIndex === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_40$1, [
  2964. vue.createElementVNode("div", _hoisted_41$1, [
  2965. _hoisted_42$1,
  2966. vue.createElementVNode("div", _hoisted_43$1, [
  2967. vue.createVNode(_component_BaseSwitch, {
  2968. modelValue: $data.config.showToolbar,
  2969. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.config.showToolbar = $event)
  2970. }, null, 8, ["modelValue"])
  2971. ])
  2972. ]),
  2973. vue.createElementVNode("div", _hoisted_44$1, [
  2974. _hoisted_45$1,
  2975. vue.createElementVNode("div", _hoisted_46$1, [
  2976. vue.createVNode(_component_BaseSelect, {
  2977. "display-type": $data.config.commentDisplayType,
  2978. "onUpdate:displayType": _cache[12] || (_cache[12] = ($event) => $data.config.commentDisplayType = $event)
  2979. }, null, 8, ["display-type"])
  2980. ])
  2981. ]),
  2982. vue.createElementVNode("div", _hoisted_47$1, [
  2983. _hoisted_48$1,
  2984. vue.createElementVNode("div", _hoisted_49$1, [
  2985. vue.createVNode(_component_BaseSwitch, {
  2986. modelValue: $data.config.autoOpenDetail,
  2987. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.config.autoOpenDetail = $event)
  2988. }, null, 8, ["modelValue"])
  2989. ])
  2990. ]),
  2991. _hoisted_50,
  2992. vue.createElementVNode("div", _hoisted_51, [
  2993. _hoisted_52,
  2994. vue.createElementVNode("div", _hoisted_53, [
  2995. vue.createVNode(_component_BaseSwitch, {
  2996. modelValue: $data.config.closePostDetailBySpace,
  2997. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.config.closePostDetailBySpace = $event)
  2998. }, null, 8, ["modelValue"])
  2999. ])
  3000. ]),
  3001. vue.createElementVNode("div", _hoisted_54, [
  3002. _hoisted_55,
  3003. vue.createElementVNode("div", _hoisted_56, [
  3004. vue.createVNode(_component_BaseSwitch, {
  3005. modelValue: $data.config.contentAutoCollapse,
  3006. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => $data.config.contentAutoCollapse = $event)
  3007. }, null, 8, ["modelValue"])
  3008. ])
  3009. ]),
  3010. vue.createElementVNode("div", _hoisted_57, [
  3011. _hoisted_58,
  3012. vue.createElementVNode("div", _hoisted_59, [
  3013. vue.withDirectives(vue.createElementVNode("input", {
  3014. type: "text",
  3015. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => $data.config.postWidth = $event)
  3016. }, null, 512), [
  3017. [vue.vModelText, $data.config.postWidth]
  3018. ])
  3019. ])
  3020. ]),
  3021. _hoisted_60,
  3022. _hoisted_61,
  3023. _hoisted_62,
  3024. _hoisted_63,
  3025. vue.createElementVNode("div", _hoisted_64, [
  3026. _hoisted_65,
  3027. vue.createElementVNode("div", _hoisted_66, [
  3028. vue.createVNode(_component_BaseSwitch, {
  3029. modelValue: $data.config.showTopReply,
  3030. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => $data.config.showTopReply = $event)
  3031. }, null, 8, ["modelValue"])
  3032. ])
  3033. ]),
  3034. vue.createElementVNode("div", _hoisted_67, [
  3035. _hoisted_68,
  3036. vue.createElementVNode("div", _hoisted_69, [
  3037. vue.withDirectives(vue.createElementVNode("input", {
  3038. type: "number",
  3039. min: "1",
  3040. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => $data.config.topReplyCount = $event)
  3041. }, null, 512), [
  3042. [vue.vModelText, $data.config.topReplyCount]
  3043. ])
  3044. ])
  3045. ]),
  3046. vue.createElementVNode("div", _hoisted_70, [
  3047. _hoisted_71,
  3048. vue.createElementVNode("div", _hoisted_72, [
  3049. vue.withDirectives(vue.createElementVNode("input", {
  3050. type: "number",
  3051. min: "1",
  3052. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => $data.config.topReplyLoveMinCount = $event)
  3053. }, null, 512), [
  3054. [vue.vModelText, $data.config.topReplyLoveMinCount]
  3055. ])
  3056. ])
  3057. ])
  3058. ])) : vue.createCommentVNode("", true),
  3059. $data.tabIndex === 2 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_73, [
  3060. vue.createElementVNode("div", _hoisted_74, [
  3061. _hoisted_75,
  3062. vue.createElementVNode("div", _hoisted_76, [
  3063. vue.createVNode(_component_BaseSwitch, {
  3064. modelValue: $data.config.openTag,
  3065. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => $data.config.openTag = $event)
  3066. }, null, 8, ["modelValue"])
  3067. ])
  3068. ]),
  3069. _hoisted_77,
  3070. vue.createElementVNode("div", _hoisted_78, [
  3071. _hoisted_79,
  3072. vue.createElementVNode("div", _hoisted_80, [
  3073. vue.createVNode(_component_BaseSwitch, {
  3074. modelValue: $data.config.base64,
  3075. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => $data.config.base64 = $event)
  3076. }, null, 8, ["modelValue"])
  3077. ])
  3078. ]),
  3079. vue.createElementVNode("div", _hoisted_81, [
  3080. _hoisted_82,
  3081. vue.createElementVNode("div", _hoisted_83, [
  3082. vue.createVNode(_component_BaseSwitch, {
  3083. modelValue: $data.config.autoSignin,
  3084. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => $data.config.autoSignin = $event)
  3085. }, null, 8, ["modelValue"])
  3086. ])
  3087. ]),
  3088. vue.createElementVNode("div", _hoisted_84, [
  3089. _hoisted_85,
  3090. vue.createElementVNode("div", _hoisted_86, [
  3091. vue.withDirectives(vue.createElementVNode("input", {
  3092. type: "text",
  3093. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => $data.config.customBgColor = $event)
  3094. }, null, 512), [
  3095. [vue.vModelText, $data.config.customBgColor]
  3096. ])
  3097. ])
  3098. ]),
  3099. _hoisted_87,
  3100. _hoisted_88,
  3101. vue.createElementVNode("div", _hoisted_89, [
  3102. _hoisted_90,
  3103. vue.createElementVNode("div", _hoisted_91, [
  3104. vue.createVNode(_component_BaseSwitch, {
  3105. modelValue: $data.config.collectBrowserNotice,
  3106. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => $data.config.collectBrowserNotice = $event)
  3107. }, null, 8, ["modelValue"])
  3108. ])
  3109. ]),
  3110. _hoisted_92
  3111. ])) : vue.createCommentVNode("", true),
  3112. $data.tabIndex === 3 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_93, [
  3113. _hoisted_94,
  3114. vue.createElementVNode("div", _hoisted_95, [
  3115. _hoisted_96,
  3116. _hoisted_97,
  3117. vue.createElementVNode("div", _hoisted_98, [
  3118. vue.createElementVNode("div", null, [
  3119. vue.createTextVNode("官网:"),
  3120. vue.createElementVNode("a", {
  3121. href: $options.DefaultVal.homeUrl,
  3122. target: "_blank"
  3123. }, vue.toDisplayString($options.DefaultVal.homeUrl), 9, _hoisted_99)
  3124. ]),
  3125. vue.createElementVNode("div", null, [
  3126. vue.createTextVNode("GitHub地址:"),
  3127. vue.createElementVNode("a", {
  3128. href: $options.DefaultVal.git,
  3129. target: "_blank"
  3130. }, vue.toDisplayString($options.DefaultVal.git), 9, _hoisted_100)
  3131. ]),
  3132. vue.createElementVNode("div", null, [
  3133. vue.createTextVNode("PC脚本地址:"),
  3134. vue.createElementVNode("a", {
  3135. href: $options.DefaultVal.pcScript,
  3136. target: "_blank"
  3137. }, vue.toDisplayString($options.DefaultVal.pcScript), 9, _hoisted_101)
  3138. ]),
  3139. vue.createElementVNode("div", null, [
  3140. vue.createTextVNode("移动端脚本地址:"),
  3141. vue.createElementVNode("a", {
  3142. href: $options.DefaultVal.mobileScript,
  3143. target: "_blank"
  3144. }, vue.toDisplayString($options.DefaultVal.mobileScript), 9, _hoisted_102)
  3145. ]),
  3146. vue.createElementVNode("div", null, [
  3147. vue.createTextVNode("反馈: "),
  3148. vue.createElementVNode("a", {
  3149. href: $options.DefaultVal.issue,
  3150. target: "_blank"
  3151. }, vue.toDisplayString($options.DefaultVal.issue), 9, _hoisted_103)
  3152. ]),
  3153. vue.createElementVNode("div", null, [
  3154. vue.createTextVNode("更新日志:"),
  3155. vue.createElementVNode("a", {
  3156. href: $options.DefaultVal.pcLog,
  3157. target: "_blank"
  3158. }, vue.toDisplayString($options.DefaultVal.pcLog), 9, _hoisted_104)
  3159. ])
  3160. ])
  3161. ])
  3162. ])) : vue.createCommentVNode("", true)
  3163. ])
  3164. ])
  3165. ])
  3166. ]),
  3167. vue.createVNode(_component_NoticeModal, {
  3168. show: $data.showNotice,
  3169. "onUpdate:show": _cache[25] || (_cache[25] = ($event) => $data.showNotice = $event),
  3170. onConfirm: _cache[26] || (_cache[26] = ($event) => $data.config.viewType = "card")
  3171. }, null, 8, ["show"])
  3172. ])) : vue.createCommentVNode("", true)
  3173. ]),
  3174. _: 1
  3175. });
  3176. }
  3177. const Setting = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$7], ["__scopeId", "data-v-df0e0e8f"]]);
  3178. const eventBus = {
  3179. eventMap: /* @__PURE__ */ new Map(),
  3180. on(eventType, cb) {
  3181. let cbs = this.eventMap.get(eventType);
  3182. if (cbs) {
  3183. cbs.push(cb);
  3184. } else {
  3185. cbs = [cb];
  3186. }
  3187. this.eventMap.set(eventType, cbs);
  3188. },
  3189. emit(eventType, val) {
  3190. let cbs = this.eventMap.get(eventType);
  3191. if (cbs) {
  3192. cbs.map((cb) => cb(val));
  3193. }
  3194. },
  3195. off(eventType) {
  3196. let cbs = this.eventMap.has(eventType);
  3197. if (cbs) {
  3198. this.eventMap.delete(eventType);
  3199. }
  3200. },
  3201. clear() {
  3202. this.eventMap = /* @__PURE__ */ new Map();
  3203. }
  3204. };
  3205. const CMD = {
  3206. SHOW_TOOLTIP: "SHOW_TOOLTIP",
  3207. SHOW_MSG: "SHOW_MSG",
  3208. SET_CALL: "SET_CALL",
  3209. SHOW_CALL: "SHOW_CALL",
  3210. REFRESH_ONCE: "REFRESH_ONCE",
  3211. ADD_REPLY: "ADD_REPLY",
  3212. IGNORE: "IGNORE",
  3213. MERGE: "MERGE",
  3214. REMOVE: "REMOVE",
  3215. CHANGE_COMMENT_THANK: "CHANGE_COMMENT_THANK",
  3216. CHANGE_POST_THANK: "CHANGE_POST_THANK",
  3217. ADD_TAG: "ADD_TAG",
  3218. REMOVE_TAG: "REMOVE_TAG",
  3219. RELATION_REPLY: "RELATION_REPLY",
  3220. JUMP: "JUMP",
  3221. REFRESH_POST: "REFRESH_POST"
  3222. };
  3223. const _sfc_main$d = {
  3224. name: "Point",
  3225. components: { PopConfirm, Icon },
  3226. inject: ["post", "isLogin"],
  3227. props: {
  3228. item: {
  3229. type: Object,
  3230. default() {
  3231. return {};
  3232. }
  3233. },
  3234. apiUrl: ""
  3235. },
  3236. computed: {
  3237. disabled() {
  3238. return this.item.username === window.user.username || this.item.isThanked || !this.isLogin;
  3239. }
  3240. },
  3241. methods: {
  3242. thankError() {
  3243. if (!this.isLogin) {
  3244. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3245. }
  3246. if (this.item.username === window.user.username) {
  3247. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "不能感谢自己" });
  3248. }
  3249. if (this.item.isThanked) {
  3250. return eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "已经感谢过了" });
  3251. }
  3252. },
  3253. async thank() {
  3254. this.$emit("addThank");
  3255. let url = `${window.baseUrl}/thank/${this.apiUrl}?once=${this.post.once}`;
  3256. $.post(url).then((res) => {
  3257. if (!res.success) {
  3258. this.$emit("recallThank");
  3259. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: res.message });
  3260. }
  3261. eventBus.emit(CMD.REFRESH_ONCE, res.once);
  3262. }, (err) => {
  3263. this.$emit("recallThank");
  3264. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "感谢失败" });
  3265. eventBus.emit(CMD.REFRESH_ONCE);
  3266. });
  3267. }
  3268. }
  3269. };
  3270. const _hoisted_1$d = {
  3271. key: 2,
  3272. class: "link-num"
  3273. };
  3274. const _hoisted_2$a = { key: 3 };
  3275. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  3276. const _component_Icon = vue.resolveComponent("Icon");
  3277. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3278. return vue.openBlock(), vue.createBlock(_component_PopConfirm, {
  3279. disabled: $options.disabled,
  3280. title: `确认花费 10 个铜币向 @${$props.item.username} 的这条回复发送感谢?`,
  3281. onConfirm: $options.thank
  3282. }, {
  3283. default: vue.withCtx(() => [
  3284. vue.createElementVNode("div", {
  3285. class: vue.normalizeClass(["tool", [$options.disabled && "disabled"]]),
  3286. onClick: _cache[0] || (_cache[0] = (...args) => $options.thankError && $options.thankError(...args))
  3287. }, [
  3288. $props.item.isThanked ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3289. key: 0,
  3290. color: "rgb(224,42,42)",
  3291. icon: "icon-park-solid:like"
  3292. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  3293. key: 1,
  3294. color: !$props.item.thankCount ? null : "rgb(224,42,42)",
  3295. icon: "icon-park-outline:like"
  3296. }, null, 8, ["color"])),
  3297. $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, "感谢"))
  3298. ], 2)
  3299. ]),
  3300. _: 1
  3301. }, 8, ["disabled", "title", "onConfirm"]);
  3302. }
  3303. const Point = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$6]]);
  3304. const _sfc_main$c = {
  3305. name: "Author",
  3306. components: { PopConfirm, Point, Icon },
  3307. inject: ["isLogin", "tags", "config", "isNight"],
  3308. props: {
  3309. modelValue: false,
  3310. comment: {
  3311. type: Object,
  3312. default() {
  3313. return {};
  3314. }
  3315. },
  3316. type: {
  3317. type: String,
  3318. default() {
  3319. return "list";
  3320. }
  3321. }
  3322. },
  3323. computed: {
  3324. isDev() {
  3325. return false;
  3326. },
  3327. pointInfo() {
  3328. return {
  3329. isThanked: this.comment.isThanked,
  3330. thankCount: this.comment.thankCount,
  3331. username: this.comment.username
  3332. };
  3333. },
  3334. myTags() {
  3335. return this.tags[this.comment.username] ?? [];
  3336. },
  3337. context() {
  3338. return this.comment.replyUsers.length;
  3339. }
  3340. },
  3341. methods: {
  3342. jump() {
  3343. eventBus.emit(CMD.JUMP, this.comment.floor);
  3344. },
  3345. showRelationReply() {
  3346. if (!this.comment.replyUsers.length) {
  3347. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "该回复无上下文" });
  3348. return;
  3349. }
  3350. eventBus.emit(CMD.RELATION_REPLY, {
  3351. left: this.comment.replyUsers,
  3352. right: this.comment.username,
  3353. rightFloor: this.comment.floor
  3354. });
  3355. },
  3356. addTag() {
  3357. eventBus.emit(CMD.ADD_TAG, this.comment.username);
  3358. },
  3359. removeTag(tag) {
  3360. eventBus.emit(CMD.REMOVE_TAG, { username: this.comment.username, tag });
  3361. },
  3362. checkIsLogin(emitName = "") {
  3363. if (!this.isLogin) {
  3364. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  3365. return false;
  3366. }
  3367. this.$emit(emitName);
  3368. return true;
  3369. },
  3370. addThank() {
  3371. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "add" });
  3372. },
  3373. recallThank() {
  3374. eventBus.emit(CMD.CHANGE_COMMENT_THANK, { id: this.comment.id, type: "recall" });
  3375. }
  3376. }
  3377. };
  3378. const _withScopeId$8 = (n2) => (vue.pushScopeId("data-v-53261a54"), n2 = n2(), vue.popScopeId(), n2);
  3379. const _hoisted_1$c = { class: "Author-left" };
  3380. const _hoisted_2$9 = ["href"];
  3381. const _hoisted_3$8 = ["src"];
  3382. const _hoisted_4$8 = { class: "texts" };
  3383. const _hoisted_5$6 = ["href"];
  3384. const _hoisted_6$6 = {
  3385. key: 0,
  3386. class: "owner"
  3387. };
  3388. const _hoisted_7$5 = {
  3389. key: 1,
  3390. class: "dup"
  3391. };
  3392. const _hoisted_8$5 = {
  3393. key: 2,
  3394. class: "mod"
  3395. };
  3396. const _hoisted_9$5 = { class: "ago" };
  3397. const _hoisted_10$4 = { class: "my-tag" };
  3398. const _hoisted_11$4 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  3399. const _hoisted_12$4 = ["onClick"];
  3400. const _hoisted_13$4 = { class: "Author-right" };
  3401. const _hoisted_14$4 = {
  3402. key: 0,
  3403. class: "toolbar"
  3404. };
  3405. const _hoisted_15$3 = { class: "tool" };
  3406. const _hoisted_16$3 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "隐藏", -1));
  3407. const _hoisted_17$2 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "上下文", -1));
  3408. const _hoisted_18$2 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  3409. const _hoisted_19$2 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  3410. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  3411. const _component_Icon = vue.resolveComponent("Icon");
  3412. const _component_PopConfirm = vue.resolveComponent("PopConfirm");
  3413. const _component_Point = vue.resolveComponent("Point");
  3414. return vue.openBlock(), vue.createElementBlock("div", {
  3415. class: vue.normalizeClass(["Author", { expand: !$props.modelValue }])
  3416. }, [
  3417. vue.createElementVNode("div", _hoisted_1$c, [
  3418. !$props.modelValue ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  3419. key: 0,
  3420. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", true)),
  3421. color: "#177EC9",
  3422. class: "expand-icon",
  3423. icon: "gravity-ui:chevrons-expand-up-right"
  3424. })) : vue.createCommentVNode("", true),
  3425. $options.config.viewType !== "simple" ? (vue.openBlock(), vue.createElementBlock("a", {
  3426. key: 1,
  3427. class: "avatar",
  3428. href: `/member/${$props.comment.username}`
  3429. }, [
  3430. vue.createElementVNode("img", {
  3431. src: $props.comment.avatar,
  3432. alt: ""
  3433. }, null, 8, _hoisted_3$8)
  3434. ], 8, _hoisted_2$9)) : vue.createCommentVNode("", true),
  3435. vue.createElementVNode("span", _hoisted_4$8, [
  3436. vue.createElementVNode("strong", null, [
  3437. vue.createElementVNode("a", {
  3438. href: `/member/${$props.comment.username}`,
  3439. class: vue.normalizeClass(["username", { "dark": $options.isNight }])
  3440. }, vue.toDisplayString($props.comment.username), 11, _hoisted_5$6)
  3441. ]),
  3442. $props.comment.isOp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$6, "OP")) : vue.createCommentVNode("", true),
  3443. $props.comment.isDup ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$5, "DUP")) : vue.createCommentVNode("", true),
  3444. $props.comment.isMod ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$5, "MOD")) : vue.createCommentVNode("", true),
  3445. vue.createElementVNode("span", _hoisted_9$5, vue.toDisplayString($props.comment.date), 1),
  3446. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  3447. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  3448. return vue.openBlock(), vue.createElementBlock("span", _hoisted_10$4, [
  3449. _hoisted_11$4,
  3450. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  3451. vue.createElementVNode("i", {
  3452. class: "fa fa-trash-o remove",
  3453. onClick: ($event) => $options.removeTag(i)
  3454. }, null, 8, _hoisted_12$4)
  3455. ]);
  3456. }), 256)),
  3457. vue.createElementVNode("span", {
  3458. class: "add-tag ago",
  3459. onClick: _cache[1] || (_cache[1] = (...args) => $options.addTag && $options.addTag(...args)),
  3460. title: "添加标签"
  3461. }, "+")
  3462. ], 64)) : vue.createCommentVNode("", true)
  3463. ])
  3464. ]),
  3465. vue.createElementVNode("div", _hoisted_13$4, [
  3466. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$4, [
  3467. vue.createVNode(_component_PopConfirm, {
  3468. title: "确认隐藏这条回复?",
  3469. onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
  3470. }, {
  3471. default: vue.withCtx(() => [
  3472. vue.createElementVNode("div", _hoisted_15$3, [
  3473. vue.createVNode(_component_Icon, { icon: "fluent:eye-hide-24-regular" }),
  3474. _hoisted_16$3
  3475. ])
  3476. ]),
  3477. _: 1
  3478. }),
  3479. $options.context ? (vue.openBlock(), vue.createElementBlock("div", {
  3480. key: 0,
  3481. class: "tool",
  3482. onClick: _cache[3] || (_cache[3] = (...args) => $options.showRelationReply && $options.showRelationReply(...args))
  3483. }, [
  3484. vue.createVNode(_component_Icon, { icon: "iconoir:page-search" }),
  3485. _hoisted_17$2
  3486. ])) : vue.createCommentVNode("", true),
  3487. $props.type === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  3488. key: 1,
  3489. class: "tool",
  3490. onClick: _cache[4] || (_cache[4] = (...args) => $options.jump && $options.jump(...args))
  3491. }, [
  3492. vue.createVNode(_component_Icon, { icon: "icon-park-outline:to-bottom" }),
  3493. _hoisted_18$2
  3494. ])) : vue.createCommentVNode("", true),
  3495. vue.createElementVNode("div", {
  3496. class: "tool",
  3497. onClick: _cache[5] || (_cache[5] = ($event) => $options.checkIsLogin("reply"))
  3498. }, [
  3499. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  3500. _hoisted_19$2
  3501. ]),
  3502. vue.withDirectives(vue.createVNode(_component_Point, {
  3503. item: $options.pointInfo,
  3504. onAddThank: $options.addThank,
  3505. onRecallThank: $options.recallThank,
  3506. "api-url": "reply/" + $props.comment.id
  3507. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3508. [vue.vShow, !$props.comment.thankCount]
  3509. ])
  3510. ])) : vue.createCommentVNode("", true),
  3511. vue.withDirectives(vue.createVNode(_component_Point, {
  3512. item: $options.pointInfo,
  3513. onAddThank: $options.addThank,
  3514. onRecallThank: $options.recallThank,
  3515. "api-url": "reply/" + $props.comment.id
  3516. }, null, 8, ["item", "onAddThank", "onRecallThank", "api-url"]), [
  3517. [vue.vShow, $props.comment.thankCount]
  3518. ]),
  3519. vue.createElementVNode("div", {
  3520. class: vue.normalizeClass(["floor", { isDev: $options.isDev }])
  3521. }, vue.toDisplayString($props.comment.floor), 3)
  3522. ])
  3523. ], 2);
  3524. }
  3525. const Author = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$5], ["__scopeId", "data-v-53261a54"]]);
  3526. const _withScopeId$7 = (n2) => (vue.pushScopeId("data-v-4522f98e"), n2 = n2(), vue.popScopeId(), n2);
  3527. const _hoisted_1$b = { class: "get-cursor" };
  3528. const _hoisted_2$8 = ["innerHTML"];
  3529. const _hoisted_3$7 = { class: "toolbar" };
  3530. const _hoisted_4$7 = { class: "left" };
  3531. const _hoisted_5$5 = { class: "upload" };
  3532. const _hoisted_6$5 = {
  3533. key: 0,
  3534. style: { "color": "black", "font-size": "1.4rem" }
  3535. };
  3536. const _hoisted_7$4 = { class: "right" };
  3537. const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$7(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, "经典表情", -1));
  3538. const _hoisted_9$4 = { class: "list" };
  3539. const _hoisted_10$3 = ["src", "onClick"];
  3540. const _hoisted_11$3 = { class: "emoji" };
  3541. const _hoisted_12$3 = { class: "title" };
  3542. const _hoisted_13$3 = { class: "list" };
  3543. const _hoisted_14$3 = ["onClick"];
  3544. const _sfc_main$b = {
  3545. __name: "PostEditor",
  3546. props: {
  3547. replyUser: null,
  3548. replyFloor: null,
  3549. useType: {
  3550. type: String,
  3551. default() {
  3552. return "reply-comment";
  3553. }
  3554. }
  3555. },
  3556. emits: ["close"],
  3557. setup(__props, { expose: __expose, emit: __emit }) {
  3558. const props = __props;
  3559. const { replyUser, replyFloor, useType } = props;
  3560. const replyInfo = replyUser ? `@${replyUser} #${replyFloor} ` : "";
  3561. const emits = __emit;
  3562. const post = vue.inject("post");
  3563. const show = vue.inject("show");
  3564. const isNight = vue.inject("isNight");
  3565. vue.inject("pageType");
  3566. const allReplyUsers = vue.inject("allReplyUsers");
  3567. let isFocus = vue.ref(false);
  3568. const loading = vue.ref(false);
  3569. const uploadLoading = vue.ref(false);
  3570. const isShowEmoticons = vue.ref(false);
  3571. const editorId = vue.ref("editorId_" + Date.now());
  3572. const content = vue.ref(replyInfo);
  3573. const txtRef = vue.ref(null);
  3574. const cursorRef = vue.ref(null);
  3575. const emoticonsRef = vue.ref(null);
  3576. const none = vue.ref('<span style="white-space:pre-wrap;"> </span>');
  3577. const emojiEmoticons = [
  3578. {
  3579. title: "小黄脸",
  3580. list: [
  3581. "😀",
  3582. "😁",
  3583. "😂",
  3584. "🤣",
  3585. "😅",
  3586. "😊",
  3587. "😋",
  3588. "😘",
  3589. "🥰",
  3590. "😗",
  3591. "🤩",
  3592. "🤔",
  3593. "🤨",
  3594. "😐",
  3595. "😑",
  3596. "🙄",
  3597. "😏",
  3598. "😪",
  3599. "😫",
  3600. "🥱",
  3601. "😜",
  3602. "😒",
  3603. "😔",
  3604. "😨",
  3605. "😰",
  3606. "😱",
  3607. "🥵",
  3608. "😡",
  3609. "🥳",
  3610. "🥺",
  3611. "🤭",
  3612. "🧐",
  3613. "😎",
  3614. "🤓",
  3615. "😭",
  3616. "🤑",
  3617. "🤮"
  3618. ]
  3619. },
  3620. {
  3621. title: "手势",
  3622. list: [
  3623. "🙋",
  3624. "🙎",
  3625. "🙅",
  3626. "🙇",
  3627. "🤷",
  3628. "🤏",
  3629. "👉",
  3630. "✌️",
  3631. "🤘",
  3632. "🤙",
  3633. "👌",
  3634. "🤌",
  3635. "👍",
  3636. "👎",
  3637. "👋",
  3638. "🤝",
  3639. "🙏",
  3640. "👏"
  3641. ]
  3642. },
  3643. {
  3644. title: "庆祝",
  3645. list: ["✨", "🎉", "🎊"]
  3646. },
  3647. {
  3648. title: "其他",
  3649. list: ["👻", "🤡", "🐔", "👀", "💩", "🐴", "🦄", "🐧", "🐶", "🐒", "🙈", "🙉", "🙊", "🐵"]
  3650. }
  3651. ];
  3652. const classicsEmoticons = [
  3653. {
  3654. name: "[狗头]",
  3655. low: "https://i.imgur.com/io2SM1h.png",
  3656. high: "https://i.imgur.com/0icl60r.png"
  3657. },
  3658. {
  3659. name: "[马]",
  3660. low: "https://i.imgur.com/8EKZv7I.png",
  3661. high: "https://i.imgur.com/ANFUX52.png"
  3662. },
  3663. {
  3664. name: "[不高兴]",
  3665. low: "https://i.imgur.com/huX6coX.png",
  3666. high: "https://i.imgur.com/N7JEuvc.png"
  3667. },
  3668. {
  3669. name: "[呵呵]",
  3670. low: "https://i.imgur.com/RvoLAbX.png",
  3671. high: "https://i.imgur.com/xSzIqrK.png"
  3672. },
  3673. {
  3674. name: "[真棒]",
  3675. low: "https://i.imgur.com/xr1UOz1.png",
  3676. high: "https://i.imgur.com/w8YEw9Q.png"
  3677. },
  3678. {
  3679. name: "[鄙视]",
  3680. low: "https://i.imgur.com/u6jlqVq.png",
  3681. high: "https://i.imgur.com/8JFNANq.png"
  3682. },
  3683. {
  3684. name: "[疑问]",
  3685. low: "https://i.imgur.com/F29pmQ6.png",
  3686. high: "https://i.imgur.com/EbbTQAR.png"
  3687. },
  3688. {
  3689. name: "[吐舌]",
  3690. low: "https://i.imgur.com/InmIzl9.png",
  3691. high: "https://i.imgur.com/Ovj56Cd.png"
  3692. },
  3693. // {
  3694. // name: '[嘲笑]',
  3695. // low: 'https://i.imgur.com/BaWcsMR.png',
  3696. // high: 'https://i.imgur.com/0OGfJw4.png'
  3697. // },
  3698. // {
  3699. // name: '[滑稽]',
  3700. // low: 'https://i.imgur.com/lmbN0yI.png',
  3701. // high: 'https://i.imgur.com/Pc0wH85.png'
  3702. // },
  3703. {
  3704. name: "[笑眼]",
  3705. low: "https://i.imgur.com/ZveiiGy.png",
  3706. high: "https://i.imgur.com/PI1CfEr.png"
  3707. },
  3708. {
  3709. name: "[狂汗]",
  3710. low: "https://i.imgur.com/veWihk6.png",
  3711. high: "https://i.imgur.com/3LtHdQv.png"
  3712. },
  3713. {
  3714. name: "[大哭]",
  3715. low: "https://i.imgur.com/hu4oR6C.png",
  3716. high: "https://i.imgur.com/b4X9XLE.png"
  3717. },
  3718. {
  3719. name: "[喷]",
  3720. low: "https://i.imgur.com/bkw3VRr.png",
  3721. high: "https://i.imgur.com/wnZL13L.png"
  3722. },
  3723. {
  3724. name: "[苦笑]",
  3725. low: "https://i.imgur.com/VUWFktU.png",
  3726. high: "https://i.imgur.com/NAfspZ1.png"
  3727. },
  3728. {
  3729. name: "[喝酒]",
  3730. low: "https://i.imgur.com/2ZZSapE.png",
  3731. high: "https://i.imgur.com/rVbSVak.png"
  3732. },
  3733. {
  3734. name: "[吃瓜]",
  3735. low: "https://i.imgur.com/ee8Lq7H.png",
  3736. high: "https://i.imgur.com/0L26og9.png"
  3737. },
  3738. {
  3739. name: "[捂脸]",
  3740. low: "https://i.imgur.com/krir4IG.png",
  3741. high: "https://i.imgur.com/qqBqgVm.png"
  3742. },
  3743. {
  3744. name: "[呕]",
  3745. low: "https://i.imgur.com/6CUiUxv.png",
  3746. high: "https://i.imgur.com/kgdxRsG.png"
  3747. },
  3748. {
  3749. name: "[阴险]",
  3750. low: "https://i.imgur.com/MA8YqTP.png",
  3751. high: "https://i.imgur.com/e94jbaT.png"
  3752. },
  3753. {
  3754. name: "[怒]",
  3755. low: "https://i.imgur.com/n4kWfGB.png",
  3756. high: "https://i.imgur.com/iMXxNxh.png"
  3757. },
  3758. {
  3759. name: "[衰]",
  3760. low: "https://i.imgur.com/voHFDyQ.png",
  3761. high: "https://i.imgur.com/XffE6gu.png"
  3762. },
  3763. {
  3764. name: "[合十]",
  3765. low: "https://i.imgur.com/I8x3ang.png",
  3766. high: "https://i.imgur.com/T4rJVee.png"
  3767. },
  3768. {
  3769. name: "[赞]",
  3770. low: "https://i.imgur.com/lG44yUl.png",
  3771. high: "https://i.imgur.com/AoF5PLp.png"
  3772. },
  3773. {
  3774. name: "[踩]",
  3775. low: "https://i.imgur.com/cJp0uKZ.png",
  3776. high: "https://i.imgur.com/1XYGfXj.png"
  3777. },
  3778. {
  3779. name: "[爱心]",
  3780. low: "https://i.imgur.com/sLENaF5.png",
  3781. high: "https://i.imgur.com/dND56oX.png"
  3782. },
  3783. {
  3784. name: "[心碎]",
  3785. low: "https://i.imgur.com/AZxJzve.png",
  3786. high: "https://i.imgur.com/RiUsPci.png"
  3787. }
  3788. ];
  3789. const imgurClientIdPool = [
  3790. "3107b9ef8b316f3",
  3791. "442b04f26eefc8a",
  3792. "59cfebe717c09e4",
  3793. "60605aad4a62882",
  3794. "6c65ab1d3f5452a",
  3795. "83e123737849aa9",
  3796. "9311f6be1c10160",
  3797. "c4a4a563f698595",
  3798. "81be04b9e4a08ce"
  3799. ];
  3800. __expose({ content, isFocus: () => isFocus.value });
  3801. const editorClass = vue.computed(() => {
  3802. return [useType, isFocus.value ? "isFocus" : "", isNight.value ? "isNight" : ""];
  3803. });
  3804. const cursorHtml = vue.computed(() => {
  3805. var _a;
  3806. if (!txtRef.value || !content.value)
  3807. return "";
  3808. let index = ((_a = txtRef.value) == null ? void 0 : _a.selectionStart) || 0;
  3809. return content.value.substring(0, index).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>").replace(/\s/g, none.value);
  3810. });
  3811. const disabled = vue.computed(() => {
  3812. if (content.value) {
  3813. return content.value === replyInfo;
  3814. } else {
  3815. return true;
  3816. }
  3817. });
  3818. function drop(e2) {
  3819. e2.preventDefault();
  3820. upload(e2.dataTransfer.files[0]);
  3821. }
  3822. async function upload(file) {
  3823. if (!file)
  3824. return;
  3825. if (uploadLoading.value)
  3826. return;
  3827. uploadLoading.value = true;
  3828. const formData = new FormData();
  3829. formData.append("image", file);
  3830. const randomIndex = Math.floor(Math.random() * imgurClientIdPool.length);
  3831. const clidenId = imgurClientIdPool[randomIndex];
  3832. const res = await fetch("https://api.imgur.com/3/upload", {
  3833. method: "POST",
  3834. headers: { Authorization: `Client-ID ${clidenId}` },
  3835. body: formData
  3836. });
  3837. uploadLoading.value = false;
  3838. if (res.ok) {
  3839. const resData = await res.json();
  3840. if (resData.success) {
  3841. return insert(" " + resData.data.link + " ");
  3842. }
  3843. }
  3844. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "上传失败" });
  3845. }
  3846. async function submit() {
  3847. if (disabled.value || loading.value)
  3848. return;
  3849. loading.value = true;
  3850. let submit_content = content.value.replace(/\[((?!\[).)+\]/g, function(match) {
  3851. let item2 = classicsEmoticons.find((v) => v.name === match);
  3852. if (item2) {
  3853. return item2.low + " ";
  3854. }
  3855. return match;
  3856. });
  3857. let show_content = content.value.replace(/https?:\/\/(i\.)?imgur\.com\/((?!http).)+\.(gif|png|jpg|jpeg|GIF|PNG|JPG|JPEG)/g, function(match) {
  3858. return `<img src="${match}" data-originUrl="${match}" data-notice="这个img标签由v2ex-超级增强脚本解析" style="max-width: 100%">`;
  3859. });
  3860. show_content = show_content.replace(/\[((?!\[).)+\]/g, function(match) {
  3861. let item2 = classicsEmoticons.find((v) => v.name === match);
  3862. if (item2) {
  3863. return `<a target="_blank" href="${item2.low}" rel="nofollow noopener"><img src="${item2.low}" class="embedded_image" rel="noreferrer"></a> `;
  3864. }
  3865. return match;
  3866. });
  3867. let matchUsers = show_content.match(/@([\w]+?[\s])/g);
  3868. if (matchUsers) {
  3869. matchUsers.map((i) => {
  3870. let username = i.replace("@", "").replace(" ", "");
  3871. show_content = show_content.replace(username, `<a href="/member/${username}">${username}</a>`);
  3872. });
  3873. }
  3874. show_content = show_content.replaceAll("\n", "<br/>");
  3875. let item = {
  3876. thankCount: 0,
  3877. isThanked: false,
  3878. isOp: post.value.username === window.user.username,
  3879. isDup: false,
  3880. id: Date.now(),
  3881. username: window.user.username,
  3882. avatar: window.user.avatar,
  3883. date: "几秒前",
  3884. floor: post.value.replyCount + 1,
  3885. reply_content: show_content ?? "",
  3886. children: [],
  3887. replyUsers: replyUser ? [replyUser] : [],
  3888. replyFloor: replyFloor || -1,
  3889. level: useType === "reply-comment" ? 1 : 0
  3890. };
  3891. item.hideCallUserReplyContent = item.reply_content;
  3892. if (item.replyUsers.length === 1) {
  3893. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  3894. }
  3895. console.log("回复", item);
  3896. let url = `${window.baseUrl}/t/${post.value.id}`;
  3897. $.post(url, { content: submit_content, once: post.value.once }).then(
  3898. // $.post(url, {content: submit_content, once: 123}).then(
  3899. (res) => {
  3900. loading.value = false;
  3901. let r2 = res.search("你上一条回复的内容和这条相同");
  3902. if (r2 > -1)
  3903. return eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你上一条回复的内容和这条相同" });
  3904. r2 = res.search("请不要在每一个回复中都包括外链,这看起来像是在 spamming");
  3905. if (r2 > -1)
  3906. return eventBus.emit(CMD.SHOW_MSG, {
  3907. type: "error",
  3908. text: "请不要在每一个回复中都包括外链,这看起来像是在 spamming"
  3909. });
  3910. let r22 = res.search("创建新回复");
  3911. if (r22 > -1) {
  3912. eventBus.emit(CMD.REFRESH_ONCE, res);
  3913. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复出现了问题,请使用原版进行回复" });
  3914. let clientWidth = window.document.body.clientWidth;
  3915. let windowWidth = 1200;
  3916. let left = clientWidth / 2 - windowWidth / 2;
  3917. let newWin = window.open("创建新回复", "", `width=${windowWidth},height=600,left=${left},top=100`);
  3918. newWin.document.write(res);
  3919. let loop = setInterval(function() {
  3920. if (newWin.closed) {
  3921. clearInterval(loop);
  3922. eventBus.emit(CMD.REFRESH_POST);
  3923. }
  3924. }, 1e3);
  3925. return;
  3926. }
  3927. content.value = replyInfo;
  3928. emits("close");
  3929. eventBus.emit(CMD.REFRESH_ONCE, res);
  3930. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "回复成功" });
  3931. eventBus.emit(CMD.ADD_REPLY, item);
  3932. },
  3933. (err) => {
  3934. console.log("err", err);
  3935. loading.value = false;
  3936. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "回复失败" });
  3937. }
  3938. ).catch((r2) => {
  3939. console.log("catch", r2);
  3940. });
  3941. }
  3942. function showEmoticons(e2) {
  3943. if (isShowEmoticons.value) {
  3944. return isShowEmoticons.value = false;
  3945. }
  3946. let rect = e2.currentTarget.getBoundingClientRect();
  3947. emoticonsRef.value.style.left = rect.left + 30 + "px";
  3948. emoticonsRef.value.style.bottom = window.innerHeight - rect.top - 20 + "px";
  3949. isShowEmoticons.value = true;
  3950. }
  3951. function off() {
  3952. eventBus.emit(CMD.SHOW_CALL, { show: false });
  3953. eventBus.off(CMD.SET_CALL);
  3954. }
  3955. function checkHeight2() {
  3956. txtRef.value.style.height = 0;
  3957. txtRef.value.style.height = txtRef.value.scrollHeight + "px";
  3958. }
  3959. function insert(str) {
  3960. let cursorPos = txtRef.value.selectionStart;
  3961. let start = content.value.slice(0, cursorPos);
  3962. let end = content.value.slice(cursorPos, content.value.length);
  3963. content.value = start + str + end;
  3964. let moveCursorPos = start.length + str.length;
  3965. setTimeout(() => {
  3966. txtRef.value.focus();
  3967. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3968. checkHeight2();
  3969. });
  3970. }
  3971. function showCallPopover(text) {
  3972. let r2 = cursorRef.value.getBoundingClientRect();
  3973. eventBus.emit(CMD.SHOW_CALL, { show: true, top: r2.top, left: r2.left, text });
  3974. eventBus.off(CMD.SET_CALL);
  3975. eventBus.on(CMD.SET_CALL, (e2) => {
  3976. let cursorPos = txtRef.value.selectionStart;
  3977. let start = content.value.slice(0, cursorPos);
  3978. let end = content.value.slice(cursorPos, content.value.length);
  3979. let lastCallPos = start.lastIndexOf("@");
  3980. start = content.value.slice(0, lastCallPos + 1);
  3981. if (e2 === "管理员") {
  3982. e2 = "Livid @Kai @Olivia @GordianZ @sparanoid";
  3983. }
  3984. if (e2 === "所有人") {
  3985. e2 = allReplyUsers.value.map((v, i) => {
  3986. if (i)
  3987. return "@" + v;
  3988. else
  3989. return v;
  3990. }).join(" ");
  3991. }
  3992. content.value = start + e2 + " " + end;
  3993. let moveCursorPos = start.length + e2.length + 1;
  3994. setTimeout(() => {
  3995. txtRef.value.setSelectionRange(moveCursorPos, moveCursorPos);
  3996. checkHeight2();
  3997. });
  3998. eventBus.off(CMD.SET_CALL);
  3999. });
  4000. }
  4001. function onKeydown(e2) {
  4002. let code = e2.keyCode;
  4003. switch (code) {
  4004. case 8:
  4005. if (content.value === "@") {
  4006. off();
  4007. }
  4008. break;
  4009. case 37:
  4010. case 38:
  4011. case 39:
  4012. case 40:
  4013. setTimeout(() => onInput({ data: "" }), 100);
  4014. break;
  4015. case 27:
  4016. e2.preventDefault();
  4017. e2.stopPropagation();
  4018. e2.stopImmediatePropagation();
  4019. return false;
  4020. case 13:
  4021. if (e2.ctrlKey)
  4022. submit();
  4023. if (e2.metaKey)
  4024. submit();
  4025. break;
  4026. }
  4027. }
  4028. function onInput(e2) {
  4029. let cursorPos = txtRef.value.selectionStart;
  4030. if (!content.value)
  4031. return;
  4032. if (e2.data === " ") {
  4033. return off();
  4034. }
  4035. if (e2.data === "@") {
  4036. if (content.value.length !== 1) {
  4037. if (content.value[cursorPos - 2] === " " || content.value[cursorPos - 2] === "\n") {
  4038. return showCallPopover("");
  4039. }
  4040. } else {
  4041. return showCallPopover("");
  4042. }
  4043. off();
  4044. } else {
  4045. let judgeStr = content.value.slice(0, cursorPos);
  4046. let lastCallPos = judgeStr.lastIndexOf("@");
  4047. if (lastCallPos === -1) {
  4048. return off();
  4049. }
  4050. let callStr = judgeStr.slice(lastCallPos, cursorPos);
  4051. let hasSpace = callStr.includes(" ");
  4052. if (hasSpace) {
  4053. off();
  4054. } else {
  4055. if (lastCallPos === 0) {
  4056. return showCallPopover(callStr.replace("@", ""));
  4057. }
  4058. if (content.value.length !== 1) {
  4059. if (content.value[lastCallPos - 1] === " " || content.value[lastCallPos - 1] === "\n") {
  4060. return showCallPopover(callStr.replace("@", ""));
  4061. }
  4062. } else {
  4063. return showCallPopover(callStr.replace("@", ""));
  4064. }
  4065. off();
  4066. }
  4067. }
  4068. }
  4069. function onPaste(e2) {
  4070. const dataTransferItemList = e2.clipboardData.items;
  4071. const items = [].slice.call(dataTransferItemList).filter(function(item) {
  4072. return item.type.indexOf("image") !== -1;
  4073. });
  4074. if (items.length === 0) {
  4075. return;
  4076. }
  4077. const dataTransferItem = items[0];
  4078. const blob = dataTransferItem.getAsFile();
  4079. upload(blob);
  4080. }
  4081. function onBlur() {
  4082. document.removeEventListener("paste", onPaste);
  4083. isFocus.value = false;
  4084. }
  4085. function onFocusin() {
  4086. document.addEventListener("paste", onPaste);
  4087. }
  4088. vue.watch(() => show, (n2) => {
  4089. if (n2.value)
  4090. isShowEmoticons.value = false;
  4091. }, { deep: true });
  4092. vue.onMounted(() => {
  4093. $(`.${editorId.value}`).each(function() {
  4094. this.setAttribute("style", "height:" + this.scrollHeight + "px;overflow-y:hidden;");
  4095. }).on("input", function() {
  4096. this.style.height = 0;
  4097. this.style.height = this.scrollHeight + "px";
  4098. });
  4099. if (useType === "reply-comment") {
  4100. txtRef.value && txtRef.value.focus();
  4101. }
  4102. });
  4103. vue.onBeforeUnmount(() => {
  4104. $(`.${editorId.value}`).off();
  4105. });
  4106. return (_ctx, _cache) => {
  4107. return vue.openBlock(), vue.createElementBlock("div", {
  4108. class: vue.normalizeClass(["post-editor-wrapper", editorClass.value])
  4109. }, [
  4110. vue.withDirectives(vue.createElementVNode("textarea", {
  4111. class: vue.normalizeClass(["post-editor", editorId.value]),
  4112. ref_key: "txtRef",
  4113. ref: txtRef,
  4114. onFocus: _cache[0] || (_cache[0] = ($event) => vue.isRef(isFocus) ? isFocus.value = true : isFocus = true),
  4115. onBlur,
  4116. onFocusin,
  4117. placeholder: "请尽量让自己的回复能够对别人有帮助",
  4118. onInput,
  4119. onKeydown,
  4120. onDrop: drop,
  4121. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event)
  4122. }, null, 34), [
  4123. [vue.vModelText, content.value]
  4124. ]),
  4125. vue.createElementVNode("div", _hoisted_1$b, [
  4126. vue.createElementVNode("span", { innerHTML: cursorHtml.value }, null, 8, _hoisted_2$8),
  4127. vue.createElementVNode("span", {
  4128. class: "cursor",
  4129. ref_key: "cursorRef",
  4130. ref: cursorRef
  4131. }, "|", 512)
  4132. ]),
  4133. vue.createElementVNode("div", _hoisted_3$7, [
  4134. vue.createElementVNode("div", _hoisted_4$7, [
  4135. vue.createVNode(vue.unref(Icon), {
  4136. onClick: showEmoticons,
  4137. icon: "streamline:smiley-happy"
  4138. }),
  4139. vue.createElementVNode("div", _hoisted_5$5, [
  4140. vue.createElementVNode("input", {
  4141. type: "file",
  4142. accept: "image/*",
  4143. onChange: _cache[2] || (_cache[2] = (e2) => upload(e2.currentTarget.files[0]))
  4144. }, null, 32),
  4145. vue.createVNode(vue.unref(Icon), { icon: "lets-icons:img-load-box-fill" })
  4146. ]),
  4147. uploadLoading.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$5, "上传中.....")) : vue.createCommentVNode("", true)
  4148. ]),
  4149. vue.createElementVNode("div", _hoisted_7$4, [
  4150. vue.unref(useType) === "reply-comment" ? (vue.openBlock(), vue.createBlock(BaseButton, {
  4151. key: 0,
  4152. type: "link",
  4153. size: "small",
  4154. style: { "margin-right": "1rem", "cursor": "pointer" },
  4155. onClick: _cache[3] || (_cache[3] = ($event) => emits("close"))
  4156. }, {
  4157. default: vue.withCtx(() => [
  4158. vue.createTextVNode(" 关闭 ")
  4159. ]),
  4160. _: 1
  4161. })) : vue.createCommentVNode("", true),
  4162. vue.createVNode(BaseButton, {
  4163. size: "small",
  4164. disabled: disabled.value,
  4165. loading: loading.value,
  4166. onClick: submit
  4167. }, {
  4168. default: vue.withCtx(() => [
  4169. vue.createTextVNode("回复 ")
  4170. ]),
  4171. _: 1
  4172. }, 8, ["disabled", "loading"])
  4173. ])
  4174. ]),
  4175. vue.withDirectives(vue.createElementVNode("div", {
  4176. class: "emoticon-pack",
  4177. ref_key: "emoticonsRef",
  4178. ref: emoticonsRef
  4179. }, [
  4180. vue.createVNode(vue.unref(Icon), {
  4181. icon: "ic:round-close",
  4182. onClick: _cache[4] || (_cache[4] = ($event) => isShowEmoticons.value = false)
  4183. }),
  4184. _hoisted_8$4,
  4185. vue.createElementVNode("div", _hoisted_9$4, [
  4186. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(classicsEmoticons, (item) => {
  4187. return vue.createElementVNode("img", {
  4188. src: item.high,
  4189. onClick: ($event) => {
  4190. insert(item.name);
  4191. isShowEmoticons.value = false;
  4192. }
  4193. }, null, 8, _hoisted_10$3);
  4194. }), 64))
  4195. ]),
  4196. vue.createElementVNode("div", _hoisted_11$3, [
  4197. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(emojiEmoticons, (item) => {
  4198. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  4199. vue.createElementVNode("div", _hoisted_12$3, vue.toDisplayString(item.title), 1),
  4200. vue.createElementVNode("div", _hoisted_13$3, [
  4201. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.list, (emoji) => {
  4202. return vue.openBlock(), vue.createElementBlock("span", {
  4203. onClick: ($event) => {
  4204. insert(emoji);
  4205. isShowEmoticons.value = false;
  4206. }
  4207. }, vue.toDisplayString(emoji), 9, _hoisted_14$3);
  4208. }), 256))
  4209. ])
  4210. ], 64);
  4211. }), 64))
  4212. ])
  4213. ], 512), [
  4214. [vue.vShow, isShowEmoticons.value]
  4215. ])
  4216. ], 2);
  4217. };
  4218. }
  4219. };
  4220. const PostEditor = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-4522f98e"]]);
  4221. const _hoisted_1$a = {
  4222. key: 0,
  4223. class: "html-wrapper"
  4224. };
  4225. const _hoisted_2$7 = ["innerHTML"];
  4226. const checkHeight = 900;
  4227. const _sfc_main$a = {
  4228. __name: "BaseHtmlRender",
  4229. props: ["html"],
  4230. setup(__props) {
  4231. const config2 = vue.inject("config");
  4232. const props = __props;
  4233. const contentRef = vue.ref(null);
  4234. const mask = vue.ref(false);
  4235. const handOpen = vue.ref(false);
  4236. function mouseup(e2) {
  4237. if (!config2.value.base64)
  4238. return;
  4239. let selectionText = window.win().getSelection().toString();
  4240. if (selectionText) {
  4241. let r2 = selectionText.match(/([A-Za-z0-9+/=]+)/g);
  4242. if (r2) {
  4243. if (r2[0].length < 4)
  4244. return;
  4245. eventBus.emit(CMD.SHOW_TOOLTIP, { text: r2[0], e: e2 });
  4246. }
  4247. }
  4248. }
  4249. vue.watch(config2.value, (newVale) => {
  4250. if (!newVale.contentAutoCollapse) {
  4251. mask.value = false;
  4252. }
  4253. });
  4254. vue.watch([() => contentRef.value, () => props.html], () => {
  4255. if (!contentRef.value || !props.html)
  4256. return;
  4257. if (!config2.value.contentAutoCollapse)
  4258. return;
  4259. contentRef.value.querySelectorAll("img").forEach((item) => {
  4260. item.removeEventListener("load", checkContentHeight);
  4261. item.addEventListener("load", checkContentHeight);
  4262. });
  4263. checkContentHeight();
  4264. }, { immediate: true, flush: "post" });
  4265. function checkContentHeight() {
  4266. if (handOpen.value)
  4267. return;
  4268. let rect = contentRef.value.getBoundingClientRect();
  4269. mask.value = rect.height >= checkHeight;
  4270. }
  4271. return (_ctx, _cache) => {
  4272. return props.html ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
  4273. vue.createElementVNode("div", {
  4274. class: vue.normalizeClass({ mask: mask.value })
  4275. }, [
  4276. vue.createElementVNode("div", {
  4277. ref_key: "contentRef",
  4278. ref: contentRef,
  4279. innerHTML: props.html,
  4280. onMouseup: mouseup
  4281. }, null, 40, _hoisted_2$7)
  4282. ], 2),
  4283. mask.value ? (vue.openBlock(), vue.createElementBlock("div", {
  4284. key: 0,
  4285. class: "expand",
  4286. onClick: _cache[0] || (_cache[0] = ($event) => {
  4287. mask.value = false;
  4288. handOpen.value = true;
  4289. })
  4290. }, "展开")) : vue.createCommentVNode("", true)
  4291. ])) : vue.createCommentVNode("", true);
  4292. };
  4293. }
  4294. };
  4295. const BaseHtmlRender = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-2c9a538c"]]);
  4296. const _sfc_main$9 = {
  4297. name: "Comment",
  4298. components: { BaseHtmlRender, Author, PostEditor, Point },
  4299. inject: ["post", "postDetailWidth", "show", "isNight", "config"],
  4300. props: {
  4301. modelValue: {
  4302. reply_content: ""
  4303. },
  4304. type: {
  4305. type: String,
  4306. default() {
  4307. return "list";
  4308. }
  4309. }
  4310. },
  4311. data() {
  4312. return {
  4313. edit: false,
  4314. ding: false,
  4315. expand: true,
  4316. expandWrong: false,
  4317. replyInfo: `@${this.modelValue.username} #${this.modelValue.floor} `,
  4318. cssStyle: null,
  4319. floor: this.modelValue.floor
  4320. };
  4321. },
  4322. watch: {
  4323. show(e2) {
  4324. if (e2) {
  4325. this.edit = false;
  4326. }
  4327. },
  4328. postDetailWidth(n2, o) {
  4329. this.checkIsTooLong(n2);
  4330. }
  4331. },
  4332. computed: {
  4333. CommentDisplayType() {
  4334. return CommentDisplayType;
  4335. },
  4336. myClass() {
  4337. return {
  4338. isOp: this.modelValue.isOp,
  4339. isSimple: this.config.viewType === "simple",
  4340. ding: this.ding,
  4341. isLevelOne: this.modelValue.level === 0,
  4342. ["c_" + this.floor]: this.type !== "top"
  4343. };
  4344. }
  4345. },
  4346. mounted() {
  4347. this.checkIsTooLong(this.postDetailWidth);
  4348. },
  4349. methods: {
  4350. checkIsTooLong(postDetailWidth) {
  4351. if (postDetailWidth !== 0) {
  4352. let rect = this.$refs.comment.getBoundingClientRect();
  4353. let ban = postDetailWidth / 2;
  4354. if (ban < rect.width && rect.width < ban + 25 && this.modelValue.children.length) {
  4355. this.expand = false;
  4356. let padding = 2;
  4357. this.cssStyle = {
  4358. padding: "1rem 0",
  4359. width: `calc(${postDetailWidth}px - ${padding}rem)`,
  4360. transform: `translateX(calc(${rect.width - postDetailWidth}px + ${padding}rem))`,
  4361. background: this.isNight ? "#18222d" : "white"
  4362. };
  4363. }
  4364. }
  4365. },
  4366. //高亮一下
  4367. showDing() {
  4368. this.ding = true;
  4369. setTimeout(() => {
  4370. this.ding = false;
  4371. }, 2e3);
  4372. },
  4373. hide() {
  4374. let url = `${window.baseUrl}/ignore/reply/${this.modelValue.id}?once=${this.post.once}`;
  4375. eventBus.emit(CMD.REMOVE, this.modelValue.floor);
  4376. $.post(url).then((res) => {
  4377. eventBus.emit(CMD.REFRESH_ONCE);
  4378. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "隐藏成功" });
  4379. }, (err) => {
  4380. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "隐藏成功,仅本次有效(接口调用失败!)" });
  4381. });
  4382. },
  4383. toggle() {
  4384. this.expand = !this.expand;
  4385. }
  4386. }
  4387. };
  4388. const _withScopeId$6 = (n2) => (vue.pushScopeId("data-v-67807ede"), n2 = n2(), vue.popScopeId(), n2);
  4389. const _hoisted_1$9 = ["data-floor"];
  4390. const _hoisted_2$6 = { class: "comment-content" };
  4391. const _hoisted_3$6 = { class: "right" };
  4392. const _hoisted_4$6 = { class: "w" };
  4393. const _hoisted_5$4 = {
  4394. key: 0,
  4395. class: "wrong-wrapper"
  4396. };
  4397. const _hoisted_6$4 = ["href"];
  4398. const _hoisted_7$3 = { class: "del-line" };
  4399. const _hoisted_8$3 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("i", {
  4400. class: "fa fa-question-circle-o wrong-icon",
  4401. "aria-hidden": "true"
  4402. }, null, -1));
  4403. const _hoisted_9$3 = {
  4404. key: 0,
  4405. class: "warning"
  4406. };
  4407. const _hoisted_10$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4408. const _hoisted_11$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4409. const _hoisted_12$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4410. const _hoisted_13$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4411. const _hoisted_14$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("br", null, null, -1));
  4412. const _hoisted_15$2 = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.createElementVNode("a", {
  4413. href: "https://github.com/zyronon/web-scripts/issues",
  4414. target: "_blank"
  4415. }, "这里", -1));
  4416. const _hoisted_16$2 = { class: "simple-wrapper" };
  4417. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  4418. const _component_Author = vue.resolveComponent("Author");
  4419. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  4420. const _component_PostEditor = vue.resolveComponent("PostEditor");
  4421. const _component_Comment = vue.resolveComponent("Comment", true);
  4422. return vue.openBlock(), vue.createElementBlock("div", {
  4423. class: vue.normalizeClass(["comment", $options.myClass]),
  4424. ref: "comment",
  4425. "data-floor": $data.floor
  4426. }, [
  4427. vue.createVNode(_component_Author, {
  4428. modelValue: $data.expand,
  4429. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.expand = $event),
  4430. comment: $props.modelValue,
  4431. onReply: _cache[1] || (_cache[1] = ($event) => $data.edit = !$data.edit),
  4432. type: $props.type,
  4433. onHide: $options.hide
  4434. }, null, 8, ["modelValue", "comment", "type", "onHide"]),
  4435. $data.cssStyle && !$data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4436. key: 0,
  4437. class: "more ago",
  4438. onClick: _cache[2] || (_cache[2] = ($event) => $data.expand = !$data.expand)
  4439. }, " 由于嵌套回复层级太深,自动将后续回复隐藏 ")) : vue.createCommentVNode("", true),
  4440. $data.expand ? (vue.openBlock(), vue.createElementBlock("div", {
  4441. key: 1,
  4442. class: "comment-content-w",
  4443. style: vue.normalizeStyle($data.cssStyle)
  4444. }, [
  4445. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4446. key: 0,
  4447. class: "more ago",
  4448. onClick: _cache[3] || (_cache[3] = ($event) => $data.expand = !$data.expand)
  4449. }, " 由于嵌套回复层级太深,自动将以下回复移至可见范围 ")) : vue.createCommentVNode("", true),
  4450. vue.createElementVNode("div", _hoisted_2$6, [
  4451. vue.createElementVNode("div", {
  4452. class: "left expand-line",
  4453. onClick: _cache[4] || (_cache[4] = (...args) => $options.toggle && $options.toggle(...args))
  4454. }),
  4455. vue.createElementVNode("div", _hoisted_3$6, [
  4456. vue.createElementVNode("div", _hoisted_4$6, [
  4457. $props.modelValue.isWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$4, [
  4458. vue.createElementVNode("span", {
  4459. onClick: _cache[5] || (_cache[5] = ($event) => $data.expandWrong = !$data.expandWrong),
  4460. title: "点击楼层号查看提示"
  4461. }, [
  4462. vue.createElementVNode("a", {
  4463. href: "/member/" + $props.modelValue.replyUsers[0]
  4464. }, "@" + vue.toDisplayString($props.modelValue.replyUsers[0]) + "  ", 9, _hoisted_6$4),
  4465. vue.createElementVNode("span", _hoisted_7$3, "#" + vue.toDisplayString($props.modelValue.replyFloor), 1),
  4466. _hoisted_8$3
  4467. ]),
  4468. $data.expandWrong ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$3, [
  4469. vue.createTextVNode(" 这条回复似乎有点问题,指定的楼层号与@的人对应不上 "),
  4470. _hoisted_10$2,
  4471. vue.createTextVNode(" 原因可能有下面几种: "),
  4472. _hoisted_11$2,
  4473. vue.createTextVNode(" 一、屏蔽用户导致楼层塌陷:你屏蔽了A,自A以后的回复的楼层号都会减1 "),
  4474. _hoisted_12$2,
  4475. vue.createTextVNode(" 二、忽略回复导致楼层塌陷:原理同上 "),
  4476. _hoisted_13$2,
  4477. vue.createTextVNode(" 三、层主回复时指定错了楼层号(同一,层主屏蔽了别人,导致楼层塌陷) "),
  4478. _hoisted_14$2,
  4479. vue.createTextVNode(" 四、脚本解析错误,请在 "),
  4480. _hoisted_15$2,
  4481. vue.createTextVNode("反馈 ")
  4482. ])) : vue.createCommentVNode("", true)
  4483. ])) : vue.createCommentVNode("", true),
  4484. $options.config.commentDisplayType === $options.CommentDisplayType.FloorInFloorNoCallUser && this.type !== "top" ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4485. key: 1,
  4486. class: "reply_content",
  4487. html: $props.modelValue.hideCallUserReplyContent
  4488. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  4489. key: 2,
  4490. class: "reply_content",
  4491. html: $props.modelValue.reply_content
  4492. }, null, 8, ["html"])),
  4493. $data.edit ? (vue.openBlock(), vue.createBlock(_component_PostEditor, {
  4494. key: 3,
  4495. onClose: _cache[6] || (_cache[6] = ($event) => $data.edit = false),
  4496. replyInfo: $data.replyInfo,
  4497. replyUser: $props.modelValue.username,
  4498. replyFloor: $props.modelValue.floor
  4499. }, null, 8, ["replyInfo", "replyUser", "replyFloor"])) : vue.createCommentVNode("", true)
  4500. ]),
  4501. vue.createElementVNode("div", _hoisted_16$2, [
  4502. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue.children, (item, index) => {
  4503. return vue.openBlock(), vue.createBlock(_component_Comment, {
  4504. modelValue: $props.modelValue.children[index],
  4505. "onUpdate:modelValue": ($event) => $props.modelValue.children[index] = $event,
  4506. key: index
  4507. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  4508. }), 128))
  4509. ])
  4510. ])
  4511. ]),
  4512. $data.cssStyle ? (vue.openBlock(), vue.createElementBlock("div", {
  4513. key: 1,
  4514. class: "more ago",
  4515. onClick: _cache[7] || (_cache[7] = ($event) => $data.expand = !$data.expand)
  4516. }, " 由于嵌套回复层级太深,自动将以上回复移至可见范围 ")) : vue.createCommentVNode("", true)
  4517. ], 4)) : vue.createCommentVNode("", true)
  4518. ], 10, _hoisted_1$9);
  4519. }
  4520. const Comment = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4], ["__scopeId", "data-v-67807ede"]]);
  4521. const _sfc_main$8 = {
  4522. name: "Toolbar",
  4523. components: { Icon, BaseLoading },
  4524. inject: [
  4525. "isLogin",
  4526. "post",
  4527. "pageType"
  4528. ],
  4529. data() {
  4530. return {
  4531. timer: null,
  4532. loading: false,
  4533. loading2: false,
  4534. loading3: false
  4535. };
  4536. },
  4537. methods: {
  4538. checkIsLogin(emitName = "") {
  4539. if (!this.isLogin) {
  4540. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请先登录!" });
  4541. return false;
  4542. }
  4543. this.$emit(emitName);
  4544. return true;
  4545. },
  4546. tweet() {
  4547. var _a;
  4548. let username = ((_a = window.user) == null ? void 0 : _a.username) ?? "";
  4549. let url = `https://twitter.com/intent/tweet?url=${location.origin}/t/${this.post.id}?r=${username}&related=v2ex&text=${this.post.title}`;
  4550. window.open(url, "_blank", "width=550,height=370");
  4551. },
  4552. async report() {
  4553. if (!this.checkIsLogin())
  4554. return;
  4555. if (this.loading3)
  4556. return;
  4557. let isReport = this.post.isReport;
  4558. if (isReport) {
  4559. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4560. return;
  4561. }
  4562. let url = `${location.origin}/report/topic/${this.post.id}?once=${this.post.once}`;
  4563. this.loading3 = true;
  4564. let apiRes = await fetch(url);
  4565. this.loading3 = false;
  4566. if (apiRes.redirected) {
  4567. let htmlText = await apiRes.text();
  4568. if (htmlText.search("你已对本主题进行了报告")) {
  4569. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "你已对本主题进行了报告" });
  4570. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4571. eventBus.emit(CMD.MERGE, { isReport: !isReport });
  4572. return;
  4573. }
  4574. }
  4575. eventBus.emit(CMD.REFRESH_ONCE);
  4576. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败,请重试" });
  4577. },
  4578. async toggleIgnore() {
  4579. if (!this.checkIsLogin())
  4580. return;
  4581. let url = `${window.baseUrl}/${this.post.isIgnore ? "unignore" : "ignore"}/topic/${this.post.id}?once=${this.post.once}`;
  4582. if (this.pageType === PageType.Post) {
  4583. this.loading2 = true;
  4584. let apiRes = await window.win().fetch(url);
  4585. if (apiRes.redirected) {
  4586. if (!this.post.isIgnore) {
  4587. window.win().location = window.baseUrl;
  4588. }
  4589. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4590. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4591. } else {
  4592. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略失败" });
  4593. }
  4594. this.loading2 = false;
  4595. } else {
  4596. if (this.post.isIgnore) {
  4597. this.loading2 = true;
  4598. } else {
  4599. eventBus.emit(CMD.IGNORE);
  4600. }
  4601. let apiRes = await window.win().fetch(url);
  4602. if (apiRes.redirected) {
  4603. if (this.post.isIgnore) {
  4604. eventBus.emit(CMD.REFRESH_ONCE);
  4605. }
  4606. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: this.post.isIgnore ? "取消成功" : "忽略成功" });
  4607. eventBus.emit(CMD.MERGE, { isIgnore: !this.post.isIgnore });
  4608. } else {
  4609. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "忽略成功,仅本次有效(接口调用失败!)" });
  4610. }
  4611. this.loading2 = false;
  4612. }
  4613. },
  4614. async toggleFavorite() {
  4615. if (!this.checkIsLogin())
  4616. return;
  4617. if (this.loading)
  4618. return;
  4619. let isFavorite = this.post.isFavorite;
  4620. if (!isFavorite && config.collectBrowserNotice) {
  4621. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "别忘记按Command/Cmd/CTRL + D添加到书签哦" });
  4622. }
  4623. let url = `${location.origin}/${isFavorite ? "unfavorite" : "favorite"}/topic/${this.post.id}?once=${this.post.once}`;
  4624. this.loading = true;
  4625. let apiRes = await fetch(url);
  4626. this.loading = false;
  4627. if (apiRes.redirected) {
  4628. let htmlText = await apiRes.text();
  4629. if (htmlText.search(isFavorite ? "加入收藏" : "取消收藏")) {
  4630. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: isFavorite ? "取消成功" : "收藏成功" });
  4631. eventBus.emit(CMD.MERGE, { collectCount: isFavorite ? this.post.collectCount - 1 : this.post.collectCount + 1 });
  4632. eventBus.emit(CMD.REFRESH_ONCE, htmlText);
  4633. eventBus.emit(CMD.MERGE, { isFavorite: !isFavorite });
  4634. return;
  4635. }
  4636. }
  4637. eventBus.emit(CMD.REFRESH_ONCE);
  4638. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "操作失败" });
  4639. }
  4640. }
  4641. };
  4642. const _withScopeId$5 = (n2) => (vue.pushScopeId("data-v-e3df61b2"), n2 = n2(), vue.popScopeId(), n2);
  4643. const _hoisted_1$8 = { class: "toolbar" };
  4644. const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "回复", -1));
  4645. const _hoisted_3$5 = {
  4646. key: 0,
  4647. class: "tool no-hover"
  4648. };
  4649. const _hoisted_4$5 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode("span", null, "Tweet", -1));
  4650. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  4651. const _component_Icon = vue.resolveComponent("Icon");
  4652. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  4653. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
  4654. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
  4655. vue.createElementVNode("div", {
  4656. class: "tool",
  4657. onClick: _cache[0] || (_cache[0] = ($event) => $options.checkIsLogin("reply"))
  4658. }, [
  4659. vue.createVNode(_component_Icon, { icon: "mynaui:message" }),
  4660. _hoisted_2$5
  4661. ]),
  4662. vue.createElementVNode("div", {
  4663. class: vue.normalizeClass(["tool", { disabled: $data.loading }]),
  4664. onClick: _cache[1] || (_cache[1] = (...args) => $options.toggleFavorite && $options.toggleFavorite(...args))
  4665. }, [
  4666. $data.loading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4667. key: 0,
  4668. size: "small"
  4669. })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  4670. $options.post.isFavorite ? (vue.openBlock(), vue.createBlock(_component_Icon, {
  4671. key: 0,
  4672. color: "rgb(224,42,42)",
  4673. icon: "iconoir:star-solid"
  4674. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4675. key: 1,
  4676. icon: "iconoir:star"
  4677. }))
  4678. ], 64)),
  4679. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isFavorite ? "取消" : "") + "收藏", 1)
  4680. ], 2),
  4681. $options.post.collectCount !== 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
  4682. vue.createElementVNode("span", null, vue.toDisplayString($options.post.collectCount + "人收藏"), 1)
  4683. ])) : vue.createCommentVNode("", true),
  4684. vue.createElementVNode("div", {
  4685. class: "tool",
  4686. onClick: _cache[2] || (_cache[2] = (...args) => $options.tweet && $options.tweet(...args))
  4687. }, [
  4688. vue.createVNode(_component_Icon, { icon: "uil:share" }),
  4689. _hoisted_4$5
  4690. ]),
  4691. vue.createElementVNode("div", {
  4692. class: vue.normalizeClass(["tool", { "disabled": $data.loading2 }]),
  4693. onClick: _cache[3] || (_cache[3] = (...args) => $options.toggleIgnore && $options.toggleIgnore(...args))
  4694. }, [
  4695. $data.loading2 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4696. key: 0,
  4697. size: "small"
  4698. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4699. key: 1,
  4700. icon: "fluent:eye-hide-24-regular"
  4701. })),
  4702. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isIgnore ? "取消忽略" : "忽略"), 1)
  4703. ], 2),
  4704. vue.createElementVNode("div", {
  4705. class: vue.normalizeClass(["tool", { "disabled": $data.loading3 }]),
  4706. onClick: _cache[4] || (_cache[4] = (...args) => $options.report && $options.report(...args))
  4707. }, [
  4708. $data.loading3 ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, {
  4709. key: 0,
  4710. size: "small"
  4711. })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  4712. key: 1,
  4713. class: "black",
  4714. icon: "solar:danger-triangle-outline"
  4715. })),
  4716. vue.createElementVNode("span", null, vue.toDisplayString($options.post.isReport ? "你已对本主题进行了报告" : "报告"), 1)
  4717. ], 2)
  4718. ]);
  4719. }
  4720. const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$3], ["__scopeId", "data-v-e3df61b2"]]);
  4721. const _withScopeId$4 = (n2) => (vue.pushScopeId("data-v-87050bc7"), n2 = n2(), vue.popScopeId(), n2);
  4722. const _hoisted_1$7 = ["href"];
  4723. const _hoisted_2$4 = ["src"];
  4724. const _hoisted_3$4 = { class: "texts" };
  4725. const _hoisted_4$4 = {
  4726. key: 0,
  4727. class: "point"
  4728. };
  4729. const _hoisted_5$3 = { class: "link-num" };
  4730. const _hoisted_6$3 = { class: "my-tag" };
  4731. const _hoisted_7$2 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  4732. const _hoisted_8$2 = {
  4733. key: 2,
  4734. class: "ago"
  4735. };
  4736. const _hoisted_9$2 = {
  4737. key: 3,
  4738. class: "mod"
  4739. };
  4740. const _hoisted_10$1 = {
  4741. key: 4,
  4742. class: "owner"
  4743. };
  4744. const _hoisted_11$1 = ["href"];
  4745. const _hoisted_12$1 = {
  4746. key: 5,
  4747. class: "owner"
  4748. };
  4749. const _hoisted_13$1 = {
  4750. key: 6,
  4751. class: "mod"
  4752. };
  4753. const _hoisted_14$1 = {
  4754. key: 7,
  4755. class: "ago"
  4756. };
  4757. const _hoisted_15$1 = { class: "my-tag" };
  4758. const _hoisted_16$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  4759. const _hoisted_17$1 = {
  4760. key: 9,
  4761. class: "point"
  4762. };
  4763. const _hoisted_18$1 = { class: "link-num" };
  4764. const _hoisted_19$1 = ["href"];
  4765. const _hoisted_20$1 = ["src"];
  4766. const _hoisted_21$1 = { class: "Author-right" };
  4767. const _hoisted_22$1 = { class: "floor" };
  4768. const _hoisted_23$1 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("span", null, "跳转", -1));
  4769. const _hoisted_24$1 = [
  4770. _hoisted_23$1
  4771. ];
  4772. const _sfc_main$7 = {
  4773. __name: "SingleComment",
  4774. props: {
  4775. comment: {
  4776. reply_content: ""
  4777. },
  4778. isRight: {
  4779. type: Boolean,
  4780. default() {
  4781. return false;
  4782. }
  4783. }
  4784. },
  4785. setup(__props) {
  4786. const config2 = vue.inject("config");
  4787. const isLogin = vue.inject("isLogin");
  4788. const tags = vue.inject("tags");
  4789. const props = __props;
  4790. const myTags = vue.computed(() => {
  4791. return tags[props.comment.username] ?? [];
  4792. });
  4793. function jump() {
  4794. eventBus.emit(CMD.JUMP, props.comment.floor);
  4795. }
  4796. return (_ctx, _cache) => {
  4797. return vue.openBlock(), vue.createElementBlock("div", {
  4798. class: vue.normalizeClass(["comment", { isSimple: vue.unref(config2).viewType === "simple" }]),
  4799. ref: "comment"
  4800. }, [
  4801. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  4802. key: 0,
  4803. class: "avatar",
  4804. href: `/member/${__props.comment.username}`
  4805. }, [
  4806. vue.createElementVNode("img", {
  4807. src: __props.comment.avatar,
  4808. alt: ""
  4809. }, null, 8, _hoisted_2$4)
  4810. ], 8, _hoisted_1$7)) : vue.createCommentVNode("", true),
  4811. vue.createElementVNode("div", {
  4812. class: vue.normalizeClass(["comment-body", { isRight: __props.isRight }])
  4813. }, [
  4814. vue.createElementVNode("div", _hoisted_3$4, [
  4815. __props.comment.thankCount && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
  4816. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4817. key: 0,
  4818. color: "rgb(224,42,42)",
  4819. icon: "icon-park-solid:like"
  4820. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4821. key: 1,
  4822. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  4823. icon: "icon-park-outline:like"
  4824. }, null, 8, ["color"])),
  4825. vue.createElementVNode("div", _hoisted_5$3, vue.toDisplayString(__props.comment.thankCount), 1)
  4826. ])) : vue.createCommentVNode("", true),
  4827. vue.unref(isLogin) && vue.unref(config2).openTag && __props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(myTags.value, (i) => {
  4828. return vue.openBlock(), vue.createElementBlock("span", _hoisted_6$3, [
  4829. _hoisted_7$2,
  4830. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  4831. ]);
  4832. }), 256)) : vue.createCommentVNode("", true),
  4833. __props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$2, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  4834. __props.comment.isMod && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$2, "MOD")) : vue.createCommentVNode("", true),
  4835. __props.comment.isOp && __props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$1, "OP")) : vue.createCommentVNode("", true),
  4836. vue.createElementVNode("a", {
  4837. href: `/member/${__props.comment.username}`,
  4838. class: "username"
  4839. }, vue.toDisplayString(__props.comment.username), 9, _hoisted_11$1),
  4840. __props.comment.isOp && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$1, "OP")) : vue.createCommentVNode("", true),
  4841. __props.comment.isMod && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$1, "MOD")) : vue.createCommentVNode("", true),
  4842. !__props.isRight ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14$1, vue.toDisplayString(__props.comment.date), 1)) : vue.createCommentVNode("", true),
  4843. vue.unref(isLogin) && vue.unref(config2).openTag && !__props.isRight ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 8 }, vue.renderList(myTags.value, (i) => {
  4844. return vue.openBlock(), vue.createElementBlock("span", _hoisted_15$1, [
  4845. _hoisted_16$1,
  4846. vue.createElementVNode("span", null, vue.toDisplayString(i), 1)
  4847. ]);
  4848. }), 256)) : vue.createCommentVNode("", true),
  4849. __props.comment.thankCount && !__props.isRight ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, [
  4850. __props.comment.isThanked ? (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4851. key: 0,
  4852. color: "rgb(224,42,42)",
  4853. icon: "icon-park-solid:like"
  4854. })) : (vue.openBlock(), vue.createBlock(vue.unref(Icon), {
  4855. key: 1,
  4856. color: !__props.comment.thankCount ? null : "rgb(224,42,42)",
  4857. icon: "icon-park-outline:like"
  4858. }, null, 8, ["color"])),
  4859. vue.createElementVNode("div", _hoisted_18$1, vue.toDisplayString(__props.comment.thankCount), 1)
  4860. ])) : vue.createCommentVNode("", true)
  4861. ]),
  4862. vue.createVNode(BaseHtmlRender, {
  4863. class: "reply_content",
  4864. html: __props.comment.reply_content
  4865. }, null, 8, ["html"])
  4866. ], 2),
  4867. __props.isRight ? (vue.openBlock(), vue.createElementBlock("a", {
  4868. key: 1,
  4869. class: "avatar",
  4870. href: `/member/${__props.comment.username}`
  4871. }, [
  4872. vue.createElementVNode("img", {
  4873. src: __props.comment.avatar,
  4874. alt: ""
  4875. }, null, 8, _hoisted_20$1)
  4876. ], 8, _hoisted_19$1)) : vue.createCommentVNode("", true),
  4877. vue.createElementVNode("div", _hoisted_21$1, [
  4878. vue.createElementVNode("div", _hoisted_22$1, vue.toDisplayString(__props.comment.floor), 1),
  4879. vue.createElementVNode("div", {
  4880. class: "tool jump",
  4881. onClick: jump
  4882. }, _hoisted_24$1)
  4883. ])
  4884. ], 2);
  4885. };
  4886. }
  4887. };
  4888. const SingleComment = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-87050bc7"]]);
  4889. const _sfc_main$6 = {
  4890. name: "detail",
  4891. components: {
  4892. BaseSelect,
  4893. BaseButton,
  4894. SingleComment,
  4895. PopConfirm,
  4896. Comment,
  4897. PostEditor,
  4898. Point,
  4899. Toolbar,
  4900. BaseHtmlRender,
  4901. Tooltip,
  4902. BaseLoading,
  4903. Icon
  4904. },
  4905. inject: ["allReplyUsers", "post", "isMobile", "tags", "isLogin", "config", "pageType", "isNight"],
  4906. provide() {
  4907. return {
  4908. postDetailWidth: vue.computed(() => this.postDetailWidth)
  4909. };
  4910. },
  4911. props: {
  4912. modelValue: {
  4913. type: Boolean,
  4914. default() {
  4915. return false;
  4916. }
  4917. },
  4918. loading: {
  4919. type: Boolean,
  4920. default() {
  4921. return false;
  4922. }
  4923. },
  4924. refreshLoading: {
  4925. type: Boolean,
  4926. default() {
  4927. return false;
  4928. }
  4929. },
  4930. displayType: CommentDisplayType.FloorInFloorNoCallUser
  4931. },
  4932. data() {
  4933. return {
  4934. isSticky: false,
  4935. selectCallIndex: 0,
  4936. postDetailWidth: 0,
  4937. showCallList: false,
  4938. showRelationReply: false,
  4939. replyText: "",
  4940. callStyle: {
  4941. top: 0,
  4942. left: 0
  4943. },
  4944. targetUser: {
  4945. left: [],
  4946. right: "",
  4947. rightFloor: -1
  4948. },
  4949. currentFloor: "",
  4950. showOpTag: false
  4951. };
  4952. },
  4953. computed: {
  4954. canAppend() {
  4955. if (this.isMy) {
  4956. let create = new Date(this.post.createDate);
  4957. return Date.now() - create.valueOf() > 1e3 * 60 * 30;
  4958. }
  4959. return false;
  4960. },
  4961. canEditMove() {
  4962. if (this.isMy) {
  4963. let create = new Date(this.post.createDate);
  4964. return Date.now() - create.valueOf() < 1e3 * 60 * 10;
  4965. }
  4966. return false;
  4967. },
  4968. isMy() {
  4969. return this.post.member.username === window.user.username;
  4970. },
  4971. myTags() {
  4972. return this.tags[this.post.member.username] ?? [];
  4973. },
  4974. CommentDisplayType() {
  4975. return CommentDisplayType;
  4976. },
  4977. isPost() {
  4978. return this.pageType === PageType.Post;
  4979. },
  4980. filterCallList() {
  4981. if (this.showCallList) {
  4982. let list = ["管理员", "所有人"].concat(this.allReplyUsers);
  4983. if (this.replyText)
  4984. return list.filter((i) => i.search(this.replyText) > -1);
  4985. return list;
  4986. }
  4987. return [];
  4988. },
  4989. topReply() {
  4990. return this.post.replyList.filter((v) => v.thankCount >= this.config.topReplyLoveMinCount).sort((a, b) => b.thankCount - a.thankCount).slice(0, this.config.topReplyCount);
  4991. },
  4992. replyList() {
  4993. if ([CommentDisplayType.FloorInFloor, CommentDisplayType.FloorInFloorNoCallUser].includes(this.displayType))
  4994. return this.post.nestedReplies;
  4995. if (this.displayType === CommentDisplayType.Like) {
  4996. return window.clone(this.post.nestedReplies).sort((a, b) => b.thankCount - a.thankCount);
  4997. }
  4998. if (this.displayType === CommentDisplayType.New) {
  4999. return window.clone(this.post.replyList).reverse();
  5000. }
  5001. if (this.displayType === CommentDisplayType.V2exOrigin)
  5002. return this.post.replyList;
  5003. if (this.displayType === CommentDisplayType.FloorInFloorNested)
  5004. return this.post.nestedRedundReplies;
  5005. if (this.displayType === CommentDisplayType.OnlyOp)
  5006. return this.post.replyList.filter((v) => {
  5007. var _a;
  5008. return v.username === ((_a = this.post.member) == null ? void 0 : _a.username);
  5009. });
  5010. return [];
  5011. },
  5012. //关联回复
  5013. relationReply() {
  5014. if (this.targetUser.left.length && this.targetUser.right) {
  5015. return this.post.replyList.filter((v) => {
  5016. if (this.targetUser.left.includes(v.username)) {
  5017. if (v.floor > this.targetUser.rightFloor) {
  5018. if (v.replyUsers.includes(this.targetUser.right)) {
  5019. return true;
  5020. }
  5021. } else {
  5022. return true;
  5023. }
  5024. }
  5025. if (v.username === this.targetUser.right) {
  5026. for (let i = 0; i < this.targetUser.left.length; i++) {
  5027. if (v.replyUsers.includes(this.targetUser.left[i])) {
  5028. return true;
  5029. }
  5030. }
  5031. }
  5032. });
  5033. }
  5034. return [];
  5035. }
  5036. },
  5037. watch: {
  5038. "post.id"(n2, o) {
  5039. if (this.$refs["post-editor"]) {
  5040. this.$refs["post-editor"].content = "";
  5041. vue.nextTick(() => {
  5042. var _a, _b;
  5043. (_b = (_a = this.$refs) == null ? void 0 : _a.detail) == null ? void 0 : _b.scrollTo({ top: 0 });
  5044. });
  5045. }
  5046. },
  5047. "post.headerTemplate"(n2, o) {
  5048. let mountEl = document.querySelector(".main-wrapper .post-wrapper .html-wrapper .header");
  5049. if (mountEl) {
  5050. this.showOpTag = true;
  5051. }
  5052. },
  5053. modelValue: {
  5054. handler(newVal) {
  5055. if (this.isPost) {
  5056. return;
  5057. }
  5058. if (newVal) {
  5059. document.body.style.overflow = "hidden";
  5060. if (!window.history.state) {
  5061. window.history.pushState({}, 0, this.post.href);
  5062. }
  5063. this.currentFloor = "";
  5064. vue.nextTick(() => {
  5065. var _a, _b;
  5066. window.document.title = this.post.title ?? "V2EX";
  5067. (_b = (_a = this.$refs) == null ? void 0 : _a.main) == null ? void 0 : _b.focus();
  5068. });
  5069. } else {
  5070. document.body.style.overflow = "unset";
  5071. window.document.title = "V2EX";
  5072. this.isSticky = false;
  5073. this.showRelationReply = false;
  5074. if (window.history.state) {
  5075. window.history.back();
  5076. }
  5077. }
  5078. }
  5079. }
  5080. },
  5081. mounted() {
  5082. setTimeout(() => {
  5083. var _a;
  5084. this.postDetailWidth = ((_a = this.$refs.mainWrapper) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
  5085. });
  5086. if (this.isLogin) {
  5087. const observer = new IntersectionObserver(
  5088. ([e2]) => e2.target.toggleAttribute("stuck", e2.intersectionRatio < 1),
  5089. { threshold: [1] }
  5090. );
  5091. observer.observe(this.$refs.replyBox);
  5092. window.addEventListener("keydown", this.onKeyDown);
  5093. }
  5094. eventBus.on(CMD.SHOW_CALL, (val) => {
  5095. if (val.show) {
  5096. this.showCallList = true;
  5097. this.replyText = val.text;
  5098. if (this.isPost) {
  5099. this.callStyle.top = val.top + $(window.win()).scrollTop() + -40 + "px";
  5100. } else {
  5101. this.callStyle.top = val.top + $(".post-detail").scrollTop() + 15 + "px";
  5102. }
  5103. this.callStyle.left = val.left - $(".main")[0].getBoundingClientRect().left + 10 + "px";
  5104. if (this.selectCallIndex >= this.filterCallList.length) {
  5105. this.selectCallIndex = 0;
  5106. }
  5107. } else {
  5108. this.replyText = "";
  5109. this.showCallList = false;
  5110. this.selectCallIndex = 0;
  5111. }
  5112. });
  5113. eventBus.on(CMD.RELATION_REPLY, (val) => {
  5114. this.targetUser = val;
  5115. this.showRelationReply = true;
  5116. });
  5117. eventBus.on(CMD.JUMP, this.jump);
  5118. if (this.isPost) {
  5119. window.addEventListener("scroll", this.debounceScroll);
  5120. }
  5121. },
  5122. beforeUnmount() {
  5123. window.removeEventListener("keydown", this.onKeyDown);
  5124. eventBus.off(CMD.SHOW_CALL);
  5125. },
  5126. methods: {
  5127. addTag() {
  5128. eventBus.emit(CMD.ADD_TAG, this.post.member.username);
  5129. },
  5130. removeTag(tag) {
  5131. eventBus.emit(CMD.REMOVE_TAG, { username: this.post.member.username, tag });
  5132. },
  5133. stop(e2) {
  5134. },
  5135. jump(floor) {
  5136. let lastItem = this.replyList[this.replyList.length - 1];
  5137. if (floor === "") {
  5138. floor = lastItem.floor;
  5139. } else {
  5140. try {
  5141. floor = Number(floor);
  5142. } catch (e2) {
  5143. floor = lastItem.floor;
  5144. }
  5145. if (floor === 0) {
  5146. floor = 1;
  5147. }
  5148. if (floor > lastItem.floor)
  5149. floor = lastItem.floor;
  5150. }
  5151. if (!this.post.replyList.length) {
  5152. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "没有回复可跳转!" });
  5153. return;
  5154. }
  5155. if (floor > this.post.replyList.length) {
  5156. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5157. return;
  5158. }
  5159. let comment = $(`.c_${floor}`);
  5160. if (!comment.length) {
  5161. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有找到对应回复!" });
  5162. return;
  5163. }
  5164. comment[0].scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
  5165. comment.addClass("ding");
  5166. this.currentFloor = floor + 1;
  5167. setTimeout(() => {
  5168. comment.removeClass("ding");
  5169. }, 2e3);
  5170. },
  5171. collapseTopReplyList() {
  5172. $(this.$refs.topReply).slideToggle("fast");
  5173. },
  5174. goBottom() {
  5175. this.isSticky = false;
  5176. setTimeout(() => {
  5177. if (this.isPost) {
  5178. let body = $("body , html");
  5179. let scrollHeight = body.prop("scrollHeight");
  5180. body.animate({ scrollTop: scrollHeight - 850 }, 300);
  5181. } else {
  5182. this.$refs.detail.scrollTo({ top: this.$refs.detail.scrollHeight, behavior: "smooth" });
  5183. }
  5184. });
  5185. },
  5186. close(from) {
  5187. if (this.isPost)
  5188. return;
  5189. if (from === "space") {
  5190. if (this.config.closePostDetailBySpace) {
  5191. this.$emit("update:modelValue", false);
  5192. }
  5193. } else {
  5194. this.$emit("update:modelValue", false);
  5195. }
  5196. },
  5197. setCall(e2) {
  5198. eventBus.emit(CMD.SET_CALL, e2);
  5199. this.showCallList = false;
  5200. },
  5201. onKeyDown(e2) {
  5202. if (!this.modelValue)
  5203. return;
  5204. if (!this.showCallList)
  5205. return;
  5206. let length = this.filterCallList.slice(0, 10).length;
  5207. if (e2.keyCode === 13) {
  5208. this.setCall(this.filterCallList[this.selectCallIndex]);
  5209. e2.preventDefault();
  5210. }
  5211. if (e2.keyCode === 38) {
  5212. this.selectCallIndex--;
  5213. if (this.selectCallIndex < 0) {
  5214. this.selectCallIndex = length - 1;
  5215. }
  5216. e2.preventDefault();
  5217. }
  5218. if (e2.keyCode === 40) {
  5219. this.selectCallIndex++;
  5220. if (this.selectCallIndex > length - 1) {
  5221. this.selectCallIndex = 0;
  5222. }
  5223. e2.preventDefault();
  5224. }
  5225. },
  5226. changeOption(item) {
  5227. this.$emit("update:displayType", item);
  5228. },
  5229. addThank() {
  5230. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "add" });
  5231. },
  5232. recallThank() {
  5233. eventBus.emit(CMD.CHANGE_POST_THANK, { id: this.post.id, type: "recall" });
  5234. },
  5235. scrollTop() {
  5236. if (this.isPost) {
  5237. $("body , html").animate({ scrollTop: 0 }, 300);
  5238. } else {
  5239. this.$refs.detail.scrollTo({ top: 0, behavior: "smooth" });
  5240. }
  5241. }
  5242. }
  5243. };
  5244. const _withScopeId$3 = (n2) => (vue.pushScopeId("data-v-165fdc78"), n2 = n2(), vue.popScopeId(), n2);
  5245. const _hoisted_1$6 = { class: "my-box post-wrapper" };
  5246. const _hoisted_2$3 = { class: "header" };
  5247. const _hoisted_3$3 = { class: "fr" };
  5248. const _hoisted_4$3 = ["href"];
  5249. const _hoisted_5$2 = ["src", "alt"];
  5250. const _hoisted_6$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("a", { href: "/" }, "V2EX", -1));
  5251. const _hoisted_7$1 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "chevron" }, "  ›  ", -1));
  5252. const _hoisted_8$1 = ["href"];
  5253. const _hoisted_9$1 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "sep10" }, null, -1));
  5254. const _hoisted_10 = ["id"];
  5255. const _hoisted_11 = ["onclick"];
  5256. const _hoisted_12 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-up" }, null, -1));
  5257. const _hoisted_13 = ["onclick"];
  5258. const _hoisted_14 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-chevron-down" }, null, -1));
  5259. const _hoisted_15 = [
  5260. _hoisted_14
  5261. ];
  5262. const _hoisted_16 = { class: "gray" };
  5263. const _hoisted_17 = ["href"];
  5264. const _hoisted_18 = ["title"];
  5265. const _hoisted_19 = ["href"];
  5266. const _hoisted_20 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("li", { class: "fa fa-info-circle" }, null, -1));
  5267. const _hoisted_21 = [
  5268. _hoisted_20
  5269. ];
  5270. const _hoisted_22 = ["href"];
  5271. const _hoisted_23 = ["href"];
  5272. const _hoisted_24 = ["href"];
  5273. const _hoisted_25 = { class: "my-tag" };
  5274. const _hoisted_26 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  5275. const _hoisted_27 = ["onClick"];
  5276. const _hoisted_28 = {
  5277. key: 0,
  5278. class: "my-box"
  5279. };
  5280. const _hoisted_29 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "高赞回复", -1));
  5281. const _hoisted_30 = { class: "top-reply" };
  5282. const _hoisted_31 = { class: "tool" };
  5283. const _hoisted_32 = { ref: "topReply" };
  5284. const _hoisted_33 = {
  5285. key: 1,
  5286. class: "my-box my-cell"
  5287. };
  5288. const _hoisted_34 = ["innerHTML"];
  5289. const _hoisted_35 = { class: "my-box comment-wrapper" };
  5290. const _hoisted_36 = {
  5291. key: 0,
  5292. class: "my-cell flex"
  5293. };
  5294. const _hoisted_37 = { key: 0 };
  5295. const _hoisted_38 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("strong", { class: "snow" }, "•", -1));
  5296. const _hoisted_39 = ["innerHTML"];
  5297. const _hoisted_40 = {
  5298. key: 0,
  5299. class: "loading-wrapper"
  5300. };
  5301. const _hoisted_41 = {
  5302. key: 1,
  5303. class: "comments"
  5304. };
  5305. const _hoisted_42 = {
  5306. key: 2,
  5307. id: "no-comments-yet"
  5308. };
  5309. const _hoisted_43 = { class: "my-cell flex" };
  5310. const _hoisted_44 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", null, "添加一条新回复", -1));
  5311. const _hoisted_45 = { class: "notice-right gray" };
  5312. const _hoisted_46 = { class: "p1" };
  5313. const _hoisted_47 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "gray" }, "上下文", -1));
  5314. const _hoisted_48 = { class: "top-reply" };
  5315. const _hoisted_49 = ["onClick"];
  5316. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  5317. const _component_BaseHtmlRender = vue.resolveComponent("BaseHtmlRender");
  5318. const _component_Point = vue.resolveComponent("Point");
  5319. const _component_Toolbar = vue.resolveComponent("Toolbar");
  5320. const _component_Icon = vue.resolveComponent("Icon");
  5321. const _component_Tooltip = vue.resolveComponent("Tooltip");
  5322. const _component_Comment = vue.resolveComponent("Comment");
  5323. const _component_BaseSelect = vue.resolveComponent("BaseSelect");
  5324. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  5325. const _component_PostEditor = vue.resolveComponent("PostEditor");
  5326. const _component_SingleComment = vue.resolveComponent("SingleComment");
  5327. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  5328. class: vue.normalizeClass(["post-detail", [$options.isNight ? "isNight" : "", $options.pageType, $options.isMobile ? "mobile" : ""]]),
  5329. ref: "detail",
  5330. onKeydown: _cache[19] || (_cache[19] = vue.withKeys(($event) => $options.close(), ["esc"])),
  5331. onScroll: _cache[20] || (_cache[20] = (...args) => _ctx.debounceScroll && _ctx.debounceScroll(...args)),
  5332. onClick: _cache[21] || (_cache[21] = ($event) => $options.close("space"))
  5333. }, [
  5334. vue.createElementVNode("div", {
  5335. ref: "main",
  5336. class: "main",
  5337. tabindex: "1",
  5338. onClick: _cache[18] || (_cache[18] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  5339. }, [
  5340. vue.createElementVNode("div", {
  5341. class: "main-wrapper",
  5342. ref: "mainWrapper",
  5343. style: vue.normalizeStyle({ width: $options.config.postWidth })
  5344. }, [
  5345. vue.createElementVNode("div", _hoisted_1$6, [
  5346. vue.createElementVNode("div", _hoisted_2$3, [
  5347. vue.createElementVNode("div", _hoisted_3$3, [
  5348. vue.createElementVNode("a", {
  5349. href: `/member/${$options.post.member.username}`,
  5350. style: { "width": "73px", "height": "73px", "display": "inline-block" }
  5351. }, [
  5352. $options.post.member.avatar_large ? (vue.openBlock(), vue.createElementBlock("img", {
  5353. key: 0,
  5354. src: $options.post.member.avatar_large,
  5355. class: "avatar",
  5356. style: { "width": "73px", "height": "73px" },
  5357. border: "0",
  5358. align: "default",
  5359. alt: $options.post.member.username
  5360. }, null, 8, _hoisted_5$2)) : vue.createCommentVNode("", true)
  5361. ], 8, _hoisted_4$3)
  5362. ]),
  5363. _hoisted_6$2,
  5364. _hoisted_7$1,
  5365. vue.createElementVNode("a", {
  5366. href: $options.post.node.url
  5367. }, vue.toDisplayString($options.post.node.title), 9, _hoisted_8$1),
  5368. _hoisted_9$1,
  5369. vue.createElementVNode("h1", null, vue.toDisplayString($options.post.title), 1),
  5370. !$options.isMobile ? (vue.openBlock(), vue.createElementBlock("div", {
  5371. key: 0,
  5372. id: `topic_${$options.post.id}_votes`,
  5373. class: "votes"
  5374. }, [
  5375. vue.createElementVNode("a", {
  5376. href: "javascript:",
  5377. onclick: `upVoteTopic(${$options.post.id});`,
  5378. class: "vote"
  5379. }, [
  5380. _hoisted_12,
  5381. vue.createTextVNode("   ")
  5382. ], 8, _hoisted_11),
  5383. vue.createTextVNode("   "),
  5384. vue.createElementVNode("a", {
  5385. href: "javascript:",
  5386. onclick: `downVoteTopic(${$options.post.id});`,
  5387. class: "vote"
  5388. }, _hoisted_15, 8, _hoisted_13)
  5389. ], 8, _hoisted_10)) : vue.createCommentVNode("", true),
  5390. vue.createTextVNode("   "),
  5391. vue.createElementVNode("small", _hoisted_16, [
  5392. vue.createElementVNode("a", {
  5393. href: `/member/${$options.post.member.username}`
  5394. }, vue.toDisplayString($options.post.member.username), 9, _hoisted_17),
  5395. vue.createTextVNode(" · "),
  5396. $options.post.member.createDate ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5397. vue.createElementVNode("span", {
  5398. class: vue.normalizeClass($options.post.member.isNew && "danger")
  5399. }, vue.toDisplayString($options.post.member.createDate), 3),
  5400. vue.createTextVNode(" · ")
  5401. ], 64)) : vue.createCommentVNode("", true),
  5402. $options.post.createDateAgo ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5403. vue.createElementVNode("span", {
  5404. title: $options.post.createDate
  5405. }, vue.toDisplayString($options.post.createDateAgo), 9, _hoisted_18),
  5406. vue.createTextVNode(" · ")
  5407. ], 64)) : vue.createCommentVNode("", true),
  5408. vue.createTextVNode(" " + vue.toDisplayString($options.post.clickCount) + " 次点击 ", 1),
  5409. $options.isMy ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  5410. vue.createTextVNode("   "),
  5411. vue.createElementVNode("a", {
  5412. href: `/t/${$options.post.id}/info`
  5413. }, _hoisted_21, 8, _hoisted_19),
  5414. vue.createTextVNode("   "),
  5415. $options.canAppend ? (vue.openBlock(), vue.createElementBlock("a", {
  5416. key: 0,
  5417. href: `/append/topic/${$options.post.id}`,
  5418. class: "op"
  5419. }, "APPEND", 8, _hoisted_22)) : vue.createCommentVNode("", true),
  5420. $options.canEditMove ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5421. vue.createElementVNode("a", {
  5422. href: `/move/topic/${$options.post.id}`,
  5423. class: "op"
  5424. }, "MOVE", 8, _hoisted_23),
  5425. vue.createTextVNode("  "),
  5426. vue.createElementVNode("a", {
  5427. href: `/edit/topic/${$options.post.id}`,
  5428. class: "op"
  5429. }, "EDIT", 8, _hoisted_24)
  5430. ], 64)) : vue.createCommentVNode("", true)
  5431. ], 64)) : vue.createCommentVNode("", true)
  5432. ]),
  5433. $options.isLogin && $options.config.openTag ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5434. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.myTags, (i) => {
  5435. return vue.openBlock(), vue.createElementBlock("span", _hoisted_25, [
  5436. _hoisted_26,
  5437. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  5438. vue.createElementVNode("i", {
  5439. class: "fa fa-trash-o remove",
  5440. onClick: ($event) => $options.removeTag(i)
  5441. }, null, 8, _hoisted_27)
  5442. ]);
  5443. }), 256)),
  5444. vue.createElementVNode("span", {
  5445. class: "add-tag ago",
  5446. onClick: _cache[0] || (_cache[0] = (...args) => $options.addTag && $options.addTag(...args)),
  5447. title: "添加标签"
  5448. }, "+")
  5449. ], 64)) : vue.createCommentVNode("", true)
  5450. ]),
  5451. $options.post.headerTemplate ? (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5452. key: 0,
  5453. html: $options.post.headerTemplate
  5454. }, null, 8, ["html"])) : (vue.openBlock(), vue.createBlock(_component_BaseHtmlRender, {
  5455. key: 1,
  5456. html: $options.post.jsonContent
  5457. }, null, 8, ["html"])),
  5458. vue.createVNode(_component_Toolbar, {
  5459. onReply: _cache[1] || (_cache[1] = ($event) => $data.isSticky = !$data.isSticky)
  5460. }, {
  5461. default: vue.withCtx(() => [
  5462. vue.createVNode(_component_Point, {
  5463. onAddThank: $options.addThank,
  5464. onRecallThank: $options.recallThank,
  5465. item: {
  5466. isThanked: $options.post.isThanked,
  5467. thankCount: $options.post.thankCount,
  5468. username: $options.post.username
  5469. },
  5470. "api-url": "topic/" + $options.post.id
  5471. }, null, 8, ["onAddThank", "onRecallThank", "item", "api-url"])
  5472. ]),
  5473. _: 1
  5474. })
  5475. ]),
  5476. $options.topReply.length && $options.config.showTopReply ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_28, [
  5477. vue.createElementVNode("div", {
  5478. class: "my-cell flex",
  5479. onClick: _cache[2] || (_cache[2] = (...args) => $options.collapseTopReplyList && $options.collapseTopReplyList(...args))
  5480. }, [
  5481. _hoisted_29,
  5482. vue.createElementVNode("div", _hoisted_30, [
  5483. vue.createVNode(_component_Tooltip, { title: "收起高赞回复" }, {
  5484. default: vue.withCtx(() => [
  5485. vue.createElementVNode("div", _hoisted_31, [
  5486. vue.createVNode(_component_Icon, { icon: "gravity-ui:chevrons-collapse-vertical" })
  5487. ])
  5488. ]),
  5489. _: 1
  5490. })
  5491. ])
  5492. ]),
  5493. vue.createElementVNode("div", _hoisted_32, [
  5494. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.topReply, (item, index) => {
  5495. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5496. key: item.floor,
  5497. type: "top",
  5498. modelValue: $options.topReply[index],
  5499. "onUpdate:modelValue": ($event) => $options.topReply[index] = $event
  5500. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5501. }), 128))
  5502. ], 512)
  5503. ])) : vue.createCommentVNode("", true),
  5504. $options.isMobile ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_33, [
  5505. vue.createElementVNode("div", {
  5506. class: "inner",
  5507. innerHTML: $options.post.fr
  5508. }, null, 8, _hoisted_34)
  5509. ])) : vue.createCommentVNode("", true),
  5510. vue.createElementVNode("div", _hoisted_35, [
  5511. $options.post.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_36, [
  5512. vue.createElementVNode("div", null, [
  5513. vue.createTextVNode(vue.toDisplayString($options.post.replyCount) + " 条回复 ", 1),
  5514. $options.post.lastReplyDate ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_37, [
  5515. vue.createTextVNode("  "),
  5516. _hoisted_38,
  5517. vue.createTextVNode("  " + vue.toDisplayString($options.post.lastReplyDate), 1)
  5518. ])) : vue.createCommentVNode("", true)
  5519. ]),
  5520. $options.config.showToolbar ? (vue.openBlock(), vue.createBlock(_component_BaseSelect, {
  5521. key: 0,
  5522. "display-type": $props.displayType,
  5523. "onUpdate:displayType": _cache[3] || (_cache[3] = (e2) => _ctx.$emit("update:displayType", e2))
  5524. }, null, 8, ["display-type"])) : (vue.openBlock(), vue.createElementBlock("div", {
  5525. key: 1,
  5526. class: "fr",
  5527. innerHTML: $options.post.fr
  5528. }, null, 8, _hoisted_39))
  5529. ])) : vue.createCommentVNode("", true),
  5530. $options.replyList.length || $props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  5531. $props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_40, [
  5532. vue.createVNode(_component_BaseLoading, { size: "large" })
  5533. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_41, [
  5534. $props.modelValue ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList($options.replyList, (item, index) => {
  5535. return vue.openBlock(), vue.createBlock(_component_Comment, {
  5536. key: item.floor,
  5537. modelValue: $options.replyList[index],
  5538. "onUpdate:modelValue": ($event) => $options.replyList[index] = $event
  5539. }, null, 8, ["modelValue", "onUpdate:modelValue"]);
  5540. }), 128)) : vue.createCommentVNode("", true)
  5541. ]))
  5542. ], 64)) : vue.createCommentVNode("", true)
  5543. ]),
  5544. !($options.replyList.length || $props.loading) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_42, "目前尚无回复")) : vue.createCommentVNode("", true),
  5545. $options.isLogin ? (vue.openBlock(), vue.createElementBlock("div", {
  5546. key: 3,
  5547. class: vue.normalizeClass(["my-box", { "sticky": $data.isSticky }]),
  5548. ref: "replyBox"
  5549. }, [
  5550. vue.createElementVNode("div", _hoisted_43, [
  5551. _hoisted_44,
  5552. vue.createElementVNode("div", _hoisted_45, [
  5553. $data.isSticky ? (vue.openBlock(), vue.createElementBlock("a", {
  5554. key: 0,
  5555. style: { "margin-right": "2rem" },
  5556. onClick: _cache[4] || (_cache[4] = ($event) => $data.isSticky = false)
  5557. }, "取消回复框停靠")) : vue.createCommentVNode("", true),
  5558. vue.createElementVNode("a", {
  5559. onClick: _cache[5] || (_cache[5] = (...args) => $options.scrollTop && $options.scrollTop(...args))
  5560. }, "回到顶部")
  5561. ])
  5562. ]),
  5563. vue.createElementVNode("div", _hoisted_46, [
  5564. vue.createVNode(_component_PostEditor, {
  5565. onClose: $options.goBottom,
  5566. ref: "post-editor",
  5567. useType: "reply-post",
  5568. onClick: _cache[6] || (_cache[6] = ($event) => $data.isSticky = true)
  5569. }, null, 8, ["onClose"])
  5570. ])
  5571. ], 2)) : vue.createCommentVNode("", true)
  5572. ], 4),
  5573. $data.showRelationReply ? (vue.openBlock(), vue.createElementBlock("div", {
  5574. key: 0,
  5575. class: "relationReply",
  5576. onClick: _cache[10] || (_cache[10] = ($event) => $options.close("space"))
  5577. }, [
  5578. vue.createElementVNode("div", {
  5579. class: "my-cell flex",
  5580. onClick: _cache[8] || (_cache[8] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  5581. }, [
  5582. _hoisted_47,
  5583. vue.createElementVNode("div", _hoisted_48, [
  5584. vue.createVNode(_component_Icon, {
  5585. icon: "ic:round-close",
  5586. onClick: _cache[7] || (_cache[7] = ($event) => $data.showRelationReply = false)
  5587. })
  5588. ])
  5589. ]),
  5590. vue.createElementVNode("div", {
  5591. class: "comments",
  5592. onClick: _cache[9] || (_cache[9] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"]))
  5593. }, [
  5594. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.relationReply, (item, index) => {
  5595. return vue.openBlock(), vue.createBlock(_component_SingleComment, {
  5596. "is-right": item.username === $data.targetUser.right,
  5597. key: item.floor,
  5598. comment: item
  5599. }, null, 8, ["is-right", "comment"]);
  5600. }), 128))
  5601. ])
  5602. ])) : vue.createCommentVNode("", true),
  5603. $data.showCallList && $options.filterCallList.length ? (vue.openBlock(), vue.createElementBlock("div", {
  5604. key: 1,
  5605. class: "call-list",
  5606. style: vue.normalizeStyle($data.callStyle)
  5607. }, [
  5608. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.filterCallList, (item, index) => {
  5609. return vue.openBlock(), vue.createElementBlock("div", {
  5610. class: vue.normalizeClass(["call-item", { select: index === $data.selectCallIndex }]),
  5611. onClick: ($event) => $options.setCall(item)
  5612. }, [
  5613. vue.createElementVNode("a", null, vue.toDisplayString(item), 1)
  5614. ], 10, _hoisted_49);
  5615. }), 256))
  5616. ], 4)) : vue.createCommentVNode("", true),
  5617. vue.createElementVNode("div", {
  5618. class: "close-btn",
  5619. onClick: _cache[11] || (_cache[11] = ($event) => $options.close("btn"))
  5620. }, [
  5621. vue.createVNode(_component_Icon, { icon: "fontisto:close-a" })
  5622. ]),
  5623. vue.createElementVNode("div", {
  5624. class: "scroll-top gray",
  5625. onClick: _cache[12] || (_cache[12] = vue.withModifiers((...args) => $options.scrollTop && $options.scrollTop(...args), ["stop"]))
  5626. }, [
  5627. vue.createVNode(_component_Icon, { icon: "lucide:move-up" })
  5628. ]),
  5629. vue.createElementVNode("div", {
  5630. class: "refresh gray",
  5631. onClick: _cache[13] || (_cache[13] = vue.withModifiers(($event) => _ctx.$emit("refresh"), ["stop"]))
  5632. }, [
  5633. $props.refreshLoading ? (vue.openBlock(), vue.createBlock(_component_BaseLoading, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_Icon, {
  5634. key: 1,
  5635. icon: "material-symbols:refresh"
  5636. }))
  5637. ]),
  5638. vue.createElementVNode("div", {
  5639. class: "scroll-to gray",
  5640. onClick: _cache[17] || (_cache[17] = vue.withModifiers(($event) => $options.jump($data.currentFloor), ["stop"]))
  5641. }, [
  5642. vue.createVNode(_component_Icon, { icon: "lucide:move-down" }),
  5643. vue.withDirectives(vue.createElementVNode("input", {
  5644. type: "text",
  5645. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => $data.currentFloor = $event),
  5646. onClick: _cache[15] || (_cache[15] = vue.withModifiers((...args) => $options.stop && $options.stop(...args), ["stop"])),
  5647. onKeydown: _cache[16] || (_cache[16] = vue.withKeys(($event) => $options.jump($data.currentFloor), ["enter"]))
  5648. }, null, 544), [
  5649. [vue.vModelText, $data.currentFloor]
  5650. ])
  5651. ])
  5652. ], 512)
  5653. ], 34)), [
  5654. [vue.vShow, $props.modelValue]
  5655. ]);
  5656. }
  5657. const PostDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-165fdc78"]]);
  5658. const _hoisted_1$5 = { key: 1 };
  5659. const _sfc_main$5 = {
  5660. __name: "Base64Tooltip",
  5661. setup(__props) {
  5662. const tooltip = vue.ref(null);
  5663. const show = vue.ref(false);
  5664. const originalText = vue.ref("");
  5665. const decodeText = vue.ref("");
  5666. const styleObject = vue.reactive({
  5667. left: "-100vw",
  5668. top: "-100vh"
  5669. });
  5670. vue.onMounted(() => {
  5671. eventBus.on(CMD.SHOW_TOOLTIP, ({ text, e: e2 }) => {
  5672. setTimeout(() => show.value = true);
  5673. originalText.value = text;
  5674. decodeText.value = "";
  5675. styleObject.left = e2.clientX + "px";
  5676. styleObject.top = e2.clientY + 20 + "px";
  5677. });
  5678. window.addEventListener("click", (e2) => {
  5679. if (!tooltip.value)
  5680. return;
  5681. if (!tooltip.value.contains(e2.target) && show.value) {
  5682. show.value = false;
  5683. }
  5684. }, { capture: true });
  5685. const fn = () => show.value && (show.value = false);
  5686. $(".post-detail", window.win().doc).on("scroll", fn);
  5687. });
  5688. function copy() {
  5689. if (window.win().navigator.clipboard) {
  5690. window.win().navigator.clipboard.writeText(decodeText.value);
  5691. eventBus.emit(CMD.SHOW_MSG, { type: "success", text: "复制成功" });
  5692. } else {
  5693. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "复制失败!浏览器不支持!" });
  5694. }
  5695. }
  5696. function base64ToArrayBuffer(base64) {
  5697. let binary_string = window.atob(base64);
  5698. let len = binary_string.length;
  5699. let bytes = new Uint8Array(len);
  5700. for (let i = 0; i < len; i++) {
  5701. bytes[i] = binary_string.charCodeAt(i);
  5702. }
  5703. return bytes.buffer;
  5704. }
  5705. function decode() {
  5706. try {
  5707. new Blob([base64ToArrayBuffer(originalText.value)]).text().then((r2) => {
  5708. decodeText.value = r2;
  5709. });
  5710. } catch (e2) {
  5711. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "Base64解码失败!不是标准数据!" });
  5712. }
  5713. }
  5714. return (_ctx, _cache) => {
  5715. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  5716. class: "base64_tooltip",
  5717. style: vue.normalizeStyle(styleObject),
  5718. onClick: decode,
  5719. ref_key: "tooltip",
  5720. ref: tooltip
  5721. }, [
  5722. !decodeText.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  5723. vue.createTextVNode(" Base64解码:" + vue.toDisplayString(originalText.value) + " ", 1),
  5724. vue.createVNode(vue.unref(Icon), { icon: "system-uicons:translate" })
  5725. ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
  5726. vue.createElementVNode("span", null, vue.toDisplayString(decodeText.value), 1),
  5727. vue.createVNode(BaseButton, {
  5728. class: "btn",
  5729. size: "small",
  5730. onClick: copy
  5731. }, {
  5732. default: vue.withCtx(() => [
  5733. vue.createTextVNode("点击复制")
  5734. ]),
  5735. _: 1
  5736. })
  5737. ]))
  5738. ], 4)), [
  5739. [vue.vShow, show.value]
  5740. ]);
  5741. };
  5742. }
  5743. };
  5744. const Base64Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c50fb66c"]]);
  5745. const _sfc_main$4 = {
  5746. name: "Msg",
  5747. components: { Icon },
  5748. props: {
  5749. type: "",
  5750. text: ""
  5751. },
  5752. created() {
  5753. setTimeout(() => {
  5754. this.$emit("close");
  5755. }, 3e3);
  5756. }
  5757. };
  5758. const _hoisted_1$4 = { class: "right" };
  5759. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  5760. const _component_Icon = vue.resolveComponent("Icon");
  5761. return vue.openBlock(), vue.createElementBlock("div", {
  5762. class: vue.normalizeClass(["msg", $props.type])
  5763. }, [
  5764. vue.createElementVNode("div", {
  5765. class: "left",
  5766. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  5767. }, [
  5768. vue.createVNode(_component_Icon, { icon: "ic:round-close" })
  5769. ]),
  5770. vue.createElementVNode("div", _hoisted_1$4, vue.toDisplayString($props.text), 1)
  5771. ], 2);
  5772. }
  5773. const Msg = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-8bf692ea"]]);
  5774. const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-674b86aa"), n2 = n2(), vue.popScopeId(), n2);
  5775. const _hoisted_1$3 = {
  5776. key: 0,
  5777. class: "tag-modal modal"
  5778. };
  5779. const _hoisted_2$2 = { class: "wrapper" };
  5780. const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 添加标签 ", -1));
  5781. const _hoisted_4$2 = { class: "option" };
  5782. const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("span", null, "用户:", -1));
  5783. const _hoisted_6$1 = { class: "btns" };
  5784. const _sfc_main$3 = {
  5785. __name: "TagModal",
  5786. props: ["tags"],
  5787. emits: ["update:tags"],
  5788. setup(__props, { emit: __emit }) {
  5789. const tagModal = vue.reactive({
  5790. show: false,
  5791. currentUsername: "",
  5792. tag: ""
  5793. });
  5794. const props = __props;
  5795. const emit = __emit;
  5796. const inputRef = vue.ref();
  5797. vue.onMounted(() => {
  5798. eventBus.on(CMD.ADD_TAG, (username) => {
  5799. tagModal.currentUsername = username;
  5800. tagModal.show = true;
  5801. vue.nextTick(() => {
  5802. inputRef.value.focus();
  5803. });
  5804. });
  5805. });
  5806. async function addTag() {
  5807. if (!tagModal.tag) {
  5808. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "请输入标签" });
  5809. return;
  5810. }
  5811. let oldTag = window.clone(props.tags);
  5812. let tempTag = window.clone(props.tags);
  5813. let userTags = tempTag[tagModal.currentUsername] ?? [];
  5814. let rIndex = userTags.findIndex((v) => v === tagModal.tag);
  5815. if (rIndex > -1) {
  5816. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "标签已存在!" });
  5817. return;
  5818. } else {
  5819. userTags.push(tagModal.tag);
  5820. }
  5821. tempTag[tagModal.currentUsername] = userTags;
  5822. emit("update:tags", tempTag);
  5823. tagModal.tag = "";
  5824. tagModal.show = false;
  5825. let res = await window.parse.saveTags(tempTag);
  5826. if (!res) {
  5827. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签添加失败!" });
  5828. emit("update:tags", oldTag);
  5829. }
  5830. }
  5831. return (_ctx, _cache) => {
  5832. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  5833. default: vue.withCtx(() => [
  5834. tagModal.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  5835. vue.createElementVNode("div", {
  5836. class: "mask",
  5837. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => tagModal.show = false, ["stop"]))
  5838. }),
  5839. vue.createElementVNode("div", _hoisted_2$2, [
  5840. _hoisted_3$2,
  5841. vue.createElementVNode("div", _hoisted_4$2, [
  5842. _hoisted_5$1,
  5843. vue.createElementVNode("div", null, [
  5844. vue.createElementVNode("b", null, vue.toDisplayString(tagModal.currentUsername), 1)
  5845. ])
  5846. ]),
  5847. vue.withDirectives(vue.createElementVNode("input", {
  5848. type: "text",
  5849. ref_key: "inputRef",
  5850. ref: inputRef,
  5851. style: { "width": "100%" },
  5852. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tagModal.tag = $event),
  5853. onKeydown: vue.withKeys(addTag, ["enter"])
  5854. }, null, 544), [
  5855. [vue.vModelText, tagModal.tag]
  5856. ]),
  5857. vue.createElementVNode("div", _hoisted_6$1, [
  5858. vue.createVNode(BaseButton, {
  5859. type: "link",
  5860. onClick: _cache[2] || (_cache[2] = ($event) => tagModal.show = false)
  5861. }, {
  5862. default: vue.withCtx(() => [
  5863. vue.createTextVNode("取消")
  5864. ]),
  5865. _: 1
  5866. }),
  5867. vue.createVNode(BaseButton, { onClick: addTag }, {
  5868. default: vue.withCtx(() => [
  5869. vue.createTextVNode("确定")
  5870. ]),
  5871. _: 1
  5872. })
  5873. ])
  5874. ])
  5875. ])) : vue.createCommentVNode("", true)
  5876. ]),
  5877. _: 1
  5878. });
  5879. };
  5880. }
  5881. };
  5882. const TagModal = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-674b86aa"]]);
  5883. const _hoisted_1$2 = { class: "msgs" };
  5884. const _sfc_main$2 = {
  5885. __name: "MsgModal",
  5886. setup(__props) {
  5887. const msgList = vue.reactive([
  5888. // {type: 'success', text: '123', id: Date.now()}
  5889. ]);
  5890. vue.onMounted(() => {
  5891. eventBus.on(CMD.SHOW_MSG, (val) => {
  5892. msgList.push({ ...val, id: Date.now() });
  5893. });
  5894. });
  5895. function removeMsg(id) {
  5896. let rIndex = msgList.findIndex((item) => item.id === id);
  5897. if (rIndex > -1) {
  5898. msgList.splice(rIndex, 1);
  5899. }
  5900. }
  5901. return (_ctx, _cache) => {
  5902. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
  5903. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(msgList, (v) => {
  5904. return vue.openBlock(), vue.createBlock(Msg, {
  5905. key: v.id,
  5906. type: v.type,
  5907. text: v.text,
  5908. onClose: ($event) => removeMsg(v.id)
  5909. }, null, 8, ["type", "text", "onClose"]);
  5910. }), 128))
  5911. ]);
  5912. };
  5913. }
  5914. };
  5915. const MsgModal = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-b73f4332"]]);
  5916. let u = ".__cf_email__", f = "data-cfemail", d = document.createElement("div");
  5917. function e(e2) {
  5918. console.error(e2);
  5919. }
  5920. function r(e2, t) {
  5921. let r2 = e2.substr(t, 2);
  5922. return parseInt(r2, 16);
  5923. }
  5924. function n(href, index) {
  5925. let o = "", a = r(href, index);
  5926. for (let i = index + 2; i < href.length; i += 2) {
  5927. let l = r(href, i) ^ a;
  5928. o += String.fromCharCode(l);
  5929. }
  5930. try {
  5931. o = decodeURIComponent(escape(o));
  5932. } catch (u2) {
  5933. e(u2);
  5934. }
  5935. d.innerHTML = '<a href="' + o.replace(/"/g, "&quot;") + '"></a>';
  5936. return d.childNodes[0].getAttribute("href") || "";
  5937. }
  5938. function decodeEmail(body) {
  5939. try {
  5940. let as = body.find(u);
  5941. as.each(function() {
  5942. try {
  5943. let o = this, a = o.parentNode, i = o.getAttribute(f);
  5944. if (i) {
  5945. let l = n(i, 0), d2 = document.createTextNode(l);
  5946. a.replaceChild(d2, o);
  5947. }
  5948. } catch (h2) {
  5949. e(h2);
  5950. }
  5951. });
  5952. } catch (s) {
  5953. e(s);
  5954. }
  5955. }
  5956. const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-882b932b"), n2 = n2(), vue.popScopeId(), n2);
  5957. const _hoisted_1$1 = {
  5958. key: 0,
  5959. class: "tag-modal modal"
  5960. };
  5961. const _hoisted_2$1 = { class: "modal-root" };
  5962. const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "title" }, " 提醒系统 ", -1));
  5963. const _hoisted_4$1 = ["innerHTML"];
  5964. const _sfc_main$1 = {
  5965. __name: "NotificationModal",
  5966. props: ["modelValue", "h"],
  5967. emits: ["update:modelValue"],
  5968. setup(__props, { emit: __emit }) {
  5969. const emit = __emit;
  5970. vue.onMounted(() => {
  5971. });
  5972. function close() {
  5973. emit("update:modelValue", false);
  5974. }
  5975. return (_ctx, _cache) => {
  5976. return vue.openBlock(), vue.createBlock(vue.Transition, null, {
  5977. default: vue.withCtx(() => [
  5978. __props.modelValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
  5979. vue.createElementVNode("div", {
  5980. class: "mask",
  5981. onClick: vue.withModifiers(close, ["stop"])
  5982. }),
  5983. vue.createElementVNode("div", _hoisted_2$1, [
  5984. vue.createElementVNode("div", { class: "modal-header" }, [
  5985. _hoisted_3$1,
  5986. vue.createElementVNode("i", {
  5987. class: "fa fa-times",
  5988. onClick: close
  5989. })
  5990. ]),
  5991. vue.createElementVNode("div", {
  5992. innerHTML: __props.h,
  5993. class: "modal-body"
  5994. }, null, 8, _hoisted_4$1)
  5995. ])
  5996. ])) : vue.createCommentVNode("", true)
  5997. ]),
  5998. _: 1
  5999. });
  6000. };
  6001. }
  6002. };
  6003. const NotificationModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-882b932b"]]);
  6004. const _sfc_main = {
  6005. components: {
  6006. BaseButton,
  6007. NotificationModal,
  6008. BaseLoading,
  6009. BaseSwitch,
  6010. MsgModal,
  6011. TagModal,
  6012. Tooltip,
  6013. Setting,
  6014. PostDetail,
  6015. Base64Tooltip,
  6016. Msg
  6017. },
  6018. provide() {
  6019. return {
  6020. isMobile: vue.computed(() => window.vals.isMobile),
  6021. isLogin: vue.computed(() => this.isLogin),
  6022. isNight: vue.computed(() => this.isNight),
  6023. pageType: vue.computed(() => this.pageType),
  6024. tags: vue.computed(() => this.tags),
  6025. show: vue.computed(() => this.show),
  6026. post: vue.computed(() => this.current),
  6027. config: vue.computed(() => this.config),
  6028. allReplyUsers: vue.computed(() => {
  6029. var _a, _b, _c;
  6030. if ((_a = this.current) == null ? void 0 : _a.replyList) {
  6031. return Array.from(new Set(((_c = (_b = this.current) == null ? void 0 : _b.replyList) == null ? void 0 : _c.map((v) => v.username)) ?? []));
  6032. }
  6033. return [];
  6034. }),
  6035. showConfig: this.showConfig
  6036. };
  6037. },
  6038. data() {
  6039. return {
  6040. loading: window.pageType === PageType.Post,
  6041. refreshLoading: false,
  6042. loadMore: false,
  6043. isLogin: !!window.user.username,
  6044. pageType: window.pageType,
  6045. isNight: window.isNight,
  6046. stopMe: window.stopMe,
  6047. //停止使用脚本
  6048. show: false,
  6049. current: window.clone(window.initPost),
  6050. list: [],
  6051. config: window.clone(window.config),
  6052. tags: window.user.tags,
  6053. configModal: {
  6054. show: false
  6055. },
  6056. notificationModal: {
  6057. show: false,
  6058. h: ""
  6059. }
  6060. };
  6061. },
  6062. computed: {
  6063. targetUserTags() {
  6064. return this.tags[window.targetUserName] ?? [];
  6065. },
  6066. isList() {
  6067. return [PageType.Home, PageType.Node].includes(this.pageType);
  6068. },
  6069. isPost() {
  6070. return this.pageType === PageType.Post;
  6071. },
  6072. isMember() {
  6073. return this.pageType === PageType.Member;
  6074. }
  6075. },
  6076. watch: {
  6077. config: {
  6078. handler(newVal) {
  6079. let config2 = { [window.user.username ?? "default"]: newVal };
  6080. localStorage.setItem("v2ex-config", JSON.stringify(config2));
  6081. window.config = newVal;
  6082. },
  6083. deep: true
  6084. },
  6085. tags(newVal) {
  6086. window.user.tags = newVal;
  6087. },
  6088. "config.viewType"(newVal) {
  6089. if (!newVal)
  6090. return;
  6091. if (newVal === "card") {
  6092. $(".post-item").each(function() {
  6093. $(this).addClass("preview");
  6094. });
  6095. } else {
  6096. $(".post-item").each(function() {
  6097. $(this).removeClass("preview");
  6098. });
  6099. }
  6100. }
  6101. },
  6102. created() {
  6103. let that = this;
  6104. this.initEvent();
  6105. window.cb = this.winCb;
  6106. if (!window.canParseV2exPage)
  6107. return;
  6108. $(document).on("click", "a", this.clickA);
  6109. $(document).on("click", ".post-item", function(e2) {
  6110. if (e2.currentTarget.getAttribute("script"))
  6111. return;
  6112. if (that.stopMe)
  6113. return true;
  6114. if (this.classList.contains("preview")) {
  6115. if (e2.target.tagName !== "A" && e2.target.tagName !== "IMG" && !e2.target.classList.contains("toggle")) {
  6116. console.log("点空白处", this);
  6117. let id = this.dataset["id"];
  6118. let href = this.dataset["href"];
  6119. if (id) {
  6120. that.clickPost(e2, id, href);
  6121. } else {
  6122. if (href)
  6123. location.href = href;
  6124. }
  6125. }
  6126. }
  6127. });
  6128. $(document).on("click", ".toggle", (e2) => {
  6129. if (this.stopMe)
  6130. return true;
  6131. let id = e2.target.dataset["id"];
  6132. let itemDom = document.querySelector(`.id_${id}`);
  6133. if (itemDom.classList.contains("preview")) {
  6134. e2.target.innerText = "预览";
  6135. itemDom.classList.remove("preview");
  6136. } else {
  6137. if (this.config.viewType !== "card") {
  6138. let index = this.list.findIndex((v) => v.id == id);
  6139. if (index > -1) {
  6140. e2.target.innerText = "收起";
  6141. itemDom.classList.add("preview");
  6142. } else {
  6143. e2.target.innerText = "加载中";
  6144. functions.getPostDetailByApi(id).then((res) => {
  6145. if (res.content_rendered) {
  6146. res.href = itemDom.dataset["href"];
  6147. this.list.push(getDefaultPost(res));
  6148. itemDom.classList.add("preview");
  6149. e2.target.innerText = "收起";
  6150. functions.appendPostContent(res, itemDom);
  6151. } else {
  6152. e2.target.innerText = "预览";
  6153. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "主题暂无正文!" });
  6154. }
  6155. });
  6156. }
  6157. } else {
  6158. e2.target.innerText = "收起";
  6159. itemDom.classList.add("preview");
  6160. }
  6161. }
  6162. });
  6163. window.onpopstate = (event) => {
  6164. if (event.state) {
  6165. if (!this.show)
  6166. this.show = true;
  6167. } else {
  6168. if (this.show)
  6169. this.show = false;
  6170. }
  6171. };
  6172. window.deleteNotification = (nId, token) => {
  6173. console.log("deleteNotification", nId, token);
  6174. let item = $("#n_" + nId);
  6175. item.slideUp("fast");
  6176. $.post({
  6177. url: "/delete/notification/" + nId + "?once=" + token,
  6178. success() {
  6179. $.get({
  6180. url: "/notifications/below/" + window.notificationBottom,
  6181. success(data, status, request) {
  6182. item.remove();
  6183. $("#notifications").append(data);
  6184. window.notificationBottom = request.getResponseHeader("X-V2EX-New-Notification-Bottom");
  6185. },
  6186. error() {
  6187. item.slideDown("fast");
  6188. }
  6189. });
  6190. },
  6191. error() {
  6192. item.slideDown("fast");
  6193. }
  6194. });
  6195. };
  6196. },
  6197. beforeUnmount() {
  6198. eventBus.clear();
  6199. $(document).off("click", "a", this.clickA);
  6200. },
  6201. methods: {
  6202. async getUnreadMessagesCount() {
  6203. var _a, _b;
  6204. const res = await fetch(`${location.origin}/mission`);
  6205. const htmlText = await res.text();
  6206. const $page = $(htmlText);
  6207. const text = $page.find('#Rightbar a[href^="/notifications"]').text();
  6208. if (text.includes("未读提醒")) {
  6209. const countStr = (_a = text.match(/\d+/)) == null ? void 0 : _a.at(0);
  6210. if (countStr) {
  6211. return Number((_b = text.match(/\d+/)) == null ? void 0 : _b.at(0));
  6212. }
  6213. } else {
  6214. return 0;
  6215. }
  6216. throw new Error("无法获取未读消息数量");
  6217. },
  6218. clickA(e2) {
  6219. let that = this;
  6220. if (e2.currentTarget.getAttribute("script"))
  6221. return;
  6222. if (that.stopMe)
  6223. return true;
  6224. let { href, id, title } = functions.parseA(e2.currentTarget);
  6225. if (href.includes("/settings/night/toggle"))
  6226. return;
  6227. if (href.includes("/?tab="))
  6228. return;
  6229. if (href.includes("/go"))
  6230. return;
  6231. if (href === window.origin + "/#;")
  6232. return;
  6233. if (href === window.origin + "/")
  6234. return;
  6235. if (href.includes("/notifications"))
  6236. ;
  6237. if (id) {
  6238. that.clickPost(e2, id, href, title);
  6239. } else {
  6240. if (that.config.newTabOpen) {
  6241. that.stopEvent(e2);
  6242. functions.openNewTab(href, that.config.newTabOpenActive);
  6243. }
  6244. }
  6245. },
  6246. stopEvent(e2) {
  6247. e2.preventDefault();
  6248. e2.stopPropagation();
  6249. },
  6250. async clickPost(e2, id, href, title = "") {
  6251. if (id) {
  6252. if (this.config.clickPostItemOpenDetail) {
  6253. this.stopEvent(e2);
  6254. let postItem = getDefaultPost();
  6255. let index = this.list.findIndex((v) => v.id == id);
  6256. if (index > -1) {
  6257. postItem = this.list[index];
  6258. }
  6259. if (!postItem.title)
  6260. postItem.title = title ?? "加载中";
  6261. postItem.id = id;
  6262. postItem.href = href;
  6263. this.getPostDetail(postItem);
  6264. return;
  6265. }
  6266. if (this.config.newTabOpen) {
  6267. this.stopEvent(e2);
  6268. functions.openNewTab(`https://www.v2ex.com/t/${id}?p=1`, this.config.newTabOpenActive);
  6269. }
  6270. }
  6271. },
  6272. showPost() {
  6273. this.show = true;
  6274. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6275. $(this).hide();
  6276. });
  6277. },
  6278. showConfig() {
  6279. this.configModal.show = true;
  6280. },
  6281. async winCb({ type, value }) {
  6282. console.log("回调的类型", type, value);
  6283. if (type === "openSetting") {
  6284. this.showConfig();
  6285. }
  6286. if (type === "syncData") {
  6287. this.list = Object.assign(this.list, window.postList);
  6288. this.config = window.config;
  6289. this.stopMe = window.stopMe;
  6290. this.tags = window.user.tags;
  6291. }
  6292. if (type === "warningNotice") {
  6293. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: value });
  6294. }
  6295. if (this.stopMe)
  6296. return;
  6297. if (type === "restorePost") {
  6298. this.show = false;
  6299. this.loading = false;
  6300. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "脚本无法查看此页面!" });
  6301. $(`#Wrapper #Main .box:lt(3)`).each(function() {
  6302. $(this).show();
  6303. });
  6304. }
  6305. if (type === "postContent") {
  6306. this.current = Object.assign(this.current, value);
  6307. this.current.inList = true;
  6308. if (this.config.autoOpenDetail) {
  6309. this.showPost();
  6310. }
  6311. }
  6312. if (type === "postReplies") {
  6313. this.current = Object.assign(this.current, value);
  6314. this.list.push(this.clone(this.current));
  6315. this.loading = false;
  6316. }
  6317. },
  6318. clone(val) {
  6319. return window.clone(val);
  6320. },
  6321. regenerateReplyList() {
  6322. if (this.current.replyList.length) {
  6323. this.current.replyCount = this.current.replyList.length;
  6324. let res = functions.createNestedList(this.current.replyList);
  6325. if (res) {
  6326. this.current.nestedReplies = res;
  6327. }
  6328. let dup_res = functions.createNestedRedundantList(this.current.replyList);
  6329. if (dup_res) {
  6330. this.current.nestedRedundReplies = dup_res;
  6331. }
  6332. } else {
  6333. this.current.replyCount = 0;
  6334. this.current.nestedReplies = [];
  6335. this.current.nestedRedundReplies = [];
  6336. }
  6337. if (this.list.length) {
  6338. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6339. if (rIndex > -1) {
  6340. this.list[rIndex] = this.clone(this.current);
  6341. }
  6342. }
  6343. },
  6344. initEvent() {
  6345. eventBus.on(CMD.CHANGE_COMMENT_THANK, (val) => {
  6346. console.log("CHANGE_COMMENT_THANK", val);
  6347. const { id, type } = val;
  6348. let currentI = this.current.replyList.findIndex((i) => i.id === id);
  6349. if (currentI > -1) {
  6350. this.current.replyList[currentI].isThanked = type === "add";
  6351. if (type === "add") {
  6352. this.current.replyList[currentI].thankCount++;
  6353. } else {
  6354. this.current.replyList[currentI].thankCount--;
  6355. }
  6356. this.regenerateReplyList();
  6357. }
  6358. });
  6359. eventBus.on(CMD.CHANGE_POST_THANK, (val) => {
  6360. const { id, type } = val;
  6361. this.current.isThanked = type === "add";
  6362. if (type === "add") {
  6363. this.current.thankCount++;
  6364. } else {
  6365. this.current.thankCount--;
  6366. }
  6367. let currentI = this.list.findIndex((i) => i.id === id);
  6368. if (currentI > -1) {
  6369. this.list[currentI].isThanked = type === "add";
  6370. if (type === "add") {
  6371. this.list[currentI].thankCount++;
  6372. } else {
  6373. this.list[currentI].thankCount++;
  6374. }
  6375. }
  6376. });
  6377. eventBus.on(CMD.REMOVE, (val) => {
  6378. let removeIndex = this.current.replyList.findIndex((i) => i.floor === val);
  6379. if (removeIndex > -1) {
  6380. this.current.replyList.splice(removeIndex, 1);
  6381. }
  6382. this.regenerateReplyList();
  6383. });
  6384. eventBus.on(CMD.IGNORE, () => {
  6385. this.show = false;
  6386. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6387. if (rIndex > -1) {
  6388. this.list.splice(rIndex, 1);
  6389. }
  6390. this.current = this.clone(window.initPost);
  6391. });
  6392. eventBus.on(CMD.MERGE, (val) => {
  6393. this.current = Object.assign(this.current, val);
  6394. let rIndex = this.list.findIndex((i) => i.id === this.current.id);
  6395. if (rIndex > -1) {
  6396. this.list[rIndex] = this.clone(this.current);
  6397. }
  6398. });
  6399. eventBus.on(CMD.ADD_REPLY, (item) => {
  6400. this.current.replyList.push(item);
  6401. this.regenerateReplyList();
  6402. });
  6403. eventBus.on(CMD.REFRESH_ONCE, async (once) => {
  6404. if (once) {
  6405. if (typeof once === "string") {
  6406. let res = once.match(/var once = "([\d]+)";/);
  6407. if (res && res[1]) {
  6408. this.current.once = Number(res[1]);
  6409. return;
  6410. }
  6411. }
  6412. if (typeof once === "number") {
  6413. this.current.once = once;
  6414. return;
  6415. }
  6416. }
  6417. window.fetchOnce().then((r2) => {
  6418. this.current.once = r2;
  6419. });
  6420. });
  6421. eventBus.on(CMD.REMOVE_TAG, async ({ username, tag }) => {
  6422. let oldTag = this.clone(this.tags);
  6423. let tags = this.tags[username] ?? [];
  6424. let rIndex = tags.findIndex((v) => v === tag);
  6425. if (rIndex > -1) {
  6426. tags.splice(rIndex, 1);
  6427. }
  6428. this.tags[username] = tags;
  6429. let res = await window.parse.saveTags(this.tags);
  6430. if (!res) {
  6431. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "标签删除失败!" });
  6432. this.tags = oldTag;
  6433. }
  6434. });
  6435. eventBus.on(CMD.REFRESH_POST, () => this.getPostDetail(this.current));
  6436. },
  6437. async getPostDetail(post) {
  6438. this.current = post;
  6439. this.show = true;
  6440. let url = window.baseUrl + "/t/" + this.current.id;
  6441. this.current.url = url;
  6442. let alreadyHasReply = this.current.replyList.length;
  6443. if (alreadyHasReply) {
  6444. this.refreshLoading = true;
  6445. } else {
  6446. this.loading = true;
  6447. functions.getPostDetailByApi(this.current.id).then((d2) => {
  6448. d2.replyCount = d2.replies;
  6449. this.current = Object.assign(this.current, d2);
  6450. if (this.current.replyCount > MAX_REPLY_LIMIT) {
  6451. functions.openNewTab(`${location.origin}/t/${this.current.id}?p=1&script=1`, true);
  6452. eventBus.emit(CMD.SHOW_MSG, { type: "warning", text: "由于回复数量较多,已为您单独打开此主题" });
  6453. this.loading = this.show = false;
  6454. return;
  6455. } else {
  6456. this.current.jsonContent = `
  6457. <div class="cell">
  6458. <div class="topic_content">
  6459. <div class="markdown_body">
  6460. ${(d2 == null ? void 0 : d2.content_rendered) ?? ""}
  6461. </div>
  6462. </div>
  6463. </div>`;
  6464. }
  6465. });
  6466. }
  6467. let apiRes = await window.fetch(url + "?p=1");
  6468. if (apiRes.status === 404) {
  6469. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "主题未找到" });
  6470. return this.refreshLoading = this.loading = false;
  6471. }
  6472. if (apiRes.status === 403) {
  6473. this.refreshLoading = this.show = this.loading = false;
  6474. functions.openNewTab(`${location.origin}/t/${post.id}?p=1&script=0`, true);
  6475. return;
  6476. }
  6477. if (apiRes.redirected) {
  6478. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "没有权限" });
  6479. return this.refreshLoading = this.loading = false;
  6480. }
  6481. let htmlText = await apiRes.text();
  6482. let hasPermission = htmlText.search("你要查看的页面需要先登录");
  6483. if (hasPermission > -1) {
  6484. eventBus.emit(CMD.SHOW_MSG, { type: "error", text: "你要查看的页面需要先登录" });
  6485. return this.refreshLoading = this.loading = false;
  6486. }
  6487. let bodyText = htmlText.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6488. let body = $(bodyText[0]);
  6489. decodeEmail(body);
  6490. await window.parse.getPostDetail(this.current, body, htmlText);
  6491. let index = this.list.findIndex((v) => v.id == this.current.id);
  6492. if (index > -1) {
  6493. this.list[index] = this.clone(this.current);
  6494. } else {
  6495. this.list.push(this.clone(this.current));
  6496. }
  6497. this.refreshLoading = this.loading = false;
  6498. await window.parse.parseOp(this.current);
  6499. console.log("当前主题", this.current);
  6500. },
  6501. addTargetUserTag() {
  6502. eventBus.emit(CMD.ADD_TAG, window.targetUserName);
  6503. },
  6504. removeTargetUserTag(tag) {
  6505. eventBus.emit(CMD.REMOVE_TAG, { username: window.targetUserName, tag });
  6506. }
  6507. }
  6508. };
  6509. const _withScopeId = (n2) => (vue.pushScopeId("data-v-c292e4b5"), n2 = n2(), vue.popScopeId(), n2);
  6510. const _hoisted_1 = {
  6511. key: 0,
  6512. class: "target-user-tags p1"
  6513. };
  6514. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "标签:", -1));
  6515. const _hoisted_3 = { class: "my-tag" };
  6516. const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", { class: "fa fa-tag" }, null, -1));
  6517. const _hoisted_5 = ["onClick"];
  6518. const _hoisted_6 = {
  6519. key: 1,
  6520. class: "my-box p2",
  6521. style: { "margin-top": "2rem", "margin-bottom": "0" }
  6522. };
  6523. const _hoisted_7 = {
  6524. key: 0,
  6525. class: "flex flex-center"
  6526. };
  6527. const _hoisted_8 = {
  6528. key: 1,
  6529. class: "loaded"
  6530. };
  6531. const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", null, "楼中楼解析完成", -1));
  6532. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  6533. const _component_Setting = vue.resolveComponent("Setting");
  6534. const _component_TagModal = vue.resolveComponent("TagModal");
  6535. const _component_PostDetail = vue.resolveComponent("PostDetail");
  6536. const _component_Base64Tooltip = vue.resolveComponent("Base64Tooltip");
  6537. const _component_MsgModal = vue.resolveComponent("MsgModal");
  6538. const _component_NotificationModal = vue.resolveComponent("NotificationModal");
  6539. const _component_BaseLoading = vue.resolveComponent("BaseLoading");
  6540. const _component_BaseButton = vue.resolveComponent("BaseButton");
  6541. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  6542. vue.createVNode(_component_Setting, {
  6543. modelValue: $data.config,
  6544. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.config = $event),
  6545. show: $data.configModal.show,
  6546. "onUpdate:show": _cache[1] || (_cache[1] = ($event) => $data.configModal.show = $event)
  6547. }, null, 8, ["modelValue", "show"]),
  6548. vue.createVNode(_component_TagModal, {
  6549. tags: $data.tags,
  6550. "onUpdate:tags": _cache[2] || (_cache[2] = ($event) => $data.tags = $event)
  6551. }, null, 8, ["tags"]),
  6552. vue.createVNode(_component_PostDetail, {
  6553. modelValue: $data.show,
  6554. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.show = $event),
  6555. ref: "postDetail",
  6556. displayType: $data.config.commentDisplayType,
  6557. "onUpdate:displayType": _cache[4] || (_cache[4] = ($event) => $data.config.commentDisplayType = $event),
  6558. onRefresh: _cache[5] || (_cache[5] = ($event) => $options.getPostDetail($data.current)),
  6559. loading: $data.loading,
  6560. refreshLoading: $data.refreshLoading
  6561. }, null, 8, ["modelValue", "displayType", "loading", "refreshLoading"]),
  6562. vue.createVNode(_component_Base64Tooltip),
  6563. vue.createVNode(_component_MsgModal),
  6564. vue.createVNode(_component_NotificationModal, {
  6565. modelValue: $data.notificationModal.show,
  6566. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.notificationModal.show = $event),
  6567. h: $data.notificationModal.h
  6568. }, null, 8, ["modelValue", "h"]),
  6569. !$data.stopMe ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  6570. $options.isMember && $data.isLogin && $data.config.openTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  6571. _hoisted_2,
  6572. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.targetUserTags, (i) => {
  6573. return vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
  6574. _hoisted_4,
  6575. vue.createElementVNode("span", null, vue.toDisplayString(i), 1),
  6576. vue.createElementVNode("i", {
  6577. class: "fa fa-trash-o remove",
  6578. onClick: ($event) => $options.removeTargetUserTag(i)
  6579. }, null, 8, _hoisted_5)
  6580. ]);
  6581. }), 256)),
  6582. vue.createElementVNode("span", {
  6583. class: "add-tag ago",
  6584. onClick: _cache[7] || (_cache[7] = (...args) => $options.addTargetUserTag && $options.addTargetUserTag(...args)),
  6585. title: "添加标签"
  6586. }, "+")
  6587. ])) : vue.createCommentVNode("", true),
  6588. $options.isPost && !$data.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
  6589. $data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
  6590. vue.createVNode(_component_BaseLoading)
  6591. ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
  6592. _hoisted_9,
  6593. vue.createVNode(_component_BaseButton, {
  6594. size: "small",
  6595. onClick: $options.showPost
  6596. }, {
  6597. default: vue.withCtx(() => [
  6598. vue.createTextVNode("点击显示")
  6599. ]),
  6600. _: 1
  6601. }, 8, ["onClick"])
  6602. ]))
  6603. ])) : vue.createCommentVNode("", true)
  6604. ], 64)) : vue.createCommentVNode("", true)
  6605. ], 64);
  6606. }
  6607. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c292e4b5"]]);
  6608. let isMobile = !document.querySelector("#Rightbar");
  6609. let $section = document.createElement("section");
  6610. $section.id = "app";
  6611. function run() {
  6612. window.baseUrl = location.origin;
  6613. window.initPost = DefaultPost;
  6614. window.win = function() {
  6615. return window;
  6616. };
  6617. window.win().doc = window.win().document;
  6618. window.win().query = (v) => window.win().document.querySelector(v);
  6619. window.query = (v) => window.win().document.querySelector(v);
  6620. window.clone = (val) => JSON.parse(JSON.stringify(val));
  6621. window.user = DefaultUser;
  6622. window.targetUserName = "";
  6623. window.pageType = void 0;
  6624. window.pageData = { pageNo: 1 };
  6625. window.config = DefaultConfig;
  6626. window.isNight = $(".Night").length === 1;
  6627. window.cb = null;
  6628. window.stopMe = false;
  6629. window.postList = [];
  6630. window.parse = {
  6631. //解析主题内容
  6632. async parsePostContent(post, body, htmlText) {
  6633. let once = htmlText.match(/var once = "([\d]+)";/);
  6634. if (once && once[1]) {
  6635. post.once = once[1];
  6636. }
  6637. post.isReport = htmlText.includes("你已对本主题进行了报告");
  6638. let wrapper = body.find("#Main");
  6639. if (!post.title || !post.content_rendered) {
  6640. let h1 = wrapper.find("h1");
  6641. if (h1) {
  6642. post.title = h1[0].innerText;
  6643. }
  6644. }
  6645. let as = wrapper.find(".header > a");
  6646. if (as.length) {
  6647. post.node.title = as[1].innerText;
  6648. post.node.url = as[1].href;
  6649. }
  6650. let aName = wrapper.find(".header small.gray a:nth-child(1)");
  6651. if (aName.length) {
  6652. post.member.username = aName[0].innerText;
  6653. }
  6654. let spanEl = wrapper.find(".header small.gray span");
  6655. if (spanEl.length) {
  6656. post.createDateAgo = spanEl[0].innerText;
  6657. post.createDate = spanEl[0].title;
  6658. }
  6659. let avatarEl = wrapper.find(".header .avatar");
  6660. if (avatarEl.length) {
  6661. post.member.avatar_large = avatarEl[0].src;
  6662. }
  6663. let topic_buttons = body.find(".topic_buttons");
  6664. if (topic_buttons.length) {
  6665. let favoriteNode = topic_buttons.find(".tb:first");
  6666. if (favoriteNode.length) {
  6667. post.isFavorite = favoriteNode[0].innerText === "取消收藏";
  6668. }
  6669. let ignoreNode = topic_buttons.find(".tb:nth-child(3)");
  6670. if (ignoreNode.length) {
  6671. post.isIgnore = ignoreNode[0].innerText === "取消忽略";
  6672. }
  6673. let thankNode = topic_buttons.find("#topic_thank .tb");
  6674. if (!thankNode.length) {
  6675. post.isThanked = true;
  6676. }
  6677. let topic_stats = topic_buttons.find(".topic_stats");
  6678. if (topic_stats.length) {
  6679. let text = topic_stats[0].innerText;
  6680. let reg1 = text.matchAll(/([\d]+)[\s]*人收藏/g);
  6681. let collectCountReg = [...reg1];
  6682. if (collectCountReg.length) {
  6683. post.collectCount = Number(collectCountReg[0][1]);
  6684. }
  6685. reg1 = text.matchAll(/([\d]+)[\s]*likes/g);
  6686. collectCountReg = [...reg1];
  6687. if (collectCountReg.length) {
  6688. post.collectCount = Number(collectCountReg[0][1]);
  6689. }
  6690. let reg2 = text.matchAll(/([\d]+)[\s]*人感谢/g);
  6691. let thankCountReg = [...reg2];
  6692. if (thankCountReg.length) {
  6693. post.thankCount = Number(thankCountReg[0][1]);
  6694. }
  6695. let reg3 = text.matchAll(/([\d]+)[\s]*次点击/g);
  6696. let clickCountReg = [...reg3];
  6697. if (clickCountReg.length) {
  6698. post.clickCount = Number(clickCountReg[0][1]);
  6699. }
  6700. reg3 = text.matchAll(/([\d]+)[\s]*views/g);
  6701. clickCountReg = [...reg3];
  6702. if (clickCountReg.length) {
  6703. post.clickCount = Number(clickCountReg[0][1]);
  6704. }
  6705. }
  6706. }
  6707. let header = body.find(`#Main .box`).first();
  6708. let temp = header.clone();
  6709. temp.find(".topic_buttons").remove();
  6710. temp.find(".inner").remove();
  6711. temp.find(".header").remove();
  6712. let html = temp.html();
  6713. html = functions.checkPhotoLink2Img(html);
  6714. post.headerTemplate = html;
  6715. return post;
  6716. },
  6717. //解析OP信息
  6718. async parseOp(post) {
  6719. if (!post.member.id) {
  6720. let userRes = await fetch(window.baseUrl + "/api/members/show.json?username=" + post.member.username);
  6721. if (userRes.status === 200) {
  6722. post.member = await userRes.json();
  6723. }
  6724. }
  6725. if (post.member.id) {
  6726. let date = new Date(post.member.created * 1e3);
  6727. let createStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
  6728. date.setHours(0);
  6729. date.setMinutes(0);
  6730. date.setSeconds(0);
  6731. date.setMilliseconds(0);
  6732. let now = /* @__PURE__ */ new Date();
  6733. now.setHours(0);
  6734. now.setMinutes(0);
  6735. now.setSeconds(0);
  6736. now.setMilliseconds(0);
  6737. let d2 = now.getTime() - date.getTime();
  6738. let isNew = d2 <= 1e3 * 60 * 60 * 24 * 7;
  6739. post.member.createDate = createStr + " 注册";
  6740. post.member.isNew = isNew;
  6741. } else {
  6742. post.member.createDate = "用户已被注销/封禁";
  6743. post.member.isNew = true;
  6744. }
  6745. return post;
  6746. },
  6747. //获取主题所有回复
  6748. async getPostAllReplies(post, body, htmlText, pageNo = 1) {
  6749. var _a, _b;
  6750. if (body.find("#no-comments-yet").length) {
  6751. return post;
  6752. }
  6753. let boxs = body.find(`#Main .box`);
  6754. let box = boxs[1];
  6755. let cells = box.querySelectorAll(".cell");
  6756. if (cells && cells.length) {
  6757. post.fr = cells[0].querySelector(".cell .fr").innerHTML;
  6758. cells = Array.from(cells);
  6759. let snow = cells[0].querySelector(".snow");
  6760. post.lastReplyDate = ((_b = (_a = snow == null ? void 0 : snow.nextSibling) == null ? void 0 : _a.nodeValue) == null ? void 0 : _b.trim()) || "";
  6761. let repliesMap = [];
  6762. if (cells[1].id) {
  6763. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(1)) });
  6764. let replyList = functions.getAllReply(repliesMap);
  6765. post.replyList = replyList;
  6766. post.replyCount = replyList.length;
  6767. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  6768. let nestedList = functions.createNestedList(replyList);
  6769. let nestedRedundantList = functions.createNestedRedundantList(replyList);
  6770. if (nestedList)
  6771. post.nestedReplies = nestedList;
  6772. if (nestedRedundantList)
  6773. post.nestedRedundReplies = nestedRedundantList;
  6774. return post;
  6775. } else {
  6776. let promiseList = [];
  6777. return new Promise((resolve, reject) => {
  6778. repliesMap.push({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  6779. let pages = cells[1].querySelectorAll("a.page_normal");
  6780. pages = Array.from(pages);
  6781. let url = window.baseUrl + "/t/" + post.id;
  6782. for (let i = 0; i < pages.length; i++) {
  6783. let currentPageNo = Number(pages[i].innerText);
  6784. promiseList.push(this.fetchPostOtherPageReplies(url + "?p=" + currentPageNo, currentPageNo));
  6785. }
  6786. Promise.allSettled(promiseList).then(
  6787. (results) => {
  6788. results.filter((result) => result.status === "fulfilled").map((v) => repliesMap.push(v.value));
  6789. let replyList = functions.getAllReply(repliesMap);
  6790. post.replyList = replyList;
  6791. post.replyCount = replyList.length;
  6792. post.allReplyUsers = Array.from(new Set(replyList.map((v) => v.username)));
  6793. let nestedList = functions.createNestedList(replyList);
  6794. let nestedRedundantList = functions.createNestedRedundantList(replyList);
  6795. if (nestedList)
  6796. post.nestedReplies = nestedList;
  6797. if (nestedRedundantList)
  6798. post.nestedRedundReplies = nestedRedundantList;
  6799. resolve(post);
  6800. }
  6801. );
  6802. });
  6803. }
  6804. }
  6805. },
  6806. //请求主题其他页的回复
  6807. fetchPostOtherPageReplies(href, pageNo) {
  6808. return new Promise((resolve) => {
  6809. $.get(href).then((res) => {
  6810. let s = res.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  6811. let box = $(s[0]).find("#Main .box")[1];
  6812. let cells = box.querySelectorAll(".cell");
  6813. cells = Array.from(cells);
  6814. resolve({ i: pageNo, replyList: this.parsePageReplies(cells.slice(2, cells.length - 1)) });
  6815. }).catch((r2) => {
  6816. if (r2.status === 403) {
  6817. functions.cbChecker({ type: "restorePost", value: null });
  6818. }
  6819. });
  6820. });
  6821. },
  6822. //解析页面的回复
  6823. parsePageReplies(nodes) {
  6824. let replyList = [];
  6825. nodes.forEach((node, index) => {
  6826. if (!node.id)
  6827. return;
  6828. let item = {
  6829. level: 0,
  6830. thankCount: 0,
  6831. isThanked: false,
  6832. isOp: false,
  6833. isDup: false,
  6834. id: node.id.replace("r_", "")
  6835. };
  6836. let reply_content = node.querySelector(".reply_content");
  6837. item.reply_content = functions.checkPhotoLink2Img(reply_content.innerHTML);
  6838. item.reply_text = reply_content.textContent;
  6839. let { users, floor } = this.parseReplyContent(item.reply_content);
  6840. item.hideCallUserReplyContent = item.reply_content;
  6841. if (users.length === 1) {
  6842. item.hideCallUserReplyContent = item.reply_content.replace(/@<a href="\/member\/[\s\S]+?<\/a>(\s#[\d]+)?\s(<br>)?/, () => "");
  6843. }
  6844. item.replyUsers = users;
  6845. item.replyFloor = floor;
  6846. let ago = node.querySelector(".ago");
  6847. item.date = ago.textContent;
  6848. let userNode = node.querySelector("strong a");
  6849. item.username = userNode.textContent;
  6850. let avatar = node.querySelector("td img");
  6851. item.avatar = avatar.src;
  6852. let no = node.querySelector(".no");
  6853. item.floor = Number(no.textContent);
  6854. let thank_area = node.querySelector(".thank_area");
  6855. if (thank_area) {
  6856. item.isThanked = thank_area.classList.contains("thanked");
  6857. }
  6858. let small = node.querySelector(".small");
  6859. if (small) {
  6860. item.thankCount = Number(small.textContent);
  6861. }
  6862. let op = node.querySelector(".op");
  6863. if (op) {
  6864. item.isOp = true;
  6865. }
  6866. let mod = node.querySelector(".mod");
  6867. if (mod) {
  6868. item.isMod = true;
  6869. }
  6870. replyList.push(item);
  6871. });
  6872. return replyList;
  6873. },
  6874. //解析回复内容,解析出@用户,回复楼层。用于后续生成嵌套楼层
  6875. parseReplyContent(str) {
  6876. if (!str)
  6877. return;
  6878. let users = [];
  6879. let getUsername = (userStr) => {
  6880. let endIndex = userStr.indexOf('">');
  6881. if (endIndex > -1) {
  6882. let user = userStr.substring(0, endIndex);
  6883. if (!users.find((i) => i === user)) {
  6884. users.push(user);
  6885. }
  6886. }
  6887. };
  6888. let userReg = /@<a href="\/member\/([\s\S]+?)<\/a>/g;
  6889. let has = str.matchAll(userReg);
  6890. let res2 = [...has];
  6891. if (res2.length > 1) {
  6892. res2.map((item) => {
  6893. getUsername(item[1]);
  6894. });
  6895. }
  6896. if (res2.length === 1) {
  6897. getUsername(res2[0][1]);
  6898. }
  6899. let floor = -1;
  6900. if (users.length === 1) {
  6901. let floorReg = /@<a href="\/member\/[\s\S]+?<\/a>[\s]+#([\d]+)/g;
  6902. let hasFloor = str.matchAll(floorReg);
  6903. let res = [...hasFloor];
  6904. if (res.length) {
  6905. floor = Number(res[0][1]);
  6906. }
  6907. }
  6908. return { users, floor };
  6909. },
  6910. //获取主题详情
  6911. async getPostDetail(post, body, htmlText, pageNo = 1) {
  6912. post = await this.parsePostContent(post, body, htmlText);
  6913. return await this.getPostAllReplies(post, body, htmlText, pageNo);
  6914. },
  6915. //解析页面主题列表
  6916. parsePagePostList(list, box) {
  6917. list.forEach((itemDom) => {
  6918. let item_title = itemDom.querySelector(".item_title");
  6919. if (!item_title)
  6920. return;
  6921. let item = getDefaultPost();
  6922. itemDom.classList.add("post-item");
  6923. let a = item_title.querySelector("a");
  6924. let { href, id } = functions.parseA(a);
  6925. item.id = Number(id);
  6926. a.href = item.href = href;
  6927. item.url = location.origin + "/api/topics/show.json?id=" + item.id;
  6928. itemDom.classList.add(`id_${id}`);
  6929. itemDom.dataset["href"] = href;
  6930. let td = itemDom.querySelector("td:nth-child(4)");
  6931. if (!td) {
  6932. td = itemDom.querySelector("td:nth-child(2)");
  6933. }
  6934. td.style.position = "relative";
  6935. let toggle = document.createElement("div");
  6936. toggle.dataset["id"] = item.id;
  6937. toggle.classList.add("toggle");
  6938. toggle.innerText = "预览";
  6939. td.append(toggle);
  6940. if (window.config.viewType === "card") {
  6941. window.postList.push(item);
  6942. }
  6943. });
  6944. const setF = (res) => {
  6945. let rIndex = window.postList.findIndex((w) => w.id === res.id);
  6946. if (rIndex > -1) {
  6947. window.postList[rIndex] = Object.assign(window.postList[rIndex], res);
  6948. functions.cbChecker({ type: "syncData" });
  6949. }
  6950. let itemDom = box.querySelector(`.id_${res.id}`);
  6951. itemDom.classList.add("preview");
  6952. if (res.content_rendered) {
  6953. functions.appendPostContent(res, itemDom);
  6954. }
  6955. };
  6956. if (window.config.viewType === "card") {
  6957. let cacheDataStr = localStorage.getItem("cacheData");
  6958. let cacheData = [];
  6959. if (cacheDataStr) {
  6960. cacheData = JSON.parse(cacheDataStr);
  6961. let now = Date.now();
  6962. cacheData = cacheData.filter((v) => {
  6963. return v.created > now / 1e3 - 60 * 60 * 24 * 3;
  6964. });
  6965. }
  6966. let fetchIndex = 0;
  6967. for (let i = 0; i < window.postList.length; i++) {
  6968. let item = window.postList[i];
  6969. let rItem = cacheData.find((w) => w.id === item.id);
  6970. if (rItem) {
  6971. rItem.href = item.href;
  6972. setF(rItem);
  6973. } else {
  6974. fetchIndex++;
  6975. setTimeout(() => {
  6976. $.get(item.url).then((v) => {
  6977. if (v && v.length) {
  6978. let res = getDefaultPost(v[0]);
  6979. res.href = item.href;
  6980. cacheData.push(res);
  6981. localStorage.setItem("cacheData", JSON.stringify(cacheData));
  6982. setF(res);
  6983. }
  6984. });
  6985. }, fetchIndex < 4 ? 0 : (fetchIndex - 4) * 1e3);
  6986. }
  6987. }
  6988. }
  6989. },
  6990. //创建记事本子条目
  6991. async createNoteItem(itemName) {
  6992. return new Promise(async (resolve) => {
  6993. let data = new FormData();
  6994. data.append("content", itemName);
  6995. data.append("parent_id", 0);
  6996. data.append("syntax", 0);
  6997. let apiRes = await fetch(`${location.origin}/notes/new`, { method: "post", body: data });
  6998. console.log(apiRes);
  6999. if (apiRes.redirected && apiRes.status === 200) {
  7000. resolve(apiRes.url.substr(-5));
  7001. return;
  7002. }
  7003. resolve(null);
  7004. });
  7005. },
  7006. //编辑记事本子条目
  7007. async editNoteItem(val, id) {
  7008. let data = new FormData();
  7009. data.append("content", val);
  7010. data.append("syntax", 0);
  7011. let apiRes = await fetch(`${location.origin}/notes/edit/${id}`, {
  7012. method: "post",
  7013. body: data
  7014. });
  7015. return apiRes.redirected && apiRes.status === 200;
  7016. },
  7017. //标签操作
  7018. async saveTags(val) {
  7019. for (const [key, value] of Object.entries(val)) {
  7020. if (!value.length)
  7021. delete val[key];
  7022. }
  7023. return await this.editNoteItem(window.user.tagPrefix + JSON.stringify(val), window.user.tagsId);
  7024. },
  7025. //已读楼层操作
  7026. async saveReadList(val) {
  7027. return;
  7028. },
  7029. //imgur图片删除hash操作
  7030. async saveImgurList(val) {
  7031. return;
  7032. }
  7033. };
  7034. window.vals = {
  7035. isMobile: !document.querySelector("#Rightbar")
  7036. };
  7037. function initMonkeyMenu() {
  7038. try {
  7039. _GM_registerMenuCommand("脚本设置", () => {
  7040. functions.cbChecker({ type: "openSetting" });
  7041. });
  7042. _GM_registerMenuCommand("仓库地址", () => {
  7043. functions.openNewTab(DefaultVal.git, true);
  7044. });
  7045. _GM_registerMenuCommand("反馈 & 建议", functions.feedback);
  7046. } catch (e2) {
  7047. console.error("无法使用Tampermonkey");
  7048. }
  7049. }
  7050. function initStyle() {
  7051. let style2 = `
  7052. html, body {
  7053. font-size: 62.5%;
  7054. }
  7055.  
  7056. :root{
  7057. --box-border-radius:8px;
  7058. }
  7059. .box{
  7060. box-shadow:rgba(0, 0, 0, 0.08) 0px 4px 12px;
  7061. }
  7062. #Tabs{
  7063. border-top-left-radius: var(--box-border-radius) !important;
  7064. border-top-right-radius: var(--box-border-radius) !important;
  7065. }
  7066. #Main .cell .count_livid {
  7067. font-size: 14px;
  7068. font-weight: bold;
  7069. padding: 3px 10px;
  7070. border-radius: 5px;
  7071. }
  7072.  
  7073. #Wrapper {
  7074. height: unset !important;
  7075. width: unset !important;
  7076. }
  7077.  
  7078. #Wrapper > .content {
  7079. height: unset !important;
  7080. width: unset !important;
  7081. max-width:1100px !important;
  7082. }
  7083.  
  7084. .post-item {
  7085. background: white;
  7086. }
  7087.  
  7088. .post-item > .post-content {
  7089. height: 0;
  7090. margin-top: 0;
  7091. }
  7092.  
  7093. .post-item:hover .toggle {
  7094. display: flex;
  7095. }
  7096.  
  7097. .toggle {
  7098. position: absolute;
  7099. right: ${window.config.viewType === "simple" ? "5rem" : 0};
  7100. top: ${window.config.viewType === "simple" ? 0 : "0.5rem"};
  7101. width: 5rem;
  7102. height: 100%;
  7103. display: flex;
  7104. justify-content: flex-end;
  7105. align-items: flex-end;
  7106. cursor: pointer;
  7107. font-size: 1.2rem;
  7108. color: var(--link-color);
  7109. display: none;
  7110. padding-right: 1rem;
  7111. }
  7112.  
  7113. .preview {
  7114. margin: 1rem 0;
  7115. border: 1px solid transparent;
  7116. border-radius: var(--box-border-radius);
  7117. cursor: pointer;
  7118. }
  7119.  
  7120. .preview:hover {
  7121. border: 1px solid #c8c8c8;
  7122. }
  7123.  
  7124. .preview > .post-content {
  7125. height: unset !important;
  7126. margin-top: 0.5rem !important;
  7127. }
  7128.  
  7129. .preview > .post-content.show-all {
  7130. max-height: unset;
  7131. -webkit-mask-image:none;
  7132. }
  7133.  
  7134. .preview .topic-link:link {
  7135. color: black !important;
  7136. }
  7137.  
  7138. .post-content {
  7139. margin-top: 0.5rem;
  7140. display: block;
  7141. max-height: 30rem;
  7142. overflow: hidden;
  7143. text-decoration: unset !important;
  7144. line-break: anywhere;
  7145. -webkit-mask-image: linear-gradient(180deg,#000 60%,transparent);
  7146. }
  7147.  
  7148. .show-more {
  7149. display: none;
  7150. }
  7151.  
  7152. .preview > .show-more {
  7153. font-size: 1.3rem;
  7154. text-align: right;
  7155. height: 3rem;
  7156. display: flex;
  7157. align-items: center;
  7158. justify-content: center;
  7159. position: relative;
  7160. z-index: 9;
  7161. }
  7162.  
  7163. .post-content:visited {
  7164. color: #afb9c1 !important;
  7165. }
  7166.  
  7167. .post-content:link {
  7168. color: #494949;
  7169. }
  7170.  
  7171.  
  7172. .Night .post-item {
  7173. background: #18222d !important;
  7174. }
  7175.  
  7176. .Night .preview {
  7177. border: 1px solid #3b536e;
  7178. }
  7179.  
  7180. .Night .preview > .post-content:link {
  7181. color: #d1d5d9;
  7182. }
  7183.  
  7184. .Night .preview > .post-content:visited {
  7185. color: #393f4e !important;
  7186. }
  7187. .Night .preview .topic-link:link {
  7188. color: #c0dbff !important;
  7189. }
  7190. ${window.config.viewType === "simple" ? `
  7191. ${window.pageType !== PageType.Member ? `
  7192. .item table tr td:first-child{display:none;}
  7193. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  7194. .item table tr td .sep5{display:none;}
  7195. .item table tr td .topic_info{display:none;}
  7196. .item {border-bottom:none;}
  7197. .avatar,#avatar{display:none;}
  7198. ` : ""}
  7199. #Logo {background-image:url('https://i.imgur.com/i9VgUtM.png');}
  7200. .bigger a, .top:nth-last-child(5){color: transparent!important;text-shadow: #b0b0b0 0 0 6px;user-select: none;}
  7201. // .bigger a:before,.top:nth-last-child(5):before{content:'Mona Lisa';position: absolute;background: white;}
  7202. #Rightbar .cell table:first-child tr td:first-child{display:none;}
  7203. ` : ""}
  7204.  
  7205. ${window.config.customBgColor ? `#Wrapper {
  7206. background-color: ${window.config.customBgColor} !important;
  7207. background-image: unset !important;
  7208. }` : ""}
  7209. .top{
  7210. position:relative;
  7211. }
  7212. .new:before{
  7213. content:'new';
  7214. position: absolute;
  7215. background: red;
  7216. font-size: 10px;
  7217. border-radius: 4px;
  7218. padding: 0px 2px;
  7219. color: white;
  7220. right: -9px;
  7221. top: -3px;
  7222. }
  7223. }
  7224. `;
  7225. let addStyle2 = document.createElement("style");
  7226. addStyle2.rel = "stylesheet";
  7227. addStyle2.type = "text/css";
  7228. addStyle2.innerHTML = style2;
  7229. window.document.head.append(addStyle2);
  7230. }
  7231. function qianDao() {
  7232. let timeNow = (/* @__PURE__ */ new Date()).getUTCFullYear() + "/" + ((/* @__PURE__ */ new Date()).getUTCMonth() + 1) + "/" + (/* @__PURE__ */ new Date()).getUTCDate();
  7233. if (window.pageType === PageType.Home) {
  7234. let qiandao = window.query('.box .inner a[href="/mission/daily"]');
  7235. if (qiandao) {
  7236. qianDao_(qiandao, timeNow);
  7237. } else if (window.win().doc.getElementById("gift_v2excellent")) {
  7238. window.win().doc.getElementById("gift_v2excellent").click();
  7239. localStorage.setItem("menu_clockInTime", timeNow);
  7240. console.info("[V2EX - 超级增强] 自动签到完成!");
  7241. } else {
  7242. console.info("[V2EX - 超级增强] 自动签到完成!");
  7243. }
  7244. } else {
  7245. let timeOld = localStorage.getItem("menu_clockInTime");
  7246. if (!timeOld || timeOld != timeNow) {
  7247. qianDaoStatus_(timeNow);
  7248. } else {
  7249. console.info("[V2EX - 超级增强] 自动签到完成!");
  7250. }
  7251. }
  7252. }
  7253. function qianDao_(qiandao, timeNow) {
  7254. let url = window.baseUrl + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector("div#Top .tools, #menu-body").innerHTML)[0];
  7255. console.log("url", url);
  7256. $.get(url).then((r2) => {
  7257. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7258. let html = $(bodyText[0]);
  7259. if (html.find("li.fa.fa-ok-sign").length) {
  7260. html = html.find("#Main").text().match(/已连续登录 (\d+?) 天/)[0];
  7261. localStorage.setItem("menu_clockInTime", timeNow);
  7262. console.info("[V2EX - 超级增强] 自动签到完成!");
  7263. if (qiandao) {
  7264. qiandao.textContent = `自动签到完成!${html}`;
  7265. qiandao.href = "javascript:void(0);";
  7266. }
  7267. } else {
  7268. _GM_notification({
  7269. text: "自动签到失败!请关闭其他插件或脚本。\n如果连续几天都签到失败,请联系作者解决!",
  7270. timeout: 4e3,
  7271. onclick() {
  7272. functions.feedback();
  7273. }
  7274. });
  7275. console.warn("[V2EX 增强] 自动签到失败!请关闭其他插件或脚本。如果连续几天都签到失败,请联系作者解决!");
  7276. if (qiandao)
  7277. qiandao.textContent = "自动签到失败!请尝试手动签到!";
  7278. }
  7279. });
  7280. }
  7281. function qianDaoStatus_(timeNow) {
  7282. $.get(window.baseUrl + "/mission/daily").then((r2) => {
  7283. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7284. let html = $(bodyText[0]);
  7285. if (html.find('input[value^="领取"]').length) {
  7286. qianDao_(null, timeNow);
  7287. } else {
  7288. console.info("[V2EX 增强] 已经签过到了。");
  7289. localStorage.setItem("menu_clockInTime", timeNow);
  7290. }
  7291. });
  7292. }
  7293. function getNoteItemContent(id, prefix) {
  7294. return new Promise((resolve, reject) => {
  7295. $.get(location.origin + "/notes/edit/" + id).then((r2) => {
  7296. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7297. let body = $(bodyText[0]);
  7298. let text = body.find(".note_editor").text();
  7299. if (text === prefix) {
  7300. resolve({});
  7301. } else {
  7302. let tagJson = text.substring(prefix.length);
  7303. try {
  7304. resolve(JSON.parse(tagJson));
  7305. } catch (e2) {
  7306. console.log("tage", tagJson);
  7307. resolve({});
  7308. }
  7309. }
  7310. });
  7311. });
  7312. }
  7313. function deleteNote(tagsId, cb) {
  7314. fetch(`/notes/${tagsId}`).then((r2) => {
  7315. r2.text().then((a) => {
  7316. let res = a.match(/\?once=([\d]+)/);
  7317. if (res && res[1]) {
  7318. console.log("接口返回了once-str", Number(res[1]));
  7319. fetch(`/notes/delete/${tagsId}?once=${Number(res[1])}`).then((r22) => {
  7320. console.log("r", r22, r22.url === location.origin + "/");
  7321. if (r22.status === 200) {
  7322. if (r22.redirected && r22.url === location.origin + "/") {
  7323. cb();
  7324. }
  7325. } else {
  7326. cb();
  7327. }
  7328. });
  7329. }
  7330. });
  7331. });
  7332. }
  7333. async function initNoteData() {
  7334. $.get(location.origin + "/notes").then(async (r2) => {
  7335. let bodyText = r2.match(/<body[^>]*>([\s\S]+?)<\/body>/g);
  7336. let body = $(bodyText[0]);
  7337. let items = body.find("#Main .box .note_item_title a");
  7338. if (window.config.openTag) {
  7339. let tagItems = Array.from(items).filter((v) => v.innerText.includes(window.user.tagPrefix));
  7340. if (tagItems.length) {
  7341. if (tagItems.length > 1) {
  7342. let next = true;
  7343. for (let i = 1; i < tagItems.length - 1; i++) {
  7344. setTimeout(() => {
  7345. if (!next)
  7346. return;
  7347. let tagsId = tagItems[i].href.substr(-5);
  7348. deleteNote(tagsId, () => next = false);
  7349. }, 60 * 1e3 * i);
  7350. }
  7351. }
  7352. window.user.tagsId = tagItems[0].href.substr(-5);
  7353. window.user.tags = await getNoteItemContent(window.user.tagsId, window.user.tagPrefix);
  7354. } else {
  7355. let r22 = await window.parse.createNoteItem(window.user.tagPrefix);
  7356. r22 && (window.user.tagsId = r22);
  7357. }
  7358. }
  7359. functions.cbChecker({ type: "syncData" });
  7360. });
  7361. }
  7362. function addSettingText() {
  7363. let setting = $(`<a href="/" class="top ${window.config.version < DefaultVal.currentVersion ? "new" : ""}">脚本设置</a>`);
  7364. setting.on("click", function(e2) {
  7365. e2.stopPropagation();
  7366. e2.preventDefault();
  7367. this.classList.remove("new");
  7368. functions.cbChecker({ type: "openSetting" });
  7369. });
  7370. $(".tools").prepend(setting);
  7371. }
  7372. async function init() {
  7373. window.addEventListener("error", (e2) => {
  7374. let dom = e2.target;
  7375. let originImgUrl = dom.getAttribute("data-originurl");
  7376. if (originImgUrl) {
  7377. let a = document.createElement("a");
  7378. a.href = originImgUrl;
  7379. a.setAttribute("notice", "此标签由v2ex超级增强脚本转换图片失败后恢复");
  7380. a.innerText = originImgUrl;
  7381. dom.parentNode.replaceChild(a, dom);
  7382. }
  7383. }, true);
  7384. if (window.isNight) {
  7385. document.documentElement.classList.add("dark");
  7386. }
  7387. functions.checkPageType();
  7388. initMonkeyMenu();
  7389. let top2 = document.querySelector(".tools .top:nth-child(2)");
  7390. if (top2 && top2.textContent !== "注册") {
  7391. window.user.username = top2.textContent;
  7392. window.user.avatar = $("#Rightbar .box .avatar").attr("src");
  7393. }
  7394. functions.initConfig().then(async (r2) => {
  7395. addSettingText();
  7396. initStyle();
  7397. try {
  7398. if (window.config.autoSignin && window.user.username) {
  7399. qianDao();
  7400. }
  7401. } catch (e2) {
  7402. console.log("签到失败");
  7403. }
  7404. if (window.user.username) {
  7405. initNoteData();
  7406. }
  7407. let box;
  7408. let list;
  7409. let last;
  7410. let headerWrap;
  7411. switch (window.pageType) {
  7412. case PageType.Node:
  7413. box = document.querySelectorAll("#Wrapper #Main .box");
  7414. try {
  7415. headerWrap = $('<div class="post-item"></div>');
  7416. if (window.config.viewType === "card")
  7417. headerWrap[0].classList.add("preview");
  7418. $(box[1]).prepend(headerWrap);
  7419. $(box[1]).children().slice(1, 3).each(function() {
  7420. if (this.classList.contains("cell")) {
  7421. headerWrap.append(this);
  7422. }
  7423. });
  7424. headerWrap = $('<div class="post-item"></div>');
  7425. if (window.config.viewType === "card")
  7426. headerWrap[0].classList.add("preview");
  7427. $(box[1]).append(headerWrap);
  7428. $(box[1]).children().slice(2).each(function() {
  7429. if (this.classList.contains("cell")) {
  7430. headerWrap.append(this);
  7431. }
  7432. });
  7433. box[1].style.boxShadow = "unset";
  7434. box[1].style.background = "unset";
  7435. box[1].style.overflow = "hidden";
  7436. } catch (e2) {
  7437. console.log("PageType-Node解析报错了", e2);
  7438. }
  7439. let topics = box[1].querySelector("#TopicsNode");
  7440. list = topics.querySelectorAll(".cell");
  7441. list[0].before($section);
  7442. window.parse.parsePagePostList(list, box[1]);
  7443. break;
  7444. case PageType.Changes:
  7445. case PageType.Home:
  7446. box = document.querySelector("#Wrapper #Main .box");
  7447. try {
  7448. headerWrap = $('<div class="post-item"></div>');
  7449. if (window.config.viewType === "card")
  7450. headerWrap[0].classList.add("preview");
  7451. $(box).prepend(headerWrap);
  7452. $(box).children().slice(1, 3).each(function() {
  7453. if (!this.classList.contains("item")) {
  7454. headerWrap.append(this);
  7455. }
  7456. });
  7457. last = $(box).children().last();
  7458. last.addClass("cell post-item");
  7459. if (window.config.viewType === "card")
  7460. last[0].classList.add("preview");
  7461. box.style.boxShadow = "unset";
  7462. box.style.background = "unset";
  7463. box.style.overflow = "hidden";
  7464. } catch (e2) {
  7465. console.log("PageType-Home解析报错了", e2);
  7466. }
  7467. list = box.querySelectorAll(".item");
  7468. list[0].before($section);
  7469. window.parse.parsePagePostList(list, box);
  7470. break;
  7471. case PageType.Post:
  7472. box = document.querySelector("#Wrapper #Main .box");
  7473. box.after($section);
  7474. let r22 = await functions.checkPostReplies(window.pageData.id, false);
  7475. if (r22) {
  7476. window.stopMe = true;
  7477. functions.cbChecker({ type: "syncData" });
  7478. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,脚本已停止解析楼中楼" });
  7479. return;
  7480. }
  7481. if (window.config.postWidth) {
  7482. let Main = $("#Main");
  7483. Main.css({
  7484. "width": window.config.postWidth,
  7485. margin: "unset"
  7486. });
  7487. $("#Wrapper > .content").css({
  7488. "max-width": "unset",
  7489. display: "flex",
  7490. "justify-content": "center",
  7491. gap: "20px"
  7492. });
  7493. Main.after($("#Rightbar"));
  7494. }
  7495. let post = getDefaultPost({ id: window.pageData.id });
  7496. let body = $(document.body);
  7497. let htmlText = document.documentElement.outerHTML;
  7498. window.parse.parsePostContent(
  7499. post,
  7500. body,
  7501. htmlText
  7502. ).then(async (res) => {
  7503. await functions.cbChecker({ type: "postContent", value: res });
  7504. await window.parse.parseOp(res);
  7505. });
  7506. window.parse.getPostAllReplies(
  7507. post,
  7508. body,
  7509. htmlText,
  7510. window.pageData.pageNo
  7511. ).then(async (res1) => {
  7512. await functions.cbChecker({ type: "postReplies", value: res1 });
  7513. });
  7514. break;
  7515. case PageType.Member:
  7516. box = document.querySelectorAll("#Wrapper #Main .box");
  7517. window.targetUserName = box[0].querySelector("h1").textContent;
  7518. if (window.config.openTag) {
  7519. box[0].style.borderBottom = "none";
  7520. box[0].style["border-bottom-left-radius"] = "0";
  7521. box[0].style["border-bottom-right-radius"] = "0";
  7522. }
  7523. try {
  7524. headerWrap = $('<div class="post-item"></div>');
  7525. if (window.config.viewType === "card")
  7526. headerWrap[0].classList.add("preview");
  7527. $(box[1]).prepend(headerWrap);
  7528. $(box[1]).children().slice(1, 2).each(function() {
  7529. if (!this.classList.contains("item")) {
  7530. headerWrap.append(this);
  7531. }
  7532. });
  7533. last = $(box[1]).children().last();
  7534. last.addClass("cell post-item");
  7535. if (window.config.viewType === "card")
  7536. last[0].classList.add("preview");
  7537. box[1].style.boxShadow = "unset";
  7538. box[1].style.background = "unset";
  7539. box[1].style.overflow = "hidden";
  7540. } catch (e2) {
  7541. console.log("PageType-Member解析报错了", e2);
  7542. }
  7543. list = box[1].querySelectorAll(".cell");
  7544. box[0].after($section);
  7545. window.parse.parsePagePostList(list, box[1]);
  7546. break;
  7547. default:
  7548. window.stopMe = true;
  7549. functions.cbChecker({ type: "syncData" });
  7550. console.error("未知页面");
  7551. break;
  7552. }
  7553. });
  7554. }
  7555. window.canParseV2exPage = !window.location.search.includes("script");
  7556. if (window.canParseV2exPage) {
  7557. init();
  7558. } else {
  7559. let box = document.querySelector("#Wrapper #Main .box");
  7560. box.after($section);
  7561. window.stopMe = true;
  7562. functions.cbChecker({ type: "syncData" });
  7563. if (window.location.search.includes("script=0")) {
  7564. functions.cbChecker({ type: "warningNotice", value: "脚本无法查看此主题,已为您单独打开此主题" });
  7565. }
  7566. if (window.location.search.includes("script=1")) {
  7567. functions.cbChecker({ type: "warningNotice", value: "由于回复数量较多,已为您单独打开此主题并停止解析楼中楼" });
  7568. }
  7569. }
  7570. }
  7571. if (!isMobile) {
  7572. (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:.7ex;text-decoration:underline 1px}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:1000;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-e4f684be]{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-e4f684be]{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-e4f684be]{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-e4f684be]{position:absolute;background:var(--color-sp-btn-bg);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-e4f684be]{word-break:keep-all;padding:.8rem 1rem;cursor:pointer}.display-type .type-list .item.active[data-v-e4f684be],.display-type .type-list .item[data-v-e4f684be]:hover{color:var(--color-font-pure)}.display-type svg[data-v-e4f684be]{width:1.5rem}.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-7d29b3cc]{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:1001}.pop-confirm-content .text[data-v-7d29b3cc]{text-align:start;font-size:1.6rem;width:15rem;min-width:15rem}.pop-confirm-content .options[data-v-7d29b3cc]{margin-top:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1rem}.setting-modal .modal-root[data-v-cb13d533]{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-cb13d533]{padding:1.4rem;display:flex;justify-content:center;position:relative}.setting-modal .modal-root .modal-header .title[data-v-cb13d533]{font-size:2.2rem;text-align:left;margin-bottom:0}.setting-modal .modal-root .modal-header svg[data-v-cb13d533]{position:absolute;right:1rem;cursor:pointer;font-size:2.6rem}.setting-modal .modal-root .body[data-v-cb13d533]{width:60rem}.setting-modal .modal-root .body .modal-content[data-v-cb13d533]{background:var(--color-second-bg);flex:1;height:100%;box-sizing:border-box;padding:1rem 1rem 1rem 2rem;font-size:1.6rem;text-align:left;line-height:1.6}.setting-modal .modal-root .body .btns[data-v-cb13d533]{margin:1.5rem;display:flex;justify-content:flex-end;align-items:center;gap:1.5rem;font-size:1.4rem}.setting-modal .modal-root[data-v-df0e0e8f]{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-df0e0e8f]{padding:2.4rem;display:flex;justify-content:space-between}.setting-modal .modal-root .modal-header .title[data-v-df0e0e8f]{font-size:2.6rem;font-weight:700;text-align:left;margin-bottom:0}.setting-modal .modal-root .modal-header svg[data-v-df0e0e8f]{cursor:pointer;font-size:2.6rem}.setting-modal .modal-root .body[data-v-df0e0e8f]{width:45vw;height:70vh;display:flex}.setting-modal .modal-root .body .left[data-v-df0e0e8f]{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-df0e0e8f]{padding:1rem 2rem;display:flex;flex-direction:column;gap:1rem}.setting-modal .modal-root .body .left .tabs .tab[data-v-df0e0e8f]{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-df0e0e8f]{background:var(--color-item-bg)}.setting-modal .modal-root .body .left .icons[data-v-df0e0e8f]{display:flex;gap:1rem;margin-bottom:2rem;font-size:2.4rem}.setting-modal .modal-root .body .modal-content[data-v-df0e0e8f]{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-df0e0e8f]{flex:1;padding-right:1rem;overflow:auto}.setting-modal .modal-root .body .modal-content .scroll .row[data-v-df0e0e8f]{min-height:5rem;display:flex;justify-content:space-between;align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper[data-v-df0e0e8f]{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-df0e0e8f]{text-align:right;font-size:1.4rem;color:gray}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key[data-v-df0e0e8f]{align-items:center}.setting-modal .modal-root .body .modal-content .scroll .row .wrapper .set-key input[data-v-df0e0e8f]{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-df0e0e8f]{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-df0e0e8f]{font-size:1.8rem}.setting-modal .modal-root .body .modal-content .scroll .desc[data-v-df0e0e8f]{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-df0e0e8f]{text-align:start;font-size:1.6rem;padding-bottom:10rem}.setting-modal .modal-root .body .modal-content .scroll .line[data-v-df0e0e8f]{border-bottom:1px solid #c4c3c3}.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-4522f98e]{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-4522f98e]{border:1px solid var(--color-line)}.post-editor-wrapper.reply-post.isFocus .post-editor[data-v-4522f98e]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment[data-v-4522f98e]{border-radius:var(--box-border-radius);overflow:hidden;border:1px solid var(--color-line)}.post-editor-wrapper.reply-comment.isFocus[data-v-4522f98e]{border:1px solid var(--color-active)}.post-editor-wrapper.reply-comment .toolbar[data-v-4522f98e]{background:var(--color-editor-toolbar)}.post-editor-wrapper .post-editor[data-v-4522f98e]{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-4522f98e]{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-4522f98e]{display:flex;align-items:center;gap:1rem;font-size:2.6rem}.post-editor-wrapper .toolbar .left svg[data-v-4522f98e]{cursor:pointer}.post-editor-wrapper .toolbar .left .upload[data-v-4522f98e]{width:2.6rem;height:2.6rem;overflow:hidden;display:flex;justify-content:center;align-items:center}.post-editor-wrapper .toolbar .left .upload input[data-v-4522f98e]{width:2.6rem;height:2.6rem;cursor:pointer;position:absolute;opacity:0}.post-editor-wrapper .toolbar span[data-v-4522f98e]{color:gray;font-size:1.3rem}.post-editor-wrapper .get-cursor[data-v-4522f98e]{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-4522f98e]{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-4522f98e]{cursor:pointer;position:absolute;right:.8rem;font-size:2.4rem}.post-editor-wrapper .emoticon-pack .list[data-v-4522f98e]{margin:1rem 0}.post-editor-wrapper .emoticon-pack img[data-v-4522f98e]{cursor:pointer;width:3rem;height:3rem;padding:.5rem}.post-editor-wrapper .emoticon-pack span[data-v-4522f98e]{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:.7ex;text-decoration:underline 1px}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:1000;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-67807ede]{width:100%;box-sizing:border-box;margin-top:.6rem}.comment.isLevelOne[data-v-67807ede]{border-bottom:1px solid var(--color-line);padding:.8rem 1rem;margin-top:0}.comment.ding[data-v-67807ede]{background:rgba(255,255,0,.3)!important}.comment.isSimple .avatar[data-v-67807ede],.comment.isSimple .expand-line[data-v-67807ede]{display:none}.comment.isSimple .simple-wrapper[data-v-67807ede]{padding-left:2.8rem}.comment.isSimple .w[data-v-67807ede]{padding-left:0!important;padding-top:.5rem}.comment .comment-content-w .more[data-v-67807ede]{text-align:center;margin:2rem 0}.comment .comment-content[data-v-67807ede]{display:flex;position:relative}.comment .comment-content .expand-line[data-v-67807ede]{cursor:pointer;margin-top:.6rem;width:2.8rem;min-width:2.8rem;position:relative}.comment .comment-content .expand-line[data-v-67807ede]:after{position:absolute;left:50%;content:" ";height:100%;width:0;border-right:1px solid var(--color-line)}.comment .comment-content .expand-line[data-v-67807ede]:hover:after{border-right:2px solid var(--color-active)}.comment .comment-content .right[data-v-67807ede]{flex:1;width:calc(100% - 3rem)}.comment .comment-content .right .w[data-v-67807ede]{padding-left:1rem}.comment .comment-content .right .w .post-editor-wrapper[data-v-67807ede]{margin-top:1rem}.wrong-wrapper[data-v-67807ede]{font-size:1.4rem;margin-bottom:1rem}.wrong-wrapper span[data-v-67807ede]{cursor:pointer}.wrong-wrapper .del-line[data-v-67807ede]{text-decoration:line-through}.wrong-wrapper .wrong-icon[data-v-67807ede]{margin-left:.5rem}.wrong-wrapper .warning[data-v-67807ede]{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-e3df61b2]{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-165fdc78],.v-leave-active[data-v-165fdc78]{transition:opacity .3s ease}.v-enter-from[data-v-165fdc78],.v-leave-to[data-v-165fdc78]{opacity:0}.username[data-v-165fdc78]{font-weight:700;font-size:1.4rem;margin-right:1rem}.link-num[data-v-165fdc78]{font-size:1.2rem;font-weight:700;color:#e02a2a}.owner[data-v-165fdc78]{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-165fdc78]{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-165fdc78]{font-size:1.4rem;color:red;margin-left:1rem}.my-tag:hover .remove[data-v-165fdc78]{display:inline}.my-tag .remove[data-v-165fdc78]{cursor:pointer;margin-left:.5rem;display:none}.add-tag[data-v-165fdc78]{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-165fdc78]{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-165fdc78]: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-165fdc78]{--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-165fdc78],body[data-v-165fdc78]{font-size:62.5%}[data-v-165fdc78]::-webkit-scrollbar{width:1rem;height:1rem}[data-v-165fdc78]::-webkit-scrollbar-track{background:transparent;border-radius:.2rem}[data-v-165fdc78]::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:1rem}.flex[data-v-165fdc78]{display:flex;align-items:center;justify-content:space-between}.flex-end[data-v-165fdc78]{justify-content:flex-end}.flex-center[data-v-165fdc78]{justify-content:center}.p1[data-v-165fdc78]{padding:1rem}.p2[data-v-165fdc78]{padding:2rem}.p0[data-v-165fdc78]{padding:0!important}body :is(.topic_content,.reply_content) a[href^=http][data-v-165fdc78]{text-underline-offset:.7ex;text-decoration:underline 1px}a[data-v-165fdc78]{text-decoration:none;cursor:pointer}a[data-v-165fdc78]:hover{text-decoration:underline}.tool[data-v-165fdc78]{position:relative;display:flex;align-items:center;border-radius:.3rem;cursor:pointer;height:2.6rem;padding:0 .5rem;gap:.6rem}.tool>svg[data-v-165fdc78]{width:1.6rem!important;height:1.6rem!important}.tool[data-v-165fdc78]:hover{background:var(--color-third-bg)}.tool.no-hover[data-v-165fdc78]{cursor:default}.tool.no-hover[data-v-165fdc78]:hover{background:unset!important}.tool.disabled[data-v-165fdc78]{cursor:not-allowed}.tool.disabled[data-v-165fdc78]:hover{background:unset!important}.my-node[data-v-165fdc78]{border-radius:.2rem;padding:.4rem;font-size:1rem;color:#999;background:#f5f5f5;cursor:pointer}.my-node[data-v-165fdc78]:hover{text-decoration:none;background:#e2e2e2}.msgs[data-v-165fdc78]{position:fixed;margin-left:calc(50% - 25rem);width:50rem;z-index:9999;bottom:0;left:0;right:0}.my-box[data-v-165fdc78]{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-165fdc78]{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-165fdc78]{position:fixed;z-index:1000;width:100vw;height:100vh;left:0;top:0;display:flex;justify-content:center;align-items:center}.modal .title[data-v-165fdc78]{font-size:2.4rem;margin-bottom:1rem;text-align:center}.modal .option[data-v-165fdc78]{display:flex;align-items:center;padding:.6rem 0}.modal .option>span[data-v-165fdc78]{position:relative}.modal .mask[data-v-165fdc78]{position:fixed;width:100vw;height:100vh;left:0;top:0;background-color:#1d1c1c47}.radio-group2[data-v-165fdc78]{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-165fdc78]{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-165fdc78]:first-child{border-left:none}.radio-group2 .active[data-v-165fdc78]{background:var(--color-third-bg);color:var(--color-font)}.pop-confirm[data-v-165fdc78]{position:relative;display:inline-flex;justify-content:center}input[data-v-165fdc78]{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-165fdc78]:hover{border:1px solid var(--color-input-border-hover)}input[data-v-165fdc78]:focus{border:1px solid var(--color-active)}.danger[data-v-165fdc78]{color:red!important}.Post[data-v-165fdc78]{position:unset!important;background:transparent!important;overflow:unset!important}.Post .main[data-v-165fdc78]{background:transparent!important;padding:unset!important;width:100%!important}.Post .close-btn[data-v-165fdc78]{display:none}.post-detail[data-v-165fdc78]{text-align:start;position:fixed;z-index:1000;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-165fdc78] .subtle{background-color:#ecfdf5e6;border-left:4px solid #a7f3d0}.post-detail.isNight[data-v-165fdc78] .subtle{background-color:#1a3332;border-left:4px solid #047857}.post-detail .main[data-v-165fdc78]{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-165fdc78]{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-165fdc78]{display:inline-block}.post-detail .main .main-wrapper .loading-wrapper[data-v-165fdc78]{height:20rem;display:flex;justify-content:center;align-items:center}.post-detail .main .main-wrapper #no-comments-yet[data-v-165fdc78]{color:#a9a9a9;font-weight:700;text-align:center;width:100%;margin-bottom:2rem;box-sizing:border-box}.post-detail .main .relationReply[data-v-165fdc78]{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-165fdc78]{background:var(--color-second-bg);border-radius:var(--box-border-radius) var(--box-border-radius) 0 0}.post-detail .main .relationReply .comments[data-v-165fdc78]{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-165fdc78]{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-165fdc78]{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-165fdc78],.post-detail .main .call-list .call-item[data-v-165fdc78]:hover,.post-detail .main .call-list .call-item.select[data-v-165fdc78]{background:var(--color-main-bg);text-decoration:none}.post-detail .main .call-list .call-item[data-v-165fdc78]:nth-child(1){border-top:1px solid transparent}@media screen and (max-width: 1500px){.post-detail .main-wrapper[data-v-165fdc78]{width:65vw!important}}@media screen and (max-width: 1280px){.post-detail .main-wrapper[data-v-165fdc78]{width:75vw!important}}@media screen and (max-width: 960px){.post-detail .main-wrapper[data-v-165fdc78]{width:100vw!important}}.post-detail .scroll-top[data-v-165fdc78]{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-165fdc78]{font-size:2.4rem}.post-detail .refresh[data-v-165fdc78]{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-165fdc78]{font-size:2.4rem}.post-detail .scroll-to[data-v-165fdc78]{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-165fdc78]{font-size:2.4rem}.post-detail .scroll-to input[data-v-165fdc78]{height:2.6rem;width:3.6rem;font-size:1.4rem;text-align:center;color:gray}.post-detail .close-btn[data-v-165fdc78]{color:var(--color-font-3);cursor:pointer;position:fixed;top:3rem;transform:translate(4rem);font-size:1.6rem}.post-detail .top-reply[data-v-165fdc78]{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:.7ex;text-decoration:underline 1px}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:1000;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-c292e4b5]{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-c292e4b5]{display:inline-block}.loaded[data-v-c292e4b5]{font-size:1.4rem;display:flex;align-items:center;gap:1rem;color:var(--color-font-pure)} ');
  7573. console.log("V2EX PC端");
  7574. run();
  7575. let vueApp = vue.createApp(App);
  7576. vueApp.config.unwrapInjectedRef = true;
  7577. vueApp.mount($section);
  7578. }
  7579.  
  7580. })(Vue);