install.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. (function($,History){
  2. var State = History.getState(),
  3. returnToIndex = function(){
  4. History.replaceState({},'Bugs','..');
  5. location = '..';
  6. };
  7. $(document).ready(function(){
  8. if($.isEmptyObject(State.data)){
  9. History.replaceState({
  10. type: 'install',
  11. id: 'config'
  12. },'Bugs');
  13. }
  14. $(window).on('statechange',function(){
  15. State = History.getState();
  16. $.get('api.php',State.data,function(d){
  17. $('body').html(d);
  18. $('#config').submit(function(){
  19. $('#install').attr('disabled','disabled');
  20. $.get('api.php?'+$("#config").serialize()+'&dbtemplate=install&type=install&id=run',function(d){
  21. if(d != "pass"){
  22. alert(d);
  23. $('#install').removeAttr('disabled');
  24. }else{
  25. if(confirm("Installation successful!\nDo you want to delete the installation files?")){
  26. $.get('api.php?&dbtemplate=install&type=install&id=cleanup',function(d){
  27. returnToIndex();
  28. });
  29. }else{
  30. returnToIndex();
  31. }
  32. }
  33. },'text');
  34. return false;
  35. });
  36. },'html');
  37. }).trigger('statechange');
  38. });
  39. })(jQuery,History);