/shy/ recap script
User Script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | # /shy/ recap script
## User Script
// ==UserScript==
// @name shy-Fluttershy
// @version 1
// @description See the last 4chan recap
// @author FlutterOP
// @match *://*.8kun.top/fluttershy/*
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
// CONFIGURATION (MANDATORY!)
const BOARD_4CHAN = 'mlp'; // 4chan board (e.g., 'mlp', 'pol', 'vip')
const THREAD_ID_4CHAN = '42132656'; // Main thread ID on 4chan
const ARCHIVE = 'desuarchive'; // 'desuarchive', 'archivedmoe', or '4b4k'
console.log('[Migrator] Script started. Board:', BOARD_4CHAN, '| Thread:', THREAD_ID_4CHAN, '| Archive:', ARCHIVE);
// Corrected main function
function convertPostReferences() {
// Enhanced selector for 8kun
const posts = document.querySelectorAll('.body, .postMessage, .post-body, .post_content, .post-text');
posts.forEach(post => {
if (post.dataset.desuConverted) return;
post.dataset.desuConverted = 'true';
const originalHTML = post.innerHTML;
let newHTML = originalHTML;
// Convert >12345678 into links
newHTML = newHTML.replace(
/(^|\s|>)>(\d{8,})/g,
(match, prefix, postId) => {
return `${prefix}<a href="${getArchiveUrl(postId)}"
target="_blank"
style="color:#0f0c5d;font-weight:bold;text-decoration:underline;"
class="desu-link">>>${postId}</a>`;
}
);
// Convert >>12345678 (if they exist)
newHTML = newHTML.replace(
/(>>)(\d{8,})/g,
(match, arrows, postId) => {
return `<a href="${getArchiveUrl(postId)}"
target="_blank"
style="color:#0f0c5d;font-weight:bold;text-decoration:underline;"
class="desu-link">${arrows}${postId}</a>`;
}
);
if (newHTML !== originalHTML) {
post.innerHTML = newHTML;
}
});
}
// Corrected URL generator
function getArchiveUrl(postId) {
// Only for Desuarchive and Archived.moe we use the format /thread/THREAD_ID/#pPOST_ID
if (ARCHIVE === 'desuarchive' || ARCHIVE === 'archivedmoe') {
return `https://${ARCHIVE === 'desuarchive' ? 'desuarchive.org' : 'archived.moe'}/${BOARD_4CHAN}/thread/${THREAD_ID_4CHAN}/#${postId}`;
}
// For 4b4k
else if (ARCHIVE === '4b4k') {
return `https://arch.b4k.co/4chan/${BOARD_4CHAN}/search/num/${postId}`;
}
}
// Initialization
function init() {
// Immediate execution
convertPostReferences();
// Observer for new posts
const observer = new MutationObserver(() => {
convertPostReferences();
});
observer.observe(document, {
childList: true,
subtree: true
});
// Additional retry for SPAs
setTimeout(convertPostReferences, 3000);
}
// Trigger initialization
if (document.readyState === 'complete') {
init();
} else {
window.addEventListener('load', init);
}
})();
## F.A.Q.
##WHY?
Since the migration from 4chan to 8kun has been completed, it's now necessary to install this conversion script to view recaps pointing to 4chan (when the thread was still hosted there). It essentially works like the previous script, but with additional steps.
##How do I install it?"
Install Guide:
1. How to Install Scripts in Firefox/Chrome (Tampermonkey, etc.):
-Get a Userscript Manager:
-Firefox/Chrome: Install Tampermonkey (Chrome Web Store / Firefox Add-ons).
-Alternatives: Violentmonkey or Greasemonkey (same steps).
2. Import the Script into Tampermonkey:
-Open Tampermonkey’s dashboard (click its icon → "Dashboard").
-Go to the "Utilities" tab.
3. Paste the ##User Script code into the box.
-Under "Install from clipboard", click "Import" → paste the code from above → "Install".
4. Click "Install" or "Confirm".
|
F.A.Q.
WHY?
Since the migration from 4chan to 8kun has been completed, it's now necessary to install this conversion script to view recaps pointing to 4chan (when the thread was still hosted there). It essentially works like the previous script, but with additional steps.
How do I install it?"
Install Guide:
- How to Install Scripts in Firefox/Chrome (Tampermonkey, etc.):
-Get a Userscript Manager:
-Firefox/Chrome: Install Tampermonkey (Chrome Web Store / Firefox Add-ons).
-Alternatives: Violentmonkey or Greasemonkey (same steps). - Import the Script into Tampermonkey:
-Open Tampermonkey’s dashboard (click its icon → "Dashboard").
-Go to the "Utilities" tab. - Paste the ##User Script code into the box.
-Under "Install from clipboard", click "Import" → paste the code from above → "Install". - Click "Install" or "Confirm".