Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
samliew committed Apr 2, 2019
1 parent 0daf920 commit ec4d433
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PostBanDeletedPosts.user.js
Expand Up @@ -3,7 +3,7 @@
// @description When user posts on SO Meta regarding a post ban, fetch and display deleted posts (must be mod) and provide easy way to copy the results into a comment
// @homepage https://github.com/samliew/SO-mod-userscripts
// @author @samliew
// @version 1.5.8
// @version 1.5.9
//
// @include https://meta.stackoverflow.com/questions/*
//
Expand Down Expand Up @@ -68,15 +68,15 @@
function doPageload() {

const post = $('#question');
const postOwner = $('.post-signature:last a[href*="/users/"]', post).first();
const postOwner = $('.post-signature:last .user-details a[href*="/users/"]', post).first();
const postText = $('h1 .question-hyperlink').text() + $('.post-text', post).text();

// Is a deleted user, do nothing
if(postOwner.length === 0) return;

const uid = postOwner.attr('href').match(/\d+/)[0];
const username = postOwner.text().trim();
const userRep = postOwner.find('.reputation-score').text().replace(',', '') || null;
const userRep = postOwner.parent().find('.reputation-score').text().replace(',', '') || null;
const hasDupeLink = $('.question-originals-of-duplicate a, .comments-list a', post).filter((i, el) => /(https:\/\/meta\.stackoverflow\.com)?\/q(uestions)?\/255583\/?.*/.test(el.href)).length > 0;
const hasTags = $('a.post-tag', post).filter((i, el) => ['post-ban', 'banning', 'deleted-'].some(v => el.innerText.contains(v))).length > 0;
const hasKeywords = ['unable', 'cannot', 'ban', 'block', 'well received'].some(v => postText.contains(v)) && ['question', 'answer', 'post'].some(v => postText.contains(v));
Expand Down

0 comments on commit ec4d433

Please sign in to comment.