mirror of https://github.com/onweru/compose.git

weru
07.40.2021 8e6061ff2c8e7aa0f901168ab6b05b12e95246d6
update helpers
5 files modified
24 ■■■■■ changed files
assets/js/code.js 7 ●●●●● patch | view | raw | blame | history
assets/js/index.js 12 ●●●●● patch | view | raw | blame | history
assets/js/variables.js 1 ●●●● patch | view | raw | blame | history
exampleSite/go.mod 2 ●●● patch | view | raw | blame | history
exampleSite/go.sum 2 ●●●●● patch | view | raw | blame | history
assets/js/code.js
@@ -91,7 +91,7 @@
    if(lastLinePos !== 0) {
      maxCodeBlockHeight = `${lastLinePos}px`;
      const codeBlock = lines[0].parentNode;
      const outerBlock = codeBlock.closest('.highlight');
      const outerBlock = codeBlock.closest(`.${highlight}`);
      const isExpanded = containsClass(outerBlock, panelExpanded);
      if(!isExpanded) {
        codeBlock.dataset.height = maxCodeBlockHeight;
@@ -120,7 +120,7 @@
    pushClass(expandDot, panelFrom);
    expandDot.title = "Toggle code block expand";
    expandDot.textContent = "...";
    const outerBlock = block.closest('.highlight');
    const outerBlock = block.closest(`.${highlight}`);
    window.setTimeout(function(){
      const expandIcon = outerBlock.nextElementSibling.lastElementChild;
      deleteClass(expandIcon, panelHide);
@@ -220,8 +220,7 @@
    return target.matches(`.${id}`) || target.closest(`.${id}`);
  }
  function showActive(target, targetClass,activeClass = 'active') {
    const active = activeClass;
  function showActive(target, targetClass) {
    const targetElement = target.matches(`.${targetClass}`) ? target : target.closest(`.${targetClass}`);
    deleteClass(targetElement, active);
assets/js/index.js
@@ -48,19 +48,21 @@
function featureHeading(){
  // show active heading at top.
  const linkClass = "section_link";
  const titleClass = "section_title";
  const parent = elem(".aside");
  let activeHeading = elem(".section_link.active");
  activeHeading = activeHeading ? activeHeading : elem(".section_title.active");
  if(parent) {
    let activeHeading = elem(`.${linkClass}.${active}`);
    activeHeading = activeHeading ? activeHeading : elem(`.${titleClass}.${active}`);
  parent.scroll({
    top: activeHeading.offsetTop,
    left: 0,
    // behavior: 'smooth'
  });
}
}
function activeHeading(position, listLinks) {
  let active = 'active';
  let linksToModify = Object.create(null);
  linksToModify.active = listLinks.filter(function(link) {
    return containsClass(link, active);
@@ -102,7 +104,7 @@
          const tocItems = Array.from(toc.children[0].children);
          const previousHeading = toc.previousElementSibling;
          previousHeading.matches('.active') ? pushClass(toc, tocActive) : false;
          previousHeading.matches(`.${active}`) ? pushClass(toc, tocActive) : false;
          tocItems.forEach(function(item){
            pushClass(item, 'toc_item');
assets/js/variables.js
@@ -3,6 +3,7 @@
const toggleId = 'toggle';
const showId = 'show';
const menu = 'menu';
const active = 'active';
const rootURL = window.location.protocol + "//" + window.location.host;
const searchFieldClass = '.search_field';
const searchClass = '.search';
exampleSite/go.mod
@@ -2,4 +2,4 @@
go 1.15
require github.com/onweru/compose v0.0.0-20210330103531-e7e0ba391d6a // indirect
require github.com/onweru/compose v0.0.0-20210406232155-ff1e43943280 // indirect
exampleSite/go.sum
@@ -154,3 +154,5 @@
github.com/onweru/compose v0.0.0-20210312153401-7f1c7da6d155/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
github.com/onweru/compose v0.0.0-20210330103531-e7e0ba391d6a h1:rpCp0Sg4jjcM1EwdFq3mYoMXz/X3ejm1YXPR8ONetUw=
github.com/onweru/compose v0.0.0-20210330103531-e7e0ba391d6a/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
github.com/onweru/compose v0.0.0-20210406232155-ff1e43943280 h1:CFctzrbQxiwVhPZUjAiwIXYg3RfdeF8koX10fJBoH/Y=
github.com/onweru/compose v0.0.0-20210406232155-ff1e43943280/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=