Skip to content

Commit

Permalink
v5, removes search by image features, uses dynamic searching for rele…
Browse files Browse the repository at this point in the history
…vant DOM objects
  • Loading branch information
bijij committed Dec 30, 2023
1 parent f520c3b commit 884aefc
Show file tree
Hide file tree
Showing 32 changed files with 177 additions and 142 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Mozilla Add-on](https://img.shields.io/amo/v/view-image.svg)](https://addons.mozilla.org/en-US/firefox/addon/view-image/)
[![Travis](https://github.com/bijij/ViewImage/workflows/CI/badge.svg)](https://github.com/bijij/ViewImage/actions)

View Image is a Chrome / Firefox extension which implements the "View Image" and "Search by image" buttons back into Google Image Search.
View Image is a Chrome / Firefox extension which re-implements the "View Image" button back into Google Image Search.

## Install
You can get this extension for Firefox or Chrome or as a userscript:
Expand Down
2 changes: 1 addition & 1 deletion _locales/ca/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Reimplementa els botons \"Mostra la imatge\" i \"Cerca per imatge\" de Google Imatges.",
"message": "Reimplementa els boton \"Mostra la imatge\" de Google Imatges.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/cs/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, displayed on the web store."
},
"appDesc": {
"message": "Re-implimentuje tlačítka \"Zobrazit obrázek\" and \"Vyhledat podle obrázku\" na vyhledávači Google.",
"message": "Re-implementuje tlačítko \"Zobrazit obrázek\" na vyhledávači Google.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/da/messages.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"appDesc": {
"description": "The description of the application, as shown on the web store.",
"message": "Genindfør \"Vis billede\" og \"Søg efter billede\"-knapperne i Google Billeder."
"message": "Genindfør \"Vis billede\" og \"Vis billede\"-knappen i Google Billeder."
},
"appName": {
"description": "Title of the application, as displayed on the web store.",
Expand Down
2 changes: 1 addition & 1 deletion _locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Dieses Plugin bringt die Schaltfläche \"Bild ansehen\" und die \"Google Bildersuche\" zurück.",
"message": "Dieses Plugin bringt die Schaltfläche \"Bild ansehen\".",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Re-implements the Google Images' \"View Image\" and \"Search by Image\" buttons.",
"message": "Re-implements the Google Images' \"View Image\" button.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/es/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Título de la aplicación, mostrado en la Tienda Web."
},
"appDesc": {
"message": "Reimplementa los botones de Google Imágenes: \"Ver imagen\" y \"Buscar por imagen\".",
"message": "Reimplementa los botón de Google Imágenes: \"Ver imagen\".",
"description": "La descripción de la aplicación, mostrada en la Tienda Web."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Titre de l'application, affiché sur la boutique en ligne."
},
"appDesc": {
"message": "Réimplémente les boutons \"Voir l'image\" et \"Recherche par image\".",
"message": "Réimplémente les bouton \"Voir l'image\".",
"description": "La description de l'application, comme indiqué sur la boutique en ligne."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/he/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "כותרת היישום, כפי שמוצג בחנות האינטרנט."
},
"appDesc": {
"message": "מחזיר את הלחצנים \"הצג תמונה\" ו \"חפש לפי תמונה\" בגוגל תמונות.",
"message": "מחזיר אתלַחְצָן \"הצג תמונה\" בגוגל תמונות.",
"description": "תיאור היישום, כפי שמוצג בחנות האינטרנט."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/hu/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Újra elérhetővé válik a \"Kép megtekintése\" és a \"Keresés kép alapján\" gomb a Google képkeresőjében.",
"message": "Újra elérhetővé válik a \"Kép megtekintése\" gomb a Google képkeresőjében.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/it/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Riattiva i pulsanti \"Visualizza immagine\" e \"Ricerca tramite immagine\" di Google Immagini.",
"message": "Riattiva i pulsante \"Visualizza immagine\" di Google Immagini.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Google画像検索に\"画像を表示\"\"画像を検索\"ボタンを再実装します。",
"message": "Google画像検索に\"画像を表示\"ボタンを再実装します。",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Google 이미지의 \"이미지 보기\" \"이미지로 검색\" 버튼을 다시 적용합니다.",
"message": "Google 이미지의 \"이미지 보기\" 버튼을 다시 적용합니다.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/nl/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Titel van de applicatie, zoals weergegeven in de web store."
},
"appDesc": {
"message": "Herimplementeert de knoppen \"Afbeelding weergeven\" en \"Afbeelding zoeken\" in Google Afbeeldingen.",
"message": "Herimplementeert de knop \"Afbeelding weergeven\" in Google Afbeeldingen.",
"description": "Beschrijving van de applicatie, zoals weergegeven in de web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/no/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, displayed on the web store."
},
"appDesc": {
"message": "Re-implementerer Google Bilder, \"Se Bilde\" og \"Søk med Bilde\" knappene.",
"message": "Re-implementerer Google Bilder, \"Se Bilde\" og knappe.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/pl/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Nazwa aplikacji w sklepie internetowym."
},
"appDesc": {
"message": "Przywraca przyciski \"Pokaż obraz\" i \"Wyszukaj obrazem\" w Grafice Google.",
"message": "Przywraca przycisk \"Pokaż obraz\" w Grafice Google.",
"description": "Opis aplikacji w sklepie internetowym."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/pt/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Nome da extensão, como apresentado na web store."
},
"appDesc": {
"message": "Reintroduz o botão \"Ver imagem\" e o link \"Pesquisar por imagem\" do Google Imagens.",
"message": "Reintroduz o botão \"Ver imagem\" do Google Imagens.",
"description": "A descrição da extensão, como apresentada na web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/pt_BR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Nome da extensão, mostrada na web store."
},
"appDesc": {
"message": "Reimplementa no Google Imagens o botão \"Ver Imagem\" e o link \"Pesquisar por imagem\".",
"message": "Reimplementa no Google Imagens o botão \"Ver Imagem\".",
"description": "A descrição da extensão, como mostrada na web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/pt_PT/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Nome da extensão, como apresentado na web store."
},
"appDesc": {
"message": "Reintroduz o botão \"Ver imagem\" e o link \"Pesquisar por imagem\" do Google Imagens.",
"message": "Reintroduz o botão \"Ver imagem\" do Google Imagens.",
"description": "A descrição da extensão, como apresentada na web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "Возвращает в Google картинки кнопки' \"Открыть в полном размере\" и \"Поиск по картинке\".",
"message": "Возвращает в Google картинки кнопки' \"Открыть в полном размере\".",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/si/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": " \" පින්තුරය බලන්න \" සහ \" පින්තුරය මගින් සෙවීම \" පහසුකම් වල බොත්තම් නැවත සක්රීය කිරීම",
"message": " \" පින්තුරය බලන්න \" සහ පහසුකම් වල බොත්තම නැවත සක්රීය කිරීම",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/sk/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, displayed on the web store."
},
"appDesc": {
"message": "Pridá tlačidlá \"Zobraziť obrázok\" a \"Vyhľadať podľa obrázku\" do vyhladávača Google.",
"message": "Pridá tlačidlo \"Zobraziť obrázok\" do vyhladávača Google.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/sl/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Ime aplikacije, prikazano na spletni trgovini."
},
"appDesc": {
"message": "Ponovno prikaže gumba \"Ogled slike\" in \"Iskanje s sliko\" na Google Slikah.",
"message": "Ponovno prikaže gumb \"Ogled slike\" na Google Slikah.",
"description": "Opis aplikacije, prikazan na spletni trgovini."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/sv/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, displayed on the web store."
},
"appDesc": {
"message": "Re-implimenterar Google bilden, \"Visa originalbilden\" och \"Fler storlekar\" knapparna.",
"message": "Re-implimenterar Google bilden, \"Visa originalbilden\" knappen.",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/tr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Uygulamanın web store üzerinde gösterildiği şekliyle başlığı."
},
"appDesc": {
"message": "Google Görseller'in \"Resmi Görüntüle\" ve \"Görselle Ara\" düğmelerini sağlar.",
"message": "Google Görsellerin \"Resmi Görüntüle\" vdüğme sağlar.",
"description": "Uygulamanın web store üzerinde gösterildiği şekliyle açıklaması."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "重新实现 Google 图片的“查看图片”和“以图搜图”按钮。",
"message": "重新实现 Google 图片的“查看图片”按钮。",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Title of the application, as displayed on the web store."
},
"appDesc": {
"message": "重新實現 Google 圖片的「檢視圖片」和「以圖搜圖」按鈕。",
"message": "重新實現 Google 圖片的「檢視圖片」按鈕。",
"description": "The description of the application, as shown on the web store."
},
"searchImage": {
Expand Down
8 changes: 8 additions & 0 deletions html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,29 @@
<label for="open-in-new-tab"></label>
</div>

<!-- Deprecated for now.
<div class="toggle">
<span data-localise="__MSG_settingsToggle_newTab_searchByImage__">Open "Search by Image" in a new tab:</span>
<input type="checkbox" id="open-search-by-in-new-tab" />
<label for="open-search-by-in-new-tab"></label>
</div>
-->

<!-- Deprecated, Google images new theme doesn't have this.
<div class="toggle">
<span data-localise="__MSG_settingsToggle_globeIcon__">Show Globe icon in "View Image" button:</span>
<input type="checkbox" id="show-globe-icon" />
<label for="show-globe-icon"></label>
</div>
-->

<!-- Deprecated for now.
<div class="toggle">
<span data-localise="__MSG_settingsToggle_contextMenu_searchByImage__">Show "Search by Image" context menu item:</span>
<input type="checkbox" id="context-menu-search-by-image" />
<label for="context-menu-search-by-image"></label>
</div>
-->

<!-- Depercated for now.
<div class="toggle" id="context-menu-search-by-image-new-tab-toggle">
Expand Down Expand Up @@ -67,10 +73,12 @@
<span data-localise="__MSG_viewImage__">View Image: </span>
<input type="text" id="button-text-view-image" />
</div>
<!-- Deprecated for now.
<div>
<span data-localise="__MSG_searchImage__">Search by Image: </span>
<input type="text" id="button-text-search-by-image" />
</div>
-->
</div>

<button type="button" id="reset-options" data-localise="__MSG_resetButton__">Reset</button>
Expand Down
27 changes: 15 additions & 12 deletions js/background.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
'use-strict';

const DEBUG = false;
const DEBUG = true;

Check failure on line 3 in js/background.js

View workflow job for this annotation

GitHub Actions / build

'DEBUG' is assigned a value but never used

function toI18n(str) {
/* function toI18n(str) {
return str.replace(/__MSG_(\w+)__/g, function (match, v1) {
return v1 ? chrome.i18n.getMessage(v1) : '';
});
}
} */

// Default options
const defaultOptions = {
'open-in-new-tab': true,
'open-search-by-in-new-tab': true,
'show-globe-icon': true,
//'open-search-by-in-new-tab': true,
//'show-globe-icon': true,
//'hide-images-subject-to-copyright': false,
'manually-set-button-text': false,
'no-referrer': false,
'button-text-view-image': '',
'button-text-search-by-image': '',
'context-menu-search-by-image': true,
//'button-text-search-by-image': '',
//'context-menu-search-by-image': true,
//'context-menu-search-by-image-new-tab': false,
};

Expand All @@ -27,7 +27,8 @@ chrome.storage.sync.get('defaultOptions', function () {
chrome.storage.sync.set({ defaultOptions });
});

chrome.runtime.onInstalled.addListener(() => {
// Deprecated for now, user feedback is that it's not useful
/* chrome.runtime.onInstalled.addListener(() => {
chrome.storage.sync.get(['options', 'defaultOptions'], (storage) => {
if (!storage.hasOwnProperty('options')) {
storage.options = {};
Expand All @@ -36,7 +37,8 @@ chrome.runtime.onInstalled.addListener(() => {
const options = Object.assign(storage.defaultOptions, storage.options);
// Setup "Search by image" context menu item
if (options['context-menu-search-by-image']) {
if (options['context-menu-search-by-image']) {
chrome.contextMenus.create(
{
'id': 'ViewImage-SearchByImage',
Expand All @@ -46,9 +48,10 @@ chrome.runtime.onInstalled.addListener(() => {
);
}
});
});
}); */

chrome.contextMenus.onClicked.addListener((info, tab) => {
// See above deprecation note
/* chrome.contextMenus.onClicked.addListener((info, tab) => {
if (DEBUG)
console.log('ViewImage: Search By Image context menu item clicked.', info, tab);
Expand All @@ -57,4 +60,4 @@ chrome.contextMenus.onClicked.addListener((info, tab) => {
url: `https://lens.google.com/uploadbyurl?url=${encodeURIComponent(info.srcUrl)}`,
});
}
});
}); */

Check failure on line 63 in js/background.js

View workflow job for this annotation

GitHub Actions / build

Newline required at end of file but not found
Loading

0 comments on commit 884aefc

Please sign in to comment.