chore: format with prettier

pull/270/head
dessant 4 years ago
parent 15ae99ea13
commit 1f3588fa93

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

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

@ -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

@ -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

@ -2,7 +2,7 @@ import Vue from 'vue';
import App from './App';
var vm = new Vue({
new Vue({
el: '#app',
render: h => h(App)
});

@ -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';

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

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

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

@ -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,

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

@ -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(

Loading…
Cancel
Save