// source --> https://www.oka-ken.co.jp/tennis/wp-content/themes/amore_tcd028/includes/resources/bootstrap/js/bootstrap.js?ver=4.9.3
/*!
* Bootstrap v3.3.1 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=f58353a31151a8c05d7c)
* Config saved to config.json and https://gist.github.com/f58353a31151a8c05d7c
*/
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($) {
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.1
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2014 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.1'
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.1
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2014 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.1'
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 = 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') && this.$element.hasClass('active')) changed = false
else $parent.find('.active').removeClass('active')
}
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
}
if (changed) 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')
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.1
* http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2014 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 =
this.sliding =
this.interval =
this.$active =
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.1'
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 delta = direction == 'prev' ? -1 : 1
var activeIndex = this.getItemIndex(active)
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 fallback = type == 'next' ? 'first' : 'last'
var that = this
if (!$next.length) {
if (!this.options.wrap) return
$next = this.$element.find('.item')[fallback]()
}
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.1
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2014 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.1'
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
$('
').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
// overriding sub-menu parent empty link #
}
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(.divider):visible a'
var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + 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')
}
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
$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)
})
}
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()
}
// 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', '[role="menu"]', Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
}(jQuery);
/* ========================================================================
* Bootstrap: modal.js v3.3.1
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2011-2014 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.$backdrop =
this.isShown = null
this.scrollbarWidth = 0
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.1'
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.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)
if (that.options.backdrop) that.adjustBackdrop()
that.adjustDialog()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$element.find('.modal-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')
.attr('aria-hidden', true)
.off('click.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 = $('')
.prependTo(this.$element)
.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, 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 () {
if (this.options.backdrop) this.adjustBackdrop()
this.adjustDialog()
}
Modal.prototype.adjustBackdrop = function () {
this.$backdrop
.css('height', 0)
.css('height', this.$element[0].scrollHeight)
}
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 () {
this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight
this.scrollbarWidth = this.measureScrollbar()
}
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', '')
}
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.1
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2014 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 =
this.options =
this.enabled =
this.timeout =
this.hoverState =
this.$element = null
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.3.1'
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 && $(this.options.viewport.selector || this.options.viewport)
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.$tip && self.$tip.is(':visible')) {
self.hoverState = 'in'
return
}
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
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.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)
}
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)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var $container = this.options.container ? $(this.options.container) : this.$element.parent()
var containerDim = this.getPosition($container)
placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' :
placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' :
placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < containerDim.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 = offset.top + marginTop
offset.left = 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, isHorizontal) {
this.arrow()
.css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
.css(isHorizontal ? '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 && this.$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.width) { // 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 () {
return (this.$tip = this.$tip || $(this.options.template))
}
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)
}
}
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)
})
}
// 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
var selector = options && options.selector
if (!data && option == 'destroy') return
if (selector) {
if (!data) $this.data('bs.tooltip', (data = {}))
if (!data[selector]) data[selector] = new Tooltip(this, options)
} else {
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.1
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2014 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.1'
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.prototype.tip = function () {
if (!this.$tip) this.$tip = $(this.options.template)
return this.$tip
}
// 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
var selector = options && options.selector
if (!data && option == 'destroy') return
if (selector) {
if (!data) $this.data('bs.popover', (data = {}))
if (!data[selector]) data[selector] = new Popover(this, options)
} else {
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.1
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
this.element = $(element)
}
Tab.VERSION = '3.3.1'
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')) {
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.1
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 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 =
this.unpin =
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION = '3.3.1'
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 && colliderTop <= 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 = $('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.1
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2011-2014 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 = $(this.options.trigger).filter('[href="#' + element.id + '"], [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.1'
Collapse.TRANSITION_DURATION = 350
Collapse.DEFAULTS = {
toggle: true,
trigger: '[data-toggle="collapse"]'
}
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.find('> .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 && option == 'show') 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' : $.extend({}, $this.data(), { trigger: this })
Plugin.call($target, option)
})
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.3.1
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
var process = $.proxy(this.process, this)
this.$body = $('body')
this.$scrollElement = $(element).is('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', process)
this.refresh()
this.process()
}
ScrollSpy.VERSION = '3.3.1'
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 offsetMethod = 'offset'
var offsetBase = 0
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase = this.$scrollElement.scrollTop()
}
this.offsets = []
this.targets = []
this.scrollHeight = this.getScrollHeight()
var self = this
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 () {
self.offsets.push(this[0])
self.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] || 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.1
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2014 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.oka-ken.co.jp/tennis/wp-content/themes/amore_tcd028/includes/js/bootstrap-wp.js?ver=4.9.3
jQuery( document ).ready( function( $ ) {
$( 'input.search-field' ).addClass( 'form-control' );
// here for each comment reply link of wordpress
$( '.comment-reply-link' ).addClass( 'btn btn-primary' );
// here for the submit button of the comment reply form
$( '#commentsubmit' ).addClass( 'btn btn-primary' );
// The WordPress Default Widgets
// Now we'll add some classes for the wordpress default widgets - let's go
// the search widget
$( 'input.search-field' ).addClass( 'form-control' );
$( 'input.search-submit' ).addClass( 'btn btn-default' );
$( '.widget_rss ul' ).addClass( 'media-list' );
$( '.widget_meta ul, .widget_recent_entries ul, .widget_archive ul, .widget_categories ul, .widget_nav_menu ul, .widget_pages ul' ).addClass( 'nav' );
$( '.widget_recent_comments ul#recentcomments' ).css( 'list-style', 'none').css( 'padding-left', '0' );
$( '.widget_recent_comments ul#recentcomments li' ).css( 'padding', '5px 15px');
$( 'table#wp-calendar' ).addClass( 'table table-striped');
} );
// source --> https://www.oka-ken.co.jp/tennis/wp-content/themes/amore_tcd028/js/jquery.elevatezoom.js
/*
* jQuery elevateZoom 3.0.8
* Demo's and documentation:
* www.elevateweb.co.uk/image-zoom
*
* Copyright (c) 2012 Andrew Eades
* www.elevateweb.co.uk
*
* Dual licensed under the GPL and MIT licenses.
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
/*
* jQuery elevateZoom 3.0.3
* Demo's and documentation:
* www.elevateweb.co.uk/image-zoom
*
* Copyright (c) 2012 Andrew Eades
* www.elevateweb.co.uk
*
* Dual licensed under the GPL and MIT licenses.
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*/
if ( typeof Object.create !== 'function' ) {
Object.create = function( obj ) {
function F() {};
F.prototype = obj;
return new F();
};
}
(function( $, window, document, undefined ) {
var ElevateZoom = {
init: function( options, elem ) {
var self = this;
self.elem = elem;
self.$elem = $( elem );
self.imageSrc = self.$elem.data("zoom-image") ? self.$elem.data("zoom-image") : self.$elem.attr("src");
self.options = $.extend( {}, $.fn.elevateZoom.options, options );
//TINT OVERRIDE SETTINGS
if(self.options.tint) {
self.options.lensColour = "none", //colour of the lens background
self.options.lensOpacity = "1" //opacity of the lens
}
//INNER OVERRIDE SETTINGS
if(self.options.zoomType == "inner") {self.options.showLens = false;}
//Remove alt on hover
self.$elem.parent().removeAttr('title').removeAttr('alt');
self.zoomImage = self.imageSrc;
self.refresh( 1 );
//Create the image swap from the gallery
$('#'+self.options.gallery + ' a').click( function(e) {
//Set a class on the currently active gallery image
if(self.options.galleryActiveClass){
$('#'+self.options.gallery + ' a').removeClass(self.options.galleryActiveClass);
$(this).addClass(self.options.galleryActiveClass);
}
//stop any link on the a tag from working
e.preventDefault();
//call the swap image function
if($(this).data("zoom-image")){self.zoomImagePre = $(this).data("zoom-image")}
else{self.zoomImagePre = $(this).data("image");}
self.swaptheimage($(this).data("image"), self.zoomImagePre);
return false;
});
},
refresh: function( length ) {
var self = this;
setTimeout(function() {
self.fetch(self.imageSrc);
}, length || self.options.refresh );
},
fetch: function(imgsrc) {
//get the image
var self = this;
var newImg = new Image();
newImg.onload = function() {
//set the large image dimensions - used to calculte ratio's
self.largeWidth = newImg.width;
self.largeHeight = newImg.height;
//once image is loaded start the calls
self.startZoom();
self.currentImage = self.imageSrc;
//let caller know image has been loaded
self.options.onZoomedImageLoaded(self.$elem);
}
newImg.src = imgsrc; // this must be done AFTER setting onload
return;
},
startZoom: function( ) {
var self = this;
//get dimensions of the non zoomed image
self.nzWidth = self.$elem.width();
self.nzHeight = self.$elem.height();
//activated elements
self.isWindowActive = false;
self.isLensActive = false;
self.isTintActive = false;
self.overWindow = false;
//CrossFade Wrappe
if(self.options.imageCrossfade){
self.zoomWrap = self.$elem.wrap('');
self.$elem.css('position', 'absolute');
}
self.zoomLock = 1;
self.scrollingLock = false;
self.changeBgSize = false;
self.currentZoomLevel = self.options.zoomLevel;
//get offset of the non zoomed image
self.nzOffset = self.$elem.offset();
//calculate the width ratio of the large/small image
self.widthRatio = (self.largeWidth/self.currentZoomLevel) / self.nzWidth;
self.heightRatio = (self.largeHeight/self.currentZoomLevel) / self.nzHeight;
//if window zoom
if(self.options.zoomType == "window") {
self.zoomWindowStyle = "overflow: hidden;"
+ "background-position: 0px 0px;text-align:center;"
+ "background-color: " + String(self.options.zoomWindowBgColour)
+ ";width: " + String(self.options.zoomWindowWidth) + "px;"
+ "height: " + String(self.options.zoomWindowHeight)
+ "px;float: left;"
+ "background-size: "+ self.largeWidth/self.currentZoomLevel+ "px " +self.largeHeight/self.currentZoomLevel + "px;"
+ "display: none;z-index:100;"
+ "border: " + String(self.options.borderSize)
+ "px solid " + self.options.borderColour
+ ";background-repeat: no-repeat;"
+ "position: absolute;";
}
//if inner zoom
if(self.options.zoomType == "inner") {
//has a border been put on the image? Lets cater for this
var borderWidth = self.$elem.css("border-left-width");
self.zoomWindowStyle = "overflow: hidden;"
+ "margin-left: " + String(borderWidth) + ";"
+ "margin-top: " + String(borderWidth) + ";"
+ "background-position: 0px 0px;"
+ "width: " + String(self.nzWidth) + "px;"
+ "height: " + String(self.nzHeight) + "px;"
+ "px;float: left;"
+ "display: none;"
+ "cursor:"+(self.options.cursor)+";"
+ "px solid " + self.options.borderColour
+ ";background-repeat: no-repeat;"
+ "position: absolute;";
}
//lens style for window zoom
if(self.options.zoomType == "window") {
// adjust images less than the window height
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
lensHeight = self.nzHeight;
}
else{
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
}
if(self.largeWidth < self.options.zoomWindowWidth){
lensWidth = self.nzWidth;
}
else{
lensWidth = (self.options.zoomWindowWidth/self.widthRatio);
}
self.lensStyle = "background-position: 0px 0px;width: " + String((self.options.zoomWindowWidth)/self.widthRatio) + "px;height: " + String((self.options.zoomWindowHeight)/self.heightRatio)
+ "px;float: right;display: none;"
+ "overflow: hidden;"
+ "z-index: 999;"
+ "-webkit-transform: translateZ(0);"
+ "opacity:"+(self.options.lensOpacity)+";filter: alpha(opacity = "+(self.options.lensOpacity*100)+"); zoom:1;"
+ "width:"+lensWidth+"px;"
+ "height:"+lensHeight+"px;"
+ "background-color:"+(self.options.lensColour)+";"
+ "cursor:"+(self.options.cursor)+";"
+ "border: "+(self.options.lensBorderSize)+"px" +
" solid "+(self.options.lensBorderColour)+";background-repeat: no-repeat;position: absolute;";
}
//tint style
self.tintStyle = "display: block;"
+ "position: absolute;"
+ "background-color: "+self.options.tintColour+";"
+ "filter:alpha(opacity=0);"
+ "opacity: 0;"
+ "width: " + self.nzWidth + "px;"
+ "height: " + self.nzHeight + "px;"
;
//lens style for lens zoom with optional round for modern browsers
self.lensRound = '';
if(self.options.zoomType == "lens") {
self.lensStyle = "background-position: 0px 0px;"
+ "float: left;display: none;"
+ "border: " + String(self.options.borderSize) + "px solid " + self.options.borderColour+";"
+ "width:"+ String(self.options.lensSize) +"px;"
+ "height:"+ String(self.options.lensSize)+"px;"
+ "background-repeat: no-repeat;position: absolute;";
}
//does not round in all browsers
if(self.options.lensShape == "round") {
self.lensRound = "border-top-left-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;"
+ "border-top-right-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;"
+ "border-bottom-left-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;"
+ "border-bottom-right-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;";
}
//create the div's + ""
//self.zoomContainer = $('').addClass('zoomContainer').css({"position":"relative", "height":self.nzHeight, "width":self.nzWidth});
self.zoomContainer = $('');
$('body').append(self.zoomContainer);
//this will add overflow hidden and contrain the lens on lens mode
if(self.options.containLensZoom && self.options.zoomType == "lens"){
self.zoomContainer.css("overflow", "hidden");
}
if(self.options.zoomType != "inner") {
self.zoomLens = $("
")
.appendTo(self.zoomContainer)
.click(function () {
self.$elem.trigger('click');
});
if(self.options.tint) {
self.tintContainer = $('').addClass('tintContainer');
self.zoomTint = $("");
self.zoomLens.wrap(self.tintContainer);
self.zoomTintcss = self.zoomLens.after(self.zoomTint);
//if tint enabled - set an image to show over the tint
self.zoomTintImage = $('')
.appendTo(self.zoomLens)
.click(function () {
self.$elem.trigger('click');
});
}
}
//create zoom window
if(isNaN(self.options.zoomWindowPosition)){
self.zoomWindow = $("
")
.appendTo('body')
.click(function () {
self.$elem.trigger('click');
});
}else{
self.zoomWindow = $("
")
.appendTo(self.zoomContainer)
.click(function () {
self.$elem.trigger('click');
});
}
self.zoomWindowContainer = $('').addClass('zoomWindowContainer').css("width",self.options.zoomWindowWidth);
self.zoomWindow.wrap(self.zoomWindowContainer);
// self.captionStyle = "text-align: left;background-color: black;color: white;font-weight: bold;padding: 10px;font-family: sans-serif;font-size: 11px";
// self.zoomCaption = $('INSERT ALT TAG
').appendTo(self.zoomWindow.parent());
if(self.options.zoomType == "lens") {
self.zoomLens.css({ backgroundImage: "url('" + self.imageSrc + "')" });
}
if(self.options.zoomType == "window") {
self.zoomWindow.css({ backgroundImage: "url('" + self.imageSrc + "')" });
}
if(self.options.zoomType == "inner") {
self.zoomWindow.css({ backgroundImage: "url('" + self.imageSrc + "')" });
}
/*-------------------END THE ZOOM WINDOW AND LENS----------------------------------*/
//touch events
self.$elem.bind('touchmove', function(e){
e.preventDefault();
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
self.setPosition(touch);
});
self.zoomContainer.bind('touchmove', function(e){
if(self.options.zoomType == "inner") {
self.showHideWindow("show");
}
e.preventDefault();
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
self.setPosition(touch);
});
self.zoomContainer.bind('touchend', function(e){
self.showHideWindow("hide");
if(self.options.showLens) {self.showHideLens("hide");}
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
});
self.$elem.bind('touchend', function(e){
self.showHideWindow("hide");
if(self.options.showLens) {self.showHideLens("hide");}
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
});
if(self.options.showLens) {
self.zoomLens.bind('touchmove', function(e){
e.preventDefault();
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
self.setPosition(touch);
});
self.zoomLens.bind('touchend', function(e){
self.showHideWindow("hide");
if(self.options.showLens) {self.showHideLens("hide");}
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
});
}
//Needed to work in IE
self.$elem.bind('mousemove', function(e){
if(self.overWindow == false){self.setElements("show");}
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
self.zoomContainer.bind('mousemove', function(e){
if(self.overWindow == false){self.setElements("show");}
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
if(self.options.zoomType != "inner") {
self.zoomLens.bind('mousemove', function(e){
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
}
if(self.options.tint && self.options.zoomType != "inner") {
self.zoomTint.bind('mousemove', function(e){
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
}
if(self.options.zoomType == "inner") {
self.zoomWindow.bind('mousemove', function(e) {
//self.overWindow = true;
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
}
// lensFadeOut: 500, zoomTintFadeIn
self.zoomContainer.add(self.$elem).mouseenter(function(){
if(self.overWindow == false){self.setElements("show");}
}).mouseleave(function(){
if(!self.scrollLock){
self.setElements("hide");
self.options.onDestroy(self.$elem);
}
});
//end ove image
if(self.options.zoomType != "inner") {
self.zoomWindow.mouseenter(function(){
self.overWindow = true;
self.setElements("hide");
}).mouseleave(function(){
self.overWindow = false;
});
}
//end ove image
// var delta = parseInt(e.originalEvent.wheelDelta || -e.originalEvent.detail);
// $(this).empty();
// return false;
//fix for initial zoom setting
if (self.options.zoomLevel != 1){
// self.changeZoomLevel(self.currentZoomLevel);
}
//set the min zoomlevel
if(self.options.minZoomLevel){
self.minZoomLevel = self.options.minZoomLevel;
}
else{
self.minZoomLevel = self.options.scrollZoomIncrement * 2;
}
if(self.options.scrollZoom){
self.zoomContainer.add(self.$elem).bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(e){
// in IE there is issue with firing of mouseleave - So check whether still scrolling
// and on mouseleave check if scrolllock
self.scrollLock = true;
clearTimeout($.data(this, 'timer'));
$.data(this, 'timer', setTimeout(function() {
self.scrollLock = false;
//do something
}, 250));
var theEvent = e.originalEvent.wheelDelta || e.originalEvent.detail*-1
//this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
// e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
e.preventDefault();
if(theEvent /120 > 0) {
//scrolling up
if(self.currentZoomLevel >= self.minZoomLevel){
self.changeZoomLevel(self.currentZoomLevel-self.options.scrollZoomIncrement);
}
}
else{
//scrolling down
if(self.options.maxZoomLevel){
if(self.currentZoomLevel <= self.options.maxZoomLevel){
self.changeZoomLevel(parseFloat(self.currentZoomLevel)+self.options.scrollZoomIncrement);
}
}
else{
//andy
self.changeZoomLevel(parseFloat(self.currentZoomLevel)+self.options.scrollZoomIncrement);
}
}
return false;
});
}
},
setElements: function(type) {
var self = this;
if(!self.options.zoomEnabled){return false;}
if(type=="show"){
if(self.isWindowSet){
if(self.options.zoomType == "inner") {self.showHideWindow("show");}
if(self.options.zoomType == "window") {self.showHideWindow("show");}
if(self.options.showLens) {self.showHideLens("show");}
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("show");
}
}
}
if(type=="hide"){
if(self.options.zoomType == "window") {self.showHideWindow("hide");}
if(!self.options.tint) {self.showHideWindow("hide");}
if(self.options.showLens) {self.showHideLens("hide");}
if(self.options.tint) { self.showHideTint("hide");}
}
},
setPosition: function(e) {
var self = this;
if(!self.options.zoomEnabled){return false;}
//recaclc offset each time in case the image moves
//this can be caused by other on page elements
self.nzHeight = self.$elem.height();
self.nzWidth = self.$elem.width();
self.nzOffset = self.$elem.offset();
if(self.options.tint && self.options.zoomType != "inner") {
self.zoomTint.css({ top: 0});
self.zoomTint.css({ left: 0});
}
//set responsive
//will checking if the image needs changing before running this code work faster?
if(self.options.responsive && !self.options.scrollZoom){
if(self.options.showLens){
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
lensHeight = self.nzHeight;
}
else{
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
}
if(self.largeWidth < self.options.zoomWindowWidth){
lensWidth = self.nzWidth;
}
else{
lensWidth = (self.options.zoomWindowWidth/self.widthRatio);
}
self.widthRatio = self.largeWidth / self.nzWidth;
self.heightRatio = self.largeHeight / self.nzHeight;
if(self.options.zoomType != "lens") {
//possibly dont need to keep recalcalculating
//if the lens is heigher than the image, then set lens size to image size
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
lensHeight = self.nzHeight;
}
else{
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
}
if(self.nzWidth < self.options.zoomWindowHeight/self.heightRatio){
lensWidth = self.nzWidth;
}
else{
lensWidth = String((self.options.zoomWindowWidth/self.widthRatio));
}
self.zoomLens.css('width', lensWidth);
self.zoomLens.css('height', lensHeight);
if(self.options.tint){
self.zoomTintImage.css('width', self.nzWidth);
self.zoomTintImage.css('height', self.nzHeight);
}
}
if(self.options.zoomType == "lens") {
self.zoomLens.css({ width: String(self.options.lensSize) + 'px', height: String(self.options.lensSize) + 'px' })
}
//end responsive image change
}
}
//container fix
self.zoomContainer.css({ top: self.nzOffset.top});
self.zoomContainer.css({ left: self.nzOffset.left});
self.mouseLeft = parseInt(e.pageX - self.nzOffset.left);
self.mouseTop = parseInt(e.pageY - self.nzOffset.top);
//calculate the Location of the Lens
//calculate the bound regions - but only if zoom window
if(self.options.zoomType == "window") {
self.Etoppos = (self.mouseTop < (self.zoomLens.height()/2));
self.Eboppos = (self.mouseTop > self.nzHeight - (self.zoomLens.height()/2)-(self.options.lensBorderSize*2));
self.Eloppos = (self.mouseLeft < 0+((self.zoomLens.width()/2)));
self.Eroppos = (self.mouseLeft > (self.nzWidth - (self.zoomLens.width()/2)-(self.options.lensBorderSize*2)));
}
//calculate the bound regions - but only for inner zoom
if(self.options.zoomType == "inner"){
self.Etoppos = (self.mouseTop < ((self.nzHeight/2)/self.heightRatio) );
self.Eboppos = (self.mouseTop > (self.nzHeight - ((self.nzHeight/2)/self.heightRatio)));
self.Eloppos = (self.mouseLeft < 0+(((self.nzWidth/2)/self.widthRatio)));
self.Eroppos = (self.mouseLeft > (self.nzWidth - (self.nzWidth/2)/self.widthRatio-(self.options.lensBorderSize*2)));
}
// if the mouse position of the slider is one of the outerbounds, then hide window and lens
if (self.mouseLeft < 0 || self.mouseTop < 0 || self.mouseLeft > self.nzWidth || self.mouseTop > self.nzHeight ) {
self.setElements("hide");
return;
}
//else continue with operations
else {
//lens options
if(self.options.showLens) {
// self.showHideLens("show");
//set background position of lens
self.lensLeftPos = String(Math.floor(self.mouseLeft - self.zoomLens.width() / 2));
self.lensTopPos = String(Math.floor(self.mouseTop - self.zoomLens.height() / 2));
}
//adjust the background position if the mouse is in one of the outer regions
//Top region
if(self.Etoppos){
self.lensTopPos = 0;
}
//Left Region
if(self.Eloppos){
self.windowLeftPos = 0;
self.lensLeftPos = 0;
self.tintpos=0;
}
//Set bottom and right region for window mode
if(self.options.zoomType == "window") {
if(self.Eboppos){
self.lensTopPos = Math.max( (self.nzHeight)-self.zoomLens.height()-(self.options.lensBorderSize*2), 0 );
}
if(self.Eroppos){
self.lensLeftPos = (self.nzWidth-(self.zoomLens.width())-(self.options.lensBorderSize*2));
}
}
//Set bottom and right region for inner mode
if(self.options.zoomType == "inner") {
if(self.Eboppos){
self.lensTopPos = Math.max( ((self.nzHeight)-(self.options.lensBorderSize*2)), 0 );
}
if(self.Eroppos){
self.lensLeftPos = (self.nzWidth-(self.nzWidth)-(self.options.lensBorderSize*2));
}
}
//if lens zoom
if(self.options.zoomType == "lens") {
self.windowLeftPos = String(((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomLens.width() / 2) * (-1));
self.windowTopPos = String(((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomLens.height() / 2) * (-1));
self.zoomLens.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
if(self.changeBgSize){
if(self.nzHeight>self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.changeBgSize = false;
}
self.setWindowPostition(e);
}
//if tint zoom
if(self.options.tint && self.options.zoomType != "inner") {
self.setTintPosition(e);
}
//set the css background position
if(self.options.zoomType == "window") {
self.setWindowPostition(e);
}
if(self.options.zoomType == "inner") {
self.setWindowPostition(e);
}
if(self.options.showLens) {
if(self.fullwidth && self.options.zoomType != "lens"){
self.lensLeftPos = 0;
}
self.zoomLens.css({ left: self.lensLeftPos + 'px', top: self.lensTopPos + 'px' })
}
} //end else
},
showHideWindow: function(change) {
var self = this;
if(change == "show"){
if(!self.isWindowActive){
if(self.options.zoomWindowFadeIn){
self.zoomWindow.stop(true, true, false).fadeIn(self.options.zoomWindowFadeIn);
}
else{self.zoomWindow.show();}
self.isWindowActive = true;
}
}
if(change == "hide"){
if(self.isWindowActive){
if(self.options.zoomWindowFadeOut){
self.zoomWindow.stop(true, true).fadeOut(self.options.zoomWindowFadeOut, function () {
if (self.loop) {
//stop moving the zoom window when zoom window is faded out
clearInterval(self.loop);
self.loop = false;
}
});
}
else{self.zoomWindow.hide();}
self.isWindowActive = false;
}
}
},
showHideLens: function(change) {
var self = this;
if(change == "show"){
if(!self.isLensActive){
if(self.options.lensFadeIn){
self.zoomLens.stop(true, true, false).fadeIn(self.options.lensFadeIn);
}
else{self.zoomLens.show();}
self.isLensActive = true;
}
}
if(change == "hide"){
if(self.isLensActive){
if(self.options.lensFadeOut){
self.zoomLens.stop(true, true).fadeOut(self.options.lensFadeOut);
}
else{self.zoomLens.hide();}
self.isLensActive = false;
}
}
},
showHideTint: function(change) {
var self = this;
if(change == "show"){
if(!self.isTintActive){
if(self.options.zoomTintFadeIn){
self.zoomTint.css({opacity:self.options.tintOpacity}).animate().stop(true, true).fadeIn("slow");
}
else{
self.zoomTint.css({opacity:self.options.tintOpacity}).animate();
self.zoomTint.show();
}
self.isTintActive = true;
}
}
if(change == "hide"){
if(self.isTintActive){
if(self.options.zoomTintFadeOut){
self.zoomTint.stop(true, true).fadeOut(self.options.zoomTintFadeOut);
}
else{self.zoomTint.hide();}
self.isTintActive = false;
}
}
},
setLensPostition: function( e ) {
},
setWindowPostition: function( e ) {
//return obj.slice( 0, count );
var self = this;
if(!isNaN(self.options.zoomWindowPosition)){
switch (self.options.zoomWindowPosition) {
case 1: //done
self.windowOffsetTop = (self.options.zoomWindowOffety);//DONE - 1
self.windowOffsetLeft =(+self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
case 2:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = ((self.options.zoomWindowHeight/2)-(self.nzHeight/2))*(-1);
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
}
else{ //negative margin
}
break;
case 3: //done
self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize*2)); //DONE 3,9
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
case 4: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
case 5: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =(self.nzWidth-self.zoomWindow.width()-(self.options.borderSize*2)); //DONE - 5,15
break;
case 6:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =((self.options.zoomWindowWidth/2)-(self.nzWidth/2)+(self.options.borderSize*2))*(-1);
}
else{ //negative margin
}
break;
case 7: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft = 0; //DONE 7, 13
break;
case 8: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 9: //done
self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize*2)); //DONE 3,9
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 10:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = ((self.options.zoomWindowHeight/2)-(self.nzHeight/2))*(-1);
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
}
else{ //negative margin
}
break;
case 11:
self.windowOffsetTop = (self.options.zoomWindowOffety);
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 12: //done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 13: //done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(0); //DONE 7, 13
break;
case 14:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =((self.options.zoomWindowWidth/2)-(self.nzWidth/2)+(self.options.borderSize*2))*(-1);
}
else{ //negative margin
}
break;
case 15://done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(self.nzWidth-self.zoomWindow.width()-(self.options.borderSize*2)); //DONE - 5,15
break;
case 16: //done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
default: //done
self.windowOffsetTop = (self.options.zoomWindowOffety);//DONE - 1
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
}
} //end isNAN
else{
//WE CAN POSITION IN A CLASS - ASSUME THAT ANY STRING PASSED IS
self.externalContainer = $('#'+self.options.zoomWindowPosition);
self.externalContainerWidth = self.externalContainer.width();
self.externalContainerHeight = self.externalContainer.height();
self.externalContainerOffset = self.externalContainer.offset();
self.windowOffsetTop = self.externalContainerOffset.top;//DONE - 1
self.windowOffsetLeft =self.externalContainerOffset.left; //DONE 1, 2, 3, 4, 16
}
self.isWindowSet = true;
self.windowOffsetTop = self.windowOffsetTop + self.options.zoomWindowOffety;
self.windowOffsetLeft = self.windowOffsetLeft + self.options.zoomWindowOffetx;
self.zoomWindow.css({ top: self.windowOffsetTop});
self.zoomWindow.css({ left: self.windowOffsetLeft});
if(self.options.zoomType == "inner") {
self.zoomWindow.css({ top: 0});
self.zoomWindow.css({ left: 0});
}
self.windowLeftPos = String(((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * (-1));
self.windowTopPos = String(((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1));
if(self.Etoppos){self.windowTopPos = 0;}
if(self.Eloppos){self.windowLeftPos = 0;}
if(self.Eboppos){self.windowTopPos = (self.largeHeight/self.currentZoomLevel-self.zoomWindow.height())*(-1); }
if(self.Eroppos){self.windowLeftPos = ((self.largeWidth/self.currentZoomLevel-self.zoomWindow.width())*(-1));}
//stops micro movements
if(self.fullheight){
self.windowTopPos = 0;
}
if(self.fullwidth){
self.windowLeftPos = 0;
}
//set the css background position
if(self.options.zoomType == "window" || self.options.zoomType == "inner") {
if(self.zoomLock == 1){
//overrides for images not zoomable
if(self.widthRatio <= 1){
self.windowLeftPos = 0;
}
if(self.heightRatio <= 1){
self.windowTopPos = 0;
}
}
// adjust images less than the window height
if (self.options.zoomType == "window") {
if (self.largeHeight < self.options.zoomWindowHeight) {
self.windowTopPos = 0;
}
if (self.largeWidth < self.options.zoomWindowWidth) {
self.windowLeftPos = 0;
}
}
//set the zoomwindow background position
if (self.options.easing){
// if(self.changeZoom){
// clearInterval(self.loop);
// self.changeZoom = false;
// self.loop = false;
// }
//set the pos to 0 if not set
if(!self.xp){self.xp = 0;}
if(!self.yp){self.yp = 0;}
//if loop not already started, then run it
if (!self.loop){
self.loop = setInterval(function(){
//using zeno's paradox
self.xp += (self.windowLeftPos - self.xp) / self.options.easingAmount;
self.yp += (self.windowTopPos - self.yp) / self.options.easingAmount;
if(self.scrollingLock){
clearInterval(self.loop);
self.xp = self.windowLeftPos;
self.yp = self.windowTopPos
self.xp = ((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * (-1);
self.yp = (((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1));
if(self.changeBgSize){
if(self.nzHeight>self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType != "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
/*
if(!self.bgxp){self.bgxp = self.largeWidth/self.newvalue;}
if(!self.bgyp){self.bgyp = self.largeHeight/self.newvalue ;}
if (!self.bgloop){
self.bgloop = setInterval(function(){
self.bgxp += (self.largeWidth/self.newvalue - self.bgxp) / self.options.easingAmount;
self.bgyp += (self.largeHeight/self.newvalue - self.bgyp) / self.options.easingAmount;
self.zoomWindow.css({ "background-size": self.bgxp + 'px ' + self.bgyp + 'px' });
}, 16);
}
*/
self.changeBgSize = false;
}
self.zoomWindow.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
self.scrollingLock = false;
self.loop = false;
}
else if (Math.round(Math.abs(self.xp - self.windowLeftPos) + Math.abs(self.yp - self.windowTopPos)) < 1) {
//stops micro movements
clearInterval(self.loop);
self.zoomWindow.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
self.loop = false;
}
else{
if(self.changeBgSize){
if(self.nzHeight>self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType != "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.changeBgSize = false;
}
self.zoomWindow.css({ backgroundPosition: self.xp + 'px ' + self.yp + 'px' });
}
}, 16);
}
}
else{
if(self.changeBgSize){
if(self.nzHeight>self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
if((self.largeHeight/self.newvaluewidth) < self.options.zoomWindowHeight){
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
else{
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
}
self.changeBgSize = false;
}
self.zoomWindow.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
}
}
},
setTintPosition: function(e){
var self = this;
self.nzOffset = self.$elem.offset();
self.tintpos = String(((e.pageX - self.nzOffset.left)-(self.zoomLens.width() / 2)) * (-1));
self.tintposy = String(((e.pageY - self.nzOffset.top) - self.zoomLens.height() / 2) * (-1));
if(self.Etoppos){
self.tintposy = 0;
}
if(self.Eloppos){
self.tintpos=0;
}
if(self.Eboppos){
self.tintposy = (self.nzHeight-self.zoomLens.height()-(self.options.lensBorderSize*2))*(-1);
}
if(self.Eroppos){
self.tintpos = ((self.nzWidth-self.zoomLens.width()-(self.options.lensBorderSize*2))*(-1));
}
if(self.options.tint) {
//stops micro movements
if(self.fullheight){
self.tintposy = 0;
}
if(self.fullwidth){
self.tintpos = 0;
}
self.zoomTintImage.css({'left': self.tintpos+'px'});
self.zoomTintImage.css({'top': self.tintposy+'px'});
}
},
swaptheimage: function(smallimage, largeimage){
var self = this;
var newImg = new Image();
if(self.options.loadingIcon){
self.spinner = $('');
self.$elem.after(self.spinner);
}
self.options.onImageSwap(self.$elem);
newImg.onload = function() {
self.largeWidth = newImg.width;
self.largeHeight = newImg.height;
self.zoomImage = largeimage;
self.zoomWindow.css({ "background-size": self.largeWidth + 'px ' + self.largeHeight + 'px' });
self.swapAction(smallimage, largeimage);
return;
}
newImg.src = largeimage; // this must be done AFTER setting onload
},
swapAction: function(smallimage, largeimage){
var self = this;
var newImg2 = new Image();
newImg2.onload = function() {
//re-calculate values
self.nzHeight = newImg2.height;
self.nzWidth = newImg2.width;
self.options.onImageSwapComplete(self.$elem);
self.doneCallback();
return;
}
newImg2.src = smallimage;
//reset the zoomlevel to that initially set in options
self.currentZoomLevel = self.options.zoomLevel;
self.options.maxZoomLevel = false;
//swaps the main image
//self.$elem.attr("src",smallimage);
//swaps the zoom image
if(self.options.zoomType == "lens") {
self.zoomLens.css({ backgroundImage: "url('" + largeimage + "')" });
}
if(self.options.zoomType == "window") {
self.zoomWindow.css({ backgroundImage: "url('" + largeimage + "')" });
}
if(self.options.zoomType == "inner") {
self.zoomWindow.css({ backgroundImage: "url('" + largeimage + "')" });
}
self.currentImage = largeimage;
if(self.options.imageCrossfade){
var oldImg = self.$elem;
var newImg = oldImg.clone();
self.$elem.attr("src",smallimage)
self.$elem.after(newImg);
newImg.stop(true).fadeOut(self.options.imageCrossfade, function() {
$(this).remove();
});
// if(self.options.zoomType == "inner"){
//remove any attributes on the cloned image so we can resize later
self.$elem.width("auto").removeAttr("width");
self.$elem.height("auto").removeAttr("height");
// }
oldImg.fadeIn(self.options.imageCrossfade);
if(self.options.tint && self.options.zoomType != "inner") {
var oldImgTint = self.zoomTintImage;
var newImgTint = oldImgTint.clone();
self.zoomTintImage.attr("src",largeimage)
self.zoomTintImage.after(newImgTint);
newImgTint.stop(true).fadeOut(self.options.imageCrossfade, function() {
$(this).remove();
});
oldImgTint.fadeIn(self.options.imageCrossfade);
//self.zoomTintImage.attr("width",elem.data("image"));
//resize the tint window
self.zoomTint.css({ height: self.$elem.height()});
self.zoomTint.css({ width: self.$elem.width()});
}
self.zoomContainer.css("height", self.$elem.height());
self.zoomContainer.css("width", self.$elem.width());
if(self.options.zoomType == "inner"){
if(!self.options.constrainType){
self.zoomWrap.parent().css("height", self.$elem.height());
self.zoomWrap.parent().css("width", self.$elem.width());
self.zoomWindow.css("height", self.$elem.height());
self.zoomWindow.css("width", self.$elem.width());
}
}
if(self.options.imageCrossfade){
self.zoomWrap.css("height", self.$elem.height());
self.zoomWrap.css("width", self.$elem.width());
}
}
else{
self.$elem.attr("src",smallimage);
if(self.options.tint) {
self.zoomTintImage.attr("src",largeimage);
//self.zoomTintImage.attr("width",elem.data("image"));
self.zoomTintImage.attr("height",self.$elem.height());
//self.zoomTintImage.attr('src') = elem.data("image");
self.zoomTintImage.css({ height: self.$elem.height()});
self.zoomTint.css({ height: self.$elem.height()});
}
self.zoomContainer.css("height", self.$elem.height());
self.zoomContainer.css("width", self.$elem.width());
if(self.options.imageCrossfade){
self.zoomWrap.css("height", self.$elem.height());
self.zoomWrap.css("width", self.$elem.width());
}
}
if(self.options.constrainType){
//This will contrain the image proportions
if(self.options.constrainType == "height"){
self.zoomContainer.css("height", self.options.constrainSize);
self.zoomContainer.css("width", "auto");
if(self.options.imageCrossfade){
self.zoomWrap.css("height", self.options.constrainSize);
self.zoomWrap.css("width", "auto");
self.constwidth = self.zoomWrap.width();
}
else{
self.$elem.css("height", self.options.constrainSize);
self.$elem.css("width", "auto");
self.constwidth = self.$elem.width();
}
if(self.options.zoomType == "inner"){
self.zoomWrap.parent().css("height", self.options.constrainSize);
self.zoomWrap.parent().css("width", self.constwidth);
self.zoomWindow.css("height", self.options.constrainSize);
self.zoomWindow.css("width", self.constwidth);
}
if(self.options.tint){
self.tintContainer.css("height", self.options.constrainSize);
self.tintContainer.css("width", self.constwidth);
self.zoomTint.css("height", self.options.constrainSize);
self.zoomTint.css("width", self.constwidth);
self.zoomTintImage.css("height", self.options.constrainSize);
self.zoomTintImage.css("width", self.constwidth);
}
}
if(self.options.constrainType == "width"){
self.zoomContainer.css("height", "auto");
self.zoomContainer.css("width", self.options.constrainSize);
if(self.options.imageCrossfade){
self.zoomWrap.css("height", "auto");
self.zoomWrap.css("width", self.options.constrainSize);
self.constheight = self.zoomWrap.height();
}
else{
self.$elem.css("height", "auto");
self.$elem.css("width", self.options.constrainSize);
self.constheight = self.$elem.height();
}
if(self.options.zoomType == "inner"){
self.zoomWrap.parent().css("height", self.constheight);
self.zoomWrap.parent().css("width", self.options.constrainSize);
self.zoomWindow.css("height", self.constheight);
self.zoomWindow.css("width", self.options.constrainSize);
}
if(self.options.tint){
self.tintContainer.css("height", self.constheight);
self.tintContainer.css("width", self.options.constrainSize);
self.zoomTint.css("height", self.constheight);
self.zoomTint.css("width", self.options.constrainSize);
self.zoomTintImage.css("height", self.constheight);
self.zoomTintImage.css("width", self.options.constrainSize);
}
}
}
},
doneCallback: function(){
var self = this;
if(self.options.loadingIcon){
self.spinner.hide();
}
self.nzOffset = self.$elem.offset();
self.nzWidth = self.$elem.width();
self.nzHeight = self.$elem.height();
// reset the zoomlevel back to default
self.currentZoomLevel = self.options.zoomLevel;
//ratio of the large to small image
self.widthRatio = self.largeWidth / self.nzWidth;
self.heightRatio = self.largeHeight / self.nzHeight;
//NEED TO ADD THE LENS SIZE FOR ROUND
// adjust images less than the window height
if(self.options.zoomType == "window") {
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
lensHeight = self.nzHeight;
}
else{
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
}
if(self.options.zoomWindowWidth < self.options.zoomWindowWidth){
lensWidth = self.nzWidth;
}
else{
lensWidth = (self.options.zoomWindowWidth/self.widthRatio);
}
if(self.zoomLens){
self.zoomLens.css('width', lensWidth);
self.zoomLens.css('height', lensHeight);
}
}
},
getCurrentImage: function(){
var self = this;
return self.zoomImage;
},
getGalleryList: function(){
var self = this;
//loop through the gallery options and set them in list for fancybox
self.gallerylist = [];
if (self.options.gallery){
$('#'+self.options.gallery + ' a').each(function() {
var img_src = '';
if($(this).data("zoom-image")){
img_src = $(this).data("zoom-image");
}
else if($(this).data("image")){
img_src = $(this).data("image");
}
//put the current image at the start
if(img_src == self.zoomImage){
self.gallerylist.unshift({
href: ''+img_src+'',
title: $(this).find('img').attr("title")
});
}
else{
self.gallerylist.push({
href: ''+img_src+'',
title: $(this).find('img').attr("title")
});
}
});
}
//if no gallery - return current image
else{
self.gallerylist.push({
href: ''+self.zoomImage+'',
title: $(this).find('img').attr("title")
});
}
return self.gallerylist;
},
changeZoomLevel: function(value){
var self = this;
//flag a zoom, so can adjust the easing during setPosition
self.scrollingLock = true;
//round to two decimal places
self.newvalue = parseFloat(value).toFixed(2);
newvalue = parseFloat(value).toFixed(2);
//maxwidth & Maxheight of the image
maxheightnewvalue = self.largeHeight/((self.options.zoomWindowHeight / self.nzHeight) * self.nzHeight);
maxwidthtnewvalue = self.largeWidth/((self.options.zoomWindowWidth / self.nzWidth) * self.nzWidth);
//calculate new heightratio
if(self.options.zoomType != "inner")
{
if(maxheightnewvalue <= newvalue){
self.heightRatio = (self.largeHeight/maxheightnewvalue) / self.nzHeight;
self.newvalueheight = maxheightnewvalue;
self.fullheight = true;
}
else{
self.heightRatio = (self.largeHeight/newvalue) / self.nzHeight;
self.newvalueheight = newvalue;
self.fullheight = false;
}
// calculate new width ratio
if(maxwidthtnewvalue <= newvalue){
self.widthRatio = (self.largeWidth/maxwidthtnewvalue) / self.nzWidth;
self.newvaluewidth = maxwidthtnewvalue;
self.fullwidth = true;
}
else{
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
self.newvaluewidth = newvalue;
self.fullwidth = false;
}
if(self.options.zoomType == "lens"){
if(maxheightnewvalue <= newvalue){
self.fullwidth = true;
self.newvaluewidth = maxheightnewvalue;
} else{
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
self.newvaluewidth = newvalue;
self.fullwidth = false;
}}
}
if(self.options.zoomType == "inner")
{
maxheightnewvalue = parseFloat(self.largeHeight/self.nzHeight).toFixed(2);
maxwidthtnewvalue = parseFloat(self.largeWidth/self.nzWidth).toFixed(2);
if(newvalue > maxheightnewvalue){
newvalue = maxheightnewvalue;
}
if(newvalue > maxwidthtnewvalue){
newvalue = maxwidthtnewvalue;
}
if(maxheightnewvalue <= newvalue){
self.heightRatio = (self.largeHeight/newvalue) / self.nzHeight;
if(newvalue > maxheightnewvalue){
self.newvalueheight = maxheightnewvalue;
}else{
self.newvalueheight = newvalue;
}
self.fullheight = true;
}
else{
self.heightRatio = (self.largeHeight/newvalue) / self.nzHeight;
if(newvalue > maxheightnewvalue){
self.newvalueheight = maxheightnewvalue;
}else{
self.newvalueheight = newvalue;
}
self.fullheight = false;
}
if(maxwidthtnewvalue <= newvalue){
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
if(newvalue > maxwidthtnewvalue){
self.newvaluewidth = maxwidthtnewvalue;
}else{
self.newvaluewidth = newvalue;
}
self.fullwidth = true;
}
else{
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
self.newvaluewidth = newvalue;
self.fullwidth = false;
}
} //end inner
scrcontinue = false;
if(self.options.zoomType == "inner"){
if(self.nzWidth >= self.nzHeight){
if( self.newvaluewidth <= maxwidthtnewvalue){
scrcontinue = true;
}
else{
scrcontinue = false;
self.fullheight = true;
self.fullwidth = true;
}
}
if(self.nzHeight > self.nzWidth){
if( self.newvaluewidth <= maxwidthtnewvalue){
scrcontinue = true;
}
else{
scrcontinue = false;
self.fullheight = true;
self.fullwidth = true;
}
}
}
if(self.options.zoomType != "inner"){
scrcontinue = true;
}
if(scrcontinue){
self.zoomLock = 0;
self.changeZoom = true;
//if lens height is less than image height
if(((self.options.zoomWindowHeight)/self.heightRatio) <= self.nzHeight){
self.currentZoomLevel = self.newvalueheight;
if(self.options.zoomType != "lens" && self.options.zoomType != "inner") {
self.changeBgSize = true;
self.zoomLens.css({height: String((self.options.zoomWindowHeight)/self.heightRatio) + 'px' })
}
if(self.options.zoomType == "lens" || self.options.zoomType == "inner") {
self.changeBgSize = true;
}
}
if((self.options.zoomWindowWidth/self.widthRatio) <= self.nzWidth){
if(self.options.zoomType != "inner"){
if(self.newvaluewidth > self.newvalueheight) {
self.currentZoomLevel = self.newvaluewidth;
}
}
if(self.options.zoomType != "lens" && self.options.zoomType != "inner") {
self.changeBgSize = true;
self.zoomLens.css({width: String((self.options.zoomWindowWidth)/self.widthRatio) + 'px' })
}
if(self.options.zoomType == "lens" || self.options.zoomType == "inner") {
self.changeBgSize = true;
}
}
if(self.options.zoomType == "inner"){
self.changeBgSize = true;
if(self.nzWidth > self.nzHeight){
self.currentZoomLevel = self.newvaluewidth;
}
if(self.nzHeight > self.nzWidth){
self.currentZoomLevel = self.newvaluewidth;
}
}
} //under
//sets the boundry change, called in setWindowPos
self.setPosition(self.currentLoc);
//
},
closeAll: function(){
if(self.zoomWindow){self.zoomWindow.hide();}
if(self.zoomLens){self.zoomLens.hide();}
if(self.zoomTint){self.zoomTint.hide();}
},
changeState: function(value){
var self = this;
if(value == 'enable'){self.options.zoomEnabled = true;}
if(value == 'disable'){self.options.zoomEnabled = false;}
}
};
$.fn.elevateZoom = function( options ) {
return this.each(function() {
var elevate = Object.create( ElevateZoom );
elevate.init( options, this );
$.data( this, 'elevateZoom', elevate );
});
};
$.fn.elevateZoom.options = {
zoomActivation: "hover", // Can also be click (PLACEHOLDER FOR NEXT VERSION)
zoomEnabled: true, //false disables zoomwindow from showing
preloading: 1, //by default, load all the images, if 0, then only load images after activated (PLACEHOLDER FOR NEXT VERSION)
zoomLevel: 1, //default zoom level of image
scrollZoom: false, //allow zoom on mousewheel, true to activate
scrollZoomIncrement: 0.1, //steps of the scrollzoom
minZoomLevel: false,
maxZoomLevel: false,
easing: false,
easingAmount: 12,
lensSize: 200,
zoomWindowWidth: 400,
zoomWindowHeight: 400,
zoomWindowOffetx: 0,
zoomWindowOffety: 0,
zoomWindowPosition: 1,
zoomWindowBgColour: "#fff",
lensFadeIn: false,
lensFadeOut: false,
debug: false,
zoomWindowFadeIn: false,
zoomWindowFadeOut: false,
zoomWindowAlwaysShow: false,
zoomTintFadeIn: false,
zoomTintFadeOut: false,
borderSize: 4,
showLens: true,
borderColour: "#888",
lensBorderSize: 1,
lensBorderColour: "#000",
lensShape: "square", //can be "round"
zoomType: "window", //window is default, also "lens" available -
containLensZoom: false,
lensColour: "white", //colour of the lens background
lensOpacity: 0.4, //opacity of the lens
lenszoom: false,
tint: false, //enable the tinting
tintColour: "#333", //default tint color, can be anything, red, #ccc, rgb(0,0,0)
tintOpacity: 0.4, //opacity of the tint
gallery: false,
galleryActiveClass: "zoomGalleryActive",
imageCrossfade: false,
constrainType: false, //width or height
constrainSize: false, //in pixels the dimensions you want to constrain on
loadingIcon: false, //http://www.example.com/spinner.gif
cursor:"default", // user should set to what they want the cursor as, if they have set a click function
responsive:true,
onComplete: $.noop,
onDestroy: function() {},
onZoomedImageLoaded: function() {},
onImageSwap: $.noop,
onImageSwapComplete: $.noop
};
})( jQuery, window, document );
// source --> https://www.oka-ken.co.jp/tennis/wp-content/themes/amore_tcd028/parallax.js
/*!
* parallax.js v1.4.2 (http://pixelcog.github.io/parallax.js/)
* @copyright 2016 PixelCog, Inc.
* @license MIT (https://github.com/pixelcog/parallax.js/blob/master/LICENSE)
*/
;(function ( $, window, document, undefined ) {
// Polyfill for requestAnimationFrame
// via: https://gist.github.com/paulirish/1579671
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}());
// Parallax Constructor
function Parallax(element, options) {
var self = this;
if (typeof options == 'object') {
delete options.refresh;
delete options.render;
$.extend(this, options);
}
this.$element = $(element);
if (!this.imageSrc && this.$element.is('img')) {
this.imageSrc = this.$element.attr('src');
}
var positions = (this.position + '').toLowerCase().match(/\S+/g) || [];
if (positions.length < 1) {
positions.push('center');
}
if (positions.length == 1) {
positions.push(positions[0]);
}
if (positions[0] == 'top' || positions[0] == 'bottom' || positions[1] == 'left' || positions[1] == 'right') {
positions = [positions[1], positions[0]];
}
if (this.positionX != undefined) positions[0] = this.positionX.toLowerCase();
if (this.positionY != undefined) positions[1] = this.positionY.toLowerCase();
self.positionX = positions[0];
self.positionY = positions[1];
if (this.positionX != 'left' && this.positionX != 'right') {
if (isNaN(parseInt(this.positionX))) {
this.positionX = 'center';
} else {
this.positionX = parseInt(this.positionX);
}
}
if (this.positionY != 'top' && this.positionY != 'bottom') {
if (isNaN(parseInt(this.positionY))) {
this.positionY = 'center';
} else {
this.positionY = parseInt(this.positionY);
}
}
this.position =
this.positionX + (isNaN(this.positionX)? '' : 'px') + ' ' +
this.positionY + (isNaN(this.positionY)? '' : 'px');
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
if (this.imageSrc && this.iosFix && !this.$element.is('img')) {
this.$element.css({
backgroundImage: 'url(' + this.imageSrc + ')',
backgroundSize: 'cover',
backgroundPosition: this.position
});
}
return this;
}
if (navigator.userAgent.match(/(Android)/)) {
if (this.imageSrc && this.androidFix && !this.$element.is('img')) {
this.$element.css({
backgroundImage: 'url(' + this.imageSrc + ')',
backgroundSize: 'cover',
backgroundPosition: this.position
});
}
return this;
}
this.$mirror = $('').prependTo('body');
var slider = this.$element.find('>.parallax-slider');
var sliderExisted = false;
if (slider.length == 0)
this.$slider = $('').prependTo(this.$mirror);
else {
this.$slider = slider.prependTo(this.$mirror)
sliderExisted = true;
}
this.$mirror.addClass('parallax-mirror').css({
visibility: 'hidden',
zIndex: this.zIndex,
position: 'fixed',
top: 0,
left: 0,
overflow: 'hidden',
}).attr('data-order', this.$element.attr('data-order'));
this.$slider.addClass('parallax-slider').one('load', function() {
if (!self.naturalHeight || !self.naturalWidth) {
self.naturalHeight = this.naturalHeight || this.height || 1;
self.naturalWidth = this.naturalWidth || this.width || 1;
}
self.aspectRatio = self.naturalWidth / self.naturalHeight;
Parallax.isSetup || Parallax.setup();
Parallax.sliders.push(self);
Parallax.isFresh = false;
Parallax.requestRender();
});
if (!sliderExisted)
this.$slider[0].src = this.imageSrc;
if (this.naturalHeight && this.naturalWidth || this.$slider[0].complete || slider.length > 0) {
this.$slider.trigger('load');
}
};
// Parallax Instance Methods
$.extend(Parallax.prototype, {
speed: 0.2,
bleed: 0,
zIndex: -100,
iosFix: true,
androidFix: true,
position: 'center',
overScrollFix: false,
refresh: function() {
this.boxWidth = this.$element.outerWidth();
this.boxHeight = this.$element.outerHeight() + this.bleed * 2;
this.boxOffsetTop = this.$element.offset().top - this.bleed;
this.boxOffsetLeft = this.$element.offset().left;
this.boxOffsetBottom = this.boxOffsetTop + this.boxHeight;
var winHeight = Parallax.winHeight;
var docHeight = Parallax.docHeight;
var maxOffset = Math.min(this.boxOffsetTop, docHeight - winHeight);
var minOffset = Math.max(this.boxOffsetTop + this.boxHeight - winHeight, 0);
var imageHeightMin = this.boxHeight + (maxOffset - minOffset) * (1 - this.speed) | 0;
var imageOffsetMin = (this.boxOffsetTop - maxOffset) * (1 - this.speed) | 0;
if (imageHeightMin * this.aspectRatio >= this.boxWidth) {
this.imageWidth = imageHeightMin * this.aspectRatio | 0;
this.imageHeight = imageHeightMin;
this.offsetBaseTop = imageOffsetMin;
var margin = this.imageWidth - this.boxWidth;
if (this.positionX == 'left') {
this.offsetLeft = 0;
} else if (this.positionX == 'right') {
this.offsetLeft = - margin;
} else if (!isNaN(this.positionX)) {
this.offsetLeft = Math.max(this.positionX, - margin);
} else {
this.offsetLeft = - margin / 2 | 0;
}
} else {
this.imageWidth = this.boxWidth;
this.imageHeight = this.boxWidth / this.aspectRatio | 0;
this.offsetLeft = 0;
var margin = this.imageHeight - imageHeightMin;
if (this.positionY == 'top') {
this.offsetBaseTop = imageOffsetMin;
} else if (this.positionY == 'bottom') {
this.offsetBaseTop = imageOffsetMin - margin;
} else if (!isNaN(this.positionY)) {
this.offsetBaseTop = imageOffsetMin + Math.max(this.positionY, - margin);
} else {
this.offsetBaseTop = imageOffsetMin - margin / 2 | 0;
}
}
},
render: function() {
var scrollTop = Parallax.scrollTop;
var scrollLeft = Parallax.scrollLeft;
var overScroll = this.overScrollFix ? Parallax.overScroll : 0;
var scrollBottom = scrollTop + Parallax.winHeight;
if (this.boxOffsetBottom > scrollTop && this.boxOffsetTop <= scrollBottom) {
this.visibility = 'visible';
this.mirrorTop = this.boxOffsetTop - scrollTop;
this.mirrorLeft = this.boxOffsetLeft - scrollLeft;
this.offsetTop = this.offsetBaseTop - this.mirrorTop * (1 - this.speed);
} else {
this.visibility = 'hidden';
}
this.$mirror.css({
transform: 'translate3d(0px, 0px, 0px)',
visibility: this.visibility,
top: this.mirrorTop - overScroll,
left: this.mirrorLeft,
height: this.boxHeight,
width: this.boxWidth
});
this.$slider.css({
transform: 'translate3d(0px, 0px, 0px)',
position: 'absolute',
top: this.offsetTop,
left: this.offsetLeft,
height: this.imageHeight,
width: this.imageWidth,
maxWidth: 'none'
});
}
});
// Parallax Static Methods
$.extend(Parallax, {
scrollTop: 0,
scrollLeft: 0,
winHeight: 0,
winWidth: 0,
docHeight: 1 << 30,
docWidth: 1 << 30,
sliders: [],
isReady: false,
isFresh: false,
isBusy: false,
setup: function() {
if (this.isReady) return;
var $doc = jQuery(document), $win = jQuery(window);
var loadDimensions = function() {
Parallax.winHeight = $win.height();
Parallax.winWidth = $win.width();
Parallax.docHeight = $doc.height();
Parallax.docWidth = $doc.width();
};
var loadScrollPosition = function() {
var winScrollTop = $win.scrollTop();
var scrollTopMax = Parallax.docHeight - Parallax.winHeight;
var scrollLeftMax = Parallax.docWidth - Parallax.winWidth;
Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, winScrollTop));
Parallax.scrollLeft = Math.max(0, Math.min(scrollLeftMax, $win.scrollLeft()));
Parallax.overScroll = Math.max(winScrollTop - scrollTopMax, Math.min(winScrollTop, 0));
};
$win.on('resize.px.parallax load.px.parallax', function() {
loadDimensions();
Parallax.isFresh = false;
Parallax.requestRender();
})
.on('scroll.px.parallax load.px.parallax', function() {
loadScrollPosition();
Parallax.requestRender();
});
loadDimensions();
loadScrollPosition();
jQuery(window).load(function(){
setInterval(function(){
loadDimensions();
Parallax.isFresh = false;
Parallax.requestRender();
}, 300)
})
this.isReady = true;
},
configure: function(options) {
if (typeof options == 'object') {
delete options.refresh;
delete options.render;
$.extend(this.prototype, options);
}
},
refresh: function() {
$.each(this.sliders, function(){ this.refresh() });
this.isFresh = true;
},
render: function() {
this.isFresh || this.refresh();
$.each(this.sliders, function(){ this.render() });
},
requestRender: function() {
var self = this;
if (!this.isBusy) {
this.isBusy = true;
window.requestAnimationFrame(function() {
self.render();
self.isBusy = false;
});
}
},
destroy: function(el){
var i,
parallaxElement = $(el).data('px.parallax');
parallaxElement.$mirror.remove();
for(i=0; i < this.sliders.length; i+=1){
if(this.sliders[i] == parallaxElement){
this.sliders.splice(i, 1);
}
}
$(el).data('px.parallax', false);
if(this.sliders.length === 0){
$(window).off('scroll.px.parallax resize.px.parallax load.px.parallax');
this.isReady = false;
Parallax.isSetup = false;
}
}
});
// Parallax Plugin Definition
function Plugin(option) {
return this.each(function () {
var $this = $(this);
var options = typeof option == 'object' && option;
if (this == window || this == document || $this.is('body')) {
Parallax.configure(options);
}
else if (!$this.data('px.parallax')) {
options = $.extend({}, $this.data(), options);
$this.data('px.parallax', new Parallax(this, options));
}
else if (typeof option == 'object')
{
$.extend($this.data('px.parallax'), options);
}
if (typeof option == 'string') {
if(option == 'destroy'){
Parallax['destroy'](this);
}else{
Parallax[option]();
}
}
})
};
var old = $.fn.parallax;
$.fn.parallax = Plugin;
$.fn.parallax.Constructor = Parallax;
// Parallax No Conflict
$.fn.parallax.noConflict = function () {
$.fn.parallax = old;
return this;
};
// Parallax Data-API
$(document).on('ready.px.parallax.data-api', function () {
$('[data-parallax="scroll"]').parallax();
});
}(jQuery, window, document));
// source --> https://www.oka-ken.co.jp/tennis/wp-content/themes/amore_tcd028/js/jscript.js
jQuery(document).ready(function($){
$(".parent_category > a").on('click',function() {
if($(this).hasClass("active")) {
$(this).removeClass("active");
$(this).next().hide();
return false;
} else {
$(this).addClass("active");
$(this).next().show();
return false;
};
});
$("a").bind("focus",function(){if(this.blur)this.blur();});
$("a.target_blank").attr("target","_blank");
$(".styled_post_list1 > li:last-child").addClass("last");
$('.footer_widget:nth-child(3n)').addClass('right_widget');
$('#global_menu > ul > li:nth-child(9)').addClass('hide_menu');
$('#global_menu > ul > li:nth-child(10)').addClass('hide_menu');
$('#global_menu > ul > li:nth-child(11)').addClass('hide_menu');
$('#global_menu > ul > li:nth-child(12)').addClass('hide_menu');
jQuery.easing.easeOutExpo = function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
};
var topBtn = $('#return_top');
topBtn.hide();
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
topBtn.fadeIn();
} else {
topBtn.fadeOut();
}
});
topBtn.click(function () {
$('body,html').animate({
scrollTop: 0
}, 1000, 'easeOutExpo');
return false;
});
$("#comment_area ol > li:even").addClass("even_comment");
$("#comment_area ol > li:odd").addClass("odd_comment");
$(".even_comment > .children > li").addClass("even_comment_children");
$(".odd_comment > .children > li").addClass("odd_comment_children");
$(".even_comment_children > .children > li").addClass("odd_comment_children");
$(".odd_comment_children > .children > li").addClass("even_comment_children");
$(".even_comment_children > .children > li").addClass("odd_comment_children");
$(".odd_comment_children > .children > li").addClass("even_comment_children");
$("#trackback_switch").click(function(){
$("#comment_switch").removeClass("comment_switch_active");
$(this).addClass("comment_switch_active");
$("#comment_area").animate({opacity: 'hide'}, 0);
$("#trackback_area").animate({opacity: 'show'}, 1000);
return false;
});
$("#comment_switch").click(function(){
$("#trackback_switch").removeClass("comment_switch_active");
$(this).addClass("comment_switch_active");
$("#trackback_area").animate({opacity: 'hide'}, 0);
$("#comment_area").animate({opacity: 'show'}, 1000);
return false;
});
$("#index_post_list_tab a").click(function() {
$("#index_post_list_tab a").removeClass('active');
$(this).addClass("active");
return false;
});
$("#index_post_list_tab > li:first-child a").addClass("active");
var index_post_list1 = $('#index_post_list1');
var index_post_list2 = $('#index_post_list2');
var index_post_list3 = $('#index_post_list3');
var index_post_list_button1 = $('#index_post_list_button1 a');
var index_post_list_button2 = $('#index_post_list_button2 a');
var index_post_list_button3 = $('#index_post_list_button3 a');
$('.index_post_list').hide();
$('#index_post_list_wrap .index_post_list:first-child').show();
index_post_list_button1.click(function () {
index_post_list1.show();
index_post_list2.hide();
index_post_list3.hide();
});
index_post_list_button2.click(function () {
index_post_list2.show();
index_post_list1.hide();
index_post_list3.hide();
});
index_post_list_button3.click(function () {
index_post_list3.show();
index_post_list1.hide();
index_post_list2.hide();
});
function mediaQueryClass(width) {
if (width > 991) { //PC
$("html").removeClass("mobile");
$("html").addClass("pc");
$(".menu_button").css("display","none");
$("#global_menu").show();
$("#global_menu li").hover(function(){
$(">ul:not(:animated)",this).slideDown("fast");
$(this).addClass("active");
}, function(){
$(">ul",this).slideUp("fast");
$(this).removeClass("active");
});
} else { //�X�}�z
$("html").removeClass("pc");
$("html").addClass("mobile");
$("#global_menu li").off('hover');
$("#global_menu ul ul").removeAttr('style');
$(".menu_button").css("display", "block");
$('.menu_button').off('click');
$(".menu_button").on('click',function() {
if($(this).hasClass("active")) {
$(this).removeClass("active");
$('#global_menu').hide();
return false;
} else {
$(this).addClass("active");
$('#global_menu').show();
return false;
};
});
$(".child_menu_button").remove();
$('#global_menu li > ul').parent().prepend("");
$("#global_menu .child_menu_button").on('click',function() {
if($(this).parent().hasClass("open")) {
$(this).parent().removeClass("open");
return false;
} else {
$(this).parent().addClass("open");
return false;
};
});
$("#global_menu li.menu-item-has-children a").hover(function(){
$(this).prev().addClass("active");
}, function(){
$(this).prev().removeClass("active");
});
};
};
function viewport() {
var e = window, a = 'inner';
if (!('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
}
var ww = viewport().width;
var timer = false;
mediaQueryClass(ww);
$(window).bind("resize orientationchange", function() {
if (timer !== false) {
clearTimeout(timer);
}
timer = setTimeout(function() {
var ww = viewport().width;
mediaQueryClass(ww);
}, 200);
})
});