diff --git a/src/BalanceShower.css b/src/BalanceShower.css deleted file mode 100644 index 4b5a918..0000000 --- a/src/BalanceShower.css +++ /dev/null @@ -1,19 +0,0 @@ -.balance-popover { - position: absolute; - top: 2em; - margin: auto; - left: 50%; - transform: translateX(-50%); - z-index: 1; -} - -.balance-value { - opacity: 0; - animation: balance-disappear 2s ease-in; -} - -@keyframes balance-disappear { - from {opacity: 1;} - 75% {opacity: 1;} - to {opacity: 0;} -} \ No newline at end of file diff --git a/src/BalanceShower.js b/src/BalanceShower.js deleted file mode 100644 index a68f037..0000000 --- a/src/BalanceShower.js +++ /dev/null @@ -1,83 +0,0 @@ -import React, {Component, PureComponent} from 'react'; -import {PKUHELPER_ROOT} from './infrastructure/const'; -import {API_VERSION_PARAM, get_json} from './flows_api'; -import {TokenCtx} from './UserAction'; - -import './BalanceShower.css'; - -export class BalanceShower extends PureComponent { - constructor(props) { - super(props); - this.state={ - loading_status: 'idle', - error: null, - balance: null, - }; - } - - do_load(e,token) { - if(this.state.loading_status==='loading') - return; - if(e.target.closest('a')) // clicking at a link - return; - if(!token || !window.config.easter_egg) { - this.setState({ - loading_status: 'idle', - }); - return; - } - - this.setState({ - loading_status: 'loading', - },()=>{ - fetch( - PKUHELPER_ROOT+'api_xmcp/isop/card_balance' - +'?user_token='+encodeURIComponent(token) - +API_VERSION_PARAM() - ) - .then(get_json) - .then((json)=>{ - console.log(json); - if(!json.success) - throw new Error(JSON.stringify(json)); - - this.setState({ - loading_status: 'done', - error: null, - balance: json.balance, - }); - }) - .catch((e)=>{ - console.error(e); - this.setState({ - loading_status: 'error', - error: ''+e, - }); - }); - }) - } - - render_popover() { - if(this.state.loading_status==='idle') // no token or disabled - return null; - else if(this.state.loading_status==='loading') - return (
- PKUHelper 网页版树洞 by @xmcp, - 基于 - GPLv3 - 协议在 GitHub 开源 -
-- PKUHelper 网页版的诞生离不开 - React - 、 - IcoMoon - 等开源项目 -
-- { - if('serviceWorker' in navigator) { - navigator.serviceWorker.getRegistrations() - .then((registrations)=>{ - for(let registration of registrations) { - console.log('unregister',registration); - registration.unregister(); - } - }); - } - cache().clear(); - setTimeout(()=>{ - window.location.reload(true); - },200); - }}>强制检查更新 - ({process.env.REACT_APP_BUILD_INFO||'---'} {process.env.NODE_ENV} 会自动在后台检查更新并在下次访问时更新) -
-- This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -
-- This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License - for more details. -
-+
+ props.show_sidebar(
+ 'P大树洞',
+
+ PKUHelper 网页版树洞 by @xmcp, + 基于 + GPLv3 + 协议在 GitHub 开源 +
++ PKUHelper 网页版的诞生离不开 + React + 、 + IcoMoon + 等开源项目 +
++ { + if('serviceWorker' in navigator) { + navigator.serviceWorker.getRegistrations() + .then((registrations)=>{ + for(let registration of registrations) { + console.log('unregister',registration); + registration.unregister(); + } + }); + } + cache().clear(); + setTimeout(()=>{ + window.location.reload(true); + },200); + }}>强制检查更新 + ({process.env.REACT_APP_BUILD_INFO||'---'} {process.env.NODE_ENV} 会自动在后台检查更新并在下次访问时更新) +
++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. +
++ This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License + for more details. +
+
- 您已登录。
-
-
-
- 根据计算中心要求,访问授权三个月内有效。
若提示“授权过期”,请注销后重新登录。
-
- {this.props.show_sidebar(
- '系统消息',
-
- 当您发送的内容违规时,我们将用系统消息提示您
-
- 复制 User Token
- User Token 用于迁移登录状态,切勿告知他人,若怀疑被盗号请尽快
-
-- PKU Helper 面向北京大学学生,通过 ISOP(北京大学数据共享开放服务平台)验证您的身份并提供服务。 -
-+ 根据计算中心要求,访问授权三个月内有效,过期需重新登录。 +
+
+ {this.props.show_sidebar(
+ '系统消息',
+
+ 当您发送的内容违规时,我们将用系统消息提示您
+
+ 复制 User Token
+ User Token 用于迁移登录状态,切勿告知他人,若怀疑被盗号请尽快
+
+ PKU Helper 面向北京大学学生,通过 ISOP(北京大学数据共享开放服务平台)验证您的身份并提供服务。 +
+