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

weru
29.34.2020 9aabca6935631692710fa026fd32a2732501d2d2
assets/js/index.js
@@ -259,23 +259,24 @@
  (function markExternalLinks(){
    let links = elems('a');
    const contentWrapperClass = '.content';
    if(links) {
      Array.from(links).forEach(function(link, index){
        let target, rel, blank, noopener, attr1, attr2, url, isExternal;
        url = elemAttribute(link, 'href');
        isExternal = (url && typeof url == 'string' && url.startsWith('http')) && !url.startsWith(parentURL) ? true : false;
        index === 1 ?console.log(parentURL) : false;
        // if(isExternal) {
        //   target = 'target';
        //   rel = 'rel';
        //   blank = '_blank';
        //   noopener = 'noopener';
        //   attr1 = elemAttribute(link, target);
        //   attr2 = elemAttribute(link, noopener);
        isExternal = (url && typeof url == 'string' && url.startsWith('http')) && !url.startsWith(parentURL) && link.closest(contentWrapperClass);
        index === 1 ? console.log(parentURL) : false;
        if(isExternal) {
          target = 'target';
          rel = 'rel';
          blank = '_blank';
          noopener = 'noopener';
          attr1 = elemAttribute(link, target);
          attr2 = elemAttribute(link, noopener);
        //   attr1 ? false : elemAttribute(link, target, blank);
        //   attr2 ? false : elemAttribute(link, rel, noopener);
        // }
          attr1 ? false : elemAttribute(link, target, blank);
          attr2 ? false : elemAttribute(link, rel, noopener);
        }
      });
    }
  })();