<commit_before>register_namespace('ui');


ui.go_to_page = function(name) {
    $('.page').hide();
    $('#page_'+name).show();
    ui.popup.hide();
    if (name == 'tune') {
        ui.get_ads('#dashboard');
        $('#now-playing').toggle(player.control.is_playing());
    }
};


ui.resz = function() {
    var ww = $(window).width();
    var wh = $(window).height()
    $('.slider_seek').width(ww-400);
    $('#search-widget__name').width(ww-150);
    $('#trackinfo div').width(ww-140);
    if (config.mode != 'vk') {
        $('#trackinfo_panel').height(wh-$('#controls').height()-20);
        $('#dashboard').height(wh - (29 + 51 + 14)); // some magic number
        $('#search-result').height(wh - (29 + 51 + 19)); // another magic number
        $('.popup__content').css('max-height', wh - 134); // some random value
    }
};


ui.fit = function() {
    var app_content = $c('#app-content'),
        search_suggest = $('#search-suggest :visible'),
        popup = $('.popup:visible'),
        iframe = $('body>iframe');
    var h = app_content.height();
    if (popup.length) {
        var ph = popup.height() + popup.offset().top + 30;
        if (h < ph) {
            h = ph;
        }
    }
    // vk comment form attach popup
    if (iframe.length) {
        var ih = iframe.height();
        if (h < ih) {
            h = ih;
        }
    }
    if (ui.fit.previous_height != h) {
        network.vkontakte.callMethod('resizeWindow', 627, parseInt(h, 10));
        ui.fit.previous_height = h;
    }
};

ui.fit.previous_height = 0;

ui.show_loader_fullscreen = function() {
    $('#loader_fullscreen__cancel').hide();
    $('#loader_fullscreen').show();
};


ui.hide_loader_fullscreen = function() {
    $('#loader_fullscreen').hide();
};


ui.get_stations_list_html = function(list, max) {
    if (!max) {
        max = Infinity;
    }
    max = Math.min(max, list.length);
    var context = {'stations': []};
    for (var i = 0; i < max; i++) {
        context.stations.push({
            'type': list[i].type,
            'name': list[i].name,
            'html': player.station[list[i].type].get_html(list[i].name)
        });
    }
    return ich.tpl_stationslist(context);
};


ui.update_dashboard = function() {
    $('#dashboard__cell_stations_favorited .dashboard__cell__content').html(ui.get_stations_list_html(userdata.favorited_stations.list, 10));
    $('#dashboard__cell_stations_recent .dashboard__cell__content').html(ui.get_stations_list_html(userdata.recent_stations.list, 10));
};


ui.update_album_info = function() {
    var current_track = player.playlist.get_current_track();
    $('.album_name').text(current_track.album_name).fadeIn();
    $('.album_cover').attr('src', current_track.album_cover + '?' + Math.random());
    ui.infoblock.show($('#tabcontent_tabs_player__album_info'), 'album', current_track.album_name + ' (' + current_track.album_artist + ')');
    network.stores.buy_album_links(current_track.album_artist, current_track.album_name, function(data){
        if (data['fuzy']) {
            $('#fuzy').attr('href', data['fuzy']).fadeIn(100);
        }
    });

};

ui.update_track_info = function() {<commit_msg>Отключен магазин.<commit_after>register_namespace('ui');


ui.go_to_page = function(name) {
    $('.page').hide();
    $('#page_'+name).show();
    ui.popup.hide();
    if (name == 'tune') {
        ui.get_ads('#dashboard');
        $('#now-playing').toggle(player.control.is_playing());
    }
};


ui.resz = function() {
    var ww = $(window).width();
    var wh = $(window).height()
    $('.slider_seek').width(ww-400);
    $('#search-widget__name').width(ww-150);
    $('#trackinfo div').width(ww-140);
    if (config.mode != 'vk') {
        $('#trackinfo_panel').height(wh-$('#controls').height()-20);
        $('#dashboard').height(wh - (29 + 51 + 14)); // some magic number
        $('#search-result').height(wh - (29 + 51 + 19)); // another magic number
        $('.popup__content').css('max-height', wh - 134); // some random value
    }
};


ui.fit = function() {
    var app_content = $c('#app-content'),
        search_suggest = $('#search-suggest :visible'),
        popup = $('.popup:visible'),
        iframe = $('body>iframe');
    var h = app_content.height();
    if (popup.length) {
        var ph = popup.height() + popup.offset().top + 30;
        if (h < ph) {
            h = ph;
        }
    }
    // vk comment form attach popup
    if (iframe.length) {
        var ih = iframe.height();
        if (h < ih) {
            h = ih;
        }
    }
    if (ui.fit.previous_height != h) {
        network.vkontakte.callMethod('resizeWindow', 627, parseInt(h, 10));
        ui.fit.previous_height = h;
    }
};

ui.fit.previous_height = 0;

ui.show_loader_fullscreen = function() {
    $('#loader_fullscreen__cancel').hide();
    $('#loader_fullscreen').show();
};


ui.hide_loader_fullscreen = function() {
    $('#loader_fullscreen').hide();
};


ui.get_stations_list_html = function(list, max) {
    if (!max) {
        max = Infinity;
    }
    max = Math.min(max, list.length);
    var context = {'stations': []};
    for (var i = 0; i < max; i++) {
        context.stations.push({
            'type': list[i].type,
            'name': list[i].name,
            'html': player.station[list[i].type].get_html(list[i].name)
        });
    }
    return ich.tpl_stationslist(context);
};


ui.update_dashboard = function() {
    $('#dashboard__cell_stations_favorited .dashboard__cell__content').html(ui.get_stations_list_html(userdata.favorited_stations.list, 10));
    $('#dashboard__cell_stations_recent .dashboard__cell__content').html(ui.get_stations_list_html(userdata.recent_stations.list, 10));
};


ui.update_album_info = function() {
    var current_track = player.playlist.get_current_track();
    $('.album_name').text(current_track.album_name).fadeIn();
    $('.album_cover').attr('src', current_track.album_cover + '?' + Math.random());
    ui.infoblock.show($('#tabcontent_tabs_player__album_info'), 'album', current_track.album_name + ' (' + current_track.album_artist + ')');
    // network.stores.buy_album_links(current_track.album_artist, current_track.album_name, function(data){
    //     if (data['fuzy']) {
    //         $('#fuzy').attr('href', data['fuzy']).fadeIn(100);
    //     }
    // });

};

ui.update_track_info = function() {
{'fraction_non_alphanumeric': 0.19508738781294285, 'fraction_numerical': 0.013226263580538498, 'mean_word_length': 2.9502487562189055, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '7134592', 'n_tokens_mistral': 2214, 'n_tokens_neox': 2134, 'n_words': 333}