« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/misc-templates.js214
1 files changed, 0 insertions, 214 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index a8a207a3..cf41991d 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -18,79 +18,6 @@ import {
   sortChronologically,
 } from './util/wiki-data.js';
 
-// Chronology links
-
-function unbound_generateChronologyLinks(currentThing, {
-  html,
-  language,
-  link,
-
-  generateNavigationLinks,
-
-  dateKey = 'date',
-  contribKey,
-  getThings,
-  headingString,
-}) {
-  const contributions = currentThing[contribKey];
-
-  if (empty(contributions)) {
-    return html.blank();
-  }
-
-  if (contributions.length > 8) {
-    return html.tag('div', {class: 'chronology'},
-      language.$('misc.chronology.seeArtistPages'));
-  }
-
-  return contributions
-    .map(({who: artist}) => {
-      const thingsUnsorted = unique(getThings(artist))
-        .filter((t) => t[dateKey]);
-
-      // Kinda a hack, but we automatically detect which is (probably) the
-      // right function to use here.
-      const args = [thingsUnsorted, {getDate: (t) => t[dateKey]}];
-      const things = (
-        thingsUnsorted.every(t => t instanceof T.Album || t instanceof T.Track)
-          ? sortAlbumsTracksChronologically(...args)
-          : sortChronologically(...args));
-
-      if (things.length === 0) return '';
-
-      const index = things.indexOf(currentThing);
-
-      if (index === -1) return '';
-
-      const heading = (
-        html.tag('span', {class: 'heading'},
-          language.$(headingString, {
-            index: language.formatIndex(index + 1, {language}),
-            artist: link.artist(artist),
-          })));
-
-      const navigation = things.length > 1 &&
-        html.tag('span',
-          {
-            [html.onlyIfContent]: true,
-            class: 'buttons',
-          },
-          generateNavigationLinks(currentThing, {
-            data: things,
-            isMain: false,
-          }));
-
-      return (
-        html.tag('div', {class: 'chronology'},
-          (navigation
-            ? language.$('misc.chronology.withNavigation', {
-                heading,
-                navigation,
-              })
-            : heading)));
-    });
-}
-
 // Divided track lists
 
 function unbound_generateTrackListDividedByGroups(tracks, {
@@ -329,145 +256,9 @@ function unbound_getCarouselHTML({
               }))))));
 }
 
-// Nav-bar links
-
-function unbound_generateInfoGalleryLinks(currentThing, isGallery, {
-  link,
-  language,
-
-  linkKeyGallery,
-  linkKeyInfo,
-}) {
-  return [
-    link[linkKeyInfo](currentThing, {
-      class: isGallery ? '' : 'current',
-      text: language.$('misc.nav.info'),
-    }),
-    link[linkKeyGallery](currentThing, {
-      class: isGallery ? 'current' : '',
-      text: language.$('misc.nav.gallery'),
-    }),
-  ].join(', ');
-}
-
-// Generate "previous" and "next" links relative to a given current thing and a
-// data set (array of things) which includes it, optionally including additional
-// provided links like "random". This is for use in navigation bars and other
-// inline areas.
-//
-// By default, generated links include ID attributes which enable client-side
-// keyboard shortcuts. Provide isMain: false to disable this (if the generated
-// links aren't the for the page's primary navigation).
-function unbound_generateNavigationLinks(current, {
-  language,
-  link,
-
-  additionalLinks = [],
-  data,
-  isMain = true,
-  linkKey = 'anything',
-  returnAsArray = false,
-}) {
-  let previousLink, nextLink;
-
-  if (current) {
-    const linkFn = link[linkKey].bind(link);
-
-    const index = data.indexOf(current);
-    const previousThing = data[index - 1];
-    const nextThing = data[index + 1];
-
-    previousLink = previousThing &&
-      linkFn(previousThing, {
-        attributes: {
-          id: isMain && 'previous-button',
-          title: previousThing.name,
-        },
-        text: language.$('misc.nav.previous'),
-        color: false,
-      });
-
-    nextLink = nextThing &&
-      linkFn(nextThing, {
-        attributes: {
-          id: isMain && 'next-button',
-          title: nextThing.name,
-        },
-        text: language.$('misc.nav.next'),
-        color: false,
-      });
-  }
-
-  const links = [
-    previousLink,
-    nextLink,
-    ...additionalLinks,
-  ].filter(Boolean);
-
-  if (returnAsArray) {
-    return links;
-  } else if (empty(links)) {
-    return '';
-  } else {
-    return language.formatUnitList(links);
-  }
-}
-
-// Sticky heading, ooooo
-
-function unbound_generateStickyHeadingContainer({
-  html,
-  img,
-
-  class: classes,
-  coverSrc,
-  coverAlt,
-  coverArtTags,
-  title,
-}) {
-  return html.tag('div',
-    {class: [
-      'content-sticky-heading-container',
-      coverSrc && 'has-cover',
-    ].concat(classes)},
-    [
-      html.tag('div', {class: 'content-sticky-heading-row'}, [
-        html.tag('h1', title),
-
-        // Cover art in the sticky heading never uses the 'reveal' setting
-        // because it's too small to effectively display content warnings.
-        // Instead, if art has content warnings, it's hidden from the sticky
-        // heading by default, and will be enabled once the main cover art
-        // is revealed.
-        coverSrc &&
-          html.tag('div', {class: 'content-sticky-heading-cover-container'},
-            html.tag('div',
-              {
-                class: [
-                  'content-sticky-heading-cover',
-                  coverArtTags .some(tag => !tag.isContentWarning) &&
-                    'content-sticky-heading-cover-needs-reveal',
-                ],
-              },
-              img({
-                src: coverSrc,
-                alt: coverAlt,
-                thumb: 'small',
-                link: false,
-                square: true,
-              }))),
-      ]),
-
-      html.tag('div', {class: 'content-sticky-subheading-row'},
-        html.tag('h2', {class: 'content-sticky-subheading'})),
-    ]);
-}
-
 // Exports
 
 export {
-  unbound_generateChronologyLinks as generateChronologyLinks,
-
   unbound_generateTrackListDividedByGroups as generateTrackListDividedByGroups,
 
   unbound_getGridHTML as getGridHTML,
@@ -475,9 +266,4 @@ export {
   unbound_getFlashGridHTML as getFlashGridHTML,
 
   unbound_getCarouselHTML as getCarouselHTML,
-
-  unbound_generateInfoGalleryLinks as generateInfoGalleryLinks,
-  unbound_generateNavigationLinks as generateNavigationLinks,
-
-  unbound_generateStickyHeadingContainer as generateStickyHeadingContainer,
 }