eliminando js
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,218 +0,0 @@
|
||||
var FunctionList = function() {
|
||||
this._always = [];
|
||||
this._stack = [];
|
||||
}
|
||||
|
||||
FunctionList.prototype.add = function(f) {
|
||||
if (!f || !(f instanceof Function)) return;
|
||||
this._stack.push(f);
|
||||
}
|
||||
FunctionList.prototype.call = function() {
|
||||
for (var i = 0; i < this._always.length; i++) {
|
||||
this._always[i]();
|
||||
}
|
||||
for (var i = 0; i < this._stack.length; i++) {
|
||||
this._stack[i]();
|
||||
}
|
||||
}
|
||||
FunctionList.prototype.always = function(f) {
|
||||
if (!f || !(f instanceof Function)) return;
|
||||
this._always.push(f);
|
||||
}
|
||||
FunctionList.prototype.clear = function() {
|
||||
this._stack.length = 0;
|
||||
}
|
||||
|
||||
window.__main = new FunctionList();
|
||||
|
||||
/******/
|
||||
|
||||
function removeEventListeners(el) {
|
||||
elClone = el.cloneNode(true);
|
||||
el.parentNode.replaceChild(elClone, el);
|
||||
return elClone;
|
||||
}
|
||||
var _blacklist = ['tel', '#', 'mailto', 'javascript'];
|
||||
var firstTime = true;
|
||||
var TRANSITION_DURATION = 0.4;
|
||||
|
||||
function bindLinks() {
|
||||
if (!firstTime) {
|
||||
$(window).off('scroll');
|
||||
$(document).unbind('click');
|
||||
}
|
||||
var _links = document.querySelectorAll('a');
|
||||
Array.from(_links).forEach(function(link) {
|
||||
if (!firstTime) {
|
||||
link = removeEventListeners(link);
|
||||
}
|
||||
if (validLink(link)) {
|
||||
link.removeEventListener('click', bindLink);
|
||||
link.addEventListener('click', bindLink);
|
||||
}
|
||||
});
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
}
|
||||
}
|
||||
|
||||
bindLinks();
|
||||
|
||||
function validLink(link) {
|
||||
var href = link.hash || link.getAttribute('href');
|
||||
if (!href) return false;
|
||||
var target = link.target || link.getAttribute('target');
|
||||
|
||||
for (var i = 0; i < _blacklist.length; i++) {
|
||||
if (href.startsWith(_blacklist[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (href.startsWith('http') && !href.includes(window.location.hostname) || target || link.getAttribute('data-rel')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function bindLink(e) {
|
||||
var menuObject = this;
|
||||
var href = this.hash || this.getAttribute('href');
|
||||
e.preventDefault();
|
||||
sendRequest(menuObject, href);
|
||||
}
|
||||
|
||||
function sendRequest(menuObject, href, fromPop) {
|
||||
|
||||
var mainTagAux = document.querySelector('main');
|
||||
if (mainTagAux) {
|
||||
mainTagAux.style.transition = 'all ' + TRANSITION_DURATION + 's';
|
||||
mainTagAux.style.opacity = 0;
|
||||
mainTagAux.style.transform = 'scale(0.9)';
|
||||
mainTagAux.style.transformOrigin = 'top center';
|
||||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', href, true);
|
||||
|
||||
if (typeof window.__main !== 'undefined') {
|
||||
window.__main.clear();
|
||||
}
|
||||
|
||||
request.onload = function() {
|
||||
if (request.status >= 200 && request.status < 400) {
|
||||
var data = request.responseText;
|
||||
var parser = new DOMParser();
|
||||
var doc = parser.parseFromString(data, 'text/html');
|
||||
var mainTag = doc.querySelector('main');
|
||||
var bodyTag = doc.querySelector('body');
|
||||
var titleTag = doc.querySelector('title');
|
||||
|
||||
if (titleTag) {
|
||||
document.title = titleTag.innerHTML;
|
||||
}
|
||||
|
||||
if (!mainTag) {
|
||||
window.location.href = href;
|
||||
return;
|
||||
}
|
||||
|
||||
var navbar = _checkIfLinkBelongsToMenu(menuObject);
|
||||
|
||||
if (navbar) {
|
||||
var active = navbar.querySelector('.active');
|
||||
if (active) active.classList.remove('active');
|
||||
menuObject.parentNode.classList.add('active');
|
||||
}
|
||||
|
||||
if (!fromPop) history.pushState({id: Date.now(), link: href}, null, href);
|
||||
|
||||
if (bodyTag) {
|
||||
document.body.classList = bodyTag.classList;
|
||||
}
|
||||
|
||||
var mainContainer = document.querySelector('main');
|
||||
if (mainContainer) {
|
||||
mainContainer.parentNode.replaceChild(mainTag, mainContainer);
|
||||
mainTag.setAttribute('style', mainContainer.getAttribute('style'));
|
||||
setTimeout(function() {
|
||||
mainTag.style.opacity = 1;
|
||||
mainTag.style.transform = 'scale(1)';
|
||||
setTimeout(function() {
|
||||
mainTag.removeAttribute('style');
|
||||
}, TRANSITION_DURATION*1000);
|
||||
}, 100);
|
||||
bindLinks();
|
||||
}
|
||||
|
||||
|
||||
if (typeof window.__main !== 'undefined') {
|
||||
var scripts = mainTag.querySelectorAll('script');
|
||||
if (scripts) {
|
||||
scripts.forEach(function(script) {
|
||||
if (!script.src) {
|
||||
window.__main.add(function() {
|
||||
eval(script.innerHTML);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
window.__main.call();
|
||||
}
|
||||
|
||||
var scripts = document.querySelectorAll('script[src]');
|
||||
if (scripts) {
|
||||
scripts.forEach(function(script) {
|
||||
var cloned = document.createElement('script');
|
||||
cloned.defer = script.defer;
|
||||
cloned.async = script.async;
|
||||
var cache = script.getAttribute('data-cache');
|
||||
if (cache !== null && cache !== undefined) {
|
||||
return true;
|
||||
}
|
||||
cloned.src = script.src.replace(/([?&]?)(t=)([\d]+)/, '');
|
||||
if (cloned.src.includes('?')) {
|
||||
cloned.src += '&t=' + Date.now();
|
||||
}else{
|
||||
cloned.src += '?t=' + Date.now();
|
||||
}
|
||||
var parent = script.parentNode;
|
||||
script.parentNode.removeChild(script);
|
||||
parent.appendChild(cloned);
|
||||
});
|
||||
}
|
||||
|
||||
window.scrollTo(0,0);
|
||||
var hamburger = document.querySelector('.navbar-toggle[aria-expanded="true"]');
|
||||
if (hamburger) hamburger.click();
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
request.onerror = function() {
|
||||
window.location.href = href;
|
||||
};
|
||||
|
||||
request.send();
|
||||
}
|
||||
|
||||
function _checkIfLinkBelongsToMenu(link) {
|
||||
if (!link) return false;
|
||||
var tag = link;
|
||||
while (tag && tag.tagName.toLowerCase() !== 'body') {
|
||||
tag = tag.parentNode;
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
window.addEventListener('popstate', function(e) {
|
||||
console.log(e);
|
||||
//window.location.reload();
|
||||
if (!e.state || !e.state.link){
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
sendRequest(null, e.state.link, true);
|
||||
});
|
||||
-1618
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
-2363
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Vendored
-7
File diff suppressed because one or more lines are too long
@@ -1,280 +0,0 @@
|
||||
class Cesta {
|
||||
/**
|
||||
* Returns the object from local storage
|
||||
*/
|
||||
static getFromLocalStorage() {
|
||||
if (!localStorage.getItem('cesta')) localStorage.setItem('cesta', '{}');
|
||||
return JSON.parse(localStorage.getItem('cesta'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds 1 unit of the product
|
||||
* @param productID
|
||||
* @param varID
|
||||
*/
|
||||
static add(productID, varID = 0, showAlert = false) {
|
||||
const products = Cesta.getFromLocalStorage();
|
||||
if (products[productID]) {
|
||||
if (products[productID][varID]) {
|
||||
products[productID][varID]++;
|
||||
}
|
||||
else {
|
||||
products[productID][varID] = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
products[productID] = {};
|
||||
products[productID][varID] = 1;
|
||||
}
|
||||
Cesta.save(products);
|
||||
Cesta.updateBadge();
|
||||
if (showAlert) {
|
||||
swal(TEXTOS_CESTA.productoAnadido, TEXTOS_CESTA.textoProductoAnadido, 'success',{
|
||||
buttons: {
|
||||
cancel: TEXTOS_CESTA.cancel,
|
||||
ok: {
|
||||
text: TEXTOS_CESTA.ok,
|
||||
value: 'ok'
|
||||
}
|
||||
}
|
||||
})
|
||||
.then((value) => {
|
||||
if (value === 'ok') {
|
||||
window.location.href = ENLACE_CESTA;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Substracts 1 unit of the product
|
||||
* @param productID
|
||||
*/
|
||||
static substract(productID) {
|
||||
const products = Cesta.getFromLocalStorage();
|
||||
if (products[productID]) {
|
||||
products[productID].quantity--;
|
||||
if (products[productID].quantity === 0) {
|
||||
delete products[productID];
|
||||
}
|
||||
}
|
||||
Cesta.save(products);
|
||||
Cesta.updateBadge();
|
||||
}
|
||||
|
||||
static setQuantity(productID, varID = 0, quantity = 1) {
|
||||
let products = Cesta.getFromLocalStorage();
|
||||
if (!products[productID] || !products[productID][varID]) {
|
||||
Cesta.add(productID, varID, false);
|
||||
products = Cesta.getFromLocalStorage();
|
||||
}
|
||||
products[productID][varID] = Math.max(quantity, 1);
|
||||
Cesta.save(products);
|
||||
Cesta.updateBadge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a product from the basket
|
||||
* @param productID
|
||||
*/
|
||||
static remove(productID) {
|
||||
const products = Cesta.getFromLocalStorage();
|
||||
delete products[productID];
|
||||
console.log(productID, products);
|
||||
Cesta.save(products);
|
||||
Cesta.updateBadge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the basket
|
||||
*/
|
||||
static clear() {
|
||||
Cesta.save({});
|
||||
Cesta.updateBadge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the new object to the local storage
|
||||
* @param products
|
||||
*/
|
||||
static save(products) {
|
||||
localStorage.setItem('cesta', JSON.stringify(products));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a promise with the products from the server
|
||||
*/
|
||||
static getProducts(sessID = '') {
|
||||
const timestamp = (new Date()).getTime();
|
||||
const products = Cesta.getFromLocalStorage();
|
||||
let gastosDeEnvio = document.querySelector('select[name=gastos_de_envio]');
|
||||
if (gastosDeEnvio) {
|
||||
gastosDeEnvio = gastosDeEnvio.value;
|
||||
}
|
||||
else {
|
||||
gastosDeEnvio = 0;
|
||||
}
|
||||
|
||||
let codigoDescuento = document.querySelector('#cesta .descuento input');
|
||||
if (codigoDescuento) {
|
||||
codigoDescuento = codigoDescuento.value;
|
||||
}
|
||||
else {
|
||||
codigoDescuento = '';
|
||||
}
|
||||
|
||||
return fetch(`${RUTA_RAIZ}/cesta.php?getProducts=1&cesta=${JSON.stringify(products)}&gastos=${gastosDeEnvio}&codigo=${codigoDescuento}×tamp=${timestamp}&sessID=${sessID}`)
|
||||
.then((data) => {
|
||||
return data.json();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks for all the "Añadir a la cesta" buttons and bind them to add a product
|
||||
*/
|
||||
static bindNodes() {
|
||||
const nodes = document.querySelectorAll('.add-to-basket');
|
||||
if (nodes) {
|
||||
nodes.forEach(function(node) {
|
||||
node.removeEventListener('click', Cesta.bindNode);
|
||||
node.addEventListener('click', Cesta.bindNode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static bindNode(e) {
|
||||
const node = this;
|
||||
const productID = parseInt(node.getAttribute('data-producto'));
|
||||
const varID = parseInt(node.getAttribute('data-variacion'));
|
||||
Cesta.add(productID, varID, true);
|
||||
}
|
||||
|
||||
static updateBadge() {
|
||||
let count = 0;
|
||||
const products = Cesta.getFromLocalStorage();
|
||||
for (const key in products) {
|
||||
for (const v in products[key]) {
|
||||
count += products[key][v];
|
||||
}
|
||||
}
|
||||
let badges = document.querySelectorAll('.cesta-count');
|
||||
if (badges) {
|
||||
badges.forEach(function(badge) {
|
||||
badge.innerHTML = `(${count})`;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Favorites {
|
||||
static getFromLocalStorage() {
|
||||
if (!localStorage.getItem('favoritos')) localStorage.setItem('favoritos', '{}');
|
||||
return JSON.parse(localStorage.getItem('favoritos'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the new object to the local storage
|
||||
* @param products
|
||||
*/
|
||||
static save(products) {
|
||||
localStorage.setItem('favoritos', JSON.stringify(products));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds or removes from the local storage
|
||||
*/
|
||||
static toggle(productID, node = null) {
|
||||
const products = Favorites.getFromLocalStorage();
|
||||
if (products[productID]) {
|
||||
delete products[productID];
|
||||
Favorites.changeClass(node, false);
|
||||
}
|
||||
else {
|
||||
products[productID] = true;
|
||||
Favorites.changeClass(node, true);
|
||||
}
|
||||
Favorites.save(products);
|
||||
Favorites.updateBadge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the product is favorite or not
|
||||
*/
|
||||
static isFavorite(productID) {
|
||||
const products = Favorites.getFromLocalStorage();
|
||||
return products[productID] ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the class of all the buttons of the same product
|
||||
*/
|
||||
static changeClass(node, active = true) {
|
||||
if (!node) return;
|
||||
if (active) {
|
||||
node.classList.add('active');
|
||||
node.querySelector('i').classList.remove('fa-heart-o');
|
||||
node.querySelector('i').classList.add('fa-heart');
|
||||
}
|
||||
else {
|
||||
node.classList.remove('active');
|
||||
node.querySelector('i').classList.remove('fa-heart');
|
||||
node.querySelector('i').classList.add('fa-heart-o');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise with the products from the server
|
||||
*/
|
||||
static getProducts() {
|
||||
const products = Favorites.getFromLocalStorage();
|
||||
|
||||
return fetch(`${RUTA_RAIZ}/favoritos.php?getProducts=1&favoritos=${JSON.stringify(products)}`)
|
||||
.then((data) => {
|
||||
return data.json();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Looks for all the "Añadir a la cesta" buttons and bind them to add a product
|
||||
*/
|
||||
static bindNodes() {
|
||||
const nodes = document.querySelectorAll('.add-to-favorites');
|
||||
if (nodes) {
|
||||
nodes.forEach(function(node) {
|
||||
const productID = node.getAttribute('data-producto');
|
||||
Favorites.changeClass(node, Favorites.isFavorite(productID));
|
||||
node.removeEventListener('click', Favorites.bindNode);
|
||||
node.addEventListener('click', Favorites.bindNode);
|
||||
});
|
||||
}
|
||||
Favorites.updateBadge();
|
||||
}
|
||||
|
||||
static bindNode(e) {
|
||||
let node = this;
|
||||
while (node && !node.classList.contains('add-to-favorites')) {
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
if (!node) return;
|
||||
|
||||
const productID = parseInt(node.getAttribute('data-producto'));
|
||||
Favorites.toggle(productID, node);
|
||||
}
|
||||
|
||||
static updateBadge() {
|
||||
let count = 0;
|
||||
const products = Favorites.getFromLocalStorage();
|
||||
for (const key in products) {
|
||||
count++;
|
||||
}
|
||||
let badges = document.querySelectorAll('.favoritos-count');
|
||||
if (badges) {
|
||||
badges.forEach(function(badge) {
|
||||
badge.innerHTML = `(${count})`;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
/*
|
||||
* fadeSlideShow
|
||||
* v.2.2.0
|
||||
*
|
||||
* Copyright (c) 2010 Pascal Bajorat (http://www.pascal-bajorat.com)
|
||||
* Dual licensed under the MIT (below)
|
||||
* and GPL (http://www.gnu.org/licenses/gpl.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://plugins.jquery.com/project/fadeslideshow
|
||||
* http://www.pascal-bajorat.com
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013 Pascal Bajorat
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
jQuery.fn.fadeSlideShow = function(options) {
|
||||
return this.each(function(){
|
||||
settings = jQuery.extend({
|
||||
width: 640, // default width of the slideshow
|
||||
height: 480, // default height of the slideshow
|
||||
speed: 'slow', // default animation transition speed
|
||||
interval: 3000, // default interval between image change
|
||||
PlayPauseElement: 'fssPlayPause', // default css id for the play / pause element
|
||||
PlayText: 'Play', // default play text
|
||||
PauseText: 'Pause', // default pause text
|
||||
NextElement: 'fssNext', // default id for next button
|
||||
NextElementText: 'Next >', // default text for next button
|
||||
PrevElement: 'fssPrev', // default id for prev button
|
||||
PrevElementText: '< Prev', // default text for prev button
|
||||
ListElement: 'fssList', // default id for image / content controll list
|
||||
ListLi: 'fssLi', // default class for li's in the image / content controll
|
||||
ListLiActive: 'fssActive', // default class for active state in the controll list
|
||||
addListToId: false, // add the controll list to special id in your code - default false
|
||||
allowKeyboardCtrl: true, // allow keyboard controlls left / right / space
|
||||
autoplay: true // autoplay the slideshow
|
||||
}, options);
|
||||
|
||||
// set style for wrapper element
|
||||
jQuery(this).css({
|
||||
width: settings.width,
|
||||
height: settings.height,
|
||||
position: 'relative',
|
||||
overflow: 'hidden'
|
||||
});
|
||||
|
||||
// set styles for child element
|
||||
jQuery('> *',this).css({
|
||||
position: 'absolute',
|
||||
width: settings.width,
|
||||
height: settings.height
|
||||
});
|
||||
|
||||
// count number of slides
|
||||
var Slides = jQuery('> *', this).length;
|
||||
Slides = Slides - 1;
|
||||
var ActSlide = Slides;
|
||||
// Set jQuery Slide short var
|
||||
var jQslide = jQuery('> *', this);
|
||||
// save this
|
||||
var fssThis = this;
|
||||
var intval = false;
|
||||
var autoplay = function(){
|
||||
intval = setInterval(function(){
|
||||
jQslide.eq(ActSlide).fadeOut(settings.speed);
|
||||
|
||||
// if list is on change the active class
|
||||
if(settings.ListElement){
|
||||
var setActLi = (Slides - ActSlide) + 1;
|
||||
if(setActLi > Slides){setActLi=0;}
|
||||
jQuery('#'+settings.ListElement+' li').removeClass(settings.ListLiActive);
|
||||
jQuery('#'+settings.ListElement+' li').eq(setActLi).addClass(settings.ListLiActive);
|
||||
}
|
||||
|
||||
if(ActSlide <= 0){
|
||||
jQslide.fadeIn(settings.speed);
|
||||
ActSlide = Slides;
|
||||
}else{
|
||||
ActSlide = ActSlide - 1;
|
||||
}
|
||||
}, settings.interval);
|
||||
|
||||
if(settings.PlayPauseElement){
|
||||
jQuery('#'+settings.PlayPauseElement).html(settings.PauseText);
|
||||
}
|
||||
}
|
||||
|
||||
var stopAutoplay = function(){
|
||||
clearInterval(intval);
|
||||
intval = false;
|
||||
if(settings.PlayPauseElement){
|
||||
jQuery('#'+settings.PlayPauseElement).html(settings.PlayText);
|
||||
}
|
||||
}
|
||||
|
||||
var jumpTo = function(newIndex){
|
||||
if(newIndex < 0){newIndex = Slides;}
|
||||
else if(newIndex > Slides){newIndex = 0;}
|
||||
if( newIndex >= ActSlide ){
|
||||
jQuery('> *:lt('+(newIndex+1)+')', fssThis).fadeIn(settings.speed);
|
||||
}else if(newIndex <= ActSlide){
|
||||
jQuery('> *:gt('+newIndex+')', fssThis).fadeOut(settings.speed);
|
||||
}
|
||||
|
||||
// set the active slide
|
||||
ActSlide = newIndex;
|
||||
|
||||
if(settings.ListElement){
|
||||
// set active
|
||||
jQuery('#'+settings.ListElement+' li').removeClass(settings.ListLiActive);
|
||||
jQuery('#'+settings.ListElement+' li').eq((Slides-newIndex)).addClass(settings.ListLiActive);
|
||||
}
|
||||
}
|
||||
|
||||
// if list is on render it
|
||||
if(settings.ListElement){
|
||||
var i=0;
|
||||
var li = '';
|
||||
while(i<=Slides){
|
||||
if(i==0){
|
||||
li = li+'<li class="'+settings.ListLi+i+' '+settings.ListLiActive+'"><a href="#">'+(i+1)+'<\/a><\/li>';
|
||||
}else{
|
||||
li = li+'<li class="'+settings.ListLi+i+'"><a href="#">'+(i+1)+'<\/a><\/li>';
|
||||
}
|
||||
i++;
|
||||
}
|
||||
var List = '<ul id="'+settings.ListElement+'">'+li+'<\/ul>';
|
||||
|
||||
// add list to a special id or append after the slideshow
|
||||
if(settings.addListToId){
|
||||
jQuery('#'+settings.addListToId).append(List);
|
||||
}else{
|
||||
jQuery(this).after(List);
|
||||
}
|
||||
|
||||
jQuery('#'+settings.ListElement+' a').bind('click', function(){
|
||||
var index = jQuery('#'+settings.ListElement+' a').index(this);
|
||||
stopAutoplay();
|
||||
var ReverseIndex = Slides-index;
|
||||
|
||||
jumpTo(ReverseIndex);
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.PlayPauseElement){
|
||||
if(!jQuery('#'+settings.PlayPauseElement).css('display')){
|
||||
jQuery(this).after('<a href="#" id="'+settings.PlayPauseElement+'"><\/a>');
|
||||
}
|
||||
|
||||
if(settings.autoplay){
|
||||
jQuery('#'+settings.PlayPauseElement).html(settings.PauseText);
|
||||
}else{
|
||||
jQuery('#'+settings.PlayPauseElement).html(settings.PlayText);
|
||||
}
|
||||
|
||||
jQuery('#'+settings.PlayPauseElement).bind('click', function(){
|
||||
if(intval){
|
||||
stopAutoplay();
|
||||
}else{
|
||||
autoplay();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.NextElement){
|
||||
if(!jQuery('#'+settings.NextElement).css('display')){
|
||||
jQuery(this).after('<a href="#" id="'+settings.NextElement+'">'+settings.NextElementText+'<\/a>');
|
||||
}
|
||||
|
||||
jQuery('#'+settings.NextElement).bind('click', function(){
|
||||
nextSlide = ActSlide-1;
|
||||
stopAutoplay();
|
||||
jumpTo(nextSlide);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.PrevElement){
|
||||
if(!jQuery('#'+settings.PrevElement).css('display')){
|
||||
jQuery(this).after('<a href="#" id="'+settings.PrevElement+'">'+settings.PrevElementText+'<\/a>');
|
||||
}
|
||||
|
||||
jQuery('#'+settings.PrevElement).bind('click', function(){
|
||||
prevSlide = ActSlide+1;
|
||||
stopAutoplay();
|
||||
jumpTo(prevSlide);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.allowKeyboardCtrl){
|
||||
jQuery(document).bind('keydown', function(e){
|
||||
if(e.which==39){
|
||||
var nextSlide = ActSlide-1;
|
||||
stopAutoplay();
|
||||
jumpTo(nextSlide);
|
||||
}else if(e.which==37){
|
||||
var prevSlide = ActSlide+1;
|
||||
stopAutoplay();
|
||||
jumpTo(prevSlide);
|
||||
}else if(e.which==32){
|
||||
if(intval){stopAutoplay();}
|
||||
else{autoplay();}
|
||||
//return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// start autoplay or set it to false
|
||||
if(settings.autoplay){autoplay();}else{intval=false;}
|
||||
});
|
||||
};
|
||||
@@ -1,466 +0,0 @@
|
||||
(function(self) {
|
||||
'use strict';
|
||||
|
||||
if (self.fetch) {
|
||||
return
|
||||
}
|
||||
|
||||
var support = {
|
||||
searchParams: 'URLSearchParams' in self,
|
||||
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
||||
blob: 'FileReader' in self && 'Blob' in self && (function() {
|
||||
try {
|
||||
new Blob()
|
||||
return true
|
||||
} catch(e) {
|
||||
return false
|
||||
}
|
||||
})(),
|
||||
formData: 'FormData' in self,
|
||||
arrayBuffer: 'ArrayBuffer' in self
|
||||
}
|
||||
|
||||
if (support.arrayBuffer) {
|
||||
var viewClasses = [
|
||||
'[object Int8Array]',
|
||||
'[object Uint8Array]',
|
||||
'[object Uint8ClampedArray]',
|
||||
'[object Int16Array]',
|
||||
'[object Uint16Array]',
|
||||
'[object Int32Array]',
|
||||
'[object Uint32Array]',
|
||||
'[object Float32Array]',
|
||||
'[object Float64Array]'
|
||||
]
|
||||
|
||||
var isDataView = function(obj) {
|
||||
return obj && DataView.prototype.isPrototypeOf(obj)
|
||||
}
|
||||
|
||||
var isArrayBufferView = ArrayBuffer.isView || function(obj) {
|
||||
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeName(name) {
|
||||
if (typeof name !== 'string') {
|
||||
name = String(name)
|
||||
}
|
||||
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
|
||||
throw new TypeError('Invalid character in header field name')
|
||||
}
|
||||
return name.toLowerCase()
|
||||
}
|
||||
|
||||
function normalizeValue(value) {
|
||||
if (typeof value !== 'string') {
|
||||
value = String(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// Build a destructive iterator for the value list
|
||||
function iteratorFor(items) {
|
||||
var iterator = {
|
||||
next: function() {
|
||||
var value = items.shift()
|
||||
return {done: value === undefined, value: value}
|
||||
}
|
||||
}
|
||||
|
||||
if (support.iterable) {
|
||||
iterator[Symbol.iterator] = function() {
|
||||
return iterator
|
||||
}
|
||||
}
|
||||
|
||||
return iterator
|
||||
}
|
||||
|
||||
function Headers(headers) {
|
||||
this.map = {}
|
||||
|
||||
if (headers instanceof Headers) {
|
||||
headers.forEach(function(value, name) {
|
||||
this.append(name, value)
|
||||
}, this)
|
||||
} else if (Array.isArray(headers)) {
|
||||
headers.forEach(function(header) {
|
||||
this.append(header[0], header[1])
|
||||
}, this)
|
||||
} else if (headers) {
|
||||
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
||||
this.append(name, headers[name])
|
||||
}, this)
|
||||
}
|
||||
}
|
||||
|
||||
Headers.prototype.append = function(name, value) {
|
||||
name = normalizeName(name)
|
||||
value = normalizeValue(value)
|
||||
var oldValue = this.map[name]
|
||||
this.map[name] = oldValue ? oldValue+','+value : value
|
||||
}
|
||||
|
||||
Headers.prototype['delete'] = function(name) {
|
||||
delete this.map[normalizeName(name)]
|
||||
}
|
||||
|
||||
Headers.prototype.get = function(name) {
|
||||
name = normalizeName(name)
|
||||
return this.has(name) ? this.map[name] : null
|
||||
}
|
||||
|
||||
Headers.prototype.has = function(name) {
|
||||
return this.map.hasOwnProperty(normalizeName(name))
|
||||
}
|
||||
|
||||
Headers.prototype.set = function(name, value) {
|
||||
this.map[normalizeName(name)] = normalizeValue(value)
|
||||
}
|
||||
|
||||
Headers.prototype.forEach = function(callback, thisArg) {
|
||||
for (var name in this.map) {
|
||||
if (this.map.hasOwnProperty(name)) {
|
||||
callback.call(thisArg, this.map[name], name, this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Headers.prototype.keys = function() {
|
||||
var items = []
|
||||
this.forEach(function(value, name) { items.push(name) })
|
||||
return iteratorFor(items)
|
||||
}
|
||||
|
||||
Headers.prototype.values = function() {
|
||||
var items = []
|
||||
this.forEach(function(value) { items.push(value) })
|
||||
return iteratorFor(items)
|
||||
}
|
||||
|
||||
Headers.prototype.entries = function() {
|
||||
var items = []
|
||||
this.forEach(function(value, name) { items.push([name, value]) })
|
||||
return iteratorFor(items)
|
||||
}
|
||||
|
||||
if (support.iterable) {
|
||||
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
|
||||
}
|
||||
|
||||
function consumed(body) {
|
||||
if (body.bodyUsed) {
|
||||
return Promise.reject(new TypeError('Already read'))
|
||||
}
|
||||
body.bodyUsed = true
|
||||
}
|
||||
|
||||
function fileReaderReady(reader) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
reader.onload = function() {
|
||||
resolve(reader.result)
|
||||
}
|
||||
reader.onerror = function() {
|
||||
reject(reader.error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function readBlobAsArrayBuffer(blob) {
|
||||
var reader = new FileReader()
|
||||
var promise = fileReaderReady(reader)
|
||||
reader.readAsArrayBuffer(blob)
|
||||
return promise
|
||||
}
|
||||
|
||||
function readBlobAsText(blob) {
|
||||
var reader = new FileReader()
|
||||
var promise = fileReaderReady(reader)
|
||||
reader.readAsText(blob)
|
||||
return promise
|
||||
}
|
||||
|
||||
function readArrayBufferAsText(buf) {
|
||||
var view = new Uint8Array(buf)
|
||||
var chars = new Array(view.length)
|
||||
|
||||
for (var i = 0; i < view.length; i++) {
|
||||
chars[i] = String.fromCharCode(view[i])
|
||||
}
|
||||
return chars.join('')
|
||||
}
|
||||
|
||||
function bufferClone(buf) {
|
||||
if (buf.slice) {
|
||||
return buf.slice(0)
|
||||
} else {
|
||||
var view = new Uint8Array(buf.byteLength)
|
||||
view.set(new Uint8Array(buf))
|
||||
return view.buffer
|
||||
}
|
||||
}
|
||||
|
||||
function Body() {
|
||||
this.bodyUsed = false
|
||||
|
||||
this._initBody = function(body) {
|
||||
this._bodyInit = body
|
||||
if (!body) {
|
||||
this._bodyText = ''
|
||||
} else if (typeof body === 'string') {
|
||||
this._bodyText = body
|
||||
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
||||
this._bodyBlob = body
|
||||
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
||||
this._bodyFormData = body
|
||||
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
||||
this._bodyText = body.toString()
|
||||
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
||||
this._bodyArrayBuffer = bufferClone(body.buffer)
|
||||
// IE 10-11 can't handle a DataView body.
|
||||
this._bodyInit = new Blob([this._bodyArrayBuffer])
|
||||
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
||||
this._bodyArrayBuffer = bufferClone(body)
|
||||
} else {
|
||||
throw new Error('unsupported BodyInit type')
|
||||
}
|
||||
|
||||
if (!this.headers.get('content-type')) {
|
||||
if (typeof body === 'string') {
|
||||
this.headers.set('content-type', 'text/plain;charset=UTF-8')
|
||||
} else if (this._bodyBlob && this._bodyBlob.type) {
|
||||
this.headers.set('content-type', this._bodyBlob.type)
|
||||
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
||||
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (support.blob) {
|
||||
this.blob = function() {
|
||||
var rejected = consumed(this)
|
||||
if (rejected) {
|
||||
return rejected
|
||||
}
|
||||
|
||||
if (this._bodyBlob) {
|
||||
return Promise.resolve(this._bodyBlob)
|
||||
} else if (this._bodyArrayBuffer) {
|
||||
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
||||
} else if (this._bodyFormData) {
|
||||
throw new Error('could not read FormData body as blob')
|
||||
} else {
|
||||
return Promise.resolve(new Blob([this._bodyText]))
|
||||
}
|
||||
}
|
||||
|
||||
this.arrayBuffer = function() {
|
||||
if (this._bodyArrayBuffer) {
|
||||
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
||||
} else {
|
||||
return this.blob().then(readBlobAsArrayBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.text = function() {
|
||||
var rejected = consumed(this)
|
||||
if (rejected) {
|
||||
return rejected
|
||||
}
|
||||
|
||||
if (this._bodyBlob) {
|
||||
return readBlobAsText(this._bodyBlob)
|
||||
} else if (this._bodyArrayBuffer) {
|
||||
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
||||
} else if (this._bodyFormData) {
|
||||
throw new Error('could not read FormData body as text')
|
||||
} else {
|
||||
return Promise.resolve(this._bodyText)
|
||||
}
|
||||
}
|
||||
|
||||
if (support.formData) {
|
||||
this.formData = function() {
|
||||
return this.text().then(decode)
|
||||
}
|
||||
}
|
||||
|
||||
this.json = function() {
|
||||
return this.text().then(JSON.parse)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
// HTTP methods whose capitalization should be normalized
|
||||
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
|
||||
|
||||
function normalizeMethod(method) {
|
||||
var upcased = method.toUpperCase()
|
||||
return (methods.indexOf(upcased) > -1) ? upcased : method
|
||||
}
|
||||
|
||||
function Request(input, options) {
|
||||
options = options || {}
|
||||
var body = options.body
|
||||
|
||||
if (input instanceof Request) {
|
||||
if (input.bodyUsed) {
|
||||
throw new TypeError('Already read')
|
||||
}
|
||||
this.url = input.url
|
||||
this.credentials = input.credentials
|
||||
if (!options.headers) {
|
||||
this.headers = new Headers(input.headers)
|
||||
}
|
||||
this.method = input.method
|
||||
this.mode = input.mode
|
||||
if (!body && input._bodyInit != null) {
|
||||
body = input._bodyInit
|
||||
input.bodyUsed = true
|
||||
}
|
||||
} else {
|
||||
this.url = String(input)
|
||||
}
|
||||
|
||||
this.credentials = options.credentials || this.credentials || 'omit'
|
||||
if (options.headers || !this.headers) {
|
||||
this.headers = new Headers(options.headers)
|
||||
}
|
||||
this.method = normalizeMethod(options.method || this.method || 'GET')
|
||||
this.mode = options.mode || this.mode || null
|
||||
this.referrer = null
|
||||
|
||||
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
||||
throw new TypeError('Body not allowed for GET or HEAD requests')
|
||||
}
|
||||
this._initBody(body)
|
||||
}
|
||||
|
||||
Request.prototype.clone = function() {
|
||||
return new Request(this, { body: this._bodyInit })
|
||||
}
|
||||
|
||||
function decode(body) {
|
||||
var form = new FormData()
|
||||
body.trim().split('&').forEach(function(bytes) {
|
||||
if (bytes) {
|
||||
var split = bytes.split('=')
|
||||
var name = split.shift().replace(/\+/g, ' ')
|
||||
var value = split.join('=').replace(/\+/g, ' ')
|
||||
form.append(decodeURIComponent(name), decodeURIComponent(value))
|
||||
}
|
||||
})
|
||||
return form
|
||||
}
|
||||
|
||||
function parseHeaders(rawHeaders) {
|
||||
var headers = new Headers()
|
||||
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
||||
// https://tools.ietf.org/html/rfc7230#section-3.2
|
||||
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ')
|
||||
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
||||
var parts = line.split(':')
|
||||
var key = parts.shift().trim()
|
||||
if (key) {
|
||||
var value = parts.join(':').trim()
|
||||
headers.append(key, value)
|
||||
}
|
||||
})
|
||||
return headers
|
||||
}
|
||||
|
||||
Body.call(Request.prototype)
|
||||
|
||||
function Response(bodyInit, options) {
|
||||
if (!options) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
this.type = 'default'
|
||||
this.status = options.status === undefined ? 200 : options.status
|
||||
this.ok = this.status >= 200 && this.status < 300
|
||||
this.statusText = 'statusText' in options ? options.statusText : 'OK'
|
||||
this.headers = new Headers(options.headers)
|
||||
this.url = options.url || ''
|
||||
this._initBody(bodyInit)
|
||||
}
|
||||
|
||||
Body.call(Response.prototype)
|
||||
|
||||
Response.prototype.clone = function() {
|
||||
return new Response(this._bodyInit, {
|
||||
status: this.status,
|
||||
statusText: this.statusText,
|
||||
headers: new Headers(this.headers),
|
||||
url: this.url
|
||||
})
|
||||
}
|
||||
|
||||
Response.error = function() {
|
||||
var response = new Response(null, {status: 0, statusText: ''})
|
||||
response.type = 'error'
|
||||
return response
|
||||
}
|
||||
|
||||
var redirectStatuses = [301, 302, 303, 307, 308]
|
||||
|
||||
Response.redirect = function(url, status) {
|
||||
if (redirectStatuses.indexOf(status) === -1) {
|
||||
throw new RangeError('Invalid status code')
|
||||
}
|
||||
|
||||
return new Response(null, {status: status, headers: {location: url}})
|
||||
}
|
||||
|
||||
self.Headers = Headers
|
||||
self.Request = Request
|
||||
self.Response = Response
|
||||
|
||||
self.fetch = function(input, init) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var request = new Request(input, init)
|
||||
var xhr = new XMLHttpRequest()
|
||||
|
||||
xhr.onload = function() {
|
||||
var options = {
|
||||
status: xhr.status,
|
||||
statusText: xhr.statusText,
|
||||
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
||||
}
|
||||
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
|
||||
var body = 'response' in xhr ? xhr.response : xhr.responseText
|
||||
resolve(new Response(body, options))
|
||||
}
|
||||
|
||||
xhr.onerror = function() {
|
||||
reject(new TypeError('Network request failed'))
|
||||
}
|
||||
|
||||
xhr.ontimeout = function() {
|
||||
reject(new TypeError('Network request failed'))
|
||||
}
|
||||
|
||||
xhr.open(request.method, request.url, true)
|
||||
|
||||
if (request.credentials === 'include') {
|
||||
xhr.withCredentials = true
|
||||
} else if (request.credentials === 'omit') {
|
||||
xhr.withCredentials = false
|
||||
}
|
||||
|
||||
if ('responseType' in xhr && support.blob) {
|
||||
xhr.responseType = 'blob'
|
||||
}
|
||||
|
||||
request.headers.forEach(function(value, name) {
|
||||
xhr.setRequestHeader(name, value)
|
||||
})
|
||||
|
||||
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
|
||||
})
|
||||
}
|
||||
self.fetch.polyfill = true
|
||||
})(typeof self !== 'undefined' ? self : this);
|
||||
-15
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
@@ -1,478 +0,0 @@
|
||||
(function umd(root,factory){
|
||||
if(typeof module==='object' && typeof exports === 'object' )
|
||||
module.exports=factory()
|
||||
else if(typeof define==='function' && define.amd)
|
||||
define([],factory)
|
||||
else
|
||||
root.httpVueLoader=factory()
|
||||
})(this,function factory() {
|
||||
'use strict';
|
||||
|
||||
var scopeIndex = 0;
|
||||
|
||||
StyleContext.prototype = {
|
||||
|
||||
withBase: function(callback) {
|
||||
|
||||
var tmpBaseElt;
|
||||
if ( this.component.baseURI ) {
|
||||
|
||||
// firefox and chrome need the <base> to be set while inserting or modifying <style> in a document.
|
||||
tmpBaseElt = document.createElement('base');
|
||||
tmpBaseElt.href = this.component.baseURI;
|
||||
|
||||
var headElt = this.component.getHead();
|
||||
headElt.insertBefore(tmpBaseElt, headElt.firstChild);
|
||||
}
|
||||
|
||||
callback.call(this);
|
||||
|
||||
if ( tmpBaseElt )
|
||||
this.component.getHead().removeChild(tmpBaseElt);
|
||||
},
|
||||
|
||||
scopeStyles: function(styleElt, scopeName) {
|
||||
|
||||
function process() {
|
||||
|
||||
var sheet = styleElt.sheet;
|
||||
var rules = sheet.cssRules;
|
||||
|
||||
for ( var i = 0; i < rules.length; ++i ) {
|
||||
|
||||
var rule = rules[i];
|
||||
if ( rule.type !== 1 )
|
||||
continue;
|
||||
|
||||
var scopedSelectors = [];
|
||||
|
||||
rule.selectorText.split(/\s*,\s*/).forEach(function(sel) {
|
||||
|
||||
scopedSelectors.push(scopeName+' '+sel);
|
||||
var segments = sel.match(/([^ :]+)(.+)?/);
|
||||
scopedSelectors.push(segments[1] + scopeName + (segments[2]||''));
|
||||
});
|
||||
|
||||
var scopedRule = scopedSelectors.join(',') + rule.cssText.substr(rule.selectorText.length);
|
||||
sheet.deleteRule(i);
|
||||
sheet.insertRule(scopedRule, i);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// firefox may fail sheet.cssRules with InvalidAccessError
|
||||
process();
|
||||
} catch (ex) {
|
||||
|
||||
if ( ex instanceof DOMException && ex.code === DOMException.INVALID_ACCESS_ERR ) {
|
||||
|
||||
styleElt.sheet.disabled = true;
|
||||
styleElt.addEventListener('load', function onStyleLoaded() {
|
||||
|
||||
styleElt.removeEventListener('load', onStyleLoaded);
|
||||
|
||||
// firefox need this timeout otherwise we have to use document.importNode(style, true)
|
||||
setTimeout(function() {
|
||||
|
||||
process();
|
||||
styleElt.sheet.disabled = false;
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
throw ex;
|
||||
}
|
||||
},
|
||||
|
||||
compile: function() {
|
||||
|
||||
var hasTemplate = this.template !== null;
|
||||
|
||||
var scoped = this.elt.hasAttribute('scoped');
|
||||
|
||||
if ( scoped ) {
|
||||
|
||||
// no template, no scopable style needed
|
||||
if ( !hasTemplate )
|
||||
return;
|
||||
|
||||
// firefox does not tolerate this attribute
|
||||
this.elt.removeAttribute('scoped');
|
||||
}
|
||||
|
||||
this.withBase(function() {
|
||||
|
||||
this.component.getHead().appendChild(this.elt);
|
||||
});
|
||||
|
||||
if ( scoped )
|
||||
this.scopeStyles(this.elt, '['+this.component.getScopeId()+']');
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
getContent: function() {
|
||||
|
||||
return this.elt.textContent;
|
||||
},
|
||||
|
||||
setContent: function(content) {
|
||||
|
||||
this.withBase(function() {
|
||||
|
||||
this.elt.textContent = content;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function StyleContext(component, elt) {
|
||||
|
||||
this.component = component;
|
||||
this.elt = elt;
|
||||
}
|
||||
|
||||
|
||||
ScriptContext.prototype = {
|
||||
|
||||
getContent: function() {
|
||||
|
||||
return this.elt.textContent;
|
||||
},
|
||||
|
||||
setContent: function(content) {
|
||||
|
||||
this.elt.textContent = content;
|
||||
},
|
||||
|
||||
compile: function(module) {
|
||||
|
||||
var childModuleRequire = function(childURL) {
|
||||
|
||||
return httpVueLoader.require(resolveURL(this.component.baseURI, childURL));
|
||||
}.bind(this);
|
||||
|
||||
var childLoader = function(childURL, childName) {
|
||||
|
||||
return httpVueLoader(resolveURL(this.component.baseURI, childURL), childName);
|
||||
}.bind(this);
|
||||
|
||||
try {
|
||||
Function('exports', 'require', 'httpVueLoader', 'module', this.getContent()).call(this.module.exports, this.module.exports, childModuleRequire, childLoader, this.module);
|
||||
} catch(ex) {
|
||||
|
||||
if ( !('lineNumber' in ex) ) {
|
||||
|
||||
return Promise.reject(ex);
|
||||
}
|
||||
var vueFileData = responseText.replace(/\r?\n/g, '\n');
|
||||
var lineNumber = vueFileData.substr(0, vueFileData.indexOf(script)).split('\n').length + ex.lineNumber - 1;
|
||||
throw new (ex.constructor)(ex.message, url, lineNumber);
|
||||
}
|
||||
|
||||
return Promise.resolve(this.module.exports)
|
||||
.then(httpVueLoader.scriptExportsHandler.bind(this))
|
||||
.then(function(exports) {
|
||||
|
||||
this.module.exports = exports;
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
function ScriptContext(component, elt) {
|
||||
|
||||
this.component = component;
|
||||
this.elt = elt;
|
||||
this.module = { exports:{} };
|
||||
}
|
||||
|
||||
|
||||
TemplateContext.prototype = {
|
||||
|
||||
getContent: function() {
|
||||
|
||||
return this.elt.innerHTML;
|
||||
},
|
||||
|
||||
setContent: function(content) {
|
||||
|
||||
this.elt.innerHTML = content;
|
||||
},
|
||||
|
||||
getRootElt: function() {
|
||||
|
||||
var tplElt = this.elt.content || this.elt;
|
||||
|
||||
if ( 'firstElementChild' in tplElt )
|
||||
return tplElt.firstElementChild;
|
||||
|
||||
for ( tplElt = tplElt.firstChild; tplElt !== null; tplElt = tplElt.nextSibling )
|
||||
if ( tplElt.nodeType === Node.ELEMENT_NODE )
|
||||
return tplElt;
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
compile: function() {
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
};
|
||||
|
||||
function TemplateContext(component, elt) {
|
||||
|
||||
this.component = component;
|
||||
this.elt = elt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Component.prototype = {
|
||||
|
||||
getHead: function() {
|
||||
|
||||
return document.head || document.getElementsByTagName('head')[0];
|
||||
},
|
||||
|
||||
getScopeId: function() {
|
||||
|
||||
if ( this._scopeId === '' ) {
|
||||
|
||||
this._scopeId = 'data-s-' + (scopeIndex++).toString(36);
|
||||
this.template.getRootElt().setAttribute(this._scopeId, '');
|
||||
}
|
||||
return this._scopeId;
|
||||
},
|
||||
|
||||
load: function(componentURL) {
|
||||
|
||||
return httpVueLoader.httpRequest(componentURL)
|
||||
.then(function(responseText) {
|
||||
|
||||
this.baseURI = componentURL.substr(0, componentURL.lastIndexOf('/')+1);
|
||||
var doc = document.implementation.createHTMLDocument('');
|
||||
|
||||
// IE requires the <base> to come with <style>
|
||||
doc.body.innerHTML = (this.baseURI ? '<base href="'+this.baseURI+'">' : '') + responseText;
|
||||
|
||||
for ( var it = doc.body.firstChild; it; it = it.nextSibling ) {
|
||||
|
||||
switch ( it.nodeName ) {
|
||||
case 'TEMPLATE':
|
||||
this.template = new TemplateContext(this, it);
|
||||
break;
|
||||
case 'SCRIPT':
|
||||
this.script = new ScriptContext(this, it);
|
||||
break;
|
||||
case 'STYLE':
|
||||
this.styles.push(new StyleContext(this, it));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
_normalizeSection: function(eltCx) {
|
||||
|
||||
var p;
|
||||
|
||||
if ( eltCx === null || !eltCx.elt.hasAttribute('src') ) {
|
||||
|
||||
p = Promise.resolve(null);
|
||||
} else {
|
||||
|
||||
p = httpVueLoader.httpRequest(eltCx.elt.getAttribute('src'))
|
||||
.then(function(content) {
|
||||
|
||||
eltCx.elt.removeAttribute('src');
|
||||
return content;
|
||||
});
|
||||
}
|
||||
|
||||
return p
|
||||
.then(function(content) {
|
||||
|
||||
if ( eltCx !== null && eltCx.elt.hasAttribute('lang') ) {
|
||||
|
||||
var lang = eltCx.elt.getAttribute('lang');
|
||||
eltCx.elt.removeAttribute('lang');
|
||||
return httpVueLoader.langProcessor[lang.toLowerCase()].call(this, content === null ? eltCx.getContent() : content);
|
||||
}
|
||||
return content;
|
||||
}.bind(this))
|
||||
.then(function(content) {
|
||||
|
||||
if ( content !== null )
|
||||
eltCx.setContent(content);
|
||||
});
|
||||
},
|
||||
|
||||
normalize: function() {
|
||||
|
||||
return Promise.all(Array.prototype.concat(
|
||||
this._normalizeSection(this.template),
|
||||
this._normalizeSection(this.script),
|
||||
this.styles.map(this._normalizeSection)
|
||||
))
|
||||
.then(function() {
|
||||
|
||||
return this;
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
compile: function() {
|
||||
|
||||
return Promise.all(Array.prototype.concat(
|
||||
this.template && this.template.compile(),
|
||||
this.script && this.script.compile(),
|
||||
this.styles.map(function(style) { return style.compile(); })
|
||||
))
|
||||
.then(function() {
|
||||
|
||||
return this;
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
function Component(name) {
|
||||
|
||||
this.name = name;
|
||||
this.template = null;
|
||||
this.script = null;
|
||||
this.styles = [];
|
||||
this._scopeId = '';
|
||||
}
|
||||
|
||||
function identity(value) {
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function parseComponentURL(url) {
|
||||
|
||||
var comp = url.match(/(.*?)([^/]+?)\/?(\.vue)?(\?.*|#.*|$)/);
|
||||
return {
|
||||
name: comp[2],
|
||||
url: comp[1] + comp[2] + (comp[3] === undefined ? '/index.vue' : comp[3]) + comp[4]
|
||||
};
|
||||
}
|
||||
|
||||
function resolveURL(baseURL, url) {
|
||||
|
||||
if (url.substr(0, 2) === './' || url.substr(0, 3) === '../') {
|
||||
return baseURL + url;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
httpVueLoader.load = function(url, name) {
|
||||
|
||||
return function() {
|
||||
|
||||
return new Component(name).load(url)
|
||||
.then(function(component) {
|
||||
|
||||
return component.normalize();
|
||||
})
|
||||
.then(function(component) {
|
||||
|
||||
return component.compile();
|
||||
})
|
||||
.then(function(component) {
|
||||
|
||||
var exports = component.script !== null ? component.script.module.exports : {};
|
||||
|
||||
if ( component.template !== null )
|
||||
exports.template = component.template.getContent();
|
||||
|
||||
if ( exports.name === undefined )
|
||||
if ( component.name !== undefined )
|
||||
exports.name = component.name;
|
||||
|
||||
exports._baseURI = component.baseURI;
|
||||
|
||||
return exports;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
httpVueLoader.register = function(Vue, url) {
|
||||
|
||||
var comp = parseComponentURL(url);
|
||||
Vue.component(comp.name, httpVueLoader.load(comp.url));
|
||||
};
|
||||
|
||||
httpVueLoader.install = function(Vue) {
|
||||
|
||||
Vue.mixin({
|
||||
|
||||
beforeCreate: function () {
|
||||
|
||||
var components = this.$options.components;
|
||||
|
||||
for ( var componentName in components ) {
|
||||
|
||||
if ( typeof(components[componentName]) === 'string' && components[componentName].substr(0, 4) === 'url:' ) {
|
||||
|
||||
var comp = parseComponentURL(components[componentName].substr(4));
|
||||
|
||||
var componentURL = ('_baseURI' in this.$options) ? resolveURL(this.$options._baseURI, comp.url) : comp.url;
|
||||
|
||||
if ( isNaN(componentName) )
|
||||
components[componentName] = httpVueLoader.load(componentURL, componentName);
|
||||
else
|
||||
components[componentName] = Vue.component(comp.name, httpVueLoader.load(componentURL, comp.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
httpVueLoader.require = function(moduleName) {
|
||||
|
||||
return window[moduleName];
|
||||
};
|
||||
|
||||
httpVueLoader.httpRequest = function(url) {
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'text';
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
|
||||
if ( xhr.readyState === 4 ) {
|
||||
|
||||
if ( xhr.status >= 200 && xhr.status < 300 )
|
||||
resolve(xhr.responseText);
|
||||
else
|
||||
reject(xhr.status);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(null);
|
||||
});
|
||||
};
|
||||
|
||||
httpVueLoader.langProcessor = {
|
||||
html: identity,
|
||||
js: identity,
|
||||
css: identity
|
||||
};
|
||||
|
||||
httpVueLoader.scriptExportsHandler = identity;
|
||||
|
||||
function httpVueLoader(url, name) {
|
||||
|
||||
var comp = parseComponentURL(url);
|
||||
return httpVueLoader.load(comp.url, name);
|
||||
}
|
||||
|
||||
return httpVueLoader;
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
/*!
|
||||
* IE10 viewport hack for Surface/desktop Windows 8 bug
|
||||
* Copyright 2014-2017 The Bootstrap Authors
|
||||
* Copyright 2014-2017 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
*/
|
||||
|
||||
// See the Getting Started docs for more information:
|
||||
// https://getbootstrap.com/getting-started/#support-ie10-width
|
||||
|
||||
(function () {
|
||||
'use strict'
|
||||
|
||||
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
|
||||
var msViewportStyle = document.createElement('style')
|
||||
msViewportStyle.appendChild(
|
||||
document.createTextNode(
|
||||
'@-ms-viewport{width:auto!important}'
|
||||
)
|
||||
)
|
||||
document.head.appendChild(msViewportStyle)
|
||||
}
|
||||
|
||||
}())
|
||||
-4
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
-10
File diff suppressed because one or more lines are too long
@@ -1,950 +0,0 @@
|
||||
/*! Swipebox v1.4.1 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
|
||||
|
||||
;( function ( window, document, $, undefined ) {
|
||||
|
||||
$.swipebox = function( elem, options ) {
|
||||
|
||||
// Default options
|
||||
var ui,
|
||||
defaults = {
|
||||
useCSS : true,
|
||||
useSVG : true,
|
||||
initialIndexOnArray : 0,
|
||||
removeBarsOnMobile : true,
|
||||
hideCloseButtonOnMobile : false,
|
||||
hideBarsDelay : 3000,
|
||||
videoMaxWidth : 1140,
|
||||
vimeoColor : 'cccccc',
|
||||
beforeOpen: null,
|
||||
afterOpen: null,
|
||||
afterClose: null,
|
||||
nextSlide: null,
|
||||
prevSlide: null,
|
||||
loopAtEnd: false,
|
||||
autoplayVideos: false,
|
||||
queryStringData: {},
|
||||
toggleClassOnLoad: ''
|
||||
},
|
||||
|
||||
plugin = this,
|
||||
elements = [], // slides array [ { href:'...', title:'...' }, ...],
|
||||
$elem,
|
||||
selector = elem.selector,
|
||||
$selector = $( selector ),
|
||||
isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ),
|
||||
isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints,
|
||||
supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', 'svg').createSVGRect,
|
||||
winWidth = window.innerWidth ? window.innerWidth : $( window ).width(),
|
||||
winHeight = window.innerHeight ? window.innerHeight : $( window ).height(),
|
||||
currentX = 0,
|
||||
/* jshint multistr: true */
|
||||
html = '<div id="swipebox-overlay">\
|
||||
<div id="swipebox-container">\
|
||||
<div id="swipebox-slider"></div>\
|
||||
<div id="swipebox-top-bar">\
|
||||
<div id="swipebox-title"></div>\
|
||||
</div>\
|
||||
<div id="swipebox-bottom-bar">\
|
||||
<div id="swipebox-arrows">\
|
||||
<a id="swipebox-prev"></a>\
|
||||
<a id="swipebox-next"></a>\
|
||||
</div>\
|
||||
</div>\
|
||||
<a id="swipebox-close"></a>\
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
plugin.settings = {};
|
||||
|
||||
$.swipebox.close = function () {
|
||||
ui.closeSlide();
|
||||
};
|
||||
|
||||
$.swipebox.extend = function () {
|
||||
return ui;
|
||||
};
|
||||
|
||||
plugin.init = function() {
|
||||
|
||||
plugin.settings = $.extend( {}, defaults, options );
|
||||
|
||||
if ( $.isArray( elem ) ) {
|
||||
|
||||
elements = elem;
|
||||
ui.target = $( window );
|
||||
ui.init( plugin.settings.initialIndexOnArray );
|
||||
|
||||
} else {
|
||||
|
||||
$( document ).on( 'click', selector, function( event ) {
|
||||
|
||||
// console.log( isTouch );
|
||||
|
||||
if ( event.target.parentNode.className === 'slide current' ) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! $.isArray( elem ) ) {
|
||||
ui.destroy();
|
||||
$elem = $( selector );
|
||||
ui.actions();
|
||||
}
|
||||
|
||||
elements = [];
|
||||
var index , relType, relVal;
|
||||
|
||||
// Allow for HTML5 compliant attribute before legacy use of rel
|
||||
if ( ! relVal ) {
|
||||
relType = 'data-rel';
|
||||
relVal = $( this ).attr( relType );
|
||||
}
|
||||
|
||||
if ( ! relVal ) {
|
||||
relType = 'rel';
|
||||
relVal = $( this ).attr( relType );
|
||||
}
|
||||
|
||||
if ( relVal && relVal !== '' && relVal !== 'nofollow' ) {
|
||||
$elem = $selector.filter( '[' + relType + '="' + relVal + '"]' );
|
||||
} else {
|
||||
$elem = $( selector );
|
||||
}
|
||||
|
||||
$elem.each( function() {
|
||||
|
||||
var title = null,
|
||||
href = null;
|
||||
|
||||
if ( $( this ).attr( 'title' ) ) {
|
||||
title = $( this ).attr( 'title' );
|
||||
}
|
||||
|
||||
|
||||
if ( $( this ).attr( 'href' ) ) {
|
||||
href = $( this ).attr( 'href' );
|
||||
}
|
||||
|
||||
elements.push( {
|
||||
href: href,
|
||||
title: title
|
||||
} );
|
||||
} );
|
||||
|
||||
index = $elem.index( $( this ) );
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
ui.target = $( event.target );
|
||||
ui.init( index );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
ui = {
|
||||
|
||||
/**
|
||||
* Initiate Swipebox
|
||||
*/
|
||||
init : function( index ) {
|
||||
if ( plugin.settings.beforeOpen ) {
|
||||
plugin.settings.beforeOpen();
|
||||
}
|
||||
this.target.trigger( 'swipebox-start' );
|
||||
$.swipebox.isOpen = true;
|
||||
this.build();
|
||||
this.openSlide( index );
|
||||
this.openMedia( index );
|
||||
this.preloadMedia( index+1 );
|
||||
this.preloadMedia( index-1 );
|
||||
if ( plugin.settings.afterOpen ) {
|
||||
plugin.settings.afterOpen();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Built HTML containers and fire main functions
|
||||
*/
|
||||
build : function () {
|
||||
var $this = this, bg;
|
||||
|
||||
$( 'body' ).append( html );
|
||||
|
||||
if ( supportSVG && plugin.settings.useSVG === true ) {
|
||||
bg = $( '#swipebox-close' ).css( 'background-image' );
|
||||
bg = bg.replace( 'png', 'svg' );
|
||||
$( '#swipebox-prev, #swipebox-next, #swipebox-close' ).css( {
|
||||
'background-image' : bg
|
||||
} );
|
||||
}
|
||||
|
||||
if ( isMobile && plugin.settings.removeBarsOnMobile ) {
|
||||
$( '#swipebox-bottom-bar, #swipebox-top-bar' ).remove();
|
||||
}
|
||||
|
||||
$.each( elements, function() {
|
||||
$( '#swipebox-slider' ).append( '<div class="slide"></div>' );
|
||||
} );
|
||||
|
||||
$this.setDim();
|
||||
$this.actions();
|
||||
|
||||
if ( isTouch ) {
|
||||
$this.gesture();
|
||||
}
|
||||
|
||||
// Devices can have both touch and keyboard input so always allow key events
|
||||
$this.keyboard();
|
||||
|
||||
$this.animBars();
|
||||
$this.resize();
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Set dimensions depending on windows width and height
|
||||
*/
|
||||
setDim : function () {
|
||||
|
||||
var width, height, sliderCss = {};
|
||||
|
||||
// Reset dimensions on mobile orientation change
|
||||
if ( 'onorientationchange' in window ) {
|
||||
|
||||
window.addEventListener( 'orientationchange', function() {
|
||||
if ( window.orientation === 0 ) {
|
||||
width = winWidth;
|
||||
height = winHeight;
|
||||
} else if ( window.orientation === 90 || window.orientation === -90 ) {
|
||||
width = winHeight;
|
||||
height = winWidth;
|
||||
}
|
||||
}, false );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
width = window.innerWidth ? window.innerWidth : $( window ).width();
|
||||
height = window.innerHeight ? window.innerHeight : $( window ).height();
|
||||
}
|
||||
|
||||
sliderCss = {
|
||||
width : width,
|
||||
height : height
|
||||
};
|
||||
|
||||
$( '#swipebox-overlay' ).css( sliderCss );
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Reset dimensions on window resize envent
|
||||
*/
|
||||
resize : function () {
|
||||
var $this = this;
|
||||
|
||||
$( window ).resize( function() {
|
||||
$this.setDim();
|
||||
} ).resize();
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if device supports CSS transitions
|
||||
*/
|
||||
supportTransition : function () {
|
||||
|
||||
var prefixes = 'transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition'.split( ' ' ),
|
||||
i;
|
||||
|
||||
for ( i = 0; i < prefixes.length; i++ ) {
|
||||
if ( document.createElement( 'div' ).style[ prefixes[i] ] !== undefined ) {
|
||||
return prefixes[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if CSS transitions are allowed (options + devicesupport)
|
||||
*/
|
||||
doCssTrans : function () {
|
||||
if ( plugin.settings.useCSS && this.supportTransition() ) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Touch navigation
|
||||
*/
|
||||
gesture : function () {
|
||||
|
||||
var $this = this,
|
||||
index,
|
||||
hDistance,
|
||||
vDistance,
|
||||
hDistanceLast,
|
||||
vDistanceLast,
|
||||
hDistancePercent,
|
||||
vSwipe = false,
|
||||
hSwipe = false,
|
||||
hSwipMinDistance = 10,
|
||||
vSwipMinDistance = 50,
|
||||
startCoords = {},
|
||||
endCoords = {},
|
||||
bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' ),
|
||||
slider = $( '#swipebox-slider' );
|
||||
|
||||
bars.addClass( 'visible-bars' );
|
||||
$this.setTimeout();
|
||||
|
||||
$( 'body' ).bind( 'touchstart', function( event ) {
|
||||
|
||||
$( this ).addClass( 'touching' );
|
||||
index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
|
||||
endCoords = event.originalEvent.targetTouches[0];
|
||||
startCoords.pageX = event.originalEvent.targetTouches[0].pageX;
|
||||
startCoords.pageY = event.originalEvent.targetTouches[0].pageY;
|
||||
|
||||
$( '#swipebox-slider' ).css( {
|
||||
'-webkit-transform' : 'translate3d(' + currentX +'%, 0, 0)',
|
||||
'transform' : 'translate3d(' + currentX + '%, 0, 0)'
|
||||
} );
|
||||
|
||||
$( '.touching' ).bind( 'touchmove',function( event ) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
endCoords = event.originalEvent.targetTouches[0];
|
||||
|
||||
if ( ! hSwipe ) {
|
||||
vDistanceLast = vDistance;
|
||||
vDistance = endCoords.pageY - startCoords.pageY;
|
||||
if ( Math.abs( vDistance ) >= vSwipMinDistance || vSwipe ) {
|
||||
var opacity = 0.75 - Math.abs(vDistance) / slider.height();
|
||||
|
||||
slider.css( { 'top': vDistance + 'px' } );
|
||||
slider.css( { 'opacity': opacity } );
|
||||
|
||||
vSwipe = true;
|
||||
}
|
||||
}
|
||||
|
||||
hDistanceLast = hDistance;
|
||||
hDistance = endCoords.pageX - startCoords.pageX;
|
||||
hDistancePercent = hDistance * 100 / winWidth;
|
||||
|
||||
if ( ! hSwipe && ! vSwipe && Math.abs( hDistance ) >= hSwipMinDistance ) {
|
||||
$( '#swipebox-slider' ).css( {
|
||||
'-webkit-transition' : '',
|
||||
'transition' : ''
|
||||
} );
|
||||
hSwipe = true;
|
||||
}
|
||||
|
||||
if ( hSwipe ) {
|
||||
|
||||
// swipe left
|
||||
if ( 0 < hDistance ) {
|
||||
|
||||
// first slide
|
||||
if ( 0 === index ) {
|
||||
// console.log( 'first' );
|
||||
$( '#swipebox-overlay' ).addClass( 'leftSpringTouch' );
|
||||
} else {
|
||||
// Follow gesture
|
||||
$( '#swipebox-overlay' ).removeClass( 'leftSpringTouch' ).removeClass( 'rightSpringTouch' );
|
||||
$( '#swipebox-slider' ).css( {
|
||||
'-webkit-transform' : 'translate3d(' + ( currentX + hDistancePercent ) +'%, 0, 0)',
|
||||
'transform' : 'translate3d(' + ( currentX + hDistancePercent ) + '%, 0, 0)'
|
||||
} );
|
||||
}
|
||||
|
||||
// swipe rught
|
||||
} else if ( 0 > hDistance ) {
|
||||
|
||||
// last Slide
|
||||
if ( elements.length === index +1 ) {
|
||||
// console.log( 'last' );
|
||||
$( '#swipebox-overlay' ).addClass( 'rightSpringTouch' );
|
||||
} else {
|
||||
$( '#swipebox-overlay' ).removeClass( 'leftSpringTouch' ).removeClass( 'rightSpringTouch' );
|
||||
$( '#swipebox-slider' ).css( {
|
||||
'-webkit-transform' : 'translate3d(' + ( currentX + hDistancePercent ) +'%, 0, 0)',
|
||||
'transform' : 'translate3d(' + ( currentX + hDistancePercent ) + '%, 0, 0)'
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return false;
|
||||
|
||||
} ).bind( 'touchend',function( event ) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
$( '#swipebox-slider' ).css( {
|
||||
'-webkit-transition' : '-webkit-transform 0.4s ease',
|
||||
'transition' : 'transform 0.4s ease'
|
||||
} );
|
||||
|
||||
vDistance = endCoords.pageY - startCoords.pageY;
|
||||
hDistance = endCoords.pageX - startCoords.pageX;
|
||||
hDistancePercent = hDistance*100/winWidth;
|
||||
|
||||
// Swipe to bottom to close
|
||||
if ( vSwipe ) {
|
||||
vSwipe = false;
|
||||
if ( Math.abs( vDistance ) >= 2 * vSwipMinDistance && Math.abs( vDistance ) > Math.abs( vDistanceLast ) ) {
|
||||
var vOffset = vDistance > 0 ? slider.height() : - slider.height();
|
||||
slider.animate( { top: vOffset + 'px', 'opacity': 0 },
|
||||
300,
|
||||
function () {
|
||||
$this.closeSlide();
|
||||
} );
|
||||
} else {
|
||||
slider.animate( { top: 0, 'opacity': 1 }, 300 );
|
||||
}
|
||||
|
||||
} else if ( hSwipe ) {
|
||||
|
||||
hSwipe = false;
|
||||
|
||||
// swipeLeft
|
||||
if( hDistance >= hSwipMinDistance && hDistance >= hDistanceLast) {
|
||||
|
||||
$this.getPrev();
|
||||
|
||||
// swipeRight
|
||||
} else if ( hDistance <= -hSwipMinDistance && hDistance <= hDistanceLast) {
|
||||
|
||||
$this.getNext();
|
||||
}
|
||||
|
||||
} else { // Top and bottom bars have been removed on touchable devices
|
||||
// tap
|
||||
if ( ! bars.hasClass( 'visible-bars' ) ) {
|
||||
$this.showBars();
|
||||
$this.setTimeout();
|
||||
} else {
|
||||
$this.clearTimeout();
|
||||
$this.hideBars();
|
||||
}
|
||||
}
|
||||
|
||||
$( '#swipebox-slider' ).css( {
|
||||
'-webkit-transform' : 'translate3d(' + currentX + '%, 0, 0)',
|
||||
'transform' : 'translate3d(' + currentX + '%, 0, 0)'
|
||||
} );
|
||||
|
||||
$( '#swipebox-overlay' ).removeClass( 'leftSpringTouch' ).removeClass( 'rightSpringTouch' );
|
||||
$( '.touching' ).off( 'touchmove' ).removeClass( 'touching' );
|
||||
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Set timer to hide the action bars
|
||||
*/
|
||||
setTimeout: function () {
|
||||
if ( plugin.settings.hideBarsDelay > 0 ) {
|
||||
var $this = this;
|
||||
$this.clearTimeout();
|
||||
$this.timeout = window.setTimeout( function() {
|
||||
$this.hideBars();
|
||||
},
|
||||
|
||||
plugin.settings.hideBarsDelay
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear timer
|
||||
*/
|
||||
clearTimeout: function () {
|
||||
window.clearTimeout( this.timeout );
|
||||
this.timeout = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Show navigation and title bars
|
||||
*/
|
||||
showBars : function () {
|
||||
var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
|
||||
if ( this.doCssTrans() ) {
|
||||
bars.addClass( 'visible-bars' );
|
||||
} else {
|
||||
$( '#swipebox-top-bar' ).animate( { top : 0 }, 500 );
|
||||
$( '#swipebox-bottom-bar' ).animate( { bottom : 0 }, 500 );
|
||||
setTimeout( function() {
|
||||
bars.addClass( 'visible-bars' );
|
||||
}, 1000 );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide navigation and title bars
|
||||
*/
|
||||
hideBars : function () {
|
||||
var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
|
||||
if ( this.doCssTrans() ) {
|
||||
bars.removeClass( 'visible-bars' );
|
||||
} else {
|
||||
$( '#swipebox-top-bar' ).animate( { top : '-50px' }, 500 );
|
||||
$( '#swipebox-bottom-bar' ).animate( { bottom : '-50px' }, 500 );
|
||||
setTimeout( function() {
|
||||
bars.removeClass( 'visible-bars' );
|
||||
}, 1000 );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Animate navigation and top bars
|
||||
*/
|
||||
animBars : function () {
|
||||
var $this = this,
|
||||
bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
|
||||
|
||||
bars.addClass( 'visible-bars' );
|
||||
$this.setTimeout();
|
||||
|
||||
$( '#swipebox-slider' ).click( function() {
|
||||
if ( ! bars.hasClass( 'visible-bars' ) ) {
|
||||
$this.showBars();
|
||||
$this.setTimeout();
|
||||
}
|
||||
} );
|
||||
|
||||
$( '#swipebox-bottom-bar' ).hover( function() {
|
||||
$this.showBars();
|
||||
bars.addClass( 'visible-bars' );
|
||||
$this.clearTimeout();
|
||||
|
||||
}, function() {
|
||||
if ( plugin.settings.hideBarsDelay > 0 ) {
|
||||
bars.removeClass( 'visible-bars' );
|
||||
$this.setTimeout();
|
||||
}
|
||||
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Keyboard navigation
|
||||
*/
|
||||
keyboard : function () {
|
||||
var $this = this;
|
||||
$( window ).bind( 'keyup', function( event ) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
if ( event.keyCode === 37 ) {
|
||||
|
||||
$this.getPrev();
|
||||
|
||||
} else if ( event.keyCode === 39 ) {
|
||||
|
||||
$this.getNext();
|
||||
|
||||
} else if ( event.keyCode === 27 ) {
|
||||
|
||||
$this.closeSlide();
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Navigation events : go to next slide, go to prevous slide and close
|
||||
*/
|
||||
actions : function () {
|
||||
var $this = this,
|
||||
action = 'touchend click'; // Just detect for both event types to allow for multi-input
|
||||
|
||||
if ( elements.length < 2 ) {
|
||||
|
||||
$( '#swipebox-bottom-bar' ).hide();
|
||||
|
||||
if ( undefined === elements[ 1 ] ) {
|
||||
$( '#swipebox-top-bar' ).hide();
|
||||
}
|
||||
|
||||
} else {
|
||||
$( '#swipebox-prev' ).bind( action, function( event ) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$this.getPrev();
|
||||
$this.setTimeout();
|
||||
} );
|
||||
|
||||
$( '#swipebox-next' ).bind( action, function( event ) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$this.getNext();
|
||||
$this.setTimeout();
|
||||
} );
|
||||
}
|
||||
|
||||
$( '#swipebox-close' ).bind( action, function() {
|
||||
$this.closeSlide();
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Set current slide
|
||||
*/
|
||||
setSlide : function ( index, isFirst ) {
|
||||
|
||||
isFirst = isFirst || false;
|
||||
|
||||
var slider = $( '#swipebox-slider' );
|
||||
|
||||
currentX = -index*100;
|
||||
|
||||
if ( this.doCssTrans() ) {
|
||||
slider.css( {
|
||||
'-webkit-transform' : 'translate3d(' + (-index*100)+'%, 0, 0)',
|
||||
'transform' : 'translate3d(' + (-index*100)+'%, 0, 0)'
|
||||
} );
|
||||
} else {
|
||||
slider.animate( { left : ( -index*100 )+'%' } );
|
||||
}
|
||||
|
||||
$( '#swipebox-slider .slide' ).removeClass( 'current' );
|
||||
$( '#swipebox-slider .slide' ).eq( index ).addClass( 'current' );
|
||||
this.setTitle( index );
|
||||
|
||||
if ( isFirst ) {
|
||||
slider.fadeIn();
|
||||
}
|
||||
|
||||
$( '#swipebox-prev, #swipebox-next' ).removeClass( 'disabled' );
|
||||
|
||||
if ( index === 0 ) {
|
||||
$( '#swipebox-prev' ).addClass( 'disabled' );
|
||||
} else if ( index === elements.length - 1 && plugin.settings.loopAtEnd !== true ) {
|
||||
$( '#swipebox-next' ).addClass( 'disabled' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Open slide
|
||||
*/
|
||||
openSlide : function ( index ) {
|
||||
$( 'html' ).addClass( 'swipebox-html' );
|
||||
if ( isTouch ) {
|
||||
$( 'html' ).addClass( 'swipebox-touch' );
|
||||
|
||||
if ( plugin.settings.hideCloseButtonOnMobile ) {
|
||||
$( 'html' ).addClass( 'swipebox-no-close-button' );
|
||||
}
|
||||
} else {
|
||||
$( 'html' ).addClass( 'swipebox-no-touch' );
|
||||
}
|
||||
$( window ).trigger( 'resize' ); // fix scroll bar visibility on desktop
|
||||
this.setSlide( index, true );
|
||||
},
|
||||
|
||||
/**
|
||||
* Set a time out if the media is a video
|
||||
*/
|
||||
preloadMedia : function ( index ) {
|
||||
var $this = this,
|
||||
src = null;
|
||||
|
||||
if ( elements[ index ] !== undefined ) {
|
||||
src = elements[ index ].href;
|
||||
}
|
||||
|
||||
if ( ! $this.isVideo( src ) ) {
|
||||
setTimeout( function() {
|
||||
$this.openMedia( index );
|
||||
}, 1000);
|
||||
} else {
|
||||
$this.openMedia( index );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Open
|
||||
*/
|
||||
openMedia : function ( index ) {
|
||||
var $this = this,
|
||||
src,
|
||||
slide;
|
||||
|
||||
if ( elements[ index ] !== undefined ) {
|
||||
src = elements[ index ].href;
|
||||
}
|
||||
|
||||
if ( index < 0 || index >= elements.length ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
slide = $( '#swipebox-slider .slide' ).eq( index );
|
||||
|
||||
if ( ! $this.isVideo( src ) ) {
|
||||
slide.addClass( 'slide-loading' );
|
||||
$this.loadMedia( src, function() {
|
||||
slide.removeClass( 'slide-loading' );
|
||||
slide.html( this );
|
||||
} );
|
||||
} else {
|
||||
slide.html( $this.getVideo( src ) );
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Set link title attribute as caption
|
||||
*/
|
||||
setTitle : function ( index ) {
|
||||
var title = null;
|
||||
|
||||
$( '#swipebox-title' ).empty();
|
||||
|
||||
if ( elements[ index ] !== undefined ) {
|
||||
title = elements[ index ].title;
|
||||
}
|
||||
|
||||
if ( title ) {
|
||||
$( '#swipebox-top-bar' ).show();
|
||||
$( '#swipebox-title' ).append( title );
|
||||
} else {
|
||||
$( '#swipebox-top-bar' ).hide();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the URL is a video
|
||||
*/
|
||||
isVideo : function ( src ) {
|
||||
|
||||
if ( src ) {
|
||||
if ( src.match( /(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || src.match( /vimeo\.com\/([0-9]*)/ ) || src.match( /youtu\.be\/([a-zA-Z0-9\-_]+)/ ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( src.toLowerCase().indexOf( 'swipeboxvideo=1' ) >= 0 ) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse URI querystring and:
|
||||
* - overrides value provided via dictionary
|
||||
* - rebuild it again returning a string
|
||||
*/
|
||||
parseUri : function (uri, customData) {
|
||||
var a = document.createElement('a'),
|
||||
qs = {};
|
||||
|
||||
// Decode the URI
|
||||
a.href = decodeURIComponent( uri );
|
||||
|
||||
// QueryString to Object
|
||||
if ( a.search ) {
|
||||
qs = JSON.parse( '{"' + a.search.toLowerCase().replace('?','').replace(/&/g,'","').replace(/=/g,'":"') + '"}' );
|
||||
}
|
||||
|
||||
// Extend with custom data
|
||||
if ( $.isPlainObject( customData ) ) {
|
||||
qs = $.extend( qs, customData, plugin.settings.queryStringData ); // The dev has always the final word
|
||||
}
|
||||
|
||||
// Return querystring as a string
|
||||
return $
|
||||
.map( qs, function (val, key) {
|
||||
if ( val && val > '' ) {
|
||||
return encodeURIComponent( key ) + '=' + encodeURIComponent( val );
|
||||
}
|
||||
})
|
||||
.join('&');
|
||||
},
|
||||
|
||||
/**
|
||||
* Get video iframe code from URL
|
||||
*/
|
||||
getVideo : function( url ) {
|
||||
var iframe = '',
|
||||
youtubeUrl = url.match( /((?:www\.)?youtube\.com|(?:www\.)?youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/ ),
|
||||
youtubeShortUrl = url.match(/(?:www\.)?youtu\.be\/([a-zA-Z0-9\-_]+)/),
|
||||
vimeoUrl = url.match( /(?:www\.)?vimeo\.com\/([0-9]*)/ ),
|
||||
qs = '';
|
||||
if ( youtubeUrl || youtubeShortUrl) {
|
||||
if ( youtubeShortUrl ) {
|
||||
youtubeUrl = youtubeShortUrl;
|
||||
}
|
||||
qs = ui.parseUri( url, {
|
||||
'autoplay' : ( plugin.settings.autoplayVideos ? '1' : '0' ),
|
||||
'v' : ''
|
||||
});
|
||||
iframe = '<iframe width="560" height="315" src="//' + youtubeUrl[1] + '/embed/' + youtubeUrl[2] + '?' + qs + '" frameborder="0" allowfullscreen></iframe>';
|
||||
|
||||
} else if ( vimeoUrl ) {
|
||||
qs = ui.parseUri( url, {
|
||||
'autoplay' : ( plugin.settings.autoplayVideos ? '1' : '0' ),
|
||||
'byline' : '0',
|
||||
'portrait' : '0',
|
||||
'color': plugin.settings.vimeoColor
|
||||
});
|
||||
iframe = '<iframe width="560" height="315" src="//player.vimeo.com/video/' + vimeoUrl[1] + '?' + qs + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
|
||||
|
||||
} else {
|
||||
iframe = '<iframe width="560" height="315" src="' + url + '" frameborder="0" allowfullscreen></iframe>';
|
||||
}
|
||||
|
||||
return '<div class="swipebox-video-container" style="max-width:' + plugin.settings.videoMaxWidth + 'px"><div class="swipebox-video">' + iframe + '</div></div>';
|
||||
},
|
||||
|
||||
/**
|
||||
* Load image
|
||||
*/
|
||||
loadMedia : function ( src, callback ) {
|
||||
// Inline content
|
||||
if ( src.trim().indexOf('#') === 0 ) {
|
||||
callback.call(
|
||||
$('<div>', {
|
||||
'class' : 'swipebox-inline-container'
|
||||
})
|
||||
.append(
|
||||
$(src)
|
||||
.clone()
|
||||
.toggleClass( plugin.settings.toggleClassOnLoad )
|
||||
)
|
||||
);
|
||||
}
|
||||
// Everything else
|
||||
else {
|
||||
if ( ! this.isVideo( src ) ) {
|
||||
var img = $( '<img>' ).on( 'load', function() {
|
||||
callback.call( img );
|
||||
} );
|
||||
|
||||
img.attr( 'src', src );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get next slide
|
||||
*/
|
||||
getNext : function () {
|
||||
var $this = this,
|
||||
src,
|
||||
index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
|
||||
if ( index + 1 < elements.length ) {
|
||||
|
||||
src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src' );
|
||||
$( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
|
||||
index++;
|
||||
$this.setSlide( index );
|
||||
$this.preloadMedia( index+1 );
|
||||
if ( plugin.settings.nextSlide ) {
|
||||
plugin.settings.nextSlide();
|
||||
}
|
||||
} else {
|
||||
|
||||
if ( plugin.settings.loopAtEnd === true ) {
|
||||
src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src' );
|
||||
$( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
|
||||
index = 0;
|
||||
$this.preloadMedia( index );
|
||||
$this.setSlide( index );
|
||||
$this.preloadMedia( index + 1 );
|
||||
if ( plugin.settings.nextSlide ) {
|
||||
plugin.settings.nextSlide();
|
||||
}
|
||||
} else {
|
||||
$( '#swipebox-overlay' ).addClass( 'rightSpring' );
|
||||
setTimeout( function() {
|
||||
$( '#swipebox-overlay' ).removeClass( 'rightSpring' );
|
||||
}, 500 );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get previous slide
|
||||
*/
|
||||
getPrev : function () {
|
||||
var index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) ),
|
||||
src;
|
||||
if ( index > 0 ) {
|
||||
src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe').attr( 'src' );
|
||||
$( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
|
||||
index--;
|
||||
this.setSlide( index );
|
||||
this.preloadMedia( index-1 );
|
||||
if ( plugin.settings.prevSlide ) {
|
||||
plugin.settings.prevSlide();
|
||||
}
|
||||
} else {
|
||||
$( '#swipebox-overlay' ).addClass( 'leftSpring' );
|
||||
setTimeout( function() {
|
||||
$( '#swipebox-overlay' ).removeClass( 'leftSpring' );
|
||||
}, 500 );
|
||||
}
|
||||
},
|
||||
|
||||
nextSlide : function () {
|
||||
// Callback for next slide
|
||||
},
|
||||
|
||||
prevSlide : function () {
|
||||
// Callback for prev slide
|
||||
},
|
||||
|
||||
/**
|
||||
* Close
|
||||
*/
|
||||
closeSlide : function () {
|
||||
$( 'html' ).removeClass( 'swipebox-html' );
|
||||
$( 'html' ).removeClass( 'swipebox-touch' );
|
||||
$( window ).trigger( 'resize' );
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the whole thing
|
||||
*/
|
||||
destroy : function () {
|
||||
$( window ).unbind( 'keyup' );
|
||||
$( 'body' ).unbind( 'touchstart' );
|
||||
$( 'body' ).unbind( 'touchmove' );
|
||||
$( 'body' ).unbind( 'touchend' );
|
||||
$( '#swipebox-slider' ).unbind();
|
||||
$( '#swipebox-overlay' ).remove();
|
||||
|
||||
if ( ! $.isArray( elem ) ) {
|
||||
elem.removeData( '_swipebox' );
|
||||
}
|
||||
|
||||
if ( this.target ) {
|
||||
this.target.trigger( 'swipebox-destroy' );
|
||||
}
|
||||
|
||||
$.swipebox.isOpen = false;
|
||||
|
||||
if ( plugin.settings.afterClose ) {
|
||||
plugin.settings.afterClose();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
plugin.init();
|
||||
};
|
||||
|
||||
$.fn.swipebox = function( options ) {
|
||||
|
||||
if ( ! $.data( this, '_swipebox' ) ) {
|
||||
var swipebox = new $.swipebox( this, options );
|
||||
this.data( '_swipebox', swipebox );
|
||||
}
|
||||
return this.data( '_swipebox' );
|
||||
|
||||
};
|
||||
|
||||
}( window, document, jQuery ) );
|
||||
-2
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
function _checkImages(){var e,t=window.scrollY,n=t+window.innerHeight;document.querySelectorAll("img[data-src]").forEach(function(i){(e=i.getBoundingClientRect()).top+i.clientHeight>=t&&e.top<=n+i.clientHeight&&(i.setAttribute("src",i.getAttribute("data-src")),i.onload=function(){i.removeAttribute("data-src")})})}window.addEventListener("scroll",function(e){_checkImages()}),window.addEventListener("resize",function(e){_checkImages()});_checkImages();
|
||||
-3
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,82 +0,0 @@
|
||||
/******** MODAL BUSQUEDA ********/
|
||||
var searchButton = document.getElementById('searchButton');
|
||||
var searchModal = document.getElementById('modalBusqueda');
|
||||
var firstSearchFocus = searchModal.querySelector('.cerrar');
|
||||
var lastSearchFocus = searchModal.querySelector('.btn');
|
||||
var searchList = document.getElementById('lista-busqueda');
|
||||
var searchListUl = searchList.querySelector('ul');
|
||||
var searchInput = searchModal.querySelector('.form-control');
|
||||
searchButton.addEventListener('click', function (e) {
|
||||
showSearchModal();
|
||||
});
|
||||
|
||||
firstSearchFocus.addEventListener('click', function () {
|
||||
closeSearchModal();
|
||||
});
|
||||
|
||||
function showSearchModal() {
|
||||
document.querySelector('body').classList.add('no-scroll');
|
||||
searchModal.classList.add('active');
|
||||
searchInput.focus();
|
||||
searchModal.addEventListener('keydown', trapFocus);
|
||||
searchModal.querySelector('input.form-control').addEventListener('input', handleSearchWrite);
|
||||
searchModal.querySelector('select').addEventListener('change', handleSearchWrite);
|
||||
}
|
||||
|
||||
function trapFocus(e) {
|
||||
switch (e.keyCode) {
|
||||
case 9:
|
||||
if (e.shiftKey) {
|
||||
if (document.activeElement === firstSearchFocus) {
|
||||
e.preventDefault();
|
||||
lastSearchFocus.focus();
|
||||
}
|
||||
} else {
|
||||
if (document.activeElement === lastSearchFocus) {
|
||||
e.preventDefault();
|
||||
firstSearchFocus.focus();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
closeSearchModal();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearchWrite(e) {
|
||||
if (searchInput.value == "") {
|
||||
searchModal.classList.remove('writing');
|
||||
searchList.classList.add('hidden');
|
||||
} else {
|
||||
searchModal.classList.add('writing');
|
||||
searchList.classList.remove('hidden');
|
||||
searchListUl.innerHTML = '';
|
||||
var orderBy = searchModal.querySelector('select[name=order]').value;
|
||||
fetch(`/productos.php?q=${searchInput.value}&order=${orderBy}`)
|
||||
.then((data) => {
|
||||
return data.json()
|
||||
})
|
||||
.then((json) => {
|
||||
if (json.query !== searchInput.value) return;
|
||||
if (json.mensaje) {
|
||||
searchList.querySelector('.message').innerHTML = json.mensaje;
|
||||
} else {
|
||||
searchList.querySelector('.message').innerHTML = '';
|
||||
}
|
||||
searchListUl.innerHTML = json.html;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function closeSearchModal() {
|
||||
document.querySelector('body').classList.remove('no-scroll');
|
||||
searchModal.classList.remove('active');
|
||||
searchButton.focus();
|
||||
searchModal.removeEventListener('keydown', trapFocus);
|
||||
searchModal.querySelector('.form-control').removeEventListener('input', handleSearchWrite);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
-9
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
function eliminar_de_la_cesta(num,numVariacion){var cesta=localStorage.getItem("cesta");if(!cesta){cesta="[]";}var cestaJSON=JSON.parse(cesta);var cesta_auxJSON=[];for(i=0;i<cestaJSON.length;i++){if(Boolean(cestaJSON[i])){if(cestaJSON[i]["num"]==num&&cestaJSON[i]["numVariacion"]==numVariacion){}else{cesta_auxJSON.push(cestaJSON[i]);}}}cestaJSON=cesta_auxJSON;localStorage["cesta"]=JSON.stringify(cestaJSON);actualiza_cesta_lateral();if(cestaJSON.length==0)document.location.reload();}function tengo_este_producto_en_la_cesta(num,numVariacion){var cesta=localStorage.getItem("cesta");cestaJSON=JSON.parse(cesta);for(i=0;i<cestaJSON.length;i++){if(Boolean(cestaJSON[i])){if(cestaJSON[i]["num"]==num&&cestaJSON[i]["numVariacion"]==numVariacion)return num;}}return 0;}function suma_cantidad_producto_cesta(num,cantidad,numVariacion){var cesta=localStorage.getItem("cesta");if(!cesta)cesta="[]";var cestaJSON=JSON.parse(cesta);for(i=0;i<cestaJSON.length;i++){if(Boolean(cestaJSON[i])){if(cestaJSON[i]["num"]==num&&cestaJSON[i]["numVariacion"]==numVariacion){var cantidad_cesta=parseInt(cestaJSON[i]["cantidad"])+parseInt(cantidad);$.ajax({data:"dame_precio_cantidades=1&producto="+num+"&numVariacion="+numVariacion+"+&cantidad="+cantidad_cesta,async:false,type:"POST",url:"/ajax.php",success:function(data){if(data!=""){var nuevo_precio=data;cestaJSON[i]["precio"]=nuevo_precio;cestaJSON[i]["cantidad"]=cantidad_cesta;}else{alert("Has superado el stock disponible. Si deseas comprar una mayor cantidad ponte en contacto con nosotros");}}});}}}cesta=JSON.stringify(cestaJSON);localStorage["cesta"]=cesta;actualiza_cesta_lateral();}function resta_cantidad_producto_cesta(num,cantidad,numVariacion){var cesta=localStorage.getItem("cesta");if(!cesta)cesta="[]";var cestaJSON=JSON.parse(cesta);for(i=0;i<cestaJSON.length;i++){if(Boolean(cestaJSON[i])){if(cestaJSON[i]["num"]==num&&cestaJSON[i]["numVariacion"]==numVariacion){var cantidad_cesta=parseInt(cestaJSON[i]["cantidad"])-parseInt(cantidad);if(cantidad_cesta<=0){return eliminar_de_la_cesta(num,numVariacion);}$.ajax({data:"dame_precio_cantidades=1&producto="+num+"&numVariacion="+numVariacion+"+&cantidad="+cantidad_cesta,async:false,type:"POST",url:"/ajax.php",success:function(data){if(data!=""){var nuevo_precio=data;cestaJSON[i]["precio"]=nuevo_precio;cestaJSON[i]["cantidad"]=cantidad_cesta;}else{alert("Has superado el stock disponible. Si deseas comprar una mayor cantidad ponte en contacto con nosotros");}}});}}}cesta=JSON.stringify(cestaJSON);localStorage["cesta"]=cesta;actualiza_cesta_lateral();}function actualiza_cesta_lateral(){var cesta=localStorage.getItem("cesta");if(!cesta)cesta="[]";var cestaJSON=JSON.parse(cesta);can=0;if(Boolean(cestaJSON)){for(i=0;i<cestaJSON.length;i++){can+=parseInt(cestaJSON[i]["cantidad"]);}}if(Boolean(document.getElementById("numeroCesta"))){document.getElementById("numeroCesta").innerHTML=can;}}actualiza_cesta_lateral();function anade_cesta(objeto,nombre,num,cantidad,numVariacion,precio,stock,textoVariacion){var imagen=$(objeto).attr("imagen");console.log($(objeto).html());$(this).remove();var foto=imagen;var producto_completo={cantidad:parseInt(cantidad),precio:precio,num:num,numVariacion:numVariacion,nombre:nombre,textoVariacion:textoVariacion,foto:foto};if(!localStorage.getItem("cesta")){localStorage.setItem('cesta',"["+JSON.stringify(producto_completo)+"]");}else{if(!tengo_este_producto_en_la_cesta(num,numVariacion)){var cestaJSON=JSON.parse(localStorage.getItem("cesta"));cestaJSON.push(producto_completo);localStorage["cesta"]=JSON.stringify(cestaJSON);}else{suma_cantidad_producto_cesta(num,cantidad,numVariacion);}}actualiza_cesta_lateral();}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
(function(self){'use strict';if(self.fetch){return}
|
||||
var support={searchParams:'URLSearchParams' in self,iterable:'Symbol' in self&&'iterator' in Symbol,blob:'FileReader' in self&&'Blob' in self&&(function(){try{new Blob()
|
||||
return!0}catch(e){return!1}})(),formData:'FormData' in self,arrayBuffer:'ArrayBuffer' in self}
|
||||
if(support.arrayBuffer){var viewClasses=['[object Int8Array]','[object Uint8Array]','[object Uint8ClampedArray]','[object Int16Array]','[object Uint16Array]','[object Int32Array]','[object Uint32Array]','[object Float32Array]','[object Float64Array]']
|
||||
var isDataView=function(obj){return obj&&DataView.prototype.isPrototypeOf(obj)}
|
||||
var isArrayBufferView=ArrayBuffer.isView||function(obj){return obj&&viewClasses.indexOf(Object.prototype.toString.call(obj))>-1}}
|
||||
function normalizeName(name){if(typeof name!=='string'){name=String(name)}
|
||||
if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)){throw new TypeError('Invalid character in header field name')}
|
||||
return name.toLowerCase()}
|
||||
function normalizeValue(value){if(typeof value!=='string'){value=String(value)}
|
||||
return value}
|
||||
function iteratorFor(items){var iterator={next:function(){var value=items.shift()
|
||||
return{done:value===undefined,value:value}}}
|
||||
if(support.iterable){iterator[Symbol.iterator]=function(){return iterator}}
|
||||
return iterator}
|
||||
function Headers(headers){this.map={}
|
||||
if(headers instanceof Headers){headers.forEach(function(value,name){this.append(name,value)},this)}else if(Array.isArray(headers)){headers.forEach(function(header){this.append(header[0],header[1])},this)}else if(headers){Object.getOwnPropertyNames(headers).forEach(function(name){this.append(name,headers[name])},this)}}
|
||||
Headers.prototype.append=function(name,value){name=normalizeName(name)
|
||||
value=normalizeValue(value)
|
||||
var oldValue=this.map[name]
|
||||
this.map[name]=oldValue?oldValue+','+value:value}
|
||||
Headers.prototype['delete']=function(name){delete this.map[normalizeName(name)]}
|
||||
Headers.prototype.get=function(name){name=normalizeName(name)
|
||||
return this.has(name)?this.map[name]:null}
|
||||
Headers.prototype.has=function(name){return this.map.hasOwnProperty(normalizeName(name))}
|
||||
Headers.prototype.set=function(name,value){this.map[normalizeName(name)]=normalizeValue(value)}
|
||||
Headers.prototype.forEach=function(callback,thisArg){for(var name in this.map){if(this.map.hasOwnProperty(name)){callback.call(thisArg,this.map[name],name,this)}}}
|
||||
Headers.prototype.keys=function(){var items=[]
|
||||
this.forEach(function(value,name){items.push(name)})
|
||||
return iteratorFor(items)}
|
||||
Headers.prototype.values=function(){var items=[]
|
||||
this.forEach(function(value){items.push(value)})
|
||||
return iteratorFor(items)}
|
||||
Headers.prototype.entries=function(){var items=[]
|
||||
this.forEach(function(value,name){items.push([name,value])})
|
||||
return iteratorFor(items)}
|
||||
if(support.iterable){Headers.prototype[Symbol.iterator]=Headers.prototype.entries}
|
||||
function consumed(body){if(body.bodyUsed){return Promise.reject(new TypeError('Already read'))}
|
||||
body.bodyUsed=!0}
|
||||
function fileReaderReady(reader){return new Promise(function(resolve,reject){reader.onload=function(){resolve(reader.result)}
|
||||
reader.onerror=function(){reject(reader.error)}})}
|
||||
function readBlobAsArrayBuffer(blob){var reader=new FileReader()
|
||||
var promise=fileReaderReady(reader)
|
||||
reader.readAsArrayBuffer(blob)
|
||||
return promise}
|
||||
function readBlobAsText(blob){var reader=new FileReader()
|
||||
var promise=fileReaderReady(reader)
|
||||
reader.readAsText(blob)
|
||||
return promise}
|
||||
function readArrayBufferAsText(buf){var view=new Uint8Array(buf)
|
||||
var chars=new Array(view.length)
|
||||
for(var i=0;i<view.length;i++){chars[i]=String.fromCharCode(view[i])}
|
||||
return chars.join('')}
|
||||
function bufferClone(buf){if(buf.slice){return buf.slice(0)}else{var view=new Uint8Array(buf.byteLength)
|
||||
view.set(new Uint8Array(buf))
|
||||
return view.buffer}}
|
||||
function Body(){this.bodyUsed=!1
|
||||
this._initBody=function(body){this._bodyInit=body
|
||||
if(!body){this._bodyText=''}else if(typeof body==='string'){this._bodyText=body}else if(support.blob&&Blob.prototype.isPrototypeOf(body)){this._bodyBlob=body}else if(support.formData&&FormData.prototype.isPrototypeOf(body)){this._bodyFormData=body}else if(support.searchParams&&URLSearchParams.prototype.isPrototypeOf(body)){this._bodyText=body.toString()}else if(support.arrayBuffer&&support.blob&&isDataView(body)){this._bodyArrayBuffer=bufferClone(body.buffer)
|
||||
this._bodyInit=new Blob([this._bodyArrayBuffer])}else if(support.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(body)||isArrayBufferView(body))){this._bodyArrayBuffer=bufferClone(body)}else{throw new Error('unsupported BodyInit type')}
|
||||
if(!this.headers.get('content-type')){if(typeof body==='string'){this.headers.set('content-type','text/plain;charset=UTF-8')}else if(this._bodyBlob&&this._bodyBlob.type){this.headers.set('content-type',this._bodyBlob.type)}else if(support.searchParams&&URLSearchParams.prototype.isPrototypeOf(body)){this.headers.set('content-type','application/x-www-form-urlencoded;charset=UTF-8')}}}
|
||||
if(support.blob){this.blob=function(){var rejected=consumed(this)
|
||||
if(rejected){return rejected}
|
||||
if(this._bodyBlob){return Promise.resolve(this._bodyBlob)}else if(this._bodyArrayBuffer){return Promise.resolve(new Blob([this._bodyArrayBuffer]))}else if(this._bodyFormData){throw new Error('could not read FormData body as blob')}else{return Promise.resolve(new Blob([this._bodyText]))}}
|
||||
this.arrayBuffer=function(){if(this._bodyArrayBuffer){return consumed(this)||Promise.resolve(this._bodyArrayBuffer)}else{return this.blob().then(readBlobAsArrayBuffer)}}}
|
||||
this.text=function(){var rejected=consumed(this)
|
||||
if(rejected){return rejected}
|
||||
if(this._bodyBlob){return readBlobAsText(this._bodyBlob)}else if(this._bodyArrayBuffer){return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))}else if(this._bodyFormData){throw new Error('could not read FormData body as text')}else{return Promise.resolve(this._bodyText)}}
|
||||
if(support.formData){this.formData=function(){return this.text().then(decode)}}
|
||||
this.json=function(){return this.text().then(JSON.parse)}
|
||||
return this}
|
||||
var methods=['DELETE','GET','HEAD','OPTIONS','POST','PUT']
|
||||
function normalizeMethod(method){var upcased=method.toUpperCase()
|
||||
return(methods.indexOf(upcased)>-1)?upcased:method}
|
||||
function Request(input,options){options=options||{}
|
||||
var body=options.body
|
||||
if(input instanceof Request){if(input.bodyUsed){throw new TypeError('Already read')}
|
||||
this.url=input.url
|
||||
this.credentials=input.credentials
|
||||
if(!options.headers){this.headers=new Headers(input.headers)}
|
||||
this.method=input.method
|
||||
this.mode=input.mode
|
||||
if(!body&&input._bodyInit!=null){body=input._bodyInit
|
||||
input.bodyUsed=!0}}else{this.url=String(input)}
|
||||
this.credentials=options.credentials||this.credentials||'omit'
|
||||
if(options.headers||!this.headers){this.headers=new Headers(options.headers)}
|
||||
this.method=normalizeMethod(options.method||this.method||'GET')
|
||||
this.mode=options.mode||this.mode||null
|
||||
this.referrer=null
|
||||
if((this.method==='GET'||this.method==='HEAD')&&body){throw new TypeError('Body not allowed for GET or HEAD requests')}
|
||||
this._initBody(body)}
|
||||
Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})}
|
||||
function decode(body){var form=new FormData()
|
||||
body.trim().split('&').forEach(function(bytes){if(bytes){var split=bytes.split('=')
|
||||
var name=split.shift().replace(/\+/g,' ')
|
||||
var value=split.join('=').replace(/\+/g,' ')
|
||||
form.append(decodeURIComponent(name),decodeURIComponent(value))}})
|
||||
return form}
|
||||
function parseHeaders(rawHeaders){var headers=new Headers()
|
||||
var preProcessedHeaders=rawHeaders.replace(/\r?\n[\t ]+/g,' ')
|
||||
preProcessedHeaders.split(/\r?\n/).forEach(function(line){var parts=line.split(':')
|
||||
var key=parts.shift().trim()
|
||||
if(key){var value=parts.join(':').trim()
|
||||
headers.append(key,value)}})
|
||||
return headers}
|
||||
Body.call(Request.prototype)
|
||||
function Response(bodyInit,options){if(!options){options={}}
|
||||
this.type='default'
|
||||
this.status=options.status===undefined?200:options.status
|
||||
this.ok=this.status>=200&&this.status<300
|
||||
this.statusText='statusText' in options?options.statusText:'OK'
|
||||
this.headers=new Headers(options.headers)
|
||||
this.url=options.url||''
|
||||
this._initBody(bodyInit)}
|
||||
Body.call(Response.prototype)
|
||||
Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})}
|
||||
Response.error=function(){var response=new Response(null,{status:0,statusText:''})
|
||||
response.type='error'
|
||||
return response}
|
||||
var redirectStatuses=[301,302,303,307,308]
|
||||
Response.redirect=function(url,status){if(redirectStatuses.indexOf(status)===-1){throw new RangeError('Invalid status code')}
|
||||
return new Response(null,{status:status,headers:{location:url}})}
|
||||
self.Headers=Headers
|
||||
self.Request=Request
|
||||
self.Response=Response
|
||||
self.fetch=function(input,init){return new Promise(function(resolve,reject){var request=new Request(input,init)
|
||||
var xhr=new XMLHttpRequest()
|
||||
xhr.onload=function(){var options={status:xhr.status,statusText:xhr.statusText,headers:parseHeaders(xhr.getAllResponseHeaders()||'')}
|
||||
options.url='responseURL' in xhr?xhr.responseURL:options.headers.get('X-Request-URL')
|
||||
var body='response' in xhr?xhr.response:xhr.responseText
|
||||
resolve(new Response(body,options))}
|
||||
xhr.onerror=function(){reject(new TypeError('Network request failed'))}
|
||||
xhr.ontimeout=function(){reject(new TypeError('Network request failed'))}
|
||||
xhr.open(request.method,request.url,!0)
|
||||
if(request.credentials==='include'){xhr.withCredentials=!0}else if(request.credentials==='omit'){xhr.withCredentials=!1}
|
||||
if('responseType' in xhr&&support.blob){xhr.responseType='blob'}
|
||||
request.headers.forEach(function(value,name){xhr.setRequestHeader(name,value)})
|
||||
xhr.send(typeof request._bodyInit==='undefined'?null:request._bodyInit)})}
|
||||
self.fetch.polyfill=!0})(typeof self!=='undefined'?self:this)
|
||||
File diff suppressed because one or more lines are too long
@@ -1,37 +0,0 @@
|
||||
(function umd(root,factory){if(typeof module==='object'&&typeof exports==='object')
|
||||
module.exports=factory()
|
||||
else if(typeof define==='function'&&define.amd)
|
||||
define([],factory)
|
||||
else root.httpVueLoader=factory()})(this,function factory(){'use strict';var scopeIndex=0;StyleContext.prototype={withBase:function(callback){var tmpBaseElt;if(this.component.baseURI){tmpBaseElt=document.createElement('base');tmpBaseElt.href=this.component.baseURI;var headElt=this.component.getHead();headElt.insertBefore(tmpBaseElt,headElt.firstChild)}
|
||||
callback.call(this);if(tmpBaseElt)
|
||||
this.component.getHead().removeChild(tmpBaseElt)},scopeStyles:function(styleElt,scopeName){function process(){var sheet=styleElt.sheet;var rules=sheet.cssRules;for(var i=0;i<rules.length;++i){var rule=rules[i];if(rule.type!==1)
|
||||
continue;var scopedSelectors=[];rule.selectorText.split(/\s*,\s*/).forEach(function(sel){scopedSelectors.push(scopeName+' '+sel);var segments=sel.match(/([^ :]+)(.+)?/);scopedSelectors.push(segments[1]+scopeName+(segments[2]||''))});var scopedRule=scopedSelectors.join(',')+rule.cssText.substr(rule.selectorText.length);sheet.deleteRule(i);sheet.insertRule(scopedRule,i)}}
|
||||
try{process()}catch(ex){if(ex instanceof DOMException&&ex.code===DOMException.INVALID_ACCESS_ERR){styleElt.sheet.disabled=!0;styleElt.addEventListener('load',function onStyleLoaded(){styleElt.removeEventListener('load',onStyleLoaded);setTimeout(function(){process();styleElt.sheet.disabled=!1})});return}
|
||||
throw ex}},compile:function(){var hasTemplate=this.template!==null;var scoped=this.elt.hasAttribute('scoped');if(scoped){if(!hasTemplate)
|
||||
return;this.elt.removeAttribute('scoped')}
|
||||
this.withBase(function(){this.component.getHead().appendChild(this.elt)});if(scoped)
|
||||
this.scopeStyles(this.elt,'['+this.component.getScopeId()+']');return Promise.resolve()},getContent:function(){return this.elt.textContent},setContent:function(content){this.withBase(function(){this.elt.textContent=content})}};function StyleContext(component,elt){this.component=component;this.elt=elt}
|
||||
ScriptContext.prototype={getContent:function(){return this.elt.textContent},setContent:function(content){this.elt.textContent=content},compile:function(module){var childModuleRequire=function(childURL){return httpVueLoader.require(resolveURL(this.component.baseURI,childURL))}.bind(this);var childLoader=function(childURL,childName){return httpVueLoader(resolveURL(this.component.baseURI,childURL),childName)}.bind(this);try{Function('exports','require','httpVueLoader','module',this.getContent()).call(this.module.exports,this.module.exports,childModuleRequire,childLoader,this.module)}catch(ex){if(!('lineNumber' in ex)){return Promise.reject(ex)}
|
||||
var vueFileData=responseText.replace(/\r?\n/g,'\n');var lineNumber=vueFileData.substr(0,vueFileData.indexOf(script)).split('\n').length+ex.lineNumber-1;throw new(ex.constructor)(ex.message,url,lineNumber)}
|
||||
return Promise.resolve(this.module.exports).then(httpVueLoader.scriptExportsHandler.bind(this)).then(function(exports){this.module.exports=exports}.bind(this))}};function ScriptContext(component,elt){this.component=component;this.elt=elt;this.module={exports:{}}}
|
||||
TemplateContext.prototype={getContent:function(){return this.elt.innerHTML},setContent:function(content){this.elt.innerHTML=content},getRootElt:function(){var tplElt=this.elt.content||this.elt;if('firstElementChild' in tplElt)
|
||||
return tplElt.firstElementChild;for(tplElt=tplElt.firstChild;tplElt!==null;tplElt=tplElt.nextSibling)
|
||||
if(tplElt.nodeType===Node.ELEMENT_NODE)
|
||||
return tplElt;return null},compile:function(){return Promise.resolve()}};function TemplateContext(component,elt){this.component=component;this.elt=elt}
|
||||
Component.prototype={getHead:function(){return document.head||document.getElementsByTagName('head')[0]},getScopeId:function(){if(this._scopeId===''){this._scopeId='data-s-'+(scopeIndex++).toString(36);this.template.getRootElt().setAttribute(this._scopeId,'')}
|
||||
return this._scopeId},load:function(componentURL){return httpVueLoader.httpRequest(componentURL).then(function(responseText){this.baseURI=componentURL.substr(0,componentURL.lastIndexOf('/')+1);var doc=document.implementation.createHTMLDocument('');doc.body.innerHTML=(this.baseURI?'<base href="'+this.baseURI+'">':'')+responseText;for(var it=doc.body.firstChild;it;it=it.nextSibling){switch(it.nodeName){case 'TEMPLATE':this.template=new TemplateContext(this,it);break;case 'SCRIPT':this.script=new ScriptContext(this,it);break;case 'STYLE':this.styles.push(new StyleContext(this,it));break}}
|
||||
return this}.bind(this))},_normalizeSection:function(eltCx){var p;if(eltCx===null||!eltCx.elt.hasAttribute('src')){p=Promise.resolve(null)}else{p=httpVueLoader.httpRequest(eltCx.elt.getAttribute('src')).then(function(content){eltCx.elt.removeAttribute('src');return content})}
|
||||
return p.then(function(content){if(eltCx!==null&&eltCx.elt.hasAttribute('lang')){var lang=eltCx.elt.getAttribute('lang');eltCx.elt.removeAttribute('lang');return httpVueLoader.langProcessor[lang.toLowerCase()].call(this,content===null?eltCx.getContent():content)}
|
||||
return content}.bind(this)).then(function(content){if(content!==null)
|
||||
eltCx.setContent(content)})},normalize:function(){return Promise.all(Array.prototype.concat(this._normalizeSection(this.template),this._normalizeSection(this.script),this.styles.map(this._normalizeSection))).then(function(){return this}.bind(this))},compile:function(){return Promise.all(Array.prototype.concat(this.template&&this.template.compile(),this.script&&this.script.compile(),this.styles.map(function(style){return style.compile()}))).then(function(){return this}.bind(this))}};function Component(name){this.name=name;this.template=null;this.script=null;this.styles=[];this._scopeId=''}
|
||||
function identity(value){return value}
|
||||
function parseComponentURL(url){var comp=url.match(/(.*?)([^/]+?)\/?(\.vue)?(\?.*|#.*|$)/);return{name:comp[2],url:comp[1]+comp[2]+(comp[3]===undefined?'/index.vue':comp[3])+comp[4]}}
|
||||
function resolveURL(baseURL,url){if(url.substr(0,2)==='./'||url.substr(0,3)==='../'){return baseURL+url}
|
||||
return url}
|
||||
httpVueLoader.load=function(url,name){return function(){return new Component(name).load(url).then(function(component){return component.normalize()}).then(function(component){return component.compile()}).then(function(component){var exports=component.script!==null?component.script.module.exports:{};if(component.template!==null)
|
||||
exports.template=component.template.getContent();if(exports.name===undefined)
|
||||
if(component.name!==undefined)
|
||||
exports.name=component.name;exports._baseURI=component.baseURI;return exports})}};httpVueLoader.register=function(Vue,url){var comp=parseComponentURL(url);Vue.component(comp.name,httpVueLoader.load(comp.url))};httpVueLoader.install=function(Vue){Vue.mixin({beforeCreate:function(){var components=this.$options.components;for(var componentName in components){if(typeof(components[componentName])==='string'&&components[componentName].substr(0,4)==='url:'){var comp=parseComponentURL(components[componentName].substr(4));var componentURL=('_baseURI' in this.$options)?resolveURL(this.$options._baseURI,comp.url):comp.url;if(isNaN(componentName))
|
||||
components[componentName]=httpVueLoader.load(componentURL,componentName);else components[componentName]=Vue.component(comp.name,httpVueLoader.load(componentURL,comp.name))}}}})};httpVueLoader.require=function(moduleName){return window[moduleName]};httpVueLoader.httpRequest=function(url){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest();xhr.open('GET',url);xhr.responseType='text';xhr.onreadystatechange=function(){if(xhr.readyState===4){if(xhr.status>=200&&xhr.status<300)
|
||||
resolve(xhr.responseText);else reject(xhr.status)}};xhr.send(null)})};httpVueLoader.langProcessor={html:identity,js:identity,css:identity};httpVueLoader.scriptExportsHandler=identity;function httpVueLoader(url,name){var comp=parseComponentURL(url);return httpVueLoader.load(comp.url,name)}
|
||||
return httpVueLoader})
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
new WOW().init();$('[data-rel="swipebox"]').swipebox()
|
||||
File diff suppressed because one or more lines are too long
@@ -1,9 +0,0 @@
|
||||
var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],window_width=w.innerWidth||e.clientWidth||g.clientWidth,window_height=w.innerHeight||e.clientHeight||g.clientHeight;var navbar_toggle=document.querySelector('.navbar-toggle');var navbar=document.querySelector('.navbar-wrapper');var navbar_items=navbar.querySelector('.nav');var scroll=0.0;var navbarHeight=navbar.offsetHeight;const OFFSET_TOP=30.0;window.addEventListener('scroll',function(){scroll=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;toggle_nav_style()});window.addEventListener('resize',function(){window_width=w.innerWidth||e.clientWidth||g.clientWidth;window_height=w.innerHeight||e.clientHeight||g.clientHeight;toggle_nav_style()});toggle_nav_style(!0);window.dispatchEvent(new Event('scroll'));window.dispatchEvent(new Event('resize'));function toggle_nav_style(force){if(scroll>=OFFSET_TOP||window_width<1024){nav_alt(force)}else{nav_normal(force)}}
|
||||
function nav_normal(force){if(!navbar.classList.contains('bg-white')&&!force)return!1;navbar.classList.remove('bg-white');navbar.classList.remove('shadow-md')}
|
||||
function nav_alt(force){if(navbar.classList.contains('bg-white')&&!force)return!1;navbar.classList.add('bg-white');navbar.classList.add('shadow-md')}
|
||||
function scrollIt(destination,duration=200,easing='linear',callback){const easings={linear(t){return t},easeInQuad(t){return t*t},easeOutQuad(t){return t*(2-t)},easeInOutQuad(t){return t<0.5?2*t*t:-1+(4-2*t)*t},easeInCubic(t){return t*t*t},easeOutCubic(t){return(--t)*t*t+1},easeInOutCubic(t){return t<0.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart(t){return t*t*t*t},easeOutQuart(t){return 1-(--t)*t*t*t},easeInOutQuart(t){return t<0.5?8*t*t*t*t:1-8*(--t)*t*t*t},easeInQuint(t){return t*t*t*t*t},easeOutQuint(t){return 1+(--t)*t*t*t*t},easeInOutQuint(t){return t<0.5?16*t*t*t*t*t:1+16*(--t)*t*t*t*t}};const start=window.pageYOffset;const startTime='now' in window.performance?performance.now():new Date().getTime();const documentHeight=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight);const windowHeight=window.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName('body')[0].clientHeight;const destinationOffset=typeof destination==='number'?destination:destination.offsetTop-navbarHeight;const destinationOffsetToScroll=Math.round(documentHeight-destinationOffset<windowHeight?documentHeight-windowHeight:destinationOffset);if('requestAnimationFrame' in window===!1){window.scrollTo(0,destinationOffsetToScroll);if(callback){callback()}
|
||||
return}
|
||||
function scroll(){const now='now' in window.performance?performance.now():new Date().getTime();const time=Math.min(1,((now-startTime)/duration));const timeFunction=easings[easing](time);window.scrollTo(0,Math.ceil((timeFunction*(destinationOffsetToScroll-start))+start));if(window.pageYOffset===destinationOffsetToScroll){if(callback){callback()}
|
||||
return}
|
||||
requestAnimationFrame(scroll)}
|
||||
scroll()}
|
||||
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-2
File diff suppressed because one or more lines are too long
@@ -1,7 +0,0 @@
|
||||
class Api{static send(request_method="POST",url,header,body={},callback,server=Api.server,type){url=server+url;var xhr=new XMLHttpRequest();xhr.addEventListener("readystatechange",function(){if(this.readyState===4){try{callback(JSON.parse(this.responseText))}catch(error){callback(this.responseText)}}});xhr.open(request_method,url);for(const key in Api.defaultHeader){xhr.setRequestHeader(key,Api.defaultHeader[key])}
|
||||
if(header){for(const key in header){xhr.setRequestHeader(key,header[key])}}
|
||||
xhr.send(JSON.stringify(body))}
|
||||
static suscribeStripeMarketeina(selection){return new Promise((resolve,reject)=>{if(!Api.token){reject(new Error("No hay token"));return!1}
|
||||
Api.send("POST","/api/pay/",{Authorization:"Bearer "+Api.token},{method:"POST",action:"suscribeMarketeina",selection:selection},response=>{if(!response.success){if(JSON.parse(response).code==403){alert("Acceso a la aplicacion denegado, esto puede ocurrir por inactividad, vuelva a loguearse");localStorage.removeItem("COCOOKIE");localStorage.removeItem("COCOUSERNUM");window.location.reload()}}
|
||||
resolve(response)})})}}
|
||||
Api.user=null;Api.usernum=null;Api.token=null;Api.server="https://ws.cocosolution.com";Api.defaultHeader={"Content-type":"application/json"}
|
||||
@@ -1,2 +0,0 @@
|
||||
new WOW().init();
|
||||
$('[data-rel="swipebox"]').swipebox();
|
||||
File diff suppressed because one or more lines are too long
@@ -1,13 +0,0 @@
|
||||
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
|
||||
require('../../js/transition.js')
|
||||
require('../../js/alert.js')
|
||||
require('../../js/button.js')
|
||||
require('../../js/carousel.js')
|
||||
require('../../js/collapse.js')
|
||||
require('../../js/dropdown.js')
|
||||
require('../../js/modal.js')
|
||||
require('../../js/tooltip.js')
|
||||
require('../../js/popover.js')
|
||||
require('../../js/scrollspy.js')
|
||||
require('../../js/tab.js')
|
||||
require('../../js/affix.js')
|
||||
@@ -1,861 +0,0 @@
|
||||
/*! PhotoSwipe Default UI - 4.1.2 - 2017-04-05
|
||||
* http://photoswipe.com
|
||||
* Copyright (c) 2017 Dmitry Semenov; */
|
||||
/**
|
||||
*
|
||||
* UI on top of main sliding area (caption, arrows, close button, etc.).
|
||||
* Built just using public methods/properties of PhotoSwipe.
|
||||
*
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
root.PhotoSwipeUI_Default = factory();
|
||||
}
|
||||
})(this, function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
var PhotoSwipeUI_Default =
|
||||
function(pswp, framework) {
|
||||
|
||||
var ui = this;
|
||||
var _overlayUIUpdated = false,
|
||||
_controlsVisible = true,
|
||||
_fullscrenAPI,
|
||||
_controls,
|
||||
_captionContainer,
|
||||
_fakeCaptionContainer,
|
||||
_indexIndicator,
|
||||
_shareButton,
|
||||
_shareModal,
|
||||
_shareModalHidden = true,
|
||||
_initalCloseOnScrollValue,
|
||||
_isIdle,
|
||||
_listen,
|
||||
|
||||
_loadingIndicator,
|
||||
_loadingIndicatorHidden,
|
||||
_loadingIndicatorTimeout,
|
||||
|
||||
_galleryHasOneSlide,
|
||||
|
||||
_options,
|
||||
_defaultUIOptions = {
|
||||
barsSize: {top:44, bottom:'auto'},
|
||||
closeElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'],
|
||||
timeToIdle: 4000,
|
||||
timeToIdleOutside: 1000,
|
||||
loadingIndicatorDelay: 1000, // 2s
|
||||
|
||||
addCaptionHTMLFn: function(item, captionEl /*, isFake */) {
|
||||
if(!item.title) {
|
||||
captionEl.children[0].innerHTML = '';
|
||||
return false;
|
||||
}
|
||||
captionEl.children[0].innerHTML = item.title;
|
||||
return true;
|
||||
},
|
||||
|
||||
closeEl:true,
|
||||
captionEl: true,
|
||||
fullscreenEl: true,
|
||||
zoomEl: true,
|
||||
shareEl: true,
|
||||
counterEl: true,
|
||||
arrowEl: true,
|
||||
preloaderEl: true,
|
||||
|
||||
tapToClose: false,
|
||||
tapToToggleControls: true,
|
||||
|
||||
clickToCloseNonZoomable: true,
|
||||
|
||||
shareButtons: [
|
||||
{id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'},
|
||||
{id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'},
|
||||
{id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/'+
|
||||
'?url={{url}}&media={{image_url}}&description={{text}}'},
|
||||
{id:'download', label:'Download image', url:'{{raw_image_url}}', download:true}
|
||||
],
|
||||
getImageURLForShare: function( /* shareButtonData */ ) {
|
||||
return pswp.currItem.src || '';
|
||||
},
|
||||
getPageURLForShare: function( /* shareButtonData */ ) {
|
||||
return window.location.href;
|
||||
},
|
||||
getTextForShare: function( /* shareButtonData */ ) {
|
||||
return pswp.currItem.title || '';
|
||||
},
|
||||
|
||||
indexIndicatorSep: ' / ',
|
||||
fitControlsWidth: 1200
|
||||
|
||||
},
|
||||
_blockControlsTap,
|
||||
_blockControlsTapTimeout;
|
||||
|
||||
|
||||
|
||||
var _onControlsTap = function(e) {
|
||||
if(_blockControlsTap) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
e = e || window.event;
|
||||
|
||||
if(_options.timeToIdle && _options.mouseUsed && !_isIdle) {
|
||||
// reset idle timer
|
||||
_onIdleMouseMove();
|
||||
}
|
||||
|
||||
|
||||
var target = e.target || e.srcElement,
|
||||
uiElement,
|
||||
clickedClass = target.getAttribute('class') || '',
|
||||
found;
|
||||
|
||||
for(var i = 0; i < _uiElements.length; i++) {
|
||||
uiElement = _uiElements[i];
|
||||
if(uiElement.onTap && clickedClass.indexOf('pswp__' + uiElement.name ) > -1 ) {
|
||||
uiElement.onTap();
|
||||
found = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(found) {
|
||||
if(e.stopPropagation) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
_blockControlsTap = true;
|
||||
|
||||
// Some versions of Android don't prevent ghost click event
|
||||
// when preventDefault() was called on touchstart and/or touchend.
|
||||
//
|
||||
// This happens on v4.3, 4.2, 4.1,
|
||||
// older versions strangely work correctly,
|
||||
// but just in case we add delay on all of them)
|
||||
var tapDelay = framework.features.isOldAndroid ? 600 : 30;
|
||||
_blockControlsTapTimeout = setTimeout(function() {
|
||||
_blockControlsTap = false;
|
||||
}, tapDelay);
|
||||
}
|
||||
|
||||
},
|
||||
_fitControlsInViewport = function() {
|
||||
return !pswp.likelyTouchDevice || _options.mouseUsed || screen.width > _options.fitControlsWidth;
|
||||
},
|
||||
_togglePswpClass = function(el, cName, add) {
|
||||
framework[ (add ? 'add' : 'remove') + 'Class' ](el, 'pswp__' + cName);
|
||||
},
|
||||
|
||||
// add class when there is just one item in the gallery
|
||||
// (by default it hides left/right arrows and 1ofX counter)
|
||||
_countNumItems = function() {
|
||||
var hasOneSlide = (_options.getNumItemsFn() === 1);
|
||||
|
||||
if(hasOneSlide !== _galleryHasOneSlide) {
|
||||
_togglePswpClass(_controls, 'ui--one-slide', hasOneSlide);
|
||||
_galleryHasOneSlide = hasOneSlide;
|
||||
}
|
||||
},
|
||||
_toggleShareModalClass = function() {
|
||||
_togglePswpClass(_shareModal, 'share-modal--hidden', _shareModalHidden);
|
||||
},
|
||||
_toggleShareModal = function() {
|
||||
|
||||
_shareModalHidden = !_shareModalHidden;
|
||||
|
||||
|
||||
if(!_shareModalHidden) {
|
||||
_toggleShareModalClass();
|
||||
setTimeout(function() {
|
||||
if(!_shareModalHidden) {
|
||||
framework.addClass(_shareModal, 'pswp__share-modal--fade-in');
|
||||
}
|
||||
}, 30);
|
||||
} else {
|
||||
framework.removeClass(_shareModal, 'pswp__share-modal--fade-in');
|
||||
setTimeout(function() {
|
||||
if(_shareModalHidden) {
|
||||
_toggleShareModalClass();
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
if(!_shareModalHidden) {
|
||||
_updateShareURLs();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
_openWindowPopup = function(e) {
|
||||
e = e || window.event;
|
||||
var target = e.target || e.srcElement;
|
||||
|
||||
pswp.shout('shareLinkClick', e, target);
|
||||
|
||||
if(!target.href) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if( target.hasAttribute('download') ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
window.open(target.href, 'pswp_share', 'scrollbars=yes,resizable=yes,toolbar=no,'+
|
||||
'location=yes,width=550,height=420,top=100,left=' +
|
||||
(window.screen ? Math.round(screen.width / 2 - 275) : 100) );
|
||||
|
||||
if(!_shareModalHidden) {
|
||||
_toggleShareModal();
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
_updateShareURLs = function() {
|
||||
var shareButtonOut = '',
|
||||
shareButtonData,
|
||||
shareURL,
|
||||
image_url,
|
||||
page_url,
|
||||
share_text;
|
||||
|
||||
for(var i = 0; i < _options.shareButtons.length; i++) {
|
||||
shareButtonData = _options.shareButtons[i];
|
||||
|
||||
image_url = _options.getImageURLForShare(shareButtonData);
|
||||
page_url = _options.getPageURLForShare(shareButtonData);
|
||||
share_text = _options.getTextForShare(shareButtonData);
|
||||
|
||||
shareURL = shareButtonData.url.replace('{{url}}', encodeURIComponent(page_url) )
|
||||
.replace('{{image_url}}', encodeURIComponent(image_url) )
|
||||
.replace('{{raw_image_url}}', image_url )
|
||||
.replace('{{text}}', encodeURIComponent(share_text) );
|
||||
|
||||
shareButtonOut += '<a href="' + shareURL + '" target="_blank" '+
|
||||
'class="pswp__share--' + shareButtonData.id + '"' +
|
||||
(shareButtonData.download ? 'download' : '') + '>' +
|
||||
shareButtonData.label + '</a>';
|
||||
|
||||
if(_options.parseShareButtonOut) {
|
||||
shareButtonOut = _options.parseShareButtonOut(shareButtonData, shareButtonOut);
|
||||
}
|
||||
}
|
||||
_shareModal.children[0].innerHTML = shareButtonOut;
|
||||
_shareModal.children[0].onclick = _openWindowPopup;
|
||||
|
||||
},
|
||||
_hasCloseClass = function(target) {
|
||||
for(var i = 0; i < _options.closeElClasses.length; i++) {
|
||||
if( framework.hasClass(target, 'pswp__' + _options.closeElClasses[i]) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
_idleInterval,
|
||||
_idleTimer,
|
||||
_idleIncrement = 0,
|
||||
_onIdleMouseMove = function() {
|
||||
clearTimeout(_idleTimer);
|
||||
_idleIncrement = 0;
|
||||
if(_isIdle) {
|
||||
ui.setIdle(false);
|
||||
}
|
||||
},
|
||||
_onMouseLeaveWindow = function(e) {
|
||||
e = e ? e : window.event;
|
||||
var from = e.relatedTarget || e.toElement;
|
||||
if (!from || from.nodeName === 'HTML') {
|
||||
clearTimeout(_idleTimer);
|
||||
_idleTimer = setTimeout(function() {
|
||||
ui.setIdle(true);
|
||||
}, _options.timeToIdleOutside);
|
||||
}
|
||||
},
|
||||
_setupFullscreenAPI = function() {
|
||||
if(_options.fullscreenEl && !framework.features.isOldAndroid) {
|
||||
if(!_fullscrenAPI) {
|
||||
_fullscrenAPI = ui.getFullscreenAPI();
|
||||
}
|
||||
if(_fullscrenAPI) {
|
||||
framework.bind(document, _fullscrenAPI.eventK, ui.updateFullscreen);
|
||||
ui.updateFullscreen();
|
||||
framework.addClass(pswp.template, 'pswp--supports-fs');
|
||||
} else {
|
||||
framework.removeClass(pswp.template, 'pswp--supports-fs');
|
||||
}
|
||||
}
|
||||
},
|
||||
_setupLoadingIndicator = function() {
|
||||
// Setup loading indicator
|
||||
if(_options.preloaderEl) {
|
||||
|
||||
_toggleLoadingIndicator(true);
|
||||
|
||||
_listen('beforeChange', function() {
|
||||
|
||||
clearTimeout(_loadingIndicatorTimeout);
|
||||
|
||||
// display loading indicator with delay
|
||||
_loadingIndicatorTimeout = setTimeout(function() {
|
||||
|
||||
if(pswp.currItem && pswp.currItem.loading) {
|
||||
|
||||
if( !pswp.allowProgressiveImg() || (pswp.currItem.img && !pswp.currItem.img.naturalWidth) ) {
|
||||
// show preloader if progressive loading is not enabled,
|
||||
// or image width is not defined yet (because of slow connection)
|
||||
_toggleLoadingIndicator(false);
|
||||
// items-controller.js function allowProgressiveImg
|
||||
}
|
||||
|
||||
} else {
|
||||
_toggleLoadingIndicator(true); // hide preloader
|
||||
}
|
||||
|
||||
}, _options.loadingIndicatorDelay);
|
||||
|
||||
});
|
||||
_listen('imageLoadComplete', function(index, item) {
|
||||
if(pswp.currItem === item) {
|
||||
_toggleLoadingIndicator(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
_toggleLoadingIndicator = function(hide) {
|
||||
if( _loadingIndicatorHidden !== hide ) {
|
||||
_togglePswpClass(_loadingIndicator, 'preloader--active', !hide);
|
||||
_loadingIndicatorHidden = hide;
|
||||
}
|
||||
},
|
||||
_applyNavBarGaps = function(item) {
|
||||
var gap = item.vGap;
|
||||
|
||||
if( _fitControlsInViewport() ) {
|
||||
|
||||
var bars = _options.barsSize;
|
||||
if(_options.captionEl && bars.bottom === 'auto') {
|
||||
if(!_fakeCaptionContainer) {
|
||||
_fakeCaptionContainer = framework.createEl('pswp__caption pswp__caption--fake');
|
||||
_fakeCaptionContainer.appendChild( framework.createEl('pswp__caption__center') );
|
||||
_controls.insertBefore(_fakeCaptionContainer, _captionContainer);
|
||||
framework.addClass(_controls, 'pswp__ui--fit');
|
||||
}
|
||||
if( _options.addCaptionHTMLFn(item, _fakeCaptionContainer, true) ) {
|
||||
|
||||
var captionSize = _fakeCaptionContainer.clientHeight;
|
||||
gap.bottom = parseInt(captionSize,10) || 44;
|
||||
} else {
|
||||
gap.bottom = bars.top; // if no caption, set size of bottom gap to size of top
|
||||
}
|
||||
} else {
|
||||
gap.bottom = bars.bottom === 'auto' ? 0 : bars.bottom;
|
||||
}
|
||||
|
||||
// height of top bar is static, no need to calculate it
|
||||
gap.top = bars.top;
|
||||
} else {
|
||||
gap.top = gap.bottom = 0;
|
||||
}
|
||||
},
|
||||
_setupIdle = function() {
|
||||
// Hide controls when mouse is used
|
||||
if(_options.timeToIdle) {
|
||||
_listen('mouseUsed', function() {
|
||||
|
||||
framework.bind(document, 'mousemove', _onIdleMouseMove);
|
||||
framework.bind(document, 'mouseout', _onMouseLeaveWindow);
|
||||
|
||||
_idleInterval = setInterval(function() {
|
||||
_idleIncrement++;
|
||||
if(_idleIncrement === 2) {
|
||||
ui.setIdle(true);
|
||||
}
|
||||
}, _options.timeToIdle / 2);
|
||||
});
|
||||
}
|
||||
},
|
||||
_setupHidingControlsDuringGestures = function() {
|
||||
|
||||
// Hide controls on vertical drag
|
||||
_listen('onVerticalDrag', function(now) {
|
||||
if(_controlsVisible && now < 0.95) {
|
||||
ui.hideControls();
|
||||
} else if(!_controlsVisible && now >= 0.95) {
|
||||
ui.showControls();
|
||||
}
|
||||
});
|
||||
|
||||
// Hide controls when pinching to close
|
||||
var pinchControlsHidden;
|
||||
_listen('onPinchClose' , function(now) {
|
||||
if(_controlsVisible && now < 0.9) {
|
||||
ui.hideControls();
|
||||
pinchControlsHidden = true;
|
||||
} else if(pinchControlsHidden && !_controlsVisible && now > 0.9) {
|
||||
ui.showControls();
|
||||
}
|
||||
});
|
||||
|
||||
_listen('zoomGestureEnded', function() {
|
||||
pinchControlsHidden = false;
|
||||
if(pinchControlsHidden && !_controlsVisible) {
|
||||
ui.showControls();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
var _uiElements = [
|
||||
{
|
||||
name: 'caption',
|
||||
option: 'captionEl',
|
||||
onInit: function(el) {
|
||||
_captionContainer = el;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'share-modal',
|
||||
option: 'shareEl',
|
||||
onInit: function(el) {
|
||||
_shareModal = el;
|
||||
},
|
||||
onTap: function() {
|
||||
_toggleShareModal();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'button--share',
|
||||
option: 'shareEl',
|
||||
onInit: function(el) {
|
||||
_shareButton = el;
|
||||
},
|
||||
onTap: function() {
|
||||
_toggleShareModal();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'button--zoom',
|
||||
option: 'zoomEl',
|
||||
onTap: pswp.toggleDesktopZoom
|
||||
},
|
||||
{
|
||||
name: 'counter',
|
||||
option: 'counterEl',
|
||||
onInit: function(el) {
|
||||
_indexIndicator = el;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'button--close',
|
||||
option: 'closeEl',
|
||||
onTap: pswp.close
|
||||
},
|
||||
{
|
||||
name: 'button--arrow--left',
|
||||
option: 'arrowEl',
|
||||
onTap: pswp.prev
|
||||
},
|
||||
{
|
||||
name: 'button--arrow--right',
|
||||
option: 'arrowEl',
|
||||
onTap: pswp.next
|
||||
},
|
||||
{
|
||||
name: 'button--fs',
|
||||
option: 'fullscreenEl',
|
||||
onTap: function() {
|
||||
if(_fullscrenAPI.isFullscreen()) {
|
||||
_fullscrenAPI.exit();
|
||||
} else {
|
||||
_fullscrenAPI.enter();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'preloader',
|
||||
option: 'preloaderEl',
|
||||
onInit: function(el) {
|
||||
_loadingIndicator = el;
|
||||
}
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
var _setupUIElements = function() {
|
||||
var item,
|
||||
classAttr,
|
||||
uiElement;
|
||||
|
||||
var loopThroughChildElements = function(sChildren) {
|
||||
if(!sChildren) {
|
||||
return;
|
||||
}
|
||||
|
||||
var l = sChildren.length;
|
||||
for(var i = 0; i < l; i++) {
|
||||
item = sChildren[i];
|
||||
classAttr = item.className;
|
||||
|
||||
for(var a = 0; a < _uiElements.length; a++) {
|
||||
uiElement = _uiElements[a];
|
||||
|
||||
if(classAttr.indexOf('pswp__' + uiElement.name) > -1 ) {
|
||||
|
||||
if( _options[uiElement.option] ) { // if element is not disabled from options
|
||||
|
||||
framework.removeClass(item, 'pswp__element--disabled');
|
||||
if(uiElement.onInit) {
|
||||
uiElement.onInit(item);
|
||||
}
|
||||
|
||||
//item.style.display = 'block';
|
||||
} else {
|
||||
framework.addClass(item, 'pswp__element--disabled');
|
||||
//item.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
loopThroughChildElements(_controls.children);
|
||||
|
||||
var topBar = framework.getChildByClass(_controls, 'pswp__top-bar');
|
||||
if(topBar) {
|
||||
loopThroughChildElements( topBar.children );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
ui.init = function() {
|
||||
|
||||
// extend options
|
||||
framework.extend(pswp.options, _defaultUIOptions, true);
|
||||
|
||||
// create local link for fast access
|
||||
_options = pswp.options;
|
||||
|
||||
// find pswp__ui element
|
||||
_controls = framework.getChildByClass(pswp.scrollWrap, 'pswp__ui');
|
||||
|
||||
// create local link
|
||||
_listen = pswp.listen;
|
||||
|
||||
|
||||
_setupHidingControlsDuringGestures();
|
||||
|
||||
// update controls when slides change
|
||||
_listen('beforeChange', ui.update);
|
||||
|
||||
// toggle zoom on double-tap
|
||||
_listen('doubleTap', function(point) {
|
||||
var initialZoomLevel = pswp.currItem.initialZoomLevel;
|
||||
if(pswp.getZoomLevel() !== initialZoomLevel) {
|
||||
pswp.zoomTo(initialZoomLevel, point, 333);
|
||||
} else {
|
||||
pswp.zoomTo(_options.getDoubleTapZoom(false, pswp.currItem), point, 333);
|
||||
}
|
||||
});
|
||||
|
||||
// Allow text selection in caption
|
||||
_listen('preventDragEvent', function(e, isDown, preventObj) {
|
||||
var t = e.target || e.srcElement;
|
||||
if(
|
||||
t &&
|
||||
t.getAttribute('class') && e.type.indexOf('mouse') > -1 &&
|
||||
( t.getAttribute('class').indexOf('__caption') > 0 || (/(SMALL|STRONG|EM)/i).test(t.tagName) )
|
||||
) {
|
||||
preventObj.prevent = false;
|
||||
}
|
||||
});
|
||||
|
||||
// bind events for UI
|
||||
_listen('bindEvents', function() {
|
||||
framework.bind(_controls, 'pswpTap click', _onControlsTap);
|
||||
framework.bind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);
|
||||
|
||||
if(!pswp.likelyTouchDevice) {
|
||||
framework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);
|
||||
}
|
||||
});
|
||||
|
||||
// unbind events for UI
|
||||
_listen('unbindEvents', function() {
|
||||
if(!_shareModalHidden) {
|
||||
_toggleShareModal();
|
||||
}
|
||||
|
||||
if(_idleInterval) {
|
||||
clearInterval(_idleInterval);
|
||||
}
|
||||
framework.unbind(document, 'mouseout', _onMouseLeaveWindow);
|
||||
framework.unbind(document, 'mousemove', _onIdleMouseMove);
|
||||
framework.unbind(_controls, 'pswpTap click', _onControlsTap);
|
||||
framework.unbind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);
|
||||
framework.unbind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);
|
||||
|
||||
if(_fullscrenAPI) {
|
||||
framework.unbind(document, _fullscrenAPI.eventK, ui.updateFullscreen);
|
||||
if(_fullscrenAPI.isFullscreen()) {
|
||||
_options.hideAnimationDuration = 0;
|
||||
_fullscrenAPI.exit();
|
||||
}
|
||||
_fullscrenAPI = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// clean up things when gallery is destroyed
|
||||
_listen('destroy', function() {
|
||||
if(_options.captionEl) {
|
||||
if(_fakeCaptionContainer) {
|
||||
_controls.removeChild(_fakeCaptionContainer);
|
||||
}
|
||||
framework.removeClass(_captionContainer, 'pswp__caption--empty');
|
||||
}
|
||||
|
||||
if(_shareModal) {
|
||||
_shareModal.children[0].onclick = null;
|
||||
}
|
||||
framework.removeClass(_controls, 'pswp__ui--over-close');
|
||||
framework.addClass( _controls, 'pswp__ui--hidden');
|
||||
ui.setIdle(false);
|
||||
});
|
||||
|
||||
|
||||
if(!_options.showAnimationDuration) {
|
||||
framework.removeClass( _controls, 'pswp__ui--hidden');
|
||||
}
|
||||
_listen('initialZoomIn', function() {
|
||||
if(_options.showAnimationDuration) {
|
||||
framework.removeClass( _controls, 'pswp__ui--hidden');
|
||||
}
|
||||
});
|
||||
_listen('initialZoomOut', function() {
|
||||
framework.addClass( _controls, 'pswp__ui--hidden');
|
||||
});
|
||||
|
||||
_listen('parseVerticalMargin', _applyNavBarGaps);
|
||||
|
||||
_setupUIElements();
|
||||
|
||||
if(_options.shareEl && _shareButton && _shareModal) {
|
||||
_shareModalHidden = true;
|
||||
}
|
||||
|
||||
_countNumItems();
|
||||
|
||||
_setupIdle();
|
||||
|
||||
_setupFullscreenAPI();
|
||||
|
||||
_setupLoadingIndicator();
|
||||
};
|
||||
|
||||
ui.setIdle = function(isIdle) {
|
||||
_isIdle = isIdle;
|
||||
_togglePswpClass(_controls, 'ui--idle', isIdle);
|
||||
};
|
||||
|
||||
ui.update = function() {
|
||||
// Don't update UI if it's hidden
|
||||
if(_controlsVisible && pswp.currItem) {
|
||||
|
||||
ui.updateIndexIndicator();
|
||||
|
||||
if(_options.captionEl) {
|
||||
_options.addCaptionHTMLFn(pswp.currItem, _captionContainer);
|
||||
|
||||
_togglePswpClass(_captionContainer, 'caption--empty', !pswp.currItem.title);
|
||||
}
|
||||
|
||||
_overlayUIUpdated = true;
|
||||
|
||||
} else {
|
||||
_overlayUIUpdated = false;
|
||||
}
|
||||
|
||||
if(!_shareModalHidden) {
|
||||
_toggleShareModal();
|
||||
}
|
||||
|
||||
_countNumItems();
|
||||
};
|
||||
|
||||
ui.updateFullscreen = function(e) {
|
||||
|
||||
if(e) {
|
||||
// some browsers change window scroll position during the fullscreen
|
||||
// so PhotoSwipe updates it just in case
|
||||
setTimeout(function() {
|
||||
pswp.setScrollOffset( 0, framework.getScrollY() );
|
||||
}, 50);
|
||||
}
|
||||
|
||||
// toogle pswp--fs class on root element
|
||||
framework[ (_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class' ](pswp.template, 'pswp--fs');
|
||||
};
|
||||
|
||||
ui.updateIndexIndicator = function() {
|
||||
if(_options.counterEl) {
|
||||
_indexIndicator.innerHTML = (pswp.getCurrentIndex()+1) +
|
||||
_options.indexIndicatorSep +
|
||||
_options.getNumItemsFn();
|
||||
}
|
||||
};
|
||||
|
||||
ui.onGlobalTap = function(e) {
|
||||
e = e || window.event;
|
||||
var target = e.target || e.srcElement;
|
||||
|
||||
if(_blockControlsTap) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.detail && e.detail.pointerType === 'mouse') {
|
||||
|
||||
// close gallery if clicked outside of the image
|
||||
if(_hasCloseClass(target)) {
|
||||
pswp.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if(framework.hasClass(target, 'pswp__img')) {
|
||||
if(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {
|
||||
if(_options.clickToCloseNonZoomable) {
|
||||
pswp.close();
|
||||
}
|
||||
} else {
|
||||
pswp.toggleDesktopZoom(e.detail.releasePoint);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// tap anywhere (except buttons) to toggle visibility of controls
|
||||
if(_options.tapToToggleControls) {
|
||||
if(_controlsVisible) {
|
||||
ui.hideControls();
|
||||
} else {
|
||||
ui.showControls();
|
||||
}
|
||||
}
|
||||
|
||||
// tap to close gallery
|
||||
if(_options.tapToClose && (framework.hasClass(target, 'pswp__img') || _hasCloseClass(target)) ) {
|
||||
pswp.close();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
ui.onMouseOver = function(e) {
|
||||
e = e || window.event;
|
||||
var target = e.target || e.srcElement;
|
||||
|
||||
// add class when mouse is over an element that should close the gallery
|
||||
_togglePswpClass(_controls, 'ui--over-close', _hasCloseClass(target));
|
||||
};
|
||||
|
||||
ui.hideControls = function() {
|
||||
framework.addClass(_controls,'pswp__ui--hidden');
|
||||
_controlsVisible = false;
|
||||
};
|
||||
|
||||
ui.showControls = function() {
|
||||
_controlsVisible = true;
|
||||
if(!_overlayUIUpdated) {
|
||||
ui.update();
|
||||
}
|
||||
framework.removeClass(_controls,'pswp__ui--hidden');
|
||||
};
|
||||
|
||||
ui.supportsFullscreen = function() {
|
||||
var d = document;
|
||||
return !!(d.exitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen || d.msExitFullscreen);
|
||||
};
|
||||
|
||||
ui.getFullscreenAPI = function() {
|
||||
var dE = document.documentElement,
|
||||
api,
|
||||
tF = 'fullscreenchange';
|
||||
|
||||
if (dE.requestFullscreen) {
|
||||
api = {
|
||||
enterK: 'requestFullscreen',
|
||||
exitK: 'exitFullscreen',
|
||||
elementK: 'fullscreenElement',
|
||||
eventK: tF
|
||||
};
|
||||
|
||||
} else if(dE.mozRequestFullScreen ) {
|
||||
api = {
|
||||
enterK: 'mozRequestFullScreen',
|
||||
exitK: 'mozCancelFullScreen',
|
||||
elementK: 'mozFullScreenElement',
|
||||
eventK: 'moz' + tF
|
||||
};
|
||||
|
||||
|
||||
|
||||
} else if(dE.webkitRequestFullscreen) {
|
||||
api = {
|
||||
enterK: 'webkitRequestFullscreen',
|
||||
exitK: 'webkitExitFullscreen',
|
||||
elementK: 'webkitFullscreenElement',
|
||||
eventK: 'webkit' + tF
|
||||
};
|
||||
|
||||
} else if(dE.msRequestFullscreen) {
|
||||
api = {
|
||||
enterK: 'msRequestFullscreen',
|
||||
exitK: 'msExitFullscreen',
|
||||
elementK: 'msFullscreenElement',
|
||||
eventK: 'MSFullscreenChange'
|
||||
};
|
||||
}
|
||||
|
||||
if(api) {
|
||||
api.enter = function() {
|
||||
// disable close-on-scroll in fullscreen
|
||||
_initalCloseOnScrollValue = _options.closeOnScroll;
|
||||
_options.closeOnScroll = false;
|
||||
|
||||
if(this.enterK === 'webkitRequestFullscreen') {
|
||||
pswp.template[this.enterK]( Element.ALLOW_KEYBOARD_INPUT );
|
||||
} else {
|
||||
return pswp.template[this.enterK]();
|
||||
}
|
||||
};
|
||||
api.exit = function() {
|
||||
_options.closeOnScroll = _initalCloseOnScrollValue;
|
||||
|
||||
return document[this.exitK]();
|
||||
|
||||
};
|
||||
api.isFullscreen = function() { return document[this.elementK]; };
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
|
||||
};
|
||||
return PhotoSwipeUI_Default;
|
||||
|
||||
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
-4
File diff suppressed because one or more lines are too long
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built in easing capabilities added In jQuery 1.1
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
||||
|
||||
jQuery.extend( jQuery.easing,
|
||||
{
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x, t, b, c, d) {
|
||||
//alert(jQuery.easing.default);
|
||||
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
||||
},
|
||||
easeInQuad: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t + b;
|
||||
},
|
||||
easeOutQuad: function (x, t, b, c, d) {
|
||||
return -c *(t/=d)*(t-2) + b;
|
||||
},
|
||||
easeInOutQuad: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t + b;
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
easeInCubic: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t + b;
|
||||
},
|
||||
easeOutCubic: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t + 1) + b;
|
||||
},
|
||||
easeInOutCubic: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t + 2) + b;
|
||||
},
|
||||
easeInQuart: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t + b;
|
||||
},
|
||||
easeOutQuart: function (x, t, b, c, d) {
|
||||
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
||||
},
|
||||
easeInOutQuart: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
||||
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
||||
},
|
||||
easeInQuint: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t*t + b;
|
||||
},
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
},
|
||||
easeInOutQuint: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
||||
},
|
||||
easeInSine: function (x, t, b, c, d) {
|
||||
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
||||
},
|
||||
easeOutSine: function (x, t, b, c, d) {
|
||||
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
||||
},
|
||||
easeInOutSine: function (x, t, b, c, d) {
|
||||
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
||||
},
|
||||
easeInExpo: function (x, t, b, c, d) {
|
||||
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
||||
},
|
||||
easeOutExpo: function (x, t, b, c, d) {
|
||||
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
||||
},
|
||||
easeInOutExpo: function (x, t, b, c, d) {
|
||||
if (t==0) return b;
|
||||
if (t==d) return b+c;
|
||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
},
|
||||
easeInCirc: function (x, t, b, c, d) {
|
||||
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
||||
},
|
||||
easeOutCirc: function (x, t, b, c, d) {
|
||||
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
||||
},
|
||||
easeInOutCirc: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
||||
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
||||
},
|
||||
easeInElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
},
|
||||
easeOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
||||
},
|
||||
easeInOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
||||
},
|
||||
easeInBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*(t/=d)*t*((s+1)*t - s) + b;
|
||||
},
|
||||
easeOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
||||
},
|
||||
easeInOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
||||
},
|
||||
easeInBounce: function (x, t, b, c, d) {
|
||||
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
||||
},
|
||||
easeOutBounce: function (x, t, b, c, d) {
|
||||
if ((t/=d) < (1/2.75)) {
|
||||
return c*(7.5625*t*t) + b;
|
||||
} else if (t < (2/2.75)) {
|
||||
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
||||
} else if (t < (2.5/2.75)) {
|
||||
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
||||
} else {
|
||||
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (x, t, b, c, d) {
|
||||
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
@@ -1,80 +0,0 @@
|
||||
/*global jQuery */
|
||||
/*jshint multistr:true browser:true */
|
||||
/*!
|
||||
* FitVids 1.0
|
||||
*
|
||||
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
||||
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
||||
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
||||
*
|
||||
* Date: Thu Sept 01 18:00:00 2011 -0500
|
||||
*/
|
||||
|
||||
(function( $ ){
|
||||
|
||||
"use strict";
|
||||
|
||||
$.fn.fitVids = function( options ) {
|
||||
var settings = {
|
||||
customSelector: null
|
||||
};
|
||||
|
||||
var div = document.createElement('div'),
|
||||
ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
|
||||
|
||||
div.className = 'fit-vids-style';
|
||||
div.innerHTML = '­<style> \
|
||||
.fluid-width-video-wrapper { \
|
||||
width: 100%; \
|
||||
position: relative; \
|
||||
padding: 0; \
|
||||
} \
|
||||
\
|
||||
.fluid-width-video-wrapper iframe, \
|
||||
.fluid-width-video-wrapper object, \
|
||||
.fluid-width-video-wrapper embed { \
|
||||
position: absolute; \
|
||||
top: 0; \
|
||||
left: 0; \
|
||||
width: 100%; \
|
||||
height: 100%; \
|
||||
} \
|
||||
</style>';
|
||||
|
||||
ref.parentNode.insertBefore(div,ref);
|
||||
|
||||
if ( options ) {
|
||||
$.extend( settings, options );
|
||||
}
|
||||
|
||||
return this.each(function(){
|
||||
var selectors = [
|
||||
"iframe[src*='player.vimeo.com']",
|
||||
"iframe[src*='www.youtube.com']",
|
||||
"iframe[src*='www.kickstarter.com']",
|
||||
"object",
|
||||
"embed"
|
||||
];
|
||||
|
||||
if (settings.customSelector) {
|
||||
selectors.push(settings.customSelector);
|
||||
}
|
||||
|
||||
var $allVideos = $(this).find(selectors.join(','));
|
||||
|
||||
$allVideos.each(function(){
|
||||
var $this = $(this);
|
||||
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
|
||||
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
|
||||
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
|
||||
aspectRatio = height / width;
|
||||
if(!$this.attr('id')){
|
||||
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
|
||||
$this.attr('id', videoID);
|
||||
}
|
||||
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
|
||||
$this.removeAttr('height').removeAttr('width');
|
||||
});
|
||||
});
|
||||
};
|
||||
})( jQuery );
|
||||
Vendored
-1
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
/home/cokeman/domains/plandeweb.com/public_html/put/template/estandar/modulos/banner_interior/script-hshpql5l1.js
|
||||
-3
File diff suppressed because one or more lines are too long
Vendored
-430
@@ -1,430 +0,0 @@
|
||||
/*! skrollr 0.6.26 (2014-06-08) | Alexander Prinzhorn - https://github.com/Prinzhorn/skrollr | Free to use under terms of MIT license */
|
||||
(function(e, t, r) {
|
||||
"use strict";
|
||||
function n(r) {
|
||||
if (o = t.documentElement, a = t.body, K(), it = this, r = r || {}, ut = r.constants || {}, r.easing)
|
||||
for (var n in r.easing)
|
||||
U[n] = r.easing[n];
|
||||
yt = r.edgeStrategy || "set", ct = {
|
||||
beforerender: r.beforerender,
|
||||
render: r.render,
|
||||
keyframe: r.keyframe
|
||||
}, ft = r.forceHeight!==!1, ft && (Vt = r.scale || 1), mt = r.mobileDeceleration || x, dt = r.smoothScrolling!==!1, gt = r.smoothScrollingDuration || E, vt = {
|
||||
targetTop: it.getScrollTop()
|
||||
}, Gt = (r.mobileCheck || function() {
|
||||
return /Android|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent || navigator.vendor || e.opera)
|
||||
})(), Gt ? (st = t.getElementById("skrollr-body"), st && at(), X(), Dt(o, [y, S], [T])) : Dt(o, [y, b], [T]), it.refresh(), St(e, "resize orientationchange", function() {
|
||||
var e = o.clientWidth, t = o.clientHeight;
|
||||
(t !== $t || e !== Mt) && ($t = t, Mt = e, _t=!0)
|
||||
});
|
||||
var i = Y();
|
||||
return function l() {
|
||||
Z(), bt = i(l)
|
||||
}(), it
|
||||
}
|
||||
var o, a, i = {
|
||||
get: function() {
|
||||
return it
|
||||
},
|
||||
init: function(e) {
|
||||
return it || new n(e)
|
||||
},
|
||||
VERSION: "0.6.26"
|
||||
}, l = Object.prototype.hasOwnProperty, s = e.Math, c = e.getComputedStyle, f = "touchstart", u = "touchmove", m = "touchcancel", p = "touchend", d = "skrollable", g = d + "-before", v = d + "-between", h = d + "-after", y = "skrollr", T = "no-" + y, b = y + "-desktop", S = y + "-mobile", k = "linear", w = 1e3, x = .004, E = 200, A = "start", F = "end", C = "center", D = "bottom", H = "___skrollable_id", I = /^(?:input|textarea|button|select)$/i, P = /^\s+|\s+$/g, N = /^data(?:-(_\w+))?(?:-?(-?\d*\.?\d+p?))?(?:-?(start|end|top|center|bottom))?(?:-?(top|center|bottom))?$/, O = /\s*(@?[\w\-\[\]]+)\s*:\s*(.+?)\s*(?:;|$)/gi, V = /^(@?[a-z\-]+)\[(\w+)\]$/, z = /-([a-z0-9_])/g, q = function(e, t) {
|
||||
return t.toUpperCase()
|
||||
}, L = /[\-+]?[\d]*\.?[\d]+/g, M = /\{\?\}/g, $ = /rgba?\(\s*-?\d+\s*,\s*-?\d+\s*,\s*-?\d+/g, _ = /[a-z\-]+-gradient/g, B = "", G = "", K = function() {
|
||||
var e = /^(?:O|Moz|webkit|ms)|(?:-(?:o|moz|webkit|ms)-)/;
|
||||
if (c) {
|
||||
var t = c(a, null);
|
||||
for (var n in t)
|
||||
if (B = n.match(e)||+n == n && t[n].match(e))
|
||||
break;
|
||||
if (!B)
|
||||
return B = G = "", r;
|
||||
B = B[0], "-" === B.slice(0, 1) ? (G = B, B = {
|
||||
"-webkit-": "webkit",
|
||||
"-moz-": "Moz",
|
||||
"-ms-": "ms",
|
||||
"-o-": "O"
|
||||
}
|
||||
[B]) : G = "-" + B.toLowerCase() + "-"
|
||||
}
|
||||
}, Y = function() {
|
||||
var t = e.requestAnimationFrame || e[B.toLowerCase() + "RequestAnimationFrame"], r = Pt();
|
||||
return (Gt ||!t) && (t = function(t) {
|
||||
var n = Pt() - r, o = s.max(0, 1e3 / 60 - n);
|
||||
return e.setTimeout(function() {
|
||||
r = Pt(), t()
|
||||
}, o)
|
||||
}), t
|
||||
}, R = function() {
|
||||
var t = e.cancelAnimationFrame || e[B.toLowerCase() + "CancelAnimationFrame"];
|
||||
return (Gt ||!t) && (t = function(t) {
|
||||
return e.clearTimeout(t)
|
||||
}), t
|
||||
}, U = {
|
||||
begin: function() {
|
||||
return 0
|
||||
},
|
||||
end: function() {
|
||||
return 1
|
||||
},
|
||||
linear: function(e) {
|
||||
return e
|
||||
},
|
||||
quadratic: function(e) {
|
||||
return e * e
|
||||
},
|
||||
cubic: function(e) {
|
||||
return e * e * e
|
||||
},
|
||||
swing: function(e) {
|
||||
return - s.cos(e * s.PI) / 2 + .5
|
||||
},
|
||||
sqrt: function(e) {
|
||||
return s.sqrt(e)
|
||||
},
|
||||
outCubic: function(e) {
|
||||
return s.pow(e - 1, 3) + 1
|
||||
},
|
||||
bounce: function(e) {
|
||||
var t;
|
||||
if (.5083 >= e)
|
||||
t = 3;
|
||||
else if (.8489 >= e)
|
||||
t = 9;
|
||||
else if (.96208 >= e)
|
||||
t = 27;
|
||||
else {
|
||||
if (!(.99981 >= e))
|
||||
return 1;
|
||||
t = 91
|
||||
}
|
||||
return 1 - s.abs(3 * s.cos(1.028 * e * t) / t)
|
||||
}
|
||||
};
|
||||
n.prototype.refresh = function(e) {
|
||||
var n, o, a=!1;
|
||||
for (e === r ? (a=!0, lt = [], Bt = 0, e = t.getElementsByTagName("*")) : e.length === r && (e = [e]), n = 0, o = e.length; o > n; n++) {
|
||||
var i = e[n], l = i, s = [], c = dt, f = yt, u=!1;
|
||||
if (a && H in i && delete i[H], i.attributes) {
|
||||
for (var m = 0, p = i.attributes.length; p > m; m++) {
|
||||
var g = i.attributes[m];
|
||||
if ("data-anchor-target" !== g.name)
|
||||
if ("data-smooth-scrolling" !== g.name)
|
||||
if ("data-edge-strategy" !== g.name)
|
||||
if ("data-emit-events" !== g.name) {
|
||||
var v = g.name.match(N);
|
||||
if (null !== v) {
|
||||
var h = {
|
||||
props: g.value,
|
||||
element: i,
|
||||
eventType: g.name.replace(z, q)
|
||||
};
|
||||
s.push(h);
|
||||
var y = v[1];
|
||||
y && (h.constant = y.substr(1));
|
||||
var T = v[2];
|
||||
/p$/.test(T) ? (h.isPercentage=!0, h.offset = (0 | T.slice(0, - 1)) / 100) : h.offset = 0 | T;
|
||||
var b = v[3], S = v[4] || b;
|
||||
b && b !== A && b !== F ? (h.mode = "relative", h.anchors = [b, S]) : (h.mode = "absolute", b === F ? h.isEnd=!0 : h.isPercentage || (h.offset = h.offset * Vt))
|
||||
}
|
||||
} else
|
||||
u=!0;
|
||||
else
|
||||
f = g.value;
|
||||
else
|
||||
c = "off" !== g.value;
|
||||
else if (l = t.querySelector(g.value), null === l)
|
||||
throw 'Unable to find anchor target "' + g.value + '"'
|
||||
}
|
||||
if (s.length) {
|
||||
var k, w, x;
|
||||
!a && H in i ? (x = i[H], k = lt[x].styleAttr, w = lt[x].classAttr) : (x = i[H] = Bt++, k = i.style.cssText, w = Ct(i)), lt[x] = {
|
||||
element: i,
|
||||
styleAttr: k,
|
||||
classAttr: w,
|
||||
anchorTarget: l,
|
||||
keyFrames: s,
|
||||
smoothScrolling: c,
|
||||
edgeStrategy: f,
|
||||
emitEvents: u,
|
||||
lastFrameIndex: - 1
|
||||
}, Dt(i, [d], [])
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Et(), n = 0, o = e.length; o > n; n++) {
|
||||
var E = lt[e[n][H]];
|
||||
E !== r && (J(E), et(E))
|
||||
}
|
||||
return it
|
||||
}, n.prototype.relativeToAbsolute = function(e, t, r) {
|
||||
var n = o.clientHeight, a = e.getBoundingClientRect(), i = a.top, l = a.bottom - a.top;
|
||||
return t === D ? i -= n : t === C && (i -= n / 2), r === D ? i += l : r === C && (i += l / 2), i += it.getScrollTop(), 0 | i + .5
|
||||
}, n.prototype.animateTo = function(e, t) {
|
||||
t = t || {};
|
||||
var n = Pt(), o = it.getScrollTop();
|
||||
return pt = {
|
||||
startTop: o,
|
||||
topDiff: e - o,
|
||||
targetTop: e,
|
||||
duration: t.duration || w,
|
||||
startTime: n,
|
||||
endTime: n + (t.duration || w),
|
||||
easing: U[t.easing || k],
|
||||
done: t.done
|
||||
}, pt.topDiff || (pt.done && pt.done.call(it, !1), pt = r), it
|
||||
}, n.prototype.stopAnimateTo = function() {
|
||||
pt && pt.done && pt.done.call(it, !0), pt = r
|
||||
}, n.prototype.isAnimatingTo = function() {
|
||||
return !!pt
|
||||
}, n.prototype.isMobile = function() {
|
||||
return Gt
|
||||
}, n.prototype.setScrollTop = function(t, r) {
|
||||
return ht = r===!0, Gt ? Kt = s.min(s.max(t, 0), Ot) : e.scrollTo(0, t), it
|
||||
}, n.prototype.getScrollTop = function() {
|
||||
return Gt ? Kt : e.pageYOffset || o.scrollTop || a.scrollTop || 0
|
||||
}, n.prototype.getMaxScrollTop = function() {
|
||||
return Ot
|
||||
}, n.prototype.on = function(e, t) {
|
||||
return ct[e] = t, it
|
||||
}, n.prototype.off = function(e) {
|
||||
return delete ct[e], it
|
||||
}, n.prototype.destroy = function() {
|
||||
var e = R();
|
||||
e(bt), wt(), Dt(o, [T], [y, b, S]);
|
||||
for (var t = 0, n = lt.length; n > t; t++)
|
||||
ot(lt[t].element);
|
||||
o.style.overflow = a.style.overflow = "", o.style.height = a.style.height = "", st && i.setStyle(st, "transform", "none"), it = r, st = r, ct = r, ft = r, Ot = 0, Vt = 1, ut = r, mt = r, zt = "down", qt =- 1, Mt = 0, $t = 0, _t=!1, pt = r, dt = r, gt = r, vt = r, ht = r, Bt = 0, yt = r, Gt=!1, Kt = 0, Tt = r
|
||||
};
|
||||
var X = function() {
|
||||
var n, i, l, c, d, g, v, h, y, T, b, S;
|
||||
St(o, [f, u, m, p].join(" "), function(e) {
|
||||
var o = e.changedTouches[0];
|
||||
for (c = e.target; 3 === c.nodeType;)
|
||||
c = c.parentNode;
|
||||
switch (d = o.clientY, g = o.clientX, T = e.timeStamp, I.test(c.tagName) || e.preventDefault(), e.type) {
|
||||
case f:
|
||||
n && n.blur(), it.stopAnimateTo(), n = c, i = v = d, l = g, y = T;
|
||||
break;
|
||||
case u:
|
||||
I.test(c.tagName) && t.activeElement !== c && e.preventDefault(), h = d - v, S = T - b, it.setScrollTop(Kt - h, !0), v = d, b = T;
|
||||
break;
|
||||
default:
|
||||
case m:
|
||||
case p:
|
||||
var a = i - d, k = l - g, w = k * k + a * a;
|
||||
if (49 > w) {
|
||||
if (!I.test(n.tagName)) {
|
||||
n.focus();
|
||||
var x = t.createEvent("MouseEvents");
|
||||
x.initMouseEvent("click", !0, !0, e.view, 1, o.screenX, o.screenY, o.clientX, o.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, 0, null), n.dispatchEvent(x)
|
||||
}
|
||||
return
|
||||
}
|
||||
n = r;
|
||||
var E = h / S;
|
||||
E = s.max(s.min(E, 3), - 3);
|
||||
var A = s.abs(E / mt), F = E * A + .5 * mt * A * A, C = it.getScrollTop() - F, D = 0;
|
||||
C > Ot ? (D = (Ot - C) / F, C = Ot) : 0 > C && (D =- C / F, C = 0), A*=1 - D, it.animateTo(0 | C + .5, {
|
||||
easing: "outCubic",
|
||||
duration: A
|
||||
})
|
||||
}
|
||||
}), e.scrollTo(0, 0), o.style.overflow = a.style.overflow = "hidden"
|
||||
}, j = function() {
|
||||
var e, t, r, n, a, i, l, c, f, u, m, p = o.clientHeight, d = At();
|
||||
for (c = 0, f = lt.length; f > c; c++)
|
||||
for (e = lt[c], t = e.element, r = e.anchorTarget, n = e.keyFrames, a = 0, i = n.length; i > a; a++)
|
||||
l = n[a], u = l.offset, m = d[l.constant] || 0, l.frame = u, l.isPercentage && (u*=p, l.frame = u), "relative" === l.mode && (ot(t), l.frame = it.relativeToAbsolute(r, l.anchors[0], l.anchors[1]) - u, ot(t, !0)), l.frame += m, ft&&!l.isEnd && l.frame > Ot && (Ot = l.frame);
|
||||
for (Ot = s.max(Ot, Ft()), c = 0, f = lt.length; f > c; c++) {
|
||||
for (e = lt[c], n = e.keyFrames, a = 0, i = n.length; i > a; a++)
|
||||
l = n[a], m = d[l.constant] || 0, l.isEnd && (l.frame = Ot - l.offset + m);
|
||||
e.keyFrames.sort(Nt)
|
||||
}
|
||||
}, W = function(e, t) {
|
||||
for (var r = 0, n = lt.length; n > r; r++) {
|
||||
var o, a, s = lt[r], c = s.element, f = s.smoothScrolling ? e: t, u = s.keyFrames, m = u.length, p = u[0], y = u[u.length - 1], T = p.frame > f, b = f > y.frame, S = T ? p: y, k = s.emitEvents, w = s.lastFrameIndex;
|
||||
if (T || b) {
|
||||
if (T&&-1 === s.edge || b && 1 === s.edge)
|
||||
continue;
|
||||
switch (T ? (Dt(c, [g], [h, v]), k && w>-1 && (xt(c, p.eventType, zt), s.lastFrameIndex =- 1)) : (Dt(c, [h], [g, v]), k && m > w && (xt(c, y.eventType, zt), s.lastFrameIndex = m)), s.edge = T?-1 : 1, s.edgeStrategy) {
|
||||
case"reset":
|
||||
ot(c);
|
||||
continue;
|
||||
case"ease":
|
||||
f = S.frame;
|
||||
break;
|
||||
default:
|
||||
case"set":
|
||||
var x = S.props;
|
||||
for (o in x)
|
||||
l.call(x, o) && (a = nt(x[o].value), 0 === o.indexOf("@") ? c.setAttribute(o.substr(1), a) : i.setStyle(c, o, a));
|
||||
continue
|
||||
}
|
||||
} else
|
||||
0 !== s.edge && (Dt(c, [d, v], [g, h]), s.edge = 0);
|
||||
for (var E = 0; m - 1 > E; E++)
|
||||
if (f >= u[E].frame && u[E + 1].frame >= f) {
|
||||
var A = u[E], F = u[E + 1];
|
||||
for (o in A.props)
|
||||
if (l.call(A.props, o)) {
|
||||
var C = (f - A.frame) / (F.frame - A.frame);
|
||||
C = A.props[o].easing(C), a = rt(A.props[o].value, F.props[o].value, C), a = nt(a), 0 === o.indexOf("@") ? c.setAttribute(o.substr(1), a) : i.setStyle(c, o, a)
|
||||
}
|
||||
k && w !== E && ("down" === zt ? xt(c, A.eventType, zt) : xt(c, F.eventType, zt), s.lastFrameIndex = E);
|
||||
break
|
||||
}
|
||||
}
|
||||
}, Z = function() {
|
||||
_t && (_t=!1, Et());
|
||||
var e, t, n = it.getScrollTop(), o = Pt();
|
||||
if (pt)
|
||||
o >= pt.endTime ? (n = pt.targetTop, e = pt.done, pt = r) : (t = pt.easing((o - pt.startTime) / pt.duration), n = 0 | pt.startTop + t * pt.topDiff), it.setScrollTop(n, !0);
|
||||
else if (!ht) {
|
||||
var a = vt.targetTop - n;
|
||||
a && (vt = {
|
||||
startTop: qt,
|
||||
topDiff: n - qt,
|
||||
targetTop: n,
|
||||
startTime: Lt,
|
||||
endTime: Lt + gt
|
||||
}), vt.endTime >= o && (t = U.sqrt((o - vt.startTime) / gt), n = 0 | vt.startTop + t * vt.topDiff)
|
||||
}
|
||||
if (Gt && st && i.setStyle(st, "transform", "translate(0, " +- Kt + "px) " + Tt), ht || qt !== n) {
|
||||
zt = n > qt ? "down" : qt > n ? "up" : zt, ht=!1;
|
||||
var l = {
|
||||
curTop: n,
|
||||
lastTop: qt,
|
||||
maxTop: Ot,
|
||||
direction: zt
|
||||
}, s = ct.beforerender && ct.beforerender.call(it, l);
|
||||
s!==!1 && (W(n, it.getScrollTop()), qt = n, ct.render && ct.render.call(it, l)), e && e.call(it, !1)
|
||||
}
|
||||
Lt = o
|
||||
}, J = function(e) {
|
||||
for (var t = 0, r = e.keyFrames.length; r > t; t++) {
|
||||
for (var n, o, a, i, l = e.keyFrames[t], s = {}; null !== (i = O.exec(l.props));)
|
||||
a = i[1], o = i[2], n = a.match(V), null !== n ? (a = n[1], n = n[2]) : n = k, o = o.indexOf("!") ? Q(o) : [o.slice(1)], s[a] = {
|
||||
value: o,
|
||||
easing: U[n]
|
||||
};
|
||||
l.props = s
|
||||
}
|
||||
}, Q = function(e) {
|
||||
var t = [];
|
||||
return $.lastIndex = 0, e = e.replace($, function(e) {
|
||||
return e.replace(L, function(e) {
|
||||
return 100 * (e / 255) + "%"
|
||||
})
|
||||
}), G && (_.lastIndex = 0, e = e.replace(_, function(e) {
|
||||
return G + e
|
||||
})), e = e.replace(L, function(e) {
|
||||
return t.push( + e), "{?}"
|
||||
}), t.unshift(e), t
|
||||
}, et = function(e) {
|
||||
var t, r, n = {};
|
||||
for (t = 0, r = e.keyFrames.length; r > t; t++)
|
||||
tt(e.keyFrames[t], n);
|
||||
for (n = {}, t = e.keyFrames.length - 1; t >= 0; t--)
|
||||
tt(e.keyFrames[t], n)
|
||||
}, tt = function(e, t) {
|
||||
var r;
|
||||
for (r in t)
|
||||
l.call(e.props, r) || (e.props[r] = t[r]);
|
||||
for (r in e.props)
|
||||
t[r] = e.props[r]
|
||||
}, rt = function(e, t, r) {
|
||||
var n, o = e.length;
|
||||
if (o !== t.length)
|
||||
throw "Can't interpolate between \"" + e[0] + '" and "' + t[0] + '"';
|
||||
var a = [e[0]];
|
||||
for (n = 1; o > n; n++)
|
||||
a[n] = e[n] + (t[n] - e[n]) * r;
|
||||
return a
|
||||
}, nt = function(e) {
|
||||
var t = 1;
|
||||
return M.lastIndex = 0, e[0].replace(M, function() {
|
||||
return e[t++]
|
||||
})
|
||||
}, ot = function(e, t) {
|
||||
e = [].concat(e);
|
||||
for (var r, n, o = 0, a = e.length; a > o; o++)
|
||||
n = e[o], r = lt[n[H]], r && (t ? (n.style.cssText = r.dirtyStyleAttr, Dt(n, r.dirtyClassAttr)) : (r.dirtyStyleAttr = n.style.cssText, r.dirtyClassAttr = Ct(n), n.style.cssText = r.styleAttr, Dt(n, r.classAttr)))
|
||||
}, at = function() {
|
||||
Tt = "translateZ(0)", i.setStyle(st, "transform", Tt);
|
||||
var e = c(st), t = e.getPropertyValue("transform"), r = e.getPropertyValue(G + "transform"), n = t && "none" !== t || r && "none" !== r;
|
||||
n || (Tt = "")
|
||||
};
|
||||
i.setStyle = function(e, t, r) {
|
||||
var n = e.style;
|
||||
if (t = t.replace(z, q).replace("-", ""), "zIndex" === t)
|
||||
n[t] = isNaN(r) ? r : "" + (0 | r);
|
||||
else if ("float" === t)
|
||||
n.styleFloat = n.cssFloat = r;
|
||||
else
|
||||
try {
|
||||
B && (n[B + t.slice(0, 1).toUpperCase() + t.slice(1)] = r), n[t] = r
|
||||
} catch (o) {}
|
||||
};
|
||||
var it, lt, st, ct, ft, ut, mt, pt, dt, gt, vt, ht, yt, Tt, bt, St = i.addEvent = function(t, r, n) {
|
||||
var o = function(t) {
|
||||
return t = t || e.event, t.target || (t.target = t.srcElement), t.preventDefault || (t.preventDefault = function() {
|
||||
t.returnValue=!1, t.defaultPrevented=!0
|
||||
}), n.call(this, t)
|
||||
};
|
||||
r = r.split(" ");
|
||||
for (var a, i = 0, l = r.length; l > i; i++)
|
||||
a = r[i], t.addEventListener ? t.addEventListener(a, n, !1) : t.attachEvent("on" + a, o), Yt.push({
|
||||
element: t,
|
||||
name: a,
|
||||
listener: n
|
||||
})
|
||||
}, kt = i.removeEvent = function(e, t, r) {
|
||||
t = t.split(" ");
|
||||
for (var n = 0, o = t.length; o > n; n++)
|
||||
e.removeEventListener ? e.removeEventListener(t[n], r, !1) : e.detachEvent("on" + t[n], r)
|
||||
}, wt = function() {
|
||||
for (var e, t = 0, r = Yt.length; r > t; t++)
|
||||
e = Yt[t], kt(e.element, e.name, e.listener);
|
||||
Yt = []
|
||||
}, xt = function(e, t, r) {
|
||||
ct.keyframe && ct.keyframe.call(it, e, t, r)
|
||||
}, Et = function() {
|
||||
var e = it.getScrollTop();
|
||||
Ot = 0, ft&&!Gt && (a.style.height = ""), j(), ft&&!Gt && (a.style.height = Ot + o.clientHeight + "px"), Gt ? it.setScrollTop(s.min(it.getScrollTop(), Ot)) : it.setScrollTop(e, !0), ht=!0
|
||||
}, At = function() {
|
||||
var e, t, r = o.clientHeight, n = {};
|
||||
for (e in ut)
|
||||
t = ut[e], "function" == typeof t ? t = t.call(it) : /p$/.test(t) && (t = t.slice(0, - 1) / 100 * r), n[e] = t;
|
||||
return n
|
||||
}, Ft = function() {
|
||||
var e = st && st.offsetHeight || 0, t = s.max(e, a.scrollHeight, a.offsetHeight, o.scrollHeight, o.offsetHeight, o.clientHeight);
|
||||
return t - o.clientHeight
|
||||
}, Ct = function(t) {
|
||||
var r = "className";
|
||||
return e.SVGElement && t instanceof e.SVGElement && (t = t[r], r = "baseVal"), t[r]
|
||||
}, Dt = function(t, n, o) {
|
||||
var a = "className";
|
||||
if (e.SVGElement && t instanceof e.SVGElement && (t = t[a], a = "baseVal"), o === r)
|
||||
return t[a] = n, r;
|
||||
for (var i = t[a], l = 0, s = o.length; s > l; l++)
|
||||
i = It(i).replace(It(o[l]), " ");
|
||||
i = Ht(i);
|
||||
for (var c = 0, f = n.length; f > c; c++)
|
||||
- 1 === It(i).indexOf(It(n[c])) && (i += " " + n[c]);
|
||||
t[a] = Ht(i)
|
||||
}, Ht = function(e) {
|
||||
return e.replace(P, "")
|
||||
}, It = function(e) {
|
||||
return " " + e + " "
|
||||
}, Pt = Date.now || function() {
|
||||
return + new Date
|
||||
}, Nt = function(e, t) {
|
||||
return e.frame - t.frame
|
||||
}, Ot = 0, Vt = 1, zt = "down", qt =- 1, Lt = Pt(), Mt = 0, $t = 0, _t=!1, Bt = 0, Gt=!1, Kt = 0, Yt = [];
|
||||
"function" == typeof define && define.amd ? define("skrollr", function() {
|
||||
return i
|
||||
}) : "undefined" != typeof module && module.exports ? module.exports = i : e.skrollr = i
|
||||
})(window, document);
|
||||
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-13
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-4
File diff suppressed because one or more lines are too long
-6
File diff suppressed because one or more lines are too long
@@ -1,513 +0,0 @@
|
||||
(function() {
|
||||
var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
|
||||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
Util = (function() {
|
||||
function Util() {}
|
||||
|
||||
Util.prototype.extend = function(custom, defaults) {
|
||||
var key, value;
|
||||
for (key in defaults) {
|
||||
value = defaults[key];
|
||||
if (custom[key] == null) {
|
||||
custom[key] = value;
|
||||
}
|
||||
}
|
||||
return custom;
|
||||
};
|
||||
|
||||
Util.prototype.isMobile = function(agent) {
|
||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
|
||||
};
|
||||
|
||||
Util.prototype.createEvent = function(event, bubble, cancel, detail) {
|
||||
var customEvent;
|
||||
if (bubble == null) {
|
||||
bubble = false;
|
||||
}
|
||||
if (cancel == null) {
|
||||
cancel = false;
|
||||
}
|
||||
if (detail == null) {
|
||||
detail = null;
|
||||
}
|
||||
if (document.createEvent != null) {
|
||||
customEvent = document.createEvent('CustomEvent');
|
||||
customEvent.initCustomEvent(event, bubble, cancel, detail);
|
||||
} else if (document.createEventObject != null) {
|
||||
customEvent = document.createEventObject();
|
||||
customEvent.eventType = event;
|
||||
} else {
|
||||
customEvent.eventName = event;
|
||||
}
|
||||
return customEvent;
|
||||
};
|
||||
|
||||
Util.prototype.emitEvent = function(elem, event) {
|
||||
if (elem.dispatchEvent != null) {
|
||||
return elem.dispatchEvent(event);
|
||||
} else if (event in (elem != null)) {
|
||||
return elem[event]();
|
||||
} else if (("on" + event) in (elem != null)) {
|
||||
return elem["on" + event]();
|
||||
}
|
||||
};
|
||||
|
||||
Util.prototype.addEvent = function(elem, event, fn) {
|
||||
if (elem.addEventListener != null) {
|
||||
return elem.addEventListener(event, fn, false);
|
||||
} else if (elem.attachEvent != null) {
|
||||
return elem.attachEvent("on" + event, fn);
|
||||
} else {
|
||||
return elem[event] = fn;
|
||||
}
|
||||
};
|
||||
|
||||
Util.prototype.removeEvent = function(elem, event, fn) {
|
||||
if (elem.removeEventListener != null) {
|
||||
return elem.removeEventListener(event, fn, false);
|
||||
} else if (elem.detachEvent != null) {
|
||||
return elem.detachEvent("on" + event, fn);
|
||||
} else {
|
||||
return delete elem[event];
|
||||
}
|
||||
};
|
||||
|
||||
Util.prototype.innerHeight = function() {
|
||||
if ('innerHeight' in window) {
|
||||
return window.innerHeight;
|
||||
} else {
|
||||
return document.documentElement.clientHeight;
|
||||
}
|
||||
};
|
||||
|
||||
return Util;
|
||||
|
||||
})();
|
||||
|
||||
WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
|
||||
function WeakMap() {
|
||||
this.keys = [];
|
||||
this.values = [];
|
||||
}
|
||||
|
||||
WeakMap.prototype.get = function(key) {
|
||||
var i, item, j, len, ref;
|
||||
ref = this.keys;
|
||||
for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
||||
item = ref[i];
|
||||
if (item === key) {
|
||||
return this.values[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WeakMap.prototype.set = function(key, value) {
|
||||
var i, item, j, len, ref;
|
||||
ref = this.keys;
|
||||
for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
||||
item = ref[i];
|
||||
if (item === key) {
|
||||
this.values[i] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.keys.push(key);
|
||||
return this.values.push(value);
|
||||
};
|
||||
|
||||
return WeakMap;
|
||||
|
||||
})());
|
||||
|
||||
MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
|
||||
function MutationObserver() {
|
||||
if (typeof console !== "undefined" && console !== null) {
|
||||
console.warn('MutationObserver is not supported by your browser.');
|
||||
}
|
||||
if (typeof console !== "undefined" && console !== null) {
|
||||
console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
|
||||
}
|
||||
}
|
||||
|
||||
MutationObserver.notSupported = true;
|
||||
|
||||
MutationObserver.prototype.observe = function() {};
|
||||
|
||||
return MutationObserver;
|
||||
|
||||
})());
|
||||
|
||||
getComputedStyle = this.getComputedStyle || function(el, pseudo) {
|
||||
this.getPropertyValue = function(prop) {
|
||||
var ref;
|
||||
if (prop === 'float') {
|
||||
prop = 'styleFloat';
|
||||
}
|
||||
if (getComputedStyleRX.test(prop)) {
|
||||
prop.replace(getComputedStyleRX, function(_, _char) {
|
||||
return _char.toUpperCase();
|
||||
});
|
||||
}
|
||||
return ((ref = el.currentStyle) != null ? ref[prop] : void 0) || null;
|
||||
};
|
||||
return this;
|
||||
};
|
||||
|
||||
getComputedStyleRX = /(\-([a-z]){1})/g;
|
||||
|
||||
this.WOW = (function() {
|
||||
WOW.prototype.defaults = {
|
||||
boxClass: 'wow',
|
||||
animateClass: 'animated',
|
||||
offset: 0,
|
||||
mobile: true,
|
||||
live: true,
|
||||
callback: null,
|
||||
scrollContainer: null
|
||||
};
|
||||
|
||||
function WOW(options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
this.scrollCallback = bind(this.scrollCallback, this);
|
||||
this.scrollHandler = bind(this.scrollHandler, this);
|
||||
this.resetAnimation = bind(this.resetAnimation, this);
|
||||
this.start = bind(this.start, this);
|
||||
this.scrolled = true;
|
||||
this.config = this.util().extend(options, this.defaults);
|
||||
if (options.scrollContainer != null) {
|
||||
this.config.scrollContainer = document.querySelector(options.scrollContainer);
|
||||
}
|
||||
this.animationNameCache = new WeakMap();
|
||||
this.wowEvent = this.util().createEvent(this.config.boxClass);
|
||||
}
|
||||
|
||||
WOW.prototype.init = function() {
|
||||
var ref;
|
||||
this.element = window.document.documentElement;
|
||||
if ((ref = document.readyState) === "interactive" || ref === "complete") {
|
||||
this.start();
|
||||
} else {
|
||||
this.util().addEvent(document, 'DOMContentLoaded', this.start);
|
||||
}
|
||||
return this.finished = [];
|
||||
};
|
||||
|
||||
WOW.prototype.start = function() {
|
||||
var box, j, len, ref;
|
||||
this.stopped = false;
|
||||
this.boxes = (function() {
|
||||
var j, len, ref, results;
|
||||
ref = this.element.querySelectorAll("." + this.config.boxClass);
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
results.push(box);
|
||||
}
|
||||
return results;
|
||||
}).call(this);
|
||||
this.all = (function() {
|
||||
var j, len, ref, results;
|
||||
ref = this.boxes;
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
results.push(box);
|
||||
}
|
||||
return results;
|
||||
}).call(this);
|
||||
if (this.boxes.length) {
|
||||
if (this.disabled()) {
|
||||
this.resetStyle();
|
||||
} else {
|
||||
ref = this.boxes;
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
this.applyStyle(box, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.disabled()) {
|
||||
this.util().addEvent(this.config.scrollContainer || window, 'scroll', this.scrollHandler);
|
||||
this.util().addEvent(window, 'resize', this.scrollHandler);
|
||||
this.interval = setInterval(this.scrollCallback, 50);
|
||||
}
|
||||
if (this.config.live) {
|
||||
return new MutationObserver((function(_this) {
|
||||
return function(records) {
|
||||
var k, len1, node, record, results;
|
||||
results = [];
|
||||
for (k = 0, len1 = records.length; k < len1; k++) {
|
||||
record = records[k];
|
||||
results.push((function() {
|
||||
var l, len2, ref1, results1;
|
||||
ref1 = record.addedNodes || [];
|
||||
results1 = [];
|
||||
for (l = 0, len2 = ref1.length; l < len2; l++) {
|
||||
node = ref1[l];
|
||||
results1.push(this.doSync(node));
|
||||
}
|
||||
return results1;
|
||||
}).call(_this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
})(this)).observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.stop = function() {
|
||||
this.stopped = true;
|
||||
this.util().removeEvent(this.config.scrollContainer || window, 'scroll', this.scrollHandler);
|
||||
this.util().removeEvent(window, 'resize', this.scrollHandler);
|
||||
if (this.interval != null) {
|
||||
return clearInterval(this.interval);
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.sync = function(element) {
|
||||
if (MutationObserver.notSupported) {
|
||||
return this.doSync(this.element);
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.doSync = function(element) {
|
||||
var box, j, len, ref, results;
|
||||
if (element == null) {
|
||||
element = this.element;
|
||||
}
|
||||
if (element.nodeType !== 1) {
|
||||
return;
|
||||
}
|
||||
element = element.parentNode || element;
|
||||
ref = element.querySelectorAll("." + this.config.boxClass);
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
if (indexOf.call(this.all, box) < 0) {
|
||||
this.boxes.push(box);
|
||||
this.all.push(box);
|
||||
if (this.stopped || this.disabled()) {
|
||||
this.resetStyle();
|
||||
} else {
|
||||
this.applyStyle(box, true);
|
||||
}
|
||||
results.push(this.scrolled = true);
|
||||
} else {
|
||||
results.push(void 0);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
WOW.prototype.show = function(box) {
|
||||
this.applyStyle(box);
|
||||
box.className = box.className + " " + this.config.animateClass;
|
||||
if (this.config.callback != null) {
|
||||
this.config.callback(box);
|
||||
}
|
||||
this.util().emitEvent(box, this.wowEvent);
|
||||
this.util().addEvent(box, 'animationend', this.resetAnimation);
|
||||
this.util().addEvent(box, 'oanimationend', this.resetAnimation);
|
||||
this.util().addEvent(box, 'webkitAnimationEnd', this.resetAnimation);
|
||||
this.util().addEvent(box, 'MSAnimationEnd', this.resetAnimation);
|
||||
return box;
|
||||
};
|
||||
|
||||
WOW.prototype.applyStyle = function(box, hidden) {
|
||||
var delay, duration, iteration;
|
||||
duration = box.getAttribute('data-wow-duration');
|
||||
delay = box.getAttribute('data-wow-delay');
|
||||
iteration = box.getAttribute('data-wow-iteration');
|
||||
return this.animate((function(_this) {
|
||||
return function() {
|
||||
return _this.customStyle(box, hidden, duration, delay, iteration);
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
WOW.prototype.animate = (function() {
|
||||
if ('requestAnimationFrame' in window) {
|
||||
return function(callback) {
|
||||
return window.requestAnimationFrame(callback);
|
||||
};
|
||||
} else {
|
||||
return function(callback) {
|
||||
return callback();
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
WOW.prototype.resetStyle = function() {
|
||||
var box, j, len, ref, results;
|
||||
ref = this.boxes;
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
results.push(box.style.visibility = 'visible');
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
WOW.prototype.resetAnimation = function(event) {
|
||||
var target;
|
||||
if (event.type.toLowerCase().indexOf('animationend') >= 0) {
|
||||
target = event.target || event.srcElement;
|
||||
return target.className = target.className.replace(this.config.animateClass, '').trim();
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
|
||||
if (hidden) {
|
||||
this.cacheAnimationName(box);
|
||||
}
|
||||
box.style.visibility = hidden ? 'hidden' : 'visible';
|
||||
if (duration) {
|
||||
this.vendorSet(box.style, {
|
||||
animationDuration: duration
|
||||
});
|
||||
}
|
||||
if (delay) {
|
||||
this.vendorSet(box.style, {
|
||||
animationDelay: delay
|
||||
});
|
||||
}
|
||||
if (iteration) {
|
||||
this.vendorSet(box.style, {
|
||||
animationIterationCount: iteration
|
||||
});
|
||||
}
|
||||
this.vendorSet(box.style, {
|
||||
animationName: hidden ? 'none' : this.cachedAnimationName(box)
|
||||
});
|
||||
return box;
|
||||
};
|
||||
|
||||
WOW.prototype.vendors = ["moz", "webkit"];
|
||||
|
||||
WOW.prototype.vendorSet = function(elem, properties) {
|
||||
var name, results, value, vendor;
|
||||
results = [];
|
||||
for (name in properties) {
|
||||
value = properties[name];
|
||||
elem["" + name] = value;
|
||||
results.push((function() {
|
||||
var j, len, ref, results1;
|
||||
ref = this.vendors;
|
||||
results1 = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
vendor = ref[j];
|
||||
results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
|
||||
}
|
||||
return results1;
|
||||
}).call(this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
WOW.prototype.vendorCSS = function(elem, property) {
|
||||
var j, len, ref, result, style, vendor;
|
||||
style = getComputedStyle(elem);
|
||||
result = style.getPropertyCSSValue(property);
|
||||
ref = this.vendors;
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
vendor = ref[j];
|
||||
result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
WOW.prototype.animationName = function(box) {
|
||||
var animationName;
|
||||
try {
|
||||
animationName = this.vendorCSS(box, 'animation-name').cssText;
|
||||
} catch (_error) {
|
||||
animationName = getComputedStyle(box).getPropertyValue('animation-name');
|
||||
}
|
||||
if (animationName === 'none') {
|
||||
return '';
|
||||
} else {
|
||||
return animationName;
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.cacheAnimationName = function(box) {
|
||||
return this.animationNameCache.set(box, this.animationName(box));
|
||||
};
|
||||
|
||||
WOW.prototype.cachedAnimationName = function(box) {
|
||||
return this.animationNameCache.get(box);
|
||||
};
|
||||
|
||||
WOW.prototype.scrollHandler = function() {
|
||||
return this.scrolled = true;
|
||||
};
|
||||
|
||||
WOW.prototype.scrollCallback = function() {
|
||||
var box;
|
||||
if (this.scrolled) {
|
||||
this.scrolled = false;
|
||||
this.boxes = (function() {
|
||||
var j, len, ref, results;
|
||||
ref = this.boxes;
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
if (!(box)) {
|
||||
continue;
|
||||
}
|
||||
if (this.isVisible(box)) {
|
||||
this.show(box);
|
||||
continue;
|
||||
}
|
||||
results.push(box);
|
||||
}
|
||||
return results;
|
||||
}).call(this);
|
||||
if (!(this.boxes.length || this.config.live)) {
|
||||
return this.stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.offsetTop = function(element) {
|
||||
var top;
|
||||
while (element.offsetTop === void 0) {
|
||||
element = element.parentNode;
|
||||
}
|
||||
top = element.offsetTop;
|
||||
while (element = element.offsetParent) {
|
||||
top += element.offsetTop;
|
||||
}
|
||||
return top;
|
||||
};
|
||||
|
||||
WOW.prototype.isVisible = function(box) {
|
||||
var bottom, offset, top, viewBottom, viewTop;
|
||||
offset = box.getAttribute('data-wow-offset') || this.config.offset;
|
||||
viewTop = (this.config.scrollContainer && this.config.scrollContainer.scrollTop) || window.pageYOffset;
|
||||
viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
|
||||
top = this.offsetTop(box);
|
||||
bottom = top + box.clientHeight;
|
||||
return top <= viewBottom && bottom >= viewTop;
|
||||
};
|
||||
|
||||
WOW.prototype.util = function() {
|
||||
return this._util != null ? this._util : this._util = new Util();
|
||||
};
|
||||
|
||||
WOW.prototype.disabled = function() {
|
||||
return !this.config.mobile && this.util().isMobile(navigator.userAgent);
|
||||
};
|
||||
|
||||
return WOW;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
Vendored
-2
File diff suppressed because one or more lines are too long
@@ -1,69 +0,0 @@
|
||||
class Api {
|
||||
static send(request_method = "POST", url, header, body = {}, callback, server = Api.server, type) {
|
||||
// Api.defaultHeader['X-ACAI-CODE'] = Api.token
|
||||
url = server + url;
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.addEventListener("readystatechange", function() {
|
||||
if (this.readyState === 4) {
|
||||
try {
|
||||
callback(JSON.parse(this.responseText));
|
||||
} catch (error) {
|
||||
callback(this.responseText);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
xhr.open(request_method, url);
|
||||
for (const key in Api.defaultHeader) {
|
||||
xhr.setRequestHeader(key, Api.defaultHeader[key]);
|
||||
}
|
||||
|
||||
if (header) {
|
||||
for (const key in header) {
|
||||
xhr.setRequestHeader(key, header[key]);
|
||||
}
|
||||
}
|
||||
xhr.send(JSON.stringify(body));
|
||||
}
|
||||
static suscribeStripeMarketeina(selection) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!Api.token) {
|
||||
reject(new Error("No hay token"));
|
||||
return false;
|
||||
}
|
||||
Api.send(
|
||||
"POST",
|
||||
"/api/pay/",
|
||||
{
|
||||
Authorization: "Bearer " + Api.token
|
||||
},
|
||||
{
|
||||
method: "POST",
|
||||
action: "suscribeMarketeina",
|
||||
selection: selection
|
||||
},
|
||||
response => {
|
||||
if (!response.success) {
|
||||
if (JSON.parse(response).code == 403) {
|
||||
alert("Acceso a la aplicacion denegado, esto puede ocurrir por inactividad, vuelva a loguearse");
|
||||
localStorage.removeItem("COCOOKIE");
|
||||
localStorage.removeItem("COCOUSERNUM");
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
resolve(response);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Api.user = null;
|
||||
Api.usernum = null;
|
||||
Api.token = null;
|
||||
Api.server = "https://ws.cocosolution.com";
|
||||
Api.defaultHeader = {
|
||||
"Content-type": "application/json"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user