refactor(*): eslint

This commit is contained in:
xhyrom 2022-01-02 19:02:40 +01:00
parent 65b7c2f4c2
commit c7b55c9c06
3 changed files with 65 additions and 63 deletions

View file

@ -0,0 +1,2 @@
public/script.js
next.config.js

View file

@ -1,14 +1,14 @@
const { createSecureHeaders } = require("next-secure-headers");
const { createSecureHeaders } = require('next-secure-headers');
module.exports = {
assetPrefix: '/roles-bot/',
async headers() {
return [{
source: "/(.*)",
source: '/(.*)',
headers: createSecureHeaders({
forceHTTPSRedirect: [true, { maxAge: 60 * 60 * 24 * 4, includeSubDomains: true }],
referrerPolicy: "same-origin",
referrerPolicy: 'same-origin',
}),
}];
},
}
};

View file

@ -1,12 +1,12 @@
let json = {
const json = {
roles: []
}
};
$('input').change((e) => {
json[e.currentTarget.id] = e.currentTarget.value;
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
})
});
$('button[id=addRole]').click((e) => {
Swal.fire({
@ -21,8 +21,8 @@ $('button[id=addRole]').click((e) => {
$('#swal-input1').val(),
$('#swal-input2').val(),
$('#swal-input3').val()
])
})
]);
});
}
}).then(function (result) {
if (result.value?.[0] && result.value?.[1]) {
@ -30,12 +30,12 @@ $('button[id=addRole]').click((e) => {
id: result.value[1],
label: result.value[0],
emoji: result.value[2] || null
})
});
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
} else Swal.fire('Missing parameters')
}).catch(swal.noop)
})
} else Swal.fire('Missing parameters');
}).catch(swal.noop);
});
$('pre[id=jsonPre].copy').click((e) => {
navigator.clipboard.writeText(e?.currentTarget?.textContent || e.textContent);
@ -46,8 +46,8 @@ $('pre[id=jsonPre].copy').click((e) => {
title: 'Copied!',
showConfirmButton: false,
timer: 1500
})
})
});
});
$('button[id=buttonCopy]').click((e) => {
const element = $('pre[id=jsonPre].copy')[0];
@ -59,10 +59,10 @@ $('button[id=buttonCopy]').click((e) => {
title: 'Copied!',
showConfirmButton: false,
timer: 1500
})
})
});
});
$(window).on('load', () => {
$('input').toArray().forEach((i) => i.value = '');
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
})
});