diff --git a/resources/assets/src/js/common/polyfill.js b/resources/assets/src/js/common/polyfill.js
index 5e0c6773..4c39123b 100644
--- a/resources/assets/src/js/common/polyfill.js
+++ b/resources/assets/src/js/common/polyfill.js
@@ -11,12 +11,12 @@ if (!String.prototype.includes) {
// polyfill of String.prototype.endsWith
if (!String.prototype.endsWith) {
String.prototype.endsWith = function (searchString, position) {
- var subjectString = this.toString();
+ const subjectString = this.toString();
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
- var lastIndex = subjectString.lastIndexOf(searchString, position);
+ const lastIndex = subjectString.lastIndexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
diff --git a/resources/assets/src/js/common/texture-preview.js b/resources/assets/src/js/common/texture-preview.js
index 2555bfbf..5ad0cae1 100644
--- a/resources/assets/src/js/common/texture-preview.js
+++ b/resources/assets/src/js/common/texture-preview.js
@@ -18,7 +18,7 @@ class TexturePreview {
/**
* @type {'default'|'slim'}
*/
- this.preference = (type == 'steve') ? 'default' : 'slim';
+ this.preference = (type === 'steve') ? 'default' : 'slim';
this.playerPreference = preference;
}
@@ -33,7 +33,7 @@ class TexturePreview {
}
async change3dPreview() {
- if (this.playerPreference == this.preference || this.type == 'cape') {
+ if (this.playerPreference === this.preference || this.type === 'cape') {
try {
const { hash } = await fetch({
type: 'GET',
@@ -41,9 +41,9 @@ class TexturePreview {
dataType: 'json'
});
- let textureUrl = url(`textures/${hash}`);
+ const textureUrl = url(`textures/${hash}`);
- if (this.type == 'cape') {
+ if (this.type === 'cape') {
MSP.changeCape(textureUrl);
} else {
MSP.changeSkin(textureUrl);
@@ -60,7 +60,7 @@ class TexturePreview {
this.selector.hide().parent().next().show();
// clear 3D preview of cape
- if (this.type == 'cape') {
+ if (this.type === 'cape') {
MSP.changeCape('');
}
@@ -68,7 +68,7 @@ class TexturePreview {
}
static init3dPreview() {
- if (TexturePreview.previewType == '2D') return;
+ if (TexturePreview.previewType === '2D') return;
$('#preview-2d').hide();
diff --git a/resources/assets/src/js/common/utils.js b/resources/assets/src/js/common/utils.js
index 619b1ef5..24fb10c6 100644
--- a/resources/assets/src/js/common/utils.js
+++ b/resources/assets/src/js/common/utils.js
@@ -11,9 +11,9 @@ console.log(`\n %c Blessing Skin v${blessing.version} %c https://blessing.studio
function isEmpty(obj) {
// null and undefined are "empty"
- if (obj == null) return true;
+ if (obj == null) return true; // eslint-disable-line eqeqeq
- if (typeof (obj) == 'number' || typeof (obj) == 'boolean') return false;
+ if (typeof (obj) === 'number' || typeof (obj) === 'boolean') return false;
// Assume if it has a length property with a non-zero value
// that that property is correct.
@@ -28,7 +28,7 @@ function isEmpty(obj) {
// Otherwise, does it have any properties of its own?
// Note that this doesn't handle
// toString and valueOf enumeration bugs in IE < 9
- for (var key in obj) {
+ for (const key in obj) {
if (hasOwnProperty.call(obj, key)) return false;
}
@@ -53,9 +53,9 @@ function fetch(option) {
* @return {string}
*/
function getQueryString(key, defaultValue) {
- let result = location.search.match(new RegExp('[?&]'+key+'=([^&]+)','i'));
+ const result = location.search.match(new RegExp('[?&]'+key+'=([^&]+)','i'));
- if (result == null || result.length < 1){
+ if (result === null || result.length < 1){
return defaultValue;
} else {
return result[1];
@@ -69,8 +69,8 @@ function getQueryString(key, defaultValue) {
* @return {Boolean}
*/
function isMobileBrowserScrolling() {
- let currentWindowWidth = $(window).width();
- let currentWindowHeight = $(window).height();
+ const currentWindowWidth = $(window).width();
+ const currentWindowHeight = $(window).height();
if ($.cachedWindowWidth === undefined) {
$.cachedWindowWidth = currentWindowWidth;
@@ -80,8 +80,8 @@ function isMobileBrowserScrolling() {
$.cachedWindowHeight = currentWindowHeight;
}
- let isWidthChanged = (currentWindowWidth !== $.cachedWindowWidth);
- let isHeightChanged = (currentWindowHeight !== $.cachedWindowHeight);
+ const isWidthChanged = (currentWindowWidth !== $.cachedWindowWidth);
+ const isHeightChanged = (currentWindowHeight !== $.cachedWindowHeight);
// If the window width & height changes simultaneously, the resize can't be fired by scrolling.
if (isWidthChanged && isHeightChanged) {
@@ -95,10 +95,10 @@ function isMobileBrowserScrolling() {
// If width didn't change but height changed ?
if (isHeightChanged) {
- let last = $.lastWindowHeight;
+ const last = $.lastWindowHeight;
$.lastWindowHeight = currentWindowHeight;
- if (last === undefined || currentWindowHeight == last) {
+ if (last === undefined || currentWindowHeight === last) {
return true;
}
}
@@ -132,7 +132,7 @@ function debounce(func, delay, args = [], context = undefined) {
function url(relativeUri = '') {
blessing.base_url = blessing.base_url || '';
- if (relativeUri[0] != '/') {
+ if (relativeUri[0] !== '/') {
relativeUri = '/' + relativeUri;
}
diff --git a/resources/assets/src/js/skinlib/index.js b/resources/assets/src/js/skinlib/index.js
index a4ddb041..9922f727 100644
--- a/resources/assets/src/js/skinlib/index.js
+++ b/resources/assets/src/js/skinlib/index.js
@@ -33,7 +33,7 @@ $('body').on('submit', '#search-form', function (e) {
});
function initSkinlib() {
- if ($('#skinlib-container').length != 0) {
+ if ($('#skinlib-container').length !== 0) {
// Initially render skinlib
requestSkinlibData().then(result => {
renderSkinlib(result.items);
@@ -47,7 +47,7 @@ function initSkinlib() {
}
function renderSkinlib(items) {
- let container = $('#skinlib-container').html('');
+ const container = $('#skinlib-container').html('');
if (items.length === 0) {
$('#skinlib-paginator').hide();
@@ -95,7 +95,7 @@ function requestSkinlibData() {
function renderSkinlibItemComponent(item) {
let title = '';
let anonymous = '';
- let liked = item.liked ? 'liked' : '';
+ const liked = item.liked ? 'liked' : '';
if (item.liked === undefined) {
// If user haven't logged in
@@ -120,7 +120,7 @@ function renderSkinlibItemComponent(item) {
-
+
${ trans('skinlib.private') }
@@ -136,9 +136,9 @@ function updatePaginator(currentPage, totalPages) {
total: totalPages
}));
- let paginator = $('#skinlib-paginator');
+ const paginator = $('#skinlib-paginator');
- if (paginator.html().length == 0) {
+ if (paginator.html().length === 0) {
// init paginator
$('#skinlib-paginator').jqPaginator($.extend({}, $.defaultPaginatorConfig, {
currentPage: parseInt(currentPage),
@@ -152,20 +152,20 @@ function updatePaginator(currentPage, totalPages) {
});
}
- let pageSelectElement = $('select.pagination').html('');
+ const pageSelectElement = $('select.pagination').html('');
for (let i = 1; i <= totalPages; i++) {
pageSelectElement.append(`
-
+
`);
}
}
function updateFilter(e) {
e.preventDefault();
- let selectedFilter = $(this).data('filter');
+ const selectedFilter = $(this).data('filter');
- if (selectedFilter == 'uploader') {
+ if (selectedFilter === 'uploader') {
$.skinlib.uploader = $(this).data('uid');
console.log('Show items uploaded by uid ' + $.skinlib.uploader);
} else {
@@ -180,7 +180,7 @@ function onPageChange(page, type) {
$.skinlib.page = page;
updateBreadCrumb();
- if (type == 'init') {
+ if (type === 'init') {
console.log('Init paginator', page);
} else {
$('.overlay').show();
@@ -191,7 +191,7 @@ function onPageChange(page, type) {
}
function updateUrlQueryString() {
- let query = $.param($.skinlib);
+ const query = $.param($.skinlib);
window.history.pushState(null, null, url(`skinlib?${ query }`));
@@ -201,7 +201,7 @@ function updateUrlQueryString() {
}
function updateBreadCrumb() {
- if ($.skinlib.filter == 'cape') {
+ if ($.skinlib.filter === 'cape') {
$('#filter-indicator').html(trans('general.cape'));
} else {
$('#filter-indicator').html(trans('general.skin') + `
@@ -209,7 +209,7 @@ function updateBreadCrumb() {
`);
}
- if ($.skinlib.uploader != 0) {
+ if ($.skinlib.uploader !== 0) {
$('#uploader-indicator').html(trans('skinlib.filter.uploader', { uid: $.skinlib.uploader }));
} else {
$('#uploader-indicator').html(trans('skinlib.filter.allUsers'));
@@ -217,7 +217,7 @@ function updateBreadCrumb() {
$('#sort-indicator').html(trans('skinlib.sort.' + $.skinlib.sort));
- if ($.skinlib.keyword != '') {
+ if ($.skinlib.keyword !== '') {
$('#search-indicator').text(trans('general.searchResult', {
keyword: decodeURI($.skinlib.keyword)
}));
diff --git a/resources/assets/src/js/skinlib/operations.js b/resources/assets/src/js/skinlib/operations.js
index b0ba74ed..06c6b92d 100644
--- a/resources/assets/src/js/skinlib/operations.js
+++ b/resources/assets/src/js/skinlib/operations.js
@@ -3,7 +3,7 @@
$(document).on('click', '.more.like', toggleLiked);
function toggleLiked() {
- let tid = $(this).attr('tid');
+ const tid = $(this).attr('tid');
if ($(this).hasClass('anonymous'))
return;
@@ -37,7 +37,7 @@ function addToCloset(tid) {
async function ajaxAddToCloset(tid, name) {
// Remove interference of modal which is hide
$('.modal').each(function () {
- return ($(this).css('display') == 'none') ? $(this).remove() : null;
+ return ($(this).css('display') === 'none') ? $(this).remove() : null;
});
try {
@@ -48,7 +48,7 @@ async function ajaxAddToCloset(tid, name) {
data: { tid: tid, name: name }
});
- if (errno == 0) {
+ if (errno === 0) {
swal({ type: 'success', html: msg });
$('.modal').modal('hide');
@@ -82,7 +82,7 @@ async function removeFromCloset(tid) {
data: { tid: tid }
});
- if (errno == 0) {
+ if (errno === 0) {
swal({ type: 'success', html: msg });
updateTextureStatus(tid, 'remove');
@@ -119,7 +119,7 @@ async function changeTextureName(tid, oldName) {
data: { tid: tid, new_name: newTextureName }
});
- if (errno == 0) {
+ if (errno === 0) {
$('#name').text(newTextureName);
toastr.success(msg);
} else {
@@ -138,8 +138,8 @@ async function changeTextureName(tid, oldName) {
* @return {null}
*/
function updateTextureStatus(tid, action) {
- let likes = parseInt($('#likes').html()) + (action == 'add' ? 1 : -1);
- action = (action == 'add') ? 'removeFromCloset' : 'addToCloset';
+ const likes = parseInt($('#likes').html()) + (action === 'add' ? 1 : -1);
+ action = (action === 'add') ? 'removeFromCloset' : 'addToCloset';
$(`a[tid=${tid}]`)
.attr('href', `javascript:${action}(${tid});`)
@@ -176,10 +176,10 @@ async function changePrivacy(tid) {
});
const { errno, msg } = result;
- if (errno == 0) {
+ if (errno === 0) {
toastr.success(msg);
- if (result.public == '0') {
+ if (result.public === '0') {
$(`a:contains("${trans('skinlib.setAsPrivate')}")`).html(trans('skinlib.setAsPublic'));
} else {
$(`a:contains("${trans('skinlib.setAsPublic')}")`).html(trans('skinlib.setAsPrivate'));
@@ -211,7 +211,7 @@ async function deleteTexture(tid) {
data: { tid: tid }
});
- if (errno == 0) {
+ if (errno === 0) {
await swal({ type: 'success', html: msg });
window.location = url('skinlib');
} else {
diff --git a/resources/assets/src/js/skinlib/upload.js b/resources/assets/src/js/skinlib/upload.js
index 1b2788aa..f0eb414b 100644
--- a/resources/assets/src/js/skinlib/upload.js
+++ b/resources/assets/src/js/skinlib/upload.js
@@ -24,18 +24,18 @@ function handleFiles(files, type) {
type = type || $('#type-cape').prop('checked') ? 'cape' : 'skin';
if (files.length > 0) {
- let file = files[0];
+ const file = files[0];
if (file.type === 'image/png' || file.type === 'image/x-png') {
- let reader = new FileReader();
+ const reader = new FileReader();
reader.onload = function () {
- let img = new Image();
+ const img = new Image();
img.onload = () => {
- let $name = $('#name');
+ const $name = $('#name');
- (type == 'skin') ? MSP.changeSkin(img.src) : MSP.changeCape(img.src);
+ (type === 'skin') ? MSP.changeSkin(img.src) : MSP.changeCape(img.src);
if ($name.val() === '' || $name.val() === $name.attr('data-last-file-name')) {
// Remove png extension in filename
@@ -59,8 +59,8 @@ function handleFiles(files, type) {
}
function upload() {
- let form = new FormData();
- let file = $('#file').prop('files')[0];
+ const form = new FormData();
+ const file = $('#file').prop('files')[0];
form.append('name', $('#name').val());
form.append('file', file);
@@ -78,7 +78,7 @@ function upload() {
if (file === undefined) {
toastr.info(trans('skinlib.emptyUploadFile'));
$('#file').focus();
- } else if ($('#name').val() == '') {
+ } else if ($('#name').val() === '') {
toastr.info(trans('skinlib.emptyTextureName'));
$('#name').focus();
} else if (file.type !== 'image/png') {
@@ -103,8 +103,8 @@ function upload() {
}
});
- if (errno == 0) {
- let redirect = function () {
+ if (errno === 0) {
+ const redirect = function () {
toastr.info(trans('skinlib.redirecting'));
setTimeout(() => {
diff --git a/resources/assets/src/js/user/closet.js b/resources/assets/src/js/user/closet.js
index 7981cd10..25edaca5 100644
--- a/resources/assets/src/js/user/closet.js
+++ b/resources/assets/src/js/user/closet.js
@@ -6,12 +6,12 @@ $(document).ready(initCloset);
$('body').on('click', '.item-body', async function () {
$('.item-selected').parent().removeClass('item-selected');
- let $item = $(this).parent();
+ const $item = $(this).parent();
const $indicator = $('#textures-indicator');
$item.addClass('item-selected');
- let tid = parseInt($item.attr('tid'));
+ const tid = parseInt($item.attr('tid'));
try {
const { type, hash } = await fetch({
@@ -20,7 +20,7 @@ $('body').on('click', '.item-body', async function () {
dataType: 'json'
});
- if (type == 'cape') {
+ if (type === 'cape') {
MSP.changeCape(url(`textures/${hash}`));
$indicator.data('cape', tid);
} else {
@@ -33,9 +33,9 @@ $('body').on('click', '.item-body', async function () {
if (skin !== undefined && cape !== undefined) {
$indicator.text(`${trans('general.skin')} & ${trans('general.cape')}`);
- } else if (skin != undefined) {
+ } else if (skin) {
$indicator.text(trans('general.skin'));
- } else if (cape != undefined) {
+ } else if (cape) {
$indicator.text(trans('general.cape'));
}
} catch (error) {
@@ -44,9 +44,9 @@ $('body').on('click', '.item-body', async function () {
});
$('body').on('click', '.category-switch', () => {
- let category = $('a[href="#skin-category"]').parent().hasClass('active') ? 'cape' : 'skin';
- let search = $('input[name=q]').val();
- let page = parseInt($('#closet-paginator').attr(`last-${category}-page`));
+ const category = $('a[href="#skin-category"]').parent().hasClass('active') ? 'cape' : 'skin';
+ const search = $('input[name=q]').val();
+ const page = parseInt($('#closet-paginator').attr(`last-${category}-page`));
reloadCloset(category, page, search);
});
@@ -56,7 +56,7 @@ async function initCloset() {
return;
$('input[name=q]').on('input', debounce(() => {
- let category = $('#skin-category').hasClass('active') ? 'skin' : 'cape';
+ const category = $('#skin-category').hasClass('active') ? 'skin' : 'cape';
reloadCloset(category, 1, $('input[name=q]').val());
}, 350));
@@ -115,8 +115,8 @@ function renderClosetItemComponent(item) {
* @param {'skin' | 'cape'} category
*/
function renderCloset(items, category) {
- let search = $('input[name=q]').val();
- let container = $(`#${category}-category`).html('');
+ const search = $('input[name=q]').val();
+ const container = $(`#${category}-category`).html('');
if (items.length === 0) {
$('#closet-paginator').hide();
@@ -159,7 +159,7 @@ async function reloadCloset(textureCategory, page, search) {
renderCloset(items, category);
- let paginator = $('#closet-paginator');
+ const paginator = $('#closet-paginator');
paginator.attr(`last-${category}-page`, page);
paginator.jqPaginator('option', {
@@ -208,7 +208,7 @@ async function renameClosetItem(tid, oldName) {
data: { tid: tid, new_name: newTextureName }
});
- if (errno == 0) {
+ if (errno === 0) {
const type = $(`[tid=${tid}]`).data('texture-type');
$(`[tid=${tid}]>.item-footer>.texture-name>span`).html(
newTextureName +
@@ -242,16 +242,16 @@ async function removeFromCloset(tid) {
data: { tid: tid }
});
- if (errno == 0) {
+ if (errno === 0) {
swal({ type: 'success', html: msg });
$(`div[tid=${tid}]`).remove();
['skin', 'cape'].forEach(type => {
- let container = $(`#${type}-category`);
+ const container = $(`#${type}-category`);
- if ($.trim(container.html()) == '') {
- let msg = trans('user.emptyClosetMsg', { url: url(`skinlib?filter=${type}`) });
+ if ($.trim(container.html()) === '') {
+ const msg = trans('user.emptyClosetMsg', { url: url(`skinlib?filter=${type}`) });
container.html(`
${msg}
`);
}
});
@@ -283,7 +283,7 @@ async function setAsAvatar(tid) {
data: { tid: tid }
});
- if (errno == 0) {
+ if (errno === 0) {
toastr.success(msg);
// Refersh avatars
@@ -300,9 +300,9 @@ async function setAsAvatar(tid) {
async function setTexture() {
const $indicator = $('#textures-indicator');
- let pid = 0,
- skin = $indicator.data('skin'),
- cape = $indicator.data('cape');
+ let pid = 0;
+ const skin = $indicator.data('skin'),
+ cape = $indicator.data('cape');
$('input[name="player"]').each(function(){
if (this.checked) pid = this.id;
@@ -310,7 +310,7 @@ async function setTexture() {
if (! pid) {
toastr.info(trans('user.emptySelectedPlayer'));
- } else if (skin == undefined && cape == undefined) {
+ } else if (!skin && !cape) {
toastr.info(trans('user.emptySelectedTexture'));
} else {
try {
@@ -325,7 +325,7 @@ async function setTexture() {
}
});
- if (errno == 0) {
+ if (errno === 0) {
swal({ type: 'success', html: msg });
$('#modal-use-as').modal('hide');
} else {
diff --git a/resources/assets/src/js/user/player.js b/resources/assets/src/js/user/player.js
index c78caa7f..30ef23e0 100644
--- a/resources/assets/src/js/user/player.js
+++ b/resources/assets/src/js/user/player.js
@@ -8,7 +8,7 @@ $('body').on('click', '.player', function () {
showPlayerTexturePreview(this.id);
}).on('click', '#preview-switch', () => {
- TexturePreview.previewType == '3D' ? TexturePreview.show2dPreview() : TexturePreview.show3dPreview();
+ TexturePreview.previewType === '3D' ? TexturePreview.show2dPreview() : TexturePreview.show3dPreview();
}).on('change', '#preference', async function () {
try {
const { errno, msg } = await fetch({
@@ -17,7 +17,7 @@ $('body').on('click', '.player', function () {
dataType: 'json',
data: { pid: $(this).attr('pid'), preference: $(this).val() }
});
- errno == 0 ? toastr.success(msg) : toastr.warning(msg);
+ errno === 0 ? toastr.success(msg) : toastr.warning(msg);
} catch (error) {
showAjaxError(error);
}
@@ -34,8 +34,8 @@ async function showPlayerTexturePreview(pid) {
// Render skin preview of selected player
['steve', 'alex', 'cape'].forEach((type) => {
- let tid = result[`tid_${type}`];
- let preview = new TexturePreview(type, tid, result.preference);
+ const tid = result[`tid_${type}`];
+ const preview = new TexturePreview(type, tid, result.preference);
if (tid) {
preview.change2dPreview().change3dPreview();
@@ -44,8 +44,8 @@ async function showPlayerTexturePreview(pid) {
}
});
- if ((result.preference == 'default' && !result.tid_steve) ||
- (result.preference == 'slim' && !result.tid_alex))
+ if ((result.preference === 'default' && !result.tid_steve) ||
+ (result.preference === 'slim' && !result.tid_alex))
{
// show default skin
MSP.changeSkin(defaultSkin);
@@ -84,7 +84,7 @@ async function changePlayerName(pid) {
data: { pid: pid, new_player_name: newPlayerName }
});
- if (errno == 0) {
+ if (errno === 0) {
swal({ type: 'success', html: msg });
$playerName.html(newPlayerName);
@@ -97,7 +97,7 @@ async function changePlayerName(pid) {
}
function clearTexture(pid) {
- let dom = `
+ const dom = `
Default (Steve)
@@ -117,16 +117,16 @@ function clearTexture(pid) {
async function ajaxClearTexture(pid) {
$('.modal').each(function () {
- if ($(this).css('display') == 'none') $(this).remove();
+ if ($(this).css('display') === 'none') $(this).remove();
});
- let data = { pid: pid };
+ const data = { pid: pid };
['steve', 'alex', 'cape'].forEach(type => {
data[type] = $(`#clear-${type}`).prop('checked') ? 1 : 0;
});
- if (data['steve'] == 0 && data['alex'] == 0 && data['cape'] == 0) {
+ if (data['steve'] === 0 && data['alex'] === 0 && data['cape'] === 0) {
return toastr.warning(trans('user.noClearChoice'));
}
@@ -137,7 +137,7 @@ async function ajaxClearTexture(pid) {
dataType: 'json',
data: data
});
- swal({ type: errno == 0 ? 'success' : 'error', html: msg });
+ swal({ type: errno === 0 ? 'success' : 'error', html: msg });
$('.modal').modal('hide');
} catch (error) {
showAjaxError(error);
@@ -166,7 +166,7 @@ async function deletePlayer(pid) {
data: { pid: pid }
});
- if (errno == 0) {
+ if (errno === 0) {
await swal({
type: 'success',
html: msg
@@ -189,7 +189,7 @@ async function addNewPlayer() {
data: { player_name: $('#player_name').val() }
});
- if (errno == 0) {
+ if (errno === 0) {
swal({
type: 'success',
html: msg
diff --git a/resources/assets/src/js/user/profile.js b/resources/assets/src/js/user/profile.js
index 814ad99f..64d3f2f1 100644
--- a/resources/assets/src/js/user/profile.js
+++ b/resources/assets/src/js/user/profile.js
@@ -1,7 +1,7 @@
'use strict';
async function changeNickName() {
- let name = $('#new-nickname').val();
+ const name = $('#new-nickname').val();
if (! name) {
return swal({ type: 'error', html: trans('user.emptyNewNickName') });
@@ -25,7 +25,7 @@ async function changeNickName() {
data: { new_nickname: name }
});
- if (errno == 0) {
+ if (errno === 0) {
$('.nickname').each(function () {
$(this).html(name);
@@ -41,23 +41,23 @@ async function changeNickName() {
}
async function changePassword() {
- let $oldPasswd = $('#password'),
- $newPasswd = $('#new-passwd'),
- $confirmPwd = $('#confirm-pwd');
+ const $oldPasswd = $('#password'),
+ $newPasswd = $('#new-passwd'),
+ $confirmPwd = $('#confirm-pwd');
- let password = $oldPasswd.val(),
- newPasswd = $newPasswd.val();
+ const password = $oldPasswd.val(),
+ newPasswd = $newPasswd.val();
- if (password == '') {
+ if (password === '') {
toastr.info(trans('user.emptyPassword'));
$oldPasswd.focus();
- } else if (newPasswd == '') {
+ } else if (newPasswd === '') {
toastr.info(trans('user.emptyNewPassword'));
$newPasswd.focus();
- } else if ($confirmPwd.val() == '') {
+ } else if ($confirmPwd.val() === '') {
toastr.info(trans('auth.emptyConfirmPwd'));
$confirmPwd.focus();
- } else if (newPasswd != $confirmPwd.val()) {
+ } else if (newPasswd !== $confirmPwd.val()) {
toastr.warning(trans('auth.invalidConfirmPwd'));
$confirmPwd.focus();
} else {
@@ -69,7 +69,7 @@ async function changePassword() {
data: { 'current_password': password, 'new_password': newPasswd }
});
- if (errno == 0) {
+ if (errno === 0) {
try {
await swal({
type: 'success',
@@ -94,7 +94,7 @@ async function changePassword() {
$('#new-email').focusin(() => {
$('#current-password').parent().show();
}).focusout(debounce(() => {
- let dom = $('#current-password');
+ const dom = $('#current-password');
if (! dom.is(':focus')) {
dom.parent().hide();
@@ -131,7 +131,7 @@ async function changeEmail() {
data: { new_email: newEmail, password: $('#current-password').val() }
});
- if (errno == 0) {
+ if (errno === 0) {
await swal({
type: 'success',
text: msg
@@ -153,7 +153,7 @@ async function changeEmail() {
}
async function deleteAccount() {
- let password = $('.modal-body>#password').val();
+ const password = $('.modal-body>#password').val();
if (! password) {
return swal({ type: 'warning', html: trans('user.emptyDeletePassword') });
@@ -167,7 +167,7 @@ async function deleteAccount() {
data: { password: password }
});
- if (errno == 0) {
+ if (errno === 0) {
await swal({
type: 'success',
html: msg
diff --git a/resources/assets/src/js/user/sign.js b/resources/assets/src/js/user/sign.js
index 37626e56..c8ef61ac 100644
--- a/resources/assets/src/js/user/sign.js
+++ b/resources/assets/src/js/user/sign.js
@@ -6,7 +6,7 @@ async function sign() {
dataType: 'json'
});
- if (result.errno == 0) {
+ if (result.errno === 0) {
$('#score').html(result.score);
const dom = ' ' + trans(
'user.signRemainingTime',