ソースを参照

Format the code.

zhixin 10 年 前
コミット
5270ffff47

+ 5 - 5
src/bootstrap-table.css

@@ -13,11 +13,11 @@
 
 .bootstrap-table
 .table,
-.table>tbody>tr>th,
-.table>tfoot>tr>th,
-.table>thead>tr>td,
-.table>tbody>tr>td,
-.table>tfoot>tr>td {
+.table > tbody > tr > th,
+.table > tfoot > tr > th,
+.table > thead > tr > td,
+.table > tbody > tr > td,
+.table > tfoot > tr > td {
     padding: 8px !important;
 }
 

+ 79 - 79
src/bootstrap-table.js

@@ -585,14 +585,14 @@
             });
 
         if (addedFilterControl) {
-            this.$header.off('keyup', 'input').on('keyup' , 'input', function (event) {
+            this.$header.off('keyup', 'input').on('keyup', 'input', function (event) {
                 clearTimeout(timeoutId);
                 timeoutId = setTimeout(function () {
                     that.onColumnSearch(event);
                 }, that.options.searchTimeOut);
             });
 
-            this.$header.off('change', 'select').on('change' , 'select', function (event) {
+            this.$header.off('change', 'select').on('change', 'select', function (event) {
                 clearTimeout(timeoutId);
                 timeoutId = setTimeout(function () {
                     that.onColumnSearch(event);
@@ -604,7 +604,7 @@
     };
 
     BootstrapTable.prototype.initFooter = function () {
-        this.$footer =  this.$container.find('.fixed-table-footer');
+        this.$footer = this.$container.find('.fixed-table-footer');
         if (!this.options.showFooter || this.options.cardView) {
             this.$footer.hide();
         } else {
@@ -907,7 +907,7 @@
         if (this.options.sidePagination !== 'server') {
             var s = this.searchText && this.searchText.toLowerCase();
             var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
-            var fp = $.isEmptyObject(this.filterColumnsPartial) ? null: this.filterColumnsPartial;
+            var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
 
             // Check filter
             this.data = f ? $.grep(this.options.data, function (item, i) {
@@ -928,7 +928,7 @@
                         that.header.formatters[$.inArray(key, that.header.fields)],
                         [value, item, i], value);
 
-                    if (! ($.inArray(key, that.header.fields) !== -1 &&
+                    if (!($.inArray(key, that.header.fields) !== -1 &&
                         (typeof value === 'string' || typeof value === 'number') &&
                         (value + '').toLowerCase().indexOf(fval) !== -1)) {
                         return false;
@@ -1039,7 +1039,7 @@
             pageList = [];
             $.each(list, function (i, value) {
                 pageList.push(value.toUpperCase() === that.options.formatAllRows().toUpperCase() ?
-                                that.options.formatAllRows() : +value);
+                    that.options.formatAllRows() : +value);
             });
         }
 
@@ -1048,7 +1048,7 @@
                 var active;
                 if ($allSelected) {
                     active = page === that.options.formatAllRows() ? ' class="active"' : '';
-                } else{
+                } else {
                     active = page === that.options.pageSize ? ' class="active"' : '';
                 }
                 pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
@@ -1157,7 +1157,7 @@
 
         $this.parent().addClass('active').siblings().removeClass('active');
         this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ?
-                                    this.options.formatAllRows() : +$this.text();
+            this.options.formatAllRows() : +$this.text();
         this.$toolbar.find('.page-size').text(this.options.pageSize);
 
         this.updatePagination(event);
@@ -1342,10 +1342,10 @@
                                     .text(''));
 
                                 selectControl.append($("<option></option>")
-                                    .attr("value",value)
+                                    .attr("value", value)
                                     .text(value));
                             } else {
-                                for (; iOpt < options.length; iOpt++ ) {
+                                for (; iOpt < options.length; iOpt++) {
                                     if (options[iOpt].value === value) {
                                         exitsOpt = true;
                                         break;
@@ -1354,7 +1354,7 @@
 
                                 if (!exitsOpt) {
                                     selectControl.append($("<option></option>")
-                                        .attr("value",value)
+                                        .attr("value", value)
                                         .text(value));
                                 }
                             }
@@ -1539,64 +1539,64 @@
     };
 
     BootstrapTable.prototype.initKeyEvents = function () {
-      if (this.options.keyEvents) {
-          var that = this;
-          $(document).off('keypress').on('keypress', function (e) {
-              var $search = that.$toolbar.find('.search input'),
-                  $refresh = that.$toolbar.find('button[name="refresh"]'),
-                  $toggle= that.$toolbar.find('button[name="toggle"]'),
-                  $paginationSwitch = that.$toolbar.find('button[name="paginationSwitch"]');
-              switch (e.keyCode) {
-                  case 115://s
-                  case 83://S
-                      if (!that.options.search) {
-                          return;
-                      }
-
-                      if(document.activeElement === $search.get(0)){
-                          return true;
-                      }
-                      $search.focus();
-                      return false;
-                  case 114: //r
-                  case 82: //R
-                      if (!that.options.showRefresh) {
-                          return;
-                      }
-
-                      if(document.activeElement === $search.get(0)){
-                          return true;
-                      }
-                      $refresh.click();
-                      return false;
-                  case 116: //t
-                  case 84: //T
-                      if (!that.options.showToggle) {
-                          return;
-                      }
-
-                      if(document.activeElement === $search.get(0)){
-                          return true;
-                      }
-
-                      $toggle.click();
-                      return false;
-                  case 112: //p
-                  case 80: //p
-                      if (!that.options.showPaginationSwitch) {
-                          return;
-                      }
-
-                      if(document.activeElement === $search.get(0)){
-                          return true;
-                      }
-
-                      $paginationSwitch.click();
-                      return false;
-
-              }
-          });
-      }
+        if (this.options.keyEvents) {
+            var that = this;
+            $(document).off('keypress').on('keypress', function (e) {
+                var $search = that.$toolbar.find('.search input'),
+                    $refresh = that.$toolbar.find('button[name="refresh"]'),
+                    $toggle = that.$toolbar.find('button[name="toggle"]'),
+                    $paginationSwitch = that.$toolbar.find('button[name="paginationSwitch"]');
+                switch (e.keyCode) {
+                    case 115://s
+                    case 83://S
+                        if (!that.options.search) {
+                            return;
+                        }
+
+                        if (document.activeElement === $search.get(0)) {
+                            return true;
+                        }
+                        $search.focus();
+                        return false;
+                    case 114: //r
+                    case 82: //R
+                        if (!that.options.showRefresh) {
+                            return;
+                        }
+
+                        if (document.activeElement === $search.get(0)) {
+                            return true;
+                        }
+                        $refresh.click();
+                        return false;
+                    case 116: //t
+                    case 84: //T
+                        if (!that.options.showToggle) {
+                            return;
+                        }
+
+                        if (document.activeElement === $search.get(0)) {
+                            return true;
+                        }
+
+                        $toggle.click();
+                        return false;
+                    case 112: //p
+                    case 80: //p
+                        if (!that.options.showPaginationSwitch) {
+                            return;
+                        }
+
+                        if (document.activeElement === $search.get(0)) {
+                            return true;
+                        }
+
+                        $paginationSwitch.click();
+                        return false;
+
+                }
+            });
+        }
     };
 
     BootstrapTable.prototype.getCaretHtml = function () {
@@ -1665,8 +1665,8 @@
             return;
         }
         $fixedHeader = that.$container.find('.fixed-table-header'),
-        $fixedBody = that.$container.find('.fixed-table-body'),
-        scrollWidth = that.$el.width() > $fixedBody.width() ? getScrollBarWidth() : 0;
+            $fixedBody = that.$container.find('.fixed-table-body'),
+            scrollWidth = that.$el.width() > $fixedBody.width() ? getScrollBarWidth() : 0;
 
         that.$header_ = that.$header.clone(true, true);
         that.$selectAll_ = that.$header_.find('[name="btSelectAll"]');
@@ -1703,7 +1703,7 @@
 
         $.each(this.options.columns, function (i, column) {
             var falign = '', // footer align style
-                style  = '',
+                style = '',
                 class_ = sprintf(' class="%s"', column['class']);
 
             if (!column.visible) {
@@ -1727,7 +1727,7 @@
         this.$footer.find('tr').html(html.join(''));
         clearTimeout(this.timeoutFooter_);
         this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this),
-            this.$el.is(':hidden') ? 100: 0);
+            this.$el.is(':hidden') ? 100 : 0);
     };
 
     BootstrapTable.prototype.fitFooter = function () {
@@ -1743,8 +1743,8 @@
             return;
         }
 
-        $fixedBody  = this.$container.find('.fixed-table-body');
-        elWidth     = this.$el.css('width');
+        $fixedBody = this.$container.find('.fixed-table-body');
+        elWidth = this.$el.css('width');
         scrollWidth = elWidth > $fixedBody.width() ? getScrollBarWidth() : 0;
 
         this.$footer.css({
@@ -1754,7 +1754,7 @@
 
         $footerTd = this.$footer.find('td');
 
-        $fixedBody.find('tbody tr:first-child:not(.no-records-found) > td').each(function(i) {
+        $fixedBody.find('tbody tr:first-child:not(.no-records-found) > td').each(function (i) {
             $footerTd.eq(i).outerWidth($(this).outerWidth());
         });
     };
@@ -1784,12 +1784,12 @@
 
     BootstrapTable.prototype.toggleRow = function (index, isIdField, visible) {
         if (index === -1) {
-           return;
+            return;
         }
 
-        $(this.$body[0]).children().filter(sprintf( isIdField ? '[value="%s"]' : '[data-index="%s"]', index))
+        $(this.$body[0]).children().filter(sprintf(isIdField ? '[value="%s"]' : '[data-index="%s"]', index))
             [visible ? 'show' : 'hide']();
-     };
+    };
 
     // PUBLIC FUNCTION DEFINITION
     // =======================

+ 11 - 11
src/extensions/cookie/bootstrap-table-cookie.js

@@ -1,20 +1,20 @@
 /**
-* @author: Dennis Hernández
-* @webSite: http://djhvscf.github.io/Blog
-* @version: v1.0.0
-*
-* @update zhixin wen <wenzhixin2010@gmail.com>
-*/
+ * @author: Dennis Hernández
+ * @webSite: http://djhvscf.github.io/Blog
+ * @version: v1.0.0
+ *
+ * @update zhixin wen <wenzhixin2010@gmail.com>
+ */
 
 (function ($) {
     'use strict';
 
     var idsStateSaveList = {
-            sortOrder: 'bs.table.sortOrder',
-            sortName: 'bs.table.sortName',
-            pageNumber: 'bs.table.pageNumber',
-            pageList: 'bs.table.pageList',
-            columns: 'bs.table.columns'
+        sortOrder: 'bs.table.sortOrder',
+        sortName: 'bs.table.sortName',
+        pageNumber: 'bs.table.pageNumber',
+        pageList: 'bs.table.pageList',
+        columns: 'bs.table.columns'
     };
 
     var cookieEnabled = function () {