// source --> https://www.hochzeitsfotografie-ronge.de/wp-content/plugins/booking/js/wpbc_vars.js?ver=8.4 /** * @version 1.0 * @package Booking Calendar * @subpackage JS Variables * @category Scripts * * @author wpdevelop * @link https://wpbookingcalendar.com/ * @email info@wpbookingcalendar.com * * @modified 2014.05.20 */ //////////////////////////////////////////////////////////////////////////////// // Eval specific variable value (integer, bool, arrays, etc...) //////////////////////////////////////////////////////////////////////////////// function wpbc_define_var( wpbc_global_var ) { if (wpbc_global_var === undefined) { return null; } else { return jQuery.parseJSON(wpbc_global_var); } //FixIn:6.1 } //////////////////////////////////////////////////////////////////////////////// // Define global Booking Calendar Varibales based on Localization //////////////////////////////////////////////////////////////////////////////// var wpbc_ajaxurl = wpbc_global1.wpbc_ajaxurl; var wpdev_bk_plugin_url = wpbc_global1.wpdev_bk_plugin_url; var wpdev_bk_today = wpbc_define_var( wpbc_global1.wpdev_bk_today ); var visible_booking_id_on_page = wpbc_define_var( wpbc_global1.visible_booking_id_on_page ); var booking_max_monthes_in_calendar = wpbc_global1.booking_max_monthes_in_calendar; var user_unavilable_days = wpbc_define_var( wpbc_global1.user_unavilable_days ); var wpdev_bk_edit_id_hash = wpbc_global1.wpdev_bk_edit_id_hash; var wpdev_bk_plugin_filename = wpbc_global1.wpdev_bk_plugin_filename; var bk_days_selection_mode = wpbc_global1.bk_days_selection_mode; var wpdev_bk_personal = parseInt( wpbc_global1.wpdev_bk_personal ); var block_some_dates_from_today = parseInt( wpbc_global1.block_some_dates_from_today ); var message_verif_requred = wpbc_global1.message_verif_requred; var message_verif_requred_for_check_box = wpbc_global1.message_verif_requred_for_check_box; var message_verif_requred_for_radio_box = wpbc_global1.message_verif_requred_for_radio_box; var message_verif_emeil = wpbc_global1.message_verif_emeil; var message_verif_same_emeil = wpbc_global1.message_verif_same_emeil; var message_verif_selectdts = wpbc_global1.message_verif_selectdts; var parent_booking_resources = wpbc_define_var( wpbc_global1.parent_booking_resources ); var new_booking_title = wpbc_global1.new_booking_title; var new_booking_title_time = parseInt( wpbc_global1.new_booking_title_time); var type_of_thank_you_message = wpbc_global1.type_of_thank_you_message; var thank_you_page_URL = wpbc_global1.thank_you_page_URL; var is_am_pm_inside_time = ( wpbc_global1.is_am_pm_inside_time == "true" ); var is_booking_used_check_in_out_time = ( wpbc_global1.is_booking_used_check_in_out_time == "true" ); var wpbc_active_locale = wpbc_global1.wpbc_active_locale; var wpbc_message_processing = wpbc_global1.wpbc_message_processing; var wpbc_message_deleting = wpbc_global1.wpbc_message_deleting; var wpbc_message_updating = wpbc_global1.wpbc_message_updating; var wpbc_message_saving = wpbc_global1.wpbc_message_saving; //FixIn: 8.2.1.99 var message_checkinouttime_error = wpbc_global1.message_checkinouttime_error; //FixIn:6.1.1.1 var message_starttime_error = wpbc_global1.message_starttime_error; var message_endtime_error = wpbc_global1.message_endtime_error; var message_rangetime_error = wpbc_global1.message_rangetime_error; var message_durationtime_error = wpbc_global1.message_durationtime_error; var bk_highlight_timeslot_word = wpbc_global1.bk_highlight_timeslot_word; if (typeof wpbc_global2 !== 'undefined') { var message_time_error = wpbc_global2.message_time_error; } if (typeof wpbc_global3 !== 'undefined') { var bk_1click_mode_days_num = parseInt( wpbc_global3.bk_1click_mode_days_num ); var bk_1click_mode_days_start = wpbc_define_var( wpbc_global3.bk_1click_mode_days_start ); var bk_2clicks_mode_days_min = parseInt( wpbc_global3.bk_2clicks_mode_days_min ); var bk_2clicks_mode_days_max = parseInt( wpbc_global3.bk_2clicks_mode_days_max ); var bk_2clicks_mode_days_specific = wpbc_define_var( wpbc_global3.bk_2clicks_mode_days_specific ); var bk_2clicks_mode_days_start = wpbc_define_var( wpbc_global3.bk_2clicks_mode_days_start ); //FixIn: 8.2.1.99 bk_highlight_timeslot_word = wpbc_global3.bk_highlight_timeslot_word; var is_booking_recurrent_time = ( wpbc_global3.is_booking_recurrent_time == "true" ); is_booking_used_check_in_out_time = ( wpbc_global3.is_booking_used_check_in_out_time == "true" ); var bk_currency_pos = wpbc_global3.bk_currency_pos; //FixIn: 7.0.1.49 } if (typeof wpbc_global4 !== 'undefined') { var wpbc_available_days_num_from_today = parseInt( wpbc_global4.wpbc_available_days_num_from_today ); var bk_cost_depends_from_selection_line1 = wpbc_global4.bk_cost_depends_from_selection_line1; var bk_cost_depends_from_selection_line2 = wpbc_global4.bk_cost_depends_from_selection_line2; var bk_cost_depends_from_selection_line3 = wpbc_global4.bk_cost_depends_from_selection_line3; var bk_cost_depends_from_selection_line14summ = wpbc_global4.bk_cost_depends_from_selection_line14summ; var bk_cost_depends_from_selection_line24summ = wpbc_global4.bk_cost_depends_from_selection_line24summ; var wpdev_bk_season_filter = wpbc_define_var( wpbc_global4.wpdev_bk_season_filter ); var bk_show_info_in_form = ( wpbc_global4.bk_show_info_in_form == "true" ); //FixIn: 8.1.3.15 } if (typeof wpbc_global5 !== 'undefined') { var max_visitors_4_bk_res = wpbc_define_var( wpbc_global5.max_visitors_4_bk_res ); var message_verif_visitors_more_then_available = wpbc_global5.message_verif_visitors_more_then_available; var is_use_visitors_number_for_availability = ( wpbc_global5.is_use_visitors_number_for_availability == "true" ); var availability_based_on = wpbc_global5.availability_based_on; parent_booking_resources = wpbc_define_var( wpbc_global5.parent_booking_resources ); }; // source --> https://www.hochzeitsfotografie-ronge.de/wp-content/plugins/booking/assets/libs/bootstrap/js/bootstrap.js?ver=3.3.5.1 /*! * Bootstrap v3.3.5 (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ /*! * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=f4b4c9cb85df757ca08c) * Config saved to config.json and https://gist.github.com/f4b4c9cb85df757ca08c */ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') } +function ($) { 'use strict'; var version = $.fn.jquery.split(' ')[0].split('.') if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) { throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher') } }(jQuery); /* ======================================================================== * Bootstrap: alert.js v3.3.5 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // ALERT CLASS DEFINITION // ====================== var dismiss = '[data-dismiss="alert"]' var Alert = function (el) { $(el).on('click', dismiss, this.close) } Alert.VERSION = '3.3.5' Alert.TRANSITION_DURATION = 150 Alert.prototype.close = function (e) { var $this = $(this) var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = $(selector) if (e) e.preventDefault() if (!$parent.length) { $parent = $this.closest('.alert') } $parent.trigger(e = $.Event('close.bs.alert')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { // detach from parent, fire event then clean up data $parent.detach().trigger('closed.bs.alert').remove() } $.support.transition && $parent.hasClass('fade') ? $parent .one('bsTransitionEnd', removeElement) .emulateTransitionEnd(Alert.TRANSITION_DURATION) : removeElement() } // ALERT PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.alert') if (!data) $this.data('bs.alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } var old = $.fn.alert $.fn.alert = Plugin $.fn.alert.Constructor = Alert // ALERT NO CONFLICT // ================= $.fn.alert.noConflict = function () { $.fn.alert = old return this } // ALERT DATA-API // ============== $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(jQuery); /* ======================================================================== * Bootstrap: button.js v3.3.5 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, Button.DEFAULTS, options) this.isLoading = false } Button.VERSION = '3.3.5' Button.DEFAULTS = { loadingText: 'loading...' } Button.prototype.setState = function (state) { var d = 'disabled' var $el = this.$element var val = $el.is('input') ? 'val' : 'html' var data = $el.data() state += 'Text' if (data.resetText == null) $el.data('resetText', $el[val]()) // push to event loop to allow forms to submit setTimeout($.proxy(function () { $el[val](data[state] == null ? this.options[state] : data[state]) if (state == 'loadingText') { this.isLoading = true $el.addClass(d).attr(d, d) } else if (this.isLoading) { this.isLoading = false $el.removeClass(d).removeAttr(d) } }, this), 0) } Button.prototype.toggle = function () { var changed = true var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { var $input = this.$element.find('input') if ($input.prop('type') == 'radio') { if ($input.prop('checked')) changed = false $parent.find('.active').removeClass('active') this.$element.addClass('active') } else if ($input.prop('type') == 'checkbox') { if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false this.$element.toggleClass('active') } $input.prop('checked', this.$element.hasClass('active')) if (changed) $input.trigger('change') } else { this.$element.attr('aria-pressed', !this.$element.hasClass('active')) this.$element.toggleClass('active') } } // BUTTON PLUGIN DEFINITION // ======================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.button') var options = typeof option == 'object' && option if (!data) $this.data('bs.button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } var old = $.fn.button $.fn.button = Plugin $.fn.button.Constructor = Button // BUTTON NO CONFLICT // ================== $.fn.button.noConflict = function () { $.fn.button = old return this } // BUTTON DATA-API // =============== $(document) .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') Plugin.call($btn, 'toggle') if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault() }) .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) }) }(jQuery); /* ======================================================================== * Bootstrap: carousel.js v3.3.5 * http://getbootstrap.com/javascript/#carousel * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CAROUSEL CLASS DEFINITION // ========================= var Carousel = function (element, options) { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.paused = null this.sliding = null this.interval = null this.$active = null this.$items = null this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) } Carousel.VERSION = '3.3.5' Carousel.TRANSITION_DURATION = 600 Carousel.DEFAULTS = { interval: 5000, pause: 'hover', wrap: true, keyboard: true } Carousel.prototype.keydown = function (e) { if (/input|textarea/i.test(e.target.tagName)) return switch (e.which) { case 37: this.prev(); break case 39: this.next(); break default: return } e.preventDefault() } Carousel.prototype.cycle = function (e) { e || (this.paused = false) this.interval && clearInterval(this.interval) this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } Carousel.prototype.getItemIndex = function (item) { this.$items = item.parent().children('.item') return this.$items.index(item || this.$active) } Carousel.prototype.getItemForDirection = function (direction, active) { var activeIndex = this.getItemIndex(active) var willWrap = (direction == 'prev' && activeIndex === 0) || (direction == 'next' && activeIndex == (this.$items.length - 1)) if (willWrap && !this.options.wrap) return active var delta = direction == 'prev' ? -1 : 1 var itemIndex = (activeIndex + delta) % this.$items.length return this.$items.eq(itemIndex) } Carousel.prototype.to = function (pos) { var that = this var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" if (activeIndex == pos) return this.pause().cycle() return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) } Carousel.prototype.pause = function (e) { e || (this.paused = true) if (this.$element.find('.next, .prev').length && $.support.transition) { this.$element.trigger($.support.transition.end) this.cycle(true) } this.interval = clearInterval(this.interval) return this } Carousel.prototype.next = function () { if (this.sliding) return return this.slide('next') } Carousel.prototype.prev = function () { if (this.sliding) return return this.slide('prev') } Carousel.prototype.slide = function (type, next) { var $active = this.$element.find('.item.active') var $next = next || this.getItemForDirection(type, $active) var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' var that = this if ($next.hasClass('active')) return (this.sliding = false) var relatedTarget = $next[0] var slideEvent = $.Event('slide.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) this.$element.trigger(slideEvent) if (slideEvent.isDefaultPrevented()) return this.sliding = true isCycling && this.pause() if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) $nextIndicator && $nextIndicator.addClass('active') } var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" if ($.support.transition && this.$element.hasClass('slide')) { $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) $active .one('bsTransitionEnd', function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger(slidEvent) }, 0) }) .emulateTransitionEnd(Carousel.TRANSITION_DURATION) } else { $active.removeClass('active') $next.addClass('active') this.sliding = false this.$element.trigger(slidEvent) } isCycling && this.cycle() return this } // CAROUSEL PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.carousel') var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) var action = typeof option == 'string' ? option : options.slide if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } var old = $.fn.carousel $.fn.carousel = Plugin $.fn.carousel.Constructor = Carousel // CAROUSEL NO CONFLICT // ==================== $.fn.carousel.noConflict = function () { $.fn.carousel = old return this } // CAROUSEL DATA-API // ================= var clickHandler = function (e) { var href var $this = $(this) var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 if (!$target.hasClass('carousel')) return var options = $.extend({}, $target.data(), $this.data()) var slideIndex = $this.attr('data-slide-to') if (slideIndex) options.interval = false Plugin.call($target, options) if (slideIndex) { $target.data('bs.carousel').to(slideIndex) } e.preventDefault() } $(document) .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) $(window).on('load', function () { $('[data-ride="carousel"]').each(function () { var $carousel = $(this) Plugin.call($carousel, $carousel.data()) }) }) }(jQuery); /* ======================================================================== * Bootstrap: dropdown.js v3.3.5 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // DROPDOWN CLASS DEFINITION // ========================= var backdrop = '.dropdown-backdrop' var toggle = '[data-toggle="dropdown"]' var Dropdown = function (element) { $(element).on('click.bs.dropdown', this.toggle) } Dropdown.VERSION = '3.3.5' function getParent($this) { var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = selector && $(selector) return $parent && $parent.length ? $parent : $this.parent() } function clearMenus(e) { if (e && e.which === 3) return $(backdrop).remove() $(toggle).each(function () { var $this = $(this) var $parent = getParent($this) var relatedTarget = { relatedTarget: this } if (!$parent.hasClass('open')) return if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) if (e.isDefaultPrevented()) return $this.attr('aria-expanded', 'false') $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) }) } Dropdown.prototype.toggle = function (e) { var $this = $(this) if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') clearMenus() if (!isActive) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { // if mobile we use a backdrop because click events don't delegate $(document.createElement('div')) .addClass('dropdown-backdrop') .insertAfter($(this)) .on('click', clearMenus) } var relatedTarget = { relatedTarget: this } $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) if (e.isDefaultPrevented()) return $this .trigger('focus') .attr('aria-expanded', 'true') $parent .toggleClass('open') .trigger('shown.bs.dropdown', relatedTarget) } return false } Dropdown.prototype.keydown = function (e) { if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return var $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') if (!isActive && e.which != 27 || isActive && e.which == 27) { if (e.which == 27) $parent.find(toggle).trigger('focus') return $this.trigger('click') } var desc = ' li:not(.disabled):visible a' var $items = $parent.find('.dropdown-menu' + desc) if (!$items.length) return var index = $items.index(e.target) if (e.which == 38 && index > 0) index-- // up if (e.which == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items.eq(index).trigger('focus') } // DROPDOWN PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.dropdown') if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } var old = $.fn.dropdown $.fn.dropdown = Plugin $.fn.dropdown.Constructor = Dropdown // DROPDOWN NO CONFLICT // ==================== $.fn.dropdown.noConflict = function () { $.fn.dropdown = old return this } // APPLY TO STANDARD DROPDOWN ELEMENTS // =================================== $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) }(jQuery); /* ======================================================================== * Bootstrap: modal.js v3.3.5 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // MODAL CLASS DEFINITION // ====================== var Modal = function (element, options) { this.options = options this.$body = $(document.body) this.$element = $(element) this.$dialog = this.$element.find('.modal-dialog') this.$backdrop = null this.isShown = null this.originalBodyPad = null this.scrollbarWidth = 0 this.ignoreBackdropClick = false if (this.options.remote) { this.$element .find('.modal-content') .load(this.options.remote, $.proxy(function () { this.$element.trigger('loaded.bs.modal') }, this)) } } Modal.VERSION = '3.3.5' Modal.TRANSITION_DURATION = 300 Modal.BACKDROP_TRANSITION_DURATION = 150 Modal.DEFAULTS = { backdrop: true, keyboard: true, show: true } Modal.prototype.toggle = function (_relatedTarget) { return this.isShown ? this.hide() : this.show(_relatedTarget) } Modal.prototype.show = function (_relatedTarget) { var that = this var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.checkScrollbar() this.setScrollbar() this.$body.addClass('modal-open') this.escape() this.resize() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.$dialog.on('mousedown.dismiss.bs.modal', function () { that.$element.one('mouseup.dismiss.bs.modal', function (e) { if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true }) }) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(that.$body) // don't move modals dom position } that.$element .show() .scrollTop(0) that.adjustDialog() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element.addClass('in') that.enforceFocus() var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) transition ? that.$dialog // wait for modal to slide in .one('bsTransitionEnd', function () { that.$element.trigger('focus').trigger(e) }) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger('focus').trigger(e) }) } Modal.prototype.hide = function (e) { if (e) e.preventDefault() e = $.Event('hide.bs.modal') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() this.resize() $(document).off('focusin.bs.modal') this.$element .removeClass('in') .off('click.dismiss.bs.modal') .off('mouseup.dismiss.bs.modal') this.$dialog.off('mousedown.dismiss.bs.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element .one('bsTransitionEnd', $.proxy(this.hideModal, this)) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : this.hideModal() } Modal.prototype.enforceFocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop .on('focusin.bs.modal', $.proxy(function (e) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { this.$element.trigger('focus') } }, this)) } Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { e.which == 27 && this.hide() }, this)) } else if (!this.isShown) { this.$element.off('keydown.dismiss.bs.modal') } } Modal.prototype.resize = function () { if (this.isShown) { $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) } else { $(window).off('resize.bs.modal') } } Modal.prototype.hideModal = function () { var that = this this.$element.hide() this.backdrop(function () { that.$body.removeClass('modal-open') that.resetAdjustments() that.resetScrollbar() that.$element.trigger('hidden.bs.modal') }) } Modal.prototype.removeBackdrop = function () { this.$backdrop && this.$backdrop.remove() this.$backdrop = null } Modal.prototype.backdrop = function (callback) { var that = this var animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $(document.createElement('div')) .addClass('modal-backdrop ' + animate) .appendTo(this.$body) this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { if (this.ignoreBackdropClick) { this.ignoreBackdropClick = false return } if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus() : this.hide() }, this)) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') if (!callback) return doAnimate ? this.$backdrop .one('bsTransitionEnd', callback) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') var callbackRemove = function () { that.removeBackdrop() callback && callback() } $.support.transition && this.$element.hasClass('fade') ? this.$backdrop .one('bsTransitionEnd', callbackRemove) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callbackRemove() } else if (callback) { callback() } } // these following methods are used to handle overflowing modals Modal.prototype.handleUpdate = function () { this.adjustDialog() } Modal.prototype.adjustDialog = function () { var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight this.$element.css({ paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' }) } Modal.prototype.resetAdjustments = function () { this.$element.css({ paddingLeft: '', paddingRight: '' }) } Modal.prototype.checkScrollbar = function () { var fullWindowWidth = window.innerWidth if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 var documentElementRect = document.documentElement.getBoundingClientRect() fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) } this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth this.scrollbarWidth = this.measureScrollbar() } Modal.prototype.setScrollbar = function () { var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) this.originalBodyPad = document.body.style.paddingRight || '' if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) } Modal.prototype.resetScrollbar = function () { this.$body.css('padding-right', this.originalBodyPad) } Modal.prototype.measureScrollbar = function () { // thx walsh var scrollDiv = document.createElement('div') scrollDiv.className = 'modal-scrollbar-measure' this.$body.append(scrollDiv) var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth this.$body[0].removeChild(scrollDiv) return scrollbarWidth } // MODAL PLUGIN DEFINITION // ======================= function Plugin(option, _relatedTarget) { return this.each(function () { var $this = $(this) var data = $this.data('bs.modal') var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option](_relatedTarget) else if (options.show) data.show(_relatedTarget) }) } var old = $.fn.modal $.fn.modal = Plugin $.fn.modal.Constructor = Modal // MODAL NO CONFLICT // ================= $.fn.modal.noConflict = function () { $.fn.modal = old return this } // MODAL DATA-API // ============== $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) if ($this.is('a')) e.preventDefault() $target.one('show.bs.modal', function (showEvent) { if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown $target.one('hidden.bs.modal', function () { $this.is(':visible') && $this.trigger('focus') }) }) Plugin.call($target, option, this) }) }(jQuery); /* ======================================================================== * Bootstrap: tooltip.js v3.3.5 * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // TOOLTIP PUBLIC CLASS DEFINITION // =============================== var Tooltip = function (element, options) { this.type = null this.options = null this.enabled = null this.timeout = null this.hoverState = null this.$element = null this.inState = null this.init('tooltip', element, options) } Tooltip.VERSION = '3.3.5' Tooltip.TRANSITION_DURATION = 150 Tooltip.DEFAULTS = { animation: true, placement: 'top', selector: false, template: '', trigger: 'hover focus', title: '', delay: 0, html: false, container: false, viewport: { selector: 'body', padding: 0 } } Tooltip.prototype.init = function (type, element, options) { this.enabled = true this.type = type this.$element = $(element) this.options = this.getOptions(options) this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) this.inState = { click: false, hover: false, focus: false } if (this.$element[0] instanceof document.constructor && !this.options.selector) { throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') } var triggers = this.options.trigger.split(' ') for (var i = triggers.length; i--;) { var trigger = triggers[i] if (trigger == 'click') { this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) } else if (trigger != 'manual') { var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } Tooltip.prototype.getDefaults = function () { return Tooltip.DEFAULTS } Tooltip.prototype.getOptions = function (options) { options = $.extend({}, this.getDefaults(), this.$element.data(), options) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay, hide: options.delay } } return options } Tooltip.prototype.getDelegateOptions = function () { var options = {} var defaults = this.getDefaults() this._options && $.each(this._options, function (key, value) { if (defaults[key] != value) options[key] = value }) return options } Tooltip.prototype.enter = function (obj) { var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) $(obj.currentTarget).data('bs.' + this.type, self) } if (obj instanceof $.Event) { self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true } if (self.tip().hasClass('in') || self.hoverState == 'in') { self.hoverState = 'in' return } clearTimeout(self.timeout) self.hoverState = 'in' if (!self.options.delay || !self.options.delay.show) return self.show() self.timeout = setTimeout(function () { if (self.hoverState == 'in') self.show() }, self.options.delay.show) } Tooltip.prototype.isInStateTrue = function () { for (var key in this.inState) { if (this.inState[key]) return true } return false } Tooltip.prototype.leave = function (obj) { var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) $(obj.currentTarget).data('bs.' + this.type, self) } if (obj instanceof $.Event) { self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false } if (self.isInStateTrue()) return clearTimeout(self.timeout) self.hoverState = 'out' if (!self.options.delay || !self.options.delay.hide) return self.hide() self.timeout = setTimeout(function () { if (self.hoverState == 'out') self.hide() }, self.options.delay.hide) } Tooltip.prototype.show = function () { var e = $.Event('show.bs.' + this.type) if (this.hasContent() && this.enabled) { this.$element.trigger(e) var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) if (e.isDefaultPrevented() || !inDom) return var that = this var $tip = this.tip() var tipId = this.getUID(this.type) this.setContent() $tip.attr('id', tipId) this.$element.attr('aria-describedby', tipId) if (this.options.animation) $tip.addClass('fade') var placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement var autoToken = /\s?auto?\s?/i var autoPlace = autoToken.test(placement) if (autoPlace) placement = placement.replace(autoToken, '') || 'top' $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .addClass(placement) .data('bs.' + this.type, this) this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) this.$element.trigger('inserted.bs.' + this.type) var pos = this.getPosition() var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (autoPlace) { var orgPlacement = placement var viewportDim = this.getPosition(this.$viewport) placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : placement $tip .removeClass(orgPlacement) .addClass(placement) } var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) this.applyPlacement(calculatedOffset, placement) var complete = function () { var prevHoverState = that.hoverState that.$element.trigger('shown.bs.' + that.type) that.hoverState = null if (prevHoverState == 'out') that.leave(that) } $.support.transition && this.$tip.hasClass('fade') ? $tip .one('bsTransitionEnd', complete) .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete() } } Tooltip.prototype.applyPlacement = function (offset, placement) { var $tip = this.tip() var width = $tip[0].offsetWidth var height = $tip[0].offsetHeight // manually read margins because getBoundingClientRect includes difference var marginTop = parseInt($tip.css('margin-top'), 10) var marginLeft = parseInt($tip.css('margin-left'), 10) // we must check for NaN for ie 8/9 if (isNaN(marginTop)) marginTop = 0 if (isNaN(marginLeft)) marginLeft = 0 offset.top += marginTop offset.left += marginLeft // $.fn.offset doesn't round pixel values // so we use setOffset directly with our own function B-0 $.offset.setOffset($tip[0], $.extend({ using: function (props) { $tip.css({ top: Math.round(props.top), left: Math.round(props.left) }) } }, offset), 0) $tip.addClass('in') // check to see if placing tip in new offset caused the tip to resize itself var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (placement == 'top' && actualHeight != height) { offset.top = offset.top + height - actualHeight } var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) if (delta.left) offset.left += delta.left else offset.top += delta.top var isVertical = /top|bottom/.test(placement) var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' $tip.offset(offset) this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) } Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { this.arrow() .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') .css(isVertical ? 'top' : 'left', '') } Tooltip.prototype.setContent = function () { var $tip = this.tip() var title = this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } Tooltip.prototype.hide = function (callback) { var that = this var $tip = $(this.$tip) var e = $.Event('hide.bs.' + this.type) function complete() { if (that.hoverState != 'in') $tip.detach() that.$element .removeAttr('aria-describedby') .trigger('hidden.bs.' + that.type) callback && callback() } this.$element.trigger(e) if (e.isDefaultPrevented()) return $tip.removeClass('in') $.support.transition && $tip.hasClass('fade') ? $tip .one('bsTransitionEnd', complete) .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete() this.hoverState = null return this } Tooltip.prototype.fixTitle = function () { var $e = this.$element if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') } } Tooltip.prototype.hasContent = function () { return this.getTitle() } Tooltip.prototype.getPosition = function ($element) { $element = $element || this.$element var el = $element[0] var isBody = el.tagName == 'BODY' var elRect = el.getBoundingClientRect() if (elRect.width == null) { // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) } var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null return $.extend({}, elRect, scroll, outerDims, elOffset) } Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } } Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { var delta = { top: 0, left: 0 } if (!this.$viewport) return delta var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 var viewportDimensions = this.getPosition(this.$viewport) if (/right|left/.test(placement)) { var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight if (topEdgeOffset < viewportDimensions.top) { // top overflow delta.top = viewportDimensions.top - topEdgeOffset } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset } } else { var leftEdgeOffset = pos.left - viewportPadding var rightEdgeOffset = pos.left + viewportPadding + actualWidth if (leftEdgeOffset < viewportDimensions.left) { // left overflow delta.left = viewportDimensions.left - leftEdgeOffset } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset } } return delta } Tooltip.prototype.getTitle = function () { var title var $e = this.$element var o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) return title } Tooltip.prototype.getUID = function (prefix) { do prefix += ~~(Math.random() * 1000000) while (document.getElementById(prefix)) return prefix } Tooltip.prototype.tip = function () { if (!this.$tip) { this.$tip = $(this.options.template) if (this.$tip.length != 1) { throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') } } return this.$tip } Tooltip.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) } Tooltip.prototype.enable = function () { this.enabled = true } Tooltip.prototype.disable = function () { this.enabled = false } Tooltip.prototype.toggleEnabled = function () { this.enabled = !this.enabled } Tooltip.prototype.toggle = function (e) { var self = this if (e) { self = $(e.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(e.currentTarget, this.getDelegateOptions()) $(e.currentTarget).data('bs.' + this.type, self) } } if (e) { self.inState.click = !self.inState.click if (self.isInStateTrue()) self.enter(self) else self.leave(self) } else { self.tip().hasClass('in') ? self.leave(self) : self.enter(self) } } Tooltip.prototype.destroy = function () { var that = this clearTimeout(this.timeout) this.hide(function () { that.$element.off('.' + that.type).removeData('bs.' + that.type) if (that.$tip) { that.$tip.detach() } that.$tip = null that.$arrow = null that.$viewport = null }) } // TOOLTIP PLUGIN DEFINITION // ========================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tooltip') var options = typeof option == 'object' && option if (!data && /destroy|hide/.test(option)) return if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.tooltip $.fn.tooltip = Plugin $.fn.tooltip.Constructor = Tooltip // TOOLTIP NO CONFLICT // =================== $.fn.tooltip.noConflict = function () { $.fn.tooltip = old return this } }(jQuery); /* ======================================================================== * Bootstrap: popover.js v3.3.5 * http://getbootstrap.com/javascript/#popovers * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // POPOVER PUBLIC CLASS DEFINITION // =============================== var Popover = function (element, options) { this.init('popover', element, options) } if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') Popover.VERSION = '3.3.5' Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { placement: 'right', trigger: 'click', content: '', template: '' }) // NOTE: POPOVER EXTENDS tooltip.js // ================================ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) Popover.prototype.constructor = Popover Popover.prototype.getDefaults = function () { return Popover.DEFAULTS } Popover.prototype.setContent = function () { var $tip = this.tip() var title = this.getTitle() var content = this.getContent() $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' ](content) $tip.removeClass('fade top bottom left right in') // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do // this manually by checking the contents. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() } Popover.prototype.hasContent = function () { return this.getTitle() || this.getContent() } Popover.prototype.getContent = function () { var $e = this.$element var o = this.options return $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) } Popover.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.arrow')) } // POPOVER PLUGIN DEFINITION // ========================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.popover') var options = typeof option == 'object' && option if (!data && /destroy|hide/.test(option)) return if (!data) $this.data('bs.popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.popover $.fn.popover = Plugin $.fn.popover.Constructor = Popover // POPOVER NO CONFLICT // =================== $.fn.popover.noConflict = function () { $.fn.popover = old return this } }(jQuery); /* ======================================================================== * Bootstrap: tab.js v3.3.5 * http://getbootstrap.com/javascript/#tabs * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // TAB CLASS DEFINITION // ==================== var Tab = function (element) { // jscs:disable requireDollarBeforejQueryAssignment this.element = $(element) // jscs:enable requireDollarBeforejQueryAssignment } Tab.VERSION = '3.3.5' Tab.TRANSITION_DURATION = 150 Tab.prototype.show = function () { var $this = this.element var $ul = $this.closest('ul:not(.dropdown-menu)') var selector = $this.data('target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } if ($this.parent('li').hasClass('active')) return var $previous = $ul.find('.active:last a') var hideEvent = $.Event('hide.bs.tab', { relatedTarget: $this[0] }) var showEvent = $.Event('show.bs.tab', { relatedTarget: $previous[0] }) $previous.trigger(hideEvent) $this.trigger(showEvent) if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return var $target = $(selector) this.activate($this.closest('li'), $ul) this.activate($target, $target.parent(), function () { $previous.trigger({ type: 'hidden.bs.tab', relatedTarget: $this[0] }) $this.trigger({ type: 'shown.bs.tab', relatedTarget: $previous[0] }) }) } Tab.prototype.activate = function (element, container, callback) { var $active = container.find('> .active') var transition = callback && $.support.transition && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) function next() { $active .removeClass('active') .find('> .dropdown-menu > .active') .removeClass('active') .end() .find('[data-toggle="tab"]') .attr('aria-expanded', false) element .addClass('active') .find('[data-toggle="tab"]') .attr('aria-expanded', true) if (transition) { element[0].offsetWidth // reflow for transition element.addClass('in') } else { element.removeClass('fade') } if (element.parent('.dropdown-menu').length) { element .closest('li.dropdown') .addClass('active') .end() .find('[data-toggle="tab"]') .attr('aria-expanded', true) } callback && callback() } $active.length && transition ? $active .one('bsTransitionEnd', next) .emulateTransitionEnd(Tab.TRANSITION_DURATION) : next() $active.removeClass('in') } // TAB PLUGIN DEFINITION // ===================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tab') if (!data) $this.data('bs.tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } var old = $.fn.tab $.fn.tab = Plugin $.fn.tab.Constructor = Tab // TAB NO CONFLICT // =============== $.fn.tab.noConflict = function () { $.fn.tab = old return this } // TAB DATA-API // ============ var clickHandler = function (e) { e.preventDefault() Plugin.call($(this), 'show') } $(document) .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) }(jQuery); /* ======================================================================== * Bootstrap: affix.js v3.3.5 * http://getbootstrap.com/javascript/#affix * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // AFFIX CLASS DEFINITION // ====================== var Affix = function (element, options) { this.options = $.extend({}, Affix.DEFAULTS, options) this.$target = $(this.options.target) .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) this.$element = $(element) this.affixed = null this.unpin = null this.pinnedOffset = null this.checkPosition() } Affix.VERSION = '3.3.5' Affix.RESET = 'affix affix-top affix-bottom' Affix.DEFAULTS = { offset: 0, target: window } Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { var scrollTop = this.$target.scrollTop() var position = this.$element.offset() var targetHeight = this.$target.height() if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false if (this.affixed == 'bottom') { if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' } var initializing = this.affixed == null var colliderTop = initializing ? scrollTop : position.top var colliderHeight = initializing ? targetHeight : height if (offsetTop != null && scrollTop <= offsetTop) return 'top' if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' return false } Affix.prototype.getPinnedOffset = function () { if (this.pinnedOffset) return this.pinnedOffset this.$element.removeClass(Affix.RESET).addClass('affix') var scrollTop = this.$target.scrollTop() var position = this.$element.offset() return (this.pinnedOffset = position.top - scrollTop) } Affix.prototype.checkPositionWithEventLoop = function () { setTimeout($.proxy(this.checkPosition, this), 1) } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var height = this.$element.height() var offset = this.options.offset var offsetTop = offset.top var offsetBottom = offset.bottom var scrollHeight = Math.max($(document).height(), $(document.body).height()) if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) if (this.affixed != affix) { if (this.unpin != null) this.$element.css('top', '') var affixType = 'affix' + (affix ? '-' + affix : '') var e = $.Event(affixType + '.bs.affix') this.$element.trigger(e) if (e.isDefaultPrevented()) return this.affixed = affix this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null this.$element .removeClass(Affix.RESET) .addClass(affixType) .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') } if (affix == 'bottom') { this.$element.offset({ top: scrollHeight - height - offsetBottom }) } } // AFFIX PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.affix') var options = typeof option == 'object' && option if (!data) $this.data('bs.affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.affix $.fn.affix = Plugin $.fn.affix.Constructor = Affix // AFFIX NO CONFLICT // ================= $.fn.affix.noConflict = function () { $.fn.affix = old return this } // AFFIX DATA-API // ============== $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) var data = $spy.data() data.offset = data.offset || {} if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom if (data.offsetTop != null) data.offset.top = data.offsetTop Plugin.call($spy, data) }) }) }(jQuery); /* ======================================================================== * Bootstrap: collapse.js v3.3.5 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, Collapse.DEFAULTS, options) this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + '[data-toggle="collapse"][data-target="#' + element.id + '"]') this.transitioning = null if (this.options.parent) { this.$parent = this.getParent() } else { this.addAriaAndCollapsedClass(this.$element, this.$trigger) } if (this.options.toggle) this.toggle() } Collapse.VERSION = '3.3.5' Collapse.TRANSITION_DURATION = 350 Collapse.DEFAULTS = { toggle: true } Collapse.prototype.dimension = function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } Collapse.prototype.show = function () { if (this.transitioning || this.$element.hasClass('in')) return var activesData var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') if (actives && actives.length) { activesData = actives.data('bs.collapse') if (activesData && activesData.transitioning) return } var startEvent = $.Event('show.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return if (actives && actives.length) { Plugin.call(actives, 'hide') activesData || actives.data('bs.collapse', null) } var dimension = this.dimension() this.$element .removeClass('collapse') .addClass('collapsing')[dimension](0) .attr('aria-expanded', true) this.$trigger .removeClass('collapsed') .attr('aria-expanded', true) this.transitioning = 1 var complete = function () { this.$element .removeClass('collapsing') .addClass('collapse in')[dimension]('') this.transitioning = 0 this.$element .trigger('shown.bs.collapse') } if (!$.support.transition) return complete.call(this) var scrollSize = $.camelCase(['scroll', dimension].join('-')) this.$element .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) } Collapse.prototype.hide = function () { if (this.transitioning || !this.$element.hasClass('in')) return var startEvent = $.Event('hide.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return var dimension = this.dimension() this.$element[dimension](this.$element[dimension]())[0].offsetHeight this.$element .addClass('collapsing') .removeClass('collapse in') .attr('aria-expanded', false) this.$trigger .addClass('collapsed') .attr('aria-expanded', false) this.transitioning = 1 var complete = function () { this.transitioning = 0 this.$element .removeClass('collapsing') .addClass('collapse') .trigger('hidden.bs.collapse') } if (!$.support.transition) return complete.call(this) this.$element [dimension](0) .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION) } Collapse.prototype.toggle = function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } Collapse.prototype.getParent = function () { return $(this.options.parent) .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') .each($.proxy(function (i, element) { var $element = $(element) this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) }, this)) .end() } Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { var isOpen = $element.hasClass('in') $element.attr('aria-expanded', isOpen) $trigger .toggleClass('collapsed', !isOpen) .attr('aria-expanded', isOpen) } function getTargetFromTrigger($trigger) { var href var target = $trigger.attr('data-target') || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 return $(target) } // COLLAPSE PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.collapse $.fn.collapse = Plugin $.fn.collapse.Constructor = Collapse // COLLAPSE NO CONFLICT // ==================== $.fn.collapse.noConflict = function () { $.fn.collapse = old return this } // COLLAPSE DATA-API // ================= $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { var $this = $(this) if (!$this.attr('data-target')) e.preventDefault() var $target = getTargetFromTrigger($this) var data = $target.data('bs.collapse') var option = data ? 'toggle' : $this.data() Plugin.call($target, option) }) }(jQuery); /* ======================================================================== * Bootstrap: scrollspy.js v3.3.5 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // SCROLLSPY CLASS DEFINITION // ========================== function ScrollSpy(element, options) { this.$body = $(document.body) this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) this.options = $.extend({}, ScrollSpy.DEFAULTS, options) this.selector = (this.options.target || '') + ' .nav li > a' this.offsets = [] this.targets = [] this.activeTarget = null this.scrollHeight = 0 this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) this.refresh() this.process() } ScrollSpy.VERSION = '3.3.5' ScrollSpy.DEFAULTS = { offset: 10 } ScrollSpy.prototype.getScrollHeight = function () { return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) } ScrollSpy.prototype.refresh = function () { var that = this var offsetMethod = 'offset' var offsetBase = 0 this.offsets = [] this.targets = [] this.scrollHeight = this.getScrollHeight() if (!$.isWindow(this.$scrollElement[0])) { offsetMethod = 'position' offsetBase = this.$scrollElement.scrollTop() } this.$body .find(this.selector) .map(function () { var $el = $(this) var href = $el.data('target') || $el.attr('href') var $href = /^#./.test(href) && $(href) return ($href && $href.length && $href.is(':visible') && [[$href[offsetMethod]().top + offsetBase, href]]) || null }) .sort(function (a, b) { return a[0] - b[0] }) .each(function () { that.offsets.push(this[0]) that.targets.push(this[1]) }) } ScrollSpy.prototype.process = function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset var scrollHeight = this.getScrollHeight() var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() var offsets = this.offsets var targets = this.targets var activeTarget = this.activeTarget var i if (this.scrollHeight != scrollHeight) { this.refresh() } if (scrollTop >= maxScroll) { return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) } if (activeTarget && scrollTop < offsets[0]) { this.activeTarget = null return this.clear() } for (i = offsets.length; i--;) { activeTarget != targets[i] && scrollTop >= offsets[i] && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) && this.activate(targets[i]) } } ScrollSpy.prototype.activate = function (target) { this.activeTarget = target this.clear() var selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]' var active = $(selector) .parents('li') .addClass('active') if (active.parent('.dropdown-menu').length) { active = active .closest('li.dropdown') .addClass('active') } active.trigger('activate.bs.scrollspy') } ScrollSpy.prototype.clear = function () { $(this.selector) .parentsUntil(this.options.target, '.active') .removeClass('active') } // SCROLLSPY PLUGIN DEFINITION // =========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.scrollspy') var options = typeof option == 'object' && option if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.scrollspy $.fn.scrollspy = Plugin $.fn.scrollspy.Constructor = ScrollSpy // SCROLLSPY NO CONFLICT // ===================== $.fn.scrollspy.noConflict = function () { $.fn.scrollspy = old return this } // SCROLLSPY DATA-API // ================== $(window).on('load.bs.scrollspy.data-api', function () { $('[data-spy="scroll"]').each(function () { var $spy = $(this) Plugin.call($spy, $spy.data()) }) }) }(jQuery); /* ======================================================================== * Bootstrap: transition.js v3.3.5 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // ============================================================ function transitionEnd() { var el = document.createElement('bootstrap') var transEndEventNames = { WebkitTransition : 'webkitTransitionEnd', MozTransition : 'transitionend', OTransition : 'oTransitionEnd otransitionend', transition : 'transitionend' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { end: transEndEventNames[name] } } } return false // explicit for ie8 ( ._.) } // http://blog.alexmaccaw.com/css-transitions $.fn.emulateTransitionEnd = function (duration) { var called = false var $el = this $(this).one('bsTransitionEnd', function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this } $(function () { $.support.transition = transitionEnd() if (!$.support.transition) return $.event.special.bsTransitionEnd = { bindType: $.support.transition.end, delegateType: $.support.transition.end, handle: function (e) { if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) } } }) }(jQuery); // source --> https://www.hochzeitsfotografie-ronge.de/wp-content/plugins/booking/js/datepick/jquery.datepick.js?ver=1.1 /* http://keith-wood.name/datepick.html Datepicker for jQuery 3.7.1. Written by Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood{at}iinet.com.au). Dual licensed under the GPL (http://dev.jQuery.com/browser/trunk/jQuery/GPL-LICENSE.txt) and MIT (http://dev.jQuery.com/browser/trunk/jQuery/MIT-LICENSE.txt) licenses. Please attribute the authors if you use it. */ (function($) { // Hide the namespace var PROP_NAME = 'datepick'; /* Date picker manager. Use the singleton instance of this class, $.datepick, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, allowing multiple different settings on the same page. */ function Datepick() { this._uuid = new Date().getTime(); // Unique identifier seed this._curInst = null; // The current instance in use this._keyEvent = false; // If the last event was a key event this._disabledInputs = []; // List of date picker inputs that have been disabled this._datepickerShowing = false; // True if the popup picker is showing , false if not this._inDialog = false; // True if showing within a "dialog", false if not this.regional = []; // Available regional settings, indexed by language code this.regional[''] = { // Default regional settings clearText: 'Clear', // Display text for clear link clearStatus: 'Erase the current date', // Status text for clear link closeText: 'Close', // Display text for close link closeStatus: 'Close without change', // Status text for close link prevText: '<Prev', // Display text for previous month link prevStatus: 'Show the previous month', // Status text for previous month link prevBigText: '<<', // Display text for previous year link prevBigStatus: 'Show the previous year', // Status text for previous year link nextText: 'Next>', // Display text for next month link nextStatus: 'Show the next month', // Status text for next month link nextBigText: '>>', // Display text for next year link nextBigStatus: 'Show the next year', // Status text for next year link currentText: 'Today', // Display text for current month link currentStatus: 'Show the current month', // Status text for current month link monthNames: ['January','February','March','April','May','June', 'July','August','September','October','November','December'], // Names of months for drop-down and formatting monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting monthStatus: 'Show a different month', // Status text for selecting a month yearStatus: 'Show a different year', // Status text for selecting a year weekHeader: 'Wk', // Header for the week of the year column weekStatus: 'Week of the year', // Status text for the week of the year column dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday dayStatus: 'Set DD as first week day', // Status text for the day of the week selection dateStatus: 'Select DD, M d', // Status text for the date selection dateFormat: 'mm/dd/yy', // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... initStatus: 'Select a date', // Initial Status text on opening isRTL: false, // True if right-to-left language, false if left-to-right showMonthAfterYear: false, // True if the year select precedes month, false for month then year yearSuffix: '' // Additional text to append to the year in the month headers }; this._defaults = { // Global defaults for all the date picker instances useThemeRoller: false, // True to apply ThemeRoller styling, false for default styling showOn: 'focus', // 'focus' for popup on focus, // 'button' for trigger button, or 'both' for either showAnim: 'show', // Name of jQuery animation for popup showOptions: {}, // Options for enhanced animations duration: 'normal', // Duration of display/closure buttonText: '...', // Text for trigger button buttonImage: '', // URL for trigger button image buttonImageOnly: false, // True if the image appears alone, false if it appears on a button alignment: 'bottom', // Alignment of popup - with nominated corner of input: // 'top' or 'bottom' aligns depending on language direction, // 'topLeft', 'topRight', 'bottomLeft', 'bottomRight' autoSize: false, // True to size the input for the date format, false to leave as is defaultDate: null, // Used when field is blank: actual date, // +/-number for offset from today, null for today showDefault: false, // True to populate field with the default date appendText: '', // Display text following the input box, e.g. showing the format closeAtTop: true, // True to have the clear/close at the top, // false to have them at the bottom mandatory: false, // True to hide the Clear link, false to include it hideIfNoPrevNext: false, // True to hide next/previous month links // if not applicable, false to just disable them navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links showBigPrevNext: false, // True to show big prev/next links stepMonths: 1, // Number of months to step back/forward stepBigMonths: 12, // Number of months to step back/forward for the big links gotoCurrent: false, // True if today link goes back to current selection instead changeMonth: true, // True if month can be selected directly, false if only prev/next changeYear: true, // True if year can be selected directly, false if only prev/next yearRange: '-10:+10', // Range of years to display in drop-down, // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn) changeFirstDay: false, // True to click on day name to change, false to remain as set showOtherMonths: false, // True to show dates in other months, false to leave blank selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable highlightWeek: false, // True to highlight the selected week showWeeks: false, // True to show week of the year, false to omit calculateWeek: this.iso8601Week, // How to calculate the week of the year, // takes a Date and returns the number of the week for it shortYearCutoff: '+10', // Short year values < this are in the current century, // > this are in the previous century, string value starting with '+' // for current year + value, -1 for no change showStatus: false, // True to show status bar at bottom, false to not show it statusForDate: this.dateStatus, // Function to provide status text for a date - // takes date and instance as parameters, returns display text minDate: null, // The earliest selectable date, or null for no limit maxDate: null, // The latest selectable date, or null for no limit numberOfMonths: 1, // Number of months to show at a time showCurrentAtPos: 0, // The position in multiple months at which to show the current month (starting at 0) rangeSelect: false, // Allows for selecting a date range on one date picker rangeSeparator: ' - ', // Text between two dates in a range multiSelect: 0, // Maximum number of selectable dates multiSeparator: ',', // Text between multiple dates beforeShow: null, // Function that takes an input field and // returns a set of custom settings for the date picker beforeShowDay: null, // Function that takes a date and returns an array with // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', // [2] = cell title (optional), e.g. $.datepick.noWeekends onChangeMonthYear: null, // Define a callback function when the month or year is changed onHover: null, // Define a callback function when hovering over a day onSelect: null, // Define a callback function when a date is selected onClose: null, // Define a callback function when the datepicker is closed altField: '', // Selector for an alternate field to store selected dates into altFormat: '', // The date format to use for the alternate field constrainInput: true // The input is constrained by the current date format }; $.extend(this._defaults, this.regional['']); this.dpDiv = $('
'); } $.extend(Datepick.prototype, { version: '3.7.0', // Current version /* Class name added to elements to indicate already configured with a date picker. */ markerClassName: 'hasDatepick', // Responsive Skin // Class/id names for default and ThemeRoller stylings _mainDivId: ['datepick-div', 'ui-datepicker-div'], // The main datepicker division _mainDivClass: ['', 'ui-datepicker ' + 'ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'], // Popup class _inlineClass: ['datepick-inline', 'ui-datepicker-inline ui-datepicker ' + 'ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'], // Inline class _multiClass: ['datepick-multi', 'ui-datepicker-multi'], // Multi-month class _rtlClass: ['datepick-rtl', 'ui-datepicker-rtl'], // Right-to-left class _appendClass: ['datepick-append', 'ui-datepicker-append'], // Append text class _triggerClass: ['datepick-trigger', 'ui-datepicker-trigger'], // Trigger class _dialogClass: ['datepick-dialog', 'ui-datepicker-dialog'], // Dialog class _promptClass: ['datepick-prompt', 'ui-datepicker-prompt'], // Dialog prompt class _disableClass: ['datepick-disabled', 'ui-datepicker-disabled'], // Disabled covering class _controlClass: ['datepick-control', 'ui-datepicker-header ' + 'ui-widget-header ui-helper-clearfix ui-corner-all'], // Control bar class _clearClass: ['datepick-clear', 'ui-datepicker-clear'], // Clear class _closeClass: ['datepick-close', 'ui-datepicker-close'], // Close class _linksClass: ['datepick-links', 'ui-datepicker-header ' + 'ui-widget-header ui-helper-clearfix ui-corner-all'], // Links bar class _prevClass: ['datepick-prev', 'ui-datepicker-prev'], // Previous class _nextClass: ['datepick-next', 'ui-datepicker-next'], // Next class _currentClass: ['datepick-current', 'ui-datepicker-current'], // Current class _oneMonthClass: ['datepick-one-month', 'ui-datepicker-group'], // Single month class _newRowClass: ['datepick-new-row', 'ui-datepicker-row-break'], // New month row class _monthYearClass: ['datepick-header', 'ui-datepicker-header ' + 'ui-widget-header ui-helper-clearfix ui-corner-all'], // Month/year header class _monthSelectClass: ['datepick-new-month', 'ui-datepicker-month'], // Month select class _monthClass: ['', 'ui-datepicker-month'], // Month text class _yearSelectClass: ['datepick-new-year', 'ui-datepicker-year'], // Year select class _yearClass: ['', 'ui-datepicker-year'], // Year text class _tableClass: ['datepick', 'ui-datepicker-calendar'], // Month table class _tableHeaderClass: ['datepick-title-row', ''], // Week header class _weekColClass: ['datepick-week-col', 'ui-datepicker-week-col'], // Week number column class _weekRowClass: ['datepick-days-row', ''], // Week row class _weekendClass: ['datepick-week-end-cell', 'ui-datepicker-week-end'], // Weekend class _dayClass: ['datepick-days-cell', ''], // Single day class _otherMonthClass: ['datepick-other-month', 'ui-datepicker-other-month'], // Other month class _todayClass: ['datepick-today', 'ui-state-highlight'], // Today class _selectableClass: ['', 'ui-state-default'], // Selectable cell class _unselectableClass: ['datepick-unselectable', 'ui-datepicker-unselectable ui-state-disabled'], // Unselectable cell class _selectedClass: ['datepick-current-day', 'ui-state-active'], // Selected day class _dayOverClass: ['datepick-days-cell-over', 'ui-state-hover'], // Day hover class _weekOverClass: ['datepick-week-over', 'ui-state-hover'], // Week hover class _statusClass: ['datepick-status', 'ui-datepicker-status'], // Status bar class _statusId: ['datepick-status-', 'ui-datepicker-status-'], // Status bar ID prefix _coverClass: ['datepick-cover', 'ui-datepicker-cover'], // IE6- iframe class /* Override the default settings for all instances of the date picker. @param settings (object) the new settings to use as defaults (anonymous object) @return (Datepick) the manager object */ setDefaults: function(settings) { extendRemove(this._defaults, settings || {}); return this; }, /* Attach the date picker to a jQuery selection. @param target (element) the target input field or division or span @param settings (object) the new settings to use for this date picker instance */ _attachDatepick: function(target, settings) { if (!target.id) target.id = 'dp' + (++this._uuid); var nodeName = target.nodeName.toLowerCase(); var inst = this._newInst($(target), (nodeName == 'div' || nodeName == 'span')); // Check for settings on the control itself var inlineSettings = ($.fn.metadata ? $(target).metadata() : {}); inst.settings = $.extend({}, settings || {}, inlineSettings || {}); if (inst.inline) { inst.dpDiv.addClass(this._inlineClass[ this._get(inst, 'useThemeRoller') ? 1 : 0]); this._inlineDatepick(target, inst); } else this._connectDatepick(target, inst); }, /* Create a new instance object. @param target (jQuery) the target input field or division or span @param inline (boolean) true if this datepicker appears inline */ _newInst: function(target, inline) { var id = target[0].id.replace(/([:\[\]\.\$])/g, '\\\\$1'); // Escape jQuery meta chars return {id: id, input: target, // Associated target cursorDate: this._daylightSavingAdjust(new Date()), // Current position drawMonth: 0, drawYear: 0, // Month being drawn dates: [], // Selected dates inline: inline, // Is datepicker inline or not dpDiv: (!inline ? this.dpDiv : $('
')), // presentation div siblings: $([])}; // Created siblings (trigger/append) }, /* Attach the date picker to an input field. @param target (element) the target input field or division or span @param inst (object) the instance settings for this datepicker */ _connectDatepick: function(target, inst) { var input = $(target); if (input.hasClass(this.markerClassName)) return; var appendText = this._get(inst, 'appendText'); var isRTL = this._get(inst, 'isRTL'); var useTR = this._get(inst, 'useThemeRoller') ? 1 : 0; if (appendText) { var append = $('' + appendText + ''); input[isRTL ? 'before' : 'after'](append); inst.siblings = inst.siblings.add(append); } var showOn = this._get(inst, 'showOn'); if (showOn == 'focus' || showOn == 'both') // Pop-up date picker when in the marked field input.focus(this._showDatepick); if (showOn == 'button' || showOn == 'both') { // Pop-up date picker when button clicked var buttonText = this._get(inst, 'buttonText'); var buttonImage = this._get(inst, 'buttonImage'); var trigger = $(this._get(inst, 'buttonImageOnly') ? $('').addClass(this._triggerClass[useTR]). attr({src: buttonImage, alt: buttonText, title: buttonText}) : $('').addClass(this._triggerClass[useTR]). html(buttonImage == '' ? buttonText : $('').attr( {src: buttonImage, alt: buttonText, title: buttonText}))); input[isRTL ? 'before' : 'after'](trigger); inst.siblings = inst.siblings.add(trigger); trigger.click(function() { if ($.datepick._datepickerShowing && $.datepick._lastInput == target) $.datepick._hideDatepick(); else $.datepick._showDatepick(target); return false; }); } input.addClass(this.markerClassName).keydown(this._doKeyDown). keypress(this._doKeyPress).keyup(this._doKeyUp); if (this._get(inst, 'showDefault') && !inst.input.val()) { inst.dates = [this._getDefaultDate(inst)]; this._showDate(inst); } this._autoSize(inst); $.data(target, PROP_NAME, inst); }, /* Apply the maximum length for the date format. @param inst (object) the instance settings for this datepicker */ _autoSize: function(inst) { if (this._get(inst, 'autoSize') && !inst.inline) { var date = new Date(2009, 12 - 1, 20); // Ensure double digits var dateFormat = this._get(inst, 'dateFormat'); if (dateFormat.match(/[DM]/)) { var findMax = function(names) { var max = 0; var maxI = 0; for (var i = 0; i < names.length; i++) { if (names[i].length > max) { max = names[i].length; maxI = i; } } return maxI; }; date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 'monthNames' : 'monthNamesShort')))); date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); } inst.input.attr('size', this._formatDate(inst, date).length); } }, /* Attach an inline date picker to a div. @param target (element) the target input field or division or span @param inst (object) the instance settings for this datepicker */ _inlineDatepick: function(target, inst) { var divSpan = $(target); if (divSpan.hasClass(this.markerClassName)) return; divSpan.addClass(this.markerClassName); $.data(target, PROP_NAME, inst); inst.drawMonth = inst.cursorDate.getMonth(); inst.drawYear = inst.cursorDate.getFullYear(); $('body').append(inst.dpDiv); this._updateDatepick(inst); // Fix width for dynamic number of date pickers inst.dpDiv.width(this._getNumberOfMonths(inst)[1] * $('.' + this._oneMonthClass[this._get(inst, 'useThemeRoller') ? 1 : 0], inst.dpDiv)[0].offsetWidth); divSpan.append(inst.dpDiv); this._updateAlternate(inst); }, /* Pop-up the date picker in a "dialog" box. @param input (element) ignored @param date (string or Date) the initial date to display @param onSelect (function) the function to call when a date is selected @param settings (object) update the dialog date picker instance's settings @param pos (int[2]) coordinates for the dialog's position within the screen or (event) with x/y coordinates or leave empty for default (screen centre) */ _dialogDatepick: function(input, date, onSelect, settings, pos) { var inst = this._dialogInst; // Internal instance if (!inst) { var id = 'dp' + (++this._uuid); this._dialogInput = $(''); this._dialogInput.keydown(this._doKeyDown); $('body').append(this._dialogInput); inst = this._dialogInst = this._newInst(this._dialogInput, false); inst.settings = {}; $.data(this._dialogInput[0], PROP_NAME, inst); } extendRemove(inst.settings, settings || {}); date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); this._dialogInput.val(date); this._pos = (pos ? (isArray(pos) ? pos : [pos.pageX, pos.pageY]) : null); if (!this._pos) { var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; this._pos = // Should use actual width/height below [(document.documentElement.clientWidth / 2) - 100 + scrollX, (document.documentElement.clientHeight / 2) - 150 + scrollY]; } // Move input on screen for focus, but hidden behind dialog this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); inst.settings.onSelect = onSelect; this._inDialog = true; this.dpDiv.addClass(this._dialogClass[this._get(inst, 'useThemeRoller') ? 1 : 0]); this._showDatepick(this._dialogInput[0]); if ($.blockUI) $.blockUI(this.dpDiv); $.data(this._dialogInput[0], PROP_NAME, inst); }, /* Detach a datepicker from its control. @param target (element) the target input field or division or span */ _destroyDatepick: function(target) { var $target = $(target); if (!$target.hasClass(this.markerClassName)) { return; } var inst = $.data(target, PROP_NAME); $.removeData(target, PROP_NAME); if (inst.inline) $target.removeClass(this.markerClassName).empty(); else { $(inst.siblings).remove(); $target.removeClass(this.markerClassName). unbind('focus', this._showDatepick).unbind('keydown', this._doKeyDown). unbind('keypress', this._doKeyPress).unbind('keyup', this._doKeyUp); } }, /* Enable the date picker to a jQuery selection. @param target (element) the target input field or division or span */ _enableDatepick: function(target) { var $target = $(target); if (!$target.hasClass(this.markerClassName)) return; var inst = $.data(target, PROP_NAME); var useTR = this._get(inst, 'useThemeRoller') ? 1 : 0; if (inst.inline) $target.children('.' + this._disableClass[useTR]).remove().end(). find('select').attr('disabled', ''); else { target.disabled = false; inst.siblings.filter('button.' + this._triggerClass[useTR]). each(function() { this.disabled = false; }).end(). filter('img.' + this._triggerClass[useTR]). css({opacity: '1.0', cursor: ''}); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); // Delete entry }, /* Disable the date picker to a jQuery selection. @param target (element) the target input field or division or span */ _disableDatepick: function(target) { var $target = $(target); if (!$target.hasClass(this.markerClassName)) return; var inst = $.data(target, PROP_NAME); var useTR = this._get(inst, 'useThemeRoller') ? 1 : 0; if (inst.inline) { var inline = $target.children('.' + this._inlineClass[useTR]); var offset = inline.offset(); var relOffset = {left: 0, top: 0}; inline.parents().each(function() { if ($(this).css('position') == 'relative') { relOffset = $(this).offset(); return false; } }); $target.prepend('
'). find('select').attr('disabled', 'disabled'); } else { target.disabled = true; inst.siblings.filter('button.' + this._triggerClass[useTR]). each(function() { this.disabled = true; }).end(). filter('img.' + this._triggerClass[useTR]). css({opacity: '0.5', cursor: 'default'}); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); // Delete entry this._disabledInputs.push(target); }, /* Is the first field in a jQuery collection disabled as a datepicker? @param target (element) the target input field or division or span @return (boolean) true if disabled, false if enabled */ _isDisabledDatepick: function(target) { return (!target ? false : $.inArray(target, this._disabledInputs) > -1); }, /* Retrieve the instance data for the target control. @param target (element) the target input field or division or span @return (object) the associated instance data @throws error if a jQuery problem getting data */ _getInst: function(target) {//alert(target.id); try { return $.data(target, PROP_NAME); } catch (err) { throw 'Missing instance data for this datepicker'; } }, /* Update or retrieve the settings for a date picker attached to an input field or division. @param target (element) the target input field or division or span @param name (object) the new settings to update or (string) the name of the setting to change or retrieve, when retrieving also 'all' for all instance settings or 'defaults' for all global defaults @param value (any) the new value for the setting (omit if above is an object or to retrieve value) */ _optionDatepick: function(target, name, value) { var inst = this._getInst(target); if (arguments.length == 2 && typeof name == 'string') { return (name == 'defaults' ? $.extend({}, $.datepick._defaults) : (inst ? (name == 'all' ? $.extend({}, inst.settings) : this._get(inst, name)) : null)); } var settings = name || {}; if (typeof name == 'string') { settings = {}; settings[name] = value; } if (inst) { if (this._curInst == inst) { this._hideDatepick(null); } var dates = this._getDateDatepick(target); extendRemove(inst.settings, settings); this._autoSize(inst); extendRemove(inst, {dates: []}); var blank = (!dates || isArray(dates)); if (isArray(dates)) for (var i = 0; i < dates.length; i++) if (dates[i]) { blank = false; break; } if (!blank) this._setDateDatepick(target, dates); if (inst.inline) $(target).children('div').removeClass(this._inlineClass.join(' ')). addClass(this._inlineClass[this._get(inst, 'useThemeRoller') ? 1 : 0]); this._updateDatepick(inst); } }, // Change method deprecated _changeDatepick: function(target, name, value) { this._optionDatepick(target, name, value); }, /* Redraw the date picker attached to an input field or division. @param target (element) the target input field or division or span */ _refreshDatepick: function(target) { var inst = this._getInst(target); if (inst) { this._updateDatepick(inst); } }, /* Set the dates for a jQuery selection. @param target (element) the target input field or division or span @param date (Date) the new date @param endDate (Date) the new end date for a range (optional) */ _setDateDatepick: function(target, date, endDate) { var inst = this._getInst(target); if (inst) { this._setDate(inst, date, endDate); this._updateDatepick(inst); this._updateAlternate(inst); } }, /* Get the date(s) for the first entry in a jQuery selection. @param target (element) the target input field or division or span @return (Date) the current date or (Date[2]) the current dates for a range */ _getDateDatepick: function(target) { var inst = this._getInst(target); if (inst && !inst.inline) this._setDateFromField(inst); return (inst ? this._getDate(inst) : null); }, /* Handle keystrokes. @param event (KeyEvent) the keystroke details @return (boolean) true to continue, false to discard */ _doKeyDown: function(event) { var inst = $.datepick._getInst(event.target); inst.keyEvent = true; var handled = true; var isRTL = $.datepick._get(inst, 'isRTL'); var useTR = $.datepick._get(inst, 'useThemeRoller') ? 1 : 0; if ($.datepick._datepickerShowing) switch (event.keyCode) { case 9: $.datepick._hideDatepick(null, ''); break; // Hide on tab out case 13: var sel = $('td.' + $.datepick._dayOverClass[useTR], inst.dpDiv); if (sel.length == 0) sel = $('td.' + $.datepick._selectedClass[useTR] + ':first', inst.dpDiv); if (sel[0]) $.datepick._selectDay(sel[0], event.target, inst.cursorDate.getTime()); else $.datepick._hideDatepick(null, $.datepick._get(inst, 'duration')); break; // Select the value on enter case 27: $.datepick._hideDatepick(null, $.datepick._get(inst, 'duration')); break; // Hide on escape case 33: $.datepick._adjustDate(event.target, (event.ctrlKey ? -$.datepick._get(inst, 'stepBigMonths') : -$.datepick._get(inst, 'stepMonths')), 'M'); break; // Previous month/year on page up/+ ctrl case 34: $.datepick._adjustDate(event.target, (event.ctrlKey ? +$.datepick._get(inst, 'stepBigMonths') : +$.datepick._get(inst, 'stepMonths')), 'M'); break; // Next month/year on page down/+ ctrl case 35: if (event.ctrlKey || event.metaKey) $.datepick._clearDate(event.target); handled = event.ctrlKey || event.metaKey; break; // Clear on ctrl or command + end case 36: if (event.ctrlKey || event.metaKey) $.datepick._gotoToday(event.target); handled = event.ctrlKey || event.metaKey; break; // Current on ctrl or command + home case 37: if (event.ctrlKey || event.metaKey) $.datepick._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); handled = event.ctrlKey || event.metaKey; // -1 day on ctrl or command + left if (event.originalEvent.altKey) $.datepick._adjustDate(event.target, (event.ctrlKey ? -$.datepick._get(inst, 'stepBigMonths') : -$.datepick._get(inst, 'stepMonths')), 'M'); // Next month/year on alt + left/+ ctrl break; case 38: if (event.ctrlKey || event.metaKey) $.datepick._adjustDate(event.target, -7, 'D'); handled = event.ctrlKey || event.metaKey; break; // -1 week on ctrl or command + up case 39: if (event.ctrlKey || event.metaKey) $.datepick._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); handled = event.ctrlKey || event.metaKey; // +1 day on ctrl or command + right if (event.originalEvent.altKey) $.datepick._adjustDate(event.target, (event.ctrlKey ? +$.datepick._get(inst, 'stepBigMonths') : +$.datepick._get(inst, 'stepMonths')), 'M'); // Next month/year on alt + right/+ ctrl break; case 40: if (event.ctrlKey || event.metaKey) $.datepick._adjustDate(event.target, +7, 'D'); handled = event.ctrlKey || event.metaKey; break; // +1 week on ctrl or command + down default: handled = false; } else if (event.keyCode == 36 && event.ctrlKey) // Display the date picker on ctrl+home $.datepick._showDatepick(this); else handled = false; if (handled) { event.preventDefault(); event.stopPropagation(); } inst.ctrlKey = (event.keyCode < 48); return !handled; }, /* Filter entered characters - based on date format. @param event (KeyEvent) the keystroke details @return (boolean) true to continue, false to discard */ _doKeyPress: function(event) { var inst = $.datepick._getInst(event.target); if ($.datepick._get(inst, 'constrainInput')) { var chars = $.datepick._possibleChars(inst); var chr = String.fromCharCode(event.keyCode || event.charCode); return inst.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); } }, /* Synchronise manual entry and field/alternate field. @param event (KeyEvent) the keystroke details @return (boolean) true to continue */ _doKeyUp: function(event) { var inst = $.datepick._getInst(event.target); if (inst.input.val() != inst.lastVal) { try { var separator = ($.datepick._get(inst, 'rangeSelect') ? $.datepick._get(inst, 'rangeSeparator') : ($.datepick._get(inst, 'multiSelect') ? $.datepick._get(inst, 'multiSeparator') : '')); var dates = (inst.input ? inst.input.val() : ''); dates = (separator ? dates.split(separator) : [dates]); var ok = true; for (var i = 0; i < dates.length; i++) { if (!$.datepick.parseDate($.datepick._get(inst, 'dateFormat'), dates[i], $.datepick._getFormatConfig(inst))) { ok = false; break; } } if (ok) { // Only if valid $.datepick._setDateFromField(inst); $.datepick._updateAlternate(inst); $.datepick._updateDatepick(inst); } } catch (event) { // Ignore } } return true; }, /* Extract all possible characters from the date format. @param inst (object) the instance settings for this datepicker @return (string) the set of characters allowed by this format */ _possibleChars: function (inst) { var dateFormat = $.datepick._get(inst, 'dateFormat'); var chars = ($.datepick._get(inst, 'rangeSelect') ? $.datepick._get(inst, 'rangeSeparator') : ($.datepick._get(inst, 'multiSelect') ? $.datepick._get(inst, 'multiSeparator') : '')); var literal = false; for (var iFormat = 0; iFormat < dateFormat.length; iFormat++) if (literal) if (dateFormat.charAt(iFormat) == "'" && !lookAhead("'")) literal = false; else chars += dateFormat.charAt(iFormat); else switch (dateFormat.charAt(iFormat)) { case 'd': case 'm': case 'y': case '@': chars += '0123456789'; break; case 'D': case 'M': return null; // Accept anything case "'": if (lookAhead("'")) chars += "'"; else literal = true; break; default: chars += dateFormat.charAt(iFormat); } return chars; }, /* Update the datepicker when hovering over a date. @param td (element) the current cell @param id (string) the ID of the datepicker instance @param timestamp (number) the timestamp for this date */ _doMouseOver: function(td, id, timestamp) { var inst = $.datepick._getInst($('#' + id)[0]); var useTR = $.datepick._get(inst, 'useThemeRoller') ? 1 : 0; $(td).parents('tbody').find('td'). removeClass($.datepick._dayOverClass[useTR]).end().end(). addClass($.datepick._dayOverClass[useTR]); if ($.datepick._get(inst, 'highlightWeek')) $(td).parent().parent().find('tr'). removeClass($.datepick._weekOverClass[useTR]).end().end(). addClass($.datepick._weekOverClass[useTR]); if ($(td).text()) { var date = new Date(timestamp); if ($.datepick._get(inst, 'showStatus')) { var status = ($.datepick._get(inst, 'statusForDate').apply( (inst.input ? inst.input[0] : null), [date, inst]) || $.datepick._get(inst, 'initStatus')); $('#' + $.datepick._statusId[useTR] + id).html(status); } if ($.datepick._get(inst, 'onHover')) $.datepick._doHover(td, '#' + id, date.getFullYear(), date.getMonth()); } }, /* Update the datepicker when no longer hovering over a date. @param td (element) the current cell @param id (string) the ID of the datepicker instance */ _doMouseOut: function(td, id) { var inst = $.datepick._getInst($('#' + id)[0]); var useTR = $.datepick._get(inst, 'useThemeRoller') ? 1 : 0; $(td).removeClass($.datepick._dayOverClass[useTR]). removeClass($.datepick._weekOverClass[useTR]); if ($.datepick._get(inst, 'showStatus')) $('#' + $.datepick._statusId[useTR] + id).html($.datepick._get(inst, 'initStatus')); if ($.datepick._get(inst, 'onHover')) $.datepick._doHover(td, '#' + id); }, /* Hover over a particular day. @param td (element) the table cell containing the selection @param id (string) the ID of the target field @param year (number) the year for this day @param month (number) the month for this day */ _doHover: function(td, id, year, month) { var inst = this._getInst($(id)[0]); var useTR = $.datepick._get(inst, 'useThemeRoller') ? 1 : 0; //if ($(td).hasClass(this._unselectableClass[useTR])) // return; var onHover = this._get(inst, 'onHover'); var date = (year ? this._daylightSavingAdjust(new Date(year, month, $(td).find('a').text())) : null); onHover.apply((inst.input ? inst.input[0] : null), [(date ? this._formatDate(inst, date) : ''), date, inst]); }, /* Pop-up the date picker for a given input field. @param input (element) the input field attached to the date picker or (event) if triggered by focus */ _showDatepick: function(input) { input = input.target || input; if ($.datepick._isDisabledDatepick(input) || $.datepick._lastInput == input) // Already here return; var inst = $.datepick._getInst(input); var beforeShow = $.datepick._get(inst, 'beforeShow'); var useTR = $.datepick._get(inst, 'useThemeRoller') ? 1 : 0; extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); $.datepick._hideDatepick(null, ''); $.datepick._lastInput = input; $.datepick._setDateFromField(inst); if ($.datepick._inDialog) // Hide cursor input.value = ''; if (!$.datepick._pos) { // Position below input $.datepick._pos = $.datepick._findPos(input); $.datepick._pos[1] += input.offsetHeight; // Add the height } var isFixed = false; $(input).parents().each(function() { isFixed |= $(this).css('position') == 'fixed'; return !isFixed; }); if (isFixed && $.browser.opera) { // Correction for Opera when fixed and scrolled $.datepick._pos[0] -= document.documentElement.scrollLeft; $.datepick._pos[1] -= document.documentElement.scrollTop; } var offset = {left: $.datepick._pos[0], top: $.datepick._pos[1]}; $.datepick._pos = null; // Determine sizing offscreen inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); $.datepick._updateDatepick(inst); // Fix width for dynamic number of date pickers inst.dpDiv.width($.datepick._getNumberOfMonths(inst)[1] * $('.' + $.datepick._oneMonthClass[useTR], inst.dpDiv).width()); // And adjust position before showing offset = $.datepick._checkOffset(inst, offset, isFixed); inst.dpDiv.css({position: ($.datepick._inDialog && $.blockUI ? 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', left: offset.left + 'px', top: offset.top + 'px'}); if (!inst.inline) { var showAnim = $.datepick._get(inst, 'showAnim') || 'show'; var duration = $.datepick._get(inst, 'duration'); var postProcess = function() { $.datepick._datepickerShowing = true; var borders = $.datepick._getBorders(inst.dpDiv); inst.dpDiv.find('iframe.' + $.datepick._coverClass[useTR]). // IE6- only css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); }; if ($.effects && $.effects[showAnim]) inst.dpDiv.show(showAnim, $.datepick._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[showAnim](duration, postProcess); if (duration == '') postProcess(); if (inst.input[0].type != 'hidden') inst.input.focus(); $.datepick._curInst = inst; } }, /* Generate the date picker content. @param inst (object) the instance settings for this datepicker */ _updateDatepick: function(inst) { var borders = this._getBorders(inst.dpDiv); var useTR = this._get(inst, 'useThemeRoller') ? 1 : 0; inst.dpDiv.empty().append(this._generateHTML(inst)). find('iframe.' + this._coverClass[useTR]). // IE6- only css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); var numMonths = this._getNumberOfMonths(inst); if (!inst.inline) inst.dpDiv.attr('id', this._mainDivId[useTR]); if (!inst.inline) inst.dpDiv.attr('class', 'datepick-inline'); // Added by wpdevelop for the correct showing of calendar in the search form. inst.dpDiv.removeClass(this._mainDivClass[1 - useTR]). addClass(this._mainDivClass[useTR]). removeClass(this._multiClass.join(' ')). addClass(numMonths[0] != 1 || numMonths[1] != 1 ? this._multiClass[useTR] : ''). removeClass(this._rtlClass.join(' ')). addClass(this._get(inst, 'isRTL') ? this._rtlClass[useTR] : ''); if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepick._curInst) $(inst.input).focus(); }, /* Retrieve the size of left and top borders for an element. @param elem (jQuery object) the element of interest @return (number[2]) the left and top borders */ _getBorders: function(elem) { var convert = function(value) { var extra = ($.browser.msie ? 1 : 0); return {thin: 1 + extra, medium: 3 + extra, thick: 5 + extra}[value] || value; }; return [parseFloat(convert(elem.css('border-left-width'))), parseFloat(convert(elem.css('border-top-width')))]; }, /* Check positioning to remain on the screen. @param inst (object) the instance settings for this datepicker @param offset (object) the offset of the attached field @param isFixed (boolean) true if control or a parent is 'fixed' in position @return (object) the updated offset for the datepicker */ _checkOffset: function(inst, offset, isFixed) { var alignment = this._get(inst, 'alignment'); var isRTL = this._get(inst, 'isRTL'); var pos = inst.input ? this._findPos(inst.input[0]) : null; var browserWidth = document.documentElement.clientWidth; var browserHeight = document.documentElement.clientHeight; if (browserWidth == 0) return offset; var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; var above = pos[1] - (this._inDialog ? 0 : inst.dpDiv.outerHeight()) - (isFixed && $.browser.opera ? document.documentElement.scrollTop : 0); var below = offset.top; var alignL = offset.left; var alignR = pos[0] + (inst.input ? inst.input.outerWidth() : 0) - inst.dpDiv.outerWidth() - (isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0); var tooWide = (offset.left + inst.dpDiv.outerWidth() - scrollX) > browserWidth; var tooHigh = (offset.top + inst.dpDiv.outerHeight() - scrollY) > browserHeight; if (alignment == 'topLeft') { offset = {left: alignL, top: above}; } else if (alignment == 'topRight') { offset = {left: alignR, top: above}; } else if (alignment == 'bottomLeft') { offset = {left: alignL, top: below}; } else if (alignment == 'bottomRight') { offset = {left: alignR, top: below}; } else if (alignment == 'top') { offset = {left: (isRTL || tooWide ? alignR : alignL), top: above}; } else { // bottom offset = {left: (isRTL || tooWide ? alignR : alignL), top: (tooHigh ? above : below)}; } offset.left = Math.max((isFixed ? 0 : scrollX), offset.left - (isFixed ? scrollX : 0)); offset.top = Math.max((isFixed ? 0 : scrollY), offset.top - (isFixed ? scrollY : 0)); return offset; }, /* Find an element's position on the screen. @param elem (element) the element to check @return (number[2]) the x- and y-coordinates for the object */ _findPos: function(elem) { while (elem && (elem.type == 'hidden' || elem.nodeType != 1)) { elem = elem.nextSibling; } var position = $(elem).offset(); return [position.left, position.top]; }, /* Hide the date picker from view. @param input (element) the input field attached to the date picker @param duration (string) the duration over which to close the date picker */ _hideDatepick: function(input, duration) { var inst = this._curInst; if (!inst || (input && inst != $.data(input, PROP_NAME))) return false; var rangeSelect = this._get(inst, 'rangeSelect'); if (rangeSelect && inst.stayOpen) this._updateInput('#' + inst.id); inst.stayOpen = false; if (this._datepickerShowing) { duration = (duration != null ? duration : this._get(inst, 'duration')); var showAnim = this._get(inst, 'showAnim'); var postProcess = function() { $.datepick._tidyDialog(inst); }; if (duration != '' && $.effects && $.effects[showAnim]) inst.dpDiv.hide(showAnim, $.datepick._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' : (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess); if (duration == '') this._tidyDialog(inst); var onClose = this._get(inst, 'onClose'); if (onClose) // Trigger custom callback onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ''), this._getDate(inst), inst]); this._datepickerShowing = false; this._lastInput = null; inst.settings.prompt = null; if (this._inDialog) { this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); this.dpDiv.removeClass(this._dialogClass[this._get(inst, 'useThemeRoller') ? 1 : 0]); if ($.blockUI) { $.unblockUI(); $('body').append(this.dpDiv); } } this._inDialog = false; } this._curInst = null; return false; }, /* Tidy up after a dialog display. @param inst (object) the instance settings for this datepicker */ _tidyDialog: function(inst) { var useTR = this._get(inst, 'useThemeRoller') ? 1 : 0; inst.dpDiv.removeClass(this._dialogClass[useTR]).unbind('.datepick'); $('.' + this._promptClass[useTR], inst.dpDiv).remove(); }, /* Close date picker if clicked elsewhere. @param event (MouseEvent) the mouse click to check */ _checkExternalClick: function(event) { if (!$.datepick._curInst) return; var $target = $(event.target); var useTR = $.datepick._get($.datepick._curInst, 'useThemeRoller') ? 1 : 0; if (!$target.parents().andSelf().is('#' + $.datepick._mainDivId[useTR]) && !$target.hasClass($.datepick.markerClassName) && !$target.parents().andSelf().hasClass($.datepick._triggerClass[useTR]) && $.datepick._datepickerShowing && !($.datepick._inDialog && $.blockUI)) $.datepick._hideDatepick(null, ''); }, /* Adjust one of the date sub-fields. @param id (string) the ID of the target field @param offset (number) the amount to change by @param period (string) 'D' for days, 'M' for months, 'Y' for years */ _adjustDate: function(id, offset, period) { var inst = this._getInst($(id)[0]); this._adjustInstDate(inst, offset + (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // Undo positioning period); this._updateDatepick(inst); return false; }, /* Show the month for today or the current selection. @param id (string) the ID of the target field */ _gotoToday: function(id) { var target = $(id); var inst = this._getInst(target[0]); if (this._get(inst, 'gotoCurrent') && inst.dates[0]) inst.cursorDate = new Date(inst.dates[0].getTime()); else inst.cursorDate = this._daylightSavingAdjust(new Date()); inst.drawMonth = inst.cursorDate.getMonth(); inst.drawYear = inst.cursorDate.getFullYear(); this._notifyChange(inst); this._adjustDate(target); return false; }, /* Selecting a new month/year. @param id (string) the ID of the target field @param select (element) the select being chosen from @param period (string) 'M' for month, 'Y' for year */ _selectMonthYear: function(id, select, period) { var target = $(id); var inst = this._getInst(target[0]); inst.selectingMonthYear = false; var value = parseInt(select.options[select.selectedIndex].value, 10); inst['selected' + (period == 'M' ? 'Month' : 'Year')] = inst['draw' + (period == 'M' ? 'Month' : 'Year')] = value; inst.cursorDate.setDate(Math.min(inst.cursorDate.getDate(), $.datepick._getDaysInMonth(inst.drawYear, inst.drawMonth))); inst.cursorDate['set' + (period == 'M' ? 'Month' : 'FullYear')](value); this._notifyChange(inst); this._adjustDate(target); }, /* Restore input focus after not changing month/year. @param id (string) the ID of the target field */ _clickMonthYear: function(id) { var inst = this._getInst($(id)[0]); if (inst.input && inst.selectingMonthYear && !$.browser.msie) inst.input.focus(); inst.selectingMonthYear = !inst.selectingMonthYear; }, /* Action for changing the first week day. @param id (string) the ID of the target field @param day (number) the number of the first day, 0 = Sun, 1 = Mon, ... */ _changeFirstDay: function(id, day) { var inst = this._getInst($(id)[0]); inst.settings.firstDay = day; this._updateDatepick(inst); return false; }, /* Select a particular day. @param td (element) the table cell containing the selection @param id (string) the ID of the target field @param timestamp (number) the timestamp for this day */ _selectDay: function(td, id, timestamp) { var inst = this._getInst($(id)[0]); var useTR = this._get(inst, 'useThemeRoller') ? 1 : 0; if ($(td).hasClass(this._unselectableClass[useTR])) return false; var rangeSelect = this._get(inst, 'rangeSelect'); var multiSelect = this._get(inst, 'multiSelect'); if (rangeSelect) inst.stayOpen = !inst.stayOpen; else if (multiSelect) inst.stayOpen = true; if (inst.stayOpen) { $('.datepick td', inst.dpDiv).removeClass(this._selectedClass[useTR]); $(td).addClass(this._selectedClass[useTR]); } inst.cursorDate = this._daylightSavingAdjust(new Date(timestamp)); var date = new Date(inst.cursorDate.getTime()); if (rangeSelect && !inst.stayOpen) inst.dates[1] = date; else if (multiSelect) { var pos = -1; for (var i = 0; i < inst.dates.length; i++) if (inst.dates[i] && date.getTime() == inst.dates[i].getTime()) { pos = i; break; } if (pos > -1) inst.dates.splice(pos, 1); else if (inst.dates.length < multiSelect) { if (inst.dates[0]) inst.dates.push(date); else inst.dates = [date]; inst.stayOpen = (inst.dates.length != multiSelect); } } else inst.dates = [date]; this._updateInput(id); if (inst.stayOpen) this._updateDatepick(inst); else if ((rangeSelect || multiSelect) && inst.inline) this._updateDatepick(inst); return false; }, /* Erase the input field and hide the date picker. @param id (string) the ID of the target field */ _clearDate: function(id) { var target = $(id); var inst = this._getInst(target[0]); if (this._get(inst, 'mandatory')) return false; inst.stayOpen = false; inst.dates = (this._get(inst, 'showDefault') ? [this._getDefaultDate(inst)] : []); this._updateInput(target); return false; }, /* Update the input field with the selected date. @param id (string) the ID of the target field or (element) the target object */ _updateInput: function(id) { var inst = this._getInst($(id)[0]); var dateStr = this._showDate(inst); this._updateAlternate(inst); var onSelect = this._get(inst, 'onSelect'); if (onSelect) onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, this._getDate(inst), inst]); // Trigger custom callback else if (inst.input) inst.input.trigger('change'); // Fire the change event if (inst.inline) this._updateDatepick(inst); else if (!inst.stayOpen) { this._hideDatepick(null, this._get(inst, 'duration')); this._lastInput = inst.input[0]; if (typeof(inst.input[0]) != 'object') inst.input.focus(); // Restore focus this._lastInput = null; } return false; }, /* Update the input field with the current date(s). @param inst (object) the instance settings for this datepicker @return (string) the formatted date(s) */ _showDate: function(inst) { var dateStr = ''; if (inst.input) { dateStr = (inst.dates.length == 0 ? '' : this._formatDate(inst, inst.dates[0])); if (dateStr) { if (this._get(inst, 'rangeSelect')) dateStr += this._get(inst, 'rangeSeparator') + this._formatDate(inst, inst.dates[1] || inst.dates[0]); else if (this._get(inst, 'multiSelect')) for (var i = 1; i < inst.dates.length; i++) dateStr += this._get(inst, 'multiSeparator') + this._formatDate(inst, inst.dates[i]); } inst.input.val(dateStr); } return dateStr; }, /* Update any alternate field to synchronise with the main field. @param inst (object) the instance settings for this datepicker */ _updateAlternate: function(inst) { var altField = this._get(inst, 'altField'); if (altField) { // Update alternate field too var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); var settings = this._getFormatConfig(inst); var dateStr = this.formatDate(altFormat, inst.dates[0], settings); if (dateStr && this._get(inst, 'rangeSelect')) dateStr += this._get(inst, 'rangeSeparator') + this.formatDate( altFormat, inst.dates[1] || inst.dates[0], settings); else if (this._get(inst, 'multiSelect')) for (var i = 1; i < inst.dates.length; i++) dateStr += this._get(inst, 'multiSeparator') + this.formatDate(altFormat, inst.dates[i], settings); $(altField).val(dateStr); } }, /* Set as beforeShowDay function to prevent selection of weekends. @param date (Date) the date to customise @return ([boolean, string]) is this date selectable?, what is its CSS class? */ noWeekends: function(date) { return [(date.getDay() || 7) < 6, '']; }, /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. @param date (Date) the date to get the week for @return (number) the number of the week within the year that contains this date */ iso8601Week: function(date) { var checkDate = new Date(date.getTime()); // Find Thursday of this week starting on Monday checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); var time = checkDate.getTime(); checkDate.setMonth(0); // Compare with Jan 1 checkDate.setDate(1); return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; }, /* Provide status text for a particular date. @param date (Date) the date to get the status for @param inst (object) the current datepicker instance @return (string) the status display text for this date */ dateStatus: function(date, inst) { return $.datepick.formatDate($.datepick._get(inst, 'dateStatus'), date, $.datepick._getFormatConfig(inst)); }, /* Parse a string value into a date object. See formatDate below for the possible formats. @param format (string) the expected format of the date @param value (string) the date in the above format @param settings (object) attributes include: shortYearCutoff (number) the cutoff year for determining the century (optional) dayNamesShort (string[7]) abbreviated names of the days from Sunday (optional) dayNames (string[7]) names of the days from Sunday (optional) monthNamesShort (string[12]) abbreviated names of the months (optional) monthNames (string[12]) names of the months (optional) @return (Date) the extracted date value or null if value is blank */ parseDate: function (format, value, settings) { if (format == null || value == null) throw 'Invalid arguments'; value = (typeof value == 'object' ? value.toString() : value + ''); if (value == '') return null; settings = settings || {}; var shortYearCutoff = settings.shortYearCutoff || this._defaults.shortYearCutoff; shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); var dayNamesShort = settings.dayNamesShort || this._defaults.dayNamesShort; var dayNames = settings.dayNames || this._defaults.dayNames; var monthNamesShort = settings.monthNamesShort || this._defaults.monthNamesShort; var monthNames = settings.monthNames || this._defaults.monthNames; var year = -1; var month = -1; var day = -1; var doy = -1; var literal = false; // Check whether a format character is doubled var lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) iFormat++; return matches; }; // Extract a number from the string value var getNumber = function(match) { lookAhead(match); var size = (match == '@' ? 14 : (match == '!' ? 20 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)))); var digits = new RegExp('^\\d{1,' + size + '}'); var num = value.substring(iValue).match(digits); if (!num) throw 'Missing number at position ' + iValue; iValue += num[0].length; return parseInt(num[0], 10); }; // Extract a name from the string value and convert to an index var getName = function(match, shortNames, longNames) { var names = (lookAhead(match) ? longNames : shortNames); for (var i = 0; i < names.length; i++) { if (value.substr(iValue, names[i].length) == names[i]) { iValue += names[i].length; return i + 1; } } throw 'Unknown name at position ' + iValue; }; // Confirm that a literal character matches the string value var checkLiteral = function() { if (value.charAt(iValue) != format.charAt(iFormat)) throw 'Unexpected literal at position ' + iValue; iValue++; }; var iValue = 0; for (var iFormat = 0; iFormat < format.length; iFormat++) { if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false; else checkLiteral(); else switch (format.charAt(iFormat)) { case 'd': day = getNumber('d'); break; case 'D': getName('D', dayNamesShort, dayNames); break; case 'o': doy = getNumber('o'); break; case 'w': getNumber('w'); break; case 'm': month = getNumber('m'); break; case 'M': month = getName('M', monthNamesShort, monthNames); break; case 'y': year = getNumber('y'); break; case '@': var date = new Date(getNumber('@')); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case '!': var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case "'": if (lookAhead("'")) checkLiteral(); else literal = true; break; default: checkLiteral(); } } if (iValue < value.length) throw 'Additional text found at end'; if (year == -1) year = new Date().getFullYear(); else if (year < 100) year += (shortYearCutoff == -1 ? 1900 : new Date().getFullYear() - new Date().getFullYear() % 100 - (year <= shortYearCutoff ? 0 : 100)); if (doy > -1) { month = 1; day = doy; do { var dim = this._getDaysInMonth(year, month - 1); if (day <= dim) break; month++; day -= dim; } while (true); } var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) throw 'Invalid date'; // E.g. 31/02/* return date; }, /* Standard date formats. */ ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) COOKIE: 'D, dd M yy', ISO_8601: 'yy-mm-dd', RFC_822: 'D, d M y', RFC_850: 'DD, dd-M-y', RFC_1036: 'D, d M y', RFC_1123: 'D, d M yy', RFC_2822: 'D, d M yy', RSS: 'D, d M y', // RFC 822 TICKS: '!', TIMESTAMP: '@', W3C: 'yy-mm-dd', // ISO 8601 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), /* Format a date object into a string value. The format can be combinations of the following: d - day of month (no leading zero) dd - day of month (two digit) o - day of year (no leading zeros) oo - day of year (three digit) D - day name short DD - day name long w - week of year (no leading zero) ww - week of year (two digit) m - month of year (no leading zero) mm - month of year (two digit) M - month name short MM - month name long y - year (two digit) yy - year (four digit) @ - Unix timestamp (ms since 01/01/1970) ! - Windows ticks (100ns since 01/01/0001) '...' - literal text '' - single quote @param format (string) the desired format of the date @param date (Date) the date value to format @param settings (object) attributes include: dayNamesShort (string[7]) abbreviated names of the days from Sunday (optional) dayNames (string[7]) names of the days from Sunday (optional) monthNamesShort (string[12]) abbreviated names of the months (optional) monthNames (string[12]) names of the months (optional) calculateWeek (function) function that determines week of the year (optional) @return (string) the date in the above format */ formatDate: function (format, date, settings) { if (!date) return ''; settings = settings || {}; var dayNamesShort = settings.dayNamesShort || this._defaults.dayNamesShort; var dayNames = settings.dayNames || this._defaults.dayNames; var monthNamesShort = settings.monthNamesShort || this._defaults.monthNamesShort; var monthNames = settings.monthNames || this._defaults.monthNames; var calculateWeek = settings.calculateWeek || this._defaults.calculateWeek; // Check whether a format character is doubled var lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) iFormat++; return matches; }; // Format a number, with leading zero if necessary var formatNumber = function(match, value, len) { var num = '' + value; if (lookAhead(match)) while (num.length < len) num = '0' + num; return num; }; // Format a name, short or long as requested var formatName = function(match, value, shortNames, longNames) { return (lookAhead(match) ? longNames[value] : shortNames[value]); }; var output = ''; var literal = false; if (date) for (var iFormat = 0; iFormat < format.length; iFormat++) { if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false; else output += format.charAt(iFormat); else switch (format.charAt(iFormat)) { case 'd': output += formatNumber('d', date.getDate(), 2); break; case 'D': output += formatName('D', date.getDay(), dayNamesShort, dayNames); break; case 'o': output += formatNumber('o', (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3); break; case 'w': output += formatNumber('w', calculateWeek(date), 2); break; case 'm': output += formatNumber('m', date.getMonth() + 1, 2); break; case 'M': output += formatName('M', date.getMonth(), monthNamesShort, monthNames); break; case 'y': output += (lookAhead('y') ? date.getFullYear() : (date.getFullYear() % 100 < 10 ? '0' : '') + date.getFullYear() % 100); break; case '@': output += date.getTime(); break; case '!': output += date.getTime() * 10000 + this._ticksTo1970; break; case "'": if (lookAhead("'")) output += "'"; else literal = true; break; default: output += format.charAt(iFormat); } } return output; }, /* Get a setting value, defaulting if necessary. @param inst (object) the instance settings for this datepicker @param name (string) the name of the property @return (any) the property's value */ _get: function(inst, name) { return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name]; }, /* Parse existing date and initialise date picker. @param inst (object) the instance settings for this datepicker */ _setDateFromField: function(inst) { var dateFormat = this._get(inst, 'dateFormat'); var rangeSelect = this._get(inst, 'rangeSelect'); var multiSelect = this._get(inst, 'multiSelect'); inst.lastVal = (inst.input ? inst.input.val() : ''); var dates = inst.lastVal; dates = (rangeSelect ? dates.split(this._get(inst, 'rangeSeparator')) : (multiSelect ? dates.split(this._get(inst, 'multiSeparator')) : [dates])); inst.dates = []; var settings = this._getFormatConfig(inst); for (var i = 0; i < dates.length; i++) try { inst.dates[i] = this.parseDate(dateFormat, dates[i], settings); } catch (event) { inst.dates[i] = null; } for (var i = inst.dates.length - 1; i >= 0; i--) if (!inst.dates[i]) inst.dates.splice(i, 1); if (rangeSelect && inst.dates.length < 2) inst.dates[1] = inst.dates[0]; if (multiSelect && inst.dates.length > multiSelect) inst.dates.splice(multiSelect, inst.dates.length); inst.cursorDate = new Date((inst.dates[0] || this._getDefaultDate(inst)).getTime()); inst.drawMonth = inst.cursorDate.getMonth(); inst.drawYear = inst.cursorDate.getFullYear(); this._adjustInstDate(inst); }, /* Retrieve the default date shown on opening. @param inst (object) the instance settings for this datepicker @return (Date) the default date */ _getDefaultDate: function(inst) { return this._restrictMinMax(inst, this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); }, /* A date may be specified as an exact value or a relative one. @param inst (object) the instance settings for this datepicker @param date (Date or number or string) the date or offset @param defaultDate (Date) the date to use if no other supplied @return (Date) the decoded date */ _determineDate: function(inst, date, defaultDate) { var offsetNumeric = function(offset) { var date = new Date(); date.setDate(date.getDate() + offset); return date; }; var offsetString = function(offset) { try { return $.datepick.parseDate($.datepick._get(inst, 'dateFormat'), offset, $.datepick._getFormatConfig(inst)); } catch (e) { // Ignore } var date = (offset.toLowerCase().match(/^c/) ? $.datepick._getDate(inst) : null) || new Date(); var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var pattern = /([+-]?[0-9]+)\s*(d|w|m|y)?/g; var matches = pattern.exec(offset.toLowerCase()); while (matches) { switch (matches[2] || 'd') { case 'd': day += parseInt(matches[1], 10); break; case 'w': day += parseInt(matches[1], 10) * 7; break; case 'm': month += parseInt(matches[1], 10); day = Math.min(day, $.datepick._getDaysInMonth(year, month)); break; case 'y': year += parseInt(matches[1], 10); day = Math.min(day, $.datepick._getDaysInMonth(year, month)); break; } matches = pattern.exec(offset.toLowerCase()); } return new Date(year, month, day); }; date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) : (typeof date == 'number' ? (isNaN(date) || date == Infinity || date == -Infinity ? defaultDate : offsetNumeric(date)) : date))); date = (date && (date.toString() == 'Invalid Date' || date.toString() == 'NaN') ? defaultDate : date); if (date) { date.setHours(0); date.setMinutes(0); date.setSeconds(0); date.setMilliseconds(0); } return this._daylightSavingAdjust(date); }, /* Handle switch to/from daylight saving. Hours may be non-zero on daylight saving cut-over: > 12 when midnight changeover, but then cannot generate midnight datetime, so jump to 1AM, otherwise reset. @param date (Date) the date to check @return (Date) the corrected date */ _daylightSavingAdjust: function(date) { if (!date) return null; date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); return date; }, /* Set the date(s) directly. @param inst (object) the instance settings for this datepicker @param date (Date or Date[] or number or string) the new date or start of a range @param endDate (Date or number or string) the end of a range */ _setDate: function(inst, date, endDate) { date = (!date ? [] : (isArray(date) ? date : [date])); if (endDate) date.push(endDate); var clear = (date.length == 0); var origMonth = inst.cursorDate.getMonth(); var origYear = inst.cursorDate.getFullYear(); inst.dates = [this._restrictMinMax(inst, this._determineDate(inst, date[0], new Date()))]; inst.cursorDate = new Date(inst.dates[0].getTime()); inst.drawMonth = inst.cursorDate.getMonth(); inst.drawYear = inst.cursorDate.getFullYear(); if (this._get(inst, 'rangeSelect')) inst.dates[1] = (date.length < 1 ? inst.dates[0] : this._restrictMinMax(inst, this._determineDate(inst, date[1], null))); else if (this._get(inst, 'multiSelect')) for (var i = 1; i < date.length; i++) inst.dates[i] = this._restrictMinMax(inst, this._determineDate(inst, date[i], null)); if (origMonth != inst.cursorDate.getMonth() || origYear != inst.cursorDate.getFullYear()) this._notifyChange(inst); this._adjustInstDate(inst); this._showDate(inst); }, /* Retrieve the date(s) directly. @param inst (object) the instance settings for this datepicker @return (Date or Date[2] or Date[]) the current date or dates (for a range or multiples) */ _getDate: function(inst) { var startDate = (inst.input && inst.input.val() == '' ? null : inst.dates[0]); if (this._get(inst, 'rangeSelect')) return (startDate ? [inst.dates[0], inst.dates[1] || inst.dates[0]] : [null, null]); else if (this._get(inst, 'multiSelect')) return inst.dates.slice(0, inst.dates.length); else return startDate; }, /* Generate the HTML for the current state of the date picker. @param inst (object) the instance settings for this datepicker @return (string) the new HTML for the datepicker */ _generateHTML: function(inst) { var today = new Date(); today = this._daylightSavingAdjust( new Date(today.getFullYear(), today.getMonth(), today.getDate())); // Clear time var showStatus = this._get(inst, 'showStatus'); var initStatus = this._get(inst, 'initStatus') || ' '; var isRTL = this._get(inst, 'isRTL'); var useTR = this._get(inst, 'useThemeRoller') ? 1 : 0; // Build the date picker HTML var clear = (this._get(inst, 'mandatory') ? '' : '
' + this._get(inst, 'clearText') + '
'); var controls = '
' + (isRTL ? '' : clear) + '
' + this._get(inst, 'closeText') + '
' + (isRTL ? clear : '') + '
'; var prompt = this._get(inst, 'prompt'); var closeAtTop = this._get(inst, 'closeAtTop'); var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); var showBigPrevNext = this._get(inst, 'showBigPrevNext'); var numMonths = this._getNumberOfMonths(inst); var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); var stepMonths = this._get(inst, 'stepMonths'); var stepBigMonths = this._get(inst, 'stepBigMonths'); var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); var minDate = this._getMinMaxDate(inst, 'min', true); var maxDate = this._getMinMaxDate(inst, 'max'); var drawMonth = inst.drawMonth - showCurrentAtPos; var drawYear = inst.drawYear; if (drawMonth < 0) { drawMonth += 12; drawYear--; } if (maxDate) { // Don't show past maximum unless also restricted by minimum var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { drawMonth--; if (drawMonth < 0) { drawMonth = 11; drawYear--; } } } inst.drawMonth = drawMonth; inst.drawYear = drawYear; // Controls and links var prevText = this._get(inst, 'prevText'); prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : ''); prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate(prevBigText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepBigMonths, 1)), this._getFormatConfig(inst))); var prev = '
' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? (showBigPrevNext ? '' + prevBigText + '' : '') + '' + prevText + '' : (hideIfNoPrevNext ? ' ' : (showBigPrevNext ? '' : '') + '')) + '
'; var nextText = this._get(inst, 'nextText'); nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); var nextBigText = (showBigPrevNext ? this._get(inst, 'nextBigText') : ''); nextBigText = (!navigationAsDateFormat ? nextBigText : this.formatDate(nextBigText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepBigMonths, 1)), this._getFormatConfig(inst))); var next = '
' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? '' + nextText + '' + (showBigPrevNext ? '' + nextBigText + '' : '') : (hideIfNoPrevNext ? ' ' : '' + (showBigPrevNext ? '' : ''))) + '
'; var currentText = this._get(inst, 'currentText'); var gotoDate = (this._get(inst, 'gotoCurrent') && inst.dates[0] ? inst.dates[0] : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); var html = (closeAtTop && !inst.inline ? controls : '');/* + '
' + (isRTL ? next : prev) + '
' + (this._isInRange(inst, gotoDate) ? '' + currentText + '' : (hideIfNoPrevNext ? ' ' : '')) + '
' + (isRTL ? prev : next) + '
' + (prompt ? '
' + prompt + '
' : '');/**/ html += '' ; var firstDay = parseInt(this._get(inst, 'firstDay'), 10); firstDay = (isNaN(firstDay) ? 0 : firstDay); var changeFirstDay = this._get(inst, 'changeFirstDay'); var dayNames = this._get(inst, 'dayNames'); var dayNamesShort = this._get(inst, 'dayNamesShort'); var dayNamesMin = this._get(inst, 'dayNamesMin'); var monthNames = this._get(inst, 'monthNames'); var beforeShowDay = this._get(inst, 'beforeShowDay'); var showOtherMonths = this._get(inst, 'showOtherMonths'); var selectOtherMonths = this._get(inst, 'selectOtherMonths'); var showWeeks = this._get(inst, 'showWeeks'); var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; var weekStatus = this._get(inst, 'weekStatus'); var status = (showStatus ? this._get(inst, 'dayStatus') || initStatus : ''); var dateStatus = this._get(inst, 'statusForDate') || this.dateStatus; var defaultDate = this._getDefaultDate(inst); for (var row = 0; row < numMonths[0]; row++) { for (var col = 0; col < numMonths[1]; col++) { var cursorDate = this._daylightSavingAdjust( new Date(drawYear, drawMonth, inst.cursorDate.getDate())); html += '
' + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, cursorDate, row > 0 || col > 0, useTR, showStatus, initStatus, monthNames) + // Draw month headers '' + '' + (showWeeks ? '' + this._get(inst, 'weekHeader') + '' : ''); for (var dow = 0; dow < 7; dow++) { // Days of the week var day = (dow + firstDay) % 7; var dayStatus = (!showStatus || !changeFirstDay ? '' : status.replace(/DD/, dayNames[day]).replace(/D/, dayNamesShort[day])); html += '' + (!changeFirstDay ? '' + dayNamesMin[day] + (changeFirstDay ? '' : '') + ''; } html += ''; var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); if (drawYear == inst.cursorDate.getFullYear() && drawMonth == inst.cursorDate.getMonth()) inst.cursorDate.setDate(Math.min(inst.cursorDate.getDate(), daysInMonth)); var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); for (var dRow = 0; dRow < numRows; dRow++) { // Create datepicker rows html += '' + (showWeeks ? '' : ''); for (var dow = 0; dow < 7; dow++) { // Create datepicker days var daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); var otherMonth = (printDate.getMonth() != drawMonth); var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate); var selected = (this._get(inst, 'rangeSelect') && inst.dates[0] && printDate.getTime() >= inst.dates[0].getTime() && printDate.getTime() <= (inst.dates[1] || inst.dates[0]).getTime()); for (var i = 0; i < inst.dates.length; i++) selected = selected || (inst.dates[i] && printDate.getTime() == inst.dates[i].getTime()); var empty = otherMonth && !showOtherMonths; html += ''; printDate.setDate(printDate.getDate() + 1); printDate = this._daylightSavingAdjust(printDate); } html += ''; } drawMonth++; if (drawMonth > 11) { drawMonth = 0; drawYear++; } html += '
' + calculateWeek(printDate) + ''+ '
' + '
' + '
' + ( unselectable ? '': ( ( typeof( wpbc_show_date_info_top ) == 'function' ) ? wpbc_show_date_info_top( inst.id, printDate.getTime() ) : '' ) ) + '
' + (empty ? ' ' : // Not showing other months //FixIn:6.0.1.2 (unselectable ? '' + printDate.getDate()+ '' : '' + printDate.getDate() + '')) + '
'+ ( unselectable ? '': ( ( typeof( wpbc_show_date_info_bottom ) == 'function' ) ? wpbc_show_date_info_bottom( inst.id, printDate.getTime() ) : '' ) ) + '
' + '
'; } if (useTR) html += '
'; } html += (showStatus ? '
' + initStatus + '
' : '') + (!closeAtTop && !inst.inline ? controls : '') + '
' + ($.browser.msie && parseInt($.browser.version, 10) < 7 && !inst.inline ? '' : ''); inst.keyEvent = false; return html; }, /* Generate the month and year header. @param inst (object) the instance settings for this datepicker @param drawMonth (number) the current month @param drawYear (number) the current year @param minDate (Date) the minimum allowed date or null if none @param maxDate (Date) the maximum allowed date or null if none @param cursorDate (Date) the current date position @param secondary (boolean) true if not the first month/year header @param useTR (number) 1 if applying ThemeRoller styling, 0 if not @param showStatus (boolean) true if status bar is visible @param initStatus (string) the default status message @param monthNames (string[12]) the names of the months @return (string) the HTML for the month and year */ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, cursorDate, secondary, useTR, showStatus, initStatus, monthNames) { var minDraw = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)); minDate = (minDate && minDraw < minDate ? minDraw : minDate); var changeMonth = this._get(inst, 'changeMonth'); var changeYear = this._get(inst, 'changeYear'); var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); var html = '
'; var monthHtml = ''; // Month selection if (secondary || !changeMonth) monthHtml += '' + monthNames[drawMonth] + ''; else { var inMinYear = (minDate && minDate.getFullYear() == drawYear); var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); monthHtml += ''; } if (!showMonthAfterYear) html += monthHtml + (secondary || !changeMonth || !changeYear ? ' ' : ''); // Year selection if (secondary || !changeYear) html += '' + drawYear + ''; else { // Determine range of years to display var years = this._get(inst, 'yearRange').split(':'); var year = 0; var endYear = 0; if (years.length != 2) { year = drawYear - 10; endYear = drawYear + 10; } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') { year = drawYear + parseInt(years[0], 10); endYear = drawYear + parseInt(years[1], 10); } else { year = parseInt(years[0], 10); endYear = parseInt(years[1], 10); } year = (minDate ? Math.max(year, minDate.getFullYear()) : year); endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); html += ''; } html += this._get(inst, 'yearSuffix'); if (showMonthAfterYear) html += (secondary || !changeMonth || !changeYear ? ' ' : '') + monthHtml; html += '
'; // Close datepicker_header return html; }, /* Provide code to set and clear the status panel. @param useTR (number) 1 if applying ThemeRoller styling, 0 if not @param showStatus (boolean) true if the status bar is shown @param id (string) the ID of the datepicker instance @param text (string) the status text to display @param initStatus (string) the default status message @return (string) hover actions for the status messages */ _addStatus: function(useTR, showStatus, id, text, initStatus) { return (showStatus ? ' onmouseover="jQuery(\'#' + this._statusId[useTR] + id + '\').html(\'' + (text || initStatus) + '\');" ' + 'onmouseout="jQuery(\'#' + this._statusId[useTR] + id + '\').html(\'' + initStatus + '\');"' : ''); }, /* Adjust one of the date sub-fields. @param inst (object) the instance settings for this datepicker @param offset (number) the change to apply @param period (string) 'D' for days, 'M' for months, 'Y' for years */ _adjustInstDate: function(inst, offset, period) { var yearMonth = inst.drawYear + '/' + inst.drawMonth; var year = inst.drawYear + (period == 'Y' ? offset : 0); var month = inst.drawMonth + (period == 'M' ? offset : 0); var day = Math.min(inst.cursorDate.getDate(), this._getDaysInMonth(year, month)) + (period == 'D' ? offset : 0); inst.cursorDate = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); inst.drawMonth = inst.cursorDate.getMonth(); inst.drawYear = inst.cursorDate.getFullYear(); if (yearMonth != inst.drawYear + '/' + inst.drawMonth) this._notifyChange(inst); }, /* Ensure a date is within any min/max bounds. @param inst (object) the instance settings for this datepicker @param date (Date) the date to check @return (Date) the restricted date */ _restrictMinMax: function(inst, date) { var minDate = this._getMinMaxDate(inst, 'min', true); var maxDate = this._getMinMaxDate(inst, 'max'); date = (minDate && date < minDate ? new Date(minDate.getTime()) : date); date = (maxDate && date > maxDate ? new Date(maxDate.getTime()) : date); return date; }, /* Notify change of month/year. @param inst (object) the instance settings for this datepicker */ _notifyChange: function(inst) { var onChange = this._get(inst, 'onChangeMonthYear'); if (onChange) onChange.apply((inst.input ? inst.input[0] : null), [inst.cursorDate.getFullYear(), inst.cursorDate.getMonth() + 1, this._daylightSavingAdjust(new Date( inst.cursorDate.getFullYear(), inst.cursorDate.getMonth(), 1)), inst]); }, /* Determine the number of months to show. @param inst (object) the instance settings for this datepicker @return (number[2]) the number of rows and columns to display */ _getNumberOfMonths: function(inst) { var numMonths = this._get(inst, 'numberOfMonths'); return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); }, /* Determine the current minimum/maximum date. Ensure no time components are set. May be overridden for a range. @param inst (object) the instance settings for this datepicker @param minMax (string) 'min' or 'max' for required date @param checkRange (boolean) true to allow override for a range minimum @return (Date) the minimum/maximum date or null if none */ _getMinMaxDate: function(inst, minMax, checkRange) { var date = this._determineDate(inst, this._get(inst, minMax + 'Date'), null); var rangeMin = this._getRangeMin(inst); return (checkRange && rangeMin && (!date || rangeMin > date) ? rangeMin : date); }, /* Retrieve the temporary range minimum when in the process of selecting. @param inst (object) the instance settings for this datepicker @return (Date) the temporary minimum or null */ _getRangeMin: function(inst) { return (this._get(inst, 'rangeSelect') && inst.dates[0] && !inst.dates[1] ? inst.dates[0] : null); }, /* Find the number of days in a given month. @param year (number) the full year @param month (number) the month (0 to 11) @return (number) the number of days in this month */ _getDaysInMonth: function(year, month) { return 32 - new Date(year, month, 32).getDate(); }, /* Find the day of the week of the first of a month. @param year (number) the full year @param month (number) the month (0 to 11) @return (number) 0 = Sunday, 1 = Monday, ... */ _getFirstDayOfMonth: function(year, month) { return new Date(year, month, 1).getDay(); }, /* Determines if we should allow a "prev/next" month display change. @param inst (object) the instance settings for this datepicker @param offset (number) the number of months to change by @param curYear (number) the full current year @param curMonth (number) the current month (0 to 11) @return (boolean) true if prev/next allowed, false if not */ _canAdjustMonth: function(inst, offset, curYear, curMonth) { var numMonths = this._getNumberOfMonths(inst); var date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); if (offset < 0) date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); return this._isInRange(inst, date); }, /* Is the given date in the accepted range? @param inst (object) the instance settings for this datepicker @param date (Date) the date to check @return (boolean) true if the date is in the allowed minimum/maximum, false if not */ _isInRange: function(inst, date) { // During range selection, use minimum of selected date and range start var minDate = this._getRangeMin(inst) || this._getMinMaxDate(inst, 'min'); var maxDate = this._getMinMaxDate(inst, 'max'); return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)); }, /* Provide the configuration settings for formatting/parsing. @param inst (object) the instance settings for this datepicker @return (object) the settings subset */ _getFormatConfig: function(inst) { return {shortYearCutoff: this._get(inst, 'shortYearCutoff'), dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; }, /* Format the given date for display. @param inst (object) the instance settings for this datepicker @param year (number, optional) the full year @param month (number, optional) the month of the year (0 to 11) @param day (number, optional) the day of the month @return (string) formatted date */ _formatDate: function(inst, year, month, day) { if (!year) inst.dates[0] = new Date(inst.cursorDate.getTime()); var date = (year ? (typeof year == 'object' ? year : this._daylightSavingAdjust(new Date(year, month, day))) : inst.dates[0]); return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); } }); /* jQuery extend now ignores nulls! @param target (object) the object to extend @param props (object) the new settings @return (object) the updated object */ function extendRemove(target, props) { $.extend(target, props); for (var name in props) if (props[name] == null || props[name] == undefined) target[name] = props[name]; return target; }; /* Determine whether an object is an array. @param a (object) the object to test @return (boolean) true if an array, false if not */ function isArray(a) { return (a && a.constructor == Array); }; /* Invoke the datepicker functionality. @param options (string) a command, optionally followed by additional parameters or (object) settings for attaching new datepicker functionality @return (jQuery) jQuery object */ $.fn.datepick = function(options){ var otherArgs = Array.prototype.slice.call(arguments, 1); if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'settings')) return $.datepick['_' + options + 'Datepick']. apply($.datepick, [this[0]].concat(otherArgs)); if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') return $.datepick['_' + options + 'Datepick']. apply($.datepick, [this[0]].concat(otherArgs)); return this.each(function() { typeof options == 'string' ? $.datepick['_' + options + 'Datepick']. apply($.datepick, [this].concat(otherArgs)) : $.datepick._attachDatepick(this, options); }); }; $.datepick = new Datepick(); // Singleton instance $(function() { $(document).mousedown($.datepick._checkExternalClick). find('body').append($.datepick.dpDiv); }); })(jQuery); // source --> https://www.hochzeitsfotografie-ronge.de/wp-content/plugins/booking/js/datepick/jquery.datepick-de.js?ver=1.1 /* German initialisation for the jQuery UI date picker plugin. */ /* Written by Milian Wolff (mail@milianw.de). */ (function($) { $.datepick.regional['de'] = { clearText: 'löschen', clearStatus: 'aktuelles Datum löschen', closeText: 'schließen', closeStatus: 'ohne Änderungen schließen', prevText: '<zurück', prevStatus: 'letzten Monat zeigen', prevBigText: '<<', prevBigStatus: '', nextText: 'Vor>', nextStatus: 'nächsten Monat zeigen', nextBigText: '>>', nextBigStatus: '', currentText: 'heute', currentStatus: '', monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'], monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', 'Jul','Aug','Sep','Okt','Nov','Dez'], monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen', weekHeader: 'Wo', weekStatus: 'Woche des Monats', dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d', dateFormat: 'dd.mm.yy', firstDay: 1, initStatus: 'Wähle ein Datum', isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepick.setDefaults($.datepick.regional['de']); })(jQuery); // source --> https://www.hochzeitsfotografie-ronge.de/wp-content/plugins/booking/js/client.js?ver=8.4 var is_booking_without_payment = false; var date_approved = []; var date2approve = []; var date_admin_blank = []; var dates_additional_info = []; var is_all_days_available = []; var avalaibility_filters = []; var is_show_cost_in_tooltips = false; var is_show_cost_in_date_cell = false; var is_show_availability_in_tooltips = false; var global_avalaibility_times = []; var numbb = 0; //var is_use_visitors_number_for_availability; var timeoutID_of_thank_you_page = null; /** * Calendar Init * * @param bk_type - resource ID * @param date_approved_par * @param my_num_month * @param start_day_of_week * @param start_bk_month * @returns {boolean} */ function init_datepick_cal(bk_type, date_approved_par, my_num_month, start_day_of_week, start_bk_month ){ if ( jQuery('#calendar_booking'+ bk_type).hasClass('hasDatepick') == true ) { // If the calendar with the same Booking resource is activated already, then exist. return false; } var cl = document.getElementById('calendar_booking'+ bk_type);if (cl === null) return; // Get calendar instance and exit if its not exist date_approved[ bk_type ] = date_approved_par; var isRangeSelect = false; var bkMultiDaysSelect = 365; if ( bk_days_selection_mode==='dynamic' ) { isRangeSelect = true; bkMultiDaysSelect = 0; } if ( bk_days_selection_mode==='single' ) bkMultiDaysSelect = 0; var bkMinDate = 0; var bkMaxDate = booking_max_monthes_in_calendar; var is_this_admin = false; if ( ( location.href.indexOf('page=wpbc-new') != -1 ) && ( location.href.indexOf('booking_hash') != -1 ) // Comment this line for ability to add booking in past days at Booking > Add booking page. ){ is_this_admin = true; bkMinDate = null; bkMaxDate = null; } function click_on_cal_td(){ if(typeof( selectDayPro ) == 'function') {selectDayPro( bk_type);} } function selectDay(date) { // Set unselectable, if only Availability Calendar here (and we do not insert Booking form by mistake). var is_calendar_booking_unselectable = jQuery( '#calendar_booking_unselectable' + bk_type ); //FixIn: 8.0.1.2 var is_booking_form_also = jQuery( '#booking_form_div' + bk_type ); if ( ( is_calendar_booking_unselectable.length > 0 ) && ( is_booking_form_also.length <= 0 ) ){ wpbc_unselect_all_days( bk_type ); jQuery('.wpbc_only_calendar .popover_calendar_hover').remove(); //Hide all opened popovers return false; } //FixIn: 8.0.1.2 end //console.log( jQuery.fn.popover.Constructor.VERSION ); // Check if this minimum BS version, and then proced if ( jQuery.isFunction( jQuery( ".datepick-days-cell" ).popover ) ){ //FixIn: 7.0.1.2 - 2016-12-10 jQuery( '.datepick-days-cell' ).popover( 'hide' ); } jQuery( '#date_booking' + bk_type ).val( date ); if ( typeof( bkDisableBookedTimeSlots ) == 'function' ){ if(typeof( prepare_tooltip ) == 'function') {setTimeout("prepare_tooltip("+bk_type+");",1000);} // HERE WE WILL DISABLE ALL OPTIONS IN RANGE TIME INTERVALS FOR SINGLE DAYS SELECTIONS FOR THAT DAYS WHERE HOURS ALREADY BOOKED bkDisableBookedTimeSlots( jQuery( '#date_booking' + bk_type ).val(), bk_type ); } if ( typeof( selectDayPro ) == 'function' ){ selectDayPro( date, bk_type ); } jQuery( ".booking_form_div" ).trigger( "date_selected", [ bk_type, date ] ); } function hoverDay(value, date){ if ( typeof( hoverDayTime ) == 'function' ){ hoverDayTime( value, date, bk_type ); } if ( (location.href.indexOf( 'page=wpbc' ) == -1) || (location.href.indexOf( 'page=wpbc-new' ) > 0) ){ // Do not show it (range) at the main admin page if ( typeof( hoverDayPro ) == 'function' ){ hoverDayPro( value, date, bk_type ); } } var is_calendar_booking_unselectable = jQuery( '#calendar_booking_unselectable' + bk_type ); //FixIn: 8.0.1.2 var is_booking_form_also = jQuery( '#booking_form_div' + bk_type ); // Set unselectable, if only Availability Calendar here (and we do not insert Booking form by mistake). if ( ( is_calendar_booking_unselectable.length == 1 ) && ( is_booking_form_also.length != 1 ) ){ jQuery( '#calendar_booking' + bk_type + ' .datepick-days-cell-over' ).removeClass( 'datepick-days-cell-over' ); // clear all highlight days selections jQuery( '.wpbc_only_calendar #calendar_booking' + bk_type + ' .datepick-days-cell, ' + '.wpbc_only_calendar #calendar_booking' + bk_type + ' .datepick-days-cell a' ).css( 'cursor', 'default' ); return false; } //FixIn: 8.0.1.2 end } function applyCSStoDays(date ){ var class_day = (date.getMonth()+1) + '-' + date.getDate() + '-' + date.getFullYear(); var additional_class = ' wpbc_weekday_' + date.getDay() + ' '; //Block today date if current today time older than 18:00 if ( ( false ) && ( date.getDate() == (wpdev_bk_today[2] ) ) && ( date.getMonth() == (wpdev_bk_today[1]-1) ) &&( date.getFullYear() == (wpdev_bk_today[0]) ) ){ var my_test_date1 = new Date( wpdev_bk_today[ 0 ], (wpdev_bk_today[ 1 ] - 1), wpdev_bk_today[ 2 ], wpdev_bk_today[ 3 ], wpdev_bk_today[ 4 ], 0 ); //Get today var my_test_date2 = new Date( wpdev_bk_today[ 0 ], (wpdev_bk_today[ 1 ] - 1), wpdev_bk_today[ 2 ], 18, 0, 0 ); //Today 18:00 if ( my_test_date2.getTime() < my_test_date1.getTime() ) return [ false, 'cal4date-' + class_day + ' date_user_unavailable' ]; } if(typeof( prices_per_day ) !== 'undefined') if(typeof( prices_per_day[bk_type] ) !== 'undefined') if(typeof( prices_per_day[bk_type][class_day] ) !== 'undefined') { additional_class += ' rate_'+prices_per_day[bk_type][class_day]; } // define season filter names as classes if(typeof( wpdev_bk_season_filter ) !== 'undefined') if(typeof( wpdev_bk_season_filter[class_day] ) !== 'undefined') { additional_class += ' '+wpdev_bk_season_filter[class_day].join(' '); } if (is_this_admin == false) { var my_test_date = new Date( wpdev_bk_today[0],(wpdev_bk_today[1]-1), wpdev_bk_today[2] ,0,0,0 ); //Get today if ( (days_between( date, my_test_date)) < block_some_dates_from_today ) return [false, 'cal4date-' + class_day +' date_user_unavailable']; if( typeof( wpbc_available_days_num_from_today ) !== 'undefined') if ( parseInt( '0' + wpbc_available_days_num_from_today ) > 0 ) if ( (days_between( date, my_test_date)) > parseInt( '0' + wpbc_available_days_num_from_today ) ) return [false, 'cal4date-' + class_day +' date_user_unavailable']; } if (typeof( is_this_day_available ) == 'function') { var is_day_available = is_this_day_available( date, bk_type); var season_filter = ''; //FixIn: 6.0.1.8 if ( is_day_available instanceof Array ) { season_filter = ' season_filter_id_' + is_day_available[1]; is_day_available = is_day_available[0]; } if (! is_day_available) {return [false, 'cal4date-' + class_day +' date_user_unavailable ' + season_filter ];} } // Time availability if (typeof( check_global_time_availability ) == 'function') {check_global_time_availability( date, bk_type );} var blank_admin_class_day = ''; if(typeof(date_admin_blank[ bk_type ]) !== 'undefined') if(typeof(date_admin_blank[ bk_type ][ class_day ]) !== 'undefined') { blank_admin_class_day = ' date_admin_blank '; } // Check availability per day for BL var reserved_days_count = 1; if(typeof(availability_per_day) !== 'undefined') if(typeof(availability_per_day[ bk_type ]) !== 'undefined') if(typeof(availability_per_day[ bk_type ][ class_day ]) !== 'undefined') { reserved_days_count = parseInt( availability_per_day[ bk_type ][ class_day ] );} // Number of Check In Dates for BL var checkin_days_count = [0 ,0]; if(typeof(wpbc_check_in_dates) !== 'undefined') if(typeof(wpbc_check_in_dates[ bk_type ]) !== 'undefined') if(typeof(wpbc_check_in_dates[ bk_type ][ class_day ]) !== 'undefined') { // [ Number of check in bookings, Pending or Approved status ] checkin_days_count = [ wpbc_check_in_dates[ bk_type ][ class_day ][ 0 ] , wpbc_check_in_dates[ bk_type ][ class_day ][ 1 ] ]; } // Number of Check Out Dates for BL var checkout_days_count = [0 ,0]; if(typeof(wpbc_check_out_dates) !== 'undefined') if(typeof(wpbc_check_out_dates[ bk_type ]) !== 'undefined') if(typeof(wpbc_check_out_dates[ bk_type ][ class_day ]) !== 'undefined') { // [ Number of check Out bookings, Pending or Approved status ] checkout_days_count = [ wpbc_check_out_dates[ bk_type ][ class_day ][ 0 ] , wpbc_check_out_dates[ bk_type ][ class_day ][ 1 ] ]; } // Booked both check in/out dates in the same child resources var both_check_in_out_num = 0; if ( typeof( getNumberClosedCheckInOutDays ) == 'function' ) { both_check_in_out_num = getNumberClosedCheckInOutDays( bk_type, class_day ); } // we have 0 available at this day - Only for resources, which have childs if ( wpdev_in_array( parent_booking_resources, bk_type ) ) if (reserved_days_count <= 0) { if(typeof(date2approve[ bk_type ]) !== 'undefined') if(typeof(date2approve[ bk_type ][ class_day ]) !== 'undefined') return [false, 'cal4date-' + class_day +' date2approve date_unavailable_for_all_childs ' + blank_admin_class_day]; return [false, 'cal4date-' + class_day +' date_approved date_unavailable_for_all_childs ' + blank_admin_class_day]; } var th=0; var tm=0; var ts=0; var time_return_value = false; // Select dates which need to approve, its exist only in Admin if(typeof(date2approve[ bk_type ]) !== 'undefined') if(typeof(date2approve[ bk_type ][ class_day ]) !== 'undefined') { for (var ia=0;ia 0 ) || ( (reserved_days_count - both_check_in_out_num ) <= 0 ) ) ) { // Check Check In / Out dates for the parent resources. // reserved_days_count - number of available items, including check in/out dates || both_check_in_out_num number of items with both check in/out //FixIn: 6.0.1.12 // Unavailable if ( (reserved_days_count - both_check_in_out_num ) <= 0 ) { // Check Pending or Approved by the Check In date if ( checkin_days_count[1] == 1 ) additional_class = ' date_approved'; else additional_class = ' date2approve'; return [false, 'cal4date-' + class_day + additional_class + blank_admin_class_day]; } // Recheck if this date check in/out if ( (reserved_days_count - both_check_in_out_num - checkin_days_count[0]) <= 0 ) { if ( checkin_days_count[1] == 1 ) additional_class += ' date_approved'; else additional_class += ' date2approve'; additional_class += ' timespartly check_in_time'; } if ( (reserved_days_count - both_check_in_out_num - checkout_days_count[0]) <= 0 ) { if ( checkout_days_count[1] == 1 ) additional_class += ' date_approved'; else additional_class += ' date2approve'; additional_class += ' timespartly check_out_time'; } } return [true, 'date_available cal4date-' + class_day +' reserved_days_count' + reserved_days_count + ' ' + is_datepick_unselectable + additional_class+ ' ']; } } function changeMonthYear(year, month){ if(typeof( prepare_tooltip ) == 'function') { setTimeout("prepare_tooltip("+bk_type+");",1000); } if(typeof( prepare_highlight ) == 'function') { setTimeout("prepare_highlight();",1000); } } // Configure and show calendar jQuery('#calendar_booking'+ bk_type).text(''); jQuery('#calendar_booking'+ bk_type).datepick( {beforeShowDay: applyCSStoDays, onSelect: selectDay, onHover:hoverDay, onChangeMonthYear:changeMonthYear, showOn: 'both', multiSelect: bkMultiDaysSelect, numberOfMonths: my_num_month, stepMonths: 1, prevText: '«', nextText: '»', dateFormat: 'dd.mm.yy', changeMonth: false, changeYear: false, minDate: bkMinDate, maxDate: bkMaxDate, //'1Y', //minDate: '01.01.2016', maxDate: '31.12.2016', // Ability to set any start and end date in calendar showStatus: false, multiSeparator: ', ', closeAtTop: false, firstDay:start_day_of_week, gotoCurrent: false, hideIfNoPrevNext:true, rangeSelect:isRangeSelect, // showWeeks: true, useThemeRoller :false // ui-cupertino.datepick.css } ); //FixIn: 7.1.2.8 setTimeout( function ( ) { jQuery( '.datepick-days-cell.datepick-today.datepick-days-cell-over' ).removeClass( 'datepick-days-cell-over' ); }, 500 ); if ( start_bk_month != false ) { var inst = jQuery.datepick._getInst(document.getElementById('calendar_booking'+bk_type)); inst.cursorDate = new Date(); inst.cursorDate.setFullYear( start_bk_month[0], (start_bk_month[1]-1) , 1 ); // In some cases, the setFullYear can set only Year, and not the Month and day //FixIn:6.2.3.5 inst.cursorDate.setMonth( parseInt( start_bk_month[1] - 1 ) ); inst.cursorDate.setDate( 1 ); inst.drawMonth = inst.cursorDate.getMonth(); inst.drawYear = inst.cursorDate.getFullYear(); jQuery.datepick._notifyChange(inst); jQuery.datepick._adjustInstDate(inst); jQuery.datepick._showDate(inst); jQuery.datepick._updateDatepick(inst); } if ( typeof( prepare_tooltip ) == 'function' ){ setTimeout( "prepare_tooltip(" + bk_type + ");", 1000 ); } } //////////////////////////////////////////////////////////////////////////// // Days Selections - support functions //////////////////////////////////////////////////////////////////////////// // Get fisrst day of selection function get_first_day_of_selection(dates) { // Multiple days selections if ( dates.indexOf(',') != -1 ){ var dates_array =dates.split(/,\s*/); var length = dates_array.length; var element = null; var new_dates_array = []; for (var i = 0; i < length; i++) { element = dates_array[i].split(/\./); new_dates_array[new_dates_array.length] = element[2]+'.' + element[1]+'.' + element[0]; //2013.12.20 } new_dates_array.sort(); element = new_dates_array[0].split(/\./); return element[2]+'.' + element[1]+'.' + element[0]; //20.12.2013 } // Range days selection if ( dates.indexOf(' - ') != -1 ){ var start_end_date = dates.split(" - "); return start_end_date[0]; } // Single day selection return dates; //20.12.2013 } // Get fisrst day of selection function get_last_day_of_selection(dates) { // Multiple days selections if ( dates.indexOf(',') != -1 ){ var dates_array =dates.split(/,\s*/); var length = dates_array.length; var element = null; var new_dates_array = []; for (var i = 0; i < length; i++) { element = dates_array[i].split(/\./); new_dates_array[new_dates_array.length] = element[2]+'.' + element[1]+'.' + element[0]; //2013.12.20 } new_dates_array.sort(); element = new_dates_array[(new_dates_array.length-1)].split(/\./); return element[2]+'.' + element[1]+'.' + element[0]; //20.12.2013 } // Range days selection if ( dates.indexOf(' - ') != -1 ){ var start_end_date = dates.split(" - "); return start_end_date[(start_end_date.length-1)]; } // Single day selection return dates; //20.12.2013 } // Set selected days at calendar as UnAvailable function setUnavailableSelectedDays( bk_type ){ var sel_dates = jQuery('#calendar_booking'+bk_type).datepick('getDate'); var class_day2; for( var i =0; i '; jQuery('.submiting_content').fadeOut( new_booking_title_time ); setTimeout( function () { location.reload( true ); }, parseInt( 1000 + new_booking_title_time ) ); //FixIn: 8.1.2.14 } } else { setUnavailableSelectedDays( bk_type ); document.getElementById('date_booking' + bk_type).value = ''; jQuery('#calendar_booking' + bk_type + ', .block_hints').hide(); if ( location.href.indexOf('admin.php') == -1 ) { // Front End // Get calendar from the html and insert it before form div, which will hide after btn click jQuery('#calendar_booking' + bk_type).insertBefore("#booking_form_div" + bk_type); document.getElementById("booking_form_div" + bk_type).style.display = "none"; jQuery( '#hided_booking_form' + bk_type ).prevAll( 'select[name="active_booking_form"]' ).hide(); //FixIn: 7.1.2.13 jQuery( '#hided_booking_form' + bk_type ).prevAll( 'label[for="calendar_type"]' ).hide(); makeScroll('#ajax_respond_insert' + bk_type); if ((document.getElementById('gateway_payment_forms' + bk_type) != null) && (document.getElementById('gateway_payment_forms' + bk_type).innerHTML != '')) is_pay_now = true; if ((!is_pay_now) || (is_booking_without_payment == true)) { if (type_of_thank_you_message == 'page') { // Page timeoutID_of_thank_you_page = setTimeout(function ( ) { location.href = thank_you_page_URL; }, 1000); } else { // Message document.getElementById('submiting' + bk_type).innerHTML = '
' + new_booking_title + '
'; makeScroll( '#submiting' + bk_type ); jQuery('.submiting_content').fadeOut( new_booking_title_time ); setTimeout( function () { location.reload( true ); }, parseInt( 1000 + new_booking_title_time ) ); //FixIn: 8.1.2.14 } } } else { // Back End setTimeout( function () { location.reload( true ); }, 1000); } } } //////////////////////////////////////////////////////////////////////////// // Submit Booking Data //////////////////////////////////////////////////////////////////////////// // Check fields at form and then send request function mybooking_submit( submit_form , bk_type, wpdev_active_locale){ //Show message if no selected days if (document.getElementById('date_booking' + bk_type).value == '') { if ( document.getElementById('additional_calendars' + bk_type) != null ) { // Checking according additional calendars. var id_additional_str = document.getElementById('additional_calendars' + bk_type).value; //Loop have to be here based on , sign var id_additional_arr = id_additional_str.split(','); var is_all_additional_days_unselected = true; for (var ia=0;ia