More SEO title, Don't run on unnecessary sites.

This commit is contained in:
Brock 2018-10-27 10:11:41 -07:00 committed by GitHub
parent 2e1e543e6e
commit 4db1bda273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
// ==UserScript==
// @name NSFW
// @name Stack Exchange, Show NSFW post's text
// @namespace https://github.com/Glorfindel83/
// @description Shows (potentially NSFW) content for deleted posts whose content is deleted because of being spam or rude/abusive.
// @author Glorfindel
@ -13,6 +13,13 @@
// @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/*
// @exclude *://api.stackexchange.com/*
// @exclude *://blog.*.com/*
// @exclude *://chat.*.com/*
// @exclude *://data.stackexchange.com/*
// @exclude *://elections.stackexchange.com/*
// @exclude *://openid.stackexchange.com/*
// @exclude *://stackexchange.com/*
// @grant none
// ==/UserScript==
@ -21,7 +28,7 @@
$('span.hidden-deleted-question, span.hidden-deleted-answer').each(function() {
let self = this;
// Load revision history
let revisionHistory = $(this).find('a').attr('href');
$.get(revisionHistory, function(historyData) {
@ -34,10 +41,10 @@
let title = $(data).find('a.question-hyperlink')[0].innerHTML;
document.getElementById('question-header').getElementsByTagName('h1')[0].innerHTML = title;
}
// Replace post content
self.innerHTML = $(data).find('div.post-text')[0].innerHTML;
// Add link to revision history
let postMenu = $(self.parentElement.parentElement).find('div.post-menu')[0];
$(postMenu).append($('<span class="lsep">|</span>'));
@ -46,4 +53,4 @@
});
});
});
})();
})();