Mark stories as read on Creepypasta.com

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

当前为 2014-10-10 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Mark stories as read on Creepypasta.com
// @namespace    http://herbalcell.com
// @version      0.1
// @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==


$('body').wrapInner('<div id="herbalcell-container"></div>');
$('#herbalcell-container').fadeTo(0, 0, function() {
    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'>" +
        '<style>' +
            '#herbalcell-container {' +
                'background: url("http://fc04.deviantart.net/fs71/f/2010/177/5/7/Spooky_trees_by_Betuwefotograaf.jpg") no-repeat top left fixed;' +
                '-webkit-background-size: cover;' +
                '-moz-background-size: cover;' +
                '-o-background-size: cover;' +
                'background-size: cover;' +
            '}' +
            '.wide {margin-top: 0; border-radius: 10px; border: none;}' +
            '#main, #header, #footer {background: transparent;}' +
            '.wide {background: #FFF7F4; color: #2E1E17;}' +
            '#poop ul {list-style-type: none;}' +
            '.children {margin-left: 40px;}' +
            '.comment {background: rgba(0,0,0,0.1); margin: 20px; padding: 10px; border-radius: 10px;}' +
            'cite {color: #666;}' +
            '.gdthumbtext {color: #888; margin-left: 10px;}' +
            '.comment span {font-size: 1.25em; color: #FB7405; display: block;}' +
            'a {color:#952E00;}' +
            'a:hover {color:#D66735;}' +
            'a:visited {color:#702300;}' +
            '.hidden-and-read, .hidden-and-read a {font-style:italic; text-decoration:line-through; color:#888}' +
            '#content table tbody tr:hover {background: #eee7e4;}' +
            '#secondnav {background: #BAADA7;}' +
        '</style>'
    );

    waitForKeyElements ('#header', function() {
        $('#header img, .wpfp-span, #text-27').remove();
        $('*').css({'font-family':'Droid Serif', 'font-size':'1em'});
        $('h1').css({'font-size':'2em'});
        $('#header, #header a, .title, .title a, .secondnav').css({'font-family':'Special Elite'});
        $('#header a').css({'color':'#952E00'});
    });

    waitForKeyElements ('#disqus_thread', function() {
        $('#disqus_thread').attr('id', 'poop');
    });

    waitForKeyElements ('#content table:first', doAllTheHidin);

    function doAllTheHidin() {

        var hideColumnHeader = $('#content table thead tr td.rating').last();
        hideColumnHeader.html('<a style="cursor:pointer;cursor:hand;">Show</a>');
        hideColumnHeader.click(function(e) {
            $('#content table tbody tr:hidden').show();
        });
        $('#content 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;">x</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');
            }
        });
    }
}).fadeTo(3000, 1);