mmmturkeybacon Show Hidden Content in Quotes

Replaces ***Hidden content cannot be quoted.*** with the hidden content if the quoted post is on the same page as the post that is quoting it.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        mmmturkeybacon Show Hidden Content in Quotes
// @version     1.01
// @description Replaces ***Hidden content cannot be quoted.*** with the hidden content if the quoted post is on the same page as the post that is quoting it.
// @author      mmmturkeybacon
// @namespace   http://userscripts.org/users/523367
// @match       http://mturkgrind.com/threads/*
// @match       http://www.mturkgrind.com/threads/*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @grant       GM_log
// ==/UserScript==


function replace_hidden_quote()
{
    $('blockquote[class="quoteContainer"] > div[class="quote"] > b:contains("***Hidden content cannot be quoted.***")').each(function()
    {
        var post_id = $(this).parent().parent().prev().find('a[href^="goto"]').attr('href').split('#')[1];
        var $hidden_content = $('li[id="'+post_id+'"] div[class="bbCodeBlock bbCodeVfcHH UnhiddenContent"] blockquote');
        if ($hidden_content.length > 0)
        {
            $(this).parent().parent().addClass('expanded');
            $(this).after($hidden_content.html());
            $(this).remove();
        }

    });
}

$(document).ready(function()
{
    replace_hidden_quote();
});

$(window).load(function()
{
    var observer = new MutationObserver(function(mutations, obs)
    {
        var new_hidden_quote = false;
        for (var i = 0; i < mutations.length; i++)
        {
            for (var j = 0; j < mutations[i].addedNodes.length; j++)
            {
                var new_tag = mutations[i].addedNodes[j];
                if ($(new_tag).find('blockquote[class="quoteContainer"] > div[class="quote"] > b:contains("***Hidden content cannot be quoted.***")').length > 0)
                {
                    new_hidden_quote = true;
                    break;
                }
            }
            if (new_hidden_quote)
            {
                break;
            }
        }

        if (new_hidden_quote)
        {
            replace_hidden_quote();
        }
    });

    observer.observe(document.documentElement,
    {
        childList: true,
        subtree: true
    });
});