Best JavaScript code snippet using stryker-parent
map.js
Source:map.js
1var touchorclick;2var Map = function(){3 var $this = this;4 /** ÐбÑÐµÐºÑ ÐºÐ°ÑÑÑ Google */5 var map;6 /** кооÑдинаÑÑ */7 var eqLocation;8 /** маÑÐºÐµÑ */9 var eqMarker;10 /** маÑкеÑ, коÑоÑÑй бÑÐ´ÐµÑ Ð¾ÑобÑажен как ÑезÑлÑÑÐ°Ñ Ð¿Ð¾Ð¸Ñка маÑÑÑÑÑа */11 var homeMarker;12 /** вÑплÑваÑÑÐ°Ñ Ð¿Ð¾Ð´Ñказка к маÑкеÑÑ */13 var eqInfo;14 /** Ñип маÑÑÑÑÑа, коÑоÑÑй бÑÐ´ÐµÑ Ð¿ÑокладÑваÑÑÑÑ Ð½Ð° каÑÑе */15 var travellingMode = google.maps.TravelMode.DRIVING;16 /** геокодиÑование ÑезÑлÑÑаÑов */17 var geocoder = new google.maps.Geocoder();18 var info;19 /** ÑзÑк ÑайÑа */20 var lang;21 var googleErrors = [];22 /** оÑменÑем вÑвод маÑкеÑов на каÑÑÑ Ð¿Ñи ÑендеÑе */23 var directionsRenderOptions = {24 suppressMarkers: true25 };26 var directionsDisplay = new google.maps.DirectionsRenderer(directionsRenderOptions);27 var directionsService = new google.maps.DirectionsService();28 /** пÑоложение маÑÑÑÑÑа */29 this.route = function(){30 var request = {31 origin: $('.abpoint-a input').val(),32 destination: eqLocation,33 travelMode: travellingMode34 };35 directionsService.route(request, function(response, status) {36 switch (status){37 case google.maps.DirectionsStatus.OK:38 directionsDisplay.setDirections(response);39 var address = $('.abpoint-a > input').val();40 geocoder.geocode({'address' : address},function(results,status){41 addHomeMarker(results[0].geometry.location,address);42 });43 break;44 case google.maps.DirectionsStatus.NOT_FOUND:45 alert(googleErrors[0]);46 break;47 case google.maps.DirectionsStatus.ZERO_RESULTS:48 alert(googleErrors[1]);49 break;50 }51 });52 }53 /** добавлÑем маÑÐºÐµÑ Ð½Ð°Ñала поиÑка */54 function addHomeMarker(position, content){55 if (typeof(info) != 'undefined'){56 info.close();57 }58 info = new google.maps.InfoWindow();59 info.setContent(content);60 info.setPosition(position);61 if (typeof (homeMarker) != 'undefined'){62 homeMarker.setPosition(position);63 } else {64 homeMarker = new google.maps.Marker({65 position: position,66 map: map67 //icon: 'img/way/marker_start.png'68 });69 google.maps.event.addListener(homeMarker,touchorclick,function(){70 info.open(map);71 });72 }73 }74 /** Ñмена Ñипа пÑокладÑÐ²Ð°Ð½Ð¸Ñ Ð¼Ð°ÑÑÑÑÑа */75 this.changeTravellingMode = function(){76 $(this).siblings().removeClass('selected').end().addClass('selected');77 if ($('.travelling-mode').index($(this)) == 0){78 travellingMode = google.maps.TravelMode.DRIVING;79 } else {80 travellingMode = google.maps.TravelMode.WALKING;81 }82 if ($.trim($('.abpoint-a>input').val()) != '') $this.route();83 }84 /** опÑеделение и ÑÑÑановка ÑзÑка */85 function determineLang(){86 var href = window.location.href;87 var regExp = /\/rus\//;88 lang = 'rus';89 /*if (href.search(regExp) != -1){90 lang = 'rus';91 } else {92 lang = 'eng';93 }*/94 }95 /** иниÑиализиÑÑем ÑзÑковÑе наÑÑÑойки */96 function initLang(){97 switch(lang){98 case 'rus':99 googleErrors[0] = "ÐдÑÐµÑ Ð½Ðµ найден. ÐожалÑйÑÑа, пÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ð¾Ð³Ð¾ адÑеÑа!";100 googleErrors[1] = "ÐдÑÐµÑ Ð½Ðµ найден. ÐожалÑйÑÑа, пÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ð¾Ð³Ð¾ адÑеÑа.";101 break;102 case 'eng':103 googleErrors[0] = "Address not found. Please check the entered address!";104 googleErrors[1] = "Sorry... No route could be found between the origin and destination!";105 break;106 }107 }108 /** иниÑиализаÑÐ¸Ñ */109 (function init(){110 determineLang();111 initLang();112 eqLocation = new google.maps.LatLng(48.011907334578346,37.78056889772415);113 var mapOptions = {114 zoom: 15,115 center: new google.maps.LatLng(48.01524109912293,37.78054744005203),116 mapTypeId: google.maps.MapTypeId.ROADMAP,117 scrollwheel: false,118 panControl: false119 };120 map = new google.maps.Map(document.getElementById('map'),mapOptions);121 directionsDisplay.setMap(map);122 eqMarker = new google.maps.Marker({123 position: eqLocation,124 map: map,125 title: 'ÐÑÑаÑи'126 });127 var th="г. ÐонеÑк, Ñл. Ðалинина, 118 (ÑÑдом Ñ \"ÐмпеÑÐ¸Ñ Ð¼ÐµÐ±ÐµÐ»Ð¸\")";128 eqInfo = new google.maps.InfoWindow({129 content:"<div><img style='float:left;width:90px;height:68px;' src='../img/vid.jpg'/><div style='width:87px;float:left;'><img style='width:141px;margin-left:47px;' src='../img/logo.png'/></div><div style='clear:both;'></div><div style='font-family:Arial;font-size:12px;color:#000;margin-top: 10px;'>г. ÐонеÑк, Ñл. Ðалинина, 118 (ÑÑдом Ñ \"ÐмпеÑÐ¸Ñ Ð¼ÐµÐ±ÐµÐ»Ð¸\")<br /><i style='color:#999999;'>+38 (067) 862 86 48<br />+38 (095) 172 72 72<br /></i> </div> </div>"130 });131 google.maps.event.addListener(eqMarker,'click',function(){132 eqInfo.open(map,eqMarker);133 });134 eqInfo.open(map,eqMarker);135 })();136}137/** ÑÑÑоим маÑÑÑÑÑÑ Ð¿Ð¾ нажаÑÐ¸Ñ ENTER'а */138var enter = function(e){139 if (e.keyCode == 13){140 $('.c-button').trigger(touchorclick);141 }142}143$(function(){144 (!!('ontouchstart' in window))?touchorclick='touchstart':touchorclick='click';145 var map = new Map();146 //$('.google-map-route input:first').focus();147 $(document).on(touchorclick,'.c-button',map.route);148 $(document).on(touchorclick,'.travelling-mode',map.changeTravellingMode);149 $(document).on(touchorclick,'.abpoint-a-aft .selected',function()150 {151 $('.abpoint-a-aft span').addClass('selected')152 $('.abpoint-a input').val($(this).data('addr'))153 $(this).removeClass('selected')154 });155 $(document).on('keyup','.abpoint-a input',function()156 {157 $('.abpoint-a-aft span').addClass('selected')158 })159 $('input').bind('keyup', enter);...
map__.js
Source:map__.js
1 var touchorclick;2var Map = function(){3 var $this = this;4 /** Îáúåêò êàðòû Google */5 var map;6 /** êîîðäèíàòû */7 var eqLocation;8 /** ìàðêåð */9 var eqMarker;10 /** ìàðêåð, êîòîðûé áóäåò îòîáðàæåí êàê ðåçóëüòàò ïîèñêà ìàðøðóòà */11 var homeMarker;12 /** âñïëûâàþùàÿ ïîäñêàçêà ê ìàðêåðó */13 var eqInfo;14 /** òèï ìàðøðóòà, êîòîðûé áóäåò ïðîêëàäûâàòüñÿ íà êàðòå */15 var travellingMode = google.maps.TravelMode.DRIVING;16 /** ãåîêîäèðîâàíèå ðåçóëüòàòîâ */17 var geocoder = new google.maps.Geocoder();18 19 var info;20 21 /** ÿçûê ñàéòà */22 var lang;23 24 var googleErrors = [];25 26 /** îòìåíÿåì âûâîä ìàðêåðîâ íà êàðòó ïðè ðåíäåðå */27 var directionsRenderOptions = {28 suppressMarkers: true29 };30 31 var directionsDisplay = new google.maps.DirectionsRenderer(directionsRenderOptions);32 var directionsService = new google.maps.DirectionsService();33 34 /** ïðîëîæåíèå ìàðøðóòà */35 this.route = function(){36 var request = {37 origin: $('.abpoint-a input').val(),38 destination: eqLocation,39 travelMode: travellingMode40 };41 directionsService.route(request, function(response, status) {42 switch (status){43 case google.maps.DirectionsStatus.OK: 44 directionsDisplay.setDirections(response);45 var address = $('.abpoint-a > input').val();46 47 geocoder.geocode({'address' : address},function(results,status){48 addHomeMarker(results[0].geometry.location,address);49 });50 break;51 case google.maps.DirectionsStatus.NOT_FOUND:52 alert(googleErrors[0]);53 break;54 case google.maps.DirectionsStatus.ZERO_RESULTS:55 alert(googleErrors[1]);56 break;57 }58 });59 }60 /** äîáàâëÿåì ìàðêåð íà÷àëà ïîèñêà */61 function addHomeMarker(position, content){62 if (typeof(info) != 'undefined'){63 info.close();64 }65 info = new google.maps.InfoWindow();66 info.setContent(content);67 info.setPosition(position);68 69 if (typeof (homeMarker) != 'undefined'){70 homeMarker.setPosition(position);71 } else {72 homeMarker = new google.maps.Marker({73 position: position,74 map: map75 //icon: 'img/way/marker_start.png'76 });77 google.maps.event.addListener(homeMarker,touchorclick,function(){78 info.open(map);79 });80 }81 }82 83 /** ñìåíà òèïà ïðîêëàäûâàíèÿ ìàðøðóòà */84 this.changeTravellingMode = function(){85 $(this).siblings().removeClass('selected').end().addClass('selected');86 if ($('.travelling-mode').index($(this)) == 0){87 travellingMode = google.maps.TravelMode.DRIVING;88 } else {89 travellingMode = google.maps.TravelMode.WALKING;90 }91 if ($.trim($('.abpoint-a>input').val()) != '') $this.route();92 }93 94 /** îïðåäåëåíèå è óñòàíîâêà ÿçûêà */95 function determineLang(){96 var href = window.location.href;97 var regExp = /\/rus\//;98 lang = 'rus';99 /*if (href.search(regExp) != -1){100 lang = 'rus';101 } else {102 lang = 'eng';103 }*/104 }105 /** èíèöèàëèçèðóåì ÿçûêîâûå íàñòðîéêè */106 function initLang(){107 switch(lang){108 case 'rus':109 googleErrors[0] = "Àäðåñ íå íàéäåí. Ïîæàëóéñòà, ïðîâåðüòå ïðàâèëüíîñòü ââåäåííîãî àäðåñà!";110 googleErrors[1] = "Àäðåñ íå íàéäåí. Ïîæàëóéñòà, ïðîâåðüòå ïðàâèëüíîñòü ââåäåííîãî àäðåñà.";111 break;112 case 'eng':113 googleErrors[0] = "Address not found. Please check the entered address!";114 googleErrors[1] = "Sorry... No route could be found between the origin and destination!";115 break;116 }117 }118 119 /** èíèöèàëèçàöèÿ */120 (function init(){121 determineLang();122 initLang();123 eqLocation = new google.maps.LatLng(48.011907334578346,37.78056889772415);124 var mapOptions = {125 zoom: 15,126 center: new google.maps.LatLng(48.01524109912293,37.78054744005203),127 mapTypeId: google.maps.MapTypeId.ROADMAP,128 scrollwheel: false,129 panControl: false130 };131 map = new google.maps.Map(document.getElementById('map'),mapOptions);132 directionsDisplay.setMap(map);133 eqMarker = new google.maps.Marker({134 position: eqLocation,135 map: map,136 title: 'Ëþôàðè'137 });138 var th="ã. Äîíåöê, óë. Êàëèíèíà, 118 (ðÿäîì ñ \"Èìïåðèÿ ìåáåëè\")";139 eqInfo = new google.maps.InfoWindow({140 content:"<div><img style='float:left;width:90px;height:68px;' src='../img/vid.jpg'/><div style='width:87px;float:left;'><img style='width:141px;margin-left:47px;' src='../img/logo.png'/></div><div style='clear:both;'></div><div style='font-family:Arial;font-size:12px;color:#000;margin-top: 10px;'>ã. Äîíåöê, óë. Êàëèíèíà, 118 (ðÿäîì ñ \"Èìïåðèÿ ìåáåëè\")<br /><i style='color:#999999;'>+38 (067) 862 86 48<br />+38 (095) 172 72 72<br /></i> </div> </div>"141 });142 google.maps.event.addListener(eqMarker,'click',function(){143 eqInfo.open(map,eqMarker);144 });145 eqInfo.open(map,eqMarker);146 })();147}148/** ñòðîèì ìàðøðóòû ïî íàæàòèþ ENTER'à */149var enter = function(e){150 if (e.keyCode == 13){151 $('.c-button').trigger(touchorclick);152 }153}154$(function(){155 156 (!!('ontouchstart' in window))?touchorclick='touchstart':touchorclick='click';157 var map = new Map();158 //$('.google-map-route input:first').focus();159 $(document).on(touchorclick,'.c-button',map.route);160 $(document).on(touchorclick,'.travelling-mode',map.changeTravellingMode);161 $(document).on(touchorclick,'.abpoint-a-aft .selected',function()162 {163 $('.abpoint-a-aft span').addClass('selected')164 $('.abpoint-a input').val($(this).data('addr'))165 $(this).removeClass('selected')166 });167 $(document).on('keyup','.abpoint-a input',function()168 {169 $('.abpoint-a-aft span').addClass('selected')170 })171 $('input').bind('keyup', enter);...
Markerlogic.js
Source:Markerlogic.js
1function createMap(Earthquake) {2 // Create the tile layer that will be the background of our map.3 var streetmap = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {4 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'5 });6 7 8 // Create a baseMaps object to hold the streetmap layer.9 var baseMaps = {10 "Street Map": streetmap11 };12 13 // Create an overlayMaps object to hold the Earthquake layer.14 var overlayMaps = {15 "Earthquakes": Earthquake16 };17 console.log(Earthquake)18 19 var myMap = L.map("map", {20 center: [39.7749, -111.4194],21 zoom: 4,22 layers: [streetmap, Earthquake]23 });24 25 // // Create a layer control, and pass it baseMaps and overlayMaps. Add the layer control to the map.26 // L.control.layers(baseMaps, overlayMaps, {27 // collapsed: false28 // }).addTo(map);29 }30 31 function createMarkers(response) {32 33 // Pull the "earthquakes" property from response.data.34 var earthquakes = response.features;35 console.log(earthquakes)36 37 // Initialize an array to hold bike markers.38 var eqMarkers = [];39 40 // Loop through the earthquakes array.41 for (var index = 0; index < earthquakes.length; index++) {42 var eqLocation = earthquakes[index];43 44 // For each station, create a marker, and bind a popup with the station's name.45 var eqMarker = L.marker([eqLocation.geometry.coordinates[1], eqLocation.geometry.coordinates[0]])46 .bindPopup(eqLocation.properties.mag + ' magnitude and the depth is ' + eqLocation.geometry.coordinates[2]) 47 48 // Add the marker to the eqMarkers array.49 eqMarkers.push(eqMarker);50 }51 console.log(eqMarkers)52 // Create a layer group that's made from the bike markers array, and pass it to the createMap function.53 createMap(L.layerGroup(eqMarkers));54 }55 56 // Perform an API call to the Citi Bike API to get the station information. Call createMarkers when it completes.57 d3.json("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson").then(createMarkers);58// d3.json("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson").then(function showdata(response) {59// console.log(response) 60// });...
Using AI Code Generation
1var eqLocation = require('stryker-parent').eqLocation;2var a = { start: { line: 1, column: 2 }, end: { line: 3, column: 4 } };3var b = { start: { line: 1, column: 2 }, end: { line: 3, column: 4 } };4if (eqLocation(a, b)) {5 console.log('locations are equal');6} else {7 console.log('locations are not equal');8}9var eqLocation = require('stryker-parent').eqLocation;10var a = { start: { line: 1, column: 2 }, end: { line: 3, column: 4 } };11var b = { start: { line: 1, column: 2 }, end: { line: 3, column: 4 } };12describe('eqLocation', function () {13 it('should return true if the locations are equal', function () {14 expect(eqLocation(a, b)).to.be.true;15 });16});171 passing (7ms)18Copyright (c) 2015 Stryker-mutator
Using AI Code Generation
1var strykerParent = require('stryker-parent');2var eqLocation = strykerParent.eqLocation;3var loc1 = { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } };4var loc2 = { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } };5var result = eqLocation(loc1, loc2);6console.log(result);
Using AI Code Generation
1var strykerParent = require('stryker-parent');2var eqLocation = strykerParent.eqLocation;3var assert = require('assert');4assert(eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},5 {start: {line: 1, column: 1}, end: {line: 1, column: 2}}));6assert(!eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},7 {start: {line: 1, column: 2}, end: {line: 1, column: 2}}));8assert(!eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},9 {start: {line: 1, column: 1}, end: {line: 1, column: 3}}));10assert(!eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},11 {start: {line: 1, column: 1}, end: {line: 1, column: 3}}));12assert(!eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},13 {start: {line: 1, column: 1}, end: {line: 1, column: 3}}));14assert(!eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},15 {start: {line: 1, column: 1}, end: {line: 1, column: 3}}));16assert(!eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},17 {start: {line: 1, column: 1}, end: {line: 1, column: 3}}));18assert(!eqLocation({start: {line: 1, column: 1}, end: {line: 1, column: 2}},19 {start: {line: 1, column: 1}, end: {line
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!