OSDN Git Service

報告書の期間指定で入力欄に直接日付を入力すると効かないのを直す
[kancollesniffer/KancolleSniffer.git] / LogViewer / index.html
index cd489d1..50e83a8 100644 (file)
@@ -75,6 +75,28 @@ var mixin = {
             height: Math.max($(window).height() - 15 * this.pxPerEm, 400),
             width: Math.max($(window).width() - 6 * this.pxPerEm, 800)
         };
+    },
+    initPicker: function(from, to, updatePicker) {
+        [$(from), $(to)].forEach(function(input) {
+            var prev, ignore;
+            input.datetimepicker({
+                onSelectDate: function() {
+                    ignore = true;
+                }
+            });
+            input.change(function() {
+                if (ignore) {
+                    ignore = false;
+                    return;
+                }
+                var cur = input.val();
+                if (typeof cur !== 'string' || cur === prev)
+                    return;
+                prev = cur;
+                input.datetimepicker({value: cur});
+                updatePicker(input);
+            });
+        });
     }
 };