HF Scripts - Thread Previewer

Allows you to preview threads before opening it. - Updated by Dr Steve Brule

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name		HF Scripts - Thread Previewer
// @namespace 		xerotic/previewthread
// @description 	Allows you to preview threads before opening it. - Updated by Dr Steve Brule
// @include  		*hackforums.net/forumdisplay.php?fid=*
// @include  		*hackforums.net/search.php?action=results&sid=*
// @version  		1.1.0
// ==/UserScript==

function getPage(e) {
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest
    } else {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
    }
    xmlhttp.open("GET", e, false);
    xmlhttp.send();
    var t = document.implementation.createHTMLDocument("HF Thread");
    t.documentElement.innerHTML = xmlhttp.responseText;
    return t
}

function loadPreview(e) {
    var t = getPage(tidElements[e].href);
    var n = document.createElement("div");
    if (!t.body.getElementsByClassName("post_body")[0]) {
        n.innerHTML = t.body.querySelectorAll('div[id^="pid"]')[0].innerHTML
    } else {
        n.innerHTML = t.body.getElementsByClassName("post_body")[0].innerHTML
    }
    n.style.border = "2px solid #0F5999";
    n.style.margin = "5px";
    n.style.padding = "6px";
    n.style.boxShadow = "0px 0px 5px 4px #1E1E1E";
    tidParents[e].parentNode.insertBefore(n, tidParents[e].nextSibling)
}
var tidElements = document.body.querySelectorAll('a[id^="tid"]');
tidParents = new Array;
for (var i = 0; i < tidElements.length; i++) {
    tidParents[i] = tidElements[i].parentNode;
    var newSpan = document.createElement("span");
    newSpan.innerHTML = "▼";
    newSpan.style.color = "#0F5999";
    newSpan.style.fontSize = "16px";
    newSpan.style.marginLeft = "7px";
    newSpan.style.cursor = "pointer";
    newSpan.id = i;
    tidParents[i].appendChild(newSpan);
    tidParents[i].addEventListener("click", function(e) {
        ele = e.srcElement;
        loadPreview(e.target.id);
        ele.parentNode.removeChild(ele)
    }, false)
}