anchor.diff:  
                               e.preventDefault();
                           });
  -                    });
  +
  +                        $("#fileinput").change(function () {
  +                            refreshTable();
  +                        });
  +
  +                        $("#filereset").click(function (e) {
  +                            e.preventDefault();
  +                            $(this).parents("form:first")[0].reset();
  +                            refreshTable();
  +                        });
  +
  +
  +                        $("#xml").on('load keyup keypress paste', function () {
  +                            $("#mathml-preview").html($(this).val());
  +                            MathJax.Hub.Queue(["Typeset", MathJax.Hub, "mathml-preview"]);
  +                        }).trigger("keyup");
  +
  +                        $("#btnCanon").click(function () {
  +                            $.ajax({
  +                                type: "Get",
  +                                url: $('#canonicalizeForm').attr('action'),
  +                                data: $('#canonicalizeForm').serialize(),
  +                                dataType: 'text',
  +                                success: function (response) {
  +                                    showTooltip("<spring:message code="entity.formula.started" />", true);
  +                                },
  +                                error: function (response) {
  +                                    showTooltip("<spring:message code="entity.formula.crashed" />", false);
  +                                }
  +                            });
  +                        });
  +                        
  +                        $('#inputFilter').tooltip({
  +                            'title': "<spring:message code="general.hint.filter" />",
  +                            'placement': 'right',
  +                            'container': 'body'
  +                        });
  +
  +            <c:if test="${not empty statistics}">
  +                        $(function () {
  +
  +                            var data = [["isValid", <c:out value="${statistics.totalValid}" />],
  +                                ["isInvalid", <c:out value="${statistics.totalInvalid}" />],
  +                                ["uncertain", <c:out value="${statistics.totalUncertain}" />],
  +                                ["removeResult", <c:out value="${statistics.totalRemove}" />]];
  +
  +                            $.plot("#flot-placeholder", [data], {
  +                                series: {
  +                                    bars: {
  +                                        show: true,
  +                                        barWidth: 0.6,
  +                                        align: "center"
  +                                    }
  +                                },
  +                                xaxis: {
  +                                    mode: "categories",
  +                                    tickLength: 0
  +                                }
  +                            });
  +                        });
  +            </c:if>
  +
  +
  +            <c:if test="${massDelete eq true}">
  +                        $(".img-thumbnail").on('click', function (e) {
  +
  +                            if ($(this).hasClass('formula-select-checked')) {
  +                                $(this).removeClass('formula-select-checked');
  +                                $(this).children(':checkbox').first().attr('checked', false);
  +
  +                            } else {
  +                                $(this).addClass('formula-select-checked');
  +                                $(this).children(':checkbox').first().attr('checked', true);
  +                            }
  +
  +                            e.preventDefault();
  +                        });
  +            </c:if>
  +
  +            <c:if test="${massCanonicalize eq true}">
  +                        var fetchFormulaIds = function (prefix, entityId) {
  +                            $.ajax({
  +                                type: 'GET',
  +                                url: prefix + entityId,
  +                                dataType: 'json',
  +                                async: true,
  +                                success: function (result) {
  +                                    $.each(result, function (i, id) {
  +                                        $("#apprun-input-formulas").append(id + " ");
  +                                    });
  +                                }
  +                            });
  +                        };
  +
  +                        $(".apprun-input-add#source-document").click(function (e) {
  +                            fetchFormulaIds("${pageContext.request.contextPath}/formula/bySourceDocument/", $("#apprun-sourcedocument-id").val());
  +                            e.preventDefault();
  +                        });
  +                        $(".apprun-input-add#conversion-program").click(function (e) {
  +                            fetchFormulaIds("${pageContext.request.contextPath}/formula/byProgram/", $("#apprun-program-id").val());
  +                            e.preventDefault();
  +                        });
  +
  +                        $(".apprun-input-option").click(function (e) {
  +                            var method = $(this).attr('data-apprun-input');
  +                            var className = "apprun-input-method";
  +                            var theDiv = $('#' + method + '.' + className);
  +
  +                            theDiv.siblings('.' + className).css('display', 'none');
  +                            theDiv.css('display', 'block');
  +                            $("#apprun-input-button").html($(this).html() + '<span class="caret"></span>');
  +                            //e.preventDefault();
  +                        });
  +                        $(".img-thumbnail").on('click', function (e) {
  +
  +                            if ($(this).hasClass('formula-select-checked')) {
  +                                $(this).removeClass('formula-select-checked');
  +                                $(this).children(':checkbox').first().attr('checked', false);
  +                            } else {
  +                                $(this).addClass('formula-select-checked');
  +                                $(this).children(':checkbox').first().attr('checked', true);
  +                            }
  +
  +                            e.preventDefault();
  +                        });
  +            </c:if>
  +
  +                    });//document.ready end
  +
  +                    function diffView() {
  +                        var byId = function (id) {
  +                            return document.getElementById(id);
  +                        },
  +                                base = difflib.stringAsLines(MathJax.Hub.getJaxFor(byId("MathJax-Element-2")).originalText),
  +                                newtxt = difflib.stringAsLines(MathJax.Hub.getJaxFor(byId("MathJax-Element-1")).originalText),
  +                                sm = new difflib.SequenceMatcher(base, newtxt),
  +                                opcodes = sm.get_opcodes(),
  +                                diffoutputdiv = byId("diff");
  +
  +                        diffoutputdiv.innerHTML = "";
  +                        diffoutputdiv.appendChild(diffview.buildView({
  +                            baseTextLines: base,
  +                            newTextLines: newtxt,
  +                            opcodes: opcodes,
  +                            baseTextName: "<spring:message code="entity.canonicOutput.original" />",
  +                            newTextName: "<spring:message code="entity.canonicOutput.outputForm" />",
  +                            viewType: 0
  +                        }));
  +                    }
  +
  +                    function showTooltip(data, close)
  +                    {
  +                        $('#btnCanon')
  +                                .tooltip({
  +                                    title: data,
  +                                    trigger: 'manual',
  +                                    placement: 'top'
  +                                }).attr('data-original-title', data).tooltip('fixTitle').tooltip('show');
  +                        setTimeout(function () {
  +                            $('#btnCanon').tooltip('hide');
  +                            if (close) {
  +                                $('#canonModal').modal('hide');
  +                            }
  +                        }, 2000);
  +                    }
  +
  +                    function refreshTable()
  +                    {
  +                        $("#uploads-table").empty();
  +                        for (var i = 0; i < $("#fileinput").prop('files').length; ++i) {
  +                            $("#uploads-table").append('<tr><td>' + $("#fileinput").prop('files')[i].name + '</td><td>' + $("#fileinput").prop('files')[i].size + '</td></tr>');
  +                        }
  +                    }
   
                       function getUserRolesHTML()
                       {
  
positive.code:                         }
                      }
          </script>
          <script>
              function refreshTable()
              {
                  $("#uploads-table").empty();
                  for (var i = 0; i < $("#fileinput").prop('files').length; ++i) {
                      $("#uploads-table").append('<tr><td>' + $("#fileinput").prop('files')[i].name + '</td><td>' + $("#fileinput").prop('files')[i].size + '</td></tr>');
                  }
              }
              ;
              $(document).ready(function () {
                  $("#fileinput").change(function () {
                      refreshTable();
                  });
                  $("#filereset").click(function (e) {
                      e.preventDefault();
                      $(this).parents("form:first")[0].reset();
                      refreshTable();
                  });
              });
          </script>
          <script>
              $(document).ready(function () {
                  $("#xml").on('load keyup keypress paste', function () {
                      $("#mathml-preview").html($(this).val());
                      MathJax.Hub.Queue(["Typeset", MathJax.Hub, "mathml-preview"]);
                  }).trigger("keyup");
              });
          </script>
          <script>
              function showTooltip(data, close)
              {
                  $('#btnCanon')
                          .tooltip({
                              title: data,
                              trigger: 'manual',
                              placement: 'top'
                          }).attr('data-original-title', data).tooltip('fixTitle').tooltip('show');
                  setTimeout(function () {
                      $('#btnCanon').tooltip('hide');
                      if (close) {
                          $('#canonModal').modal('hide');
                      }
                  }, 2000);
              }
              $(document).ready(function () {
                  $("#btnCanon").click(function () {
                      $.ajax({
                          type: "Get",
                          url: $('#canonicalizeForm').attr('action'),
                          data: $('#canonicalizeForm').serialize(),
                          dataType: 'text',
                          success: function (response) {
                              showTooltip("<spring:message code="entity.formula.started" />", true);
                          },
                          error: function (response) {
                              showTooltip("<spring:message code="entity.formula.crashed" />", false);
                          }
                      });
                  });
              });
          </script>
          <script type="text/javascript">
              function diffView() {
                  var byId = function (id) {
                      return document.getElementById(id);
                  },
                          base = difflib.stringAsLines(MathJax.Hub.getJaxFor(byId("MathJax-Element-2")).originalText),
                          newtxt = difflib.stringAsLines(MathJax.Hub.getJaxFor(byId("MathJax-Element-1")).originalText),
                          sm = new difflib.SequenceMatcher(base, newtxt),
                          opcodes = sm.get_opcodes(),
                          diffoutputdiv = byId("diff");
  
                  diffoutputdiv.innerHTML = "";
                  diffoutputdiv.appendChild(diffview.buildView({
                      baseTextLines: base,
                      newTextLines: newtxt,
                      opcodes: opcodes,
                      baseTextName: "<spring:message code="entity.canonicOutput.original" />",
                      newTextName: "<spring:message code="entity.canonicOutput.outputForm" />",
                      viewType: 0
                  }));
              }
          </script>
  
          <script>
  
              $('#inputFilter').tooltip({
                  'title': "<spring:message code="general.hint.filter" />",
                  'placement': 'right',
                  'container': 'body'
              });
          </script>
      </body>
  </html>
  
  
negative.code: 
                      SyntaxHighlighter.all();
  
                      //document.ready start
                      $(document).ready(function () {
                          $(".elementList").select2();
  
  