Attendance Boost (Optimized)

Faster, event-based attendance boost

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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         Attendance Boost (Optimized)
// @namespace    http://tampermonkey.net/
// @version      9.0
// @description  Faster, event-based attendance boost
// @match        https://arsdcollege.in/Internet/Student/Attendance_Report_Monthly.aspx
// @run-at       document-end
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
  'use strict';

  const BOOST = 12;

  const getText = (el) =>
    (el.textContent || '').replace(/\s+/g, ' ').trim();

  function applyFix() {
    const dEl = document.getElementById('lbl_Tot_LD');
    const aEl = document.getElementById('lbl_Tot_LA');
    const pEl = document.getElementById('lbl_percentage');

    if (!dEl || !aEl || !pEl) return;

    const delivered = parseInt(getText(dEl));
    const attended = parseInt(getText(aEl));

    if (!delivered || isNaN(attended)) return;

    const newAttended = Math.min(attended + BOOST, delivered);
    const newPct = ((newAttended / delivered) * 100).toFixed(2);

    // Only update if needed (prevents unnecessary DOM writes)
    if (aEl.textContent != newAttended) {
      aEl.textContent = newAttended;
      pEl.textContent = `Percent Attd. (Including Medical): ${newPct}`;

      console.log(
        `[AttFixer] ✅ ${attended} + ${BOOST} = ${newAttended} | ${newPct}%`
      );
    }
  }

  // Run immediately
  applyFix();

  // 🔥 Observe DOM changes instead of polling
  const observer = new MutationObserver(() => applyFix());

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

})();