tona-utils 1.0.1 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/index.cjs +0 -443
- package/dist/index.d.cts +0 -187
- package/dist/index.d.cts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -182,6 +182,7 @@ declare function getAppQUrl(): string;
|
|
|
182
182
|
declare function getAppIngUrl(): string;
|
|
183
183
|
declare function getAppGroupUrl(): string;
|
|
184
184
|
declare function getDraftBoxUrl(): string;
|
|
185
|
+
declare function getEditPostUrl(): string;
|
|
185
186
|
//#endregion
|
|
186
|
-
export { IsCommentTurnedOn, checkEnableCodeLineNumber, checkEnableCodeThemeTypeFollowSystem, checkEnableMacStyleCodeBlock, checkEnableMathjax, checkHasCustomScript, checkIsDarkCodeHighlightTheme, checkIsDarkModeCodeHighlightThemeDark, checkIsDisableCodeHighlighter, checkIsLogin, checkIsOwner, follow, getAdminUrl, getAntiforgeryToken, getAppGroupUrl, getAppIngUrl, getAppQUrl, getAppWzUrl, getArticleCount, getBlogAge, getBlogUserGuid, getCnblogHomeUrl, getCodeHighlightEngine, getCodeHighlightTheme, getCommentCount, getCommentedUrl, getContactUrl, getCurrentBlogApp, getCurrentBlogId, getCurrentPage, getCurrentPostDateAdded, getCurrentPostId, getCurrentPostUrl, getDarkModeCodeHighlightTheme, getDetailUrl, getDraftBoxUrl, getFollowState, getFolloweesUrl, getFollowers, getFollowersUrl, getFollowing, getFollowingUrl, getIndexUrl, getLoginState, getMathEngine, getMessageCount, getMessageUrl, getMydiggedUrl, getNewPostUrl, getNickname, getPostCount, getRssUrl, getSendUrl, getSkinName, getUserInfo, getViewCount, getVisitorUserId, hasPostTitle, isAlbumPage, isCategoryPage, isEntrylistPage, isHomePage, isMd, isOwner, isPostDetailsPage, isTagListPage, isTinymce5, likePost, openNews, setCodeTheme, unLikePost, unfollow };
|
|
187
|
+
export { IsCommentTurnedOn, checkEnableCodeLineNumber, checkEnableCodeThemeTypeFollowSystem, checkEnableMacStyleCodeBlock, checkEnableMathjax, checkHasCustomScript, checkIsDarkCodeHighlightTheme, checkIsDarkModeCodeHighlightThemeDark, checkIsDisableCodeHighlighter, checkIsLogin, checkIsOwner, follow, getAdminUrl, getAntiforgeryToken, getAppGroupUrl, getAppIngUrl, getAppQUrl, getAppWzUrl, getArticleCount, getBlogAge, getBlogUserGuid, getCnblogHomeUrl, getCodeHighlightEngine, getCodeHighlightTheme, getCommentCount, getCommentedUrl, getContactUrl, getCurrentBlogApp, getCurrentBlogId, getCurrentPage, getCurrentPostDateAdded, getCurrentPostId, getCurrentPostUrl, getDarkModeCodeHighlightTheme, getDetailUrl, getDraftBoxUrl, getEditPostUrl, getFollowState, getFolloweesUrl, getFollowers, getFollowersUrl, getFollowing, getFollowingUrl, getIndexUrl, getLoginState, getMathEngine, getMessageCount, getMessageUrl, getMydiggedUrl, getNewPostUrl, getNickname, getPostCount, getRssUrl, getSendUrl, getSkinName, getUserInfo, getViewCount, getVisitorUserId, hasPostTitle, isAlbumPage, isCategoryPage, isEntrylistPage, isHomePage, isMd, isOwner, isPostDetailsPage, isTagListPage, isTinymce5, likePost, openNews, setCodeTheme, unLikePost, unfollow };
|
|
187
188
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;AAIA;AAQA;AAQA;AAQgB,iBAxBA,OAAA,CAAA,CAwBY,EAAA,OAAA;AAU5B;AAUA;AAQA;AAUA;AAUgB,iBAhEA,aAAA,CAAA,CAgEe,EAAA,OAAA;AAsB/B;AAWA;AAYA;AAQA;AAQgB,iBArHA,QAAA,CAAA,CAqHU,EAAA,OAAA;AAQ1B;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AIA,WAAA,CAAA;iBAIA,gBAAA,CAAA;iBAIA,oBAAA,CAAA;iBAIA,kBAAA,CAAA;iBAIA,aAAA,CAAA;iBAIA,sBAAA,CAAA;iBAIA,yBAAA,CAAA;iBAIA,qBAAA,CAAA;iBAIA,6BAAA,CAAA;iBAIA,6BAAA,CAAA;iBAIA,qCAAA,CAAA;iBAIA,6BAAA,CAAA;iBAIA,oCAAA,CAAA;iBAIA,4BAAA,CAAA;iBAIA,gBAAA,CAAA;iBAIA,uBAAA,CAAA;iBAIA,mBAAA,CAAA;iBAQA,WAAA,CAAA;iBAkCA,YAAA,CAAA;iBAKA,eAAA,CAAA;iBAKA,eAAA,CAAA;iBAKA,gBAAA,CAAA;iBAKA,SAAA,CAAA;iBAKA,WAAA,CAAA;iBAKA,cAAA,CAAA;iBAKA,eAAA,CAAA;iBAKA,eAAA,CAAA;iBAKA,aAAA,CAAA;iBAKA,UAAA,CAAA;iBAKA,WAAA,CAAA;iBAKA,aAAA,CAAA;iBAKA,aAAA,CAAA;iBAKA,WAAA,CAAA;iBAKA,UAAA,CAAA;iBAKA,YAAA,CAAA;iBAKA,cAAA,CAAA;iBAKA,cAAA,CAAA;iBAIA,cAAA,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -364,9 +364,12 @@ function getAppGroupUrl() {
|
|
|
364
364
|
return "https://group.cnblogs.com";
|
|
365
365
|
}
|
|
366
366
|
function getDraftBoxUrl() {
|
|
367
|
-
return
|
|
367
|
+
return `${iCnblog}/posts`;
|
|
368
|
+
}
|
|
369
|
+
function getEditPostUrl() {
|
|
370
|
+
return `${iCnblog}/EditPosts.aspx?postid=${getCurrentPostId()}`;
|
|
368
371
|
}
|
|
369
372
|
|
|
370
373
|
//#endregion
|
|
371
|
-
export { IsCommentTurnedOn, checkEnableCodeLineNumber, checkEnableCodeThemeTypeFollowSystem, checkEnableMacStyleCodeBlock, checkEnableMathjax, checkHasCustomScript, checkIsDarkCodeHighlightTheme, checkIsDarkModeCodeHighlightThemeDark, checkIsDisableCodeHighlighter, checkIsLogin, checkIsOwner, follow, getAdminUrl, getAntiforgeryToken, getAppGroupUrl, getAppIngUrl, getAppQUrl, getAppWzUrl, getArticleCount, getBlogAge, getBlogUserGuid, getCnblogHomeUrl, getCodeHighlightEngine, getCodeHighlightTheme, getCommentCount, getCommentedUrl, getContactUrl, getCurrentBlogApp, getCurrentBlogId, getCurrentPage, getCurrentPostDateAdded, getCurrentPostId, getCurrentPostUrl, getDarkModeCodeHighlightTheme, getDetailUrl, getDraftBoxUrl, getFollowState, getFolloweesUrl, getFollowers, getFollowersUrl, getFollowing, getFollowingUrl, getIndexUrl, getLoginState, getMathEngine, getMessageCount, getMessageUrl, getMydiggedUrl, getNewPostUrl, getNickname, getPostCount, getRssUrl, getSendUrl, getSkinName, getUserInfo, getViewCount, getVisitorUserId, hasPostTitle, isAlbumPage, isCategoryPage, isEntrylistPage, isHomePage, isMd, isOwner, isPostDetailsPage, isTagListPage, isTinymce5, likePost, openNews, setCodeTheme, unLikePost, unfollow };
|
|
374
|
+
export { IsCommentTurnedOn, checkEnableCodeLineNumber, checkEnableCodeThemeTypeFollowSystem, checkEnableMacStyleCodeBlock, checkEnableMathjax, checkHasCustomScript, checkIsDarkCodeHighlightTheme, checkIsDarkModeCodeHighlightThemeDark, checkIsDisableCodeHighlighter, checkIsLogin, checkIsOwner, follow, getAdminUrl, getAntiforgeryToken, getAppGroupUrl, getAppIngUrl, getAppQUrl, getAppWzUrl, getArticleCount, getBlogAge, getBlogUserGuid, getCnblogHomeUrl, getCodeHighlightEngine, getCodeHighlightTheme, getCommentCount, getCommentedUrl, getContactUrl, getCurrentBlogApp, getCurrentBlogId, getCurrentPage, getCurrentPostDateAdded, getCurrentPostId, getCurrentPostUrl, getDarkModeCodeHighlightTheme, getDetailUrl, getDraftBoxUrl, getEditPostUrl, getFollowState, getFolloweesUrl, getFollowers, getFollowersUrl, getFollowing, getFollowingUrl, getIndexUrl, getLoginState, getMathEngine, getMessageCount, getMessageUrl, getMydiggedUrl, getNewPostUrl, getNickname, getPostCount, getRssUrl, getSendUrl, getSkinName, getUserInfo, getViewCount, getVisitorUserId, hasPostTitle, isAlbumPage, isCategoryPage, isEntrylistPage, isHomePage, isMd, isOwner, isPostDetailsPage, isTagListPage, isTinymce5, likePost, openNews, setCodeTheme, unLikePost, unfollow };
|
|
372
375
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * 判断访问者是否为博主\n * @returns {boolean} boolean - 是否为博主\n */\nexport function isOwner(): boolean {\n return window.isBlogOwner\n}\n\n/**\n * 判断用户登录是否登录\n * @returns {boolean} 是否登录\n */\nexport function getLoginState(): boolean {\n return window.isLogined\n}\n\n/**\n * 判断是否开启公告\n * @returns {boolean} 是否开启公告\n */\nexport function openNews(): boolean {\n return !!$('#profile_block').length\n}\n\n/**\n * 获取粉丝数\n * @returns {string} 粉丝数\n */\nexport function getFollowers(): string {\n return openNews()\n ? $('#profile_block a:nth-of-type(3)').text().trim()\n : '未知'\n}\n\n/**\n * 获取关注的人数\n * @returns {string} 关注的人数\n */\nexport function getFollowing(): string {\n return openNews()\n ? $('#profile_block a:nth-of-type(4)').text().trim()\n : '未知'\n}\n\n/**\n * 判断是否已经关注\n * @returns {boolean} 是否已经关注\n */\nexport function getFollowState(): boolean {\n return $('#p_b_follow>a').text().trim() === '-取消关注'\n}\n\n/**\n * 获取园龄\n * @returns {string} 园龄\n */\nexport function getBlogAge(): string {\n return openNews()\n ? $('#profile_block a:nth-of-type(2)').text().trim()\n : '未知'\n}\n\n/**\n * 获取当前博文链接\n * @returns {string} 当前博文链接\n */\nexport function getCurrentPostUrl(): string {\n return !location.href.includes('#')\n ? location.href\n : location.href.substring(0, location.href.lastIndexOf('#'))\n}\n\n/**\n * 获取博客园 user guid\n * @example '144690cc-79e2-4508-aa7f-08d6a1e9eeef'\n */\nexport function getBlogUserGuid(): string {\n if (window.cb_blogUserGuid) {\n return window.cb_blogUserGuid\n }\n\n const followElement = document.querySelector('#p_b_follow')\n const scriptElement = followElement?.nextElementSibling\n if (scriptElement?.tagName === 'SCRIPT' && scriptElement.textContent) {\n const match = scriptElement.textContent.match(\n /getFollowStatus\\(['\"]([^'\"]+)['\"]\\)/,\n )\n if (match?.[1]) {\n return match[1]\n }\n }\n\n return ''\n}\n\n/**\n * 关注\n */\nexport function follow(): void {\n if (isOwner()) {\n return\n }\n const guid = getBlogUserGuid()\n window.follow(guid)\n}\n\n/**\n * 取消关注\n */\nexport function unfollow(): void {\n if (isOwner()) {\n return\n }\n const guid = getBlogUserGuid()\n window.unfollow(guid)\n}\n\n/**\n * 判断文章是否打开了评论\n * @returns {boolean} 文章是否打开了评论\n */\nexport function IsCommentTurnedOn(): boolean {\n return !!$('#tbCommentBody').length\n}\n\n/**\n * 判断是否为博文详情页\n * @returns {boolean} 是否为博文详情页\n */\nexport function isPostDetailsPage(): boolean {\n return !!$('#post_detail').length\n}\n\n/**\n * 是否为首页\n * @returns {boolean} 是否为首页\n */\nexport function isHomePage(): boolean {\n return !!$('.day').length\n}\n\n/**\n * 是否为标签列表页\n * @returns {boolean} 是否为标签列表页\n */\nexport function isTagListPage(): boolean {\n return !!$('#taglist_main').length\n}\n\n/**\n * 是否为博文详情页\n * @returns {boolean} 是否为博文详情页\n */\nexport function isEntrylistPage(): boolean {\n return !!$('.entrylistPosttitle').length\n}\n\n/**\n * 判断是否为相册页\n * @returns {boolean} 是否为相册页\n */\nexport function isAlbumPage(): boolean {\n return !!$('.gallery').length\n}\n\n/**\n * 判断是否为博文分类页\n * @returns {boolean} 是否为博文分类页\n */\nexport function isCategoryPage(): boolean {\n return !!$('.entrylistItem').length\n}\n\nexport function getCurrentPage():\n | 'home'\n | 'post'\n | 'tags'\n | 'post-archive'\n | 'category'\n | 'photos'\n | 'photo-view'\n | 'unknown' {\n // 首页\n if (document.querySelectorAll('.day').length) {\n return 'home'\n }\n\n // 随笔详情页\n if (document.querySelector('#post_detail')) {\n return 'post'\n }\n\n // 我的标签页\n if (\n document.querySelector('#taglist_main') ||\n document.querySelector('#myposts')\n ) {\n return 'tags'\n }\n\n if (\n document.querySelector('.entrylistTitle')?.textContent?.includes('档案')\n ) {\n return 'post-archive'\n }\n\n // 随笔分类页\n if (\n document.querySelector('.entrylistTitle')?.textContent?.includes('随笔分类')\n ) {\n return 'category'\n }\n\n // 相册页\n if (\n document.querySelector('.gallery') &&\n !document.querySelector('#ViewPicture1_GalleryImage')\n ) {\n return 'photos'\n }\n\n // 照片预览页\n if (\n document.querySelector('.gallery') &&\n document.querySelector('#ViewPicture1_GalleryImage')\n ) {\n return 'photo-view'\n }\n\n return 'unknown'\n}\n\n/**\n * 判断编辑器类型是否为 md\n * @returns {boolean} 编辑器类型是否为 md\n */\nexport function isMd(): boolean {\n return $('#cnblogs_post_body').hasClass('cnblogs-markdown')\n}\n\n// TODO\n/**\n * 判断编辑器类型是否为 tinymce 5\n */\nexport function isTinymce5(): boolean {\n return false\n}\n\n/**\n * 判断文章内容是否存在标题\n * @returns {boolean} 文章内容是否存在标题\n */\nexport function hasPostTitle(): boolean {\n return !!$(\n '#cnblogs_post_body>h1,#cnblogs_post_body>h2,#cnblogs_post_body>h3,#cnblogs_post_body>h4',\n ).length\n}\n\n/**\n * 推荐博文\n * 博客园过滤机制禁止调用 `window.votePost`\n * https://group.cnblogs.com/topic/115024.html\n */\nexport function likePost(): void {\n const diggElement = document.querySelector('.diggit') as HTMLElement\n if (diggElement) {\n diggElement.click()\n }\n}\n\nexport function unLikePost(): void {\n const diggElement = document.querySelector('.digg_gray') as HTMLElement\n if (diggElement) {\n diggElement.click()\n }\n}\n\n/**\n * 获取用户信息\n * 仅当用户代码放到页脚 HTML 中才有效\n * @returns {Promise<unknown>} 表示用户信息的 Promise 对象\n */\nexport function getUserInfo(): Promise<unknown> {\n return new Promise((resolve) => {\n $(document).ajaxComplete((_, xhr, settings) => {\n if (settings.url === 'https://account.cnblogs.com/user/userinfo') {\n resolve($.parseJSON(xhr.responseText))\n }\n })\n })\n}\n\n/**\n * 获取消息数\n * @returns {string} 消息数\n */\nexport function getMessageCount(): string {\n return $('#msg_count').text()\n}\n\n/**\n * 获取随笔数量\n * @returns {string} 随笔数量\n */\nexport function getPostCount(): string {\n return $('#stats_post_count').text().trim().replace(/\\D/g, '')\n}\n\n/**\n * 获取文章数量\n * @returns {string} 文章数量\n */\nexport function getArticleCount(): string {\n return $('#stats_article_count').text().trim().replace(/\\D/g, '')\n}\n\n/**\n * 获取评论数量\n * @returns {string} 评论数量\n */\nexport function getCommentCount(): string {\n return $('#stats-comment_count').text().trim().replace(/\\D/g, '')\n}\n\n/**\n * 获取博客访问总量\n * @returns {string} 博客访问总量\n */\nexport function getViewCount(): string {\n return $('#stats-total-view-count>span').text().trim()\n}\n\nexport function setCodeTheme(mode: 'dark' | 'light') {\n const theme =\n mode === 'dark'\n ? window.darkModeCodeHighlightTheme\n : window.codeHighlightTheme\n\n window.highlighter.setTheme(theme)\n}\n\nexport function getCurrentBlogId(): string {\n return window.currentBlogId\n}\n\nexport function getCurrentBlogApp(): string {\n return window.currentBlogApp\n}\n\nexport function checkIsLogin(): boolean {\n return window.isLogined\n}\n\nexport function checkIsOwner(): boolean {\n return window.isBlogOwner\n}\n\nexport function getSkinName(): string {\n return window.skinName\n}\n\nexport function getVisitorUserId(): string {\n return window.visitorUserId\n}\n\nexport function checkHasCustomScript(): boolean {\n return window.hasCustomScript\n}\n\nexport function checkEnableMathjax(): boolean {\n return window.cb_enable_mathjax\n}\n\nexport function getMathEngine(): number {\n return window.mathEngine\n}\n\nexport function getCodeHighlightEngine(): number {\n return window.codeHighlightEngine\n}\n\nexport function checkEnableCodeLineNumber(): boolean {\n return window.enableCodeLineNumber\n}\n\nexport function getCodeHighlightTheme(): string {\n return window.codeHighlightTheme\n}\n\nexport function getDarkModeCodeHighlightTheme(): string {\n return window.darkModeCodeHighlightTheme\n}\n\nexport function checkIsDarkCodeHighlightTheme(): boolean {\n return window.isDarkCodeHighlightTheme\n}\n\nexport function checkIsDarkModeCodeHighlightThemeDark(): boolean {\n return window.isDarkModeCodeHighlightThemeDark\n}\n\nexport function checkIsDisableCodeHighlighter(): boolean {\n return window.isDisableCodeHighlighter\n}\n\nexport function checkEnableCodeThemeTypeFollowSystem(): boolean {\n return window.enableCodeThemeTypeFollowSystem\n}\n\nexport function checkEnableMacStyleCodeBlock(): boolean {\n return window.enableMacStyleCodeBlock\n}\n\nexport function getCurrentPostId(): number | null {\n return window.currentPostId || null\n}\n\nexport function getCurrentPostDateAdded(): string | null {\n return window.currentPostDateAdded || null\n}\n\nexport function getAntiforgeryToken(): string | null {\n return (\n document.querySelector(\n 'input[name=\"antiforgery_token\"]',\n ) as HTMLInputElement\n )?.value\n}\n\nexport function getNickname(): string | null {\n const title = document.title\n\n if (!title) {\n return null\n }\n\n // 匹配模式:提取标题中最后一个 \"- 博客园\" 之前的部分\n // 如果包含多个 \"-\",取最后一个 \"- 博客园\" 前面的内容作为用户昵称\n const parts = title.split(' - ')\n\n if (parts.length >= 2 && parts[parts.length - 1] === '博客园') {\n // 移除最后的 \"博客园\" 部分,剩余部分重新组合\n const withoutBlogCn = parts.slice(0, -1).join(' - ')\n\n // 如果还有 \"-\",取最后一部分作为用户昵称\n if (withoutBlogCn.includes(' - ')) {\n const nicknameParts = withoutBlogCn.split(' - ')\n return nicknameParts[nicknameParts.length - 1].trim()\n }\n\n return withoutBlogCn.trim()\n }\n\n return null\n}\n\nconst { currentBlogApp } = window\nconst home = 'https://home.cnblogs.com'\nconst cnblog = 'https://www.cnblogs.com'\nconst iCnblog = 'https://i.cnblogs.com'\nconst msg = 'https://msg.cnblogs.com'\n\n/* 用户详情页 */\nexport function getDetailUrl(): string {\n return `${home}/u/${currentBlogApp}`\n}\n\n/* 粉丝 */\nexport function getFollowersUrl(): string {\n return `${home}/u/${currentBlogApp}/followers`\n}\n\n/* 我的关注 */\nexport function getFolloweesUrl(): string {\n return `${home}/u/${currentBlogApp}/followees`\n}\n\n/* 博客园首页 */\nexport function getCnblogHomeUrl(): string {\n return cnblog\n}\n\n/* 订阅 */\nexport function getRssUrl(): string {\n return `${cnblog}/${currentBlogApp}/rss`\n}\n\n/* 用户博客首页 */\nexport function getIndexUrl(): string {\n return `${cnblog}/${currentBlogApp}`\n}\n\n/* 我赞 */\nexport function getMydiggedUrl(): string {\n return `${cnblog}/aggsite/mydigged`\n}\n\n/* 我评 */\nexport function getCommentedUrl(): string {\n return `${cnblog}/aggsite/mycommented`\n}\n\n/* 关注园友最新博文 */\nexport function getFollowingUrl(): string {\n return `${cnblog}/following`\n}\n\n/* 新随笔 */\nexport function getNewPostUrl(): string {\n return `${iCnblog}/posts/edit`\n}\n\n/* 联系 */\nexport function getSendUrl(): string {\n return $('#blog_nav_contact').attr('href') || ''\n}\n\n/* 管理 */\nexport function getAdminUrl(): string {\n return iCnblog\n}\n\n/* 消息 */\nexport function getMessageUrl(): string {\n return `${msg}`\n}\n\n/* 联系博主 */\nexport function getContactUrl(): string {\n return `${msg}/send/${currentBlogApp}`\n}\n\n/* 收藏 */\nexport function getAppWzUrl(): string {\n return 'https://wz.cnblogs.com'\n}\n\n/* 博问 */\nexport function getAppQUrl(): string {\n return 'https://q.cnblogs.com'\n}\n\n/* 闪存 */\nexport function getAppIngUrl(): string {\n return 'https://ing.cnblogs.com'\n}\n\n/* 小组 */\nexport function getAppGroupUrl(): string {\n return 'https://group.cnblogs.com'\n}\n\n/* 草稿箱 */\nexport function getDraftBoxUrl(): string {\n return 'https://i.cnblogs.com/posts'\n}\n"],"mappings":";;;;;AAIA,SAAgB,UAAmB;AACjC,QAAO,OAAO;;;;;;AAOhB,SAAgB,gBAAyB;AACvC,QAAO,OAAO;;;;;;AAOhB,SAAgB,WAAoB;AAClC,QAAO,CAAC,CAAC,EAAE,iBAAiB,CAAC;;;;;;AAO/B,SAAgB,eAAuB;AACrC,QAAO,UAAU,GACb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AIpB,SAAgB,aAAqB;AACnC,QAAO,EAAE,oBAAoB,CAAC,KAAK,OAAO,IAAI;;AAIhD,SAAgB,cAAsB;AACpC,QAAO;;AAIT,SAAgB,gBAAwB;AACtC,QAAO,GAAG;;AAIZ,SAAgB,gBAAwB;AACtC,QAAO,GAAG,IAAI,QAAQ;;AAIxB,SAAgB,cAAsB;AACpC,QAAO;;AAIT,SAAgB,aAAqB;AACnC,QAAO;;AAIT,SAAgB,eAAuB;AACrC,QAAO;;AAIT,SAAgB,iBAAyB;AACvC,QAAO;;AAIT,SAAgB,iBAAyB;AACvC,QAAO"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * 判断访问者是否为博主\n * @returns {boolean} boolean - 是否为博主\n */\nexport function isOwner(): boolean {\n return window.isBlogOwner\n}\n\n/**\n * 判断用户登录是否登录\n * @returns {boolean} 是否登录\n */\nexport function getLoginState(): boolean {\n return window.isLogined\n}\n\n/**\n * 判断是否开启公告\n * @returns {boolean} 是否开启公告\n */\nexport function openNews(): boolean {\n return !!$('#profile_block').length\n}\n\n/**\n * 获取粉丝数\n * @returns {string} 粉丝数\n */\nexport function getFollowers(): string {\n return openNews()\n ? $('#profile_block a:nth-of-type(3)').text().trim()\n : '未知'\n}\n\n/**\n * 获取关注的人数\n * @returns {string} 关注的人数\n */\nexport function getFollowing(): string {\n return openNews()\n ? $('#profile_block a:nth-of-type(4)').text().trim()\n : '未知'\n}\n\n/**\n * 判断是否已经关注\n * @returns {boolean} 是否已经关注\n */\nexport function getFollowState(): boolean {\n return $('#p_b_follow>a').text().trim() === '-取消关注'\n}\n\n/**\n * 获取园龄\n * @returns {string} 园龄\n */\nexport function getBlogAge(): string {\n return openNews()\n ? $('#profile_block a:nth-of-type(2)').text().trim()\n : '未知'\n}\n\n/**\n * 获取当前博文链接\n * @returns {string} 当前博文链接\n */\nexport function getCurrentPostUrl(): string {\n return !location.href.includes('#')\n ? location.href\n : location.href.substring(0, location.href.lastIndexOf('#'))\n}\n\n/**\n * 获取博客园 user guid\n * @example '144690cc-79e2-4508-aa7f-08d6a1e9eeef'\n */\nexport function getBlogUserGuid(): string {\n if (window.cb_blogUserGuid) {\n return window.cb_blogUserGuid\n }\n\n const followElement = document.querySelector('#p_b_follow')\n const scriptElement = followElement?.nextElementSibling\n if (scriptElement?.tagName === 'SCRIPT' && scriptElement.textContent) {\n const match = scriptElement.textContent.match(\n /getFollowStatus\\(['\"]([^'\"]+)['\"]\\)/,\n )\n if (match?.[1]) {\n return match[1]\n }\n }\n\n return ''\n}\n\n/**\n * 关注\n */\nexport function follow(): void {\n if (isOwner()) {\n return\n }\n const guid = getBlogUserGuid()\n window.follow(guid)\n}\n\n/**\n * 取消关注\n */\nexport function unfollow(): void {\n if (isOwner()) {\n return\n }\n const guid = getBlogUserGuid()\n window.unfollow(guid)\n}\n\n/**\n * 判断文章是否打开了评论\n * @returns {boolean} 文章是否打开了评论\n */\nexport function IsCommentTurnedOn(): boolean {\n return !!$('#tbCommentBody').length\n}\n\n/**\n * 判断是否为博文详情页\n * @returns {boolean} 是否为博文详情页\n */\nexport function isPostDetailsPage(): boolean {\n return !!$('#post_detail').length\n}\n\n/**\n * 是否为首页\n * @returns {boolean} 是否为首页\n */\nexport function isHomePage(): boolean {\n return !!$('.day').length\n}\n\n/**\n * 是否为标签列表页\n * @returns {boolean} 是否为标签列表页\n */\nexport function isTagListPage(): boolean {\n return !!$('#taglist_main').length\n}\n\n/**\n * 是否为博文详情页\n * @returns {boolean} 是否为博文详情页\n */\nexport function isEntrylistPage(): boolean {\n return !!$('.entrylistPosttitle').length\n}\n\n/**\n * 判断是否为相册页\n * @returns {boolean} 是否为相册页\n */\nexport function isAlbumPage(): boolean {\n return !!$('.gallery').length\n}\n\n/**\n * 判断是否为博文分类页\n * @returns {boolean} 是否为博文分类页\n */\nexport function isCategoryPage(): boolean {\n return !!$('.entrylistItem').length\n}\n\nexport function getCurrentPage():\n | 'home'\n | 'post'\n | 'tags'\n | 'post-archive'\n | 'category'\n | 'photos'\n | 'photo-view'\n | 'unknown' {\n // 首页\n if (document.querySelectorAll('.day').length) {\n return 'home'\n }\n\n // 随笔详情页\n if (document.querySelector('#post_detail')) {\n return 'post'\n }\n\n // 我的标签页\n if (\n document.querySelector('#taglist_main') ||\n document.querySelector('#myposts')\n ) {\n return 'tags'\n }\n\n if (\n document.querySelector('.entrylistTitle')?.textContent?.includes('档案')\n ) {\n return 'post-archive'\n }\n\n // 随笔分类页\n if (\n document.querySelector('.entrylistTitle')?.textContent?.includes('随笔分类')\n ) {\n return 'category'\n }\n\n // 相册页\n if (\n document.querySelector('.gallery') &&\n !document.querySelector('#ViewPicture1_GalleryImage')\n ) {\n return 'photos'\n }\n\n // 照片预览页\n if (\n document.querySelector('.gallery') &&\n document.querySelector('#ViewPicture1_GalleryImage')\n ) {\n return 'photo-view'\n }\n\n return 'unknown'\n}\n\n/**\n * 判断编辑器类型是否为 md\n * @returns {boolean} 编辑器类型是否为 md\n */\nexport function isMd(): boolean {\n return $('#cnblogs_post_body').hasClass('cnblogs-markdown')\n}\n\n// TODO\n/**\n * 判断编辑器类型是否为 tinymce 5\n */\nexport function isTinymce5(): boolean {\n return false\n}\n\n/**\n * 判断文章内容是否存在标题\n * @returns {boolean} 文章内容是否存在标题\n */\nexport function hasPostTitle(): boolean {\n return !!$(\n '#cnblogs_post_body>h1,#cnblogs_post_body>h2,#cnblogs_post_body>h3,#cnblogs_post_body>h4',\n ).length\n}\n\n/**\n * 推荐博文\n * 博客园过滤机制禁止调用 `window.votePost`\n * https://group.cnblogs.com/topic/115024.html\n */\nexport function likePost(): void {\n const diggElement = document.querySelector('.diggit') as HTMLElement\n if (diggElement) {\n diggElement.click()\n }\n}\n\nexport function unLikePost(): void {\n const diggElement = document.querySelector('.digg_gray') as HTMLElement\n if (diggElement) {\n diggElement.click()\n }\n}\n\n/**\n * 获取用户信息\n * 仅当用户代码放到页脚 HTML 中才有效\n * @returns {Promise<unknown>} 表示用户信息的 Promise 对象\n */\nexport function getUserInfo(): Promise<unknown> {\n return new Promise((resolve) => {\n $(document).ajaxComplete((_, xhr, settings) => {\n if (settings.url === 'https://account.cnblogs.com/user/userinfo') {\n resolve($.parseJSON(xhr.responseText))\n }\n })\n })\n}\n\n/**\n * 获取消息数\n * @returns {string} 消息数\n */\nexport function getMessageCount(): string {\n return $('#msg_count').text()\n}\n\n/**\n * 获取随笔数量\n * @returns {string} 随笔数量\n */\nexport function getPostCount(): string {\n return $('#stats_post_count').text().trim().replace(/\\D/g, '')\n}\n\n/**\n * 获取文章数量\n * @returns {string} 文章数量\n */\nexport function getArticleCount(): string {\n return $('#stats_article_count').text().trim().replace(/\\D/g, '')\n}\n\n/**\n * 获取评论数量\n * @returns {string} 评论数量\n */\nexport function getCommentCount(): string {\n return $('#stats-comment_count').text().trim().replace(/\\D/g, '')\n}\n\n/**\n * 获取博客访问总量\n * @returns {string} 博客访问总量\n */\nexport function getViewCount(): string {\n return $('#stats-total-view-count>span').text().trim()\n}\n\nexport function setCodeTheme(mode: 'dark' | 'light') {\n const theme =\n mode === 'dark'\n ? window.darkModeCodeHighlightTheme\n : window.codeHighlightTheme\n\n window.highlighter.setTheme(theme)\n}\n\nexport function getCurrentBlogId(): string {\n return window.currentBlogId\n}\n\nexport function getCurrentBlogApp(): string {\n return window.currentBlogApp\n}\n\nexport function checkIsLogin(): boolean {\n return window.isLogined\n}\n\nexport function checkIsOwner(): boolean {\n return window.isBlogOwner\n}\n\nexport function getSkinName(): string {\n return window.skinName\n}\n\nexport function getVisitorUserId(): string {\n return window.visitorUserId\n}\n\nexport function checkHasCustomScript(): boolean {\n return window.hasCustomScript\n}\n\nexport function checkEnableMathjax(): boolean {\n return window.cb_enable_mathjax\n}\n\nexport function getMathEngine(): number {\n return window.mathEngine\n}\n\nexport function getCodeHighlightEngine(): number {\n return window.codeHighlightEngine\n}\n\nexport function checkEnableCodeLineNumber(): boolean {\n return window.enableCodeLineNumber\n}\n\nexport function getCodeHighlightTheme(): string {\n return window.codeHighlightTheme\n}\n\nexport function getDarkModeCodeHighlightTheme(): string {\n return window.darkModeCodeHighlightTheme\n}\n\nexport function checkIsDarkCodeHighlightTheme(): boolean {\n return window.isDarkCodeHighlightTheme\n}\n\nexport function checkIsDarkModeCodeHighlightThemeDark(): boolean {\n return window.isDarkModeCodeHighlightThemeDark\n}\n\nexport function checkIsDisableCodeHighlighter(): boolean {\n return window.isDisableCodeHighlighter\n}\n\nexport function checkEnableCodeThemeTypeFollowSystem(): boolean {\n return window.enableCodeThemeTypeFollowSystem\n}\n\nexport function checkEnableMacStyleCodeBlock(): boolean {\n return window.enableMacStyleCodeBlock\n}\n\nexport function getCurrentPostId(): number | null {\n return window.currentPostId || null\n}\n\nexport function getCurrentPostDateAdded(): string | null {\n return window.currentPostDateAdded || null\n}\n\nexport function getAntiforgeryToken(): string | null {\n return (\n document.querySelector(\n 'input[name=\"antiforgery_token\"]',\n ) as HTMLInputElement\n )?.value\n}\n\nexport function getNickname(): string | null {\n const title = document.title\n\n if (!title) {\n return null\n }\n\n // 匹配模式:提取标题中最后一个 \"- 博客园\" 之前的部分\n // 如果包含多个 \"-\",取最后一个 \"- 博客园\" 前面的内容作为用户昵称\n const parts = title.split(' - ')\n\n if (parts.length >= 2 && parts[parts.length - 1] === '博客园') {\n // 移除最后的 \"博客园\" 部分,剩余部分重新组合\n const withoutBlogCn = parts.slice(0, -1).join(' - ')\n\n // 如果还有 \"-\",取最后一部分作为用户昵称\n if (withoutBlogCn.includes(' - ')) {\n const nicknameParts = withoutBlogCn.split(' - ')\n return nicknameParts[nicknameParts.length - 1].trim()\n }\n\n return withoutBlogCn.trim()\n }\n\n return null\n}\n\nconst { currentBlogApp } = window\nconst home = 'https://home.cnblogs.com'\nconst cnblog = 'https://www.cnblogs.com'\nconst iCnblog = 'https://i.cnblogs.com'\nconst msg = 'https://msg.cnblogs.com'\n\n/* 用户详情页 */\nexport function getDetailUrl(): string {\n return `${home}/u/${currentBlogApp}`\n}\n\n/* 粉丝 */\nexport function getFollowersUrl(): string {\n return `${home}/u/${currentBlogApp}/followers`\n}\n\n/* 我的关注 */\nexport function getFolloweesUrl(): string {\n return `${home}/u/${currentBlogApp}/followees`\n}\n\n/* 博客园首页 */\nexport function getCnblogHomeUrl(): string {\n return cnblog\n}\n\n/* 订阅 */\nexport function getRssUrl(): string {\n return `${cnblog}/${currentBlogApp}/rss`\n}\n\n/* 用户博客首页 */\nexport function getIndexUrl(): string {\n return `${cnblog}/${currentBlogApp}`\n}\n\n/* 我赞 */\nexport function getMydiggedUrl(): string {\n return `${cnblog}/aggsite/mydigged`\n}\n\n/* 我评 */\nexport function getCommentedUrl(): string {\n return `${cnblog}/aggsite/mycommented`\n}\n\n/* 关注园友最新博文 */\nexport function getFollowingUrl(): string {\n return `${cnblog}/following`\n}\n\n/* 新随笔 */\nexport function getNewPostUrl(): string {\n return `${iCnblog}/posts/edit`\n}\n\n/* 联系 */\nexport function getSendUrl(): string {\n return $('#blog_nav_contact').attr('href') || ''\n}\n\n/* 管理 */\nexport function getAdminUrl(): string {\n return iCnblog\n}\n\n/* 消息 */\nexport function getMessageUrl(): string {\n return `${msg}`\n}\n\n/* 联系博主 */\nexport function getContactUrl(): string {\n return `${msg}/send/${currentBlogApp}`\n}\n\n/* 收藏 */\nexport function getAppWzUrl(): string {\n return 'https://wz.cnblogs.com'\n}\n\n/* 博问 */\nexport function getAppQUrl(): string {\n return 'https://q.cnblogs.com'\n}\n\n/* 闪存 */\nexport function getAppIngUrl(): string {\n return 'https://ing.cnblogs.com'\n}\n\n/* 小组 */\nexport function getAppGroupUrl(): string {\n return 'https://group.cnblogs.com'\n}\n\n/* 草稿箱 */\nexport function getDraftBoxUrl(): string {\n return `${iCnblog}/posts`\n}\n\nexport function getEditPostUrl(): string {\n return `${iCnblog}/EditPosts.aspx?postid=${getCurrentPostId()}`\n}\n"],"mappings":";;;;;AAIA,SAAgB,UAAmB;AACjC,QAAO,OAAO;;;;;;AAOhB,SAAgB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AAO;;AAInB,SAAgB,kBAA0B;AACxC,QAAO,GAAG,OAAO;;AAInB,SAAgB,kBAA0B;AACxC,QAAO,GAAG,OAAO;;AAInB,SAAgB,gBAAwB;AACtC,QAAO,GAAG,QAAQ;;AAIpB,SAAgB,aAAqB;AACnC,QAAO,EAAE,oBAAoB,CAAC,KAAK,OAAO,IAAI;;AAIhD,SAAgB,cAAsB;AACpC,QAAO;;AAIT,SAAgB,gBAAwB;AACtC,QAAO,GAAG;;AAIZ,SAAgB,gBAAwB;AACtC,QAAO,GAAG,IAAI,QAAQ;;AAIxB,SAAgB,cAAsB;AACpC,QAAO;;AAIT,SAAgB,aAAqB;AACnC,QAAO;;AAIT,SAAgB,eAAuB;AACrC,QAAO;;AAIT,SAAgB,iBAAyB;AACvC,QAAO;;AAIT,SAAgB,iBAAyB;AACvC,QAAO,GAAG,QAAQ;;AAGpB,SAAgB,iBAAyB;AACvC,QAAO,GAAG,QAAQ,yBAAyB,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tona-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": {
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
"email": "guangzan1999@outlook.com"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"homepage": "https://github.com/
|
|
12
|
+
"homepage": "https://github.com/guangzan/tona/tree/main/packages/utils#readme",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/
|
|
15
|
+
"url": "git+https://github.com/guangzan/tona.git",
|
|
16
|
+
"directory": "packages/utils"
|
|
16
17
|
},
|
|
17
18
|
"bugs": {
|
|
18
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "https://github.com/guangzan/tona/issues"
|
|
19
20
|
},
|
|
20
21
|
"keywords": [
|
|
21
22
|
"博客园"
|
|
@@ -23,11 +24,10 @@
|
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
25
26
|
"types": "./dist/index.d.mts",
|
|
26
|
-
"import": "./dist/index.mjs"
|
|
27
|
-
"require": "./dist/index.cjs"
|
|
27
|
+
"import": "./dist/index.mjs"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
"main": "./dist/index.
|
|
30
|
+
"main": "./dist/index.mjs",
|
|
31
31
|
"module": "./dist/index.mjs",
|
|
32
32
|
"types": "./dist/index.d.mts",
|
|
33
33
|
"files": [
|
package/dist/index.cjs
DELETED
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/index.ts
|
|
3
|
-
/**
|
|
4
|
-
* 判断访问者是否为博主
|
|
5
|
-
* @returns {boolean} boolean - 是否为博主
|
|
6
|
-
*/
|
|
7
|
-
function isOwner() {
|
|
8
|
-
return window.isBlogOwner;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* 判断用户登录是否登录
|
|
12
|
-
* @returns {boolean} 是否登录
|
|
13
|
-
*/
|
|
14
|
-
function getLoginState() {
|
|
15
|
-
return window.isLogined;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 判断是否开启公告
|
|
19
|
-
* @returns {boolean} 是否开启公告
|
|
20
|
-
*/
|
|
21
|
-
function openNews() {
|
|
22
|
-
return !!$("#profile_block").length;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 获取粉丝数
|
|
26
|
-
* @returns {string} 粉丝数
|
|
27
|
-
*/
|
|
28
|
-
function getFollowers() {
|
|
29
|
-
return openNews() ? $("#profile_block a:nth-of-type(3)").text().trim() : "未知";
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 获取关注的人数
|
|
33
|
-
* @returns {string} 关注的人数
|
|
34
|
-
*/
|
|
35
|
-
function getFollowing() {
|
|
36
|
-
return openNews() ? $("#profile_block a:nth-of-type(4)").text().trim() : "未知";
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 判断是否已经关注
|
|
40
|
-
* @returns {boolean} 是否已经关注
|
|
41
|
-
*/
|
|
42
|
-
function getFollowState() {
|
|
43
|
-
return $("#p_b_follow>a").text().trim() === "-取消关注";
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 获取园龄
|
|
47
|
-
* @returns {string} 园龄
|
|
48
|
-
*/
|
|
49
|
-
function getBlogAge() {
|
|
50
|
-
return openNews() ? $("#profile_block a:nth-of-type(2)").text().trim() : "未知";
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* 获取当前博文链接
|
|
54
|
-
* @returns {string} 当前博文链接
|
|
55
|
-
*/
|
|
56
|
-
function getCurrentPostUrl() {
|
|
57
|
-
return !location.href.includes("#") ? location.href : location.href.substring(0, location.href.lastIndexOf("#"));
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 获取博客园 user guid
|
|
61
|
-
* @example '144690cc-79e2-4508-aa7f-08d6a1e9eeef'
|
|
62
|
-
*/
|
|
63
|
-
function getBlogUserGuid() {
|
|
64
|
-
if (window.cb_blogUserGuid) return window.cb_blogUserGuid;
|
|
65
|
-
const scriptElement = document.querySelector("#p_b_follow")?.nextElementSibling;
|
|
66
|
-
if (scriptElement?.tagName === "SCRIPT" && scriptElement.textContent) {
|
|
67
|
-
const match = scriptElement.textContent.match(/getFollowStatus\(['"]([^'"]+)['"]\)/);
|
|
68
|
-
if (match?.[1]) return match[1];
|
|
69
|
-
}
|
|
70
|
-
return "";
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* 关注
|
|
74
|
-
*/
|
|
75
|
-
function follow() {
|
|
76
|
-
if (isOwner()) return;
|
|
77
|
-
const guid = getBlogUserGuid();
|
|
78
|
-
window.follow(guid);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* 取消关注
|
|
82
|
-
*/
|
|
83
|
-
function unfollow() {
|
|
84
|
-
if (isOwner()) return;
|
|
85
|
-
const guid = getBlogUserGuid();
|
|
86
|
-
window.unfollow(guid);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 判断文章是否打开了评论
|
|
90
|
-
* @returns {boolean} 文章是否打开了评论
|
|
91
|
-
*/
|
|
92
|
-
function IsCommentTurnedOn() {
|
|
93
|
-
return !!$("#tbCommentBody").length;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* 判断是否为博文详情页
|
|
97
|
-
* @returns {boolean} 是否为博文详情页
|
|
98
|
-
*/
|
|
99
|
-
function isPostDetailsPage() {
|
|
100
|
-
return !!$("#post_detail").length;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* 是否为首页
|
|
104
|
-
* @returns {boolean} 是否为首页
|
|
105
|
-
*/
|
|
106
|
-
function isHomePage() {
|
|
107
|
-
return !!$(".day").length;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* 是否为标签列表页
|
|
111
|
-
* @returns {boolean} 是否为标签列表页
|
|
112
|
-
*/
|
|
113
|
-
function isTagListPage() {
|
|
114
|
-
return !!$("#taglist_main").length;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* 是否为博文详情页
|
|
118
|
-
* @returns {boolean} 是否为博文详情页
|
|
119
|
-
*/
|
|
120
|
-
function isEntrylistPage() {
|
|
121
|
-
return !!$(".entrylistPosttitle").length;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* 判断是否为相册页
|
|
125
|
-
* @returns {boolean} 是否为相册页
|
|
126
|
-
*/
|
|
127
|
-
function isAlbumPage() {
|
|
128
|
-
return !!$(".gallery").length;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* 判断是否为博文分类页
|
|
132
|
-
* @returns {boolean} 是否为博文分类页
|
|
133
|
-
*/
|
|
134
|
-
function isCategoryPage() {
|
|
135
|
-
return !!$(".entrylistItem").length;
|
|
136
|
-
}
|
|
137
|
-
function getCurrentPage() {
|
|
138
|
-
if (document.querySelectorAll(".day").length) return "home";
|
|
139
|
-
if (document.querySelector("#post_detail")) return "post";
|
|
140
|
-
if (document.querySelector("#taglist_main") || document.querySelector("#myposts")) return "tags";
|
|
141
|
-
if (document.querySelector(".entrylistTitle")?.textContent?.includes("档案")) return "post-archive";
|
|
142
|
-
if (document.querySelector(".entrylistTitle")?.textContent?.includes("随笔分类")) return "category";
|
|
143
|
-
if (document.querySelector(".gallery") && !document.querySelector("#ViewPicture1_GalleryImage")) return "photos";
|
|
144
|
-
if (document.querySelector(".gallery") && document.querySelector("#ViewPicture1_GalleryImage")) return "photo-view";
|
|
145
|
-
return "unknown";
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* 判断编辑器类型是否为 md
|
|
149
|
-
* @returns {boolean} 编辑器类型是否为 md
|
|
150
|
-
*/
|
|
151
|
-
function isMd() {
|
|
152
|
-
return $("#cnblogs_post_body").hasClass("cnblogs-markdown");
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* 判断编辑器类型是否为 tinymce 5
|
|
156
|
-
*/
|
|
157
|
-
function isTinymce5() {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* 判断文章内容是否存在标题
|
|
162
|
-
* @returns {boolean} 文章内容是否存在标题
|
|
163
|
-
*/
|
|
164
|
-
function hasPostTitle() {
|
|
165
|
-
return !!$("#cnblogs_post_body>h1,#cnblogs_post_body>h2,#cnblogs_post_body>h3,#cnblogs_post_body>h4").length;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* 推荐博文
|
|
169
|
-
* 博客园过滤机制禁止调用 `window.votePost`
|
|
170
|
-
* https://group.cnblogs.com/topic/115024.html
|
|
171
|
-
*/
|
|
172
|
-
function likePost() {
|
|
173
|
-
const diggElement = document.querySelector(".diggit");
|
|
174
|
-
if (diggElement) diggElement.click();
|
|
175
|
-
}
|
|
176
|
-
function unLikePost() {
|
|
177
|
-
const diggElement = document.querySelector(".digg_gray");
|
|
178
|
-
if (diggElement) diggElement.click();
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* 获取用户信息
|
|
182
|
-
* 仅当用户代码放到页脚 HTML 中才有效
|
|
183
|
-
* @returns {Promise<unknown>} 表示用户信息的 Promise 对象
|
|
184
|
-
*/
|
|
185
|
-
function getUserInfo() {
|
|
186
|
-
return new Promise((resolve) => {
|
|
187
|
-
$(document).ajaxComplete((_, xhr, settings) => {
|
|
188
|
-
if (settings.url === "https://account.cnblogs.com/user/userinfo") resolve($.parseJSON(xhr.responseText));
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* 获取消息数
|
|
194
|
-
* @returns {string} 消息数
|
|
195
|
-
*/
|
|
196
|
-
function getMessageCount() {
|
|
197
|
-
return $("#msg_count").text();
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* 获取随笔数量
|
|
201
|
-
* @returns {string} 随笔数量
|
|
202
|
-
*/
|
|
203
|
-
function getPostCount() {
|
|
204
|
-
return $("#stats_post_count").text().trim().replace(/\D/g, "");
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* 获取文章数量
|
|
208
|
-
* @returns {string} 文章数量
|
|
209
|
-
*/
|
|
210
|
-
function getArticleCount() {
|
|
211
|
-
return $("#stats_article_count").text().trim().replace(/\D/g, "");
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* 获取评论数量
|
|
215
|
-
* @returns {string} 评论数量
|
|
216
|
-
*/
|
|
217
|
-
function getCommentCount() {
|
|
218
|
-
return $("#stats-comment_count").text().trim().replace(/\D/g, "");
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* 获取博客访问总量
|
|
222
|
-
* @returns {string} 博客访问总量
|
|
223
|
-
*/
|
|
224
|
-
function getViewCount() {
|
|
225
|
-
return $("#stats-total-view-count>span").text().trim();
|
|
226
|
-
}
|
|
227
|
-
function setCodeTheme(mode) {
|
|
228
|
-
const theme = mode === "dark" ? window.darkModeCodeHighlightTheme : window.codeHighlightTheme;
|
|
229
|
-
window.highlighter.setTheme(theme);
|
|
230
|
-
}
|
|
231
|
-
function getCurrentBlogId() {
|
|
232
|
-
return window.currentBlogId;
|
|
233
|
-
}
|
|
234
|
-
function getCurrentBlogApp() {
|
|
235
|
-
return window.currentBlogApp;
|
|
236
|
-
}
|
|
237
|
-
function checkIsLogin() {
|
|
238
|
-
return window.isLogined;
|
|
239
|
-
}
|
|
240
|
-
function checkIsOwner() {
|
|
241
|
-
return window.isBlogOwner;
|
|
242
|
-
}
|
|
243
|
-
function getSkinName() {
|
|
244
|
-
return window.skinName;
|
|
245
|
-
}
|
|
246
|
-
function getVisitorUserId() {
|
|
247
|
-
return window.visitorUserId;
|
|
248
|
-
}
|
|
249
|
-
function checkHasCustomScript() {
|
|
250
|
-
return window.hasCustomScript;
|
|
251
|
-
}
|
|
252
|
-
function checkEnableMathjax() {
|
|
253
|
-
return window.cb_enable_mathjax;
|
|
254
|
-
}
|
|
255
|
-
function getMathEngine() {
|
|
256
|
-
return window.mathEngine;
|
|
257
|
-
}
|
|
258
|
-
function getCodeHighlightEngine() {
|
|
259
|
-
return window.codeHighlightEngine;
|
|
260
|
-
}
|
|
261
|
-
function checkEnableCodeLineNumber() {
|
|
262
|
-
return window.enableCodeLineNumber;
|
|
263
|
-
}
|
|
264
|
-
function getCodeHighlightTheme() {
|
|
265
|
-
return window.codeHighlightTheme;
|
|
266
|
-
}
|
|
267
|
-
function getDarkModeCodeHighlightTheme() {
|
|
268
|
-
return window.darkModeCodeHighlightTheme;
|
|
269
|
-
}
|
|
270
|
-
function checkIsDarkCodeHighlightTheme() {
|
|
271
|
-
return window.isDarkCodeHighlightTheme;
|
|
272
|
-
}
|
|
273
|
-
function checkIsDarkModeCodeHighlightThemeDark() {
|
|
274
|
-
return window.isDarkModeCodeHighlightThemeDark;
|
|
275
|
-
}
|
|
276
|
-
function checkIsDisableCodeHighlighter() {
|
|
277
|
-
return window.isDisableCodeHighlighter;
|
|
278
|
-
}
|
|
279
|
-
function checkEnableCodeThemeTypeFollowSystem() {
|
|
280
|
-
return window.enableCodeThemeTypeFollowSystem;
|
|
281
|
-
}
|
|
282
|
-
function checkEnableMacStyleCodeBlock() {
|
|
283
|
-
return window.enableMacStyleCodeBlock;
|
|
284
|
-
}
|
|
285
|
-
function getCurrentPostId() {
|
|
286
|
-
return window.currentPostId || null;
|
|
287
|
-
}
|
|
288
|
-
function getCurrentPostDateAdded() {
|
|
289
|
-
return window.currentPostDateAdded || null;
|
|
290
|
-
}
|
|
291
|
-
function getAntiforgeryToken() {
|
|
292
|
-
return document.querySelector("input[name=\"antiforgery_token\"]")?.value;
|
|
293
|
-
}
|
|
294
|
-
function getNickname() {
|
|
295
|
-
const title = document.title;
|
|
296
|
-
if (!title) return null;
|
|
297
|
-
const parts = title.split(" - ");
|
|
298
|
-
if (parts.length >= 2 && parts[parts.length - 1] === "博客园") {
|
|
299
|
-
const withoutBlogCn = parts.slice(0, -1).join(" - ");
|
|
300
|
-
if (withoutBlogCn.includes(" - ")) {
|
|
301
|
-
const nicknameParts = withoutBlogCn.split(" - ");
|
|
302
|
-
return nicknameParts[nicknameParts.length - 1].trim();
|
|
303
|
-
}
|
|
304
|
-
return withoutBlogCn.trim();
|
|
305
|
-
}
|
|
306
|
-
return null;
|
|
307
|
-
}
|
|
308
|
-
const { currentBlogApp } = window;
|
|
309
|
-
const home = "https://home.cnblogs.com";
|
|
310
|
-
const cnblog = "https://www.cnblogs.com";
|
|
311
|
-
const iCnblog = "https://i.cnblogs.com";
|
|
312
|
-
const msg = "https://msg.cnblogs.com";
|
|
313
|
-
function getDetailUrl() {
|
|
314
|
-
return `${home}/u/${currentBlogApp}`;
|
|
315
|
-
}
|
|
316
|
-
function getFollowersUrl() {
|
|
317
|
-
return `${home}/u/${currentBlogApp}/followers`;
|
|
318
|
-
}
|
|
319
|
-
function getFolloweesUrl() {
|
|
320
|
-
return `${home}/u/${currentBlogApp}/followees`;
|
|
321
|
-
}
|
|
322
|
-
function getCnblogHomeUrl() {
|
|
323
|
-
return cnblog;
|
|
324
|
-
}
|
|
325
|
-
function getRssUrl() {
|
|
326
|
-
return `${cnblog}/${currentBlogApp}/rss`;
|
|
327
|
-
}
|
|
328
|
-
function getIndexUrl() {
|
|
329
|
-
return `${cnblog}/${currentBlogApp}`;
|
|
330
|
-
}
|
|
331
|
-
function getMydiggedUrl() {
|
|
332
|
-
return `${cnblog}/aggsite/mydigged`;
|
|
333
|
-
}
|
|
334
|
-
function getCommentedUrl() {
|
|
335
|
-
return `${cnblog}/aggsite/mycommented`;
|
|
336
|
-
}
|
|
337
|
-
function getFollowingUrl() {
|
|
338
|
-
return `${cnblog}/following`;
|
|
339
|
-
}
|
|
340
|
-
function getNewPostUrl() {
|
|
341
|
-
return `${iCnblog}/posts/edit`;
|
|
342
|
-
}
|
|
343
|
-
function getSendUrl() {
|
|
344
|
-
return $("#blog_nav_contact").attr("href") || "";
|
|
345
|
-
}
|
|
346
|
-
function getAdminUrl() {
|
|
347
|
-
return iCnblog;
|
|
348
|
-
}
|
|
349
|
-
function getMessageUrl() {
|
|
350
|
-
return `${msg}`;
|
|
351
|
-
}
|
|
352
|
-
function getContactUrl() {
|
|
353
|
-
return `${msg}/send/${currentBlogApp}`;
|
|
354
|
-
}
|
|
355
|
-
function getAppWzUrl() {
|
|
356
|
-
return "https://wz.cnblogs.com";
|
|
357
|
-
}
|
|
358
|
-
function getAppQUrl() {
|
|
359
|
-
return "https://q.cnblogs.com";
|
|
360
|
-
}
|
|
361
|
-
function getAppIngUrl() {
|
|
362
|
-
return "https://ing.cnblogs.com";
|
|
363
|
-
}
|
|
364
|
-
function getAppGroupUrl() {
|
|
365
|
-
return "https://group.cnblogs.com";
|
|
366
|
-
}
|
|
367
|
-
function getDraftBoxUrl() {
|
|
368
|
-
return "https://i.cnblogs.com/posts";
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
//#endregion
|
|
372
|
-
exports.IsCommentTurnedOn = IsCommentTurnedOn;
|
|
373
|
-
exports.checkEnableCodeLineNumber = checkEnableCodeLineNumber;
|
|
374
|
-
exports.checkEnableCodeThemeTypeFollowSystem = checkEnableCodeThemeTypeFollowSystem;
|
|
375
|
-
exports.checkEnableMacStyleCodeBlock = checkEnableMacStyleCodeBlock;
|
|
376
|
-
exports.checkEnableMathjax = checkEnableMathjax;
|
|
377
|
-
exports.checkHasCustomScript = checkHasCustomScript;
|
|
378
|
-
exports.checkIsDarkCodeHighlightTheme = checkIsDarkCodeHighlightTheme;
|
|
379
|
-
exports.checkIsDarkModeCodeHighlightThemeDark = checkIsDarkModeCodeHighlightThemeDark;
|
|
380
|
-
exports.checkIsDisableCodeHighlighter = checkIsDisableCodeHighlighter;
|
|
381
|
-
exports.checkIsLogin = checkIsLogin;
|
|
382
|
-
exports.checkIsOwner = checkIsOwner;
|
|
383
|
-
exports.follow = follow;
|
|
384
|
-
exports.getAdminUrl = getAdminUrl;
|
|
385
|
-
exports.getAntiforgeryToken = getAntiforgeryToken;
|
|
386
|
-
exports.getAppGroupUrl = getAppGroupUrl;
|
|
387
|
-
exports.getAppIngUrl = getAppIngUrl;
|
|
388
|
-
exports.getAppQUrl = getAppQUrl;
|
|
389
|
-
exports.getAppWzUrl = getAppWzUrl;
|
|
390
|
-
exports.getArticleCount = getArticleCount;
|
|
391
|
-
exports.getBlogAge = getBlogAge;
|
|
392
|
-
exports.getBlogUserGuid = getBlogUserGuid;
|
|
393
|
-
exports.getCnblogHomeUrl = getCnblogHomeUrl;
|
|
394
|
-
exports.getCodeHighlightEngine = getCodeHighlightEngine;
|
|
395
|
-
exports.getCodeHighlightTheme = getCodeHighlightTheme;
|
|
396
|
-
exports.getCommentCount = getCommentCount;
|
|
397
|
-
exports.getCommentedUrl = getCommentedUrl;
|
|
398
|
-
exports.getContactUrl = getContactUrl;
|
|
399
|
-
exports.getCurrentBlogApp = getCurrentBlogApp;
|
|
400
|
-
exports.getCurrentBlogId = getCurrentBlogId;
|
|
401
|
-
exports.getCurrentPage = getCurrentPage;
|
|
402
|
-
exports.getCurrentPostDateAdded = getCurrentPostDateAdded;
|
|
403
|
-
exports.getCurrentPostId = getCurrentPostId;
|
|
404
|
-
exports.getCurrentPostUrl = getCurrentPostUrl;
|
|
405
|
-
exports.getDarkModeCodeHighlightTheme = getDarkModeCodeHighlightTheme;
|
|
406
|
-
exports.getDetailUrl = getDetailUrl;
|
|
407
|
-
exports.getDraftBoxUrl = getDraftBoxUrl;
|
|
408
|
-
exports.getFollowState = getFollowState;
|
|
409
|
-
exports.getFolloweesUrl = getFolloweesUrl;
|
|
410
|
-
exports.getFollowers = getFollowers;
|
|
411
|
-
exports.getFollowersUrl = getFollowersUrl;
|
|
412
|
-
exports.getFollowing = getFollowing;
|
|
413
|
-
exports.getFollowingUrl = getFollowingUrl;
|
|
414
|
-
exports.getIndexUrl = getIndexUrl;
|
|
415
|
-
exports.getLoginState = getLoginState;
|
|
416
|
-
exports.getMathEngine = getMathEngine;
|
|
417
|
-
exports.getMessageCount = getMessageCount;
|
|
418
|
-
exports.getMessageUrl = getMessageUrl;
|
|
419
|
-
exports.getMydiggedUrl = getMydiggedUrl;
|
|
420
|
-
exports.getNewPostUrl = getNewPostUrl;
|
|
421
|
-
exports.getNickname = getNickname;
|
|
422
|
-
exports.getPostCount = getPostCount;
|
|
423
|
-
exports.getRssUrl = getRssUrl;
|
|
424
|
-
exports.getSendUrl = getSendUrl;
|
|
425
|
-
exports.getSkinName = getSkinName;
|
|
426
|
-
exports.getUserInfo = getUserInfo;
|
|
427
|
-
exports.getViewCount = getViewCount;
|
|
428
|
-
exports.getVisitorUserId = getVisitorUserId;
|
|
429
|
-
exports.hasPostTitle = hasPostTitle;
|
|
430
|
-
exports.isAlbumPage = isAlbumPage;
|
|
431
|
-
exports.isCategoryPage = isCategoryPage;
|
|
432
|
-
exports.isEntrylistPage = isEntrylistPage;
|
|
433
|
-
exports.isHomePage = isHomePage;
|
|
434
|
-
exports.isMd = isMd;
|
|
435
|
-
exports.isOwner = isOwner;
|
|
436
|
-
exports.isPostDetailsPage = isPostDetailsPage;
|
|
437
|
-
exports.isTagListPage = isTagListPage;
|
|
438
|
-
exports.isTinymce5 = isTinymce5;
|
|
439
|
-
exports.likePost = likePost;
|
|
440
|
-
exports.openNews = openNews;
|
|
441
|
-
exports.setCodeTheme = setCodeTheme;
|
|
442
|
-
exports.unLikePost = unLikePost;
|
|
443
|
-
exports.unfollow = unfollow;
|
package/dist/index.d.cts
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
//#region src/index.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* 判断访问者是否为博主
|
|
4
|
-
* @returns {boolean} boolean - 是否为博主
|
|
5
|
-
*/
|
|
6
|
-
declare function isOwner(): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* 判断用户登录是否登录
|
|
9
|
-
* @returns {boolean} 是否登录
|
|
10
|
-
*/
|
|
11
|
-
declare function getLoginState(): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* 判断是否开启公告
|
|
14
|
-
* @returns {boolean} 是否开启公告
|
|
15
|
-
*/
|
|
16
|
-
declare function openNews(): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* 获取粉丝数
|
|
19
|
-
* @returns {string} 粉丝数
|
|
20
|
-
*/
|
|
21
|
-
declare function getFollowers(): string;
|
|
22
|
-
/**
|
|
23
|
-
* 获取关注的人数
|
|
24
|
-
* @returns {string} 关注的人数
|
|
25
|
-
*/
|
|
26
|
-
declare function getFollowing(): string;
|
|
27
|
-
/**
|
|
28
|
-
* 判断是否已经关注
|
|
29
|
-
* @returns {boolean} 是否已经关注
|
|
30
|
-
*/
|
|
31
|
-
declare function getFollowState(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 获取园龄
|
|
34
|
-
* @returns {string} 园龄
|
|
35
|
-
*/
|
|
36
|
-
declare function getBlogAge(): string;
|
|
37
|
-
/**
|
|
38
|
-
* 获取当前博文链接
|
|
39
|
-
* @returns {string} 当前博文链接
|
|
40
|
-
*/
|
|
41
|
-
declare function getCurrentPostUrl(): string;
|
|
42
|
-
/**
|
|
43
|
-
* 获取博客园 user guid
|
|
44
|
-
* @example '144690cc-79e2-4508-aa7f-08d6a1e9eeef'
|
|
45
|
-
*/
|
|
46
|
-
declare function getBlogUserGuid(): string;
|
|
47
|
-
/**
|
|
48
|
-
* 关注
|
|
49
|
-
*/
|
|
50
|
-
declare function follow(): void;
|
|
51
|
-
/**
|
|
52
|
-
* 取消关注
|
|
53
|
-
*/
|
|
54
|
-
declare function unfollow(): void;
|
|
55
|
-
/**
|
|
56
|
-
* 判断文章是否打开了评论
|
|
57
|
-
* @returns {boolean} 文章是否打开了评论
|
|
58
|
-
*/
|
|
59
|
-
declare function IsCommentTurnedOn(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* 判断是否为博文详情页
|
|
62
|
-
* @returns {boolean} 是否为博文详情页
|
|
63
|
-
*/
|
|
64
|
-
declare function isPostDetailsPage(): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* 是否为首页
|
|
67
|
-
* @returns {boolean} 是否为首页
|
|
68
|
-
*/
|
|
69
|
-
declare function isHomePage(): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* 是否为标签列表页
|
|
72
|
-
* @returns {boolean} 是否为标签列表页
|
|
73
|
-
*/
|
|
74
|
-
declare function isTagListPage(): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* 是否为博文详情页
|
|
77
|
-
* @returns {boolean} 是否为博文详情页
|
|
78
|
-
*/
|
|
79
|
-
declare function isEntrylistPage(): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* 判断是否为相册页
|
|
82
|
-
* @returns {boolean} 是否为相册页
|
|
83
|
-
*/
|
|
84
|
-
declare function isAlbumPage(): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* 判断是否为博文分类页
|
|
87
|
-
* @returns {boolean} 是否为博文分类页
|
|
88
|
-
*/
|
|
89
|
-
declare function isCategoryPage(): boolean;
|
|
90
|
-
declare function getCurrentPage(): 'home' | 'post' | 'tags' | 'post-archive' | 'category' | 'photos' | 'photo-view' | 'unknown';
|
|
91
|
-
/**
|
|
92
|
-
* 判断编辑器类型是否为 md
|
|
93
|
-
* @returns {boolean} 编辑器类型是否为 md
|
|
94
|
-
*/
|
|
95
|
-
declare function isMd(): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* 判断编辑器类型是否为 tinymce 5
|
|
98
|
-
*/
|
|
99
|
-
declare function isTinymce5(): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* 判断文章内容是否存在标题
|
|
102
|
-
* @returns {boolean} 文章内容是否存在标题
|
|
103
|
-
*/
|
|
104
|
-
declare function hasPostTitle(): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* 推荐博文
|
|
107
|
-
* 博客园过滤机制禁止调用 `window.votePost`
|
|
108
|
-
* https://group.cnblogs.com/topic/115024.html
|
|
109
|
-
*/
|
|
110
|
-
declare function likePost(): void;
|
|
111
|
-
declare function unLikePost(): void;
|
|
112
|
-
/**
|
|
113
|
-
* 获取用户信息
|
|
114
|
-
* 仅当用户代码放到页脚 HTML 中才有效
|
|
115
|
-
* @returns {Promise<unknown>} 表示用户信息的 Promise 对象
|
|
116
|
-
*/
|
|
117
|
-
declare function getUserInfo(): Promise<unknown>;
|
|
118
|
-
/**
|
|
119
|
-
* 获取消息数
|
|
120
|
-
* @returns {string} 消息数
|
|
121
|
-
*/
|
|
122
|
-
declare function getMessageCount(): string;
|
|
123
|
-
/**
|
|
124
|
-
* 获取随笔数量
|
|
125
|
-
* @returns {string} 随笔数量
|
|
126
|
-
*/
|
|
127
|
-
declare function getPostCount(): string;
|
|
128
|
-
/**
|
|
129
|
-
* 获取文章数量
|
|
130
|
-
* @returns {string} 文章数量
|
|
131
|
-
*/
|
|
132
|
-
declare function getArticleCount(): string;
|
|
133
|
-
/**
|
|
134
|
-
* 获取评论数量
|
|
135
|
-
* @returns {string} 评论数量
|
|
136
|
-
*/
|
|
137
|
-
declare function getCommentCount(): string;
|
|
138
|
-
/**
|
|
139
|
-
* 获取博客访问总量
|
|
140
|
-
* @returns {string} 博客访问总量
|
|
141
|
-
*/
|
|
142
|
-
declare function getViewCount(): string;
|
|
143
|
-
declare function setCodeTheme(mode: 'dark' | 'light'): void;
|
|
144
|
-
declare function getCurrentBlogId(): string;
|
|
145
|
-
declare function getCurrentBlogApp(): string;
|
|
146
|
-
declare function checkIsLogin(): boolean;
|
|
147
|
-
declare function checkIsOwner(): boolean;
|
|
148
|
-
declare function getSkinName(): string;
|
|
149
|
-
declare function getVisitorUserId(): string;
|
|
150
|
-
declare function checkHasCustomScript(): boolean;
|
|
151
|
-
declare function checkEnableMathjax(): boolean;
|
|
152
|
-
declare function getMathEngine(): number;
|
|
153
|
-
declare function getCodeHighlightEngine(): number;
|
|
154
|
-
declare function checkEnableCodeLineNumber(): boolean;
|
|
155
|
-
declare function getCodeHighlightTheme(): string;
|
|
156
|
-
declare function getDarkModeCodeHighlightTheme(): string;
|
|
157
|
-
declare function checkIsDarkCodeHighlightTheme(): boolean;
|
|
158
|
-
declare function checkIsDarkModeCodeHighlightThemeDark(): boolean;
|
|
159
|
-
declare function checkIsDisableCodeHighlighter(): boolean;
|
|
160
|
-
declare function checkEnableCodeThemeTypeFollowSystem(): boolean;
|
|
161
|
-
declare function checkEnableMacStyleCodeBlock(): boolean;
|
|
162
|
-
declare function getCurrentPostId(): number | null;
|
|
163
|
-
declare function getCurrentPostDateAdded(): string | null;
|
|
164
|
-
declare function getAntiforgeryToken(): string | null;
|
|
165
|
-
declare function getNickname(): string | null;
|
|
166
|
-
declare function getDetailUrl(): string;
|
|
167
|
-
declare function getFollowersUrl(): string;
|
|
168
|
-
declare function getFolloweesUrl(): string;
|
|
169
|
-
declare function getCnblogHomeUrl(): string;
|
|
170
|
-
declare function getRssUrl(): string;
|
|
171
|
-
declare function getIndexUrl(): string;
|
|
172
|
-
declare function getMydiggedUrl(): string;
|
|
173
|
-
declare function getCommentedUrl(): string;
|
|
174
|
-
declare function getFollowingUrl(): string;
|
|
175
|
-
declare function getNewPostUrl(): string;
|
|
176
|
-
declare function getSendUrl(): string;
|
|
177
|
-
declare function getAdminUrl(): string;
|
|
178
|
-
declare function getMessageUrl(): string;
|
|
179
|
-
declare function getContactUrl(): string;
|
|
180
|
-
declare function getAppWzUrl(): string;
|
|
181
|
-
declare function getAppQUrl(): string;
|
|
182
|
-
declare function getAppIngUrl(): string;
|
|
183
|
-
declare function getAppGroupUrl(): string;
|
|
184
|
-
declare function getDraftBoxUrl(): string;
|
|
185
|
-
//#endregion
|
|
186
|
-
export { IsCommentTurnedOn, checkEnableCodeLineNumber, checkEnableCodeThemeTypeFollowSystem, checkEnableMacStyleCodeBlock, checkEnableMathjax, checkHasCustomScript, checkIsDarkCodeHighlightTheme, checkIsDarkModeCodeHighlightThemeDark, checkIsDisableCodeHighlighter, checkIsLogin, checkIsOwner, follow, getAdminUrl, getAntiforgeryToken, getAppGroupUrl, getAppIngUrl, getAppQUrl, getAppWzUrl, getArticleCount, getBlogAge, getBlogUserGuid, getCnblogHomeUrl, getCodeHighlightEngine, getCodeHighlightTheme, getCommentCount, getCommentedUrl, getContactUrl, getCurrentBlogApp, getCurrentBlogId, getCurrentPage, getCurrentPostDateAdded, getCurrentPostId, getCurrentPostUrl, getDarkModeCodeHighlightTheme, getDetailUrl, getDraftBoxUrl, getFollowState, getFolloweesUrl, getFollowers, getFollowersUrl, getFollowing, getFollowingUrl, getIndexUrl, getLoginState, getMathEngine, getMessageCount, getMessageUrl, getMydiggedUrl, getNewPostUrl, getNickname, getPostCount, getRssUrl, getSendUrl, getSkinName, getUserInfo, getViewCount, getVisitorUserId, hasPostTitle, isAlbumPage, isCategoryPage, isEntrylistPage, isHomePage, isMd, isOwner, isPostDetailsPage, isTagListPage, isTinymce5, likePost, openNews, setCodeTheme, unLikePost, unfollow };
|
|
187
|
-
//# sourceMappingUR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