NSFW v0.1
This commit is contained in:
parent
0f953e74cd
commit
cd236b00f1
2 changed files with 50 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
hnq-research/se-hnq-html-only.backup
|
||||||
|
hnq-research/sede-vote-analysis.sql
|
||||||
|
|
48
nsfw/nsfw.user.js
Normal file
48
nsfw/nsfw.user.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// ==UserScript==
|
||||||
|
// @name NSFW
|
||||||
|
// @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
|
||||||
|
// @updateURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/nsfw/nsfw.user.js
|
||||||
|
// @downloadURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/nsfw/nsfw.user.js
|
||||||
|
// @version 0.1
|
||||||
|
// @match *://*.stackexchange.com/*
|
||||||
|
// @match *://*.stackoverflow.com/*
|
||||||
|
// @match *://*.superuser.com/*
|
||||||
|
// @match *://*.serverfault.com/*
|
||||||
|
// @match *://*.askubuntu.com/*
|
||||||
|
// @match *://*.stackapps.com/*
|
||||||
|
// @match *://*.mathoverflow.net/*
|
||||||
|
// @grant none
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
$('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) {
|
||||||
|
// Find link to latest revision
|
||||||
|
let href = $(historyData).find('#revisions a.single-revision')[0].getAttribute('href');
|
||||||
|
$.get(href, function(data) {
|
||||||
|
// Question?
|
||||||
|
if (self.className == 'hidden-deleted-question') {
|
||||||
|
// Replace question title
|
||||||
|
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>'));
|
||||||
|
$(postMenu).append($('<a href="' + revisionHistory + '">revisions</a>'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
Loading…
Reference in a new issue