1/* eslint-disable */ 2 3(function($, window, document) { 4 Handlebars.registerHelper("if_eq", function(a, b, opts) { 5 if (a === b) { 6 return opts.fn(this); 7 } else { 8 return opts.inverse(this); 9 } 10 }); 11 12 var StageDomainNames = [ 13 "https://stage-wwwtest.ncdot.gov", 14 "https://stage-wwwqc.ncdot.gov", 15 "https://stage-www.ncdot.gov", 16 ]; 17 var NonRootSiteCollections = ["/dmv", "/news", "/projects", "/search"]; 18 19 /*Wide Nav*/ 20 $.WideNav = function(element, options) { 21 var settings = $.extend({}, $.WideNav.defaultOptions, options); 22 23 var templateScript = 24 '<li class="wide-nav__list-item" role="none">' + 25 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">About' + 26 '<i class="icon-keyboard-arrow-down"></i></a>' + 27 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 28 '<div class="wide-nav-sub__inner-wrapper">' + 29 '<p id="wide-nav-about" class="heading wide-nav-sub__title" aria-hidden="true">About</p>' + 30 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-about">' + 31 "{{#each items}}" + 32 '{{#if_eq parentUniqueID "About Us"}}' + 33 '<li class="wide-nav-sub__list-item grid__cell wide-nav__link--with-menu" role="none">' + 34 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href=" {{ linkUrl }}"> {{ title }} </a>' + 35 "</li>" + 36 "{{/if_eq}}" + 37 "{{/each}}" + 38 "</ul>" + 39 "</div>" + 40 "</div>" + 41 "</li>" + 42 '<li class="wide-nav__list-item" role="none">' + 43 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">News & Events' + 44 '<i class="icon-keyboard-arrow-down"></i></a>' + 45 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 46 '<div class="wide-nav-sub__inner-wrapper">' + 47 '<p id="wide-nav-news" class="heading wide-nav-sub__title" aria-hidden="true">News & Events</p>' + 48 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-news">' + 49 "{{#each items}}" + 50 '{{#if_eq parentUniqueID "News & Events"}}' + 51 '<li class="wide-nav-sub__list-item grid__cell wide-nav__link--with-menu" role="none">' + 52 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href=" {{ linkUrl }}"> {{ title }} </a>' + 53 "</li>" + 54 "{{/if_eq}}" + 55 "{{/each}}" + 56 "</ul>" + 57 "</div>" + 58 "</div>" + 59 "</li>" + 60 '<li class="wide-nav__list-item" role="none">' + 61 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">Divisions' + 62 '<i class="icon-keyboard-arrow-down"></i></a>' + 63 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 64 '<div class="wide-nav-sub__inner-wrapper">' + 65 '<p id="wide-nav-divisions" class="heading wide-nav-sub__title" aria-hidden="true">Divisions</p>' + 66 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-divisions">' + 67 "{{#each items}}" + 68 '{{#if_eq parentUniqueID "Divisions"}}' + 69 '<li class="wide-nav-sub__list-item grid__cell wide-nav__link--with-menu" role="none">' + 70 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href=" {{ linkUrl }}"> {{ title }} </a>' + 71 "</li>" + 72 "{{/if_eq}}" + 73 "{{/each}}" + 74 "</ul>" + 75 "</div>" + 76 "</div>" + 77 "</li>" + 78 '<li class="wide-nav__list-item" role="none">' + 79 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">Initiatives & Policies' + 80 '<i class="icon-keyboard-arrow-down"></i></a>' + 81 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 82 '<div class="wide-nav-sub__inner-wrapper">' + 83 '<p id="wide-nav-policies" class="heading wide-nav-sub__title" aria-hidden="true">Initiatives & Policies</p>' + 84 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-policies">' + 85 "{{#each items}}" + 86 '{{#if_eq parentUniqueID "Initiatives & Policies"}}' + 87 '<li class="wide-nav-sub__list-item grid__cell wide-nav__link--with-menu" role="none">' + 88 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href=" {{ linkUrl }}"> {{ title }} </a>' + 89 "</li>" + 90 "{{/if_eq}}" + 91 "{{/each}}" + 92 "</ul>" + 93 "</div>" + 94 "</div>" + 95 "</li>" + 96 '<li class="wide-nav__list-item" role="none">' + 97 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">Travel & Maps' + 98 '<i class="icon-keyboard-arrow-down"></i></a>' + 99 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 100 '<div class="wide-nav-sub__inner-wrapper">' + 101 '<p id="wide-nav-travel" class="heading wide-nav-sub__title" aria-hidden="true">Travel & Maps</p>' + 102 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-travel">' + 103 "{{#each items}}" + 104 '{{#if_eq parentUniqueID "Travel & Maps"}}' + 105 '<li class="wide-nav-sub__list-item grid__cell wide-nav__link--with-menu" role="none">' + 106 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href=" {{ linkUrl }}"> {{ title }} </a>' + 107 "</li>" + 108 "{{/if_eq}}" + 109 "{{/each}}" + 110 "</ul>" + 111 "</div>" + 112 "</div>" + 113 "</li>" + 114 '<li class="wide-nav__list-item" role="none">' + 115 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">Projects' + 116 '<i class="icon-keyboard-arrow-down"></i></a>' + 117 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 118 '<div class="wide-nav-sub__inner-wrapper">' + 119 '<p id="wide-nav-projects" class="heading wide-nav-sub__title" aria-hidden="true">Projects & Studies</p>' + 120 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-projects">' + 121 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 122 '<span class="wide-nav-sub__link">Projects</span>' + //role="menuitem" tabindex="" 123 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 124 '<ul class="wide-nav-sub-sub__list" role="menu">' + 125 "{{#each items}}" + 126 '{{#if_eq uniqueID "Projects"}}' + 127 '<li class="wide-nav-sub-sub__list-item" role="none">' + 128 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 129 "</li>" + 130 "{{/if_eq}}" + 131 "{{/each}}" + 132 "</ul></div>" + 133 "</li>" + 134 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 135 '<span class="wide-nav-sub__link" >Studies</span>' + //role="menuitem" tabindex="" 136 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 137 '<ul class="wide-nav-sub-sub__list" role="menu">' + 138 "{{#each items}}" + 139 '{{#if_eq uniqueID "Studies"}}' + 140 '<li class="wide-nav-sub-sub__list-item" role="none">' + 141 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 142 "</li>" + 143 "{{/if_eq}}" + 144 "{{/each}}" + 145 "</ul></div>" + 146 "</li>" + 147 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 148 '<span class="wide-nav-sub__link" >Related Resources</span>' + //role="menuitem" tabindex="" 149 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 150 '<ul class="wide-nav-sub-sub__list" role="menu">' + 151 "{{#each items}}" + 152 '{{#if_eq uniqueID "Related Resources"}}' + 153 '<li class="wide-nav-sub-sub__list-item" role="none">' + 154 '<a class="wide-nav-sub__link" role="menuitem" tabindex="" href="{{ linkUrl }}"> {{ title }} </a>' + 155 "</li>" + 156 "{{/if_eq}}" + 157 "{{/each}}" + 158 "</ul></div>" + 159 "</li>" + 160 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 161 '<span class="wide-nav-sub__link" >Other Links</span>' + //role="menuitem" tabindex="" 162 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 163 '<ul class="wide-nav-sub-sub__list" role="menu">' + 164 "{{#each items}}" + 165 '{{#if_eq uniqueID "Other Links"}}' + 166 '<li class="wide-nav-sub-sub__list-item" role="none">' + 167 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 168 "</li>" + 169 "{{/if_eq}}" + 170 "{{/each}}" + 171 "</ul></div>" + 172 "</li>" + 173 "</ul>" + 174 "</div>" + 175 "</div>" + 176 "</li>" + 177 '<li class="wide-nav__list-item" role="none">' + 178 '<a class="wide-nav__link " role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="/about-us/our-people/careers/Pages/default.aspx">Careers<i class="icon-keyboard-arrow-down"></i></a>' + 179 "</li>" + 180 '<li class="wide-nav__list-item" role="none">' + 181 '<a class="wide-nav__link " role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="/contact">Contact<i class="icon-keyboard-arrow-down"></i></a>' + 182 "</li>"; 183 184 // Compile the template 185 var template = Handlebars.compile(templateScript); 186 187 // Define data object 188 var context = { 189 items: [], 190 }; 191 192 function getQuery() { 193 var whereQuery = "<Where><Eq><FieldRef Name='RR_IsVisible' /><Value Type='Text'>Yes</Value></Eq></Where>"; 194 var orderByQuery = "<OrderBy><FieldRef Name='RR_SortOrder' Ascending='True' /></OrderBy>"; 195 return "<Query>" + whereQuery + orderByQuery + "</Query>"; 196 } 197 198 function getItems() {
199 context.items = []; 200 var dfd = $.Deferred(); 201 202 $().SPServices({ 203 webURL: getRootSiteCollectionUrl(settings.webUrl), 204 operation: "GetListItems", 205 async: true, 206 listName: settings.listName, 207 CAMLQuery: getQuery(), 208 CAMLViewFields: 209 "<ViewFields><FieldRef Name='Title' />" + 210 "<FieldRef Name='RR_UniqueID' /><FieldRef Name='RR_ParentUniqueID' />" + 211 "<FieldRef Name='RR_LinkUrl' /></ViewFields>", 212 completefunc: function(xData, status) { 213 if (status === "success") { 214 $(xData.responseXML) 215 .SPFilterNode("z:row") 216 .each(function() { 217 var item = { 218 title: $(this).attr("ows_Title"), 219 linkUrl: retrieveLink($(this).attr("ows_RR_LinkUrl")), 220 uniqueID: $(this).attr("ows_RR_UniqueID"), 221 parentUniqueID: $(this).attr("ows_RR_ParentUniqueID"), 222 }; 223 context.items.push(item); 224 }); 225 dfd.resolve(""); 226 } else { 227 dfd.reject(); 228 } 229 }, 230 }); 231 232 return dfd.promise(); 233 } 234 235 // get SharePoint data 236 $.when(getItems()) 237 .fail(function() { 238 console.log("error in wide nav"); 239 }) 240 .done(function() { 241 dataReady(); 242 }); 243 244 function getRootSiteCollectionUrl(scUrl) { 245 var tempUrl = scUrl; 246 247 $.each(NonRootSiteCollections, function(index, item) { 248 tempUrl = tempUrl.replace(item, ""); 249 }); 250 251 return tempUrl; 252 } 253 254 function retrieveLink(x) { 255 var link = x ? x.split(", ")[0] : ""; 256 var host = window.location.host; 257 258 if (host !== "localhost:3000" && host !== "127.0.0.1:3000") { 259 $.each(StageDomainNames, function(index, item) { 260 link = link.replace(item, ""); 261 }); 262 } 263 264 return link; 265 } 266 267 function dataReady() { 268 // render template and add to attached element 269 var renderedHtml = template(context); 270 $(element).append(renderedHtml); 271 272 var menuBtn = $(".wide-nav__link--with-menu"), 273 expandedMenu = $(".wide-nav-sub"), 274 showMoreList = $(".wide-nav__more-btn + ul"), 275 moreList = $(".wide-nav__more-list"), 276 headerHeight = $(".site-header").height(), 277 desktopNav = $(".page-wrapper").find(".wide-nav"); // target element when viewed within a template/page (not in component's standalone demo) 278 279 menuBtn.bind("click", menuBtnHandler); 280 281 function menuBtnHandler(event) { 282 // 283 // update 'active' classes 284 // 285 286 $(this).toggleClass("active"); 287 console.log("this",$(this)); 288 $(this) 289 .next() 290 .not("li") 291 .toggleClass("active"); // this is referring to the sibling ".wide-nav-sub" element (the menu that gets displayed when clicking the menu button) 292 // console.log("next",$(this).next()); 293 showMoreList.removeClass("active"); // hide consolidated nav menu 294 menuBtn.not(this).removeClass("active"); 295 menuBtn 296 .not(this) 297 .next() 298 .removeClass("active"); 299 300 // 301 // update button ARIA attributes 302 // 303 if(!(menuBtn).is("li")){ 304 menuBtn.filter("a").attr("aria-expanded", "false"); // reset all button 'aria-expanded' attributes 305 } 306 307 if ($(this).hasClass("active")) { 308 if ($(this).is("a")) { 309 $(this).attr("aria-expanded", "true"); 310 } 311 } 312 313 // 314 // update expanded menu ARIA attributes 315 // 316 317 if ($(this).next().hasClass("active")) 318 { 319 $(this).next().removeAttr("aria-hidden"); 320 if ($(this).next().is("a")) { 321 if ($(this).next().is("a")) { 322 $(this).next().attr("aria-expanded", "true"); 323 } 324 } 325 } else { 326 $(this).next().attr("aria-hidden", "true"); 327 if ($(this).next().is("a")) { 328 if ($(this).next().is("a")) { 329 $(this).next().attr("aria-expanded", "false"); 330 } 331 } 332 // console.log("hidden", $(this).next().attr("aria-hidden")); 333 } 334 335 // 336 // update tabindex 337 // 338 339 /* in progress */ 340 341 // 342 // prevent page from scrolling to top 343 // 344 345 event.stopPropagation(); 346 } 347 348 // 349 // reset menu when clicking outside of it 350 // 351 352 $(".page-wrapper").bind("tap click", function(e) { 353 var menuBtn = $(".wide-nav__link--with-menu"); 354 355 if ( 356 !$(e.target.offsetParent).is( 357 ".wide-nav-sub__title, .wide-nav, .wide-nav-sub__link, .wide-nav-sub-sub__link, .wide-nav-sub" 358 ) 359 ) { 360 menuBtn.removeClass("active"); 361 menuBtn.next().removeClass("active"); 362 menuBtn.filter("a").attr("aria-expanded", "false"); 363 } 364 }); 365 366 // 367 // close menu when clicking anything but a link 368 // 369 370 $(".page-wrapper").click(function(e) { 371 if ( 372 !$(e.target.offsetParent).is( 373 ".wide-nav-sub__title, .wide-nav, .wide-nav-sub__link, .wide-nav-sub-sub__link, .wide-nav-sub" 374 ) 375 ) { 376 menuBtn.removeClass("active"); 377 menuBtn.next().removeClass("active"); 378 } 379 }); 380 381 // 382 // stick nav to top of viewport on scroll 383 // 384 385 $(window).scroll(function() { 386 if ($(window).scrollTop() > headerHeight) { 387 $(desktopNav).addClass("wide-nav--stuck"); 388 } else { 389 $(desktopNav).removeClass("wide-nav--stuck"); 390 } 391 }); 392 } 393 }; 394 395 $.WideNav.defaultOptions = { 396 webUrl: "", 397 listName: "", 398 }; 399 400 $.fn.wideNav = function(options) { 401 return this.each(function() { 402 new $.WideNav($(this), options); 403 }); 404 }; 405 406 /*End Wide Nav*/ 407
408 /*DMV Wide Nav*/ 409 $.WideNavDMV = function(element, options) { 410 var settings = $.extend({}, $.WideNavDMV.defaultOptions, options); 411 412 var templateScript = 413 '<li class="wide-nav__list-item" role="none">' + 414 '<a class="wide-nav__link " role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0"' + 415 ' href="/dmv/offices-services/online/Pages/default.aspx">Online Services</a>' + 416 "</li>" + 417 '<li class="wide-nav__list-item" role="none">' + 418 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">License & ID' + 419 '<i class="icon-keyboard-arrow-down"></i></a>' + 420 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 421 '<div class="wide-nav-sub__inner-wrapper">' + 422 '<p id="wide-nav-license" class="heading wide-nav-sub__title" aria-hidden="true">License & ID</p>' + 423 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-license">' + 424 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 425 '<span class="wide-nav-sub__link">Driver Licenses</span>' + //role="menuitem" tabindex="" 426 '<div class="wide-nav-sub-sub false">' + 427 '<ul class="wide-nav-sub-sub__list" role="menu">' + 428 "{{#each items}}" + 429 '{{#if_eq uniqueID "Driver Licenses"}}' + 430 '<li class="wide-nav-sub-sub__list-item" role="none">' + 431 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 432 "</li>" + 433 "{{/if_eq}}" + 434 "{{/each}}" + 435 "</ul></div>" + 436 "</li>" + 437 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 438 '<span class="wide-nav-sub__link" >Special Licenses</span>' + //role="menuitem" tabindex="" 439 '<div class="wide-nav-sub-sub false">' + 440 '<ul class="wide-nav-sub-sub__list" role="menu">' + 441 "{{#each items}}" + 442 '{{#if_eq uniqueID "Special Licenses"}}' + 443 '<li class="wide-nav-sub-sub__list-item" role="none">' + 444 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 445 "</li>" + 446 "{{/if_eq}}" + 447 "{{/each}}" + 448 "</ul></div>" + 449 "</li>" + 450 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 451 '<span class="wide-nav-sub__link" >Identification</span>' + //role="menuitem" tabindex="" 452 '<div class="wide-nav-sub-sub false">' + 453 '<ul class="wide-nav-sub-sub__list" role="menu">' + 454 "{{#each items}}" + 455 '{{#if_eq uniqueID "Identification"}}' + 456 '<li class="wide-nav-sub-sub__list-item" role="none">' + 457 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 458 "</li>" + 459 "{{/if_eq}}" + 460 "{{/each}}" + 461 "</ul></div>" + 462 "</li>" + 463 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 464 '<span class="wide-nav-sub__link" >License Suspension</span>' + //role="menuitem" tabindex="" 465 '<div class="wide-nav-sub-sub false">' + 466 '<ul class="wide-nav-sub-sub__list" role="menu">' + 467 "{{#each items}}" + 468 '{{#if_eq uniqueID "License Suspension"}}' + 469 '<li class="wide-nav-sub-sub__list-item" role="none">' + 470 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 471 "</li>" + 472 "{{/if_eq}}" + 473 "{{/each}}" + 474 "</ul></div>" + 475 "</li>" + 476 "</ul>" + 477 "</div>" + 478 "</div>" + 479 "</li>" + 480 '<li class="wide-nav__list-item" role="none">' + 481 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">Title & Registration' + 482 '<i class="icon-keyboard-arrow-down"></i></a>' + 483 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 484 '<div class="wide-nav-sub__inner-wrapper">' + 485 '<p id="wide-nav-title" class="heading wide-nav-sub__title" aria-hidden="true">Title & Registration</p>' + 486 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-title">' + 487 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 488 '<span class="wide-nav-sub__link" >Vehicle Titles</span>' + //role="menuitem" tabindex="" 489 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 490 '<ul class="wide-nav-sub-sub__list" role="menu">' + 491 "{{#each items}}" + 492 '{{#if_eq uniqueID "Vehicle Titles"}}' + 493 '<li class="wide-nav-sub-sub__list-item" role="none">' + 494 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 495 "</li>" + 496 "{{/if_eq}}" + 497 "{{/each}}" + 498 "</ul></div>" + 499 "</li>" + 500 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 501 '<span class="wide-nav-sub__link" >Registration</span>' + //role="menuitem" tabindex="" 502 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 503 '<ul class="wide-nav-sub-sub__list" role="menu">' + 504 "{{#each items}}" + 505 '{{#if_eq uniqueID "Registration"}}' + 506 '<li class="wide-nav-sub-sub__list-item" role="none">' + 507 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 508 "</li>" + 509 "{{/if_eq}}" + 510 "{{/each}}" + 511 "</ul></div>" + 512 "</li>" + 513 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 514 '<span class="wide-nav-sub__link" >License Plates</span>' + //role="menuitem" tabindex="" 515 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 516 '<ul class="wide-nav-sub-sub__list" role="menu">' + 517 "{{#each items}}" + 518 '{{#if_eq uniqueID "License Plates"}}' + 519 '<li class="wide-nav-sub-sub__list-item" role="none">' + 520 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 521 "</li>" + 522 "{{/if_eq}}" + 523 "{{/each}}" + 524 "</ul></div>" + 525 "</li>" + 526 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 527 '<span class="wide-nav-sub__link" >Requirements</span>' + //role="menuitem" tabindex="" 528 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 529 '<ul class="wide-nav-sub-sub__list" role="menu">' + 530 "{{#each items}}" + 531 '{{#if_eq uniqueID "Requirements"}}' + 532 '<li class="wide-nav-sub-sub__list-item" role="none">' + 533 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 534 "</li>" + 535 "{{/if_eq}}" + 536 "{{/each}}" + 537 "</ul></div>" + 538 "</li>" + 539 "</ul>" + 540 "</div>" + 541 "</div>" + 542 "</li>" + 543 // begin programs 544 // '<li class="wide-nav__list-item" role="none">' + 545 // '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" id="" href="javascript:;">Programs' + 546 // '<i class="icon-keyboard-arrow-down"></i></a>' + 547 // '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 548 // '<div class="wide-nav-sub__inner-wrapper">' + 549 // '<p id="wide-nav-programs" class="heading wide-nav-sub__title" aria-hidden="true">Programs</p>' + 550 // '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-programs">' + 551 552 // '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 553 // '<span class="wide-nav-sub__link" >Commercial Trucking</span>' + //role="menuitem" tabindex="" 554 // '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 555 // '<ul class="wide-nav-sub-sub__list" role="menu">' + 556 // '{{#each items}}' + 557 // '{{#if_eq uniqueID "Commercial Trucking"}}' + 558 // '<li class="wide-nav-sub-sub__list-item" role="none">' + 559 // '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 560 // '</li>' + 561 // '{{/if_eq}}' + 562 // '{{/each}}' + 563 // '</ul></div>' + 564 // '</li>' + 565 566 // '<li class="wide-nav-sub__list-item grid__cell wide-nav-sub__list-item--with-split-list" role="none">' + 567 // '<span class="wide-nav-sub__link" >Fraud & Theft Prevention</span>' + //role="menuitem" tabindex="" 568 // '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 569 // '<ul class="wide-nav-sub-sub__list" role="menu">' + 570 // "{{#each items}}" + 571 // '{{#if_eq uniqueID "Fraud & Theft Prevention"}}' + 572 // '<li class="wide-nav-sub-sub__list-item" role="none">' + 573 // '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 574 // "</li>" + 575 // "{{/if_eq}}" + 576 // "{{/each}}" + 577 // "</ul></div>" + 578 // "</li>" + 579 // "</ul>" + 580 // "</div>" + 581 // "</div>" + 582 // "</li>" + 583 // end programs 584 585 '<li class="wide-nav__list-item" role="none">' + 586 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="javascript:;">Offices & Services' + 587 '<i class="icon-keyboard-arrow-down"></i></a>' + 588 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="false" 589 '<div class="wide-nav-sub__inner-wrapper">' + 590 '<p id="wide-nav-services" class="heading wide-nav-sub__title" aria-hidden="true">Offices & Services</p>' + 591 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu" aria-labelledby="wide-nav-services">' + 592 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 593 '<span class="wide-nav-sub__link" >DMV Offices</span>' + //role="menuitem" tabindex="" 594 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 595 '<ul class="wide-nav-sub-sub__list" role="menu">' + 596 "{{#each items}}" + 597 '{{#if_eq uniqueID "DMV Offices"}}' + 598 '<li class="wide-nav-sub-sub__list-item" role="none">' + 599 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 600 "</li>" + 601 "{{/if_eq}}" + 602 "{{/each}}" + 603 "</ul></div>" + 604 "</li>" + 605 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 606 '<span class="wide-nav-sub__link" >Records & Reports</span>' + //role="menuitem" tabindex="" 607 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 608 '<ul class="wide-nav-sub-sub__list" role="menu">' + 609 "{{#each items}}" + 610 '{{#if_eq uniqueID "Records & Reports"}}' + 611 '<li class="wide-nav-sub-sub__list-item" role="none">' + 612 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 613 "</li>" + 614 "{{/if_eq}}" + 615 "{{/each}}" + 616 "</ul></div>" + 617 "</li>" + 618 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 619 '<span class="wide-nav-sub__link" >Online Services</span>' + //role="menuitem" tabindex="" 620 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 621 '<ul class="wide-nav-sub-sub__list" role="menu">' + 622 "{{#each items}}" + 623 '{{#if_eq uniqueID "Online Services"}}' + 624 '<li class="wide-nav-sub-sub__list-item" role="none">' + 625 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 626 "</li>" + 627 "{{/if_eq}}" + 628 "{{/each}}" + 629 "</ul></div>" + 630 "</li>" + 631 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 632 '<span class="wide-nav-sub__link" >Other Services</span>' + //role="menuitem" tabindex="" 633 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 634 '<ul class="wide-nav-sub-sub__list" role="menu">' + 635 "{{#each items}}" + 636 '{{#if_eq uniqueID "Other Services"}}' + 637 '<li class="wide-nav-sub-sub__list-item" role="none">' + 638 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{ title }} </a>' + 639 "</li>" + 640 "{{/if_eq}}" + 641 "{{/each}}" + 642 "</ul></div>" + 643 "</li>" + 644 "</ul>" + 645 "</div>" + 646 "</div>" + 647 "</li>" + 648 '<li class="wide-nav__list-item" role="none">' + 649 '<a class="wide-nav__link wide-nav__link--with-menu" role="menuitem" aria-haspopup="true" aria-expanded="false"' + 650 ' tabindex="0" href="javascript:;">Help' + 651 '<i class="icon-keyboard-arrow-down"></i></a>' + 652 '<div class="wide-nav-sub">' + //aria-label="submenu" aria-labelledby="" aria-hidden="true" aria-expanded="fal'+ 653 '<div class="wide-nav-sub__inner-wrapper">' + 654 '<p id="wide-nav-help" class="heading wide-nav-sub__title" aria-hidden="true">Help</p>' + 655 '<ul class="wide-nav-sub__list grid grid--guttersLg grid--1of4" role="menu"' + 656 ' aria-labelledby="wide-nav-help">' + 657 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 658 '<span class="wide-nav-sub__link">Contact NCDMV</span>' + //role="menuitem" tabindex'+ 659 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 660 '<ul class="wide-nav-sub-sub__list" role="menu">' + 661 "{{#each items}}" + 662 '{{#if_eq uniqueID "Contact NCDMV"}}' + 663 '<li class="wide-nav-sub-sub__list-item" role="none">' + 664 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true"' + 665 ' aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{title' + 666 "}} </a>" + 667 "</li>" + 668 "{{/if_eq}}" + 669 "{{/each}}" + 670 "</ul>" + 671 "</div>" + 672 "</li>" + 673 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 674 '<span class="wide-nav-sub__link">Report a Concern</span>' + //role="menuitem" tabindex'+ 675 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 676 '<ul class="wide-nav-sub-sub__list" role="menu">' + 677 "{{#each items}}" + 678 '{{#if_eq uniqueID "Report a Concern"}}' + 679 '<li class="wide-nav-sub-sub__list-item" role="none">' + 680 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true"' + 681 ' aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{title' + 682 "}} </a>" + 683 "</li>" + 684 "{{/if_eq}}" + 685 "{{/each}}" + 686 "</ul>" + 687 "</div>" + 688 "</li>" + 689 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 690 '<span class="wide-nav-sub__link">Publications</span>' + //role="menuitem" tabindex'+ 691 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 692 '<ul class="wide-nav-sub-sub__list" role="menu">' + 693 "{{#each items}}" + 694 '{{#if_eq uniqueID "Publications"}}' + 695 '<li class="wide-nav-sub-sub__list-item" role="none">' + 696 '<a class="wide-nav-sub__link" role="menuitem" aria-haspopup="true"' + 697 ' aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{title' + 698 "}} </a>" + 699 "</li>" + 700 "{{/if_eq}}" + 701 "{{/each}}" + 702 "</ul>" + 703 "</div>" + 704 "</li>" + 705 '<li class="wide-nav-sub__list-item grid__cell false" role="none">' + 706 '<span class="wide-nav-sub__link">Other Resources</span>' + //role="menuitem" tabindex'+ 707 '<div class="wide-nav-sub-sub wide-nav-sub-sub--split-list">' + 708 '<ul class="wide-nav-sub-sub__list" role="menu">' + 709 "{{#each items}}" + 710 '{{#if_eq uniqueID "Other Resources"}}' + 711 '<li class="wide-nav-sub-sub__list-item" role="none">' + 712 '<a class="wide-nav-s
712ub__link" role="menuitem" aria-haspopup="true"' + 713 ' aria-expanded="false" tabindex="0" href="{{ linkUrl }}"> {{title' + 714 "}} </a>" + 715 "</li>" + 716 "{{/if_eq}}" + 717 "{{/each}}" + 718 "</ul>" + 719 "</div>" + 720 "</li>" + 721 "</li>" + 722 "</div>" + 723 "</li>" + 724 '<li class="wide-nav__list-item" role="none">' + 725 '<a class="wide-nav__link " role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0"' + 726 ' href="/about-us/our-people/careers/Pages/careers-ncdmv.aspx">Careers</a>' + 727 "</li>"; 728 729 // Compile the template 730 var template = Handlebars.compile(templateScript); 731 732 // Define data object 733 var context = { 734 items: [], 735 }; 736 737 function getQuery() { 738 var whereQuery = "<Where><Eq><FieldRef Name='RR_IsVisible' /><Value Type='Text'>Yes</Value></Eq></Where>"; 739 var orderByQuery = "<OrderBy><FieldRef Name='RR_SortOrder' Ascending='True' /></OrderBy>"; 740 return "<Query>" + whereQuery + orderByQuery + "</Query>"; 741 } 742 743 function getItems() { 744 context.items = []; 745 var dfd = $.Deferred(); 746 747 $().SPServices({ 748 // webURL: getRootSiteCollectionUrl(settings.webUrl), 749 webURL: window.location.origin, 750 operation: "GetListItems", 751 async: true, 752 listName: settings.listName, 753 CAMLQuery: getQuery(), 754 CAMLViewFields: 755 "<ViewFields><FieldRef Name='Title' />" + 756 "<FieldRef Name='RR_UniqueID' /><FieldRef Name='RR_ParentUniqueID' />" + 757 "<FieldRef Name='RR_LinkUrl' /></ViewFields>", 758 completefunc: function(xData, status) { 759 if (status === "success") { 760 $(xData.responseXML) 761 .SPFilterNode("z:row") 762 .each(function() { 763 var item = { 764 title: $(this).attr("ows_Title"), 765 linkUrl: retrieveLink($(this).attr("ows_RR_LinkUrl")), 766 uniqueID: $(this).attr("ows_RR_UniqueID"), 767 parentUniqueID: $(this).attr("ows_RR_ParentUniqueID"), 768 }; 769 context.items.push(item); 770 }); 771 dfd.resolve(""); 772 } else { 773 dfd.reject(); 774 } 775 }, 776 }); 777 778 return dfd.promise(); 779 } 780 781 // get SharePoint data 782 $.when(getItems()) 783 .fail(function() { 784 console.log("error in wide nav DMV"); 785 }) 786 .done(function() { 787 dataReady(); 788 }); 789 790 function getRootSiteCollectionUrl(scUrl) { 791 var tempUrl = scUrl; 792 793 $.each(NonRootSiteCollections, function(index, item) { 794 tempUrl = tempUrl.replace(item, ""); 795 }); 796 797 return tempUrl; 798 } 799 800 function retrieveLink(x) { 801 var link = x ? x.split(", ")[0] : ""; 802 var host = window.location.host; 803 804 if (host !== "localhost:3000" && host !== "127.0.0.1:3000") { 805 $.each(StageDomainNames, function(index, item) { 806 link = link.replace(item, ""); 807 }); 808 } 809 810 return link; 811 } 812 813 function dataReady() { 814 // render template and add to attached element 815 var renderedHtml = template(context); 816 $(element).append(renderedHtml); 817 818 var menuBtn = $(".wide-nav__link--with-menu"), 819 expandedMenu = $(".wide-nav-sub"), 820 showMoreList = $(".wide-nav__more-btn + ul"), 821 moreList = $(".wide-nav__more-list"), 822 headerHeight = $(".site-header").height(), 823 desktopNav = $(".page-wrapper").find(".wide-nav"); // target element when viewed within a template/page (not in component's standalone demo) 824 825 menuBtn.bind("click", menuBtnHandler); 826 827 function menuBtnHandler(event) { 828 // 829 // update 'active' classes 830 // 831 832 $(this).toggleClass("active"); 833 $(this) 834 .next() 835 .toggleClass("active"); // this is referring to the sibling ".wide-nav-sub" element (the menu that gets displayed when clicking the menu button) 836 showMoreList.removeClass("active"); // hide consolidated nav menu 837 menuBtn.not(this).removeClass("active"); 838 menuBtn 839 .not(this) 840 .next() 841 .removeClass("active"); 842 843 // 844 // update button ARIA attributes 845 // 846 847 menuBtn.attr("aria-selected", ""); // reset all button 'aria-selected' attributes 848 849 if ($(this).hasClass("active")) { 850 $(this).attr("aria-selected", "true"); 851 } 852 853 // 854 // update expanded menu ARIA attributes 855 // 856 857 if ( 858 $(this) 859 .next() 860 .hasClass("active") 861 ) { 862 $(this).next().removeAttr("aria-hidden"); 863 if ($(this).next().is("a")) { 864 if ($(this).next().is("a")) { 865 $(this).next().attr("aria-expanded", "true"); 866 } 867 } 868 } else { 869 $(this).next().attr("aria-hidden", "true"); 870 if ($(this).next().is("a")) { 871 if ($(this).next().is("a")) { 872 $(this).next().attr("aria-expanded", "false"); 873 } 874 } 875 } 876 877 // 878 // update tabindex 879 // 880 881 /* in progress */ 882 883 // 884 // prevent page from scrolling to top 885 // 886 887 event.stopPropagation(); 888 } 889 890 // 891 // reset menu when clicking outside of it 892 // 893 894 $(".page-wrapper").bind("tap click", function(e) { 895 var menuBtn = $(".wide-nav__link--with-menu"); 896 897 if ( 898 !$(e.target.offsetParent).is( 899 ".wide-nav-sub__title, .wide-nav, .wide-nav-sub__link, .wide-nav-sub-sub__link, .wide-nav-sub" 900 ) 901 ) { 902 menuBtn.removeClass("active"); 903 menuBtn.next().removeClass("active"); 904 menuBtn.filter("a").attr("aria-expanded", "false"); 905 } 906 }); 907 908 // 909 // close menu when clicking anything but a link 910 // 911 912 $(".page-wrapper").click(function(e) { 913 if ( 914 !$(e.target.offsetParent).is( 915 ".wide-nav-sub__title, .wide-nav, .wide-nav-sub__link, .wide-nav-sub-sub__link, .wide-nav-sub" 916 ) 917 ) { 918 menuBtn.removeClass("active"); 919 menuBtn.next().removeClass("active"); 920 } 921 }); 922 923 // 924 // stick nav to top of viewport on scroll 925 // 926 927 $(window).scroll(function() { 928 if ($(window).scrollTop() > headerHeight) { 929 $(desktopNav).addClass("wide-nav--stuck"); 930 } else { 931 $(desktopNav).removeClass("wide-nav--stuck"); 932 } 933 }); 934 } 935 }; 936 937 $.WideNavDMV.defaultOptions = { 938 webUrl: "", 939 listName: "", 940 }; 941 942 $.fn.wideNavDMV = function(options) { 943 return this.each(function() { 944 new $.WideNavDMV($(this), options); 945 }); 946 }; 947 948 /*End DMV Wide Nav*/ 949 950 /* Slinky Nav */ 951 952 $.SlinkyNav = function(element, options) { 953 var settings = $.extend({}, $.SlinkyNav.defaultOptions, options); 954 955 var templateScript = 956 "<li>" + 957 '<a href="javascript:;">About</a>' + 958 "<ul>" + 959 "{{#each items}}" + 960 '{{#if_eq parentUniqueID "About Us"}}' + 961 "<li>" + 962 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 963 "</li>" + 964 "{{/if_eq}}" + 965 "{{/each}}" + 966 "</ul>" + 967 "</li>" + 968 "<li>" + 969 '<a href="javascript:;">News & Events</a>' + 970 "<ul>" + 971 "{{#each items}}" + 972 '{{#if_eq parentUniqueID "News & Events"}}' + 973 "<li>" + 974 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 975 "</li>" + 976 "{{/if_eq}}" + 977 "{{/each}}" + 978 "</ul>" + 979 "</li>" + 980 "<li>" + 981 '<a href="javascript:;">Divisions</a>' + 982 "<ul>" + 983 "{{#each items}}" + 984 '{{#if_eq parentUniqueID "Divisions"}}' + 985 "<li>" + 986 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 987 "</li>" + 988 "{{/if_eq}}" + 989 "{{/each}}" + 990 "</ul>" + 991 "</li>" + 992 "<li>" + 993 '<a href="javascript:;">Initiatives & Policies</a>' + 994 "<ul>" + 995 "{{#each items}}" + 996 '{{#if_eq parentUniqueID "Initiatives & Policies"}}' + 997 "<li>" + 998 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 999 "</li>" + 1000 "{{/if_eq}}" + 1001 "{{/each}}" + 1002 "</ul>" + 1003 "</li>" + 1004 "<li>" + 1005 '<a href="javascript:;">Travel & Maps</a>' + 1006 "<ul>" + 1007 "{{#each items}}" + 1008 '{{#if_eq parentUniqueID "Travel & Maps"}}' + 1009 "<li>" + 1010 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1011 "</li>" + 1012 "{{/if_eq}}" + 1013 "{{/each}}" + 1014 "</ul>" + 1015 "</li>" + 1016 "<li>" + 1017 '<a href="javascript:;">Projects & Studies</a>' + 1018 "<ul>" + 1019 "<li>" + 1020 '<a href="javascript:;">Projects</a>' + 1021 "<ul>" + 1022 "{{#each items}}" + 1023 '{{#if_eq uniqueID "Projects"}}' + 1024 "<li>" + 1025 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1026 "</li>" + 1027 "{{/if_eq}}" + 1028 "{{/each}}" + 1029 "</ul>" + 1030 "</li>" + 1031 "<li>" + 1032 '<a href="javascript:;">Studies</a>' + 1033 "<ul>" + 1034 "{{#each items}}" + 1035 '{{#if_eq uniqueID "Studies"}}' + 1036 "<li>" + 1037 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1038 "</li>" + 1039 "{{/if_eq}}" + 1040 "{{/each}}" + 1041 "</ul>" + 1042 "</li>" + 1043 "<li>" + 1044 '<a href="javascript:;">Related Resources</a>' + 1045 "<ul>" + 1046 "{{#each items}}" + 1047 '{{#if_eq uniqueID "Related Resources"}}' + 1048 "<li>" + 1049 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1050 "</li>" + 1051 "{{/if_eq}}" + 1052 "{{/each}}" + 1053 "</ul>" + 1054 "</li>" + 1055 "<li>" + 1056 '<a href="javascript:;">Other Links</a>' + 1057 "<ul>" + 1058 "{{#each items}}" + 1059 '{{#if_eq uniqueID "Other Links"}}' + 1060 "<li>" + 1061 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1062 "</li>" + 1063 "{{/if_eq}}" + 1064 "{{/each}}" + 1065 "</ul>" + 1066 "</li>" + 1067 "</ul>" + 1068 "</li>" + 1069 "<li>" + 1070 '<a href="/about-us/our-people/careers/Pages/default.aspx">Careers</a>' + 1071 "</li>" + 1072 "<li>" + 1073 '<a href="/contact">Contact</a>' + 1074 "</li>"; 1075 1076 // Compile the template 1077 var template = Handlebars.compile(templateScript); 1078 1079 // Define data object 1080 var context = { 1081 items: [], 1082 }; 1083 1084 function getQuery() { 1085 var whereQuery = "<Where><Eq><FieldRef Name='RR_IsVisible' /><Value Type='Text'>Yes</Value></Eq></Where>"; 1086 var orderByQuery = "<OrderBy><FieldRef Name='RR_SortOrder' Ascending='True' /></OrderBy>"; 1087 return "<Query>" + whereQuery + orderByQuery + "</Query>"; 1088 } 1089 1090 function getItems() {
1091 context.items = []; 1092 var dfd = $.Deferred(); 1093 1094 $().SPServices({ 1095 webURL: getRootSiteCollectionUrl(settings.webUrl), 1096 operation: "GetListItems", 1097 async: true, 1098 listName: settings.listName, 1099 CAMLQuery: getQuery(), 1100 CAMLViewFields: 1101 "<ViewFields><FieldRef Name='Title' />" + 1102 "<FieldRef Name='RR_UniqueID' /><FieldRef Name='RR_ParentUniqueID' />" + 1103 "<FieldRef Name='RR_LinkUrl' /></ViewFields>", 1104 completefunc: function(xData, status) { 1105 if (status === "success") { 1106 $(xData.responseXML) 1107 .SPFilterNode("z:row") 1108 .each(function() { 1109 var item = { 1110 title: $(this).attr("ows_Title"), 1111 linkUrl: retrieveLink($(this).attr("ows_RR_LinkUrl")), 1112 uniqueID: $(this).attr("ows_RR_UniqueID"), 1113 parentUniqueID: $(this).attr("ows_RR_ParentUniqueID"), 1114 }; 1115 context.items.push(item); 1116 }); 1117 dfd.resolve(""); 1118 } else { 1119 dfd.reject(); 1120 } 1121 }, 1122 }); 1123 1124 return dfd.promise(); 1125 } 1126 1127 // get SharePoint data 1128 $.when(getItems()) 1129 .fail(function() { 1130 console.log("error in slinky nav"); 1131 }) 1132 .done(function() { 1133 dataReady(); 1134 }); 1135 1136 function getRootSiteCollectionUrl(scUrl) { 1137 var tempUrl = scUrl; 1138 1139 $.each(NonRootSiteCollections, function(index, item) { 1140 tempUrl = tempUrl.replace(item, ""); 1141 }); 1142 1143 return tempUrl; 1144 } 1145 1146 function retrieveLink(x) { 1147 var link = x ? x.split(", ")[0] : ""; 1148 var host = window.location.host; 1149 1150 if (host !== "localhost:3000" && host !== "127.0.0.1:3000") { 1151 $.each(StageDomainNames, function(index, item) { 1152 link = link.replace(item, ""); 1153 }); 1154 } 1155 1156 return link; 1157 } 1158 1159 function dataReady() { 1160 // render template and add to attached element 1161 var renderedHtml = template(context); 1162 $(element).append(renderedHtml); 1163 1164 // Tap/click button to animate up/down 1165 var slinkyMenu = $(".slinky-menu"); 1166 1167 slinkyMenu.slinky({ 1168 title: true, 1169 speed: 150, 1170 }); 1171 } 1172 }; 1173 1174 $.SlinkyNav.defaultOptions = { 1175 webUrl: "", 1176 listName: "", 1177 }; 1178 1179 $.fn.slinkyNav = function(options) { 1180 return this.each(function() { 1181 new $.SlinkyNav($(this), options); 1182 }); 1183 }; 1184 1185 /* End Slinky Nav */ 1186 1187 /* Slinky Nav DMV */ 1188 1189 $.SlinkyNavDMV = function(element, options) { 1190 var settings = $.extend({}, $.SlinkyNavDMV.defaultOptions, options); 1191 1192 var templateScript = 1193 "<li>" + 1194 '<a href="/dmv/offices-services/online/Pages/default.aspx">Online Services</a>' + 1195 "</li>" + 1196 "<li>" + 1197 '<a href="javascript:;">License & ID</a>' + 1198 "<ul>" + 1199 "<li>" + 1200 '<a href="javascript:;">Driver Licenses</a>' + 1201 "<ul>" + 1202 "{{#each items}}" + 1203 '{{#if_eq uniqueID "Driver Licenses"}}' + 1204 "<li>" + 1205 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1206 "</li>" + 1207 "{{/if_eq}}" + 1208 "{{/each}}" + 1209 "</ul>" + 1210 "</li>" + 1211 "<li>" + 1212 '<a href="javascript:;">Special Licenses</a>' + 1213 "<ul>" + 1214 "{{#each items}}" + 1215 '{{#if_eq uniqueID "Special Licenses"}}' + 1216 "<li>" + 1217 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1218 "</li>" + 1219 "{{/if_eq}}" + 1220 "{{/each}}" + 1221 "</ul>" + 1222 "</li>" + 1223 "<li>" + 1224 '<a href="javascript:;">Identification</a>' + 1225 "<ul>" + 1226 "{{#each items}}" + 1227 '{{#if_eq uniqueID "Identification"}}' + 1228 "<li>" + 1229 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1230 "</li>" + 1231 "{{/if_eq}}" + 1232 "{{/each}}" + 1233 "</ul>" + 1234 "</li>" + 1235 "<li>" + 1236 '<a href="javascript:;">License Suspension</a>' + 1237 "<ul>" + 1238 "{{#each items}}" + 1239 '{{#if_eq uniqueID "License Suspension"}}' + 1240 "<li>" + 1241 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1242 "</li>" + 1243 "{{/if_eq}}" + 1244 "{{/each}}" + 1245 "</ul>" + 1246 "</li>" + 1247 "</ul>" + 1248 "</li>" + 1249 "<li>" + 1250 '<a href="javascript:;">Title & Registration</a>' + 1251 "<ul>" + 1252 "<li>" + 1253 '<a href="javascript:;">Vehicle Titles</a>' + 1254 "<ul>" + 1255 "{{#each items}}" + 1256 '{{#if_eq uniqueID "Vehicle Titles"}}' + 1257 "<li>" + 1258 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1259 "</li>" + 1260 "{{/if_eq}}" + 1261 "{{/each}}" + 1262 "</ul>" + 1263 "</li>" + 1264 "<li>" + 1265 '<a href="javascript:;">Registration</a>' + 1266 "<ul>" + 1267 "{{#each items}}" + 1268 '{{#if_eq uniqueID "Registration"}}' + 1269 "<li>" + 1270 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1271 "</li>" + 1272 "{{/if_eq}}" + 1273 "{{/each}}" + 1274 "</ul>" + 1275 "</li>" + 1276 "<li>" + 1277 '<a href="javascript:;">License Plates</a>' + 1278 "<ul>" + 1279 "{{#each items}}" + 1280 '{{#if_eq uniqueID "License Plates"}}' + 1281 "<li>" + 1282 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1283 "</li>" + 1284 "{{/if_eq}}" + 1285 "{{/each}}" + 1286 "</ul>" + 1287 "</li>" + 1288 "<li>" + 1289 '<a href="javascript:;">Requirements</a>' + 1290 "<ul>" + 1291 "{{#each items}}" + 1292 '{{#if_eq uniqueID "Requirements"}}' + 1293 "<li>" + 1294 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1295 "</li>" + 1296 "{{/if_eq}}" + 1297 "{{/each}}" + 1298 "</ul>" + 1299 "</li>" + 1300 "</ul>" + 1301 "</li>" + 1302 // begin programs 1303 1304 // '<li>' + 1305 // '<a href="javascript:;">Programs</a>' + 1306 // '<ul>' + 1307 1308 // '<li>' + 1309 // '<a href="javascript:;">Commercial Trucking</a>' + 1310 // '<ul>' + 1311 // '{{#each items}}' + 1312 // '{{#if_eq uniqueID "Commercial Trucking"}}' + 1313 // '<li>' + 1314 // '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1315 // '</li>' + 1316 // '{{/if_eq}}' + 1317 // '{{/each}}' + 1318 // '</ul>' + 1319 // '</li>' + 1320 // '<li>' + 1321 // '<a href="javascript:;">Fraud & Theft Prevention</a>' + 1322 // '<ul>' + 1323 // '{{#each items}}' + 1324 // '{{#if_eq uniqueID "Fraud & Theft Prevention"}}' + 1325 // '<li>' + 1326 // '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1327 // '</li>' + 1328 // '{{/if_eq}}' + 1329 // '{{/each}}' + 1330 // '</ul>' + 1331 // '</li>' + 1332 // '</ul>' + 1333 // '</li>' + 1334 1335 // end programs 1336 1337 "<li>" + 1338 '<a href="javascript:;">Offices & Services</a>' + 1339 "<ul>" + 1340 "<li>" + 1341 '<a href="javascript:;">DMV Offices</a>' + 1342 "<ul>" + 1343 "{{#each items}}" + 1344 '{{#if_eq uniqueID "DMV Offices"}}' + 1345 "<li>" + 1346 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1347 "</li>" + 1348 "{{/if_eq}}" + 1349 "{{/each}}" + 1350 "</ul>" + 1351 "</li>" + 1352 "<li>" + 1353 '<a href="javascript:;">Records & Reports</a>' + 1354 "<ul>" + 1355 "{{#each items}}" + 1356 '{{#if_eq uniqueID "Records & Reports"}}' + 1357 "<li>" + 1358 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1359 "</li>" + 1360 "{{/if_eq}}" + 1361 "{{/each}}" + 1362 "</ul>" + 1363 "</li>" + 1364 "<li>" + 1365 '<a href="javascript:;">Online Services</a>' + 1366 "<ul>" + 1367 "{{#each items}}" + 1368 '{{#if_eq uniqueID "Online Services"}}' + 1369 "<li>" + 1370 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1371 "</li>" + 1372 "{{/if_eq}}" + 1373 "{{/each}}" + 1374 "</ul>" + 1375 "</li>" + 1376 "<li>" + 1377 '<a href="javascript:;">Other Services</a>' + 1378 "<ul>" + 1379 "{{#each items}}" + 1380 '{{#if_eq uniqueID "Other Services"}}' + 1381 "<li>" + 1382 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1383 "</li>" + 1384 "{{/if_eq}}" + 1385 "{{/each}}" + 1386 "</ul>" + 1387 "</li>" + 1388 "</ul>" + 1389 "</li>" + 1390 "<li>" + 1391 '<a href="javascript:;">Help</a>' + 1392 "<ul>" + 1393 "<li>" + 1394 '<a href="javascript:;">Contact NCDMV </a>' + 1395 "<ul>" + 1396 "{{#each items}}" + 1397 '{{#if_eq uniqueID "Contact NCDMV "}}' + 1398 "<li>" + 1399 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1400 "</li>" + 1401 "{{/if_eq}}" + 1402 "{{/each}}" + 1403 "</ul>" + 1404 "</li>" + 1405 "<li>" + 1406 '<a href="javascript:;">Report a Concern</a>' + 1407 "<ul>" + 1408 "{{#each items}}" + 1409 '{{#if_eq uniqueID "Report a Concern"}}' + 1410 "<li>" + 1411 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1412 "</li>" + 1413 "{{/if_eq}}" + 1414 "{{/each}}" + 1415 "</ul>" + 1416 "</li>" + 1417 "<li>" + 1418 '<a href="javascript:;">Publications</a>' + 1419 "<ul>" + 1420 "{{#each items}}" + 1421 '{{#if_eq uniqueID "Publications"}}' + 1422 "<li>" + 1423 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1424 "</li>" + 1425 "{{/if_eq}}" + 1426 "{{/each}}" + 1427 "</ul>" + 1428 "</li>" + 1429 "<li>" + 1430 '<a href="javascript:;">Other Resources</a>' + 1431 "<ul>" + 1432 "{{#each items}}" + 1433 '{{#if_eq uniqueID "Other Resources"}}' + 1434 "<li>" + 1435 '<a href=" {{ linkUrl }}"> {{ title }} </a>' + 1436 "</li>" + 1437 "{{/if_eq}}" + 1438 "{{/each}}" + 1439 "</ul>" + 1440 "</li>" + 1441 "</ul>" + 1442 "</li>" + 1443 "<li>" + 1444 '<a href="/about-us/our-people/careers/Pages/careers-ncdmv.aspx">Careers</a>' + 1445 "</li>" + 1446 "</ul>" + 1447 "</li>"; 1448 1449 // Compile the template 1450 var template = Handlebars.compile(templateScript); 1451 1452 // Define data object 1453 var context = { 1454 items: [], 1455 }; 1456 1457 function getQuery() { 1458 var whereQuery = "<Where><Eq><FieldRef Name='RR_IsVisible' /><Value Type='Text'>Yes</Value></Eq></Where>"; 1459 var orderByQuery = "<OrderBy><FieldRef Name='RR_SortOrder' Ascending='True' /></OrderBy>"; 1460 return "<Query>" + whereQuery + orderByQuery + "</Query>"; 1461 } 1462 1463 function getItems() {
1464 context.items = []; 1465 var dfd = $.Deferred(); 1466 1467 $().SPServices({ 1468 // webURL: getRootSiteCollectionUrl(settings.webUrl), 1469 webURL: window.location.origin, 1470 operation: "GetListItems", 1471 async: true, 1472 listName: settings.listName, 1473 CAMLQuery: getQuery(), 1474 CAMLViewFields: 1475 "<ViewFields><FieldRef Name='Title' />" + 1476 "<FieldRef Name='RR_UniqueID' /><FieldRef Name='RR_ParentUniqueID' />" + 1477 "<FieldRef Name='RR_LinkUrl' /></ViewFields>", 1478 completefunc: function(xData, status) { 1479 if (status === "success") { 1480 $(xData.responseXML) 1481 .SPFilterNode("z:row") 1482 .each(function() { 1483 var item = { 1484 title: $(this).attr("ows_Title"), 1485 linkUrl: retrieveLink($(this).attr("ows_RR_LinkUrl")), 1486 uniqueID: $(this).attr("ows_RR_UniqueID"), 1487 parentUniqueID: $(this).attr("ows_RR_ParentUniqueID"), 1488 }; 1489 context.items.push(item); 1490 }); 1491 dfd.resolve(""); 1492 } else { 1493 dfd.reject(); 1494 } 1495 }, 1496 }); 1497 1498 return dfd.promise(); 1499 } 1500 1501 // get SharePoint data 1502 $.when(getItems()) 1503 .fail(function() { 1504 console.log("error in slinky nav DMV"); 1505 }) 1506 .done(function() { 1507 dataReady(); 1508 }); 1509 1510 function getRootSiteCollectionUrl(scUrl) { 1511 var tempUrl = scUrl; 1512 1513 $.each(NonRootSiteCollections, function(index, item) { 1514 tempUrl = tempUrl.replace(item, ""); 1515 }); 1516 1517 return tempUrl; 1518 } 1519 1520 function retrieveLink(x) { 1521 var link = x ? x.split(", ")[0] : ""; 1522 var host = window.location.host; 1523 1524 if (host !== "localhost:3000" && host !== "127.0.0.1:3000") { 1525 $.each(StageDomainNames, function(index, item) { 1526 link = link.replace(item, ""); 1527 }); 1528 } 1529 1530 return link; 1531 } 1532 1533 function dataReady() { 1534 // render template and add to attached element 1535 var renderedHtml = template(context); 1536 $(element).append(renderedHtml); 1537 1538 // Tap/click button to animate up/down 1539 var slinkyMenu = $(".slinky-menu"); 1540 1541 slinkyMenu.slinky({ 1542 title: true, 1543 speed: 150, 1544 }); 1545 } 1546 }; 1547 1548 $.SlinkyNavDMV.defaultOptions = { 1549 webUrl: "", 1550 listName: "", 1551 }; 1552 1553 $.fn.slinkyNavDMV = function(options) { 1554 return this.each(function() { 1555 new $.SlinkyNavDMV($(this), options); 1556 }); 1557 }; 1558 1559 /* End Slinky Nav DMV */ 1560 1561 var pagehref = window.location.href.toLowerCase(); 1562 1563 if (pagehref.indexOf("/dmv/") != -1) { 1564 $(".wide-nav__list").wideNavDMV({ 1565 webUrl: _spPageContextInfo.siteAbsoluteUrl, 1566 listName: "DMV Global Navigation", 1567 }); 1568 1569 $(".slinky-menu ul").slinkyNavDMV({ 1570 webUrl: _spPageContextInfo.siteAbsoluteUrl, 1571 listName: "DMV Global Navigation", 1572 }); 1573 1574 $(".wide-nav").addClass("wide-nav--turquoise"); 1575 1576 $(".logo--header") 1577 .attr("href", "/dmv/") 1578 .addClass("logo--DMV-full"); 1579 1580 $(".wide-nav__link.home").attr("href", "/dmv/"); 1581 1582 $(".mobile-header__site-title") 1583 .attr("href", "/dmv/") 1584 .text("NCDMV"); 1585 1586 function addMyDmvLogin() { 1587 var myDmvLoginMarkup = 1588 "<li class='wide-nav__list-item wide-nav__list-item--login' role='none'>" + 1589 "<a class='wide-nav__link ' href='https://edmv.ncdot.gov/MyDMV/Account/Login' role='menuitem' " + 1590 "aria-haspopup='true' aria-expanded='false' tabindex='' target='_blank'>" + 1591 "<i class='icon-account'></i>myDMV<br>LOGIN" + 1592 "<i class='icon-keyboard-arrow-down'></i>" + 1593 "</a>" + 1594 "</li>"; 1595 $(".wide-nav ul").append(myDmvLoginMarkup); 1596 } 1597 1598 addMyDmvLogin(); 1599 } else { 1600 $(".wide-nav__list").wideNav({ 1601 webUrl: _spPageContextInfo.siteAbsoluteUrl, 1602 listName: "Global Navigation", 1603 }); 1604 1605 $(".slinky-menu ul").slinkyNav({ 1606 webUrl: _spPageContextInfo.siteAbsoluteUrl, 1607 listName: "Global Navigation", 1608 }); 1609 1610 $(".wide-nav").addClass("wide-nav--orange"); 1611 1612 $(".logo--header").addClass("logo--DOT-full"); 1613 } 1614})(this.jQuery, this, this.document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.