1;(function($){ 2 3 "use strict"; 4 5 window.MSHotspotLayer = function(){ 6 MSLayerElement.call(this); 7 8 this.__cssConfig = [ 9 'margin-top' , 'padding-top' , 10 'margin-bottom' , 'padding-left' , 11 'margin-right' , 'padding-right' , 12 'margin-left' , 'padding-bottom' , 13 14 'left' , 'right' , 15 'top' , 'bottom' 16 ]; 17 18 19 this.ease = 'Expo'; 20 this.hide_start = true; 21 this.type = 'hotspot'; 22 }; 23 24 MSHotspotLayer.extend(MSLayerElement); 25 26 var p = MSHotspotLayer.prototype; 27 var _super = MSLayerElement.prototype; 28 29 /*-------------- METHODS --------------*/ 30 31 p._showTT = function(){ 32 if(!this.show_cl) return; 33 34 clearTimeout(this.hto); 35 if(this._tween) this._tween.stop(true); 36 37 if( this.hide_start ){ 38 this.align = this._orgAlign; 39 this._locateTT(); 40 41 this.tt.css({display:'block'}); 42 this._tween = CTween.animate(this.tt , 900 , this.to , {ease:'easeOut'+this.ease}); 43 this.hide_start = false; 44 } 45 46 }; 47 48 p._hideTT = function(){ 49 if(!this.show_cl) return; 50 if(this._tween) this._tween.stop(true); 51 52 var that = this; 53 54 clearTimeout(this.hto); 55 this.hto = setTimeout(function(){ 56 that.hide_start = true; 57 that._tween = CTween.animate(that.tt , 900 , that.from , {ease:'easeOut'+that.ease , complete:function(){that.tt.css('display' , 'none');}} ); 58 } , 200); 59 }; 60 61 p._updateClassName = function(name){ 62 if(this._lastClass) this.tt.removeClass(this._lastClass); 63 this.tt.addClass(name); 64 this._lastClass = name; 65 } 66 67 p._alignPolicy = function(){ 68 var h = this.tt.outerHeight(false), 69 w = Math.max(this.tt.outerWidth(false) , parseInt(this.tt.css('max-width'))), 70 ww = window.innerWidth, 71 wh = window.innerHeight; 72 73 switch(this.align){ 74 case 'top': 75 if(this.base_t < 0 ) 76 return 'bottom'; 77 break; 78 case 'right': 79 if(this.base_l + w > ww || this.base_t < 0) 80 return 'bottom'; 81 break; 82 case 'left': 83 if(this.base_l < 0 || this.base_t < 0) 84 return 'bottom'; 85 break; 86 } 87 88 return null; 89 }; 90 91 p._locateTT = function(){ 92 var os = this.$element.offset(), 93 os2 = this.slide.slider.$element.offset(); 94 95 var dist = 50, 96 space = 15 //* this.factor; 97 98 this.pos_x = os.left - os2.left - this.slide.slider.$element.scrollLeft(); 99 this.pos_y = os.top - os2.top - this.slide.slider.$element.scrollTop(); 100 101 this.from = {opacity:0}; 102 this.to = {opacity:1}; 103 104 this._updateClassName('ms-tooltip-'+this.align); 105 this.tt_arrow.css('margin-left' , ''); 106 107 var arrow_w = 15,//parseInt(this.tt_arrow.css('border-left')) + parseInt(this.tt_arrow.css('border-right')), 108 arrow_h = 15;//parseInt(this.tt_arrow.css('border-top')) + parseInt(this.tt_arrow.css('border-bottom')); 109 110 //console.log(arrow_h,arrow_w); 111 // 112 switch(this.align){ 113 case 'top': 114 var w = Math.min(this.tt.outerWidth(false) , parseInt(this.tt.css('max-width'))); 115 this.base_t = this.pos_y - this.tt.outerHeight(false) - arrow_h - space; 116 this.base_l = this.pos_x - w/2; 117 118 if(this.base_l + w > window.innerWidth){ 119 this.tt_arrow.css('margin-left' , -arrow_w/2 + this.base_l + w -window.innerWidth + 'px'); 120 this.base_l = window.innerWidth - w; 121 } 122 123 if(this.base_l < 0){ 124 this.base_l = 0; 125 this.tt_arrow.css('margin-left' , -arrow_w/2 + this.pos_x - this.tt.outerWidth(false) / 2 + 'px'); 126 } 127 128 if(window._css3d){ 129 this.from[window._jcsspfx+'Transform'] = 'translateY(-'+dist+'px)'; 130 this.to[window._jcsspfx+'Transform'] = ''; 131 }else{ 132 this.from.top = (this.base_t - dist) + 'px'; 133 this.to.top = this.base_t + 'px'; 134 } 135 136 break; 137 case 'bottom': 138 var w = Math.min(this.tt.outerWidth(false) , parseInt(this.tt.css('max-width'))); 139 140 this.base_t = this.pos_y + arrow_h + space; 141 this.base_l = this.pos_x - w/2; 142 143 if(this.base_l + w > window.innerWidth){ 144 this.tt_arrow.css('margin-left' , -arrow_w/2 + this.base_l + w -window.innerWidth + 'px'); 145 this.base_l = window.innerWidth - w; 146 } 147 148 if(this.base_l < 0){ 149 this.base_l = 0; 150 this.tt_arrow.css('margin-left' , -arrow_w/2 + this.pos_x - this.tt.outerWidth(false) / 2 + 'px'); 151 } 152 153 if(window._css3d){ 154 this.from[window._jcsspfx+'Transform'] = 'translateY('+dist+'px)'; 155 this.to[window._jcsspfx+'Transform'] = ''; 156 }else{ 157 this.from.top = (this.base_t + dist) + 'px'; 158 this.to.top = this.base_t + 'px'; 159 } 160 161 break; 162 163 case 'right': 164 this.base_l = this.pos_x + arrow_w + space; 165 this.base_t = this.pos_y - this.tt.outerHeight(false) / 2; 166 167 if(window._css3d){ 168 this.from[window._jcsspfx+'Transform'] = 'translateX('+dist+'px)'; 169 this.to[window._jcsspfx+'Transform'] = ''; 170 }else{ 171 this.from.left = (this.base_l + dist) + 'px'; 172 this.to.left = this.base_l + 'px'; 173 } 174 175 break; 176 case 'left': 177 this.base_l = this.pos_x - arrow_w - this.tt.outerWidth(false) - space; 178 this.base_t = this.pos_y - this.tt.outerHeight(false) / 2; 179 180 if(window._css3d){
181 this.from[window._jcsspfx+'Transform'] = 'translateX(-'+dist+'px)'; 182 this.to[window._jcsspfx+'Transform'] = ''; 183 }else{ 184 this.from.left = (this.base_l - dist) + 'px'; 185 this.to.left = this.base_l + 'px'; 186 } 187 188 break; 189 } 190 191 192 193 var policyAlign = this._alignPolicy(); 194 if(policyAlign !== null){ 195 this.align = policyAlign; 196 this._locateTT(); 197 return; 198 } 199 200 this.tt.css('top' ,parseInt(this.base_t)+'px'). 201 css('left' ,parseInt(this.base_l)+'px'); 202 203 this.tt.css(this.from); 204 205 }; 206 207 p.start = function(){ 208 _super.start.call(this); 209 this.tt.appendTo(this.slide.slider.$element); 210 //this._locateTT(); 211 this.tt.css('display' , 'none'); 212 }; 213 214 p.reset = function(){ 215 _super.reset.call(this); 216 this.tt.detach(); 217 }; 218 219 /** 220 * locate hotspot over slide 221 * @override LayerElement.locate 222 * @since 2.2.0 223 */ 224/* p.locate = function(){ 225 _super.locate.call(this); 226 227 if ( this.relativeToBG ) { 228 console.log(this.baseOffsetX , this.slide.$bg_img.width() , this.slide.bgWidth) 229 this.$element[0].style.left = this.baseOffsetX * this.slide.$bg_img.width() / this.slide.bgWidth + 'px'; 230 this.$element[0].style.top = this.baseOffsetY * this.slide.$bg_img.height() / this.slide.bgHeight + 'px'; 231 } 232 233 }; 234*/ 235 p.create = function(){ 236 var that = this; 237 238 //@since 2.2.0 239 //chnage offset progin to top left 240 /* this.relativeToBG = this.$element.data('relative') && (this.slide.fillMode === 'fill' || this.slide.fillMode === 'fit'); 241 if ( this.relativeToBG ) { 242 243 var origin = this.$element.data('origin'), 244 osy = this.$element.data('offset-y'), 245 osx = this.$element.data('offset-x'); 246 247 if ( origin ) { 248 if ( origin.charAt(0) === 'b' ){ 249 osy = this.slide.slider.options.height - this.$element.data('offset-y'); 250 this.$element.data('offset-y', osy); 251 } 252 253 if ( origin.charAt(1) === 'r' ){ 254 osx = this.slide.slider.options.width - this.$element.data('offset-x'); 255 this.$element.data('offset-x', osx); 256 } 257 258 } 259 260 this.$element.data('origin', 'tl'); 261 262 this.baseOffsetX = osx; 263 this.baseOffsetY = osy; 264 }*/ 265 266 267 this._orgAlign = this.align = this.$element.data('align') !== undefined ? this.$element.data('align') : 'top'; 268 269 this.data = this.$element.html(); 270 271 this.$element.html('').on('mouseenter' , function(){that._showTT();}).on('mouseleave',function(){that._hideTT();}); 272 273 this.point = $('<div><div class="ms-point-center"></div><div class="ms-point-border"></div></div>') 274 .addClass('ms-tooltip-point') 275 .appendTo(this.$element); 276 277 var link = this.$element.data('link'), 278 target = this.$element.data('target'); 279 280 if( link ){ 281 this.point.on('click', function(){window.open(link , target || '_self');}); 282 } 283 284 this.tt = $('<div></div>') 285 .addClass('ms-tooltip') 286 //.addClass('ms-tooltip-'+this.align) 287 .css('display','hidden') 288 .css('opacity' , 0); 289 290 // @since v1.6.1 291 if( this.$element.data('width') !== undefined ){ 292 this.tt.css('width', this.$element.data('width')) 293 .css('max-width', this.$element.data('width')); 294 } 295 296 this.tt_arrow = $('<div></div>') 297 .addClass('ms-tooltip-arrow') 298 .appendTo(this.tt); 299 300 this._updateClassName('ms-tooltip-'+this.align); 301 302 this.ttcont = $('<div></div>') 303 .addClass('ms-tooltip-cont') 304 .html(this.data) 305 .appendTo(this.tt) 306 307 308 if( this.$element.data('stay-hover') === true ) { 309 this.tt.on('mouseenter' , function(){ 310 if( that.hide_start ){ 311 return 312 } 313 clearTimeout(that.hto); 314 that._tween.stop(true); 315 that._showTT(); 316 }).on('mouseleave', function(){ 317 that._hideTT(); 318 }); 319 } 320 321 _super.create.call(this); 322 }; 323 324})(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.