mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-16 12:29:41 +08:00
1 line
2.4 KiB
JavaScript
1 line
2.4 KiB
JavaScript
(()=>{var __webpack_modules__={"./src/js/journals.js":()=>{eval("let journalContextInitial = false\r\nconst journalContext = {\r\n /* 初始化事件 */\r\n initEvent() {\r\n if (journalContextInitial) return\r\n let $body = $('body')\r\n // 展开和关闭评论区事件\r\n $body.on('click', '.journal .comment', function () {\r\n $(this).parent().parent().siblings('.journal-comment').stop().slideToggle(200)\r\n })\r\n // 折叠日志区域\r\n $body.on('click', '.journal-content>.expand-done', function () {\r\n Utils.foldBlock($(this).parent())\r\n })\r\n $body.on('click', '.journal-operation-item>.share', function () {\r\n let $journal = $(this).parents('.journal')\r\n let title = '动态: ' + $journal.find('.journal-date>em').text()\r\n let desc = $journal.children('.journal-content').children('.main-content').text()\r\n DShare.sharePoster({\r\n image: DreamConfig.journals_share_image,\r\n title: title,\r\n description: desc.length > 220 ? desc.substring(0, 220) + '...' :desc\r\n })\r\n })\r\n Utils.initLikeEvent('.journal .like', 'moments', ($elem) => $elem.find('em'))\r\n journalContextInitial = true\r\n },\r\n /* 点赞 */\r\n initLike() {\r\n Utils.initLikeButton('.journal .like', 'moments')\r\n },\r\n /* 折叠日志区域 */\r\n foldJournals() {\r\n const $journals = $('.journal .journal-content')\r\n $journals.each(function () {\r\n const $this = $(this)\r\n if (this.scrollHeight >= DreamConfig.journals_fold_height) {\r\n $this.append('<div class=\"expand-done\"><i class=\"ri-arrow-up-double-line\"></i></div>')\r\n } else {\r\n $this.removeClass('fold')\r\n }\r\n })\r\n },\r\n}\r\nwindow.journalPjax = function (serialNumber) {\r\n if ($('.card.journal').length === 0) return\r\n Object.keys(journalContext).forEach(\r\n (c) => window.pjaxSerialNumber === serialNumber && journalContext[c]()\r\n )\r\n}\r\n!(function () {\r\n !window.pjaxSerialNumber && journalContext.initEvent()\r\n !window.pjaxSerialNumber && journalContext.initLike()\r\n\r\n document.addEventListener('DOMContentLoaded', function () {\r\n !window.pjaxSerialNumber && journalContext.foldJournals()\r\n })\r\n})()\n\n//# sourceURL=webpack://halo-theme-dream2.0-plus/./src/js/journals.js?")}},__webpack_exports__={};__webpack_modules__["./src/js/journals.js"]()})(); |