From d695dcaff91ce616549dc54c02b8bf9167f2be58 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 9 Apr 2021 19:09:22 +0300 Subject: experimental flash support through ruffle --- src/components/attachment/attachment.vue | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components/attachment/attachment.vue') diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 2c1c1682..2102127d 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -117,6 +117,8 @@ + + -- cgit v1.2.3-70-g09d2 From adafae977a5cc2b5ce1e3ab044bc17c4d4f11a4e Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 12 Apr 2021 00:00:23 +0300 Subject: Play-on-click, layout improvements. --- src/components/attachment/attachment.vue | 1 + src/components/flash/flash.js | 36 +++++++++++++++++--- src/components/flash/flash.vue | 57 +++++++++++++++++++++++++++++--- src/i18n/en.json | 3 +- 4 files changed, 87 insertions(+), 10 deletions(-) (limited to 'src/components/attachment/attachment.vue') diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 2102127d..9bb0d0be 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -174,6 +174,7 @@ } .non-gallery.attachment { + &.flash, &.video { flex: 1 0 40%; } diff --git a/src/components/flash/flash.js b/src/components/flash/flash.js index e707a4c4..832705a2 100644 --- a/src/components/flash/flash.js +++ b/src/components/flash/flash.js @@ -1,16 +1,44 @@ import RuffleService from '../../services/ruffle_service/ruffle_service.js' +import { library } from '@fortawesome/fontawesome-svg-core' +import { faStop } from '@fortawesome/free-solid-svg-icons' + +library.add( + faStop, +) const Flash = { props: [ 'src' ], - created () { - this.$nextTick(function () { + data () { + return { + player: false, // can be true, "hidden", false. hidden = element exists + loaded: false, + ruffleInstance: null + } + }, + methods: { + openPlayer () { + if (this.player) return // prevent double-loading + this.player = 'hidden' RuffleService.getRuffle().then((ruffle) => { const player = ruffle.newest().createPlayer() + player.config = { + letterbox: 'on' + } const container = this.$refs.cunt container.appendChild(player) - player.load(this.src) + player.style.width = '100%' + player.style.height = '100%' + player.load(this.src).then(() => { + this.player = true + }) + this.ruffleInstance = player }) - }) + }, + closePlayer () { + console.log(this.ruffleInstance) + this.ruffleInstance.remove() + this.player = false + } } } diff --git a/src/components/flash/flash.vue b/src/components/flash/flash.vue index 510fe6d2..adef67ff 100644 --- a/src/components/flash/flash.vue +++ b/src/components/flash/flash.vue @@ -1,8 +1,31 @@ @@ -10,6 +33,30 @@ diff --git a/src/i18n/en.json b/src/i18n/en.json index d6138482..90cbbf0f 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -79,7 +79,8 @@ "role": { "admin": "Admin", "moderator": "Moderator" - } + }, + "flash_content": "Click to show Flash content using Ruffle (Experimental)" }, "image_cropper": { "crop_picture": "Crop picture", -- cgit v1.2.3-70-g09d2 From f0641d05dffe627abd093c296a8cf9e5296b3098 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 12 Apr 2021 00:07:28 +0300 Subject: linting --- src/components/attachment/attachment.vue | 5 ++++- src/components/flash/flash.js | 2 +- src/components/flash/flash.vue | 16 +++++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/components/attachment/attachment.vue') diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 9bb0d0be..f80badfd 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -118,7 +118,10 @@ - + diff --git a/src/components/flash/flash.js b/src/components/flash/flash.js index 832705a2..17a52747 100644 --- a/src/components/flash/flash.js +++ b/src/components/flash/flash.js @@ -3,7 +3,7 @@ import { library } from '@fortawesome/fontawesome-svg-core' import { faStop } from '@fortawesome/free-solid-svg-icons' library.add( - faStop, + faStop ) const Flash = { diff --git a/src/components/flash/flash.vue b/src/components/flash/flash.vue index adef67ff..a27d3930 100644 --- a/src/components/flash/flash.vue +++ b/src/components/flash/flash.vue @@ -8,13 +8,19 @@ /> @@ -24,8 +30,8 @@ @click="closePlayer" > - - + + -- cgit v1.2.3-70-g09d2