PageSourceSearch

https://goodapple.top/wp-content/themes/argon/argontheme.js?v1.3.5

js goodapple.top collected 2026-10-03 23:19:46 UTC 89,769 bytes, 2,616 lines download raw bytes

1if (typeof(argonConfig) == "undefined"){
2	var argonConfig = {};
3}
4if (typeof(argonConfig.wp_path) == "undefined"){
5	argonConfig.wp_path = "/";
6}
7/*Cookies 操作*/
8function setCookie(cname, cvalue, exdays) {
9	let d = new Date();
10	d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
11	let expires = "expires=" + d.toUTCString();
12	document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
13}
14function getCookie(cname) {
15	let name = cname + "=";
16	let decodedCookie = decodeURIComponent(document.cookie);
17	let ca = decodedCookie.split(';');
18	for (let i = 0; i < ca.length; i++) {
19		let c = ca[i];
20		while (c.charAt(0) == ' ') {
21			c = c.substring(1);
22		}
23		if (c.indexOf(name) == 0) {
24			return c.substring(name.length, c.length);
25		}
26	}
27	return "";
28}
29
30/*多语言支持*/
31var translation = {};
32translation['en_US'] = {
33	"确定": "OK",
34	"清除": "Clear",
35	"恢复博客默认": "Set To Default",
36	"评论内容不能为空": "Comment content cannot be empty",
37	"昵称不能为空": "Name cannot be empty",
38	"邮箱或 QQ 号格式错误": "Incorrect email or QQ format",
39	"邮箱格式错误": "Incorrect email format",
40	"网站格式错误 (不是 http(s):// 开头)": "Website URL format error",
41	"验证码未输入": "CAPTCHA cannot be empty",
42	"验证码格式错误": "Incorrect CAPTCHA format",
43	"评论格式错误": "Comment format error",
44	"发送中": "Sending",
45	"正在发送": "Sending",
46	"评论正在发送中...": "Comment is sending...",
47	"发送": "Send",
48	"评论发送失败": "Comment failed",
49	"发送成功": "Success",
50	"您的评论已发送": "Your comment has been sent",
51	"评论": "Comments",
52	"未知原因": "Unknown Error",
53	"编辑中": "Editing",
54	"正在编辑": "Editing",
55	"评论正在编辑中...": "Comment is being edited...",
56	"编辑": "Edit",
57	"评论编辑失败": "Comment editing failed",
58	"已编辑": "Edited",
59	"编辑成功": "Success",
60	"您的评论已编辑": "Your comment has been edited",
61	"评论 #": "Comment #",
62	"的编辑记录": "- Edit History",
63	"加载失败": "Failed to load",
64	"展开": "Show",
65	"没有更多了": "No more comments",
66	"找不到该 Repo": "Can't find the repository",
67	"获取 Repo 信息失败": "Failed to get repository information",
68	"点赞失败": "Vote failed",
69	"Hitokoto 获取失败": "Failed to get Hitokoto",
70	"复制成功": "Copied",
71	"代码已复制到剪贴板": "Code has been copied to the clipboard",
72	"复制失败": "Failed",
73	"请手动复制代码": "Please copy the code manually",
74	"刚刚": "Now",
75	"分钟前": "minutes ago",
76	"小时前": "hours ago",
77	"昨天": "Yesterday",
78	"前天": "The day before yesterday",
79	"天前": "days ago",
80	"隐藏行号": "Hide Line Numbers",
81	"显示行号": "Show Line Numbers",
82	"开启折行": "Enable Break Line",
83	"关闭折行": "Disable Break Line",
84	"复制": "Copy",
85	"全屏": "Fullscreen",
86	"退出全屏": "Exit Fullscreen",
87	"置顶评论": "Pin Comment",
88	"取消置顶评论": "Unpin Comment",
89	"是否要取消置顶评论 #": "Do you want to unpin the comment #",
90	"是否要置顶评论 #": "Do you want to pin the comment #",
91	"确认": "Confirm",
92	"取消": "取消",
93	"置顶": "Pin",
94	"取消置顶": "Unpin",
95	"置顶成功": "Pinned",
96	"取消置顶成功": "Unpinned",
97	"该评论已置顶": "The comment has been pinned",
98	"该评论已取消置顶": "The comment has been unpinned",
99	"置顶失败": "Failed to pin",
100	"取消置顶失败": "Failed to unpin",
101};
102translation['ru_RU'] = {
103	"确定": "ОК",
104	"清除": "Очистить",
105	"恢复博客默认": "Восстановить по умолчанию",
106	"评论内容不能为空": "Содержимое комментария не может быть пустым",
107	"昵称不能为空": "Имя не может быть пустым",
108	"邮箱或 QQ 号格式错误": "Неверный формат электронной почты или QQ",
109	"邮箱格式错误": "Неправильный формат электронной почты",
110	"网站格式错误 (不是 http(s):// 开头)": "Сайт ошибка формата URL-адреса ",
111	"验证码未输入": "Вы не решили капчу",
112	"验证码格式错误": "Ошибка проверки капчи",
113	"评论格式错误": "Неправильный формат комментария",
114	"发送中": "Отправка",
115	"正在发送": "Отправка",
116	"评论正在发送中...": "Комментарий отправляется...",
117	"发送": "Отправить",
118	"评论发送失败": "Не удалось отправить комментарий",
119	"发送成功": "Комментарий отправлен",
120	"您的评论已发送": "Ваш комментарий был отправлен",
121	"评论": "Комментарии",
122	"未知原因": "Неизвестная ошибка",
123	"编辑中": "Редактируется",
124	"正在编辑": "Редактируется",
125	"评论正在编辑中...": "Комментарий редактируется",
126	"编辑": "Редактировать",
127	"评论编辑失败": "Не удалось отредактировать комментарий",
128	"已编辑": "Изменено",
129	"编辑成功": "Успешно",
130	"您的评论已编辑": "Ваш комментарий был изменен",
131	"评论 #": "Комментарий #",
132	"的编辑记录": "- История изменений",
133	"加载失败": "Ошибка загрузки",
134	"展开": "Показать",
135	"没有更多了": "Комментариев больше нет",
136	"找不到该 Repo": "Невозможно найти репозиторий",
137	"获取 Repo 信息失败": "Неудалось получить информацию репозитория",
138	"点赞失败": "Ошибка голосования",
139	"Hitokoto 获取失败": "Проблемы с вызовом Hitokoto",
140	"复制成功": "Скопировано",
141	"代码已复制到剪贴板": "Код скопирован в буфер обмена",
142	"复制失败": "Неудалось",
143	"请手动复制代码": "Скопируйте код вручную",
144	"刚刚": "Сейчас",
145	"分钟前": "минут назад",
146	"小时前": "часов назад",
147	"昨天": "Вчера",
148	"前天": "Позавчера",
149	"天前": "дней назад",
150	"隐藏行号": "Скрыть номера строк",
151	"显示行号": "Показать номера строк",
152	"开启折行": "Включить перенос строк",
153	"关闭折行": "Выключить перенос строк",
154	"复制": "Скопировать",
155	"全屏": "Полноэкранный режим",
156	"退出全屏": "Выход из полноэкранного режима",
157};
158translation['zh_TW'] = {
159	"确定": "確定",
160	"清除": "清除",
161	"恢复博客默认": "恢復博客默認",
162	"评论内容不能为空": "評論內容不能為空",
163	"昵称不能为空": "昵稱不能為空",
164	"邮箱或 QQ 号格式错误": "郵箱或 QQ 號格式錯誤",
165	"邮箱格式错误": "郵箱格式錯誤",
166	"网站格式错误 (不是 http(s):// 开头)": "網站格式錯誤 (不是 http(s):// 開頭)",
167	"验证码未输入": "驗證碼未輸入",
168	"验证码格式错误": "驗證碼格式錯誤",
169	"评论格式错误": "評論格式錯誤",
170	"发送中": "發送中",
171	"正在发送": "正在發送",
172	"评论正在发送中...": "評論正在發送中...",
173	"发送": "發送",
174	"评论发送失败": "評論發送失敗",
175	"发送成功": "發送成功",
176	"您的评论已发送": "您的評論已發送",
177	"评论": "評論",
178	"未知原因": "未知原因",
179	"编辑中": "編輯中",
180	"正在编辑": "正在編輯",
181	"评论正在编辑中...": "評論正在編輯中...",
182	"编辑": "編輯",
183	"评论编辑失败": "評論編輯失敗",
184	"已编辑": "已編輯",
185	"编辑成功": "編輯成功",
186	"您的评论已编辑": "您的評論已編輯",
187	"评论 #": "評論 #",
188	"的编辑记录": "的編輯記錄",
189	"加载失败": "加載失敗",
190	"展开": "展開",
191	"没有更多了": "沒有更多了",
192	"找不到该 Repo": "找不到該 Repo",
193	"获取 Repo 信息失败": "獲取 Repo 信息失敗",
194	"点赞失败": "點贊失敗",
195	"Hitokoto 获取失败": "Hitokoto 獲取失敗",
196	"复制成功": "復制成功",
197	"代码已复制到剪贴板": "代碼已復制到剪貼板",
198	"复制失败": "復制失敗",
199	"请手动复制代码": "請手動復制代碼",
200	"刚刚": "剛剛",
201	"分钟前": "分鐘前",
202	"小时前": "小時前",
203	"昨天": "昨天",
204	"前天": "前天",
205	"天前": "天前",
206	"隐藏行号": "隱藏行號",
207	"显示行号": "顯示行號",
208	"开启折行": "開啟折行",
209	"关闭折行": "關閉折行",
210	"复制": "復制",
211	"全屏": "全屏",
212	"退出全屏": "退出全屏"
213};
214function __(text){
215	let lang = argonConfig.language;
216	if (typeof(translation[lang]) == "undefined"){
217		return text;
218	}
219	if (typeof(translation[lang][text]) == "undefined"){
220		return text;
221	}
222	return translation[lang][text];
223}
224
225/*根据滚动高度改变顶栏透明度*/
226!function(){
227	let toolbar = document.getElementById("navbar-main");
228	let $bannerContainer = $("#banner_container");
229	let $content = $("#content");
230
231	let startTransitionHeight;
232	let endTransitionHeight;
233	let maxOpacity = 0.85;
234
235	startTransitionHeight = $bannerContainer.offset().top - 75;
236	endTransitionHeight = $content.offset().top - 75;
237
238	$(window).resize(function(){
239		startTransitionHeight = $bannerContainer.offset().top - 75;
240		endTransitionHeight = $content.offset().top - 75;
241	});
242
243	function changeToolbarTransparency(){
244		let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
245		if (scrollTop < startTransitionHeight){
246			toolbar.style.setProperty('background-color', 'rgba(var(--toolbar-color), 0)', 'important');
247			toolbar.style.setProperty('box-shadow', 'none');
248			if (argonConfig.toolbar_blur){
249				toolbar.style.setProperty('backdrop-filter', 'blur(0px)');
250			}
251			toolbar.classList.add("navbar-ontop");
252			return;
253		}
254		if (scrollTop > endTransitionHeight){
255			toolbar.style.setProperty('background-color', 'rgba(var(--toolbar-color), ' + maxOpacity + ')', 'important');
256			toolbar.style.setProperty('box-shadow', '');
257			if (argonConfig.toolbar_blur){
258				toolbar.style.setProperty('backdrop-filter', 'blur(16px)');
259			}
260			toolbar.classList.remove("navbar-ontop");
261			return;
262		}
263		let transparency = (scrollTop - startTransitionHeight) / (endTransitionHeight - startTransitionHeight) * maxOpacity;
264		toolbar.style.setProperty('background-color', 'rgba(var(--toolbar-color), ' + transparency, 'important');
265		toolbar.style.setProperty('box-shadow', '');
266		if (argonConfig.toolbar_blur){
267			if ((scrollTop - startTransitionHeight) / (endTransitionHeight - startTransitionHeight) > 0.3){
268				toolbar.style.setProperty('backdrop-filter', 'blur(16px)');
269			}else{
270				toolbar.style.setProperty('backdrop-filter', 'blur(0px)');
271			}
272		}
273		toolbar.classList.remove("navbar-ontop");
274	}
275	function changeToolbarOnTopClass(){
276		let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
277		if (scrollTop < 30){
278			toolbar.classList.add("navbar-no-blur");
279		}else{
280			toolbar.classList.remove("navbar-no-blur");
281		}
282	}
283	if ($("html").hasClass("no-banner")) {
284		changeToolbarOnTopClass();
285		document.addEventListener("scroll", changeToolbarOnTopClass, {passive: true});
286		return;
287	}
288	if (argonConfig.headroom == "absolute") {
289		toolbar.classList.add("navbar-ontop");
290		return;
291	}
292	if ($("html").hasClass("toolbar-blur")) {
293		argonConfig.toolbar_blur = true;
294		maxOpacity = 0.65;
295	}else{
296		argonConfig.toolbar_blur = false;
297	}
298	changeToolbarTransparency();
299	document.addEventListener("scroll", changeToolbarTransparency, {passive: true});
300}();
301
302/*搜索*/
303function searchPosts(word){
304	if ($(".search-result").length > 0){
305		let url = new URL(window.location.href);
306		url.searchParams.set("s", word);
307		$.pjax({
308			url: url.href
309		});
310	}else{
311		$.pjax({
312			url: argonConfig.wp_path + "?s=" + encodeURI(word)
313		});
314	}
315}
316/*顶栏搜索*/
317$(document).on("click" , "#navbar_search_input_container" , function(){
318	$(this).addClass("open");
319	$("#navbar_search_input").focus();
320});
321$(document).on("blur" , "#navbar_search_input_container" , function(){
322	$(this).removeClass("open");
323});
324$(document).on("keydown" , "#navbar_search_input_container #navbar_search_input" , function(e){
325	if (e.keyCode != 13){
326		return;
327	}
328	let word = $(this).val();
329	if (word == ""){
330		$("#navbar_search_input_container").blur();
331		return;
332	}
333	let scrolltop = $(document).scrollTop();
334	searchPosts(word);
335});
336/*顶栏搜索 (Mobile)*/
337$(document).on("keydown" , "#navbar_search_input_mobile" , function(e){
338	if (e.keyCode != 13){
339		return;
340	}
341	let word = $(this).val();
342	$("#navbar_global .collapse-close button").click();
343	if (word == ""){
344		return;
345	}
346	let scrolltop = $(document).scrollTop();
347	searchPosts(word);
348});
349/*侧栏搜索*/
350$(document).on("click" , "#leftbar_search_container" , function(){
351	$(".leftbar-search-button").addClass("open");
352	$("#leftbar_search_input").removeAttr("readonly").focus();
353	$("#leftbar_search_input").focus();
354	$("#leftbar_search_input").select();
355	return false;
356});
357$(document).on("blur" , "#leftbar_search_container" , function(){
358	$(".leftbar-search-button").removeClass("open");
359	$("#leftbar_search_input").attr("readonly", "readonly");
360});
361$(document).on("keydown" , "#leftbar_search_input" , function(e){
362	if (e.keyCode != 13){
363		return;
364	}
365	let word = $(this).val();
366	if (word == ""){
367		$("#leftbar_search_container").blur();
368		return;
369	}
370	$("html").removeClass("leftbar-opened");
371	searchPosts(word);
372});
373/*搜索过滤器*/
374$(document).on("change" , ".search-filter" , function(e){
375	if (pjaxLoading){
376		$(this).prop("checked", !$(this).prop("checked"));
377		e.preventDefault();
378		return;
379	}
380	pjaxLoading = true;
381	let postTypes = [];
382	$(".search-filter:checked").each(function(){
383		postTypes.push($(this).attr("name"));
384	});
385	if (postTypes.length == 0){
386		postTypes = ["none"];
387	}
388	let url = new URL(document.location.href);
389	url.searchParams.set("post_type", postTypes.join(","));
390	url.pathname = url.pathname.replace(/\/page\/\d+$/, '');
391	$.pjax({
392		url: url.href
393	});
394});
395
396/*左侧栏随页面滚动浮动*/
397!function(){
398	if ($("#leftbar").length == 0){
399		let contentOffsetTop = $('#content').offset().top;
400		function changeLeftbarStickyStatusWithoutSidebar(){
401			let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
402			if( contentOffsetTop - 10 - scrollTop <= 20 ){
403				document.body.classList.add('leftbar-can-headroom');
404			}else{
405				document.body.classList.remove('leftbar-can-headroom');
406			}
407		}
408		changeLeftbarStickyStatusWithoutSidebar();
409		document.addEventListener("scroll", changeLeftbarStickyStatusWithoutSidebar, {passive: true});
410		$(window).resize(function(){
411			contentOffsetTop = $('#content').offset().top;
412			changeLeftbarStickyStatusWithoutSidebar();
413		});
414		return;
415	}
416	let $leftbarPart1 = $('#leftbar_part1');
417	let $leftbarPart2 = $('#leftbar_part2');
418	let leftbarPart1 = document.getElementById('leftbar_part1');
419	let leftbarPart2 = document.getElementById('leftbar_part2');
420
421	let part1OffsetTop = $('#leftbar_part1').offset().top;
422	let part1OuterHeight = $('#leftbar_part1').outerHeight();
423
424	function changeLeftbarStickyStatus(){
425		let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
426		if( part1OffsetTop + part1OuterHeight + 10 - scrollTop <= (argonConfig.headroom != "absolute" ? 90 : 18) ){
427			//滚动条在页面中间浮动状态
428			leftbarPart2.classList.add('sticky');
429		}else{
430			//滚动条在顶部 不浮动状态
431			leftbarPart2.classList.remove('sticky');
432		}
433		if( part1OffsetTop + part1OuterHeight + 10 - scrollTop <= 20 ){//侧栏下部分是否可以随 Headroom 一起向上移动
434			document.body.classList.add('leftbar-can-headroom');
435		}else{
436			document.body.classList.remove('leftbar-can-headroom');
437		}
438	}
439	changeLeftbarStickyStatus();
440	document.addEventListener("scroll", changeLeftbarStickyStatus, {passive: true});
441	$(window).resize(function(){
442		part1OffsetTop = $leftbarPart1.offset().top;
443		part1OuterHeight = $leftbarPart1.outerHeight();
444		changeLeftbarStickyStatus();
445	});
446	new MutationObserver(function(){
447		part1OffsetTop = $leftbarPart1.offset().top;
448		part1OuterHeight = $leftbarPart1.outerHeight();
449		changeLeftbarStickyStatus();
450	}).observe(leftbarPart1, {attributes: true, childList: true, subtree: true});
451}();
452
453/*Headroom*/
454if (argonConfig.headroom == "true"){
455	var headroom = new Headroom(document.querySelector("body"),{
456		"tolerance" : {
457			up : 0,
458			down : 0
459		},
460		"offset": 0,
461			"classes": {
462			"initial": "with-headroom",
463			"pinned": "headroom---pinned",
464			"unpinned": "headroom---unpinned",
465			"top": "headroom---top",
466			"notTop": "headroom---not-top",
467			"bottom": "headroom---bottom",
468			"notBottom": "headroom---not-bottom",
469			"frozen": "headroom---frozen"
470		}
471	}).init();
472}
473
474/*瀑布流布局*/
475function waterflowInit() {
476	if (argonConfig.waterflow_columns == "1") {
477		return;
478	}
479	$("#main.article-list img").each(function(index, ele){
480		ele.onload = function(){
481			waterflowInit();
482		}
483	});
484	let columns;
485	if (argonConfig.waterflow_columns == "2and3") {
486		if ($("#main").outerWidth() > 1000) {
487			columns = 3;
488		} else {
489			columns = 2;
490		}
491	}else{
492		columns = parseInt(argonConfig.waterflow_columns);
493	}
494	if ($("#main").outerWidth() < 650 && columns == 2) {
495		columns = 1;
496	}else if ($("#main").outerWidth() < 800 && columns == 3) {
497		columns = 1;
498	}
499
500	let heights = [0, 0, 0];
501	function getMinHeightPosition(){
502		let res = 0, minn = 2147483647;
503		for (var i = 0; i < columns; i++) {
504			if (heights[i] < minn) {
505				minn = heights[i];
506				res = i;
507			}
508		}
509		return res;
510	}
511	function getMaxHeight(){
512		let res = 0;
513		for (let i in heights) {
514			res = Math.max(res, heights[i]);
515		}
516		return res;
517	}
518	$("#primary").css("transition", "none")
519		.addClass("waterflow");
520	let $container = $("#main.article-list");
521	if (!$container.length){
522		return;
523	}
524	let $items = $container.find("article.post:not(.no-results), .shuoshuo-preview-container");
525	columns = Math.max(Math.min(columns, $items.length), 1);
526	if (columns == 1) {
527		$container.removeClass("waterflow");
528		$items.css("transition", "").css("position", "").css("width", "").css("top", "").css("left", "").css("margin", "");
529		$(".waterflow-placeholder").remove();
530	}else{
531		$container.addClass("waterflow");
532		$items.each(function(index, item) {
533			let $item = $(item);
534			$item.css("transition", "none")
535				.css("position", "absolute")
536				.css("width", "calc(" + (100 / columns) + "% - " + (10 * (columns - 1) / columns) + "px)").css("margin", 0);
537			let itemHeight = $item.outerHeight() + 10;
538			let pos = getMinHeightPosition();
539			$item.css("top", heights[getMinHeightPosition()] + "px")
540				.css("left", (pos * $item.outerWidth() + 10 * pos) + "px");
541			heights[pos] += itemHeight;
542		});
543	}
544	if ($(".waterflow-placeholder").length) {
545		$(".waterflow-placeholder").css("height", getMaxHeight() + "px");
546	}else{
547		$container.prepend("<div class='waterflow-placeholder' style='height: " + getMaxHeight() +"px;'></div>");
548	}
549}
550waterflowInit();
551if (argonConfig.waterflow_columns != "1") {
552	$(window).resize(function(){
553		waterflowInit();
554	});
555	new MutationObserver(function(mutations, observer){
556		waterflowInit();
557	}).observe(document.querySelector("#primary"), {
558		'childList': true
559	});
560}
561
562/*浮动按钮栏相关 (回顶等)*/
563!function(){
564	let $fabtns = $('#float_action_buttons');
565	let $backToTopBtn = $('#fabtn_back_to_top');
566	let $toggleSidesBtn = $('#fabtn_toggle_sides');
567	let $toggleDarkmode = $('#fabtn_toggle_darkmode');
568	let $toggleAmoledMode = $('#blog_setting_toggle_darkmode_and_amoledarkmode');
569	let $toggleBlogSettings = $('#fabtn_toggle_blog_settings_popup');
570	let $goToComment = $('#fabtn_go_to_comment');
571
572	let $readingProgressBtn = $('#fabtn_reading_progress');
573	let $readingProgressBar = $('#fabtn_reading_progress_bar');
574	let $readingProgressDetails = $('#fabtn_reading_progress_details');
575
576	$backToTopBtn.on("click" , function(){
577		$("body,html").stop().animate({
578			scrollTop: 0
579		}, 800, 'easeOutExpo');
580	});
581
582	$toggleDarkmode.on("click" , function(){
583		toggleDarkmode();
584	});
585
586	$toggleAmoledMode.on("click" , function(){
587		toggleAmoledDarkMode();
588	})
589
590	if ($("#post_comment").length > 0){
591		$("#fabtn_go_to_comment").removeClass("d-none");
592	}else{
593		$("#fabtn_go_to_comment").addClass("d-none");
594	}
595	$goToComment.on("click" , function(){
596		gotoHash("#post_comment" , 600);
597		$("#post_comment_content").focus();
598	});
599
600	if (localStorage['Argon_fabs_Floating_Status'] == "left"){
601		$fabtns.addClass("fabtns-float-left");
602	}
603	$toggleSidesBtn.on("click" , function(){
604		$fabtns.addClass("fabtns-unloaded");
605		setTimeout(function(){
606			$fabtns.toggleClass("fabtns-float-left");
607			if ($fabtns.hasClass("fabtns-float-left")){
608				localStorage['Argon_fabs_Floating_Status'] = "left";
609			}else{
610				localStorage['Argon_fabs_Floating_Status'] = "right";
611			}
612			$fabtns.removeClass("fabtns-unloaded");
613		} , 300);
614	});
615	//博客设置
616	$toggleBlogSettings.on("click" , function(){
617		$("#float_action_buttons").toggleClass("blog_settings_opened");
618	});
619	$("#close_blog_settings").on("click" , function(){
620		$("#float_action_buttons").removeClass("blog_settings_opened");
621	});
622	$("#blog_setting_darkmode_switch .custom-toggle-slider").on("click" , function(){
623		toggleDarkmode();
624	});
625	//字体
626	$("#blog_setting_font_sans_serif").on("click" , function(){
627		$("html").removeClass("use-serif");
628		localStorage['Argon_Use_Serif'] = "false";
629	});
630	$("#blog_setting_font_serif").on("click" , function(){
631		$("html").addClass("use-serif");
632		localStorage['Argon_Use_Serif'] = "true";
633	});
634	if (localStorage['Argon_Use_Serif'] == "true"){
635		$("html").addClass("use-serif");
636	}else if (localStorage['Argon_Use_Serif'] == "false"){
637		$("html").removeClass("use-serif");
638	}
639	//阴影
640	$("#blog_setting_shadow_small").on("click" , function(){
641		$("html").removeClass("use-big-shadow");
642		localStorage['Argon_Use_Big_Shadow'] = "false";
643	});
644	$("#blog_setting_shadow_big").on("click" , function(){
645		$("html").addClass("use-big-shadow");
646		localStorage['Argon_Use_Big_Shadow'] = "true";
647	});
648	if (localStorage['Argon_Use_Big_Shadow'] == "true"){
649		$("html").addClass("use-big-shadow");
650	}else if (localStorage['Argon_Use_Big_Shadow'] == "false"){
651		$("html").removeClass("use-big-shadow");
652	}
653	//滤镜
654	function setBlogFilter(name){
655		if (name == undefined || name == ""){
656			name = "off";
657		}
658		if (!$("html").hasClass("filter-" + name)){
659			$("html").removeClass("filter-sunset filter-darkness filter-grayscale");
660			if (name != "off"){
661				$("html").addClass("filter-" + name);
662			}
663		}
664		$("#blog_setting_filters .blog-setting-filter-btn").removeClass("active");
665		$("#blog_setting_filters .blog-setting-filter-btn[filter-name='" + name + "']").addClass("active");
666		localStorage['Argon_Filter'] = name;
667	}
668	setBlogFilter(localStorage['Argon_Filter']);
669	$(".blog-setting-filter-btn").on("click" , function(){
670		setBlogFilter(this.getAttribute("filter-name"));
671	});
672
673	let $window = $(window);
674
675	function changefabtnDisplayStatus(){
676		//阅读进度
677		function hideReadingProgress(){
678			$readingProgressBtn.addClass("fabtn-hidden");
679		}
680		function setReadingProgress(percent){
681			$readingProgressBtn.removeClass("fabtn-hidden");
682			$readingProgressDetails.html((percent * 100).toFixed(0) + "%");
683			$readingProgressBar.css("width" , (percent * 100).toFixed(0) + "%");
684		}
685		if ($("article.post.post-full").length == 0){
686			hideReadingProgress();
687		}else{
688			let a = $window.scrollTop() - ($("article.post.post-full").offset().top - 80);
689			let b = $("article.post.post-full").outerHeight() + 50 - $window.height();
690			if (b <= 0){
691				hideReadingProgress();
692			}else{
693				readingProgress = a / b;
694				if (isNaN(readingProgress) || readingProgress < 0 || readingProgress > 1){
695					hideReadingProgress();
696				}else{
697					setReadingProgress(readingProgress);
698				}
699			}
700		}
701		//是否显示回顶
702		if ($(window).scrollTop() >= 400){
703			$backToTopBtn.removeClass("fabtn-hidden");
704		}else{
705			$backToTopBtn.addClass("fabtn-hidden");
706		}
707	}
708	changefabtnDisplayStatus();
709	$(window).scroll(function(){
710		changefabtnDisplayStatus();
711	});
712	$(window).resize(function(){
713		changefabtnDisplayStatus();
714	});
715	$fabtns.removeClass("fabtns-unloaded");
716}();
717
718/*卡片圆角大小调整*/
719!function(){
720	function setCardRadius(radius, setcookie){
721		document.documentElement.style.setProperty('--card-radius', radius + "px");
722		if (setcookie){
723			setCookie("argon_card_radius", radius, 365);
724		}
725	}
726	let slider = document.getElementById('blog_setting_card_radius');
727	noUiSlider.create(slider, {
728		start: [$("meta[name='theme-card-radius']").attr("content")],
729		step: 0.5,
730		connect: [true, false],
731		range: {
732			'min': [0],
733			'max': [30]
734		}
735	});
736	slider.noUiSlider.on('update', function (values){
737		let value = values[0];
738		setCardRadius(value, false);
739	});
740	slider.noUiSlider.on('set', function (values){
741		let value = values[0];
742		setCardRadius(value, true);
743	});
744	$(document).on("click" , "#blog_setting_card_radius_to_default" , function(){
745		slider.noUiSlider.set($("meta[name='theme-card-radius-origin']").attr("content"));
746		setCardRadius($("meta[name='theme-card-radius-origin']").attr("content"), false);
747		setCookie("argon_card_radius", $("meta[name='theme-card-radius-origin']").attr("content"), 0);
748	});
749}();
750
751/*评论区 & 发送评论*/
752!function(){
753	//回复评论
754	let replying = false , replyID = 0;
755	function reply(commentID){
756		cancelEdit(false);
757		replying = true;
758		replyID = commentID;
759		$("#post_comment_reply_name").html($("#comment-" + commentID + " .comment-item-title > .comment-name")[0].innerHTML);
760		let preview = $("#comment-" + commentID + " .comment-item-text")[0].innerHTML;
761		if ($("#comment-" + commentID + " .comment-item-source")[0].innerHTML != ''){
762			preview = $("#comment-" + commentID + " .comment-item-source")[0].innerHTML.replace(/\n/g, "</br>");
763		}
764		$("#post_comment_reply_preview").html(preview);
765		if ($("#comment-" + commentID + " .comment-item-title .badge-private-comment").length > 0){
766			$("#post_comment").addClass("post-comment-force-privatemode-on");
767		}else{
768			$("#post_comment").addClass("post-comment-force-privatemode-off");
769		}
770		$("body,html").animate({
771			scrollTop: $('#post_comment').offset().top - 100
772		}, 500, 'easeOutCirc');
773		$('#post_comment_reply_info').slideDown(500, 'easeOutCirc');
774		setTimeout(function(){
775			$("#post_comment_content").focus();
776		}, 500);
777	}
778	function cancelReply(){
779		replying = false;
780		replyID = 0;
781		$('#post_comment_reply_info').slideUp(300, 'easeOutCirc');
782		$("#post_comment").removeClass("post-comment-force-privatemode-on post-comment-force-privatemode-off");
783	}
784	$(document).on("click" , ".comment-reply" , function(){
785		reply(this.getAttribute("data-id"));
786	});
787	$(document).on("click pjax:click" , "#post_comment_reply_cancel" , function(){
788		cancelReply();
789	});
790	$(document).on("pjax:click" , function(){
791		replying = false;
792		replyID = 0;
793		$('#post_comment_reply_info').css("display", "none");
794		$("#post_comment").removeClass("post-comment-force-privatemode-on post-comment-force-privatemode-off");
795	});
796	//编辑评论
797	let editing = false , editID = 0;
798	function edit(commentID){
799		cancelReply();
800		editing = true;
801		editID = commentID;
802		$('#post_comment').addClass("editing");
803		$("#post_comment_content").val($("#comment-" + editID + " .comment-item-source").text());
804		$("#post_comment_content").trigger("change");
805		if ($("#comment-" + editID).data("use-markdown") == true && document.getElementById("comment_post_use_markdown") != null){
806			document.getElementById("comment_post_use_markdown").checked = true;
807		}else{
808			document.getElementById("comment_post_use_markdown").checked = false;
809		}
810		if ($("#comment-" + commentID + " .comment-item-title .badge-private-comment").length > 0){
811			$("#post_comment").addClass("post-comment-force-privatemode-on");
812		}else{
813			$("#post_comment").addClass("post-comment-force-privatemode-off");
814		}
815		$("body,html").animate({
816			scrollTop: $('#post_comment').offset().top - 100
817		}, 500, 'easeOutCirc');
818		$("#post_comment_content").focus();
819	}
820	function cancelEdit(clear){
821		editing = false;
822		editID = 0;
823		$("#post_comment").removeClass("post-comment-force-privatemode-on post-comment-force-privatemode-off");
824		if (clear == true) $("#post_comment_content").val("");
825		$("#post_comment_content").trigger("change");
826		$('#post_comment').removeClass("editing");
827	}
828	$(document).on("click", ".comment-edit", function(){
829		edit(this.getAttribute("data-id"));
830	});
831	$(document).on("click", "#post_comment_edit_cancel", function(){
832		$("body,html").animate({
833			scrollTop: $("#comment-" + editID).offset().top - 100
834		}, 400, 'easeOutCirc');
835		cancelEdit(true);
836	});
837	$(document).on("pjax:click", function(){
838		cancelEdit(true);
839	});
840	$(document).on("click", ".comment-pin, .comment-unpin", function(){
841		toogleCommentPin(this.getAttribute("data-id"), !this.classList.contains("comment-pin"));
842	});
843	$(document).on("mouseenter", ".comment-parent-info", function(){
844		$("#comment-" + this.getAttribute("data-parent-id")).addClass("highlight");
845	});
846	$(document).on("mouseleave", ".comment-parent-info", function(){
847		$("#comment-" + this.getAttribute("data-parent-id")).removeClass("highlight");
848	});
849	//切换评论置顶状态
850	function toogleCommentPin(commentID, pinned){
851		$("#comment_pin_comfirm_dialog .modal-title").html(pinned ? __("取消置顶评论") : __("置顶评论"));
852		$("#comment_pin_comfirm_dialog .modal-body").html(pinned ? __("是否要取消置顶评论 #") + commentID + "?" : __("是否要置顶评论 #") + commentID + "?");
853		$("#comment_pin_comfirm_dialog .btn-comfirm").html(__("确认")).attr("disabled", false);
854		$("#comment_pin_comfirm_dialog .btn-dismiss").html(__("取消")).attr("disabled", false);
855		$("#comment_pin_comfirm_dialog .btn-comfirm").off("click").on("click", function(){
856			$("#comment_pin_comfirm_dialog .btn-dismiss").attr("disabled", true)
857			$("#comment_pin_comfirm_dialog .btn-comfirm").attr("disabled", true).prepend(__(`<span class="btn-inner--icon" style="margin-right: 10px;"><i class="fa fa-spinner fa-spin"></i></span>`));
858			$.ajax({
859				type: 'POST',
860				url: argonConfig.wp_path + "wp-admin/admin-ajax.php",
861				dataType : "json",
862				data: {
863					action: "pin_comment",
864					id: commentID,
865					pinned: pinned ? "false" : "true"
866				},
867				success: function(result){
868					$("#comment_pin_comfirm_dialog").modal('hide');
869					if (result.status == "success"){
870						if (pinned){
871							$("#comment-" + commentID + " .comment-name .badge-pinned").remove();
872							$("#comment-" + commentID + " .comment-unpin").removeClass("comment-unpin").addClass("comment-pin").html(__("置顶"));
873						}else{
874							$("#comment-" + commentID + " .comment-name").append(`<span class="badge badge-danger badge-pinned">${__("置顶")}</span>`);
875							$("#comment-" + commentID + " .comment-pin").removeClass("comment-pin").addClass("comment-unpin").html(__("取消置顶"));
876						}
877						iziToast.show({
878							title: pinned ? __("取消置顶成功") : __("置顶成功"),
879							message: pinned ? __("该评论已取消置顶") : __("该评论已置顶"),
880							class: 'shadow-sm',
881							position: 'topRight',
882							backgroundColor: '#2dce89',
883							titleColor: '#ffffff',
884							messageColor: '#ffffff',
885							iconColor: '#ffffff',
886							progressBarColor: '#ffffff',
887							icon: 'fa fa-check',
888							timeout: 5000
889						});
890					} else {
891						iziToast.show({
892							title: pinned ? __("取消置顶失败") : __("置顶失败"),
893							message: result.msg,
894							class: 'shadow-sm',
895							position: 'topRight',
896							backgroundColor: '#f5365c',
897							titleColor: '#ffffff',
898							messageColor: '#ffffff',
899							iconColor: '#ffffff',
900							progressBarColor: '#ffffff',
901							icon: 'fa fa-close',
902							timeout: 5000
903						});
904					}
905				},
906				error: function(result){
907					$("#comment_pin_comfirm_dialog").modal('hide');
908					iziToast.show({
909						title: pinned ? __("取消置顶失败") : __("置顶失败"),
910						message: __("未知错误"),
911						class: 'shadow-sm',
912						position: 'topRight',
913						backgroundColor: '#f5365c',
914						titleColor: '#ffffff',
915						messageColor: '#ffffff',
916						iconColor: '#ffffff',
917						progressBarColor: '#ffffff',
918						icon: 'fa fa-close',
919						timeout: 5000
920					});
921				}
922			});
923		});
924		$("#comment_pin_comfirm_dialog").modal(null);
925	}
926		
927
928	//显示/隐藏额外输入框 (评论者网站)
929	$(document).on("click" , "#post_comment_toggle_extra_input" , function(){
930		$("#post_comment").toggleClass("show-extra-input");
931		if ($("#post_comment").hasClass("show-extra-input")){
932			$("#post_comment_extra_input").slideDown(300, 'easeOutCirc');
933		}else{
934			$("#post_comment_extra_input").slideUp(300, 'easeOutCirc');
935		}
936	});
937
938	//输入框细节
939	$(document).on("change input keydown keyup propertychange" , "#post_comment_content" , function(){
940		$("#post_comment_content_hidden")[0].innerText = $("#post_comment_content").val() + "\n";
941		$("#post_comment_content").css("height" , $("#post_comment_content_hidden").outerHeight());
942	});
943	$(document).on("focus" , "#post_comment_link" , function(){
944		$(".post-comment-link-container").addClass("active");
945	});
946	$(document).on("blur" , "#post_comment_link" , function(){
947		$(".post-comment-link-container").removeClass("active");
948	});
949	$(document).on("focus" , "#post_comment_captcha" , function(){
950		$(".post-comment-captcha-container").addClass("active");
951	});
952	$(document).on("blur" , "#post_comment_captcha" , function(){
953		$(".post-comment-captcha-container").removeClass("active");
954	});
955
956	//发送评论
957	function postComment(){
958		let commentContent = $("#post_comment_content").val();
959		let commentName = $("#post_comment_name").val();
960		let commentEmail = $("#post_comment_email").val();
961		let commentLink = $("#post_comment_link").val();
962		let commentCaptcha = $("#post_comment_captcha").val();
963		let useMarkdown = false;
964		let privateMode = false;
965		let mailNotice = false;
966		if ($("#comment_post_use_markdown").length > 0){
967			useMarkdown = $("#comment_post_use_markdown")[0].checked;
968		}
969		if ($("#comment_post_privatemode").length > 0){
970			privateMode = $("#comment_post_privatemode")[0].checked;
971		}
972		if ($("#comment_post_mailnotice").length > 0){
973			mailNotice = $("#comment_post_mailnotice")[0].checked;
974		}
975
976		let postID = $("#post_comment_post_id").val();
977		let commentCaptchaSeed = $("#post_comment_captcha_seed").val();
978
979		let isError = false;
980		let errorMsg = "";
981
982		//检查表单合法性
983		if (commentContent.match(/^\s*$/)){
984			isError = true;
985			errorMsg += __("评论内容不能为空") + "</br>";
986		}
987		if (!$("#post_comment").hasClass("no-need-name-email")){
988			if (commentName.match(/^\s*$/)){
989				isError = true;
990				errorMsg += __("昵称不能为空") + "</br>";
991			}
992			if ($("#post_comment").hasClass("enable-qq-avatar")){
993				if (!(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(commentEmail) && !(/^[1-9][0-9]{4,10}$/).test(commentEmail)){
994					isError = true;
995					errorMsg += __("邮箱或 QQ 号格式错误") + "</br>";
996				}
997			}else{
998				if (!(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(commentEmail)){
999					isError = true;
1000					errorMsg += __("邮箱格式错误") + "</br>";
1001				}
1002			}
1003		}else{
1004			if (commentEmail.length || (document.getElementById("comment_post_mailnotice") != null && document.getElementById("comment_post_mailnotice").checked == true)){
1005				if ($("#post_comment").hasClass("enable-qq-avatar")){
1006					if (!(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(commentEmail) && !(/^[1-9][0-9]{4,10}$/).test(commentEmail)){
1007						isError = true;
1008						errorMsg += __("邮箱或 QQ 号格式错误") + "</br>";
1009					}
1010				}else{
1011					if (!(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(commentEmail)){
1012						isError = true;
1013						errorMsg += __("邮箱格式错误") + "</br>";
1014					}
1015				}
1016			}
1017		}
1018		if (commentLink != "" && !(/https?:\/\//).test(commentLink)){
1019			isError = true;
1020			errorMsg += __("网站格式错误 (不是 http(s):// 开头)") + "</br>";
1021		}
1022		if (!$("#post_comment").hasClass("no-need-captcha")){
1023			if (commentCaptcha == ""){
1024				isError = true;
1025				errorMsg += __("验证码未输入");
1026			}
1027			if (commentCaptcha != "" && !(/^[0-9]+$/).test(commentCaptcha)){
1028				isError = true;
1029				errorMsg += __("验证码格式错误");
1030			}
1031		}
1032		if (isError){
1033			iziToast.show({
1034				title: __("评论格式错误"),
1035				message: errorMsg,
1036				class: 'shadow-sm',
1037				position: 'topRight',
1038				backgroundColor: '#f5365c',
1039				titleColor: '#ffffff',
1040				messageColor: '#ffffff',
1041				iconColor: '#ffffff',
1042				progressBarColor: '#ffffff',
1043				icon: 'fa fa-close',
1044				timeout: 5000
1045			});
1046			return;
1047		}
1048
1049		//增加 disabled 属性和其他的表单提示
1050		$("#post_comment").addClass("sending");
1051		$("#post_comment_content").attr("disabled","disabled");
1052		$("#post_comment_name").attr("disabled","disabled");
1053		$("#post_comment_email").attr("disabled","disabled");
1054		$("#post_comment_captcha").attr("disabled","disabled");
1055		$("#post_comment_link").attr("disabled","disabled");
1056		$("#post_comment_send").attr("disabled","disabled");
1057		$("#post_comment_reply_cancel").attr("disabled","disabled");
1058		$("#post_comment_send .btn-inner--icon.hide-on-comment-editing").html("<i class='fa fa-spinner fa-spin'></i>");
1059		$("#post_comment_send .btn-inner--text.hide-on-comment-editing").html(__("发送中"));
1060
1061		iziToast.show({
1062			title: __("正在发送"),
1063			message: __("评论正在发送中..."),
1064			class: 'shadow-sm iziToast-noprogressbar',
1065			position: 'topRight',
1066			backgroundColor: 'var(--themecolor)',
1067			titleColor: '#ffffff',
1068			messageColor: '#ffffff',
1069			iconColor: '#ffffff',
1070			progressBarColor: '#ffffff',
1071			icon: 'fa fa-spinner fa-spin',
1072			close: false,
1073			timeout: 999999999
1074		});
1075
1076		$.ajax({
1077			type: 'POST',
1078			url: argonConfig.wp_path + "wp-admin/admin-ajax.php",
1079			dataType : "json",
1080			data: {
1081				action: "ajax_post_comment",
1082				comment: commentContent,
1083				author: commentName,
1084				email: commentEmail,
1085				url: commentLink,
1086				comment_post_ID: postID,
1087				comment_parent: replyID,
1088				comment_captcha_seed: commentCaptchaSeed,
1089				comment_captcha: commentCaptcha,
1090				"wp-comment-cookies-consent": "yes",
1091				use_markdown: useMarkdown,
1092				private_mode: privateMode,
1093				enable_mailnotice: mailNotice
1094			},
1095			success: function(result){
1096				$("#post_comment").removeClass("sending");
1097				$("#post_comment_content").removeAttr("disabled");
1098				$("#post_comment_name").removeAttr("disabled");
1099				$("#post_comment_email").removeAttr("disabled");
1100				$("#post_comment_link").removeAttr("disabled");
1101				$("#post_comment_send").removeAttr("disabled");
1102				$("#post_comment_reply_cancel").removeAttr("disabled");
1103				$("#post_comment_send .btn-inner--icon.hide-on-comment-editing").html("<i class='fa fa-send'></i>");
1104				$("#post_comment_send .btn-inner--text.hide-on-comment-editing").html(__("发送"));
1105				$("#post_comment").removeClass("show-extra-input post-comment-force-privatemode-on post-comment-force-privatemode-off");
1106				if (!result.isAdmin){
1107					$("#post_comment_captcha").removeAttr("disabled");
1108				}
1109
1110				//判断是否有错误
1111				if (result.status == "failed"){
1112					iziToast.destroy();
1113					iziToast.show({
1114						title: __("评论发送失败"),
1115						message: result.msg,
1116						class: 'shadow-sm',
1117						position: 'topRight',
1118						backgroundColor: '#f5365c',
1119						titleColor: '#ffffff',
1120						messageColor: '#ffffff',
1121						iconColor: '#ffffff',
1122						progressBarColor: '#ffffff',
1123						icon: 'fa fa-close',
1124						timeout: 5000
1125					});
1126					return;
1127				}
1128
1129				//发送成功
1130				iziToast.destroy();
1131				iziToast.show({
1132					title: __("发送成功"),
1133					message: __("您的评论已发送"),
1134					class: 'shadow-sm',
1135					position: 'topRight',
1136					backgroundColor: '#2dce89',
1137					titleColor: '#ffffff',
1138					messageColor: '#ffffff',
1139					iconColor: '#ffffff',
1140					progressBarColor: '#ffffff',
1141					icon: 'fa fa-check',
1142					timeout: 5000
1143				});
1144				//插入新评论
1145				result.html = result.html.replace(/<img class='comment-sticker lazyload'(.*?)\/>/g, "").replace(/<(\/).noscript>/g, "");
1146				let parentID = result.parentID;
1147				if (parentID == "" || parentID == null){
1148					parentID = 0;
1149				}
1150				parentID = parseInt(parentID);
1151				if (parentID == 0){
1152					if ($("#comments > .card-body > ol.comment-list").length == 0){
1153						$("#comments > .card-body").html("<h2 class='comments-title'><i class='fa fa-comments'></i> " + __("评论") + "</h2><ol class='comment-list'></ol>");
1154					}
1155					if (result.commentOrder == "asc"){
1156						$("#comments > .card-body > ol.comment-list").append(result.html);
1157					}else{
1158						$("#comments > .card-body > ol.comment-list").prepend(result.html);
1159					}
1160				}else{
1161					if ($("#comment-" + parentID + " + .comment-divider + li > ul.children").length > 0){
1162						$("#comment-" + parentID + " + .comment-divider + li > ul.children").append(result.html);
1163					}else{
1164						$("#comment-" + parentID + " + .comment-divider").after("<li><ul class='children'>" + result.html + "</ul></li>");
1165					}
1166				}
1167				calcHumanTimesOnPage();
1168				//复位评论表单
1169				cancelReply();
1170				$("#post_comment_content").val("");
1171				$("#post_comment_captcha_seed").val(result.newCaptchaSeed);
1172				$("#post_comment_captcha + style").html(".post-comment-captcha-container:before{content: '" + result.newCaptcha + "';}");
1173				$("#post_comment_captcha").val(result.newCaptchaAnswer);
1174				$("body,html").animate({
1175					scrollTop: $("#comment-" + result.id).offset().top - 100
1176				}, 500, 'easeOutExpo');
1177			},
1178			error: function(result){
1179				$("#post_comment").removeClass("sending");
1180				$("#post_comment_content").removeAttr("disabled");
1181				$("#post_comment_name").removeAttr("disabled");
1182				$("#post_comment_email").removeAttr("disabled");
1183				$("#post_comment_link").removeAttr("disabled");
1184				$("#post_comment_send").removeAttr("disabled");
1185				$("#post_comment_reply_cancel").removeAttr("disabled");
1186				$("#post_comment_send .btn-inner--icon.hide-on-comment-editing").html("<i class='fa fa-send'></i>");
1187				$("#post_comment_send .btn-inner--text.hide-on-comment-editing").html(__("发送"));
1188				$("#post_comment").removeClass("show-extra-input post-comment-force-privatemode-on post-comment-force-privatemode-off");
1189				if (!result.isAdmin){
1190					$("#post_comment_captcha").removeAttr("disabled");
1191				}
1192
1193				iziToast.destroy();
1194				iziToast.show({
1195					title: __("评论发送失败"),
1196					message: __("未知原因"),
1197					class: 'shadow-sm',
1198					position: 'topRight',
1199					backgroundColor: '#f5365c',
1200					titleColor: '#ffffff',
1201					messageColor: '#ffffff',
1202					iconColor: '#ffffff',
1203					progressBarColor: '#ffffff',
1204					icon: 'fa fa-close',
1205					timeout: 5000
1206				});
1207				return;
1208			}
1209		});
1210	}
1211	//编辑评论
1212	function editComment(){
1213		let commentContent = $("#post_comment_content").val();
1214		let isError = false;
1215		let errorMsg = "";
1216		if (commentContent.match(/^\s*$/)){
1217			isError = true;
1218			errorMsg += __("评论内容不能为空") + "</br>";
1219		}
1220		if (isError){
1221			iziToast.show({
1222				title: __("评论格式错误"),
1223				message: errorMsg,
1224				class: 'shadow-sm',
1225				position: 'topRight',
1226				backgroundColor: '#f5365c',
1227				titleColor: '#ffffff',
1228				messageColor: '#ffffff',
1229				iconColor: '#ffffff',
1230				progressBarColor: '#ffffff',
1231				icon: 'fa fa-close',
1232				timeout: 5000
1233			});
1234			return;
1235		}
1236
1237		//增加 disabled 属性和其他的表单提示
1238		$("#post_comment_content").attr("disabled","disabled");
1239		$("#post_comment_send").attr("disabled","disabled");
1240		$("#post_comment_edit_cancel").attr("disabled","disabled");
1241		$("#post_comment_send .btn-inner--icon.hide-on-comment-not-editing").html("<i class='fa fa-spinner fa-spin'></i>");
1242		$("#post_comment_send .btn-inner--text.hide-on-comment-not-editing").html(__("编辑中"));
1243
1244		iziToast.show({
1245			title: __("正在编辑"),
1246			message: __("评论正在编辑中..."),
1247			class: 'shadow-sm iziToast-noprogressbar',
1248			position: 'topRight',
1249			backgroundColor: 'var(--themecolor)',
1250			titleColor: '#ffffff',
1251			messageColor: '#ffffff',
1252			iconColor: '#ffffff',
1253			progressBarColor: '#ffffff',
1254			icon: 'fa fa-spinner fa-spin',
1255			close: false,
1256			timeout: 999999999
1257		});
1258
1259		$.ajax({
1260			type: 'POST',
1261			url: argonConfig.wp_path + "wp-admin/admin-ajax.php",
1262			dataType : "json",
1263			data: {
1264				action: "user_edit_comment",
1265				comment: commentContent,
1266				id: editID
1267			},
1268			success: function(result){
1269				$("#post_comment_content").removeAttr("disabled");
1270				$("#post_comment_send").removeAttr("disabled");
1271				$("#post_comment_edit_cancel").removeAttr("disabled");
1272				$("#post_comment_send .btn-inner--icon.hide-on-comment-not-editing").html("<i class='fa fa-pencil'></i>");
1273				$("#post_comment_send .btn-inner--text.hide-on-comment-not-editing").html(__("编辑"));
1274
1275				//判断是否有错误
1276				if (result.status == "failed"){
1277					iziToast.destroy();
1278					iziToast.show({
1279						title: __("评论编辑失败"),
1280						message: result.msg,
1281						class: 'shadow-sm',
1282						position: 'topRight',
1283						backgroundColor: '#f5365c',
1284						titleColor: '#ffffff',
1285						messageColor: '#ffffff',
1286						iconColor: '#ffffff',
1287						progressBarColor: '#ffffff',
1288						icon: 'fa fa-close',
1289						timeout: 5000
1290					});
1291					return;
1292				}
1293
1294				//发送成功,替换原评论
1295				result.new_comment = result.new_comment.replace(/<img class='comment-sticker lazyload'(.*?)\/>/g, "").replace(/<(\/).noscript>/g, "");		
1296				$("#comment-" + editID + " .comment-item-text").html(result.new_comment);
1297				$("#comment-" + editID + " .comment-item-source").html(result.new_comment_source);
1298				if ($("#comment-" + editID + " .comment-info .comment-edited").length == 0){
1299					$("#comment-" + editID + " .comment-info").prepend("<div class='comment-edited'><i class='fa fa-pencil' aria-hidden='true'></i>" + __("已编辑") + "</div>")
1300				}
1301				if (result.can_visit_edit_history){
1302					$("#comment-" + editID + " .comment-info .comment-edited").addClass("comment-edithistory-accessible");
1303				}
1304
1305				iziToast.destroy();
1306				iziToast.show({
1307					title: __("编辑成功"),
1308					message: __("您的评论已编辑"),
1309					class: 'shadow-sm',
1310					position: 'topRight',
1311					backgroundColor: '#2dce89',
1312					titleColor: '#ffffff',
1313					messageColor: '#ffffff',
1314					iconColor: '#ffffff',
1315					progressBarColor: '#ffffff',
1316					icon: 'fa fa-check',
1317					timeout: 5000
1318				});
1319				$("body,html").animate({
1320					scrollTop: $("#comment-" + editID).offset().top - 100
1321				}, 500, 'easeOutExpo');
1322				editing = false;
1323				editID = 0;
1324				$("#post_comment_content").val("");
1325				$('#post_comment').removeClass("editing post-comment-force-privatemode-on post-comment-force-privatemode-off");
1326				$("#post_comment_content").trigger("change");
1327			},
1328			error: function(result){
1329				$("#post_comment_content").removeAttr("disabled");
1330				$("#post_comment_send").removeAttr("disabled");
1331				$("#post_comment_edit_cancel").removeAttr("disabled");
1332				$("#post_comment_send .btn-inner--icon.hide-on-comment-not-editing").html("<i class='fa fa-pencil'></i>");
1333				$("#post_comment_send .btn-inner--text.hide-on-comment-not-editing").html(__("编辑"));
1334				if (result.readyState != 4 || result.status == 0){
1335					iziToast.destroy();
1336					iziToast.show({
1337						title: __("评论编辑失败"),
1338						message: __("未知原因"),
1339						class: 'shadow-sm',
1340						position: 'topRight',
1341						backgroundColor: '#f5365c',
1342						titleColor: '#ffffff',
1343						messageColor: '#ffffff',
1344						iconColor: '#ffffff',
1345						progressBarColor: '#ffffff',
1346						icon: 'fa fa-close',
1347						timeout: 5000
1348					});
1349					return;
1350				}
1351			}
1352		});
1353	}
1354	$(document).on("click" , "#post_comment_send" , function(){
1355		if ($("#post_comment").hasClass("editing")){
1356			editComment();
1357		}else{
1358			postComment();
1359		}
1360	});
1361}();
1362/*评论点赞*/
1363$(document).on("click" , ".comment-upvote" , function(){
1364	$this = $(this);
1365	ID = $this.attr("data-id");
1366	$this.addClass("comment-upvoting");
1367	$.ajax({
1368		url : argonConfig.wp_path + "wp-admin/admin-ajax.php",
1369		type : "POST",
1370		dataType : "json",
1371		data : {
1372			action: "upvote_comment",
1373			comment_id : ID,
1374		},
1375		success : function(result){
1376			$this.removeClass("comment-upvoting");
1377			if (result.status == "success"){
1378				$(".comment-upvote-num" , $this).html(result.total_upvote);
1379				$this.addClass("upvoted");
1380			}else{
1381				$(".comment-upvote-num" , $this).html(result.total_upvote);
1382				iziToast.show({
1383					title: result.msg,
1384					class: 'shadow-sm',
1385					position: 'topRight',
1386					backgroundColor: '#f5365c',
1387					titleColor: '#ffffff',
1388					messageColor: '#ffffff',
1389					iconColor: '#ffffff',
1390					progressBarColor: '#ffffff',
1391					icon: 'fa fa-close',
1392					timeout: 5000
1393				});
1394			}
1395		},
1396		error : function(xhr){
1397			$this.removeClass("comment-upvoting");
1398			iziToast.show({
1399				title: __("点赞失败"),
1400				class: 'shadow-sm',
1401				position: 'topRight',
1402				backgroundColor: '#f5365c',
1403				titleColor: '#ffffff',
1404				messageColor: '#ffffff',
1405				iconColor: '#ffffff',
1406				progressBarColor: '#ffffff',
1407				icon: 'fa fa-close',
1408				timeout: 5000
1409			});
1410		}
1411	});
1412});
1413/*评论表情面板*/
1414function lazyloadStickers(){
1415	$(".emotion-keyboard .emotion-group:not(d-none) .emotion-item > img.lazyload").lazyload({threshold: 500, effect: "fadeIn"}).removeClass("lazyload");
1416	$("html").trigger("scroll");
1417}
1418$(document).on("click" , "#comment_emotion_btn" , function(){
1419	$("#comment_emotion_btn").toggleClass("comment-emotion-keyboard-open");
1420	lazyloadStickers();
1421});
1422$(document).on("click" , ".emotion-keyboard .emotion-group-name" , function(){
1423	$(".emotion-keyboard .emotion-group-name.active").removeClass("active");
1424	$(this).addClass("active");
1425	$(".emotion-keyboard .emotion-group:not(d-none)").addClass("d-none");
1426	$(".emotion-keyboard .emotion-group[index='" + $(this).attr("index") + "']").removeClass("d-none");
1427	lazyloadStickers();
1428});
1429function inputInsertText(text, input){
1430	$(input).focus();
1431	let isSuccess = document.execCommand("insertText", false, text);
1432	if (!isSuccess) { //FF
1433		if (typeof input.setRangeText === "function"){
1434			const start = input.selectionStart;
1435			input.setRangeText(text);
1436			input.selectionStart = input.selectionEnd = start + input.length;
1437			const e = document.createEvent("UIEvent");
1438			e.initEvent("input", true, false);
1439			input.dispatchEvent(e);
1440		}else{
1441			let value = $(input).val();
1442			let startPos = input.selectionStart, endPos = input.selectionEnd;
1443			$(input).val(value.substring(0, startPos) + text + value.substring(endPos));
1444			input.selectionStart = startPos + text.length;
1445			input.selectionEnd = startPos + text.length;
1446		}
1447	}
1448	$(input).focus();
1449}
1450$(document).on("click" , ".emotion-keyboard .emotion-item" , function(){
1451	$("#comment_emotion_btn").removeClass("comment-emotion-keyboard-open");
1452	if ($(this).hasClass("emotion-item-sticker")){
1453		inputInsertText(" :" + $(this).attr("code") + ": ", document.getElementById("post_comment_content"));
1454	}else{
1455		inputInsertText($(this).attr("text"), document.getElementById("post_comment_content"));
1456	}
1457});
1458$(document).on("dragstart" , ".emotion-keyboard .emotion-item > img, .comment-sticker" , function(e){
1459	e.preventDefault();
1460});
1461document.addEventListener('click', (e) => {
1462	if (document.getElementById("comment_emotion_btn") == null){
1463		return;
1464	}
1465  if(e.target.id != "comment_emotion_btn" && e.target.id != "emotion_keyboard" && !document.getElementById("comment_emotion_btn").contains(e.target) && !document.getElementById("emotion_keyboard").contains(e.target)){
1466		$("#comment_emotion_btn").removeClass("comment-emotion-keyboard-open");
1467  }
1468})
1469/*查看评论编辑记录*/
1470function showCommentEditHistory(id){
1471	let requestID = parseInt(new Date().getTime());
1472	$("#comment_edit_history").data("request-id", requestID);
1473	$("#comment_edit_history .modal-title").html(__("评论 #") + id + " " + __("的编辑记录"));
1474	$("#comment_edit_history .modal-body").html("<div class='comment-history-loading'><span class='spinner-border text-primary'></span><span style='display: inline-block;transform: translateY(-4px);margin-left: 15px;font-size: 18px;'>加载中</span></div>");
1475	$("#comment_edit_history").modal(null);
1476	$.ajax({
1477		type: 'POST',
1478		url: argonConfig.wp_path + "wp-admin/admin-ajax.php",
1479		dataType : "json",
1480		data: {
1481			action: "get_comment_edit_history",
1482			id: id
1483		},
1484		success: function(result){
1485			if ($("#comment_edit_history").data("request-id") != requestID){
1486				return;
1487			}
1488			$("#comment_edit_history .modal-body").hide();
1489			$("#comment_edit_history .modal-body").html(result.history);
1490			$("#comment_edit_history .modal-body").fadeIn(300);
1491		},
1492		error: function(result){
1493			if ($("#comment_edit_history").data("request-id") != requestID){
1494				return;
1495			}
1496			$("#comment_edit_history .modal-body").hide();
1497			$("#comment_edit_history .modal-body").html(__("加载失败"));
1498			$("#comment_edit_history .modal-body").fadeIn(300);
1499		}
1500	});
1501}
1502$(document).on("click" , ".comment-edited.comment-edithistory-accessible" , function(){
1503	showCommentEditHistory($(this).parent().parent().parent().parent().data("id"));
1504});
1505/*过长评论折叠*/
1506function foldLongComments(){
1507	if (argonConfig.fold_long_comments == false){
1508		return;
1509	}
1510	$(".comment-item-inner").each(function(){
1511		if ($(this).hasClass("comment-unfolded")){
1512			return;
1513		}
1514		if (this.clientHeight > 800){
1515			$(this).addClass("comment-folded");
1516			$(this).append("<div class='show-full-comment'><button><i class='fa fa-angle-down' aria-hidden='true'></i> " + __("展开") + "</button></div>");
1517		}
1518	});
1519}
1520foldLongComments();
1521$(document).on("click" , ".show-full-comment" , function(){
1522	$(this).parent().removeClass("comment-folded").addClass("comment-unfolded");
1523});
1524/*评论文字头像*/
1525function generateCommentTextAvatar(img){
1526	let emailHash = '';
1527	try{
1528		emailHash = img.attr("src").match(/([a-f\d]{32}|[A-F\d]{32})/)[0];
1529	}catch{
1530		emailHash = img.parent().parent().parent().find(".comment-name").text().trim();
1531		if (emailHash == '' || emailHash == undefined){
1532			emailHash = img.parent().find("*[class*='comment-author']").text().trim();
1533		}
1534	}
1535	let hash = 0;
1536	for (i in emailHash){
1537		hash = (hash * 233 + emailHash.charCodeAt(i)) % 16;
1538	}
1539	let colors = ['#e25f50', '#f25e90', '#bc67cb', '#9672cf', '#7984ce', '#5c96fa', '#7bdeeb', '#45d0e2', '#48b7ad', '#52bc89', '#9ace5f', '#d4e34a', '#f9d715', '#fac400', '#ffaa00', '#ff8b61', '#c2c2c2', '#8ea3af', '#a1877d', '#a3a3a3', '#b0b6e3', '#b49cde', '#c2c2c2', '#7bdeeb', '#bcaaa4', '#aed77f'];
1540	let text = $(".comment-name", img.parent().parent().parent()).text().trim()[0];
1541	if (text == '' || text == undefined){
1542		text = img.parent().find("*[class*='comment-author']").text().trim()[0];
1543	}
1544	let classList = img.attr('class') + " text-avatar";
1545	img.prop('outerHTML', '<div class="' + classList + '" style="background-color: ' + colors[hash] + ';">
1545' + text + '</div>');
1546}
1547document.addEventListener("error", function(e){
1548	let img = $(e.target);
1549	if (!img.hasClass("avatar")){
1550		return;
1551	}
1552	generateCommentTextAvatar(img);
1553}, true);
1554function refreshCommentTextAvatar(){
1555	$(".comment-item-avatar > img.avatar").each(function(index, img){
1556		if (!img.complete){
1557			return;
1558		}
1559		if (img.naturalWidth !== 0){
1560			return false;
1561		}
1562		generateCommentTextAvatar($(img));
1563	});
1564}
1565refreshCommentTextAvatar();
1566$(window).on("load", function(){
1567	refreshCommentTextAvatar();
1568});
1569/*需要密码的文章加载*/
1570$(document).on("submit" , ".post-password-form" , function(){
1571	$("input[type='submit']", this).attr("disabled", "disabled");
1572	let url = $(this).attr("action");
1573	$.pjax.form(this, {
1574		push: false,
1575		replace: false
1576	});
1577	return false;
1578});
1579/*评论分页加载*/
1580!function(){
1581	$(document).on("click" , "#comments_navigation .page-item > div" , function(){
1582		$("#comments").addClass("comments-loading");
1583		NProgress.set(0.618);
1584		url = $(this).attr("href");
1585		$.ajax({
1586			type: 'POST',
1587			url: url,
1588			dataType : "html",
1589			success : function(result){
1590				NProgress.done();
1591				$vdom = $(result);
1592				$("#comments").html($("#comments", $vdom).html());
1593				$("#comments").removeClass("comments-loading");
1594				$("body,html").animate({
1595					scrollTop: $("#comments").offset().top - 100
1596				}, 500, 'easeOutExpo');
1597				foldLongComments();
1598				calcHumanTimesOnPage();
1599				panguInit();
1600				$(".comment-item-text .comment-sticker.lazyload").lazyload(argonConfig.lazyload).removeClass("lazyload");
1601			},
1602			error : function(){
1603				window.location.href = url;
1604			}
1605		});
1606	});
1607	$(document).on("click" , "#comments_more" , function(){
1608		$("#comments_more").attr("disabled", "disabled");
1609		NProgress.set(0.618);
1610		url = $(this).attr("href");
1611		$.ajax({
1612			type: 'POST',
1613			url: url,
1614			data: {
1615				no_post_view: 'true'
1616			},
1617			dataType : "html",
1618			success : function(result){
1619				NProgress.done();
1620				$vdom = $(result);
1621				$("#comments > .card-body > ol.comment-list").append($("#comments > .card-body > ol.comment-list", $vdom).html());
1622				if ($("#comments_more", $vdom).length == 0){
1623					$("#comments_more").remove();
1624					$(".comments-navigation-more").html("<div class='comments-navigation-nomore'>" + __("没有更多了") + "</div>");
1625				}else{
1626					$("#comments_more").attr("href", $("#comments_more", $vdom).attr("href"));
1627					$("#comments_more").removeAttr("disabled");
1628				}
1629				foldLongComments();
1630				calcHumanTimesOnPage();
1631				panguInit();
1632				$(".comment-item-text .comment-sticker.lazyload").lazyload(argonConfig.lazyload).removeClass("lazyload");
1633			},
1634			error : function(){
1635				window.location.href = url;
1636			}
1637		});
1638	});
1639}();
1640
1641/*URL 中 # 根据 ID 定位*/
1642function gotoHash(hash, durtion, easing = 'easeOutExpo'){
1643	if (hash.length == 0){
1644		return;
1645	}
1646	if ($(hash).length == 0){
1647		return;
1648	}
1649	if (durtion == null){
1650		durtion = 200;
1651	}
1652	$("body,html").stop().animate({
1653		scrollTop: $(hash).offset().top - 80
1654	}, durtion, easing);
1655}
1656function getHash(url){
1657	return url.substring(url.indexOf('#'));
1658}
1659!function(){
1660	$(window).on("hashchange" , function(){
1661		gotoHash(window.location.hash);
1662	});
1663	$(window).trigger("hashchange");
1664}();
1665
1666/*显示文章过时信息 Toast*/
1667function showPostOutdateToast(){
1668	if ($("#primary #post_outdate_toast").length > 0){
1669		iziToast.show({
1670			title: '',
1671			message: $("#primary #post_outdate_toast").data("text"),
1672			class: 'shadow-sm',
1673			position: 'topRight',
1674			backgroundColor: 'var(--themecolor)',
1675			titleColor: '#ffffff',
1676			messageColor: '#ffffff',
1677			iconColor: '#ffffff',
1678			progressBarColor: '#ffffff',
1679			icon: 'fa fa-info',
1680			close: false,
1681			timeout: 8000
1682		});
1683		$("#primary #post_outdate_toast").remove();
1684	}
1685}
1686showPostOutdateToast();
1687
1688/*Zoomify*/
1689function zoomifyInit(){
1690	if (argonConfig.zoomify == false){
1691		return;
1692	}
1693	$("article img").zoomify(argonConfig.zoomify);
1694}
1695zoomifyInit();
1696
1697/*Fancybox*/
1698$.fancybox.defaults.transitionEffect = "slide";
1699$.fancybox.defaults.buttons = ["zoom", "fullScreen", "thumbs", "close"];
1700$.fancybox.defaults.lang = argonConfig.language;
1701$.fancybox.defaults.i18n = {
1702	en_US: {
1703		CLOSE: "Close",
1704		NEXT: "Next",
1705		PREV: "Previous",
1706		ERROR: "The requested content cannot be loaded. <br/> Please try again later.",
1707		PLAY_START: "Start slideshow",
1708		PLAY_STOP: "Pause slideshow",
1709		FULL_SCREEN: "Full screen",
1710		THUMBS: "Thumbnails",
1711		DOWNLOAD: "Download",
1712		SHARE: "Share",
1713		ZOOM: "Zoom"
1714	},
1715	zh_CN: {
1716		CLOSE: "关闭",
1717		NEXT: "下一张",
1718		PREV: "上一张",
1719		ERROR: "图片加载失败",
1720		PLAY_START: "开始幻灯片展示",
1721		PLAY_STOP: "暂停幻灯片展示",
1722		FULL_SCREEN: "全屏",
1723		THUMBS: "缩略图",
1724		DOWNLOAD: "下载",
1725		SHARE: "分享",
1726		ZOOM: "缩放"
1727	}
1728};
1729
1730/*Lazyload*/
1731function lazyloadInit(){
1732	if (argonConfig.lazyload == false){
1733		return;
1734	}
1735	if (argonConfig.lazyload.effect == "none"){
1736		delete argonConfig.lazyload.effect;
1737	}
1738	$("article img.lazyload:not(.lazyload-loaded) , .related-post-thumbnail.lazyload:not(.lazyload-loaded) , .shuoshuo-preview-container img.lazyload:not(.lazyload-loaded)").lazyload(
1739		Object.assign(argonConfig.lazyload, {
1740			load: function () {
1741				$(this).addClass("lazyload-loaded");
1742				$(this).parent().removeClass("lazyload-container-unload");
1743			}
1744		})
1745	);
1746	$(".post-thumbnail.lazyload:not(.lazyload-loaded)").lazyload(
1747		Object.assign({threshold: argonConfig.lazyload.threshold}, {
1748			load: function () {
1749				$(this).addClass("lazyload-loaded");
1750				$(this).parent().removeClass("lazyload-container-unload");
1751				waterflowInit();
1752			}
1753		})
1754	);
1755	$(".comment-item-text .comment-sticker.lazyload").lazyload(Object.assign(argonConfig.lazyload, {load: function(){$(this).removeClass("lazyload")}}));
1756}
1757lazyloadInit();
1758
1759/*Pangu.js*/
1760function panguInit(){
1761	if (argonConfig.pangu.indexOf("article") >= 0){
1762		pangu.spacingElementByClassName('post-content');
1763	}
1764	if (argonConfig.pangu.indexOf("comment") >= 0){
1765		pangu.spacingElementById('comments');
1766	}
1767	if (argonConfig.pangu.indexOf("shuoshuo") >= 0){
1768		pangu.spacingElementByClassName('shuoshuo-content');
1769	}
1770}
1771panguInit();
1772
1773/*Clamp.js*/
1774function clampInit(){
1775	$(".clamp").each(function(index, dom) {
1776		$clamp(dom, {clamp: dom.getAttribute("clamp-line")});
1777	});
1778}
1779clampInit();
1780
1781/*Tippy.js*/
1782function tippyInit(){
1783	//Reference Popover
1784	tippy('sup.reference[data-content]:not(.tippy-initialized)', {
1785		content: (reference) => reference.getAttribute('data-content'),
1786		allowHTML: true,
1787		interactive: true,theme: 'light scroll-y',
1788		delay: [100, 250],
1789		animation: 'fade'
1790	});
1791	$("sup.reference[data-content]:not(.tippy-initialized)").addClass("tippy-initialized");
1792}
1793tippyInit();
1794
1795/*Banner 全屏封面相关*/
1796if ($("html").hasClass("banner-as-cover")){
1797	function classInit(){
1798		if ($("#main").hasClass("article-list-home")){
1799			if (!$("html").hasClass("is-home")){
1800				$("html").addClass("is-home");
1801				$("html").trigger("resize");
1802			}
1803		}else{
1804			if ($("html").hasClass("is-home")){
1805				$("html").removeClass("is-home");
1806				$("html").trigger("resize");
1807			}
1808		}
1809	}
1810	classInit();
1811	new MutationObserver(function(mutations, observer){
1812		classInit();
1813	}).observe(document.querySelector("#primary"), {
1814		'childList': true
1815	});
1816	$(".cover-scroll-down").on("click" , function(){
1817		gotoHash("#content", 600, 'easeOutCirc');
1818		$("#content").focus();
1819	});
1820	$fabs = $("#float_action_buttons");
1821	$coverScrollDownBtn = $(".cover-scroll-down");
1822	function changeWidgetsDisplayStatus(){
1823		let scrollTop = $(window).scrollTop();
1824		if (scrollTop >= window.outerHeight * 0.2){
1825			$fabs.removeClass("hidden");
1826		}else{
1827			$fabs.addClass("hidden");
1828		}
1829		if (scrollTop >= window.outerHeight * 0.6){
1830			$coverScrollDownBtn.addClass("hidden");
1831		}else{
1832			$coverScrollDownBtn.removeClass("hidden");
1833		}
1834	}
1835	changeWidgetsDisplayStatus();
1836	$(window).scroll(function(){
1837		changeWidgetsDisplayStatus();
1838	});
1839	$(window).resize(function(){
1840		changeWidgetsDisplayStatus();
1841	});
1842}
1843
1844/*Pjax*/
1845var pjaxScrollTop = 0, pjaxLoading = false;
1846$.pjax.defaults.timeout = 10000;
1847$.pjax.defaults.container = ['#primary', '#leftbar_part1_menu', '#leftbar_part2_inner', '.page-information-card-container', '#rightbar', '#wpadminbar'];
1848$.pjax.defaults.fragment = ['#primary', '#leftbar_part1_menu', '#leftbar_part2_inner', '.page-information-card-container', '#rightbar', '#wpadminbar'];
1849$(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):not([download]):not(.reference-link):not(.reference-list-backlink)")
1850.on('pjax:click', function(e, f, g){
1851	if (argonConfig.disable_pjax == true){
1852		e.preventDefault();
1853		return;
1854	}
1855	NProgress.remove();
1856	NProgress.start();
1857	pjaxLoading = true;
1858}).on('pjax:afterGetContainers', function(e, f, g) {
1859	if (g.is("#main article.post-preview a.post-title")){
1860		let $card = $(g.parents("article.post-preview")[0]);
1861		let waterflowOn = false;
1862		if ($("#main").hasClass("waterflow")){
1863			waterflowOn = true;
1864			$card.css("transition", "all .5s ease");
1865		}
1866		$card.append("<div class='loading-css-animation'><div class='loading-dot loading-dot-1' ></div><div class='loading-dot loading-dot-2' ></div><div class='loading-dot loading-dot-3' ></div><div class='loading-dot loading-dot-4' ></div><div class='loading-dot loading-dot-5' ></div><div class='loading-dot loading-dot-6' ></div><div class='loading-dot loading-dot-7' ></div><div class='loading-dot loading-dot-8' ></div></div></div>");
1867		$card.addClass("post-pjax-loading");
1868		$("#main").addClass("post-list-pjax-loading");
1869		let offsetTop = $($card).offset().top - $("#main").offset().top;
1870		if ($("html").hasClass("is-home") && $("html").hasClass("banner-as-cover")){
1871			offsetTop = $($card).offset().top - window.outerHeight * 0.418;
1872		}
1873		$card.css("transform" , "translateY(-" + offsetTop + "px)");
1874		if (waterflowOn){
1875			$card.css("left", "10px");
1876			$card.css("width", "calc(100% - 20px)");
1877		}
1878		$("body,html").animate({
1879			scrollTop: 0
1880		}, 450);
1881	}
1882	pjaxScrollTop = 0;
1883	if ($("html").hasClass("banner-as-cover")){
1884		if (g.is(".page-link")){
1885			pjaxScrollTop = $("#content").offset().top - 80;
1886		}
1887	}
1888}).on('pjax:send', function() {
1889	NProgress.set(0.618);
1890}).on('pjax:beforeReplace', function(e, dom) {
1891	if ($("#post_comment", dom[0]).length > 0){
1892		$("#fabtn_go_to_comment").removeClass("d-none");
1893	}else{
1894		$("#fabtn_go_to_comment").addClass("d-none");
1895	}
1896	if ($("html").hasClass("banner-as-cover")){
1897		if (!$("#main").hasClass("article-list-home")){
1898			pjaxScrollTop = 0;
1899		}
1900	}
1901}).on('pjax:complete', function() {
1902	pjaxLoading = false;
1903	NProgress.inc();
1904	try{
1905		if (MathJax != undefined){
1906			if (MathJax.Hub != undefined){
1907				MathJax.Hub.Typeset();
1908			}else{
1909				MathJax.typeset();
1910			}
1911		}
1912	}catch (err){}
1913	try{
1914		if (renderMathInElement != undefined){
1915			renderMathInElement(document.body,{
1916				delimiters: [
1917					{left: "$$", right: "$$", display: true},
1918					{left: "$", right: "$", display: false},
1919					{left: "\\(", right: "\\)", display: false}
1920				]
1921			});
1922		}
1923	}catch (err){}
1924
1925	waterflowInit();
1926	lazyloadInit();
1927	zoomifyInit();
1928	highlightJsRender();
1929	panguInit();
1930	clampInit();
1931	tippyInit();
1932	getGithubInfoCardContent();
1933	showPostOutdateToast();
1934	calcHumanTimesOnPage();
1935	foldLongComments();
1936	foldLongShuoshuo();
1937	$("html").trigger("resize");
1938
1939	if (typeof(window.pjaxLoaded) == "function"){
1940		try{
1941			window.pjaxLoaded();
1942		}catch (err){
1943			console.error(err);
1944		}
1945	}
1946
1947	NProgress.done();
1948}).on('pjax:end', function() {
1949	waterflowInit();
1950	lazyloadInit();
1951});
1952
1953/*Reference 跳转*/
1954$(document).on("click", ".reference-link , .reference-list-backlink" , function(e){
1955	e.preventDefault();
1956	$target = $($(this).attr("href"));
1957	$("body,html").animate({
1958		scrollTop: $target.offset().top - document.body.clientHeight / 2 - 75
1959	}, 500, 'easeOutExpo')
1960	setTimeout(function(){
1961		if ($target.is("li")){
1962			$(".space", $target).focus();
1963		}else{
1964			$target.focus();
1965		}
1966	}, 1);
1967});
1968
1969/*Tags Dialog pjax 加载后自动关闭*/
1970$(document).on("click" , "#blog_tags .tag" , function(){
1971	$("#blog_tags button.close").trigger("click");
1972});
1973$(document).on("click" , "#blog_categories .tag" , function(){
1974	$("#blog_categories button.close").trigger("click");
1975});
1976
1977/*侧栏 & 顶栏菜单手机适配*/
1978!function(){
1979	$(document).on("click" , "#fabtn_open_sidebar, #open_sidebar" , function(){
1980		$("html").addClass("leftbar-opened");
1981	});
1982	$(document).on("click" , "#sidebar_mask" , function(){
1983		$("html").removeClass("leftbar-opened");
1984	});
1985	$(document).on("click" , "#leftbar a[href]:not([no-pjax]):not([href^='#'])" , function(){
1986		$("html").removeClass("leftbar-opened");
1987	});
1988	$(document).on("click" , "#navbar_global.show .navbar-nav a[href]:not([no-pjax]):not([href^='#'])" , function(){
1989		$("#navbar_global .navbar-toggler").click();
1990	});
1991	$(document).on("click" , "#navbar_global.show #navbar_search_btn_mobile" , function(){
1992		$("#navbar_global .navbar-toggler").click();
1993	});
1994}();
1995
1996/*折叠区块小工具*/
1997$(document).on("click" , ".collapse-block .collapse-block-title" , function(){
1998	let block = $(this).parent();
1999	$(block).toggleClass("collapsed");
2000	let inner = $(".collapse-block-body", block);
2001	if (block.hasClass("collapsed")){
2002		inner.stop(true, false).slideUp(300, 'easeOutCirc');
2003	}else{
2004		inner.stop(true, false).slideDown(300, 'easeOutCirc');
2005	}
2006	$("html").trigger("scroll");
2007});
2008
2009/*获得 Github Repo Shortcode 信息卡内容*/
2010function getGithubInfoCardContent(){
2011	$(".github-info-card").each(function(){
2012		(function($this){
2013			if ($this.attr("data-getdata") == "backend"){
2014				$(".github-info-card-description" , $this).html($this.attr("data-description"));
2015				$(".github-info-card-stars" , $this).html($this.attr("data-stars"));
2016				$(".github-info-card-forks" , $this).html($this.attr("data-forks"));
2017				return;
2018			}
2019			$(".github-info-card-description" , $this).html("Loading...");
2020			$(".github-info-card-stars" , $this).html("-");
2021			$(".github-info-card-forks" , $this).html("-");
2022			author = $this.attr("data-author");
2023			project = $this.attr("data-project");
2024			$.ajax({
2025				url : "https://api.github.com/repos/" + author + "/" + project,
2026				type : "GET",
2027				dataType : "json",
2028				success : function(result){
2029					description = result.description;
2030					if (result.homepage != "" && result.homepage != null){
2031						description += " <a href='" + result.homepage + "' target='_blank' no-pjax>" + result.homepage + "</a>"
2032					}
2033					$(".github-info-card-description" , $this).html(description);
2034					$(".github-info-card-stars" , $this).html(result.stargazers_count);
2035					$(".github-info-card-forks" , $this).html(result.forks_count);
2036				},
2037				error : function(xhr){
2038					if (xhr.status == 404){
2039						$(".github-info-card-description" , $this).html(__("找不到该 Repo"));
2040					}else{
2041						$(".github-info-card-description" , $this).html(__("获取 Repo 信息失败"));
2042					}
2043				}
2044			});
2045		})($(this));
2046	});
2047}
2048getGithubInfoCardContent();
2049
2050/*说说点赞*/
2051$(document).on("click" , ".shuoshuo-upvote" , function(){
2052	$this = $(this);
2053	ID = $this.attr("data-id");
2054	$this.addClass("shuoshuo-upvoting");
2055	$.ajax({
2056		url : argonConfig.wp_path + "wp-admin/admin-ajax.php",
2057		type : "POST",
2058		dataType : "json",
2059		data : {
2060			action: "upvote_shuoshuo",
2061			shuoshuo_id : ID,
2062		},
2063		success : function(result){
2064			$this.removeClass("shuoshuo-upvoting");
2065			if (result.status == "success"){
2066				$(".shuoshuo-upvote-num" , $this).html(result.total_upvote);
2067				$("i.fa-thumbs-o-up" , $this).addClass("fa-thumbs-up").removeClass("fa-thumbs-o-up");
2068				$this.addClass("upvoted");
2069				$this.addClass("shuoshuo-upvoted-animation");
2070				iziToast.show({
2071					title: result.msg,
2072					class: 'shadow-sm',
2073					position: 'topRight',
2074					backgroundColor: '#2dce89',
2075					titleColor: '#ffffff',
2076					messageColor: '#ffffff',
2077					iconColor: '#ffffff',
2078					progressBarColor: '#ffffff',
2079					icon: 'fa fa-check',
2080					timeout: 5000
2081				});
2082			}else{
2083				$(".shuoshuo-upvote-num" , $this).html(result.total_upvote);
2084				iziToast.show({
2085					title: result.msg,
2086					class: 'shadow-sm',
2087					position: 'topRight',
2088					backgroundColor: '#f5365c',
2089					titleColor: '#ffffff',
2090					messageColor: '#ffffff',
2091					iconColor: '#ffffff',
2092					progressBarColor: '#ffffff',
2093					icon: 'fa fa-close',
2094					timeout: 5000
2095				});
2096			}
2097		},
2098		error : function(xhr){
2099			$this.removeClass("shuoshuo-upvoting");
2100			iziToast.show({
2101				title: __("点赞失败"),
2102				class: 'shadow-sm',
2103				position: 'topRight',
2104				backgroundColor: '#f5365c',
2105				titleColor: '#ffffff',
2106				messageColor: '#ffffff',
2107				iconColor: '#ffffff',
2108				progressBarColor: '#ffffff',
2109				icon: 'fa fa-close',
2110				timeout: 5000
2111			});
2112		}
2113	});
2114});
2115//折叠长说说
2116function foldLongShuoshuo(){
2117	if (argonConfig.fold_long_shuoshuo == false){
2118		return;
2119	}
2120	$("#main .shuoshuo-foldable > .shuoshuo-content").each(function(){
2121		if ($(this).hasClass("shuoshuo-unfolded")){
2122			return;
2123		}
2124		if (this.clientHeight > 400){
2125			$(this).addClass("shuoshuo-folded");
2126			$(this).append("<div class='show-full-shuoshuo'><button class='btn btn-outline-primary'><i class='fa fa-angle-down' aria-hidden='true'></i> " + __("展开") + "</button></div>");
2127		}
2128	});
2129}
2130foldLongShuoshuo();
2131$(document).on("click" , ".show-full-shuoshuo" , function(){
2132	$(this).parent().removeClass("shuoshuo-folded").addClass("shuoshuo-unfolded");
2133});
2134
2135//颜色计算
2136function rgb2hsl(R,G,B){
2137	let r = R / 255;
2138	let g = G / 255;
2139	let b = B / 255;
2140
2141	let var_Min = Math.min(r, g, b);
2142	let var_Max = Math.max(r, g, b);
2143	let del_Max = var_Max - var_Min;
2144
2145	let H, S, L = (var_Max + var_Min) / 2;
2146
2147	if (del_Max == 0){
2148		H = 0;
2149		S = 0;
2150	}else{
2151		if (L < 0.5){
2152			S = del_Max / (var_Max + var_Min);
2153		}else{
2154			S = del_Max / (2 - var_Max - var_Min);
2155		}
2156
2157		del_R = (((var_Max - r) / 6) + (del_Max / 2)) / del_Max;
2158		del_G = (((var_Max - g) / 6) + (del_Max / 2)) / del_Max;
2159		del_B = (((var_Max - b) / 6) + (del_Max / 2)) / del_Max;
2160
2161		if (r == var_Max){
2162			H = del_B - del_G;
2163		}
2164		else if (g == var_Max){
2165			H = (1 / 3) + del_R - del_B;
2166		}
2167		else if (b == var_Max){
2168			H = (2 / 3) + del_G - del_R;
2169		}
2170		if (H < 0) H += 1;
2171		if (H > 1) H -= 1;
2172	}
2173	return {
2174		'h': H,//0~1
2175		's': S,
2176		'l': L,
2177		'H': Math.round(H * 360),//0~360
2178		'S': Math.round(S * 100),//0~100
2179		'L': Math.round(L * 100),//0~100
2180	};
2181}
2182function Hue_2_RGB(v1,v2,vH){
2183	if (vH < 0) vH += 1;
2184	if (vH > 1) vH -= 1;
2185	if ((6 * vH) < 1) return (v1 + (v2 - v1) * 6 * vH);
2186	if ((2 * vH) < 1) return v2;
2187	if ((3 * vH) < 2) return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
2188	return v1;
2189}
2190function hsl2rgb(h,s,l){
2191	let r, g, b, var_1, var_2;
2192	if (s == 0){
2193		r = l;
2194		g = l;
2195		b = l;
2196	}
2197	else{
2198		if (l < 0.5){
2199			var_2 = l * (1 + s);
2200		}
2201		else{
2202			var_2 = (l + s) - (s * l);
2203		}
2204		var_1 = 2 * l - var_2;
2205		r = Hue_2_RGB(var_1, var_2, h + (1 / 3));
2206		g = Hue_2_RGB(var_1, var_2, h);
2207		b = Hue_2_RGB(var_1, var_2, h - (1 / 3));
2208	}
2209	return {
2210		'R': Math.round(r * 255),//0~255
2211		'G': Math.round(g * 255),
2212		'B': Math.round(b * 255),
2213		'r': r,//0~1
2214		'g': g,
2215		'b': b
2216	};
2217}
2218function rgb2hex(r,g,b){
2219	let hex = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
2220	let rh, gh, bh;
2221	rh = "", gh ="", bh="";
2222	while (rh.length < 2){
2223		rh = hex[r%16] + rh;
2224		r = Math.floor(r / 16);
2225	}
2226	while (gh.length < 2){
2227		gh = hex[g%16] + gh;
2228		g = Math.floor(g / 16);
2229	}
2230	while (bh.length < 2){
2231		bh = hex[b%16] + bh;
2232		b = Math.floor(b / 16);
2233	}
2234	return "#" + rh + gh + bh;
2235}
2236function hex2rgb(hex){
2237	//hex: #XXXXXX
2238	let dec = {
2239		'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, 'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15
2240	};
2241	return {
2242		'R': (dec[hex.substr(1,1)] * 16 + dec[hex.substr(2,1)]),//0~255
2243		'G': (dec[hex.substr(3,1)] * 16 + dec[hex.substr(4,1)]),
2244		'B': (dec[hex.substr(5,1)] * 16 + dec[hex.substr(6,1)]),
2245		'r': (dec[hex.substr(1,1)] * 16 + dec[hex.substr(2,1)]) / 255,//0~1
2246		'g': (dec[hex.substr(3,1)] * 16 + dec[hex.substr(4,1)]) / 255,
2247		'b': (dec[hex.substr(5,1)] * 16 + dec[hex.substr(6,1)]) / 255
2248	};
2249}
2250function rgb2gray(R,G,B){
2251	return Math.round(R * 0.299 + G * 0.587 + B * 0.114);
2252}
2253function hex2gray(hex){
2254	let rgb_array = hex2rgb(hex);
2255	return hex2gray(rgb_array['R'], rgb_array['G'], rgb_array['B']);
2256}
2257function rgb2str(rgb){
2258	return rgb['R'] + "," + rgb['G'] + "," + rgb['B'];
2259}
2260function hex2str(hex){
2261	return rgb2str(hex2rgb(hex));
2262}
2263//颜色选择器 & 切换主题色
2264if ($("meta[name='argon-enable-custom-theme-color']").attr("content") == 'true'){
2265	let themeColorPicker = new Pickr({
2266		el: '#theme-color-picker',
2267		container: 'body',
2268		theme: 'monolith',
2269		closeOnScroll: false,
2270		appClass: 'theme-color-picker-box',
2271		useAsButton: false,
2272		padding: 8,
2273		inline: false,
2274		autoReposition: true,
2275		sliders: 'h',
2276		disabled: false,
2277		lockOpacity: true,
2278		outputPrecision: 0,
2279		comparison: false,
2280		default: $("meta[name='theme-color']").attr("content"),
2281		swatches: ['#5e72e4', '#fa7298', '#009688', '#607d8b', '#2196f3', '#3f51b5', '#ff9700', '#109d58', '#dc4437', '#673bb7', '#212121', '#795547'],
2282		defaultRepresentation: 'HEX',
2283		showAlways: false,
2284		closeWithKey: 'Escape',
2285		position: 'top-start',
2286		adjustableNumbers: false,
2287		components: {
2288			palette: true,
2289			preview: true,
2290			opacity: false,
2291			hue: true,
2292			interaction: {
2293				hex: true,
2294				rgba: true,
2295				hsla: false,
2296				hsva: false,
2297				cmyk: false,
2298				input: true,
2299				clear: false,
2300				cancel: true,
2301				save: true
2302			}
2303		},
2304		strings: {
2305			save: __('确定'),
2306			clear: __('清除'),
2307			cancel: __('恢复博客默认')
2308		}
2309	});
2310	themeColorPicker.on('change', instance => {
2311		updateThemeColor(pickrObjectToHEX(instance), true);
2312	})
2313	themeColorPicker.on('save', (color, instance) => {
2314		updateThemeColor(pickrObjectToHEX(instance._color), true);
2315		themeColorPicker.hide();
2316	})
2317	themeColorPicker.on('cancel', instance => {
2318		themeColorPicker.hide();
2319		themeColorPicker.setColor($("meta[name='theme-color-origin']").attr("content").toUpperCase());
2320		updateThemeColor($("meta[name='theme-color-origin']").attr("content").toUpperCase(), false);
2321		setCookie("argon_custom_theme_color", "", 0);
2322	});
2323}
2324function pickrObjectToHEX(color){
2325	let HEXA = color.toHEXA();
2326	return ("#" + HEXA[0] + HEXA[1] + HEXA[2]).toUpperCase();
2327}
2328function updateThemeColor(color, setcookie){
2329	let themecolor = color;
2330	let themecolor_rgbstr = hex2str(themecolor);
2331	let RGB = hex2rgb(themecolor);
2332	let HSL = rgb2hsl(RGB['R'], RGB['G'], RGB['B']);
2333
2334	document.documentElement.style.setProperty('--themecolor', themecolor);
2335	document.documentElement.style.setProperty('--themecolor-R', RGB['R']);
2336	document.documentElement.style.setProperty('--themecolor-G', RGB['G']);
2337	document.documentElement.style.setProperty('--themecolor-B', RGB['B']);
2338	document.documentElement.style.setProperty('--themecolor-H', HSL['H']);
2339	document.documentElement.style.setProperty('--themecolor-S', HSL['S']);
2340	document.documentElement.style.setProperty('--themecolor-L', HSL['L']);
2341
2342
2343	if (rgb2gray(RGB['R'], RGB['G'], RGB['B']) < 50){
2344		$("html").addClass("themecolor-toodark");
2345	}else{
2346		$("html").removeClass("themecolor-toodark");
2347	}
2348
2349	$("meta[name='theme-color']").attr("content", themecolor);
2350	$("meta[name='theme-color-rgb']").attr("content", themecolor_rgbstr);
2351
2352	if (setcookie){
2353		setCookie("argon_custom_theme_color", themecolor, 365);
2354	}
2355}
2356
2357/*打字效果*/
2358function typeEffect($element, text, now, interval){
2359	if (now > text.length){
2360		setTimeout(function(){
2361			$element.removeClass("typing-effect");
2362		}, 1000);
2363		return;
2364	}
2365	$element[0].innerText = text.substring(0, now);
2366	setTimeout(function(){typeEffect($element, text, now + 1, interval)}, interval);
2367}
2368function startTypeEffect($element, text, interval){
2369	$element.addClass("typing-effect");
2370	$element.attr("style", "--animation-cnt: " + Math.ceil(text.length * interval / 1000));
2371	typeEffect($element, text, 1, interval);
2372}
2373!function(){
2374	if ($(".banner-title").data("interval") != undefined){
2375		let interval = $(".banner-title").data("interval");
2376		let $title = $(".banner-title-inner");
2377		let $subTitle = $(".banner-subtitle");
2378		startTypeEffect($title, $title.data("text"), interval);
2379		if (!$subTitle.length){
2380			return;
2381		}
2382		setTimeout(function(){startTypeEffect($subTitle, $subTitle.data("text"), interval);}, Math.ceil($title.data("text").length * interval / 1000) * 1000);
2383	}
2384}();
2385
2386/*一言*/
2387if ($(".hitokoto").length > 0){
2388	$.ajax({
2389		type: 'GET',
2390		url: "https://v1.hitokoto.cn",
2391		success: function(result){
2392			$(".hitokoto").text(result.hitokoto);
2393		},
2394		error: function(result){
2395			$(".hitokoto").text(__("Hitokoto 获取失败"));
2396		}
2397	});
2398}
2399
2400/*Highlight.js*/
2401function randomString(len) {
2402	len = len || 32;
2403	let chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
2404	let res = "";
2405	for (let i = 0; i < len; i++) {
2406		res += chars.charAt(Math.floor(Math.random() * chars.length));
2407	}
2408	res[0] = chars.charAt(Math.floor(Math.random() * (chars.length - 10)));
2409	return res;
2410}
2411var codeOfBlocks = {};
2412function getCodeFromBlock(block){
2413	if (codeOfBlocks[block.id] != undefined){
2414		return codeOfBlocks[block.id];
2415	}
2416	let lines = $(".hljs-ln-code", block);
2417	let res = "";
2418	for (let i = 0; i < lines.length - 1; i++){
2419		res += lines[i].innerText;
2420		res += "\n";
2421	}
2422	res += lines[lines.length - 1].innerText;
2423	codeOfBlocks[block.id] = res;
2424	return res;
2425}
2426function highlightJsRender(){
2427	if (typeof(hljs) == "undefined"){
2428		return;
2429	}
2430	if (typeof(argonConfig.code_highlight.enable) == "undefined"){
2431		return;
2432	}
2433	if (!argonConfig.code_highlight.enable){
2434		return;
2435	}
2436	$("article pre.code").each(function(index, block) {
2437		if ($(block).hasClass("no-hljs")){
2438			return;
2439		}
2440		$(block).html("<code>" + $(block).html() + "</code>");
2441	});
2442	$("article pre > code").each(function(index, block) {
2443		if ($(block).hasClass("no-hljs")){
2444			return;
2445		}
2446		$(block).parent().attr("id", randomString());
2447		hljs.highlightBlock(block);
2448		hljs.lineNumbersBlock(block, {singleLine: true});
2449		$(block).parent().addClass("hljs-codeblock");
2450		if (argonConfig.code_highlight.hide_linenumber){
2451			$(block).parent().addClass("hljs-hide-linenumber");
2452		}
2453		if (argonConfig.code_highlight.break_line){
2454			$(block).parent().addClass("hljs-break-line");
2455		}
2456		if (argonConfig.code_highlight.transparent_linenumber){
2457			$(block).parent().addClass("hljs-transparent-linenumber");
2458		}
2459		$(block).attr("hljs-codeblock-inner", "");
2460		let copyBtnID = "copy_btn_" + randomString();
2461		$(block).parent().append(`<div class="hljs-control hljs hljs-title">
2462				<div class="hljs-control-btn hljs-control-toggle-linenumber" tooltip-hide-linenumber="` + __("隐藏行号") + `" tooltip-show-linenumber="` + __("显示行号") + `">
2463					<i class="fa fa-list"></i>
2464				</div>
2465				<div class="hljs-control-btn hljs-control-toggle-break-line" tooltip-enable-breakline="` + __("开启折行") + `" tooltip-disable-breakline="` + __("关闭折行") + `">
2466					<i class="fa fa-align-left"></i>
2467				</div>
2468				<div class="hljs-control-btn hljs-control-copy" id=` + copyBtnID + ` tooltip="` + __("复制") + `">
2469					<i class="fa fa-clipboard"></i>
2470				</div>
2471				<div class="hljs-control-btn hljs-control-fullscreen" tooltip-fullscreen="` + __("全屏") + `" tooltip-exit-fullscreen="` + __("退出全屏") + `">
2472					<i class="fa fa-arrows-alt"></i>
2473				</div>
2474			</div>`);
2475		let clipboard = new ClipboardJS("#" + copyBtnID, {
2476			text: function(trigger) {
2477				return getCodeFromBlock($(block).parent()[0]);
2478			}
2479		});
2480		clipboard.on('success', function(e) {
2481			iziToast.show({
2482				title: __("复制成功"),
2483				message: __("代码已复制到剪贴板"),
2484				class: 'shadow',
2485				position: 'topRight',
2486				backgroundColor: '#2dce89',
2487				titleColor: '#ffffff',
2488				messageColor: '#ffffff',
2489				iconColor: '#ffffff',
2490				progressBarColor: '#ffffff',
2491				icon: 'fa fa-check',
2492				timeout: 5000
2493			});
2494		});
2495		clipboard.on('error', function(e) {
2496			iziToast.show({
2497				title: __("复制失败"),
2498				message: __("请手动复制代码"),
2499				class: 'shadow',
2500				position: 'topRight',
2501				backgroundColor: '#f5365c',
2502				titleColor: '#ffffff',
2503				messageColor: '#ffffff',
2504				iconColor: '#ffffff',
2505				progressBarColor: '#ffffff',
2506				icon: 'fa fa-close',
2507				timeout: 5000
2508			});
2509		});
2510	});
2511}
2512$(document).ready(function(){
2513	highlightJsRender();
2514	waterflowInit();
2515});
2516$(document).on("click" , ".hljs-control-fullscreen" , function(){
2517	let block = $(this).parent().parent();
2518	block.toggleClass("hljs-codeblock-fullscreen");
2519	if (block.hasClass("hljs-codeblock-fullscreen")){
2520		$("html").addClass("noscroll codeblock-fullscreen");
2521	}else{
2522		$("html").removeClass("noscroll codeblock-fullscreen");
2523	}
2524});
2525$(document).on("click" , ".hljs-control-toggle-break-line" , function(){
2526	let block = $(this).parent().parent();
2527	block.toggleClass("hljs-break-line");
2528});
2529$(document).on("click" , ".hljs-control-toggle-linenumber" , function(){
2530	let block = $(this).parent().parent();
2531	block.toggleClass("hljs-hide-linenumber");
2532});
2533
2534/*时间差计算*/
2535function addPreZero(num, n) {
2536	var len = num.toString().length;
2537	while(len < n) {
2538		num = "0" + num;
2539		len++;
2540	}
2541	return num;
2542}
2543function humanTimeDiff(time){
2544	let now = new Date();
2545	time = new Date(time);
2546	let delta = now - time;
2547	if (delta < 0){
2548		delta = 0;
2549	}
2550	if (delta < 1000 * 60){
2551		return __("刚刚");
2552	}
2553	if (delta < 1000 * 60 * 60){
2554		return parseInt(delta / (1000 * 60)) + " " + __("分钟前");
2555	}
2556	if (delta < 1000 * 60 * 60 * 24){
2557		return parseInt(delta / (1000 * 60 * 60)) + " " + __("小时前");
2558	}
2559	let yesterday = new Date(now - 1000 * 60 * 60 * 24);
2560	yesterday.setHours(0);
2561	yesterday.setMinutes(0);
2562	yesterday.setSeconds(0);
2563	yesterday.setMilliseconds(0);
2564	if (time > yesterday){
2565		return __("昨天") + " " + time.getHours() + ":" + addPreZero(time.getMinutes(), 2);
2566	}
2567	let theDayBeforeYesterday = new Date(now - 1000 * 60 * 60 * 24 * 2);
2568	theDayBeforeYesterday.setHours(0);
2569	theDayBeforeYesterday.setMinutes(0);
2570	theDayBeforeYesterday.setSeconds(0);
2571	theDayBeforeYesterday.setMilliseconds(0);
2572	if (time > theDayBeforeYesterday && argonConfig.language.indexOf("zh") == 0){
2573		return __("前天") + " " + time.getHours() + ":" + addPreZero(time.getMinutes(), 2);
2574	}
2575	if (delta < 1000 * 60 * 60 * 24 * 30){
2576		return parseInt(delta / (1000 * 60 * 60 * 24)) + " " + __("天前");
2577	}
2578	let theFirstDayOfThisYear = new Date(now);
2579	theFirstDayOfThisYear.setMonth(0);
2580	theFirstDayOfThisYear.setDate(1);
2581	theFirstDayOfThisYear.setHours(0);
2582	theFirstDayOfThisYear.setMinutes(0);
2583	theFirstDayOfThisYear.setSeconds(0);
2584	theFirstDayOfThisYear.setMilliseconds(0);
2585	if (time > theFirstDayOfThisYear){
2586		if (argonConfig.dateFormat == "YMD" || argonConfig.dateFormat == "MDY"){
2587			return (time.getMonth() + 1) + "-" + time.getDate();
2588		}else{
2589			return time.getDate() + "-" + (time.getMonth() + 1);
2590		}
2591	}
2592	if (argonConfig.dateFormat == "YMD"){
2593		return time.getFullYear() + "-" + (time.getMonth() + 1) + "-" + time.getDate();
2594	}else if (argonConfig.dateFormat == "MDY"){
2595		return time.getDate() + "-" + (time.getMonth() + 1) + "-" + time.getFullYear();
2596	}else if (argonConfig.dateFormat == "DMY"){
2597		return time.getDate() + "-" + (time.getMonth() + 1) + "-" + time.getFullYear();
2598	}
2599}
2600function calcHumanTimesOnPage(){
2601	$(".human-time").each(function(){
2602		$(this).text(humanTimeDiff(parseInt($(this).data("time")) * 1000));
2603	});
2604}
2605calcHumanTimesOnPage();
2606setInterval(function(){
2607	calcHumanTimesOnPage()
2608}, 15000);
2609
2610
2611/*Console*/
2612!function(){
2613	console.log('%cTheme: %cArgon%cBy solstice23', 'color: rgba(255,255,255,.6); background: #5e72e4; font-size: 15px;border-radius:5px 0 0 5px;padding:10px 0 10px 20px;','color: rgba(255,255,255,1); background: #5e72e4; font-size: 15px;border-radius:0;padding:10px 15px 10px 0px;','color: #fff; background: #92A1F4; font-size: 15px;border-radius:0 5px 5px 0;padding:10px 20px 10px 15px;');
2614	console.log('%cVersion%c' + $("meta[name='theme-version']").attr("content"), 'color:#fff; background: #5e72e4;font-size: 12px;border-radius:5px 0 0 5px;padding:3px 10px 3px 10px;','color:#fff; background: #92a1f4;font-size: 12px;border-radius:0 5px 5px 0;padding:3px 10px 3px 10px;');
2615	console.log('%chttps://github.com/solstice23/argon-theme', 'font-size: 12px;border-radius:5px;padding:3px 10px 3px 10px;border:1px solid #5e72e4;');
2616}();

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.