Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: go-back-with-backspace/pages/common.js

Issue 2400303003: Update UI and catch executeScript errors now shown in Canary (Closed)
Patch Set: Fix global-replace bug Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: go-back-with-backspace/pages/common.js
diff --git a/go-back-with-backspace/pages/common.js b/go-back-with-backspace/pages/common.js
index 9fb28c52b55789d3514c40c499cda60951205af7..328c708da4c8f4f04bc1b8ff16859134e9d6b5d4 100644
--- a/go-back-with-backspace/pages/common.js
+++ b/go-back-with-backspace/pages/common.js
@@ -4,20 +4,32 @@
// Load strings from messages.json into the HTML page. Each element that needs
// an internationalized string should have an 'i18n' property holding the
-// name of the message to be used.
-function LoadInternationalizedStrings() {
+// name of the message to be used. If the element instead has an 'i18n-alt'
+// property, that message will be used for the alt and title attributes of the
+// element (generally an image).
+function loadInternationalizedStrings() {
var all = document.querySelectorAll('[i18n]');
for (var i = 0; i < all.length; ++i) {
var i18n = all[i].getAttribute('i18n');
if (i18n)
all[i].textContent = chrome.i18n.getMessage(i18n);
}
+
+ all = document.querySelectorAll('[i18n-alt]');
+ for (var i = 0; i < all.length; ++i) {
+ var i18n = all[i].getAttribute('i18n-alt');
+ if (i18n) {
Devlin 2016/11/01 15:12:14 When is this falsey? (Same for line 14)
Pam (message me for reviews) 2016/11/01 21:29:03 Leftover from a past version, when it iterated ove
+ var message = chrome.i18n.getMessage(i18n);
+ all[i].alt = message;
+ all[i].title = message;
+ }
+ }
}
// Open a pre-filled email to send feedback to the extension developers. The
// initial content of the email depends on whether the URL of the current page
// is provided.
-function reportPage(url) {
+function sendFeedback(url) {
var subject = chrome.i18n.getMessage('reportSubject');
var body = '';
if (url)

Powered by Google App Engine
This is Rietveld 408576698