BrowzOS/clock/jsDatePick.min.1.3.js

1 line
26 KiB
JavaScript
Raw Normal View History

2019-02-24 23:00:10 +00:00
g_l=[];g_l.MONTHS=["Janaury","February","March","April","May","June","July","August","September","October","November","December"];g_l.DAYS_3=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];g_l.MONTH_FWD="Move a month forward";g_l.MONTH_BCK="Move a month backward";g_l.YEAR_FWD="Move a year forward";g_l.YEAR_BCK="Move a year backward";g_l.CLOSE="Close the calendar";g_l.ERROR_2=g_l.ERROR_1="Date object invalid!";g_l.ERROR_4=g_l.ERROR_3="Target invalid";g_jsDatePickImagePath="img/";g_jsDatePickDirectionality="ltr";g_arrayOfUsedJsDatePickCalsGlobalNumbers=[];g_arrayOfUsedJsDatePickCals=[];g_currentDateObject={};g_currentDateObject.dateObject=new Date();g_currentDateObject.day=g_currentDateObject.dateObject.getDate();g_currentDateObject.month=g_currentDateObject.dateObject.getMonth()+1;g_currentDateObject.year=g_currentDateObject.dateObject.getFullYear();JsgetElem=function(a){return document.getElementById(a)};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};String.prototype.strpad=function(){return(!isNaN(this)&&this.toString().length==1)?"0"+this:this};JsDatePick=function(a){if(document.all){this.isie=true;this.iever=JsDatePick.getInternetExplorerVersion()}else{this.isie=false}this.oConfiguration={};this.oCurrentDay=g_currentDateObject;this.monthsTextualRepresentation=g_l.MONTHS;this.lastPostedDay=null;this.initialZIndex=2;this.globalNumber=this.getUnUsedGlobalNumber();g_arrayOfUsedJsDatePickCals[this.globalNumber]=this;this.setConfiguration(a);this.makeCalendar()};JsDatePick.getCalInstanceById=function(a){return g_arrayOfUsedJsDatePickCals[parseInt(a,10)]};JsDatePick.getInternetExplorerVersion=function(){var c=-1,a,b;if(navigator.appName=="Microsoft Internet Explorer"){a=navigator.userAgent;b=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(b.exec(a)!=null){c=parseFloat(RegExp.$1)}return c}};JsDatePick.prototype.setC=function(a,b){if(this.isie&&this.iever>7){a.setAttribute("class",b)}else{a.className=b}};JsDatePick.prototype.getUnUsedGlobalNumber=function(){var a=Math.floor(Math.random()*1000);while(!this.isUnique_GlobalNumber(a)){a=Math.floor(Math.random()*1000)}return a};JsDatePick.prototype.isUnique_GlobalNumber=function(b){var a;for(a=0;a<g_arrayOfUsedJsDatePickCalsGlobalNumbers.length;a++){if(g_arrayOfUsedJsDatePickCalsGlobalNumbers[a]==b){return false}}return true};JsDatePick.prototype.addOnSelectedDelegate=function(a){if(typeof(a)=="function"){this.addonSelectedDelegate=a}return false};JsDatePick.prototype.setOnSelectedDelegate=function(a){if(typeof(a)=="function"){this.onSelectedDelegate=a;return true}return false};JsDatePick.prototype.executeOnSelectedDelegateIfExists=function(){if(typeof(this.onSelectedDelegate)=="function"){this.onSelectedDelegate()}if(typeof(this.addonSelectedDelegate)=="function"){this.addonSelectedDelegate()}};JsDatePick.prototype.setRepopulationDelegate=function(a){if(typeof(a)=="function"){this.repopulationDelegate=a;return true}return false};JsDatePick.prototype.setConfiguration=function(a){this.oConfiguration.isStripped=(a.isStripped!=null)?a.isStripped:false;this.oConfiguration.useMode=(a.useMode!=null)?a.useMode:1;this.oConfiguration.selectedDate=(a.selectedDate!=null)?a.selectedDate:null;this.oConfiguration.target=(a.target!=null)?a.target:null;this.oConfiguration.yearsRange=(a.yearsRange!=null)?a.yearsRange:[1971,2100];this.oConfiguration.limitToToday=(a.limitToToday!=null)?a.limitToToday:false;this.oConfiguration.field=(a.field!=null)?a.field:false;this.oConfiguration.cellColorScheme=(a.cellColorScheme!=null)?a.cellColorScheme:"ocean_blue";this.oConfiguration.dateFormat=(a.dateFormat!=null)?a.dateFormat:"%m-%d-%Y";this.oConfiguration.imgPath=(g_jsDatePickImagePath.length!=null)?g_jsDatePickImagePath:"img/";this.oConfiguration.weekStartDay=(a.weekStartDay!=null)?a.weekStartDay:1;this.selectedDayObject={};this.flag_DayMarkedBeforeRepopulation=false;this.flag_aDayWasSelected=false;this.lastMarkedDayObject=null;if(!this.oConfiguration.selectedDa