save and load state
This commit is contained in:
		
							
								
								
									
										18
									
								
								popup/tip.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								popup/tip.js
									
									
									
									
									
								
							| @ -11,4 +11,22 @@ window.onload = function () { | ||||
|                 'url': `https://git.jebbs.co/jebbs/data-extracter-extesion` | ||||
|             }); | ||||
|         }) | ||||
|     document.querySelector('#state-input') | ||||
|         .addEventListener('change', function (...args) { | ||||
|             if (this.files.length == 1) { | ||||
|                 var reader = new FileReader(); | ||||
|                 let fileName = this.files[0].name; | ||||
|                 reader.readAsText(this.files[0], "UTF-8"); | ||||
|                 reader.onload = function (evt) { | ||||
|                     var fileString = evt.target.result; | ||||
|                     chrome.runtime.sendMessage({ | ||||
|                         action: ACTION_UPLOAD_STATE, | ||||
|                         state: fileString, | ||||
|                         name: fileName | ||||
|                     }, r => { | ||||
|                         if (r) console.log('State sent:', r); | ||||
|                     }); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user