From b85c090b41275f31e38fcc9d028e9a6fffe56091 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 18 Mar 2014 19:56:49 -0600 Subject: [PATCH] More eloquent way of getting Boolean value --- imp/js/compose-dimp.js | 2 +- imp/js/search.js | 10 +++++----- imp/js/viewport.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/imp/js/compose-dimp.js b/imp/js/compose-dimp.js index 1080bfcf0fa..651e62efaad 100644 --- a/imp/js/compose-dimp.js +++ b/imp/js/compose-dimp.js @@ -52,7 +52,7 @@ var DimpCompose = { } DimpCore.doAction('cancelCompose', this.actionParams({ - discard: Number(Boolean(discard)) + discard: Number(!!discard) })); this.updateDraftsMailbox(); return this.closeCompose(); diff --git a/imp/js/search.js b/imp/js/search.js index 3bbfdc43cde..a0af9683466 100644 --- a/imp/js/search.js +++ b/imp/js/search.js @@ -454,13 +454,13 @@ var ImpSearch = { switch (this.data.types[this.criteria[c].t]) { case 'header': case 'text': - this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]')))); + this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]'))); this.criteria[c].v = $F($(c).down('INPUT[type=text]')); data.push(this.criteria[c]); break; case 'customhdr': - this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]')))); + this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]'))); this.criteria[c].v = { h: $F($(c).down('INPUT')), s: $F($(c).down('INPUT', 1)) }; data.push(this.criteria[c]); break; @@ -479,7 +479,7 @@ var ImpSearch = { alert(this.text.need_date); return; } - this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]')))); + this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]'))); data.push(this.criteria[c]); break; @@ -489,12 +489,12 @@ var ImpSearch = { break; case 'filter': - this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]')))); + this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]'))); data.push(this.criteria[c]); break; case 'flag': - this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]')))); + this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]'))); data.push({ n: this.criteria[c].n, t: 'flag', diff --git a/imp/js/viewport.js b/imp/js/viewport.js index 861549f02d5..7a211bf14d8 100644 --- a/imp/js/viewport.js +++ b/imp/js/viewport.js @@ -1017,7 +1017,7 @@ var ViewPort = Class.create({ bufferLoaded: function(view) { - return Boolean(this.views[view]); + return !!this.views[view]; }, currentOffset: function()