@gremlin5

JQuery code should be do?Tell me about #?

<script type="text/javascript">
      jQuery(document).ready(function($) {
        $(".trac-autofocus").focus();
        $(".trac-target-new").attr("target", "_blank");
        setTimeout(function() { $(".trac-scroll").scrollToTop() }, 1);
        $(".trac-disable-on-submit").disableOnSubmit();
      });
    </script>

<script type="text/javascript">
      jQuery(document).ready(function($) {
        $("div.description").find("h1,h2,h3,h4,h5,h6").addAnchor(_("Link to this section"));
        $(".foldable").enableFolding(false, true);
      /*<![CDATA[*/
        $("#attachments").toggleClass("collapsed");
        $("#trac-up-attachments").click(function () {
          $("#attachments").removeClass("collapsed");
          return true;
        });
        $("#modify").parent().toggleClass("collapsed");
        $(".trac-topnav a").click(function() { $("#modify").parent().removeClass("collapsed"); });
        /* only enable control elements for the currently selected action */
        var actions = $("#action input[name='action']");
        function updateActionFields() {
          actions.each(function () {
            $(this).siblings().find("*[id]").enable($(this).checked());
            $(this).siblings().filter("*[id]").enable($(this).checked());
          });
        }
        actions.click(updateActionFields);
        updateActionFields();
        function setRevertHandler() {
          $("button.trac-revert").click(function() {
            var div = $("div", this);
            var field_name = div[0].id.substr(7);
            var field_value = div.text();
            var input = $("#propertyform *[name=field_" + field_name + "]");
            if (input.length > 0) {
              if (input.filter("input[type=radio]").length > 0) {
                input.val([field_value]);
              } else if (input.filter("input[type=checkbox]").length > 0) {
                input.val(field_value == "1" ? [field_value] : []);
              } else {
                input.val(field_value);
              }
            } else { // Special case for CC checkbox
              input = $("#propertyform input[name=cc_update]").val([]);
            }
            input.change();
            $(this).closest("li").remove();
            return false;
          });
        }
        setRevertHandler();
        var comment_focused = false;
        $("#comment").focus(function() { comment_focused = true; })
                     .blur(function() { comment_focused = false; });
        $("#propertyform").autoSubmit({preview: '1'}, function(data, reply) {
          var items = $(reply);
          // Update ticket box
          $("#ticket").replaceWith(items.filter('#ticket'));
          // Unthread, unrevert and update changelog
          if (!$('#trac-comments-oldest').checked())
            $('#trac-comments-oldest').click().change();
          $("#changelog").replaceWith(items.filter("#changelog"));
          if ($('#trac-comments-only-toggle').attr('checked'))
            $('#trac-comments-only-toggle').click().attr('checked', true);
          // Show warning
          var new_changes = $("#changelog .trac-new");
          $("#trac-edit-warning").toggle(new_changes.length != 0);
          if (new_changes.length != 0)
            $("#changelog").parent().show().removeClass("collapsed");
          // Update view time
          $("#propertyform input[name='view_time']").replaceWith(items.filter("input[name='view_time']"));
          // Update preview
          var preview = $("#ticketchange").html(items.filter('#preview').children());
          var show_preview = preview.children().length != 0;
          $("#ticketchange").toggle(show_preview);
          setRevertHandler();
          // Collapse property form if comment editor has focus
          if (show_preview && comment_focused)
            $("#modify").parent().addClass("collapsed");
        }, "#ticketchange .trac-loading");
        $("#trac-comment-editor").autoSubmit({preview_comment: '1'}, function(data, reply) {
          var comment = $("#trac-comment-editor").next("div.comment").html(reply);
          comment.toggle(comment.children().length != 0);
        }, "#changelog .trac-loading");
        /*]]>*/
      });
    </script>
  • Вопрос задан
  • 145 просмотров
Пригласить эксперта
Ответы на вопрос 1
@GreatRash
1) Your JS-code pretty old, in modern browsers you don't need those type="text/javascript" and <![CDATA[, unless you are using something like IE6.
2) # symbol in jQuery-code means exacly the same as in CSS-code - an id of DOM-element.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы