diff --git a/gulpfile.js b/gulpfile.js index d3ab4a5..c380307 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,7 +23,7 @@ function clean() { } function jsWebpack(done) { - exec('webpack-cli --display-error-details --bail --colors', function( + exec('webpack-cli --display-error-details --bail --colors', function ( err, stdout, stderr @@ -95,7 +95,9 @@ async function fonts(done) { }); await new Promise(resolve => { - src('node_modules/fontsource-roboto/files/roboto-latin-@(400|500|700)-normal.woff2') + src( + 'node_modules/fontsource-roboto/files/roboto-latin-@(400|500|700)-normal.woff2' + ) .pipe(dest(path.join(distDir, 'src/fonts/files'))) .on('error', done) .on('finish', resolve); @@ -104,7 +106,7 @@ async function fonts(done) { async function locale(done) { const localesRootDir = path.join(__dirname, 'src/_locales'); - const localeDirs = readdirSync(localesRootDir).filter(function(file) { + const localeDirs = readdirSync(localesRootDir).filter(function (file) { return lstatSync(path.join(localesRootDir, file)).isDirectory(); }); for (const localeDir of localeDirs) { @@ -193,7 +195,7 @@ See the LICENSE file for further information. function zip(done) { exec( `web-ext build -s dist/${targetEnv} -a artifacts/${targetEnv} -n '{name}-{version}-${targetEnv}.zip' --overwrite-dest`, - function(err, stdout, stderr) { + function (err, stdout, stderr) { console.log(stdout); console.log(stderr); done(err); @@ -204,7 +206,7 @@ function zip(done) { function inspect(done) { exec( `webpack --profile --json > report.json && webpack-bundle-analyzer report.json dist/firefox/src && sleep 10 && rm report.{json,html}`, - function(err, stdout, stderr) { + function (err, stdout, stderr) { console.log(stdout); console.log(stderr); done(err); diff --git a/src/content/initReset.js b/src/content/initReset.js index d51a7d9..891db99 100644 --- a/src/content/initReset.js +++ b/src/content/initReset.js @@ -1,7 +1,7 @@ function initReset(challengeUrl) { const script = document.createElement('script'); - script.onload = function(e) { - e.target.remove(); + script.onload = function (ev) { + ev.target.remove(); document.dispatchEvent( new CustomEvent('___resetCaptcha', {detail: challengeUrl}) ); @@ -11,14 +11,14 @@ function initReset(challengeUrl) { } function addListener() { - const onMessage = function(request) { + const onMessage = function (request) { if (request.id === 'resetCaptcha') { removeCallbacks(); initReset(request.challengeUrl); } }; - const removeCallbacks = function() { + const removeCallbacks = function () { window.clearTimeout(timeoutId); chrome.runtime.onMessage.removeListener(onMessage); }; diff --git a/src/content/reset.js b/src/content/reset.js index 7a790c3..4617ca4 100644 --- a/src/content/reset.js +++ b/src/content/reset.js @@ -1,5 +1,5 @@ -(function() { - const reset = function(challengeUrl) { +(function () { + const reset = function (challengeUrl) { for (const [k, client] of Object.entries(___grecaptcha_cfg.clients)) { for (const [_, items] of Object.entries(client)) { for (const [_, v] of Object.entries(items)) { @@ -12,14 +12,14 @@ } }; - const onMessage = function(e) { - e.stopImmediatePropagation(); + const onMessage = function (ev) { + ev.stopImmediatePropagation(); window.clearTimeout(timeoutId); - reset(e.detail); + reset(ev.detail); }; - const timeoutId = window.setTimeout(function() { + const timeoutId = window.setTimeout(function () { document.removeEventListener('___resetCaptcha', onMessage, { capture: true, once: true diff --git a/src/contribute/App.vue b/src/contribute/App.vue index 49dcc91..9c081d1 100644 --- a/src/contribute/App.vue +++ b/src/contribute/App.vue @@ -15,7 +15,7 @@ export default { [Contribute.name]: Contribute }, - data: function() { + data: function () { return { extName: getText('extensionName'), extSlug: 'buster', @@ -23,7 +23,7 @@ export default { }; }, - created: function() { + created: function () { document.title = getText('pageTitle', [ getText('pageTitle_contribute'), this.extName diff --git a/src/contribute/main.js b/src/contribute/main.js index 2d519b3..d4da16e 100755 --- a/src/contribute/main.js +++ b/src/contribute/main.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import App from './App'; -var vm = new Vue({ +new Vue({ el: '#app', render: h => h(App) }); diff --git a/src/options/App.vue b/src/options/App.vue index 5a6a0c0..2aa78be 100644 --- a/src/options/App.vue +++ b/src/options/App.vue @@ -306,7 +306,7 @@ export default { try { await pingClientApp(); this.clientAppInstalled = true; - } catch (e) { + } catch (err) { if (!this.installGuideUrl) { this.installGuideUrl = 'https://github.com/dessant/buster/wiki/Installing-the-client-app'; diff --git a/src/options/main.js b/src/options/main.js index ead13f4..0f80e42 100644 --- a/src/options/main.js +++ b/src/options/main.js @@ -6,9 +6,9 @@ async function init() { try { await document.fonts.load('400 14px Roboto'); await document.fonts.load('500 14px Roboto'); - } catch (e) {} + } catch (err) {} - const vm = new Vue({ + new Vue({ el: '#app', render: h => h(App) }); diff --git a/src/setup/App.vue b/src/setup/App.vue index 0148254..274c39d 100644 --- a/src/setup/App.vue +++ b/src/setup/App.vue @@ -76,7 +76,7 @@ export default { [TextField.name]: TextField }, - data: function() { + data: function () { const urlParams = new URL(window.location.href).searchParams; const apiURL = new URL('http://127.0.0.1/api/v1'); apiURL.port = urlParams.get('port'); @@ -100,7 +100,7 @@ export default { methods: { getText, - getExtensionId: function() { + getExtensionId: function () { let id = browser.runtime.id; if (targetEnv !== 'firefox') { const scheme = window.location.protocol; @@ -110,7 +110,7 @@ export default { return id; }, - setLocation: async function() { + setLocation: async function () { try { await this.location(); } catch (err) { @@ -119,7 +119,7 @@ export default { } }, - runInstall: async function() { + runInstall: async function () { this.isInstalling = true; try { @@ -144,7 +144,7 @@ export default { } }, - location: async function() { + location: async function () { const data = new FormData(); data.append('session', this.session); data.append('browser', this.browser); @@ -167,7 +167,7 @@ export default { } }, - install: async function() { + install: async function () { const data = new FormData(); data.append('session', this.session); data.append('appDir', this.appDir); @@ -194,7 +194,7 @@ export default { } }, - created: async function() { + created: async function () { this.browser = (await browser.runtime.sendMessage({id: 'getBrowser'})).name; await this.setLocation(); diff --git a/src/setup/main.js b/src/setup/main.js index 143264d..d6d8cbf 100644 --- a/src/setup/main.js +++ b/src/setup/main.js @@ -6,9 +6,9 @@ async function init() { try { await document.fonts.load('400 14px Roboto'); await document.fonts.load('500 14px Roboto'); - } catch (e) {} + } catch (err) {} - const vm = new Vue({ + new Vue({ el: '#app', render: h => h(App) }); diff --git a/src/solve/main.js b/src/solve/main.js index d87696c..65f2b2c 100644 --- a/src/solve/main.js +++ b/src/solve/main.js @@ -279,10 +279,10 @@ async function solve(simulateUserInput, clickEvent) { } if (simulateUserInput) { - const muteAudio = function() { + const muteAudio = function () { audioEl.muted = true; }; - const unmuteAudio = function() { + const unmuteAudio = function () { removeCallbacks(); audioEl.muted = false; }; @@ -296,7 +296,7 @@ async function solve(simulateUserInput, clickEvent) { once: true }); - const removeCallbacks = function() { + const removeCallbacks = function () { window.clearTimeout(timeoutId); audioEl.removeEventListener('playing', muteAudio, { capture: true, diff --git a/src/utils/app.js b/src/utils/app.js index c8cfe8c..aac2539 100755 --- a/src/utils/app.js +++ b/src/utils/app.js @@ -28,7 +28,7 @@ function getOptionLabels(data, scope = 'optionValue') { const labels = {}; for (const [group, items] of Object.entries(data)) { labels[group] = []; - items.forEach(function(value) { + items.forEach(function (value) { labels[group].push({ id: value, label: getText(`${scope}_${group}_${value}`) @@ -57,24 +57,24 @@ function sendNativeMessage(port, message, {timeout = 10000} = {}) { const id = uuidv4(); message.id = id; - const messageCallback = function(msg) { + const messageCallback = function (msg) { if (msg.id !== id) { return; } removeListeners(); resolve(msg); }; - const errorCallback = function() { + const errorCallback = function () { removeListeners(); reject('No response from native app'); }; - const removeListeners = function() { + const removeListeners = function () { window.clearTimeout(timeoutId); port.onMessage.removeListener(messageCallback); port.onDisconnect.removeListener(errorCallback); }; - const timeoutId = window.setTimeout(function() { + const timeoutId = window.setTimeout(function () { errorCallback(); }, timeout); diff --git a/src/utils/common.js b/src/utils/common.js index 4daac50..d039901 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -45,7 +45,7 @@ async function getBrowser() { let name, version; try { ({name, version} = await browser.runtime.getBrowserInfo()); - } catch (e) {} + } catch (err) {} if (!name) { ({name, version} = Bowser.getParser( @@ -74,7 +74,7 @@ function waitForElement(selector, {timeout = 10000} = {}) { return; } - const observer = new MutationObserver(function(mutations, obs) { + const observer = new MutationObserver(function (mutations, obs) { const el = document.querySelector(selector); if (el) { obs.disconnect(); @@ -88,7 +88,7 @@ function waitForElement(selector, {timeout = 10000} = {}) { subtree: true }); - const timeoutId = window.setTimeout(function() { + const timeoutId = window.setTimeout(function () { observer.disconnect(); resolve(); }, timeout); @@ -130,7 +130,7 @@ async function scriptsAllowed(tabId, frameId = 0) { code: 'true;' }); return true; - } catch (e) {} + } catch (err) {} } async function functionInContext(