Reminder to report the iPhone spammer.
// ==UserScript==
// @name Submit reports to 4chan directly from Archives
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Adds “Report on 4chan” buttons
// @match https://desuarchive.org/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function addReportButton(postElem) {
const postId = postElem.id;
if (!postId) return;
if (postElem.querySelector('.report-on-4chan-btn')) return;
const a = document.createElement('a');
a.href = `https://sys.4chan.org/g/imgboard.php?mode=report&no=${postId}`;
a.textContent = 'Report on 4chan';
a.className = 'report-on-4chan-btn';
Object.assign(a.style, {
backgroundColor: '#66bb66',
color: 'white',
border: '1px solid #449944',
padding: '4px 8px',
marginLeft: '8px',
cursor: 'pointer',
borderRadius: '3px',
fontSize: '0.9em',
display: 'inline-block'
});
a.onclick = e => {
e.preventDefault();
window.open(a.href, '_blank');
};
const controls = postElem.querySelector('.post_controls');
if (controls) {
controls.appendChild(a);
}
}
function processAllPosts() {
document.querySelectorAll('.post').forEach(addReportButton);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', processAllPosts);
} else {
processAllPosts();
}
})();