@ampify/aquery
Advanced tools
Comparing version 1.2.6 to 1.2.9
{ | ||
"name": "@ampify/aquery", | ||
"version": "1.2.6", | ||
"version": "1.2.9", | ||
"main": "./dist/aquery.js", | ||
@@ -37,3 +37,3 @@ "module": "./src", | ||
}, | ||
"gitHead": "6febac6ac5f89feff551f13eeec1322d80000023" | ||
"gitHead": "15395dc11c465f876d1003cabefc198e3505c4fb" | ||
} |
@@ -233,8 +233,9 @@ import jQuery from 'jquery'; | ||
const exitAction = arrActions.length == 2 ? arrActions.pop() : null; | ||
const enter = `calc(100vh + ${/^\d+$/.test(options.enter.toString()) ? options.enter + 'px' : options.enter})`; | ||
const enter = `calc(100vh + ${ | ||
/^\d+$/.test(options.enter.toString()) | ||
? options.enter + 'px' | ||
: options.enter | ||
})`; | ||
const { observer, observee } = scrollObserver( | ||
{ top: enter }, | ||
aQuery, | ||
); | ||
const { observer, observee } = scrollObserver({ top: enter }, aQuery); | ||
const anim = createAnimation({ | ||
@@ -250,3 +251,5 @@ selector: `#${genId(observee)}`, | ||
if (options.exit) { | ||
const exit = /^\d+$/.test(options.exit.toString()) ? options.exit + 'px' : options.exit; | ||
const exit = /^\d+$/.test(options.exit.toString()) | ||
? options.exit + 'px' | ||
: options.exit; | ||
@@ -349,2 +352,4 @@ const { | ||
form(options = {}) { | ||
console.log('zorg', options, createForm); | ||
for (const node of this.nodes) { | ||
@@ -431,3 +436,5 @@ if (aQuery(node).is('form')) { | ||
//if node is hidden we need to show and and hide it again using hidden attribute | ||
if (!node.offsetParent) { jQuery(node).show().attr('hidden', ''); } | ||
if (!node.offsetParent) { | ||
jQuery(node).show().attr('hidden', ''); | ||
} | ||
@@ -559,3 +566,5 @@ arrActions.push(`${genId(node)}.show()`); | ||
for (const node of this.nodes) { | ||
arrActions.push(`${genId(node)}.scrollTo(duration=${duration}, position=${position})`); | ||
arrActions.push( | ||
`${genId(node)}.scrollTo(duration=${duration}, position=${position})`, | ||
); | ||
} | ||
@@ -777,2 +786,2 @@ } | ||
// | ||
// |
const defaults = { | ||
'submit-error': { color: '#F44336' }, | ||
'submit-success': { color: '#009688' }, | ||
'submitting': { color: '#607D8B' }, | ||
submitting: { color: '#607D8B' }, | ||
}; | ||
@@ -14,3 +14,7 @@ | ||
<template type="amp-mustache"> | ||
${/^\</.test(message) ? message : `<span style="color: ${color}; clear: both;">${message}</span>`} | ||
${ | ||
/^\</.test(message) | ||
? message | ||
: `<span style="color: ${color}; clear: both;">${message}</span>` | ||
} | ||
</template> | ||
@@ -22,7 +26,6 @@ `; | ||
const createForm = ({ form, url, success, error, submit, fields = [] }, $) => { | ||
for (const { name, value } of fields) { | ||
$(`<input type="hidden" name="${name}" value="${value}" />`).appendTo(form); | ||
} | ||
const createForm = ( | ||
{ form, url, proxy, success, error, submit, fields = [], debug }, | ||
$, | ||
) => { | ||
if (url) { | ||
@@ -32,2 +35,17 @@ form.setAttribute('action', url); | ||
if (proxy) { | ||
const action = new URL(form.getAttribute('action'), location); | ||
form.setAttribute( | ||
'action', | ||
window.AMPIFY_DEBUG_PROXY_FORM_URL || '//api.ampify.io/forms', | ||
); | ||
fields.push({ name: 'ampifyProxyAction', value: action }); | ||
} | ||
if (debug) { | ||
fields.push({ name: 'ampifyProxyDebug', value: 1 }); | ||
} | ||
if (success) { | ||
@@ -42,6 +60,10 @@ addMessage(form, 'submit-success', success); | ||
if (submit) { | ||
addMessage(form, 'submit', submit); | ||
addMessage(form, 'submitting', submit); | ||
} | ||
for (const { name, value } of fields) { | ||
$(`<input type="hidden" name="${name}" value="${value}" />`).appendTo(form); | ||
} | ||
}; | ||
export default createForm; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44203
1416