1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-25 02:57:22 +00:00

Make changes requested by Codacy

This commit is contained in:
Jonathan Rehm 2017-07-18 14:20:32 -07:00
parent 61e0405f75
commit 3258f4fb79

View File

@ -1,7 +1,7 @@
/** /**
* Created by SpeedProg on 05.04.2015. * Created by SpeedProg on 05.04.2015.
*/ */
/* global Bloodhound, language */ /* global Bloodhound, language, Modernizr, tinymce */
tinymce.init({ tinymce.init({
selector: '#description', selector: '#description',
@ -11,19 +11,20 @@ tinymce.init({
}); });
if (!Modernizr.inputtypes.date) { if (!Modernizr.inputtypes.date) {
$('#pubdate').datepicker({ $("#pubdate").datepicker({
format: 'yyyy-mm-dd', format: "yyyy-mm-dd",
language: 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, results; let pubDate;
if ((results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value))) { // YYYY-MM-DD const results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value); // YYYY-MM-DD
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);
} }
$('#fake_pubdate') $("#fake_pubdate")
.val(pubDate.toLocaleDateString(language)) .val(pubDate.toLocaleDateString(language))
.removeClass('hidden'); .removeClass("hidden");
}).trigger('change'); }).trigger("change");
} }
/* /*