Skip to content

Commit

Permalink
wip(163musichot): 优化快捷键支持
Browse files Browse the repository at this point in the history
  • Loading branch information
renxia committed Sep 10, 2024
1 parent 757c21e commit 8a6729f
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ss -a

## 文档

- [awesome-tools 个人常用工具列表](./src/docs/tools.md)
- [awesome-tools 个人常用工具列表](./src/docs/awesome-tools.md)
- [Awesome ChatGPT 学习资料搜集](./src/docs/AIGC/ChatGPT/READEME.md)
- more...

Expand Down
16 changes: 11 additions & 5 deletions src/docs/tools.md → src/docs/awesome-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
## 通用

- [vscode](https://code.visualstudio.com) 主力开发工具
- [electerm](https://electerm.github.io/electerm) 基于 Electron 开发的 Terminal,支持多系统平台。主要是 Macbook 下使用,主要是 sftp 的拖拽式上传下载开箱即用。当前主要是 Mac 下拉取源码自己编译
- [nxshell](https://github.com/nxshell/nxshell) 与 electerm 一样基于 Electron 开发的 Terminal,支持多系统平台。主要是 Macbook 下使用,相比 electerm 的功能更为简洁。特色功能是内置编辑器,可以直接点击文件编辑并保存。
- [Git录屏](https://www.cockos.com/licecap) 有 Mac 和 windows 版
- [charles](https://www.charlesproxy.com) 代理软件,抓包工具,多平台支持
- [Whistle](https://wproxy.org/whistle/) 基于 Node.js 的抓包工具。安装: `npm i -g whistle`

### SSH 终端

- [electerm](https://electerm.github.io/electerm) 基于 Electron 开发的 Terminal,支持多系统平台。主要是 Macbook 下使用,主要是 sftp 的拖拽式上传下载开箱即用。当前主要是 Mac 下拉取源码自己编译
- [nxshell](https://github.com/nxshell/nxshell) 与 electerm 一样基于 Electron 开发的 Terminal,支持多系统平台。主要是 Macbook 下使用,相比 electerm 的功能更为简洁。特色功能是内置编辑器,可以直接点击文件编辑并保存。
- [tabby](https://github.com/Eugeny/tabby/releases/) 跨平台终端,开源免费。基于 Electron 开发。


## Macbook

Expand All @@ -19,7 +23,8 @@
- [iTerm2](https://www.iterm2.com)
- [zsh](https://en.wikipedia.org/wiki/Z_shell)
- [oh-my-zsh][https://github.com/robbyrussell/oh-my-zsh]
- 可以选用 [electerm](https://electerm.github.io/electerm)[nxshell](https://github.com/nxshell/nxshell)
- [electerm](https://electerm.github.io/electerm)
- [nxshell](https://github.com/nxshell/nxshell)
- [Jietu](https://jietu.qq.com) Macbook 下好用的截图软件,可以录屏

## Windows
Expand All @@ -29,8 +34,9 @@
- [国内可用的 Scoop 应用下载地址加速仓库](https://github.com/lzwme/scoop-proxy-cn)
- Terminal / ssh Terminal
- [FinalShell](https://www.hostbuf.com) Terminal 终端工具。 Windows 下使用,优点是性能稳定,上传下载很稳定
- 可选:[electerm](https://electerm.github.io/electerm)[nxshell](https://github.com/nxshell/nxshell),应用商店都可以搜到
- Windows Terminal
- [nxshell](https://github.com/nxshell/nxshell) 应用商店可搜到
- [electerm](https://electerm.github.io/electerm) 应用商店可搜到
- `Windows Terminal`

## 扩展参考

Expand Down
16 changes: 8 additions & 8 deletions src/x/163musichot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<title>网易云音乐热评墙 - 志文工作室</title>
<meta name="description" content="网易云热评墙,热评音乐在线随心听! " />
<meta name="keywords" content="云音乐,网易云音乐评论" />
<link rel="stylesheet" href="style.css?v=005" />
<link rel="stylesheet" href="style.css?v=007" />
<script crossorigin="anonymous" src="https://npm.elemecdn.com/jquery/dist/jquery.min.js"></script>
</head>

Expand All @@ -40,16 +40,16 @@ <h1 id="title"></h1>
<div id="lrcUpdate"></div>
<p id="yh"></p>
<p id="pl"></p>
<div id="copyComment">复制</div>
<div id="nextComment">下一条</div>
<div id="copyComment">复制(C)</div>
<div id="nextComment">下一条(↓)</div>
</div>
</div>
<nav>
<ul>
<li><a href="javascript:;" id="bfBtn">播放</a></li>
<li><a href="javascript:;" id="nextTone">下一首</a></li>
<li><a href="javascript:;" id="lrcBtn">看歌词</a></li>
<li><a href="javascript:;" id="hotBtn">热歌榜</a></li>
<li><a href="javascript:;" id="bfBtn">播放(p)</a></li>
<li><a href="javascript:;" id="nextTone">下一首(n)</a></li>
<li><a href="javascript:;" id="lrcBtn">看歌词(L)</a></li>
<li><a href="javascript:;" id="hotBtn">热歌榜(h)</a></li>
</ul>
</nav>
</header>
Expand All @@ -72,5 +72,5 @@ <h1 id="title"></h1>
<div id="playlistContain"></div>
</body>
<script src="https://lzw.me/x/lib/utils/h5-common.js?v=010"></script>
<script src="main.js?v=005"></script>
<script src="main.js?v=006"></script>
</html>
4 changes: 4 additions & 0 deletions src/x/163musichot/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,17 @@ $(async function () {
$(document).on('keydown', (ev) => {
console.log(ev.key, ev.code);
switch(ev.key) {
case 'ArrowDown':
el.nextComment.click();
break;
case 'c':
play.copyComment();
break;
case 'n':
play.nextTone();
break;
case 'p':
case ' ':
el.bfBtn.click();
break;
case 'l':
Expand Down
10 changes: 7 additions & 3 deletions src/x/163musichot/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ i {
}

p {
margin: 0 0 2rem 0;
margin: 0 0 .8rem 0;
}

h1,
Expand Down Expand Up @@ -1305,7 +1305,7 @@ body.is-loading #bg:before {
background-image: -webkit-radial-gradient(rgba(0, 0, 0, 0.25) 25%, transparent 55%);
background-image: -ms-radial-gradient(rgba(0, 0, 0, 0.25) 25%, transparent 55%);
background-image: radial-gradient(rgba(0, 0, 0, 0.25) 25%, transparent 55%);
max-width: 100%;
max-width: 900px;
text-align: center;
}

Expand Down Expand Up @@ -1389,7 +1389,7 @@ body.is-loading #bg:before {
}

#header .content .inner #copyComment {
right: 65px;
right: 96px;
}

#header .content p {
Expand All @@ -1399,6 +1399,10 @@ body.is-loading #bg:before {
line-height: 2;
}

#header .content #yh {
color: #ff0;
}

#header .content #pl {
margin-bottom: 10px;
}
Expand Down
52 changes: 46 additions & 6 deletions src/x/iapi/bing/api.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
$idx = $_REQUEST['idx'] ?: 0;
$n = $_REQUEST['n'] ?: 1;
$mkt = $_REQUEST['mkt'] ?: 'zh-CN';
$idx = isset($_REQUEST['idx']) ? $_REQUEST['idx'] : 0;
$n = isset($_REQUEST['n']) ? $_REQUEST['n'] : 1;
$mkt = isset($_REQUEST['mkt']) ? $_REQUEST['mkt'] : 'zh-CN';

$str = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=js&mkt=' . $mkt . '&idx=' . $idx . '&n=' . $n);
$json = json_decode($str, true);
// $str = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=js&mkt=' . $mkt . '&idx=' . $idx . '&n=' . $n);
$json = get_bing_hpimage_info($n, $idx, $mkt);

if ($_REQUEST['json']) {
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '*';
header("Access-Control-Allow-Origin:" . $origin);
header('Content-Type:application/json; charset=utf-8');
header('cache-control:no-cache');
print_r($str);
die(json_encode($json));
} else {
$src = $json['images'][0]['url'];

Expand All @@ -22,3 +22,43 @@
$imgurl = 'https://cn.bing.com' . $src;
header("Location: $imgurl");
}

function get_bing_hpimage_info($n = 1, $offset = 0, $mkt = 'zh-CN')
{
$today = (int) date('Ymd', time()) - 1;
$n = max(1, min($n, 10));
$offset = max(0, min($offset, 100));

// 取缓存
$cacheFile = 'cache/bing_HPImageArchive.json';
$cacheInfo = file_exists($cacheFile) ? json_decode(file_get_contents($cacheFile), true) : [];
$result = ['images' => [], 'cache' => 1];

if (!isset($cacheInfo[$today])) {
$str = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=js&mkt=' . $mkt . '&idx=' . $offset . '&n=' . $n);
$json = json_decode($str, true);

if (is_array($json['images'])) {
foreach ($json['images'] as $k => $v) {
$cacheInfo[$v['startdate']] = $v;
}

if (!file_exists(dirname($cacheFile))) {
mkdir(dirname($cacheFile));
}
file_put_contents($cacheFile, json_encode($cacheInfo, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$result = ['images' => [], 'cache' => 0];
}
}

$start = (int) $today - $offset;

for ($i = 0; $i < $n; $i++) {
$key = $start - $i;
if (isset($cacheInfo[$key])) {
$result['images'][$i] = $cacheInfo[$key];
}
}

return $result;
}

0 comments on commit 8a6729f

Please sign in to comment.