破解javascript - 格式化工具不会修复它。导致前一段代码中断

时间:2012-02-27 17:44:57

标签: javascript

尽管我希望有人说“改变这行代码来阅读......”,但我真的想知道Firefox没有报告破解代码的问题的解决方案。此代码块被破坏,导致前一个代码块中断。它位于notdupe.live.click函数中的某个位置。我可以注释掉整个函数,其余代码也可以。我试过评论片断但不能隔离问题。

<script type="text/javascript">     
        var SaveDupeGroup = 0;
        var DupeCount = 0;
        var ReInitAnswer = '';
        var RemoveAnswer = '';

        $(document).ready(function () {
          $('.StartOver').live('click', function () {
            ReInitAnswer = confirm('Are you sure you want TO DELETE ALL temp dupe records AND start over FROM SCRATCH? \nIt may take a couple OF hours.');
            if (ReInitAnswer) {
              // submit the form TO BEGIN re-creating the temp table
              document.forms["dupeIndivs"].submit(); //return true;
            } else {
              alert('canceled');
              return false;
            }
          });
          $('.notdupe').live('click', function (e) {
            $.ajax({
              type: "POST",
              url: "cfc/basic.cfc?method=SetNotDupe",
              data: "indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"),
              error: function (xhr, textStatus, errorThrown) {
                // show error
                alert(errorThrown);
              },
              success: function (response1, textStatus, jqXHR)(
              if ($(e.target).is(":checked")) {
                $firstTD = $(this).parent().siblings().first();
                SaveDupeGroup = $firstTD.text();
                $.ajax({
                  type: 'GET',
                  url: 'cfc/basic.cfc?method=CheckDupeGroup&returnformat=json',
                  dataType: 'json',
                  data: 'DupeGroupNumber=' + $firstTD.text(),
                  error: function (xhr, textStatus, errorThrown) {
                    // show error
                    alert(errorThrown);
                  },
                  success: function (response, textStatus, jqXHR) {
                    DupeCount = response.DATA[0];
                    alert('Dupe Group-' + SaveDupeGroup + ' count=' + response.DATA[0]);
                    if (DupeCount) {
                      alert('huh?');
                    } else {
                      RemoveAnswer = confirm('All of the names in this group have been checked.\nDo you want to remove them from the lists?');
                      if (RemoveAnswer) {
                        alert('continued');
                      } else {
                        alert('canceled');
                        return false;
                      }
                    }
                  }
                });
              })
            });
          });
        });
    </script>

2 个答案:

答案 0 :(得分:2)

第26行,function()(应为function(){,因此你可能需要调查你的结束}

您是否尝试使用jshintjslint

检查代码

答案 1 :(得分:2)

你有一个SyntaxError。

此...

success: function (response1, textStatus, jqXHR)(

应该是这个......

success: function (response1, textStatus, jqXHR) {

colose )也应为}

不确定为什么Firefox(Firebug?)不报告它。