Release v2.2.0
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
// API source form visibility helpers.
|
||||
|
||||
(function () {
|
||||
var form = document.getElementById('api-source-form');
|
||||
if (!form) {
|
||||
return;
|
||||
}
|
||||
|
||||
var methodSelect = form.querySelector('[data-api-source-auth-method]');
|
||||
var authDetailsSection = form.querySelector('[data-api-source-auth-details-section]');
|
||||
var panels = Array.prototype.slice.call(form.querySelectorAll('[data-api-source-auth-panel]'));
|
||||
|
||||
function updatePanels() {
|
||||
var method = String(methodSelect && methodSelect.value || 'none').trim();
|
||||
var hasAuth = method !== 'none';
|
||||
|
||||
if (authDetailsSection) {
|
||||
authDetailsSection.hidden = !hasAuth;
|
||||
}
|
||||
|
||||
panels.forEach(function (panel) {
|
||||
var panelMethod = String(panel.getAttribute('data-api-source-auth-panel') || '').trim();
|
||||
panel.hidden = !hasAuth || panelMethod !== method;
|
||||
});
|
||||
}
|
||||
|
||||
if (methodSelect) {
|
||||
methodSelect.addEventListener('change', updatePanels);
|
||||
}
|
||||
|
||||
updatePanels();
|
||||
}());
|
||||
Reference in New Issue
Block a user