Google Drive support
This commit is contained in:
		
							parent
							
								
									0e96a56e8d
								
							
						
					
					
						commit
						e023b8d26c
					
				| @ -15,6 +15,7 @@ | ||||
| <script type="text/javascript"> | ||||
| 	var CLIENT_ID = '241271498917-jpto9lls9fqnem1e4h6ppds9uob8rpvu.apps.googleusercontent.com'; | ||||
| 	var SCOPES = 'https://www.googleapis.com/auth/drive.install'; | ||||
| 	var driveUpload = false; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Called when the client library is loaded to start the auth flow. | ||||
| @ -39,6 +40,9 @@ | ||||
| 	function handleAuthResult(authResult) { | ||||
| 		 if (authResult && !authResult.error) { | ||||
| 			 $("#drive-link").hide(); | ||||
| 			 gapi.client.load('drive', 'v2', function() { | ||||
| 				 driveUpload = true; | ||||
| 			 }); | ||||
| 		 } else { | ||||
| 			 $("#drive-link").click(function() { | ||||
| 	                gapi.auth.authorize({ 'client_id' : CLIENT_ID, | ||||
| @ -67,6 +71,7 @@ | ||||
| 	 * @param {Function} callback Function to call when the request is complete. | ||||
| 	 */ | ||||
| 	function insertFile(fileData, callback) { | ||||
| 		 if(driveUpload) { | ||||
| 			var request = gapi.client.request({ | ||||
| 				'path' : '/upload/drive/v2/files', | ||||
| 				'method' : 'POST', | ||||
| @ -80,6 +85,7 @@ | ||||
| 			} | ||||
| 			request.execute(callback); | ||||
| 		 } | ||||
| 	} | ||||
| </script> | ||||
| <script type="text/javascript" | ||||
| 	src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 benweet
						benweet