run eslint --fix .

This commit is contained in:
YFdyh000
2017-07-09 05:57:35 +08:00
parent cb01687314
commit a547c672e7
7 changed files with 17 additions and 17 deletions

View File

@@ -69,6 +69,6 @@ browser.alarms.onAlarm.addListener((alarm) => {
/*
On page action click, navigate the corresponding tab to the cat gifs.
*/
browser.pageAction.onClicked.addListener(function () {
browser.pageAction.onClicked.addListener(() => {
browser.tabs.update({url: CATGIFS});
});

View File

@@ -3,7 +3,7 @@ browser.contextMenus.create({
title: "Copy link to clipboard",
contexts: ["link"],
});
browser.contextMenus.onClicked.addListener(function(info, tab) {
browser.contextMenus.onClicked.addListener((info, tab) => {
if (info.menuItemId === "copy-link-to-clipboard") {
// Examples: text and HTML to be copied.
const text = "This is text: " + info.linkUrl;
@@ -22,7 +22,7 @@ browser.contextMenus.onClicked.addListener(function(info, tab) {
browser.tabs.executeScript({
code: "typeof copyToClipboard === 'function';",
}).then(function(results) {
}).then((results) => {
// The content script's last expression will be true if the function
// has been defined. If this is not the case, then we need to run
// clipboard-helper.js to define function copyToClipboard.
@@ -31,11 +31,11 @@ browser.contextMenus.onClicked.addListener(function(info, tab) {
file: "clipboard-helper.js",
});
}
}).then(function() {
}).then(() => {
return browser.tabs.executeScript(tab.id, {
code,
});
}).catch(function(error) {
}).catch((error) => {
// This could happen if the extension is not allowed to run code in
// the page, for example if the tab is a privileged page.
console.error("Failed to copy text: " + error);

View File

@@ -127,7 +127,7 @@ function updateCheckUncheck() {
The click event listener, where we perform the appropriate action given the
ID of the menu item that was clicked.
*/
browser.contextMenus.onClicked.addListener(function(info, tab) {
browser.contextMenus.onClicked.addListener((info, tab) => {
switch (info.menuItemId) {
case "log-selection":
console.log(info.selectionText);

View File

@@ -2,7 +2,7 @@
Listen for messages from the page.
If the message was from the page script, show an alert.
*/
window.addEventListener("message", function(event) {
window.addEventListener("message", (event) => {
if (event.source == window &&
event.data &&
event.data.direction == "from-page-script") {

View File

@@ -88,7 +88,7 @@ function displayNote(title, body) {
/* set up listener for the delete functionality */
deleteBtn.addEventListener('click',function(e){
deleteBtn.addEventListener('click',(e) => {
evtTgt = e.target;
evtTgt.parentNode.parentNode.parentNode.removeChild(evtTgt.parentNode.parentNode);
browser.storage.local.remove(title);
@@ -125,24 +125,24 @@ function displayNote(title, body) {
/* set up listeners for the update functionality */
noteH.addEventListener('click',function(){
noteH.addEventListener('click',() => {
noteDisplay.style.display = 'none';
noteEdit.style.display = 'block';
})
notePara.addEventListener('click',function(){
notePara.addEventListener('click',() => {
noteDisplay.style.display = 'none';
noteEdit.style.display = 'block';
})
cancelBtn.addEventListener('click',function(){
cancelBtn.addEventListener('click',() => {
noteDisplay.style.display = 'block';
noteEdit.style.display = 'none';
noteTitleEdit.value = title;
noteBodyEdit.value = body;
})
updateBtn.addEventListener('click',function(){
updateBtn.addEventListener('click',() => {
if(noteTitleEdit.value !== title || noteBodyEdit.value !== body) {
updateNote(title,noteTitleEdit.value,noteBodyEdit.value);
note.parentNode.removeChild(note);

View File

@@ -47,7 +47,7 @@ function getCurrentWindowTabs() {
return browser.tabs.query({currentWindow: true});
}
document.addEventListener("click", function(e) {
document.addEventListener("click", (e) => {
function callOnActiveTab(callback) {
getCurrentWindowTabs().then((tabs) => {
for (var tab of tabs) {
@@ -173,7 +173,7 @@ document.addEventListener("click", function(e) {
chrome.tabs.query({
currentWindow: true
}, function(tabs) {
}, (tabs) => {
for (var tab of tabs) {
if (tab.id === tabId) {
chrome.tabs.update(tabId, {
@@ -188,7 +188,7 @@ document.addEventListener("click", function(e) {
});
//onRemoved listener. fired when tab is removed
browser.tabs.onRemoved.addListener(function(tabId, removeInfo){
browser.tabs.onRemoved.addListener((tabId, removeInfo) => {
console.log(`The tab with id: ${tabId}, is closing`);
if(removeInfo.isWindowClosing) {
@@ -199,7 +199,7 @@ browser.tabs.onRemoved.addListener(function(tabId, removeInfo){
});
//onMoved listener. fired when tab is moved into the same window
browser.tabs.onMoved.addListener(function(tabId, moveInfo){
browser.tabs.onMoved.addListener((tabId, moveInfo) => {
var startIndex = moveInfo.fromIndex;
var endIndex = moveInfo.toIndex;
console.log(`Tab with id: ${tabId} moved from index: ${startIndex} to index: ${endIndex}`);

View File

@@ -4,7 +4,7 @@ If the user clicks on an element which has the class "ua-choice":
* fetch the element's textContent: for example, "IE 11"
* pass it into the background page's setUaString() function
*/
document.addEventListener("click", function(e) {
document.addEventListener("click", (e) => {
if (!e.target.classList.contains("ua-choice")) {
return;
}