Skip to content

Instantly share code, notes, and snippets.

@amarkulo
Created December 2, 2016 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amarkulo/9d97f598eb968166f77c6d78dc3af619 to your computer and use it in GitHub Desktop.
Save amarkulo/9d97f598eb968166f77c6d78dc3af619 to your computer and use it in GitHub Desktop.
Klix unread post fix tampermonkey script for Chrome
// ==UserScript==
// @name Klix unread posts fix
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Unread posts fix for permalinks
// @author Amar Kulo (amar@url.ba)
// @match http://forum.klix.ba/search.php?*
// @grant none
// ==/UserScript==
(function() {
var links = document.evaluate("//a[contains(@href, 'unread#unread')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i=0; i < links.snapshotLength; i++)
{
var thisLink = links.snapshotItem(i);
var threadPrefix = new String(thisLink.href.match(/t\d{2,}/));
thisLink.href = 'http://forum.klix.ba/viewtopic.php?t=' + threadPrefix.substr(1) + '&view=unread#unread';
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment