-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmal-bigger-thumbnails.user.js
87 lines (82 loc) · 2.8 KB
/
mal-bigger-thumbnails.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// ==UserScript==
// @name MAL bigger images
// @namespace https://github.com/Alistair1231/my-userscripts/
// @version 0.3.3
// @description bigger thumbnails on MAL
// @author Alistair1231
// @match https://myanimelist.net/*
// @icon https://icons.duckduckgo.com/ip2/myanimelist.net.ico
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @license MIT
// ==/UserScript==
(function () {
"use strict";
setInterval(() => {
jQuery(document).ready(
jQuery("#content table .picSurround img").each(bigger)
);
jQuery(document).ready(
jQuery("#content table .ranking-list img").each(bigger)
);
// make animelist/mangalist images bigger
var checkExist = setInterval(function () {
//first element in list
if (location.href.split("/")[3] == "animelist") {
if (
$(
"#list-container > div.list-block > div > table > tbody:nth-child(2) > tr.list-table-data > td.data.title.clearfix > a"
).length
) {
jQuery(document).ready(
jQuery(".list-table-data .data.image img").each(bigger)
);
clearInterval(checkExist);
}
}
if (location.href.split("/")[3] == "mangalist") {
if (
$(
"#list-container > div.list-block > div > table > tbody:nth-child(2) > tr.list-table-data > td.data.image > a"
).length
) {
jQuery(document).ready(
jQuery(".list-table-data .data.image img").each(bigger)
);
clearInterval(checkExist);
}
}
}, 100); // check every 100ms
}, 500);
function bigger() {
var el = $(this)[0];
var imgTemp = el.src.match(/(\/images\/\w+\/\d+\/\d+)(?=t?\.\w{3,4})/);
if (imgTemp != null) {
var img = "https://cdn.myanimelist.net" + imgTemp[0] + ".jpg";
// el.src = el.src.replace(/https:\/\/cdn\.myanimelist\.net\/r\/\d+x\d+(\/images\/anime\/\d+\/\d+).*$/g,"https://cdn.myanimelist.net/$1.jpg")
if (img.match("/anime") != null || img.match("/manga") != null) {
el.height = 252;
el.width = 180;
jQuery(el).attr("srcset", img);
jQuery(el).css("object-fit", "contain");
// jQuery(el).attr('src',img)
// jQuery(el).attr('data-srcset',img)
// jQuery(el).attr('data-src',img)
if (
location.href.split("/")[3] == "animelist" ||
location.href.split("/")[3] == "mangalist"
)
biggerList();
}
}
}
function biggerList() {
jQuery(".list-table .list-table-data .data.image .image").css(
"height",
"252"
);
jQuery(".list-table .list-table-data .data.image .image").css(
"width",
"180"
);
}
})();