1(function(window) { 2 3 L.Icon.Pulse = L.DivIcon.extend({ 4 5 options: { 6 className: '', 7 iconSize: [12,12], 8 fillColor: 'red', 9 color: 'red', 10 animate: true, 11 heartbeat: 1, 12 }, 13 14 initialize: function (options) { 15 L.setOptions(this,options); 16 17 // css 18 19 var uniqueClassName = 'lpi-'+ new Date().getTime()+'-'+Math.round(Math.random()*100000); 20 21 var before = ['background-color: '+this.options.fillColor]; 22 var after = [ 23 24 25 26 'animation: pulsate ' + this.options.heartbeat + 's ease-out', 27 'animation-iteration-count: infinite', 28 'animation-delay: '+ (this.options.heartbeat + .1) + 's', 29 ]; 30 31 if (!this.options.animate){ 32 after.push('animation: none'); 33 after.push('box-shadow:none'); 34 } 35 36 var css = [ 37 '.'+uniqueClassName+'{'+before.join(';')+';}', 38 '.'+uniqueClassName+':after{'+after.join(';')+';}', 39 ].join(''); 40 41 var el = document.createElement('style'); 42 if (el.styleSheet){ 43 el.styleSheet.cssText = css; 44 } else { 45 el.appendChild(document.createTextNode(css)); 46 } 47 48 document.getElementsByTagName('head')[0].appendChild(el); 49 50 // apply css class 51 52 this.options.className = this.options.className+' leaflet-pulsing-icon '+uniqueClassName; 53 54 // initialize icon 55 56 L.DivIcon.prototype.initialize.call(this, options); 57 58 } 59 }); 60 61 L.icon.pulse = function (options) { 62 return new L.Icon.Pulse(options); 63 }; 64 65 66 L.Marker.Pulse = L.Marker.extend({ 67 initialize: function (latlng,options) { 68 options.icon = L.icon.pulse(options); 69 L.Marker.prototype.initialize.call(this, latlng, options); 70 } 71 }); 72 73 L.marker.pulse = function (latlng,options) { 74 return new L.Marker.Pulse(latlng,options); 75 }; 76 77})(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.