Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var deleteSpam = {
- count: 0,
- list: null,
- tiemout: 500,
- //Selector for cross(x) icon, look for <i> tag
- crossSelector: '.userContentWrapper .sx_477a95',
- //Selector for buttons wrapper in overlay box which appears when we click on cross icon
- overlayPresenseSelector: '.uiOverlayFooter',
- //Delete button selector on overlay box
- confirmDeleteButtonSelector: 'button.layerConfirm',
- init: function() {
- this.list = document.querySelectorAll(this.crossSelector);
- this.overlay();
- },
- checkOverlay: function() {
- var that = this;
- var overlay = document.querySelector(this.overlayPresenseSelector);
- if (!overlay) {
- this.overlay();
- } else {
- setTimeout(function() {
- that.checkOverlay();
- }, this.timeout);
- }
- },
- overlay: function() {
- var that = this;
- var event = document.createEvent('HTMLEvents');
- event.initEvent('click', true, false);
- if (this.list.length <= this.count) {
- return false;
- }
- this.list[this.count].offsetParent.dispatchEvent(event);
- setTimeout(function() {
- that.confirm();
- }, this.timeout);
- },
- confirm: function() {
- var that = this;
- var button = document.querySelector(this.confirmDeleteButtonSelector);
- var event = document.createEvent('HTMLEvents');
- event.initEvent('click', true, false);
- if (button) {
- button.dispatchEvent(event);
- this.count++;
- setTimeout(function() {
- that.checkOverlay();
- }, this.timeout);
- } else {
- setTimeout(function() {
- that.confirm();
- }, this.timeout);
- }
- }
- }.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement