js批量删除人人状态

人人没有批量删除状态的功能,尝试用了js来删除。

'use strict';

var a = jQuery('.page-next');
var b = jQuery('.page-prev');
var job = jQuery.Deferred();
var l = setInterval(function () {
  		job.then(function () {
		if (jQuery('.del-status').length === 0) {
			if (a.hasClass('page-disable') && b.hasClass('page-disable')) {
				clearInterval(l);
				console.log('clear');
				return false;
			}
			if (a.hasClass('page-disable')) {
				var _ref = [b, a];
				a = _ref[0];
				b = _ref[1];
				console.log('turn around');
			}
			console.log('next');
			a.click();
		}
}).then(function () {
	jQuery('.del-status').eq(0).click();
  	}).then(function () {
	jQuery('.ui-dialog button').eq(2).click();
  	});
  	job.resolve(1);
}, 1000);

发现收藏也要删,继续上代码,然而删一页会刷新一次所以要手动执行

'use strict';

var a = jQuery('.page-next');
var b = jQuery('.page-prev');
var l = function l() {
	console.log('check items');
	if (jQuery('.ugc-list-item').length === 0) {
		if (a.hasClass('page-disable') && b.hasClass('page-disable')) {
			console.log('clear');
			return false;
		}
		if (a.hasClass('page-disable')) {
			var _ref = [b, a];
			a = _ref[0];
			b = _ref[1];
			console.log('turn around');
		}
		console.log('next');
		a.click();
  		}
  		console.log('delete');
  		jQuery('.share-item-delete').each(function () {
		jQuery(this).click();
  		});
  		console.log('confirm');
  		jQuery('.ui-dialog button').delay(1000).each(function () {
		jQuery(this).click();
  		});
  		//setTimeout(l,1000)
};
l();

转载自 https://www.v2ex.com/t/277348#reply8