PageSourceSearch

https://mxdm999.com/usr/themes/Joe-master/assets/js/joe.global.js?version=1.3294

js mxdm999.com collected 2026-10-06 13:14:58 UTC 51,625 bytes, 1,223 lines download raw bytes

1document.addEventListener("DOMContentLoaded", () => {
2
3	/* 检测IE */
4	{
5		function detectIE() {
6			var n = window.navigator.userAgent,
7				e = n.indexOf("MSIE ");
8			if (e > 0) {
9				return parseInt(n.substring(e + 5, n.indexOf(".", e)), 10)
10			}
11			if (n.indexOf("Trident/") > 0) {
12				var r = n.indexOf("rv:");
13				return parseInt(n.substring(r + 3, n.indexOf(".", r)), 10)
14			}
15			var i = n.indexOf("Edge/");
16			return i > 0 && parseInt(n.substring(i + 5, n.indexOf(".", i)), 10)
17		};
18		detectIE() && (alert('当前站点不支持IE浏览器或您开启了兼容模式,请使用其他浏览器访问或关闭兼容模式。'), (location.href = 'https://www.baidu.com'))
19	}
20
21	/* 设置$.getScript()方法缓存 */
22	{
23		jQuery.ajaxSetup({
24			cache: true
25		});
26	}
27
28	/* 展示百度统计信息 */
29	{
30		if ($('#statistics').is(':visible')) {
31			$.ajax({
32				url: Joe.BASE_API,
33				type: 'POST',
34				dataType: 'json',
35				data: {
36					routeType: 'statistics'
37				},
38				success(data) {
39					if (data.access_token == 'off') {
40						$("#statistics").remove();
41						return;
42					}
43					if (data.msg) {
44						$("#statistics").remove();
45						data.code == 200 ? Qmsg.info('百度统计:' + data.msg) : Qmsg.error('百度统计:' + data.msg);
46						return;
47					}
48					let statistics = $('#statistics span strong');
49					$(statistics[0]).text(data['today'][0]);
50					$(statistics[1]).text(data['yesterday'][1]);
51					$(statistics[2]).text(data['month'][0]);
52				},
53				error() {
54					$("#statistics").remove();
55				}
56			});
57		}
58	}
59
60	/* 初始化昼夜模式 */
61	{
62		if (localStorage.getItem("data-night") || $("html").attr("data-night") == 'night') {
63		} else {
64			$("html").removeAttr("data-night");
65		}
66		if (document.querySelector('.joe_action_item.mode')) {
67			if (localStorage.getItem("data-night") || $("html").attr("data-night") == 'night') {
68				$(".joe_action_item.mode .icon-1").addClass("active");
69				$(".joe_action_item.mode .icon-2").removeClass("active");
70				if (!Joe.IS_MOBILE) {
71					$(".joe_action_item.mode").attr('data-original-title', '日间模式');
72					$(".joe_action_item.mode").tooltip({
73						container: "body"
74					});
75				}
76			} else {
77				$(".joe_action_item.mode .icon-1").removeClass("active");
78				$(".joe_action_item.mode .icon-2").addClass("active");
79				if (!Joe.IS_MOBILE) {
80					$(".joe_action_item.mode").attr('data-original-title', '夜间模式');
81					$(".joe_action_item.mode").tooltip({
82						container: "body"
83					});
84				}
85			}
86			$(".joe_action_item.mode").on("click", () => {
87				if (localStorage.getItem("data-night") || $("html").attr("data-night") == 'night') {
88					$(".joe_action_item.mode .icon-1").removeClass("active");
89					$(".joe_action_item.mode .icon-2").addClass("active");
90					$("html").removeAttr("data-night");
91					localStorage.removeItem("data-night");
92					if (!Joe.IS_MOBILE) {
93						$(".joe_action_item.mode").attr('data-original-title', '夜间模式');
94						$(".joe_action_item.mode").tooltip({
95							container: "body"
96						});
97					}
98				} else {
99					$(".joe_action_item.mode .icon-1").addClass("active");
100					$(".joe_action_item.mode .icon-2").removeClass("active");
101					$("html").attr("data-night", "night");
102					localStorage.setItem("data-night", "night");
103					if (!Joe.IS_MOBILE) {
104						$(".joe_action_item.mode").attr('data-original-title', '日间模式');
105						$(".joe_action_item.mode").tooltip({
106							container: "body"
107						});
108					}
109				}
110			});
111		}
112	}
113
114	/* 动态背景 */
115	{
116		if (!Joe.IS_MOBILE && Joe.DYNAMIC_BACKGROUND !== "off" && Joe.DYNAMIC_BACKGROUND && !Joe.WALLPAPER_BACKGROUND_PC) {
117			$.getScript(`${Joe.THEME_URL}assets/plugin/backdrop/${Joe.DYNAMIC_BACKGROUND}`);
118		}
119	}
120
121	/* 搜索框弹窗 */
122	{
123		$(".joe_header__above-search .input").on("click", (e) => {
124			e.stopPropagation();
125			$(".joe_header__above-search .result").addClass("active");
126		});
127		$(document).on("click", function () {
128			$(".joe_header__above-search .result").removeClass("active");
129		});
130	}
131
132	/* 激活全局下拉框功能 */
133	{
134		$(".joe_dropdown").each(function (index, item) {
135			const menu = $(this).find(".joe_dropdown__menu");
136			const trigger = $(item).attr("trigger") || "click";
137			const placement = $(item).attr("placement") || $(this).height() || 0;
138			menu.css("top", placement);
139			if (trigger === "hover") {
140				$(this).hover(
141					() => $(this).addClass("active"),
142					() => $(this).removeClass("active")
143				);
144			} else {
145				$(this).on("click", function (e) {
146					$(this).toggleClass("active");
147					$(document).one("click", () => $(this).removeClass("active"));
148					e.stopPropagation();
149				});
150				menu.on("click", (e) => e.stopPropagation());
151			}
152		});
153	}
154
155	/* 激活全局返回顶部功能 */
156	{
157		$(".joe_action_item.scroll").on("click", () => window.scrollTo({
158			top: 0,
159			behavior: "smooth"
160		}));
161	}
162
163	/* 激活侧边栏人生倒计时功能 */
164	{
165		if ($(".joe_aside__item.timelife").length) {
166			let timelife = [{
167				title: "今日已经过去",
168				endTitle: "小时",
169				num: 0,
170				percent: "0%"
171			},
172			{
173				title: "这周已经过去",
174				endTitle: "天",
175				num: 0,
176				percent: "0%"
177			},
178			{
179				title: "本月已经过去",
180				endTitle: "天",
181				num: 0,
182				percent: "0%"
183			},
184			{
185				title: "今年已经过去",
186				endTitle: "个月",
187				num: 0,
188				percent: "0%"
189			},
190			]; {
191				let nowDate = +new Date();
192				let todayStartDate = new Date(new Date().toLocaleDateString()).getTime();
193				let todayPassHours = (nowDate - todayStartDate) / 1000 / 60 / 60;
194				let todayPassHoursPercent = (todayPassHours / 24) * 100;
195				timelife[0].num = parseInt(todayPassHours);
196				timelife[0].percent = parseInt(todayPassHoursPercent) + "%";
197			} {
198				let weeks = {
199					0: 7,
200					1: 1,
201					2: 2,
202					3: 3,
203					4: 4,
204					5: 5,
205					6: 6
206				};
207				let weekDay = weeks[new Date().getDay()];
208				let weekDayPassPercent = (weekDay / 7) * 100;
209				timelife[1].num = parseInt(weekDay);
210				timelife[1].percent = parseInt(weekDayPassPercent) + "%";
211			} {
212				let year = new Date().getFullYear();
213				let date = new Date().getDate();
214				let month = new Date().getMonth() + 1;
215				let monthAll = new Date(year, month, 0).getDate();
216				let monthPassPercent = (date / monthAll) * 100;
217				timelife[2].num = date;
218				timelife[2].percent = parseInt(monthPassPercent) + "%";
219			} {
220				let month = new Date().getMonth() + 1;
221				let yearPass = (month / 12) * 100;
222				timelife[3].num = month;
223				timelife[3].percent = parseInt(yearPass) + "%";
224			}
225			let htmlStr = "";
226			timelife.forEach((item, index) => {
227				htmlStr += `
228						<div class="item">
229							<div class="title">
230								${item.title}
231								<span class="text">${item.num}</span>
232								${item.endTitle}
233							</div>
234							<div class="progress">
235								<div class="progress-bar">
236									<div class="progress-bar-inner progress-bar-inner-${index}" style="width: ${item.percent}"></div>
237								</div>
238								<div class="progress-percentage">${item.percent}</div>
239							</div>
240						</div>`;
241			});
242			$(".joe_aside__item.timelife .joe_aside__item-contain").html(htmlStr);
243		}
244	}
245
246	/* 激活侧边栏天气功能 */
247	{
248		if ($(".joe_aside__item.weather").length) {
249			const key = $(".joe_aside__item.weather").attr("data-key");
250			const style = $(".joe_aside__item.weather").attr("data-style");
251			const aqiColor = {
252				1: "FFFFFF",
253				2: "4A4A4A",
254				3: "FFFFFF"
255			};
256			window.WIDGET = {
257				CONFIG: {
258					layout: 2,
259					width: "220",
260					height: "270",
261					background: style,
262					dataColor: aqiColor[style],
263					language: "zh",
264					key
265				}
266			};
267			$.getScript("https://widget.qweather.net/standard/static/js/he-standard-common.js?v=2.0");
268		}
269	}
270
271	/* 3d云标签 */
272	{
273		if ($(".joe_aside__item.tags").length) {
274			const entries = [];
275			const colors = [
276				"#F8D800",
277				"#0396FF",
278				"#EA5455",
279				"#7367F0",
280				"#32CCBC",
281				"#F6416C",
282				"#28C76F",
283				"#9F44D3",
284				"#F55555",
285				"#736EFE",
286				"#E96D71",
287				"#DE4313",
288				"#D939CD",
289				"#4C83FF",
290				"#F072B6",
291				"#C346C2",
292				"#5961F9",
293				"#FD6585",
294				"#465EFB",
295				"#FFC600",
296				"#FA742B",
297				"#5151E5",
298				"#BB4E75",
299				"#FF52E5",
300				"#49C628",
301				"#00EAFF",
302				"#F067B4",
303				"#F067B4",
304				"#ff9a9e",
305				"#00f2fe",
306				"#4facfe",
307				"#f093fb",
308				"#6fa3ef",
309				"#bc99c4",
310				"#46c47c",
311				"#f9bb3c",
312				"#e8583d",
313				"#f68e5f",
314			];
315			const random = (min, max) => {
316				min = Math.ceil(min);
317				max = Math.floor(max);
318				return Math.floor(Math.random() * (max - min + 1)) + min;
319			};
320			$(".joe_aside__item-contain .list li").each((i, item) => {
321				entries.push({
322					label: $(item).attr("data-label"),
323					url: $(item).attr("data-url"),
324					target: "_blank",
325					fontColor: colors[random(0, colors.length - 1)],
326					fontSize: 15,
327				});
328			});
329			$(".joe_aside__item-contain .tag").svg3DTagCloud({
330				entries,
331				width: 281,
332				height: 220,
333				radius: "65%",
334				radiusMin: 75,
335				bgDraw: false,
336				fov: 800,
337				speed: 0.5,
338				fontWeight: 500,
339			});
340		}
341	}
342
343	/* 侧边栏舔狗日记 */
344	{
345		if ($(".joe_aside__item.flatterer").length) {
346			const arr = [
347				"你昨天晚上又没回我信息,我却看见你的游戏在线,在我再一次孜孜不倦的骚扰你的情况下,你终于跟我说了一句最长的话“**你他妈是不是有病**”,我又陷入了沉思,这一定有什么含义,我想了很久,你竟然提到了我的妈妈,原来你已经想得那么长远了,想和我结婚见我的父母,我太感动了,真的。那你现在在干嘛,我好想你,我妈妈说她也很喜欢你。",
348				"今天我观战了一天你和别人打游戏,**你们玩的很开心**;我给你发了200多条消息,你说没流量就不回;晚上发说说没有人爱你,我连滚带爬评论了句有“我在”,你把我拉黑了,我给你打电话也无人接听。对不起,我不该打扰你,我求求你再给我一次当好友的机会吧!",
349				"我爸说再敢网恋就打断我的腿,幸好不是胳膊,这样我还能继续**和你打字聊天**,就算连胳膊也打断了,我的心里也会有你位置。",
350				"你说你情侣头像是一个人用的,空间上锁是因为你不喜欢玩空间,情侣空间是和闺蜜开的,找你连麦时你说你在忙工作,每次聊天你都说在忙,你真是一个**上进的好女孩**,你真好,我好喜欢你!",
351				"你跟他已经醒了吧?我今天捡垃圾挣了一百多,明天给你打过去。你快点休息吧,我明天叫你起床,给你点外卖买烟,给你点你最喜欢的奶茶。晚上我会继续去摆地摊的,你不用担心我,你床只有那么大睡不下三个。**你要好好照顾好自己,不要让他抢你被子**。我永远爱你!",
352				"她三天没回我的消息了,在我孜孜不倦地骚扰下她终于舍得回我“*
352*nmsl**”,我想这一定是有什么含义吧,噢!我恍然大悟原来是**尼美舒利颗粒**,她知道我有关节炎让我吃尼美舒利颗粒,她还是关心我的,但是又不想显现的那么热情。天啊!她好高冷,我好像更喜欢她了!",
353				"你想我了吧?可以回我消息了吗?我买了万通筋骨贴,你**运动一个晚上腰很疼**吧?今晚早点回家,我炖了排骨汤,我永远在家等你。",
354				"昨晚你和朋友打了一晚上游戏,你破天荒的给我看了战绩,虽然我看不懂但是我相信你一定是最厉害的、最棒的。我给你发了好多消息夸你,告诉你我多崇拜你,你回了我一句“**啥B**”,我翻来覆去思考这是什么意思,Sha[傻],噢你是说我傻,那B就是Baby的意思了吧,原来你是在叫我**傻宝**,这么宠溺的语气,我竟一时不敢相信,其实你也是喜欢我的对吧。",
355				"今天我还是照常给你发消息,汇报日常工作,你终于回了我四个字:“**嗯嗯,好的。**”。你开始愿意敷衍我了,我太感动了,受宠若惊。我愿意天天给你发消息,就算你天天骂我,我也不觉得烦。",
356				"你昨天晚上又没回我的消息,在我孜孜不倦的骚扰下,你终于舍得回我了,你说“**滚**”,这其中一定有什么含义,我想了很久,滚是三点水,这代表你对我的思念也如**滚滚流水**一样汹涌,我感动哭了,不知道你现在在干嘛,我很想你。",
357				"听说你想要一套化妆品,我算了算,明天我去工地上**搬一天砖**,就可以拿到200块钱,再加上我上个月攒下来的零花钱,刚好给你买一套迪奥。",
358				"今天表白被拒绝了,她对我说能不能脱下裤子**撒泡尿照照自己**。当我脱下裤子,她咽了口水,说我们可以试一下。",
359				"刚从派出所出来,原因前几天14号情人节,我想送你礼物,我去偷东西的时候被抓了。我本来想反抗,警察说了一句老实点别动,我立刻就放弃了反抗,因为我记得你说过,你喜欢**老实人**。",
360				"疫情不能出门,现在是早上八点,你肯定饿了吧。我早起做好了早餐来到你小区,保安大哥不让进。我给你打了三个电话你终于接了“**有病啊,我还睡觉呢,你小区门口等着吧**”。啊,我高兴坏了!你终于愿意吃我做的早餐了,还让我等你,啊!啊!啊!好幸福噢!",
361				"我存了两个月钱,给你买了一双**北卡蓝**,你对我说一句“谢谢”,我好开心。这是你第一次对我说两个字,以前你都只对我说滚。今天晚上逛**闲鱼**,看到了你把我送你的北卡蓝发布上去了。我想你一定是在考验我,再次送给你,给你一个惊喜,我爱你。",
362				"昨天**你领完红包就把我删了**,我陷入久久地沉思。我想这其中一定有什么含义,原来你是在欲擒故纵,嫌我不够爱你。无理取闹的你变得更加可爱了,我会坚守我对你的爱的。你放心好啦!今天发工资了,发了1850,给你微信转了520,支付宝1314,还剩下16。给你发了很多消息你没回。剩下16块我在小卖部买了你爱吃的老坛酸菜牛肉面,给你寄过去了。希望你保护好食欲,我去上班了爱你~~",
363				"在保安亭内看完了最新一集的梨泰院,曾经多么倔强的朴世路因为伊瑞给张大熙跪下了,亭外的树也许感受到了**我的悲伤**,枯了。我连树都保护不了,怎么保护你,或许保安才是真的需要被保护的吧。我难受,我想你。over",
364				"难以言喻的下午。说不想你是假的,说爱你是真的。昨天他们骂**我是你的舔狗**,我不相信,因为我知道你肯定也是爱我的,你一定是在考验我对你的感情,只要我坚持下去你一定会被我的真诚所打动,加油!不过我要批评你一下,昨晚你说**去酒店跟人斗地主**,我寻思两个人也玩不了呀。算了,不想了,毕竟打牌是赌博行为,不太好。",
365				"明天就周六了我知道你不上班,但是我怕你睡懒觉不吃早饭饿坏自己。我早晨4点去菜市场买了新鲜活鸡**给你炖鸡汤**,阿姨给我用箱子装了起来,我骑上我280买的电动车哼着小调回家,心想你一定会被我感动的,箱子半路开了,鸡跑了,拐到了一个胡同里,凌晨4点的胡同还有穿超短裙和大叔聊天的美女,不禁感叹这个世界变了,她问我找什么,…………。对不起,我爱你",
366				"12点队长过来准时交班,出去的车辆按喇叭我也没听到,只因我在监控中看到了穿睡衣出来倒垃圾的你,**望你望的入神**不由的傻笑了起来,队长过来骂我扣了我一天工资。我委屈,想抱你。你送的泡面真好吃。",
367				"今天的我排位输了好多把,我将这些事情分享给你,但是你一个字都没有讲,我在想你æ
367˜¯ä¸æ˜¯åœ¨å¿™ï¼Ÿæˆ‘头痛欲裂,终于在我给你发了几十条消息之后,你回了我一个“**脑子是不是有病?**”,原来你还是关心我的,看到这句话,我的脑子一下就不疼了,今天也是爱你的一天。",
368				"我存了半年的工资,给你买了一只LV,你对我说了一句“**你真好**”,我好开心,这是你第一次这么认可我,以前你都只对我说滚。今天晚上逛闲鱼,看到你把我送你的LV发布上去了。我想,你一定是在考验我,于是我用借呗里的钱把它买了下来,再次送给你,给你一个惊喜,我爱你。",
369				"其实我每月工资6000,但我只给你转2000,你以为我给你了全部。才不是,我一共舔了3个啦,**我要舔的雨露均沾**,才不会把你当成唯一。",
370				"昨天你把我拉黑了,我看着红色感叹号陷入了久久的沉思,我想这其中一定有什么含义?红色红色?我明白了!红色代表热情,你对我很热情,你想和我结婚,我愿意。",
371				"今天你问我借了两千块钱,说要做个手术,你果然还是爱我的,**不是我的孩子,你不要**。 ",
372				"中午你无故扇了我一巴掌,我握着你的手说“手怎么这么凉,都怪我没有照顾好你,一定要更加对你好”。",
373				"我给你打了几通电话,你终于接了。听到了**你发出啊啊啊啊的声音**,你说你肚子痛,我想你一定是很难受吧。电话还有个男的对你说“来换个姿势”,一定是**在做理疗**了。期待你早日康复,我好担心。",
374				"昨天晚上好冷,本来以为街上没人,结果刚刚**偷电动车**的时候被抓了,本来想反抗,但警察说了一句老实点别动,我立刻就放弃了抵抗,因为我记得你说过,你喜欢**老实人**。",
375				"找你连麦时你说你在忙工作,每次聊天你都说在忙,你真是一个**上进的好女孩**,你真好,发现我越来越喜欢这样优秀的你。",
376				"你从来没说过爱我,聊天记录搜索了一下“爱”,唯一的一条是:**你好像乡村爱情里的刘能啊**。",
377				"今天好开心啊,和你一起在峡谷嬉戏,打完一波团战之后看到你在打大龙,残血的我跳过去直接被龙爪拍死,但这一刻我觉得好浪漫,**死在你的脚旁边,这是我离你最近的一次**。",
378				"哥们,求你和她说句话吧,这样她就不会那么难过了。",
379				"今天你把我的微信拉黑了,这下我终于解放了!以前我总担心太多消息会打扰你,现在我终于不用顾忌,不管我怎么给你发消息,都不会让你不开心了。等我**攒够5201314条**我就拿给你看,你一定会震惊得说不出话然后哭着说会爱我一辈子。哈哈。",
380				"昨天你把我删了,我陷入了久久的沉思 。我想这其中一定有什么含义,你应该是欲擒故纵吧,嫌我不够爱你。突然觉得**无理取闹的你变得更加可爱**了,我会坚守我对你的爱的 你放心好啦!这么一想,突然对我俩的未来更有期望了呢。",
381				"今天上班不是太忙,百无聊赖,又翻出了你的相片,看了又看。今天是我认识你的第302天,也是我爱你的第302天,可是这些你并不知道,也许**你知道了,也不会在意**吧。 此刻的我好想你! ",
382				"今天你跟我说我很丑,让我不要骚扰你了。我听了很高兴,小说里的主角都像你这样,最开始表现的很厌恶,但最后**总会被我的真心打动**。你现在有多讨厌我,以后就会有多爱我。嘻嘻。",
383				"我坐在窗边给你发了99条消息,你终于肯回我了,你说“**发你妈啊**”,我一下子就哭了。原来努力真的有用,你已经开始考虑想见我的妈妈了,你也是挺喜欢我的。",
384				"刚才我找你说话,你回了一个滚,我陷入了沉思,你还是如此的关心我,知道我腿受伤了,让我这样走,好感动!看来你还是爱我的!",
385				"今天下雨了,我去你公司接你下班。看见我你不耐烦的说“*
385*烦不烦啊,不要再找我了**”,一头冲进雨里就跑开了。我心里真高兴啊,你宁愿自己淋雨,都不愿让我也淋湿一点,你果然还是爱我的。",
386				"晚上和你聊天,10点钟不到,你就说“**困了,去睡觉了**”。现在凌晨1点钟,看到你给他的朋友圈点赞评论,约他明天去吃火锅,一定是你微信被盗了吧。",
387				"今天我主动给你发了游戏邀请,邀请你和我单挑安琪拉,虽然我安琪拉很菜,可是为了和你打游戏,我还是毅然决然给你发了邀请。你说你不接受,你在打其他游戏。联想到我自己很菜,我突然明白,原来你还是在乎我的,只是不想一遍遍连招一套的在泉水送我走。我再一次感动哭了,因此,我好像更喜欢你了,你可真是一个宝藏男孩!",
388				"你的头像是一个女孩子左手边牵着一条秋田犬,犬=狗,而**我是一条舔狗**。是不是代表你的小手在牵着我呢?",
389				"今天发工资了,我一个月工资3000,你猜我会给你多少,是不是觉得我会给你2500,自己留500吃饭?你想多了,我3000都给你,因为厂里包吃包住。",
390				"昨天就为你充了710点卷,虽然知道你不会玩不知去向,但你说好看,你刚才说小号想要还想要一个,爱你的我还是满心欢喜的把剩下的100元伙食费又给你充了710,然后看到你小号并没有买,而是你送给了你的一个弟弟,你对弟弟真好,好有爱心,我感觉对你陷得很深了。",
391				"今天我给你发消息,你回复我“**nmsl**”,我想了半天才知道你是在夸我,原来是**你美死了**,你嘴真甜,我爱你。",
392				"你说你想买口红,今天我去了叔叔的口罩厂做了一天的打包。拿到了两百块钱,加上我这几天**省下的钱刚好能给你买一根小金条**。即没有给我自己剩下一分钱,但你不用担心,因为厂里包吃包住。对了打包的时候,满脑子都是你,想着你哪天突然就接受我的橄榄枝了呢。而且今天我很棒呢,主管表扬我很能干,其实也有你的功劳啦,是你给了我无穷的力量。今天我比昨天多想你一点,比明天少想你一点。",
393				"在我一如既往的每天跟她问早安的时候,她今天终于回我了。我激动地问她我是不是今天第一个跟她说话的人,她说不是,是**她男朋友把她叫起来退房**的。",
394				"听说你朋友说今天出门了,我打扮成精神小伙来找你,没想到你竟然对我说“**给我爬,别过来**”我当场就哭了,原来真心真的会感动人,你一定是知道,穿豆豆鞋走路脚会很累,让我爬是因为这样不会累着脚,其实你是喜欢我的吧",
395				"今天把你的备注改成了「**对方正在输入...**」,这样我就知道你不是不想回我,刚又给你发了消息,看到你在思考怎么回我,我就知道你和我一样,心里有我。",
396				"今天在楼上窗户上看见你和他在公园里接吻,我看见哭了出来,并打电话给你,想问问你为什么?但你说怎么了,声音是那么好听。于是我说“**以后你和他接吻的时候,能不能用我送给你的口红啊?**”",
397				"我退了无关紧要的群,唯独这个群我没有退,因为这里有一个对我来说很特别的女孩子,我们不是好友,**我每天只能通过群名片看看她**,虽然一张照片也看不到,我也知足了,我不敢说她的名字,但我知道她是群里面最美的女孩子,她说我们这样会距离产生美~ 我想想发现她说的挺对的,我心里很开心。",
398				"今天早上我告诉你我想你了,你没理我。今天中午我给你打电话,你不接,打第二个你就关机。晚上我在你公司楼下等你,你对我说的第一句话就是滚“**滚,别烦我,别浪费时间了**”,我真的好感动,你居然为我考虑了,怕我浪费时间。呜呜呜,这是我爱你的第74天。",
399				"我坐在窗边给你发了99条消息,你终于肯回我了你说“**发你妈啊**”,我一下子就哭了,原来努力真的有用,你已经开始考虑想见我的妈妈了,你其实也是挺喜欢我的。",
400				"你一个小时没回我的消息,在我孜孜不倦地骚扰下你终于舍得回我了“**在做爱**”,这其中一定有什么含义,我想了很久,“在做爱”这简简单单的三个字肯定是三句话,分别是**我在忙、做你女朋友、我爱你**,想到这里我不禁流下了眼泪,我这么长时间的喜欢没有白费,不知道你现在忙干嘛,但我很想你。",
401				"最近我暗恋的女生每天都和不同的男生约会,我想总有一天会轮到我,我问她什么时候能见见我?她说**下辈子å
401§**。她真好,下辈子还要和我在一起。",
402				"你好像从来没有对我说过晚安,我在我们的聊天记录里搜索了关键字:“晚安”,你说过一次:**我早晚安排人弄死你**。",
403			];
404			const random = (min, max) => {
405				min = Math.ceil(min);
406				max = Math.floor(max);
407				return Math.floor(Math.random() * (max - min + 1)) + min;
408			};
409			const toggle = () => {
410				$(".joe_aside__item.flatterer .content").html(arr[random(0, arr.length - 1)].replace(
411					/\*\*(.*?)\*\*/g, "<mark>$1</mark>"));
412				$(".joe_aside__item.flatterer .content").attr("class", "content type" + random(1, 6));
413			};
414			toggle();
415			$(".joe_aside__item.flatterer .change").on("click", () => toggle());
416		}
417	}
418
419	/* 激活Live2d人物 */
420	{
421		if (Joe.LIVE2D !== "off" && Joe.LIVE2D) {
422			$.getScript(`${Joe.THEME_URL}assets/plugin/live2d/L2Dwidget.min.js`, () => {
423				L2Dwidget.init({
424					model: {
425						jsonPath: Joe.LIVE2D,
426						scale: 1
427					},
428					mobile: {
429						show: true
430					},
431					display: {
432						position: "left",
433						width: 130,
434						height: 170,
435						hOffset: 0,
436						vOffset: 0
437					},
438				});
439			});
440		}
441	}
442
443	/* 评论框点击切换画图模式和文本模式 */
444	{
445		if ($(".joe_comment").length) {
446			$(".joe_comment__respond-type .item").on("click", function () {
447				$(this).addClass("active").siblings().removeClass("active");
448				if ($(this).attr("data-type") === "draw") {
449					$(".joe_comment__respond-form .body .draw").show().siblings().hide();
450					$("#joe_comment_draw").prop("width", $(".joe_comment__respond-form .body").width());
451					/* 设置表单格式为画图模式 */
452					$(".joe_comment__respond-form").attr("data-type", "draw");
453					/** 隐藏表情包功能 */
454					$('.joe_comment__respond-form .foot .owo').css('opacity', '0');
455				} else {
456					$(".joe_comment__respond-form .body .text").show().siblings().hide();
457					/* 设置表单格式为文字模式 */
458					$(".joe_comment__respond-form").attr("data-type", "text");
459					/** 显示表情包功能 */
460					$('.joe_comment__respond-form .foot .owo').css('opacity', '1');
461				}
462			});
463		}
464	}
465
466	/* 激活画图功能 */
467	{
468		if ($("#joe_comment_draw").length) {
469			/* 激活画板 */
470			window.sketchpad = new Sketchpad({
471				element: "#joe_comment_draw",
472				height: 300,
473				penSize: 5,
474				color: "303133"
475			});
476			/* 撤销上一步 */
477			$(".joe_comment__respond-form .body .draw .icon-undo").on("click", () => window.sketchpad.undo());
478			/* 动画预览 */
479			$(".joe_comment__respond-form .body .draw .icon-animate").on("click", () => window.sketchpad
480				.animate(10));
481			/* 更改画板的线宽 */
482			$(".joe_comment__respond-form .body .draw .line li").on("click", function () {
483				window.sketchpad.penSize = $(this).attr("data-line");
484				$(this).addClass("active").siblings().removeClass("active");
485			});
486			/* 更改画板的颜色 */
487			$(".joe_comment__respond-form .body .draw .color li").on("click", function () {
488				window.sketchpad.color = $(this).attr("data-color");
489				$(this).addClass("active").siblings().removeClass("active");
490			});
491		}
492	}
493
494	/* 重写评论功能 */
495	{
496		if ($(".joe_comment__respond").length) {
497			const respond = $(".joe_comment__respond");
498			/* 重写回复功能 */
499			$(".joe_comment__reply").on("click", function () {
500				/* 父级ID */
501				const coid = $(this).attr("data-coid");
502				/* 当前的项 */
503				const item = $("#" + $(this).attr("data-id"));
504				/* 添加自定义属性表示父级ID */
505				respond.find(".joe_comment__respond-form").attr("data-coid", coid);
506				item.append(respond);
507				$(".joe_comment__respond-type .item[data-type='text']").click();
508				$(".joe_comment__cancle").show();
509				window.scrollTo({
510					top: item.offset().top - $(".joe_header").height() - 15,
511					behavior: "smooth",
512				});
513			});
514			/* 重写取消回复功能 */
515			$(".joe_comment__cancle").on("click", function () {
516				/* 移除自定义属性父级ID */
517				respond.find(".joe_comment__respond-form").removeAttr("data-coid");
518				$(".joe_comment__cancle").hide();
519				$(".joe_comment>.comment-list").before(respond);
520				$(".joe_comment__respond-type .item[data-type='text']").click();
521				window.scrollTo({
522					top: $(".joe_comment").offset().top - $(".joe_header").height() - 15,
523					behavior: "smooth",
524				});
525			});
526		}
527	}
528
529	/* 激活评论提交 */
530	{
531		if ($(".joe_comment").length) {
532			let isSubmit = false;
533			$(".joe_comment__respond-form").on("submit", function (e) {
534				e.preventDefault();
535				const action = $(".joe_comment__respond-form").attr("action") + "?time=" + +new Date();
536				const type = $(".joe_comment__respond-form").attr("data-type");
537				const parent = $(".joe_comment__respond-form").attr("data-coid");
538				const author = $(".joe_comment__respond-form .head input[name='author']").val();
539				const _ = $(".joe_comment__respond-form input[name='_']").val();
540				const mail = $(".joe_comment__respond-form .head input[name='mail']").val();
541				const url = $(".joe_comment__respond-form .head input[name='url']").val();
542				let text = $(".joe_comment__respond-form .body textarea[name='text']").val();
543				if (author.trim() === "") return Qmsg.info("请输入昵称!");
544				if (!/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(mail)) return Qmsg.info(
545					"请输入正确的邮箱!");
546				if (type === "text" && text.trim() === "") return Qmsg.info("请输入评论内容!");
547				if (type === "draw") {
548					const txt = $("#joe_comment_draw")[0].toDataURL("image/webp", 0.1);
549					text = "{!{" + txt + "}!} ";
550				}
551				if (isSubmit) return;
552				isSubmit = true;
553				$(".joe_comment__respond-form .foot .submit button").html("发送中...");
554				$.ajax({
555					url: action,
556					type: "POST",
557					data: {
558						author,
559						mail,
560						text,
561						parent,
562						url,
563						_
564					},
565					dataType: "text",
566					success(res) {
567						let arr = [],
568							str = "";
569						arr = $(res).contents();
570						Array.from(arr).forEach((_) => {
571							if (_.parentNode.className === "container") str = _;
572						});
573						if (!/Joe/.test(res)) {
574							Qmsg.warning(str.textContent.trim() || "");
575							isSubmit = false;
576							$(".joe_comment__respond-form .foot .submit button").html("发表评论");
577						} else {
578							window.location.reload();
579						}
580					},
581					error(res) {
582						isSubmit = false;
583						$(".joe_comment__respond-form .foot .submit button").html("发表评论");
584						res = res.responseText;
585						var str = /<div class="container">\s+(.+)\s+<\/div>/;
586						var msg = res.match(str)[1];
587						if (msg) {
588							Qmsg.warning(msg);
589						} else {
590							Qmsg.warning("发送失败!请刷新重试!");
591						}
592					},
593				});
594			});
595		}
596	}
597
598	/* 设置评论回复网址为新窗口打开 */
599	{
600		$(".comment-list__item .term .content .user .author a").each((index, item) => $(item).attr("target",
601			"_blank"));
602	}
603
604	/* 格式化评论分页的hash值 */
605	{
606		$(".joe_comment .joe_pagination a").each((index, item) => {
607			const href = $(item).attr("href");
608			if (href && href.includes("#")) {
609				$(item).attr("href", href.replace("#comments", "?scroll=joe_comment"));
610			}
611		});
612	}
613
614	/* 切换标签显示不同的标题 */
615	{
616		if (Joe.DOCUMENT_TITLE) {
617			const TITLE = document.title;
618			document.addEventListener("visibilitychange", () => {
619				if (document.visibilityState === "hidden") {
620					document.title = Joe.DOCUMENT_TITLE;
621				} else {
622					document.title = TITLE;
623				}
624			});
625		}
626	}
627
628	/* 小屏幕伸缩侧边栏 */
629	{
630		$(".joe_header__above-slideicon").on("click", function () {
631			/* 关闭搜索框 */
632			$(".joe_header__searchout").removeClass("active");
633			/* 处理开启关闭状态 */
634			if ($(".joe_header__slideout").hasClass("active")) {
635				$("body").css("overflow", "");
636				$(".joe_header__mask").removeClass("active slideout");
637				$(".joe_header__slideout").removeClass("active");
638				$('.joe_header__above').css('box-shadow', '');
639			} else {
640				$("body").css("overflow", "hidden");
641				$(".joe_header__mask").addClass("active slideout");
642				$(".joe_header__slideout").addClass("active");
643				$('.joe_header__above').css('box-shadow', '0 10px 10px var(--main-shadow)');
644			}
645		});
646	}
647
648	/* 小屏幕搜索框 */
649	{
650		$(".joe_header__above-searchicon").on("click", function () {
651			/* 关闭侧边栏 */
652			$(".joe_header__slideout").removeClass("active");
653			$('.joe_header__above').css('box-shadow', '');
654			/* 处理开启关闭状态 */
655			if ($(".joe_header__searchout").hasClass("active")) {
656				$("body").css("overflow", "");
657				$(".joe_header__mask").removeClass("active slideout");
658				$(".joe_header__searchout").removeClass("active");
659			} else {
660				$("body").css("overflow", "hidden");
661				$(".joe_header__mask").addClass("active");
662				$(".joe_header__searchout").addClass("active");
663			}
664		});
665	}
666
667	/* 点击遮罩层关闭 */
668	{
669		$(".joe_header__mask").on("click", function () {
670			$("body").css("overflow", "");
671			$(".joe_header__mask").removeClass("active slideout");
672			$(".joe_header__searchout").removeClass("active");
673			$(".joe_header__slideout").removeClass("active");
674			$('.joe_header__above').css('box-shadow', '');
675		});
676	}
677
678	/* 移动端侧边栏菜单手风琴 */
679	{
680		$(".joe_header__slideout-menu .current").parents(".panel-body").show().siblings(".panel").addClass(
681			"in");
682		$(".joe_header__slideout-menu .panel").on("click", function () {
683			const panelBox = $(this).parent().parent();
684			/* 清除全部内容 */
685			panelBox.find(".panel").not($(this)).removeClass("in");
686			panelBox.find(".panel-body").not($(this).siblings(".panel-body")).stop().hide("fast");
687			/* 激活当前的内容 */
688			$(this).toggleClass("in").siblings(".panel-body").stop().toggle("fast");
689		});
690	}
691
692	/* 初始化网站运行时间 */
693	{
694		const getRunTime = () => {
695			const birthDay = new Date(Joe.BIRTHDAY);
696			const today = +new Date();
697			const timePast = today - birthDay.getTime();
698			let day = timePast / (1000 * 24 * 60 * 60);
699			let dayPast = Math.floor(day);
700			let hour = (day - dayPast) * 24;
701			let hourPast = Math.floor(hour);
702			let minute = (hour - hourPast) * 60;
703			let minutePast = Math.floor(minute);
704			let second = (minute - minutePast) * 60;
705			let secondPast = Math.floor(second);
706			day = String(dayPast).padStart(2, 0);
707			hour = String(hourPast).padStart(2, 0);
708			minute = String(minutePast).padStart(2, 0);
709			second = String(secondPast).padStart(2, 0);
710			$(".joe_run__day").html(day);
711			$(".joe_run__hour").html(hour);
712			$(".joe_run__minute").html(minute);
713			$(".joe_run__second").html(second);
714		};
715		if (Joe.BIRTHDAY && /(\d{4})\/(\d{1,2})\/(\d{1,2}) (\d{1,2})\:(\d{1,2})\:(\d{1,2})/.test(Joe
716			.BIRTHDAY)) {
717			getRunTime();
718			setInterval(getRunTime, 1000);
719		}
720	}
721
722	/* 初始化表情功能 */
723	{
724		if ($(".joe_owo__contain").length && $(".joe_owo__target").length && !$('.joe_owo__target').attr('disabled')) {
725			$.ajax({
726				url: window.Joe.THEME_URL + "assets/json/joe.owo.json",
727				dataType: "json",
728				success(res) {
729					let barStr = "";
730					let scrollStr = "";
731					for (let key in res) {
732						const item = res[key];
733						barStr += `<div class="item" data-type="${key}">${key}</div>`;
734						scrollStr += `
735							<ul class="scroll" data-type="${key}">
736								${item.map((_) => `<li class="item" data-text="${_.data}">${key === "颜文字" ? `${_.icon}` : `<img src="${window.Joe.THEME_URL + _.icon}" title="${/.*?\((.*?)\)/.exec(_.data)[1]}"	alt="${/.*?\((.*?)\)/.exec(_.data)[1]}"/>`}</li>`).join("")}
737							</ul>`;
738					}
739					$(".joe_owo__contain").html(`
740						<div class="seat">OωO</div>
741						<div class="box">
742							${scrollStr}
743							<div class="bar no-scrollbar">${barStr}</div>
744						</div>
745					`);
746					$(document).on("click", function () {
747						$(".joe_owo__contain .box").stop().slideUp("fast");
748					});
749					$(".joe_owo__contain .seat").on("click", function (e) {
750						e.stopPropagation();
751						$(this).siblings(".box").stop().slideToggle("fast");
752					});
753					$(".joe_owo__contain .box .bar .item").on("click", function (e) {
754						e.stopPropagation();
755						$(this).addClass("active").siblings().removeClass("active");
756						const scrollIndx = '.joe_owo__contain .box .scroll[data-type="' + $(
757							this).attr("data-type") + '"]';
758						$(scrollIndx).show().siblings(".scroll").hide();
759					});
760					$(".joe_owo__contain .scroll .item").on("click", function () {
761						const text = $(this).attr("data-text");
762						$(".joe_owo__target").insertContent(text);
763					});
764					$(".joe_owo__contain .box .bar .item").first().click();
765				},
766			});
767		}
768	}
769
770	/* 座右铭 */
771	{
772		let motto = Joe.MOTTO;
773		if (!motto) {
774			const mottoArray = [
775				'风急天高猿啸哀,渚清沙白鸟飞回',
776				'无边落木萧萧下,不尽长江滚滚来',
777				'万里悲秋常作客,百年多病独登台',
778				'艰难苦恨繁霜鬓,潦倒新停浊酒杯',
779				'君不见黄河之水天上来,奔流到海不复回',
780				'君不见高堂明镜悲白发,朝如青丝暮成雪',
781				'人生得意须尽欢,莫使金樽空对月',
782				'天生我材必有用,千金散尽还复来',
783				'问君能有几多愁,恰似一江春水向东流',
784				'不知天上宫阙,今夕是何年',
785				'我欲乘风归去,又恐琼楼玉宇',
786				'高处不胜寒,起舞弄清影,何似在人间',
787				'醉里挑灯看剑,梦回吹角连营',
788				'八百里分麾下炙,五十弦翻塞外声,沙场秋点兵',
789				'在天愿为比翼鸟,在地愿为连理枝',
790				'莫愁前路无知己,天下谁人不识君',
791				'枯藤老树昏鸦,小桥流水人家',
792				'夕阳西下,断肠人在天涯',
793				'安能摧眉折腰事权贵,使我不得开心颜?',
794				'国破山河在,城春草木深',
795				'感时花溅泪,恨别鸟惊心',
796				'羌管悠悠霜满地,人不寐,将军白发征夫泪',
797				'五花马,千金裘,呼儿将出换美酒',
798				'山无陵,江水为竭,冬雷震震,夏雨雪,天地合,乃敢与君绝',
799				'劝君更尽一杯酒,西出阳关无故人',
800				'人生自是有情痴,此恨不关风与月',
801				'千山鸟飞绝,万径人踪灭',
802				'孤舟蓑笠翁,独钓寒江雪',
803				'十年生死两茫茫,不思量,自难忘。千里孤坟,无处话凄凉',
804				'纵使相逢应不识,尘满面,鬓如霜',
805				'少年不识愁滋味,爱上层楼。爱上层楼,为赋新词强说愁',
806				'时光只解催人老,不信多情,长恨离亭,泪滴春衫酒易醒',
807				'梧桐昨夜西风急,淡月胧明,好梦频惊,何处高楼雁一声?',
808				'惶恐滩头说惶恐,零丁洋里叹零丁',
809				'人生自古谁无死?留取丹心照汗青',
810				'前不见古人,后不见来者',
811				'念天地之悠悠,独怆然而涕下',
812				'我醉欲眠卿且去,明朝有意抱琴来',
813				'人生自古谁无死,留取丹心照汗青',
814				'黑云压城城欲摧,甲光向日金鳞开'
815			];
816			const randomIndex = Math.floor(Math.random() * mottoArray.length);
817			motto = mottoArray[randomIndex];
818		}
819		if (motto.startsWith("https://") || motto.startsWith("http://") || motto.startsWith("//")) {
820			$.ajax({
821				url: motto,
822				dataType: "text",
823				success: (res) => {
824					$(".joe_motto").html(res);
825				}
826			});
827		} else {
828			$(".joe_motto").html(motto);
829		}
830	}
831
832	/** 页面滚动监听函数 */
833	{
834		if (!window.Joe.IS_MOBILE) {
835			var flag = true;
836			function handleHeader(diffY) {
837				if (window.pageYOffset >= $(".joe_header").height() && diffY <= 0) {
838					if (flag) return;
839					$(".joe_header").addClass("active");
840					$(".joe_aside .joe_aside__item:last-child").css("top", $(".joe_header").height() - 60 +
841						23);
842					flag = true;
843				} else {
844					if (!flag) return;
845					$(".joe_header").removeClass("active");
846					$(".joe_aside .joe_aside__item:last-child").css("top", $(".joe_header").height() + 15);
847					flag = false;
848				}
849			};
850			var Y = window.pageYOffset;
851			handleHeader(Y);
852		}
853		$(window).scroll(throttle(() => {
854			// 激活全局返回顶部功能
855			var h = document.documentElement.scrollTop + document.body.scrollTop,
856				ontop = $(
857					".joe_action_item.scroll");
858			h > 100 ? $('body').addClass('body-scroll') : $('body').removeClass('body-scroll');
859			h > 400 ? ontop.addClass('active') : ontop.removeClass('active');
860
861			// 头部滚动
862			if (!window.Joe.IS_MOBILE) {
863				handleHeader(Y - window.pageYOffset);
864				Y = window.pageYOffset;
865			}
866		}, 100))//.trigger("scroll");
867
868		// 页面滚动隐藏 tooltip 提示
869		$(window).scroll(debounce(() => {
870			if (!Joe.IS_MOBILE) $("[data-toggle='tooltip']").tooltip('hide');
871		}, 500, true));
872	}
873
874	/* 监听移动端键盘弹出 */
875	{
876		var footerTabbar = document.querySelector('.footer-tabbar');
877		var joeAction = document.querySelector('.joe_action');
878		if (footerTabbar || joeAction) {
879			const ua = typeof window === 'object' ? window.navigator.userAgent : '';
880			let _isIOS = -1;
881			let _isAndroid = -1;
882			const isIOS = () => {
883				if (_isIOS === -1) {
884					_isIOS = /iPhone|iPod|iPad/i.test(ua) ? 1 : 0;
885				}
886				return _isIOS === 1;
887			}
888			const isAndroid = () => {
889				if (_isAndroid === -1) {
890					_isAndroid = /Android/i.test(ua) ? 1 : 0;
891				}
892				return _isAndroid === 1;
893			}
894			const popUp = () => {
895				if (footerTabbar) footerTabbar.style.display = 'none';
896				if (joeAction) joeAction.style.display = 'none';
897			}
898			const retract = () => {
899				if (footerTabbar) footerTabbar.style.display = 'flex';
900				if (joeAction) joeAction.style.display = 'block';
901			}
902			if (isAndroid()) {
903				const innerHeight = window.innerHeight;
904				window.addEventListener('resize', () => {
905					const newInnerHeight = window.innerHeight;
906					if (innerHeight > newInnerHeight) {
907						// 键盘弹出事件处理
908						popUp();
909					} else {
910						// 键盘收起事件处理
911						retract();
912					}
913				});
914			} else if (isIOS()) {
915				window.addEventListener('focusin', () => {
916					// 键盘弹出事件处理
917					popUp();
918				});
919				window.addEventListener('focusout', () => {
920					// 键盘收起事件处理
921					retract();
922				});
923			}
924		}
925	}
926
927	/** 动态监听实际VH高度 */
928	{
929		if (window.Joe.IS_MOBILE) {
930			function resetVhAndPx() {
931				let vh = window.innerHeight * 0.01
932				document.documentElement.style.setProperty('--vh', `${vh}px`)
933				// document.documentElement.style.fontSize = document.documentElement.clientWidth / 375 + 'px'
934				console.log('重新计算VH高度')
935			}
936			resetVhAndPx();
937			// 监听resize事件 视图大小发生变化就重新计算1vh的值
938			window.addEventListener('resize', resetVhAndPx);
939		}
940	}
941
942	/** 文章列表缩略图加载失败自动使用主题自带缩略图 */
943	{
944		window.thumbOnError = function () {
945			$('.thumbnail>img, .joe_detail__related-content>a>img, .graphic>.fit-cover, .joe_index__hot-list .item .link .inner .image').on('error', function () {
946				// 生成一个 1 到 42 之间的随机整数
947				const randomNumber = Math.floor(Math.random() * 41) + 1;
948				// 将随机数格式化为两位数
949				const formattedNumber = ("0" + randomNumber).slice(-2);
950				const thumb = `${Joe.THEME_URL}assets/images/thumb/${formattedNumber}.jpg`;
951				$(this).attr('data-src', thumb);
952				$(this).attr('src', thumb);
953			});
954		}
955		thumbOnError();
956	}
957
958	/** 全局Loading动画补全 */
959	{
960		function checkUrl(string) {
961			try {
962				// console.log(string);
963				if (string.startsWith('/')) return true;
964				let url = new URL(string);
965				if (url.protocol == 'javascript:' || url.protocol == 'javascript::' || url.search != '') return false;
966			} catch (error) {
967				return false;
968			}
969			return true;
970		}
971		if (window.loadingEnd && window.loadingStart) {
972			window.offLoading = () => {
973				// a标签加载动画
974				$(document.querySelectorAll('a[href]:not([href=""])')).click(function (e) {
975					if ($(this).attr('target') == '_blank') return true;
976					if ($(this).attr('ajax-replace')) return true;
977					let url = $(this).attr('href');
978					if (checkUrl(url)) window.loadingStart();
979					setTimeout(() => {
980						window.loadingEnd();
981					}, 5000);
982					window.addEventListener('unload', function (event) {
983						// 在这里执行你希望在用户离开前运行的代码
984						window.loadingEnd();
985					});
986				});
987			}
988			offLoading();
989		}
990	}
991
992	/** 头像加载失败代替 */
993	{
994		$('img.avatar').on('error', function () {
995			this.setAttribute('data-src', Joe.THEME_URL + 'assets/images/avatar-default.png');
996			this.setAttribute('src', Joe.THEME_URL + 'assets/images/avatar-default.png');
997		});
998	}
999
1000	/** 模态框 */
1001	{
1002		var _wid = $(window).width();
1003		var _hei = $(window).height();
1004		// 模态框居中
1005		$('body').on('show.bs.modal loaded.bs.modal', '.modal:not(.flex)', function () {
1006			var o = $(this);
1007			var i = o.find('.modal-dialog');
1008			o.css('display', 'block'),
1009				i.css({
1010					'margin-top': Math.max(0, (_hei - i.height()) / 2),
1011				});
1012		});
1013
1014		// 每次都刷新的模态框
1015		$('body').on('click', '[data-toggle="RefreshModal"]', function () {
1016			var _this = $(this);
1017			var dataclass = _this.attr('data-class') || '';
1018			var remote = _this.attr('data-remote');
1019			var height = _this.attr('data-height') || 300;
1020			var mobile_bottom = _this.attr('mobile-bottom') && _wid < 769 ? ' bottom' : '';
1021			var modal_class = 'modal flex jc fade' + mobile_bottom;
1022			var id = 'refresh_modal';
1023			var is_new = _this.attr('new');
1024			id += is_new ? parseInt((Math.random() + 1) * Math.pow(10, 4)) : '';
1025
1026			var _id = '#' + id;
1027
1028			dataclass += ' modal-dialog';
1029			var modal_html =
1030				'<div class="' +
1031				modal_class +
1032				'" id="' +
1033				id +
1034				'" tabindex="-1" role="dialog" aria-hidden="false">\
1035	<div class="' +
1036				dataclass +
1037				'" role="document">\
1038	<div class="modal-content">\
1039	</div>\
1040	</div>\
1041	</div>';
1042
1043			var loading = '<div class="modal-body" style="display:none;"></div><div class="flex jc loading-mask absolute main-bg radius8"><div class="em2x opacity5"><i class="loading"></i></div></div>';
1044			// console.log(_id);
1045			var _modal = $(_id);
1046			if (_modal.length) {
1047				if (_modal.hasClass('in')) modal_class += ' in';
1048				_modal.removeClass().addClass(modal_class);
1049				_modal.find('.modal-dialog').removeClass().addClass(dataclass);
1050				_modal.find('.loading-mask').fadeIn(200);
1051				_modal
1052					.find('.modal-content')
1053					.css({
1054						overflow: 'hidden',
1055					})
1056					.animate({
1057						height: height,
1058					});
1059			} else {
1060				$('body').append(modal_html);
1061				_modal = $(_id);
1062				if (is_new) {
1063					_modal.on('hidden.bs.modal', function () {
1064						$(this).remove();
1065					});
1066				}
1067				_modal.find('.modal-content').html(loading).css({
1068					height: height,
1069					overflow: 'hidden',
1070				});
1071				if (_wid < 769) {
1072					_modal.minitouch({
1073						direction: 'bottom',
1074						selector: '.modal-dialog',
1075						start_selector: '.modal-colorful-header,.touch-close,.touch',
1076						onEnd: function () {
1077							_modal.modal('hide');
1078						},
1079						stop: function () {
1080							return !_modal.hasClass('bottom');
1081						},
1082					});
1083				}
1084			}
1085
1086			_modal.find('.touch-close').remove();
1087			var touch_close = '<div class="touch-close"></div>';
1088			if (mobile_bottom && !_this.attr('no-touch')) {
1089				_modal.find('.modal-dialog').append(touch_close);
1090			}
1091
1092			_modal.modal('show');
1093
1094			$.get(remote, null, function (data) {
1095				_modal.trigger('loaded.bs.modal').find('.loading-mask').fadeOut(200);
1096				try {
1097					jsonData = JSON.parse(data);
1098					if (jsonData) {
1099						Qmsg.error(jsonData.message);
1100						_modal.modal('hide');
1101						return;
1102					}
1103				} catch (e) {
1104					// console.log(data);
1105					_modal
1106						.find('.modal-body')
1107						.html(data)
1108						.slideDown(200, function () {
1109							var b_height = $(this).outerHeight();
1110							_modal.find('.modal-content').animate(
1111								{
1112									height: b_height,
1113								},
1114								200,
1115								'swing',
1116								function () {
1117									_modal.find('.modal-content').css({
1118										height: '',
1119										overflow: '',
1120										transition: '',
1121									});
1122								}
1123							);
1124						});
1125				}
1126			});
1127			return false;
1128		});
1129	}
1130
1131	{
1132		//搜索多选择
1133		$('body').on('click', '[data-for]', function () {
1134			var _this = $(this);
1135			var _tt;
1136			var _for = _this.attr('data-for');
1137			var _f = _this.parents('form');
1138			var _v = _this.attr('data-value');
1139			var multiple = _this.attr('data-multiple');
1140			var _group = _this.closest('[for-group]');
1141			if (!_group.length) {
1142				_group = _this.parent();
1143			}
1144
1145			if (multiple) {
1146				_tt = '';
1147				var active_array = [];
1148				var _input = '';
1149				var is_active = _this.hasClass('active');
1150				if (!is_active) {
1151					//添加
1152					if (_group.find('[data-for="_for"].active').length >= multiple) {
1153						return Qmsg.info('最多可选择' + multiple + '个', 'danger');
1154					}
1155				}
1156
1157				if (is_active) {
1158					//已存在-删除
1159					_group.find('[data-for="' + _for + '"][data-value="' + _v + '"]').removeClass('active');
1160				} else {
1161					//不存在-添加
1162					_group.find('[data-for="' + _for + '"][data-value="' + _v + '"]').addClass('active');
1163				}
1164
1165				_group.find('[data-for="' + _for + '"].active').each(function () {
1166					var _this_value = $(this).attr('data-value');
1167					//不重复
1168					if (active_array.indexOf(_this_value) == -1) {
1169						_tt += $(this).html();
1170						_input += '<input type="hidden" name="' + _for + '[]" value="' + _this_value + '">';
1171						active_array.push(_this_value);
1172					}
1173				});
1174
1175				//循环将所有的active_array添加active的calass
1176				$.each(active_array, function (index, value) {
1177					_group.find('[data-for="' + _for + '"][data-value="' + value + '"]').addClass('active');
1178				});
1179
1180				_f.find("input[name='" + _for + "[]']").remove();
1181				_f.append(_input);
1182			} else {
1183				_group.find('[data-for="' + _for + '"]').removeClass('active');
1184				_group.find('[data-for="' + _for + '"][data-value="' + _v + '"]').addClass('active');
1185
1186				_tt = _this.html();
1187				_f.find("input[name='" + _for + "']")
1188					.val(_v)
1189					.trigger('change');
1190			}
1191
1192			_f.find("span[name='" + _for + "']").html(_tt);
1193			_f.find('input[name=s]').focus();
1194		});
1195	}
1196
1197	{
1198		// tooltip.js
1199		if (Joe.IS_MOBILE) {
1200			// 遍历所有的元素
1201			$('[data-toggle="tooltip"]').each(function () {
1202				// 获取当前元素的data-original-title属性
1203				var title = $(this).attr('data-original-title') || $(this).attr('title');
1204				// 设置title属性为data-original-title的值
1205				$(this).attr('title', title);
1206				['data-toggle', 'data-placement'].forEach(value => {
1207					$(this).removeAttr(value);
1208				});
1209			});
1210		} else {
1211			$("[data-toggle='tooltip']").tooltip({
1212				container: "body"
1213			});
1214			$("[data-toggle='tooltip']").on('click', function (event) {
1215				$(this).tooltip('hide');
1216			});
1217		}
1218		// popover.js
1219		$("[data-toggle='popover']").popover({
1220			sanitize: false,
1221		});
1222	}
1223});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.