/* 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.7 // @description 一键批量删除微博、取消关注、删除粉丝、删除点赞记录 // @author gafish // @match https://weibo.com/* // @icon https://www.google.com/s2/favicons?domain=weibo.com // @license MIT // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js // @require https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js // @grant none // @downloadURL https://update.greasyfork.icu/scripts/432290/%E6%96%B0%E6%B5%AA%E5%BE%AE%E5%8D%9A%28%E6%96%B0%E7%89%88%29%E4%B8%80%E9%94%AE%E5%88%A0%E9%99%A4%E3%80%81%E6%B8%85%E7%A9%BA%E5%8A%A9%E6%89%8B.user.js // @updateURL https://update.greasyfork.icu/scripts/432290/%E6%96%B0%E6%B5%AA%E5%BE%AE%E5%8D%9A%28%E6%96%B0%E7%89%88%29%E4%B8%80%E9%94%AE%E5%88%A0%E9%99%A4%E3%80%81%E6%B8%85%E7%A9%BA%E5%8A%A9%E6%89%8B.meta.js // ==/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(`