From 546ea4aada96647c0ae977291135b424644f6f50 Mon Sep 17 00:00:00 2001 From: Alexander Heimbuch Date: Sat, 15 Apr 2017 15:37:27 +0200 Subject: [PATCH] =?UTF-8?q?fix(publisher-integration):=20Several=20adaptio?= =?UTF-8?q?ns=20for=20web=20player=20integration=20-=20Share=20button=20on?= =?UTF-8?q?ly=20visible=20if=20needed=20reference=20available=20-=20Player?= =?UTF-8?q?=20version=20now=20visible=20and=20included=20in=20debug=20stat?= =?UTF-8?q?e=20-=20Fallback=20for=20missing=20chapters=20-=20Don=E2=80=99t?= =?UTF-8?q?=20display=20image=20if=20no=20poster=20is=20provided?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/app.js | 4 ++++ src/components/info/Info.vue | 2 +- src/components/player/Player.vue | 5 +++-- src/components/tabs/settings/Settings.vue | 21 ++++++++++++++++++--- src/embed/embed.js | 3 +-- src/store/reducers/chapters.js | 2 +- src/store/reducers/init.js | 12 +++++++++++- src/utils/debug.js | 7 +++++++ 9 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 src/utils/debug.js diff --git a/package.json b/package.json index caa67afcc..bc54f0912 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "title": "PodloveWebPlayer", "description": "a Podcast-optimized, HTML5-based video and audio player with Flash fallback. It can be used as a WordPress plugin or within a static HTML/JavaScript context.", "license": "BSD-2-Clause", - "version": "4.0.0-proto", + "version": "4.0.0-alpha", "homepage": "https://github.com/podlove/podlove-web-player", "contributors": [], "repository": "https://github.com/podlove/podlove-web-player.git", diff --git a/src/app.js b/src/app.js index 54e46399a..2615b8c05 100644 --- a/src/app.js +++ b/src/app.js @@ -1,6 +1,7 @@ import Vue from 'vue' import head from 'lodash/head' +import debug from 'utils/debug' import registerDirectives from './directives' registerDirectives(Vue) @@ -12,6 +13,9 @@ import store from 'store' import App from './components/App.vue' export default config => { + // Enhance config with app debug information + config = Object.assign({}, config, { debug }) + // Initialize meta for store store.dispatch(store.actions.init(config)) diff --git a/src/components/info/Info.vue b/src/components/info/Info.vue index d3dd9b9e3..3cfc69ef2 100644 --- a/src/components/info/Info.vue +++ b/src/components/info/Info.vue @@ -3,7 +3,7 @@
- +
diff --git a/src/components/player/Player.vue b/src/components/player/Player.vue index 83503e341..4546cf8c1 100644 --- a/src/components/player/Player.vue +++ b/src/components/player/Player.vue @@ -3,7 +3,7 @@
- +
@@ -20,7 +20,8 @@ export default { data() { return { - playstate: this.$select('playstate') + playstate: this.$select('playstate'), + reference: this.$select('reference') } }, components: { diff --git a/src/components/tabs/settings/Settings.vue b/src/components/tabs/settings/Settings.vue index 19f4620c9..471850bfb 100644 --- a/src/components/tabs/settings/Settings.vue +++ b/src/components/tabs/settings/Settings.vue @@ -1,6 +1,8 @@ @@ -12,6 +14,11 @@ } export default { + data() { + return { + version: this.$select('debug.version') + } + }, methods: { exportStore } @@ -23,7 +30,15 @@ .podlove-settings { width: 100%; - padding: $padding 0; - text-align: center; + padding: $padding; + } + + .podlove-settings__footer { + text-align: right; + } + + .podlove-settings__version { + font-size: 0.8rem; + color: #444; } diff --git a/src/embed/embed.js b/src/embed/embed.js index 6c09f8846..3d76ec698 100644 --- a/src/embed/embed.js +++ b/src/embed/embed.js @@ -85,7 +85,7 @@ const configNode = (config = {}) => Bluebird.resolve(config) // If the config is a string, lets assume that this will point to the remote config json .then(config => isString(config) ? requestConfig(config) : config) - // load parameters from url + // Load parameters from url .then(config => Object.assign({}, config, urlConfig)) // Finally return the node .then(config => tag('script', `window.PODLOVE = ${JSON.stringify(config)}`)) @@ -102,7 +102,6 @@ const playerEntry = tag('PodlovePlayer') // Bootstrap window.podlovePlayer = (selector, config) => { const anchor = typeof selector === 'string' ? head(findNode(selector)) : selector - return Bluebird.all([ playerEntry, configNode(config), diff --git a/src/store/reducers/chapters.js b/src/store/reducers/chapters.js index cf4da78b1..63b263279 100644 --- a/src/store/reducers/chapters.js +++ b/src/store/reducers/chapters.js @@ -27,7 +27,7 @@ const setActive = playtime => chapter => { const chapters = (state = [], action) => { switch (action.type) { case 'INIT': - const chapters = get(action.payload, 'chapters', []) + const chapters = get(action.payload, 'chapters') || [] return chapters .reduce(parseChapters(action.payload.duration), []) diff --git a/src/store/reducers/init.js b/src/store/reducers/init.js index c96bb0c21..a371d66f5 100644 --- a/src/store/reducers/init.js +++ b/src/store/reducers/init.js @@ -48,10 +48,20 @@ const reference = (state = {}, action) => { } } +const debug = (state = {}, action) => { + switch (action.type) { + case 'INIT': + return get(action.payload, 'debug', state) + default: + return state + } +} + export { poster, subtitle, title, reference, - mode + mode, + debug } diff --git a/src/utils/debug.js b/src/utils/debug.js new file mode 100644 index 000000000..295e8b696 --- /dev/null +++ b/src/utils/debug.js @@ -0,0 +1,7 @@ +import { version } from '../../package.json' +import browser from 'detect-browser' + +export default ({ + version, + browser: `${browser.name}:${browser.version}` +}) \ No newline at end of file