// ==UserScript== // @name Guilty Record Lookup for scboy.com // @namespace http://tampermonkey.net/ // @version 0.1 // @description Complement the forum's existing guilty record feature // @author tianyi // @include https://www.scboy.com/* // @downloadURL none // ==/UserScript== (function() { 'use strict'; const $guiltyRecord = $(`
  • `).appendTo('body').hide(); const $confession = $guiltyRecord.find('#confession'); $('img.avatar-3').mouseenter((ev) => { const $victim = $(ev.target); const uid = $victim.attr('uid'); $.xpost('mod-ban_yy.htm', {uid: uid}, (code, msg) => { if (code === 0) { let record = ''; const confession = $.parseJSON(msg); for (let i = 0; i < confession.length; i++) { let showInfo = ''; if (confession[i]['state_fmt'] === '解封') { showInfo = '系统 解封'; } else { showInfo = `${confession[i]['admin_username']} ${confession[i]['state_fmt']} 原因: ${confession[i]['remark']}`; } record += `

    ${confession[i]['opt_date_fmt']} 被 ${showInfo}

    `; } if (!record) { return; } $confession.empty().append(`${record}`); const offset = $victim.offset(); $guiltyRecord.css({ top: `${offset.top}px`, left: `${offset.left + $victim.outerWidth() + 5}px` }); $guiltyRecord.show(); } }); }).mouseleave(() => { $guiltyRecord.hide(); }); })();