Use ES5 syntax

pull/298/head
Jonathan Rehm 7 years ago
parent a8b53ab38a
commit 282837c7c5

@ -8,18 +8,17 @@ tinymce.init({
selector: "#description", selector: "#description",
branding: false, branding: false,
menubar: "edit view format", menubar: "edit view format",
language language: language
}); });
if (!Modernizr.inputtypes.date) { if (!Modernizr.inputtypes.date) {
$("#pubdate").datepicker({ $("#pubdate").datepicker({
format: "yyyy-mm-dd", format: "yyyy-mm-dd",
language language: language
}).on("change", function () { }).on("change", function () {
// Show localized date over top of the standard YYYY-MM-DD date // Show localized date over top of the standard YYYY-MM-DD date
let pubDate; var pubDate;
const results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value); // YYYY-MM-DD var results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value); // YYYY-MM-DD
if (results) { if (results) {
pubDate = new Date(results[1], parseInt(results[2], 10) - 1, results[3]) || new Date(this.value); pubDate = new Date(results[1], parseInt(results[2], 10) - 1, results[3]) || new Date(this.value);
} }
@ -29,6 +28,7 @@ if (!Modernizr.inputtypes.date) {
}).trigger("change"); }).trigger("change");
} }
} }
/* /*
Takes a prefix, query typeahead callback, Bloodhound typeahead adapter Takes a prefix, query typeahead callback, Bloodhound typeahead adapter
and returns the completions it gets from the bloodhound engine prefixed. and returns the completions it gets from the bloodhound engine prefixed.
@ -43,6 +43,7 @@ function prefixedSource(prefix, query, cb, bhAdapter) {
cb(matches); cb(matches);
}); });
} }
function getPath() { function getPath() {
var jsFileLocation = $("script[src*=edit_books]").attr("src"); // the js file path var jsFileLocation = $("script[src*=edit_books]").attr("src"); // the js file path
jsFileLocation = jsFileLocation.replace("/static/js/edit_books.js", ""); // the js folder path jsFileLocation = jsFileLocation.replace("/static/js/edit_books.js", ""); // the js folder path

Loading…
Cancel
Save