AI is continuously reshaping the ecommerce landscape for good, and savvy business owners are embracing it to stay ahead. According to industry insights, AI adoption in organizations has surged to 72%. For WooCommerce store owners, leveraging WooCommerce AI is no longer just a trend but a necessity. It’s the future of selling smart!
With AI tools, you can easily automate time-consuming tasks, improve the customer experience, and scale your operations with less effort. In this helpful guide, we’ll explore these key benefits and introduce StoreAgent: a game-changing AI tool designed to optimize your WooCommerce store. Plus, we’ll show you how you can maximize your store’s success by combining StoreAgent with Advanced Coupons!
Pretty exciting, right? Let’s dive right in!
Store owners have a lot on their plate. Juggling customer inquiries, updating product details, managing inventory, running promotions… these are just a few of the daily challenges store owners face. Staying on top of these tasks while carving time to strategize can be quite a challenge. This is where WooCommerce AI tools can make a difference.
Simply put, AI tools handle time-consuming, repetitive tasks for you. They can generate compelling product descriptions, answer common customer questions, summarize product reviews, and more. So, instead of manually crafting responses and analyzing your data, AI tools can take care of it, freeing up more time so you can focus on growing your business.
From our experience, the best tools to invest in are the ones that seamlessly integrate into your current workflow. Creating product listings can be time-consuming, but using an AI Product Description tool can speed up the process significantly. Tools like AI Product Description generators help WooCommerce store owners create SEO-optimized, engaging content effortlessly, ensuring that every product stands out without hours of manual writing.
StoreAgent, for instance, makes it easy to activate AI-powered agents that handle key tasks in your store (more on this later):
A look inside the StoreAgent dashboard—manage and activate AI agents with ease! (click to zoom)
Trust us, once you start using AI in your store, you’ll wonder how you ever managed without it!
Key Benefits Of AI In Retail
We’ve seen firsthand how AI can streamline store operations and improve the customer experience. In this section, we’ll explore four key benefits of AI in retail and why you should consider integrating them into your business:
The key benefits of AI in retail and how it transforms store management click to zoom
1. Saves time with automated store management
Time is your most valuable asset as a store owner. We’ve touched on this earlier: AI tools can help you save time by automating tasks. Here are just a few of the tasks AI-powered tools can handle for you:
Generate product descriptions: AI tools can analyze product details and create SEO-optimized copy in a few clicks.
Summarize customer reviews: No need to read through hundreds of product reviews–AI tools can analyze large amounts of data and craft review summaries to help shoppers make better shopping decisions.
Answer customer inquiries automatically: AI-powered chatbots can easily handle common customer questions 24/7, freeing up your support team for more complex customer concerns.
Monitor site health: AI tools can scan your store for errors, broken links, and performance issues, ensuring everything runs smoothly.
With these tasks handled in the background, you can dedicate more time to strategizing, developing new products, and creating a better shopping experience for your customers.
2. Boosts conversions with personalized shopping experiences
AI-driven personalization is making waves in ecommerce, and for good reason. Today’s shoppers expect brands to deliver personalized shopping experiences. In fact, 76% of customers get frustrated when this doesn’t happen!
With AI tools, store owners can offer personalized experiences that make shoppers feel seen, valued, and understood. These tools can analyze past purchases, browsing habits, and shopper preferences to suggest relevant product recommendations and upsells. As a result, product suggestions feel more tailored to customers, making the shopping journey more engaging and increasing the likelihood of a sale.
This brings us to our next point.
3. Improves the customer experience
According to industry insights, more than half of shoppers today will leave a business after a single bad experience. This is why creating a smooth, stress-free shopping journey is crucial if you want to stay competitive. AI tools can help eliminate friction and create a more intuitive shopping journey for your valued customers.
Using the right tools, you can:
Provide answers instantly: You can leverage AI-powered chatbots to answer common questions without delay, reducing wait times and customer frustration.
Speed up product search: AI-powered search learns from user behavior and past purchase history, helping shoppers find what they need on your website faster.
Enhance the post-purchase experience: With AI, you can automate order updates to inform customers about the status of their orders.
Reduce cart abandonment: AI can analyze shopper behavior to identify shoppers who are more likely to leave without completing a purchase. Once identified, it can trigger personalized discounts or limited-time offers to re-engage these shoppers and encourage them to checkout.
4. Streamlines operations and maximizes efficiency
The best tools to invest in are the ones that help you minimize costs while maximizing efficiency. As store owners ourselves, we know how quickly manual tasks and rising expenses can eat into time and profits! WooCommerce AI tools help create a more efficient workflow while reducing operational costs in the long run. Here’s how:
Eliminates costly human errors: With AI-powered tools, you can reduce the risks of manual inventory errors, mismanaged promotions, and pricing mistakes, which are often the cause of refunds and lost revenue.
Boosts marketing efficiency: WooCommerce AI plugins can also help refine ad targeting, recommending relevant products based on shopper behavior. This ensures that every dollar you spend on advertising is directed to the right people.
Improves your overall operational workflow: Integrating AI tools into your business management allows you to automate tasks like customer support, pricing adjustments, and order processing. This leads to a faster, more efficient store operation.
Introducing StoreAgent: The WooCommerce AI Plugin That Automates And Optimizes Your Store
Now that we’ve discussed how AI is revolutionizing the ecommerce landscape and the benefits you can enjoy from it, you’re likely wondering… “How can I integrate AI into my own WooCommerce store?”
This is where StoreAgent comes in.
StoreAgent is a WooCommerce AI plugin designed to automate key store management tasks so you can focus on scaling your business. This tool provides a suite of smart “AI agents” (think of them like mini assistants) that work behind the scenes to streamline your operations and improve the shopping experience. It’s incredibly easy to set up and you can activate the agents you need in a few clicks!
Here are just a few AI agents that StoreAgent offers and how they help:
AI agents available in StoreAgentpowerful automation for your WooCommerce store click to zoom
1. Product Questions Agent
Manually answering product questions can be a huge time-sink, especially for businesses with a wide product catalog! The Product Questions agent adds a Q&A tab to your product pages, letting customers ask questions and providing them instant AI-generated responses based on available product information. To ensure accuracy, store owners can review and approve AI-generated answers before publishing them.
Based on our experience, enabling AI-powered product Q&A not only lightens the workload but also creates a more interactive shopping experience that enhances customer engagement. This can lead to faster purchase decisions, which is a win for your bottom line!
2. Product Description Assistant
Crafting detailed, SEO-optimized product descriptions can take a long while, especially if you have a lot of product varieties available. With the Product Description Assistant, you can quickly create high-quality and SEO-optimized product descriptions based on a few key details.
Check it out in action:
See StoreAgents AI powered Product Description Generator in action click to zoom
3. Review Summaries Agent
According to industry insights, a whopping 98% of customers read reviews before deciding on a purchase. Social proof is a crucial builder of trust, but shoppers don’t always have the time to sift through hundreds of product reviews! This is where AI can help.
The Review Summaries agent analyzes customer feedback to generate concise summaries of customer ratings and sentiment. We’ve observed that shoppers tend to scan reviews rather than read them word-for-word, so making this information instantly accessible is a game-changer. This AI agent allows you to provide social proof more efficiently, helping shoppers feel more confident and ready to buy.
Here’s an example of how it looks:
How StoreAgents Review Summaries AI enhances product pages with key takeaways click to zoom
4. Product Summaries Agent
Make shopping easier for customers by providing an informative product summary for all your listings. Long descriptions might overwhelm shoppers–too much information can be just as bad as too little! The Product Summaries AI agent generates short, compelling product overviews to help you highlight product benefits and key details easily. Aside from saving you time from additional copywriting, it also enhances the shopper buying experience.
5. Product Tag Generator
Product tags help shoppers find products quickly while keeping your store more organized and easier to navigate. With the Product Tag Generator, you can easily generate relevant, AI-powered product tags, to ensure better searchability and categorization. Automating this process can help your customers find exactly what they’re looking for faster, leading to better product discovery and increased conversions!
6. Error Log Monitoring Agent
As we’ve discovered earlier, shoppers can leave after a single negative experience. Something as simple as a broken link or a slow checkout process can drive eager shoppers away. The key to ensuring a smooth shopping experience is being proactive–fixing critical errors before they escalate into bigger problems. This agent helps store owners stay ahead of potential issues by tracking site errors in real time and providing automated alerts.
7. Product Page Auditor
Your product pages can make or break a sale. After all, they serve as your digital storefront. With the Product Page Auditor, you can easily optimize your product pages for better conversions. This AI agent provides store owners with data-backed recommendations to refine product page layout, content, and overall structure for better engagement and sales. So, instead of blindly wondering about what works, this agent gives you actionable insights to fine-tune your product pages for maximum impact.
Level Up Your WooCommerce Store with StoreAgent and Advanced Coupons
Here’s the thing: running a successful online business is not just about attracting customers. It’s about engaging and keeping them coming back for the long haul. This is where StoreAgent and Advanced Coupons can help! These WooCommerce plugins are a powerful duo for optimizing and supercharging your store’s growth.
StoreAgent automates your store management, freeing up time and ensuring smooth operations.
Advanced Coupons enhances your store’s marketing strategy by offering powerful discount and loyalty tools that keep customers coming back.
With both tools in your arsenal, you can:
Supercharge your WooCommerce store with StoreAgent Advanced Coupons click to zoom
Boost your discount strategy with compelling product descriptions
StoreAgent creates SEO-optimized, engaging product descriptions that highlight key selling points. When paired with irresistible promotions from Advanced Coupons, your discounts become even more persuasive—helping convert more shoppers and maximize sales!
Create a more rewarding shopping experience
StoreAgent automates essential backend operations, while Advanced Coupons ensures that shoppers get compelling deals and exclusive offers—creating an experience that customers love and remember.
Automate and enhance promotional messaging
With Advanced Coupons, you can set up discount rules, loyalty rewards, and scheduled promotions. StoreAgent’s AI-powered product summaries and review summaries ensure that these promotions are displayed with clear, persuasive messaging on product pages and summaries, helping you drive more conversions!
Conclusion
If you’re not integrating AI into your WooCommerce store just yet, then you’re missing out! WooCommerce AI tools can help you automate repetitive tasks, create tailored shopping experiences, and optimize store performance. In this guide, we explored the key benefits of AI in retail and introduced you to StoreAgent, a game-changing WooCommerce AI plugin.
Let’s walk through some of the key things we’ve discussed:
What Is A WooCommerce AI Tool?
Key Benefits Of AI Retail
StoreAgent: The WooCommerce AI Plugin That Automates And Optimizes Your Store
How To Level Up Your Store With StoreAgent And Advanced Coupons
StoreAgent and Advanced Coupons are the perfect tools for store owners looking to leverage AI-powered automation while maximizing their revenue potential. StoreAgent handles AI-driven store management and Advanced Coupons allows you to create advanced discounts and loyalty promotions–the best of both worlds!
We hope this guide helped you out! Do you have any questions about WooCommerce AI tools and how they can help you grow your business? Let us know–we’re here to help! 😊
Very good, gangs hunters, prepare to upload your savings game because Sam’s Club is about to become her new best friend. At this time, as part of the sale of its presidents, you can obtain a membership by Justo $ 20.
Yes, that’s 60% discount The regular price of $ 50! If you have been waiting for you to finally be a signal, this is. But let’s not stop alone in the deal. I will share some intelligent ways that you can also make that membership work in extra time for you too. You are welcome.
How to maximize your membership
Now that you are in the fast track to join Sam’s Club, let’s see how you can stretch that investment of $ 20. Being a member is not just about saving money, it’s about making life easier and more intelligent.
Do you want to save money and avoid the dreaded question of “what’s for dinner”? Sam’s Club can help you stock up on all the essential elements to facilitate meal preparation. Buy in bulk meals and prepare throughout the week! Here is a combo that will cause the greatness of meal preparation:
Take your packages in beef or ground chicken to cook and freeze.
ABOX your pantry with rice, pasta or quinoa for easy sides (hello, carbohydrates).
Do not forget the Fresh Products section: You can cut, portion and bag vegetables for fast snacks or sauteed kits.
Pinterest idea: Create a Mason’s bottle salad station! Use Sam’s Mason’s bottles and take them with layers of vegetables, proteins and dressings, all of bulk portions. It is convenient, healthy and looks super cute in its refrigerator (read Instagram’s gold).
2. Give bulk purchases a creative touch
Buying in bulk does not mean wasting food or drowning in snacks. It’s about thinking about it. For example, take those boxes of bars or marola chips of mega size in Sam’s Club. Use them for:
Build affordable snack packages for school or work.
Create personalized gift bags for birthday parties or team events.
Moment of Vibes de Pinterest? Use chips bags the size of a snack to make mini piñatas or party favors for children’s birthdays!
Do you want even easier things? Sam’s Club regularly offers kits all in one for parties and events, from sandwiches trays to dessert dishes. Ah, and your frozen section? Perfect for quick comforting foods (we are talking about pizza and gofres rolls for days).
3. Holidays and parties with a budget
Organizing people can be expensive, but not if you have a Sam’s Club card. The dishes of his party are super affordable, and can obtain thematic supplies and bulk supplies such as cups, dishes and utensils for any meeting. And you do not sleep in its floral department, it is a beautiful already a price less than the specialized stores.
Idea worthy of Pinterest: Buy Mini Mason Jars by Sam’s Club, fill them with bulk sweets and put them with printable labels for personalized party favors. Ideal for weddings, Baby Showers or, Devils, on Tuesday afternoon.
4. Save on the essential elements of the home
Laundry detergent, paper towels, cleaning products, you know, the It is not fun but totally necessary stuff. Sam’s Club has those giant packages of essential elements at much better prices than most groceries. Buy them once and be ready for months. Less shopping trips = more time for things like seeing your favorite programs.
Hack Pinterest: Convert bulk cleaning supplies into a nice DIY project of home organizer! Gócalos in transparent jars or containers, tag them with slate stickers and voilà: functional fantasy and Pinterest level.
5. Exclusive offers on great savings
Another secret weapon? You will find good crazy prices in everything from electronics to mattresses. Do you need a new iPhone? A grill for outdoor meals? Verify the Sam Club first. In addition, its health and beauty section often carries brand products at better prices, and maybe even some luxury robberies (think of skin care and hair care care brands).
Final thoughts
There you have it, it is not only this offer of the presidents of the presidents of $ 20 the perfect excuse to join Sam’s Club finally, but it is also your gold ticket for a more friendly life for the budget and worthy of Pinterest. Whether you are preparing, buying vacations or simply tired of paying more essential, savings are endless.
Don’t forget, this one 60% discount The membership agreement ends February 26And once he is gone, he has gone. Register online Or go to your local Sam Club and start enjoying all the advantages. Happy bulk purchase!
PD: If you make those mason bottle salads or mini sweet bottles, tag in Pinterest; I need to see your brilliance in action.
See the places of interest in Madrid and Barcelona, with a customizable itinerary. It will fly to Madrid and outside of Barcelona, with international round trip tickets included, and hundreds of hotels to choose from, while you can choose the duration of your stay in each city, and which of the optional activities you want to add to your trip (at an additional cost). Reserve this travel agreement before July 31.
Start planning your summer empties and autumn with all our best travel offers. Buy now in tripmasters
“;outerWrapper.insertAdjacentHTML(getInsertPosition(options.navPosition),navHtml);navContainer=outerWrapper.querySelector(“.tns-nav”);navItems=navContainer.children}updateNavVisibility();if(TRANSITIONDURATION){var prefix=TRANSITIONDURATION.substring(0,TRANSITIONDURATION.length-18).toLowerCase(),str=”transition: all “+speed/1000+”s”;if(prefix){str=”-“+prefix+”-“+str}addCSSRule(sheet,”(aria-controls^=”+slideId+”-item)”,str,getCssRulesLength(sheet))}setAttrs(navItems(navCurrentIndex),{“aria-label”:navStr+(navCurrentIndex+1)+navStrCurrent});removeAttrs(navItems(navCurrentIndex),”tabindex”);addClass(navItems(navCurrentIndex),navActiveClass);addEvents(navContainer,navEvents)}if(hasControls){if(!controlsContainer&&(!prevButton||!nextButton)){outerWrapper.insertAdjacentHTML(getInsertPosition(options.controlsPosition),”
“);controlsContainer=outerWrapper.querySelector(“.tns-controls”)}if(!prevButton||!nextButton){prevButton=controlsContainer.children(0);nextButton=controlsContainer.children(1)}if(options.controlsContainer){setAttrs(controlsContainer,{“aria-label”:”Carousel Navigation”,”tabindex”:”0″})}if(options.controlsContainer||options.prevButton&&options.nextButton){setAttrs((prevButton,nextButton),{“aria-controls”:slideId,”tabindex”:”-1″})}if(options.controlsContainer||options.prevButton&&options.nextButton){setAttrs(prevButton,{“data-controls”:”prev”});setAttrs(nextButton,{“data-controls”:”next”})}prevIsButton=isButton(prevButton);nextIsButton=isButton(nextButton);updateControlsStatus();if(controlsContainer){addEvents(controlsContainer,controlsEvents)}else{addEvents(prevButton,controlsEvents);addEvents(nextButton,controlsEvents)}}disableUI()}function initEvents(){if(carousel&&TRANSITIONEND){var eve={};eve(TRANSITIONEND)=onTransitionEnd;addEvents(container,eve)}if(touch){addEvents(container,touchEvents,options.preventScrollOnTouch)}if(mouseDrag){addEvents(container,dragEvents)}if(arrowKeys){addEvents(doc,docmentKeydownEvent)}if(nested===”inner”){events.on(“outerResized”,function(){resizeTasks();events.emit(“innerLoaded”,info())})}else if(responsive||fixedWidth||autoWidth||autoHeight||!horizontal){addEvents(win,{“resize”:onResize})}if(autoHeight){if(nested===”outer”){events.on(“innerLoaded”,doAutoHeight)}else if(!disable){doAutoHeight()}}doLazyLoad();if(disable){disableSlider()}else if(freeze){freezeSlider()}events.on(“indexChanged”,additionalUpdates);if(nested===”inner”){events.emit(“innerLoaded”,info())}if(typeof onInit===”function”){onInit(info())}isOn=true}function destroy(){sheet.disabled=true;if(sheet.ownerNode){sheet.ownerNode.remove()}removeEvents(win,{“resize”:onResize});if(arrowKeys){removeEvents(doc,docmentKeydownEvent)}if(controlsContainer){removeEvents(controlsContainer,controlsEvents)}if(navContainer){removeEvents(navContainer,navEvents)}removeEvents(container,hoverEvents);removeEvents(container,visibilityEvent);if(autoplayButton){removeEvents(autoplayButton,{“click”:toggleAutoplay})}if(autoplay){clearInterval(autoplayTimer)}if(carousel&&TRANSITIONEND){var eve={};eve(TRANSITIONEND)=onTransitionEnd;removeEvents(container,eve)}if(touch){removeEvents(container,touchEvents)}if(mouseDrag){removeEvents(container,dragEvents)}var htmlList=(containerHTML,controlsContainerHTML,prevButtonHTML,nextButtonHTML,navContainerHTML,autoplayButtonHTML);tnsList.forEach(function(item,i){var el=item===”container”?outerWrapper:options(item);if(typeof el===”object”){var prevEl=el.previousElementSibling?el.previousElementSibling:false,parentEl=el.parentNode;el.outerHTML=htmlList(i);options(item)=prevEl?prevEl.nextElementSibling:parentEl.firstElementChild}});tnsList=animateIn=animateOut=animateDelay=animateNormal=horizontal=outerWrapper=innerWrapper=container=containerParent=containerHTML=slideItems=slideCount=breakpointZone=windowWidth=autoWidth=fixedWidth=edgePadding=gutter=viewport=items=slideBy=viewportMax=arrowKeys=speed=rewind=loop=autoHeight=sheet=lazyload=slidePositions=slideItemsOut=cloneCount=slideCountNew=hasRightDeadZone=rightBoundary=updateIndexBeforeTransform=transformAttr=transformPrefix=transformPostfix=getIndexMax=index=indexCached=indexMin=indexMax=resizeTimer=swipeAngle=moveDirectionExpected=running=onInit=events=newContainerClasses=slideId=disable=disabled=freezable=freeze=frozen=controlsEvents=navEvents=hoverEvents=visibilityEvent=docmentKeydownEvent=touchEvents=dragEvents=hasControls=hasNav=navAsThumbnails=hasAutoplay=hasTouch=hasMouseDrag=slideActiveClass=imgCompleteClass=imgEvents=imgsComplete=controls=controlsText=controlsContainer=controlsContainerHTML=prevButton=nextButton=prevIsButton=nextIsButton=nav=navContainer=navContainerHTML=navItems=pages=pagesCached=navClicked=navCurrentIndex=navCurrentIndexCached=navActiveClass=navStr=navStrCurrent=autoplay=autoplayTimeout=autoplayDirection=autoplayText=autoplayHoverPause=autoplayButton=autoplayButtonHTML=autoplayResetOnVisibility=autoplayHtmlStrings=autoplayTimer=animating=autoplayHoverPaused=autoplayUserPaused=autoplayVisibilityPaused=initPosition=lastPosition=translateInit=disX=disY=panStart=rafIndex=getDist=touch=mouseDrag=null;for(var a in this){if(a!==”rebuild”){this(a)=null}}isOn=false}function onResize(e){raf(function(){resizeTasks(getEvent(e))})}function resizeTasks(e){if(!isOn){return}if(nested===”outer”){events.emit(“outerResized”,info(e))}windowWidth=getWindowWidth();var bpChanged,breakpointZoneTem=breakpointZone,needContainerTransform=false;if(responsive){setBreakpointZone();bpChanged=breakpointZoneTem!==breakpointZone;if(bpChanged){events.emit(“newBreakpointStart”,info(e))}}var indChanged,itemsChanged,itemsTem=items,disableTem=disable,freezeTem=freeze,arrowKeysTem=arrowKeys,controlsTem=controls,navTem=nav,touchTem=touch,mouseDragTem=mouseDrag,autoplayTem=autoplay,autoplayHoverPauseTem=autoplayHoverPause,autoplayResetOnVisibilityTem=autoplayResetOnVisibility,indexTem=index;if(bpChanged){var fixedWidthTem=fixedWidth,autoHeightTem=autoHeight,controlsTextTem=controlsText,centerTem=center,autoplayTextTem=autoplayText;if(!CSSMQ){var gutterTem=gutter,edgePaddingTem=edgePadding}}arrowKeys=getOption(“arrowKeys”);controls=getOption(“controls”);nav=getOption(“nav”);touch=getOption(“touch”);center=getOption(“center”);mouseDrag=getOption(“mouseDrag”);autoplay=getOption(“autoplay”);autoplayHoverPause=getOption(“autoplayHoverPause”);autoplayResetOnVisibility=getOption(“autoplayResetOnVisibility”);if(bpChanged){disable=getOption(“disable”);fixedWidth=getOption(“fixedWidth”);speed=getOption(“speed”);autoHeight=getOption(“autoHeight”);controlsText=getOption(“controlsText”);autoplayText=getOption(“autoplayText”);autoplayTimeout=getOption(“autoplayTimeout”);if(!CSSMQ){edgePadding=getOption(“edgePadding”);gutter=getOption(“gutter”)}}resetVariblesWhenDisable(disable);viewport=getViewportWidth();if((!horizontal||autoWidth)&&!disable){setSlidePositions();if(!horizontal){updateContentWrapperHeight();needContainerTransform=true}}if(fixedWidth||autoWidth){rightBoundary=getRightBoundary();indexMax=getIndexMax()}if(bpChanged||fixedWidth){items=getOption(“items”);slideBy=getOption(“slideBy”);itemsChanged=items!==itemsTem;if(itemsChanged){if(!fixedWidth&&!autoWidth){indexMax=getIndexMax()}updateIndex()}}if(bpChanged){if(disable!==disableTem){if(disable){disableSlider()}else{enableSlider()}}}if(freezable&&(bpChanged||fixedWidth||autoWidth)){freeze=getFreeze();if(freeze!==freezeTem){if(freeze){doContainerTransform(getContainerTransformValue(getStartIndex(0)));freezeSlider()}else{unfreezeSlider();needContainerTransform=true}}}resetVariblesWhenDisable(disable||freeze);if(!autoplay){autoplayHoverPause=autoplayResetOnVisibility=false}if(arrowKeys!==arrowKeysTem){arrowKeys?addEvents(doc,docmentKeydownEvent):removeEvents(doc,docmentKeydownEvent)}if(controls!==controlsTem){if(controls){if(controlsContainer){showElement(controlsContainer)}else{if(prevButton){showElement(prevButton)}if(nextButton){showElement(nextButton)}}}else{if(controlsContainer){hideElement(controlsContainer)}else{if(prevButton){hideElement(prevButton)}if(nextButton){hideElement(nextButton)}}}}if(nav!==navTem){nav?showElement(navContainer):hideElement(navContainer)}if(touch!==touchTem){touch?addEvents(container,touchEvents,options.preventScrollOnTouch):removeEvents(container,touchEvents)}if(mouseDrag!==mouseDragTem){mouseDrag?addEvents(container,dragEvents):removeEvents(container,dragEvents)}if(autoplay!==autoplayTem){if(autoplay){if(autoplayButton){showElement(autoplayButton)}if(!animating&&!autoplayUserPaused){startAutoplay()}}else{if(autoplayButton){hideElement(autoplayButton)}if(animating){stopAutoplay()}}}if(autoplayHoverPause!==autoplayHoverPauseTem){autoplayHoverPause?addEvents(container,hoverEvents):removeEvents(container,hoverEvents)}if(autoplayResetOnVisibility!==autoplayResetOnVisibilityTem){autoplayResetOnVisibility?addEvents(doc,visibilityEvent):removeEvents(doc,visibilityEvent)}if(bpChanged){if(fixedWidth!==fixedWidthTem||center!==centerTem){needContainerTransform=true}if(autoHeight!==autoHeightTem){if(!autoHeight){innerWrapper.style.height=””}}if(controls&&controlsText!==controlsTextTem){prevButton.innerHTML=controlsText(0);nextButton.innerHTML=controlsText(1)}if(autoplayButton&&autoplayText!==autoplayTextTem){var i=autoplay?1:0,html=autoplayButton.innerHTML,len=html.length-autoplayTextTem(i).length;if(html.substring(len)===autoplayTextTem(i)){autoplayButton.innerHTML=html.substring(0,len)+autoplayText(i)}}}else{if(center&&(fixedWidth||autoWidth)){needContainerTransform=true}}if(itemsChanged||fixedWidth&&!autoWidth){pages=getPages();updateNavVisibility()}indChanged=index!==indexTem;if(indChanged){events.emit(“indexChanged”,info());needContainerTransform=true}else if(itemsChanged){if(!indChanged){additionalUpdates()}}else if(fixedWidth||autoWidth){doLazyLoad();updateSlideStatus();updateLiveRegion()}if(itemsChanged||!carousel){updateGallerySlidePositions()}if(!disable&&!freeze){if(bpChanged&&!CSSMQ){if(autoHeight!==autoheightTem||speed!==speedTem){update_carousel_transition_duration()}if(edgePadding!==edgePaddingTem||gutter!==gutterTem){innerWrapper.style.cssText=getInnerWrapperStyles(edgePadding,gutter,fixedWidth,speed,autoHeight)}if(horizontal){if(carousel){container.style.width=getContainerWidth(fixedWidth,gutter,items)}var str=getSlideWidthStyle(fixedWidth,gutter,items)+getSlideGutterStyle(gutter);removeCSSRule(sheet,getCssRulesLength(sheet)-1);addCSSRule(sheet,”#”+slideId+” > .tns-item”,str,getCssRulesLength(sheet))}}if(autoHeight){doAutoHeight()}if(needContainerTransform){doContainerTransformSilent();indexCached=index}}if(bpChanged){events.emit(“newBreakpointEnd”,info(e))}}function getFreeze(){if(!fixedWidth&&!autoWidth){var a=center?items-(items-1)/2:items;return slideCount<=a}var width=fixedWidth?(fixedWidth+gutter)*slideCount:slidePositions(slideCount),vp=edgePadding?viewport+edgePadding*2:viewport+gutter;if(center){vp-=fixedWidth?(viewport-fixedWidth)/2:(viewport-(slidePositions(index+1)-slidePositions(index)-gutter))/2}return width=bp){breakpointZone=bp}}}var updateIndex=function(){return loop?carousel?function(){var leftEdge=indexMin,rightEdge=indexMax;leftEdge+=slideBy;rightEdge-=slideBy;if(edgePadding){leftEdge+=1;rightEdge-=1}else if(fixedWidth){if((viewport+gutter)%(fixedWidth+gutter)){rightEdge-=1}}if(cloneCount){if(index>rightEdge){index-=slideCount}else if(indexindexMax){while(index>=indexMin+slideCount){index-=slideCount}}else if(index<indexMin){while(index<=indexMax-slideCount){index+=slideCount}}}:function(){index=Math.max(indexMin,Math.min(indexMax,index))}}();function disableUI(){if(!autoplay&&autoplayButton){hideElement(autoplayButton)}if(!nav&&navContainer){hideElement(navContainer)}if(!controls){if(controlsContainer){hideElement(controlsContainer)}else{if(prevButton){hideElement(prevButton)}if(nextButton){hideElement(nextButton)}}}}function enableUI(){if(autoplay&&autoplayButton){showElement(autoplayButton)}if(nav&&navContainer){showElement(navContainer)}if(controls){if(controlsContainer){showElement(controlsContainer)}else{if(prevButton){showElement(prevButton)}if(nextButton){showElement(nextButton)}}}}function freezeSlider(){if(frozen){return}if(edgePadding){innerWrapper.style.margin="0px"}if(cloneCount){var str="tns-transparent";for(var i=cloneCount;i–;){if(carousel){addClass(slideItems(i),str)}addClass(slideItems(slideCountNew-i-1),str)}}disableUI();frozen=true}function unfreezeSlider(){if(!frozen){return}if(edgePadding&&CSSMQ){innerWrapper.style.margin=""}if(cloneCount){var str="tns-transparent";for(var i=cloneCount;i–;){if(carousel){removeClass(slideItems(i),str)}removeClass(slideItems(slideCountNew-i-1),str)}}enableUI();frozen=false}function disableSlider(){if(disabled){return}sheet.disabled=true;container.className=container.className.replace(newContainerClasses.substring(1),"");removeAttrs(container,("style"));if(loop){for(var j=cloneCount;j–;){if(carousel){hideElement(slideItems(j))}hideElement(slideItems(slideCountNew-j-1))}}if(!horizontal||!carousel){removeAttrs(innerWrapper,("style"))}if(!carousel){for(var i=index,l=index+slideCount;i<l;i++){var item=slideItems(i);removeAttrs(item,("style"));removeClass(item,animateIn);removeClass(item,animateNormal)}}disableUI();disabled=true}function enableSlider(){if(!disabled){return}sheet.disabled=false;container.className+=newContainerClasses;doContainerTransformSilent();if(loop){for(var j=cloneCount;j–;){if(carousel){showElement(slideItems(j))}showElement(slideItems(slideCountNew-j-1))}}if(!carousel){for(var i=index,l=index+slideCount;i<l;i++){var item=slideItems(i),classN=i<index+items?animateIn:animateNormal;item.style.left=(i-index)*100/items+"%";addClass(item,classN)}}enableUI();disabled=false}function updateLiveRegion(){var str=getLiveRegionStr();if(liveregionCurrent.innerHTML!==str){liveregionCurrent.innerHTML=str}}function getLiveRegionStr(){var arr=getVisibleSlideRange(),start=arr(0)+1,end=arr(1)+1;return start===end?start+"":start+" to "+end}function getVisibleSlideRange(val){if(val==null){val=getContainerTransformValue()}var start=index,end,rangestart,rangeend;if(center||edgePadding){if(autoWidth||fixedWidth){rangestart=-(parseFloat(val)+edgePadding);rangeend=rangestart+viewport+edgePadding*2}}else{if(autoWidth){rangestart=slidePositions(index);rangeend=rangestart+viewport}}if(autoWidth){slidePositions.forEach(function(point,i){if(i<slideCountNew){if((center||edgePadding)&&point=0.5){end=i}}})}else{if(fixedWidth){var cell=fixedWidth+gutter;if(center||edgePadding){start=Math.floor(rangestart/cell);end=Math.ceil(rangeend/cell-1)}else{end=start+Math.ceil(viewport/cell)-1}}else{if(center||edgePadding){var a=items-1;if(center){start-=a/2;end=index+a/2}else{end=index+a}if(edgePadding){var b=edgePadding*items/viewport;start-=b;end+=b}start=Math.floor(start);end=Math.ceil(end)}else{end=start+items-1}}start=Math.max(start,0);end=Math.min(end,slideCountNew-1)}return(start,end)}function doLazyLoad(){if(lazyload&&!disable){getImageArray.apply(null,getVisibleSlideRange()).forEach(function(img){if(!hasClass(img,imgCompleteClass)){var eve={};eve(TRANSITIONEND)=function(e){e.stopPropagation()};addEvents(img,eve);addEvents(img,imgEvents);img.src=getAttr(img,”data-src”);var srcset=getAttr(img,”data-srcset”);if(srcset){img.srcset=srcset}addClass(img,”loading”)}})}}function onImgLoaded(e){imgLoaded(getTarget(e))}function onImgFailed(e){imgFailed(getTarget(e))}function imgLoaded(img){addClass(img,”loaded”);imgCompleted(img)}function imgFailed(img){addClass(img,”failed”);imgCompleted(img)}function imgCompleted(img){addClass(img,”tns-complete”);removeClass(img,”loading”);removeEvents(img,imgEvents)}function getImageArray(start,end){var imgs=();while(start<=end){forEach(slideItems(start).querySelectorAll("img"),function(img){imgs.push(img)});start++}return imgs}function doAutoHeight(){var imgs=getImageArray.apply(null,getVisibleSlideRange());raf(function(){imgsLoadedCheck(imgs,updateInnerWrapperHeight)})}function imgsLoadedCheck(imgs,cb){if(imgsComplete){return cb()}imgs.forEach(function(img,index){if(hasClass(img,imgCompleteClass)){imgs.splice(index,1)}});if(!imgs.length){return cb()}raf(function(){imgsLoadedCheck(imgs,cb)})}function additionalUpdates(){doLazyLoad();updateSlideStatus();updateLiveRegion();updateControlsStatus();updateNavStatus()}function update_carousel_transition_duration(){if(carousel&&autoHeight){middleWrapper.style(TRANSITIONDURATION)=speed/1000+"s"}}function getMaxSlideHeight(slideStart,slideRange){var heights=();for(var i=slideStart,l=Math.min(slideStart+slideRange,slideCountNew);i=start&&i=index&&i=0?navClicked:getCurrentNavIndex();navClicked=-1;if(navCurrentIndex!==navCurrentIndexCached){var navPrev=navItems(navCurrentIndexCached),navCurrent=navItems(navCurrentIndex);setAttrs(navPrev,{“tabindex”:”-1″,”aria-label”:navStr+(navCurrentIndexCached+1)});removeClass(navPrev,navActiveClass);setAttrs(navCurrent,{“aria-label”:navStr+(navCurrentIndex+1)+navStrCurrent});removeAttrs(navCurrent,”tabindex”);addClass(navCurrent,navActiveClass);navCurrentIndexCached=navCurrentIndex}}}function getLowerCaseNodeName(el){return el.nodeName.toLowerCase()}function isButton(el){return getLowerCaseNodeName(el)===”button”}function isAriaDisabled(el){return el.getAttribute(“aria-disabled”)===”true”}function disEnableElement(isButton,el,val){if(isButton){el.disabled=val}else{el.setAttribute(“aria-disabled”,val.toString())}}function updateControlsStatus(){if(!controls||rewind||loop){return}var prevDisabled=prevIsButton?prevButton.disabled:isAriaDisabled(prevButton),nextDisabled=nextIsButton?nextButton.disabled:isAriaDisabled(nextButton),disablePrev=index=indexMax?true:false;if(disablePrev&&!prevDisabled){disEnableElement(prevIsButton,prevButton,true)}if(!disablePrev&&prevDisabled){disEnableElement(prevIsButton,prevButton,false)}if(disableNext&&!nextDisabled){disEnableElement(nextIsButton,nextButton,true)}if(!disableNext&&nextDisabled){disEnableElement(nextIsButton,nextButton,false)}}function resetDuration(el,str){if(TRANSITIONDURATION){el.style(TRANSITIONDURATION)=str}}function getSliderWidth(){return fixedWidth?(fixedWidth+gutter)*slideCountNew:slidePositions(slideCountNew)}function getCenterGap(num){if(num==null){num=index}var gap=edgePadding?gutter:0;return autoWidth?(viewport-gap-(slidePositions(num+1)-slidePositions(num)-gutter))/2:fixedWidth?(viewport-fixedWidth)/2:(items-1)/2}function getRightBoundary(){var gap=edgePadding?gutter:0,result=viewport+gap-getSliderWidth();if(center&&!loop){result=fixedWidth?-(fixedWidth+gutter)*(slideCountNew-1)-getCenterGap():getCenterGap(slideCountNew-1)-slidePositions(slideCountNew-1)}if(result>0){result=0}return result}function getContainerTransformValue(num){if(num==null){num=index}var val;if(horizontal&&!autoWidth){if(fixedWidth){val=-(fixedWidth+gutter)*num;if(center){val+=getCenterGap()}}else{var denominator=TRANSFORM?slideCountNew:items;if(center){num-=getCenterGap()}val=-num*100/denominator}}else{val=-slidePositions(num);if(center&&autoWidth){val+=getCenterGap()}}if(hasRightDeadZone){val=Math.max(val,rightBoundary)}val+=horizontal&&!autoWidth&&!fixedWidth?”%”:”px”;return val}function doContainerTransformSilent(val){resetDuration(container,”0s”);doContainerTransform(val)}function doContainerTransform(val){if(val==null){val=getContainerTransformValue()}container.style(transformAttr)=transformPrefix+val+transformPostfix}function animateSlide(number,classOut,classIn,isOut){var l=number+items;if(!loop){l=Math.min(l,slideCountNew)}for(var i=number;i=0){stopAutoplay()}running=true;transformCore()}}function strTrans(str){return str.toLowerCase().replace(/-/g,””)}function onTransitionEnd(event){if(carousel||running){events.emit(“transitionEnd”,info(event));if(!carousel&&slideItemsOut.length>0){for(var i=0;i<slideItemsOut.length;i++){var item=slideItemsOut(i);item.style.left="";if(ANIMATIONDELAY&&TRANSITIONDELAY){item.style(ANIMATIONDELAY)="";item.style(TRANSITIONDELAY)=""}removeClass(item,animateOut);addClass(item,animateNormal)}}if(!event||!carousel&&event.target.parentNode===container||event.target===container&&strTrans(event.propertyName)===strTrans(transformAttr)){if(!updateIndexBeforeTransform){var indexTem=index;updateIndex();if(index!==indexTem){events.emit("indexChanged",info());doContainerTransformSilent()}}if(nested==="inner"){events.emit("innerLoaded",info())}running=false;indexCached=index}}}function goTo(targetIndex,e){if(freeze){return}if(targetIndex==="prev"){onControlsClick(e,-1)}else if(targetIndex==="next"){onControlsClick(e,1)}else{if(running){if(preventActionWhenRunning){return}else{onTransitionEnd()}}var absIndex=getAbsIndex(),indexGap=0;if(targetIndex==="first"){indexGap=-absIndex}else if(targetIndex==="last"){indexGap=carousel?slideCount-items-absIndex:slideCount-1-absIndex}else{if(typeof targetIndex!=="number"){targetIndex=parseInt(targetIndex)}if(!isNaN(targetIndex)){if(!e){targetIndex=Math.max(0,Math.min(slideCount-1,targetIndex))}indexGap=targetIndex-absIndex}}if(!carousel&&indexGap&&Math.abs(indexGap)0?1:-1;indexGap+=index+indexGap-slideCount>=indexMin?slideCount*factor:slideCount*2*factor*-1}index+=indexGap;if(carousel&&loop){if(indexindexMax){index-=slideCount}}if(getAbsIndex(index)!==getAbsIndex(indexCached)){render(e)}}}function onControlsClick(e,dir){if(running){if(preventActionWhenRunning){return}else{onTransitionEnd()}}var passEventObject;if(!dir){e=getEvent(e);var target=getTarget(e);while(target!==controlsContainer&&(prevButton,nextButton).indexOf(target)=0){passEventObject=true;dir=targetIn===0?-1:1}}if(rewind){if(index===indexMin&&dir===-1){goTo(“last”,e);return}else if(index===indexMax&&dir===1){goTo(“first”,e);return}}if(dir){index+=slideBy*dir;if(autoWidth){index=Math.floor(index)}render(passEventObject||e&&e.type===”keydown”?e:null)}}function onNavClick(e){if(running){if(preventActionWhenRunning){return}else{onTransitionEnd()}}e=getEvent(e);var target=getTarget(e),navIndex;while(target!==navContainer&&!hasAttr(target,”data-nav”)){target=target.parentNode}if(hasAttr(target,”data-nav”)){var navIndex=navClicked=Number(getAttr(target,”data-nav”)),targetIndexBase=fixedWidth||autoWidth?navIndex*slideCount/pages:navIndex*items,targetIndex=navAsThumbnails?navIndex:Math.min(Math.ceil(targetIndexBase),slideCount-1);goTo(targetIndex,e);if(navCurrentIndex===navIndex){if(animating){stopAutoplay()}navClicked=-1}}}function setAutoplayTimer(){autoplayTimer=setInterval(function(){onControlsClick(null,autoplayDirection)},autoplayTimeout);animating=true}function stopAutoplayTimer(){clearInterval(autoplayTimer);animating=false}function updateAutoplayButton(action,txt){setAttrs(autoplayButton,{“data-action”:action});autoplayButton.innerHTML=autoplayHtmlStrings(0)+action+autoplayHtmlStrings(1)+txt}function startAutoplay(){setAutoplayTimer();if(autoplayButton){updateAutoplayButton(“stop”,autoplayText(1))}}function stopAutoplay(){stopAutoplayTimer();if(autoplayButton){updateAutoplayButton(“start”,autoplayText(0))}}function play(){if(autoplay&&!animating){startAutoplay();autoplayUserPaused=false}}function pause(){if(animating){stopAutoplay();autoplayUserPaused=true}}function toggleAutoplay(){if(animating){stopAutoplay();autoplayUserPaused=true}else{startAutoplay();autoplayUserPaused=false}}function onVisibilityChange(){if(doc.hidden){if(animating){stopAutoplayTimer();autoplayVisibilityPaused=true}}else if(autoplayVisibilityPaused){setAutoplayTimer();autoplayVisibilityPaused=false}}function mouseoverPause(){if(animating){stopAutoplayTimer();autoplayHoverPaused=true}}function mouseoutRestart(){if(autoplayHoverPaused){setAutoplayTimer();autoplayHoverPaused=false}}function onDocumentKeydown(e){e=getEvent(e);var keyIndex=(KEYS.LEFT,KEYS.RIGHT).indexOf(e.keyCode);if(keyIndex>=0){onControlsClick(e,keyIndex===0?-1:1)}}function onControlsKeydown(e){e=getEvent(e);var keyIndex=(KEYS.LEFT,KEYS.RIGHT).indexOf(e.keyCode);if(keyIndex>=0){if(keyIndex===0){if(!prevButton.disabled){onControlsClick(e,-1)}}else if(!nextButton.disabled){onControlsClick(e,1)}}}function setFocus(el){el.focus()}function onNavKeydown(e){e=getEvent(e);var curElement=doc.activeElement;if(!hasAttr(curElement,”data-nav”)){return}var keyIndex=(KEYS.LEFT,KEYS.RIGHT,KEYS.ENTER,KEYS.SPACE).indexOf(e.keyCode),navIndex=Number(getAttr(curElement,”data-nav”));if(keyIndex>=0){if(keyIndex===0){if(navIndex>0){setFocus(navItems(navIndex-1))}}else if(keyIndex===1){if(navIndex=0}function preventDefaultBehavior(e){e.preventDefault?e.preventDefault():e.returnValue=false}function getMoveDirectionExpected(){return getTouchDirection(toDegree(lastPosition.y-initPosition.y,lastPosition.x-initPosition.x),swipeAngle)===options.axis}function onPanStart(e){if(running){if(preventActionWhenRunning){return}else{onTransitionEnd()}}if(autoplay&&animating){stopAutoplayTimer()}panStart=true;if(rafIndex){caf(rafIndex);rafIndex=null}var $=getEvent(e);events.emit(isTouchEvent(e)?”touchStart”:”dragStart”,info(e));if(!isTouchEvent(e)&&(“img”,”a”).indexOf(getLowerCaseNodeName(getTarget(e)))>=0){preventDefaultBehavior(e)}lastPosition.x=initPosition.x=$.clientX;lastPosition.y=initPosition.y=$.clientY;if(carousel){translateInit=parseFloat(container.style(transformAttr).replace(transformPrefix,””));resetDuration(container,”0s”)}}function onPanMove(e){if(panStart){var $=getEvent(e);lastPosition.x=$.clientX;lastPosition.y=$.clientY;if(carousel){if(!rafIndex){rafIndex=raf(function(){panUpdate(e)})}}else{if(moveDirectionExpected===”?”){moveDirectionExpected=getMoveDirectionExpected()}if(moveDirectionExpected){preventScroll=true}}if(preventScroll){e.preventDefault()}}}function panUpdate(e){if(!moveDirectionExpected){panStart=false;return}caf(rafIndex);if(panStart){rafIndex=raf(function(){panUpdate(e)})}if(moveDirectionExpected===”?”){moveDirectionExpected=getMoveDirectionExpected()}if(moveDirectionExpected){if(!preventScroll&&isTouchEvent(e)){preventScroll=true}try{if(e.type){events.emit(isTouchEvent(e)?”touchMove”:”dragMove”,info(e))}}catch(err){}var x=translateInit,dist=getDist(lastPosition,initPosition);if(!horizontal||fixedWidth||autoWidth){x+=dist;x+=”px”}else{var percentageX=TRANSFORM?dist*items*100/((viewport+gutter)*slideCountNew):dist*100/(viewport+gutter);x+=percentageX;x+=”%”}container.style(transformAttr)=transformPrefix+x+transformPostfix}}function onPanEnd(e){if(panStart){if(rafIndex){caf(rafIndex);rafIndex=null}if(carousel){resetDuration(container,””)}panStart=false;var $=getEvent(e);lastPosition.x=$.clientX;lastPosition.y=$.clientY;var dist=getDist(lastPosition,initPosition);if(Math.abs(dist)){if(!isTouchEvent(e)){var target=getTarget(e);addEvents(target,{“click”:function preventClick(e){preventDefaultBehavior(e);removeEvents(target,{“click”:preventClick})}})}if(carousel){rafIndex=raf(function(){if(horizontal&&!autoWidth){var indexMoved=-dist*items/(viewport+gutter);indexMoved=dist>0?Math.floor(indexMoved):Math.ceil(indexMoved);index+=indexMoved}else{var moved=-(translateInit+dist);if(moved=slidePositions(slideCountNew-1)){index=indexMax}else{var i=0;while(i=slidePositions(i)){index=i;if(moved>slidePositions(i)&&dist0?-1:1)}}}}if(options.preventScrollOnTouch===”auto”){preventScroll=false}if(swipeAngle){moveDirectionExpected=”?”}if(autoplay&&!animating){setAutoplayTimer()}}function updateContentWrapperHeight(){var wp=middleWrapper?middleWrapper:innerWrapper;wp.style.height=slidePositions(index+items)-slidePositions(index)+”px”}function getPages(){var rough=fixedWidth?(fixedWidth+gutter)*slideCount/viewport:slideCount/items;return Math.min(Math.ceil(rough),slideCount)}function updateNavVisibility(){if(!nav||navAsThumbnails){return}if(pages!==pagesCached){var min=pagesCached,max=pages,fn=showElement;if(pagesCached>pages){min=pages;max=pagesCached;fn=hideElement}while(min<max){fn(navItems(min));min++}pagesCached=pages}}function info(e){return{container:container,slideItems:slideItems,navContainer:navContainer,navItems:navItems,controlsContainer:controlsContainer,hasControls:hasControls,prevButton:prevButton,nextButton:nextButton,items:items,slideBy:slideBy,cloneCount:cloneCount,slideCount:slideCount,slideCountNew:slideCountNew,index:index,indexCached:indexCached,displayIndex:getCurrentSlide(),navCurrentIndex:navCurrentIndex,navCurrentIndexCached:navCurrentIndexCached,pages:pages,pagesCached:pagesCached,sheet:sheet,isOn:isOn,event:e||{}}}return{version:"2.9.1",getInfo:info,events:events,goTo:goTo,play:play,pause:pause,isOn:isOn,updateSliderHeight:updateInnerWrapperHeight,refresh:initSliderTransform,destroy:destroy,rebuild:function(){return tns(extend(options,optionsElements))}}};return tns}();
/* save_content */
DN.saveContent=function(element){this.contentElement=element;this.contentId=element.getAttribute("data-id");this.contentType=element.getAttribute("data-type");this.source="site-"+DN.pageData.publication_id+"-"+DN.pageData.type;if(deviceTarget){this.source+="-"+deviceTarget}var subSource=element.getAttribute("data-sub-source");if(!DN.empty(subSource)){this.source+="-"+subSource}this.saveURL=document.location.protocol+"//"+document.location.hostname+"/async/content/save/";this.removeURL=document.location.protocol+"//"+document.location.hostname+"/async/content/remove/";this.xhr=null;this.doAction=function(remove){var params="";var url=null;params+="content_id="+encodeURIComponent(this.contentId);params+="&content_type="+encodeURIComponent(this.contentType);if(remove){url=this.removeURL}else{url=this.saveURL;params+="&source="+encodeURIComponent(this.source)}this.xhr=new DN.xhr(url,this.handleResponse,params,this)};this.handleResponse=function(responseText){if(responseText!==undefined){var data=JSON.parse(responseText);if(data("success")){var title=this.contentElement.getAttribute("data-title");if(title==undefined||title.length==0){title="This Content"}if(data("removed")){title="Click To Save "+title;if(DN.hasClass(this.contentElement,"icon-saved-heart")){DN.swapClass(this.contentElement,"icon-saved-heart","icon-unsaved-heart");DN.swapClass(this.contentElement,"remove-content","save-content");this.contentElement.setAttribute("aria-label",title);this.contentElement.setAttribute("title",title)}else if(DN.hasClass(this.contentElement,"material-save-heart")){DN.swapClass(this.contentElement,"remove-content","save-content");DN.get("svg.icon use",this.contentElement).setAttribute("xlink:href","#ic-save");this.contentElement.setAttribute("aria-label",title);this.contentElement.setAttribute("title",title)}else{var parent=this.contentElement.parentNode;while(!DN.hasClass(parent,"tile")){parent=parent.parentNode;if(!parent){break}}if(parent){parent.style.opacity=0.25;element.style.visibility="hidden"}if(DN.hasClass(this.contentElement.parentNode,"saved-content")){this.contentElement.parentNode.style.display="none";var saveButton=DN.get(".save-content",this.contentElement.parentNode.parentNode);if(saveButton){saveButton.style.display="inline-block"}if(parent){parent.style.opacity=1;this.contentElement.style.visibility="visible"}}}DN.saveContentHandler.afterUnsave.fire(this.contentElement)}else{title="Click To Unsave "+title;if(DN.hasClass(this.contentElement,"icon-unsaved-heart")){DN.swapClass(this.contentElement,"icon-unsaved-heart","icon-saved-heart");DN.swapClass(this.contentElement,"save-content","remove-content");this.contentElement.setAttribute("aria-label",title);this.contentElement.setAttribute("title",title)}else if(DN.hasClass(this.contentElement,"material-save-heart")){DN.swapClass(this.contentElement,"save-content","remove-content");DN.get("svg.icon use",this.contentElement).setAttribute("xlink:href","#ic-save-checked");this.contentElement.setAttribute("aria-label",title);this.contentElement.setAttribute("title",title)}else{savedURL="https://"+document.location.hostname+"/mydealnews/saved/";this.contentElement.style.display="none";var savedDiv=DN.get(".saved-content",this.contentElement.parentNode);if(savedDiv){savedDiv.style.display="inline-block"}else{newEl=document.createElement("span");newEl.className="saved-content";newEl.innerHTML="Saved! (undo)”;this.contentElement.parentNode.insertBefore(newEl,this.contentElement);DN.event.bind(DN.get(“.remove-content”,this.contentElement.parentNode),”click”,DN.saveContentHandler.clickHandler)}}DN.saveContentHandler.afterSave.fire(this.contentElement)}var newText;var savedCountElements=DN.getAll(“.saved-count”);for(var x=0;x<savedCountElements.length;x++){savedCountElements(x).innerHTML=data("saved_count_fmt")}var savedCountLinkElements=DN.getAll(".saved-count-link");for(var x=0;x0){DN.removeClass(savedCountLinkElements(x),”saved-count-link-hidden”)}else{DN.addClass(savedCountLinkElements(x),”saved-count-link-hidden”)}}var savedCount=DN.get(“header-saved-count”);if(savedCount){var savedCountText=data(“saved_count_fmt”);if(data(“saved_count”)>9){savedCountText=”9+”}if(parseInt(data(“saved_count”),0)===0){DN.swapClass(savedCount,”heart-number-saved”,”heart-number-unsaved”);DN.swapClass(savedCount,”heart-number-saved-shift”,”heart-number-unsaved”)}else{DN.swapClass(savedCount,”heart-number-unsaved”,”heart-number-saved”);if(data(“saved_count”)>9){data(“saved_count”)=”9+”;DN.swapClass(savedCount,”heart-number-unsaved”,”heart-number-saved-shift”);DN.swapClass(savedCount,”heart-number-saved”,”heart-number-saved-shift”)}else{DN.swapClass(savedCount,”heart-number-unsaved”,”heart-number-saved”);DN.swapClass(savedCount,”heart-number-saved-shift”,”heart-number-saved”)}}savedCount.innerHTML=savedCountText}var savedTabBar=DN.get(“saved-tab-bar”);if(savedTabBar){selTab=DN.get(“.sel .txt”,savedTabBar,true);if(selTab){newText=selTab.innerHTML.substr(0,selTab.innerHTML.indexOf(“(“)+1)+data(“saved_count_fmt”)+”)”;selTab.innerHTML=newText}}}else{if(data(“not_logged_in”)){DN.loginForm.show.call(this.contentElement)}else{if(!data(“error”)||data(“error”)===””){data(“error”)=”An unknown error occured”}this.showError(data(“error”))}}}else{this.showError(“An unknown error occurred”)}};this.showError=function(error){alert(error)}};if(!DN.saveContentHandler){DN.saveContentHandler={objCache:{},afterSave:new DN.customEvent({passArgs:true}),afterUnsave:new DN.customEvent({passArgs:true}),afterChange:new DN.customEvent({passArgs:true}),addListeners:function(){var links=DN.getAll(“.save-content”);for(n=0;n<links.length;n++){if(!links(n).getAttribute("data-bound")){links(n).setAttribute("data-bound",1);DN.event.bind(links(n),"click",DN.saveContentHandler.clickHandler)}}links=DN.getAll(".remove-content");for(n=0;n<links.length;n++){if(!links(n).getAttribute("data-bound")){links(n).setAttribute("data-bound",1);DN.event.bind(links(n),"click",DN.saveContentHandler.clickHandler)}}},clickHandler:function(e){DN.preventDefault(e);var contentId=this.getAttribute("data-id");var contentType=this.getAttribute("data-type");if(contentId&&contentType){var key=contentType+contentId;var isUnsave=DN.hasClass(this,"remove-content");if(isUnsave){key+="remove"}if(!DN.saveContentHandler.objCache(key)||!DN.saveContentHandler.objCache(key).contentElement){DN.saveContentHandler.objCache(key)=new DN.saveContent(this)}var saveContentObj=DN.saveContentHandler.objCache(key);saveContentObj.doAction(isUnsave)}}}}DN.onDOMReady.bind(DN.saveContentHandler.addListeners);
/* content_overflow_menu */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props(i);descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}(function(scopeVar){var ContentOverflowMenu=function(){"use strict";function ContentOverflowMenu(){_classCallCheck(this,ContentOverflowMenu)}_createClass(ContentOverflowMenu,({key:"attachListeners",value:function attachListeners(){var menus=DN.getAll(".content-card .action-menu");for(var x=0;x<menus.length;x++){if(menus(x).getAttribute("data-overflow-menu-bound")!=="true"){DN.event.bind(menus(x),"mouseenter",this.setAttributes,this);DN.event.bind(menus(x),"focus",this.setAttributes,this);menus(x).setAttribute("data-overflow-menu-bound","true")}}}},{key:"setAttributes",value:function setAttributes(ev){var menu=DN.getRealTarget(ev);var sheet=DN.get(menu.dataset.bottomSheetId);if(sheet){DN.get(".open-link",sheet).href=menu.dataset.offerUrl;DN.get(".alert-signup",sheet).setAttribute("category",menu.dataset.category);DN.get(".alert-signup",sheet).setAttribute("brand",menu.dataset.brand);DN.get(".alert-signup",sheet).setAttribute("store",menu.dataset.store);if(menu.dataset.expired==="1"){DN.get(".report-error",sheet).classList.add("hidden");DN.get(".report-error",sheet).setAttribute("data-id","");DN.get(".report-error",sheet).setAttribute("data-type","")}else{DN.get(".report-error",sheet).classList.remove("hidden");DN.get(".report-error",sheet).setAttribute("data-id",menu.dataset.contentId);DN.get(".report-error",sheet).setAttribute("data-type",menu.dataset.contentType)}var shareSheet=DN.get(DN.get(".action-menu-share",sheet).dataset.bottomSheetId);DN.get(".share-email",shareSheet).href=menu.dataset.shareEmailUrl;DN.get(".share-facebook",shareSheet).href=menu.dataset.shareFacebookUrl;DN.get(".share-twitter",shareSheet).href=menu.dataset.shareTwitterUrl;DN.get(".share-pinterest",shareSheet).href=menu.dataset.sharePinterestUrl}}}));return ContentOverflowMenu}();scopeVar.ContentOverflowMenu=ContentOverflowMenu})(DN);DN.onDOMReady.bind(function(){if(!DN.contentOverflowMenu){DN.contentOverflowMenu=new DN.ContentOverflowMenu}DN.contentOverflowMenu.attachListeners()});
/* content_card */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;ip>a”,this.card);if(el){this.addSalesLeadAttributes(el,”snippet”)}el=DN.get(“div.summary>p>a”,this.card);if(el){this.addSalesLeadAttributes(el,”summary”)}var related=DN.getAll(“div.related-offers>ul>li>a”,this.card);for(var x=0;x<related.length;x++){related(x).dataset.saleslead="related"}var image=DN.getAll(".cover-link, .attractor, .title-link",this.card);if(image){DN.event.bind(image,"click",function(e){if(!DN.hasClass(_this.card,"expanded")){if(_this.ctaDisabled){DN.preventDefault(e)}var fakeEvent={target:_this.media,srcElement:_this.media};_this.mediaClick(fakeEvent);e.stopPropagation()}},this)}this.expandButton=DN.get(".expand",this.card);if(this.expandButton){DN.event.bind(this.expandButton,"click",this.expand,this);DN.event.bind(this.expandButton,"keydown",this.expand,this)}var expandDefaults=DN.getAll(".expand-default",this.card);if(expandDefaults){DN.event.bind(expandDefaults,"click",function(){this.expand()},this)}this.collapseButton=DN.get(".collapse",this.card);if(this.collapseButton){DN.event.bind(this.collapseButton,"click",this.collapse,this);DN.event.bind(this.collapseButton,"keydown",this.collapse,this)}var less=DN.get(".less",this.card);if(less){DN.event.bind(less,"click",this.collapse,this);DN.event.bind(less,"keydown",this.collapse,this)}var more=DN.get(".more",this.card);if(more){DN.event.bind(more,"click",this.expand,this);DN.event.bind(more,"keydown",this.expand,this)}}},{key:"mediaClick",value:function mediaClick(e){var foundAnchor=false;var target=DN.getTarget(e);while(target!=this.media){if(target.tagName=="A"){foundAnchor=true;break}target=target.parentNode}if(!foundAnchor){if(!DN.hasClass(this.card,"expanded")){this.expand(e)}}}},{key:"expand",value:function expand(e){if(e){if(e.keyCode&&!(e.keyCode==13||e.keyCode==32)){return}DN.preventDefault(e)}if(this.detailsLoaded){this.revealDetails()}else{new DN.xhr(this.expandBaseURL+this.media.getAttribute("data-id")+".html",this.loadDetails,null,this,{"Accept":"dealnews/json","Content-Accept":"dealnews/json"})}}},{key:"collapse",value:function collapse(e){if(e){if(e.keyCode&&!(e.keyCode==13||e.keyCode==32)){return}DN.preventDefault(e)}this.card.classList.remove("expanded");this.media.classList.remove("details");this.card.setAttribute("aria-expanded","false");this.setStyle(this.collapseButton,"display","none");this.setStyle(this.expandButton,"display","inline-block");if(this.cta&&this.ctaDisabled){this.cta.setAttribute("disabled","")}}},{key:"revealDetails",value:function revealDetails(){var card=this.card;var scrollIntoView=function(){var cardRegion=DN.getRegion(card);var block;if(cardRegion.topdocument.documentElement.scrollTop+document.documentElement.clientHeight){block=”end”}if(block){card.scrollIntoView({behavior:”smooth”,block:block})}};this.card.classList.add(“expanded”);this.media.classList.add(“details”);this.card.setAttribute(“aria-expanded”,”true”);this.setStyle(this.expandButton,”display”,”none”);this.setStyle(this.collapseButton,”display”,”inline-block”);if(this.cta&&this.ctaDisabled){this.cta.removeAttribute(“disabled”)}window.setTimeout(scrollIntoView,100)}},{key:”setStyle”,value:function setStyle(elem,style,value){if(elem){elem.style(style)=value}}},{key:”loadDetails”,value:function loadDetails(responseText){try{var response=JSON.parse(responseText)}catch(error){var response=null}if(response){DN.loadDNJson(this.detailsContainer,response);this.detailsLoaded=true;this.revealDetails()}}}));return ContentCard}();scopeVar.ContentCard=ContentCard})(DN);DN.onDOMReady.bind(function(){DN.createObjects(“contentCards”,”.content-card”,DN.ContentCard)});
/* get_code */
DN.getCode=function(el){this.handleClick=function(e){var href=this.el.getAttribute(“data-href”);if(!href){href=this.el.getAttribute(“href”)}var permalink=this.el.getAttribute(“data-permalink”);if(permalink&&href){DN.preventDefault(e);window.open(permalink);window.location.href=href}};this.el=el;DN.event.bind(el,”click”,this.handleClick,this)};DN.onDOMReady.bind(function(){DN.createObjects(“getCodeObjects”,”.get-code”,DN.getCode,false)});
/* views */
DN.contentViewTracker=function(){this.content={};this.viewed={};this.sent={};this.scrollTimer=null;this.sendTimer=null;this.init=function(){if(typeof publicationID==”undefined”||publicationID===null||publicationID===0){return}var contentElements=DN.getAll(“.article, .content-view”);for(var x=0;x<contentElements.length;x++){var c=contentElements(x);if(!c.getAttribute("data-id")||c.getAttribute("data-id").lengthviewTop&&c.center=200){this.makeRequest(content);content={};count=0}}if(count>0){this.makeRequest(content);this.viewed={}}};this.makeRequest=function(content){var url=document.location.protocol+”//”+document.location.hostname+”/lw/views.php”;var data={publicationID:publicationID,content:content};data=DN.addStdLogData(data);data=JSON.stringify(data);try{DN.xhr(url,null,data)}catch(e){}};this.init()};DN.onDOMReady.bind(function(){if(!DN.contentViewTrackerObject){DN.contentViewTrackerObject=new DN.contentViewTracker}else{DN.contentViewTrackerObject.init()}});
/* lightbox_pop */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError(“Cannot call a class as a function”)}}function _defineProperties(target,props){for(var i=0;i0){for(var i=0;i0){for(var h=0;h<offers.length;h++){attr=offers(h).getAttribute("data-singleuseloaded");if(!attr){offers(h).setAttribute("data-singleuseloaded",1);new DN.singleUseCouponLightbox(offers(h))}}}var continue_browsing=DN.get(".continue-browsing");if(continue_browsing&&DN.hasOwnProperty("lightboxPanels")&&DN.lightboxPanels.hasOwnProperty("singleusecouponpanel")){DN.event.bind(continue_browsing,"click",function(){DN.lightboxPanels("singleusecouponpanel").hide()})}});
/* loading_bar */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props(i);descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}(function(scopeVar){var LoadingBar=function(){"use strict";function LoadingBar(elem){_classCallCheck(this,LoadingBar);this.elem=elem;this.id=elem.id;this.scrim_elem=DN.get(this.id+"_scrim")}_createClass(LoadingBar,({key:"show",value:function show(){DN.removeClass(this.elem,"loading-ellipsis-hide");if(this.scrim_elem){DN.removeClass(this.scrim_elem,"loading-ellipsis-hide")}}},{key:"hide",value:function hide(){DN.addClass(this.elem,"loading-ellipsis-hide");if(this.scrim_elem){DN.addClass(this.scrim_elem,"loading-ellipsis-hide")}}}));return LoadingBar}();DN.onDOMReady.bind(function(){scopeVar.LoadingBar=LoadingBar;DN.createObjects("loadingBars",".loading-ellipsis",LoadingBar)})})(DN);
/* wizard */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i=this.step_timeout){clearInterval(this.interval);this.interval=null;this.activateStep(this.error_step_name)}}else{if(!DN.empty(this.interval)){clearInterval(this.interval);this.interval=null}for(var i in this.steps){if(i===step_name){DN.addClass(this.steps(i),”dnwizard-step-active”);this.active_step=step_name;this.stepActivated.fire(step_name)}else{DN.removeClass(this.steps(i),”dnwizard-step-active”)}}this.hideBar()}}},{key:”cancelStep”,value:function cancelStep(deactivate_loadingbar){if(typeof deactivate_loadingbar===”undefined”){deactivate_loadingbar=true}if(!DN.empty(this.interval)){clearInterval(this.interval);this.interval=null}if(deactivate_loadingbar){this.hideBar()}}},{key:”showBar”,value:function showBar(){this.initializeObject(“loadingbar”,this.loadingbar_id,DN.loadingBars);if(this.loadingbar){this.loadingbar.show()}}},{key:”hideBar”,value:function hideBar(){this.initializeObject(“loadingbar”,this.loadingbar_id,DN.loadingBars);if(this.loadingbar){this.loadingbar.hide()}}},{key:”initializeObject”,value:function initializeObject(property_name,object_name,object_container){if(!this(property_name)){if(object_container&&typeof object_container===”object”){if(object_container.hasOwnProperty(object_name)){this(property_name)=object_container(object_name)}}}}},{key:”initialize”,value:function initialize(){this.steps={};this.steps_status={};this.default_step=null;var step_name=null;var step_status=0;var step_default=0;var steps=DN.getAll(“.dnwizard-step”,this.elem);if(steps&&steps.length>0){for(var i=0;i=o.length)return{done:true};return{done:false,value:o(i++)}},e:function(e){throw e},f:F}}throw new TypeError(“Invalid attempt to iterate non-iterable instance.nIn order to be iterable, non-array objects must have a (Symbol.iterator)() method.”)}var normalCompletion=true,didErr=false,err;return{s:function(){it=o(Symbol.iterator)()},n:function(){var step=it.next();normalCompletion=step.done;return step},e:function(e){didErr=true;err=e},f:function(){try{if(!normalCompletion&&it.return!=null)it.return()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o===”string”)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n===”Object”&&o.constructor)n=o.constructor.name;if(n===”Map”||n===”Set”)return Array.from(o);if(n===”Arguments”||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2(i)=arr(i)}return arr2}(function(scopeVar){if(!scopeVar.recaptchaLoaded){window.CaptchaCallback=function(){var recaptchas=DN.getAll(".g-recaptcha-explicit");if(recaptchas){var _iterator=_createForOfIteratorHelper(recaptchas),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var el=_step.value;var id=grecaptcha.render(el,{"sitekey":el.getAttribute("data-sitekey"),"theme":el.getAttribute("data-theme"),"size":el.getAttribute("data-size"),"tabindex":el.getAttribute("data-tabindex"),"callback":el.getAttribute("data-callback"),"expired-callback":el.getAttribute("data-expired-callback"),"error-callback":el.getAttribute("data-error-callback"),"client-id":el.getAttribute("data-widget-id")});el.setAttribute("data-widget-id",id)}}catch(err){_iterator.e(err)}finally{_iterator.f()}}if(DN.MessageBus){DN.MessageBus.post("recaptchaAvailable")}};var js=document.createElement("script");js.src="https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit";js.async=true;js.defer=true;document.head.appendChild(js);scopeVar.recaptchaLoaded=true}})(DN);
/* async_form */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i0){for(var x=0;x<fields.length;x++){if(fields(x).type!=="submit"&&(fields(x).type!=="checkbox"||fields(x).checked)){if(post_data!==""){post_data+="&"}post_data+=fields(x).name+"="+encodeURIComponent(fields(x).value)}}}}return post_data}},{key:"responseCallback",value:function responseCallback(responseText){var response={};try{response=JSON.parse(responseText)}catch(e){response={};console.log(e)}if(response){this.submitted.fire(response,this.form)}}},{key:"initialize",value:function initialize(){if(this.form){DN.event.bind(this.form,"submit",this.submitForm,this)}}}));return AsyncForm}();scopeVar.AsyncForm=AsyncForm})(DN);
/* google_login */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props(i);descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}(function(scopeVar){if(scopeVar.GoogleLogin){return}var GoogleLogin=function(){"use strict";function GoogleLogin(){_classCallCheck(this,GoogleLogin);this.ready=false;this.onReady=new DN.customEvent;this.onSignIn=new DN.customEvent({passArgs:true,returnResult:false,returnArgs:false});this.clientId="240283651047-2k9j9dpqt61kh002lfn5f9dptm2vo4bt.apps.googleusercontent.com"}_createClass(GoogleLogin,({key:"load",value:function load(){(function(d,s,id){var js,fjs=d.getElementsByTagName(s)(0);if(d.getElementById(id)){return}js=d.createElement(s);js.id=id;js.src="https://accounts.google.com/gsi/client";js.async=true;js.defer=true;fjs.parentNode.insertBefore(js,fjs)})(document,"script","google-jssdk");var self=this;window.onGoogleLibraryLoad=function(){if(!self.ready){google.accounts.id.initialize({client_id:self.clientId,context:"signin",itp_support:true,callback:function(CredentialResponse){self.onSignIn.fire(CredentialResponse)}});self.setReady();google.accounts.id.prompt()}}}},{key:"setReady",value:function setReady(){this.ready=true;this.onReady.fire()}},{key:"attachOnReadyCallback",value:function attachOnReadyCallback(callback){if(this.ready){callback()}else{this.onReady.bind(callback)}}},{key:"renderButton",value:function renderButton(container){if(this.ready){google.accounts.id.renderButton(container,{type:"standard",shape:"rectangular",theme:"outline",text:"continue_with",size:"large",logo_alignment:"left",width:240})}else{this.onReady.bind(function(){this.renderButton(container)},this)}}}));return GoogleLogin}();scopeVar.GoogleLogin=new GoogleLogin;if(DN.MessageBus){DN.MessageBus.post("thirdPartyLoginAvailable")}})(DN);
/* facebook_login */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props(i);descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}(function(scopeVar){if(scopeVar.FacebookLogin){return}var FacebookLogin=function(){"use strict";function FacebookLogin(){_classCallCheck(this,FacebookLogin);this.FB=null;this.onReady=new DN.customEvent}_createClass(FacebookLogin,({key:"load",value:function load(){(function(d,s,id){var js,fjs=d.getElementsByTagName(s)(0);if(d.getElementById(id)){return}js=d.createElement(s);js.id=id;js.src="https://connect.facebook.net/en_US/sdk.js";fjs.parentNode.insertBefore(js,fjs)})(document,"script","facebook-jssdk")}},{key:"setFB",value:function setFB(FB){this.FB=FB;this.onReady.fire()}},{key:"loginOrPop",value:function loginOrPop(callback,context){var that=this;this.FB.getLoginStatus(function(response){if(response.status==="connected"){that.loadUser(callback,context)}else{that.FB.login(function(response){if(response.authResponse){that.loadUser(callback,context)}},{scope:"public_profile,email"})}})}},{key:"loadUser",value:function loadUser(callback,context){this.FB.api("/me?fields=email,name",function(response){if(context){callback.apply(context,(response))}else{callback.apply(null,(response))}})}},{key:"attachListener",value:function attachListener(element,callback,context){if(this.FB){DN.event.bind(element,"click",function(){this.loginOrPop(callback,context)},this)}else{this.onReady.bind(function(){this.attachListener(element,callback,context)},this)}}},{key:"attachOnReadyCallback",value:function attachOnReadyCallback(callback){if(this.FB){callback()}else{this.onReady.bind(callback)}}}));return FacebookLogin}();scopeVar.FacebookLogin=new FacebookLogin;if(DN.MessageBus){DN.MessageBus.post("thirdPartyLoginAvailable")}})(DN);window.fbAsyncInit=function(){FB.init({appId:"16976398217",xfbml:true,version:"v3.3"});FB.AppEvents.logPageView();DN.FacebookLogin.setFB(FB)};
/* login */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i0){for(var i=0;i0){for(var j=0;j0){for(var x=0;x<fields.length;x++){if(fields(x).type!=="submit"&&(fields(x).type!=="checkbox"||fields(x).checked)){if(post_data!==""){post_data+="&"}post_data+=fields(x).name+"="+encodeURIComponent(fields(x).value)}}}this.beforeSubmit.fire(post_data);if(!DN.empty(post_data)){new DN.xhr(this.endpoint,this.responseCallback,post_data,this,this.postFormResultsHeaders,"POST")}}}},{key:"responseCallback",value:function responseCallback(responseText){this.form=null;var response={};try{response=JSON.parse(responseText)}catch(e){console.log(e)}if(response&&DN.isDNJson(response)){if(DN.loadDNJson(this.container,response)){this.form=DN.get(this.form_selector,this.container);if(this.form){DN.event.bind(this.form,"submit",this.submitForm,this)}this.dnjsonLoaded.fire()}}else if(response){this.success.fire(response)}}},{key:"postAuthCallback",value:function postAuthCallback(responseText){var response={};try{response=JSON.parse(responseText)}catch(e){console.log(e)}if(response&&response.hasOwnProperty("post_auth")){if(this.form){if(this.postauth_field){var field=DN.get(this.postauth_field,this.form);field.value=response.post_auth;this.postData()}}}}}));return XHRForm}();scopeVar.XHRForm=XHRForm})(DN);
/* modal/onboard */
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i0){for(var x=0;x0){for(var y=0;y0){for(var j=0;j0){var step_index=0;if(step||this.wizard.active_step){if(step){step_index=steps.indexOf(step)}else if(this.wizard.active_step){step_index=steps.indexOf(this.wizard.active_step)}if(step_index>=0){step_index++}}if(step_index>=0&&steps(step_index)){next_step=steps(step_index)}else{next_step=false}}if(!DN.hasOwnProperty(“onboardpreferences”)||!DN.onboardpreferences){if(next_step===”entry”||next_step===”preferences”||next_step===”success”){next_step=this.getNextStep(next_step)}}else if(DN.userLoggedIn&&(next_step===”entry”||next_step===”account”)){next_step=this.getNextStep(next_step)}else if(DN.userHasPref&&(next_step===”preferences”||next_step===”success”)){if(next_step===”preferences”||!this.pref_changed){next_step=this.getNextStep(next_step)}}else if(!DN.userHasPref&&next_step===”success”){next_step=this.getNextStep(next_step)}if(next_step===”entry”||next_step===”success”){var cookie_name=this.entry_cookie_name;if(next_step===”success”){cookie_name=this.success_cookie_name}var cookie=DN.getCookie(cookie_name);if(!DN.empty(cookie)){next_step=this.getNextStep(next_step)}}return next_step}}));return Onboard}();scopeVar.Onboard=new Onboard})(DN);
/* modal/onboard-login */
DN.loginForm={show:function(e){if(DN.hasOwnProperty(“Onboard”)){if(typeof e!==”object”){if(typeof this===”object”&&this instanceof HTMLElement){e={currentTarget:this}}}DN.Onboard.toggle(e)}}};
/* widgets/newsletter */
DN.NewsletterSignup=function(baseElement){this.baseElement=DN.get(baseElement);if(baseElement.tagName==”FORM”){this.element=this.baseElement}else{this.element=DN.get(“form”,this.baseElement)}this.onSuccess=new DN.customEvent({passArgs:true});this.onFailure=new DN.customEvent;this.onSubmit=new DN.customEvent;this.shown=false;this.scrollTimer=null;this.source=””;this.source_type=””;this.lastResponse={};this.campaignCheckbox=false;this.closeEl=false;this.closeCookieName=false;this.baseURL=document.location.protocol+”//”+document.location.hostname+”/async/newsletter/signup/”;this.data={};this.submitForm=function(responseText){if(responseText){var data=JSON.parse(responseText);if(data(“post_auth”)){var queryData=””;for(var i in this.data){if(queryData.length>0){queryData+=”&”}queryData+=i+”=”;if(i==”campaign”){queryData+=this.data(i).join(“,”)}else{queryData+=encodeURIComponent(this.data(i))}}queryData+=”&post_auth=”+encodeURIComponent(data(“post_auth”));var buttons=DN.getAll(“.button, input(type=submit)”,this.element);if(buttons){for(var x=0;x<buttons.length;x++){buttons(x).setAttribute("disabled","1")}}this.logNavEvent("submitted");var xhr=new DN.xhr(this.baseURL,this.handleResponse,queryData,this);return}}alert("An unknown error has occured.")};this.validate=function(e){if(e){DN.preventDefault(e)}this.data={};this.getData();if(!this.data.hasOwnProperty("uid")&&!this.data.hasOwnProperty("email")){alert("An unknown error has occured. Please reload the page and try again.");return}else if(!this.data.hasOwnProperty("uid")&&DN.empty(this.data.email)){alert("You must provide a valid email address in order to subscribe.");return}if((!this.data.hasOwnProperty("campaign")||this.data.campaign.length<1)&&this.campaignCheckbox===true){alert("Please choose at least one newsletter campaign, before clicking "Subscribe".");return}if(!this.data.hasOwnProperty("source")&&!this.data.hasOwnProperty("source_page")){alert("An unknown error has occured. Please reload the page and try again.");return}this.onSubmit.fire();this.pA.fetch()};this.getData=function(){if(JSON.stringify(this.data)=="{}"){var emailField=DN.get(".nl-email",this.element);var uidField=DN.get(".nl-user_id",this.element);var zipField=DN.get(".nl-zipcode",this.element);var pubField=DN.get(".nl-pub",this.element);if(emailField){this.data("email")=emailField.value}if(uidField&&!DN.empty(uidField.value)){this.data("uid")=uidField.value}if(zipField&&!DN.empty(zipField.value)){this.data("zip")=zipField.value}if(pubField&&!DN.empty(pubField.value)){this.data("pub")=pubField.value}else if(publicationID){this.data("pub")=publicationID}this.getSource();if(this.source_type=="form"){this.data("source")=this.source}else if(this.source_type=="page"){this.data("source_page")=this.source}this.data("campaign")=this.getCampaigns()}};this.handleResponse=function(responseText){if(responseText){var data=JSON.parse(responseText);this.lastResponse=data;if(data("success")){frmBlock=DN.get(".frm",this.baseElement);if(data("sent_confirm")){successBlock=DN.get(".success-confirm-sent",this.baseElement)}else{successBlock=DN.get(".success-confirmed",this.baseElement)}if(frmBlock&&successBlock){if(successBlock.innerHTML===""){successBlock.innerHTML=data("message_html")}emailSpan=DN.get(".email",successBlock);if(emailSpan){emailSpan.innerHTML=data("email")}frmBlock.style.display="none";successBlock.style.display="block";this.logNavEvent("subscribed");if(this.closeEl){this.setCloseCookie();var self=this;this.scrollTimer=setTimeout(function(){self.dismiss.call(self)},5000)}}this.onSuccess.fire(data)}else{errorBlock=DN.get(".nl-error",this.element);if(errorBlock){errorBlock.innerHTML=data("errors")(0)}else{alert(data("errors")(0))}var buttons=DN.getAll(".button, input(type=submit)",this.element);if(buttons){for(var x=0;xdocument.body.scrollTop){viewTop=document.documentElement.scrollTop}else{viewTop=document.body.scrollTop}if(document.documentElement&&document.documentElement.clientHeight>document.body.clientHeight){viewBottom=viewTop+document.body.clientHeight}else{viewBottom=viewTop+document.documentElement.clientHeight}var center=region.top+region.height/2;if(center>viewTop&¢er<viewBottom){this.isShown()}}};this.isShown=function(){if(!this.shown){this.shown=true;this.logNavEvent("shown");DN.event.unbind(window,"optimizedScroll",this.checkOnScreen)}};this.handleScroll=function(){if(this.scrollTimer){clearTimeout(this.scrollTimer)}var self=this;this.scrollTimer=setTimeout(function(){self.checkOnScreen.call(self)},500)};this.getSource=function(){var sourceValue=null;if(this.source===""||this.source_type===""){var sourcePageField=DN.get(".nl-source-page",this.element);var sourceField=DN.get(".nl-source",this.element);if(sourceField){sourceValue=encodeURIComponent(sourceField.value);this.source=sourceValue;this.source_type="form"}else if(sourcePageField){sourceValue=encodeURIComponent(sourcePageField.value);this.source=sourceValue;this.source_type="page"}}else{sourceValue=this.source}return sourceValue};this.getCampaigns=function(){var campaignFields=DN.getAll(".nl-campaign",this.element);var camps=();if(campaignFields){for(x=0;x0){for(var i=0;i<buttons.length;i++){if(buttons(i).getAttribute("data-manage-newsletters")!=="1"){DN.event.bind(buttons(i),"click",DN.manage_newsletters.action);buttons(i).setAttribute("data-manage-newsletters","1")}}}}};DN.onDOMReady.bind(DN.manage_newsletters.init);
/* back_to_top */
DN.backToTop=function(){this.el=DN.get(".back-to-top-outer");if(this.el){DN.event.bind(this.el,"click",function(e){DN.preventDefault(e);DN.scrollTo(document.body)},this)}};DN.onDOMReady.bind(function(){DN.backToTopButton=new DN.backToTop});