1$(function () { 2 var CarouselInline = Backbone.View.extend({ 3 el: '.carousel-inline', 4 initialize: function () { 5 this.controls = { 6 left: this.$el.find('[data-control="left"]'), 7 right: this.$el.find('[data-control="right"]') 8 }; 9 10 var 11 width = 0, 12 root = this.$el.find('.carousel-inline-img'); 13 this.img = { 14 root: root, 15 el: root.children() 16 }; 17 18 _.each(this.img.el, function (value) { 19 width += $(value).outerWidth(true); 20 }); 21 22 if (width < this.$el.find('.carousel-inline-wrap').width()) { 23 // ÐÑли вÑе ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð²Ð¼ÐµÑаÑÑÑÑ, добавим пÑÑÑÑе обÑабоÑÑики пÑи клике на кнопки впÑаво/влево 24 $('.carousel-inline-control').click(function(e) { e.preventDefault() }); 25 return; 26 } 27 this.img.root.width(width); 28 29 this.controls.left.bind('click', $.proxy(this.prev, this)); 30 this.controls.right.bind('click', $.proxy(this.next, this)); 31 }, 32 next: function () { 33 var sorted = this.sort(true); 34 this.detach(sorted); 35 36 return false; 37 }, 38 prev: function () { 39 var sorted = this.sort(false); 40 this.detach(sorted); 41 42 return false; 43 }, 44 detach: function (sorted) { 45 this.img.el.detach(); 46 this.img.root.append(sorted); 47 this.img.el = this.img.root.children(); 48 }, 49 sort: function (next) { 50 var count = true === next ? 0 : this.img.el.length - 1; 51 return _.sortBy(this.img.el, function (value, key) { 52 if (true === next) { 53 return count === key; 54 } else { 55 if (count === key) { 56 return value 57 } 58 } 59 }); 60 } 61 }); 62 63 new CarouselInline; 64});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.