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

weru
29.24.2020 12e3c9ac3a333e2259ab6f75c2946559b61492c3
edit resource
5 files modified
31 ■■■■ changed files
assets/js/functions.js 2 ●●● patch | view | raw | blame | history
assets/js/index.js 20 ●●●●● patch | view | raw | blame | history
assets/js/search.js 3 ●●●●● patch | view | raw | blame | history
assets/sass/_base.sass 2 ●●● patch | view | raw | blame | history
assets/sass/_variables.sass 4 ●●●● patch | view | raw | blame | history
assets/js/functions.js
@@ -2,6 +2,7 @@
const doc = document.documentElement;
const toggleId = 'toggle';
const showId = 'show';
const menu = 'menu';
function isObj(obj) {
  return (obj && typeof obj === 'object' && obj !== null) ? true : false;
@@ -148,7 +149,6 @@
  if(hyperLinks) {
    hyperLinks.forEach(function(link){
      const href = link.href.replaceAll(encodeURI(open), "").replaceAll(encodeURI(close), "");
      console.log(open, close);
      link.href = href;
    });
  }
assets/js/index.js
@@ -8,10 +8,30 @@
  const target = event.target;
  const isToggleControl = target.matches(`.${toggleId}`);
  const isWithToggleControl = target.closest(`.${toggleId}`);
  const showInstances = elems(`.${showId}`) ? Array.from(elems(`.${showId}`)) : [];
  const menuInstance = target.closest(`.${menu}`);
  function showOff(target, self = false) {
    showInstances.forEach(function(showInstance){
      if(!self) {
        deleteClass(showInstance, showId);
      }
      if(showInstance !== target.closest(`.${menu}`)) {
        deleteClass(showInstance, showId);
      }
    });
  }
  if(isToggleControl || isWithToggleControl) {
    const menu = isWithToggleControl ? isWithToggleControl.parentNode.parentNode : target.parentNode.parentNode;
    event.preventDefault();
    modifyClass(menu, showId);
  } else {
    if(!menuInstance) {
      showOff(target);
    } else {
      showOff(target, true);
    }
  }
}
assets/js/search.js
@@ -54,14 +54,12 @@
      const minimumSearchTermLength = isFloat ? 2 : 3;
      if(searchTerm.length >= minimumSearchTermLength) {
        let rawResults = index.search(searchTerm);
        // console.log(rawResults);
        rawResults = rawResults.map(function(result){
          const score = result.score;
          const resultItem = result.item;
          resultItem.score = (parseFloat(score) * 50).toFixed(0);
          return resultItem;
        });
        // console.log(rawResults);
        searchResults(rawResults, searchTerm);
      } else {
        searchResults();
@@ -87,7 +85,6 @@
  main = elem('.main');
}
const searchQuery = findQuery();
// console.log(searchQuery);
wrapText(searchQuery[0],main);
wrapText(searchQuery[1],main);
assets/sass/_base.sass
@@ -135,7 +135,7 @@
    // right: 2.5rem
    // opacity: 0
    padding: 1.5rem 0
    margin: -1.5rem 0
    margin: -1.5rem -0.5rem -1.5rem 0
    display: flex
    justify-content: space-between
    @media screen and (min-width: 42rem)
assets/sass/_variables.sass
@@ -21,8 +21,8 @@
    --accent: var(--bubble)
    --overlay: var(--bubble)
    --border-color: transparent
    // *
      // box-shadow: none !important
    *
      box-shadow: none !important
  &[data-mode="dark"]
    @include darkmode