微件:getMCBBSCredit:修订间差异

添加30字节 、​ 2023年3月17日 (星期五)
// Edit via Wikiplus
(使用salt跨域)
(// Edit via Wikiplus)
 
(未显示2个用户的12个中间版本)
第2行: 第2行:
(function () {
(function () {
     // 添加highcharts开源库
     // 添加highcharts开源库
     addScript('https://cdn.staticfile.org/highcharts/8.2.2/highcharts.min.js')
     addScript('/salt/highcharts.min.js')
     addScript('https://cdn.staticfile.org/highcharts/8.2.2/modules/exporting.min.js')
     addScript('/salt/highcharts.exporting.min.js')
     window.addEventListener('load', () => {
     window.addEventListener('DOMContentLoaded', () => {
         let uid = getUID(); if (!uid || isNaN(uid)) { console.log('未获取到MCBBSUID'); return }
         let uid = getUID(); if (!uid || isNaN(uid)) { console.log('未获取到MCBBSUID'); return }
         getPIE(uid)
         getPIE(uid)
第26行: 第26行:
     let retry = 1 // 重试次数
     let retry = 1 // 重试次数
     function getPIE(uid) {
     function getPIE(uid) {
         let $url = 'https://www.mcbbs.net/api/mobile/index.php?module=profile&uid=' + uid; console.log('正在获取用户信息: ' + $url)
         let $url = 'https://mcbbs.wiki/913-api/users/' + uid; console.log('正在获取用户信息: ' + $url)
         fetch('https://saltproxy.saltlovely.workers.dev/' + $url)
         fetch($url)
             .then(response => {
             .then(response => {
                 if (response.ok) {
                 if (response.ok) {
第40行: 第40行:
             .then((data) => {
             .then((data) => {
                 console.log(data); window.res = data
                 console.log(data); window.res = data
                 let space = data.Variables.space
                 let credits = data.credits.credit;        //总积分
                let credits = space.credits;        //总积分
                 let post = data.activites.post+data.activites.thread;            //回帖
                 let post = space.posts;            //回帖
                 let thread = data.activites.thread;        //主题
                 let thread = space.threads;        //主题
                 let digestpost = data.activites.digiest; //精华
                 let digestpost = space.digestposts; //精华
                 let popular = data.credits.popularity;    //人气
                 let popular = space.extcredits1;    //人气
                 // let goldngt = space.extcredits2;    //金粒
                 // let goldngt = space.extcredits2;    //金粒
                 // let goldigt = space.extcredits3;    //金锭
                 // let goldigt = space.extcredits3;    //金锭
                 // let emerald = space.extcredits4;    //绿宝石
                 // let emerald = space.extcredits4;    //绿宝石
                 // let nethers = space.extcredits5;    //下界之星
                 // let nethers = space.extcredits5;    //下界之星
                 let contrib = space.extcredits6;    //贡献
                 let contrib = data.credits.contribute;    //贡献
                 let kindnes = space.extcredits7;    //爱心
                 let kindnes = data.credits.heart;    //爱心
                 let diamond = space.extcredits8;    //钻石
                 let diamond = data.credits.diamond;    //钻石
                 let uname = space.username || '';  //用户名
                 let uname = data.nickname || '';  //用户名
                 let group = space.group.grouptitle || ''; //用户组
                 let group = data.activites.currentGroupText || ''; //用户组
                 var json = {};
                 var json = {};
                 json.credits = {
                 json.credits = {
                     href: 'https://mcbbs-wiki.cn/wiki/%E7%94%A8%E6%88%B7:Salt_lovely',
                     href: 'https://mcbbs.wiki/wiki/MCBBS_Wiki:API#%E7%A7%AF%E5%88%86%E6%9F%A5%E8%AF%A2',
                     text: '小工具由Salt_lovely制作,使用了highcharts开源库'
                     text: '小工具由Salt_lovely制作,使用了Litwak.913的论坛用户信息API和highcharts开源库'
                 }
                 }
                 json.chart = { backgroundColor: '#fbf2da', plotShadow: false };
                 json.chart = { backgroundColor: '#fbf2da', plotShadow: false };
第127行: 第126行:
})()
})()
</script>
</script>
</includeonly>
</includeonly><noinclude>已弃用,请使用 <code><mcbbs-credit></code>标签代替。</noinclude>
维护员、​界面管理员、​巡查员、​监督员、​小部件编辑者
3,469

个编辑