summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/resources/about_stats.js69
-rw-r--r--chrome/browser/resources/certificate_viewer.js7
-rw-r--r--chrome/browser/resources/crashes.js4
-rw-r--r--chrome/browser/resources/feedback.js18
-rw-r--r--chrome/browser/resources/flags.js16
-rw-r--r--chrome/browser/resources/plugins.js31
-rw-r--r--chrome/browser/resources/policy.js7
-rw-r--r--chrome/browser/resources/sessions.js16
-rw-r--r--chrome/browser/resources/sync_setup_overlay.js4
-rw-r--r--chrome/browser/resources/translate.js8
10 files changed, 86 insertions, 94 deletions
diff --git a/chrome/browser/resources/about_stats.js b/chrome/browser/resources/about_stats.js
index 30b8b96..82916a4 100644
--- a/chrome/browser/resources/about_stats.js
+++ b/chrome/browser/resources/about_stats.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,62 +42,58 @@ function filterMatching(text, nodelist, functionToGetNameNode) {
var showAll = text.length == 0;
for (var i = 0, node; node = nodelist[i]; i++) {
var name = functionToGetNameNode(node).innerHTML.toLowerCase();
- if (showAll || name.indexOf(text) >= 0) {
- node.style.display = "table-row";
- } else {
- node.style.display = "none";
- }
+ if (showAll || name.indexOf(text) >= 0)
+ node.style.display = 'table-row';
+ else
+ node.style.display = 'none';
}
}
/* Hides or shows counters based on the user's current filter selection. */
function doFilter() {
- var filter = document.getElementById("filter");
+ var filter = document.getElementById('filter');
var text = filter.value.toLowerCase();
- var nodes = document.getElementsByName("counter");
+ var nodes = document.getElementsByName('counter');
filterMatching(text, nodes, getCounterNameFromCounterNode);
- var nodes = document.getElementsByName("timer");
+ var nodes = document.getElementsByName('timer');
filterMatching(text, nodes, getTimerNameFromTimerNode);
}
/* Colors the counters based on increasing or decreasing value. */
function doColor() {
- var nodes = document.getElementsByName("counter");
+ var nodes = document.getElementsByName('counter');
for (var i = 0, node; node = nodes[i]; i++) {
var child = getCounterDeltaFromCounterNode(node);
var delta = child.innerHTML;
- if (delta > 0) {
- child.style.color = "Green";
- } else if (delta == 0) {
- child.style.color = "Black";
- } else {
- child.style.color = "Red";
- }
+ if (delta > 0)
+ child.style.color = 'Green';
+ else if (delta == 0)
+ child.style.color = 'Black';
+ else
+ child.style.color = 'Red';
}
}
/* Counters with no values are null. Remove them. */
function removeNullValues() {
- var nodes = document.getElementsByName("counter");
+ var nodes = document.getElementsByName('counter');
for (var i = nodes.length - 1; i >= 0; i--) {
var node = nodes[i];
var value = getCounterValueFromCounterNode(node).innerHTML;
- if (value == "null") {
+ if (value == 'null')
node.parentNode.removeChild(node);
- }
}
- var nodes = document.getElementsByName("timer");
+ var nodes = document.getElementsByName('timer');
for (var i = 0, node; node = nodes[i]; i++) {
var value_node = getTimerValueFromTimerNode(node);
- if (value_node.innerHTML == "null") {
- value_node.innerHTML = "";
- }
+ if (value_node.innerHTML == 'null')
+ value_node.innerHTML = '';
}
}
/* Compute the average time for timers */
function computeTimes() {
- var nodes = document.getElementsByName("timer");
+ var nodes = document.getElementsByName('timer');
for (var i = 0, node; node = nodes[i]; i++) {
var count = getTimerValueFromTimerNode(node).innerHTML;
if (count.length > 0) {
@@ -116,18 +112,18 @@ function onLoadWork() {
jstProcess(input, output);
// Add handlers to dynamically created HTML elements.
- var elements = document.getElementsByName("string-sort");
+ var elements = document.getElementsByName('string-sort');
for (var i = 0; i < elements.length; ++i)
- elements[i].onclick = function () { sort_table("string"); };
+ elements[i].onclick = function() { sort_table('string'); };
- elements = document.getElementsByName("number-sort");
+ elements = document.getElementsByName('number-sort');
for (i = 0; i < elements.length; ++i)
- elements[i].onclick = function () { sort_table("number"); };
+ elements[i].onclick = function() { sort_table('number'); };
doColor();
removeNullValues();
computeTimes();
- document.getElementById("filter").focus();
+ document.getElementById('filter').focus();
}
// The function should only be used as the event handler
@@ -137,7 +133,7 @@ function onLoadWork() {
// The function sorts rows after the row with onclick event handler.
//
// type: the data type, 'string', 'number'
-function sort_table(type){
+function sort_table(type) {
var cell = event.target;
var cnum = cell.cellIndex;
@@ -155,33 +151,33 @@ function sort_table(type){
rows.push(table.rows[i]);
// a, b are strings
- function compare_strings(a,b) {
+ function compare_strings(a, b) {
if (a == b) return 0;
if (a < b) return -1;
return 1;
}
// a, b are numbers
- function compare_numbers(a,b) {
+ function compare_numbers(a, b) {
var x = isNaN(a) ? 0 : a;
var y = isNaN(b) ? 0 : b;
return x - y;
}
- var sort_func = undefined;
+ var sort_func;
if (type === 'string') {
sort_func = function(a, b) {
var x = a.cells[cnum].innerText;
var y = b.cells[cnum].innerText;
return compare_strings(x, y);
- } ;
+ };
} else if (type === 'number') {
sort_func = function(a, b) {
var x = parseFloat(a.cells[cnum].innerText);
var y = parseFloat(b.cells[cnum].innerText);
return compare_numbers(x, y);
- }
+ };
}
rows.sort(sort_func);
@@ -199,4 +195,3 @@ function sort_table(type){
}
document.addEventListener('DOMContentLoaded', onLoadWork);
-
diff --git a/chrome/browser/resources/certificate_viewer.js b/chrome/browser/resources/certificate_viewer.js
index 3155521..95a5d82 100644
--- a/chrome/browser/resources/certificate_viewer.js
+++ b/chrome/browser/resources/certificate_viewer.js
@@ -21,9 +21,8 @@ cr.define('cert_viewer', function() {
chrome.send('requestCertificateInfo');
// TODO(kochi): ESC key should be handled in the views window side.
document.addEventListener('keydown', function(e) {
- if (e.keyCode == 27) { // ESC
+ if (e.keyCode == 27) // ESC
chrome.send('DialogClose');
- }
});
}
@@ -42,7 +41,7 @@ cr.define('cert_viewer', function() {
/**
* The tab name strings in the languages file have accessor keys indicated
* by a preceding & sign. Strip these out for now.
- * @TODO(flackr) These accessor keys could be implemented with Javascript or
+ * TODO(flackr) These accessor keys could be implemented with Javascript or
* translated strings could be added / modified to remove the & sign.
*/
function stripGtkAccessorKeys() {
@@ -50,7 +49,7 @@ cr.define('cert_viewer', function() {
var nodes = Array.prototype.slice.call($('tabs').childNodes, 0);
nodes.push($('export'));
for (var i = 0; i < nodes.length; i++)
- nodes[i].textContent = nodes[i].textContent.replace('&','');
+ nodes[i].textContent = nodes[i].textContent.replace('&', '');
}
/**
diff --git a/chrome/browser/resources/crashes.js b/chrome/browser/resources/crashes.js
index db18567..b4cec0e 100644
--- a/chrome/browser/resources/crashes.js
+++ b/chrome/browser/resources/crashes.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,7 +8,7 @@ localStrings = new LocalStrings();
* Requests the list of crashes from the backend.
*/
function requestCrashes() {
- chrome.send('requestCrashList', [])
+ chrome.send('requestCrashList');
}
/**
diff --git a/chrome/browser/resources/feedback.js b/chrome/browser/resources/feedback.js
index fc0588f..c529340 100644
--- a/chrome/browser/resources/feedback.js
+++ b/chrome/browser/resources/feedback.js
@@ -3,8 +3,8 @@
// found in the LICENSE file.
// Constants.
-var FEEDBACK_LANDING_PAGE =
- 'http://www.google.com/support/chrome/go/feedback_confirmation'
+/** @const */ var FEEDBACK_LANDING_PAGE =
+ 'http://www.google.com/support/chrome/go/feedback_confirmation';
var selectedThumbnailDivId = '';
var selectedThumbnailId = '';
@@ -14,7 +14,7 @@ var savedThumbnailIds = [];
savedThumbnailIds['current-screenshots'] = '';
savedThumbnailIds['saved-screenshots'] = '';
-var categoryTag = "";
+var categoryTag = '';
var localStrings = new LocalStrings();
@@ -110,7 +110,7 @@ function sendReport() {
// Add chromeos data if it exists.
if ($('user-email-text') && $('sys-info-checkbox')) {
- var userEmail= $('user-email-text').textContent;
+ var userEmail = $('user-email-text').textContent;
if (!$('user-email-checkbox').checked)
userEmail = '';
reportArray = reportArray.concat([userEmail,
@@ -124,7 +124,7 @@ function sendReport() {
}
function cancel() {
- chrome.send('cancel', []);
+ chrome.send('cancel');
return true;
}
@@ -154,7 +154,7 @@ function savedSelected() {
if ($('saved-screenshots').childElementCount == 0) {
// setupSavedScreenshots will take care of changing visibility
- chrome.send('refreshSavedScreenshots', []);
+ chrome.send('refreshSavedScreenshots');
} else {
$('saved-screenshots').hidden = false;
if (selectedThumbnailDivId != 'saved-screenshots')
@@ -251,9 +251,9 @@ function load() {
// Pick up the category tag (for most cases this will be an empty string)
categoryTag = parameters['categoryTag'];
- chrome.send('getDialogDefaults', []);
- chrome.send('refreshCurrentScreenshot', []);
-};
+ chrome.send('getDialogDefaults');
+ chrome.send('refreshCurrentScreenshot');
+}
function setupCurrentScreenshot(screenshot) {
addScreenshot('current-screenshots', screenshot);
diff --git a/chrome/browser/resources/flags.js b/chrome/browser/resources/flags.js
index 116810c4..640e068 100644
--- a/chrome/browser/resources/flags.js
+++ b/chrome/browser/resources/flags.js
@@ -47,7 +47,7 @@ function renderTemplate(flagsExperimentsData) {
// Add handlers to dynamically created HTML elements.
var elements = document.getElementsByClassName('experiment-select');
for (var i = 0; i < elements.length; ++i) {
- elements[i].onchange = function () {
+ elements[i].onchange = function() {
handleSelectChoiceExperiment(this, this.selectedIndex);
return false;
};
@@ -55,7 +55,7 @@ function renderTemplate(flagsExperimentsData) {
elements = document.getElementsByClassName('experiment-disable-link');
for (var i = 0; i < elements.length; ++i) {
- elements[i].onclick = function () {
+ elements[i].onclick = function() {
handleEnableExperiment(this, false);
return false;
};
@@ -63,7 +63,7 @@ function renderTemplate(flagsExperimentsData) {
elements = document.getElementsByClassName('experiment-enable-link');
for (var i = 0; i < elements.length; ++i) {
- elements[i].onclick = function () {
+ elements[i].onclick = function() {
handleEnableExperiment(this, true);
return false;
};
@@ -81,21 +81,21 @@ function renderTemplate(flagsExperimentsData) {
* should reply to returnFlagsExperiments() (below).
*/
function requestFlagsExperimentsData() {
- chrome.send('requestFlagsExperiments', []);
+ chrome.send('requestFlagsExperiments');
}
/**
* Asks the C++ FlagsDOMHandler to restart the browser (restoring tabs).
*/
function restartBrowser() {
- chrome.send('restartBrowser', []);
+ chrome.send('restartBrowser');
}
/**
* Called by the WebUI to re-populate the page with data representing the
* current state of installed experiments.
*/
-function returnFlagsExperiments(flagsExperimentsData){
+function returnFlagsExperiments(flagsExperimentsData) {
var bodyContainer = document.getElementById('body-container');
renderTemplate(flagsExperimentsData);
bodyContainer.style.visibility = 'visible';
@@ -107,7 +107,7 @@ function returnFlagsExperiments(flagsExperimentsData){
function handleEnableExperiment(node, enable) {
// Tell the C++ FlagsDOMHandler to enable/disable the experiment.
chrome.send('enableFlagsExperiment', [String(node.internal_name),
- String(enable)]);
+ String(enable)]);
requestFlagsExperimentsData();
}
@@ -118,7 +118,7 @@ function handleEnableExperiment(node, enable) {
function handleSelectChoiceExperiment(node, index) {
// Tell the C++ FlagsDOMHandler to enable the selected choice.
chrome.send('enableFlagsExperiment',
- [String(node.internal_name) + "@" + index, "true"]);
+ [String(node.internal_name) + '@' + index, 'true']);
requestFlagsExperimentsData();
}
diff --git a/chrome/browser/resources/plugins.js b/chrome/browser/resources/plugins.js
index 5f9edcb..80e1bd2 100644
--- a/chrome/browser/resources/plugins.js
+++ b/chrome/browser/resources/plugins.js
@@ -23,10 +23,10 @@ var pluginDataFormat = {
'description': 'My crappy plugin',
'mimeTypes': [
{ 'description': 'Foo Media',
- 'fileExtensions': [ 'foo' ],
+ 'fileExtensions': ['foo'],
'mimeType': 'application/x-my-foo' },
{ 'description': 'Bar Stuff',
- 'fileExtensions': [ 'bar','baz' ],
+ 'fileExtensions': ['bar', 'baz'],
'mimeType': 'application/my-bar' }
],
'enabledMode': 'enabledByUser'
@@ -38,7 +38,7 @@ var pluginDataFormat = {
'description': 'My first plugin',
'mimeTypes': [
{ 'description': 'New Guy Media',
- 'fileExtensions': [ 'mfp' ],
+ 'fileExtensions': ['mfp'],
'mimeType': 'application/x-my-first' }
],
'enabledMode': 'enabledByPolicy'
@@ -50,7 +50,7 @@ var pluginDataFormat = {
'description': 'Your great plugin',
'mimeTypes': [
{ 'description': 'Baz Stuff',
- 'fileExtensions': [ 'baz' ],
+ 'fileExtensions': ['baz'],
'mimeType': 'application/x-your-baz' }
],
'enabledMode': 'disabledByUser'
@@ -62,7 +62,7 @@ var pluginDataFormat = {
'description': 'His great plugin',
'mimeTypes': [
{ 'description': 'More baz Stuff',
- 'fileExtensions': [ 'bor' ],
+ 'fileExtensions': ['bor'],
'mimeType': 'application/x-his-bor' }
],
'enabledMode': 'disabledByPolicy'
@@ -91,8 +91,8 @@ function renderTemplate(pluginsData) {
* reply to returnPluginsData() (below).
*/
function requestPluginsData() {
- chrome.send('requestPluginsData', []);
- chrome.send('getShowDetails', []);
+ chrome.send('requestPluginsData');
+ chrome.send('getShowDetails');
}
function loadShowDetailsFromPrefs(show_details) {
@@ -109,7 +109,7 @@ function loadShowDetailsFromPrefs(show_details) {
* Called by the web_ui_ to re-populate the page with data representing the
* current state of installed plugins.
*/
-function returnPluginsData(pluginsData){
+function returnPluginsData(pluginsData) {
var bodyContainer = document.getElementById('body-container');
var body = document.body;
@@ -125,38 +125,38 @@ function returnPluginsData(pluginsData){
// Add handlers to dynamically created HTML elements.
var links = document.getElementsByClassName('disable-plugin-link');
for (var i = 0; i < links.length; i++) {
- links[i].onclick = function () {
+ links[i].onclick = function() {
handleEnablePlugin(this, false, false);
return false;
};
}
links = document.getElementsByClassName('enable-plugin-link');
for (var i = 0; i < links.length; i++) {
- links[i].onclick = function () {
+ links[i].onclick = function() {
handleEnablePlugin(this, true, false);
return false;
};
}
links = document.getElementsByClassName('disable-group-link');
for (var i = 0; i < links.length; i++) {
- links[i].onclick = function () {
+ links[i].onclick = function() {
handleEnablePlugin(this, false, true);
return false;
};
}
links = document.getElementsByClassName('enable-group-link');
for (var i = 0; i < links.length; i++) {
- links[i].onclick = function () {
+ links[i].onclick = function() {
handleEnablePlugin(this, true, true);
return false;
};
}
var checkboxes = document.getElementsByClassName('always-allow');
for (var i = 0; i < checkboxes.length; i++) {
- checkboxes[i].onclick = function () {
- handleSetPluginAlwaysAllowed(this)
+ checkboxes[i].onclick = function() {
+ handleSetPluginAlwaysAllowed(this);
};
- };
+ }
// Make sure the left column (with "Description:", "Location:", etc.) is the
// same size for all plugins.
@@ -257,4 +257,3 @@ document.addEventListener('DOMContentLoaded', requestPluginsData);
document.getElementById('collapse').onclick = toggleTmiMode;
document.getElementById('expand').onclick = toggleTmiMode;
document.getElementById('details-link').onclick = toggleTmiMode;
-
diff --git a/chrome/browser/resources/policy.js b/chrome/browser/resources/policy.js
index daceb6a..5c26d8b0 100644
--- a/chrome/browser/resources/policy.js
+++ b/chrome/browser/resources/policy.js
@@ -48,7 +48,6 @@ cr.define('policies', function() {
cr.addSingletonGetter(Policy);
Policy.prototype = {
-
/**
* True if none of the received policies are actually set, false otherwise.
* @type {boolean}
@@ -73,7 +72,7 @@ cr.define('policies', function() {
if (this.noActivePolicies_)
$('no-policies').hidden = false;
if (policyData.status.displayStatusSection)
- $('status-section').hidden = false;;
+ $('status-section').hidden = false;
// This is the javascript code that processes the template:
var input = new JsEvalContext(policyData);
@@ -90,7 +89,7 @@ cr.define('policies', function() {
var containers = document.querySelectorAll('.text-container');
for (var i = 0; i < containers.length; i++)
- this.initTextContainer_(containers[i])
+ this.initTextContainer_(containers[i]);
},
/**
@@ -256,7 +255,7 @@ cr.define('policies', function() {
$('fetch-policies-button').onclick = function(event) {
this.disabled = true;
Policy.triggerPolicyFetch();
- }
+ };
$('toggle-unsent-policies').onchange = function(event) {
Policy.getInstance().updatePolicyVisibility();
diff --git a/chrome/browser/resources/sessions.js b/chrome/browser/resources/sessions.js
index 5e6a3e4..61cceef 100644
--- a/chrome/browser/resources/sessions.js
+++ b/chrome/browser/resources/sessions.js
@@ -1,19 +1,19 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
localStrings = new LocalStrings();
// UTF8 sequence for an arrow triangle pointing down.
-kExpandedArrow = "\u25BE";
+kExpandedArrow = '\u25BE';
// UTF8 sequence for an arrow triangle pointing right.
-kCollapsedArrow = "\u25B8";
+kCollapsedArrow = '\u25B8';
/**
* Requests the list of sessions from the backend.
*/
function requestSessions() {
- chrome.send('requestSessionList', [])
+ chrome.send('requestSessionList');
}
/**
@@ -22,10 +22,10 @@ function requestSessions() {
function toggleExpandedState(div) {
if (div.textContent.indexOf(kExpandedArrow) != -1) {
div.textContent = div.textContent.replace(kExpandedArrow, kCollapsedArrow);
- div.parentNode.querySelector(".indent").hidden = true;
+ div.parentNode.querySelector('.indent').hidden = true;
} else {
div.textContent = div.textContent.replace(kCollapsedArrow, kExpandedArrow);
- div.parentNode.querySelector(".indent").hidden = false;
+ div.parentNode.querySelector('.indent').hidden = false;
}
}
@@ -71,7 +71,7 @@ function transformTab(tab) {
*/
function transformWindow(window) {
var windowDiv = document.createElement('div');
- windowDiv.className = "window";
+ windowDiv.className = 'window';
windowDiv.appendChild(createTitleDiv('window-title', 'Window'));
addItems(windowDiv, window.tabs, transformTab);
return windowDiv;
@@ -83,7 +83,7 @@ function transformWindow(window) {
function transformSession(session) {
var sessionDiv = document.createElement('div');
var sessionName = session.name.length == 0 ? 'Session' : session.name;
- sessionDiv.className = "session";
+ sessionDiv.className = 'session';
sessionDiv.appendChild(createTitleDiv('session-title', sessionName));
addItems(sessionDiv, session.windows, transformWindow);
return sessionDiv;
diff --git a/chrome/browser/resources/sync_setup_overlay.js b/chrome/browser/resources/sync_setup_overlay.js
index 9240022..3f84fe1 100644
--- a/chrome/browser/resources/sync_setup_overlay.js
+++ b/chrome/browser/resources/sync_setup_overlay.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
cr.define('options', function() {
- const OptionsPage = options.OptionsPage;
+ /** @const */ var OptionsPage = options.OptionsPage;
// Variable to track if a captcha challenge was issued. If this gets set to
// true, it stays that way until we are told about successful login from
@@ -74,7 +74,7 @@ cr.define('options', function() {
/** @inheritDoc */
didShowPage: function() {
- var forceLogin = document.location.hash == "#forceLogin";
+ var forceLogin = document.location.hash == '#forceLogin';
var result = JSON.stringify({'forceLogin': forceLogin});
chrome.send('SyncSetupAttachHandler', [result]);
},
diff --git a/chrome/browser/resources/translate.js b/chrome/browser/resources/translate.js
index 24153db..6568d35 100644
--- a/chrome/browser/resources/translate.js
+++ b/chrome/browser/resources/translate.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -74,7 +74,7 @@ cr.googleTranslate = (function() {
*/
get sourceLang() {
if (!libReady || !finished || error)
- return "";
+ return '';
return lib.getDetectedLanguage();
},
@@ -108,10 +108,10 @@ cr.googleTranslate = (function() {
* Entry point called by the Translate Element once it has been injected in
* the page.
*/
- onTranslateElementLoad : function() {
+ onTranslateElementLoad: function() {
try {
lib = google.translate.TranslateService({});
- } catch(err) {
+ } catch (err) {
error = true;
return;
}