PageSourceSearch

https://skravlekort.no/file/site/script/-1026628594.af.365.dataBinding.AfDatePicker.js

js skravlekort.no collected 2026-10-02 00:39:28 UTC 10,216 bytes, 1 lines download raw bytes

1(function(n){"use strict";var i=n.af,r=i.common,u={dropdown:"<div class='dropdown-menu bg-white datepicker-advanced py-0 pb-2' style='font-size: 0.85rem;box-shadow: 1px 2px 14px 3px rgba(0, 0, 0, 0.175);z-index: 999999!important;'>   <div class='datepicker-container'>   <\/div>"+"   <div class='px-2'><button class='clear-data py-0 btn btn-sm btn-secondary btn-block'>× <%=Clear%><\/button><\/div>"+"<\/div>",separator:"<div class='w-100'><\/div>"},t={activePicker:null,picker:null,container:null,documentKeyEventRemoved:!1,yearRangeSpecific:{}};function AfDatePicker(f,e){var s=$(f),h=this,o={format:null,formatFunction:null,unFormatFunction:null,dataObject:null,fieldName:null,date:null,callback:null,callbackOnShow:null,skipSettingValue:!1,minDate:null,maxDate:null,defaultDate:null,yearRange:null,dateType:"dateTime",eventHandler:new r.EventHandler(h,{onDatePicked:{abortable:!1},onDateCleared:{abortable:!1}})};f.autocomplete="off";o.dataObject=e;o.format=s.data("format")||i.article.defaultDateFormat||"Short Date"||i.userSession.formats["General Date Short Time"];o.formatFunction=getFormatFunction(s,o.format);o.unFormatFunction=getUnFormatFunction(s,o.format);o.fieldName=s.data("field");o.minDate=validDateOrNull(s.data("minDate"));o.maxDate=validDateOrNull(s.data("maxDate"));o.yearRange=null;o.defaultDate=s.data("default-date");var c=s.data("yearRange");c&&(o.yearRange=c);o.callback=s.data("callback");o.callbackOnShow=s.data("onshow");o.skipSettingValue=s.data("skip-setting-value");o.showPlaceholder=s.data("showformat")===!0&&i.userSession.formats[o.format]?!0:!1;o.showPlaceholder&&s.attr("placeholder",i.userSession.formats[o.format]);function fireEvent(n,t,i){return o.eventHandler.fire(n,t,i)}function attachEvent(n,t){return o.eventHandler.attach(n,t)}function detachEvent(n,t){return o.eventHandler.detach(n,t)}function validDateOrNull(n){var t=new Date(n);return t instanceof Date&&!isNaN(t)?t:null}function intialize(){if(i.userSession||(i.userSession={formats:{$:"$0 000","$.00":"$0 000.00","%":"0%","*":"*","/1000.0":"/1000.0","/1000000.0":"/1000000.0","0.0%":"0.0%","1 234":"0 000","1 234.1":"0 000.0","1 234.12":"0 000.00","1 234.1234":"0 000.0000","123.12b":"0.00b","123.12k":"0.00k","123.1b":"0.0b","123.1k":"0.0k","dd.MM":"dd.MM","dd.MM.yy":"dd.MM.yy","dd.MM.yyyy":"dd.MM.yyyy","dd.MM.yyyy HH:mm":"dd.MM.yyyy HH:mm","dd.MMM":"dd.MMM","dd.MMM.yyyy":"dd.MMM.yyyy","dd.MMM.yyyy HH:mm":"dd.MMM.yyyy HH:mm","Full Date Short Time":"dddd, d MMMM yyyy HH:mm","General Date Long Time":"dd/MM/yyyy HH:mm:ss","General Date Short Time":"dd/MM/yyyy HH:mm","HH:mm":"HH:mm","Long Date":"dddd, d MMMM yyyy","Long Time":"HH:mm:ss","MM.yyyy":"MM.yyyy","Short Date":"dd/MM/yyyy","Short Time":"HH:mm",sql_date_time:"yyyy-MM-dd HH:mm:ss",yyyymmdd:"yyyyMMdd","yyyy-MM-dd":"yyyy-MM-dd"},amDesignator:"am",culture:"en-GB",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],decimalSeparator:".",groupSeparator:",",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],pmDesignator:"pm",shortDateFormat:"dd/MM/yyyy",uiculture:"en-GB"}),s.attr("autocomplete","off"),t.yearRangeSpecific.hasOwnProperty(o.yearRange))t.documentKeyEventRemoved&&t.picker.addKeyEvent(),t.picker=t.yearRangeSpecific[o.yearRange].picker,t.container=t.yearRangeSpecific[o.yearRange].container;else{t.picker=new Pikaday({onSelect:function(n){if(t.activePicker.setDate(n),typeof window[t.activePicker.callback()]=="function"){var i=o.date?o.date:new Date;o.dateType==="date"?window[t.activePicker.callback()](new Date(n.getFullYear(),n.getMonth(),n.getDate(),(new Date).getHours()+n.getTimezoneOffset()/-60,(new Date).getMinutes(),0,0)):window[t.activePicker.callback()](new Date(n.getFullYear(),n.getMonth(),n.getDate(),i.getHours(),i.getMinutes(),0,0))}o.dateType==="date"?t.activePicker.fireEvent("onDatePicked",(new Date).getHours()+n.getTimezoneOffset()/-60):t.activePicker.fireEvent("onDatePicked",n)},yearRange:o.yearRange||[1940,2099],container:document.body,firstDay:1,i18n:{previousMonth:aT("Last month"),nextMonth:aT("Next month"),months:i.userSession.monthNames,weekdays:i.userSession.dayNames,weekdaysShort:i.userSession.dayNamesShort},showWeekNumber:!0});t.container=$(i.template.run(u.dropdown,{clear:aT("Clear")}));t.yearRangeSpecific[o.yearRange]={picker:t.picker,container:t.container};$(t.picker.el).css("position","relative");$(t.picker.el).css("border","0");$(t.picker.el).css("box-shadow","none");t.container.find(".datepicker-container").append(t.picker.el);window.afDatePickerContainer=t.container;t.container.on("click",".pika-title",function(n){n.stopPropagation()});$("body").append(t.container);$(document).on("click touchstart",function(n){$(n.target).closest(".datepicker-advanced").length===0&&doHide()});$(window).scroll(function(){t.activePicker&&i.dataBinding.Helpers.setPosition(s,t.container,3)}
1);$(".modal-open .modal").scroll(function(){t.activePicker&&i.dataBinding.Helpers.setPosition(s,t.container,3)});$(window).resize(function(){t.activePicker&&i.dataBinding.Helpers.setPosition(s,t.container,3)});t.container.find(".clear-data").on("click",function(n){t.activePicker.clearDate();n.stopPropagation();doHide();t.activePicker.fireEvent("onDateCleared");typeof window[t.activePicker.callback()]=="function"&&window[t.activePicker.callback()](null)})}if(o.minDate&&t.picker.setMinDate(o.minDate),o.maxDate&&t.picker.setMaxDate(o.maxDate),o.dataObject){var n=o.dataObject.getExtendedFields(o.fieldName);n&&n.type&&(o.dateType=n.type)}}s.on("keydown",function(n){console.log("KeyDown: "+n.code);n.code==="F2"||n.altKey===!0&&n.code==="ArrowDown"||n.code==="Space"?(intialize(),i.dataBinding.Helpers.setPosition(s,t.container,3),window["af.shared.active.dropdown"]={target:$(this),dropdown:t.container},n.preventDefault()):n.code==="Escape"?(doHide(),n.preventDefault(),n.stopPropagation()):n.code==="Tab"&&doHide()});s.on("keyup",function(n){t.activePicker=h;var u=n.code;if(u!=="Tab"){var a=o.date?o.date.getMinutes():0,v=o.date?o.date.getHours():0,e=o.date?!1:!0,r=o.unFormatFunction(n.target.value),c=(i.userSession.formats[o.format]||"").indexOf("HH")!==-1,l=(i.userSession.formats[o.format]||"").indexOf("mm")!==-1;if(o.dateType==="date"&&r&&(r=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),0,0,0))),r||(r=new Date(n.target.value)),r&&(c?r.setHours(r.getHours()):c||e||r.setHours(v),l?r.setMinutes(r.getMinutes()):l||e||r.setMinutes(a)),r||n.target.value===""){var f=r?r:null;f?t.picker.setDate(f,!0,u):setDate([null],!1,u);s.data("new-date",f)}typeof window[t.activePicker.callback()]=="function"&&window[t.activePicker.callback()](r)}});s.on("click focus",handleClick);function handleClick(n){if(t.activePicker=h,intialize(),n.type==="click"&&$(this).data("justfocussed")){$(this).data("justfocussed",!1);setValueOnFocusClick();n.stopPropagation();return}n.type==="focus"&&$(this).data("justfocussed",!0);t.picker.setMinDate(null);t.picker.setMaxDate(null);o.callbackOnShow&&typeof window[o.callbackOnShow]=="function"&&window[o.callbackOnShow](l);i.dataBinding.Helpers.setPosition(s,t.container,3);window["af.shared.active.dropdown"]={target:$(this),dropdown:t.container};n.stopPropagation()}function setValueOnFocusClick(){if(o.dataObject&&o.fieldName){var n=o.dataObject.currentRow(o.fieldName);if(n===null&&(n=new XDate(!0)[0]),t.activePicker.defaultDate()){var r=eval("(function(){"+t.activePicker.defaultDate()+"}())");r?t.picker.setDate(r,!0):t.picker.setDate(n,!0)}else t.picker.setDate(n,!0);o.date=o.dataObject.currentRow(o.fieldName)}else if(t.activePicker.defaultDate()){var r=eval("(function(){"+t.activePicker.defaultDate()+"}())");r?t.picker.setDate(r,!0):t.picker.setDate(n,!0)}else if(s.data("date")||s.data("new-date")){let n;n=s.data("new-date")?s.data("new-date"):s.data("date");t.picker.setDate(n,!0)}else s.val()!==""?t.picker.setDate(i.utils.date.parse(s.val(),i.userSession.shortDateFormat),!0):t.picker.setDate(i.utils.date.parse(new XDate(!0).toString(),i.userSession.shortDateFormat),!0)}function clearDate(){setDate([null]);o.dataObject&&o.fieldName&&o.dataObject.currentRow(o.fieldName,null)}function setDate(n,r,u){var f,h=r===!1?!1:!0;if(f=n&&n.constructor===Date?n:new XDate(n).valid()?n[0]:i.Filter.isDateExpression(f)?i.Filter.DATEEXPRESSIONS.VALUES[f]:n,new XDate(f).valid()){if(o.dateType==="date")f=new Date(f.getFullYear(),f.getMonth(),f.getDate(),(new Date).getHours()+f.getTimezoneOffset()/-60,(new Date).getMinutes(),0,0);else{var e=o.date?o.date:new Date;f=new Date(f.getFullYear(),f.getMonth(),f.getDate(),e.getHours(),e.getMinutes(),0,0)}o.date=f;s.data("new-date",f);s.data("new-date-value",f);s[0].tagName==="INPUT"?s.attr("data-field")||s.attr("data-callback")?o.dateType==="date"?s.val(i.common.formatByMask(n,o.format?o.format:"Short Date",!1,!0)).change():s.val(o.formatFunction(f,!1)).change():s.val(o.formatFunction(f)):o.skipSettingValue||(s.text(o.formatFunction(f)).change(),s.attr("data-field")&&o.dataObject.currentRow(s.attr("data-field"),f));t.container&&(h||u==="Enter")&&(s.focus(),doHide())}}function doHide(){t.documentKeyEventRemoved===!1&&(t.documentKeyEventRemoved=!0);t.picker.removeKeyEvent();t.container.hide()}function setDateParameter(n){o.date=n}function callback(){return o.callback}function getElement(){return s}function defaultDate(){return o.defaultDate}function getFormatFunction(t,r){var u=t.data("format-function");return u&&typeof n[u]=="function"?n[u]:r?function(n){return i.common.formatByMask(n,r)}:void 0}function getUnFormatFunction(t,r){var u=t.data("un-format-function");return u&&typeof n[u]=="function"?n[u]:r?function(n){return i.common.unFormatByMask(n,r)}:void 0}var l={shared:t,setDate:function(n){t.picker.setDate(n,!0)}};this.setDate=setDate;this.setDateParameter=setDateParameter;this.attachEvent=attachEvent;this.detachEvent=detachEvent;this.fireEvent=fireEvent;this.callback=callback;this.getElement=getElement;this.clearDate=clearDate;this.defaultDate=defaultDate}r.expose("af.dataBinding",AfDatePicker)})(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.