/* eslint-disable no-unused-vars */ /* eslint-disable no-extra-semi */ /* eslint-disable no-console */ // ==UserScript== // @name 新浪微博(新版)一键删除、清空助手 // @namespace https://greasyfork.org/zh-CN/users/812943 // @version 0.0.6 // @description 一键批量删除微博、取消关注、删除粉丝、删除点赞记录 // @author gafish // @match https://weibo.com/* // @icon https://www.google.com/s2/favicons?domain=weibo.com // @license MIT // @require https://greasyfork.org/scripts/415581-jquery%E5%BA%93/code/jquery%E5%BA%93.js?version=866373 // @require https://greasyfork.org/scripts/26454-jquery-cookie/code/jQuery%20Cookie.js?version=169689 // @grant none // ==/UserScript== ;(function () { 'use strict' const jq = window.jQuery const HELPER_NAME = '微博一键清空助手' const TOKEN = jq.cookie('XSRF-TOKEN') const WB_CONFIG = window.$CONFIG const UID = WB_CONFIG.uid const USER = WB_CONFIG.user const showNewWeoboTip = () => { const newWeiboEntry = jq('a[action-type="changeversion"]') if (!newWeiboEntry[0]) { return setTimeout(showNewWeoboTip, 500) } const tip = jq('
') tip .css({ position: 'fixed', top: 70, left: 10, width: 200, height: 30, color: '#f00', background: '#fff', border: '1px solid #f00', lineHeight: '30px', textAlign: 'center', cursor: 'pointer', }) .text('当前是旧版,是否切换到新版?') .click(() => { if (newWeiboEntry[0]) { newWeiboEntry[0].click() } }) jq('#plc_frame').append(tip) } if (!USER) { return showNewWeoboTip() } const STATUSES_COUNT = USER.statuses_count const FRIENDS_COUNT = USER.friends_count const FOLLOWERS_COUNT = USER.followers_count const URL_PREFIX = 'https://weibo.com/u' const c_app = jq('#app') const c_menu = jq('') const c_notice = jq('') const c_btn = jq('') if (!UID) return // 当前删除页码 let deletePage // 已删除数 let deletedCount // 停止清空 let stop // 折叠菜单 let fold const utils = { // alert fail alertFail: (jqXHR, textStatus, errorThrown) => { var error = '状态码:' + jqXHR.status + ',异常:' + errorThrown alert('读取数据失败,请稍后重试\n' + error) }, // 检查是否在当前页 checkURL: (url, title) => { const isCurrent = window.location.href.indexOf(url) !== -1 if (!isCurrent) { const r = confirm('当前操作需要前往 ' + title + ' 页面,是否跳转?') if (r === true) { window.location.href = url } } return isCurrent }, // 输出提示信息 showNotice: html => { c_notice.show().html(`