1(function ($, scope, undefined) { 2 function NextendSmartSliderWidgetBulletTransition(id, parameters) { 3 4 this.slider = window[id]; 5 6 this.slider.started($.proxy(this.start, this, id, parameters)); 7 }; 8 9 NextendSmartSliderWidgetBulletTransition.prototype.start = function (id, parameters) { 10 11 if (this.slider.sliderElement.data('bullet')) { 12 return false; 13 } 14 this.slider.sliderElement.data('bullet', this); 15 16 this.axis = 'horizontal'; 17 this.offset = 0; 18 this.parameters = parameters; 19 20 this.bar = this.slider.sliderElement.find('.nextend-bullet-bar'); 21 22 var event = 'universalclick'; 23 if (parameters.action == 'mouseenter') { 24 event = 'mouseenter'; 25 } 26 this.originalDots = this.dots = this.bar.find('div').on(event, $.proxy(this.onDotClick, this)); 27 this.slider.sliderElement 28 .on('slideCountChanged', $.proxy(this.onSlideCountChanged, this)) 29 .on('sliderSwitchTo', $.proxy(this.onSlideSwitch, this)); 30 31 if (parameters.overlay == 0) { 32 var side = false; 33 switch (parameters.area) { 34 case 1: 35 side = 'Top'; 36 break; 37 case 12: 38 side = 'Bottom'; 39 break; 40 case 5: 41 side = 'Left'; 42 this.axis = 'vertical'; 43 break; 44 case 8: 45 side = 'Right'; 46 this.axis = 'vertical'; 47 break; 48 } 49 if (side) { 50 this.offset = parseFloat(this.bar.data('offset')); 51 this.slider.responsive.addStaticMargin(side, this); 52 } 53 } 54 55 this.initThumbnails(); 56 }; 57 58 NextendSmartSliderWidgetBulletTransition.prototype.onDotClick = function (e) { 59 this.slider.directionalChangeToReal(this.originalDots.index(e.currentTarget)); 60 }; 61 62 NextendSmartSliderWidgetBulletTransition.prototype.onSlideSwitch = function (e, targetSlideIndex) { 63 this.dots.filter('.n2-active').removeClass('n2-active'); 64 this.dots.eq(targetSlideIndex).addClass('n2-active'); 65 }; 66 67 NextendSmartSliderWidgetBulletTransition.prototype.isVisible = function () { 68 return this.bar.is(':visible'); 69 }; 70 71 NextendSmartSliderWidgetBulletTransition.prototype.getSize = function () { 72 if (this.axis == 'horizontal') { 73 return this.bar.height() + this.offset; 74 } 75 return this.bar.width() + this.offset; 76 }; 77 78 NextendSmartSliderWidgetBulletTransition.prototype.initThumbnails = function () { 79 if (this.parameters.thumbnails.length > 0) { 80 this.dots.each($.proxy(function (i, el) { 81 if (this.parameters.thumbnails[i] != '') { 82 $(el).on({ 83 universalenter: $.proxy(this.showThumbnail, this, i)/*, 84 universalleave: $.proxy(this.hideThumbnail, this, i)*/ 85 }, { 86 leaveOnSecond: true 87 }) 88 } 89 }, this)); 90 } 91 }; 92 93 NextendSmartSliderWidgetBulletTransition.prototype.showThumbnail = function (i, e) { 94 var thumbnail = this.getThumbnail(i); 95 96 NextendTween.to(thumbnail, 0.3, { 97 opacity: 1 98 }).play(); 99 100 this.originalDots.eq(i).on('universalleave', $.proxy(this.hideThumbnail, this, thumbnail)); 101 }; 102 103 NextendSmartSliderWidgetBulletTransition.prototype.hideThumbnail = function (thumbnail, e) { 104 e.stopPropagation(); 105 NextendTween.to(thumbnail, 0.3, { 106 opacity: 0, 107 onComplete: function () { 108 thumbnail.remove(); 109 } 110 }).play(); 111 }; 112 113 NextendSmartSliderWidgetBulletTransition.prototype.getThumbnail = function (i) { 114 var target = this.originalDots.eq(i); 115 var targetOffset = target.offset(), 116 targetW = target.outerWidth(), 117 targetH = target.outerHeight(); 118
119 var thumbnail = $('<div/>').append($('<div/>').css({ 120 width: this.parameters.thumbnailWidth, 121 height: this.parameters.thumbnailHeight, 122 backgroundImage: 'url("' + this.parameters.thumbnails[i] + '")', 123 backgroundSize: 'cover' 124 })) 125 .addClass(this.parameters.thumbnailStyle) 126 .css({ 127 position: 'absolute', 128 opacity: 0, 129 zIndex: 10000000 130 }).appendTo('body'); 131 132 switch (this.parameters.thumbnailPosition) { 133 case 'right': 134 thumbnail.css({ 135 left: targetOffset.left + targetW, 136 top: targetOffset.top + targetH / 2 - thumbnail.outerHeight(true) / 2 137 }); 138 break; 139 case 'left': 140 thumbnail.css({ 141 left: targetOffset.left - thumbnail.outerWidth(true), 142 top: targetOffset.top + targetH / 2 - thumbnail.outerHeight(true) / 2 143 }); 144 break; 145 case 'top': 146 thumbnail.css({ 147 left: targetOffset.left + targetW / 2 - thumbnail.outerWidth(true) / 2, 148 top: targetOffset.top - thumbnail.outerHeight(true) 149 }); 150 break; 151 case 'bottom': 152 thumbnail.css({ 153 left: targetOffset.left + targetW / 2 - thumbnail.outerWidth(true) / 2, 154 top: targetOffset.top + targetH 155 }); 156 break; 157 } 158 159 target.data('thumbnail', thumbnail); 160 return thumbnail; 161 }; 162 163 NextendSmartSliderWidgetBulletTransition.prototype.onSlideCountChanged = function (e, newCount, slidesInGroup) { 164 this.dots = $(); 165 for (var i = 0; i < this.originalDots.length; i++) { 166 if (i % slidesInGroup == 0) { 167 this.dots = this.dots.add(this.originalDots.eq(i).css("display", "")); 168 } else { 169 this.originalDots.eq(i).css("display", "none"); 170 } 171 } 172 if (this.parameters.numeric) { 173 this.dots.each(function (i, el) { 174 el.innerHTML = i + 1; 175 }); 176 } 177 }; 178 179 scope.NextendSmartSliderWidgetBulletTransition = NextendSmartSliderWidgetBulletTransition; 180})(n2, window);
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.