(function() { let formatPassword = function(data) { let dest$ = $('#passwordOut'); let html = new EJS({url: '/template/password.ejs'}).render(data); dest$.empty(); dest$.append(html); dest$.show(); }; let generatePassword = function(from, to) { let url = '/generate'; $.ajax({ type: 'GET', url: url, data: '', dataType: 'json', timeout: 10000, headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type' }, success: function(data) { formatPassword(data); }, error: function(xhr, type) { console.log('ajax error'); console.log(xhr); console.log(type); } }); }; $('#newPassword').on('click', function() { generatePassword(); }); document.title = 'Slack'; })(); let popitout = function(url) { let newwindow = window.open(url, 'name', 'height=600,width=570'); if (window.focus) { newwindow.focus(); } return false; }; let popitoutSmall = function(url) { let newwindow = window.open(url, 'name', 'height=400,width=520'); if (window.focus) { newwindow.focus(); } return false; };