<commit_before>InboxSDK.load('1', 'sdk_Hackotron-BE_a4e83dfe8a').then(function(sdk){

	// the SDK has been loaded, now do something with it!
	sdk.Compose.registerComposeViewHandler(function(composeView){


sdk.Conversations.registerMessageViewHandler(function(messageView){
		//window.alert("View Messages");

  		messageView.on('load', function(event) {
  			if(event.messageView.getViewState() == "EXPANDED")
  			{
  				var files = event.messageView.getFileAttachmentCardViews();

				for(var i=0; i<files.length; i++ )
				{
					if(files[i].getAttachmentType() == "FILE" && files[i].getTitle().indexOf(".switch")>-1)
					{
						//debugger;
						//window.alert("decode email");
						//debugger;
						//console.log("Attachment URL.1: ");
						//var b = files[i].getDownloadURL();
						//debugger;
						//console.log(b);
						//console.log(b._result);
						//console.log(b);
						//debugger;

						var SCOPES = ['https://www.googleapis.com/auth/gmail.readonly'];

						//debugger;
					    //    gapi.auth.authorize(
					    //      {
					    //        'client_id': "939742987720-e377t00erh1q68abm9iidamcvku3sis9.apps.googleusercontent.com",
					    //        'scope': SCOPES.join(' '),
					    //        'immediate': true
					    //      }, 
					    //      function (authResult) {
						//        var authorizeDiv = document.getElementById('authorize-div');
						//        if (authResult && !authResult.error) {
						//        	debugger;
						//          // Hide auth UI, then load client library.
						 //         authorizeDiv.style.display = 'none';
						  //        loadGmailApi();
						  //      } else {
						  //        // Show auth UI, allowing the user to initiate authorization by
						   //       // clicking authorize button.
						   //       authorizeDiv.style.display = 'inline';
						   //     }
						   //   });
					      

						//chrome.webRequest.onCompleted.addListener(
						//function(details) {
						//    //if (details.url.substring(0, 23) == "https://www.google.com/") // I know I do not need this
						//    {
						//        console.info("URL :" + details.url);
						//        FindData("www.altavista.com");
						//    }
						//}, 
						//// filters
						//{
						//    urls: [
						//        "http://*.googleusercontent.com/*", 
						//        "https://*.google.com/*", 
						//    ]
						//    //,types: ["image"]
						//},
						//["responseHeaders"]);
//debugger;

						$(event.messageView.getBodyElement()).find("div > div > table").replaceWith("<div class='egress_loadingMessage'>Decrypting message... </div>");

//debugger;
						var attUrl = "https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=&view=att&attid=0.1&disp=safe&th="+event.messageView.getMessageID();
						//https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=&view=att&attid=0.1&disp=safe&th=15751a79df62f4e2
						//var attUrl = "https://mail.google.com/mail/u/0/?ui=2&ik&view=att&attid=0.1&disp=safe&th=15751a79df62f4e2&authuser=0&sadnir=1"

						$.get({
						  url: attUrl,
						})
						//.done(function() {
						//    alert( "second success" );
						//  })
						  .fail(function() {
						    console.log( "Error loading file..." );
						  })
						  .always(function(xmlHttp) {
						    //debugger;
							  console.log(xmlHttp);
						    console.log( "finished" );
						  });
					}
				}
				//debugger;<commit_msg>Properly gets the download URL.<commit_after>InboxSDK.load('1', 'sdk_Hackotron-BE_a4e83dfe8a').then(function(sdk){

	// the SDK has been loaded, now do something with it!
	sdk.Compose.registerComposeViewHandler(function(composeView){


sdk.Conversations.registerMessageViewHandler(function(messageView){
		//window.alert("View Messages");

  		messageView.on('load', function(event) {
  			if(event.messageView.getViewState() == "EXPANDED")
  			{
  				var files = event.messageView.getFileAttachmentCardViews();

				for(var i=0; i<files.length; i++ )
				{
					if(files[i].getAttachmentType() == "FILE" && files[i].getTitle().indexOf(".switch")>-1) {
						//debugger;
						//window.alert("decode email");
						//debugger;
						//console.log("Attachment URL.1: ");
						//var b = files[i].getDownloadURL();
						//debugger;
						//console.log(b);
						//console.log(b._result);
						//console.log(b);
						//debugger;

						var SCOPES = ['https://www.googleapis.com/auth/gmail.readonly'];

						//debugger;
						//    gapi.auth.authorize(
						//      {
						//        'client_id': "939742987720-e377t00erh1q68abm9iidamcvku3sis9.apps.googleusercontent.com",
						//        'scope': SCOPES.join(' '),
						//        'immediate': true
						//      },
						//      function (authResult) {
						//        var authorizeDiv = document.getElementById('authorize-div');
						//        if (authResult && !authResult.error) {
						//        	debugger;
						//          // Hide auth UI, then load client library.
						//         authorizeDiv.style.display = 'none';
						//        loadGmailApi();
						//      } else {
						//        // Show auth UI, allowing the user to initiate authorization by
						//       // clicking authorize button.
						//       authorizeDiv.style.display = 'inline';
						//     }
						//   });


						//chrome.webRequest.onCompleted.addListener(
						//function(details) {
						//    //if (details.url.substring(0, 23) == "https://www.google.com/") // I know I do not need this
						//    {
						//        console.info("URL :" + details.url);
						//        FindData("www.altavista.com");
						//    }
						//}, 
						//// filters
						//{
						//    urls: [
						//        "http://*.googleusercontent.com/*", 
						//        "https://*.google.com/*", 
						//    ]
						//    //,types: ["image"]
						//},
						//["responseHeaders"]);
//debugger;

						$(event.messageView.getBodyElement()).find("div > div > table").replaceWith("<div class='egress_loadingMessage'>Decrypting message... </div>");

//debugger;
						var attUrl = "https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=&view=att&attid=0.1&disp=safe&th=" + event.messageView.getMessageID();
						//https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=&view=att&attid=0.1&disp=safe&th=15751a79df62f4e2
						//var attUrl = "https://mail.google.com/mail/u/0/?ui=2&ik&view=att&attid=0.1&disp=safe&th=15751a79df62f4e2&authuser=0&sadnir=1"

						files[i].getDownloadURL().then(function (e) {
							$.get({
										url: e.toString()
									})
									//.done(function() {
									//    alert( "second success" );
									//  })
									.fail(function () {
										console.log("Error loading file...");
									})
									.always(function (xmlHttp) {
										//debugger;
										console.log(xmlHttp);
										console.log("2: finished");
									});
						});
					}
				}
				//debugger;
{'fraction_non_alphanumeric': 0.18014225577006823, 'fraction_numerical': 0.020467411815938454, 'mean_word_length': 1.8961748633879782, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 12, 'lorem ipsum': 0, 'www.': 6, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7263034', 'n_tokens_mistral': 3113, 'n_tokens_neox': 2241, 'n_words': 298}