fixed group attr in CSS highlighter

This commit is contained in:
DataHoarder 2022-04-27 15:01:20 +02:00
parent d0c76dc243
commit 9f212029fd
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name AnimeBytes Mediainfo Improvements
// @author WeebDataHoarder
// @version 1.28.1
// @version 1.28.2
// @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
@ -58,12 +58,24 @@ function wrap(...e) {
function wrapStyleClass(e, classType) {
let span = document.createElement("span");
let value;
if (typeof e === 'string'){
value = e;
} else {
value = e.textContent;
if (value === "") {
value = e.getAttribute("alt");
}
}
if(value === ""){
return e;
}
if(settings.getSetting("script_evaHighlightEmulation") || settings.getSetting("script_abHighlights2Emulation")){
span.setAttribute("data-" + classType, typeof e === 'string' ? e : e.textContent);
span.setAttribute("data-" + classType, value);
}
if(settings.getSetting("script_abHighlights2Emulation")){
span.classList.add("userscript-highlight", "torrent-field");
span.setAttribute("data-field", typeof e === 'string' ? e : e.textContent);
span.setAttribute("data-field", value);
}
span.append(e);
return span;
@ -158,7 +170,11 @@ function getEntryLine(tags, messages){
}
}
entries.text.push(wrap(wrapStyleClass(("subtitleCodec" in tags ? tags.subtitleCodec + " " : ""), "subbing-codec"), wrapStyleClass(("subtitleType" in tags ? getLineTagEntry(tags.subtitleType, false) : "RAW"), "subbing"), wrapStyleClass(("group" in tags ? " (" + tags.group + ")" : ""), "group")));
entries.text.push(wrap(
wrapStyleClass(("subtitleCodec" in tags ? tags.subtitleCodec + " " : ""), "subbing-codec"),
wrapStyleClass(("subtitleType" in tags ? getLineTagEntry(tags.subtitleType, false) : "RAW"), "subbing"),
("group" in tags ? wrap(" (", wrapStyleClass(tags.group, "group"), ")") : ""),
));
if(tags.remastered){
entries.other.push(createImage("remastered"));