Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge remote-tracking branch 'upstream/master' #677

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions plugins/1x.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ hoverZoomPlugins.push({
'-thumb.',
'-fullsize.'
);
hoverZoom.urlReplace(res,
'img[src]',
'-ld.',
'-sd.'
);
hoverZoom.urlReplace(res,
'img[src]',
'-ld.',
Expand All @@ -32,6 +37,11 @@ hoverZoomPlugins.push({
hoverZoom.urlReplace(res,
'img[src]',
'-ld.',
'-hd4.'
);
hoverZoom.urlReplace(res,
'img[src]',
'-sq.',
'-sd.'
);
hoverZoom.urlReplace(res,
Expand All @@ -42,13 +52,14 @@ hoverZoomPlugins.push({
hoverZoom.urlReplace(res,
'img[src]',
'-sq.',
'-sd.'
'-hd4.'
);
hoverZoom.urlReplace(res,
'img[src]',
'-square.',
'.'
);
callback($(res));

callback($(res), this.name);
}
});
51 changes: 44 additions & 7 deletions plugins/3dtotal.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,59 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'3dtotal.com',
version:'0.1',
version:'0.3',
prepareImgLinks:function (callback) {
var res = [];
var res = [];

hoverZoom.urlReplace(res,
'img[src*="3dtotal"]',
'img[src]',
/\/gallery_.*?\//,
'/gallery_originals/'
);


hoverZoom.urlReplace(res,
'img[src]',
/\.(card|expanded|image|large|medium|small|thumb)\..+/,
'.jpg'
);

hoverZoom.urlReplace(res,
'img[src]',
/\.(card|expanded|image|large|medium|small|thumb)\..+/,
'.png'
);

hoverZoom.urlReplace(res,
'div[style*="background"]',
/\/gallery_.*?\//,
'/gallery_originals/'
);

callback($(res));

$('[style*=background]').each(function() {
var link = $(this);
// extract url from style
var backgroundImage = this.style.backgroundImage;
if (backgroundImage.indexOf("url") != -1) {
var reUrl = /.*url\s*\(\s*(.*)\s*\).*/i
backgroundImage = backgroundImage.replace(reUrl, '$1');
// remove leading & trailing quotes
var backgroundImageUrl = backgroundImage.replace(/^['"]/,"").replace(/['"]+$/,"");
var reFullsize = /\.(card|expanded|image|large|medium|small|thumb)\..+/
$(['.jpg','.png']).each(function() {
var extension = this.toString();
var fullsizeUrl = backgroundImageUrl.replace(reFullsize,extension);
if (fullsizeUrl != backgroundImageUrl) {

if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.unshift(fullsizeUrl);
res.push(link);
}
}
});
}
});

callback($(res), this.name);
}
});
8 changes: 4 additions & 4 deletions plugins/adobestock.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'adobestock.com',
version:'0.1',
version:'0.2',
prepareImgLinks:function (callback) {
var res = [];
hoverZoom.urlReplace(res,
'img[src]',
'/240_F',
'/1000_F'
['/240_F', '/500_F'],
['/1000_F', '/1000_F']
);

callback($(res));
callback($(res), this.name);
}
});
35 changes: 30 additions & 5 deletions plugins/allocine.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'Allocine',
version:'0.1',
version:'0.2',
prepareImgLinks:function (callback) {
var res = [];
$('a img:not([src$="empty.gif"]):not(.hnipimg)').each(function () {

/*$('a img:not([src$="empty.gif"]):not(.hnipimg)').each(function () {
var img = $(this);
var src = img.attr('src');
if (!src) return;
Expand All @@ -16,9 +17,33 @@ hoverZoomPlugins.push({
}
src = aSrc.join('/');
var link = $(this).parents('a:eq(0)');
link.data().hoverZoomSrc = [src];
res.push(link);
if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(src) == -1) {
link.data().hoverZoomSrc.unshift(src);
res.push(link);
}
});*/

$('a img:not([src$="empty.gif"]):not(.hnipimg)').each(function () {
var link = $(this).parents('a:eq(0)');
var img = $(this);
var src = img.attr('src');
if (!src) return;
var aSrc = src.replace(/\/[cr]_\d+_\d+\//, '/');

if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(aSrc) == -1) {
link.data().hoverZoomSrc.unshift(aSrc);
res.push(link);
}
});
callback($(res));

hoverZoom.urlReplace(res,
'img[src]',
/\/[cr]_\d+_\d+\//,
'/'
);

callback($(res), this.name);
}
});
14 changes: 7 additions & 7 deletions plugins/artlimited.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'artlimited.net',
version:'0.1',
version:'0.3',
prepareImgLinks:function (callback) {
var res = [];
var res = [];

hoverZoom.urlReplace(res,
'img[src*="artlimited.net"]',
['_s', '_m'],
['', '']
'img[src]',
['_s', '_m', '-medium-', '-small-'],
['', '', '-large-', '-large-']
);
callback($(res));
callback($(res), this.name);
}
});
2 changes: 1 addition & 1 deletion plugins/artsper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hoverZoomPlugins.push({
var res = [];

hoverZoom.urlReplace(res,
'img[src*="artsper"]',
'img[src]',
['_p.', '_s.', '_m.', '_f.', '_grid.'],
['_l.', '_l.', '_l.', '_l.', '_l.']
);
Expand Down
2 changes: 1 addition & 1 deletion plugins/bing_a.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hoverZoomPlugins.push({
var patch = '$1?$2';

hoverZoom.urlReplace(res,
'img[src*=".bing.net/th"]',
'img[src*="/th?"]',
regex,
patch
);
Expand Down
27 changes: 13 additions & 14 deletions plugins/boardgamegeek.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'BoardGameGeek',
version:'0.3',
version:'0.5',
prepareImgLinks:function (callback) {

var name = this.name;
var res = [];

//hoverZoom.urlReplace(res, 'img[src*="_mt."]', /_mt/, '');
Expand All @@ -12,20 +13,20 @@ hoverZoomPlugins.push({
//hoverZoom.urlReplace(res, 'img[src*="_md."]', /_md/, '');
//hoverZoom.urlReplace(res, 'img[src*="_lg."]', /_lg/, '');
//hoverZoom.urlReplace(res, 'img[src]', /geekdo-images.com\/[^images].*\/pic/, 'geekdo-images.com\/images\/pic');

// https://cf.geekdo-images.com/T936PUt9WZBkv6vjXLYvcwrDXU8=/35x35/https://cf.geekdo-static.com/avatars/avatar_id46554.jpg
// -> https://cf.geekdo-static.com/avatars/avatar_id46554.jpg
hoverZoom.urlReplace(res, 'img[src]', /.*\/(http.*)/, '$1');

// use API call to retrieve fullsize img url
// method based on Imagus extension
// method based on Imagus extension
// method based on Imagus extension, check this file : https://github.com/Zren/chrome-extension-imagus/blob/community/unminified/sieve.jsn
//
// sample url : https://cf.geekdo-images.com/tinysquare/img/_tWFnVEWmngUa5tzPMV9baJFa1A=/fit-in/30x30/pic2119260.jpg
// -> image id : 2119260
// -> API call : https://api.geekdo.com/api/images/2119260
// -> fullsize url : data.images.original.url = https://cf.geekdo-images.com/original/img/lWyxk2AH3g29lS-kmDQjkWlOOhc=/0x0/pic2119260.jpg
$('img[src]:not(.hoverZoomLink),[style*=url]:not(.hoverZoomLink)').parent().one('mouseover', function() {
$('img[src]:not(.hoverZoomMouseover),[style*=url]:not(.hoverZoomMouseover)').addClass('hoverZoomMouseover').parent().one('mouseover', function() {

// extract url from link, it might be an image or a background-image
var link = $(this).children('img[src]')[0];
Expand Down Expand Up @@ -66,19 +67,18 @@ hoverZoomPlugins.push({
var data = JSON.parse(response);
} catch (e) { return; }

// store response in sessionStorage
// store response in sessionStorage
fullsizeUrl = data.images.original.url;
sessionStorage.setItem(id, fullsizeUrl);
console.log('photo fullsizeUrl (from API call):' + fullsizeUrl);

if (fullsizeUrl != undefined) {
if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.push(fullsizeUrl);
link.data().hoverZoomSrc.reverse();
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.unshift(fullsizeUrl);
}
link.addClass('hoverZoomLink');
callback(link);
callback(link, name);
hoverZoom.displayPicFromElement(link);
}
});
} else {
Expand All @@ -90,11 +90,10 @@ hoverZoomPlugins.push({
if (fullsizeUrl != undefined) {
if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.push(fullsizeUrl);
link.data().hoverZoomSrc.reverse();
link.data().hoverZoomSrc.unshift(fullsizeUrl);
}
link.addClass('hoverZoomLink');
callback(link);
callback(link, name);
hoverZoom.displayPicFromElement(link);
}
}
}
Expand Down
24 changes: 21 additions & 3 deletions plugins/cgsociety.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'cgsociety.org',
version:'0.1',
version:'0.2',
prepareImgLinks:function (callback) {
var res = [];

Expand All @@ -16,7 +16,25 @@ hoverZoomPlugins.push({
['_300.', '_600.', '_large.'],
['_orig.', '_orig.', '_orig.']
);

callback($(res));

hoverZoom.urlReplace(res,
'img[src]',
['/thumbnail/', '/thumb/', '/xs/', '/xsmall/', '/small/', '/tiny/', '/micro/', '/preview/', '/medium/', '/channel/', '/channel_2x/', '/channel_3x/'],
['/large/', '/large/', '/large/', '/large/', '/large/', '/large/', '/large/', '/large/', '/large/', '/large/', '/large/', '/large/']
);

hoverZoom.urlReplace(res,
'img[src]',
['/thumbnail/', '/thumb/', '/xs/', '/xsmall/', '/small/', '/tiny/', '/micro/', '/preview/', '/medium/', '/channel/', '/channel_2x/', '/channel_3x/', '/large/'],
['/original/', '/original/', '/original/', '/original/', '/original/', '/original/', '/original/', '/original/', '/original/', '/original/', '/original/', '/original/', '/original/']
);

hoverZoom.urlReplace(res,
'img[src]',
['/thumbnail/', '/thumb/', '/xs/', '/xsmall/', '/small/', '/tiny/', '/micro/', '/preview/', '/medium/', '/channel/', '/channel_2x/', '/channel_3x/', '/large/'],
['/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/', '/orig/']
);

callback($(res), this.name);
}
});
Loading