mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
29 lines
595 B
JavaScript
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);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}); |