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

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

Issue 2400303003: Update UI and catch executeScript errors now shown in Canary (Closed)
Patch Set: Add TODO to validate URLs Created 4 years, 1 month 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
« no previous file with comments | « go-back-with-backspace/pages/popup.html ('k') | go-back-with-backspace/pages/settings.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go-back-with-backspace/pages/popup.js
diff --git a/go-back-with-backspace/pages/popup.js b/go-back-with-backspace/pages/popup.js
index aa4666b36a9a700dd2dbb537e8395eceb768379d..02fbf616ebec43ef3ca6feb4c0f3583f0baf1fd2 100644
--- a/go-back-with-backspace/pages/popup.js
+++ b/go-back-with-backspace/pages/popup.js
@@ -25,7 +25,7 @@ function urlAllowed(url, file_ok) {
// Update the popup display depending on the current options and the URL of
// the current page.
function updatePopup(options, url) {
- var button = document.getElementById('list_edit_button');
+ var button = $('list-edit-button');
if (!urlAllowed(url, options.file_ok)) {
button.textContent = chrome.i18n.getMessage('popupAddBlacklist');
@@ -40,35 +40,32 @@ function updatePopup(options, url) {
// If the current page is prohibited because it's a file:// scheme, show a
// link to chrome://extensions, where that setting can be changed.
if (!options.file_ok && url.startsWith('file://')) {
- document.getElementById('file_url_message').hidden = false;
- document.getElementById('status').hidden = true;
+ $('file-url-message').hidden = false;
+ $('status').hidden = true;
}
}
// Set the status text and display it in the error style.
function setStatusError(message_id, placeholder) {
setStatus(message_id, placeholder);
- document.getElementById('status').classList.add('error');
+ $('status').classList.add('error');
}
// Set the status text.
function setStatus(message_id, placeholder) {
- var status = document.getElementById('status');
if (placeholder === undefined)
- status.textContent = chrome.i18n.getMessage(message_id);
+ $('status').textContent = chrome.i18n.getMessage(message_id);
else
- status.textContent = chrome.i18n.getMessage(message_id, placeholder);
+ $('status').textContent = chrome.i18n.getMessage(message_id, placeholder);
}
// Initialize the page.
function init() {
- LoadInternationalizedStrings();
+ loadInternationalizedStrings();
// Load the active tab's URL, then set up page features that depend on it.
chrome.tabs.query({active: true, currentWindow: true}, function(tabList) {
var url = tabList[0].url;
- var element = document.getElementById('current_url');
- element.textContent = chrome.i18n.getMessage('popupCurrentURL', url);
// Load settings.
var options = {};
@@ -86,7 +83,7 @@ function init() {
});
// Set event handlers that depend on the URL.
- document.getElementById('list_edit_button').onclick = function() {
+ $('list-edit-button').onclick = function() {
var index = options.blacklist.indexOf(url);
if (index > -1)
options.blacklist.splice(index, 1);
@@ -106,20 +103,20 @@ function init() {
});
};
- document.getElementById('report_page').onclick = function() {
- reportPage(url);
+ $('feedback-link').onclick = function() {
+ sendFeedback(url);
};
});
// Set event handlers that don't need the URL.
- document.getElementById('open_options').onclick = function() {
+ $('options-link').onclick = function() {
chrome.runtime.openOptionsPage();
};
- document.getElementById('open_extensions').onclick = function() {
+ $('open-extensions').onclick = function() {
chrome.tabs.create({url: 'chrome://extensions', active:true});
window.close();
};
}
-window.addEventListener('load', init, false);
+window.addEventListener('load', init);
« no previous file with comments | « go-back-with-backspace/pages/popup.html ('k') | go-back-with-backspace/pages/settings.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698