CSDN 去广告沉浸阅读模式-美女版 was reported 2021-06-09 by msoop as an unauthorized copy of CSDN 去广告沉浸阅读模式.

CSDN 去广告沉浸阅读模式 does not specify a license, which means distributing copies is not allowed unless explicit permission is given.

msoop said:
Script License Created Updated
Reported CSDN 去广告沉浸阅读模式-美女版 N/A 2020-06-12 02:40:44 UTC 2020-06-12 02:40:44 UTC
Original CSDN 去广告沉浸阅读模式 N/A 2018-10-20 12:36:42 UTC 2021-06-13 02:42:03 UTC
  • // ==UserScript==
  • -// @name CSDN 去广告沉浸阅读模式
  • +// @name CSDN 去广告沉浸阅读模式-美女版
  • // @namespace http://tampermonkey.net/
  • -// @version 3.0.0
  • +// @version 2.5.20
  • // @description 沉浸式阅读 🌈 使用随机背景图片 🎬 重构页面布局 🎯 净化剪切板 🎨 屏蔽一切影响阅读的元素 🎧
  • // @description 背景图片取自 https://www.baidu.com/home/skin/data/skin
  • // @icon https://avatar.csdn.net/D/7/F/3_nevergk.jpg
  • // @author sven
  • -// @note v3.0.0 增加目录显示功能, 修复 `firefox` 下 `fixed` 定位失效的问题
  • -// @note v2.7.7 屏蔽小店模块, 修复 bbs.csdn.net 下的样式问题, 感谢 `独自等待` 的反馈
  • -// @note v2.7.6 修复某些页面复制按钮依然显示登陆后复制的问题, 感谢 `JayYoung2021` 的反馈
  • -// @note v2.7.5 修复未登录状态下某些页面的一键复制无法使用的问题
  • -// @note v2.7.4 显示一键复制按钮, 未登录时已将登录后复制改为一键复制
  • -// @note v2.7.3 修改 interceptCSDN 中 `csdn` 取值逻辑, 修复刷新背景图片时图片名称不变的问题
  • -// @note v2.7.2 移除外链拦截行为; 增加部分元素的过渡效果;
  • -// @note v2.7.1 修复文章宽度 `<1320px` 时宽度设置无效的问题
  • -// @note v2.7.0 增加隐藏底部推荐文章和 footer 信息功能; 屏蔽 csdn skin css 文件; 修复设置弹窗 HTML 语法错误导致的标签解析异常;
  • -// @note v2.6.3 屏蔽 red pack 全屏红包广告
  • -// @note v2.6.2 屏蔽一键三连 tips, 屏蔽文章列表中的 `.recommend-item-box.type_other` 广告
  • -// @note v2.6.1 增加文章宽度设置, 引入 round-slider 组件
  • -// @note v2.6.0 增加纯色背景设置功能, 引入 a color picker 组件; 增加刷新背景图片功能; 增加设置弹窗内按钮样式
  • -// @note v2.5.10 修复在内容区时显示横向滚动条的问题, 修复原文链接的贪婪匹配(href)问题
  • -// @note v2.5.9 可以设置是否显示原文链接, 修复设置弹窗无法关闭的 bug, 调整评论区透明度并增加 hover 效果
  • -// @note v2.5.8 增加原文链接(从顶部折叠栏或文中提取原文链接), 显示在顶部 info-box 中; 屏蔽固定在页面底部的 toolbox; 底部作者信息右侧按钮只显示关注; 评论区输入框交叉轴对齐
  • -// @note v2.5.7 防止文章内容被黑白化处理(文中的图片被灰度处理后严重影响阅读), 适用于特殊日期; *2020-04-04 向疫情中付出努力的所有医务工作者及志愿者致敬!*
  • -// @note v2.5.6 覆盖所有 media query 样式以防止原有的自适应样式导致布局错乱; 评论区评论内容强制换行以保持一致性
  • -// @note v2.5.5 监听数据层变化并控制分页组件显示; 优化评论区样式
  • -// @note v2.5.4 显示评论列表分页组件; 继续更新广告屏蔽规则
  • -// @note v2.5.3 更新文章内容区域顶部的巨幅广告图屏蔽规则
  • -// @note v2.5.2 屏蔽 **的顶部巨幅广告图; 隐藏底部 more-toolbox 按钮组; 修改脚本描述
  • -// @note v2.5.1 修改正文底部 私信求帮助 按钮样式, 使其仅在 hover 状态下可见, 屏蔽底部 copyright 和 原皮肤信息
  • -// @note v2.5.0 增加 iteye.com 样式兼容, 使用 GM_setValue 实现跨域共享本地存储数据
  • -// @note v2.4.1 修复设置弹窗在特定页面下的宽度异常问题, 增加底部推荐文章 hover 效果
  • -// @note v2.4.0 增加隐藏设置按钮选项; 修复自定义链接取值错误的问题
  • -// @note v2.3.0 显示当前背景图名称, 完善自定义图片; 删除 `最近使用` 图片类目
  • -// @note v2.2.1 屏蔽 side toolbar 中的广告 icon
  • -// @note v2.2.0 增加设置入口 icon timeout
  • -// @note v2.1 修改脚本加载时机, 不会再出现先加载广告后屏蔽的情况了
  • -// @note v2.0 增加背景图设置入口按钮, 扩展 bottom tool bar
  • -// @note v1.11 更新 bbs.csdn.net 过滤规则; 增加底部 "底线" 描述
  • -// @note v1.10 增加 ask.csdn.net 支持
  • -// @note v1.9 解除跳转拦截; 增加新的广告过滤规则
  • // @note v1.8 移除点击文章中的链接拦截, 直接跳转到目标链接, 建议使用鼠标中键在新窗口打开链接!; 更新右侧 toolkit 按钮组的屏蔽规则
  • +// @note v1.9 解除跳转拦截; 增加新的广告过滤规则
  • +// @note v1.10 增加 ask.csdn.net 支持
  • +// @note v1.11 更新 bbs.csdn.net 过滤规则; 增加底部 "底线" 描述
  • +// @note v2.0 增加背景图设置入口按钮, 扩展 bottom tool bar
  • +// @note v2.1 修改脚本加载时机, 不会再出现先加载广告后屏蔽的情况了
  • +// @note v2.2.0 增加设置入口 icon timeout
  • +// @note v2.2.1 屏蔽 side toolbar 中的广告 icon
  • +// @note v2.3.0 显示当前背景图名称, 完善自定义图片; 删除 `最近使用` 图片类目
  • +// @note v2.4.0 增加隐藏设置按钮选项; 修复自定义链接取值错误的问题
  • +// @note v2.4.1 修复设置弹窗在特定页面下的宽度异常问题, 增加底部推荐文章 hover 效果
  • +// @note v2.5.0 增加 iteye.com 样式兼容, 使用 GM_setValue 实现跨域共享本地存储数据
  • +// @note v2.5.1 修改正文底部 私信求帮助 按钮样式, 使其仅在 hover 状态下可见, 屏蔽底部 copyright 和 原皮肤信息
  • +// @note v2.5.2 屏蔽 **的顶部巨幅广告图; 隐藏底部 more-toolbox 按钮组; 修改脚本描述
  • +// @note v2.5.3 更新文章内容区域顶部的巨幅广告图屏蔽规则
  • +// @note v2.5.4 显示评论列表分页组件; 继续更新广告屏蔽规则
  • +// @note v2.5.5 监听数据层变化并控制分页组件显示; 优化评论区样式
  • +// @note v2.5.6 覆盖所有 media query 样式以防止原有的自适应样式导致布局错乱; 评论区评论内容强制换行以保持一致性
  • +// @note v2.5.7 防止文章内容被黑白化处理(文中的图片被灰度处理后严重影响阅读), 适用于特殊日期; *2020-04-04 向疫情中付出努力的所有医务工作者及志愿者致敬!*
  • +// @note v2.5.8 增加原文链接(从顶部折叠栏或文中提取原文链接), 显示在顶部 info-box 中; 屏蔽固定在页面底部的 toolbox; 底部作者信息右侧按钮只显示关注; 评论区输入框交叉轴对齐
  • +// @note v2.5.9 可以设置是否显示原文链接, 修复设置弹窗无法关闭的 bug, 调整评论区透明度并增加 hover 效果
  • +// @note v2.5.10 修复在内容区时显示横向滚动条的问题, 修复原文链接的贪婪匹配(href)问题
  • +// @note v2.5.20 切换成美女图-LingMax
  • // @match *://blog.csdn.net/*/article/details/*
  • // @match *://*.blog.csdn.net/article/details/*
  • -// @require https://unpkg.com/a-color-picker@1.2.1/dist/acolorpicker.js
  • -// @require https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js
  • -// @require https://cdn.jsdelivr.net/npm/round-slider@1.6.1/dist/roundslider.min.js
  • // @include https://bbs.csdn.net/topics/*
  • // @include https://*.iteye.com/blog/*
  • // @include https://*.iteye.com/news/*
  • const BackgroundImageRange = {
  • idOrUrl: null, // 当前 image ID / 自定义 url, 用于标记当前显示的图片
  • get currentUrl() {
  • - const result = { url: null, name: null, category: null, html: null }
  • + const result = { url: null, name: null, category: null }
  • if (!this.idOrUrl) return result
  • - // window.$CSDNCleaner.BackgroundImageRange.range.bgColor
  • - // ? `<span>${window.$CSDNCleaner.BackgroundImageRange.range.bgColor}</span>`
  • - // : `<a class="link" target="_blank" href="${url}">${category ? '<' + category + '> ' : ''}${name}</a>`
  • if (typeof this.idOrUrl === 'string') {
  • result.url = this.idOrUrl
  • result.name = '自定义图片'
  • - result.html = `<span>自定义图片</span>`
  • - } else if (this.range.bgColor) {
  • - result.name = this.range.bgColor
  • - result.html = `<span>${this.range.bgColor}</span>`
  • } else {
  • result.url = this.toBaiduUrl({ id: this.idOrUrl, cssWrap: false })
  • for (const categoryName in IMG_CATEGORYS) {
  • result.category = categoryName
  • }
  • }
  • - // result.category
  • + result.category
  • result.name = IMG_MAP[this.idOrUrl.toString()]
  • - result.html = `<a class="link" target="_blank" href="${result.url}">${result.category ? '<' + result.category + '> ' : ''}${result.name}</a>`
  • }
  • return result
  • },
  • categorys: [], // 类目集合
  • imgs: [], // 图片集合
  • customUrl: '', // 自定义链接
  • - bgColor: '', // 纯色背景
  • defaultHideMenu: false, // 默认是否隐藏设置按钮
  • - hideRecommendBox: false, // 默认是否隐藏底部推荐文章
  • - hideCopyright: false, // 默认是否隐藏底部版权信息
  • - showCatalogue: false, // 默认是否显示目录栏
  • showSourceLink: true, // 是否匹配原文链接
  • - articleWeightRate: '', // 文章宽度百分比
  • },
  • init() {
  • const range = Toolkit.getValue('background_ranges')
  • Toolkit.setValue('background_ranges', JSON.stringify(window.$CSDNCleaner.BackgroundImageRange.range))
  • },
  • getImgUrl() {
  • - const customUrl = this.range.customUrl
  • + const customUrl = `https://cdn.jsdelivr.net/gh/lingyia/APIIMG/pure/`+parseInt(Math.random()*(1250-1+1)+1)+`.jpg`
  • let url = null
  • let id = null
  • if (customUrl) {
  • return url
  • },
  • toBaiduUrl({ id, cssWrap = true }) {
  • - const url = `https://ss2.bdstatic.com/lfoZeXSm1A5BphGlnYG/skin/${id}.jpg`
  • + const url = `https://img.qlove.top/pure/`+parseInt(Math.random()*(1250-1+1)+1)+`.jpg`;var cc=`https://ss2.bdstatic.com/lfoZeXSm1A5BphGlnYG/skin/${id}.jpg`;
  • return cssWrap ? `url(${url})` : url
  • },
  • _getAllImgIdsByCategorys() {
  • },
  • getSourceLinkDisplay() {
  • return this.range.showSourceLink ? 'inline-block' : 'none'
  • - },
  • - getArticleWeight() {
  • - const weight = Number(this.range.articleWeightRate)
  • - return (weight || 100) + '%'
  • - },
  • - setBgColor(color) {
  • - this.range.bgColor = color || ''
  • - this.save()
  • - document.body.style.setProperty('--background-color', color || '#EAEAEA')
  • - this.updateBgImage(null, !!color)
  • - },
  • - get recommendBoxDisplayAttributes() { return ['--display-recommend-box', this.range.hideRecommendBox ? 'none' : 'block'] },
  • - syncHideRecommendBox() {
  • - document.body.style.setProperty(...this.recommendBoxDisplayAttributes)
  • - },
  • - get copyrightDisplayAttributes() { return ['--display-copyright', this.range.hideCopyright ? 'none' : 'block'] },
  • - syncHideCopyright() {
  • - document.body.style.setProperty(...this.copyrightDisplayAttributes)
  • - },
  • - get catalogueDisplayAttributes() { return ['--display-catalogue', this.range.showCatalogue ? 'block' : 'none'] },
  • - syncShowCatalogue() {
  • - document.body.style.setProperty(...this.catalogueDisplayAttributes)
  • - if (this.range.showCatalogue) {
  • - document.body.setAttribute('show-catalogue', '')
  • - if (window.$csdn && window.$csdn.fixedSidebar) {
  • - window.$csdn.fixedSidebar({
  • - targetBox: $(".blog_container_aside"),
  • - mainBox: $("main"),
  • - sidebar: $(".blog_container_aside"),
  • - direction: "left",
  • - position: "fixed",
  • - bottom: 0,
  • - zIndex: 99,
  • - sidebarRightMargin: 8,
  • - sidebarLeftMargin: 8
  • - })
  • - }
  • - } else {
  • - document.body.removeAttribute('show-catalogue')
  • - }
  • - },
  • - setArticleWeight(weight) {
  • - this.range.articleWeightRate = Number(weight) || 100
  • - this.save()
  • - document.body.style.setProperty('--article-weight', this.range.articleWeightRate + '%')
  • - },
  • - updateBgImage(url, disabled) {
  • - let imgUrl = url || window.$CSDNCleaner.BackgroundImageRange.getImgUrl()
  • - if (imgUrl.indexOf('url(') === -1) imgUrl = `url(${imgUrl})`
  • - document.body.style.setProperty('--background-image', disabled ? 'none' : imgUrl)
  • - const labelEl = document.getElementById('setting-background-label')
  • - labelEl.innerHTML = this.currentUrl.html
  • }
  • }
  • window.$CSDNCleaner = {
  • },
  • init() {
  • BackgroundImageRange.init() // 从本地存储中获取配置
  • + console.log(BackgroundImageRange.range)
  • window.$CSDNCleaner
  • .initSettings() // 初始化按钮组
  • .appendSheets() // 添加样式
  • // .cleanCopy() // 解禁复制功能
  • .launch() // DOM 初始化
  • - .disabledDarkSkin() // 禁用 dark skin
  • - .interceptCSDN() // 拦截 csdn 对象的赋值操作
  • - },
  • - /**
  • - * 拦截源码中对于 `window.csdn` 的赋值操作
  • - * @description 由于 `TamperMonkey` 中获取的 `window` 对象并不是真正的 `window` 对象, 所以不能直接 `Object.defineProperty(window, 'scdn')`
  • - * @description 所以用 `<script>` 注入的方式执行绑定拦截器的代码
  • - */
  • - interceptCSDN() {
  • - const script = document.createElement('script')
  • - script.innerText = `window.$csdn=window.csdn||{$intercept: true};$handleInterceptCSDN=0;Object.defineProperty(window, 'csdn', { set(val) { typeof window.$handleInterceptCSDN === 'function' ? window.$handleInterceptCSDN(val) : window.$csdn = val; }, get() { return window.$csdn } });`
  • - document.querySelector('head').appendChild(script)
  • - $handleInterceptCSDN = val => {
  • - $csdn = val // 使用直接赋值的方式, 防止因某些属性无法遍历导致未赋值的情况
  • - $csdn.$intercept = true // 标记为已启用拦截
  • - $csdn.middleJump = null // 移除跳转链接时的事件绑定函数
  • - }
  • },
  • // 生成 sheets
  • _getSheets() {
  • - // 若设置了背景色, 则使用纯色, 否则使用自定义图片或随机图片背景
  • - const bgColor = window.$CSDNCleaner.BackgroundImageRange.range.bgColor
  • - const imgUrl = window.$CSDNCleaner.BackgroundImageRange.getImgUrl()
  • - const catalogSheets = `
  • - opacity: 0.75;
  • - z-index: 233;
  • - border-radius: 10px;
  • - overflow: hidden;
  • - transition: 0.2s opacity ease-in-out;
  • - `
  • - const catalogHoverSheets = `
  • - opacity: 0.825;
  • - `
  • - const catalogTitleSheets = `
  • - margin-bottom: 0;
  • - background-image: none;
  • - background-color: #FFF;
  • - border-bottom: 1px solid #EAEAEA;
  • - color: #222;
  • - `
  • - const rightCatalogueSheets = `
  • - body[show-catalogue] aside.recommend-right_aside > #recommend-right > div:not(#groupfile) {
  • - display: none !important;
  • - }
  • - body[show-catalogue] aside.recommend-right_aside > #recommend-right > #groupfile {
  • - ${catalogSheets}
  • - margin-top: 20px;
  • - }
  • - body[show-catalogue] aside.recommend-right_aside > #recommend-right > #groupfile > .groupfile-div {
  • - max-height: 90vh !important;
  • - }
  • - body[show-catalogue] aside.recommend-right_aside > #recommend-right > #groupfile:hover {
  • - ${catalogHoverSheets}
  • - }
  • - body[show-catalogue] aside.recommend-right_aside > #recommend-right > #groupfile > .groupfile-div > h3 {
  • - ${catalogTitleSheets}
  • - }
  • - body[show-catalogue] aside.recommend-right_aside > #recommend-right > #groupfile ol > li {}
  • - `
  • - const leftCatalogueSheets = `
  • - /* 除目录外的其他 card */
  • - body[show-catalogue] #mainBox aside.blog_container_aside > div:not(#asidedirectory) {
  • - display: none !important;
  • - height: 0;
  • - z-index: -32;
  • - opacity: 0;
  • - margin: 0;
  • - }
  • - body[show-catalogue] #mainBox aside.blog_container_aside > div#asidedirectory {
  • - ${catalogSheets}
  • - }
  • - body[show-catalogue] #mainBox aside.blog_container_aside > div#asidedirectory > .groupfile-div {
  • - max-height: 90vh !important;
  • - }
  • - body[show-catalogue] #mainBox aside.blog_container_aside > div#asidedirectory:hover {
  • - ${catalogHoverSheets}
  • - }
  • - body[show-catalogue] #mainBox aside.blog_container_aside > div#asidedirectory > #directory > h3 {
  • - ${catalogTitleSheets}
  • - }
  • - body[show-catalogue] #mainBox aside.blog_container_aside > div#asidedirectory > #directory ol > li {}
  • - `
  • const sheets = `
  • body {
  • --comments-avatar-size: 50px;
  • --source-link-wrapper-display: ${window.$CSDNCleaner.BackgroundImageRange.getSourceLinkDisplay()};
  • - --background-color: ${bgColor || '#EAEAEA'};
  • - --background-image: ${bgColor ? 'none' : imgUrl};
  • - --article-weight: ${window.$CSDNCleaner.BackgroundImageRange.getArticleWeight()};
  • - ${window.$CSDNCleaner.BackgroundImageRange.recommendBoxDisplayAttributes.join(': ')};
  • - ${window.$CSDNCleaner.BackgroundImageRange.copyrightDisplayAttributes.join(': ')};
  • - ${window.$CSDNCleaner.BackgroundImageRange.catalogueDisplayAttributes.join(': ')};
  • }
  • - body:not(.clean-mode) { background-color: var(--background-color) !important; background-image: var(--background-image) !important; background-attachment: fixed !important;background-size: cover; background-repeat: no-repeat; background-size: 100% !important; }
  • - body>#page>#content, body>.container.container-box,main,body>.main.clearfix { opacity: 0.9; }
  • + body:not(.clean-mode) { background-image: ${window.$CSDNCleaner.BackgroundImageRange.getImgUrl()} !important; background-color:#EAEAEA !important; background-attachment: fixed !important;background-size; cover; background-repeat: no-repeat; background-size: 100% !important; }
  • + body>#page>#content, body>.container.container-box,main,body>.main.clearfix { opacity: 0.85; }
  • main {margin: 20px;}
  • #local { position: fixed; left: -99999px }
  • - .recommend-item-box .content,.post_feed_box,.topic_r,#bbs_title_bar,#bbs_detail_wrap,#left-box {width: 100% !important;}
  • - #csdn-shop-window-top,#csdn-shop-window,.csdn-redpack-time, #csdn-redpack, .recommend-item-box.type_other, .triplet-prompt, .column-advert-box, .comment-sofa-flag, #article_content .more-toolbox, .blog-content-box a[data-report-query],main .template-box, .blog-content-box>.postTime,.post_body div[data-pid],#unlogin-tip-box,.t0.clearfix,.recommend-item-box.recommend-recommend-box,.csdn-side-toolbar>a[data-type]:not([data-type=gotop]):not([data-type="$setting"]),a[href^="https://edu.csdn.net/topic"],.adsbygoogle,.mediav_ad,.bbs_feed_ad_box,.bbs_title_h,.title_bar_fixed,#adContent,.crumbs,#page>#content>#nav,#local,#reportContent,.comment-list-container>.opt-box.text-center,.type_hot_word,.blog-expert-recommend-box,.login-mark,#passportbox,.recommend-download-box,.recommend-ad-box,#dmp_ad_58,.blog_star_enter,#header,.blog-sidebar,#new_post.login,.mod_fun_wrap,.hide_topic_box,.bbs_bread_wrap,.news-nav,#rightList.right-box,aside,aside .aside-box.kind_person,#kp_box_476,.tool-box,.pulllog-box,.adblock,.fourth_column,.hide-article-box,#csdn-toolbar
  • + .recommend-item-box .content,.post_feed_box,.topic_r,.mod_topic_wrap,#bbs_title_bar,#bbs_detail_wrap,#left-box,main {width: 100% !important;}
  • + .column-advert-box, .comment-sofa-flag, #article_content .more-toolbox, .blog-content-box a[data-report-query],main .template-box, .blog-content-box>.postTime,.post_body div[data-pid],#unlogin-tip-box,.t0.clearfix,.recommend-item-box.recommend-recommend-box,.hljs-button.signin,.csdn-side-toolbar>a[data-type]:not([data-type=gotop]):not([data-type="$setting"]),a[href^="https://edu.csdn.net/topic"],.adsbygoogle,.mediav_ad,.bbs_feed_ad_box,.bbs_title_h,.title_bar_fixed,#adContent,.crumbs,#page>#content>#nav,#local,#reportContent,.comment-list-container>.opt-box.text-center,.type_hot_word,.blog-expert-recommend-box,.login-mark,#passportbox,.hljs-button.signin,.recommend-download-box,.recommend-ad-box,#dmp_ad_58,.blog_star_enter,#header,.blog-sidebar,#new_post.login,.mod_fun_wrap,.hide_topic_box,.bbs_bread_wrap,.news-nav,#rightList.right-box,aside,#kp_box_476,.tool-box,.recommend-right,.pulllog-box,.adblock,.fourth_column,.hide-article-box,#csdn-toolbar
  • {display: none !important;}
  • .hide-main-content,#blog_content,#bbs_detail_wrap,.article_content {height: auto !important;}
  • .comment-list-box,#bbs_detail_wrap {max-height: none !important;}
  • #page {width: 80vw !important;}
  • #bbs_title_bar {margin-top: 20px;}
  • #page>#content {margin-top: 0 !important;}
  • - #content_views{ user-select: auto !important; }
  • -
  • - body > .container-box .container_main.clearfix { width: 100% !important; }
  • - .csdn_main_container > .container_main > #left-box { width: 100% !important; }
  • - #bbs_detail_wrap > .paginate_box { width: 100% !important; }
  • - .mod_topic_wrap { width: 100% !important; }
  • - .container_main > .mod_topic_wrap > .post_feed_box { width: 100% !important; }
  • - .bbs-common-footer { width: 100% !important; }
  • - .csdn_main_container > #navs { display: none; }
  • - /* 推荐文章 hover 不改变标题颜色 */
  • - .recommend-box .recommend-item-box .title-box .tit:hover {
  • - color: inherit !important;
  • - }
  • - /* 图片预览底色 */
  • - .imgViewDom.disnone { background-color: rgba(0, 0, 0, 0.5); }
  • - /* 控制目录是否显示 */
  • - /* .recommend-right,aside.recommend-right_aside { display: var(${window.$CSDNCleaner.BackgroundImageRange.catalogueDisplayAttributes[0]}) !important; } */
  • - body[show-catalogue] .recommend-right .flex-column.aside-box {}
  • - /* 在宽屏下显示在文章右侧 */
  • - @media screen and (min-width: 1550px) {
  • - body[show-catalogue] .nodata.recommend-right, aside.recommend-right_aside {
  • - display: var(${window.$CSDNCleaner.BackgroundImageRange.catalogueDisplayAttributes[0]}) !important;
  • - }
  • - ${rightCatalogueSheets}
  • - body[show-catalogue] #mainBox aside.blog_container_aside {
  • - display: none !important;
  • - }
  • - }
  • - /* 在小屏下显示在文章左侧 */
  • - @media screen and (min-width: 1380px) and (max-width: 1550px) {
  • - body[show-catalogue] #mainBox aside.blog_container_aside { display: var(${window.$CSDNCleaner.BackgroundImageRange.catalogueDisplayAttributes[0]}) !important; }
  • - }
  • - /* 在小屏下显示在文章左侧 */
  • - @media screen and (max-width: 1380px) {
  • - body[show-catalogue] #mainBox aside.blog_container_aside {
  • - display: var(${window.$CSDNCleaner.BackgroundImageRange.catalogueDisplayAttributes[0]}) !important;
  • - }
  • - body[show-catalogue] .main_father > .container#mainBox > main {
  • - float: right !important;
  • - }
  • - }
  • - @media screen and (max-width: 1549px) and (min-width: 1380px) {
  • - body[show-catalogue] .main_father > .container#mainBox > main {
  • - float: right !important;
  • - }
  • - }
  • - @media screen and (min-width: 0px) and (max-width: 1550px) {
  • - /* aside */
  • - body[show-catalogue] #mainBox aside.blog_container_aside {
  • - position: fixed !important;
  • - top: 28px !important;
  • - }
  • - ${leftCatalogueSheets}
  • - }
  • - body:not([show-catalogue]) .main_father > #mainBox > aside { display: none !important; }
  • - body:not([show-catalogue]) .recommend-right { display: none !important; }
  • -
  • - /* 复制按钮增加 !important, 修复在某些页面下样式被覆盖的问题 | 2021-01-23 13:12:57 */
  • - /* 重写登录后复制按钮样式 | 2021-01-01 10:45:03 */
  • - .hljs-button.signin[data-title="登录后复制"] { font-size: 0 !important; }
  • - .hljs-button.signin[data-title="登录后复制"]:before { content: "一键复制"; font-size: 14px; vertical-align: middle; }
  • - /* 增加隐藏底部推荐文章和版权信息功能 | 2020-11-11 21:03:10 */
  • - .recommend-box { display: var(${window.$CSDNCleaner.BackgroundImageRange.recommendBoxDisplayAttributes[0]}) !important; }
  • - .blog-footer-bottom { display: var(${window.$CSDNCleaner.BackgroundImageRange.copyrightDisplayAttributes[0]}) !important; }
  • - /* 增加 round-slider 组件 | 2020-08-20 20:29:05 */
  • - .round-slider-wrapper { margin: 15px auto !important; }
  • - .round-slider-wrapper .rs-handle { background-color: transparent; border: 8px solid transparent; border-right-color: black; margin: -6px 0px 0px 14px !important; border-width: 6px 104px 6px 4px; }
  • - .round-slider-wrapper .rs-handle:before { display: block; content: " "; position: absolute; height: 22px; width: 22px; background: black; right: -11px; bottom: -11px; border-radius: 100px; }
  • - .round-slider-wrapper .rs-tooltip { top: 75% !important; font-size: 11px; }
  • - .round-slider-wrapper .rs-full.rs-tooltip { top: 75% !important; }
  • - .round-slider-wrapper .rs-tooltip > div { text-align: center; background: orange; color: white; border-radius: 4px; padding: 1px 5px 2px; margin-top: 4px; }
  • - .round-slider-wrapper .rs-range-color { background-color: #DB5959; }
  • - .round-slider-wrapper .rs-path-color { background-color: #F0C5C5; }
  • - .color-picker-container { margin-left: 50%; transform: translateX(-50%); }
  • /* 评论区每行增加 hover 效果 | 2020-05-17 18:32:22 */
  • .comment-box { background-color: rgba(255,255,255,0.9) !important; }
  • .comment-list-box { padding: 0 !important; }
  • - .comment-list-box > .comment-list { padding: 0 24px; margin-top: 0 !important; padding-top: 16px; }
  • - .comment-list-box .comment-list { transition: all .2s ease-in-out; }
  • + .comment-list-box > .comment-list { padding: 0 24px; margin-top: 0 !important; padding-top: 16px }
  • .comment-list-box > .comment-list:hover { background-color: rgba(255,255,255,0.7); }
  • - .comment-list-box .comment-line-box:hover img.avatar { border-color: rgb(255, 198, 198, 0.95); }
  • /* 屏蔽固定在页面底部的 toolbox | 2020-05-17 18:28:03 */
  • .more-toolbox > .left-toolbox { position: relative !important; left: 0 !important; }
  • /* 底部作者信息右侧按钮只显示关注 | 2020-05-17 18:26:52 */
  • }
  • .source-link-wrapper > .source-link-link:hover { color: #008eff !important; }
  • /* 防止网页主体内容被黑白处理, 适用于特殊日期; CSDN 真是太蠢了,只有 CSDN 把文章内容中的图片都显示成黑白的了, 严重影响阅读! | 2020-04-04 13:17:48 */
  • - /* 经测试, firefox 下会导致子元素的 fixed 定位失效, 故将其改为 none */
  • - html { filter: none !important; }
  • + html { filter: grayscale(0) !important; }
  • /* 评论区评论内容强制换行以保持一致性 | 2020-02-19 08:58:33 */
  • .comment-box .comment-list-container .comment-list .new-comment { display: block !important; }
  • /* 覆盖所有 media query 样式以防止原有的自适应样式导致布局错乱 | 2020-02-19 08:28:52 */
  • - @media screen and (max-width: 1320px) {
  • - .main_father > .container#mainBox > main, body:not([show-catalogue]) > .container-box.csdn_main_container { float: none; margin: 0 auto !important; margin-top: 20px !important; }
  • - body:not([show-catalogue]) > .container-box.csdn_main_container { width: var(--article-weight) !important; }
  • - body > .container-box.csdn_main_container { width: calc(var(--article-weight) - 30%) !important; }
  • - }
  • @media screen and (max-width: 1379px) and (min-width: 1320px) {
  • - .main_father > .container#mainBox > main, body:not([show-catalogue]) > .container-box.csdn_main_container { float: none; margin: 0 auto !important; margin-top: 20px !important; }
  • - body:not([show-catalogue]) > .container-box.csdn_main_container { width: var(--article-weight) !important; }
  • - body > .container-box.csdn_main_container { width: calc(var(--article-weight) - 30%) !important; }
  • -
  • + .main_father > .container#mainBox > main { width: 100% !important; float: none; margin: 0 !important; margin-top: 20px !important; }
  • }
  • @media screen and (max-width: 1699px) and (min-width: 1550px) {
  • - .main_father > .container#mainBox > main, body:not([show-catalogue]) > .container-box.csdn_main_container { width: var(--article-weight) !important; float: none; margin: 0 auto !important; margin-top: 20px !important; }
  • - /* body:not([show-catalogue]) > .container-box.csdn_main_container { width: var(--article-weight) !important; } */
  • - body > .container-box.csdn_main_container { width: calc(var(--article-weight) - 30%) !important; }
  • -
  • + .main_father > .container#mainBox > main { width: 100% !important; float: none; margin: 0 !important; margin-top: 20px !important; }
  • }
  • @media screen and (max-width: 1549px) and (min-width: 1380px) {
  • - .main_father > .container#mainBox > main, body:not([show-catalogue]) > .container-box.csdn_main_container { float: none; margin: 0 auto !important; margin-top: 20px !important; }
  • - body:not([show-catalogue]) > .container-box.csdn_main_container { width: var(--article-weight) !important; }
  • - body > .container-box.csdn_main_container { width: calc(var(--article-weight) - 30%) !important; }
  • -
  • + .main_father > .container#mainBox > main { width: 100% !important; float: none; margin: 0 !important; margin-top: 20px !important; }
  • }
  • @media screen and (min-width: 1700px) {
  • - .main_father > .container#mainBox > main, body:not([show-catalogue]) > .container-box.csdn_main_container { width: var(--article-weight) !important; float: none; margin: 0 auto !important; margin-top: 20px !important; }
  • - /* body:not([show-catalogue]) > .container-box.csdn_main_container { width: var(--article-weight) !important; } */
  • - body > .container-box.csdn_main_container { width: calc(var(--article-weight) - 30%) !important; }
  • -
  • + .main_father > .container#mainBox > main { width: 100% !important; float: none; margin: 0 !important; margin-top: 20px !important; }
  • }
  • /* 评论区样式重写 | 2019-12-27 21:32:24 */
  • .comment-list-container img.avatar {
  • height: var(--comments-avatar-size) !important;
  • margin-top: 4px;
  • margin-right: 15px !important;
  • - border: 3px solid rgba(215, 215, 205, 0.7);
  • - transition: border-color .2s ease-in-out;
  • }
  • .comment-edit-box img.show_loginbox {
  • width: var(--comments-avatar-size) !important;
  • }
  • /* 防止原有的自适应样式导致布局错乱 | 2019-12-27 21:08:09 */
  • @media screen and (min-width: 1700px) {
  • - .recommend-right.align-items-stretch { color: teal; display: var(${window.$CSDNCleaner.BackgroundImageRange.catalogueDisplayAttributes[0]}) !important; }
  • + .recommend-right.align-items-stretch { color: teal; display: none !important; }
  • }
  • /* 隐藏底部 more-toolbox 按钮组 ~~和底部作者 row 中的其他信息~~; 还是保留这一行吧 ... 以后可能会把更多对文章和作者的操作放到这里面 | 2019-12-17 22:18:16 */
  • /* 修改底部 私信求帮助 按钮样式 | 2019-11-23 17:37:52 */
  • body>#page>#content>#main, #bbs_title_bar > .owner_top,.blog-content-box { border-top-left-radius: 8px; border-top-right-radius: 8px; }
  • body > div#page {background-color: transparent}
  • .dl_no_more:after { content: "上边是原话, 脚本作者原本想屏蔽这段话, 但是 CSDN 从未找到自己的底线;\\A 从阅读更多必须注册, 到验证手机号必须关注公众号, 再到大尺度H广告, 严重影响了用户体验;\\A 自从 CSDN 使用明文密码被脱库之后我就不再使用 CSDN 账号, 为了继续阅读 CSDN 内容我写了这个脚本 "; color: teal; display: block; width: 60%; margin: auto; white-space: pre; }
  • - .recommend-box>.recommend-item-box { transition: all .2s ease-in-out; }
  • .recommend-box>.recommend-item-box:hover { background-color: rgba(255,255,255,0.8); }
  • /* 脚本设置弹窗 */
  • a.option-box[data-type="$setting"] img {
  • display: none;
  • }
  • #setting-dialog {
  • - z-index: 244;
  • display: block;
  • position: fixed;
  • top: 20vh;
  • height: 100%;
  • display: flex;
  • justify-content: center;
  • - transform: translateY(0) translateX(0) scale(1) skew(0);
  • - transition: 0.65s all ease-in-out;
  • - }
  • - #setting-dialog.display-none {
  • - transform: translateY(80vh) translateX(90vw) scale(0) skew(50deg, 10deg) !important;
  • - display: flex !important;
  • - }
  • - #setting-dialog section {
  • - opacity: 1;
  • - transition: 0.25s opacity ease-in-out;
  • }
  • #setting-dialog section header {
  • max-width: 550px;
  • justify-content: space-between;
  • padding: 0 15px;
  • align-items: center;
  • - border-bottom: 1px solid #EEE;
  • }
  • #setting-dialog section header .icon-close > img {
  • width: 20px;
  • cursor: pointer;
  • }
  • #setting-dialog section article .row {
  • - margin: 0;
  • - margin-bottom: 10px;
  • - }
  • - #setting-dialog section article .row .color-picker-box {
  • margin-bottom: 10px;
  • }
  • #setting-dialog section article .row > label {
  • font-weight: bold;
  • }
  • - #setting-dialog section article button { color: #409EFF; background-color: #FAFAFA; padding: 4px; margin: 2.5px; border: 1px solid: #EEE; border-radius: 3px; }
  • - #setting-dialog section article button:hover { background-color: #EEE; }
  • - #setting-dialog section article button#btn-clear-bg { color: #F56C6C; }
  • - #setting-dialog section article button#btn-clear-bgColor { color: #F56C6C; }
  • - #setting-dialog section article button#btn-update-bg { color: #E6A23C; }
  • - /* #setting-dialog section article button#btn-use-current { color: #909399; } */
  • /* 链接输入框 */
  • #custom-bg-url {
  • width: 100%;
  • },
  • // 复制功能
  • cleanCopy() {
  • - try {
  • csdn.copyright && csdn.copyright.init('', '', '')
  • - // 重写复制按钮的点击事件
  • - try { if (hljs) hljs.signin = hljs.copyCode } catch(err) {}
  • - try { if (mdcp) mdcp.signin = mdcp.copyCode } catch(err) {}
  • - // 为所有的未登录复制按钮增加复制事件
  • - // const box = document.getElementById('mainBox')
  • - // box.addEventListener('click', evt => {
  • - // const isCopyButton = evt.target.classList.contains('hljs-button') && evt.target.classList.contains('signin')
  • - // console.log('click copy button: ', isCopyButton)
  • - // try {
  • - // mdcp ? mdcp.copyCode(evt.target) : hljs.copyCode(evt.target)
  • - // } catch(err) {}
  • - // })
  • - } catch(err) {
  • - console.log('cleanCopy() failed: ', err)
  • - }
  • return this
  • },
  • onLoad() {
  • - /** 初始化目录 attribute */
  • - window.$CSDNCleaner.BackgroundImageRange.syncShowCatalogue()
  • // 图片下的底色
  • - // document.body.setAttribute('style', 'background-color:#EAEAEA !important')
  • + document.body.setAttribute('style', 'background-color:#EAEAEA !important')
  • // 解除跳转拦截
  • $ && $("#content_views") && $("#content_views").off('click')
  • // 初始化右侧 bottom menu tool bar
  • window.$CSDNCleaner.cleanCopy() // 解禁复制功能
  • window.$CSDNCleaner._launchPagintion() // 解禁并初始化分页组件
  • window.$CSDNCleaner.showSourceLink() // 转载的文章显示原文链接
  • - window.$CSDNCleaner.loadColorPicker() // 加载 color picker
  • - window.$CSDNCleaner.disabledDarkSkin() // 禁用暗黑系 css 样式
  • - window.$CSDNCleaner.loadRoundSliderResources() // 加载 color picker
  • - .then(() => {
  • - window.$CSDNCleaner.initRoundSlider() // 加载 round slider
  • - })
  • },
  • _launchPagintion() {
  • // 监听数据层变动并动态控制分页组件显示
  • settingDialog.id = 'setting-dialog'
  • settingDialog.classList.add('display-none')
  • const categorys = BackgroundImageRange.toCategoryHTML()
  • - const { url, name, category, html } = window.$CSDNCleaner.BackgroundImageRange.currentUrl
  • - const currentBackgroundHTML = html
  • -
  • + const { url, name, category } = window.$CSDNCleaner.BackgroundImageRange.currentUrl
  • settingDialog.innerHTML = `
  • <section>
  • <header>
  • - <div>
  • - <span class="title">脚本设置</span>
  • - <!-- <span> - </span> -->
  • - <!-- <span class="script-name">[${this.NAME}]</span> -->
  • - </div>
  • + <div>设置 - [${this.NAME}]</div>
  • <div class="icon-close">
  • <img src="https://csdnimg.cn//cdn/content-toolbar/guide-close-btn.png">
  • </div>
  • <article>
  • <div class="row">
  • <label>当前背景图: </label>
  • - <div class="content" id="setting-background-label">
  • - ${currentBackgroundHTML}
  • + <div class="content">
  • + <a class="link" target="_blank" href="${url}">${category ? '<' + category + '> ' : ''}${name}</a>
  • </div>
  • - <button type="reset" id="btn-update-bg">刷新背景图片</button>
  • </div>
  • <div class="row">
  • <label>背景图片类目范围(点选): </label>
  • <button type="button" id="btn-use-current">使用当前图片</button>
  • </div>
  • </div>
  • - <div class="row">
  • - <label>文章宽度: </label>
  • - <div class="color-picker-box">
  • - <div class="tips-line">
  • - <span>
  • - 宽度基于源码中的
  • - <code>.container</code>
  • - 的宽度, 详见
  • - <a href="https://github.com/SublimeCT/greasy_monkey_scripts/issues/4#issuecomment-675349913">#4</a>
  • - </span>
  • - </div>
  • - <div id="weight-slider" class="round-slider-wrapper"></div>
  • - </div>
  • - </div>
  • - <div class="row">
  • - <label>纯色背景(优先使用): </label>
  • - <div class="color-picker-box">
  • - <div class="tips-line">
  • - <span>优先级高于自定义图片, 选择纯色背景将覆盖已添加的背景图片链接</span>
  • - <button type="reset" id="btn-clear-bgColor">清除</button>
  • - </div>
  • - <div class="content">
  • - <div class="color-picker-container"
  • - acp-palette="PALETTE_MATERIAL_CHROME"
  • - acp-palette-editable
  • - acp-color="${BackgroundImageRange.range.bgColor}"></div>
  • - </div>
  • - </div
  • - </div>
  • <div class="row" id="showSourceLink-wrap">
  • <label>是否显示 原文链接: </label>
  • <div class="tips-line">原文链接从顶部文章信息或原文中提取, 若作者直接文中写入原文链接(未在文章信息中标注), 有可能会匹配错误</div>
  • </label>
  • </div>
  • </div>
  • - <div class="row" id="hideRecommendBox-wrap">
  • - <label>是否隐藏所有 推荐文章: </label>
  • - <div class="tips-line">隐藏之后将不会显示底部的推荐文章列表</div>
  • - <div class="content">
  • - <label style="margin-right: 15px;">
  • - <input type="radio" value="1" ${BackgroundImageRange.range.hideRecommendBox ? 'checked' : ''} class="radio-hideRecommendBox" name="hideRecommendBox" />
  • - <span>隐藏</span>
  • - </label>
  • - <label>
  • - <input type="radio" value="0" ${BackgroundImageRange.range.hideRecommendBox ? '' : 'checked'} class="radio-hideRecommendBox" name="hideRecommendBox" />
  • - <span>显示</span>
  • - </label>
  • - </div>
  • - </div>
  • - <div class="row" id="hideCopyright-wrap">
  • - <label>是否隐藏最底部 csdn版权信息: </label>
  • - <div class="tips-line">隐藏之后将不会显示页面最底部的 footer</div>
  • - <div class="content">
  • - <label style="margin-right: 15px;">
  • - <input type="radio" value="1" ${BackgroundImageRange.range.hideCopyright ? 'checked' : ''} class="radio-hideCopyright" name="hideCopyright" />
  • - <span>隐藏</span>
  • - </label>
  • - <label>
  • - <input type="radio" value="0" ${BackgroundImageRange.range.hideCopyright ? '' : 'checked'} class="radio-hideCopyright" name="hideCopyright" />
  • - <span>显示</span>
  • - </label>
  • - </div>
  • - </div>
  • - <div class="row" id="showCatalogue-wrap">
  • - <label>是否显示目录栏: </label>
  • - <div class="tips-line">开启之后会在右侧显示文章目录</div>
  • - <div class="content">
  • - <label style="margin-right: 15px;">
  • - <input type="radio" value="0" ${BackgroundImageRange.range.showCatalogue ? '' : 'checked'} class="radio-showCatalogue" name="showCatalogue" />
  • - <span>隐藏</span>
  • - </label>
  • - <label>
  • - <input type="radio" value="1" ${BackgroundImageRange.range.showCatalogue ? 'checked' : ''} class="radio-showCatalogue" name="showCatalogue" />
  • - <span>显示</span>
  • - </label>
  • - </div>
  • - </div>
  • <div class="row">
  • <label>联系作者: </label>
  • <div class="content">
  • </div>
  • </div>
  • <div class="content">
  • - <div class="tips-line">反馈:</div>
  • + <div class="tips-line">问题/反馈:</div>
  • <div class="tips-line">
  • <a class="link" href="https://greasyfork.org/zh-CN/scripts/373457-csdn-%E5%8E%BB%E5%B9%BF%E5%91%8A%E6%B2%89%E6%B5%B8%E9%98%85%E8%AF%BB%E6%A8%A1%E5%BC%8F/feedback" target="_blank">greasyfork page</a>
  • </div>
  • const dialogWrapper = document.getElementById('setting-dialog')
  • const urlInput = document.getElementById('custom-bg-url')
  • const saveUrlBtn = document.getElementById('btn-save-bg')
  • - const updateBgImageBtn = document.getElementById('btn-update-bg')
  • - const clearBgColorBtn = document.getElementById('btn-clear-bgColor')
  • const saveCurrentImgBtn = document.getElementById('btn-use-current')
  • const clearUrlBtn = document.getElementById('btn-clear-bg')
  • const hideMenuWrap = document.getElementById('defaultHideMenu-wrap')
  • - const hideRecommendBox = document.getElementById('hideRecommendBox-wrap')
  • - const hideCopyright = document.getElementById('hideCopyright-wrap')
  • - const showCatalogue = document.getElementById('showCatalogue-wrap')
  • const showSourceLinkWrap = document.getElementById('showSourceLink-wrap')
  • if (!dialogWrapper) { console.error(`[${window.$CSDNCleaner.NAME}] Internal error. dialog init failed.`); return }
  • dialogWrapper.addEventListener('click', evt => {
  • })
  • saveCurrentImgBtn.addEventListener('click', evt => {
  • const { url } = window.$CSDNCleaner.BackgroundImageRange.currentUrl
  • + console.warn(url, window.$CSDNCleaner.BackgroundImageRange)
  • if (!url) return false
  • urlInput.value = url
  • BackgroundImageRange.range.customUrl = url
  • BackgroundImageRange.save()
  • - BackgroundImageRange.updateBgImage(url)
  • })
  • clearUrlBtn.addEventListener('click', evt => {
  • urlInput.value = BackgroundImageRange.range.customUrl = ''
  • BackgroundImageRange.save()
  • })
  • - clearBgColorBtn.addEventListener('click', evt => {
  • - BackgroundImageRange.setBgColor()
  • - })
  • - updateBgImageBtn.addEventListener('click', evt => {
  • - BackgroundImageRange.updateBgImage(null, !!BackgroundImageRange.range.bgColor)
  • - })
  • hideMenuWrap.addEventListener('change', evt => {
  • const dom = evt.target
  • if (!dom || !dom.classList || !dom.classList.contains('radio-defaultHideMenu')) return
  • urlInput.defaultHideMenu = BackgroundImageRange.range.defaultHideMenu = val
  • BackgroundImageRange.save()
  • })
  • - hideRecommendBox.addEventListener('change', evt => {
  • - const dom = evt.target
  • - if (!dom || !dom.classList || !dom.classList.contains('radio-hideRecommendBox')) return
  • - const val = !!Number(dom.value)
  • - urlInput.hideRecommendBox = BackgroundImageRange.range.hideRecommendBox = val
  • - BackgroundImageRange.save()
  • - })
  • - hideCopyright.addEventListener('change', evt => {
  • - const dom = evt.target
  • - if (!dom || !dom.classList || !dom.classList.contains('radio-hideCopyright')) return
  • - const val = !!Number(dom.value)
  • - urlInput.hideCopyright = BackgroundImageRange.range.hideCopyright = val
  • - BackgroundImageRange.save()
  • - })
  • - showCatalogue.addEventListener('change', evt => {
  • - const dom = evt.target
  • - if (!dom || !dom.classList || !dom.classList.contains('radio-showCatalogue')) return
  • - const val = !!Number(dom.value)
  • - BackgroundImageRange.range.showCatalogue = val
  • - BackgroundImageRange.save()
  • - })
  • showSourceLinkWrap.addEventListener('change', evt => {
  • const dom = evt.target
  • if (!dom || !dom.classList || !dom.classList.contains('radio-showSourceLink')) return
  • const val = !!Number(dom.value)
  • - // console.log('>>>', val, urlInput.showSourceLink, dom)
  • + console.log('>>>', val, urlInput.showSourceLink, dom)
  • BackgroundImageRange.range.showSourceLink = val
  • document.body.style.setProperty('--source-link-wrapper-display', window.$CSDNCleaner.BackgroundImageRange.getSourceLinkDisplay())
  • BackgroundImageRange.save()
  • sourceLinkLabelWrapperDom.appendChild(sourceLinkLinkDom)
  • // 插入页面中
  • const wrapper = document.querySelector('.bar-content')
  • - // console.log(wrapper)
  • + console.log(wrapper)
  • if (wrapper) wrapper.appendChild(sourceLinkLabelWrapperDom)
  • - },
  • - loadColorPicker() {
  • - if (!window.AColorPicker) return
  • - window.AColorPicker.from('div.color-picker-container')
  • - .on('change', (picker, color) => {
  • - BackgroundImageRange.setBgColor(color)
  • - })
  • - },
  • - disabledDarkSkin() {
  • - const sheets = document.querySelectorAll('link')
  • - for (const sheet of Array.from(sheets)) {
  • - if (sheet.href.indexOf('template/themes_skin/skin-') > 0) {
  • - sheet.setAttribute('disabled', 'disabled')
  • - }
  • - }
  • - return this
  • - },
  • - async loadRoundSliderResources() {
  • - await this.loadResourcesFiles('link', 'https://cdn.jsdelivr.net/npm/round-slider@1.6.1/dist/roundslider.min.css')
  • - // await this.loadResourcesFiles('script', 'https://cdn.jsdelivr.net/npm/round-slider@1.6.1/dist/roundslider.min.js')
  • - },
  • - loadResourcesFiles(tagName = 'link', href, wait = true) {
  • - const tag = document.createElement(tagName)
  • - let hrefAttr = 'href'
  • - switch (tagName) {
  • - case 'link':
  • - tag.setAttribute('rel', 'stylesheet')
  • - break;
  • - case 'script':
  • - hrefAttr = 'src'
  • - break;
  • - }
  • - tag.setAttribute(hrefAttr, href)
  • - document.head.appendChild(tag)
  • - return new Promise((resolve, reject) => {
  • - tag.addEventListener('load', evt => resolve(tag))
  • - tag.addEventListener('error', evt => reject(tag))
  • - })
  • - },
  • - initRoundSlider() {
  • - if (!window.changeTooltip) window.changeTooltip = this.changeTooltip
  • - $('#weight-slider').roundSlider({
  • - sliderType: 'min-range',
  • - editableTooltip: false,
  • - radius: 105,
  • - width: 16,
  • - value: window.$CSDNCleaner.BackgroundImageRange.range.articleWeightRate || 100,
  • - handleSize: 0,
  • - handleShape: 'square',
  • - circleShape: 'pie',
  • - startAngle: 315,
  • - tooltipFormat: 'changeTooltip',
  • - update: this.onUpdateRoundSlider
  • - })
  • - },
  • - onUpdateRoundSlider(evt) {
  • - window.$CSDNCleaner.BackgroundImageRange.setArticleWeight(evt.value)
  • - },
  • - changeTooltip(e) {
  • - const val = e.value
  • - let speed = '';
  • - if (val < 40) speed = 'Slow';
  • - else if (val < 65) speed = 'Normal';
  • - else if (val < 90) speed = 'Speed';
  • - else speed = 'Very Speed';
  • -
  • - return val + '%' + '<div>' + speed + '<div>';
  • }
  • }
  • window.$CSDNCleaner.init()

This report has been upheld by a moderator.