Skip to content

Commit

Permalink
New plug-in : MyAnimeList
Browse files Browse the repository at this point in the history
Request #744 by @prestidigitonium
  • Loading branch information
GrosPoulet committed Jun 20, 2021
1 parent b939263 commit 0b8c7ff
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manifest.json
Expand Up @@ -1755,6 +1755,11 @@
"js": ["plugins/maxsold.js"],
"matches": ["*://*.maxsold.com/*"
]
},
{
"js": ["plugins/myanimelist.js"],
"matches": ["*://*.myanimelist.net/*"
]
}
]
}
39 changes: 39 additions & 0 deletions plugins/myanimelist.js
@@ -0,0 +1,39 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'myanimelist',
version:'0.1',
prepareImgLinks:function (callback) {
var res = [];

// sample: https://cdn.myanimelist.net/images/clubs/11/354157_thumb.jpg
// zoomed: https://cdn.myanimelist.net/images/clubs/11/354157.jpg

// sample: https://cdn.myanimelist.net/s/common/store/cover/6129/8a6a30d4d3fd68771ad396639bc82cda959205b096a4ed17ee6f31de226bb3d2/m.jpg
// zoomed: https://cdn.myanimelist.net/s/common/store/cover/6129/8a6a30d4d3fd68771ad396639bc82cda959205b096a4ed17ee6f31de226bb3d2/original.jpg

// sample: https://cdn.myanimelist.net/images/anime/2/73862.webp
// zoomed: https://cdn.myanimelist.net/images/anime/2/73862l.webp

// sample: https://cdn.myanimelist.net/r/50x70/images/anime/1223/96541.webp?s=263cff1b768e29f3cc841792b2dded2e
// zoomed: https://cdn.myanimelist.net/images/anime/1223/96541.webp?s=263cff1b768e29f3cc841792b2dded2e

// sample: https://cdn.myanimelist.net/r/50x78/images/voiceactors/3/63373.jpg?s=f2d8f3f5a9a42ffe4dc7a64282264cbd
// zoomed: https://cdn.myanimelist.net/images/voiceactors/3/63373ll.jpg?s=f2d8f3f5a9a42ffe4dc7a64282264cbd

hoverZoom.urlReplace(res,
'img[src], [style*=url]',
[/\/r\/\d+x\d+\//, /\/([lms])\./, '/thumbs/', '_thumb.'],
['/', '/original.', '/', '.']
);

hoverZoom.urlReplace(res,
'img[src], [style*=url]',
[/\/r\/\d+x\d+\//, /\/(\d+)t?\./, /\/([lms])\./, '/thumbs/', '_thumb.'],
['/', '/$1l.', '/original.', '/', '.']
);

if (res.length) {
callback($(res), this.name);
}
}
});

0 comments on commit 0b8c7ff

Please sign in to comment.