Commit 09be3573 authored by Michal Čihař's avatar Michal Čihař

Use type safe comparing

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 9d38c274
...@@ -25,7 +25,7 @@ jQuery.fn.extend({ ...@@ -25,7 +25,7 @@ jQuery.fn.extend({
var sel = document.selection.createRange(); var sel = document.selection.createRange();
sel.text = myValue; sel.text = myValue;
this.focus(); this.focus();
} else if (this.selectionStart || this.selectionStart == '0') { } else if (this.selectionStart || this.selectionStart === 0) {
//For browsers like Firefox and Webkit based //For browsers like Firefox and Webkit based
var startPos = this.selectionStart; var startPos = this.selectionStart;
var endPos = this.selectionEnd; var endPos = this.selectionEnd;
...@@ -125,11 +125,11 @@ function initEditor(editors) { ...@@ -125,11 +125,11 @@ function initEditor(editors) {
$('.specialchar').click(function (e) { $('.specialchar').click(function (e) {
var $this = $(this); var $this = $(this);
var text = $this.text(); var text = $this.text();
if (text == '\\t') { if (text === '\\t') {
text = '\t'; text = '\t';
} else if (text == '') { } else if (text === '') {
text = '\t'; text = '\t';
} else if (text == '') { } else if (text === '') {
text = '\r'; text = '\r';
} }
$this.parents('.translation-item').find('.translation-editor').insertAtCaret(text).trigger('autosize.resize'); $this.parents('.translation-item').find('.translation-editor').insertAtCaret(text).trigger('autosize.resize');
...@@ -139,7 +139,7 @@ function initEditor(editors) { ...@@ -139,7 +139,7 @@ function initEditor(editors) {
} }
function testChangeHandler(e) { function testChangeHandler(e) {
if (e.key && e.key == 'Tab') { if (e.key && e.key === 'Tab') {
return; return;
} }
$(this).parents('form').find('[name=fuzzy]').prop('checked', false); $(this).parents('form').find('[name=fuzzy]').prop('checked', false);
...@@ -147,7 +147,7 @@ function testChangeHandler(e) { ...@@ -147,7 +147,7 @@ function testChangeHandler(e) {
function processMachineTranslation(data, textStatus, jqXHR) { function processMachineTranslation(data, textStatus, jqXHR) {
decreaseLoading('#mt-loading'); decreaseLoading('#mt-loading');
if (data.responseStatus == 200) { if (data.responseStatus === 200) {
data.translations.forEach(function (el, idx, ar) { data.translations.forEach(function (el, idx, ar) {
var newRow = $('<tr/>').data('quality', el.quality); var newRow = $('<tr/>').data('quality', el.quality);
var done = false; var done = false;
...@@ -208,7 +208,7 @@ function isNumber(n) { ...@@ -208,7 +208,7 @@ function isNumber(n) {
} }
function compareCells(a, b) { function compareCells(a, b) {
if (a.indexOf('%') != -1 && b.indexOf('%') != -1) { if (a.indexOf('%') !== -1 && b.indexOf('%') !== -1) {
a = parseFloat(a.replace(',', '.')); a = parseFloat(a.replace(',', '.'));
b = parseFloat(b.replace(',', '.')); b = parseFloat(b.replace(',', '.'));
} else if (isNumber(a) && isNumber(b)) { } else if (isNumber(a) && isNumber(b)) {
...@@ -263,7 +263,7 @@ function loadTableSorting() { ...@@ -263,7 +263,7 @@ function loadTableSorting() {
}); });
thead.find('i.sort-button').removeClass('fa-chevron-down fa-chevron-up').addClass('fa-chevron-down sort-none'); thead.find('i.sort-button').removeClass('fa-chevron-down fa-chevron-up').addClass('fa-chevron-down sort-none');
if (inverse == 1) { if (inverse === 1) {
$(this).find('i.sort-button').addClass('fa-chevron-down').removeClass('fa-chevron-up sort-none'); $(this).find('i.sort-button').addClass('fa-chevron-down').removeClass('fa-chevron-up sort-none');
} else { } else {
$(this).find('i.sort-button').addClass('fa-chevron-up').removeClass('fa-chevron-down sort-none'); $(this).find('i.sort-button').addClass('fa-chevron-up').removeClass('fa-chevron-down sort-none');
...@@ -333,7 +333,7 @@ $(function () { ...@@ -333,7 +333,7 @@ $(function () {
$content.load( $content.load(
$target.data('href'), $target.data('href'),
function (response, status, xhr) { function (response, status, xhr) {
if ( status == "error" ) { if ( status === "error" ) {
var msg = gettext('Error while loading page:'); var msg = gettext('Error while loading page:');
$content.html( msg + " " + xhr.status + " " + xhr.statusText ); $content.html( msg + " " + xhr.status + " " + xhr.statusText );
} }
...@@ -584,7 +584,7 @@ $(function () { ...@@ -584,7 +584,7 @@ $(function () {
$window.scroll(function(){ $window.scroll(function(){
var $loadingNext = $('#loading-next'); var $loadingNext = $('#loading-next');
if ($window.scrollTop() >= $document.height() - (2 * $window.height())) { if ($window.scrollTop() >= $document.height() - (2 * $window.height())) {
if ($('#last-section').length > 0 || $loadingNext.css('display') != 'none') { if ($('#last-section').length > 0 || $loadingNext.css('display') !== 'none') {
return; return;
} }
$loadingNext.show(); $loadingNext.show();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment