1/** 2 * @namespace WPGMZA 3 * @module UseMyLocationButton 4 * @requires WPGMZA.EventDispatcher 5 */ 6jQuery(function($) { 7 8 WPGMZA.UseMyLocationButton = function(target, options) 9 { 10 var self = this; 11 12 this.options = {}; 13 if(options) 14 this.options = options; 15 16 this.target = $(target); 17 18 var buttonClass = 'button-secondary'; 19 if(WPGMZA.settings.internalEngine !== 'legacy'){ 20 buttonClass = 'wpgmza-button'; 21 } 22 23 if(!WPGMZA.InternalEngine.isLegacy() && !(parseInt(WPGMZA.is_admin) === 1)){ 24 this.element = $("<button class='wpgmza-use-my-location " + buttonClass + "' type='button' title='" + WPGMZA.localized_strings.use_my_location + "'>" + this.getSVG() + "</button>"); 25 } else { 26 this.element = $("<button class='wpgmza-use-my-location " + buttonClass + "' type='button' title='" + WPGMZA.localized_strings.use_my_location + "'><i class='fa fa-crosshairs' aria-hidden='true'></i></button>"); 27 } 28 29 this.element.on("click", function(event) { 30 self.onClick(event); 31 }); 32 } 33 34 WPGMZA.UseMyLocationButton.prototype = Object.create(WPGMZA.EventDispatcher.prototype); 35 WPGMZA.UseMyLocationButton.prototype.constructor = WPGMZA.UseMyLocationButton; 36 37 WPGMZA.UseMyLocationButton.prototype.onClick = function(event) 38 { 39 var self = this; 40 41 WPGMZA.getCurrentPosition(function(position) { 42 43 var lat = position.coords.latitude; 44 var lng = position.coords.longitude; 45 46 self.target.val(lat + ", " + lng); 47 self.target.trigger("change"); 48 49 var geocoder = WPGMZA.Geocoder.createInstance(); 50 geocoder.geocode({latLng: {lat: lat, lng: lng}}, function(results) { 51 52 if(results && results.length) 53 self.target.val(results[0]); 54 55 }); 56 57 }); 58 } 59 60 WPGMZA.UseMyLocationButton.prototype.getSVG = function(){ 61 var html = '<svg width="40" height="40" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg" class="wpgmza-use-loc">'; 62 html += '<circle cx="30" cy="30" r="20.5" stroke-width="5" class="circle_outer"/>'; 63 html += '<circle cx="30" cy="30" r="12" class="circle_inner"/>'; 64 html += '<line x1="30" y1="7" x2="30" y2="3" stroke-width="6" stroke-linecap="round" class="line" />'; 65 html += '<line x1="30" y1="57" x2="30" y2="53" stroke-width="6" stroke-linecap="round" class="line" />'; 66 html += '<line x1="53" y1="30" x2="57" y2="30" stroke-width="6" stroke-linecap="round" class="line" />'; 67 html += '<line x1="3" y1="30" x2="7" y2="30" stroke-width="6" stroke-linecap="round" class="line" />'; 68 html += '</svg>'; 69 70 return html; 71 } 72 73});
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.