wip
This commit is contained in:
		
							parent
							
								
									f37fb38640
								
							
						
					
					
						commit
						3c4719a0b1
					
				|  | @ -11,7 +11,7 @@ | |||
| 		</div> | ||||
| 		<hr> | ||||
| 		<footer> | ||||
| 			<small>Misskey ver { version } (葵 aoi)</small> | ||||
| 			<small><a href={ CONFIG.url }>Misskey</a> ver { version } (葵 aoi)</small> | ||||
| 		</footer> | ||||
| 	</main> | ||||
| 	<style> | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ let page = null; | |||
| 
 | ||||
| export default me => { | ||||
| 	route('/',                           index); | ||||
| 	route('/selectdrive',                selectDrive); | ||||
| 	route('/i/notifications',            notifications); | ||||
| 	route('/i/messaging',                messaging); | ||||
| 	route('/i/messaging/:username',      messaging); | ||||
|  | @ -122,6 +123,10 @@ export default me => { | |||
| 		mount(el); | ||||
| 	} | ||||
| 
 | ||||
| 	function selectDrive() { | ||||
| 		mount(document.createElement('mk-selectdrive-page')); | ||||
| 	} | ||||
| 
 | ||||
| 	function notFound() { | ||||
| 		mount(document.createElement('mk-not-found')); | ||||
| 	} | ||||
|  |  | |||
|  | @ -483,7 +483,7 @@ | |||
| 			if (fn == null || fn == '') return; | ||||
| 			switch (fn) { | ||||
| 				case '1': | ||||
| 					this.refs.file.click(); | ||||
| 					this.selectLocalFile(); | ||||
| 					break; | ||||
| 				case '2': | ||||
| 					this.urlUpload(); | ||||
|  | @ -503,6 +503,10 @@ | |||
| 			} | ||||
| 		}; | ||||
| 
 | ||||
| 		this.selectLocalFile = () => { | ||||
| 			this.refs.file.click(); | ||||
| 		}; | ||||
| 
 | ||||
| 		this.createFolder = () => { | ||||
| 			const name = window.prompt('フォルダー名'); | ||||
| 			if (name == null || name == '') return; | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ require('./page/settings/authorized-apps.tag'); | |||
| require('./page/settings/twitter.tag'); | ||||
| require('./page/messaging.tag'); | ||||
| require('./page/messaging-room.tag'); | ||||
| require('./page/selectdrive.tag'); | ||||
| require('./home.tag'); | ||||
| require('./home-timeline.tag'); | ||||
| require('./timeline.tag'); | ||||
|  |  | |||
|  | @ -0,0 +1,83 @@ | |||
| <mk-selectdrive-page> | ||||
| 	<header> | ||||
| 		<h1>%i18n:mobile.tags.mk-selectdrive-page.select-file%<span class="count" if={ files.length > 0 }>({ files.length })</span></h1> | ||||
| 		<button class="upload" onclick={ upload }><i class="fa fa-upload"></i></button> | ||||
| 		<button if={ multiple } class="ok" onclick={ ok }><i class="fa fa-check"></i></button> | ||||
| 	</header> | ||||
| 	<mk-drive ref="browser" select-file={ true } multiple={ multiple }/> | ||||
| 
 | ||||
| 	<style> | ||||
| 		:scope | ||||
| 			display block | ||||
| 			width 100% | ||||
| 			height 100% | ||||
| 			background #fff | ||||
| 
 | ||||
| 			> header | ||||
| 				border-bottom solid 1px #eee | ||||
| 
 | ||||
| 				> h1 | ||||
| 					margin 0 | ||||
| 					padding 0 | ||||
| 					text-align center | ||||
| 					line-height 42px | ||||
| 					font-size 1em | ||||
| 					font-weight normal | ||||
| 
 | ||||
| 					> .count | ||||
| 						margin-left 4px | ||||
| 						opacity 0.5 | ||||
| 
 | ||||
| 				> .upload | ||||
| 					position absolute | ||||
| 					top 0 | ||||
| 					left 0 | ||||
| 					line-height 42px | ||||
| 					width 42px | ||||
| 
 | ||||
| 				> .ok | ||||
| 					position absolute | ||||
| 					top 0 | ||||
| 					right 0 | ||||
| 					line-height 42px | ||||
| 					width 42px | ||||
| 
 | ||||
| 			> mk-drive | ||||
| 				height calc(100% - 42px) | ||||
| 				overflow scroll | ||||
| 				-webkit-overflow-scrolling touch | ||||
| 
 | ||||
| 	</style> | ||||
| 	<script> | ||||
| 		const q = (new URL(location)).searchParams; | ||||
| 		this.multiple = q.get('multiple') == 'true' ? true : false; | ||||
| 
 | ||||
| 		this.on('mount', () => { | ||||
| 			document.documentElement.style.background = '#fff'; | ||||
| 
 | ||||
| 			this.refs.browser.on('selected', file => { | ||||
| 				this.files = [file]; | ||||
| 				this.ok(); | ||||
| 			}); | ||||
| 
 | ||||
| 			this.refs.browser.on('change-selection', files => { | ||||
| 				this.update({ | ||||
| 					files: files | ||||
| 				}); | ||||
| 			}); | ||||
| 		}); | ||||
| 
 | ||||
| 		this.upload = () => { | ||||
| 			this.refs.browser.selectLocalFile(); | ||||
| 		}; | ||||
| 
 | ||||
| 		this.close = () => { | ||||
| 			window.close(); | ||||
| 		}; | ||||
| 
 | ||||
| 		this.ok = () => { | ||||
| 			window.opener.cb(this.multiple ? this.files : this.files[0]); | ||||
| 			window.close(); | ||||
| 		}; | ||||
| 	</script> | ||||
| </mk-selectdrive-page> | ||||
		Loading…
	
		Reference in New Issue