<commit_before>/*
 * MapEmAll is licensed under the conditions of the MIT License (MIT)
 *
 * Copyright (c) 2015-2016 <NAME>
 * All rights reserved.
 *
 * See https://raw.githubusercontent.com/stophi-dev/MapEmAll/master/LICENSE for details.
 */

/* global Microsoft */

define(function () {
    'use strict';

    var BingMap = function BingMap(options) {
        var mapOptions = {
            credentials: options.credentials,
            center: new Microsoft.Maps.Location(options.center.latitude, options.center.longitude),
            zoom: 16
        };
        var map = new Microsoft.Maps.Map(options.htmlContainer, mapOptions);
        this.getArea = function () {
            var bounds = map.getBounds();
            return {
                northEast: {
                    latitude: bounds.getNorth(),
                    longitude: bounds.getEast()
                },
                southWest: {
                    latitude: bounds.getSouth(),
                    longitude: bounds.getWest()
                }
            };
        };
        this.addMarker = function (geoPosition, title) {

            var location = new Microsoft.Maps.Location(geoPosition.latitude, geoPosition.longitude);
            var pin = new Microsoft.Maps.Pushpin(location);
            map.entities.push(pin);
        };

        this.addListener = function (event, listener) {
            if (event === 'boundsChanged') {
                Microsoft.Maps.Events.addHandler(map, 'viewchangeend', listener);
                // TODO maybe needs to be debounced, like google API
            }
        };

        this.clearAllMarkers = function () {
            map.entities.clear();
        };
    };

    return BingMap;
});

<commit_msg>Add tooltip to Bing marker<commit_after>/*
 * MapEmAll is licensed under the conditions of the MIT License (MIT)
 *
 * Copyright (c) 2015-2016 <NAME>
 * All rights reserved.
 *
 * See https://raw.githubusercontent.com/stophi-dev/MapEmAll/master/LICENSE for details.
 */

/* global Microsoft */

define(['JSLoader'], function (loader) {
    'use strict';

    var BingMap = function BingMap(options) {
        var mapOptions = {
            credentials: options.credentials,
            center: new Microsoft.Maps.Location(options.center.latitude, options.center.longitude),
            zoom: 16
        };
        var map = new Microsoft.Maps.Map(options.htmlContainer, mapOptions);
        this.getArea = function () {
            var bounds = map.getBounds();
            return {
                northEast: {
                    latitude: bounds.getNorth(),
                    longitude: bounds.getEast()
                },
                southWest: {
                    latitude: bounds.getSouth(),
                    longitude: bounds.getWest()
                }
            };
        };

        this.addMarker = function (geoPosition, title) {
            var pinId = 'bing_pushpin_' + loader.makeId(20);

            var location = new Microsoft.Maps.Location(geoPosition.latitude, geoPosition.longitude);
            var pin = new Microsoft.Maps.Pushpin(location, {id: pinId});
            map.entities.push(pin);

            addTooltipToPin(pinId, title);
        };

        function addTooltipToPin(pinId, tooltipText) {
            var pinElement = document.getElementById(pinId);
            var children = Array.prototype.slice.call(pinElement.childNodes);
            children.forEach(function(child) {
                child.setAttribute('title', tooltipText);
            });
        }

        this.addListener = function (event, listener) {
            if (event === 'boundsChanged') {
                Microsoft.Maps.Events.addHandler(map, 'viewchangeend', listener);
                // TODO maybe needs to be debounced, like google API
            }
        };

        this.clearAllMarkers = function () {
            map.entities.clear();
        };
    };

    return BingMap;
});


{'fraction_non_alphanumeric': 0.11004056795131846, 'fraction_numerical': 0.005578093306288032, 'mean_word_length': 1.7762139338494018, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4704247', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1018, 'n_words': 228}