v站增强

v2ex站点增强插件.增强评论查看模式。

目前为 2021-03-21 提交的版本。查看 最新版本

// ==UserScript==
// @name         v站增强
// @namespace    https://www.yffjglcms.com/
// @version      0.1.0.20210321
// @description  v2ex站点增强插件.增强评论查看模式。
// @author       yffjglcms
// @match        https://v2ex.com/t/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...



    // 获取数据
    let data = [];

    let map = new Map();

    let boxName = "v2Box";
    let boxNameSelector = ".v2Box";
    let msgBox = `<div class='box ${boxName}' style='position: absolute;width: 270px; padding: 5px;'></div>`;

    fetchData();

    function fetchData() {
        $(".cell strong a").each((idx, e) => {
            let _this = $(e);
            let _cell = _this.parents(".cell");

            let author = _this.html();
            let no = _cell.find(".no").html();

            console.log(author);
            console.log(no);

            if (!map.has(author)) {
                map.set(author, []);
            }
            map.get(author).push(_cell.html());
        });

        console.log(map);
    }

    // 绑定事件
    $(".reply_content a").hover(
        (e) => {
            let _this = $(e.currentTarget);
            let parent = _this.parents(".cell");
            let author = _this.html();

            if ($(boxNameSelector).length > 0) {
                $(boxNameSelector).remove();
            }
            $(parent).before(msgBox);

            $(boxNameSelector).css("left", Rightbar.offsetLeft);
            $(boxNameSelector).html(map.get(author));
        },
        () => {
            // console.log("2-1");
            // $(boxNameSelector).remove();
            // console.log("2-2");
        }
    );




})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址