{"size": 1374, "ext": "js", "max_stars_repo_path": "public/samples/widgets/youtube/js/js.js", "max_stars_repo_name": "moli-php/dev-moli-zf2", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/samples/widgets/youtube/js/js.js", "max_issues_repo_name": "moli-php/dev-moli-zf2", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/samples/widgets/youtube/js/js.js", "max_forks_repo_name": "moli-php/dev-moli-zf2", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.4230769231, "max_line_length": 70, "alphanum_fraction": 0.4657933042}
$(function() {
    $('#search_btn').click(function(e) {
        e.preventDefault();
        var search = $('#search').val();
        if(search.length == 0) return false;
		
        $('#result').html("");
			
        var request = gapi.client.youtube.search.list({
            part: 'snippet',
            type : 'video',
            q : encodeURIComponent(search).replace(/%20/g, "+"),
            maxResult : 10,
            order : 'viewCount'
			
        });
		
        request.execute(function(response){
            var results = response.result;
            $.get('widgets/youtube-item', function(youtube_template){
                $.each(results.items, function(k,item){

                    $('#result').append(tplawesome(youtube_template,[{
                        "title":item.snippet.title, 
                        "videoid":item.id.videoId
                    }]));
                });
                
            });
        });
		
        $('#result').css('height', '420px');
		
        return false;
		
		
    });
});
function init() {
    gapi.client.setApiKey('AIzaSyC81N3rIWyQmKT5Gy_e3ot9bq2nNRqBCxM');
    gapi.client.load('youtube', 'v3', function() {
        });
}
function tplawesome(e,t){
    res=e;
    for(var n=0;n<t.length;n++){
        res=res.replace(/\{\{(.*?)\}\}/g,function(e,r){
            return t[n][r]
        })
    }
    return res
}