Skip to content

Instantly share code, notes, and snippets.

@niikoo
Last active November 16, 2024 11:16
Show Gist options
  • Save niikoo/5948a7d0a2d1bee2f0cfc1321ee6e7d9 to your computer and use it in GitHub Desktop.
Save niikoo/5948a7d0a2d1bee2f0cfc1321ee6e7d9 to your computer and use it in GitHub Desktop.
Prevent clicking entries in 'skattelisten'
// ==UserScript==
// @name Prevent clicking search results in "Skattelisten".
// @namespace http://tampermonkey.net/
// @version 0.4.0
// @author niikoo
// @match https://tjenester.skatteetaten.no/personsok
// @match https://skatt.skatteetaten.no/web/skattelistesoek*
// @grant none
// @downloadURL https://gist.github.com/niikoo/5948a7d0a2d1bee2f0cfc1321ee6e7d9/raw/skattelisten.clickdrop.user.js
// @updateURL https://gist.github.com/niikoo/5948a7d0a2d1bee2f0cfc1321ee6e7d9/raw/skattelisten.clickdrop.user.js
// @icon https://icons.duckduckgo.com/ip2/skatteetaten.no.ico
// ==/UserScript==
/* eslint-disable no-multi-spaces, curly */
/*
0.4 - Update for new page and drop jquery
0.3 - Show a person's age.
0.2 - Add update url
0.1 - Initial release
*/
(function() {
'use strict';
setInterval(() => {
try {
const tabellElem = document.getElementById("soekeresulat-tabell-person");
tabellElem.querySelectorAll('div[data-automationid="DetailsRowFields"]').forEach(elem => {
elem.onclick = function() { return false };
elem.href = '#';
const parentElem = elem.parentElement;
parentElem.innerHtml = elem.innerText;
parentElem.style.pointerEvents = 'none';
});
const currentYear = new Date().getFullYear();
tabellElem.querySelectorAll('div[data-automationid="DetailsRowFields"]').forEach(elem => {
try {
const yearElem = [...elem.querySelectorAll('div[data-automationid="DetailsRowCell"]')][1];
const year = parseInt(yearElem.innerText);
const age = currentYear - year;
yearElem.innerText = year + ' (' + age + ' år gammel i ' + currentYear + ')';
} catch {
// Ignore
}
});
} catch {
// Ignore
}
}, 500);
})();
@niikoo
Copy link
Author

niikoo commented Nov 14, 2020

Tested using Tampermonkey on Google Chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment