Skip to content

Commit

Permalink
Update with new image css-class from A/B test.
Browse files Browse the repository at this point in the history
  • Loading branch information
bijij committed May 22, 2023
1 parent 5ae7163 commit 819a1cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ chrome.contextMenus.onClicked.addListener(

if (options['context-menu-search-by-image-new-tab']) {
chrome.tabs.executeScript(tab.id, {
code: `window.open('http://www.google.com/searchbyimage?image_url=${encodeURIComponent(info.srcUrl)}', '_blank').focus();`
code: `window.open('https://lens.google.com/uploadbyurl?url=${encodeURIComponent(info.srcUrl)}', '_blank').focus();`
});
} else {
chrome.tabs.executeScript(tab.id, {
code: `window.location.href = 'http://www.google.com/searchbyimage?image_url=${encodeURIComponent(info.srcUrl)}';`
code: `window.location.href = 'https://lens.google.com/uploadbyurl?url=${encodeURIComponent(info.srcUrl)}';`
});
}
});
Expand Down
10 changes: 5 additions & 5 deletions js/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function findImageURL(container, version) {
image = iframe.contentDocument.querySelector('img#irc_mi');
break;
case VERSIONS.OCT19:
image = container.querySelector('img[src].n3VNCb');
image = container.querySelector('img[src].n3VNCb, img[src].r48jcc');
if (image.src in images) {
return images[image.src];
}
Expand Down Expand Up @@ -126,7 +126,7 @@ function addViewImageButton(container, imageURL, version) {
visitButton = container.querySelector('a.irc_hol[href]');
break;
case VERSIONS.OCT19:
visitButton = container.querySelector('.ZsbmCf[href], a.J2oL9c, a.jAklOc');
visitButton = container.querySelector('.ZsbmCf[href], a.J2oL9c, a.jAklOc, a.uZ49bd');
break;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ function addSearchImageButton(container, imageURL, version) {
}

// Set the search by image button url
searchImageButton.href = '/searchbyimage?image_url=' + encodeURIComponent(imageURL);
searchImageButton.href = '/uploadbyurl?url=' + encodeURIComponent(imageURL);

// Set additional options
if (options['open-search-by-in-new-tab']) {
Expand Down Expand Up @@ -363,14 +363,14 @@ var observer = new MutationObserver(function (mutations) {
for (node of mutation.addedNodes) {
if (node.classList) {
// Check for new image nodes
if (['irc_mi', 'irc_mut', 'irc_ris', 'n3VNCb'].some(className => node.classList.contains(className))) {
if (['irc_mi', 'irc_mut', 'irc_ris', 'n3VNCb', 'r48jcc'].some(className => node.classList.contains(className))) {
addLinks(node);
}
}
}
}

if (mutation.target.classList && mutation.target.classList.contains('n3VNCb')) {
if (mutation.target.classList && mutation.target.classList.contains('n3VNCb', 'r48jcc')) {
node = mutation.target.closest('.tvh9oe');

if (!node.hasAttribute('aria-hidden')) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_appName__",
"version": "3.6.5",
"version": "3.7.0",
"description": "__MSG_appDesc__",
"homepage_url": "https://github.com/bijij/ViewImage",
"default_locale": "en",
Expand Down

0 comments on commit 819a1cf

Please sign in to comment.