- 扫描 ID:
- ab4dd0a5-b1b4-4193-9816-6b6f3032bde7已完成
- 提交的 URL:
- https://www.abcsubmit.com/embed/id_1giknhm4m_uus/feedback-form.js
- 报告完成时间:
链接 · 找到 0 个
从页面中识别出的传出链接
JavaScript 变量 · 找到 3 个
在页面窗口对象上加载的全局 JavaScript 变量是在函数外部声明的变量,可以从当前范围内的代码中的任何位置访问
名称 | 类型 |
---|---|
onbeforetoggle | object |
documentPictureInPicture | object |
onscrollend | object |
控制台日志消息 · 找到 0 条
记录到 Web 控制台的消息
HTML
页面的原始 HTML 正文
<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">(function () {
var warn = function (message) {
try {
console.warn.apply(this, ['[abcsubmit.com]'].concat(Array.prototype.slice.call(arguments, 0)));
} catch (e) {
}
};
if (!document || !document.querySelector) {
warn('Failed to embed form. Running under node.js, or your browser is too old!');
return;
}
var documentId = 'id_1giknhm4m_uus',
embedJavascriptPlaceholder = document.querySelector('script[type="text/javascript"][data-role="abcsubmit-form-embed"][data-document-id="' + documentId + '"]'),
embedMethod = embedJavascriptPlaceholder.hasAttribute('data-embed-method')
? (embedJavascriptPlaceholder.getAttribute('data-embed-method') || null)
: null;
if (!embedJavascriptPlaceholder) {
warn('Failed to embed your document: Incorrect embed code');
}
function addWindowListeners(iframe, embedURL, noWidthResizing, noScrolling) {
noWidthResizing = noWidthResizing || false;
noScrolling = noScrolling || false;
var origin = embedJavascriptPlaceholder && embedJavascriptPlaceholder.getAttribute
? embedJavascriptPlaceholder.getAttribute('data-origin')
: null;
var listener = function (e) {
var messageData = e.data || null;
if (!messageData) {
return;
}
if (['http://' + embedURL.hostname, 'https://' + embedURL.hostname].indexOf(e.origin) === -1
&&
( origin && ['http://' + origin, 'https://' + origin].indexOf(e.origin) === -1 )
) {
return;
}
var eventCommand = messageData.command,
eventDocumentId = messageData.documentId;
if (eventDocumentId !== documentId) {
return; // ANOTHER EMBED SCRIPT WILL HANDLE THIS COMMAND
}
switch (eventCommand) {
case "resize":
var width = messageData.width,
height = messageData.height;
if ('string' === typeof width && 'string' === typeof 'height') {
if (!noWidthResizing) {
iframe.style.width = width
? width
: '100%';
}
iframe.style.height = height
? height
: '100%';
}
break;
case "submit_navigate_to_url":
if ('string' === typeof messageData.url && messageData.url) {
location.href = messageData.url;
}
break;
case "switch_page":
try {
if (noScrolling) {
return;
}
var iframeClientRect = iframe.getBoundingClientRect();
if (!iframeClientRect) {
return;
}
var wantedScrollLeftPosition = Math.round(iframeClientRect.left),
wantedScrollTopPosition = Math.round(iframeClientRect.top),
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
wantedScrollLeftPosition += scrollLeft;
wantedScrollTopPosition += scrollTop;
wantedScrollTopPosition -= 20;
wantedScrollTopPosition = Math.max(0, wantedScrollTopPosition);
try {
window.scrollTo({
left: wantedScrollLeftPosition,
top: wantedScrollTopPosition,
behavior: "smooth",
});
} catch (e) {
window.scrollTo(wantedScrollLeftPosition, wantedScrollTopPosition);
}
} catch (e) {
}
break;
default:
// DISCARD;
}
};
window.addEventListener("message", listener);
return listener;
}
function getAbcSubmitURL(urlWithoutProtocol) {
switch (location.protocol) {
case 'http:':
case 'https:':
return urlWithoutProtocol;
default:
return 'https:' + urlWithoutProtocol;
}
}
function regularEmbed() {
var iframe = document.createElement('iframe'),
embedURL = document.createElement('a'),
origin = embedJavascriptPlaceholder && embedJavascriptPlaceholder.getAttribute
? embedJavascriptPlaceholder.getAttribute('data-origin')
: null;
embedURL.setAttribute('href', embedJavascriptPlaceholder.getAttribute('src'));
iframe.src = getAbcSubmitURL(
'//' + (origin || embedURL.hostname) + '/view/' + embedJavascriptPlaceholder.getAttribute('data-document-id')
+ '?referrer=' + encodeURIComponent(document.referrer)
+ '&embedURL=' + encodeURIComponent(location.href)
+ '&isEmbed=1'
+ ('&' + embedJavascriptPlaceholder.getAttribute('data-embed-params') || '')
);
iframe.style.backgroundColor = 'transparent !important';
iframe.setAttribute('data-role-abcsubmit', '1');
iframe.style.border = 'none !important';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.display = 'block';
iframe.style.maxWidth = "100%";
iframe.style.margin = '0 auto';
embedJavascriptPlaceholder.parentNode.replaceChild(iframe, embedJavascriptPlaceholder);
addWindowListeners(iframe, embedURL);
}
function createCloseButtonSVG(bgColor) {
return '<svg width="32" height="32" version="1.1" viewBox="0 0 8.4666665 8.4666669" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'
+ '<g transform="translate(0 -288.53)">'
+ '<path transform="matrix(.26458 0 0 .26458 0 288.53)" d="m3.1465 0l-3.1465 3.1465 12.854 12.854-12.854 12.854 3.1465 3.1465 12.854-12.854 12.854 12.854 3.1465-3.1465-12.854-12.854 12.854-12.854-3.1465-3.1465-12.854 12.854-12.854-12.854z" fill="' + bgColor + '" fill-rule="evenodd"/>'
+ '</g>'
+ '</svg>';
}
function createLightbox(lightboxStyle, width, height, onClose, titlebarText) {
var lightboxStyleDOMNode = document.createElement("style");
var lightboxModalDOMNode = document.createElement("div");
var lightboxBorderDOMNode = document.createElement("div");
var lightboxBodyDOMNode = document.createElement("div");
var closeButtonDOMNode = document.createElement("div");
var lightboxId = "lightbox-id-" + (+new Date) + "-" + Math.round(10000 * Math.random()) + "-" + Math.round(10000 * Math.random());
var titlebarDOMNode;
var borderColor,
bodyColor,
outerBorderRadius = "5px",
innerBorderRadius = "3px",
hasTitlebar = false;
lightboxModalDOMNode.id = lightboxId;
switch (lightboxStyle) {
case "titlebar":
borderColor = "#444444";
bodyColor = "#ffffff";
innerBorderRadius = "0 0 3px 3px";
hasTitlebar = true;
closeButtonDOMNode.innerHTML = createCloseButtonSVG('#fff');
break;
case "light-border":
borderColor = "#ffffff";
bodyColor = "#ffffff";
closeButtonDOMNode.innerHTML = createCloseButtonSVG('#444');
break;
case "dark-border":
default:
borderColor = "#444444";
bodyColor = "#ffffff";
closeButtonDOMNode.innerHTML = createCloseButtonSVG('#fff');
break;
}
if (hasTitlebar) {
titlebarDOMNode = document.createElement("div");
titlebarDOMNode.className = "lb-titlebar";
titlebarDOMNode.textContent = titlebarText || "";
}
var cssLines = [
"#" + lightboxId + " {",
" position: fixed;",
" left: 0;",
" top: 0;",
" right: 0;",
" bottom: 0;",
" background-color: rgba(0,0,0,.9);",
" overflow-x: hidden;",
" overflow-y: auto;",
" z-index: 3000000;",
"}",
"#" + lightboxId + " .lb-border {",
" display: block;",
" position: relative;",
" background-color: " + borderColor + ";",
" padding: 10px;",
" margin: 100px auto 10px auto;",
" border-radius: " + outerBorderRadius + ";",
" max-width: calc(100vw - 40px);",
" box-sizing: border-box;",
(width ? "width: " + width + ";" : ""),
"}",
"@media screen and (max-width: 760px) {",
" #" + lightboxId + " .lb-border {",
" margin: 20px auto 20px auto;",
" }",
"}",
"@media screen and (max-height: 760px) {",
" #" + lightboxId + " .lb-border {",
" margin: 20px auto 20px auto;",
" }",
"}",
"#" + lightboxId + " .lb-body {",
" background-color: " + bodyColor + ";",
" border-radius: " + innerBorderRadius + ";",
" box-sizing: border-box;",
"}",
"#" + lightboxId + " .lb-body iframe {",
"width: 1px !important;",
"min-width: 100% !important;",
"}",
"#" + lightboxId + " .lb-titlebar {",
" background-color: #4285f4;",
" border-radius: 3px 3px 0 0;",
" box-sizing: border-box;",
" height: 50px;",
" padding: 14px 10px;",
" color: white;",
" font-weight: bold;",
" font-family: BlinkMacSystemFont, -apple-system, 'Segoe UI', SegoeUI, 'Segoe WP', Roboto, Helvetica, Arial, Tahoma, sans-serif;",
" position: relative",
"}",
"#" + lightboxId + " .lb-close > svg {",
" width: 100%;",
" height: 100%;",
"}",
"#" + lightboxId + " .lb-titlebar > .lb-close {",
" position: absolute;",
" right: 16px;",
" top: 15px;",
" width: 20px;",
" height: 20px;",
" cursor: pointer;",
"}",
"#" + lightboxId + " .lb-border > .lb-close {",
" position: absolute;",
" cursor: pointer;",
" right: -10px;",
" top: -10px;",
" width: 30px;",
" height: 30px;",
" background-color: inherit;",
" border-radius: 15px;",
" overflow: hidden;",
" padding: 7px;",
" box-sizing: border-box;",
"}",
".overflow-hidden-body {",
" overflow: hidden !important;",
"}",
];
if (embedMethod === "lightbox") {
cssLines.push(
"#" + lightboxId + " {"
);
cssLines.push(
" display: none;"
);
cssLines.push(
"}"
);
}
lightboxStyleDOMNode.textContent = cssLines.join("\n");
lightboxBorderDOMNode.className = "lb-border";
lightboxBodyDOMNode.className = "lb-body";
closeButtonDOMNode.className = "lb-close";
if (hasTitlebar) {
titlebarDOMNode.appendChild(closeButtonDOMNode);
lightboxBorderDOMNode.appendChild(titlebarDOMNode);
} else {
lightboxBorderDOMNode.appendChild(closeButtonDOMNode);
}
lightboxBorderDOMNode.appendChild(lightboxBodyDOMNode);
lightboxModalDOMNode.appendChild(lightboxStyleDOMNode);
lightboxModalDOMNode.appendChild(lightboxBorderDOMNode);
document.body.appendChild(lightboxModalDOMNode);
lightboxModalDOMNode.addEventListener("click", function (e) {
var target = e.target || e.srcElement;
if (target === lightboxModalDOMNode && lightboxModalDOMNode.parentNode) {
lightboxModalDOMNode.parentNode.removeChild(lightboxModalDOMNode);
if (onClose) {
onClose();
}
}
}, true);
closeButtonDOMNode.addEventListener("click", function (e) {
if (lightboxModalDOMNode.parentNode) {
lightboxModalDOMNode.parentNode.removeChild(lightboxModalDOMNode);
if (onClose) {
onClose();
}
}
}, true);
return {
root: lightboxModalDOMNode,
frame: lightboxBorderDOMNode,
body: lightboxBodyDOMNode
};
}
function createFloatingModal(lightboxStyle, width, height, onClose, titlebarText, screenPosition) {
var lightboxStyleDOMNode = document.createElement("style");
var lightboxModalDOMNode = document.createElement("div");
var lightboxBorderDOMNode = document.createElement("div");
var lightboxBodyDOMNode = document.createElement("div");
var closeButtonDOMNode = document.createElement("div");
var lightboxId = "lightbox-id-" + (+new Date) + "-" + Math.round(10000 * Math.random()) + "-" + Math.round(10000 * Math.random());
var titlebarDOMNode;
var borderColor,
bodyColor,
outerBorderRadius = "5px",
innerBorderRadius = "5px",
hasTitlebar = false;
lightboxModalDOMNode.id = lightboxId;
switch (lightboxStyle) {
case "titlebar":
borderColor = "#444444";
bodyColor = "#ffffff";
innerBorderRadius = "0 0 3px 3px";
hasTitlebar = true;
closeButtonDOMNode.innerHTML = createCloseButtonSVG('#fff');
break;
case "light-border":
borderColor = "#ffffff";
bodyColor = "#ffffff";
closeButtonDOMNode.innerHTML = createCloseButtonSVG('#444');
break;
case "dark-border":
default:
borderColor = "#444444";
bodyColor = "#ffffff";
closeButtonDOMNode.innerHTML = createCloseButtonSVG('#fff');
break;
}
if (hasTitlebar) {
titlebarDOMNode = document.createElement("div");
titlebarDOMNode.className = "lb-titlebar";
titlebarDOMNode.textContent = titlebarText || "";
}
var cssLines = [
"#" + lightboxId + " {",
" position: fixed;",
" padding: 10px;",
" background-color: " + borderColor + ";",
" border-radius: 8px;",
" z-index: 10000000;",
"}",
"#" + lightboxId + " .lb-border {",
" display: block;",
" position: relative;",
" border-radius: " + outerBorderRadius + ";",
" max-width: calc(100vw - 50px);",
" box-sizing: border-box;",
" max-height: calc(100vh - 90px);",
" overflow-y: scroll;);",
(width ? "width: " + width + ";" : ""),
"}",
"@media screen and (max-width: 760px) {",
" #" + lightboxId + " {",
" top: 50%!important;\n",
" left: 50%!important;\n",
" bottom: unset!important;\n",
" right: unset!important;\n",
" transform: translate(-50%, -50%)!important;\n",
" }",
"}",
"#" + lightboxId + " .lb-body {",
" background-color: " + bodyColor + ";",
" border-radius: " + innerBorderRadius + ";",
" box-sizing: border-box;",
"}",
"#" + lightboxId + " .lb-body iframe {",
"width: 1px !important;",
"min-width: 100% !important;",
"}",
"#" + lightboxId + " .lb-titlebar {",
" background-color: #4285f4;",
" border-radius: 3px 3px 0 0;",
" box-sizing: border-box;",
" height: 50px;",
" padding: 14px 10px;",
" color: white;",
" font-weight: bold;",
" font-family: BlinkMacSystemFont, -apple-system, 'Segoe UI', SegoeUI, 'Segoe WP', Roboto, Helvetica, Arial, Tahoma, sans-serif;",
" position: relative",
"}",
"#" + lightboxId + " .lb-close > svg {",
" width: 100%;",
" height: 100%;",
" color: black;",
"}",
"#" + lightboxId + " .lb-titlebar > .lb-close {",
" position: absolute;",
" right: 16px;",
" top: 15px;",
" width: 20px;",
" height: 20px;",
" cursor: pointer;",
"}",
"#" + lightboxId + " .lb-border > .lb-close {",
" position: absolute;",
" cursor: pointer;",
" right: -10px;",
" top: -10px;",
" width: 30px;",
" height: 30px;",
" background-color: inherit;",
" border-radius: 15px;",
" overflow: hidden;",
" padding: 7px;",
" box-sizing: border-box;",
"}",
"#" + lightboxId + " > .lb-close {",
" position: absolute;",
" cursor: pointer;",
" right: -8px;",
" top: -8px;",
" width: 30px;",
" height: 30px;",
" background-color: inherit;",
" border-radius: 15px;",
" overflow: hidden;",
" padding: 7px;",
" box-sizing: border-box;",
" z-index: 10000001;",
" border: 1px solid " +borderColor + ";",
"}",
];
switch (screenPosition) {
case 'bottom-middle':
cssLines.push( "#" + lightboxId + " {\n");
cssLines.push( " left: 50%;\n");
cssLines.push( " transform: translateX(-50%);\n");
cssLines.push( " bottom: 15px;\n");
cssLines.push( " }");
break;
case 'bottom-left':
cssLines.push( "#" + lightboxId + " { \n");
cssLines.push( "left: 15px; \n");
cssLines.push( "bottom: 15px;\n");
cssLines.push( " }");
break;
case 'center-right':
cssLines.push( "#" + lightboxId + " { \n");
cssLines.push( "right: 15px; \n");
cssLines.push( "top: 50%;\n");
cssLines.push( " transform: translateY(-50%);\n");
cssLines.push( " }");
break;
case 'center-middle':
cssLines.push( "#" + lightboxId + " { \n");
cssLines.push( "top: 50%;\n");
cssLines.push( "left: 50%; \n");
cssLines.push( " transform: translate(-50%, -50%);\n");
cssLines.push( " }");
break;
case 'center-left':
cssLines.push( "#" + lightboxId + " { \n");
cssLines.push( "left: 15px; \n");
cssLines.push( "top: 50%;\n");
cssLines.push( " transform: translateY(-50%);\n");
cssLines.push( " }");
break;
case 'top-right':
cssLines.push( "#" + lightboxId + " { \n");
cssLines.push( "right: 15px; \n");
cssLines.push( "top: 15px;\n");
cssLines.push( " }");
break;
case 'top-middle':
cssLines.push( "#" + lightboxId + " {\n");
cssLines.push( " left: 50%;\n");
cssLines.push( " transform: translateX(-50%);\n");
cssLines.push( " top: 15px;\n");
cssLines.push( " }");
break;
case 'top-left':
cssLines.push( "#" + lightboxId + " { \n");
cssLines.push( "left: 15px; \n");
cssLines.push( "top: 15px;\n");
cssLines.push( " }");
break;
default:
cssLines.push( "#" + lightboxId + " { \n");
cssLines.push( "right: 15px; \n");
cssLines.push( "bottom: 15px;\n");
cssLines.push( " }");
break;
}
if (embedMethod === "floating-modal") {
cssLines.push(
"#" + lightboxId + " {"
);
cssLines.push(
" display: none;"
);
cssLines.push(
"}"
);
}
lightboxStyleDOMNode.textContent = cssLines.join("\n");
lightboxBorderDOMNode.className = "lb-border";
lightboxBodyDOMNode.className = "lb-body";
closeButtonDOMNode.className = "lb-close";
if (hasTitlebar) {
titlebarDOMNode.appendChild(closeButtonDOMNode);
lightboxBorderDOMNode.appendChild(titlebarDOMNode);
} else {
lightboxModalDOMNode.appendChild(closeButtonDOMNode);
}
lightboxBorderDOMNode.appendChild(lightboxBodyDOMNode);
lightboxModalDOMNode.appendChild(lightboxStyleDOMNode);
lightboxModalDOMNode.appendChild(lightboxBorderDOMNode);
document.body.appendChild(lightboxModalDOMNode);
lightboxModalDOMNode.addEventListener("click", function (e) {
var target = e.target || e.srcElement;
if (target === lightboxModalDOMNode && lightboxModalDOMNode.parentNode) {
lightboxModalDOMNode.parentNode.removeChild(lightboxModalDOMNode);
if (onClose) {
onClose();
}
}
}, true);
closeButtonDOMNode.addEventListener("click", function (e) {
if (lightboxModalDOMNode.parentNode) {
lightboxModalDOMNode.parentNode.removeChild(lightboxModalDOMNode);
if (onClose) {
onClose();
}
}
}, true);
return {
root: lightboxModalDOMNode,
frame: lightboxBorderDOMNode,
body: lightboxBodyDOMNode
};
}
function feedbackButtonEmbed() {
var buttonPlacement = embedJavascriptPlaceholder.getAttribute('data-button-placement')/** LEFT-CENTER **/,
buttonText = embedJavascriptPlaceholder.getAttribute("data-button-text") /** SUPPORT **/,
buttonBackgroundColor = embedJavascriptPlaceholder.getAttribute("data-bg-color"),
buttonTextColor = embedJavascriptPlaceholder.getAttribute("data-text-color"),
lightboxWidth = embedJavascriptPlaceholder.getAttribute("data-lightbox-width"),
lightboxHeight = embedJavascriptPlaceholder.getAttribute("data-lightbox-height"),
lightboxType = embedJavascriptPlaceholder.getAttribute("data-lightbox-type");
var formId = embedJavascriptPlaceholder.getAttribute("data-document-id"),
feedbackButtonId = "feedback-button-abcsubmit-" + formId;
var feedbackButton = document.createElement("a");
feedbackButton.setAttribute("href", "javascript:");
feedbackButton.textContent = buttonText || "Feedback";
feedbackButton.id = feedbackButtonId;
document.body.appendChild(feedbackButton);
var feedbackButtonCSSNode = document.createElement("style");
var cssLines = [
"#" + feedbackButtonId + " {",
" position: fixed;",
" display: block;",
" cursor: pointer;",
" background-color: " + buttonBackgroundColor + ";",
" color: " + buttonTextColor + ";",
" padding: 10px;",
" font-weight: bold;",
" text-decoration: none;",
" line-height: 1em;",
" box-sizing: border-box;",
" user-select: none;",
" -webkit-user-select: none;",
" -moz-user-select: none;",
" -ms-user-select: none;",
" font-family: BlinkMacSystemFont, -apple-system, 'Segoe UI', SegoeUI, 'Segoe WP', Roboto, Helvetica, Arial, Tahoma, sans-serif;",
" z-index: 2999999;",
];
switch (buttonPlacement) {
case "left-start":
cssLines.push("left: 0; top: 10px; border-radius: 0 5px 5px 0; writing-mode: vertical-lr;");
break;
case "left-end":
cssLines.push("left: 0; bottom: 10px; border-radius: 0 5px 5px 0; writing-mode: vertical-lr;");
break;
case "top-start":
cssLines.push("left: 10px; top: 0; border-radius: 0 0 5px 5px;");
break;
case "top-center":
cssLines.push("left: 50%; top: 0; border-radius: 0 0 5px 5px; transform: translateX(-50%); -webkit-transform: translateX(-50%); -moz-transform: translateX(-50%);");
break;
case "top-end":
cssLines.push("right: 10px; top: 0; border-radius: 0 0 5px 5px;");
break;
case "right-start":
cssLines.push("right: 0; top: 10px; border-radius: 5px 0 0 5px; writing-mode: vertical-lr;");
break;
case "right-center":
cssLines.push("right: 0; top: 50%; border-radius: 5px 0 0 5px; writing-mode: vertical-lr; transform: translateY(-50%); -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%);");
break;
case "right-end":
cssLines.push("right: 0; bottom: 10px; border-radius: 5px 0 0 5px; writing-mode: vertical-lr;");
break;
case "bottom-start":
cssLines.push("bottom: 0; left: 10px; border-radius: 5px 5px 0 0;");
break;
case "bottom-center":
cssLines.push("bottom: 0; left: 50%; border-radius: 5px 5px 0 0; transform: translateX(-50%); -webkit-transform: translateX(-50%); -moz-transform: translateX(-50%);");
break;
case "bottom-end":
cssLines.push("bottom: 0; right: 10px; border-radius: 5px 5px 0 0;");
break;
case "left-center":
default:
cssLines.push("left: 0; top: 50%; border-radius: 0 5px 5px 0; writing-mode: vertical-lr; transform: translateY(-50%); -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%);");
break;
}
cssLines.push(" }");
cssLines.push("#" + feedbackButtonId + ":hover {");
cssLines.push(" filter: brightness(1.1);");
cssLines.push(" -webkit-filter: brightness(1.1);");
cssLines.push(" -moz-filter: brightness(1.1);");
cssLines.push(" -ms-filter: brightness(1.1);");
cssLines.push("}");
cssLines.push("#" + feedbackButtonId + ":active {");
cssLines.push(" filter: brightness(0.9);");
cssLines.push(" -webkit-filter: brightness(0.9);");
cssLines.push(" -moz-filter: brightness(0.9);");
cssLines.push(" -ms-filter: brightness(0.9);");
cssLines.push("}");
feedbackButtonCSSNode.textContent = cssLines.join("\n");
document.body.appendChild(feedbackButtonCSSNode);
feedbackButton.addEventListener("click", function () {
var closeCallbackExec,
closeCallback = function () {
if (closeCallbackExec) {
closeCallbackExec();
}
};
var lightbox = createLightbox(lightboxType, lightboxWidth, lightboxHeight, closeCallback, buttonText),
iframe = document.createElement('iframe'),
embedURL = document.createElement('a'),
origin = embedJavascriptPlaceholder && embedJavascriptPlaceholder.getAttribute
? embedJavascriptPlaceholder.getAttribute("data-origin")
: null;
embedURL.setAttribute('href', embedJavascriptPlaceholder.getAttribute('src'));
iframe.src = getAbcSubmitURL(
'//' + (origin || embedURL.hostname) + '/view/' + embedJavascriptPlaceholder.getAttribute('data-document-id')
+ '?referrer=' + encodeURIComponent(document.referrer)
+ '&embedURL=' + encodeURIComponent(location.href)
+ '&isEmbed=1'
+ '&isLightbox=1'
+ ('&' + embedJavascriptPlaceholder.getAttribute('data-embed-params') || '')
);
iframe.style.backgroundColor = 'transparent !important';
iframe.setAttribute('data-role-abcsubmit', '1');
iframe.style.border = 'none !important';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.display = 'block';
iframe.style.width = "100%";
lightbox.body.appendChild(iframe);
var listener = addWindowListeners(iframe, embedURL, true, true);
closeCallbackExec = function () {
window.removeEventListener("message", listener);
}
});
}
function lightboxEmbed() {
var buttonText = embedJavascriptPlaceholder.getAttribute("data-button-text") || "",
buttonBackgroundColor = embedJavascriptPlaceholder.getAttribute("data-bg-color"),
buttonTextColor = embedJavascriptPlaceholder.getAttribute("data-text-color"),
lightboxWidth = embedJavascriptPlaceholder.getAttribute("data-lightbox-width"),
lightboxHeight = embedJavascriptPlaceholder.getAttribute("data-lightbox-height"),
lightboxType = embedJavascriptPlaceholder.getAttribute("data-lightbox-type"),
lightboxTimeout = embedJavascriptPlaceholder.getAttribute("data-lightbox-timeout"),
lightboxAutoload = !!~~embedJavascriptPlaceholder.getAttribute("data-lightbox-autoload"),
lightobxExitIntent = !!~~embedJavascriptPlaceholder.getAttribute("data-lightbox-exit-intent");
var openLightbox = function (waitForIframeLoad) {
var closeCallbackExec,
closeCallback = function () {
if (closeCallbackExec) {
closeCallbackExec();
}
};
var lightbox = createLightbox(lightboxType, lightboxWidth, lightboxHeight, closeCallback, buttonText),
iframe = document.createElement('iframe'),
embedURL = document.createElement('a'),
origin = embedJavascriptPlaceholder && embedJavascriptPlaceholder.getAttribute
? embedJavascriptPlaceholder.getAttribute("data-origin")
: null;
embedURL.setAttribute('href', embedJavascriptPlaceholder.getAttribute('src'));
iframe.src = getAbcSubmitURL('//' + (origin || embedURL.hostname) + '/view/' + embedJavascriptPlaceholder.getAttribute('data-document-id')
+ '?referrer=' + encodeURIComponent(document.referrer)
+ '&embedURL=' + encodeURIComponent(location.href)
+ '&isEmbed=1'
+ '&isLightbox=1'
+ ('&' + embedJavascriptPlaceholder.getAttribute('data-embed-params') || '')
);
iframe.style.backgroundColor = 'transparent !important';
iframe.setAttribute('data-role-abcsubmit', '1');
iframe.style.border = 'none !important';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.display = 'block';
iframe.style.width = "100%";
lightbox.body.appendChild(iframe);
var listener = addWindowListeners(iframe, embedURL, true, true);
closeCallbackExec = function () {
window.removeEventListener("message", listener);
}
if (waitForIframeLoad) {
setTimeout(() => {
document.body.classList.add('overflow-hidden-body');
lightbox.root.style.display = 'block';
}, 1500);
} else {
document.body.classList.add('overflow-hidden-body');
lightbox.root.style.display = 'block';
}
},
injectButton = function () {
var formId = embedJavascriptPlaceholder.getAttribute("data-document-id"),
feedbackButtonId = "feedback-button-abcsubmit-" + formId;
var feedbackButton = document.createElement("a");
feedbackButton.setAttribute("href", "javascript:");
feedbackButton.textContent = buttonText || "Feedback";
feedbackButton.id = feedbackButtonId;
embedJavascriptPlaceholder.parentNode.insertBefore(feedbackButton, embedJavascriptPlaceholder);
var feedbackButtonCSSNode = document.createElement("style");
var cssLines = [
"#" + feedbackButtonId + " {",
" position: relative;",
" display: inline-block;",
" cursor: pointer;",
" background-color: " + buttonBackgroundColor + ";",
" color: " + buttonTextColor + ";",
" padding: 10px;",
" font-weight: bold;",
" text-decoration: none;",
" line-height: 1em;",
" box-sizing: border-box;",
" user-select: none;",
" -webkit-user-select: none;",
" -moz-user-select: none;",
" -ms-user-select: none;",
" vertical-align: middle;",
" border-radius: 3px;",
];
cssLines.push(" }");
cssLines.push("#" + feedbackButtonId + ":hover {");
cssLines.push(" filter: brightness(1.1);");
cssLines.push(" -webkit-filter: brightness(1.1);");
cssLines.push(" -moz-filter: brightness(1.1);");
cssLines.push(" -ms-filter: brightness(1.1);");
cssLines.push("}");
cssLines.push("#" + feedbackButtonId + ":active {");
cssLines.push(" filter: brightness(0.9);");
cssLines.push(" -webkit-filter: brightness(0.9);");
cssLines.push(" -moz-filter: brightness(0.9);");
cssLines.push(" -ms-filter: brightness(0.9);");
cssLines.push("}");
feedbackButtonCSSNode.textContent = cssLines.join("\n");
document.body.appendChild(feedbackButtonCSSNode);
return feedbackButton;
},
ouibounce = function (el, custom_config) {
var config = custom_config || {},
aggressive = config.aggressive || false,
sensitivity = setDefault(config.sensitivity, 20),
timer = setDefault(config.timer, 1000),
delay = setDefault(config.delay, 0),
callback = config.callback || function () {
},
cookieExpire = setDefaultCookieExpire(config.cookieExpire) || '',
cookieDomain = config.cookieDomain ? ';domain=' + config.cookieDomain : '',
cookieName = config.cookieName ? config.cookieName : 'viewedOuibounceModal',
sitewide = config.sitewide === true ? ';path=/' : '',
_delayTimer = null,
_html = document.documentElement;
function setDefault(_property, _default) {
return typeof _property === 'undefined' ? _default : _property;
}
function setDefaultCookieExpire(days) {
var ms = days * 24 * 60 * 60 * 1000;
var date = new Date();
date.setTime(date.getTime() + ms);
return "; expires=" + date.toUTCString();
}
setTimeout(attachOuiBounce, timer);
function attachOuiBounce() {
if (isDisabled()) {
return;
}
_html.addEventListener('mouseleave', handleMouseleave);
_html.addEventListener('mouseenter', handleMouseenter);
_html.addEventListener('keydown', handleKeydown);
}
function handleMouseleave(e) {
if (e.clientY > sensitivity) {
return;
}
_delayTimer = setTimeout(fire, delay);
}
function handleMouseenter() {
if (_delayTimer) {
clearTimeout(_delayTimer);
_delayTimer = null;
}
}
var disableKeydown = false;
function handleKeydown(e) {
if (disableKeydown) {
return;
} else if (!e.metaKey || e.keyCode !== 76) {
return;
}
disableKeydown = true;
_delayTimer = setTimeout(fire, delay);
}
function checkCookieValue(cookieName, value) {
return parseCookies()[cookieName] === value;
}
function parseCookies() {
// cookies are separated by '; '
var cookies = document.cookie.split('; ');
var ret = {};
for (var i = cookies.length - 1; i >= 0; i--) {
var el = cookies[i].split('=');
ret[el[0]] = el[1];
}
return ret;
}
function isDisabled() {
return checkCookieValue(cookieName, 'true') && !aggressive;
}
function fire() {
if (isDisabled()) {
return;
}
if (el) {
el.style.display = 'block';
}
callback();
disable();
}
function disable(custom_options) {
var options = custom_options || {};
if (typeof options.cookieExpire !== 'undefined') {
cookieExpire = setDefaultCookieExpire(options.cookieExpire);
}
if (options.sitewide === true) {
sitewide = ';path=/';
}
if (typeof options.cookieDomain !== 'undefined') {
cookieDomain = ';domain=' + options.cookieDomain;
}
if (typeof options.cookieName !== 'undefined') {
cookieName = options.cookieName;
}
document.cookie = cookieName + '=true' + cookieExpire + cookieDomain + sitewide;
_html.removeEventListener('mouseleave', handleMouseleave);
_html.removeEventListener('mouseenter', handleMouseenter);
_html.removeEventListener('keydown', handleKeydown);
}
return {
fire: fire,
disable: disable,
isDisabled: isDisabled
};
},
executeTimeout = function () {
var timeoutParts = lightboxTimeout.split("-");
if (timeoutParts.length !== 3 || timeoutParts[0] !== "1") {
return;
}
var timeoutValue = parseInt(timeoutParts[1]) || 0,
timeoutUnit = timeoutParts[2];
if (!timeoutValue) {
openLightbox();
return;
}
var openAfterDate = new Date();
switch (timeoutUnit) {
case "m":
openAfterDate.setMinutes(openAfterDate.getMinutes() + timeoutValue);
break;
case "h":
openAfterDate.setHours(openAfterDate.getHours() + timeoutValue);
break;
case "s":
default:
openAfterDate.setSeconds(openAfterDate.getSeconds() + timeoutValue);
break;
}
var openAfterTime = +openAfterDate;
var openAfterInterval = setInterval(function () {
if (+new Date >= openAfterTime) {
openLightbox(true);
clearInterval(openAfterInterval);
}
}, 1000);
};
if (buttonText) {
var button = injectButton();
button.addEventListener("click", function () {
openLightbox();
}, true);
}
if (lightboxAutoload) {
openLightbox(true);
}
if (lightobxExitIntent) {
ouibounce(null, {
aggressive: true,
timer: 0,
callback: function () {
openLightbox();
},
})
}
if (lightboxTimeout) {
executeTimeout();
}
}
function floatingEmbed() {
var buttonText = embedJavascriptPlaceholder.getAttribute("data-button-text") || "",
buttonBackgroundColor = embedJavascriptPlaceholder.getAttribute("data-bg-color"),
buttonTextColor = embedJavascriptPlaceholder.getAttribute("data-text-color"),
lightboxWidth = embedJavascriptPlaceholder.getAttribute("data-lightbox-width"),
lightboxHeight = embedJavascriptPlaceholder.getAttribute("data-lightbox-height"),
screenPosition = embedJavascriptPlaceholder.getAttribute("data-lightbox-position"),
lightboxType = embedJavascriptPlaceholder.getAttribute("data-lightbox-type"),
lightboxTimeout = embedJavascriptPlaceholder.getAttribute("data-lightbox-timeout"),
lightboxAutoload = !!~~embedJavascriptPlaceholder.getAttribute("data-lightbox-autoload"),
lightobxExitIntent = !!~~embedJavascriptPlaceholder.getAttribute("data-lightbox-exit-intent");
var openLightbox = function (waitForIframeLoad) {
var closeCallbackExec,
closeCallback = function () {
if (closeCallbackExec) {
closeCallbackExec();
}
};
var lightbox = createFloatingModal(lightboxType, lightboxWidth, lightboxHeight, closeCallback, buttonText, screenPosition),
iframe = document.createElement('iframe'),
embedURL = document.createElement('a'),
origin = embedJavascriptPlaceholder && embedJavascriptPlaceholder.getAttribute
? embedJavascriptPlaceholder.getAttribute("data-origin")
: null;
embedURL.setAttribute('href', embedJavascriptPlaceholder.getAttribute('src'));
iframe.src = getAbcSubmitURL('//' + (origin || embedURL.hostname) + '/view/' + embedJavascriptPlaceholder.getAttribute('data-document-id')
+ '?referrer=' + encodeURIComponent(document.referrer)
+ '&embedURL=' + encodeURIComponent(location.href)
+ '&isEmbed=1'
+ '&isLightbox=1'
+ ('&' + embedJavascriptPlaceholder.getAttribute('data-embed-params') || '')
);
iframe.style.backgroundColor = 'transparent !important';
iframe.setAttribute('data-role-abcsubmit', '1');
iframe.style.border = 'none !important';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.display = 'block';
iframe.style.width = "100%";
lightbox.body.appendChild(iframe);
var listener = addWindowListeners(iframe, embedURL, true, true);
closeCallbackExec = function () {
window.removeEventListener("message", listener);
}
if (waitForIframeLoad) {
setTimeout(() => {
document.body.classList.add('overflow-hidden-body');
lightbox.root.style.display = 'block';
}, 1500);
} else {
document.body.classList.add('overflow-hidden-body');
lightbox.root.style.display = 'block';
}
},
injectButton = function () {
var formId = embedJavascriptPlaceholder.getAttribute("data-document-id"),
feedbackButtonId = "feedback-button-abcsubmit-" + formId;
var feedbackButton = document.createElement("a");
feedbackButton.setAttribute("href", "javascript:");
feedbackButton.textContent = buttonText || "Feedback";
feedbackButton.id = feedbackButtonId;
embedJavascriptPlaceholder.parentNode.insertBefore(feedbackButton, embedJavascriptPlaceholder);
var feedbackButtonCSSNode = document.createElement("style");
var cssLines = [
"#" + feedbackButtonId + " {",
" position: relative;",
" display: inline-block;",
" cursor: pointer;",
" background-color: " + buttonBackgroundColor + ";",
" color: " + buttonTextColor + ";",
" padding: 10px;",
" font-weight: bold;",
" text-decoration: none;",
" line-height: 1em;",
" box-sizing: border-box;",
" user-select: none;",
" -webkit-user-select: none;",
" -moz-user-select: none;",
" -ms-user-select: none;",
" vertical-align: middle;",
" border-radius: 3px;",
];
cssLines.push(" }");
cssLines.push("#" + feedbackButtonId + ":hover {");
cssLines.push(" filter: brightness(1.1);");
cssLines.push(" -webkit-filter: brightness(1.1);");
cssLines.push(" -moz-filter: brightness(1.1);");
cssLines.push(" -ms-filter: brightness(1.1);");
cssLines.push("}");
cssLines.push("#" + feedbackButtonId + ":active {");
cssLines.push(" filter: brightness(0.9);");
cssLines.push(" -webkit-filter: brightness(0.9);");
cssLines.push(" -moz-filter: brightness(0.9);");
cssLines.push(" -ms-filter: brightness(0.9);");
cssLines.push("}");
feedbackButtonCSSNode.textContent = cssLines.join("\n");
document.body.appendChild(feedbackButtonCSSNode);
return feedbackButton;
},
ouibounce = function (el, custom_config) {
var config = custom_config || {},
aggressive = config.aggressive || false,
sensitivity = setDefault(config.sensitivity, 20),
timer = setDefault(config.timer, 1000),
delay = setDefault(config.delay, 0),
callback = config.callback || function () {
},
cookieExpire = setDefaultCookieExpire(config.cookieExpire) || '',
cookieDomain = config.cookieDomain ? ';domain=' + config.cookieDomain : '',
cookieName = config.cookieName ? config.cookieName : 'viewedOuibounceModal',
sitewide = config.sitewide === true ? ';path=/' : '',
_delayTimer = null,
_html = document.documentElement;
function setDefault(_property, _default) {
return typeof _property === 'undefined' ? _default : _property;
}
function setDefaultCookieExpire(days) {
var ms = days * 24 * 60 * 60 * 1000;
var date = new Date();
date.setTime(date.getTime() + ms);
return "; expires=" + date.toUTCString();
}
setTimeout(attachOuiBounce, timer);
function attachOuiBounce() {
if (isDisabled()) {
return;
}
_html.addEventListener('mouseleave', handleMouseleave);
_html.addEventListener('mouseenter', handleMouseenter);
_html.addEventListener('keydown', handleKeydown);
}
function handleMouseleave(e) {
if (e.clientY > sensitivity) {
return;
}
_delayTimer = setTimeout(fire, delay);
}
function handleMouseenter() {
if (_delayTimer) {
clearTimeout(_delayTimer);
_delayTimer = null;
}
}
var disableKeydown = false;
function handleKeydown(e) {
if (disableKeydown) {
return;
} else if (!e.metaKey || e.keyCode !== 76) {
return;
}
disableKeydown = true;
_delayTimer = setTimeout(fire, delay);
}
function checkCookieValue(cookieName, value) {
return parseCookies()[cookieName] === value;
}
function parseCookies() {
// cookies are separated by '; '
var cookies = document.cookie.split('; ');
var ret = {};
for (var i = cookies.length - 1; i >= 0; i--) {
var el = cookies[i].split('=');
ret[el[0]] = el[1];
}
return ret;
}
function isDisabled() {
return checkCookieValue(cookieName, 'true') && !aggressive;
}
function fire() {
if (isDisabled()) {
return;
}
if (el) {
el.style.display = 'block';
}
callback();
disable();
}
function disable(custom_options) {
var options = custom_options || {};
if (typeof options.cookieExpire !== 'undefined') {
cookieExpire = setDefaultCookieExpire(options.cookieExpire);
}
if (options.sitewide === true) {
sitewide = ';path=/';
}
if (typeof options.cookieDomain !== 'undefined') {
cookieDomain = ';domain=' + options.cookieDomain;
}
if (typeof options.cookieName !== 'undefined') {
cookieName = options.cookieName;
}
document.cookie = cookieName + '=true' + cookieExpire + cookieDomain + sitewide;
_html.removeEventListener('mouseleave', handleMouseleave);
_html.removeEventListener('mouseenter', handleMouseenter);
_html.removeEventListener('keydown', handleKeydown);
}
return {
fire: fire,
disable: disable,
isDisabled: isDisabled
};
},
executeTimeout = function () {
var timeoutParts = lightboxTimeout.split("-");
if (timeoutParts.length !== 3 || timeoutParts[0] !== "1") {
return;
}
var timeoutValue = parseInt(timeoutParts[1]) || 0,
timeoutUnit = timeoutParts[2];
if (!timeoutValue) {
openLightbox();
return;
}
var openAfterDate = new Date();
switch (timeoutUnit) {
case "m":
openAfterDate.setMinutes(openAfterDate.getMinutes() + timeoutValue);
break;
case "h":
openAfterDate.setHours(openAfterDate.getHours() + timeoutValue);
break;
case "s":
default:
openAfterDate.setSeconds(openAfterDate.getSeconds() + timeoutValue);
break;
}
var openAfterTime = +openAfterDate;
var openAfterInterval = setInterval(function () {
if (+new Date >= openAfterTime) {
openLightbox(true);
clearInterval(openAfterInterval);
}
}, 1000);
};
if (buttonText) {
var button = injectButton();
button.addEventListener("click", function () {
openLightbox();
}, true);
}
if (lightboxAutoload) {
openLightbox(true);
}
if (lightobxExitIntent) {
ouibounce(null, {
aggressive: true,
timer: 0,
callback: function () {
openLightbox();
},
})
}
if (lightboxTimeout) {
executeTimeout();
}
}
// noinspection JSRedundantSwitchStatement
switch (embedMethod) {
case 'feedback-button':
feedbackButtonEmbed();
break;
case 'lightbox':
lightboxEmbed();
break;
case 'floating-modal':
floatingEmbed();
break;
default:
regularEmbed();
}
})();
</pre></body></html>