An error occurred while processing the template.
Java method "com.sun.proxy.$Proxy804.getArticle(long, String)" threw an exception when invoked on com.sun.proxy.$Proxy804 object "com.liferay.journal.service.impl.JournalArticleLocalServiceImpl@76d23f59"; see cause exception in the Java stack trace. ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign journalArticle = JournalArtic... [in template "10154#10192#" at line 11, column 1] ----
1<!-- https://gsmblog.net/blog/date-objects-liferay-freemarker-web-content-templates/ -->
2<#-- Retrieve the published date meta data field of the web content -->
3<#assign displaydate = .vars['reserved-article-display-date'].data>
4<#assign createdate = .vars['reserved-article-create-date'].data>
5<#assign modifieddate = .vars['reserved-article-modified-date'].data>
6<#assign articleId = .vars['reserved-article-id'].data>
7
8<#assign JournalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")>
9<#assign AssetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")>
10
11<#assign journalArticle = JournalArticleLocalService.getArticle(groupId, articleId)>
12<#assign journalArticleResource = journalArticle.getArticleResource()>
13<#assign assetEntry = AssetEntryLocalService.fetchEntry(groupId, journalArticleResource.getUuid())>
14
15<#-- Save the original page locale for later -->
16<#assign originalLocale = .locale>
17
18<#-- Set the page locale to the portals default locale -->
19<#setting locale = localeUtil.getDefault()>
20
21<#-- Parse the date to a date object -->
22<#assign displaydate = displaydate?datetime("EEE, d MMM yyyy HH:mm:ss Z")>
23<#assign createdate = createdate?datetime("EEE, d MMM yyyy HH:mm:ss Z")>
24<#assign modifieddate = modifieddate?datetime("EEE, d MMM yyyy HH:mm:ss Z")>
25
26<#-- Set the page locale back to the original page locale -->
27<#assign locale = originalLocale>
28
29<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext()>
30<#assign themeDisplay = serviceContext.getThemeDisplay() />
31
32<#assign sectionTitles = []>
33<#list Subtitle.getSiblings() as cur_subTitle>
34 <#if cur_subTitle?? && cur_subTitle.getData()?? && cur_subTitle.getData() != "">
35 <#assign sectionTitles = sectionTitles + [cur_subTitle]>
36 </#if>
37</#list>
38
39<#function cleanContractions str>
40 <#assign returnString = '' />
41 <#list 0..<str?length as i>>
42 <#if i != 0 && i != str?length - 1 >
43 <#if str[i - 1] == "-" && str[i + 1] == "-">
44 <#if str[i] != "a" && str[i] != "i">
45 <#assign returnString = str[0..i-2] + "'" + str[i..str?length-1] />
46 <#else>
47 <#assign returnString = str />
48 </#if>
49 <#else>
50 <#assign returnString = str />
51 </#if>
52 </#if>
53 </#list>
54 <#return returnString>
55</#function>
56
57<#function cleanImageURL imageURL>
58 <#if imageURL?contains("@root")>
59 <#return imageURL?keep_after("root_path@") >
60 <#else>
61 <#return imageURL >
62 </#if>
63</#function>
64
65<section class="title-with-sections 2019">
66
67 <div class="row page-layout">
68
69 <div class="col-md-3 col-sm-16">
70 <div class="page-date">
71 <#-- Logic is inverted because HideDateInSidebar (Boolean7kfq) is undefined by default -->
72 <#if Boolean7kfq?? && getterUtil.getBoolean(Boolean7kfq.getData())>
73 <#else>
74 <h4 class="h4">${assetEntry.getPublishDate()?date}</h4>
75 </#if>
76 </div>
77 </div>
78
79 <div class="col-md-10 col-sm-16">
80 <#if Title.getData() != "">
81 <div class="page-title">
82 <h1 class="h1">${Title.getData()}</h1>
83 </div>
84 </#if>
85
86 <#if sectionTitles?size != 0>
87 <div class="mobile-page-nav">
88 <select name="page-nav" class="form-control">
89 <option value="" selected="true" disabled="true">Jump to section</option>
90 <#list Subtitle.getSiblings() as section>
91 <#if section.getData() != "">
92 <option value="#${section.getData()?replace(" ", "_")}">${section.getData()}</option>
93 </#if>
94 </#list>
95 </select>
96 </div>
97 </#if>
98
99 <#list Subtitle.getSiblings() as section>
100 <section>
101 <#if section.getData() != "">
102 <div class="section-title">
103 <#assign currentUrl = themeDisplay.getPortalURL() + themeDisplay.getURLCurrent() />
104 <#assign temp = section.getData()?replace(" ", "_") />
105 <#assign sectionID = temp?replace("\\W","", "r") />
106 <button class="section-hyperlink" data-url="#${sectionID}_2019">
107 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"> <g fill="#3C5976" transform="translate(2 2)"> <path d="M6.46966991,10.1913079 L7.06366991,10.7853079 C7.19742939,10.9190674 7.41355912,11.0987434 7.70019478,11.2769265 C8.57658114,11.8217201 9.54159691,11.9862244 10.4719295,11.469604 C10.6962841,11.3450182 10.90851,11.183128 11.1073301,10.9843079 L15.7473872,6.34325075 C15.8607328,6.22990523 16.0062522,6.04910633 16.1479065,5.80442489 C16.7709911,4.72816198 16.7077829,3.45910054 15.5483301,2.29964772 L14.4883301,1.23964772 C14.3545706,1.10588825 14.1384409,0.926212244 13.8518052,0.748029107 C12.9754189,0.203235524 12.0104031,0.038731182 11.0800705,0.555351622 C10.8557159,0.679937389 10.64349,0.841827652 10.4446699,1.04064772 L7.98477774,3.49953992 C7.69182498,3.79237359 7.69172844,4.26724732 7.98456211,4.56020007 C8.27739578,4.85315283 8.75226951,4.85324937 9.04522226,4.5604157 L11.5052223,2.1014157 C11.607414,1.99922402 11.7083835,1.92220234 11.8082861,1.86672574 C12.1751901,1.66298129 12.5985233,1.73514606 13.0598905,2.0219487 C13.2377414,2.13250725 13.3689349,2.24157292 13.4276699,2.3003079 L14.4876699,3.3603079 C15.1279755,4.00061344 15.1541946,4.52702838 14.8497592,5.05288402 C14.7800388,5.17331299 14.7141837,5.25513398 14.6866699,5.28264772 L10.0466128,9.92370487 C9.94458604,10.0257316 9.84361645,10.1027533 9.74371392,10.1582299 C9.37680992,10.3619743 8.95347672,10.2898096 8.49210946,10.0030069 C8.31425862,9.89244838 8.18306507,9.78338271 8.12433009,9.72464772 L7.53033009,9.13064772 C7.23743687,8.83775451 6.76256313,8.83775451 6.46966991,9.13064772 C6.1767767,9.42354094 6.1767767,9.89841468 6.46966991,10.1913079 Z"/> <path d="M10.3109958,6.83364772 L9.71699575,6.23964772 C9.58323628,6.10588825 9.36710655,5.92621224 9.08047089,5.74802911 C8.20408453,5.20323552 7.23906875,5.03873118 6.30873617,5.55535162 C6.08438152,5.67993739 5.87215565,5.84182765 5.67333558,6.04064772 L1.03327844,10.6817049 C0.919932909,10.7950504 0.774413466,10.9758493 0.632759199,11.2205307 C0.00967461158,12.2967936 0.072882768,13.5658551 1.23233558,14.7253079 L2.29233558,15.7853079 C2.42609505,15.9190674 2.64222479,16.0987434 2.92886045,16.2769265 C3.8052468,16.8217201 4.77026258,16.9862244 5.70059516,16.469604 C5.92494981,16.3450182 6.13717568,16.183128 6.33599575,15.9843079 L8.79588793,13.5254157 C9.08884069,13.232582 9.08893722,12.7577083 8.79610355,12.4647555 C8.50326988,12.1718028 8.02839616,12.1717063 7.7354434,12.4645399 L5.2754434,14.9235399 C5.1732517,15.0257316 5.07228212,15.1027533 4.97237959,15.1582299 C4.60547559,15.3619743 4.18214238,15.2898096 3.72077513,15.0030069 C3.54292429,14.8924484 3.41173073,14.7833827 3.35299575,14.7246477 L2.29299575,13.6646477 C1.65269021,13.0243422 1.62647105,12.4979272 1.93090647,11.9720716 C2.00062683,11.8516426 2.06648201,11.7698216 2.09399575,11.7423079 L6.73405289,7.10125075 C6.83607963,6.99922402 6.93704921,6.92220234 7.03695174,6.86672574 C7.40385574,6.66298129 7.82718895,6.73514606 8.2885562,7.0219487 C8.46640705,7.13250725 8.5976006,7.24157292 8.65633558,7.3003079 L9.25033558,7.8943079 C9.5432288,8.18720112 10.0181025,8.18720112 10.3109958,7.8943079 C10.603889,7.60141468 10.603889,7.12654094 10.3109958,6.83364772 Z"/> </g> </svg>
108 </button>
109 <h2 id="${sectionID}_2019">${section.getData()}</h2>
110 </div>
111 </#if>
112 <div class="section-content">
113 ${section.Body.getData()}
114 </div>
115 </section>
116 </#list>
117 </div>
118
119 <div class="col-md-3 col-sm-16 page-nav">
120 <#if showRightHandNav?? && getterUtil.getBoolean(showRightHandNav.getData())>
121 <div class="page-nav-container">
122 <#if sectionTitles?size != 0>
123 <div class="page-nav-title" style="margin-bottom: 1rem" >
124 <h2 class="page-nav-title-h2" >Sections</h2>
125 </div>
126 <nav class="page-nav-list">
127 <#list Subtitle.getSiblings() as section>
128 <#if section.getData() != "">
129 <div class="page-nav-item">
130 <a class="page-nav-link" data-senna-off="true" href="#${section.getData()?replace(" ", "_")?replace("\\W","", "r")}" >
131 ${section.getData()}
132 </a>
133 </div>
134 </#if>
135 </#list>
136 </nav>
137 </#if>
138 </div>
139 </#if>
140 </div>
141 </div>
142 <div class="fixed-jump-to-top-button jump-to-top-button">
143 <div class="row">
144 <div class="col-md-8">
145 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="19" viewBox="0 0 16 19"> <path fill="#3C5976" d="M8.70320061,4.28823998 L8.70320061,17.4126841 C8.70320061,17.8959333 8.31144977,18.2876841 7.82820061,18.2876841 C7.34495145,18.2876841 6.95320061,17.8959333 6.95320061,17.4126841 L6.95320061,4.28785174 L2.48442136,8.62526255 C2.13765366,8.96183633 1.58369594,8.95357254 1.24712216,8.60680484 C0.910548372,8.26003715 0.918812169,7.70607943 1.26557986,7.36950564 L7.82800061,1 L14.3904214,7.36950564 C14.7371891,7.70607943 14.7454528,8.26003715 14.4088791,8.60680484 C14.0723053,8.95357254 13.5183476,8.96183633 13.1715799,8.62526255 L8.70320061,4.28823998 Z"></path> </svg>
146 <span>To Top</span>
147 </div>
148 </div>
149 </div>
150</section>
151
152<section class="title-with-sections 2017">
153
154 <div class="row page-layout">
155
156 <div class="col-xl-3 col-sm-16">
157 <div class="page-date">
158 <#-- Logic is inverted because HideDateInSidebar (Boolean7kfq) is undefined by default -->
159 <#if Boolean7kfq?? && getterUtil.getBoolean(Boolean7kfq.getData())>
160 <#else>
161 <h4 class="h4">${assetEntry.getPublishDate()?date}</h4>
162 </#if>
163 </div>
164 </div>
165
166 <div class="col-xl-10 col-sm-16">
167 <#if Title.getData() != "">
168 <div class="page-title">
169 <h1 class="h1">${Title.getData()}</h1>
170 </div>
171 </#if>
172
173 <#if sectionTitles?size != 0>
174 <div class="mobile-page-nav">
175 <select name="page-nav" class="form-control">
176 <option value="" selected="true" disabled="true">Jump to section</option>
177 <#list Subtitle.getSiblings() as section>
178 <#if section.getData() != "">
179 <option value="#${section.getData()?replace(" ", "_")}">${section.getData()}</option>
180 </#if>
181 </#list>
182 </select>
183 </div>
184 </#if>
185
186 <#list Subtitle.getSiblings() as section>
187 <section>
188 <#if section.getData() != "">
189 <div class="section-title">
190 <#assign currentUrl = themeDisplay.getPortalURL() + themeDisplay.getURLCurrent() />
191 <#assign temp = section.getData()?replace(" ", "_") />
192 <#assign sectionID = temp?replace("\\W","", "r") />
193 <button class="section-hyperlink" data-url="#${sectionID}_2017">
194 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"> <g fill="#3C5976" transform="translate(2 2)"> <path d="M6.46966991,10.1913079 L7.06366991,10.7853079 C7.19742939,10.9190674 7.41355912,11.0987434 7.70019478,11.2769265 C8.57658114,11.8217201 9.54159691,11.9862244 10.4719295,11.469604 C10.6962841,11.3450182 10.90851,11.183128 11.1073301,10.9843079 L15.7473872,6.34325075 C15.8607328,6.22990523 16.0062522,6.04910633 16.1479065,5.80442489 C16.7709911,4.72816198 16.7077829,3.45910054 15.5483301,2.29964772 L14.4883301,1.23964772 C14.3545706,1.10588825 14.1384409,0.926212244 13.8518052,0.748029107 C12.9754189,0.203235524 12.0104031,0.038731182 11.0800705,0.555351622 C10.8557159,0.679937389 10.64349,0.841827652 10.4446699,1.04064772 L7.98477774,3.49953992 C7.69182498,3.79237359 7.69172844,4.26724732 7.98456211,4.56020007 C8.27739578,4.85315283 8.75226951,4.85324937 9.04522226,4.5604157 L11.5052223,2.1014157 C11.607414,1.99922402 11.7083835,1.92220234 11.8082861,1.86672574 C12.1751901,1.66298129 12.5985233,1.73514606 13.0598905,2.0219487 C13.2377414,2.13250725 13.3689349,2.24157292 13.4276699,2.3003079 L14.4876699,3.3603079 C15.1279755,4.00061344 15.1541946,4.52702838 14.8497592,5.05288402 C14.7800388,5.17331299 14.7141837,5.25513398 14.6866699,5.28264772 L10.0466128,9.92370487 C9.94458604,10.0257316 9.84361645,10.1027533 9.74371392,10.1582299 C9.37680992,10.3619743 8.95347672,10.2898096 8.49210946,10.0030069 C8.31425862,9.89244838 8.18306507,9.78338271 8.12433009,9.72464772 L7.53033009,9.13064772 C7.23743687,8.83775451 6.76256313,8.83775451 6.46966991,9.13064772 C6.1767767,9.42354094 6.1767767,9.89841468 6.46966991,10.1913079 Z"/> <path d="M10.3109958,6.83364772 L9.71699575,6.23964772 C9.58323628,6.10588825 9.36710655,5.92621224 9.08047089,5.74802911 C8.20408453,5.20323552 7.23906875,5.03873118 6.30873617,5.55535162 C6.08438152,5.67993739 5.87215565,5.84182765 5.67333558,6.04064772 L1.03327844,10.6817049 C0.919932909,10.7950504 0.774413466,10.9758493 0.632759199,11.2205307 C0.00967461158,12.2967936 0.072882768,13.5658551 1.23233558,14.7253079 L2.29233558,15.7853079 C2.42609505,15.9190674 2.64222479,16.0987434 2.92886045,16.2769265 C3.8052468,16.8217201 4.77026258,16.9862244 5.70059516,16.469604 C5.92494981,16.3450182 6.13717568,16.183128 6.33599575,15.9843079 L8.79588793,13.5254157 C9.08884069,13.232582 9.08893722,12.7577083 8.79610355,12.4647555 C8.50326988,12.1718028 8.02839616,12.1717063 7.7354434,12.4645399 L5.2754434,14.9235399 C5.1732517,15.0257316 5.07228212,15.1027533 4.97237959,15.1582299 C4.60547559,15.3619743 4.18214238,15.2898096 3.72077513,15.0030069 C3.54292429,14.8924484 3.41173073,14.7833827 3.35299575,14.7246477 L2.29299575,13.6646477 C1.65269021,13.0243422 1.62647105,12.4979272 1.93090647,11.9720716 C2.00062683,11.8516426 2.06648201,11.7698216 2.09399575,11.7423079 L6.73405289,7.10125075 C6.83607963,6.99922402 6.93704921,6.92220234 7.03695174,6.86672574 C7.40385574,6.66298129 7.82718895,6.73514606 8.2885562,7.0219487 C8.46640705,7.13250725 8.5976006,7.24157292 8.65633558,7.3003079 L9.25033558,7.8943079 C9.5432288,8.18720112 10.0181025,8.18720112 10.3109958,7.8943079 C10.603889,7.60141468 10.603889,7.12654094 10.3109958,6.83364772 Z"/> </g> </svg>
195 </button>
196 <h2 id="${sectionID}_2017">${section.getData()}</h2>
197 </div>
198 </#if>
199 <div class="section-content">
200 ${section.Body.getData()}
201 </div>
202 </section>
203 </#list>
204 </div>
205
206 <div class="col-xl-3 col-sm-16 page-nav">
207 <#if showRightHandNav?? && getterUtil.getBoolean(showRightHandNav.getData())>
208 <div class="page-nav-container">
209 <#if sectionTitles?size != 0>
210 <div class="page-nav-title" style="margin-bottom: 1rem" >
211 <h2 class="page-nav-title-h2">Sections</h2>
212 </div>
213 <nav class="page-nav-list">
214 <#list Subtitle.getSiblings() as section>
215 <#if section.getData() != "">
216 <div class="page-nav-item">
217 <a class="page-nav-link" data-senna-off="true" href="#${section.getData()?replace(" ", "_")?replace("\\W","", "r")}">
218 ${section.getData()}
219 </a>
220 </div>
221 </#if>
222 </#list>
223 </nav>
224 </#if>
225 </div>
226 </#if>
227 </div>
228 </div>
229 <div class="fixed-jump-to-top-button jump-to-top-button">
230 <div class="row">
231 <div class="col-xl-3 col-md-8">
232 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="19" viewBox="0 0 16 19"> <path fill="#3C5976" d="M8.70320061,4.28823998 L8.70320061,17.4126841 C8.70320061,17.8959333 8.31144977,18.2876841 7.82820061,18.2876841 C7.34495145,18.2876841 6.95320061,17.8959333 6.95320061,17.4126841 L6.95320061,4.28785174 L2.48442136,8.62526255 C2.13765366,8.96183633 1.58369594,8.95357254 1.24712216,8.60680484 C0.910548372,8.26003715 0.918812169,7.70607943 1.26557986,7.36950564 L7.82800061,1 L14.3904214,7.36950564 C14.7371891,7.70607943 14.7454528,8.26003715 14.4088791,8.60680484 C14.0723053,8.95357254 13.5183476,8.96183633 13.1715799,8.62526255 L8.70320061,4.28823998 Z"></path> </svg>
233 <span>To Top</span>
234 </div>
235 </div>
236 </div>
237</section>
238
239<!-- -->
240<#if UseThumbnailImage?? && getterUtil.getBoolean(UseThumbnailImage.getData())>
241 <#if UseThumbnailImage.ThumbnailImage.getData()?? && UseThumbnailImage.ThumbnailImage.getData() != "">
242 <#if UseThumbnailImage.SocialMediaCardTitle?? && UseThumbnailImage.SocialMediaCardTitle.getData()?? && UseThumbnailImage.SocialMediaCardTitle.getData() != "">
243 <#assign title = UseThumbnailImage.SocialMediaCardTitle.getData() />
244 <#else>
245 <#assign title = themeDisplay.getURLCurrent()?keep_after_last("/") />
246 <#assign title = cleanContractions(title)?replace("-", " ")?capitalize />
247 </#if>
248 <#assign imageURL = UseThumbnailImage.ThumbnailImage.getData() >
249 <img style="display: none" alt="${UseThumbnailImage.ThumbnailImage.getAttribute("alt")}" data-fileentryid="${UseThumbnailImage.ThumbnailImage.getAttribute("fileEntryId")}" src="${UseThumbnailImage.ThumbnailImage.getData()}" />
250 <!-- <meta name="twitter:description" content="${UseThumbnailImage.ThumbnailImage.getAttribute("alt")}"> <meta property="og:description" content="${UseThumbnailImage.ThumbnailImage.getAttribute("alt")}"/> -->
251 <@liferay_util["html-top"]>
252
253 <!-- Twitter -->
254 <meta name="twitter:card" content="summary_large_image" />
255 <meta name="twitter:title" content="${title}">
256 <meta name="twitter:image" content="https://www.cmap.illinois.gov${cleanImageURL(imageURL)}">
257
258 <!-- Facebook and LinkedIn -->
259
260 <meta property="og:title" content="${title}" />
261 <meta property="og:image" content="https://www.cmap.illinois.gov${cleanImageURL(imageURL)}" />
262 <meta property="og:url" content="https://www.cmap.illinois.gov${themeDisplay.getURLCurrent()}" />
263
264 </@>
265 </#if>
266</#if>
267
268<script type="text/javascript">
269
270 var cmap = cmap || {};
271 cmap.titleWithSections = cmap.titleWithSections || {};
272
273 cmap.titleWithSections.init = function() {
274 $('.page-nav').css("width", "18.75%");
275
276 $('.standalone-section').each(function() {
277 var $this = $(this);
278 var $sectionTitle = $this.find('.section-title > h2');
279 if ($sectionTitle.text().length) {
280 var title = $sectionTitle.data('text');
281 var id = $sectionTitle.attr('id');
282 $('.page-nav-list').append('<div class="page-nav-item"><a href="#' + id + '">' + title + '</a></div>')
283 $('.mobile-page-nav select').append('<option value="#'+id+'">' + title + '</option>');
284 }
285 });
286 // console.log($('.page-nav-container').offset());
287
288 // $('.page-nav-container').data('original-offset-top', $('.page-nav-container').offset().top);
289
290 // console.log("page-nav-container offset top: " + $('.page-nav-container').offset().top);
291
292 // remove inline styles from content items
293 var pathname = window.location.pathname.replace('/web/guest','');
294
295 if ((pathname.indexOf('/on-to-2050/') !== 0) && (pathname.indexOf('/2050/') !== 0)) {
296 $('.section-content').find('h1,h2,h3,h4,h5,h6,p,a,table').removeAttr('style');
297 $('.section-content').find('span').each((index, value) => { value.style.fontFamily = '' });
298 }
299
300 // remove empty paragraphs
301 //$('p').each(function(){
302 // var $p = $(this);
303 // console.log($p)
304 // if($p.html().trim() === ' '){
305 // console.log($p)
306 // $p.remove();
307 // }
308 //});
309
310 // Stolen from stack overflow
311 // https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
312 function copyToClipboard(text) {
313 if (window.clipboardData && window.clipboardData.setData) {
314 // IE specific code path to prevent textarea being shown while dialog is visible.
315 return clipboardData.setData("Text", text);
316 } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
317 var textarea = document.createElement("textarea");
318 textarea.textContent = text;
319 textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in MS Edge.
320 document.body.appendChild(textarea);
321 textarea.select();
322 try {
323 return document.execCommand("copy"); // Security exception may be thrown by some browsers.
324 } catch (ex) {
325 console.warn("Copy to clipboard failed.", ex);
326 return false;
327 } finally {
328 document.body.removeChild(textarea);
329 }
330 }
331 }
332
333 $('.section-hyperlink').click(function(){
334 var toCopy = window.location.origin + window.location.pathname + $(this).data('url');
335 window.history.replaceState(null, '', $(this).data('url'));
336 var status = copyToClipboard(toCopy);
337 console.log(toCopy, Liferay.currentUrl, status);
338 });
339
340 $('.jump-to-top-button').click(function(){
341 $('html,body').animate({
342 scrollTop: 0
343 }, 800);
344 });
345 };
346
347 cmap.titleWithSections.bindEvents = function() {
348
349 $(window).off('scroll').on('scroll', _.throttle(cmap.titleWithSections.computeScrollNav, 100));
350
351 function moveToID(id){
352 if($('.cmap-2017-theme').length) {
353 id = id + "_2017";
354 } else {
355 id = id + "_2019";
356 };
357 var push = $('#scroll-nav').innerHeight() * 1.5;
358 var target = $(id).offset().top;
359 $('html,body').animate({
360 scrollTop: target - push
361 }, 800);
362 }
363 $('.page-nav-item a').click(function(e){
364 e.preventDefault();
365 moveToID($(this).attr('href'));
366 });
367
368 $('.mobile-page-nav select').on('change', function(){
369 moveToID($(this).val());
370 });
371
372 var $banner = $('#banner'), $scroll_nav = $('#scroll-nav');
373 if($banner.length && $scroll_nav.length){
374 $(window).scroll(_.throttle(function(){
375 var this_scroll = window.scrollY + $('#ControlMenu').innerHeight();
376 var target_scroll = $banner.offset().top + $banner.innerHeight();
377 if(this_scroll > target_scroll){
378 $scroll_nav.addClass('active');
379 } else {
380 $scroll_nav.removeClass('active');
381 }
382 },100));
383 }
384 };
385
386 cmap.titleWithSections.computeScrollNav = function() {
387
388 var titleWithSectionsNodes = document.querySelectorAll("section.title-with-sections");
389 if($('.cmap-2017-theme').length){
390 var titleWithSectionsNode = titleWithSectionsNodes[1];
391 }
392 else{
393 var titleWithSectionsNode = titleWithSectionsNodes[0];
394 }
395
396 var bodyRect = document.body.getBoundingClientRect();
397 var elemRect = titleWithSectionsNode ? titleWithSectionsNode.getBoundingClientRect() : null;
398 var offset = (elemRect ? elemRect.top : 0) - bodyRect.top;
399
400 var scrollTop = $(window).scrollTop();
401 var navHeight = $('#scroll-nav').height();
402 var currentOffset = scrollTop + navHeight;
403
404 if (currentOffset > offset) {
405 $('.page-nav-container').addClass('fixed');
406 $('.page-nav-container').css("top", "2.656em");
407 } else {
408 $('.page-nav-container').removeClass('fixed');
409 $('.page-nav-container').css("top", "0");
410 }
411 };
412
413 AUI().ready(function(){
414 //cmap.titleWithSections.init();
415 //cmap.titleWithSections.bindEvents()
416 setTimeout(function(){cmap.titleWithSections.init()}, 500);
417 setTimeout(function(){cmap.titleWithSections.bindEvents()}, 500);
418 });
419
420</script>
421
422<script>
423 Liferay.on(
424 'allPortletsReady',
425 function() {
426 if($('.cmap-2017-theme').length){
427 $('.2019').hide();
428 }
429 else{
430 console.log("hiding 2017");
431 $('.2017').hide();
432 }
433 }
434 );
435</script>