DBLP Page Count Display

Add total page count to DBLP paper listings

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         DBLP Page Count Display
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Add total page count to DBLP paper listings
// @author       You
// @match        https://dblp.org/*
// @match        https://dblp.uni-trier.de/*
// @match        https://*.dblp.org/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function addPageCounts() {
        // Find all pagination spans
        const paginationSpans = document.querySelectorAll('span[itemprop="pagination"]');

        paginationSpans.forEach(span => {
            // Check if we've already processed this span
            if (span.dataset.processed) return;

            const pageRange = span.textContent.trim();

            // Match patterns like "23-42" or "123-456"
            const match = pageRange.match(/^(\d+)-(\d+)$/);

            if (match) {
                const startPage = parseInt(match[1], 10);
                const endPage = parseInt(match[2], 10);
                const totalPages = endPage - startPage + 1;

                // Create a new span for the page count
                const countSpan = document.createElement('span');
                countSpan.textContent = ` (${totalPages} pages)`;
                countSpan.style.color = '#666';
                countSpan.style.fontSize = '0.95em';

                // Insert after the pagination span
                span.parentNode.insertBefore(countSpan, span.nextSibling);

                // Mark as processed
                span.dataset.processed = 'true';
            }
        });
    }

    // Run initially
    addPageCounts();

    // Watch for dynamic content changes
    const observer = new MutationObserver(() => {
        addPageCounts();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();