Set all data fields per each element

This commit is contained in:
DataHoarder 2022-04-24 21:03:03 +02:00
parent 4f1a6c9deb
commit 8bb4599929
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name AnimeBytes Mediainfo Improvements
// @author WeebDataHoarder
// @version 1.27.1
// @version 1.27.3
// @downloadURL https://git.gammaspectra.live/WeebDataHoarder/userscripts/raw/branch/master/AnimeBytes/ab-mediainfo.user.js
// @updateURL https://git.gammaspectra.live/WeebDataHoarder/userscripts/raw/branch/master/AnimeBytes/ab-mediainfo.user.js
// @description AnimeBytes Mediainfo Improvements. Adds several listing and matching releases against mediainfo utilities. MIT license
@ -1908,6 +1908,7 @@ if(
let entryText = [];
let fields = [];
["icons", "source", "video", "audio", "text", "other"].forEach((k) => {
let td = document.createElement("td");
td.style["max-width"] = "calc(80% / " + torrentTableColspan + ")";
@ -1944,7 +1945,6 @@ if(
a.classList.add("userscript-highlight", "torrent-page");
a.querySelectorAll("span.userscript-highlight").forEach((e) => {
let fields = [];
e.getAttributeNames().forEach((name) => {
if(name.match(/^data-/) !== null){
let attr = e.getAttribute(name);
@ -1952,7 +1952,6 @@ if(
fields.push(attr);
}
});
a.setAttribute("data-fields", fields.join(" "))
});
}
@ -1963,6 +1962,12 @@ if(
entryText.push(td.textContent.trim());
});
if(settings.getSetting("script_abHighlights2Emulation")) {
lastTd.parentElement.querySelectorAll("td > a.userscript-highlight").forEach((e) => {
e.setAttribute("data-fields", fields.join(" "))
})
}
if(settings.getSetting("script_deliciousCompatMode")){
let hiddenParent = torrent.elements.link.closest("td");
let span = document.createElement("span");