Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
t-lansing committed Dec 6, 2024
1 parent a046498 commit 09eac4e
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions lib/incito-browser/incito.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,35 +287,24 @@ function renderView(view, canLazyload: boolean, shouldLazyload: boolean) {

const src = String(new URL(view.src));

if (view.autoplay === true) {
attrs['data-autoplay'] = true;
}

if (view.controls === true) {
attrs['controls'] = '';
}

if (view.loop === true) {
attrs['loop'] = '';
}

if (canLazyload && shouldLazyload) {
attrs['data-src'] = `${src}#t=0.1`;
attrs['data-mime'] = view.mime;
classNames.push('incito--lazy');

if (view.autoplay === true) {
attrs['data-autoplay'] = true;
}

if (view.controls === true) {
attrs['controls'] = '';
}

if (view.loop === true) {
attrs['loop'] = '';
}
} else {
attrs.src = `${src}#t=0.1`;
if (view.autoplay === true) {
attrs['data-autoplay'] = true;
}

if (view.controls === true) {
attrs['controls'] = '';
}

if (view.loop === true) {
attrs['loop'] = '';
}
}

break;
Expand Down

0 comments on commit 09eac4e

Please sign in to comment.