server.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. var ProxmoxCloudVps_td1;
  2. var ProxmoxCloudVps_td2;
  3. var ProxmoxCloudVps_accesshash;
  4. var ProxmoxCloudVps_selectAdded = false;
  5. function ProxmoxCloudVps_addSelect(){
  6. var accessTd = $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(0)");
  7. ProxmoxCloudVps_td1 = accessTd.html();
  8. accessTd.html("Authentication");
  9. var accessInput = $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(1)");
  10. ProxmoxCloudVps_td2 = accessInput.html();
  11. accessInput.html("<select name=\"accesshash\"><option value=\"pam\">Linux PAM standard authentication</option><option value=\"pve\">Proxmox VE authentication server</option><option value=\"PVEAPIToken\" hidden>API Tokens</option></select>");
  12. ProxmoxCloudVps_accesshash ? $("select[name='accesshash']").val(ProxmoxCloudVps_accesshash): $("select[name='accesshash']").val("pam")
  13. ProxmoxCloudVps_selectAdded = true;
  14. }
  15. function ProxmoxCloudVps_removeSelect(){
  16. $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(0)").html(ProxmoxCloudVps_td1);
  17. $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(1)").html(ProxmoxCloudVps_td2);
  18. ProxmoxCloudVps_selectAdded = false
  19. }
  20. $(document).ready(function(){
  21. var pc_ServerType = $( "#inputServerType").val();
  22. ProxmoxCloudVps_accesshash = $( "textarea[name='accesshash']").val();
  23. if(pc_ServerType=="ProxmoxCloudVps" || pc_ServerType=="ProxmoxCloudVps"){
  24. ProxmoxCloudVps_addSelect();
  25. }
  26. $( "#inputServerType").change(function(){
  27. pc_ServerType = $( this).val();
  28. if(ProxmoxCloudVps_selectAdded==true && pc_ServerType!="ProxmoxCloudVps" && pc_ServerType!="ProxmoxCloudVps" ){
  29. ProxmoxCloudVps_removeSelect();
  30. }else if(!ProxmoxCloudVps_selectAdded && pc_ServerType=="ProxmoxCloudVps" || pc_ServerType=="ProxmoxCloudVps" ){
  31. ProxmoxCloudVps_addSelect();
  32. }
  33. });
  34. });