32

Update Jan. 17, 2024 Yay! The calendar pop-out is back in action.

When I click the link on "Visited xxx days" (hover text:Click to view daily visit calendar) on user profile page I get only a clocking display, no calendar.

enter image description here

This seems identical to an old issue, Visited Calendar Doesn't Render from 2010, and it occurs on all my Activity pages that I checked.

11
  • 3
    Reproduced on macOS 13.5, using: Chrome 116, Edge 116, Firefox 116, Opera 102, Safari 16.6 Commented Aug 29, 2023 at 3:53
  • @ElementsinSpace: Thanks! My browser is Chromium 116 on (desktop) Fedora Workstation 38. Also under Edge 116 on MS Windows 10.
    – hardmath
    Commented Aug 29, 2023 at 19:02
  • 5
  • Repro'd. Same bug. Commented Aug 30, 2023 at 10:39
  • 5
    @V2Blast For bugs like this where you can reproduce the issue, please consider adding a status-review tag.
    – Makyen
    Commented Sep 10, 2023 at 15:22
  • @Makyen: The linked MSO post was already on our radar, so there isn't really a benefit from our end to adding the tag to both versions of the post. I've linked the Jira issue for this post to the existing issue for the MSO post.
    – V2Blast
    Commented Sep 11, 2023 at 15:23
  • 2
    As a workaround, based on the answer here by InSync you can execute delete $.ui in the browser console prior to trying to open the calendar and have the calendar displayed normally.
    – Makyen
    Commented Sep 22, 2023 at 13:45
  • @Makyen: I'm able to get this to work (and display the calendar), but it seems only to apply to the immediate Activity page (not to all Communities where I visit).
    – hardmath
    Commented Sep 22, 2023 at 15:54
  • @hardmath Yes, it will only apply to the current page. In a browser, each page visit is completely separate. The context in which the JavaScript is running is completely destroyed when you navigate away from the page. A new execution context is created when the new page starts loading. I was only offering a very temporary solution for a relatively rarely used feature. It is possible to create a userscript which is then loaded into every appropriate page and makes the correction automatically each time, which would be more appropriate if it's a feature that's often used or SE delays fixing.
    – Makyen
    Commented Sep 22, 2023 at 16:39
  • 2
    I see your update. But still, the issue exists in the "Saves" menu. The calendar icon is not responding when the Saves menu is active
    – Arulkumar
    Commented Jan 17 at 18:19
  • 1
    @Arulkumar: Good catch. Yes, the problem persists on the Saves menu tab, although it seems fixed for Settings/Preferences tab of user page. I only checked for this on Meta SE however.
    – hardmath
    Commented Jan 17 at 18:32

2 Answers 2

19

The culprit is the following function:

StackExchange.loadJqueryUi = function() {
    var cssLink = StackExchange.settings.paths.jQueryUICSSPath
      , jsLink = StackExchange.settings.paths.jQueryUIJSPath;
    if ($.ui)
        return $.Deferred().resolve();
    /* Some AJAX loader code... */
}

...which was called by:

$(function() {
    StackExchange.loadJqueryUi().done(showCalendar);
});

function showCalendar() {
    var $cal = $('.js-daily-access-calendar');
    
    $cal.datepicker({ /* Options... */ });
}

StackExchange.loadJqueryUi assumes that $.ui exists also means $.datepicker() is available, which was not the case. I tried two crude monkeypatches; they both worked:

StackExchange._loadJqueryUi = StackExchange.loadJqueryUi
StackExchange.loadJqueryUi = function() {
  delete $.ui;
  return StackExchange._loadJqueryUi();
}
StackExchange.loadJqueryUi = function() {
    var cssLink = StackExchange.settings.paths.jQueryUICSSPath
      , jsLink = StackExchange.settings.paths.jQueryUIJSPath;
    if ($.datepicker)
        return $.Deferred().resolve();
    /* The rest... */
}

TLDR: Run delete $.ui in your browser console.

Whether they break anything and how jQueryUI was loaded without .datepicker() in the first place are unknown. I didn't bother to check further, since all I want was to see my SO visit calendar. Isn't she beautiful?

Visited 189 days, 182 consecutive

2
  • I put a small bounty on this Question to encourage a revised Answer that explains how the problem was fixed. You seem to have the skills to spot what changed a few days ago.
    – hardmath
    Commented Jan 21 at 19:02
  • 1
    @hardmath I don't; I'm not a SE staffer and therefore have no idea whatsoever about how they changed their code (I didn't even notice that the bug was fixed until I got this notification). That said, I'm expecting them to write their own answer.
    – InSync
    Commented Jan 21 at 20:12
7

If it helps, I can reproduce this on MSE with a computer running Windows 10 22H2. My browser version is Firefox 116.0.3 (64-bit).

Here's what I get in the browser console, if it helps (on AU):

Uncaught TypeError: $cal.datepicker is not a function
    jQuery 14
    success https://cdn.sstatic.net/Js/user.en.js?v=9b38ac467cb4:1
    jQuery 6
    init https://cdn.sstatic.net/Js/user.en.js?v=9b38ac467cb4:1
    jQuery 9
    init https://cdn.sstatic.net/Js/user.en.js?v=9b38ac467cb4:1
    <anonymous> https://askubuntu.com/users/1438484/cocomac:40
    jQuery 3
    init https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    h https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    jQuery 3
    c https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    jQuery 2
    c https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    t https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    jQuery 3
    onreadystatechange https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    d https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    u https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    s https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    p https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    p https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    s https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    h https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    init https://cdn.sstatic.net/Js/stub.en.js?v=98d9f62851ed:1
    jQuery 8
1
  • If you are motivated to dig further, I posted a small bounty on this Question to encourage someone to explain how the fix was made a few days ago. Thanks for your earlier investigation!
    – hardmath
    Commented Jan 21 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .