// ==UserScript== // @name MCBBS CreditAnalysis Mobile // @namespace https://fang.blog.miri.site // @version 0.3 // @description MCBBS用户积分成分分析(手机版) // @author Mr_Fang // @match https://*.mcbbs.net/home.php?mod=space&uid=* // @grant none // @downloadURL https://update.greasyfork.icu/scripts/407854/MCBBS%20CreditAnalysis%20Mobile.user.js // @updateURL https://update.greasyfork.icu/scripts/407854/MCBBS%20CreditAnalysis%20Mobile.meta.js // ==/UserScript== (function() { console.log(" %c MCBBS %c CreditAnalysis", "color: #fff; background: #f8981d; padding:5px;", "color:#fff; background: #000; padding:5px;"); console.log(" %c Made by %c 快乐小方 ", "color: #fff; background: #815098; padding:5px;", "color:#fff; background: #000; padding:5px;"); var jq = $; console.group('MCA Log'); console.log('[L] 正在运行的MCA为Mobile版!'); // 获取用户uid(我觉得通过页面url获取更麻烦) var uid = jq("span.uid").html(); uid = uid.split(':'); uid = uid[1]; console.log("[L] 用户UID:" + uid); console.log("[L] 开始获取用户数据"); // 调用api jq.ajax({ type:'get', url:"https://www.mcbbs.net/api/mobile/index.php?module=profile&uid=" + uid, success:function(body,heads,status){ console.log("[L] 成功获取用户数据"); var credits = body.Variables.space.credits; //积分总值 var extcredits1 = body.Variables.space.extcredits1; //人气 var extcredits2 = body.Variables.space.extcredits6; //贡献 var extcredits3 = body.Variables.space.extcredits7; //爱心 var extcredits4 = body.Variables.space.extcredits8; //钻石 var posts = body.Variables.space.posts; //发帖数 var threads = body.Variables.space.threads; //主题数 var digestposts = body.Variables.space.digestposts; //精华数 var json = [credits,extcredits1*3,extcredits2*10,extcredits3*4,extcredits4*2,posts/3,threads*2,digestposts*45]; console.log("[D] 用户积分数:" + json[0] +",公式计算得:" + Math.round(json[1] + json[2] + json[3] + json[4] + json[5] + json[6] + json[7])); // 页面宽带不同 绘制的canvas高度不同 var div_h = 500; if(document.body.clientWidth > 400){ div_h = 300; } // 在id是psts的标签末尾添加canvas jq('ul.tjxx').append(`
  • 积分成分分析By.快乐小方

    你的浏览器不支持HTML5
  • `); // 绘制饼状图(https://github.com/sutianbinde/charts) jq('ul.tjxx').append(` `); console.groupEnd(); } }); })();