« get me outta code hell

Merge branch 'staging' into preview - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-01-15 20:37:01 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-01-15 20:37:01 -0400
commit3daff0953b88de9ae0fffa1b928c4945e8902a09 (patch)
tree8b9aea91cb06c49d323241b6357a6235d1e332ed /src
parent088a0d4ef42c90d6e81586601ee6cb37340b5bf4 (diff)
parenta526ae6ac12e912374ff812c0ab89c70c7943df7 (diff)
Merge branch 'staging' into preview
Diffstat (limited to 'src')
-rw-r--r--src/listing-spec.js9
-rw-r--r--src/static/lazy-loading.js2
-rw-r--r--src/util/transform-content.js10
3 files changed, 15 insertions, 6 deletions
diff --git a/src/listing-spec.js b/src/listing-spec.js
index 1538757c..ef51fe90 100644
--- a/src/listing-spec.js
+++ b/src/listing-spec.js
@@ -617,9 +617,12 @@ const listingSpec = [
     directory: 'tracks/by-date',
     stringsKey: 'listTracks.byDate',
 
-    data: ({wikiData: {trackData}}) =>
+    data: ({wikiData: {albumData}}) =>
       chunkByProperties(
-        sortChronologically(trackData.filter(t => t.date)),
+        sortByDate(
+          sortChronologically(albumData)
+            .flatMap(album => album.tracks)
+            .filter(track => track.date)),
         ['album', 'date']),
 
     html: (data, {html, language, link}) =>
@@ -634,7 +637,7 @@ const listingSpec = [
           html.tag('dd',
             html.tag('ul',
               tracks.map(track =>
-                track.aka
+                track.originalReleaseTrack
                   ? html.tag('li',
                       {class: 'rerelease'},
                       language.$('listingPage.listTracks.byDate.track.rerelease', {
diff --git a/src/static/lazy-loading.js b/src/static/lazy-loading.js
index b04ad7c2..1df56f08 100644
--- a/src/static/lazy-loading.js
+++ b/src/static/lazy-loading.js
@@ -37,7 +37,7 @@ function lazyLoadMain() {
   if (window.IntersectionObserver) {
     observer = new IntersectionObserver(lazyLoad, {
       rootMargin: '200px',
-      threshold: 1.0,
+      threshold: 0,
     });
     for (i = 0; i < lazyElements.length; i++) {
       observer.observe(lazyElements[i]);
diff --git a/src/util/transform-content.js b/src/util/transform-content.js
index 2a7d859b..d1d0f51a 100644
--- a/src/util/transform-content.js
+++ b/src/util/transform-content.js
@@ -377,8 +377,14 @@ function unbound_transformMultiline(text, {
       }
 
       // for sticky headings!
-      if (elementMatch) {
-        lineContent = lineContent.replace(/<h2/, `<h2 class="content-heading"`)
+      if (elementMatch && elementMatch[1] === 'h2') {
+        lineContent = lineContent.replace(/<h2(.*?)>/g, (match, attributes) => {
+          const parsedAttributes = parseAttributes(attributes, {to});
+          return `<h2 ${html.attributes({
+            ...parsedAttributes,
+            class: [...parsedAttributes.class?.split(' ') ?? [], 'content-heading'],
+          })}>`;
+        });
       }
     }