Skip to content

Commit 9d4d5fd

Browse files
committed
updated swagger-ui versions
1 parent 74b839c commit 9d4d5fd

File tree

28 files changed

+904
-2585
lines changed

28 files changed

+904
-2585
lines changed

samples/java-grails2/web-app/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<html>
33
<head>
44
<title>Swagger UI</title>
5-
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
5+
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
66
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
77
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
8+
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
9+
<link href='css/screen.css' media='print' rel='stylesheet' type='text/css'/>
810
<script type="text/javascript" src="lib/shred.bundle.js"></script>
911
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
1012
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script>

samples/java-grails2/web-app/lib/swagger-oauth.js

Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -48,65 +48,72 @@ function handleLogin() {
4848
str += '</label></li>';
4949
popup.append(str);
5050
}
51-
}
52-
53-
var $win = $(window),
54-
dw = $win.width(),
55-
dh = $win.height(),
56-
st = $win.scrollTop(),
57-
dlgWd = popupDialog.outerWidth(),
58-
dlgHt = popupDialog.outerHeight(),
59-
top = (dh -dlgHt)/2 + st,
60-
left = (dw - dlgWd)/2;
61-
62-
popupDialog.css({
63-
top: (top < 0? 0 : top) + 'px',
64-
left: (left < 0? 0 : left) + 'px'
65-
});
66-
67-
popupDialog.find('button.api-popup-cancel').click(function() {
68-
popupMask.hide();
69-
popupDialog.hide();
70-
});
71-
popupDialog.find('button.api-popup-authbtn').click(function() {
72-
popupMask.hide();
73-
popupDialog.hide();
74-
75-
var authSchemes = window.swaggerUi.api.authSchemes;
76-
var host = window.location;
77-
var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
78-
var url = null;
79-
80-
var p = window.swaggerUi.api.authSchemes;
81-
for (var key in p) {
82-
if (p.hasOwnProperty(key)) {
83-
var o = p[key].grantTypes;
84-
for(var t in o) {
85-
if(o.hasOwnProperty(t) && t === 'implicit') {
86-
var dets = o[t];
87-
url = dets.loginEndpoint.url + "?response_type=token";
88-
window.swaggerUi.tokenName = dets.tokenName;
51+
52+
53+
var $win = $(window),
54+
dw = $win.width(),
55+
dh = $win.height(),
56+
st = $win.scrollTop(),
57+
dlgWd = popupDialog.outerWidth(),
58+
dlgHt = popupDialog.outerHeight(),
59+
top = (dh -dlgHt)/2 + st,
60+
left = (dw - dlgWd)/2;
61+
62+
popupDialog.css({
63+
top: (top < 0? 0 : top) + 'px',
64+
left: (left < 0? 0 : left) + 'px'
65+
});
66+
67+
popupDialog.find('button.api-popup-cancel').click(function() {
68+
popupMask.hide();
69+
popupDialog.hide();
70+
});
71+
popupDialog.find('button.api-popup-authbtn').click(function() {
72+
popupMask.hide();
73+
popupDialog.hide();
74+
75+
var authSchemes = window.swaggerUi.api.authSchemes;
76+
var location = window.location;
77+
var locationUrl = location.protocol + '//' + location.host + location.pathname;
78+
var redirectUrl = locationUrl.replace("index.html","").concat("/o2c.html").replace("//o2c.html","/o2c.html");
79+
var url = null;
80+
81+
var p = window.swaggerUi.api.authSchemes;
82+
for (var key in p) {
83+
if (p.hasOwnProperty(key)) {
84+
var o = p[key].grantTypes;
85+
for(var t in o) {
86+
if(o.hasOwnProperty(t) && t === 'implicit') {
87+
var dets = o[t];
88+
url = dets.loginEndpoint.url + "?response_type=token";
89+
window.swaggerUi.tokenName = dets.tokenName;
90+
}
8991
}
9092
}
9193
}
92-
}
93-
var scopes = []
94-
var o = $('.api-popup-scopes').find('input:checked');
95-
96-
for(k =0; k < o.length; k++) {
97-
scopes.push($(o[k]).attr("scope"));
98-
}
99-
100-
window.enabledScopes=scopes;
94+
var scopes = [];
95+
var scopeForUrl='';
96+
var o = $('.api-popup-scopes').find('input:checked');
97+
98+
for(var k =0; k < o.length; k++) {
99+
scopes.push($(o[k]).attr("scope"));
100+
if(k > 0){
101+
scopeForUrl+=' ';
102+
}
103+
scopeForUrl+=$(o[k]).attr("scope");
104+
}
101105

102-
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
103-
url += '&realm=' + encodeURIComponent(realm);
104-
url += '&client_id=' + encodeURIComponent(clientId);
105-
url += '&scope=' + encodeURIComponent(scopes);
106+
window.enabledScopes=scopes;
107+
106108

107-
window.open(url);
108-
});
109+
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
110+
url += '&realm=' + encodeURIComponent(realm);
111+
url += '&client_id=' + encodeURIComponent(clientId);
112+
url += '&scope=' + encodeURIComponent(scopeForUrl);
109113

114+
window.open(url);
115+
});
116+
}
110117
popupMask.show();
111118
popupDialog.show();
112119
return;

0 commit comments

Comments
 (0)