{"size": 1070, "ext": "js", "max_stars_repo_path": "JS Advanced/06 Exercise jQuery/3. Book Generator/book-generator.js", "max_stars_repo_name": "svetoslavmishev/JS-Core", "max_stars_repo_stars_event_min_datetime": "2018-01-29T06:09:01.000Z", "max_stars_repo_stars_event_max_datetime": "2018-05-06T11:30:06.000Z", "max_issues_repo_path": "JS Advanced/06 Exercise jQuery/3. Book Generator/book-generator.js", "max_issues_repo_name": "svetoslavmishev/JS-Core", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JS Advanced/06 Exercise jQuery/3. Book Generator/book-generator.js", "max_forks_repo_name": "svetoslavmishev/JS-Core", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 41.1538461538, "max_line_length": 84, "alphanum_fraction": 0.5411214953}
function createBook(selector, titleName, authorName, isbn) {
    let bookData = (function bookGenerator() {
        let id = 1;
        return function (selector, titleName, authorName, isbn) {
            let container = $(selector);
            let div = $('<div>').attr('id', `book${id}`).appendTo(container);
            let title = $('<p>').addClass('title').text(titleName).appendTo(div);
            let author = $('<p>').addClass('author').text(authorName).appendTo(div);
            let isbnCode = $('<p>').addClass('isbn').text(isbn).appendTo(div);
            let selectButton = $('<button>Select</button>').appendTo(div);
            let deselectButton = $('<button>Deselect</button>').appendTo(div);

            selectButton.on('click', function () {
                div.css('border', '2px solid blue');
            }).appendTo(div);
            deselectButton.on('click', function () {
                div.css('border', 'none');
            }).appendTo(div);

            id++;
        };
    }());
    bookData(selector, titleName, authorName, isbn);
}

