mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
29 lines
No EOL
595 B
JavaScript
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);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}); |