PageSourceSearch

https://merrative.com/wp-content/themes/sinatra/assets/js/menu-avatar.js

js merrative.com collected 2026-09-28 08:33:19 UTC 2,043 bytes, 53 lines download raw bytes

1jQuery(document).ready(function ($) {
2    if (typeof wpApiSettings === 'undefined' || !wpApiSettings.is_logged_in) {
3        return; // Stop if user not logged in
4    }
5
6    function insertAvatar() {
7        const accountLinks = $('a:contains("My Account")').filter(function () {
8            return $(this).text().trim() === 'My Account';
9        });
10
11        if (accountLinks.length) {
12            $.ajax({
13                url: '/wp-json/wp/v2/user-avatar',
14                method: 'GET',
15                headers: {
16                    'X-WP-Nonce': wpApiSettings.nonce
17                },
18                success: function (response) {
19                    if (response.avatar) {
20                        const img = $('<img>', {
21                            src: response.avatar,
22                            alt: 'Avatar',
23                            css: {
24                                width: '24px',
25                                height: '24px',
26                                'border-radius': '50%',
27                                'margin-right': '8px',
28                                'vertical-align': 'middle'
29                            }
30                        });
31
32                        accountLinks.each(function () {
33                            const $link = $(this);
34                            if ($link.find('img').length === 0) {
35                                $link.css({
36                                    display: 'flex',
37                                    'align-items': 'center'
38                                });
39                                $link.prepend(img.clone());
40                            }
41                        });
42                    }
43                },
44                error: function (xhr, status, error) {
45                    console.error('Avatar Fetch Error:', error);
46                }
47            });
48        }
49    }
50
51    // Delay or use MutationObserver for dynamic headers (Elementor etc.)
52    setTimeout(insertAvatar, 500);
53});

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.