1//Componente de destaques Matriz 2 baseado no MatrizCarousel.js, desenvolvido pelo Fabrizio para o Detran 2(function (window, $) { 3 4 var oldCycle, MatrizCarousel; 5 oldCycle = $.fn.carousel.Constructor.prototype.cycle; 6 $.fn.carousel.Constructor.prototype.cycle = function (e) { 7 this.$element.trigger('cycle', [this.sliding]); 8 return oldCycle.call(this, e); 9 }; 10 11 MatrizCarousel = function (container) { 12 if (!(container instanceof $)) { 13 throw 'Container deve ser um instancia do jQuery'; 14 } 15 this.container = container; 16 this.window || (this.window = $(window)); 17 this.carousel || (this.carousel = this.container.find('.carousel[data-ride="carousel"]')); 18 this.pausePlayButton || (this.pausePlayButton = this.container.find('[data-target="matriz-carousel-pause-play"]')); 19 this.captions || (this.captions = this.container.find('[data-target="matriz-carousel-captions"]')); 20 this.pausePlayButton.unbind('click').bind('click', function (e) { 21 this.pause(e); 22 }.bind(this)); 23 this.carousel.on('cycle', function (e) { 24 this.play(e); 25 }.bind(this)); 26 this.carousel.on('slid.bs.carousel', function (e) { 27 this.caption(); 28 }.bind(this)); 29 this.window.on('load', function () { 30 this.caption(); 31 }.bind(this)); 32 this.container.on('swiperight', function (e) { 33 this.carousel.carousel('prev'); 34 }.bind(this)); 35 this.container.on('swipeleft', function (e) { 36 this.carousel.carousel('next'); 37 }.bind(this)); 38 }; 39 40 MatrizCarousel.prototype.pause = function (e) { 41 this.carousel.carousel('pause'); 42 this.pausePlayButton.children('span').removeClass('glyphicon-pause').addClass('glyphicon-play'); 43 this.pausePlayButton.unbind('click').bind('click', function (e) { 44 this.play(e); 45 }.bind(this)); 46 }; 47 48 MatrizCarousel.prototype.play = function (e) { 49 e || (e = {type: null}); 50 if (e.type != 'cycle') { 51 this.carousel.carousel('cycle'); 52 } 53 this.pausePlayButton.children('span').removeClass('glyphicon-play').addClass('glyphicon-pause'); 54 this.pausePlayButton.unbind('click').bind('click', function (e) { 55 this.pause(e); 56 }.bind(this)); 57 }; 58 59 MatrizCarousel.prototype.caption = function () { 60 var active = $(this.carousel).find('.carousel-inner > .item.active'); 61 this.captions.children().removeClass('active'); 62 this.captions.children().eq(active.index()).addClass('active'); 63 }; 64 65 MatrizCarousel.prototype.resize = function () { 66 var children = this.captions.find('li'); 67 children.css('height', (100 / children.length) + "%"); 68 }; 69 70 return (function () { 71 $('.matriz-carousel-container').each(function () { 72 new MatrizCarousel($(this)); 73 }); 74 })(); 75})(window, jQuery);
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.