mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-29 20:32:44 +08:00
feat: 春节彩蛋
This commit is contained in:
parent
72f098e104
commit
e0d688779f
@ -6,9 +6,22 @@ import qcfeatures from "./qcfeatures.js"
|
|||||||
import qcpanel from "./qcpanel.js"
|
import qcpanel from "./qcpanel.js"
|
||||||
import qcparser from "./qcparser.js"
|
import qcparser from "./qcparser.js"
|
||||||
|
|
||||||
! function() {
|
! function () {
|
||||||
|
// 春节彩蛋
|
||||||
|
let showSpringFestivalEgg = () => {
|
||||||
|
let eggs = UTOOLS.getDB(UTOOLS.DBPRE.CFG + 'eggs')
|
||||||
|
let thisYear = (new Date()).getFullYear()
|
||||||
|
if (!eggs.years) eggs.years = []
|
||||||
|
if (eggs.years.includes(thisYear)) return
|
||||||
|
let egg = window.springFestivalEgg()
|
||||||
|
if (!egg.springFestival) return
|
||||||
|
utools.showNotification(egg.msg)
|
||||||
|
eggs.years.push(thisYear)
|
||||||
|
UTOOLS.putDB(eggs, UTOOLS.DBPRE.CFG + 'eggs')
|
||||||
|
}
|
||||||
// 进入插件
|
// 进入插件
|
||||||
utools.onPluginEnter(async ({ code, type, payload }) => {
|
utools.onPluginEnter(async ({ code, type, payload }) => {
|
||||||
|
showSpringFestivalEgg()
|
||||||
// 暗黑模式
|
// 暗黑模式
|
||||||
if (utools.isDarkColors()) {
|
if (utools.isDarkColors()) {
|
||||||
!$('#darkmode').length && $('head').append(`
|
!$('#darkmode').length && $('head').append(`
|
||||||
@ -133,7 +146,7 @@ import qcparser from "./qcparser.js"
|
|||||||
// 启动子命令输入
|
// 启动子命令输入
|
||||||
// 清空输出
|
// 清空输出
|
||||||
// $("#out").empty();
|
// $("#out").empty();
|
||||||
var rule = String.raw `\{\{subinput(:.+?){0,1}\}\}`
|
var rule = String.raw`\{\{subinput(:.+?){0,1}\}\}`
|
||||||
var matched = cmd.match(new RegExp(rule))
|
var matched = cmd.match(new RegExp(rule))
|
||||||
var placeholder = matched[1] || ':请输入'
|
var placeholder = matched[1] || ':请输入'
|
||||||
var subinput = '';
|
var subinput = '';
|
||||||
|
BIN
src/logo_spring_festival.png
Normal file
BIN
src/logo_spring_festival.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
@ -4,10 +4,10 @@
|
|||||||
"main": "index.html",
|
"main": "index.html",
|
||||||
"homepage": "https://github.com/fofolee/uTools-quickcommand",
|
"homepage": "https://github.com/fofolee/uTools-quickcommand",
|
||||||
"publishPage": "https://yuanliao.info/d/424",
|
"publishPage": "https://yuanliao.info/d/424",
|
||||||
"version": "2.4.0",
|
"version": "2.4.2",
|
||||||
"author": "云之轩",
|
"author": "云之轩",
|
||||||
"unpack":"autopep8.py",
|
"unpack":"autopep8.py",
|
||||||
"logo": "logo.png",
|
"logo": "logo_spring_festival.png",
|
||||||
"preload": "preload.js",
|
"preload": "preload.js",
|
||||||
"pluginSetting": {
|
"pluginSetting": {
|
||||||
"single": false
|
"single": false
|
||||||
|
@ -3,11 +3,12 @@ const os = require('os');
|
|||||||
const child_process = require("child_process")
|
const child_process = require("child_process")
|
||||||
const iconv = require('iconv-lite')
|
const iconv = require('iconv-lite')
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const { NodeVM } = require('vm2')
|
const { NodeVM } = require('./assets/plugins/vm2')
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
const util = require("util")
|
const util = require("util")
|
||||||
const PinyinMatch = require('pinyin-match');
|
const PinyinMatch = require('pinyin-match');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
const solarLunar = require("solarLunar")
|
||||||
// axios.defaults.adapter = require('axios/lib/adapters/http')
|
// axios.defaults.adapter = require('axios/lib/adapters/http')
|
||||||
|
|
||||||
if (!utools.isWindows()) process.env.PATH += ':/usr/local/bin:/usr/local/sbin'
|
if (!utools.isWindows()) process.env.PATH += ':/usr/local/bin:/usr/local/sbin'
|
||||||
@ -875,3 +876,20 @@ runCodeFile = (cmd, option, terminal, callback) => {
|
|||||||
// callback(stdout, stderr)
|
// callback(stdout, stderr)
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.springFestivalEgg = () => {
|
||||||
|
let today = new Date()
|
||||||
|
const solar2lunarData = solarLunar.solar2lunar(today.getFullYear(), today.getMonth() + 1, today.getDate())
|
||||||
|
let springFestivalDays = ["初一", "初二", "初三", "初四", "初五", "初六"]
|
||||||
|
if (solar2lunarData.monthCn == "正月" && springFestivalDays.includes(solar2lunarData.dayCn)) {
|
||||||
|
return {
|
||||||
|
springFestival: true,
|
||||||
|
msg: "今天是农历" + solar2lunarData.yearCn + solar2lunarData.monthCn + solar2lunarData.dayCn + ", 春节快乐!"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
springFestival: false,
|
||||||
|
msg: "今天是农历" + solar2lunarData.yearCn + solar2lunarData.monthCn + solar2lunarData.dayCn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user