tona-vite 0.0.8 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
15
19
  }
16
20
  return to;
17
21
  };
@@ -54,13 +58,13 @@ function tona(options = {}) {
54
58
  entry: existingLib.entry || resolvedEntryPath,
55
59
  name: existingLib.name || themeName,
56
60
  fileName: existingLib.fileName || (() => `${themeName}.min.js`),
57
- cssFileName: existingLib.cssFileName || `${themeName}.min.css`
61
+ cssFileName: existingLib.cssFileName || `${themeName}.min`
58
62
  } : {
59
63
  formats: ["iife"],
60
64
  entry: resolvedEntryPath,
61
65
  name: themeName,
62
66
  fileName: () => `${themeName}.min.js`,
63
- cssFileName: `${themeName}.min.css`
67
+ cssFileName: `${themeName}.min`
64
68
  };
65
69
  return {
66
70
  ...config,
package/dist/index.mjs CHANGED
@@ -28,13 +28,13 @@ function tona(options = {}) {
28
28
  entry: existingLib.entry || resolvedEntryPath,
29
29
  name: existingLib.name || themeName,
30
30
  fileName: existingLib.fileName || (() => `${themeName}.min.js`),
31
- cssFileName: existingLib.cssFileName || `${themeName}.min.css`
31
+ cssFileName: existingLib.cssFileName || `${themeName}.min`
32
32
  } : {
33
33
  formats: ["iife"],
34
34
  entry: resolvedEntryPath,
35
35
  name: themeName,
36
36
  fileName: () => `${themeName}.min.js`,
37
- cssFileName: `${themeName}.min.css`
37
+ cssFileName: `${themeName}.min`
38
38
  };
39
39
  return {
40
40
  ...config,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["resolvedEntryPath: string | null","filePath: string | null"],"sources":["../src/index.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport type { LibraryFormats, Plugin, UserConfig, ViteDevServer } from 'vite'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\n\ninterface MimeTypes {\n [key: string]: string\n}\n\nexport interface TonaPluginOptions {\n /**\n * Theme name for build output filename\n * @default 'theme'\n */\n themeName?: string\n}\n\n/**\n * Vite plugin for Tona themes - combines dynamic script extension and shared assets serving\n */\nexport default function tona(options: TonaPluginOptions = {}): Plugin {\n const { themeName = 'theme' } = options\n\n // Default path to shared assets\n const assetsPath = path.join(__dirname, '..', 'public')\n const baseDir = process.cwd()\n\n return {\n name: 'vite-plugin-tona',\n\n config(config: UserConfig): UserConfig {\n // Check main.ts first, then main.js\n const tsPath = path.resolve(baseDir, 'src/main.ts')\n const jsPath = path.resolve(baseDir, 'src/main.js')\n\n let resolvedEntryPath: string | null = null\n if (fs.existsSync(tsPath)) {\n resolvedEntryPath = tsPath\n } else if (fs.existsSync(jsPath)) {\n resolvedEntryPath = jsPath\n }\n\n if (!resolvedEntryPath) {\n return config\n }\n\n const existingLib = config.build?.lib\n const libConfig =\n existingLib && typeof existingLib === 'object'\n ? {\n ...existingLib,\n formats: existingLib.formats || (['iife'] as LibraryFormats[]),\n entry: existingLib.entry || resolvedEntryPath,\n name: existingLib.name || themeName,\n fileName: existingLib.fileName || (() => `${themeName}.min.js`),\n cssFileName: existingLib.cssFileName || `${themeName}.min.css`,\n }\n : {\n formats: ['iife'] as LibraryFormats[],\n entry: resolvedEntryPath,\n name: themeName,\n fileName: () => `${themeName}.min.js`,\n cssFileName: `${themeName}.min.css`,\n }\n\n return {\n ...config,\n build: {\n ...config.build,\n cssCodeSplit: config.build?.cssCodeSplit ?? false,\n lib: libConfig,\n },\n }\n },\n\n transformIndexHtml(html) {\n // Check main.ts or main.js exists\n const jsPath = path.resolve(baseDir, 'src/main.js')\n const tsPath = path.resolve(baseDir, 'src/main.ts')\n let scriptSrc = '/src/main.js'\n\n if (fs.existsSync(tsPath)) {\n scriptSrc = '/src/main.ts'\n } else if (fs.existsSync(jsPath)) {\n scriptSrc = '/src/main.js'\n }\n\n // Replace script src in HTML\n return html.replace(\n /<script type=\"module\" src=\"[^\"]*\"><\\/script>/,\n `<script type=\"module\" src=\"${scriptSrc}\"></script>`,\n )\n },\n\n configureServer(server: ViteDevServer) {\n // Serve static files from shared-assets/public directory\n server.middlewares.use((req, res, next) => {\n let filePath: string | null = null\n\n // Check if the request is for a file in /public (which will be served from shared-assets)\n if (req.url?.startsWith('/public/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n urlWithoutQuery!.replace('/public/', ''),\n )\n } else if (req.url?.startsWith('/templates/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'templates',\n urlWithoutQuery!.replace('/templates/', ''),\n )\n } else if (req.url?.startsWith('/js/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'js',\n urlWithoutQuery!.replace('/js/', ''),\n )\n } else if (req.url?.startsWith('/css/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'css',\n urlWithoutQuery!.replace('/css/', ''),\n )\n } else if (req.url?.startsWith('/images/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'images',\n urlWithoutQuery!.replace('/images/', ''),\n )\n } else if (\n req.url === '/' ||\n req.url?.startsWith('/?') ||\n req.url === '/index.html' ||\n req.url?.startsWith('/index.html?')\n ) {\n filePath = path.join(assetsPath, 'index.html')\n }\n\n // Check if file exists\n if (filePath && fs.existsSync(filePath)) {\n // Set appropriate content type\n const ext = path.extname(filePath).toLowerCase()\n const mimeTypes: MimeTypes = {\n '.html': 'text/html',\n '.css': 'text/css',\n '.js': 'application/javascript',\n '.json': 'application/json',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n }\n\n const contentType = mimeTypes[ext] || 'application/octet-stream'\n res.setHeader('Content-Type', contentType)\n\n // Read and serve the file\n const fileStream = fs.createReadStream(filePath)\n fileStream.pipe(res)\n return\n }\n\n // If not handled, pass to next middleware\n next()\n })\n },\n }\n}\n"],"mappings":";;;;;;AAMA,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;;;;AAiB9D,SAAwB,KAAK,UAA6B,EAAE,EAAU;CACpE,MAAM,EAAE,YAAY,YAAY;CAGhC,MAAM,aAAa,KAAK,KAAK,WAAW,MAAM,SAAS;CACvD,MAAM,UAAU,QAAQ,KAAK;AAE7B,QAAO;EACL,MAAM;EAEN,OAAO,QAAgC;GAErC,MAAM,SAAS,KAAK,QAAQ,SAAS,cAAc;GACnD,MAAM,SAAS,KAAK,QAAQ,SAAS,cAAc;GAEnD,IAAIA,oBAAmC;AACvC,OAAI,GAAG,WAAW,OAAO,CACvB,qBAAoB;YACX,GAAG,WAAW,OAAO,CAC9B,qBAAoB;AAGtB,OAAI,CAAC,kBACH,QAAO;GAGT,MAAM,cAAc,OAAO,OAAO;GAClC,MAAM,YACJ,eAAe,OAAO,gBAAgB,WAClC;IACA,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AE;KACvC,MAAM,kBAAkB,IAAI,IAAI,MAAM,IAAI,CAAC;AAC3C,gBAAW,KAAK,KACd,YACA,OACA,gBAAiB,QAAQ,SAAS,GAAG,CACtC;eACQ,IAAI,KAAK,WAAW,WAAW,EAAE;KAC1C,MAAM,kBAAkB,IAAI,IAAI,MAAM,IAAI,CAAC;AAC3C,gBAAW,KAAK,KACd,YACA,UACA,gBAAiB,QAAQ,YAAY,GAAG,CACzC;eAED,IAAI,QAAQ,OACZ,IAAI,KAAK,WAAW,KAAK,IACzB,IAAI,QAAQ,iBACZ,IAAI,KAAK,WAAW,eAAe,CAEnC,YAAW,KAAK,KAAK,YAAY,aAAa;AAIhD,QAAI,YAAY,GAAG,WAAW,SAAS,EAAE;KAEvC,MAAM,MAAM,KAAK,QAAQ,SAAS,CAAC,aAAa;KAchD,MAAM,cAbuB;MAC3B,SAAS;MACT,QAAQ;MACR,OAAO;MACP,SAAS;MACT,QAAQ;MACR,QAAQ;MACR,SAAS;MACT,QAAQ;MACR,QAAQ;MACR,QAAQ;MACT,CAE6B,QAAQ;AACtC,SAAI,UAAU,gBAAgB,YAAY;AAI1C,KADmB,GAAG,iBAAiB,SAAS,CACrC,KAAK,IAAI;AACpB;;AAIF,UAAM;KACN;;EAEL"}
1
+ {"version":3,"file":"index.mjs","names":["resolvedEntryPath: string | null","filePath: string | null"],"sources":["../src/index.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport type { LibraryFormats, Plugin, UserConfig, ViteDevServer } from 'vite'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\n\ninterface MimeTypes {\n [key: string]: string\n}\n\nexport interface TonaPluginOptions {\n /**\n * Theme name for build output filename\n * @default 'theme'\n */\n themeName?: string\n}\n\n/**\n * Vite plugin for Tona themes - combines dynamic script extension and shared assets serving\n */\nexport default function tona(options: TonaPluginOptions = {}): Plugin {\n const { themeName = 'theme' } = options\n\n // Default path to shared assets\n const assetsPath = path.join(__dirname, '..', 'public')\n const baseDir = process.cwd()\n\n return {\n name: 'vite-plugin-tona',\n\n config(config: UserConfig): UserConfig {\n // Check main.ts first, then main.js\n const tsPath = path.resolve(baseDir, 'src/main.ts')\n const jsPath = path.resolve(baseDir, 'src/main.js')\n\n let resolvedEntryPath: string | null = null\n if (fs.existsSync(tsPath)) {\n resolvedEntryPath = tsPath\n } else if (fs.existsSync(jsPath)) {\n resolvedEntryPath = jsPath\n }\n\n if (!resolvedEntryPath) {\n return config\n }\n\n const existingLib = config.build?.lib\n const libConfig =\n existingLib && typeof existingLib === 'object'\n ? {\n ...existingLib,\n formats: existingLib.formats || (['iife'] as LibraryFormats[]),\n entry: existingLib.entry || resolvedEntryPath,\n name: existingLib.name || themeName,\n fileName: existingLib.fileName || (() => `${themeName}.min.js`),\n cssFileName: existingLib.cssFileName || `${themeName}.min`, // 不能包含 .css 后缀,会自动生成,否则变成 .css.css\n }\n : {\n formats: ['iife'] as LibraryFormats[],\n entry: resolvedEntryPath,\n name: themeName,\n fileName: () => `${themeName}.min.js`,\n cssFileName: `${themeName}.min`, // 不能包含 .css 后缀,会自动生成,否则变成 .css.css\n }\n\n return {\n ...config,\n build: {\n ...config.build,\n cssCodeSplit: config.build?.cssCodeSplit ?? false,\n lib: libConfig,\n },\n }\n },\n\n transformIndexHtml(html) {\n // Check main.ts or main.js exists\n const jsPath = path.resolve(baseDir, 'src/main.js')\n const tsPath = path.resolve(baseDir, 'src/main.ts')\n let scriptSrc = '/src/main.js'\n\n if (fs.existsSync(tsPath)) {\n scriptSrc = '/src/main.ts'\n } else if (fs.existsSync(jsPath)) {\n scriptSrc = '/src/main.js'\n }\n\n // Replace script src in HTML\n return html.replace(\n /<script type=\"module\" src=\"[^\"]*\"><\\/script>/,\n `<script type=\"module\" src=\"${scriptSrc}\"></script>`,\n )\n },\n\n configureServer(server: ViteDevServer) {\n // Serve static files from shared-assets/public directory\n server.middlewares.use((req, res, next) => {\n let filePath: string | null = null\n\n // Check if the request is for a file in /public (which will be served from shared-assets)\n if (req.url?.startsWith('/public/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n urlWithoutQuery!.replace('/public/', ''),\n )\n } else if (req.url?.startsWith('/templates/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'templates',\n urlWithoutQuery!.replace('/templates/', ''),\n )\n } else if (req.url?.startsWith('/js/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'js',\n urlWithoutQuery!.replace('/js/', ''),\n )\n } else if (req.url?.startsWith('/css/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'css',\n urlWithoutQuery!.replace('/css/', ''),\n )\n } else if (req.url?.startsWith('/images/')) {\n const urlWithoutQuery = req.url.split('?')[0]\n filePath = path.join(\n assetsPath,\n 'images',\n urlWithoutQuery!.replace('/images/', ''),\n )\n } else if (\n req.url === '/' ||\n req.url?.startsWith('/?') ||\n req.url === '/index.html' ||\n req.url?.startsWith('/index.html?')\n ) {\n filePath = path.join(assetsPath, 'index.html')\n }\n\n // Check if file exists\n if (filePath && fs.existsSync(filePath)) {\n // Set appropriate content type\n const ext = path.extname(filePath).toLowerCase()\n const mimeTypes: MimeTypes = {\n '.html': 'text/html',\n '.css': 'text/css',\n '.js': 'application/javascript',\n '.json': 'application/json',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n }\n\n const contentType = mimeTypes[ext] || 'application/octet-stream'\n res.setHeader('Content-Type', contentType)\n\n // Read and serve the file\n const fileStream = fs.createReadStream(filePath)\n fileStream.pipe(res)\n return\n }\n\n // If not handled, pass to next middleware\n next()\n })\n },\n }\n}\n"],"mappings":";;;;;;AAMA,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK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iBAAiB,SAAS,CACrC,KAAK,IAAI;AACpB;;AAIF,UAAM;KACN;;EAEL"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tona-vite",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "1.0.1",
5
5
  "description": "Vite plugin for Tona themes - combines dynamic script extension and shared assets serving",
6
6
  "author": {
7
7
  "name": "guangzan",
@@ -51,10 +51,10 @@
51
51
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "^24.10.1",
54
+ "@types/node": "^25.0.3",
55
55
  "tsdown": "latest",
56
- "vite": "^7.2.2",
57
- "vitest": "^3.2.4"
56
+ "vite": "^7.3.1",
57
+ "vitest": "^4.0.16"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "tsdown --watch",
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="zh-cn">
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -135,28 +135,56 @@
135
135
  <div id="navigator">
136
136
  <ul id="navList">
137
137
  <li>
138
- <a id="blog_nav_sitehome" class="menu" href="#">博客园</a>
138
+ <a
139
+ id="blog_nav_sitehome"
140
+ class="menu"
141
+ href="https://www.cnblogs.com/"
142
+ >
143
+ 博客园</a
144
+ >
139
145
  </li>
140
146
  <li>
141
- <a id="blog_nav_myhome" class="menu" href="#">首页</a>
147
+ <a
148
+ id="blog_nav_myhome"
149
+ class="menu"
150
+ href="https://www.cnblogs.com/guangzan/"
151
+ >
152
+ 首页</a
153
+ >
142
154
  </li>
143
155
  <li>
144
- <a id="blog_nav_newpost" class="menu" href="#">新随笔</a>
156
+ <a
157
+ id="blog_nav_newpost"
158
+ class="menu"
159
+ href="https://i.cnblogs.com/EditPosts.aspx?opt=1"
160
+ >
161
+ 新随笔</a
162
+ >
145
163
  </li>
146
164
  <li>
147
- <a id="blog_nav_contact" class="menu" href="#">联系</a>
165
+ <a
166
+ id="blog_nav_contact"
167
+ class="menu"
168
+ href="https://msg.cnblogs.com/send/guangzan"
169
+ >
170
+ 联系</a
171
+ >
148
172
  </li>
149
173
  <li>
150
174
  <a
151
175
  id="blog_nav_rss"
152
176
  class="menu"
153
- href="#"
154
- data-rss="https://www.cnblogs.com/mzq123/rss/"
155
- >订阅</a
177
+ href="javascript:void(0)"
178
+ data-rss="https://www.cnblogs.com/guangzan/rss/"
156
179
  >
180
+ 订阅</a
181
+ >
182
+ <!--<partial name="./Shared/_XmlLink.cshtml" model="Model" /></li>-->
157
183
  </li>
158
184
  <li>
159
- <a id="blog_nav_admin" class="menu" href="#">管理</a>
185
+ <a id="blog_nav_admin" class="menu" href="https://i.cnblogs.com/">
186
+ 管理</a
187
+ >
160
188
  </li>
161
189
  </ul>
162
190
  <div class="blogStats">
@@ -273,7 +301,10 @@
273
301
  <td class="CalNextPrev">
274
302
  <a
275
303
  href="#"
276
- onclick="loadBlogCalendar('2021/04/23'); return false;"
304
+ onclick="
305
+ loadBlogCalendar('2021/04/23')
306
+ return false
307
+ "
277
308
  >&lt;</a
278
309
  >
279
310
  </td>
@@ -281,7 +312,10 @@
281
312
  <td align="right" class="CalNextPrev">
282
313
  <a
283
314
  href="#"
284
- onclick="loadBlogCalendar('2021/06/23'); return false;"
315
+ onclick="
316
+ loadBlogCalendar('2021/06/23')
317
+ return false
318
+ "
285
319
  >&gt;</a
286
320
  >
287
321
  </td>
@@ -424,7 +458,7 @@
424
458
  <input
425
459
  type="text"
426
460
  id="q"
427
- onkeydown="return zzk_go_enter(event);"
461
+ onkeydown="return zzk_go_enter(event)"
428
462
  class="input_my_zzk"
429
463
  />&nbsp;<input
430
464
  onclick="zzk_go()"
@@ -439,7 +473,7 @@
439
473
  type="text"
440
474
  name="google_q"
441
475
  id="google_q"
442
- onkeydown="return google_go_enter(event);"
476
+ onkeydown="return google_go_enter(event)"
443
477
  class="input_my_zzk"
444
478
  />&nbsp;<input
445
479
  onclick="google_go()"
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="zh-cn">
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -136,28 +136,56 @@
136
136
  <div id="navigator">
137
137
  <ul id="navList">
138
138
  <li>
139
- <a id="blog_nav_sitehome" class="menu" href="#">博客园</a>
139
+ <a
140
+ id="blog_nav_sitehome"
141
+ class="menu"
142
+ href="https://www.cnblogs.com/"
143
+ >
144
+ 博客园</a
145
+ >
140
146
  </li>
141
147
  <li>
142
- <a id="blog_nav_myhome" class="menu" href="#">首页</a>
148
+ <a
149
+ id="blog_nav_myhome"
150
+ class="menu"
151
+ href="https://www.cnblogs.com/guangzan/"
152
+ >
153
+ 首页</a
154
+ >
143
155
  </li>
144
156
  <li>
145
- <a id="blog_nav_newpost" class="menu" href="#">新随笔</a>
157
+ <a
158
+ id="blog_nav_newpost"
159
+ class="menu"
160
+ href="https://i.cnblogs.com/EditPosts.aspx?opt=1"
161
+ >
162
+ 新随笔</a
163
+ >
146
164
  </li>
147
165
  <li>
148
- <a id="blog_nav_contact" class="menu" href="#">联系</a>
166
+ <a
167
+ id="blog_nav_contact"
168
+ class="menu"
169
+ href="https://msg.cnblogs.com/send/guangzan"
170
+ >
171
+ 联系</a
172
+ >
149
173
  </li>
150
174
  <li>
151
175
  <a
152
176
  id="blog_nav_rss"
153
177
  class="menu"
154
- href="#"
155
- data-rss="https://www.cnblogs.com/mzq123/rss/"
156
- >订阅</a
178
+ href="javascript:void(0)"
179
+ data-rss="https://www.cnblogs.com/guangzan/rss/"
157
180
  >
181
+ 订阅</a
182
+ >
183
+ <!--<partial name="./Shared/_XmlLink.cshtml" model="Model" /></li>-->
158
184
  </li>
159
185
  <li>
160
- <a id="blog_nav_admin" class="menu" href="#">管理</a>
186
+ <a id="blog_nav_admin" class="menu" href="https://i.cnblogs.com/">
187
+ 管理</a
188
+ >
161
189
  </li>
162
190
  </ul>
163
191
  <div class="blogStats">
@@ -344,7 +372,10 @@
344
372
  <td class="CalNextPrev">
345
373
  <a
346
374
  href="#"
347
- onclick="loadBlogCalendar('2021/04/23'); return false;"
375
+ onclick="
376
+ loadBlogCalendar('2021/04/23')
377
+ return false
378
+ "
348
379
  >&lt;</a
349
380
  >
350
381
  </td>
@@ -352,7 +383,10 @@
352
383
  <td align="right" class="CalNextPrev">
353
384
  <a
354
385
  href="#"
355
- onclick="loadBlogCalendar('2021/06/23'); return false;"
386
+ onclick="
387
+ loadBlogCalendar('2021/06/23')
388
+ return false
389
+ "
356
390
  >&gt;</a
357
391
  >
358
392
  </td>
@@ -495,7 +529,7 @@
495
529
  <input
496
530
  type="text"
497
531
  id="q"
498
- onkeydown="return zzk_go_enter(event);"
532
+ onkeydown="return zzk_go_enter(event)"
499
533
  class="input_my_zzk"
500
534
  />&nbsp;<input
501
535
  onclick="zzk_go()"
@@ -510,7 +544,7 @@
510
544
  type="text"
511
545
  name="google_q"
512
546
  id="google_q"
513
- onkeydown="return google_go_enter(event);"
547
+ onkeydown="return google_go_enter(event)"
514
548
  class="input_my_zzk"
515
549
  />&nbsp;<input
516
550
  onclick="google_go()"
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="zh-cn">
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -136,28 +136,56 @@
136
136
  <div id="navigator">
137
137
  <ul id="navList">
138
138
  <li>
139
- <a id="blog_nav_sitehome" class="menu" href="#">博客园</a>
139
+ <a
140
+ id="blog_nav_sitehome"
141
+ class="menu"
142
+ href="https://www.cnblogs.com/"
143
+ >
144
+ 博客园</a
145
+ >
140
146
  </li>
141
147
  <li>
142
- <a id="blog_nav_myhome" class="menu" href="#">首页</a>
148
+ <a
149
+ id="blog_nav_myhome"
150
+ class="menu"
151
+ href="https://www.cnblogs.com/guangzan/"
152
+ >
153
+ 首页</a
154
+ >
143
155
  </li>
144
156
  <li>
145
- <a id="blog_nav_newpost" class="menu" href="#">新随笔</a>
157
+ <a
158
+ id="blog_nav_newpost"
159
+ class="menu"
160
+ href="https://i.cnblogs.com/EditPosts.aspx?opt=1"
161
+ >
162
+ 新随笔</a
163
+ >
146
164
  </li>
147
165
  <li>
148
- <a id="blog_nav_contact" class="menu" href="#">联系</a>
166
+ <a
167
+ id="blog_nav_contact"
168
+ class="menu"
169
+ href="https://msg.cnblogs.com/send/guangzan"
170
+ >
171
+ 联系</a
172
+ >
149
173
  </li>
150
174
  <li>
151
175
  <a
152
176
  id="blog_nav_rss"
153
177
  class="menu"
154
- href="#"
155
- data-rss="https://www.cnblogs.com/mzq123/rss/"
156
- >订阅</a
178
+ href="javascript:void(0)"
179
+ data-rss="https://www.cnblogs.com/guangzan/rss/"
157
180
  >
181
+ 订阅</a
182
+ >
183
+ <!--<partial name="./Shared/_XmlLink.cshtml" model="Model" /></li>-->
158
184
  </li>
159
185
  <li>
160
- <a id="blog_nav_admin" class="menu" href="#">管理</a>
186
+ <a id="blog_nav_admin" class="menu" href="https://i.cnblogs.com/">
187
+ 管理</a
188
+ >
161
189
  </li>
162
190
  </ul>
163
191
  <div class="blogStats">
@@ -357,7 +385,10 @@
357
385
  <td class="CalNextPrev">
358
386
  <a
359
387
  href="#"
360
- onclick="loadBlogCalendar('2021/04/23'); return false;"
388
+ onclick="
389
+ loadBlogCalendar('2021/04/23')
390
+ return false
391
+ "
361
392
  >&lt;</a
362
393
  >
363
394
  </td>
@@ -365,7 +396,10 @@
365
396
  <td align="right" class="CalNextPrev">
366
397
  <a
367
398
  href="#"
368
- onclick="loadBlogCalendar('2021/06/23'); return false;"
399
+ onclick="
400
+ loadBlogCalendar('2021/06/23')
401
+ return false
402
+ "
369
403
  >&gt;</a
370
404
  >
371
405
  </td>
@@ -508,7 +542,7 @@
508
542
  <input
509
543
  type="text"
510
544
  id="q"
511
- onkeydown="return zzk_go_enter(event);"
545
+ onkeydown="return zzk_go_enter(event)"
512
546
  class="input_my_zzk"
513
547
  />&nbsp;<input
514
548
  onclick="zzk_go()"
@@ -523,7 +557,7 @@
523
557
  type="text"
524
558
  name="google_q"
525
559
  id="google_q"
526
- onkeydown="return google_go_enter(event);"
560
+ onkeydown="return google_go_enter(event)"
527
561
  class="input_my_zzk"
528
562
  />&nbsp;<input
529
563
  onclick="google_go()"
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="zh-cn">
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -135,28 +135,56 @@
135
135
  <div id="navigator">
136
136
  <ul id="navList">
137
137
  <li>
138
- <a id="blog_nav_sitehome" class="menu" href="#">博客园</a>
138
+ <a
139
+ id="blog_nav_sitehome"
140
+ class="menu"
141
+ href="https://www.cnblogs.com/"
142
+ >
143
+ 博客园</a
144
+ >
139
145
  </li>
140
146
  <li>
141
- <a id="blog_nav_myhome" class="menu" href="#">首页</a>
147
+ <a
148
+ id="blog_nav_myhome"
149
+ class="menu"
150
+ href="https://www.cnblogs.com/guangzan/"
151
+ >
152
+ 首页</a
153
+ >
142
154
  </li>
143
155
  <li>
144
- <a id="blog_nav_newpost" class="menu" href="#">新随笔</a>
156
+ <a
157
+ id="blog_nav_newpost"
158
+ class="menu"
159
+ href="https://i.cnblogs.com/EditPosts.aspx?opt=1"
160
+ >
161
+ 新随笔</a
162
+ >
145
163
  </li>
146
164
  <li>
147
- <a id="blog_nav_contact" class="menu" href="#">联系</a>
165
+ <a
166
+ id="blog_nav_contact"
167
+ class="menu"
168
+ href="https://msg.cnblogs.com/send/guangzan"
169
+ >
170
+ 联系</a
171
+ >
148
172
  </li>
149
173
  <li>
150
174
  <a
151
175
  id="blog_nav_rss"
152
176
  class="menu"
153
- href="#"
154
- data-rss="https://www.cnblogs.com/mzq123/rss/"
155
- >订阅</a
177
+ href="javascript:void(0)"
178
+ data-rss="https://www.cnblogs.com/guangzan/rss/"
156
179
  >
180
+ 订阅</a
181
+ >
182
+ <!--<partial name="./Shared/_XmlLink.cshtml" model="Model" /></li>-->
157
183
  </li>
158
184
  <li>
159
- <a id="blog_nav_admin" class="menu" href="#">管理</a>
185
+ <a id="blog_nav_admin" class="menu" href="https://i.cnblogs.com/">
186
+ 管理</a
187
+ >
160
188
  </li>
161
189
  </ul>
162
190
  <div class="blogStats">
@@ -405,7 +433,10 @@
405
433
  <td class="CalNextPrev">
406
434
  <a
407
435
  href="#"
408
- onclick="loadBlogCalendar('2021/04/23'); return false;"
436
+ onclick="
437
+ loadBlogCalendar('2021/04/23')
438
+ return false
439
+ "
409
440
  >&lt;</a
410
441
  >
411
442
  </td>
@@ -413,7 +444,10 @@
413
444
  <td align="right" class="CalNextPrev">
414
445
  <a
415
446
  href="#"
416
- onclick="loadBlogCalendar('2021/06/23'); return false;"
447
+ onclick="
448
+ loadBlogCalendar('2021/06/23')
449
+ return false
450
+ "
417
451
  >&gt;</a
418
452
  >
419
453
  </td>
@@ -556,7 +590,7 @@
556
590
  <input
557
591
  type="text"
558
592
  id="q"
559
- onkeydown="return zzk_go_enter(event);"
593
+ onkeydown="return zzk_go_enter(event)"
560
594
  class="input_my_zzk"
561
595
  />&nbsp;<input
562
596
  onclick="zzk_go()"
@@ -571,7 +605,7 @@
571
605
  type="text"
572
606
  name="google_q"
573
607
  id="google_q"
574
- onkeydown="return google_go_enter(event);"
608
+ onkeydown="return google_go_enter(event)"
575
609
  class="input_my_zzk"
576
610
  />&nbsp;<input
577
611
  onclick="google_go()"