CSDN刷浏览量

先点击获取,先点击获取,先点击获取!!,开自己的CSDN主页会自动刷(blog开头的地址)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         CSDN刷浏览量
// @namespace    https://xyw.baklib.com/
// @version      0.0.7
// @description  先点击获取,先点击获取,先点击获取!!,开自己的CSDN主页会自动刷(blog开头的地址)
// @author       Silencer
// @match        *://blog.csdn.net/*
// @icon         https://blog.csdn.net/favicon.ico
// ==/UserScript==

(function () {
  const config = {
    // 每个请求的间隔时间,过快会失败,单位:秒(不建议设置0.2以下,实测不行)
    time: 0.2,
    // 总请求的时间间隔,过快不计入,单位:秒(不知道怎么算的,就60秒一次吧)
    interval: 60,
    // 切割用的字符串
    str: '|'
  }

  function getUrl() {
    !localStorage.urlList && (localStorage.urlList = '')
    document.querySelectorAll('.csdn-tracking-statistics p a')
      .forEach(i => {
        i.href && (localStorage.urlList += i.href + config.str)
      })
    localStorage.urlList =
      [...new Set(localStorage.urlList
        .split(config.str)
      )]
        // .filter(i => i)
        .join(config.str)
        .trim()
    console.log('获取成功啦,要啥提示啊扑街')
    // + config.str
  }
  function request() {
    localStorage.urlList
      .split(config.str)
      // .sort(() => Math.random() - 0.5)
      .forEach((item, index) => {
        setTimeout(
          () => {
            fetch(item)
          },
          index * config.time * 1000
        )
      })
  }
  function init() {
    $(".opt-box").prepend(`<a class="btn btn-sm" id="getUrl" href="javascript:;">获取该页链接</a >`)
    // $(".opt-box").prepend(`<a class="btn btn-sm" id="clearUrl" href="javascript:;">清除链接</a >`)
    $('#getUrl').click(getUrl)
    // $('#clearUrl').click(() => { localStorage.urlList = '' })

    !localStorage.urlList && getUrl()
  }

  (function main() {
    init()
    request()
    setInterval(
      request,
      config.interval * 1000
    )
  })()
})()