PageSourceSearch

https://www.xploresports.com/bower_components/ngComboDatePicker/source/ngComboDatePicker.min.js

js xploresports.com collected 2026-09-30 11:48:22 UTC 6,673 bytes, 7 lines download raw bytes

1/*
2 * ngComboDatePicker v1.5.1
3 * http://github.com/jfmdev/ngComboDatePicker
4 * «Copyright 2015 Jose F. Maldonado»
5 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 */
7angular.module("ngComboDatePicker",[]).directive("ngComboDatePicker",function(){function maxDate(e,n){var t=31;return null!=e&&(4!=e&&6!=e&&9!=e&&11!=e||(t=30),null!=n&&2==e&&(t=n%4==0&&n%100!=0||n%400==0?29:28)),t}function adjustTimezone(e,n){var t=isNaN(n)?(new Date).getTimezoneOffset():60*parseFloat(n);return new Date(e.getTime()+60*t*1e3)}function parseDate(e,n){var t=null;return void 0!==e&&null!==e&&(e instanceof Date?t=e:"number"!=typeof e&&"string"!=typeof e||(t=new Date(isNaN(e)?e:parseInt(e,10)),t=adjustTimezone(t,n))),t}function parseIntStrict(e){return null!==e&&""!==e&&NaN!=parseInt(e)?parseInt(e):null}function parseJsonPlus(e){var n=null;if(null!=e){try{n=JSON.parse(e)}catch(e){}if(null==n)try{n=JSON.parse(e.replace(/'/g,'"'))}catch(e){}}return n}return{restrict:"AEC",scope:{ngModel:"=",ngDate:"@",ngMinDate:"@",ngMaxDate:"@",ngMinModel:"=?",ngMaxModel:"=?",ngMonths:"@",ngTimezone:"@",ngOrder:"@",ngAttrsDate:"@",ngAttrsMonth:"@",ngAttrsYear:"@",ngDisabled:"=?",ngYearOrder:"@",ngPlaceholder:"@",ngPlaceholderEnabled:"@",ngRequired:"@"},require:"ngModel",controller:["$scope",function(e){e.ngModel=parseDate(e.ngModel,e.ngTimezone),e.ngMinModel=parseDate(e.ngMinModel,e.ngTimezone),e.ngMaxModel=parseDate(e.ngMaxModel,e.ngTimezone),e.ngAttrsDate=parseJsonPlus(e.ngAttrsDate),e.ngAttrsMonth=parseJsonPlus(e.ngAttrsMonth),e.ngAttrsYear=parseJsonPlus(e.ngAttrsYear);var n=parseDate(e.ngDate,e.ngTimezone);if(null!=n&&(e.ngModel=n),"string"!=typeof e.ngOrder?e.ngOrder="dmy":e.ngOrder=e.ngOrder.toLowerCase(),e.ngMinDate&&(e.ngMinModel=parseDate(e.ngMinDate,e.ngTimezone)),!e.ngMinModel){var t=new Date;e.ngMinModel=new Date(t.getFullYear()-100,t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}if(e.ngMaxDate&&(e.ngMaxModel=parseDate(e.ngMaxDate,e.ngTimezone)),e.ngMaxModel||(e.ngMaxModel=new Date),e.$watch("[ngMinModel, ngMaxModel]",function(){if(e.ngMinModel&&e.ngMaxModel){e.years=[];for(var n=e.ngMinModel.getFullYear();n<=e.ngMaxModel.getFullYear();n++)e.years.push({value:n,name:n});"string"==typeof e.ngYearOrder&&0==e.ngYearOrder.indexOf("des")&&e.years.reverse(),e.placeHolders&&e.years.unshift(e.placeHolders[0])}e.ngModel&&e.ngMinModel&&e.ngModel<e.ngMinModel&&(e.ngModel=e.ngMinModel),e.ngModel&&e.ngMaxModel&&e.ngModel>e.ngMaxModel&&(e.ngModel=e.ngMaxModel)}),e.placeHolders=null,void 0!==e.ngPlaceholder&&null!==e.ngPlaceholder&&("string"==typeof e.ngPlaceholder||Array.isArray(e.ngPlaceholder))){var a="string"==typeof e.ngPlaceholder?e.ngPlaceholder.split(","):e.ngPlaceholder;if(3==a.length){e.placeHolders=[];for(var l=0;l<a.length;l++)e.placeHolders.push({value:"",name:a[l],disabled:!1})}}var r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(void 0!==e.ngMonths&&null!==e.ngMonths){if("string"==typeof e.ngMonths){var o=e.ngMonths.split(",");12==o.length&&(r=o)}Array.isArray(e.ngMonths)&&12==e.ngMonths.length&&(r=e.ngMonths)}e.updateMonthList=function(n){n=parseIntStrict(n);var t=null!==n&&n==e.ngMinModel.getFullYear()?e.ngMinModel.getMonth():0,a=null!==n&&n==e.ngMaxModel.getFullYear()?e.ngMaxModel.getMonth():11;e.months=[],e.placeHolders&&e.months.push(e.placeHolders[1]);for(var l=t;l<=a;l++)e.months.push({value:l,name:r[l]})},e.updateDateList=function(n,t){n=parseIntStrict(n),t=parseIntStrict(t);var a=1;null!==n&&n==e.ngMinModel.getMonth()&&null!==t&&t==e.ngMinModel.getFullYear()&&(a=e.ngMinModel.getDate());var l=maxDate(null!==n?n+1:null,t);null!==n&&n==e.ngMaxModel.getMonth()&&null!==t&&t==e.ngMaxModel.getFullYear()&&(l=e.ngMaxModel.getDate()),e.dates=[],e.placeHolders&&e.dates.push(e.placeHolders[2]);for(var r=a;r<=l;r++)e.dates.push({value:r,name:r})}}],link:function(e,n,t,a){for(var l=angular.element,r=l(n[0]).children(),o=e.ngOrder.split(""),s=0;s<o.length;s++)"d"==o[s]&&l(n[0]).append(r[0]),"m"==o[s]&&l(n[0]).append(r[1]),"y"==o[s]&&l(n[0]).append(r[2]);a.$formatters.push(function(n){var t={date:null,month:null,year:null};return n?(t.date=n.getDate(),t.month=n.getMonth(),t.year=n.getFullYear()):(t.date="",t.month="",t.year="",e.placeHolders&&(e.placeHolders[0].disabled=!1,e.placeHolders[1].disabled=!1,e.placeHolders[2].disabled=!1)),e.updateMonthList(t.year),e.updateDateList(t.month,t.year),t}),a.$render=function(){e.date=a.$viewValue.date,e.month=a.$viewValue.month,e.year=a.$viewValue.year},e.$watch('date + "-" + month + "-" + year',function(n,t){n!=t&&a.$setViewValue({date:e.date,month:e.month,year:e.year})}),a.$isEmpty=function(e){return null==e.date||""==e.date||isNaN(parseInt(e.month))||null==e.year||""==e.year},a.$parsers.push(function(n){var t=null;if(null!=n.date&&""!=n.date&&!isNaN(parseInt(n.month))&&null!=n.year&&""!=n.year){var a=maxDate(n.month+1,n.year),l=0,r=0,o=0,s=0;null!=e.ngModel&&(l=e.ngModel.getHours(),r=e.ngModel.getMinutes(),o=e.ngModel.getSeconds(),s=e.ngModel.getMilliseconds()),t=new Date(n.year,n.month,n.date>a?a:n.date,l,r,o,s)}return e.placeHolders&&angular.isUndefined(e.ngPlaceholderEnabled)&&(""!=e.year&&(e.placeHolders[0].disabled=!0),""!=e.month&&(e.placeHolders[1].disabled=!0),""!=e.date&&(e.placeHolders[2].disabled=!0)),e.updateMonthList(n.year),e.updateDateList(n.month,n.year),t}),e.touched=function(){a.$touched=!0,a.$untouched=!1}},template:function(element,attrs){for(var strAttrs=["","",""],attrNames=["ngAttrsDate","ngAttrsMonth","ngAttrsYear"],i=0;i<3;i++)try{if(attrs&&attrs[attrNames[i]]){eval("var attrsAux= "+attrs[attrNames[i]]);for(var key in attrsAux){var value=attrsAux[key];"boolean"==typeof value?value&&(strAttrs[i]+=key+" "):("string"==typeof value&&value.indexOf('"')>0&&(value=value.replace(/"/g,"&quot;")),strAttrs[i]+=key+'="'+value+'" ')}}}catch(e){console.log(e)}var html='<select ng-disabled="ngDisabled === true || ngDisabled[0] === true" ng-model="date" ng-blur="touched()" '+strAttrs[0]+' ng-options="date.value as date.name disable when date.disabled for date in dates"></select><select ng-disabled="ngDisabled === true || ngDisabled[1] === true" ng-model="month" ng-blur="touched()" '+strAttrs[1]+' ng-options="month.value as month.name disable when month.disabled for month in months"></select><select ng-disabled="ngDisabled === true || ngDisabled[2] === true" ng-model="year" ng-blur="touched()" '+strAttrs[2]+' ng-options="year.value as year.name disable when year.disabled for year in years"></select>';return html}}});

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.