window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/15.0.3\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/15.0.3\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/blocklayouts.com\/wp-includes\/js\/wp-emoji-release.min.js"}};
/*! This file is auto-generated */
!function(i,n){var o,s,e;function c(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function p(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data),r=(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0),new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data));return t.every(function(e,t){return e===r[t]})}function u(e,t,n){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\uddfa\ud83c\uddf3","\ud83c\uddfa\u200b\ud83c\uddf3")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!n(e,"\ud83d\udc26\u200d\u2b1b","\ud83d\udc26\u200b\u2b1b")}return!1}function f(e,t,n){var r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):i.createElement("canvas"),a=r.getContext("2d",{willReadFrequently:!0}),o=(a.textBaseline="top",a.font="600 32px Arial",{});return e.forEach(function(e){o[e]=t(a,e,n)}),o}function t(e){var t=i.createElement("script");t.src=e,t.defer=!0,i.head.appendChild(t)}"undefined"!=typeof Promise&&(o="wpEmojiSettingsSupports",s=["flag","emoji"],n.supports={everything:!0,everythingExceptFlag:!0},e=new Promise(function(e){i.addEventListener("DOMContentLoaded",e,{once:!0})}),new Promise(function(t){var n=function(){try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()<e.timestamp+604800&&"object"==typeof e.supportTests)return e.supportTests}catch(e){}return null}();if(!n){if("undefined"!=typeof Worker&&"undefined"!=typeof OffscreenCanvas&&"undefined"!=typeof URL&&URL.createObjectURL&&"undefined"!=typeof Blob)try{var e="postMessage("+f.toString()+"("+[JSON.stringify(s),u.toString(),p.toString()].join(",")+"));",r=new Blob([e],{type:"text/javascript"}),a=new Worker(URL.createObjectURL(r),{name:"wpTestEmojiSupports"});return void(a.onmessage=function(e){c(n=e.data),a.terminate(),t(n)})}catch(e){}c(n=f(s,u,p))}t(n)}).then(function(e){for(var t in e)n.supports[t]=e[t],n.supports.everything=n.supports.everything&&n.supports[t],"flag"!==t&&(n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&n.supports[t]);n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&!n.supports.flag,n.DOMReady=!1,n.readyCallback=function(){n.DOMReady=!0}}).then(function(){return e}).then(function(){var e;n.supports.everything||(n.readyCallback(),(e=n.source||{}).concatemoji?t(e.concatemoji):e.wpemoji&&e.twemoji&&(t(e.twemoji),t(e.wpemoji)))}))}((window,document),window._wpemojiSettings);
window._nslDOMReady = function (callback) {
if ( document.readyState === "complete" || document.readyState === "interactive" ) {
callback();
} else {
document.addEventListener( "DOMContentLoaded", callback );
}
};
var breeze_prefetch = {"local_url":"https:\/\/blocklayouts.com","ignore_remote_prefetch":"1","ignore_list":["\/cart\/","\/checkout\/","\/my-account\/","\/login\/?loginSocial=google","\/login","\/wp-login.php","\/my-account\/signup\/","\/my-account\/login\/","\/cart\/","\/checkout\/","wp-admin","wp-login.php"]};
https://blocklayouts.com/wp-content/plugins/breeze/assets/js/js-front-end/breeze-prefetch-links.min.js
https://blocklayouts.com/wp-includes/js/jquery/jquery.min.js
https://blocklayouts.com/wp-includes/js/jquery/jquery-migrate.min.js
https://blocklayouts.com/wp-content/themes/blocklayouts/assets/libs/clipboard.min.js
https://blocklayouts.com/wp-content/themes/blocklayouts/assets/libs/prism.js
Contact section with company information
<!-- wp:spacer {"height":"50px"} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:group {"align":"full","style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull"><!-- wp:group {"align":"wide","style":{"spacing":{"blockGap":"1.1rem"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide"><!-- wp:heading {"textAlign":"center","style":{"typography":{"fontSize":"1.99rem","fontStyle":"normal","fontWeight":"600"}}} -->
<h2 class="wp-block-heading has-text-align-center" style="font-size:1.99rem;font-style:normal;font-weight:600">Let's Stay Connected</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center","style":{"color":{"text":"#6b7280"},"elements":{"link":{"color":{"text":"#6b7280"}}}}} -->
<p class="has-text-align-center has-text-color has-link-color" style="color:#6b7280">Feel free to reach out to us for any inquiries or assistance. We're here to help!</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
<!-- wp:spacer {"height":"50px"} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:columns {"verticalAlignment":"center","style":{"spacing":{"blockGap":{"top":"2rem","left":"2rem"}}}} -->
<div class="wp-block-columns are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center"} -->
<div class="wp-block-column is-vertically-aligned-center"><!-- wp:image {"aspectRatio":"4/3","scale":"cover","sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://images.unsplash.com/photo-1605217613423-0a61bd725c8a?q=80&w=1935&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="" style="aspect-ratio:4/3;object-fit:cover"/></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column {"verticalAlignment":"center","style":{"spacing":{"blockGap":"2rem"}}} -->
<div class="wp-block-column is-vertically-aligned-center"><!-- wp:group {"style":{"spacing":{"blockGap":"1.1rem"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"}},"color":{"background":"#eef2ff"},"border":{"radius":"999px"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-background" style="border-radius:999px;background-color:#eef2ff;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)"><!-- wp:image {"width":"30px","sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3' y='5' width='18' height='14' rx='1' stroke='%234f46e5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3C/rect%3E%3Cpath d='M20 5.5L12 13L4 5.5' stroke='%234f46e5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3C/path%3E%3C/svg%3E" alt="" style="width:30px"/></figure>
<!-- /wp:image --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"blockGap":"0.4rem"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p><strong>Email</strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>info@company.com</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"blockGap":"1.1rem"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"}},"color":{"background":"#eef2ff"},"border":{"radius":"999px"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-background" style="border-radius:999px;background-color:#eef2ff;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)"><!-- wp:image {"width":"30px","sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.0325 15.2873L12.0001 22L17.9677 15.2873C22.5447 10.1388 18.8894 2 12.0001 2C5.11079 2 1.45549 10.1388 6.0325 15.2873Z' stroke='%234f46e5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3C/path%3E%3Ccircle cx='12' cy='10' r='3' stroke='%234f46e5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3C/circle%3E%3C/svg%3E%0A" alt="" style="width:30px"/></figure>
<!-- /wp:image --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"blockGap":"0.4rem"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p><strong><strong>Address</strong></strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>123 Main Street, Cityville, Country</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"blockGap":"1.1rem"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"}},"color":{"background":"#eef2ff"},"border":{"radius":"999px"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-background" style="border-radius:999px;background-color:#eef2ff;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)"><!-- wp:image {"width":"30px","sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.51089 2L7.15002 2.13169C7.91653 2.15942 8.59676 2.64346 8.89053 3.3702L9.96656 6.03213C10.217 6.65159 10.1496 7.35837 9.78693 7.91634L8.40831 10.0375C9.22454 11.2096 11.4447 13.9558 13.7955 15.5633L15.5484 14.4845C15.9939 14.2103 16.5273 14.1289 17.0314 14.2581L20.5161 15.1517C21.4429 15.3894 22.0674 16.2782 21.9942 17.2552L21.7705 20.2385C21.6919 21.2854 20.8351 22.1069 19.818 21.9887C6.39245 20.4276 -1.48056 1.99997 3.51089 2Z' stroke='%234f46e5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3C/path%3E%3C/svg%3E" alt="" style="width:30px"/></figure>
<!-- /wp:image --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"blockGap":"0.4rem"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p><strong><strong><strong>Phone number</strong></strong></strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>(222) 123-4567</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:group -->
<!-- wp:spacer {"height":"50px"} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
Pattern Information
This block pattern is fully customizable, responsive, and easy to use. Simply copy and paste it into your website for seamless integration. It's designed to enhance user engagement and improve overall user experience.
Last Update
April 30, 2024
Blocklayouts
Discover a new era of WordPress design at Blocklayout with our intuitive Gutenberg patterns. Elevate your site effortlessly!
(function () {
var c = document.body.className;
c = c.replace(/woocommerce-no-js/, 'woocommerce-js');
document.body.className = c;
})();
https://blocklayouts.com/wp-includes/js/dist/hooks.min.js
https://blocklayouts.com/wp-includes/js/dist/i18n.min.js
wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } );
https://blocklayouts.com/wp-content/plugins/woocommerce-google-analytics-integration/assets/js/build/main.js
https://blocklayouts.com/wp-content/plugins/contact-form-7/includes/swv/js/index.js
var wpcf7 = {"api":{"root":"https:\/\/blocklayouts.com\/wp-json\/","namespace":"contact-form-7\/v1"},"cached":"1"};
https://blocklayouts.com/wp-content/plugins/contact-form-7/includes/js/index.js
https://blocklayouts.com/wp-content/themes/blocklayouts/assets/js/main.js
var block_render_params = {"ajax_url":"https:\/\/blocklayouts.com\/wp-admin\/admin-ajax.php","render_blocks_security":"ac8ff65fe1","posts_per_page":"10","current_page":"1","current_layout":"grid","max_pages":"0","post_type":"block"};
https://blocklayouts.com/wp-content/themes/blocklayouts/assets/js/block-render-ajax.js
https://blocklayouts.com/wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.min.js
var wc_order_attribution = {"params":{"lifetime":1.0e-5,"session":30,"base64":false,"ajaxurl":"https:\/\/blocklayouts.com\/wp-admin\/admin-ajax.php","prefix":"wc_order_attribution_","allowTracking":true},"fields":{"source_type":"current.typ","referrer":"current_add.rf","utm_campaign":"current.cmp","utm_source":"current.src","utm_medium":"current.mdm","utm_content":"current.cnt","utm_id":"current.id","utm_term":"current.trm","utm_source_platform":"current.plt","utm_creative_format":"current.fmt","utm_marketing_tactic":"current.tct","session_entry":"current_add.ep","session_start_time":"current_add.fd","session_pages":"session.pgs","session_count":"udata.vst","user_agent":"udata.uag"}};
https://blocklayouts.com/wp-content/plugins/woocommerce/assets/js/frontend/order-attribution.min.js
https://blocklayouts.com/wp-includes/js/dist/vendor/wp-polyfill.min.js
var wpcf7_recaptcha = {"sitekey":"6LdiAXcpAAAAALTFgtKP9VSeIOHrlUR0jCAQ02q2","actions":{"homepage":"homepage","contactform":"contactform"}};
https://blocklayouts.com/wp-content/plugins/contact-form-7/modules/recaptcha/index.js
window.ga4w = { data: {"cart":{"items":[],"coupons":[],"totals":{"currency_code":"USD","total_price":0,"currency_minor_unit":2}}}, settings: {"tracker_function_name":"gtag","events":["purchase","add_to_cart","remove_from_cart","view_item_list","select_content","view_item","begin_checkout"],"identifier":null} }; document.dispatchEvent(new Event("ga4w:ready"));
(function (undefined) {let scriptOptions={"_localizedStrings":{"redirect_overlay_title":"Hold On","redirect_overlay_text":"You are being redirected to another page,<br>it may take a few seconds.","webview_notification_text":"The selected provider doesn't support embedded browsers!"},"_targetWindow":"prefer-popup","_redirectOverlay":"","_unsupportedWebviewBehavior":""};
/**
* Used when Cross-Origin-Opener-Policy blocked the access to the opener. We can't have a reference of the opened windows, so we should attempt to refresh only the windows that has opened popups.
*/
window._nslHasOpenedPopup = false;
window._nslWebViewNoticeElement = null;
window.NSLPopup = function (url, title, w, h) {
const userAgent = navigator.userAgent,
mobile = function () {
return /\b(iPhone|iP[ao]d)/.test(userAgent) ||
/\b(iP[ao]d)/.test(userAgent) ||
/Android/i.test(userAgent) ||
/Mobile/i.test(userAgent);
},
screenX = window.screenX !== undefined ? window.screenX : window.screenLeft,
screenY = window.screenY !== undefined ? window.screenY : window.screenTop,
outerWidth = window.outerWidth !== undefined ? window.outerWidth : document.documentElement.clientWidth,
outerHeight = window.outerHeight !== undefined ? window.outerHeight : document.documentElement.clientHeight - 22,
targetWidth = mobile() ? null : w,
targetHeight = mobile() ? null : h,
left = parseInt(screenX + (outerWidth - targetWidth) / 2, 10),
right = parseInt(screenY + (outerHeight - targetHeight) / 2.5, 10),
features = [];
if (targetWidth !== null) {
features.push('width=' + targetWidth);
}
if (targetHeight !== null) {
features.push('height=' + targetHeight);
}
features.push('left=' + left);
features.push('top=' + right);
features.push('scrollbars=1');
const newWindow = window.open(url, title, features.join(','));
if (window.focus) {
newWindow.focus();
}
window._nslHasOpenedPopup = true;
return newWindow;
};
let isWebView = null;
function checkWebView() {
if (isWebView === null) {
function _detectOS(ua) {
if (/Android/.test(ua)) {
return "Android";
} else if (/iPhone|iPad|iPod/.test(ua)) {
return "iOS";
} else if (/Windows/.test(ua)) {
return "Windows";
} else if (/Mac OS X/.test(ua)) {
return "Mac";
} else if (/CrOS/.test(ua)) {
return "Chrome OS";
} else if (/Firefox/.test(ua)) {
return "Firefox OS";
}
return "";
}
function _detectBrowser(ua) {
let android = /Android/.test(ua);
if (/Opera Mini/.test(ua) || / OPR/.test(ua) || / OPT/.test(ua)) {
return "Opera";
} else if (/CriOS/.test(ua)) {
return "Chrome for iOS";
} else if (/Edge/.test(ua)) {
return "Edge";
} else if (android && /Silk\//.test(ua)) {
return "Silk";
} else if (/Chrome/.test(ua)) {
return "Chrome";
} else if (/Firefox/.test(ua)) {
return "Firefox";
} else if (android) {
return "AOSP";
} else if (/MSIE|Trident/.test(ua)) {
return "IE";
} else if (/Safari\//.test(ua)) {
return "Safari";
} else if (/AppleWebKit/.test(ua)) {
return "WebKit";
}
return "";
}
function _detectBrowserVersion(ua, browser) {
if (browser === "Opera") {
return /Opera Mini/.test(ua) ? _getVersion(ua, "Opera Mini/") :
/ OPR/.test(ua) ? _getVersion(ua, " OPR/") :
_getVersion(ua, " OPT/");
} else if (browser === "Chrome for iOS") {
return _getVersion(ua, "CriOS/");
} else if (browser === "Edge") {
return _getVersion(ua, "Edge/");
} else if (browser === "Chrome") {
return _getVersion(ua, "Chrome/");
} else if (browser === "Firefox") {
return _getVersion(ua, "Firefox/");
} else if (browser === "Silk") {
return _getVersion(ua, "Silk/");
} else if (browser === "AOSP") {
return _getVersion(ua, "Version/");
} else if (browser === "IE") {
return /IEMobile/.test(ua) ? _getVersion(ua, "IEMobile/") :
/MSIE/.test(ua) ? _getVersion(ua, "MSIE ")
:
_getVersion(ua, "rv:");
} else if (browser === "Safari") {
return _getVersion(ua, "Version/");
} else if (browser === "WebKit") {
return _getVersion(ua, "WebKit/");
}
return "0.0.0";
}
function _getVersion(ua, token) {
try {
return _normalizeSemverString(ua.split(token)[1].trim().split(/[^\w\.]/)[0]);
} catch (o_O) {
}
return "0.0.0";
}
function _normalizeSemverString(version) {
const ary = version.split(/[\._]/);
return (parseInt(ary[0], 10) || 0) + "." +
(parseInt(ary[1], 10) || 0) + "." +
(parseInt(ary[2], 10) || 0);
}
function _isWebView(ua, os, browser, version, options) {
switch (os + browser) {
case "iOSSafari":
return false;
case "iOSWebKit":
return _isWebView_iOS(options);
case "AndroidAOSP":
return false;
case "AndroidChrome":
return parseFloat(version) >= 42 ? /; wv/.test(ua) : /\d{2}\.0\.0/.test(version) ? true : _isWebView_Android(options);
}
return false;
}
function _isWebView_iOS(options) {
const document = (window["document"] || {});
if ("WEB_VIEW" in options) {
return options["WEB_VIEW"];
}
return !("fullscreenEnabled" in document || "webkitFullscreenEnabled" in document || false);
}
function _isWebView_Android(options) {
if ("WEB_VIEW" in options) {
return options["WEB_VIEW"];
}
return !("requestFileSystem" in window || "webkitRequestFileSystem" in window || false);
}
const options = {},
nav = window.navigator || {},
ua = nav.userAgent || "",
os = _detectOS(ua),
browser = _detectBrowser(ua),
browserVersion = _detectBrowserVersion(ua, browser);
isWebView = _isWebView(ua, os, browser, browserVersion, options);
}
return isWebView;
}
function isAllowedWebViewForUserAgent(provider) {
const facebookAllowedWebViews = [
'Instagram',
'FBAV',
'FBAN'
];
let whitelist = [];
if (provider && provider === 'facebook') {
whitelist = facebookAllowedWebViews;
}
const nav = window.navigator || {},
ua = nav.userAgent || "";
if (whitelist.length && ua.match(new RegExp(whitelist.join('|')))) {
return true;
}
return false;
}
function disableButtonInWebView(providerButtonElement) {
if (providerButtonElement) {
providerButtonElement.classList.add('nsl-disabled-provider');
providerButtonElement.setAttribute('href', '#');
providerButtonElement.addEventListener('pointerdown', (e) => {
if (!window._nslWebViewNoticeElement) {
window._nslWebViewNoticeElement = document.createElement('div');
window._nslWebViewNoticeElement.id = "nsl-notices-fallback";
window._nslWebViewNoticeElement.addEventListener('pointerdown', function (e) {
this.parentNode.removeChild(this);
window._nslWebViewNoticeElement = null;
});
const webviewNoticeHTML = '<div class="error"><p>' + scriptOptions._localizedStrings.webview_notification_text + '</p></div>';
window._nslWebViewNoticeElement.insertAdjacentHTML("afterbegin", webviewNoticeHTML);
document.body.appendChild(window._nslWebViewNoticeElement);
}
});
}
}
window._nslDOMReady(function () {
window.nslRedirect = function (url) {
if (scriptOptions._redirectOverlay) {
const overlay = document.createElement('div');
overlay.id = "nsl-redirect-overlay";
let overlayHTML = '';
const overlayContainer = "<div id='nsl-redirect-overlay-container'>",
overlayContainerClose = "</div>",
overlaySpinner = "<div id='nsl-redirect-overlay-spinner'></div>",
overlayTitle = "<p id='nsl-redirect-overlay-title'>" + scriptOptions._localizedStrings.redirect_overlay_title + "</p>",
overlayText = "<p id='nsl-redirect-overlay-text'>" + scriptOptions._localizedStrings.redirect_overlay_text + "</p>";
switch (scriptOptions._redirectOverlay) {
case "overlay-only":
break;
case "overlay-with-spinner":
overlayHTML = overlayContainer + overlaySpinner + overlayContainerClose;
break;
default:
overlayHTML = overlayContainer + overlaySpinner + overlayTitle + overlayText + overlayContainerClose;
break;
}
overlay.insertAdjacentHTML("afterbegin", overlayHTML);
document.body.appendChild(overlay);
}
window.location = url;
};
let targetWindow = scriptOptions._targetWindow || 'prefer-popup',
lastPopup = false;
document.addEventListener('click', function (e) {
if (e.target) {
const buttonLinkElement = e.target.closest('a[data-plugin="nsl"][data-action="connect"]') || e.target.closest('a[data-plugin="nsl"][data-action="link"]');
if (buttonLinkElement) {
if (lastPopup && !lastPopup.closed) {
e.preventDefault();
lastPopup.focus();
} else {
let href = buttonLinkElement.href,
success = false;
if (href.indexOf('?') !== -1) {
href += '&';
} else {
href += '?';
}
const redirectTo = buttonLinkElement.dataset.redirect;
if (redirectTo === 'current') {
href += 'redirect=' + encodeURIComponent(window.location.href) + '&';
} else if (redirectTo && redirectTo !== '') {
href += 'redirect=' + encodeURIComponent(redirectTo) + '&';
}
if (targetWindow !== 'prefer-same-window' && checkWebView()) {
targetWindow = 'prefer-same-window';
}
if (targetWindow === 'prefer-popup') {
lastPopup = NSLPopup(href + 'display=popup', 'nsl-social-connect', buttonLinkElement.dataset.popupwidth, buttonLinkElement.dataset.popupheight);
if (lastPopup) {
success = true;
e.preventDefault();
}
} else if (targetWindow === 'prefer-new-tab') {
const newTab = window.open(href + 'display=popup', '_blank');
if (newTab) {
if (window.focus) {
newTab.focus();
}
success = true;
window._nslHasOpenedPopup = true;
e.preventDefault();
}
}
if (!success) {
window.location = href;
e.preventDefault();
}
}
}
}
});
let buttonCountChanged = false;
const googleLoginButtons = document.querySelectorAll(' a[data-plugin="nsl"][data-provider="google"]');
if (googleLoginButtons.length && checkWebView()) {
googleLoginButtons.forEach(function (googleLoginButton) {
if (scriptOptions._unsupportedWebviewBehavior === 'disable-button') {
disableButtonInWebView(googleLoginButton);
} else {
googleLoginButton.remove();
buttonCountChanged = true;
}
});
}
const facebookLoginButtons = document.querySelectorAll(' a[data-plugin="nsl"][data-provider="facebook"]');
if (facebookLoginButtons.length && checkWebView() && /Android/.test(window.navigator.userAgent) && !isAllowedWebViewForUserAgent('facebook')) {
facebookLoginButtons.forEach(function (facebookLoginButton) {
if (scriptOptions._unsupportedWebviewBehavior === 'disable-button') {
disableButtonInWebView(facebookLoginButton);
} else {
facebookLoginButton.remove();
buttonCountChanged = true;
}
});
}
const separators = document.querySelectorAll('div.nsl-separator');
if (buttonCountChanged && separators.length) {
separators.forEach(function (separator) {
const separatorParentNode = separator.parentNode;
if (separatorParentNode) {
const separatorButtonContainer = separatorParentNode.querySelector('div.nsl-container-buttons');
if (separatorButtonContainer && !separatorButtonContainer.hasChildNodes()) {
separator.remove();
}
}
})
}
});
/**
* Cross-Origin-Opener-Policy blocked the access to the opener
*/
if (typeof BroadcastChannel === "function") {
const _nslLoginBroadCastChannel = new BroadcastChannel('nsl_login_broadcast_channel');
_nslLoginBroadCastChannel.onmessage = (event) => {
if (window?._nslHasOpenedPopup && event.data?.action === 'redirect') {
window._nslHasOpenedPopup = false;
const url = event.data?.href;
_nslLoginBroadCastChannel.close();
if (typeof window.nslRedirect === 'function') {
window.nslRedirect(url);
} else {
window.opener.location = url;
}
}
};
}})();