<commit_before>var hotspots = (function () {

var exports = {};

// icon placements (relative to element):
var TOP_LEFT = 'TOP_LEFT';
var TOP_RIGHT = 'TOP_RIGHT';
var BOTTOM_RIGHT = 'BOTTOM_RIGHT';
var BOTTOM_LEFT = 'BOTTOM_LEFT';
var CENTER = 'CENTER';

// popover orientations
var TOP = 'top';
var LEFT = 'left';
var RIGHT = 'right';
var BOTTOM = 'bottom';
var VIEWPORT_CENTER = 'viewport_center';

// popover orientation can optionally be fixed here (property: popover),
// otherwise popovers.compute_placement is used to compute orientation
var HOTSPOT_LOCATIONS = {
    click_to_reply: {
        element: '.selected_message .messagebox-content',
        icon: CENTER,
    },
    new_topic_button: {
        element: '#left_bar_compose_stream_button_big',
        icon: TOP_LEFT,
    },
    stream_settings: {
        element: '#streams_inline_cog',
        icon: CENTER,
    },
};

// popover illustration url(s)
var WHALE = '/static/images/hotspots/whale.svg';


exports.map_hotspots_to_DOM = function (hotspots, locations) {
    hotspots.forEach(function (hotspot) {
        hotspot.location = locations[hotspot.name];
    });
};

exports.post_hotspot_as_read = function (hotspot_name) {
    channel.post({
        url: '/json/users/me/hotspots',
        data: { hotspot: JSON.stringify(hotspot_name) },
        error: function (err) {
            blueslip.error(err.responseText);
        },
    });
};

function place_icon(hotspot) {
    if ($(hotspot.location.element).length !== 0) {
        $('#hotspot_' + hotspot.name + '_icon').css('display', 'none');
        return;
    }

    var el_width = $(hotspot.location.element).outerWidth();<commit_msg>hotspots.js: Fix hotspots not appearing.<commit_after>var hotspots = (function () {

var exports = {};

// icon placements (relative to element):
var TOP_LEFT = 'TOP_LEFT';
var TOP_RIGHT = 'TOP_RIGHT';
var BOTTOM_RIGHT = 'BOTTOM_RIGHT';
var BOTTOM_LEFT = 'BOTTOM_LEFT';
var CENTER = 'CENTER';

// popover orientations
var TOP = 'top';
var LEFT = 'left';
var RIGHT = 'right';
var BOTTOM = 'bottom';
var VIEWPORT_CENTER = 'viewport_center';

// popover orientation can optionally be fixed here (property: popover),
// otherwise popovers.compute_placement is used to compute orientation
var HOTSPOT_LOCATIONS = {
    click_to_reply: {
        element: '.selected_message .messagebox-content',
        icon: CENTER,
    },
    new_topic_button: {
        element: '#left_bar_compose_stream_button_big',
        icon: TOP_LEFT,
    },
    stream_settings: {
        element: '#streams_inline_cog',
        icon: CENTER,
    },
};

// popover illustration url(s)
var WHALE = '/static/images/hotspots/whale.svg';


exports.map_hotspots_to_DOM = function (hotspots, locations) {
    hotspots.forEach(function (hotspot) {
        hotspot.location = locations[hotspot.name];
    });
};

exports.post_hotspot_as_read = function (hotspot_name) {
    channel.post({
        url: '/json/users/me/hotspots',
        data: { hotspot: JSON.stringify(hotspot_name) },
        error: function (err) {
            blueslip.error(err.responseText);
        },
    });
};

function place_icon(hotspot) {
    if ($(hotspot.location.element).length === 0) {
        $('#hotspot_' + hotspot.name + '_icon').css('display', 'none');
        return;
    }

    var el_width = $(hotspot.location.element).outerWidth();
{'fraction_non_alphanumeric': 0.13757087436586093, 'fraction_numerical': 0.000596836765144733, 'mean_word_length': 3.3251612903225807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2933692', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1081, 'n_words': 235}