The old forum URLs that is. I like digging through threads, but any linked thread is dead. I initially thought I’d just swap thread IDs but they’re not the same.
Any solution other than searching for the thread?
The old forum URLs that is. I like digging through threads, but any linked thread is dead. I initially thought I’d just swap thread IDs but they’re not the same.
Any solution other than searching for the thread?
The Kunena urls have the thread name. Use thst to find it with the search bar.
I could probably write a script to redirect old links to a search of the thread title. I just have to battle some regex.
EDIT: That was actually really easy to do. Here’s the script: https://openuserjs.org/scripts/Artex/Redirect_old_links
… woops doesn’t work on threads anchored to a specific post/has query strings.
Just make it omit those? Also, any way to use that on mobile?
I fixed the matching issue, but now I either need to find a global way to redirect link after it’s clicked or remember how to use MutationObserver to watch for page changes so I can replace old links as you scroll down discourses dynamically loaded pages.
You should be able to use it on mobile if your mobile browser supports extensions. I’m pretty sure greasemonkey works in firefox mobile, don’t know about tampermonkey on chrome’s mobile browser since I haven’t used it.
Edit: Well this isn’t going well. I can only get the script to run through the console and MutationObserver isn’t doing it’s job. If anyone want’s to fix it go ahead, i’m done for now.
// ==UserScript==
// @name Redirect old links
// @namespace Artex
// @description redirect old developer forum links to a search query of the thread title.
// @include http://devforum.roblox.com/t/*
// @include https://devforum.roblox.com/t/*
// @include devforum.roblox.com/t/*
// @run-at document-end
// @version 1
// @grant none
// ==/UserScript==
function isOldLink(url) {
if (url.search("developer.roblox.com/forum/") !== -1) {
return true;
} else {
return false;
}
}
function redirectLink(a) {
var href = a.href
var title = href.match(/\/\d+([0-9,a-z,A-Z, -]+)(?=#?|\?)/)[1];
title = title.replace(/-/g, " ");
a.href = "http://devforum.roblox.com/search?q=" + title;
}
function replaceLinks(e) {
var links = e.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (isOldLink(link.href)) {
redirectLink(link);
}
}
}
var observer = new MutationObserver(function(mutation){
console.log("mutation:", mutation)
for (var i = 0; i < mutation.length; i++) {
if (mutation[i].target !== undefined) {
replaceLinks(mutation[i].target);
}
}
});
replaceLinks(document);
observer.observe(document, {attribute: false, childList: true, characterData: false});