Move functions mark_state, start_download to api.js.
This commit is contained in:
		
							parent
							
								
									d996101152
								
							
						
					
					
						commit
						66f499c232
					
				
					 2 changed files with 22 additions and 20 deletions
				
			
		|  | @ -41,3 +41,22 @@ function set_automark(channel_id, state, callback) | ||||||
| 
 | 
 | ||||||
| /**************************************************************************************************/ | /**************************************************************************************************/ | ||||||
| api.videos = {}; | api.videos = {}; | ||||||
|  | 
 | ||||||
|  | api.videos.mark_state = | ||||||
|  | function mark_state(video_ids, state, callback) | ||||||
|  | { | ||||||
|  |     var url = "/mark_video_state"; | ||||||
|  |     data = new FormData(); | ||||||
|  |     data.append("video_ids", video_ids); | ||||||
|  |     data.append("state", state); | ||||||
|  |     return common.post(url, data, callback); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | api.videos.start_download = | ||||||
|  | function start_download(video_ids, callback) | ||||||
|  | { | ||||||
|  |     var url = "/start_download"; | ||||||
|  |     data = new FormData(); | ||||||
|  |     data.append("video_ids", video_ids); | ||||||
|  |     return common.post(url, data, callback); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -220,7 +220,7 @@ https://stackoverflow.com/a/35153397 | ||||||
|                 {% else %} |                 {% else %} | ||||||
|                 class="video_action_pending" |                 class="video_action_pending" | ||||||
|                 {% endif %} |                 {% endif %} | ||||||
|                 onclick="action_button_passthrough(event, mark_video_state, 'pending')" |                 onclick="action_button_passthrough(event, api.videos.mark_state, 'pending')" | ||||||
|                 >Revert to Pending</button> |                 >Revert to Pending</button> | ||||||
| 
 | 
 | ||||||
|                 <button |                 <button | ||||||
|  | @ -229,7 +229,7 @@ https://stackoverflow.com/a/35153397 | ||||||
|                 {% else %} |                 {% else %} | ||||||
|                 class="video_action_download hidden" |                 class="video_action_download hidden" | ||||||
|                 {% endif %} |                 {% endif %} | ||||||
|                 onclick="action_button_passthrough(event, start_download)" |                 onclick="action_button_passthrough(event, api.videos.start_download)" | ||||||
|                 >Download</button> |                 >Download</button> | ||||||
| 
 | 
 | ||||||
|                 <button |                 <button | ||||||
|  | @ -238,7 +238,7 @@ https://stackoverflow.com/a/35153397 | ||||||
|                 {% else %} |                 {% else %} | ||||||
|                 class="video_action_ignore hidden" |                 class="video_action_ignore hidden" | ||||||
|                 {% endif %} |                 {% endif %} | ||||||
|                 onclick="action_button_passthrough(event, mark_video_state, 'ignored')" |                 onclick="action_button_passthrough(event, api.videos.mark_state, 'ignored')" | ||||||
|                 >Ignore</button> |                 >Ignore</button> | ||||||
|             </div> |             </div> | ||||||
|             <div class="embed_toolbox"> |             <div class="embed_toolbox"> | ||||||
|  | @ -483,22 +483,5 @@ function set_automark_hook(event) | ||||||
| { | { | ||||||
|     api.channels.set_automark(CHANNEL_ID, event.target.value); |     api.channels.set_automark(CHANNEL_ID, event.target.value); | ||||||
| } | } | ||||||
| 
 |  | ||||||
| function mark_video_state(video_ids, state, callback) |  | ||||||
| { |  | ||||||
|     var url = "/mark_video_state"; |  | ||||||
|     data = new FormData(); |  | ||||||
|     data.append("video_ids", video_ids); |  | ||||||
|     data.append("state", state); |  | ||||||
|     return common.post(url, data, callback); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function start_download(video_ids, callback) |  | ||||||
| { |  | ||||||
|     var url = "/start_download"; |  | ||||||
|     data = new FormData(); |  | ||||||
|     data.append("video_ids", video_ids); |  | ||||||
|     return common.post(url, data, callback); |  | ||||||
| } |  | ||||||
| </script> | </script> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue