// ==UserScript== // @name v2ex_comment // @namespace http://tampermonkey.net/ // @version 0.1 // @description simplify comment cell. // @author 6david9 // @match https://*.v2ex.com/t/* // @icon https://www.google.com/s2/favicons?sz=64&domain=v2ex.com // @require https://code.jquery.com/jquery-3.6.3.min.js // @grant none // ==/UserScript== (function() { 'use strict'; /* globals jQuery, $, waitForKeyElements */ const comment_container = $("#Main > div:nth-child(4)"); if (comment_container.length == 0) { return; } const cells = comment_container.find("div.cell"); for (let i = 0; i < cells.length; ++i) { const cell = cells[i]; const titleElem = $(cell).find("strong>a"); const commentElem = $(cell).find(".reply_content"); const timeElem = $(cell).find("span.ago"); let replacedCell = $("
").addClass("cell"); let infoLine = $(""); if (typeof(titleElem) !== "undefined" && titleElem.length > 0) { const aElem = titleElem.first().attr({"target": "_blank"}); const titleSpan = $("").append(aElem[0]); infoLine.append(titleSpan); } if (typeof(timeElem) !== "undefined" && timeElem.length > 0) { const timeSpan = $("").append(timeElem.first().attr("title")); infoLine.append(timeSpan); } if (typeof(commentElem) !== "undefined" && commentElem.length > 0) { const commentSpan = $("").append(commentElem.first().text()); replacedCell.append(commentSpan); } replacedCell.append(infoLine); $(cell).replaceWith(replacedCell); } })();