Use width as necessary, or wrap if not possible, dynamically
This commit is contained in:
parent
010a60d6eb
commit
445936bcb7
|
@ -1,12 +1,13 @@
|
|||
// ==UserScript==
|
||||
// @name AnimeBytes Mediainfo Improvements
|
||||
// @author WeebDataHoarder
|
||||
// @version 1.9.2
|
||||
// @version 1.9.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
|
||||
// @match https://animebytes.tv/torrents.php?*id=*
|
||||
// @icon http://animebytes.tv/favicon.ico
|
||||
// @grant GM_addStyle
|
||||
// @run-at document-end
|
||||
// ==/UserScript==
|
||||
|
||||
|
@ -612,11 +613,7 @@ const videoCodecs = [
|
|||
const torrentType = document.querySelector("a.scaledImg > img").getAttribute("title");
|
||||
const torrentTableColspan = 6;
|
||||
if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
||||
|
||||
//Make page wider
|
||||
let contentStyle = document.getElementById("content").style;
|
||||
contentStyle["max-width"] = "1400px";
|
||||
contentStyle["width"] = "calc(100% - 50px)";
|
||||
|
||||
let episodeCount = 0;
|
||||
document.querySelectorAll("ul.stats > li").forEach((item) => {
|
||||
|
@ -626,7 +623,7 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
}
|
||||
});
|
||||
|
||||
if(episodeCount === 0 && (torrentType === "Movie")){
|
||||
if(episodeCount === 0 && torrentType.match(/Movie$/) !== null){
|
||||
episodeCount = 1;
|
||||
}
|
||||
|
||||
|
@ -805,6 +802,34 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
});
|
||||
}
|
||||
|
||||
let contentStyle = document.getElementById("content").style;
|
||||
contentStyle["max-width"] = "calc(100% - 50px)";
|
||||
contentStyle["width"] = "fit-content";
|
||||
|
||||
GM_addStyle(`
|
||||
#content{
|
||||
max-width: calc(100% - 50px);
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
table.torrent_table {
|
||||
width: fit-content;
|
||||
}
|
||||
`);
|
||||
|
||||
const torrentTableElement = document.querySelector("div#content table.torrent_table");
|
||||
|
||||
const resizeCallback = () => {
|
||||
document.querySelectorAll("#torrents div.main_column > table:not(.torrent_table), #torrents div.main_column > div").forEach((e) => {
|
||||
console.log(e);
|
||||
e.style["width"] = torrentTableElement.offsetWidth + "px";
|
||||
});
|
||||
};
|
||||
const tableResizeObserver = new ResizeObserver(resizeCallback);
|
||||
tableResizeObserver.observe(torrentTableElement);
|
||||
resizeCallback();
|
||||
|
||||
|
||||
console.log(torrentListing);
|
||||
|
||||
torrentListing.forEach((torrent) => {
|
||||
|
@ -1097,7 +1122,14 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
}
|
||||
}
|
||||
|
||||
const ratio = ("stream_size" in audio) ? parseFloat(audio.stream_size.match(/\((?<percentage>[0-9.]+)%\)$/).groups.percentage) : null;
|
||||
let ratio = null;
|
||||
if("stream_size" in audio){
|
||||
try{
|
||||
ratio = parseFloat(audio.stream_size.match(/\((?<percentage>[0-9.]+)%\)$/).groups.percentage);
|
||||
}catch (e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!("remux" in tags) && audio.format === "PCM"){
|
||||
warnings.audio.push(["warning", "BLOAT: Audio track #"+(index+1)+" is uncompressed PCM."]);
|
||||
|
@ -1363,9 +1395,9 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
|
||||
["icons", "source", "video", "audio", "text", "other"].forEach((k) => {
|
||||
let td = document.createElement("td");
|
||||
td.style["white-space"] = "nowrap";
|
||||
td.style["max-width"] = "calc(80% / " + torrentTableColspan + ")";
|
||||
if(k !== "other"){
|
||||
td.style["width"] = "1%";
|
||||
//td.style["width"] = "1%";
|
||||
}
|
||||
td.style["cursor"] = "pointer";
|
||||
|
||||
|
|
Loading…
Reference in a new issue