惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Securelist
C
Cybersecurity and Infrastructure Security Agency CISA
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
Hacker News: Ask HN
Hacker News: Ask HN
L
Lohrmann on Cybersecurity
PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cyber Attacks, Cyber Crime and Cyber Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MyScale Blog
MyScale Blog
月光博客
月光博客
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
The GitHub Blog
The GitHub Blog
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
F
Full Disclosure
U
Unit 42
Jina AI
Jina AI
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
The Hacker News
The Hacker News
The Last Watchdog
The Last Watchdog
T
Troy Hunt's Blog
腾讯CDC
T
Threatpost
H
Hacker News: Front Page
P
Palo Alto Networks Blog
博客园 - 聂微东
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
Help Net Security
Help Net Security
L
LINUX DO - 热门话题
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Spread Privacy
Spread Privacy

Hyde Blog

Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog 关于我 关于我 Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog
Hyde Blog
Hyde · 2025-10-05 · via Hyde Blog

添加网页音乐播放器 ​

版权 ​

提示

本文是在 博主One 文章:《添加网页音乐播放器》 基础上增加了自己实践过程的一些细节,转载无需和我联系,但请注明文章来源。如果侵权之处,请联系博主进行删除,谢谢~

配置 ​

注意

由于此项目是魔改的,放在head.ts文件中不生效,因此这里我将代码加在打好包的docs\.vuepress\dist\index.html文件里。

js

<script
  type="text/javascript"
  id="myhk"
  src="https://myhkw.cn/api/player/xxxxxxxxxxxx"
  key="xxxxxxxxxxxx"
  m="1"
  lr="l"
></script>

参数说明:lr="l"代表播放器在左下角,lr="r"代表播放在右下角

警告

如果播放器不加载,请开启加载 jQuery 设置或将此段代码插入到网站源码</head>或播放器代码之前

js

<script
  type="text/javascript"
  src="https://myhkw.cn/player/js/jquery.min.js"
></script>

将上面 2 行代码添加到自己打好包的docs\.vuepress\dist\index.html文件

示例:

html

   <!DOCTYPE html>
   <html lang="en">
       /*省略...*/
   </body>
   <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
   <script type="text/javascript" id="myhk" src="https://myhkw.cn/api/player/xxxxxxxxxxxx" key="xxxxxxxxxxxx" m="1" lr="l"></script>
   </html>

这里唯一麻烦的是,每次打包后都要手动添加代码,这里我直接用 sed 命令再每次打包后自动插入这 2 行代码。编辑shell\vdoing.sh文件:

sh

   #构建
   cd /D/code/zhishiku/vuepress-theme-vdoing-Hyde
   npm run build:win
   echo "----------------------------追加音乐播放器代码前--------------------------------"
   # “/D/code/zhishiku/vuepress-theme-vdoing-Hyde/docs/.vuepress/dist/index.html”换成自己打包的路径
   tail -5 /D/code/zhishiku/vuepress-theme-vdoing-Hyde/docs/.vuepress/dist/index.html
   sed -i '/<\/body>/i\    <script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>\n    <script type="text/javascript" id="myhk" src="https://myhkw.cn/api/player/xxxxxxxxxxxx" key="xxxxxxxxxxxx" m="1" lr="l"></script>' /D/code/zhishiku/vuepress-theme-vdoing-Hyde/docs/.vuepress/dist/index.html
   echo "----------------------------追加音乐播放器代码后--------------------------------"
   tail -5 /D/code/zhishiku/vuepress-theme-vdoing-Hyde/docs/.vuepress/dist/index.html

验证 ​

bash 控制台输入 hxx(此命令是我自定义的)命令,打开打包路径的 index.html 是否有添加上,如有说明成功~