Error executing template "Designs/Warmtethuis/_parsed/FaqCategoryPage.parsed.cshtml"
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.) ---> System.ComponentModel.Win32Exception: The wait operation timed out
   --- End of inner exception stack trace ---
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Dynamicweb.Data.DatabaseConnectionProvider.CreateConnection(Boolean open)
   at Dynamicweb.Data.Database.CreateConnection()
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Content.Items.Queries.Repository.FindChildPagesId(IEnumerable`1 pids, Boolean includeAllChildItems)
   at Dynamicweb.Content.Items.Queries.Repository.GetPagesByIds(IEnumerable`1 parentIds, Boolean includeChildItems, Boolean checkPermissions, List`1& childPages)
   at Dynamicweb.Content.Items.Queries.Repository.SelectByParentPageIds(IEnumerable`1 parentIds, Query query, Boolean includeParagraphs, Boolean includeChildItems, Boolean checkPermissions, Boolean includeInheritedItems)
   at Dynamicweb.ItemPublisher.Frontend.GetItems()
   at Dynamicweb.ItemPublisher.Frontend.List()
   at Dynamicweb.ItemPublisher.Frontend.GetContent()
   at Dynamicweb.ItemPublisher.Frontend.GetContentBySettings(String settings)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Dynamicweb.Extensibility.AddIns.AddInManager.InvokeFunction(Object instance, String functionName, Object[] arguments)
   at Dynamicweb.Rendering.TemplateBase`1.RenderItemList(Object settings)
   at CompiledRazorTemplates.Dynamic.RazorEngine_6e1efc435a7f4f51a6cbe694c8340626.Execute() in D:\inetpub\wwwroot\www.warmgarant.nl\Files\Templates\Designs\Warmtethuis\_parsed\FaqCategoryPage.parsed.cshtml:line 200
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using Warmgarant.Shop.Repository.Helpers 2 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3 @{ 4 var requestHost = string.Format("{0}://{1}", GetGlobalValue("Global:Request.Scheme"), GetGlobalValue("Global:Request.Host")); 5 var hpId = AreaHelper.GetAreaItemIntValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.HeaderParagraphId); 6 var fpId = AreaHelper.GetAreaItemIntValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.FooterParagraphId); 7 var assetsDirectory = "./files/templates/designs/warmtethuis/styleguide/assets/"; 8 9 // seo meta data 10 var pageDescription = GetString("Meta.Description"); 11 var pageKeywords = GetString("Meta.Keywords"); 12 var language = GetGlobalValue("Global:Area.Lang"); 13 14 var templateDesignBaseUrl = GetString("Template:DesignBaseUrl"); 15 16 var cssStyleguide = Fingerprint.Tag(templateDesignBaseUrl, "Styleguide/css/warmtethuis.min.css"); 17 var cssWarmtethuis = Fingerprint.Tag(templateDesignBaseUrl, "Css/warmtethuis.min.css"); 18 19 var vendorJs = Fingerprint.Tag(templateDesignBaseUrl, "Styleguide/js/vendor.min.js"); 20 var warmtethuisStyleguideJs = Fingerprint.Tag(templateDesignBaseUrl, "Styleguide/js/warmtethuis.min.js"); 21 var warmtethuisJs = Fingerprint.Tag(templateDesignBaseUrl, "Scripts/warmtethuis.min.js"); 22 var reCaptchaSiteKey = AreaHelper.GetAreaItemStringValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.ReCaptchaSiteKey, Dynamicweb.Frontend.PageView.Current().AreaID); 23 } 24 <!DOCTYPE html> 25 <html lang="@language"> 26 <head> 27 <title>@GetValue("Title")</title> 28 @GetValue("MetaTags") 29 @GetValue("CopyRightNotice") 30 31 <meta http-equiv="content-language" content="@language"> 32 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 33 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 34 <meta name="msapplication-tap-highlight" content="no"> 35 <meta name="format-detection" content="telephone=no"> 36 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 37 <meta name="application-name" content="warmtethuis.nl"> 38 <meta name="author" content="Innovadis BV, Enschede"> 39 <meta name="copyright" content="Innovadis BV, Enschede, @DateTime.Now.Year"> 40 <meta name="web_author" content="Innovadis BV, Enschede"> 41 @if (!string.IsNullOrWhiteSpace(pageDescription)) 42 { 43 44 } 45 @if (!string.IsNullOrWhiteSpace(pageKeywords)) 46 { 47 48 } 49 <link rel="dns-prefetch" href="@requestHost"> 50 <link rel="icon" href="/Files/Templates/Designs/Warmtethuis/Images/favicon.ico" type="image/x-icon"> 51 <link rel="shortcut icon" href="/Files/Templates/Designs/Warmtethuis/Images/favicon.ico" type="image/x-icon"> 52 <!--Remote CSS--> 53 <link href="https://cdn.jsdelivr.net/npm/&#64;mdi/font@2.0.46/css/materialdesignicons.min.css" rel="stylesheet"> 54 <link href="https://fonts.googleapis.com/css?family=Open+Sans:200,200i,300,300i,400,700" rel="stylesheet"> 55 <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css" rel="stylesheet"> 56 <link rel="stylesheet" href="https://use.typekit.net/znz2dkr.css"> 57 <!--Local CSS--> 58 <link rel="stylesheet" type="text/css" href="@cssStyleguide"> 59 <link rel="stylesheet" type="text/css" href="@cssWarmtethuis"> 60 <!--Scripts--> 61 <script> 62 // Set global JavaScript variable with AreaID 63 var dwAreaID = @GetInteger("DwAreaID"); 64 </script> 65 <script src="@vendorJs"></script> 66 <script src="@warmtethuisStyleguideJs"></script> 67 <script src="/Scripts/jquery.waypoints.min.js"></script> 68 <script src="/Scripts/sticky.min.js"></script> 69 70 @if (!string.IsNullOrWhiteSpace(reCaptchaSiteKey)) 71 { 72 <script src="https://www.google.com/recaptcha/api.js?render=@reCaptchaSiteKey"></script> 73 } 74 75 @RenderSnippet("HeadContent") 76 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 77 @{ 78 var googleTagmanagerCode = Warmgarant.Shop.Repository.Helpers.AreaHelper.GetAreaItemStringValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.GoogleTagmanagerCode); 79 if (!string.IsNullOrWhiteSpace(googleTagmanagerCode)) 80 { 81 <!-- Google Tag Manager --> 82 <script> 83 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push( 84 {'gtm.start': new Date().getTime(),event:'gtm.js'} 85 );var f=d.getElementsByTagName(s)[0], 86 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 87 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 88 })(window, document, 'script', 'dataLayer', '@googleTagmanagerCode'); 89 </script> 90 <!-- End Google Tag Manager --> 91 } 92 } 93 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 94 @{ 95 var googleTrackingCode = Warmgarant.Shop.Repository.Helpers.AreaHelper.GetAreaItemStringValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.GoogleTrackingCode); 96 if (!string.IsNullOrWhiteSpace(googleTrackingCode)) 97 { 98 var optInLevel = GetGlobalValue("Global:CookieOptInLevel"); 99 // optInLevel can be: 100 // - None (0) 101 // - Functional (1) 102 // - All (2) 103 104 <script> 105 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 106 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 107 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 108 })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 109 110 var virtualPageviewHasBeenSent = false; // this variable will be set to true in innovadis-seo.js when a virtual pageview has been fired and used to prevent double analytics tracking 111 112 ga('create', '@googleTrackingCode', 'auto'); 113 // NOTE: the analytics tracking event 'send' code, ga('send', 'pageview'), which is located here in the Google code samples is moved to innovadis-seo.js and called at the bottom of the master to be able to prevent double analytics tracking when a virtual pageview has already been fired. 114 // Anonymization based on CookieOptInLevel is done there. 115 </script> 116 117 if (optInLevel.Equals("None", StringComparison.InvariantCultureIgnoreCase)) 118 { 119 <script> 120 // GA opt out 121 window['ga-disable-@googleTrackingCode'] = true; 122 </script> 123 } 124 } 125 } 126 @GetValue("Stylesheets") 127 @GetValue("Javascripts") 128 </head> 129 <body data-pageid='@GetGlobalValue("Global:Page.ID")' data-navtop='@NavigationHelper.GetActiveTopLevelPageId(GetGlobalValue("Global:Page.ID"))'> 130 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 131 @{ 132 if (!string.IsNullOrWhiteSpace(googleTagmanagerCode)) 133 { 134 var tagManagerUrl = string.Format("https://www.googletagmanager.com/ns.html?id={0}", googleTagmanagerCode); 135 <!-- Google Tag Manager (noscript) --> 136 <noscript> 137 <iframe src="@tagManagerUrl" height="0" width="0" style="display:none;visibility:hidden"></iframe> 138 </noscript> 139 <!-- End Google Tag Manager (noscript) --> 140 } 141 } 142 <header> 143 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 144 @{ 145 var notificationText = Warmgarant.Shop.Repository.Helpers.AreaHelper.GetAreaItemStringValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.NotificationText).Trim(); 146 if (!string.IsNullOrWhiteSpace(notificationText)) 147 { 148 <div class="content header-notification"> 149 <div class="header-notification__spacer"></div> 150 <div class="header-notification__content">@notificationText</div> 151 <a href="/hide-notification" class="header-notification__button notification-hide"> 152 <img src="/Files/Templates/Designs/Warmtethuis/images/icons/x-close-white.svg"> 153 </a> 154 </div> 155 156 @SnippetStart("JavaScriptBottom") 157 <script> 158 $(document).ready(function () { 159 160 var sessionStorageId = "Warmtethuis_Hide_Notification"; 161 var hideNotification = window.sessionStorage.getItem(sessionStorageId); 162 if (hideNotification == null || hideNotification !== 'true') { 163 $(".header-notification").addClass('active'); 164 $("main").addClass('notification-active'); 165 } 166 167 $(".notification-hide").off("click").on("click", function () { 168 window.sessionStorage.setItem(sessionStorageId, 'true'); 169 $(".header-notification").removeClass('active'); 170 $("main").removeClass('notification-active'); 171 return false; 172 }); 173 }); 174 </script> 175 @SnippetEnd("JavaScriptBottom") 176 } 177 } 178 @if (hpId > 0) 179 { 180 @RenderParagraphContent(hpId) 181 } 182 </header> 183 184 <main> 185 @using NLog; 186 @using Warmgarant.Shop.Repository.Helpers 187 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 188 189 @{ 190 var logger = LogManager.GetLogger("Warmgarant.Shop.Application.FaqCategoryPage"); 191 var allFaqItemsPageId = GetPageIdByNavigationTag("faq_all_items"); 192 } 193 <div class="container"> 194 @NavigationHelper.GetBreadCrumb() 195 <section class="page-content row"> 196 @(!string.IsNullOrEmpty(GetString("DwPageName")) ? "<h1>" + GetString("DwPageName") + "</h1>" : "") 197 <aside class="col s12 m12 l3" id="sidebar_left">@GetValue("DwContent(sidebarleft)")</aside> 198 <main class="col s12 m12 l6" id="main_content" title="Main content"> 199 @{ 200 var categoryFaqs = RenderItemList(new 201 { 202 ItemType = "FaqItem_WT", 203 ListSourceType = "SelfPage", 204 ItemFieldsList = "Id", 205 ListTemplate = "ItemPublisher/List/FAQ_WT.cshtml", 206 ListPageSize = "100", 207 ListOrderBy = "Sort", 208 IncludeAllChildItems = "True", 209 }); 210 @categoryFaqs 211 } 212 </main> 213 <aside class="col s12 m12 l3" id="sidebar_right" title="Sidebar right"> 214 @{ 215 if (allFaqItemsPageId > 0) 216 { 217 var allFaqs = RenderItemList(new 218 { 219 ItemType = "FaqItem_WT", 220 ListSourceType = "Page", 221 ListSourcePage = allFaqItemsPageId, 222 ItemFieldsList = "Id", 223 ListTemplate = "ItemPublisher/List/FAQ_Categories.cshtml", 224 ListPageSize = "999", 225 ListOrderBy = "Sort", 226 IncludeAllChildItems = "True", 227 }); 228 @allFaqs 229 } 230 else 231 { 232 logger.Error("Navigation tag: faq_all_items. Not found"); 233 } 234 } 235 </aside> 236 </section> 237 </div> 238 </main> 239 240 <footer> 241 @if (fpId > 0) 242 { 243 @RenderParagraphContent(fpId) 244 } 245 </footer> 246 247 <!--Scripts--> 248 <script src="@warmtethuisJs"></script> 249 @if (Dynamicweb.Frontend.PageView.Current().Page.NavigationTag.Equals(Warmgarant.Shop.Models.Constants.StringConstants.Navigation.ServiceContractInfo)) 250 { 251 <text> 252 @using Warmgarant.Shop.Repository.Helpers 253 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 254 @{ 255 // THIS CONTENT WILL BE ACTIVE WHEN THE CURRENT PAGE NAVIGATION TAG IS: ServiceContractInfo 256 // THE MODAL WIL OPEN ONCLICK OF AN ELEMENT WITH CLASSNAME: servicecontract-callback 257 258 var callMeBackParagraphId = AreaHelper.GetAreaItemIntValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.CallMeBackParagraphId); 259 if (callMeBackParagraphId > 0) 260 { 261 var modalId = $"ServiceContractCallMeBackModal"; 262 var seoParagraphServiceContractCall = string.Format("{0}/{1}", System.Web.HttpContext.Current.Request.Url.Authority, Translate("SEO_VirtualPageviewServiceContractCallMeBackForm", "all-in-service-callmeback-form")); 263 264 <div id="@modalId" class="modal modal-large quotation-request-modal"> 265 <div class="modal-header"> 266 <h3>@Translate("ServiceContractCallMeBack_Modal_Header", "Call me back request")</h3> 267 <div class="modal-action modal-close"> 268 <img src="/files/templates/designs/warmtethuis/images/icons/x-close.svg" title='@Translate("Close", "Close").JsEncode()' class="black-svg"> 269 </div> 270 </div> 271 <div class="modal-content rich-text-editor-content"> 272 @RenderParagraphContent(callMeBackParagraphId) 273 </div> 274 </div> 275 276 @SnippetStart("JavaScriptBottom") 277 <script> 278 var openServiceContractCallMeBackModal = function () { 279 $('#@modalId').innovadisModal().modal('open'); 280 }; 281 $(function () { 282 // Init modal call me back request 283 $('.servicecontract-callback').off("click").on("click", function (e) { 284 e.preventDefault(); 285 openServiceContractCallMeBackModal(); 286 SEO.trackPageView("@seoParagraphServiceContractCall", '@GetGlobalValue("Global:CookieOptInLevel").ToLower()' === 'functional'); 287 return false; 288 }); 289 $("label.checkbox", "#@modalId").innovadisCheckbox({}); 290 }); 291 </script> 292 @SnippetEnd("JavaScriptBottom") 293 } 294 } 295 </text> 296 } 297 @RenderSnippet("JavaScriptBottom") 298 <script> 299 function getParam(p) { 300 var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search); 301 return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); 302 } 303 304 function getExpiryRecord(value) { 305 var expiryPeriod = 90 * 24 * 60 * 60 * 1000; // 90 day expiry in milliseconds 306 var expiryDate = new Date().getTime() + expiryPeriod; 307 return { 308 value: value, 309 expiryDate: expiryDate 310 }; 311 } 312 313 function addGclid() { 314 var gclidParam = getParam('gclid'); 315 var gclidFormFields = ['QuotationRequests_GCLID']; // all possible gclid form field ids here 316 var gclidRecord = null; 317 var currGclidFormField; 318 var gclsrcParam = getParam('gclsrc'); 319 var isGclsrcValid = !gclsrcParam || gclsrcParam.indexOf('aw') !== -1; 320 321 gclidFormFields.forEach(function (field) { 322 if (document.getElementById(field)) { 323 currGclidFormField = document.getElementById(field); 324 } 325 }); 326 327 if (gclidParam && isGclsrcValid) { 328 gclidRecord = getExpiryRecord(gclidParam); 329 localStorage.setItem('gclid', JSON.stringify(gclidRecord)); 330 } 331 332 var gclid = gclidRecord || JSON.parse(localStorage.getItem('gclid')); 333 var isGclidValid = gclid && new Date().getTime() < gclid.expiryDate; 334 335 if (currGclidFormField && isGclidValid) { 336 currGclidFormField.value = gclid.value; 337 } 338 } 339 340 window.addEventListener('load', addGclid); 341 </script> 342 @using Warmgarant.Shop.Repository.Helpers 343 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 344 @{ 345 if (IntercomHelper.IntercomIsActive()) 346 { 347 var intercomAppId = Warmgarant.Shop.Models.Config.ExtraConfig.ExtraConfiguration.IntercomMessengerSettings.AppId; 348 if (!string.IsNullOrWhiteSpace(intercomAppId)) 349 { 350 <script> 351 352 function setIntercomCookie(cname, cvalue, exdays) { 353 var d = new Date(); 354 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 355 var expires = "expires=" + d.toUTCString(); 356 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 357 } 358 359 function getIntercomCookie(cname) { 360 var name = cname + "="; 361 var decodedCookie = decodeURIComponent(document.cookie); 362 var ca = decodedCookie.split(';'); 363 for (var i = 0; i < ca.length; i++) { 364 var c = ca[i]; 365 while (c.charAt(0) == ' ') { 366 c = c.substring(1); 367 } 368 if (c.indexOf(name) == 0) { 369 return c.substring(name.length, c.length); 370 } 371 } 372 return ""; 373 } 374 375 window.intercomSettings = { 376 app_id: "@intercomAppId", // app Id located in the web.config 377 custom_launcher_selector: '.openIntercom', // links with the '.openIntercom' class activate the intercom messenger 378 hide_default_launcher: true // hides the intercom icon in right bottom corner 379 }; 380 381 382 (function() { 383 var w = window; 384 var ic = w.Intercom; 385 if (typeof ic === "function") { 386 ic('reattach_activator'); 387 ic('update', intercomSettings); 388 389 } else { 390 var d = document; 391 var i = function() { i.c(arguments) }; 392 i.q = []; 393 i.c = function(args) { i.q.push(args) }; 394 w.Intercom = i; 395 396 function l() { 397 var s = d.createElement('script'); 398 s.type = 'text/javascript'; 399 s.async = true; 400 s.src = 'https://widget.intercom.io/widget/bz2i6o1f'; 401 var x = d.getElementsByTagName('script')[0]; 402 x.parentNode.insertBefore(s, x); 403 } 404 405 if (w.attachEvent) { 406 w.attachEvent('onload', l); 407 } else { 408 w.addEventListener('load', l, false); 409 } 410 411 // use cookie value to determine if the messenger should be shown on page. 412 // by default no messenger should be shown 413 // the messenger should open on trigger click 414 // the messenger should stay in focus despite changing pages as long as the cookie value is true 415 // when manually hiding the messenger by clicking the close/hide link the cookie value changes to false 416 var intercomCookieName = "WarmgarantIntercomIsOpen"; 417 var currentCookieValue = getIntercomCookie(intercomCookieName); 418 if (currentCookieValue === "true") { 419 w.Intercom('show'); 420 } 421 w.Intercom('onShow', function () { 422 setIntercomCookie(intercomCookieName, "true", 60); 423 }); 424 w.Intercom('onHide', function () { 425 setIntercomCookie(intercomCookieName, "false", 60); 426 }); 427 } 428 })() 429 </script> 430 } 431 } 432 } 433 434 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 435 <script type="text/javascript"> 436 piAId = '867102'; 437 piCId = '43215'; 438 piHostname = 'pi.pardot.com'; 439 440 @*var onlyFunctional = '@GetGlobalValue("Global:CookieOptInLevel").ToLower()' === 'functional';*@ 441 442 (function() { 443 function async_load(){ 444 var s = document.createElement('script'); s.type = 'text/javascript'; 445 s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js'; 446 var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c); 447 } 448 if(window.attachEvent) { window.attachEvent('onload', async_load); } 449 else { window.addEventListener('load', async_load, false); } 450 })(); 451 </script> 452 453 <script> 454 $(function () { 455 // seo original pageview tracking 456 var anonymized = '@GetGlobalValue("Global:CookieOptInLevel").ToLower()' === 'functional'; 457 SEO.trackOriginalView(anonymized); 458 459 460 console.log('Init recaptcha v3'); 461 const RECAPTCHA_SITE_KEY = "@reCaptchaSiteKey"; 462 const TOKEN_TTL_MS = 90 * 1000; // refresh every 90 seconds 463 464 function updateRecaptchaToken() { 465 const elements = document.getElementsByClassName("g-recaptcha-response"); 466 const textarea = elements[0]; 467 if (!textarea) return false; // element not yet available 468 469 grecaptcha.ready(() => { 470 grecaptcha.execute(RECAPTCHA_SITE_KEY, { action: "submit" }) 471 .then((token) => { 472 textarea.value = token; 473 }); 474 }); 475 return true; 476 } 477 478 // Wait until the textarea is rendered, then start token refresh 479 const waitForTextarea = setInterval(() => { 480 if (updateRecaptchaToken()) { 481 clearInterval(waitForTextarea); 482 setInterval(updateRecaptchaToken, TOKEN_TTL_MS); 483 } 484 }, 200); 485 486 @RenderSnippet("JavaScriptDocReady") 487 }); 488 </script> 489 490 491 </body> 492 </html> 493