diff --git a/client/html/post_upload_row.tpl b/client/html/post_upload_row.tpl index 25ff3aed..d91f274f 100644 --- a/client/html/post_upload_row.tpl +++ b/client/html/post_upload_row.tpl @@ -60,7 +60,7 @@ <%= ctx.makeCheckbox({ text: 'Loop video', name: 'loop-video', - checked: true, + checked: ctx.uploadable.flags.includes('loop'), }) %> <% } %> diff --git a/client/js/views/post_upload_view.js b/client/js/views/post_upload_view.js index b2603813..51a035c2 100644 --- a/client/js/views/post_upload_view.js +++ b/client/js/views/post_upload_view.js @@ -30,7 +30,7 @@ class Uploadable extends events.EventTarget { constructor() { super(); this.safety = 'safe'; - this.flags = ['loop']; + this.flags = []; this.anonymous = false; this.order = globalOrder; globalOrder++; @@ -54,6 +54,12 @@ class Uploadable extends events.EventTarget { get name() { throw new Error('Not implemented'); } + + _initComplete() { + if (['video'].includes(this.type)) { + this.flags.push('loop'); + } + } } class File extends Uploadable { @@ -73,6 +79,7 @@ class File extends Uploadable { new CustomEvent('finish', {detail: {uploadable: this}})); }); } + this._initComplete(); } destroy() { @@ -103,6 +110,7 @@ class Url extends Uploadable { super(); this.url = url; this.dispatchEvent(new CustomEvent('finish')); + this._initComplete(); } get mimeType() {