From 81164153bebe252069dc9ec7a22e4d21231b4c7f Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Wed, 22 Feb 2017 02:05:44 +0900
Subject: [PATCH] Fix bugs

---
 src/web/app/common/tags/signup.tag                  |  3 ++-
 src/web/app/desktop/tags/analog-clock.tag           | 12 ++++++------
 src/web/app/desktop/tags/crop-window.tag            |  2 +-
 src/web/app/desktop/tags/drive/browser.tag          |  6 +++---
 src/web/app/desktop/tags/drive/file-contextmenu.tag |  1 -
 src/web/app/desktop/tags/home-widgets/timeline.tag  |  2 +-
 src/web/app/desktop/tags/post-form.tag              |  4 ++--
 src/web/app/desktop/tags/ui-header-clock.tag        |  5 ++++-
 src/web/app/desktop/tags/user-photos.tag            |  2 +-
 src/web/app/mobile/tags/drive.tag                   |  8 ++++----
 src/web/app/mobile/tags/drive/folder.tag            |  2 +-
 src/web/app/mobile/tags/post-form.tag               |  4 ++--
 src/web/app/mobile/tags/timeline-post.tag           |  2 +-
 13 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/src/web/app/common/tags/signup.tag b/src/web/app/common/tags/signup.tag
index dafdf51e1..f0358e232 100644
--- a/src/web/app/common/tags/signup.tag
+++ b/src/web/app/common/tags/signup.tag
@@ -249,6 +249,7 @@
 
 			const strength = this.getPasswordStrength(password);
 			this.passwordStrength = strength > 0.7 ? 'high' : strength > 0.3 ? 'medium' : 'low';
+			this.update();
 			this.refs.passwordMetar.style.width = `${strength * 100}%`;
 		};
 
@@ -256,7 +257,7 @@
 			const password = this.refs.password.value;
 			const retypedPassword = this.refs.passwordRetype.value;
 
-			if (retyped-password == '') {
+			if (retypedPassword == '') {
 				this.passwordRetypeState = null;
 				return;
 			}
diff --git a/src/web/app/desktop/tags/analog-clock.tag b/src/web/app/desktop/tags/analog-clock.tag
index c7f200746..dcf4acaff 100644
--- a/src/web/app/desktop/tags/analog-clock.tag
+++ b/src/web/app/desktop/tags/analog-clock.tag
@@ -43,13 +43,13 @@
 					const uv = new Vec2(Math.sin(angle), -Math.cos(angle));
 					ctx.beginPath();
 					ctx.lineWidth = 1;
-					ctx.moveTo((canv-w / 2) + uv.x * lineStart, (canv-h / 2) + uv.y * lineStart);
+					ctx.moveTo((canvW / 2) + uv.x * lineStart, (canvH / 2) + uv.y * lineStart);
 					if (i % 5 == 0) {
 						ctx.strokeStyle = 'rgba(255, 255, 255, 0.2)';
-						ctx.lineTo((canv-w / 2) + uv.x * longLineEnd, (canv-h / 2) + uv.y * longLineEnd);
+						ctx.lineTo((canvW / 2) + uv.x * longLineEnd, (canvH / 2) + uv.y * longLineEnd);
 					} else {
 						ctx.strokeStyle = 'rgba(255, 255, 255, 0.1)';
-						ctx.lineTo((canv-w / 2) + uv.x * shortLineEnd, (canv-h / 2) + uv.y * shortLineEnd);
+						ctx.lineTo((canvW / 2) + uv.x * shortLineEnd, (canvH / 2) + uv.y * shortLineEnd);
 					}
 					ctx.stroke();
 				}
@@ -58,7 +58,7 @@
 			{ // 分
 				const angle = Math.PI * (m + s / 60) / 30;
 				const length = Math.min(canvW, canvH) / 2.6;
-				const uv = new vec2(Math.sin(angle), -Math.cos(angle));
+				const uv = new Vec2(Math.sin(angle), -Math.cos(angle));
 				ctx.beginPath();
 				ctx.strokeStyle = '#ffffff';
 				ctx.lineWidth = 2;
@@ -70,7 +70,7 @@
 			{ // 時
 				const angle = Math.PI * (h % 12 + m / 60) / 6;
 				const length = Math.min(canvW, canvH) / 4;
-				const uv = new vec2(Math.sin(angle), -Math.cos(angle));
+				const uv = new Vec2(Math.sin(angle), -Math.cos(angle));
 				ctx.beginPath();
 				ctx.strokeStyle = CONFIG.themeColor;
 				ctx.lineWidth = 2;
@@ -82,7 +82,7 @@
 			{ // 秒
 				const angle = Math.PI * s / 30;
 				const length = Math.min(canvW, canvH) / 2.6;
-				const uv = new vec2(Math.sin(angle), -Math.cos(angle));
+				const uv = new Vec2(Math.sin(angle), -Math.cos(angle));
 				ctx.beginPath();
 				ctx.strokeStyle = 'rgba(255, 255, 255, 0.5)';
 				ctx.lineWidth = 1;
diff --git a/src/web/app/desktop/tags/crop-window.tag b/src/web/app/desktop/tags/crop-window.tag
index c5c186555..2cadc2994 100644
--- a/src/web/app/desktop/tags/crop-window.tag
+++ b/src/web/app/desktop/tags/crop-window.tag
@@ -169,7 +169,7 @@
 			this.img = this.refs.window.refs.img;
 			this.cropper = new this.Cropper(this.img, {
 				aspectRatio: this.aspectRatio,
-				highlight: no,
+				highlight: false,
 				viewMode: 1
 			});
 		});
diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag
index 989ec48ae..1e8b17cfc 100644
--- a/src/web/app/desktop/tags/drive/browser.tag
+++ b/src/web/app/desktop/tags/drive/browser.tag
@@ -659,10 +659,10 @@
 			});
 
 			let flag = false;
-			complete = () => {
+			const complete = () => {
 				if (flag) {
-					fetchedFolders.forEach(folder => this.addFolder);
-					fetchedFiles.forEach(file => this.addFile);
+					fetchedFolders.forEach(this.addFolder);
+					fetchedFiles.forEach(this.addFile);
 					this.update({
 						fetching: false
 					});
diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag
index 733ee853f..29f1befc4 100644
--- a/src/web/app/desktop/tags/drive/file-contextmenu.tag
+++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag
@@ -39,7 +39,6 @@
 		this.mixin('i');
 		this.mixin('update-avatar');
 		this.mixin('update-banner');
-		this.mixin('update-wallpaper');
 		this.mixin('input-dialog');
 		this.mixin('NotImplementedException');
 
diff --git a/src/web/app/desktop/tags/home-widgets/timeline.tag b/src/web/app/desktop/tags/home-widgets/timeline.tag
index 138ff5ed1..a0a8790ea 100644
--- a/src/web/app/desktop/tags/home-widgets/timeline.tag
+++ b/src/web/app/desktop/tags/home-widgets/timeline.tag
@@ -62,7 +62,7 @@
 		});
 
 		this.onDocumentKeydown = e => {
-			if (e.target.tagName != 'INPUT' && tag != 'TEXTAREA') {
+			if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
 				if (e.which == 84) { // t
 					this.refs.timeline.focus();
 				}
diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag
index 2e3262fed..3b80eee5d 100644
--- a/src/web/app/desktop/tags/post-form.tag
+++ b/src/web/app/desktop/tags/post-form.tag
@@ -305,7 +305,7 @@
 
 	</style>
 	<script>
-		getCat = require('../../common/scripts/get-cat');
+		const getCat = require('../../common/scripts/get-cat');
 
 		this.mixin('api');
 		this.mixin('notify');
@@ -379,7 +379,7 @@
 		};
 
 		this.onkeydown = e => {
-			if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.meta-key)) this.post();
+			if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.metaKey)) this.post();
 		};
 
 		this.onpaste = e => {
diff --git a/src/web/app/desktop/tags/ui-header-clock.tag b/src/web/app/desktop/tags/ui-header-clock.tag
index ce41083fc..48b142509 100644
--- a/src/web/app/desktop/tags/ui-header-clock.tag
+++ b/src/web/app/desktop/tags/ui-header-clock.tag
@@ -2,6 +2,7 @@
 	<div class="header">
 		<time ref="time">
 			<span class="yyyymmdd">{ yyyy }/{ mm }/{ dd }</span>
+			<br>
 			<span class="hhnn">{ hh }<span style="visibility:{ now.getSeconds() % 2 == 0 ? 'visible' : 'hidden' }">:</span>{ nn }</span>
 		</time>
 	</div>
@@ -61,8 +62,10 @@
 
 	</style>
 	<script>
+		this.now = new Date();
+
 		this.draw = () => {
-			this.now = new Date();
+			const now = this.now = new Date();
 			this.yyyy = now.getFullYear();
 			this.mm = ('0' + (now.getMonth() + 1)).slice(-2);
 			this.dd = ('0' + now.getDate()).slice(-2);
diff --git a/src/web/app/desktop/tags/user-photos.tag b/src/web/app/desktop/tags/user-photos.tag
index a72b1f302..86f12aceb 100644
--- a/src/web/app/desktop/tags/user-photos.tag
+++ b/src/web/app/desktop/tags/user-photos.tag
@@ -81,7 +81,7 @@
 					this.initializing = false;
 					posts.forEach(post => {
 						post.media.forEach(media => {
-							if (this.images.length < 9) this.images.push(image);
+							if (this.images.length < 9) this.images.push(media);
 						});
 					});
 					this.update();
diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag
index 707ec9478..35b9b6541 100644
--- a/src/web/app/mobile/tags/drive.tag
+++ b/src/web/app/mobile/tags/drive.tag
@@ -198,7 +198,7 @@
 		};
 
 		this.move = ev => {
-			this.move(ev.item.folder);
+			this.cd(ev.item.folder);
 		};
 
 		this.cd = (target, silent = false) => {
@@ -333,10 +333,10 @@
 			});
 
 			let flag = false;
-			complete = () => {
+			const complete = () => {
 				if (flag) {
-					fetchedFolders.forEach(folder => this.addFolder);
-					fetchedFiles.forEach(file => this.addFile);
+					fetchedFolders.forEach(this.addFolder);
+					fetchedFiles.forEach(this.addFile);
 					this.update({
 						fetching: false
 					});
diff --git a/src/web/app/mobile/tags/drive/folder.tag b/src/web/app/mobile/tags/drive/folder.tag
index 093e74292..27e86662c 100644
--- a/src/web/app/mobile/tags/drive/folder.tag
+++ b/src/web/app/mobile/tags/drive/folder.tag
@@ -41,7 +41,7 @@
 		this.folder = this.opts.folder;
 
 		this.onclick = () => {
-			this.browser.move(this.folder);
+			this.browser.cd(this.folder);
 		};
 	</script>
 </mk-drive-folder>
diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag
index 397475e3f..353db0154 100644
--- a/src/web/app/mobile/tags/post-form.tag
+++ b/src/web/app/mobile/tags/post-form.tag
@@ -182,7 +182,7 @@
 
 	</style>
 	<script>
-		getCat = require('../../common/scripts/get-cat');
+		const getCat = require('../../common/scripts/get-cat');
 
 		this.mixin('api');
 
@@ -204,7 +204,7 @@
 		});
 
 		this.onkeydown = e => {
-			if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.meta-key)) this.post();
+			if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.metaKey)) this.post();
 		};
 
 		this.onpaste = e => {
diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag
index 0a6db9a92..8662eadb8 100644
--- a/src/web/app/mobile/tags/timeline-post.tag
+++ b/src/web/app/mobile/tags/timeline-post.tag
@@ -298,7 +298,7 @@
 		this.mixin('api');
 		this.mixin('text');
 		this.mixin('get-post-summary');
-		this.mixin('openPostForm');
+		this.mixin('open-post-form');
 
 		this.post = this.opts.post;
 		this.isRepost = this.post.repost != null && this.post.text == null;