Advertisement
xandr91

Q2APHP-PRO send button fix

Aug 29th, 2014
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Replace in media/js/scripts.js
  2. function ask(_0) {
  3.     if(!$("#response0").val()) {
  4.         $("#response0").addClass("highlightRed").focus();
  5.         return;
  6.     }
  7.     $("#response0").removeClass("highlightRed");
  8.     $("#sendButton").attr("disabled", "disabled");
  9.     $(".ask-button-text").hide();
  10.     $("#sendIndicator").show();
  11.     var _1 = $("#askForm").serialize();
  12.     $.ajax({
  13.         url: 'ajax/ask',
  14.         async: true,
  15.         type: "POST",
  16.         data: _1 + "&username="+_0+"&ajax=1",
  17.         success: function(_2){
  18.             if(_2.response == 'success') {
  19.                 $("#response0").hide();
  20.                 $("#success").show();
  21.                 $("#sendButton").removeAttr('disabled');
  22.                 $("#sendIndicator").hide();
  23.                 $(".ask-button-text").show();
  24.             }
  25.             else {
  26.                 $("#sendButton").removeAttr('disabled');
  27.                 $("#sendIndicator").hide();
  28.                 $(".ask-button-text").show();
  29.             }
  30.         },
  31.         error: function (_6) {
  32.             alert('Error: '+_6);
  33.             $("#sendButton").removeAttr('disabled');
  34.             $("#sendIndicator").hide();
  35.             $(".ask-button-text").show();
  36.         }
  37.     });
  38. }
  39. //Into:
  40. function ask(_0) {
  41.     if(!$("#response0").val()) {
  42.         $("#response0").addClass("highlightRed").focus();
  43.         return;
  44.     }
  45.     $("#response0").removeClass("highlightRed");
  46.     $("#sendButton").attr("disabled", "disabled");
  47.     $(".ask-button-text").hide();
  48.     $("#sendIndicator").show();
  49.     var _1 = $("#askForm").serialize();
  50.     $.ajax({
  51.         url: 'ajax/ask',
  52.         async: true,
  53.         type: "POST",
  54.         data: _1 + "&username="+_0+"&ajax=1",
  55.         success: function(_2){
  56.             if(_2.response == 'success') {
  57.                 $("#response0").hide();
  58.                 $("#success").show();
  59.                 $("#sendIndicator").hide();
  60.                 $(".ask-button-text").show();
  61.             }
  62.             else {
  63.                 $("#sendButton").removeAttr('disabled');
  64.                 $("#sendIndicator").hide();
  65.                 $(".ask-button-text").show();
  66.             }
  67.         },
  68.         error: function (_6) {
  69.             alert('Error: '+_6);
  70.             $("#sendButton").removeAttr('disabled');
  71.             $("#sendIndicator").hide();
  72.             $(".ask-button-text").show();
  73.         }
  74.     });
  75. }
  76.  
  77. //And
  78. function askAgain() {
  79.     $("#response0").val('');
  80.     $("#success").hide();
  81.     $("#response0").show();
  82.     $("#response0").focus();
  83. }
  84. //Into
  85. function askAgain() {
  86.     $("#sendButton").removeAttr('disabled');
  87.     $("#response0").val('');
  88.     $("#success").hide();
  89.     $("#response0").show();
  90.     $("#response0").focus();
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement