Уборка Unreachable statement. Замена === на == и !== на != в яваскриптах из-за ошибок с нестрогой типизацией при переходе на 7.4.
This commit is contained in:
+10
-10
@@ -6,18 +6,18 @@ const training_handler = () => {
|
||||
return condition ? '/api/training/complete' : '/api/training/go_back';
|
||||
};
|
||||
|
||||
request.open('POST', url(training_data().answer === null || training_data().answer === get_user_answer()))
|
||||
request.open('POST', url(training_data().answer == null || training_data().answer == get_user_answer()))
|
||||
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
request.onreadystatechange = function () {//Call a function when the state changes.
|
||||
if (request.readyState === 4) {
|
||||
if(request.status === 200) {
|
||||
if (request.readyState == 4) {
|
||||
if(request.status == 200) {
|
||||
parent.frames['main'].location.reload();
|
||||
}
|
||||
|
||||
if(request.responseText !== '') {
|
||||
if(request.responseText != '') {
|
||||
let response = JSON.parse(request.responseText);
|
||||
|
||||
if (response.message !== undefined) {
|
||||
if (response.message != undefined) {
|
||||
alert(response.message);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ const training_handler = () => {
|
||||
}
|
||||
|
||||
function get_user_answer() {
|
||||
if(training_data().answer === '') {
|
||||
if(training_data().answer == '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ function get_user_answer() {
|
||||
}
|
||||
|
||||
(function () {
|
||||
if (typeof window.CustomEvent === "function") return false;
|
||||
if (typeof window.CustomEvent == "function") return false;
|
||||
function CustomEvent(event, params) {
|
||||
params = params || { bubbles: false, cancelable: false, detail: null };
|
||||
var evt = document.createEvent('CustomEvent');
|
||||
@@ -71,7 +71,7 @@ $modal = function (options) {
|
||||
modal_content,
|
||||
modalFooterHTML = '';
|
||||
|
||||
if(training_data().answer !== '') {
|
||||
if(training_data().answer != '') {
|
||||
modalInputAnswer = '<br><br><input name="user_answer" placeholder="Укажите ответ"/>';
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ $modal = function (options) {
|
||||
}
|
||||
|
||||
function _handlerCloseModal(e) {
|
||||
if (e.target.dataset.dismiss === 'modal') {
|
||||
if (e.target.dataset.dismiss == 'modal') {
|
||||
_hideModal();
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ let modal = $modal({
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
if (e.target.dataset.handler === 'next_step') {
|
||||
if (e.target.dataset.handler == 'next_step') {
|
||||
training_handler()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user