master
宇天 2020-12-09 20:38:11 +08:00
parent 45ab088e89
commit 8d0fb8ff74
7 changed files with 6033 additions and 79 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "io.yutent.gaystat", "name": "io.yutent.gaystat",
"version": "1.7.0", "version": "2.0.0",
"description": "搞基数据", "description": "搞基数据",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {
@ -12,16 +12,20 @@
"name": "yutent", "name": "yutent",
"email": "yutent.io@gmail.com" "email": "yutent.io@gmail.com"
}, },
"homepage": "https://yutent.me", "homepage": "https://yutent.top",
"license": "MIT", "license": "MIT",
"build": { "build": {
"appId": "io.yutent.gaystat", "appId": "io.yutent.gaystat",
"productName": "gaystat", "productName": "GayStat",
"copyright": "Copyright © 2019 ${author}", "copyright": "Copyright © 2019 ${author}",
"directories": { "directories": {
"buildResources": "icons", "buildResources": "icons",
"output": "build" "output": "build"
}, },
"electronDownload": {
"version": "11.0.4",
"mirror": "https://npm.taobao.org/mirrors/electron/"
},
"files": ["src/**/*", "node_modules/iofs/*"], "files": ["src/**/*", "node_modules/iofs/*"],
"mac": { "mac": {
"category": "public.app-category.developer-tools", "category": "public.app-category.developer-tools",
@ -31,8 +35,8 @@
} }
}, },
"devDependencies": { "devDependencies": {
"electron": "^9.0.0", "electron": "11.0.4",
"electron-builder": "^22.0.0" "electron-builder": "^22.1.0"
}, },
"dependencies": { "dependencies": {
"iofs": "^1.3.2" "iofs": "^1.3.2"

View File

@ -1 +1 @@
html{font-size:12.8px;width:100%;height:100vh}body{display:flex;flex-direction:column;width:100%;height:100%;padding-top:.9375rem;line-height:1.25;font-size:1.09375rem;color:#f2f5fc;background:transparent}.app{position:relative;display:flex;flex-direction:column;height:100%;padding:1.25rem 0 .46875rem;border-radius:.46875rem;background:rgba(88,88,88,0.85)}.app::before{position:absolute;left:12.10938rem;top:-.54688rem;width:1.09375rem;height:1.09375rem;border-radius:.15625rem;background:linear-gradient(to bottom right, rgba(88,88,88,0.85) 50%, transparent 50%);-webkit-transform:rotate(45deg);transform:rotate(45deg);content:""}.app .option,.app .close,.app .load{position:absolute;right:.46875rem;top:.15625rem;--size: 1.09375rem;cursor:pointer;opacity:0}.app .option:hover,.app .close:hover,.app .load:hover{opacity:1}.app .close{right:auto;left:.46875rem}.app .load{right:auto;left:12.10938rem}.app .list{flex:1}.app .list .item{display:flex;align-items:center;height:4.21875rem;padding:.78125rem .9375rem;line-height:1.17188rem;border-bottom:.07812rem solid rgba(200,200,200,0.1);border-top:.07812rem solid rgba(0,0,0,0.1)}.app .list .item:first-child{border-top:0}.app .list .item:last-child{border-bottom:0}.app .list .item .info{overflow:hidden;flex:1}.app .list .item .info h3{font-size:1.09375rem}.app .list .item .info cite{color:#dae1e9}.app .list .item .last-days{display:flex;width:5rem;height:2.34375rem;margin:0 .46875rem}.app .list .item .today{width:4.0625rem;font-size:.9375rem;color:#fff;text-align:right}.app .list .item .today span{display:block;padding:0 .3125rem}.app .list .item .today .percent{border-radius:.15625rem}.app .list .item .today .percent.red{background:#ff5061}.app .list .item .today .percent.green{background:#4caf50} html{font-size:12.8px;width:100%;height:100vh}body{display:flex;flex-direction:column;width:100%;height:100%;padding-top:.9375rem;line-height:1.25;font-size:1.09375rem;color:#f2f5fc;background:transparent}.app{position:relative;display:flex;flex-direction:column;height:100%;padding:1.25rem 0 .46875rem;border-radius:.46875rem}.app::before{position:absolute;left:12.10938rem;top:-5.46875rem;width:1.09375rem;height:1.09375rem;border-radius:.15625rem;background:linear-gradient(to bottom right, rgba(88,88,88,0.85) 50%, transparent 50%);-webkit-transform:rotate(45deg);transform:rotate(45deg);content:''}.app .option,.app .close,.app .load{position:absolute;right:.46875rem;top:.15625rem;--size: 1.09375rem;cursor:pointer;opacity:0}.app .option:hover,.app .close:hover,.app .load:hover{opacity:1}.app .close{right:auto;left:.46875rem}.app .load{right:auto;left:12.10938rem}.app .list{flex:1}.app .list .item{display:flex;align-items:center;height:4.21875rem;padding:.78125rem .9375rem;line-height:1.17188rem;border-bottom:.07812rem solid rgba(200,200,200,0.1);border-top:.07812rem solid rgba(0,0,0,0.1)}.app .list .item:first-child{border-top:0}.app .list .item:last-child{border-bottom:0}.app .list .item .info{overflow:hidden;flex:1}.app .list .item .info h3{font-size:1.09375rem}.app .list .item .info cite{color:#dae1e9}.app .list .item .last-days{display:flex;width:5rem;height:2.34375rem;margin:0 .46875rem}.app .list .item .today{width:4.0625rem;font-size:.9375rem;color:#fff;text-align:right}.app .list .item .today span{display:block;padding:0 .3125rem}.app .list .item .today .percent{border-radius:.15625rem}.app .list .item .today .percent.red{background:#ff5061}.app .list .item .today .percent.green{background:#4caf50}

View File

@ -5,96 +5,132 @@
* @date 2018/12/16 17:15:07 * @date 2018/12/16 17:15:07
*/ */
@import './var.scss';
@import "./var.scss"; html {
font-size: 12.8px;
width: 100%;
html {font-size:12.8px;width:100%;height:100vh;} height: 100vh;
}
body { body {
display:flex;flex-direction: column; display: flex;
width:100%;height:100%; flex-direction: column;
padding-top:px(12); width: 100%;
line-height:1.25; height: 100%;
font-size:px(14); padding-top: px(12);
color:nth($cp, 1); line-height: 1.25;
background:transparent; font-size: px(14);
color: nth($cp, 1);
background: transparent;
// background: rgba(88, 88, 88, 0.5);
} }
.app { .app {
position:relative; position: relative;
display:flex; display: flex;
flex-direction: column; flex-direction: column;
height:100%; height: 100%;
padding:px(16) 0 px(6); padding: px(16) 0 px(6);
border-radius:px(6); border-radius: px(6);
background:rgba(88, 88, 88, .85); // background: rgba(88, 88, 88, 0.5);
&::before { &::before {
position:absolute; position: absolute;
left:px(155); top:px(-7); left: px(155);
width:px(14); height:px(14); top: px(-70);
border-radius:px(2); width: px(14);
background: linear-gradient(to bottom right, rgba(88, 88, 88, .85) 50%, transparent 50%); height: px(14);
transform:rotate(45deg); border-radius: px(2);
content:""; background: linear-gradient(
to bottom right,
rgba(88, 88, 88, 0.85) 50%,
transparent 50%
);
transform: rotate(45deg);
content: '';
} }
.option, .close, .load { .option,
position:absolute; .close,
right:px(6);top:px(2); .load {
position: absolute;
right: px(6);
top: px(2);
--size: #{px(14)}; --size: #{px(14)};
cursor:pointer; cursor: pointer;
opacity:0; opacity: 0;
&:hover { &:hover {
opacity:1; opacity: 1;
} }
} }
.close {right:auto;left:px(6)} .close {
.load {right:auto;left:px(155)} right: auto;
left: px(6);
}
.load {
right: auto;
left: px(155);
}
.list { .list {
flex:1; flex: 1;
.item { .item {
display:flex; display: flex;
align-items:center; align-items: center;
height:px(54); height: px(54);
padding:px(10) px(12); padding: px(10) px(12);
line-height:px(15); line-height: px(15);
border-bottom:px(1) solid rgba(200, 200, 200, .1); border-bottom: px(1) solid rgba(200, 200, 200, 0.1);
border-top:px(1) solid rgba(0, 0, 0, .1); border-top: px(1) solid rgba(0, 0, 0, 0.1);
&:first-child {border-top:0;} &:first-child {
&:last-child {border-bottom:0;} border-top: 0;
}
&:last-child {
border-bottom: 0;
}
.info { .info {
overflow:hidden; overflow: hidden;
flex:1; flex: 1;
h3 {font-size:px(14);} h3 {
cite {color:nth($cp, 3);} font-size: px(14);
}
cite {
color: nth($cp, 3);
}
} }
.last-days { .last-days {
display:flex; display: flex;
width:px(64);height:px(30); width: px(64);
margin:0 px(6); height: px(30);
margin: 0 px(6);
} }
.today { .today {
width:px(52); width: px(52);
font-size:px(12); font-size: px(12);
color:#fff; color: #fff;
text-align:right; text-align: right;
span {display:block;padding:0 px(4);} span {
display: block;
padding: 0 px(4);
}
.percent { .percent {
border-radius:px(2); border-radius: px(2);
&.red {background:nth($cr, 1);} &.red {
&.green {background:nth($cg, 3);} background: nth($cr, 1);
}
&.green {
background: nth($cg, 3);
}
} }
} }
} }

View File

@ -16,9 +16,9 @@ import Utils from '/lib/utils.js'
const log = console.log const log = console.log
const { remote, ipcRenderer } = require('electron') const { ipcRenderer } = require('electron')
const WIN = remote.getCurrentWindow() // const WIN = remote.getCurrentWindow()
const $doc = Anot(document) const $doc = Anot(document)
@ -72,14 +72,13 @@ Anot({
} }
}, },
mounted() { mounted() {
WIN.on('blur', _ => { // WIN.on('blur', _ => {
WIN.hide() // WIN.hide()
}) // })
var watch_list = Anot.ls('watch_list') || '[]' var watch_list = Anot.ls('watch_list') || '[]'
if (watch_list) {
watch_list = JSON.parse(watch_list) watch_list = JSON.parse(watch_list)
}
this.list = watch_list this.list = watch_list
@ -89,7 +88,7 @@ Anot({
}, },
methods: { methods: {
close() { close() {
WIN.close() // WIN.close()
}, },
getTodayStat(id) { getTodayStat(id) {
var res = ipcRenderer.sendSync( var res = ipcRenderer.sendSync(

View File

@ -80,12 +80,17 @@ app.once('ready', () => {
maximizable: false, maximizable: false,
frame: false, frame: false,
transparent: true, transparent: true,
show: false, hasShadow: false,
// backgroundColor: '#80585858',
// show: false,
vibrancy: 'dark',
visualEffectState: 'active',
icon: path.resolve(ROOT, './images/app.png'), icon: path.resolve(ROOT, './images/app.png'),
webPreferences: { webPreferences: {
webSecurity: false, // webSecurity: false,
experimentalFeatures: true, experimentalFeatures: true,
nodeIntegration: true nodeIntegration: true,
spellcheck: false
} }
}) })

View File

@ -6,15 +6,15 @@
'use strict' 'use strict'
const { app, Tray } = require('electron') const { Tray } = require('electron')
const path = require('path') const path = require('path')
const ROOT = __dirname const ROOT = __dirname
module.exports = function(win) { module.exports = function(win) {
app.__TRAY__ = new Tray(path.join(ROOT, '../images/tray.png')) win.__TRAY__ = new Tray(path.join(ROOT, '../images/tray.png'))
app.__TRAY__.on('click', _ => { win.__TRAY__.on('click', _ => {
var b = app.__TRAY__.getBounds() var b = win.__TRAY__.getBounds()
win.setBounds({ x: b.x - 150, y: b.y + b.height + 4 }) win.setBounds({ x: b.x - 150, y: b.y + b.height + 4 })
win.show() win.show()
win.focus() win.focus()

5910
test.js Normal file

File diff suppressed because it is too large Load Diff