论坛tampermonkey

论坛tampermonkey版本

  1. // ==UserScript==
  2. // @name 论坛tampermonkey
  3. // @namespace npm/vite-plugin-monkey
  4. // @version 3.08
  5. // @author gsonhub
  6. // @description 论坛tampermonkey版本
  7. // @license MIT
  8. // @icon https://vitejs.dev/logo.svg
  9. // @match https://jsonp.gitee.io/404.html*
  10. // @match http://192.168.88.3:5173/dev/index.html*
  11. // @match http://192.168.101.188:5173/dev/index.html*
  12. // @require https://cdn.jsdelivr.net/npm/vue@3.3.4/dist/vue.global.prod.js
  13. // @require https://cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js
  14. // @connect cunhua.pics
  15. // @connect www.cunhua.pics
  16. // @connect cunhua.moe
  17. // @connect www.cunhua.moe
  18. // @grant GM_xmlhttpRequest
  19. // @grant unsafeWindow
  20. // @run-at document-end
  21. // ==/UserScript==
  22.  
  23. (t=>{const a=document.createElement("style");a.dataset.source="vite-plugin-monkey",a.textContent=t,document.head.append(a)})(' @charset "UTF-8";:root{--vt-c-white: #ffffff;--vt-c-white-soft: #f8f8f8;--vt-c-white-mute: #f2f2f2;--vt-c-black: #181818;--vt-c-black-soft: #222222;--vt-c-black-mute: #282828;--vt-c-indigo: #2c3e50;--vt-c-divider-light-1: rgba(60, 60, 60, .29);--vt-c-divider-light-2: rgba(60, 60, 60, .12);--vt-c-divider-dark-1: rgba(84, 84, 84, .65);--vt-c-divider-dark-2: rgba(84, 84, 84, .48);--vt-c-text-light-1: var(--vt-c-indigo);--vt-c-text-light-2: rgba(60, 60, 60, .66);--vt-c-text-dark-1: var(--vt-c-white);--vt-c-text-dark-2: rgba(235, 235, 235, .64)}:root{--color-background: var(--vt-c-white);--color-background-soft: var(--vt-c-white-soft);--color-background-mute: var(--vt-c-white-mute);--color-border: var(--vt-c-divider-light-2);--color-border-hover: var(--vt-c-divider-light-1);--color-heading: var(--vt-c-text-light-1);--color-text: var(--vt-c-text-light-1);--section-gap: 160px}@media (prefers-color-scheme: dark){:root{--color-background: var(--vt-c-black);--color-background-soft: var(--vt-c-black-soft);--color-background-mute: var(--vt-c-black-mute);--color-border: var(--vt-c-divider-dark-2);--color-border-hover: var(--vt-c-divider-dark-1);--color-heading: var(--vt-c-text-dark-1);--color-text: var(--vt-c-text-dark-2)}}*,*:before,*:after{box-sizing:border-box;margin:0;font-weight:400}body{min-height:100vh;color:var(--color-text);background:var(--color-background);transition:color .5s,background-color .5s;line-height:1.6;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:15px;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{background-color:#3a3c40}#app{margin:0;padding:0;font-weight:400;min-height:100vh}.left-bar[data-v-e340e55d]{width:125px;height:100vh;display:flex;background-color:#191919;position:relative;padding-top:100px}.left-bar .logo[data-v-e340e55d]{position:absolute;top:5px;left:5px}.left-bar .logo img[data-v-e340e55d]{height:40px}.left-bar .bar[data-v-e340e55d]{width:2px;height:14px;margin-left:20px;margin-top:4px;background-color:#fd8d29;transition:transform .1s}.left-bar .cate[data-v-e340e55d]{flex:1;display:flex;flex-direction:column;cursor:pointer}.left-bar .cate a.item[data-v-e340e55d]{display:block;text-decoration:none;height:55px;color:#fff;font-size:14px;margin-left:10px}.left-bar .cate a.item.active[data-v-e340e55d]{color:#fd8d29}.top-bar[data-v-0a5dfa4f]{position:fixed;top:0;left:0;z-index:999;width:100%;height:50px;background:#3a3c40;display:flex}.top-bar .logo[data-v-0a5dfa4f]{flex:1;padding-left:0}.top-bar .logo img[data-v-0a5dfa4f]{height:50px;display:block;padding:10px}.top-bar .search-bar[data-v-0a5dfa4f]{width:500px;padding-left:10px}.top-bar .search-bar .bar[data-v-0a5dfa4f]{width:490px;margin:8px 0;padding-left:17px;border-radius:17px;background-color:#2b2c2f;display:flex}.top-bar .search-bar .bar .input[data-v-0a5dfa4f]{flex:1}.top-bar .search-bar .bar .input input[data-v-0a5dfa4f]{width:100%;background-color:#2b2c2f;height:34px;outline:none;border:none;color:#fff}.top-bar .search-bar .bar button[data-v-0a5dfa4f]{display:flex;justify-content:center;align-items:center;width:100px;height:30px;margin:2px;border:none;font-size:12px;outline:none;border-radius:15px;cursor:pointer;background-color:#4a4b4e;color:#fff}.top-bar .search-bar .bar button[data-v-0a5dfa4f]:active{background:#3a3c3f}.top-bar .search-bar .bar button .icon[data-v-0a5dfa4f]{display:inline-block;scale:.6}.top-bar .tool[data-v-0a5dfa4f]{flex:1;display:flex;flex-direction:row-reverse;align-items:center;margin-right:20px}.top-bar .tool .icon[data-v-0a5dfa4f]{margin-left:15px;color:#eee;scale:.9}@media (max-width: 768px){.top-bar .search-bar[data-v-0a5dfa4f]{width:300px}.top-bar .search-bar .bar[data-v-0a5dfa4f]{width:290px}.top-bar .tool[data-v-0a5dfa4f]{display:none}}.cate-bar[data-v-5b69aa69]{width:100%;height:50px;position:fixed;display:flex;align-items:end;padding-left:20px;background:#3a3c40;z-index:999}.cate-bar a.cate[data-v-5b69aa69]{display:block;text-decoration:none;margin:10px;color:#fff;font-size:14px}.cate-bar a.cate span[data-v-5b69aa69]{padding-bottom:6px}.cate-bar a.cate.active span[data-v-5b69aa69]{border-bottom:2px solid #fd8d29;color:#fd8d29}.vo-item{text-decoration:none;display:block;border-radius:5px;overflow:hidden}.vo-item .img img{display:block;width:100%;opacity:1}.vo-item .text p{color:#fff;opacity:1}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.element{animation:rotate 1s linear infinite;color:#fff;position:fixed;bottom:0;left:50%;width:36px;height:36px;z-index:999}.list-bar{top:50px}@media (max-width: 768px){.list-bar{top:100px}}.container[data-v-856190d9]{display:flex}.container .left[data-v-856190d9]{width:125px;position:fixed;z-index:9999;left:0}.container .right[data-v-856190d9]{width:100%;padding-left:125px}.container .right .cate-bar[data-v-856190d9]{display:none}@media (max-width: 768px){.container .left[data-v-856190d9]{display:none}.container .right[data-v-856190d9]{padding-left:0}.container .right .cate-bar[data-v-856190d9]{display:flex;top:50px}} ');
  24.  
  25. (function (vue, jQuery) {
  26. 'use strict';
  27.  
  28. var __defProp = Object.defineProperty;
  29. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  30. var __publicField = (obj, key, value) => {
  31. __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  32. return value;
  33. };
  34. let config = {
  35. app_name: "论坛tampermonkey",
  36. version: "3.08",
  37. debug: false,
  38. host: "cunhua.pics"
  39. };
  40. var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
  41. var _unsafeWindow = /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)();
  42. const _Logger = class {
  43. static config(option) {
  44. const { appName = "", debug = true } = option;
  45. _Logger.appName = appName;
  46. _Logger.debug = debug;
  47. }
  48. static traceCall() {
  49. const error = new Error();
  50. if (error.stack) {
  51. const stackLines = error.stack.split("\n");
  52. if (stackLines[3]) {
  53. return stackLines[3];
  54. }
  55. }
  56. return "";
  57. }
  58. static log(...info) {
  59. const trace = _Logger.traceCall();
  60. info = [...info, trace];
  61. if (_Logger.debug)
  62. console.log(_Logger.appName, (/* @__PURE__ */ new Date()).toLocaleString(), ...info);
  63. }
  64. static info(...info) {
  65. const trace = _Logger.traceCall();
  66. info = [...info, trace];
  67. if (_Logger.debug)
  68. console.info(_Logger.appName, (/* @__PURE__ */ new Date()).toLocaleString(), ...info);
  69. }
  70. static error(...info) {
  71. console.error(_Logger.appName, (/* @__PURE__ */ new Date()).toLocaleString(), ...info);
  72. }
  73. static warn(...info) {
  74. const trace = _Logger.traceCall();
  75. info = [...info, trace];
  76. if (_Logger.debug)
  77. console.warn(_Logger.appName, (/* @__PURE__ */ new Date()).toLocaleString(), ...info);
  78. }
  79. };
  80. let Logger = _Logger;
  81. __publicField(Logger, "appName");
  82. __publicField(Logger, "debug");
  83. class Response {
  84. constructor(text, header) {
  85. __publicField(this, "str");
  86. __publicField(this, "header");
  87. this.str = text;
  88. this.header = header;
  89. }
  90. json() {
  91. let arr;
  92. try {
  93. if (this.str) {
  94. arr = JSON.parse(this.str);
  95. } else {
  96. throw new Error("数据为空");
  97. }
  98. } catch (error) {
  99. throw new Error("数据格式错误,解析成json失败:" + JSON.stringify(error));
  100. }
  101. return arr;
  102. }
  103. text() {
  104. return this.str;
  105. }
  106. toString() {
  107. return "" + this.str;
  108. }
  109. }
  110. class Http {
  111. static fetch(url, option = {}) {
  112. return new Promise((resolve, reject) => {
  113. const { method = "GET", headers = {}, body = "", timeout = 1e4 } = option;
  114. const requestOptions = {
  115. method,
  116. headers,
  117. data: "",
  118. url,
  119. timeout,
  120. onload: (response) => {
  121. if (response.status >= 200 && response.status < 400) {
  122. resolve(new Response(response.responseText, response.responseHeaders));
  123. } else {
  124. Logger.error(response);
  125. reject(new Error("Http status error:" + response.status));
  126. }
  127. },
  128. onerror: (err) => {
  129. Logger.error(err);
  130. reject(new Error("Http response on error"));
  131. },
  132. ontimeout: () => {
  133. Logger.error("Http response on timeout");
  134. reject(new Error("Http response on timeout"));
  135. }
  136. };
  137. if (method.toUpperCase() === "POST" || method.toUpperCase() === "PUT") {
  138. requestOptions.data = body;
  139. }
  140. _GM_xmlhttpRequest(requestOptions);
  141. });
  142. }
  143. }
  144. const _Img = class {
  145. static load(image_link, func = (is_load, rate) => {
  146. }) {
  147. return new Promise((resolve, reject) => {
  148. const image_link_key = encodeURIComponent(image_link);
  149. const cache_image = _Img.imgObjList[image_link_key];
  150. if (cache_image) {
  151. return resolve(cache_image);
  152. }
  153. let is_timeout = false;
  154. let img = new Image();
  155. img.src = image_link;
  156. let timer = setTimeout(() => {
  157. is_timeout = true;
  158. resolve({ status: "timeout", rate: Discuz.ImgLoadRate });
  159. Logger.error("load image " + image_link + " failed on timeout 5s");
  160. }, 5e3);
  161. img.onload = async () => {
  162. if (is_timeout)
  163. func.call(this, true, img.width / img.height);
  164. const imgobj = {
  165. status: 200,
  166. rate: img.width / img.height,
  167. width: img.width,
  168. height: img.height
  169. };
  170. _Img.imgObjList[image_link_key] = imgobj;
  171. clearTimeout(timer);
  172. resolve(imgobj);
  173. };
  174. img.onerror = () => {
  175. if (is_timeout)
  176. func.call(this, false, Discuz.Img404Rate);
  177. clearTimeout(timer);
  178. resolve({ status: 404, rate: Discuz.Img404Rate });
  179. Logger.error("load image " + image_link + " failed onerror");
  180. };
  181. });
  182. }
  183. };
  184. let Img = _Img;
  185. __publicField(Img, "imgObjList", {});
  186. const _Discuz = class {
  187. static getCateList() {
  188. let list = [
  189. {
  190. name: "国产资源",
  191. id: 38
  192. },
  193. {
  194. name: "直播资源",
  195. id: 39
  196. },
  197. {
  198. name: "亚洲无码",
  199. id: 40
  200. },
  201. {
  202. name: "亚洲有码",
  203. id: 41
  204. }
  205. ];
  206. return list;
  207. }
  208. static async getListByCate(page = 1, fid = 39) {
  209. const mobileOpt = {
  210. headers: {
  211. "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/113.0.0.0"
  212. },
  213. timeout: 3e4
  214. };
  215. let htmlString = await Http.fetch(`${_Discuz.BaseUrl}forum.php?mod=forumdisplay&fid=${fid}&mobile=2&page=${page}`, mobileOpt);
  216. let html = htmlString.text().replace(/<img([^>]*)>/g, (m, match) => {
  217. return `<v-img${match}>`;
  218. });
  219. const objs = jQuery(html).find(".byg_threadlist_pic .byg_pic_img a").map(function() {
  220. let img_link = jQuery(this).find("v-img").attr("src") || "";
  221. img_link = img_link.includes("http") ? img_link : _Discuz.BaseUrl + img_link;
  222. let href = _Discuz.BaseUrl + (jQuery(this).attr("href") || "");
  223. href = href.replace("&mobile=2", "");
  224. return {
  225. title: jQuery(this).attr("title") || "",
  226. href,
  227. image_link: img_link,
  228. pre_image_link: "",
  229. img_rate: _Discuz.ImgLoadRate
  230. };
  231. }).get();
  232. return objs;
  233. }
  234. static async init() {
  235. _Discuz.initFormHash().then();
  236. const img404 = await Img.load(_Discuz.Img404Link);
  237. _Discuz.Img404Rate = img404.rate ?? _Discuz.DefaultRate;
  238. const imgLoad = await Img.load(_Discuz.ImgLoadingLink);
  239. _Discuz.ImgLoadRate = imgLoad.rate ?? _Discuz.DefaultRate;
  240. }
  241. static async initFormHash() {
  242. if (_Discuz.searchFormHash)
  243. return;
  244. const _url = _Discuz.BaseUrl + "search.php?mod=forum&mobile=2";
  245. const res = await Http.fetch(_url);
  246. let hash = jQuery(res.text()).find('input[name="formhash"]').val();
  247. Logger.log("searchFormHash:" + hash);
  248. _Discuz.searchFormHash = hash;
  249. }
  250. static async search(key, page = 1) {
  251. await _Discuz.initFormHash();
  252. const first_url = _Discuz.BaseUrl + "search.php?mod=forum&mobile=2";
  253. const _dkey = decodeURIComponent(key);
  254. const _key = encodeURIComponent(key);
  255. const search_id = _Discuz.searchIdObj[_key] ? _Discuz.searchIdObj[_key] : 0;
  256. const keyid_url = `https://cunhua.click/search.php?mod=forum&searchid=${search_id}&orderby=lastpost&ascdesc=desc&searchsubmit=yes&page=${page}&mobile=2`;
  257. let _url = search_id ? keyid_url : first_url;
  258. let htmlString = await Http.fetch(_url, {
  259. method: "POST",
  260. headers: {
  261. "content-type": "application/x-www-form-urlencoded",
  262. "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/113.0.0.0"
  263. },
  264. timeout: 1e4,
  265. body: `formhash=${_Discuz.searchFormHash}&srchtxt=${_dkey}&searchsubmit=yes`
  266. });
  267. let html = htmlString.text().replace(/<img([^>]*)>/g, (m, match) => {
  268. return `<v-img${match}>`;
  269. });
  270. let hash = jQuery(html).find('input[name="formhash"]').val();
  271. _Discuz.searchFormHash = hash;
  272. let res = /searchid=(\d+)/.exec(html) ?? [];
  273. if (res && res[1]) {
  274. _Discuz.searchIdObj[_key] = +res[1];
  275. } else {
  276. Logger.error("can not fetch searchid");
  277. throw new Error("can not fetch searchid");
  278. }
  279. Logger.log({ _dkey, "searchId": res[1] });
  280. let promise_list = jQuery(html).find("h2.thread_tit + ul").find("li a").map(async function() {
  281. let url = _Discuz.BaseUrl + (jQuery(this).attr("href") || "");
  282. let image_link = _Discuz.Img404Link;
  283. url = store.is_mobile ? url : url.replace("&mobile=2", "");
  284. return {
  285. title: jQuery(this).text(),
  286. href: url,
  287. image_link,
  288. pre_image_link: "",
  289. img_rate: _Discuz.ImgLoadRate
  290. };
  291. }).get();
  292. let list = await Promise.all(promise_list);
  293. Logger.log("search list", { list });
  294. return list;
  295. }
  296. static async getImage(url) {
  297. const mobileOpt = {
  298. headers: { "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/113.0.0.0" },
  299. timeout: 15e3
  300. };
  301. const pcOpt = { timeout: 15e3 };
  302. const opt = store.is_mobile ? mobileOpt : pcOpt;
  303. let resp;
  304. try {
  305. resp = await Http.fetch(url, opt);
  306. } catch (error) {
  307. Logger.error("getImage", error);
  308. return _Discuz.Img404Link;
  309. }
  310. let html = resp.text().replace(/<img([^>]*)>/g, (m, match) => {
  311. return `<v-img${match}>`;
  312. });
  313. let img_list = jQuery(html).find('[id^="aimg_"]').map(function() {
  314. let src = jQuery(this).attr("src") || "";
  315. let zoomfile = jQuery(this).attr("zoomfile") || "";
  316. return zoomfile ? zoomfile : src;
  317. }).get();
  318. if (img_list && img_list.length > 0) {
  319. const image_link = img_list[Math.floor(Math.random() * img_list.length)];
  320. return /^https?/.test(image_link) ? image_link : _Discuz.BaseUrl + image_link;
  321. } else {
  322. return _Discuz.Img404Link;
  323. }
  324. }
  325. static async fetchRealUrl(url) {
  326. const mobileOpt = { timeout: 1e4, headers: { "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/113.0.0.0" } };
  327. const resp = await Http.fetch(url, store.is_mobile ? mobileOpt : { timeout: 1e4 });
  328. const html = resp.text();
  329. if (/<head>/.test(html))
  330. return url;
  331. let [, jsStr] = /<script.*?>([\s\S]*?)<\/script>/gm.exec(html) ?? [];
  332. const temp = `
  333. MuURL='';
  334. MuObj={
  335. href:'',replace:function(abc){MuURL=abc},
  336. assign:function(abc){MuURL=abc},
  337. };`;
  338. jsStr = temp + jsStr.replaceAll("location", "MuObj");
  339. let func = new Function(jsStr);
  340. func.call(this);
  341. MuURL = MuURL ? MuURL : MuObj.href || MuObj;
  342. let [, _dsign] = /_dsign=(.*)/gm.exec(MuURL) ?? [];
  343. const sign = url.includes("?") ? "&" : "?";
  344. const _url = `${url}${sign}_dsign=${_dsign}`;
  345. return _url;
  346. }
  347. };
  348. let Discuz = _Discuz;
  349. __publicField(Discuz, "Img404Link", "https://jsonp.gitee.io/video/img/404.png");
  350. __publicField(Discuz, "Img404Rate");
  351. __publicField(Discuz, "ImgLoadingLink", "https://jsonp.gitee.io/video/img/load.gif");
  352. __publicField(Discuz, "ImgLoadRate");
  353. __publicField(Discuz, "Host", config.host);
  354. __publicField(Discuz, "DefaultRate", 0.72);
  355. __publicField(Discuz, "BaseUrl", `https://${config.host}/`);
  356. __publicField(Discuz, "searchIdObj", {});
  357. __publicField(Discuz, "searchFormHash", "");
  358. __publicField(Discuz, "defaultCid", 38);
  359. const store = vue.reactive({
  360. cate_list: [],
  361. cate_index: 0,
  362. cid: Discuz.defaultCid,
  363. is_mobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
  364. route: "cate",
  365. key: "",
  366. initCate: () => {
  367. let [, cid] = /^#id=(\d+)$/.exec(location.hash) ?? [];
  368. if (cid) {
  369. store.cid = +cid;
  370. store.route = "cate";
  371. }
  372. let [, key] = /^#key=(.*?)_=\d+$/.exec(location.hash) ?? [];
  373. if (key) {
  374. store.key = key;
  375. store.route = "search";
  376. } else {
  377. store.key = "";
  378. }
  379. let list = Discuz.getCateList();
  380. store.cate_list = list.map((vo) => {
  381. return { ...vo, ...{ active: store.cid == vo.id && store.route == "cate" } };
  382. });
  383. store.cate_index = store.cate_list.findIndex((vo) => vo.active);
  384. }
  385. });
  386. const _withScopeId$1 = (n) => (vue.pushScopeId("data-v-e340e55d"), n = n(), vue.popScopeId(), n);
  387. const _hoisted_1$a = { class: "left-bar" };
  388. const _hoisted_2$8 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "logo" }, [
  389. /* @__PURE__ */ vue.createElementVNode("img", {
  390. alt: "Vue logo",
  391. class: "logo",
  392. src: "https://www.cunhua.click/template/bygsjw/image/logo.png"
  393. })
  394. ], -1));
  395. const _hoisted_3$6 = { class: "cate" };
  396. const _hoisted_4$3 = ["href"];
  397. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  398. __name: "LeftBar",
  399. setup(__props) {
  400. return (_ctx, _cache) => {
  401. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
  402. _hoisted_2$8,
  403. vue.createElementVNode("div", {
  404. class: "bar",
  405. style: vue.normalizeStyle({ transform: "translateY(" + (vue.unref(store).cate_index >= 0 ? 55 * vue.unref(store).cate_index : -1e3) + "px)" })
  406. }, null, 4),
  407. vue.createElementVNode("div", _hoisted_3$6, [
  408. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(store).cate_list, (vo, index) => {
  409. return vue.openBlock(), vue.createElementBlock("a", {
  410. href: "#id=" + vo.id,
  411. class: vue.normalizeClass(["item", { active: vo.active }]),
  412. key: index
  413. }, vue.toDisplayString(vo.name), 11, _hoisted_4$3);
  414. }), 128))
  415. ])
  416. ]);
  417. };
  418. }
  419. });
  420. const _export_sfc = (sfc, props) => {
  421. const target = sfc.__vccOpts || sfc;
  422. for (const [key, val] of props) {
  423. target[key] = val;
  424. }
  425. return target;
  426. };
  427. const LeftBar = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-e340e55d"]]);
  428. const _sfc_main$9 = {};
  429. const _hoisted_1$9 = {
  430. xmlns: "http://www.w3.org/2000/svg",
  431. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  432. "aria-hidden": "true",
  433. role: "img",
  434. class: "iconify iconify--mdi",
  435. width: "24",
  436. height: "24",
  437. preserveAspectRatio: "xMidYMid meet",
  438. viewBox: "0 0 24 24"
  439. };
  440. const _hoisted_2$7 = /* @__PURE__ */ vue.createElementVNode("path", {
  441. d: "M20 18v-4h-3v1h-2v-1H9v1H7v-1H4v4h16M6.33 8l-1.74 4H7v-1h2v1h6v-1h2v1h2.41l-1.74-4H6.33M9 5v1h6V5H9m12.84 7.61c.1.22.16.48.16.8V18c0 .53-.21 1-.6 1.41c-.4.4-.85.59-1.4.59H4c-.55 0-1-.19-1.4-.59C2.21 19 2 18.53 2 18v-4.59c0-.32.06-.58.16-.8L4.5 7.22C4.84 6.41 5.45 6 6.33 6H7V5c0-.55.18-1 .57-1.41C7.96 3.2 8.44 3 9 3h6c.56 0 1.04.2 1.43.59c.39.41.57.86.57 1.41v1h.67c.88 0 1.49.41 1.83 1.22l2.34 5.39z",
  442. fill: "currentColor"
  443. }, null, -1);
  444. const _hoisted_3$5 = [
  445. _hoisted_2$7
  446. ];
  447. function _sfc_render$4(_ctx, _cache) {
  448. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$9, _hoisted_3$5);
  449. }
  450. const ToolingIcon = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4]]);
  451. const _sfc_main$8 = {};
  452. const _hoisted_1$8 = {
  453. xmlns: "http://www.w3.org/2000/svg",
  454. width: "18",
  455. height: "20",
  456. fill: "currentColor"
  457. };
  458. const _hoisted_2$6 = /* @__PURE__ */ vue.createElementVNode("path", { d: "M11.447 8.894a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm0 1.789a1 1 0 1 0 .894-1.789l-.894 1.789zM7.447 7.106a1 1 0 1 0-.894 1.789l.894-1.789zM10 9a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0H8zm9.447-5.606a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm2 .789a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zM18 5a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0h-2zm-5.447-4.606a1 1 0 1 0 .894-1.789l-.894 1.789zM9 1l.447-.894a1 1 0 0 0-.894 0L9 1zm-2.447.106a1 1 0 1 0 .894 1.789l-.894-1.789zm-6 3a1 1 0 1 0 .894 1.789L.553 4.106zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zm-2-.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 2.789a1 1 0 1 0 .894-1.789l-.894 1.789zM2 5a1 1 0 1 0-2 0h2zM0 7.5a1 1 0 1 0 2 0H0zm8.553 12.394a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 1a1 1 0 1 0 .894 1.789l-.894-1.789zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zM8 19a1 1 0 1 0 2 0H8zm2-2.5a1 1 0 1 0-2 0h2zm-7.447.394a1 1 0 1 0 .894-1.789l-.894 1.789zM1 15H0a1 1 0 0 0 .553.894L1 15zm1-2.5a1 1 0 1 0-2 0h2zm12.553 2.606a1 1 0 1 0 .894 1.789l-.894-1.789zM17 15l.447.894A1 1 0 0 0 18 15h-1zm1-2.5a1 1 0 1 0-2 0h2zm-7.447-5.394l-2 1 .894 1.789 2-1-.894-1.789zm-1.106 1l-2-1-.894 1.789 2 1 .894-1.789zM8 9v2.5h2V9H8zm8.553-4.894l-2 1 .894 1.789 2-1-.894-1.789zm.894 0l-2-1-.894 1.789 2 1 .894-1.789zM16 5v2.5h2V5h-2zm-4.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zm-2.894-1l-2 1 .894 1.789 2-1L8.553.106zM1.447 5.894l2-1-.894-1.789-2 1 .894 1.789zm-.894 0l2 1 .894-1.789-2-1-.894 1.789zM0 5v2.5h2V5H0zm9.447 13.106l-2-1-.894 1.789 2 1 .894-1.789zm0 1.789l2-1-.894-1.789-2 1 .894 1.789zM10 19v-2.5H8V19h2zm-6.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zM2 15v-2.5H0V15h2zm13.447 1.894l2-1-.894-1.789-2 1 .894 1.789zM18 15v-2.5h-2V15h2z" }, null, -1);
  459. const _hoisted_3$4 = [
  460. _hoisted_2$6
  461. ];
  462. function _sfc_render$3(_ctx, _cache) {
  463. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$8, _hoisted_3$4);
  464. }
  465. const EcosystemIcon = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$3]]);
  466. const _sfc_main$7 = {};
  467. const _hoisted_1$7 = {
  468. xmlns: "http://www.w3.org/2000/svg",
  469. width: "20",
  470. height: "20",
  471. fill: "currentColor"
  472. };
  473. const _hoisted_2$5 = /* @__PURE__ */ vue.createElementVNode("path", { d: "M15 4a1 1 0 1 0 0 2V4zm0 11v-1a1 1 0 0 0-1 1h1zm0 4l-.707.707A1 1 0 0 0 16 19h-1zm-4-4l.707-.707A1 1 0 0 0 11 14v1zm-4.707-1.293a1 1 0 0 0-1.414 1.414l1.414-1.414zm-.707.707l-.707-.707.707.707zM9 11v-1a1 1 0 0 0-.707.293L9 11zm-4 0h1a1 1 0 0 0-1-1v1zm0 4H4a1 1 0 0 0 1.707.707L5 15zm10-9h2V4h-2v2zm2 0a1 1 0 0 1 1 1h2a3 3 0 0 0-3-3v2zm1 1v6h2V7h-2zm0 6a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2zm-1 1h-2v2h2v-2zm-3 1v4h2v-4h-2zm1.707 3.293l-4-4-1.414 1.414 4 4 1.414-1.414zM11 14H7v2h4v-2zm-4 0c-.276 0-.525-.111-.707-.293l-1.414 1.414C5.42 15.663 6.172 16 7 16v-2zm-.707 1.121l3.414-3.414-1.414-1.414-3.414 3.414 1.414 1.414zM9 12h4v-2H9v2zm4 0a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2zm3-3V3h-2v6h2zm0-6a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2zm-3-3H3v2h10V0zM3 0a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1V0zM0 3v6h2V3H0zm0 6a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1H0zm3 3h2v-2H3v2zm1-1v4h2v-4H4zm1.707 4.707l.586-.586-1.414-1.414-.586.586 1.414 1.414z" }, null, -1);
  474. const _hoisted_3$3 = [
  475. _hoisted_2$5
  476. ];
  477. function _sfc_render$2(_ctx, _cache) {
  478. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, _hoisted_3$3);
  479. }
  480. const CommunityIcon = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$2]]);
  481. const _sfc_main$6 = {};
  482. const _hoisted_1$6 = {
  483. xmlns: "http://www.w3.org/2000/svg",
  484. width: "20",
  485. height: "20",
  486. fill: "currentColor"
  487. };
  488. const _hoisted_2$4 = /* @__PURE__ */ vue.createElementVNode("path", { d: "M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.666.105 5.5 5.5 0 0 0-.114 7.665L10 18.78l8.39-8.4a5.5 5.5 0 0 0-.114-7.665 5.5 5.5 0 0 0-7.666-.105l-.61.61z" }, null, -1);
  489. const _hoisted_3$2 = [
  490. _hoisted_2$4
  491. ];
  492. function _sfc_render$1(_ctx, _cache) {
  493. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _hoisted_3$2);
  494. }
  495. const SupportIcon = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$1]]);
  496. const _withScopeId = (n) => (vue.pushScopeId("data-v-0a5dfa4f"), n = n(), vue.popScopeId(), n);
  497. const _hoisted_1$5 = { class: "top-bar" };
  498. const _hoisted_2$3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "logo" }, [
  499. /* @__PURE__ */ vue.createElementVNode("img", {
  500. alt: "Vue logo",
  501. class: "logo",
  502. src: "https://www.cunhua.click/template/bygsjw/image/logo.png"
  503. })
  504. ], -1));
  505. const _hoisted_3$1 = { class: "search-bar" };
  506. const _hoisted_4$2 = { class: "bar" };
  507. const _hoisted_5 = { class: "input" };
  508. const _hoisted_6 = { class: "tool" };
  509. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  510. __name: "TopBar",
  511. setup(__props) {
  512. let key = vue.ref("");
  513. function doSearch() {
  514. const t = +/* @__PURE__ */ new Date();
  515. location.hash = `key=${key.value}_=${t}`;
  516. }
  517. vue.onMounted(() => {
  518. key.value = decodeURIComponent(store.key);
  519. });
  520. vue.watch(store, () => {
  521. key.value = decodeURIComponent(store.key);
  522. });
  523. return (_ctx, _cache) => {
  524. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
  525. _hoisted_2$3,
  526. vue.createElementVNode("div", _hoisted_3$1, [
  527. vue.createElementVNode("div", _hoisted_4$2, [
  528. vue.createElementVNode("div", _hoisted_5, [
  529. vue.withDirectives(vue.createElementVNode("input", {
  530. type: "search",
  531. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(key) ? key.value = $event : key = $event),
  532. onKeyup: _cache[1] || (_cache[1] = vue.withKeys(($event) => doSearch(), ["enter"])),
  533. placeholder: "请输入关键词搜索。。。"
  534. }, null, 544), [
  535. [vue.vModelText, vue.unref(key)]
  536. ])
  537. ]),
  538. vue.createElementVNode("button", {
  539. onClick: _cache[2] || (_cache[2] = ($event) => doSearch())
  540. }, [
  541. vue.createVNode(SupportIcon, { class: "icon" }),
  542. vue.createTextVNode(" 搜索帖子 ")
  543. ])
  544. ])
  545. ]),
  546. vue.createElementVNode("div", _hoisted_6, [
  547. vue.createVNode(ToolingIcon, { class: "icon" }),
  548. vue.createVNode(SupportIcon, { class: "icon" }),
  549. vue.createVNode(CommunityIcon, { class: "icon" }),
  550. vue.createVNode(EcosystemIcon, { class: "icon" })
  551. ])
  552. ]);
  553. };
  554. }
  555. });
  556. const TopBar = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-0a5dfa4f"]]);
  557. const _hoisted_1$4 = { class: "cate-bar" };
  558. const _hoisted_2$2 = ["href"];
  559. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  560. __name: "CateBar",
  561. setup(__props) {
  562. return (_ctx, _cache) => {
  563. return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
  564. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(store).cate_list, (vo, index) => {
  565. return vue.openBlock(), vue.createElementBlock("a", {
  566. href: "#id=" + vo.id,
  567. class: vue.normalizeClass(["cate", { active: vo.active }]),
  568. key: index
  569. }, [
  570. vue.createElementVNode("span", null, vue.toDisplayString(vo.name), 1)
  571. ], 10, _hoisted_2$2);
  572. }), 128))
  573. ]);
  574. };
  575. }
  576. });
  577. const CateBar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-5b69aa69"]]);
  578. const _hoisted_1$3 = ["href", "target"];
  579. const _hoisted_2$1 = { class: "img" };
  580. const _hoisted_3 = ["id", "src"];
  581. const _hoisted_4$1 = ["id"];
  582. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  583. __name: "Item",
  584. props: {
  585. width: {},
  586. title: {},
  587. image_link: {},
  588. pre_image_link: {},
  589. img_rate: {},
  590. href: {},
  591. loaded: { type: Boolean },
  592. index: {}
  593. },
  594. setup(__props) {
  595. return (_ctx, _cache) => {
  596. return vue.openBlock(), vue.createElementBlock("a", {
  597. class: "vo-item",
  598. href: _ctx.href,
  599. target: vue.unref(store).is_mobile ? "_self" : "_blank"
  600. }, [
  601. vue.createElementVNode("div", _hoisted_2$1, [
  602. vue.createElementVNode("img", {
  603. id: "vo-item-img-" + _ctx.index,
  604. src: _ctx.pre_image_link,
  605. alt: "",
  606. style: vue.normalizeStyle({ height: (_ctx.width || 150) / _ctx.img_rate + "px" })
  607. }, null, 12, _hoisted_3)
  608. ]),
  609. vue.createElementVNode("div", {
  610. class: "text",
  611. id: "vo-item-p-" + _ctx.index
  612. }, [
  613. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  614. ], 8, _hoisted_4$1)
  615. ], 8, _hoisted_1$3);
  616. };
  617. }
  618. });
  619. const _sfc_main$2 = {};
  620. const _hoisted_1$2 = {
  621. xmlns: "http://www.w3.org/2000/svg",
  622. width: "36",
  623. height: "36",
  624. viewBox: "0 0 24 24",
  625. class: "element"
  626. };
  627. const _hoisted_2 = /* @__PURE__ */ vue.createStaticVNode('<defs><linearGradient id="mingcuteLoadingFill0" x1="50%" x2="50%" y1="5.271%" y2="91.793%"><stop offset="0%" stop-color="currentColor"></stop><stop offset="100%" stop-color="currentColor" stop-opacity=".55"></stop></linearGradient><linearGradient id="mingcuteLoadingFill1" x1="50%" x2="50%" y1="15.24%" y2="87.15%"><stop offset="0%" stop-color="currentColor" stop-opacity="0"></stop><stop offset="100%" stop-color="currentColor" stop-opacity=".55"></stop></linearGradient></defs><g fill="none"><path d="M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"></path><path fill="url(#mingcuteLoadingFill0)" d="M8.749.021a1.5 1.5 0 0 1 .497 2.958A7.502 7.502 0 0 0 3 10.375a7.5 7.5 0 0 0 7.5 7.5v3c-5.799 0-10.5-4.7-10.5-10.5C0 5.23 3.726.865 8.749.021Z" transform="translate(1.5 1.625)"></path><path fill="url(#mingcuteLoadingFill1)" d="M15.392 2.673a1.5 1.5 0 0 1 2.119-.115A10.475 10.475 0 0 1 21 10.375c0 5.8-4.701 10.5-10.5 10.5v-3a7.5 7.5 0 0 0 5.007-13.084a1.5 1.5 0 0 1-.115-2.118Z" transform="translate(1.5 1.625)"></path></g>', 2);
  628. const _hoisted_4 = [
  629. _hoisted_2
  630. ];
  631. function _sfc_render(_ctx, _cache) {
  632. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _hoisted_4);
  633. }
  634. const IconLoading = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
  635. const _hoisted_1$1 = {
  636. class: "list-bar",
  637. id: "list-bar"
  638. };
  639. const loading_img_link = "https://jsonp.gitee.io/video/img/load.gif";
  640. const offset = 10;
  641. const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
  642. __name: "ListBar",
  643. setup(__props) {
  644. let item_list = vue.ref([]);
  645. let is_loading_data = vue.ref(false);
  646. let is_loading_img = vue.ref(false);
  647. let page_num = vue.ref(1);
  648. const item_width = window.innerWidth < 550 ? Math.floor((window.innerWidth - 20) / 2) : 250;
  649. let h_arr = [];
  650. async function load_article_img(vo, index) {
  651. if (store.route == "cate") {
  652. const img = await Img.load(vo.image_link, (is_load, rate) => {
  653. Logger.log("callback", { is_load }, vo.image_link);
  654. const dom = document.getElementById(`vo-item-img-${index}`);
  655. vo.pre_image_link = is_load ? vo.image_link : Discuz.Img404Link;
  656. dom.setAttribute("src", vo.pre_image_link);
  657. dom.style.height = item_width / rate + "px";
  658. item_list.value[index] = vo;
  659. });
  660. vo.loaded = img.status == 200;
  661. vo.img_rate = img.rate;
  662. if (img.status == 200) {
  663. vo.pre_image_link = vo.image_link;
  664. } else if (img.status == 404) {
  665. vo.pre_image_link = Discuz.Img404Link;
  666. }
  667. } else if (store.route == "search") {
  668. load_search_img(vo).then(async (v) => {
  669. const dom = document.getElementById(`vo-item-img-${index}`);
  670. dom.setAttribute("src", v.image_link);
  671. dom.style.height = item_width / v.img.rate + "px";
  672. }).catch((err) => {
  673. Logger.error("end", "搜索页加载图片失败" + index, JSON.stringify(err));
  674. });
  675. }
  676. return vo;
  677. }
  678. async function load_search_img(vo, index) {
  679. let href = await Discuz.fetchRealUrl(vo.href);
  680. let image_link = await Discuz.getImage(href);
  681. const img = await Img.load(image_link);
  682. return { href, image_link, img };
  683. }
  684. async function load_more(page) {
  685. if (is_loading_data.value || is_loading_img.value) {
  686. return false;
  687. } else {
  688. page_num.value = page;
  689. is_loading_data.value = true;
  690. is_loading_img.value = true;
  691. }
  692. Logger.log("load page start", { route: store.route });
  693. let list = [];
  694. try {
  695. list = await get_data(page);
  696. } catch (error) {
  697. let msg = "加载失败,请检查网络状况:";
  698. if (error instanceof Error) {
  699. msg += error.message;
  700. } else if (typeof error === "string") {
  701. msg += error;
  702. } else {
  703. msg += JSON.stringify(error);
  704. }
  705. alert(msg);
  706. }
  707. Logger.log({ route: store.route, list });
  708. let arr = list.map((vo) => {
  709. return {
  710. image_link: vo.image_link,
  711. img_rate: Discuz.ImgLoadRate,
  712. pre_image_link: loading_img_link,
  713. title: vo.title,
  714. href: vo.href,
  715. position: "absolute",
  716. left: -item_width * 2,
  717. top: -item_width * 2,
  718. width: item_width
  719. };
  720. });
  721. let index = item_list.value.length;
  722. let start_item_list = item_list.value;
  723. item_list.value = [...start_item_list, ...arr];
  724. is_loading_data.value = false;
  725. await vue.nextTick();
  726. await update_list(index, true);
  727. let load_num = 0;
  728. for (let i = 0; i < arr.length; i++) {
  729. load_article_img(arr[i], i + index).then((vo) => {
  730. item_list.value[i + index] = vo;
  731. load_num++;
  732. });
  733. }
  734. while (load_num < arr.length) {
  735. await new Promise((resolve) => setTimeout(resolve, 100));
  736. }
  737. await vue.nextTick();
  738. await update_list(index);
  739. is_loading_img.value = false;
  740. Logger.log("load page finished", store.route, { page, load_num });
  741. }
  742. function init_water() {
  743. const container = document.getElementById("list-bar");
  744. container.style.position = "relative";
  745. const win_width = container.getBoundingClientRect().width;
  746. const row_count = Math.floor((win_width + offset) / (item_width + offset));
  747. const inner_w = (row_count - 1) * offset + row_count * item_width;
  748. container.style.width = inner_w + "px";
  749. container.style.margin = "0 auto";
  750. h_arr = Array.from({ length: row_count }, () => 0);
  751. }
  752. async function update_list(index = 0, is_try = false) {
  753. let last_h_arr = [...h_arr];
  754. let i = index;
  755. let lenght = item_list.value.length;
  756. while (i < lenght) {
  757. let vo = item_list.value[i];
  758. const h_i = h_arr.indexOf(Math.min(...h_arr));
  759. vo.top = h_arr[h_i];
  760. vo.left = h_i * (offset + item_width);
  761. const dom = document.getElementById(`vo-item-p-${i}`);
  762. const _height = item_width / vo.img_rate + dom.getBoundingClientRect().height + offset;
  763. h_arr[h_i] += _height;
  764. i++;
  765. }
  766. if (is_try)
  767. h_arr = last_h_arr;
  768. }
  769. async function get_data(page) {
  770. if (store.route == "search") {
  771. Logger.log("serach page", { page, key: store.key });
  772. let res = await Discuz.search(store.key, page);
  773. return res;
  774. } else {
  775. Logger.log("cate page", { page, cid: store.cid });
  776. let res = await Discuz.getListByCate(page, store.cid);
  777. return res;
  778. }
  779. }
  780. vue.onMounted(async () => {
  781. init_water();
  782. await load_more(page_num.value);
  783. });
  784. let win = location.port ? window : _unsafeWindow;
  785. win.addEventListener("hashchange", async () => {
  786. init_water();
  787. page_num.value = 1;
  788. item_list.value = [];
  789. await load_more(page_num.value);
  790. });
  791. win.onscroll = async () => {
  792. let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  793. let windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
  794. let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
  795. if (scrollTop + windowHeight + 25 >= scrollHeight) {
  796. await load_more(page_num.value + 1);
  797. }
  798. };
  799. return (_ctx, _cache) => {
  800. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  801. vue.createElementVNode("div", _hoisted_1$1, [
  802. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(item_list), (item, index) => {
  803. return vue.openBlock(), vue.createBlock(_sfc_main$3, {
  804. width: item.width,
  805. index,
  806. img_rate: item.img_rate,
  807. title: item.title,
  808. image_link: item.image_link,
  809. pre_image_link: item.pre_image_link,
  810. href: item.href,
  811. class: "li",
  812. key: index,
  813. id: "vo-item-" + index,
  814. style: vue.normalizeStyle({
  815. width: item.width + "px",
  816. height: item.height + "px",
  817. left: item.left + "px",
  818. top: item.top + "px",
  819. position: item.position
  820. })
  821. }, {
  822. default: vue.withCtx(() => [
  823. vue.createTextVNode(vue.toDisplayString(item.title), 1)
  824. ]),
  825. _: 2
  826. }, 1032, ["width", "index", "img_rate", "title", "image_link", "pre_image_link", "href", "id", "style"]);
  827. }), 128))
  828. ]),
  829. vue.unref(is_loading_data) ? (vue.openBlock(), vue.createBlock(IconLoading, { key: 0 })) : vue.createCommentVNode("", true)
  830. ], 64);
  831. };
  832. }
  833. });
  834. const _hoisted_1 = { class: "right" };
  835. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  836. __name: "App",
  837. setup(__props) {
  838. let port = vue.ref(location.port ? true : false);
  839. let win = port.value ? window : _unsafeWindow;
  840. win.addEventListener("hashchange", async () => {
  841. store.initCate();
  842. });
  843. vue.onBeforeMount(() => {
  844. store.initCate();
  845. });
  846. vue.onMounted(async () => {
  847. await Discuz.init();
  848. });
  849. return (_ctx, _cache) => {
  850. return vue.openBlock(), vue.createElementBlock("div", {
  851. class: "container",
  852. style: vue.normalizeStyle({ opacity: vue.unref(port) ? 0.2 : 1 })
  853. }, [
  854. vue.createVNode(LeftBar, { class: "left" }),
  855. vue.createElementVNode("div", _hoisted_1, [
  856. vue.createVNode(TopBar),
  857. vue.createVNode(CateBar, { class: "cate-bar" }),
  858. vue.createVNode(_sfc_main$1)
  859. ])
  860. ], 4);
  861. };
  862. }
  863. });
  864. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-856190d9"]]);
  865. function initHead() {
  866. var _a;
  867. let metaElements = document.getElementsByTagName("meta");
  868. for (let i = metaElements.length - 1; i >= 0; i--) {
  869. let metaElement = metaElements[i];
  870. (_a = metaElement.parentNode) == null ? void 0 : _a.removeChild(metaElement);
  871. }
  872. let charsetMeta = document.createElement("meta");
  873. charsetMeta.setAttribute("charset", "UTF-8");
  874. document.head.appendChild(charsetMeta);
  875. let viewportMeta = document.createElement("meta");
  876. viewportMeta.setAttribute("name", "viewport");
  877. viewportMeta.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no");
  878. document.head.appendChild(viewportMeta);
  879. document.title = config.app_name;
  880. document.body.innerHTML = "";
  881. }
  882. Logger.config({ debug: config.debug });
  883. initHead();
  884. vue.createApp(App).mount(
  885. (() => {
  886. const app = document.createElement("div");
  887. app.id = "app";
  888. document.body.append(app);
  889. return app;
  890. })()
  891. );
  892.  
  893. })(Vue, jQuery);