lbry-desktop/ui/component/fileThumbnail/FreezeframeLite/utils.js
2020-01-06 16:35:43 -05:00

18 lines
542 B
JavaScript

// Modified from
// https://github.com/ctrl-freaks/freezeframe.js/tree/master/packages/freezeframe/src
export const isTouch = () => {
return 'ontouchstart' in window || 'onmsgesturechange' in window;
};
export const htmlToNode = html => {
const $wrap = window.document.createElement('div');
$wrap.innerHTML = html;
const $content = $wrap.childNodes;
return $content.length > 1 ? $content : $content[0];
};
export const wrapNode = ($el, $wrapper) => {
$el.parentNode.insertBefore($wrapper, $el);
$wrapper.appendChild($el);
};