Mark Read Creepypasta.com

Mark stories as read on Creepypasta.com, makes styling more readable but still creepy

目前為 2014-11-06 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Mark Read Creepypasta.com
// @namespace    http://herbalcell.com
// @version      0.2
// @description  Mark stories as read on Creepypasta.com, makes styling more readable but still creepy
// @match        http://www.creepypasta.com/*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js
// @require      https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349
// ==/UserScript==


var storedHiddenTitles = JSON.parse(localStorage.storedHiddenTitles || '{}');
$('head').append(
    "<link href='http://fonts.googleapis.com/css?family=Special+Elite|Droid+Serif' rel='stylesheet' type='text/css'>" +
    '<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">' +
    '<style>' +
        '.hidden-and-read, .hidden-and-read a {font-style:italic; text-decoration:line-through; color:#888}' +
        '.tpost table tbody tr:hover {background: #eee7e4;}' +
        'td, th {padding: 0 10px; text-align: center;}' +
    '</style>'
);

waitForKeyElements ('.tpost table', doAllTheHidin);

function doAllTheHidin() {

    var hideColumnHeader = $('.tpost table thead tr td.rating').last();
    hideColumnHeader.html('<a style="cursor:pointer;cursor:hand;">Show</a>');
    hideColumnHeader.click(function(e) {
        $('.tpost table tbody tr:hidden').show();
    });
    $('.tpost table tbody tr').each(function() {
        var currentRow = $(this);
        var currentTitle = currentRow.find('td.title').text();
        var hideColumn = currentRow.find('td.rating').last();
        hideColumn.html('<a style="cursor:pointer;cursor:hand;"><i class="fa fa-close"></i></a>');
        hideColumn.attr('class','hide-link');
        hideColumn.click(function(e) {
            storedHiddenTitles[currentTitle] = true;
            localStorage.storedHiddenTitles = JSON.stringify(storedHiddenTitles);
            currentRow.hide();
            currentRow.addClass('hidden-and-read');
        });
        if (storedHiddenTitles[currentTitle] !== undefined) {
            currentRow.hide();
            currentRow.addClass('hidden-and-read');
        }
    });
}