1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/lib/GUI/js/entry.js
2014-05-07 14:56:48 -05:00

29 lines
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);
}
});
}
});
});