Add message and close link to HTML form
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							parent
							
								
									714c84b35d
								
							
						
					
					
						commit
						ae611fd970
					
				| @ -2,7 +2,7 @@ | |||||||
|     "name": "nwb/multi-downloader-client", |     "name": "nwb/multi-downloader-client", | ||||||
|     "description": "Client for multi-downloader-service", |     "description": "Client for multi-downloader-service", | ||||||
|     "type": "library", |     "type": "library", | ||||||
|     "version": "0.0.9", |     "version": "0.1.9", | ||||||
|     "autoload": { |     "autoload": { | ||||||
|         "psr-4": { |         "psr-4": { | ||||||
|             "Nwb\\MultiDownloaderClient\\": "src/" |             "Nwb\\MultiDownloaderClient\\": "src/" | ||||||
|  | |||||||
| @ -19,6 +19,17 @@ use Nwb\MultiDownloaderClient\MultiDownloaderClient; | |||||||
|         body { |         body { | ||||||
|             display: inline; |             display: inline; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         #message {
 | ||||||
|  |             text-align: center; | ||||||
|  |             margin-top: 20px; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         #close-link {
 | ||||||
|  |             display: block; | ||||||
|  |             text-align: center; | ||||||
|  |             margin-top: 10px; | ||||||
|  |         } | ||||||
|     </style> |     </style> | ||||||
| </head> | </head> | ||||||
| 
 | 
 | ||||||
| @ -26,18 +37,38 @@ use Nwb\MultiDownloaderClient\MultiDownloaderClient; | |||||||
|     <div id="button_div" class="modal-dialog-buttons"> |     <div id="button_div" class="modal-dialog-buttons"> | ||||||
|         <form name="f" id="f" method="POST" action="<?= $this->url ?>/v2/form/zip<?= $zipName ?>" enctype="multipart/form-data"> |         <form name="f" id="f" method="POST" action="<?= $this->url ?>/v2/form/zip<?= $zipName ?>" enctype="multipart/form-data"> | ||||||
|             <input type="hidden" name="json" value='<?= json_encode($this->buildRequest()) ?>' /> |             <input type="hidden" name="json" value='<?= json_encode($this->buildRequest()) ?>' /> | ||||||
| 
 |  | ||||||
|             <noscript> |             <noscript> | ||||||
|                 <button id="submit_approve_access" type="submit" tabindex="1" style="overflow:visible;">Continue</button> |                 <button id="submit_approve_access" type="submit" tabindex="1" style="overflow:visible;">Continue</button> | ||||||
|             </noscript> |             </noscript> | ||||||
|         </form> |         </form> | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|  |     <div id="message"></div> | ||||||
|  |     <div id="close-link"> | ||||||
|  |         <a href="javascript:void(0);" onclick="window.close();">Close this tab</a> | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|     <script type="text/javascript"> |     <script type="text/javascript"> | ||||||
|  |         var messages = { | ||||||
|  |             'en': 'Your download will begin shortly. This page will close automatically.', | ||||||
|  |             'fr': 'Votre téléchargement va commencer. Cette page se fermera automatiquement.' | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         var closeLinkMessages = { | ||||||
|  |             'en': 'Close this page', | ||||||
|  |             'fr': 'Fermer cette page' | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         var userLang = navigator.language || navigator.userLanguage; | ||||||
|  |         userLang = userLang.split('-')[0]; | ||||||
|  | 
 | ||||||
|  |         document.getElementById('message').innerText = messages[userLang] || messages['en']; | ||||||
|  |         document.getElementById('close-link').getElementsByTagName('a')[0].innerText = closeLinkMessages[userLang] || closeLinkMessages['en']; | ||||||
|  | 
 | ||||||
|         document.forms['f'].submit(); |         document.forms['f'].submit(); | ||||||
|         window.setTimeout(function() { |         window.setTimeout(function() { | ||||||
|             window.close(); |             window.close(); | ||||||
|         }, 2000); // Attend 2 secondes avant de fermer la fenêtre
 |         }, 2000); // 2 secondes
 | ||||||
|     </script> |     </script> | ||||||
| </body> | </body> | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user