(function () {
  window.easyUtils = window.easyUtils || {};
  window.easyUtils.clipboard = {
    copy: function(text) {
      function selectElementText(element) {
        if (document.selection) {
          var range = document.body.createTextRange();
          range.moveToElementText(element);
          range.select();
        } else if (window.getSelection) {
          var range = document.createRange();
          range.selectNode(element);
          window.getSelection().removeAllRanges();
          window.getSelection().addRange(range);
        }
      }
      var element = document.createElement('DIV');
      element.textContent = text;
      document.body.appendChild(element);
      selectElementText(element);
      document.execCommand('copy');
      element.remove();
    }
  };}
)();
