移除LeetCode付费题目

移除LeetCode付费题目, 使不显示在列表中

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         移除LeetCode付费题目
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  移除LeetCode付费题目, 使不显示在列表中
// @author       sumuzhe
// @match        *://leetcode-cn.com/problemset/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    main();
})();

function main() {
    setInterval(remove, 3000);
}

function remove() {
    console.log("remove function start");
    var ps = $(".reactable-data");
    if (ps.length <= 0) {
        return;
    }
    var trs = ps.find("tr");
    for (var i = 0; i < trs.length; i++) {
        var tr = $(trs.get(i));
        if (tr.is(":hidden")) {
            continue;
        }
        var lockDiv = $(tr.find("td").get(0)).find("div").children("i");
        if (lockDiv.length === 1) {
            tr.hide();
        }
    }
    console.log("remove function end");
}