diff --git a/frontend/templates/comments.ejs b/frontend/templates/comments.ejs index cfdbd8d3..fe67bb98 100644 --- a/frontend/templates/comments.ejs +++ b/frontend/templates/comments.ejs @@ -49,15 +49,15 @@ - \ No newline at end of file + diff --git a/frontend/templates/counter.ejs b/frontend/templates/counter.ejs index 8dde4d64..b0999d47 100644 --- a/frontend/templates/counter.ejs +++ b/frontend/templates/counter.ejs @@ -38,25 +38,19 @@ site_id: 'remark', host: '<%= htmlWebpackPlugin.options.REMARK_URL %>', url: 'https://remark42.com/demo/', - components: ['counter'] + components: ['counter'], }; (function (c, d) { + var r = d.head || d.body; for (var i = 0; i < c.length; i++) { var s = d.createElement('script'); - var e = '.js'; - var r = d.head || d.body; - - if ('noModule' in s) { - s.type = 'module'; - e = '.mjs'; - } else { - s.async = true; - } - + var m = 'noModule' in s; + var e = m ? '.mjs' : '.js'; + m && (s.type = 'module'); + s.async = true; s.defer = true; s.src = remark_config.host + '/web/' + c[i] + e; - r.appendChild(s); } })(remark_config.components || ['embed'], document); diff --git a/frontend/templates/demo.ejs b/frontend/templates/demo.ejs index 2b970ce3..fd1b6539 100644 --- a/frontend/templates/demo.ejs +++ b/frontend/templates/demo.ejs @@ -135,20 +135,15 @@ }; (function (c, d) { + var r = d.head || d.body; for (var i = 0; i < c.length; i++) { var s = d.createElement('script'); - var e = '.js'; - var r = d.head || d.body; - - if ('noModule' in s) { - s.type = 'module'; - e = '.mjs'; - } - + var m = 'noModule' in s; + var e = m ? '.mjs' : '.js'; + m && (s.type = 'module'); s.async = true; s.defer = true; s.src = remark_config.host + '/web/' + c[i] + e; - r.appendChild(s); } })(remark_config.components || ['embed'], document); diff --git a/frontend/templates/iframe.ejs b/frontend/templates/iframe.ejs index 5a9c3de8..13dc9a82 100644 --- a/frontend/templates/iframe.ejs +++ b/frontend/templates/iframe.ejs @@ -174,10 +174,11 @@