Sha256: 8c6dd6f1b76d384a4775f9bfaac125ae87900251cbcf893224ac767aa91fde0c

Contents?: true

Size: 841 Bytes

Versions: 7

Compression:

Stored size: 841 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    = new TimelineMax();

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

      UtilCopy(url);

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
futuro-0.3.5 assets/js/custom/UtilShare.js
futuro-0.3.4 assets/js/custom/UtilShare.js
futuro-0.3.3 assets/js/custom/UtilShare.js
futuro-0.3.2 assets/js/custom/UtilShare.js
futuro-0.3.1 assets/js/custom/_UtilShare.js
futuro-0.3.0 assets/js/custom/_UtilShare.js
futuro-0.2.9 assets/js/custom/_UtilShare.js