// ==UserScript==
// @name EPFO Service History - Hide Wipro and Renumber
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Hide Wipro locally and renumber remaining service entries
// @match https://passbook.epfindia.gov.in/MemberPassBook/service-history*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function () {
'use strict';
const TARGET_COMPANY = 'WIPRO LIMITED';
function updateServiceHistory() {
const timeline = document.querySelector('ul.timeline');
if (!timeline) return;
const entries = Array.from(
timeline.querySelectorAll(':scope > li.timeline-item')
);
let number = 1;
entries.forEach(entry => {
const company = entry.querySelector(
'p.text-muted.mb-2.bold'
);
const companyName = company?.textContent
.trim()
.replace(/\s+/g, ' ')
.toUpperCase();
if (companyName === TARGET_COMPANY) {
entry.style.setProperty(
'display', 'none', 'important'
);
const separator = entry.nextElementSibling;
if (separator?.matches('hr.service-history-hr')) {
separator.style.setProperty(
'display', 'none', 'important'
);
}
return;
}
const heading = entry.querySelector(
'.service-history-heading'
);
if (heading) {
heading.textContent = String(number);
}
number++;
});
}
let scheduled = false;
function scheduleUpdate() {
if (scheduled) return;
scheduled = true;
requestAnimationFrame(() => {
scheduled = false;
updateServiceHistory();
});
}
updateServiceHistory();
const observer = new MutationObserver(scheduleUpdate);
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
})();3 views