Skip to content

Commit

Permalink
Merge pull request #789 from GrosPoulet/master
Browse files Browse the repository at this point in the history
New plug-ins
  • Loading branch information
GrosPoulet authored Sep 4, 2021
2 parents 75b8dae + d773fe5 commit c5760f3
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 1 deletion.
19 changes: 18 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,9 @@
{
"js": ["plugins/safebooru.js"],
"matches": ["*://*.safebooru.org/*",
"*://*.gelbooru.com/*"]
"*://*.gelbooru.com/*",
"*://*.xbooru.com/*",
"*://*.booru.org/*"]
},
{
"js": ["plugins/depositphotos.js"],
Expand Down Expand Up @@ -1760,6 +1762,21 @@
"js": ["plugins/myanimelist.js"],
"matches": ["*://*.myanimelist.net/*"
]
},
{
"js": ["plugins/themoviedb.js"],
"matches": ["*://*.themoviedb.org/*"
]
},
{
"js": ["plugins/twibooru.js"],
"matches": ["*://*.twibooru.org/*"
]
},
{
"js": ["plugins/catawiki.js"],
"matches": ["*://*.catawiki.com/*"
]
}
]
}
28 changes: 28 additions & 0 deletions plugins/catawiki.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'catawiki',
version:'0.1',
prepareImgLinks:function (callback) {
var res = [];

// sample: https://cdn.catawiki.net/image/pr:cw_crop/w:98/h:76/sh:0.7/plain/assets/catawiki/assets/2021/5/15/6/9/6/696de2d5-5a9b-4a3d-9639-e878b25d418f.jpg
// original: https://assets.catawiki.nl/assets/2021/5/15/6/9/6/696de2d5-5a9b-4a3d-9639-e878b25d418f.jpg
hoverZoom.urlReplace(res,
'img[src],[style*="url"]',
/(.*catawiki\/assets\/)(.*$)/,
'https://assets.catawiki.nl/assets/$2'
);

// sample: https://assets.catawiki.nl/assets/2021/8/15/c/8/8/thumb5_c88fbb66-7096-4612-9756-1f6a7f935581.jpg
// original: https://assets.catawiki.nl/assets/2021/8/15/c/8/8/c88fbb66-7096-4612-9756-1f6a7f935581.jpg
hoverZoom.urlReplace(res,
'img[src],[style*="url"]',
/\/thumb.*?_/,
'/'
);

if (res.length) {
callback($(res), this.name);
}
}
});
20 changes: 20 additions & 0 deletions plugins/themoviedb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'themoviedb',
version:'0.1',
prepareImgLinks:function (callback) {
var res = [];

// sample: https://www.themoviedb.org/t/p/w276_and_h350_face/q0QXFRg5bSnaLjbvhamfclt0eId.jpg
// original: https://www.themoviedb.org/t/p/original/q0QXFRg5bSnaLjbvhamfclt0eId.jpg
hoverZoom.urlReplace(res,
'img[src]',
/\/p\/.*\//,
'/p/original/'
);

if (res.length) {
callback($(res), this.name);
}
}
});
51 changes: 51 additions & 0 deletions plugins/twibooru.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'twibooru',
version:'0.1',
prepareImgLinks:function (callback) {
var res = [];

// use data-uris attribute when available
$('[data-uris]').each(function () {
var _this = $(this);
var fullsrc = _this.data().uris.full;
if (fullsrc == undefined) return;
var img = _this.find('img');
if (img.data().hoverZoomSrc == undefined) img.data().hoverZoomSrc = [fullsrc];
else if (img.data().hoverZoomSrc.indexOf(fullsrc) == -1) img.data().hoverZoomSrc.unshift(fullsrc);
res.push(img);
});

/*
// sample: https://cdn.twibooru.org/img/2021/8/4/2516087/thumb.webp
// original: https://cdn.twibooru.org/img/2021/8/4/2516087/full.png
hoverZoom.urlReplace(res,
'img[src]',
/\/(thumb_tiny|thumb_small|thumb|small|medium|large|tall)(\.)(jpeg|png|webp)/,
'/full.png'
);
hoverZoom.urlReplace(res,
'img[src]',
/\/(thumb_tiny|thumb_small|thumb|small|medium|large|tall)(\.)(jpeg|png|webp)/,
'/full.jpeg'
);
// sample: https://cdn.twibooru.org/img/2021/7/18/2503661/thumb.gif
// original: https://cdn.twibooru.org/img/2021/7/18/2503661/full.webm
hoverZoom.urlReplace(res,
'img[src]',
/\/(thumb_tiny|thumb_small|thumb|small|medium|large|tall)(\.)(gif|webm)/,
'/full.gif'
);
hoverZoom.urlReplace(res,
'img[src]',
/\/(thumb_tiny|thumb_small|thumb|small|medium|large|tall)(\.)(gif|webm)/,
'/full.webm'
);
*/

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

0 comments on commit c5760f3

Please sign in to comment.