0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/lib/GUI/js/entry.js
2014-05-07 14:56:48 -05:00

29 lines
No EOL
595 B
JavaScript

var $ = require('unopinionate').selector,
onClick = require('onclick');
$(function() {
onClick('.entry .name', function() {
var $this = $(this),
$entry = $this.closest('.entry');
if($entry.hasClass('open')) {
$entry
.removeClass('open')
.find('.readme').remove();
}
else {
$entry.addClass('open');
$.ajax({
url: '/-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
dataType: 'text',
success: function(html) {
console.log(html);
$("<div class='readme'>")
.html(html)
.appendTo($entry);
}
});
}
});
});