Generalizing this theme for usage
  • Delete all posts
  • Update the Site Logo below (favicon, square-based)
  • Empty Media Library, besides the Site Logo you just uploaded
    • This will break the image galleries below
  • Delete boilerplate SCSS in main.scss (keep all the rest)
  • Disable any default Block Variants this brand doesn’t use
  • Add in per-design Block Styles and Variants
Animation Primer & Library

Animations are managed using both an animated element, and its parent. The parent receives a class named .has-animation, which works in tandem with some JavaScript code. That code runs on page load, and then every time the page is scrolled.

Once an element has been detected as scrolled into view, the parent is appended an additional class, named .has-been-revealed. With minimal exceptions, animations are only triggered on elements with a specific animation class, that is the child of an element bearing both the classes .has-animation and .has-been-revealed.

Basic Animations
.fade-in-up
.fade-in-right
.fade-in-down
.fade-in-right
.reveal-in
.draw-in-line

.draw-in-line-80

Like the above animations, leverages the class .has-animation but also the class (on parent still) of .has-image-animation.

Advanced Animations

Tilted Text Animation:

  • As seen on Astute Homepage
  • Limited as it does not flow like real text — text is grouped by line, then sub-grouped by word

Retro Machinery Animation:

  • As seen on Astute 404
  • Static layer overlaid with two reels, underlaid by two additional reels through transparencies in main layer

Scroll-based Rings:

  • As seen on Astute Services
  • Outermost ring stays static
  • Other two rings rotate with scroll up/down
    • Middle ring rotates clockwise/counterclockwise
    • Innermost ring rotates counterclockwise/clockwise

Scroll-based Globe:

  • As seen on KSG Homepage
  • Scroll-based triggers to paginate text alongside animation
  • Most complexity in terms of planning for active and idle states of globe
SCSS Architecture

|sass/
| - meta.scss            # WP Header Comments for style meta
|
|– utils/                # Misc stuff like variables, helper classes, functions, mix-ins, and animation stuff
|   |– _variables.scss   # Sass Variables
|   |– _functions.scss   # Sass Functions
|   |– _mixins.scss      # Sass Mixins
|   |– _helpers.scss     # Class & placeholders helpers
|   |–  animations.scss  # Class & placeholders helpers
|
|– base/                 # Boilerplate, typography, normalizing -- shouldn't need edits
|   |–  normalize.scss   # Reset/normalize
|   |– _typography.scss  # Typography rules
|   ...                  # Etc…
|
|– layout/               # Globals, grid system, forms, etc.
|   |– _navigation.scss  # Navigation
|   |– _header.scss      # Header
|   |– _footer.scss      # Footer
|   |– _forms.scss       # Forms
|   ...                  # Etc…
|
|– components/           # Styles specific to widgets -- overrides for ACF Blocks go here
|   |– _buttons.scss     # Buttons -- includes default permutations
|   |– _carousel.scss    # Carousel
|   |– _cover.scss       # Cover
|   |– _dropdown.scss    # Dropdown
|   ...                  # Etc…
|
|– sections/             # Styles specific to pages
|   |– _home.scss        # Home specific styles
|   |– _contact.scss     # Contact specific styles
|   ...                  # Etc…
|
| – main.scss            # Primary Sass file -- only @import and comments in here

Anatomy of a Style Guide

Font Faces, Weights, Styles, Sizes

  • List out all font families used
  • List out all font weights used in those families
  • Styles refers to normal vs. italics, so just call out if any fonts should also have their italics variant registered (if applicable, not off font families offer italics)
  • All font sizes used, even one-offs like copyright text only used in a single place

Each Unique Text Element Instance

  • Paragraphs, Headings, List Items
  • Any permutations of those items
    • One-off text variants are still Paragraphs like “Label” or whatnot
    • Additional styles for semantic headings, such as if the H1 on Homepage differs from how an H1 would look on a Blog Post
    • Unordered list variants besides default bullet (see top level of this list)
    • Ordered list variants (number, letter, Roman num, etc.), if applicable

Other Relevant Elements

  • Callout any element with more than one permutation
    • Buttons, specifically color changes and functionality such as play buttons
    • Block Quotes

Paragraphs & Text Variants

This is normal text.

This is some fancy variant.

This is some other fancy variant

Headings

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

List Styles

  • This is an
  • unordered list
  • using default bullets
  1. This is an
  2. ordered list
  3. using numbers


ACF Custom Blocks /acf-blocks/


Blog Category Filter and API Blog Listing (two blocks)

Category block doesn’t work without the API Blog Listing block.


Breadcrumb (Dynamic)

Only works if the page has a parent page, otherwise it assumes you wanna go 🏠. Includes plain, chevron, and arrow (for now, and counting).


Flex Divider (Colorable)

Vertical line on desktop; horizontal line on mobile. There is no native vertical line in HTML, but there is for horizontal.


Hamburger Toggle (Colorable)

Must be implemented in conjunction with the meganav (see header).


Expanding Bio

Line height will look wonky pending your brand choice, will need to be refined on a per-site basis (quick and easy to do that, though).

Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my Here is my


FAQ Items (w/ Category Filter)

Filter does not render on mobile.

All

Category One

Category Two

Category One

Example Item One

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sodales, nulla vel tristique euismod, orci erat laoreet massa, vitae accumsan augue tellus aliquet tortor. Mauris ante tortor, varius nec posuere vitae, tincidunt at tortor. Sed malesuada elementum sollicitudin. Quisque ornare neque quis orci laoreet egestas eu at justo. Vestibulum a congue nunc. Nulla ultricies tortor vel nunc rutrum scelerisque. Sed accumsan aliquet ex sit amet congue. Phasellus eu nibh ipsum. Nunc dapibus, odio sit amet tempus interdum, purus quam accumsan turpis, nec posuere metus elit vitae ipsum. Praesent non lorem id tellus pretium lacinia. Nunc porta lectus mi, eu ornare ipsum facilisis a. Nam et eros aliquet, tristique lorem ac, congue nisi. Sed faucibus ornare diam sed ultrices. Suspendisse quis blandit orci. Phasellus dictum dictum sapien eget tempus. Curabitur ut vestibulum erat.


Example Item One

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sodales, nulla vel tristique euismod, orci erat laoreet massa, vitae accumsan augue tellus aliquet tortor. Mauris ante tortor, varius nec posuere vitae, tincidunt at tortor. Sed malesuada elementum sollicitudin. Quisque ornare neque quis orci laoreet egestas eu at justo. Vestibulum a congue nunc. Nulla ultricies tortor vel nunc rutrum scelerisque. Sed accumsan aliquet ex sit amet congue. Phasellus eu nibh ipsum. Nunc dapibus, odio sit amet tempus interdum, purus quam accumsan turpis, nec posuere metus elit vitae ipsum. Praesent non lorem id tellus pretium lacinia. Nunc porta lectus mi, eu ornare ipsum facilisis a. Nam et eros aliquet, tristique lorem ac, congue nisi. Sed faucibus ornare diam sed ultrices. Suspendisse quis blandit orci. Phasellus dictum dictum sapien eget tempus. Curabitur ut vestibulum erat.


Category Two

Example Item Two

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sodales, nulla vel tristique euismod, orci erat laoreet massa, vitae accumsan augue tellus aliquet tortor. Mauris ante tortor, varius nec posuere vitae, tincidunt at tortor. Sed malesuada elementum sollicitudin. Quisque ornare neque quis orci laoreet egestas eu at justo. Vestibulum a congue nunc. Nulla ultricies tortor vel nunc rutrum scelerisque. Sed accumsan aliquet ex sit amet congue. Phasellus eu nibh ipsum. Nunc dapibus, odio sit amet tempus interdum, purus quam accumsan turpis, nec posuere metus elit vitae ipsum. Praesent non lorem id tellus pretium lacinia. Nunc porta lectus mi, eu ornare ipsum facilisis a. Nam et eros aliquet, tristique lorem ac, congue nisi. Sed faucibus ornare diam sed ultrices. Suspendisse quis blandit orci. Phasellus dictum dictum sapien eget tempus. Curabitur ut vestibulum erat.


Example Item Two

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sodales, nulla vel tristique euismod, orci erat laoreet massa, vitae accumsan augue tellus aliquet tortor. Mauris ante tortor, varius nec posuere vitae, tincidunt at tortor. Sed malesuada elementum sollicitudin. Quisque ornare neque quis orci laoreet egestas eu at justo. Vestibulum a congue nunc. Nulla ultricies tortor vel nunc rutrum scelerisque. Sed accumsan aliquet ex sit amet congue. Phasellus eu nibh ipsum. Nunc dapibus, odio sit amet tempus interdum, purus quam accumsan turpis, nec posuere metus elit vitae ipsum. Praesent non lorem id tellus pretium lacinia. Nunc porta lectus mi, eu ornare ipsum facilisis a. Nam et eros aliquet, tristique lorem ac, congue nisi. Sed faucibus ornare diam sed ultrices. Suspendisse quis blandit orci. Phasellus dictum dictum sapien eget tempus. Curabitur ut vestibulum erat.



“Details” Items (FAQ but w/o Filter)

Example Category

Example Item

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sodales, nulla vel tristique euismod, orci erat laoreet massa, vitae accumsan augue tellus aliquet tortor. Mauris ante tortor, varius nec posuere vitae, tincidunt at tortor. Sed malesuada elementum sollicitudin. Quisque ornare neque quis orci laoreet egestas eu at justo. Vestibulum a congue nunc. Nulla ultricies tortor vel nunc rutrum scelerisque. Sed accumsan aliquet ex sit amet congue. Phasellus eu nibh ipsum. Nunc dapibus, odio sit amet tempus interdum, purus quam accumsan turpis, nec posuere metus elit vitae ipsum. Praesent non lorem id tellus pretium lacinia. Nunc porta lectus mi, eu ornare ipsum facilisis a. Nam et eros aliquet, tristique lorem ac, congue nisi. Sed faucibus ornare diam sed ultrices. Suspendisse quis blandit orci. Phasellus dictum dictum sapien eget tempus. Curabitur ut vestibulum erat.

Example Item

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sodales, nulla vel tristique euismod, orci erat laoreet massa, vitae accumsan augue tellus aliquet tortor. Mauris ante tortor, varius nec posuere vitae, tincidunt at tortor. Sed malesuada elementum sollicitudin. Quisque ornare neque quis orci laoreet egestas eu at justo. Vestibulum a congue nunc. Nulla ultricies tortor vel nunc rutrum scelerisque. Sed accumsan aliquet ex sit amet congue. Phasellus eu nibh ipsum. Nunc dapibus, odio sit amet tempus interdum, purus quam accumsan turpis, nec posuere metus elit vitae ipsum. Praesent non lorem id tellus pretium lacinia. Nunc porta lectus mi, eu ornare ipsum facilisis a. Nam et eros aliquet, tristique lorem ac, congue nisi. Sed faucibus ornare diam sed ultrices. Suspendisse quis blandit orci. Phasellus dictum dictum sapien eget tempus. Curabitur ut vestibulum erat.


Search Results (Colorable)

Dynamically shows results from search query when added to a “Search” Gutenberg template. If not part of that template, will render a list of all pages.

The Meadows | Personalized Alcohol Addiction Treatment

Effective Treatment for Long-Term Healing Did you know that between 20%-26% of patients with substance use disorders are expected to readmit within 3 months of treatment? With treatment programs designed to meet your needs, you can expect long-term improvements to your overall health and well-being. OF OUR ALUMNIDO NOT READMIT Healing the Whole Person Our […]

The Meadows | Personalized Addiction Treatment

Effective Treatment for Long-Term Healing Did you know that between 20%-26% of patients with substance use disorders are expected to readmit within 3 months of treatment? With treatment programs designed to meet your needs, you can expect long-term improvements to your overall health and well-being. OF OUR ALUMNIDO NOT READMIT Healing the Whole Person Our […]

The Meadows | Personalized Trauma Treatment

Effective Treatment for Long-Term Healing Trauma is often an underlying cause of substance abuse and mental health conditions. It must be resolved for a person to fully heal and thrive in their recovery. With trauma-informed treatment programs designed to meet your needs, you can expect long-term improvements to your overall health and well-being. OF OUR […]

The Meadows | Personalized Drug Addiction Treatment

Effective Treatment for Long-Term Healing Did you know that between 20%-26% of patients with substance use disorders are expected to readmit within 3 months of treatment? With treatment programs designed to meet your needs, you can expect long-term improvements to your overall health and well-being. OF OUR ALUMNIDO NOT READMIT Healing the Whole Person Our […]

The Meadows | Personalized Alcohol Addiction Rehab

Effective Treatment for Long-Term Healing Did you know that between 20%-26% of patients with substance use disorders are expected to readmit within 3 months of leaving rehab? With treatment programs designed to meet your needs, you can expect long-term improvements to your overall health and well-being. OF OUR ALUMNIDO NOT READMIT Healing the Whole Person […]

The Meadows | Inpatient Treatment Center

Effective Treatment for Long-Term Healing Did you know that between 20%-26% of patients with substance use disorders are expected to readmit to an inpatient treatment center within 3 months of treatment? With programs designed to meet your needs, you can expect long-term improvements to your overall health and well-being. OF OUR ALUMNIDO NOT READMIT Healing […]

Info (PPC Pages)

The Meadows Expands Access to Care with Blue Cross Blue Shield of Arizona

PHOENIX, Dec. 31, 2024 /PRNewswire/ — The Meadows Behavioral Healthcare is proud to announce that effective Jan. 1, 2025, all of its inpatient treatment centers in Arizona will be in-network with Blue Cross Blue Shield of Arizona (BCBSAZ). This groundbreaking partnership, which includes a value-based agreement, marks a significant milestone in the effort to provide greater access to high-quality mental health care […]

Meadows Behavioral Healthcare Appoints Marina Rodina as Senior Vice President of Business Development

WICKENBURG, Ariz., Dec. 23, 2024 /PRNewswire/ — Meadows Behavioral Healthcare (MBH), a leader in trauma, addiction, and mental health treatment, is proud to announce the appointment of Marina Rodina as its new Senior Vice President of Business Development. Marina, an accomplished executive with over two decades of experience in sales and behavioral healthcare leadership, will play a pivotal role in […]

MBH on Arizona’s Family | Coping With Eating Disorders During the Holidays

The holiday season can be especially difficult for those battling eating disorders. With the emphasis on food, gatherings, and comments about appearances, triggers are everywhere, making this time of year overwhelming. Dr. Jerry Law, Executive Director of The Meadows, and former patient Daria Alvarez, joined Arizona’s Family 3TV to discuss: Watch the Arizona Family’s Segment:


Multiple Gallery Image Gallery


" + "" + "" + //ENG-1082 "\"" + chatbtn_tooltip_text + "\""; /* " "; */ doc.getElementById("widgetlbtn").style.color = color; doc.getElementById("widgetlbtn").style.backgroundColor = msg.widgetcolor; doc.getElementById("widgetlbtn").style.display = 'block'; count = count != undefined ? count : 0; doc.getElementById("spnwidgetlbtn").setAttribute("aria-label", "Chat button , " + count + " unread messages"); //ENG-1082 doc.getElementById("widgetlbtn").addEventListener('click', function () { console.log("switchicon called"); if (parent.IMIChatInit != undefined) { parent.IMIChatInit.chatswitchicon(); } else { IMIChatInit.chatswitchicon(); } }); document.getElementById('imi-chatbutton').style.display = "block"; //console.log( doc.getElementById("widgetlbtn")); /*$('[data-toggle=\"tooltip\"]').tooltip();*/ // doc.close(); /* for test */ var doc1 = document.getElementById('chatunread-frame').contentWindow.document; // doc1.open(); doc1.head.innerHTML = "" + ""; doc1.body.innerHTML = "x
"; // ""+ //"" + //""; //doc1.close(); doc1.getElementsByTagName('html')[0].classList.add('imichatmsgpreview'); doc1.getElementById("ancclearcards").addEventListener('click', function () { if (parent.IMIChatInit != undefined) { parent.IMIChatInit.clearmsgcards(); } else { IMIChatInit.clearmsgcards(); } }); document.getElementById('chatunread-frame').style.display = "block"; IMIGeneral.storeLocal("style_" + document.getElementById("divicw").getAttribute("data-bind") + "_" + window.location.hostname, msg); document.getElementById('chatbutton').style.display = "block"; } else { document.getElementById("divicw").innerHTML = ''; } } catch (e1) { } }, loadCookieConsentWidgetStyles: function () { try { if (cookieConsentWidgetOptions != '' && cookieConsentWidgetOptions != undefined && cookieConsentWidgetOptions != null && cookieConsentWidgetOptions != 'null') { buttonType = cookieConsentWidgetOptions.buttonType; var color = "#ffffff"; var lightness1 = 0; var lightness = 0; try { var widgcolor = cookieConsentWidgetOptions.widgetColor; r = parseInt(widgcolor.substr(1, 2), 16); g = parseInt(widgcolor.substr(3, 2), 16); b = parseInt(widgcolor.substr(5, 2), 16); hue = IMIGeneral.rgbToHsl(r, g, b)[0] * 360; saturation = IMIGeneral.rgbToHsl(r, g, b)[1] * 100; lightness = IMIGeneral.rgbToHsl(r, g, b)[2] * 100; lightness1 = lightness + 10; lightness2 = 95; var lightness3 = 98; var lightness4 = lightness + 10; if (lightness > 80) { color = "#333333"; } } catch (e1) { } var badgecount = " {1} "; badgecount = badgecount.replace("{0}", "style=\"display:none;\"").replace("{1}", ""); var chatbtn_tooltip_text = IMILocalisation.getValue(cookieConsentWidgetOptions.widgetLang, "chat_button_tooltip", "Live Chat"); _IMIchat_widget_lang = cookieConsentWidgetOptions.widgetLang; var doc = document.getElementById('imi-chatbutton').contentWindow.document; doc.body.innerHTML = "" + "" + "" + "" + "" + ""; doc.getElementById("cookieconsentwidgetlbtn").style.color = color; doc.getElementById("cookieconsentwidgetlbtn").style.backgroundColor = cookieConsentWidgetOptions.widgetColor; doc.getElementById("cookieconsentwidgetlbtn").style.display = 'block'; doc.getElementById("cookieconsentwidgetlbtn").addEventListener('click', function () { if (parent.IMIChatInit != undefined) { parent.IMIChatInit.chatcookieconsentswitchicon(); } else { IMIChatInit.chatcookieconsentswitchicon(); } }); document.getElementById('chatbutton').style.display = "block"; } else { document.getElementById("divicw").innerHTML = ''; } } catch (e1) { } }, acceptCookies: function (element) { if (IMIChatInit.checklocalStorage()) { localStorage.setItem("webex_engage_cookieconsent_accepted", 1); IMIChatInit.init(); } else { document.getElementById("divicw").innerHTML = "
\n \n \nError:
Cookies Disabled

We use cookies to enable best chat experience. Follow these directions to re-enable cookies specific to your browser type or re-open this website in a cookie-enabled browser.

"; console.log("Local storage not supported"); } }, chatswitchicon: function (type) { console.log("Chatswitchicon::" + type); try { /*type=1-max and 0- min */ var isMobile = "0"; // if (window.innerWidth > 768) { // document.getElementById('divchatmain').className = 'main-chat-cont'; // } else { // document.getElementById('divchatmain').className = 'main-chat-cont chatmobile'; // isMobile="1"; // } if ((navigator.userAgent.indexOf("Mobile")) != -1) { isMobile = "1"; } sessionStorage.setItem("webex_engage_data-bind", document.getElementById("divicw").getAttribute("data-bind")); sessionStorage.setItem("webex_engage_data-org", document.getElementById("divicw").getAttribute("data-org")); var iframe = document.getElementById('imi-chatbutton'); if (iframe == null || iframe == undefined) return; var innerDoc = iframe.contentDocument || iframe.contentWindow.document; //Open Widget if (document.getElementById("divchatmain").style.display === 'none' && (type == 1 || type == 2 || type == undefined)) { document.getElementById("divchatmain").style.display = "block"; IMIGeneral.checkmobile(); var widgetmain = document.getElementById("iframechatwindow");//ENG-1034 widgetmain.contentWindow.focus();//ENG-1034 //if ((window.outerWidth < 497) && (document.documentElement.classList.contains('imichatmobile-active') == false) && document.getElementById("divchatmain").style.display == "block") { var className = " " + document.documentElement.className + " "; if ((window.outerWidth < 700) && (" " + className + " ").replace(/[\n\t]/g, " ").indexOf("imichatmobile-active") > -1 && document.getElementById("divchatmain").style.display == "block") { // if((document.documentElement.classList.value.split(/\s+|\./).filter(word => word === 'imichatmobile-active').length==1) == false){ document.documentElement.classList.remove("imichatmobile-active"); document.documentElement.className = document.documentElement.className + " imichatmobile-active"; // } } else { document.documentElement.className = document.documentElement.className.replace(' imichatmobile-active', ''); } document.getElementById('chatunread-frame').style.display = "none"; innerDoc.getElementById("widgetlbtn").setAttribute("class", "open-btn state1 " + buttonType + " close-btn"); // innerDoc.getElementById("widgetlbtn").setAttribute("aria-label", "Close web chat"); innerDoc.getElementById("widgetlbtn").setAttribute("aria-expanded", "true"); document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").style.display = "none"; document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").innerText = ""; localStorage.setItem(fingerprint + "_" + _skey + "_badgecount", 0); localStorage.setItem(fingerprint + "_" + _skey + "_cardcount", 0); IMIChatInit.clearmsgcards(); // if (IMIGeneral.getBrowserName() == "safari") { // if (IMIGeneral.detectIOS()) { // document.body.classList.add('chatnoscroll'); // } // } if (type === undefined) { var destination = document.getElementById('iframechatwindow').contentWindow; msg = { "action": "showiframe", "host": window.location.hostname, "chatmobile": isMobile }; destination.postMessage(msg, domainUrl); document.getElementById("iframechatwindow").setAttribute("aria-hidden", "false"); } return; } //Close Widget if (document.getElementById("divchatmain").style.display === 'block' && (type == 0 || type == 2 || type == undefined)) { document.documentElement.className = document.documentElement.className.replace(' imichatmobile-active', ''); //document.body.classList.remove('chatnoscroll'); document.getElementById("divchatmain").style.display = "none"; innerDoc.getElementById("widgetlbtn").setAttribute("class", "open-btn state " + buttonType); innerDoc.getElementById("widgetlbtn").setAttribute("aria-expanded", "false"); innerDoc.getElementById("widgetlbtn").focus(); document.getElementById('chatunread-frame').style.display = "block"; localStorage.setItem(fingerprint + "_" + _skey + "_cardcount", 0); document.getElementById("iframechatwindow").setAttribute("aria-hidden", "true"); return; } //var iframeEl = document.getElementById("iframechatwindow"); // Make sure you are sending a string, and to stringify JSON // iframeEl.contentWindow.postMessage("hello", '*'); return; } catch (e) { console.log("LaunchProactiveMsgManager:" + e.msg); } }, chatcookieconsentswitchicon: function (type) { try { var isMobile = "0"; if ((navigator.userAgent.indexOf("Mobile")) != -1) { isMobile = "1"; } var iframe = document.getElementById('imi-chatbutton'); if (iframe == null || iframe == undefined) return; var innerDoc = iframe.contentDocument || iframe.contentWindow.document; //Open Widget if (document.getElementById("divchatmain").style.display === 'none' && (type == 1 || type == 2 || type == undefined)) { document.getElementById("divchatmain").style.display = "block"; IMIGeneral.checkmobile(); var className = " " + document.documentElement.className + " "; //if ((window.outerWidth < 700) && (" " + className + " ").replace(/[\n\t]/g, " ").indexOf("imichatmobile-active") > -1 && document.getElementById("divchatmain").style.display == "block") { // // if((document.documentElement.classList.value.split(/\s+|\./).filter(word => word === 'imichatmobile-active').length==1) == false){ // document.documentElement.classList.remove("imichatmobile-active"); // document.documentElement.className = document.documentElement.className + " imichatmobile-active"; // // } //} else { // document.documentElement.className = document.documentElement.className.replace(' imichatmobile-active', ''); //} document.getElementById('chatunread-frame').style.display = "none"; innerDoc.getElementById("cookieconsentwidgetlbtn").setAttribute("class", "open-btn state1 " + buttonType + " close-btn"); innerDoc.getElementById("cookieconsentwidgetlbtn").setAttribute("aria-expanded", "true"); document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").style.display = "none"; document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").innerText = ""; //IMIChatInit.clearmsgcards(); if (type === undefined) { var destination = document.getElementById('iframecookieconsentwindow').contentWindow; msg = { "action": "showiframe", "host": window.location.hostname, "chatmobile": isMobile }; destination.postMessage(msg, domainUrl); document.getElementById("iframecookieconsentwindow").setAttribute("aria-hidden", "false"); } return; } //Close Widget if (document.getElementById("divchatmain").style.display === 'block' && (type == 0 || type == 2 || type == undefined)) { document.documentElement.className = document.documentElement.className.replace(' imichatmobile-active', ''); document.getElementById("divchatmain").style.display = "none"; innerDoc.getElementById("cookieconsentwidgetlbtn").setAttribute("class", "open-btn state " + buttonType); innerDoc.getElementById("cookieconsentwidgetlbtn").setAttribute("aria-expanded", "false"); innerDoc.getElementById("cookieconsentwidgetlbtn").focus(); document.getElementById('chatunread-frame').style.display = "block"; document.getElementById("iframecookieconsentwindow").setAttribute("aria-hidden", "true"); return; } return; } catch (e) { console.log("LaunchProactiveMsgManager:" + e.msg); } }, clearmsgcards: function () { document.getElementById('chatunread-frame').contentWindow.document.getElementById("msg-list").innerHTML = ""; document.getElementById('chatunread-frame').contentWindow.document.getElementById("ancclearcards").style.display = "none"; //document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").style.display = "none"; //document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").innerText == ""; localStorage.setItem(fingerprint + "_" + _skey + "_cardcount", 0); }, openchat: function (event) { document.getElementById('imichat-fullscreen-modal').className = 'imichat-fullscreen-modal'; document.getElementById('imichat-fullscreen-modal').removeAttribute('tabindex'); document.getElementById('imichat-fullscreen-modal').removeAttribute('aria-hidden'); var destination = document.getElementById('iframechatwindow').contentWindow; destination.postMessage({ action: 'openchat', threadid: event.data.threadid, proactive_id: event.data.proactive_id }, '*'); if (parent.IMIChatInit != undefined) { parent.IMIChatInit.chatswitchicon(2); } else { IMIChatInit.chatswitchicon(2); } }, extractContent: function (s) { var span = document.createElement('span'); span.innerHTML = s; return span.textContent || span.innerText; }, badgecount: function (event) { try { if (document.getElementById("divchatmain").style.display === 'none') { var count = document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").innerText; if (count == 0 || count == "") { count = 1; } else { count = parseInt(count) + 1; } var duplicate = 0; var innerDivs; var innerDivsCount = 0; var refChild; IMIChatInit.clearmsgcards(); var containerDiv = document.getElementById('chatunread-frame').contentWindow.document.getElementById("msg-list"); if (count > 1) { innerDivs = containerDiv.getElementsByClassName("msg"); if (innerDivs != undefined) { innerDivsCount = innerDivs.length; for (var i = 0; i < innerDivs.length; i++) { if ("msg_" + event.data.msgtransid == innerDivs[i].id) { duplicate = 1; } } refChild = innerDivs[0]; } } var cardcount; var checkbadgecount; if (innerDivs == undefined) { localStorage.setItem(event.data.fingerprint + "_" + _skey + "_cardcount", 1); } document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").style.display = "block"; if (duplicate == 0) { if (parseInt(innerDivsCount) == 5) { containerDiv.removeChild(document.getElementById('chatunread-frame').contentWindow.document.getElementsByClassName('msg')[4]); containerDiv.removeChild(document.getElementById('chatunread-frame').contentWindow.document.getElementsByClassName('msgclear')[4]); innerDivsCount = innerDivsCount - 1; } if ((parseInt(innerDivsCount) < 1 && event.data.badge_type === undefined) || event.data.badge_type === 2 || event.data.badge_type === 3) { var node = document.createElement("div"); var node1 = document.createElement("div"); var textnode = document.createTextNode(IMIChatInit.extractContent(event.data.msg)); if (textnode.data.length > 45) { if (event.data.badge_type === undefined || event.data.badge_type === 2) { textnode.data = textnode.data.substr(0, 45) + "..."; } else { textnode.data = textnode.data; } } node.className = "msg"; node.style = "cursor:pointer;"; node1.className = "msgclear"; node.id = "msg_" + event.data.msgtransid; // Create a text node node1.id = "msgclear_" + event.data.msgtransid; node1.style = "clear:both;"; node.addEventListener("click", function () { window.parent.postMessage({ action: 'openchat', threadid: event.data.threadid, proactive_id: event.data.proactive_id }, '*'); }); node1.addEventListener("click", function () { window.parent.postMessage({ action: 'openchat', threadid: event.data.threadid, proactive_id: event.data.proactive_id }, '*'); }); if (event.data.msg_from !== undefined && event.data.msg_from !== "") { var span = document.createElement("span"); //var span span.innerHTML = '' + event.data.msg_from + ':'; node.appendChild(span); } else if (event.data.msg_from === undefined || event.data.msg_from == "") { var span = document.createElement("span"); //var span span.innerHTML = 'New Conversation:'; node.appendChild(span); } node.appendChild(textnode); var height = document.getElementsByClassName('main-unreadchat-cont')[0].style.height; if (height == "") { height = 70; } if (innerDivsCount == 0) { height = document.getElementsByClassName('main-unreadchat-cont')[0].style.height = "150px"; } /* else if (innerDivsCount == 2) { height = document.getElementsByClassName('main-unreadchat-cont')[0].style.height = "150px"; } else if (innerDivsCount > 2) {*/ else { document.getElementsByClassName('main-unreadchat-cont')[0].style.height = parseInt(height) + 60 + "px"; } var referenceNode = document.getElementById('chatunread-frame').contentWindow.document.getElementById("msg-list"); // document.querySelector('#some-element'); if (innerDivsCount == 0) { referenceNode.appendChild(node); referenceNode.appendChild(node1); } else { referenceNode.insertBefore(node, refChild); referenceNode.insertBefore(node1, refChild); if ((window.innerHeight + 100) < (document.getElementsByClassName("main-unreadchat-cont")[0].style.height)) { var frame = document.getElementById('chatunread-frame'); var c = frame.contentDocument || frame.contentWindow.document; c.getElementsByTagName("body")[0].offsetHeight = '80%'; c.getElementsByTagName("body")[0].style.overflow = "auto"; } } if (event.data.badge_type === 3) { document.getElementsByClassName("main-unreadchat-cont")[0].style.height = "100%"; var frame = document.getElementById('chatunread-frame'); var c = frame.contentDocument || frame.contentWindow.document; c.getElementsByClassName("msg")[0].style.maxHeight = "unset"; var frameheight = c.getElementsByTagName("body")[0].offsetHeight; document.getElementsByClassName("main-unreadchat-cont")[0].style.height = frameheight + "px"; } } else if (event.data.badge_type === 4) { var fullscreen_modal = document.getElementById('imichat-fullscreen-modal'); fullscreen_modal.className = 'imichat-fullscreen-modal imichat-open'; fullscreen_modal.contentWindow.postMessage({ action: 'bind_data', proactive_id: event.data.proactive_id, threadid: event.data.threadid, msg_from: event.data.msg_from, msg: event.data.msg, btn_chat_now_open: IMILocalisation.getValue(_IMIchat_widget_lang, "proactive_poupup_chat_now_button", "Chat Now"), btn_chat_now_close: IMILocalisation.getValue(_IMIchat_widget_lang, "proactive_poupup_close_button", "Close") }, "*"); } cardcount = parseInt(localStorage.getItem(event.data.fingerprint + "_" + _skey + "_cardcount")) + 1; localStorage.setItem(event.data.fingerprint + "_" + _skey + "_cardcount", cardcount); localStorage.setItem("fingerprint", event.data.fingerprint); localStorage.setItem(event.data.fingerprint + "_" + _skey + "_badgecount", count); document.getElementById('imi-chatbutton').contentWindow.document.getElementById("chattotalbadge").innerText = count; if (count > 0) { //to do for ENG-1082 get localisation for chat button tooltip with count document.getElementById('imi-chatbutton').contentWindow.document.getElementById("spnwidgetlbtn").setAttribute("aria-label", "Chat button , " + count + " unread messages"); //ENG-1082 } else { document.getElementById('imi-chatbutton').contentWindow.document.getElementById("spnwidgetlbtn").setAttribute("aria-label", "Chat button , " + count + " unread messages"); //ENG-1082 } } document.getElementById('chatunread-frame').contentWindow.document.getElementById("ancclearcards").style.display = (event.data.badge_type === undefined || (event.data.badge_type === 2 || event.data.badge_type === 3)) ? "block" : "none"; } } catch (e) { console.log("badgecount:" + e.msg); } }, message: function (event) { try { if (event.data.action != null) { if (event.data.action == 'openchat') { IMIChatInit.openchat(event); } if (event.data.action == 'badgecount') { IMIChatInit.badgecount(event); } if (event.data.action == 'chatswitchicon') { IMIChatInit.chatswitchicon(); //event } if (event.data.action == 'imichat_custom_chat_fields') { if (event.data.type == 'add') { if (_IMIchat_callback_dic['imichat-widget:custom_chat_fields_init'] !== undefined) { _IMIchat_callback_dic['imichat-widget:custom_chat_fields_init'](event.data.response); } } else if (event.data.type == 'update') { if (_IMIchat_callback_dic['imichat-widget:custom_chat_fields_update'] !== undefined) { _IMIchat_callback_dic['imichat-widget:custom_chat_fields_update'](event.data.response); } }//event } if (event.data.action == 'acceptCookies') { IMIChatInit.acceptCookies(); } if (event.data.action == 'loadcookieconsentwidgetstyles') { IMIChatInit.loadCookieConsentWidgetStyles(); } if (event.data.action == 'loadstyles') { IMIChatInit.loadJQuery(_wxengage_domain_name, function () { IMIChatInit.loadwidgetStyles(event.data.message); try { if (event.data.message != null) { if (_IMIchat_callback_dic['imichat-widget:ready'] !== undefined) { _IMIchat_callback_dic['imichat-widget:ready'](_wxengage_attr_key); console.log("imichat-widget:ready fired"); } //eval('imichatWidgetLoaded();'); if (_IMIchat_callback_dic['imichat-widget:custom_chat_fields_init'] !== undefined) { _IMIchat_callback_dic['imichat-widget:custom_chat_fields_init'](); }// debugger; var widget_data = JSON.parse(event.data.message); hdr_bfp = widget_data.hdr_bfp; hdr_xtoken = widget_data.hdr_xtoken; hdr_tid = widget_data.hdr_tid; } } catch (e) { } IMIChatInit.LaunchProactiveMsgManager(_wxengage_domain_name, function () { }); IMIChatInit.handleAbandonedChats(); }); } if (event.data.action == 'closemodelpopup') { document.getElementById('imichat-fullscreen-modal').className = 'imichat-fullscreen-modal'; document.getElementById('imichat-fullscreen-modal').setAttribute('tabindex', '-1'); document.getElementById('imichat-fullscreen-modal').setAttribute('aria-hidden', 'true'); } if (event.data.action == 'setsession') { sessionStorage.setItem(event.data.key, event.data.value); } if (event.data.action == 'setlocal') { localStorage.setItem(event.data.key, event.data.value); } if (event.data.action == 'browserstorage') { document.getElementById("divicw").innerHTML = "
\n \n \nError:
Cookies Disabled

We use cookies to enable best chat experience. Follow these directions to re-enable cookies specific to your browser type or re-open this website in a cookie-enabled browser.

"; console.log("Local storage not supported"); } if (event.data.action == 'clearallsessionkeys') { sessionStorage.clear(); } if (event.data.action == 'clearalllocalstoragekeys') { localStorage.clear(); } if (event.data.action == 'cookierejectreload') { IMIChatInit.removeStorageKeysWhenCookieRejected(); IMIChatInit.init(); } } } catch (e) { } }, resize: function () { try { var destination = document.getElementById('iframechatwindow').contentWindow; destination.postMessage({ action: 'resize', width: window.outerWidth //window.innerWidth//screen.width // document.body.clientWidth }, "*"); IMIGeneral.checkmobile(); } catch (e) { } }, removeStorageKeysWhenCookieRejected: function () { sessionStorage.removeItem(_wxengage_attr_key + "_imichat-reload-check"); sessionStorage.removeItem("webex_engage_data-bind"); sessionStorage.removeItem("webex_engage_data-org"); localStorage.removeItem(fingerprint + "_" + _skey + "_badgecount"); localStorage.removeItem(fingerprint + "_" + _skey + "_cardcount"); localStorage.removeItem("style_" + document.getElementById("divicw").getAttribute("data-bind") + "_" + window.location.hostname); localStorage.removeItem("webex_engage_customer_first_seen"); localStorage.removeItem("webex_engage_customer_last_seen"); localStorage.removeItem("webex_engage_customer_last_seen_interval_id"); localStorage.removeItem("webex_engage_executed_proactive_ids"); localStorage.removeItem("fingerprint"); localStorage.removeItem("webex_engage_repeat_customer"); sessionStorage.removeItem("webex_engage_imichat_hasinitconvexist"); localStorage.removeItem("webex_engage_cookieconsent_accepted"); }, clearBrowserStorage : function() { try { IMIChatInit.removeStorageKeysWhenCookieRejected(); var destination = document.getElementById('iframechatwindow').contentWindow; destination.postMessage({ action: 'clearbrowserstorage', width: window.outerWidth //window.innerWidth//screen.width // document.body.clientWidth }, "*"); IMIChatInit.verifyCookieConsent(); console.log("browser storage cleared"); } catch (e) { } }, LaunchProactiveMsgManager: function (domainName, callback) { try { var widget_styles = localStorage.getItem("style_" + document.getElementById("divicw").getAttribute("data-bind") + "_" + window.location.hostname); if (widget_styles == null && !JSON.parse(widget_styles).enable_proactive) { callback(); return; } var body = document.getElementsByTagName('body')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = IMIChatInit.domainName() + '/js/proactive-msg-manager.js'; body.appendChild(script); script.addEventListener('load', function (event) { console.log('proactive manager loaded;'); var destination = document.getElementById('iframechatwindow').contentWindow; destination.postMessage({ action: 'proactive-manager-loaded', attrkey: document.getElementById("divicw").getAttribute("data-bind"), host: window.location.hostname }, "*"); callback(); }); } catch (e) { console.log("LaunchProactiveMsgManager:" + e.msg); } }, processAbandonedChats: function (type) { if (!imichatwidget.hasInitiatedChat()) { return; } var browser_fingerprint = localStorage.getItem("fingerprint"); var url = IMIGeneral.profileUrl() + "livechats/" + _wxengage_attr_key + "/customers/" + browser_fingerprint + "/abandoned?host=" + window.document.URL; url = url + "&type=" + type; var body = JSON.stringify({ "is_reloaded": false, "is_closechat": true }); var headers = { 'type': 'application/json', 'fpid': hdr_bfp, 'Tid': hdr_tid, 'X-Token': hdr_xtoken }; var blob = new Blob([body], headers); navigator.sendBeacon(url); }, handleAbandonedChats: function () { // Attach the event keypress to exclude the F5 refresh //jQuery(window).on('keydown', function (e) { window.addEventListener('keydown', function (e) { if (e.keyCode == 116) { _IMIchat_IsValidNavigation = true; } }); window.addEventListener("beforeunload", function (e) { sessionStorage.setItem(_wxengage_attr_key + "_imichat-reload-check", document.referrer); console.log(document.referrer); //sessionStorage.setItem("imi_tabid", Math.random().toString(16).slice(2)); if (_IMIchat_IsValidNavigation !== undefined && !_IMIchat_IsValidNavigation) { IMIChatInit.processAbandonedChats("unload"); } }); if (window.performance.navigation.type == 1) { IMIChatInit.processAbandonedChats("load"); } }, loadJQuery: function (domainName, callback) { if (typeof (jQuery) !== 'undefined') { callback(); return; } var body = document.getElementsByTagName('body')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = domainName + '/js/jquery.min.js'; body.appendChild(script); script.addEventListener('load', function (event) { callback(); }); return; }, on: function (func_name, callback) { if (typeof callback != 'function') { console.error('function was expected.'); return; } switch (func_name) { case 'imichat-widget:ready': _IMIchat_callback_dic['imichat-widget:ready'] = callback; break; } }, checklocalStorage: function () { var test = 'test'; try { localStorage.setItem(test, test); localStorage.removeItem(test); return true; } catch (e) { return false; } }, call_previous_chats: function () { try { var destination = document.getElementById('iframechatwindow').contentWindow; msg = { "action": "showiframe", "host": window.location.hostname, "chatmobile": ((navigator.userAgent.indexOf("Mobile")) != -1) ? "1" : "0" }; destination.postMessage(msg, domainUrl); } catch (e) { } }, check_clear_session_chats: function () { if (document.referrer == sessionStorage.getItem(_wxengage_attr_key + "_imichat-reload-check")) { return false; } else if (sessionStorage.getItem(_wxengage_attr_key + "_imichat-reload-check") == undefined) { return true; } else { console.log("Hey, Thanks for visiting again"); return false; } }, verifyCookieConsent: function () { var isCookieConsent = typeof cookieConsentWidgetOptions === 'undefined' ? false : true; if (isCookieConsent != undefined && isCookieConsent != null && isCookieConsent && localStorage.getItem("webex_engage_cookieconsent_accepted") != "1") { try { var body = document.getElementsByTagName('body')[0]; var script = document.currentScript || (function () { var scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; })(); var generalscript = document.createElement('script'); generalscript.src = IMIChatInit.domainName() + "/js/imichatgeneral.js"; generalscript.type = 'text/javascript'; body.appendChild(generalscript); generalscript.addEventListener('load', function (event) { document.getElementById("divicw").innerHTML = "" + "" + "" + "
" + "
" + "" + "
" + ""; var iframeMainDoc = document.getElementById("iframecookieconsentwindow"); iframeMainDoc.addEventListener('load', function () { IMIChatInit.onCookieConsentWidgetIconIframeLoad(); }); iframeMainDoc.src = IMIGeneral.domainName() + "/cookieconsent.html"; window.removeEventListener('message', IMIChatInit.message); window.addEventListener('message', IMIChatInit.message); }); } catch (e) { console.log("LaunchProactiveMsgManager:" + e.msg); } } else { if (IMIChatInit.checklocalStorage()) { IMIChatInit.init(); } else { document.getElementById("divicw").innerHTML = "
\n \n \nError:
Cookies Disabled

We use cookies to enable best chat experience. Follow these directions to re-enable cookies specific to your browser type or re-open this website in a cookie-enabled browser.

"; console.log("Local storage not supported"); } } } }; }(); IMIChatInit.verifyCookieConsent(); var imichatwidget = { // get hasInitiatedConversation() { // if (sessionStorage.getItem("webex_engage_imichat_hasinitconvexist") == null) // return false; // if (sessionStorage.getItem("webex_engage_imichat_hasinitconvexist") == "1") { // return true; // } else { // return false; // } // }, hasInitiatedChat: function () { if (sessionStorage.getItem("webex_engage_imichat_hasinitconvexist") == null) return false; if (sessionStorage.getItem("webex_engage_imichat_hasinitconvexist") == "1") { return true; } else { return false; } }, show: function () { //$("#divicw").show();return; document.getElementById("divicw").style.display = 'block'; }, hide: function () { // $("#divicw").hide();return; document.getElementById("divicw").style.display = 'none'; }, /* test:function() { if(sessionStorage.getItem("webex_engage_imichat_hasinitconvexist")==null) return false; if(sessionStorage.getItem("webex_engage_imichat_hasinitconvexist")=="1") { return true; } else { return false; } },*/ maximizeWindow: function () { IMIChatInit.chatswitchicon(1); IMIChatInit.resize(); IMIChatInit.call_previous_chats(); return; }, minimizeWindow: function () { return IMIChatInit.chatswitchicon(0); }, init: function (jsondata, callback) { if (typeof callback != 'function') { console.error('function was expected.'); return; } var destination = document.getElementById('iframechatwindow').contentWindow; destination.postMessage({ action: 'imichat_custom_chat_fields', data: jsondata, type: 'add' }, '*'); _IMIchat_callback_dic['imichat-widget:custom_chat_fields_init'] = callback; }, update: function (jsondata, callback) { if (typeof callback != 'function') { console.error('function was expected.'); return; } var destination = document.getElementById('iframechatwindow').contentWindow; destination.postMessage({ action: 'imichat_custom_chat_fields', data: jsondata, type: 'update' }, '*'); _IMIchat_callback_dic['imichat-widget:custom_chat_fields_update'] = callback; }, on: function (func_name, callback) { if (typeof callback != 'function') { console.error('function was expected.'); return; } switch (func_name) { case 'imichat-widget:ready': _IMIchat_callback_dic['imichat-widget:ready'] = callback; break; } }, clearBrowserStorage: function () { IMIChatInit.clearBrowserStorage(); } }; /* function imichatWidgetLoaded(){imi imichatwidget.maximizeWindow(); }*/