META-INF.resources.webjars.swagger-ui.5.13.0.swagger-customer.js Maven / Gradle / Ivy
window.theme = "";
$.get('/swagger-customer').then(data => {
data.title && (document.title = data.title);
data.logo && $('.head_logo').attr('href', data.logo);
window.theme = data.theme || 'MONOKAI'
setTimeout(() => {
data.logo && $("img").attr('src', data.logo);
data.url && $("img").parent().attr('href', data.url)
}, 100);
if(data.configUrl){
const ui = SwaggerUIBundle({
url : "https://petstore.swagger.io/v2/swagger.json",
dom_id : '#swagger-ui',
deepLinking : true,
presets : [ SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset ],
plugins : [ SwaggerUIBundle.plugins.DownloadUrl ],
layout : "StandaloneLayout",
configUrl : data.configUrl,
validatorUrl : ""
});
window.ui = ui;
}
$.get('/swagger-themes').then(d => {
d.forEach(item => {
$('#theme-selector ul').append('' + item.description + ' ');
})
d.filter(item => item.name === window.theme).forEach(item => {
changeTheme(item.code, item.name)
})
$('.themes').hide();
})
})
$(function(){
$('.setting-switch').click(()=>{
if($('.setting-switch').text() == "关闭"){
$('.themes').hide();
$('.setting-switch').text("设置主题")
}else{
$('.themes').show();
$('.setting-switch').text("关闭")
}
})
})
function changeTheme(code, value) {
$('#themes').attr('href', "./themes/" + code + ".css")
$('#theme-selector a.active').removeClass('active');
$('#theme_' + value).addClass('active')
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy