Skip to content
Snippets Groups Projects
Select Git revision
  • 737c0b2ade4ea92ea85ad9c536553abfcbc96877
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

startpage.js

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    startpage.js 1.02 KiB
    STUDIP.domReady(() => {
        if ($('html').is(':not(.responsive-display)')) {
            STUDIP.startpage.init();
        }
    });
    
    // Add handler for "read all" on news widget
    $(document).on('click', '#start-index .visit-all', function(event) {
        var icon = $(this),
            url = icon.attr('href'),
            widget = icon.closest('.studip-widget');
    
        icon.prop('disabled', true).addClass('ajaxing');
    
        $.getJSON(url).then(function(response) {
            if (response) {
                $('article.new', widget).removeClass('new');
                $('.news-comments-unread', widget)
                    .removeClass('news-comments-unread')
                    .removeAttr('title');
    
                // It is approriate to use attr() to modify data here since
                // the attribute's value is displayed via css, thus it needs
                // to be actually in the DOM.
                $('#nav_start [data-badge]')
                    .attr('data-badge', 0)
                    .trigger('badgechange');
    
                icon.remove();
            }
        });
    
        event.preventDefault();
    });