diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index ef559083..8193ea17 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -1398,7 +1398,7 @@ function client(name) { } //Poll Parser function pollParse(poll, acct_id, emojis) { - var rand = uuid() + var rand = makeCID() var datetype = localStorage.getItem('datetype') var anime = localStorage.getItem('animation') if (anime == 'yes' || !anime) { diff --git a/app/js/ui/img.js b/app/js/ui/img.js index 0d557f6c..2ca8ea16 100644 --- a/app/js/ui/img.js +++ b/app/js/ui/img.js @@ -22,20 +22,40 @@ function imgv(id, key, acct_id) { murl = ourl } $(document).ready(function () { - if (type == 'image') { - $('#imagemodal').modal('open') - imageXhr(id, key, murl) - $('#imagewrap').dragScroll() // ドラッグスクロール設定 - $('#imgmodal').show() - $('#imagemodal').attr('data-key', key) - $('#imagemodal').attr('data-id', id) - } else if (type == 'video' || type == 'gifv') { - $('#video').attr('src', murl) - $('#videomodal').modal('open') - $('#imgmodal').show() + if (type == 'image') {display_image(murl,id,key)} + else if (type == 'video') {display_video(murl)} + else if (type == 'gifv') + { + if (remote_img == 'no') {display_video(murl)} + else + { + // Need to detect if it's a video or a gif, depends if it came from pleroma or mastodon + // Using extension is a bad idea but w/e + // Actually if it's from mastodon the extension will be mp4. + if (murl.endsWith('.mp4')) {display_video(murl)} + else {display_image(murl,id,key)} + } } }) } + +function display_image(murl,id,key) +{ + $('#imagemodal').modal('open') + imageXhr(id, key, murl) + $('#imagewrap').dragScroll() // ドラッグスクロール設定 + $('#imgmodal').show() + $('#imagemodal').attr('data-key', key) + $('#imagemodal').attr('data-id', id) +} + +function display_video(murl,id=null,key=null) +{ + $('#video').attr('src', murl) + $('#videomodal').modal('open') + $('#imgmodal').show() +} + //イメージビューワーの送り function imgCont(type) { var key = $('#imagemodal').attr('data-key')