1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/* ========================================================= 11 * bootstrap-datepicker.js 12 * http://www.eyecon.ro/bootstrap-datepicker 13 * ========================================================= 14 * Copyright 2012 Stefan Petre 15 * 16 * Licensed under the Apache License, Version 2.0 (the "License"); 17 * you may not use this file except in compliance with the License. 18 * You may obtain a copy of the License at 19 * 20 * http://www.apache.org/licenses/LICENSE-2.0 21 * 22 * Unless required by applicable law or agreed to in writing, software 23 * distributed under the License is distributed on an "AS IS" BASIS, 24 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 * See the License for the specific language governing permissions and 26 * limitations under the License. 27 * ========================================================= */ 28 29!function( $ ) { 30 31 // Picker object 32 33 var Datepicker = function(element, options){ 34 this.element = $(element); 35 this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy'); 36 this.picker = $(DPGlobal.template) 37 .appendTo('body') 38 .on({ 39 click: $.proxy(this.click, this)//, 40 //mousedown: $.proxy(this.mousedown, this) 41 }); 42 this.isInput = this.element.is('input'); 43 this.component = this.element.is('.date') ? this.element.find('.add-on') : false; 44 45 if (this.isInput) { 46 this.element.on({ 47 focus: $.proxy(this.show, this), 48 //blur: $.proxy(this.hide, this), 49 keyup: $.proxy(this.update, this) 50 }); 51 } else { 52 if (this.component){ 53 this.component.on('click', $.proxy(this.show, this)); 54 } else { 55 this.element.on('click', $.proxy(this.show, this)); 56 } 57 } 58 59 this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0; 60 if (typeof this.minViewMode === 'string') { 61 switch (this.minViewMode) { 62 case 'months': 63 this.minViewMode = 1; 64 break; 65 case 'years': 66 this.minViewMode = 2; 67 break; 68 default: 69 this.minViewMode = 0; 70 break; 71 } 72 } 73 this.viewMode = options.viewMode||this.element.data('date-viewmode')||0; 74 if (typeof this.viewMode === 'string') { 75 switch (this.viewMode) { 76 case 'months': 77 this.viewMode = 1; 78 break; 79 case 'years': 80 this.viewMode = 2; 81 break; 82 default: 83 this.viewMode = 0; 84 break; 85 } 86 } 87 this.startViewMode = this.viewMode; 88 this.weekStart = options.weekStart||this.element.data('date-weekstart')||0; 89 this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1; 90 this.onRender = options.onRender; 91 this.fillDow(); 92 this.fillMonths(); 93 this.update(); 94 this.showMode(); 95 }; 96 97 Datepicker.prototype = { 98 constructor: Datepicker, 99 100 show: function(e) { 101 this.picker.show(); 102 this.height = this.component ? this.component.outerHeight() : this.element.outerHeight(); 103 this.place(); 104 $(window).on('resize', $.proxy(this.place, this)); 105 if (e ) { 106 e.stopPropagation(); 107 e.preventDefault(); 108 } 109 if (!this.isInput) { 110 } 111 var that = this; 112 $(document).on('mousedown', function(ev){ 113 if ($(ev.target).closest('.datepicker').length == 0) { 114 that.hide(); 115 } 116 }); 117 this.element.trigger({ 118 type: 'show', 119 date: this.date 120 }); 121 }, 122 123 hide: function(){ 124 this.picker.hide(); 125 $(window).off('resize', this.place); 126 this.viewMode = this.startViewMode; 127 this.showMode(); 128 if (!this.isInput) { 129 $(document).off('mousedown', this.hide); 130 } 131 //this.set(); 132 this.element.trigger({ 133 type: 'hide', 134 date: this.date 135 }); 136 }, 137 138 set: function() { 139 var formated = DPGlobal.formatDate(this.date, this.format); 140 if (!this.isInput) { 141 if (this.component){ 142 this.element.find('input').prop('value', formated); 143 } 144 this.element.data('date', formated); 145 } else { 146 this.element.prop('value', formated); 147 } 148 }, 149 150 setValue: function(newDate) { 151 if (typeof newDate === 'string') { 152 this.date = DPGlobal.parseDate(newDate, this.format); 153 } else { 154 this.date = new Date(newDate); 155 } 156 this.set(); 157 this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0); 158 this.fill(); 159 }, 160 161 place: function(){ 162 var offset = this.component ? this.component.offset() : this.element.offset(); 163 this.picker.css({ 164 top: offset.top + this.height, 165 left: offset.left 166 }); 167 }, 168 169 update: function(newDate){ 170 this.date = DPGlobal.parseDate( 171 typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')), 172 this.format 173 ); 174 this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0); 175 this.fill(); 176 }, 177 178 fillDow: function(){ 179 var dowCnt = this.weekStart; 180 var html = '<tr>'; 181 while (dowCnt < this.weekStart + 7) { 182 html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>'; 183 } 184 html += '</tr>'; 185 this.picker.find('.datepicker-days thead').append(html); 186 }, 187 188 fillMonths: function(){ 189 var html = ''; 190 var i = 0 191 while (i < 12) { 192 html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>'; 193 } 194 this.picker.find('.datepicker-months td').append(html); 195 }, 196 197 fill: function() { 198 var d = new Date(this.viewDate), 199 year = d.getFullYear(),
200 month = d.getMonth(), 201 currentDate = this.date.valueOf(); 202 this.picker.find('.datepicker-days th:eq(1)') 203 .text(DPGlobal.dates.months[month]+' '+year); 204 var prevMonth = new Date(year, month-1, 28,0,0,0,0), 205 day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth()); 206 prevMonth.setDate(day); 207 prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7); 208 var nextMonth = new Date(prevMonth); 209 nextMonth.setDate(nextMonth.getDate() + 42); 210 nextMonth = nextMonth.valueOf(); 211 var html = []; 212 var clsName, 213 prevY, 214 prevM; 215 while(prevMonth.valueOf() < nextMonth) { 216 if (prevMonth.getDay() === this.weekStart) { 217 html.push('<tr>'); 218 } 219 clsName = this.onRender(prevMonth); 220 prevY = prevMonth.getFullYear(); 221 prevM = prevMonth.getMonth(); 222 if ((prevM < month && prevY === year) || prevY < year) { 223 clsName += ' old'; 224 } else if ((prevM > month && prevY === year) || prevY > year) { 225 clsName += ' new'; 226 } 227 if (prevMonth.valueOf() === currentDate) { 228 clsName += ' active'; 229 } 230 html.push('<td class="day '+clsName+'">'+prevMonth.getDate() + '</td>'); 231 if (prevMonth.getDay() === this.weekEnd) { 232 html.push('</tr>'); 233 } 234 prevMonth.setDate(prevMonth.getDate()+1); 235 } 236 this.picker.find('.datepicker-days tbody').empty().append(html.join('')); 237 var currentYear = this.date.getFullYear(); 238 239 var months = this.picker.find('.datepicker-months') 240 .find('th:eq(1)') 241 .text(year) 242 .end() 243 .find('span').removeClass('active'); 244 if (currentYear === year) { 245 months.eq(this.date.getMonth()).addClass('active'); 246 } 247 248 html = ''; 249 year = parseInt(year/10, 10) * 10; 250 var yearCont = this.picker.find('.datepicker-years') 251 .find('th:eq(1)') 252 .text(year + '-' + (year + 9)) 253 .end() 254 .find('td'); 255 year -= 1; 256 for (var i = -1; i < 11; i++) { 257 html += '<span class="year'+(i === -1 || i === 10 ? ' old' : '')+(currentYear === year ? ' active' : '')+'">'+year+'</span>'; 258 year += 1; 259 } 260 yearCont.html(html); 261 }, 262 263 click: function(e) { 264 e.stopPropagation(); 265 e.preventDefault(); 266 var target = $(e.target).closest('span, td, th'); 267 if (target.length === 1) { 268 switch(target[0].nodeName.toLowerCase()) { 269 case 'th': 270 switch(target[0].className) { 271 case 'switch': 272 this.showMode(1); 273 break; 274 case 'prev': 275 case 'next': 276 this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call( 277 this.viewDate, 278 this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) + 279 DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1) 280 ); 281 this.fill(); 282 this.set(); 283 break; 284 } 285 break; 286 case 'span': 287 if (target.is('.month')) { 288 var month = target.parent().find('span').index(target); 289 this.viewDate.setMonth(month); 290 } else { 291 var year = parseInt(target.text(), 10)||0; 292 this.viewDate.setFullYear(year); 293 } 294 if (this.viewMode !== 0) { 295 this.date = new Date(this.viewDate); 296 this.element.trigger({ 297 type: 'changeDate', 298 date: this.date, 299 viewMode: DPGlobal.modes[this.viewMode].clsName 300 }); 301 } 302 this.showMode(-1); 303 this.fill(); 304 this.set(); 305 break; 306 case 'td': 307 if (target.is('.day') && !target.is('.disabled')){ 308 var day = parseInt(target.text(), 10)||1; 309 var month = this.viewDate.getMonth(); 310 if (target.is('.old')) { 311 month -= 1; 312 } else if (target.is('.new')) { 313 month += 1; 314 } 315 var year = this.viewDate.getFullYear(); 316 this.date = new Date(year, month, day,0,0,0,0); 317 this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0); 318 this.fill(); 319 this.set(); 320 this.element.trigger({ 321 type: 'changeDate', 322 date: this.date, 323 viewMode: DPGlobal.modes[this.viewMode].clsName 324 }); 325 } 326 break; 327 } 328 } 329 }, 330 331 mousedown: function(e){ 332 e.stopPropagation(); 333 e.preventDefault(); 334 }, 335 336 showMode: function(dir) { 337 if (dir) { 338 this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir)); 339 } 340 this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); 341 } 342 }; 343 344 $.fn.datepicker = function ( option, val ) { 345 return this.each(function () { 346 var $this = $(this), 347 data = $this.data('datepicker'), 348 options = typeof option === 'object' && option; 349 if (!data) { 350 $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options)))); 351 } 352 if (typeof option === 'string') data[option](val); 353 }); 354 }; 355 356 $.fn.datepicker.defaults = { 357 onRender: function(date) { 358 return ''; 359 } 360 }; 361 $.fn.datepicker.Constructor = Datepicker; 362 363 var DPGlobal = { 364 modes: [ 365 { 366 clsName: 'days', 367 navFnc: 'Month', 368 navStep: 1 369 }, 370 { 371 clsName: 'months', 372 navFnc: 'FullYear', 373 navStep: 1 374 }, 375 { 376 clsName: 'years', 377 navFnc: 'FullYear', 378 navStep: 10 379 }], 380 dates:{ 381 days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], 382 daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], 383 daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], 384 months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
384November", "December"], 385 monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] 386 }, 387 isLeapYear: function (year) { 388 return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) 389 }, 390 getDaysInMonth: function (year, month) { 391 return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] 392 }, 393 parseFormat: function(format){ 394 var separator = format.match(/[.\/\-\s].*?/), 395 parts = format.split(/\W+/); 396 if (!separator || !parts || parts.length === 0){ 397 throw new Error("Invalid date format."); 398 } 399 return {separator: separator, parts: parts}; 400 }, 401 parseDate: function(date, format) { 402 var parts = date.split(format.separator), 403 date = new Date(), 404 val; 405 date.setHours(0); 406 date.setMinutes(0); 407 date.setSeconds(0); 408 date.setMilliseconds(0); 409 if (parts.length === format.parts.length) { 410 var year = date.getFullYear(), day = date.getDate(), month = date.getMonth(); 411 for (var i=0, cnt = format.parts.length; i < cnt; i++) { 412 val = parseInt(parts[i], 10)||1; 413 switch(format.parts[i]) { 414 case 'dd': 415 case 'd': 416 day = val; 417 date.setDate(val); 418 break; 419 case 'mm': 420 case 'm': 421 month = val - 1; 422 date.setMonth(val - 1); 423 break; 424 case 'yy': 425 year = 2000 + val; 426 date.setFullYear(2000 + val); 427 break; 428 case 'yyyy': 429 year = val; 430 date.setFullYear(val); 431 break; 432 } 433 } 434 date = new Date(year, month, day, 0 ,0 ,0); 435 } 436 return date; 437 }, 438 formatDate: function(date, format){ 439 var val = { 440 d: date.getDate(), 441 m: date.getMonth() + 1, 442 yy: date.getFullYear().toString().substring(2), 443 yyyy: date.getFullYear() 444 }; 445 val.dd = (val.d < 10 ? '0' : '') + val.d; 446 val.mm = (val.m < 10 ? '0' : '') + val.m; 447 var date = []; 448 for (var i=0, cnt = format.parts.length; i < cnt; i++) { 449 date.push(val[format.parts[i]]); 450 } 451 return date.join(format.separator); 452 }, 453 headTemplate: '<thead>'+ 454 '<tr>'+ 455 '<th class="prev">‹</th>'+ 456 '<th colspan="5" class="switch"></th>'+ 457 '<th class="next">›</th>'+ 458 '</tr>'+ 459 '</thead>', 460 contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>' 461 }; 462 DPGlobal.template = '<div class="datepicker dropdown-menu">'+ 463 '<div class="datepicker-days">'+ 464 '<table class=" table-condensed">'+ 465 DPGlobal.headTemplate+ 466 '<tbody></tbody>'+ 467 '</table>'+ 468 '</div>'+ 469 '<div class="datepicker-months">'+ 470 '<table class="table-condensed">'+ 471 DPGlobal.headTemplate+ 472 DPGlobal.contTemplate+ 473 '</table>'+ 474 '</div>'+ 475 '<div class="datepicker-years">'+ 476 '<table class="table-condensed">'+ 477 DPGlobal.headTemplate+ 478 DPGlobal.contTemplate+ 479 '</table>'+ 480 '</div>'+ 481 '</div>'; 482 483}( window.jQuery ); 484}
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.