<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      使用Beautify.js來美化你的jQuery代碼

      日期:2011/11/15  來源:GBin1.com

      使用程序或者某些工具自動生成的Javascript格式有時候可能會非常糟糕,這個時候如果我們擁有一個可以自動幫助你美化代碼的工具將會非常的給力!今天我們介紹使用Beautify.js來幫助你自動規整jQuery代碼。

      在線演示

      Javascript代碼:

      $(document).ready(function() {
      $('.beautify').each(function()
      {
      console.log(this);
      beautify(this);
      });
      });


      以上代碼查詢DOC中的class為beautify的節點,然后調用beautify。

      HTML

      <B> CSS Code </B>

      <pre>body{color:#fff;font-size:12px}</pre>

      <pre class="beautify">body{color:#fff;font-size:12px}</pre>

      <B> jQuery Code </B>

      <pre>$('#gbin1').html('Just a test for beautify.js, enjoy!').animate({fontSize: "15px"}, 500);</pre>

      <pre class="beautify">$('#gbin1').html('Just a test for beautify.js, enjoy!').animate({fontSize: "15px"}, 500);</pre>


      修改了的beautify(),然后保存為gbbeautify.js,如下:

      var the = {
      beautify_in_progress: false
      };

      // this dummy function alleviates Chrome large string corruption by probably shoveling the corruption bug to some other area
      if (/chrome/.test(navigator.userAgent.toLowerCase())) {
      String.prototype.old_charAt = String.prototype.charAt;
      String.prototype.charAt = function (n) { return this.old_charAt(n); }
      }

      function unpacker_filter(source) {
      var trailing_comments = '';
      var comment = '';
      var found = false;

      do {
      found = false;
      if (/^\s*\/\*/.test(source)) {
      found = true;
      comment = source.substr(0, source.indexOf('*/') + 2);
      source = source.substr(comment.length).replace(/^\s+/, '');
      trailing_comments += comment + "\n";
      } else if (/^\s*\/\//.test(source)) {
      found = true;
      comment = source.match(/^\s*\/\/.*/)[0];
      source = source.substr(comment.length).replace(/^\s+/, '');
      trailing_comments += comment + "\n";
      }
      } while (found);

      return trailing_comments + source;
      }


      function beautify(elem) {
      if (the.beautify_in_progress) return;

      the.beautify_in_progress = true;

      // var source = $('#source').val();
      var source = $(elem).html();

      var indent_size = $('#tabsize').val();
      var indent_char = indent_size == 1 ? '\t' : ' ';
      var preserve_newlines = $('#preserve-newlines').attr('checked');
      var keep_array_indentation = $('#keep-array-indentation').attr('checked');
      var brace_style = $('#brace-style').val();

      if ($('#detect-packers').attr('checked')) {
      source = unpacker_filter(source);
      }

      var comment_mark = '<-' + '-';
      var opts = {
      indent_size: indent_size,
      indent_char: indent_char,
      preserve_newlines:preserve_newlines,
      brace_style: brace_style,
      keep_array_indentation:keep_array_indentation,
      space_after_anon_function:true};

      if (source && source[0] === '<' && source.substring(0, 4) !== comment_mark) {
      $(elem).html(
      style_html(source, opts)
      );
      } else {
      var v = js_beautify(unpacker_filter(source), opts);
      $(elem).html(v);
      }

      the.beautify_in_progress = false;
      }


      原文來自:使用Beautify.js來美化你的jQuery代碼

      posted @ 2011-11-15 17:34  igeekbar  閱讀(8848)  評論(0)    收藏  舉報

      中文互聯: GBin1.com | RSS訂閱 | 郵件訂閱 | 手機訂閱

      主站蜘蛛池模板: 亚洲精品日韩精品久久| 蜜臀久久综合一本av| 51午夜精品免费视频| 在线a级毛片无码免费真人| 国产精品久久久久影院色| 欧美国产精品不卡在线观看| 乐业县| 人妻熟女一二三区夜夜爱| 亚洲第一极品精品无码久久| 亚洲爆乳精品无码一区二区| 成人一区二区三区激情视频| 二区中文字幕在线观看| 国产一区二区三区内射高清| 亚洲精品国产av成人网| 久久精品不卡一区二区| 最新高清无码专区| 人妻少妇偷人精品免费看| 国产一区二区一卡二卡| 无码人妻视频一区二区三区| 成人伊人青草久久综合网| 欧洲中文字幕一区二区| 国产在线精品无码二区| 人人澡人人透人人爽| 人妻夜夜爽天天爽三区麻豆av| 免费无码黄十八禁网站| xxxx丰满少妇高潮| 久久香蕉国产线看观看精品yw| 中文字幕结果国产精品| 欧美日韩精品一区二区三区高清视频| 凸凹人妻人人澡人人添| 无码一区二区三区视频| 加勒比中文字幕无码一区| 丰台区| 少妇人妻偷人精品免费| 久久夜色精品国产亚av| 欧美精品国产综合久久| 日韩乱码卡一卡2卡三卡四| 美女又黄又免费的视频| 亚洲av综合久久成人网| 色综合久久人妻精品日韩| 日韩精品一区二区三区激情视频 |