// ==UserScript== // @name tingyun-userid // @namespace Violentmonkey Scripts // @author https://github.com/LinusLing // @match https://report.tingyun.com/mobile-web/ // @require http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js // @version 1.0.0 // @grant none // @description 支持听云查看自定义上传的 UserId 字段 // @downloadURL none // ==/UserScript== (function() { 'use strict'; window.addEventListener("load", function(event) { var th = $("th:first")[0]; // find the first element of "th" type var userid_column = '
UserId
'; $(th.parentNode).addClass("").append(userid_column); // call the parentNode to append userid_column // add click function for crash $("tr[style='cursor: default;']").click(function() { if ($(".tr-selected>td").hasClass("userid")) { // if td already append userid then return return; } $("li[target='userDiyInfo']").trigger("click"); // trigger an click event for userDiyInfo(which includes userid) // grap the userid from tab_cust var str = $("#tab_cust")[0].innerText; var userid_str = str.split("\n")[0].split(":").pop().trim(); var y = $(".tr-selected")[0]; // find the selected tr for showing userid var userid_html = '
' + userid_str + '
'; // build the td element with userid $(y).addClass("").append(userid_html); // append userid to the table $("li[target='stackTrace']").trigger("click"); // restore stackTrace tab }); $(".tr-selected").trigger("click"); }); })();