Something Awful Single Post Link

To add a link to display that single post on each post.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           Something Awful Single Post Link
// @namespace      http://www.mathemaniac.org
// @include        *://forum.somethingawful.com/showthread.php?*
// @include        *://forums.somethingawful.com/showthread.php?*
// @include        *://archives.somethingawful.com/showthread.php?*
// @description    To add a link to display that single post on each post.
// @version        1.0.3
// ==/UserScript==

// 2nd of August, 2011: Update the script to work with the "Mark as read" links enabled.

function insertAfter(newNode, node) {
  return node.parentNode.insertBefore(newNode, node.nextSibling);
}

var tds = document.getElementsByTagName('td');
for (var i = 0; i < tds.length; i++) {
    var curTD = tds[i];
    if (curTD.className == 'postdate') {
        var atag = curTD.getElementsByTagName('a');
        if (atag.length > 0) {
            var newA = document.createElement('a');
            newA.href="showthread.php?action=showpost&noseen=1&postid="+atag[1].getAttribute('href').replace(/[^0-9]*/,'');
            newA.appendChild(document.createTextNode("1"));
            insertAfter(newA, atag[1]);
            insertAfter(document.createTextNode(" "), atag[1]);
        }
    }
}