Shows content hidden by Valve's automated content check system
当前为
// ==UserScript==
// @name Show not checked content
// @namespace https://greasyfork.org/users/2205
// @version 0.1
// @description Shows content hidden by Valve's automated content check system
// @author Ryzhehvost
// @license Apache-2.0
// @match https://steamcommunity.com/groups/*/discussions/*
// @match https://steamcommunity.com/discussions/forum/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
/* global g_rgForumTopicCommentThreads */
/* global g_rgForumTopics*/
function GetText( gidTopic, gidComment )
{
var CommentThread = g_rgForumTopicCommentThreads[gidTopic];
var rgRawComment;
if ( gidComment && gidComment != -1 )
{
rgRawComment = CommentThread.GetRawComment( gidComment );
}
else
{
// topic quoting
rgRawComment = g_rgForumTopics[gidTopic].m_rgRawData;
}
return rgRawComment.text;
}
function FixComments (comments){
for (let i=comments.length-1; i>=0; i--) {
let parent = comments[i].parentNode;
let gidComment = parent.id.split('_')[2];
parent.innerHTML = GetText( gidTopic, gidComment);
}
}
let re = /.*discussions\/\d+\/(\d+)/g;
let res = re.exec(document.URL);
if (res===null){
re = /.*forum\/\d+\/(\d+)/g;
res = re.exec(document.URL);
}
let gidTopic = res[1];
let comments = document.getElementsByClassName('needs_content_check');
FixComments(comments);
let mutationObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
mutation.addedNodes.forEach( function(currentValue, currentIndex, listObj) {
if (currentValue.nodeType == Node.ELEMENT_NODE) {
let comments = currentValue.querySelectorAll("div[class^='needs_content_check']");
FixComments(comments);
}
});
});
});
mutationObserver.observe(document.documentElement, {
childList: true,
subtree: true
});
})();