mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-25 02:32:52 -05:00
web: encode version strings in urls
This commit is contained in:
parent
ae1f67d31f
commit
691bdb3a92
3 changed files with 135 additions and 132 deletions
|
@ -52,7 +52,9 @@ $(function() {
|
|||
|
||||
// Get the data
|
||||
$.ajax({
|
||||
url: '-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
|
||||
url: '-/readme/'
|
||||
+ encodeURIComponent($entry.attr('data-name')) + '/'
|
||||
+ encodeURIComponent($entry.attr('data-version')),
|
||||
dataType: 'text',
|
||||
success: function(html) {
|
||||
var $readme = $("<div class='readme'>")
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,21 +13,21 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|||
if (helper = helpers.version) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
||||
else { helper = (depth0 && depth0.version); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "\">\n <div class=\"row\">\n <div class=\"col-md-8 col-sm-8\">\n <h4 class=\"title\">\n <a class='name icon-angle-right red' href='javascript:void(0)'>";
|
||||
+ "\">\n <div class=\"row\">\n <div class=\"col-md-8 col-sm-8\">\n <h4 class=\"title\">\n <a class='name icon-angle-right red' href='javascript:void(0)'>";
|
||||
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
||||
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "</a>\n <small class='version'>v";
|
||||
+ "</a>\n <small class='version'>v";
|
||||
if (helper = helpers.version) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
||||
else { helper = (depth0 && depth0.version); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "</small>\n </h4>\n </div>\n <div class=\"col-md-4 col-sm-4\">\n <div class=\"author pull-right\">\n <small>By: "
|
||||
+ "</small>\n </h4>\n </div>\n <div class=\"col-md-4 col-sm-4\">\n <div class=\"author pull-right\">\n <small>By: "
|
||||
+ escapeExpression(((stack1 = ((stack1 = (depth0 && depth0._npmUser)),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
||||
+ "</small>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <p class=\"description\">";
|
||||
+ "</small>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <p class=\"description\">";
|
||||
if (helper = helpers.description) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
||||
else { helper = (depth0 && depth0.description); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "</p>\n </div>\n </div>\n</div>\n";
|
||||
+ "</p>\n </div>\n </div>\n</div>\n";
|
||||
return buffer;
|
||||
});
|
||||
},{"handlebars/runtime":12}],2:[function(require,module,exports){
|
||||
|
@ -314,77 +314,79 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|||
}(jQuery);
|
||||
|
||||
},{}],3:[function(require,module,exports){
|
||||
var $ = require('unopinionate').selector,
|
||||
onClick = require('onclick'),
|
||||
transitionComplete = require('transition-complete');
|
||||
var $ = require('unopinionate').selector
|
||||
var onClick = require('onclick')
|
||||
var transitionComplete = require('transition-complete')
|
||||
|
||||
$(function() {
|
||||
onClick('.entry .name', function() {
|
||||
var $this = $(this),
|
||||
$entry = $this.closest('.entry');
|
||||
onClick('.entry .name', function() {
|
||||
var $this = $(this)
|
||||
var $entry = $this.closest('.entry')
|
||||
|
||||
//Close entry
|
||||
if($entry.hasClass('open')) {
|
||||
$entry
|
||||
.height($entry.outerHeight())
|
||||
.removeClass('open');
|
||||
if ($entry.hasClass('open')) {
|
||||
// Close entry
|
||||
$entry
|
||||
.height($entry.outerHeight())
|
||||
.removeClass('open')
|
||||
|
||||
setTimeout(function() {
|
||||
$entry.css('height', $entry.attr('data-height') + 'px');
|
||||
}, 0);
|
||||
setTimeout(function() {
|
||||
$entry.css('height', $entry.attr('data-height') + 'px')
|
||||
}, 0)
|
||||
|
||||
transitionComplete(function() {
|
||||
$entry.find('.readme').remove();
|
||||
$entry.css('height', 'auto');
|
||||
});
|
||||
}
|
||||
//Open entry
|
||||
else {
|
||||
//Close open entries
|
||||
$('.entry.open').each(function() {
|
||||
var $entry = $(this);
|
||||
$entry
|
||||
.height($entry.outerHeight())
|
||||
.removeClass('open');
|
||||
transitionComplete(function() {
|
||||
$entry.find('.readme').remove()
|
||||
$entry.css('height', 'auto')
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
$entry.css('height', $entry.attr('data-height') + 'px');
|
||||
}, 0);
|
||||
} else {
|
||||
// Open entry
|
||||
$('.entry.open').each(function() {
|
||||
// Close open entries
|
||||
var $entry = $(this)
|
||||
$entry
|
||||
.height($entry.outerHeight())
|
||||
.removeClass('open')
|
||||
|
||||
transitionComplete(function() {
|
||||
$entry.find('.readme').remove();
|
||||
$entry.css('height', 'auto');
|
||||
});
|
||||
});
|
||||
setTimeout(function() {
|
||||
$entry.css('height', $entry.attr('data-height') + 'px')
|
||||
}, 0)
|
||||
|
||||
//Add the open class
|
||||
$entry.addClass('open');
|
||||
transitionComplete(function() {
|
||||
$entry.find('.readme').remove()
|
||||
$entry.css('height', 'auto')
|
||||
})
|
||||
})
|
||||
|
||||
//Explicitly set heights for transitions
|
||||
var height = $entry.outerHeight();
|
||||
$entry
|
||||
.attr('data-height', height)
|
||||
.css('height', height);
|
||||
// Add the open class
|
||||
$entry.addClass('open')
|
||||
|
||||
//Get the data
|
||||
$.ajax({
|
||||
url: '-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
|
||||
dataType: 'text',
|
||||
success: function(html) {
|
||||
var $readme = $("<div class='readme'>")
|
||||
.html(html)
|
||||
.appendTo($entry);
|
||||
// Explicitly set heights for transitions
|
||||
var height = $entry.outerHeight()
|
||||
$entry
|
||||
.attr('data-height', height)
|
||||
.css('height', height)
|
||||
|
||||
$entry.height(height + $readme.outerHeight());
|
||||
// Get the data
|
||||
$.ajax({
|
||||
url: '-/readme/'
|
||||
+ encodeURIComponent($entry.attr('data-name')) + '/'
|
||||
+ encodeURIComponent($entry.attr('data-version')),
|
||||
dataType: 'text',
|
||||
success: function(html) {
|
||||
var $readme = $("<div class='readme'>")
|
||||
.html(html)
|
||||
.appendTo($entry)
|
||||
|
||||
transitionComplete(function() {
|
||||
$entry.css('height', 'auto');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
$entry.height(height + $readme.outerHeight())
|
||||
|
||||
transitionComplete(function() {
|
||||
$entry.css('height', 'auto')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
},{"onclick":13,"transition-complete":15,"unopinionate":16}],4:[function(require,module,exports){
|
||||
// twitter bootstrap stuff;
|
||||
|
@ -395,93 +397,92 @@ require('./bootstrap-modal')
|
|||
require('./search')
|
||||
require('./entry')
|
||||
|
||||
var $ = require('unopinionate').selector
|
||||
$(document).on('click', '.js-userLogoutBtn', function() {
|
||||
$('#userLogoutForm').submit()
|
||||
return false
|
||||
$('#userLogoutForm').submit()
|
||||
return false
|
||||
})
|
||||
|
||||
},{"./bootstrap-modal":2,"./entry":3,"./search":5}],5:[function(require,module,exports){
|
||||
var $ = require('unopinionate').selector,
|
||||
template = require('../entry.hbs'),
|
||||
onScroll = require('onscroll');
|
||||
},{"./bootstrap-modal":2,"./entry":3,"./search":5,"unopinionate":16}],5:[function(require,module,exports){
|
||||
var $ = require('unopinionate').selector
|
||||
var template = require('../entry.hbs')
|
||||
var onScroll = require('onscroll')
|
||||
|
||||
$(function() {
|
||||
'use strict';
|
||||
;(function(window, document) {
|
||||
var $form = $('#search-form')
|
||||
var $input = $form.find('input')
|
||||
var $body = $('body')
|
||||
var $clear = $form.find('.clear')
|
||||
var $searchResults = $('#search-results')
|
||||
var $pkgListing = $('#all-packages')
|
||||
var $searchBtn = $('.js-search-btn')
|
||||
var request
|
||||
var currentResults
|
||||
|
||||
(function( window, document ) {
|
||||
var toggle = function(validQuery) {
|
||||
$searchResults.toggleClass('show', validQuery)
|
||||
$pkgListing.toggleClass('hide', validQuery)
|
||||
|
||||
var $form = $('#search-form');
|
||||
var $input = $form.find('input');
|
||||
var $body = $('body');
|
||||
var $clear = $form.find('.clear');
|
||||
var $searchResults = $("#search-results");
|
||||
var $pkgListing = $("#all-packages");
|
||||
var $searchBtn = $('.js-search-btn');
|
||||
var request;
|
||||
var currentResults;
|
||||
$searchBtn.find('i').toggleClass('icon-cancel', validQuery)
|
||||
$searchBtn.find('i').toggleClass('icon-search', !validQuery)
|
||||
}
|
||||
|
||||
var toggle = function( validQuery ) {
|
||||
$searchResults.toggleClass( 'show', validQuery );
|
||||
$pkgListing.toggleClass( 'hide', validQuery );
|
||||
$form.bind('submit keyup', function(e) {
|
||||
var q, qBool
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
$searchBtn.find('i').toggleClass( 'icon-cancel', validQuery );
|
||||
$searchBtn.find('i').toggleClass( 'icon-search', !validQuery );
|
||||
};
|
||||
q = $input.val()
|
||||
qBool = (q !== '')
|
||||
|
||||
$form.bind('submit keyup', function(e) {
|
||||
var q, qBool;
|
||||
toggle(qBool)
|
||||
|
||||
e.preventDefault();
|
||||
if (!qBool) {
|
||||
if (request && typeof request.abort === 'function') {
|
||||
request.abort()
|
||||
}
|
||||
|
||||
q = $input.val();
|
||||
qBool = q !== '';
|
||||
currentResults = null
|
||||
$searchResults.html('')
|
||||
return
|
||||
}
|
||||
|
||||
toggle( qBool );
|
||||
if (request && typeof request.abort === 'function') {
|
||||
request.abort()
|
||||
}
|
||||
|
||||
if( !qBool ) {
|
||||
if( request && typeof request.abort === 'function' ) {
|
||||
request.abort();
|
||||
}
|
||||
if (!currentResults) {
|
||||
$searchResults.html(
|
||||
"<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>")
|
||||
}
|
||||
|
||||
currentResults = null;
|
||||
$searchResults.html('');
|
||||
return;
|
||||
}
|
||||
request = $.getJSON('-/search/' + q, function( results ) {
|
||||
currentResults = results
|
||||
|
||||
if( request && typeof request.abort === 'function' ) {
|
||||
request.abort();
|
||||
}
|
||||
if (results.length > 0) {
|
||||
var html = ''
|
||||
|
||||
if( !currentResults ) {
|
||||
$searchResults.html( "<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>" );
|
||||
}
|
||||
$.each(results, function(i, entry) {
|
||||
html += template(entry)
|
||||
})
|
||||
|
||||
request = $.getJSON('-/search/' + q, function( results ) {
|
||||
currentResults = results;
|
||||
$searchResults.html(html)
|
||||
} else {
|
||||
$searchResults.html(
|
||||
"<div class='no-results'><big>No Results</big></div>")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
if( results.length > 0 ) {
|
||||
var html = '';
|
||||
$(document).on('click', '.icon-cancel', function(e) {
|
||||
e.preventDefault()
|
||||
$input.val('')
|
||||
$form.keyup()
|
||||
})
|
||||
|
||||
$.each(results, function( i, entry ) {
|
||||
html += template( entry );
|
||||
});
|
||||
|
||||
$searchResults.html(html);
|
||||
} else {
|
||||
$searchResults.html("<div class='no-results'><big>No Results</big></div>");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( document ).on( 'click', '.icon-cancel', function( e ) {
|
||||
e.preventDefault();
|
||||
$input.val('');
|
||||
$form.keyup();
|
||||
});
|
||||
|
||||
})( window, window.document );
|
||||
});
|
||||
})(window, window.document)
|
||||
})
|
||||
|
||||
},{"../entry.hbs":1,"onscroll":14,"unopinionate":16}],6:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
|
Loading…
Add table
Reference in a new issue