Merge branch 'bodnia-issue-1745'

This commit is contained in:
Tony Tam
2016-02-08 21:37:49 -08:00
3 changed files with 24 additions and 2 deletions

11
dist/swagger-ui.js vendored
View File

@@ -25158,6 +25158,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
this.router = opts.router; this.router = opts.router;
document.addEventListener('click', this.onLinkClick, true);
// Sort APIs // Sort APIs
if (opts.swaggerOptions.apisSorter) { if (opts.swaggerOptions.apisSorter) {
sorterOption = opts.swaggerOptions.apisSorter; sorterOption = opts.swaggerOptions.apisSorter;
@@ -25292,6 +25293,16 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
clear: function(){ clear: function(){
$(this.el).html(''); $(this.el).html('');
},
onLinkClick: function (e) {
var el = e.target;
if (el.tagName === 'A') {
if (location.hostname !== el.hostname || location.port !== el.port) {
e.preventDefault();
window.open(el.href, '_blank');
}
}
} }
}); });

File diff suppressed because one or more lines are too long

View File

@@ -14,6 +14,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
this.router = opts.router; this.router = opts.router;
document.addEventListener('click', this.onLinkClick, true);
// Sort APIs // Sort APIs
if (opts.swaggerOptions.apisSorter) { if (opts.swaggerOptions.apisSorter) {
sorterOption = opts.swaggerOptions.apisSorter; sorterOption = opts.swaggerOptions.apisSorter;
@@ -148,5 +149,15 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
clear: function(){ clear: function(){
$(this.el).html(''); $(this.el).html('');
},
onLinkClick: function (e) {
var el = e.target;
if (el.tagName === 'A') {
if (location.hostname !== el.hostname || location.port !== el.port) {
e.preventDefault();
window.open(el.href, '_blank');
}
}
} }
}); });