Refactored code to comply with Google Style Guides
This commit refactors JS, MD and Bash files in order to comply with the
Google style guides.
Change-Id: I5bc9a175d2400fa1095ba9eb1c8cff3ebfef4b8f
diff --git a/src/options.js b/src/options.js
index 1a321b4..5f965b9 100644
--- a/src/options.js
+++ b/src/options.js
@@ -3,25 +3,25 @@
}
const defaultOptions = {
- "list": true,
- "thread": true,
- "threadall": false,
- "fixedtoolbar": false,
- "redirect": false,
- "history": false,
- "loaddrafts": false,
- "batchduplicate": false,
- "escalatethreads": false,
- "movethreads": false,
- "increasecontrast": false,
- "stickysidebarheaders": false
+ 'list': true,
+ 'thread': true,
+ 'threadall': false,
+ 'fixedtoolbar': false,
+ 'redirect': false,
+ 'history': false,
+ 'loaddrafts': false,
+ 'batchduplicate': false,
+ 'escalatethreads': false,
+ 'movethreads': false,
+ 'increasecontrast': false,
+ 'stickysidebarheaders': false,
};
const deprecatedOptions = [
- "list",
- "escalatethreads",
- "movethreads",
- "batchduplicate"
+ 'list',
+ 'escalatethreads',
+ 'movethreads',
+ 'batchduplicate',
];
function cleanUpOptions(options) {
@@ -43,9 +43,9 @@
function save() {
var options = defaultOptions;
- Object.keys(options).forEach(function (opt) {
+ Object.keys(options).forEach(function(opt) {
if (deprecatedOptions.includes(opt)) return;
- options[opt] = document.querySelector("#"+opt).checked || false;
+ options[opt] = document.querySelector('#' + opt).checked || false;
});
chrome.storage.sync.set(options, function() {
@@ -54,16 +54,21 @@
}
function i18n() {
- document.querySelectorAll("[data-i18n]").forEach(el => el.innerHTML = chrome.i18n.getMessage("options_"+el.getAttribute("data-i18n")));
+ document.querySelectorAll('[data-i18n]')
+ .forEach(
+ el => el.innerHTML = chrome.i18n.getMessage(
+ 'options_' + el.getAttribute('data-i18n')));
}
function thread() {
- if (document.querySelector("#thread").checked && document.querySelector("#threadall").checked) {
- document.querySelector("#"+(this.id == "thread" ? "threadall" : "thread")).checked = false;
+ if (document.querySelector('#thread').checked &&
+ document.querySelector('#threadall').checked) {
+ document.querySelector('#' + (this.id == 'thread' ? 'threadall' : 'thread'))
+ .checked = false;
}
}
-window.addEventListener("load", function() {
+window.addEventListener('load', function() {
i18n();
chrome.storage.sync.get(null, function(items) {
@@ -71,11 +76,13 @@
Object.keys(defaultOptions).forEach(function(opt) {
if (items[opt] === true && !deprecatedOptions.includes(opt)) {
- document.querySelector("#"+opt).checked = true;
+ document.querySelector('#' + opt).checked = true;
}
});
- ["thread", "threadall"].forEach(el => document.querySelector("#"+el).addEventListener("change", thread));
- document.querySelector("#save").addEventListener("click", save);
+ ['thread', 'threadall'].forEach(
+ el => document.querySelector('#' + el).addEventListener(
+ 'change', thread));
+ document.querySelector('#save').addEventListener('click', save);
});
});