Okay success...
Using the history modifications I theorised about.
note session URL in image and visited threads.
HTTP://i.imgur.com/3sjBKFt.png
Then I logged out, and back in again. As expected it looked like this...
HTTP://i.imgur.com/uM15XWb.png
I ran my script and...
HTTP://i.imgur.com/nEDWVFM.png
Different session ID but all forum history has been updated to include the new ID.
It's almost 4:00am here so I'm going to leave it that for now. But I think this is the way to go.
If anyone finds a better method, I'll take it. But I think this is a pretty nice solution or at the very least has potential.
The script just needs a modification for the asynchronous "chrome.history.add" and chrome.history.deleteUrl. So they wait for each other. That's why the delete is commented out but I'll fix that and tidy it up when I'm awake. It works as it is though
function sIdFromURL(dUrl) {
"use strict";
if (dUrl === 0) {dUrl = document.URL; }
dUrl = dUrl.match(/^https?:\/\/(services|secure)\.runescape\.com[\w\W]+\/(c=[A-Z0-9\-\*]+?[?=\/])/i);
return dUrl ? dUrl[2] : null;
}
var fHistory = [];
chrome.history.search({text: 'http://services.runescape.com/m=forum/', maxResults: 500}, function(data) {
fHistory = data;
fHistory.forEach(function(page) {
//chrome.history.deleteUrl({"url"
age.url}, function(data) {
page.url = page.url.replace(sIdFromURL(page.url), 'c
V2Ueu6L210/').replace('sl=0/', '').replace('a=13/', '');
chrome.history.addUrl({"url"
age.url});
//});
});
});
Edit: code requires history permission in manifest to work, published version of linkify currently does not have that.