<commit_before>//Okay, so the showResponse function contains all the AJAX code and Youtube API search goes that is triggered when the
//button is clicked. So far I can display a list of videos, but the positioning is off and I haven't linked it to another
//project yet.

var finalResponse;
var i;

function showResponse(response) {
    var responseString = JSON.stringify(response, '', 2);
  	console.log(response.items[0].snippet.thumbnails.default.url);
    loadXMLDoc();
    console.log(responseString);
 	function loadXMLDoc() {
 		var xmlhttp;
        var request;
 		if(window.XMLHttpRequest){
 			xmlhttp=new XMLHttpRequest();
 		}else {
 			xmlhttp = newActiveXObject("Microsoft.XMLHTTP");
 		}
        finalResponse = response;
   		var html = "<div class='guide'> Which tutorial <br/> would you like to follow? </div>";
    	for(i = 0; i < (response.items).length; i++) {
    		//I tried to teach myself Ajax (before today's lecture), and so I basically created a container, 
    		//div and used a thumbnail image, description, and title, to identify the project. I was a little confused
    		//about what we wanted to extract from the user click. Do we want to return the video id? Do we want
    		//to go to the Youtube url for the user to view the video? Would love your input!
    		html += '<div class="videoitem"> \
                <div class="thumbnails" onclick = "addData('+i+');" style="background: url('+response.items[i].snippet.thumbnails.high.url+'); background-size: cover; background-position: center center"> \
                    <div class="over"><span class="helper"></span><span class="glyphicon glyphicon glyphicon-plus"></span></div> \
                </div> \
                <div class="title">'+response.items[i].snippet.title+'</div> \
    			<div class="description-button"><span class="glyphicon glyphicon-chevron-right"></span> Show Description</div> \
                <div class="description">'+response.items[i].snippet.description+'</div> \
    			</div>';
 		}

        html += '<a href="#top"><div id="gobacktop"> GO BACK TO TOP <span class="glyphicon glyphicon-arrow-up"></span></div></a>';
 		$(".container").html(html);
 		xmlhttp.open("GET","create",true);
		xmlhttp.send();

        $(".description-button").click(function() {
            console.log("hello");
            $(this).fadeOut(function() {
                $(this).next().fadeIn();
            });
        });

 	}
}


function addData(i) {
    $.post("/create", finalResponse.items[i], callBack2);
}

 function callBack2(result) {
    console.log(result);
    $(".notification .message").html("Breakpoint video has been created <br/> and will be played shortly...");
    $(".notification").fadeIn(function() {
        setTimeout(function() {
            window.location.href = "/video/"+result;
        }, 2000);
    });
 }

// Called automatically when JavaScript client library is loaded.
function onClientLoad() {
    gapi.client.load('youtube', 'v3', onYouTubeApiLoad);
}

// Called automatically when YouTube API interface is loaded (see line 9).
function onYouTubeApiLoad() {
    // This API key is intended for use only in this lesson.
    // See http://goo.gl/PdPA1 to get a key for your own applications.
    gapi.client.setApiKey('<KEY>');
    //gapi.client.setApiKey('<KEY>');

}
// LOCAL KEY: gapi.client.setApiKey('<KEY>');
// HEROKU KEY: gapi.client.setApiKey('<KEY>');


function search(tag) {<commit_msg>key change<commit_after>//Okay, so the showResponse function contains all the AJAX code and Youtube API search goes that is triggered when the
//button is clicked. So far I can display a list of videos, but the positioning is off and I haven't linked it to another
//project yet.

var finalResponse;
var i;

function showResponse(response) {
    var responseString = JSON.stringify(response, '', 2);
  	console.log(response.items[0].snippet.thumbnails.default.url);
    loadXMLDoc();
    console.log(responseString);
 	function loadXMLDoc() {
 		var xmlhttp;
        var request;
 		if(window.XMLHttpRequest){
 			xmlhttp=new XMLHttpRequest();
 		}else {
 			xmlhttp = newActiveXObject("Microsoft.XMLHTTP");
 		}
        finalResponse = response;
   		var html = "<div class='guide'> Which tutorial <br/> would you like to follow? </div>";
    	for(i = 0; i < (response.items).length; i++) {
    		//I tried to teach myself Ajax (before today's lecture), and so I basically created a container, 
    		//div and used a thumbnail image, description, and title, to identify the project. I was a little confused
    		//about what we wanted to extract from the user click. Do we want to return the video id? Do we want
    		//to go to the Youtube url for the user to view the video? Would love your input!
    		html += '<div class="videoitem"> \
                <div class="thumbnails" onclick = "addData('+i+');" style="background: url('+response.items[i].snippet.thumbnails.high.url+'); background-size: cover; background-position: center center"> \
                    <div class="over"><span class="helper"></span><span class="glyphicon glyphicon glyphicon-plus"></span></div> \
                </div> \
                <div class="title">'+response.items[i].snippet.title+'</div> \
    			<div class="description-button"><span class="glyphicon glyphicon-chevron-right"></span> Show Description</div> \
                <div class="description">'+response.items[i].snippet.description+'</div> \
    			</div>';
 		}

        html += '<a href="#top"><div id="gobacktop"> GO BACK TO TOP <span class="glyphicon glyphicon-arrow-up"></span></div></a>';
 		$(".container").html(html);
 		xmlhttp.open("GET","create",true);
		xmlhttp.send();

        $(".description-button").click(function() {
            console.log("hello");
            $(this).fadeOut(function() {
                $(this).next().fadeIn();
            });
        });

 	}
}


function addData(i) {
    $.post("/create", finalResponse.items[i], callBack2);
}

 function callBack2(result) {
    console.log(result);
    $(".notification .message").html("Breakpoint video has been created <br/> and will be played shortly...");
    $(".notification").fadeIn(function() {
        setTimeout(function() {
            window.location.href = "/video/"+result;
        }, 2000);
    });
 }

// Called automatically when JavaScript client library is loaded.
function onClientLoad() {
    gapi.client.load('youtube', 'v3', onYouTubeApiLoad);
}

// Called automatically when YouTube API interface is loaded (see line 9).
function onYouTubeApiLoad() {
    // This API key is intended for use only in this lesson.
    // See http://goo.gl/PdPA1 to get a key for your own applications.
    //gapi.client.setApiKey('<KEY>');
    gapi.client.setApiKey('<KEY>');

}
// LOCAL KEY: gapi.client.setApiKey('<KEY>');
// HEROKU KEY: gapi.client.setApiKey('<KEY>');


function search(tag) {
{'fraction_non_alphanumeric': 0.15169602562236134, 'fraction_numerical': 0.003493958363662833, 'mean_word_length': 3.0990453460620526, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5749640', 'n_tokens_mistral': 2116, 'n_tokens_neox': 1997, 'n_words': 591}