hexo-theme-linen 1.0.39 → 1.0.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-linen",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "A clean Hexo theme",
5
5
  "main": "index.js",
6
6
  "homepage": "https://github.com/lynanbreeze/hexo-theme-linen",
@@ -86,13 +86,23 @@ hexo.extend.helper.register("getTranslationPage", function () {
86
86
  : false;
87
87
  let origin =
88
88
  config?.theme_config?.siteOriginLocaleMap?.[targetLanguage] || config.url;
89
- let targetLanguagePath = `${origin}${this.url_for(page.path)}`;
89
+ // `url_for` includes the current site's `root` (for example, the GitHub
90
+ // Pages repository path). The locale origin may already include its own
91
+ // root, so only append the page path portion to avoid duplicating it.
92
+ const rootPath = String(config.root || "/").replace(/^\/+|\/+$/g, "");
93
+ const siteRoot = rootPath ? `/${rootPath}/` : "/";
94
+ let pagePath = this.url_for(page.path);
95
+ if (siteRoot !== "/" && pagePath.startsWith(siteRoot)) {
96
+ pagePath = pagePath.slice(siteRoot.length - 1);
97
+ }
98
+ const originBase = String(origin || "").replace(/\/+$/, "");
99
+ let targetLanguagePath = `${originBase}/${String(pagePath).replace(/^\/+/, "")}`;
90
100
  if (page?.seriesInfo?.mappingName) {
91
- targetLanguagePath = `${origin}/series/${page?.seriesInfo?.mappingName}/`;
101
+ targetLanguagePath = `${originBase}/series/${page?.seriesInfo?.mappingName}/`;
92
102
  }
93
103
  if (this.is_category()) {
94
104
  if (categoriesInfo?.[page.category]?.mappingName) {
95
- targetLanguagePath = `${origin}/categories/${
105
+ targetLanguagePath = `${originBase}/categories/${
96
106
  categoriesInfo?.[page.category]?.mappingName
97
107
  }/`;
98
108
  } else {
@@ -101,7 +111,7 @@ hexo.extend.helper.register("getTranslationPage", function () {
101
111
  }
102
112
  if (this.is_tag()) {
103
113
  if (tagsInfo?.[page.tag]?.mappingName) {
104
- targetLanguagePath = `${origin}/tags/${tagsInfo?.[page.tag]?.mappingName}/`;
114
+ targetLanguagePath = `${originBase}/tags/${tagsInfo?.[page.tag]?.mappingName}/`;
105
115
  } else {
106
116
  hasTranslatation = false;
107
117
  }
@@ -1113,6 +1113,7 @@ body {
1113
1113
  display: none;
1114
1114
  }
1115
1115
  figure.highlight {
1116
+ margin-bottom: 0;
1116
1117
  pre {
1117
1118
  white-space: pre-wrap;
1118
1119
  word-wrap: break-word;
@@ -3066,6 +3066,7 @@ class CSSAnimation {
3066
3066
  easing = DEFAULT_EASING
3067
3067
  } = props;
3068
3068
  this.onFinish = onFinish;
3069
+ this._duration = duration;
3069
3070
 
3070
3071
  // support only transform and opacity
3071
3072
  const prop = transform ? "transform" : "opacity";
@@ -3113,6 +3114,11 @@ class CSSAnimation {
3113
3114
  */
3114
3115
  _onTransitionEnd(e) {
3115
3116
  if (e.target === this._target) {
3117
+ // Chrome can dispatch a premature transitionend with elapsedTime 0
3118
+ // after scrolling. Do not tear down a transition that has not run yet.
3119
+ if (e.type === "transitionend" && e.elapsedTime === 0 && this._duration > 0) {
3120
+ return;
3121
+ }
3116
3122
  this._finalizeAnimation();
3117
3123
  }
3118
3124
  }