Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions scripts/cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var checked_labels_session = sessionStorage.getItem('checked_labels');
var checked_repo_names_session = sessionStorage.getItem('checked_repo_names');
var minimum_repo_stars_session = sessionStorage.getItem('minimum_repo_stars');
var entries_per_page = 10;
var MOBILE_BREAKPOINT = 440;

function killSpinner() {
let spinner = document.getElementById("loading");
Expand All @@ -16,14 +17,18 @@ function showTable() {
}

function renderFilteredList(filteredIssueList, entries_per_page) {
if (!entries_per_page || entries_per_page <= 0) {
entries_per_page = 10;
}
let total_num_pages = Math.ceil(filteredIssueList.length / entries_per_page);
Comment thread
apoorvdarshan marked this conversation as resolved.

$('#pagination').empty();
$('#pagination').removeData("twbs-pagination");
$('#pagination').unbind("page");
// Destroy the previous pagination instance to reset page state
if ($('#pagination').data("twbs-pagination")) {
$('#pagination').twbsPagination('destroy');
Comment thread
apoorvdarshan marked this conversation as resolved.
}

let number_of_visible_pages = 5;
if ($(window).width() <= 440) {
if ($(window).width() <= MOBILE_BREAKPOINT) {
number_of_visible_pages = 2;
}

Expand All @@ -33,6 +38,7 @@ function renderFilteredList(filteredIssueList, entries_per_page) {
$('#pagination').twbsPagination({
totalPages: total_num_pages,
visiblePages: number_of_visible_pages,
startPage: 1,
hideOnlyOnePage: true,
onPageClick: function (event, page) {
let page_index = page - 1; // Variable page starts from 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All perfect code

Expand Down