Worm comments spoiler protector

Disables tags and comments newer than 2 days. JQuery required.

目前為 2017-08-04 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Worm comments spoiler protector
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Disables tags and comments newer than 2 days. JQuery required.
// @author       ShareDVI
// @match        https://parahumans.wordpress.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // How many days ahead are allowed
    var DAYS = 2;
    // Get chapter release date, thank gods of semantic web
    var chapter = Date.parse(jQuery("time.entry-date").attr("datetime"));
    // If something went wrong, better kill all comments
    if(!chapter) chapter=0;
    // Filter all comments newer than days
    jQuery("article.comment").filter(function(i,e) {return Date.parse(jQuery(e).find("time").attr("datetime")) >= chapter + 2*86400*1000;}).hide().remove();
    // Delete tags
    jQuery("a[rel=tag]").hide().remove();
    // Add warning so that you know it's enabled
    jQuery("#comments-title").append("<b style='color:green; font-size:150%'>Spoiler protection on!</b>");
})();