Deskthority: Mark forums read

Mark all forums read from the unread posts page

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Deskthority: Mark forums read
// @author      Bruno Sabença
// @version     1
// @description Mark all forums read from the unread posts page
// @namespace   https://deskthority.net
// @include     https://deskthority.net/search.php?search_id=unreadposts
// @include     https://deskthority.net/?markread
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
// @grant       GM_addStyle
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);

$(document).ready(function() {
    if (window.location.href == "https://deskthority.net/search.php?search_id=unreadposts") {
        var markread_link_html = "<span class=\"markread\">Mark forums read</span> • ";

        $(".rightside.pagination").each(function() {
            $(this).prepend(markread_link_html);
        });

        $(".markread").each(function() {
            $(this).click(function() {
                window.location.href = "https://deskthority.net?markread";
            });
        });
    }

    if (window.location.href == "https://deskthority.net/?markread") {
        var markread_link_href = $("a:contains('Mark forums read')").attr("href");

        window.location.replace(markread_link_href);
    }
});

GM_addStyle("                   \
.markread {                     \
cursor: pointer;                \
cursor: hand;                   \
}                               \
.markread:hover {               \
text-decoration: underline;     \
}                               \
");