AnandTech Forums Jump

Add a Read link to the Ask The Community block, to jump to each forum.

Tính đến 05-12-2018. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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

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

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

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

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         AnandTech Forums Jump
// @namespace    https://sites.google.com/site/kenscode/
// @version      0.1
// @description  Add a Read link to the Ask The Community block, to jump to each forum.
// @author       Ken g6 (Ken Brazier)
// @match        https://forums.anandtech.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function changeReadLink() {
        var readlink = document.getElementById('askblockreadlink');
        var bselect = document.querySelector("form[data-xf-init*='future-quick-thread-widget draft'] select");
        var h = bselect.options[bselect.selectedIndex].dataset.actionUrl;
        h = h.substr(0, h.lastIndexOf('/')) + '/';
        readlink.href = h;
    }
    var bform = document.querySelector("form[data-xf-init*='future-quick-thread-widget draft']");
    if(bform != null) {
        var bselect = bform.querySelector("select");
        var bbgroup = bform.querySelector(".formButtonGroup");
        var readlink = document.createElement('a');
        readlink.innerHTML = '<span class="button-text">Read</span>';
        readlink.href = '#';
        readlink.className = 'button--primary button button--icon button--icon--search rippleButton';
        readlink.id = 'askblockreadlink';
        bbgroup.insertBefore(readlink, bbgroup.firstChild);
        changeReadLink();
        bselect.addEventListener("change", changeReadLink);
    }
})();