From adcaab03fbb7e275993a7ca0bd9f88c6d8a35f4f Mon Sep 17 00:00:00 2001 From: alseambusher Date: Sun, 25 Sep 2016 23:12:12 -0700 Subject: [PATCH] Fixing single quote bug --- public/js/script.js | 10 +++++----- views/index.ejs | 3 +-- views/restore.ejs | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 878546e..c704a95 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1,3 +1,4 @@ +/*jshint esversion: 6 */ /*********** MessageBox ****************/ // simply show info. Only close button function infoMessageBox(message, title){ @@ -84,7 +85,6 @@ function editJob(_id){ } schedule = job.schedule; job_command = job.command; - console.log(job.logging) if (job.logging && job.logging != "false") $("#job-logging").prop("checked", true); job_string(); @@ -95,13 +95,13 @@ function editJob(_id){ // TODO good old boring validations $.post(routes.save, {name: $("#job-name").val(), command: job_command , schedule: schedule, _id: _id, logging: $("#job-logging").prop("checked")}, function(){ location.reload(); - }) + }); }); } function newJob(){ - schedule = "" - job_command = "" + schedule = ""; + job_command = ""; $("#job-minute").val("*"); $("#job-hour").val("*"); $("#job-day").val("*"); @@ -117,7 +117,7 @@ function newJob(){ // TODO good old boring validations $.post(routes.save, {name: $("#job-name").val(), command: job_command , schedule: schedule, _id: -1, logging: $("#job-logging").prop("checked")}, function(){ location.reload(); - }) + }); }); } diff --git a/views/index.ejs b/views/index.ejs index 553949a..47e081c 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -13,7 +13,7 @@ $(function () { // initialize tooltips $('[data-toggle="tooltip"]').tooltip(); - crontabs = JSON.parse('<%- crontabs.replace(/\\\\/g, "\\\\\\\\").replace(/\\\"/g,"\\\\\"") %>'); + crontabs = JSON.parse('<%- crontabs.replace(/\\\\/g, "\\\\\\\\").replace(/\\\"/g,"\\\\\"").replace(/\'/g,"\\\'") %>'); routes = JSON.parse('<%- routes %>'); $("#env_vars").val(`<%- env %>`); }) @@ -89,7 +89,6 @@ Start <% } %> - <% }); %> diff --git a/views/restore.ejs b/views/restore.ejs index ac6ff46..fa8aeb7 100644 --- a/views/restore.ejs +++ b/views/restore.ejs @@ -11,7 +11,7 @@ $(function () { // initialize tooltips $('[data-toggle="tooltip"]').tooltip(); - crontabs = JSON.parse('<%- crontabs.replace(/\\\"/g,"\\\\\"") %>'); + crontabs = JSON.parse('<%- crontabs.replace(/\\\\/g, "\\\\\\\\").replace(/\\\"/g,"\\\\\"").replace(/\'/g,"\\\'") %>'); routes = JSON.parse('<%- routes %>'); })