>>107615369
It works for me, but the way it works it replaces the entire line with the new link.
Here's a changed version that replaces the news to stay (see picrel).
That seems to fuck with the way 4chanX/XT do auto embed on hover though.
// ==UserScript==
// @name 4chan Linkify Greentext
// @version 1.2
// @include http://boards.4chan.org/*
// @include https://boards.4chan.org/*
// @include http://www.4chan.org/*
// @include https://www.4chan.org/*
// @grant none
// @run-at document-start
// ==/UserScript==
document.onreadystatechange = function () {
if (document.readyState === "interactive") {
document.querySelectorAll('span.quote').forEach(quoteSpan => {
const post = quoteSpan.parentNode;
const previousThreadUrl = post.querySelector('a[href*="thread"]');
let threadId = null;
if (previousThreadUrl) {
const threadMatch = previousThreadUrl.href.match(/thread\/(\d{9})/);
if (threadMatch) threadId = threadMatch[1];
}
const quoteIds = quoteSpan.textContent.match(/(?<!>)>(\d{9})(.*)/g);
if (quoteIds) {
quoteSpan.outerHTML = quoteIds.map(id => {
const postId = id.slice(1);
const news = quoteIds[2]||"";
const linkUrl = threadId ? `/g/thread/${threadId}#p${postId}` : `#p${postId}`;
return `<a href="${linkUrl}" class="quotelink">>>${postId}</a>${news}`;
}).join(' ');
}
});
}
};
But it seems to work for >>107615393 so maybe it's just because I'm on my laptop at my parent's home because of christmas, if it's just the network here, then all is well and I can write news normally again when I'm back at my place.
If not 'd rework the script it a bit to be more elegant and add it to the OP if needed (also to make sure it doesn't conflict with the other one), but that seems like a reasonable solution too.
Seems news are here to stay anon, thanks!