arXiv: marcar papers como leídos
Cuando haces clic en un enlace PDF, guarda el ID localmente y atenúa las filas del paper en los listados.
Código para copiar
// Mark papers as "read" once you click their PDF link, dim them in listings
(function () {
var KEY = 'jzArxReadIds';
function load() {
try { return JSON.parse(localStorage.getItem(KEY) || '{}') || {}; }
catch (e) { return {}; }
}
function save(map) { localStorage.setItem(KEY, JSON.stringify(map)); }
function markId(id) {
if (!id) { return; }
var m = load(); m[id] = Date.now(); save(m);
apply();
}
function extractId(href) {
var m = href.match(/\/(?:abs|pdf)\/([\w.\-\/]+?)(?:v\d+)?(?:\.pdf)?$/);
return m ? m[1] : null;
}
document.addEventListener('click', function (e) {
var a = e.target.closest('a[href*="/pdf/"], a[href$=".pdf"]');
if (!a) { return; }
markId(extractId(a.getAttribute('href') || ''));
}, true);
function apply() {
var read = load();
document.querySelectorAll('a[href*="/abs/"]').forEach(function (a) {
var id = extractId(a.getAttribute('href') || '');
if (!id || !read[id]) { return; }
var row = a.closest('dt, li, tr, .arxiv-result') || a.parentElement;
if (row && !row.dataset.jzArxRead) {
row.dataset.jzArxRead = '1';
row.style.opacity = '0.55';
row.style.filter = 'grayscale(0.5)';
var tag = document.createElement('span');
tag.textContent = ' ✓ read';
tag.style.cssText = 'color:#0a7c3a;font-weight:700;font-size:12px;margin-left:6px;';
a.appendChild(tag);
}
});
}
apply();
new MutationObserver(function () {
clearTimeout(window.__jzArxRead);
window.__jzArxRead = setTimeout(apply, 400);
}).observe(document.body, { childList: true, subtree: true });
})();
Cómo usar este ejemplo
- Copia el código con el botón de arriba.
- Instala JustZix (2 minutos) y abre la extensión en la página de destino.
- Añade una nueva regla que coincida con esa página.
- Pega el código en el panel JavaScript de la regla y guarda — se ejecuta en cada visita a la página.
Valora este ejemplo
Sin valoraciones — sé el primero.