summaryrefslogtreecommitdiff
path: root/static/js/kosten.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--static/js/kosten.js29
1 files changed, 27 insertions, 2 deletions
diff --git a/static/js/kosten.js b/static/js/kosten.js
index e2fa06a..a1c30fb 100644
--- a/static/js/kosten.js
+++ b/static/js/kosten.js
@@ -1,11 +1,17 @@
// Generated by LiveScript 1.2.0
(function(){
- var jq, setLang, addJS, showJS, statJS, catsJS, out$ = typeof exports != 'undefined' && exports || this;
+ var jq, setLang, extendDate, addJS, showJS, statJS, catsJS, out$ = typeof exports != 'undefined' && exports || this;
jQuery.fn.extend({
copy: function(){
return this.clone().removeAttr('id class');
}
});
+ String.prototype.splitAt = function(pos){
+ return [this.slice(0, pos), this.slice(pos)];
+ };
+ Date.prototype.format = function(){
+ return $.datepicker.formatDate('dd.mm.yy', this);
+ };
jq = function(f){
return function(){
$(f);
@@ -24,6 +30,20 @@
}
});
};
+ extendDate = function(input){
+ var that, now, _, day, month, year;
+ if (that = /^([12][0-9]|3[01]|0?[1-9])(?:(0?[1-9]|1[0-2])((?:20)?[0-9][0-9])?)?$/.exec(input.val())) {
+ now = new Date();
+ _ = that[0], day = that[1], month = that[2], year = that[3];
+ year == null && (year = now.getFullYear());
+ month == null && (month = now.getMonth() + 1);
+ if (!(year > 99)) {
+ year = "20" + year;
+ }
+ input.val(
+ new Date(year, month - 1, day).format());
+ }
+ };
$(function(){
$('form.search').hide();
$('li.search').click(function(){
@@ -39,10 +59,15 @@
});
});
out$.addJS = addJS = jq(function(){
- $('input[name=date]').datepicker({
+ var x$;
+ x$ = $('input[name=date]');
+ x$.datepicker({
dateFormat: 'dd.mm.yy',
firstDay: 1
});
+ x$.blur(function(){
+ extendDate(x$);
+ });
});
out$.showJS = showJS = jq(function(){
setLang();