compare link element width to parent element width for longlink evaluation

This commit is contained in:
Joe 2021-03-23 21:07:02 -05:00
parent 2fb085fc4d
commit 139855da31
Signed by: joe
GPG Key ID: 8595A3F8F2CE1B74
1 changed files with 2 additions and 1 deletions

View File

@ -1,8 +1,9 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3
document.addEventListener('DOMContentLoaded', function () {
var link = document.getElementsByTagName('A');
var parent = document.getElementsByTagName('A').parentElement;
for (var i = 0; i < link.length; i++) {
if (link[i].innerHTML.length < 26) {
if (link[i].clientWidth < parent[i].clientWidth) {
link[i].classList.add('not-long')
};
}