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); |