/** * On mouseover change the password input to text and change back * * @type {HTMLElement} */ let snapForm = document.getElementById('tabs'); if (snapForm) { /* * Find all input fields in 'tabs' div. */ let inputs = snapForm.getElementsByTagName('input'); for (let i=0; iAPI Key ist leer.'); return; } let url = 'index.php?module=snapaddy&action=apicheck'; resultField .attr('class', '') .html('Lädt ...'); $.post(url, {key: key}) .done(function(msg, status, xhr){ console.log(msg, status, xhr); console.warn(msg.key); console.warn(msg.class); if (msg.key && msg.class) { resultField.append('' + msg.key + ''); resultField .attr('class', msg.class) .html(msg.key); } else { resultField .attr('class', 'api_fail') .html('Server Fehler'); } }) .fail(function(xhr, status, error) { resultField .attr('class', 'api_fail') .html('Der Test schlug fehl.'); console.error(status, error, xhr); }); }); $('#browser-reset').click(function (e) { e.preventDefault(); if(!confirm("Nach der Erneuerung des Authorization-Headers muss dieser noch einmal im snapADDY-Grabber Browser-Plugin eingetragen werden.\n\nSind Sie sicher, dass der Authorization-Header trotzdem erneuert werden soll?")) { return false; } console.log('reset auth header'); let inputField = $('#browser-key'); let oldKey = inputField.val(); let url = 'index.php?module=snapaddy&action=newheader'; $.post(url, {}) .done(function(msg, status, xhr){ if (oldKey === msg.key) { inputField.html('reset auth header failed: same header'); console.error('reset auth header failed: same header'); } inputField.val(msg.key); }) .fail(function(xhr, status, error) { inputField.html('Reset schlug fehl.'); console.error(status, error, xhr); }); });