summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-12-08 21:12:49 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-12-08 21:12:49 +0900
commitc88097298f204bcd3f181e84e0028b2ec0a39814 (patch)
treeac1e0af503046706fd863693c63e49f16d288e6f /src/web
parentRefactor (diff)
downloadmisskey-c88097298f204bcd3f181e84e0028b2ec0a39814.tar.gz
misskey-c88097298f204bcd3f181e84e0028b2ec0a39814.tar.bz2
misskey-c88097298f204bcd3f181e84e0028b2ec0a39814.zip
Display Exif
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/base.pug3
-rw-r--r--src/web/app/mobile/tags/drive/file-viewer.tag54
-rw-r--r--src/web/assets/code-highlight.css93
3 files changed, 149 insertions, 1 deletions
diff --git a/src/web/app/base.pug b/src/web/app/base.pug
index 140286a768..d7c7f0aed4 100644
--- a/src/web/app/base.pug
+++ b/src/web/app/base.pug
@@ -24,6 +24,9 @@ html
//- FontAwesome style
style #{facss}
+ //- highlight.js style
+ style #{hljscss}
+
body
noscript: p
| JavaScriptを有効にしてください
diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag
index da895359dc..48fc83fa67 100644
--- a/src/web/app/mobile/tags/drive/file-viewer.tag
+++ b/src/web/app/mobile/tags/drive/file-viewer.tag
@@ -1,6 +1,6 @@
<mk-drive-file-viewer>
<div class="preview">
- <img if={ kind == 'image' } src={ file.url } alt={ file.name } title={ file.name }>
+ <img if={ kind == 'image' } src={ file.url } alt={ file.name } title={ file.name } onload={ onImageLoaded } ref="img">
<virtual if={ kind != 'image' }>%fa:file%</virtual>
<footer if={ kind == 'image' && file.properties && file.properties.width && file.properties.height }>
<span class="size">
@@ -39,6 +39,14 @@
</button>
</div>
</div>
+ <div class="exif" show={ exif }>
+ <div>
+ <p>
+ %fa:camera%%i18n:mobile.tags.mk-drive-file-viewer.exif%
+ </p>
+ <pre ref="exif" class="json">{ exif ? JSON.stringify(exif, null, 2) : '' }</pre>
+ </div>
+ </div>
<div class="hash">
<div>
<p>
@@ -178,12 +186,45 @@
white-space nowrap
overflow auto
font-size 0.8em
+ color #222
+ border solid 1px #dfdfdf
+ border-radius 2px
+ background #f5f5f5
+
+ > .exif
+ padding 14px
+ border-top solid 1px #dfdfdf
+
+ > div
+ max-width 500px
+ margin 0 auto
+
+ > p
+ display block
+ margin 0
+ padding 0
+ color #555
+ font-size 0.9em
+
+ > [data-fa]
+ margin-right 4px
+
+ > pre
+ display block
+ width 100%
+ margin 6px 0 0 0
+ padding 8px
+ height 128px
+ overflow auto
+ font-size 0.9em
border solid 1px #dfdfdf
border-radius 2px
background #f5f5f5
</style>
<script>
+ import EXIF from 'exif-js';
+ import hljs from 'highlight.js';
import bytesToSize from '../../../common/scripts/bytes-to-size';
import gcd from '../../../common/scripts/gcd';
@@ -195,6 +236,17 @@
this.file = this.opts.file;
this.kind = this.file.type.split('/')[0];
+ this.onImageLoaded = () => {
+ const self = this;
+ EXIF.getData(this.refs.img, function() {
+ const allMetaData = EXIF.getAllTags(this);
+ self.update({
+ exif: allMetaData
+ });
+ hljs.highlightBlock(self.refs.exif);
+ });
+ };
+
this.rename = () => {
const name = window.prompt('名前を変更', this.file.name);
if (name == null || name == '' || name == this.file.name) return;
diff --git a/src/web/assets/code-highlight.css b/src/web/assets/code-highlight.css
new file mode 100644
index 0000000000..f0807dc9c3
--- /dev/null
+++ b/src/web/assets/code-highlight.css
@@ -0,0 +1,93 @@
+.hljs {
+ font-family: Consolas, 'Courier New', Courier, Monaco, monospace;
+}
+
+.hljs,
+.hljs-subst {
+ color: #444;
+}
+
+.hljs-comment {
+ color: #888888;
+}
+
+.hljs-keyword {
+ color: #2973b7;
+}
+
+.hljs-number {
+ color: #ae81ff;
+}
+
+.hljs-string {
+ color: #e96900;
+}
+
+.hljs-regexp {
+ color: #e9003f;
+}
+
+.hljs-attribute,
+.hljs-selector-tag,
+.hljs-meta-keyword,
+.hljs-doctag,
+.hljs-name {
+ font-weight: bold;
+}
+
+.hljs-type,
+.hljs-selector-id,
+.hljs-selector-class,
+.hljs-quote,
+.hljs-template-tag,
+.hljs-deletion {
+ color: #880000;
+}
+
+.hljs-title,
+.hljs-section {
+ color: #880000;
+ font-weight: bold;
+}
+
+.hljs-symbol,
+.hljs-variable,
+.hljs-template-variable,
+.hljs-link,
+.hljs-selector-attr,
+.hljs-selector-pseudo {
+ color: #BC6060;
+}
+
+/* Language color: hue: 90; */
+
+.hljs-literal {
+ color: #78A960;
+}
+
+.hljs-built_in,
+.hljs-bullet,
+.hljs-code,
+.hljs-addition {
+ color: #397300;
+}
+
+/* Meta color: hue: 200 */
+
+.hljs-meta {
+ color: #1f7199;
+}
+
+.hljs-meta-string {
+ color: #4d99bf;
+}
+
+/* Misc effects */
+
+.hljs-emphasis {
+ font-style: italic;
+}
+
+.hljs-strong {
+ font-weight: bold;
+}