Sha256: a215fe5a219f44a7257a9bd9a503d5f78515a7199b4f4a02965c6ad3d7a7a445

Contents?: true

Size: 830 Bytes

Versions: 11

Compression:

Stored size: 830 Bytes

Contents

const UtilCopy = str => {
  const el = document.createElement('textarea');
        el.value = str;
        document.body.appendChild(el);
        el.select();
        document.execCommand('copy');
        document.body.removeChild(el);
}

const UtilShare = e => {
  let ting  = $(e.target).parents('._util-share'),
      type  = $(ting)[0].classList[2].slice(2),
      url   = $(ting).children('._util-url').text().replace('index',''),
      title = $(ting)[0].children[1],
      reset = '',
      tl    = gsap.timeline();

      if (type == 'page') {
        reset = 'Copy page';
      }

      UtilCopy(url);

      tl
      .set(title,{text:'Copied!'})
      .to(title,{duration:0.3,opacity:0},'+=0.6')
      .set(title,{text:reset,clearProps:'all'},'+=0.3')
      ;
}

$(function(){
  $('._util-share').click(UtilShare);
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
futuro-0.4.6 assets/js/footer/custom/UtilShare.js
futuro-0.4.5 assets/js/footer/custom/UtilShare.js
futuro-0.4.4 assets/js/footer/custom/UtilShare.js
futuro-0.4.3 assets/js/footer/custom/UtilShare.js
futuro-0.4.2 assets/js/footer/custom/UtilShare.js
futuro-0.4.1 assets/js/footer/custom/UtilShare.js
futuro-0.4.0 assets/js/footer/custom/UtilShare.js
futuro-0.3.9 assets/js/footer/custom/UtilShare.js
futuro-0.3.8 assets/js/footer/custom/UtilShare.js
futuro-0.3.7 assets/js/footer/custom/UtilShare.js
futuro-0.3.6 assets/js/custom/UtilShare.js