LiuShen / 仅仅刷新图片,而不刷新整站
0 likes
0 forks
1 files
Last active 9 months ago
点击图片仅仅刷新图片,而不刷新整站,通过添加参数防止缓存
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>局部刷新图片</title> |
| 7 | <style> |
| 8 | body { |
| 9 | display: flex; |
| 10 | justify-content: center; |
LiuShen / 友链friend.json生成新方式
0 likes
0 forks
1 files
Last active 9 months ago
| 1 | const blacklist = ["友站名称1", "友站名称2", "友站名称3"]; |
| 2 | const path = "friend.json"; |
| 3 | |
| 4 | function genFriendJSON(locals) { |
| 5 | var friends = []; |
| 6 | var data = locals.data.link; |
| 7 | data.forEach((entry, index) => { |
| 8 | let lastIndex = 2; |
| 9 | if (index < lastIndex) { |
| 10 | const filteredLinkList = entry.link_list.filter( |
| 1 | addEventListener('fetch', event => { |
| 2 | event.respondWith(handleRequest(event.request)) |
| 3 | }) |
| 4 | const specialCases = { |
| 5 | "*": { |
| 6 | "Origin": "DELETE", |
| 7 | "Referer": "DELETE" |
| 8 | } |
| 9 | } |
| 10 | function handleSpecialCases(request) { |
LiuShen / Hexo-butterfly聊天记录外挂标签
1 likes
0 forks
2 files
Last active 1 year ago
基于鹊楠改进的Hexo-butterfly聊天记录外挂标签
| 1 | /** |
| 2 | * Chat |
| 3 | */ |
| 4 | |
| 5 | "use strict"; |
| 6 | |
| 7 | // 预定义头像数组 |
| 8 | const avatars = [ |
| 9 | "https://i.p-i.vip/30/20240920-66ed9a608c2cf.png", |
| 10 | "https://i.p-i.vip/30/20240920-66ed9b0655cba.png", |
LiuShen / 解决Matplotlib不显示汉字的问题
0 likes
0 forks
1 files
Last active 1 year ago
解决Matplotlib不显示汉字的问题,设置汉语字体
| 1 | import matplotlib.pyplot as plt |
| 2 | import matplotlib.font_manager as fm |
| 3 | |
| 4 | # 设置中文字体 |
| 5 | plt.rcParams['font.sans-serif'] = ['SimHei'] # 使用黑体 |
| 6 | plt.rcParams['axes.unicode_minus'] = False # 解决负号显示问题 |
| 7 | |
| 8 | # 示例数据 |
| 9 | x = [1, 2, 3, 4] |
| 10 | y = [10, 20, 15, 25] |