From 20e080751d8f6ec6b1dcb855b8d732b726c0b8fc Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Fri, 22 Jul 2016 19:43:44 +0200 Subject: [PATCH] Update preview code. --- CHANGELOG.md | 1 + ghu.js | 2 +- src/_h5ai/private/conf/options.json | 2 + src/_h5ai/public/css/lib/ext/preview-txt.less | 28 ++-- src/_h5ai/public/css/lib/ext/preview.less | 2 +- .../public/js/lib/ext/preview/preview-aud.js | 34 ++--- .../public/js/lib/ext/preview/preview-img.js | 29 ++--- .../public/js/lib/ext/preview/preview-txt.js | 42 +++--- .../public/js/lib/ext/preview/preview-vid.js | 32 ++--- .../public/js/lib/ext/preview/preview-x.js | 68 ---------- .../public/js/lib/ext/preview/preview.js | 120 +++++++++++++++--- 11 files changed, 166 insertions(+), 194 deletions(-) delete mode 100644 src/_h5ai/public/js/lib/ext/preview/preview-x.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 16db81b1..edc7e7d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * fixes shell command detection on Windows * fixes `.htaccess` auth issues * adds `rust` type and icon +* adds `autoplay` option to audio and video preview * removes *Install* section from `README.md`, caused to much trouble * updates build process to use `node 6.0+`, no need for babel now * replaces `jquery-qrcode` with `kjua` diff --git a/ghu.js b/ghu.js index 2bb93ba9..6e78c76e 100644 --- a/ghu.js +++ b/ghu.js @@ -68,7 +68,7 @@ ghu.task('build:scripts', runtime => { .then(webpack(webpackCfg([SRC]), {showStats: false})) .then(wrap('\n\n// @include "pre.js"\n\n')) .then(includeit()) - .then(ife(() => runtime.args.production, uglify())) + .then(ife(() => runtime.args.production, uglify({compressor: {warnings: false}}))) .then(wrap(runtime.commentJs)) .then(write(mapper, {overwrite: true})); }); diff --git a/src/_h5ai/private/conf/options.json b/src/_h5ai/private/conf/options.json index fa2d4ced..87dedb5c 100644 --- a/src/_h5ai/private/conf/options.json +++ b/src/_h5ai/private/conf/options.json @@ -220,6 +220,7 @@ */ "preview-aud": { "enabled": true, + "autoplay": true, "types": ["aud"] }, @@ -283,6 +284,7 @@ */ "preview-vid": { "enabled": true, + "autoplay": true, "types": ["vid-avi", "vid-flv", "vid-mkv", "vid-mov", "vid-mp4", "vid-mpg", "vid-webm"] }, diff --git a/src/_h5ai/public/css/lib/ext/preview-txt.less b/src/_h5ai/public/css/lib/ext/preview-txt.less index e005db94..508a6103 100644 --- a/src/_h5ai/public/css/lib/ext/preview-txt.less +++ b/src/_h5ai/public/css/lib/ext/preview-txt.less @@ -1,6 +1,7 @@ #pv-content-txt { .raised; + box-sizing: border-box; max-width: 960px; text-align: left; background: @col-back-paper; @@ -17,20 +18,19 @@ color: #68A9FF; } } +} - &.highlighted { - - code { - line-height: 1.2em; - } - } - - &.markdown { - font-size: 1.1em; - padding: 8px 24px; - - code { - color: #008200; - } +pre#pv-content-txt { + code { + line-height: 1.2em; + } +} + +div#pv-content-txt { + font-size: 1.1em; + padding: 8px 24px; + + code { + color: #008200; } } diff --git a/src/_h5ai/public/css/lib/ext/preview.less b/src/_h5ai/public/css/lib/ext/preview.less index aa4fd1e6..f17b504b 100644 --- a/src/_h5ai/public/css/lib/ext/preview.less +++ b/src/_h5ai/public/css/lib/ext/preview.less @@ -16,7 +16,7 @@ background: @col-grey-900; } -#pv-content { +#pv-container { position: absolute; } diff --git a/src/_h5ai/public/js/lib/ext/preview/preview-aud.js b/src/_h5ai/public/js/lib/ext/preview/preview-aud.js index a91662b6..446ae4c4 100644 --- a/src/_h5ai/public/js/lib/ext/preview/preview-aud.js +++ b/src/_h5ai/public/js/lib/ext/preview/preview-aud.js @@ -1,38 +1,27 @@ -const {each, dom} = require('../../util'); -const event = require('../../core/event'); +const {dom} = require('../../util'); const format = require('../../core/format'); const allsettings = require('../../core/settings'); const preview = require('./preview'); -const previewX = require('./preview-x'); const settings = Object.assign({ enabled: false, + autoplay: true, types: [] }, allsettings['preview-aud']); const tpl = '