Skip to content

Commit 0cf258a

Browse files
committed
stricter comparison operators
1 parent a1b1a25 commit 0cf258a

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

js/admin.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jQuery(document).ready(($) => {
6363
jQuery("#bibleget_ajax_spinner").hide();
6464
},
6565
success: (returndata) => {
66-
if (returndata == "datarefreshed") {
66+
if (returndata === "datarefreshed") {
6767
jQuery("#bibleget-settings-notification")
6868
.append(
6969
'Data from server retrieved successfully, now refreshing page... <span id="bibleget-countdown">3 secs...</span>'
@@ -72,7 +72,7 @@ jQuery(document).ready(($) => {
7272
let seconds = 3;
7373
let interval1 = setInterval(() => {
7474
jQuery("#bibleget-countdown").text(
75-
--seconds + (seconds == 1 ? " sec..." : " secs...")
75+
--seconds + (seconds === 1 ? " sec..." : " secs...")
7676
);
7777
}, 1000);
7878
setTimeout(() => {
@@ -113,7 +113,7 @@ jQuery(document).ready(($) => {
113113
jQuery("#bibleget_ajax_spinner").hide();
114114
},
115115
success: (returndata) => {
116-
if (returndata == "cacheflushed") {
116+
if (returndata === "cacheflushed") {
117117
jQuery("#bibleget-settings-notification")
118118
.append("Bible quotes cache emptied successfully")
119119
.fadeIn("slow");
@@ -145,7 +145,7 @@ jQuery(document).ready(($) => {
145145
gfontsBatch.job.hasOwnProperty("gfontsPreviewJob") &&
146146
gfontsBatch.job.gfontsPreviewJob === true &&
147147
gfontsBatch.job.hasOwnProperty("gfontsWeblist") &&
148-
typeof gfontsBatch.job.gfontsWeblist == "object" &&
148+
typeof gfontsBatch.job.gfontsWeblist === "object" &&
149149
gfontsBatch.job.gfontsWeblist.hasOwnProperty("items")
150150
) {
151151
//console.log('We have a gfontsPreviewJob to do! gfontsBatch: ');
@@ -159,7 +159,7 @@ jQuery(document).ready(($) => {
159159
.append(
160160
$("<div>", {
161161
html:
162-
"!!! Impossible to write data to the BibleGet plugin directory, please check permissions!",
162+
"!!! Impossible to write data to the BibleGet plugin directory, please check permissions!<br>" + wpFsErrors.join('<br>'),
163163
style:
164164
"color: white; background-color: red; padding: 3px 9px; display: inline-block; font-weight: bold; font-family: sans-serif;",
165165
})
@@ -185,6 +185,8 @@ jQuery(document).ready(($) => {
185185
//console.log('gfontsCount = '+gfontsCount);
186186
//console.log('batchLimit = '+batchLimit);
187187
}
188+
//We actually need to run one more time than the batchlimit, in order for the minify stage to take place
189+
numRuns++;
188190

189191
//$gfontsBatchRunProgressbarOverlay, $gfontsBatchRunProgressbarWrapper, and $gfontsBatchRunProgressbar are global variables so don't use "var" here
190192
$gfontsBatchRunProgressbarOverlay = jQuery("<div>", {
@@ -323,9 +325,9 @@ const gfontsBatchRun = (postdata) => {
323325
//console.log(returndataJSON.errorinfo);
324326
if (
325327
(returndataJSON.hasOwnProperty("httpStatus2") &&
326-
returndataJSON.httpStatus2 == 504) ||
328+
returndataJSON.httpStatus2 === 504) ||
327329
(returndataJSON.hasOwnProperty("httpStatus3") &&
328-
returndataJSON.httpStatus3 == 504)
330+
returndataJSON.httpStatus3 === 504)
329331
) {
330332
//there was a timeout at some point during the communication with the Google Fonts server
331333
//we haven't finished yet, but let's try not to get stuck
@@ -367,7 +369,7 @@ const gfontsBatchRun = (postdata) => {
367369
case "COMPLETE":
368370
$gfontsBatchRunProgressbar.progressbar("value", 100);
369371

370-
// if (thisRun == postdata.numRuns) {
372+
// if (thisRun === postdata.numRuns) {
371373
// console.log("gfontsBatchRun has finished the job!");
372374
// } else {
373375
// console.log(
@@ -460,14 +462,14 @@ const bibleGetForceRefreshGFapiResults = () => {
460462
//send ajax request to the server to have the transient deleted
461463
//console.log('we should have an nonce for this action: '+gfontsBatch.gfontsRefreshNonce);
462464
if (
463-
typeof gfontsBatch != "undefined" &&
464-
typeof gfontsBatch == "object" &&
465+
typeof gfontsBatch !== "undefined" &&
466+
typeof gfontsBatch === "object" &&
465467
gfontsBatch.hasOwnProperty("job") &&
466-
typeof gfontsBatch.job == "object" &&
468+
typeof gfontsBatch.job === "object" &&
467469
gfontsBatch.job.hasOwnProperty("gfontsRefreshNonce") &&
468-
gfontsBatch.job.gfontsRefreshNonce != "" &&
470+
gfontsBatch.job.gfontsRefreshNonce !== "" &&
469471
gfontsBatch.job.hasOwnProperty("gfontsApiKey") &&
470-
gfontsBatch.job.gfontsApiKey != ""
472+
gfontsBatch.job.gfontsApiKey !== ""
471473
) {
472474
const postProps = {
473475
action: "bibleget_refresh_gfonts",

0 commit comments

Comments
 (0)