Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • e9eb27c
  • /
  • templates
  • /
  • view
  • /
  • view_carousel_functionalities.js
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:d519cd2ea90c4635a210a319b02555a6963173c1
directory badge
swh:1:dir:033038e60894f76e0c7a9d49ad505b8121f41ed2

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
view_carousel_functionalities.js
function initialize_carousel() {
    let content_div_parallel_coordinates = d3.select('#' + item_plot_preferences[0].id + id_content_ending).select('.' + id_items_parallel_coordinates_class);

    initialize_items_plot_new(content_div_parallel_coordinates)

    let carousel_options_p = content_div_parallel_coordinates.append('div').attr('class', id_carousel_options).append('p');

    let circle_width_height = parseFloat(getComputedStyle(carousel_options_p.node()).getPropertyValue(id_view_property_dimension_button_width_height));
    let circle_width_height_radius = circle_width_height - 2;


    let circle_div_left = carousel_options_p.append('div')
        .attr('class', id_previous_button)//.style('float', 'left')
        .style('width', circle_width_height + 'px')
        .style('height', circle_width_height + 'px')
        .style('left', 'calc(50% - ' + circle_width_height + 'px - var(--padding)')
        .style('position', 'absolute')
        .append('svg')
        .style('width', circle_width_height + 'px')
        .style('height', circle_width_height + 'px')
        .attr('data-tippy-content', get_language_label_by_id(id_previous_button));


    tippy(circle_div_left.nodes());

    circle_div_left
        .append('circle')
        .attr("cx", circle_width_height_radius / 2)
        .attr("cy", circle_width_height_radius / 2 + 2)
        .attr("r", circle_width_height_radius / 2)
        .attr("stroke", "none")
        .style('fill', getComputedStyle(carousel_options_p.node()).getPropertyValue(id_view_propertiy_dimensions_background_color));

    let svg_width_height = circle_width_height_radius - 10;
    circle_div_left.append("svg:image")
        .attr('x', circle_width_height_radius / 2 - svg_width_height / 2)
        .attr('y', circle_width_height_radius / 2 - svg_width_height / 2 + 2)
        .attr('width', svg_width_height)
        .attr('height', svg_width_height)
        .attr('fill', 'white')
        .attr("xlink:href", "resources/left.png");

    let circle_div_right = carousel_options_p.append('div')
        .attr('class', id_next_button)
        .style('width', circle_width_height + 'px')
        .style('height', circle_width_height + 'px')
        .style('left', 'calc(50% + ' + circle_width_height + 'px + var(--padding)')
        .style('position', 'absolute')
        .append('svg')
        .style('width', circle_width_height + 'px')
        .style('height', circle_width_height + 'px')
        .attr('data-tippy-content', get_language_label_by_id(id_next_button));

    tippy(circle_div_right.nodes());

    circle_div_right
        .append('circle')
        .attr("cx", circle_width_height_radius / 2)
        .attr("cy", circle_width_height_radius / 2 + 2)
        .attr("r", circle_width_height_radius / 2)
        .attr("stroke", "none")
        .style('fill', getComputedStyle(carousel_options_p.node()).getPropertyValue(id_view_propertiy_dimensions_background_color));

    circle_div_right.append("svg:image")
        .attr('x', circle_width_height_radius / 2 - svg_width_height / 2)
        .attr('y', circle_width_height_radius / 2 - svg_width_height / 2 + 2)
        .attr('width', svg_width_height)
        .attr('height', svg_width_height)
        .attr('fill', 'white')
        .attr("xlink:href", "resources/right.png");

    selectedIndex = 0;

    rotateFn = 'rotateY';

    let prevButton = document.querySelector('.previous-button');
    prevButton.addEventListener('click', function () {
        selectedIndex--;
        rotateCarousel(true);
    });

    let nextButton = document.querySelector('.next-button');
    nextButton.addEventListener('click', function () {
        selectedIndex++;
        rotateCarousel(true);
    });
}

function rotateCarousel(bool_also_down) {

    if (column_values_grouped.length + selectedIndex === 0) {
        selectedIndex = 0;
    } else if (column_values_grouped.length - selectedIndex === 0) {
        selectedIndex = 0;
    }

    if (bool_also_down) {
        update_pcp_plot(get_visible_dimensions());
        highlight_donut_chart_after_rotation();

    }
}

function get_visible_dimensions() {
    let new_dimensions = [];

    for (let i = 0; i < d3.min([dimensions_count_shown, column_values_grouped.length]); i++) {
        let push_index = i + selectedIndex;

        if (push_index > column_values_grouped.length - 1) {
            push_index = push_index - column_values_grouped.length
        } else if (push_index < 0) {
            push_index = column_values_grouped.length + push_index
        }

        new_dimensions.push(column_values_grouped[push_index].id);
    }

    return (new_dimensions);
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API