1$jq(document).ready(function () { 2 preparePageHeaderSlides() 3 preparePageHeaderForms(); 4 5 whichMenuIsAppropriate(); 6 7 prepareFooterNewsletterForm(); 8 prepareNewsletterFormListener(); 9 10 $jq("a.lang-switch").click(function () { 11 $jq.removeCookie(languageCookieKey); 12 $jq.cookie(languageCookieKey, $jq(this).data("lang"), { expires: 365, path: "/" }); 13 }); 14}); 15 16function hideProgress() { 17 $jq('.modal-progress-container').remove(); 18} 19 20function showProgress() { 21 $jq(document.body).append('<div class="modal-progress-container"><img src="/static/images/spinner-transparent.gif" alt="Loading" /></div>'); 22} 23 24function preparePageHeaderSlides() { 25 $jq(".MainMenu-signIn.not-logged-in").click(function () { 26 if ($jq("#login-wrapper:visible").length > 0) { 27 $jq("#login-wrapper").slideToggle(400, function () { $jq("#content").toggleClass("no-padding"); }); 28 } 29 else { 30 $jq("#content").toggleClass("no-padding"); 31 $jq("#login-wrapper").slideToggle(); 32 } 33 $jq("#change-password-slide-down").slideUp(); 34 $jq("#register-wrapper").slideUp(); 35 clearPageHeaderForms(); 36 }); 37 38 $jq(".MainMenu-signIn.logged-in").click(function () { 39 if ($jq("#myaccount-wrapper:visible").length > 0) { 40 $jq("#myaccount-wrapper").slideToggle(400, function () { $jq("#content").toggleClass("no-padding"); }); 41 } 42 else { 43 $jq("#content").toggleClass("no-padding"); 44 $jq("#myaccount-wrapper").slideToggle(); 45 } 46 $jq("#change-password-slide-down").slideUp(); 47 $jq("#register-wrapper").slideUp(); 48 clearPageHeaderForms(); 49 }); 50 $jq("#myaccount-slide-down-close").click(function () { 51 $jq("#content").toggleClass("no-padding"); 52 $jq("#login-wrapper").slideToggle(); 53 clearPageHeaderForms(); 54 }); 55 $jq("#change-password-slide-down-close").click(function () { 56 $jq("#content").toggleClass("no-padding"); 57 $jq("#change-password-slide-down").slideUp(); 58 clearPageHeaderForms(); 59 }); 60 $jq("#log-in-password-changed-button").click(function () { 61 $jq("#content").toggleClass("no-padding"); 62 $jq("#change-password-slide-down").slideUp(); 63 $jq("#login-wrapper").slideToggle(); 64 }); 65 $jq("#register-slide-down-close").click(function () { 66 $jq("#content").toggleClass("no-padding"); 67 $jq("#register-wrapper").slideToggle(); 68 }); 69} 70 71function clearPageHeaderForms() { 72 $jq("#password").val(""); 73 $jq("#repeat-password").val(""); 74 $jq("#slideDownPasswordOld").val(""); 75 $jq("#slideDownPasswordNew").val(""); 76 $jq("#slideDownPasswordRepeat").val(""); 77} 78 79function fancyAlert(text, reloadParentPage) { 80 $jq.fancybox({ 81 content: '<div class="fancy-alert">
81' + text + '</div>', 82 afterClose: function () { 83 if (reloadParentPage) { 84 parent.location.reload(true); 85 } 86 } 87 }); 88} 89 90function preparePageHeaderForms() { 91 $jq("#repeat-password").keyup(function () { 92 if ($jq("#password").val() == $jq("#repeat-password").val()) { 93 $jq("#change-password-slide-down-button").prop("disabled", false); 94 } else { 95 $jq("#change-password-slide-down-button").prop("disabled", true); 96 } 97 }); 98 99 $jq("#password").keyup(function () { 100 if ($jq("#password").val() == $jq("#repeat-password").val()) { 101 $jq("#change-password-slide-down-button").prop("disabled", false); 102 } else { 103 $jq("#change-password-slide-down-button").prop("disabled", true); 104 } 105 }); 106 107 $jq("#slideDownPasswordOld").keyup(function () { 108 if ($jq("#slideDownPasswordNew").val() == $jq("#slideDownPasswordRepeat").val() && $jq("#slideDownPasswordOld").val().length > 0) { 109 $jq("#apapapa").prop("disabled", false); 110 } else { 111 $jq("#apapapa").prop("disabled", true); 112 } 113 }); 114 115 $jq("#slideDownPasswordNew").keyup(function () { 116 if ($jq("#slideDownPasswordNew").val() == $jq("#slideDownPasswordRepeat").val() && $jq("#slideDownPasswordOld").val().length > 0) { 117 $jq("#apapapa").prop("disabled", false); 118 } else { 119 $jq("#apapapa").prop("disabled", true); 120 } 121 }); 122 123 $jq("#slideDownPasswordRepeat").keyup(function () { 124 if ($jq("#slideDownPasswordNew").val() == $jq("#slideDownPasswordRepeat").val() && $jq("#slideDownPasswordOld").val().length > 0) { 125 $jq("#apapapa").prop("disabled", false); 126 } else { 127 $jq("#apapapa").prop("disabled", true); 128 } 129 }); 130} 131 132function autoOpenFancyboxes() { 133 $jq(".fancybox[data-autoopen='true']").click(); 134} 135 136function hoverMenu() { //dropdowns on hover 137 $jq(".MainMenu-dropdownSubmenu a.dropdown-toggle").click(function (e) { 138 let $this = $jq(this); 139 $jq(".MainMenu-dropdownSubmenu ul").removeAttr('style'); 140 $this.next("ul").toggle(); 141 e.stopPropagation(); 142 e.preventDefault(); 143 }); 144} 145 146 147// CONSID MASTER PIECE 148 149 150function whichMenuIsAppropriate() { 151 if ($jq(window).width() < 1025) { 152 mobileMenu(); 153 } 154 else { 155 //mobileMenu(); 156 desktopMenu(); 157 } 158} 159 160function desktopMenu() { //dropdowns on hover 161 $jq(".MainMenu-dropdownSubmenu a.dropdown-toggle").click(function (e) { 162 let $this = $jq(this); 163 $jq(".MainMenu-dropdownSubmenu ul").removeAttr('style'); 164 $this.next("ul").toggle(); 165 e.stopPropagation(); 166 e.preventDefault(); 167 }); 168} 169 170//This function will fire only for mobile-sizes > 768 171function mobileMenu() { 172 $jq('.MainMenu-dropdownSubmenu .dropdown-toggle').on("click", function (e) { 173 e.stopPropagation(); 174 e.preventDefault(); 175 $jq(this).parent(".dropdown").toggleClass("open"); 176 }); 177} 178 179function prepareFooterNewsletterForm() { 180 var dropdownLabelText = $jq('.wffm-form-container').data('dropdowntext'); 181 $jq('.wffm-form-container .scfDroplistBorder select option:first-of-type').text(dropdownLabelText); 182 183 var emailLabelText = $jq('.wffm-form-container').data('emailtext'); 184 $jq('.wffm-form-container .scfEmailBorder input[type=email]').attr('placeholder', emailLabelText); 185 186 var buttonText = $jq('.wffm-form-container').data('buttontext'); 187 $jq('.wffm-form-container input[type=submit]').val(buttonText); 188 $jq('.wffm-form-container input[type=submit]').removeClass('btn-default'); 189 $jq('.wffm-form-container input[type=submit]').addClass('btn-success btn-block'); 190 191 $jq('.wffm-form-container .scfDroplistBorder').append('<svg class="Footer-iconDropdown" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"> <path d="M0 0h24v24H0z" fill="none"></path> <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95a15.65 15.65 0 00-1.38-3.56A8.03 8.03 0 0118.92 8zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56A7.987 7.987 0 015.08 16zm2.95-8H5.08a7.987 7.987 0 014.33-3.56A15.65 15.65 0 008.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.
19116-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95a8.03 8.03 0 01-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"></path> </svg>'); 192} 193 194function prepareNewsletterFormListener() { 195 $jq('.wffm-form-container').bind('DOMSubtreeModified', function () { 196 if ($jq('.wffm-form-container .scfDroplistBorder svg').length === 0) 197 prepareFooterNewsletterForm(); 198 }) 199} 200 201 202$jq(document).ready(function () { 203 showSearch(); 204 scrollTop(); 205 showThirdLevelDropMobile(); 206 wideNavigationWidth(); 207 anchorLinks(); 208 socialLinks(); 209 moreFacts(); 210 moreDownloads(); 211 sortTable(".documentDtoSectionsTable table", moreDownloads(), true); 212 sortTable("#smartengineeringTable", moreSmartEngineeringResources()); 213 //moreSmartEngineeringResources(); 214 //sortTable(".download-lists .documentDtoSectionsTable table", moreDownloads()); 215 216 moreDrivers(); 217 readMoreBtn(); 218 $jq(".fancybox").fancybox(); 219 autoOpenFancyboxes(); 220 headerSlider(true); 221 showJsTree(); 222 moveWffMErrorMessageToTop(); 223 scrollToVideo(); 224 startVideo(); 225}); 226 227$jq(window).load(function () { 228 flexSlider(); 229}); 230var timer; 231$jq(window).resize(function () { 232 timer = setTimeout(function () { 233 headerSlider(false); 234 moreDownloads(); 235 }, 500); 236}); 237 238 239function isMobile() { 240 return ($jq('#detect-xs').css('display') === 'block'); 241} 242 243function showSearch() { 244 $jq('.fa-search.fa-2x').click(function () { 245 $jq('.search-container').stop().slideToggle('fast'); 246 $jq('.header-page-slider').stop().toggleClass('mobile-search-open'); 247 }); 248} 249 250function scrollTop() { 251 $jq(window).scroll(function () { 252 if ($jq(this).scrollTop() > 140) { 253 if (!$jq('#mainmenu .navbar.navbar-default').hasClass('navbar-fixed-top')) { 254 $jq('#mainmenu .navbar.navbar-default').fadeOut(0); 255 } 256 } 257 if ($jq(this).scrollTop() > 150) { 258 if (!$jq('#mainmenu .navbar.navbar-default').hasClass('navbar-fixed-top')) { 259 $jq('#mainmenu .navbar.navbar-default').addClass('navbar-fixed-top').fadeIn('fast'); 260 if (!isMobile()) { 261 $jq('.navbar.navbar-default li.open.wide-li').removeClass('open'); 262 } 263 } 264 $jq('.scrollToTop').fadeIn(); 265 } else { 266 $jq('.scrollToTop').fadeOut(); 267 if ($jq('#mainmenu .navbar.navbar-default').hasClass('navbar-fixed-top')) { 268 $jq('#mainmenu .navbar.navbar-default.navbar-fixed-top').fadeOut('fast', function () { 269 $jq('#mainmenu .navbar.navbar-default.navbar-fixed-top').removeClass('navbar-fixed-top'); 270 $jq('#mainmenu .navbar.navbar-default').fadeIn(0); 271 if (!isMobile()) { 272 $jq('.navbar.navbar-default li.open.wide-li').removeClass('open'); 273 } 274 }); 275 } 276 } 277 }); 278 $jq('.scrollToTop').click(function () { 279 $jq('html, body').animate({ scrollTop: 0 }, 'fast'); 280 return false; 281 }); 282} 283 284function showThirdLevelDropMobile() { 285 if (isMobile()) { 286 $jq("#mainmenu").on("hidden.bs.dropdown", function (el, o) { 287 $jq(o.relatedTarget).parent().addClass('open'); 288 }); 289 $jq('.caret-container').click(function () { 290 $jq(this).parent().toggleClass('open'); 291 }); 292 } 293} 294 295function wideNavigationWidth() { 296 if (!isMobile()) { 297 $jq('.wide-link').click(function () { 298 var logo = $jq('.navbar-logo').width() - ($jq('.navbar-logo').width() * 2) - 30; 299 var prevWidth = 0; 300 $jq(this).parent().prevAll('li').each( 301 function () { 302 prevWidth += $jq(this).width(); 303 } 304 ); 305 var left = prevWidth - (prevWidth * 2); 306 var negLeft = logo + left; 307 var width = $jq('.navbar.navbar-default').width(); 308 $jq('#site .wide-menu').width(width); 309 $jq('#site .wide-menu').css('left', negLeft); 310 setTimeout(function () { 311 $jq('#site .wide-menu.dropdown-menu > li .dropdown-menu').matchHeight(true); 312 }, 1); 313 }); 314 } 315} 316 317function flexSlider() { 318 $jq('.flexslider-menu').flexslider({ 319 animation: "slide", 320 slideshow: false, 321 animationLoop: true, 322 itemWidth: 130, 323 itemMargin: 0, 324 controlNav: false, 325 prevText: "", 326 nextText: "" 327 });
328 //$jq('.flexslider-prod').flexslider({ 329 // animation: "slide", 330 // controlNav: "thumbnails", 331 // controlNav: true, 332 //}); 333 334 $jq('#carousel').flexslider({ 335 animation: "slide", 336 controlNav: false, 337 animationLoop: false, 338 slideshow: false, 339 itemWidth: 150, 340 itemMargin: 5, 341 asNavFor: '#slider' 342 }); 343 344 $jq('#slider').flexslider({ 345 animation: "slide", 346 controlNav: false, 347 animationLoop: false, 348 slideshow: false, 349 sync: "#carousel" 350 }); 351 352} 353 354function anchorLinks() { 355 $jq('.anchor-links a').click(function () { 356 scrollToSection($jq(this).attr('href'), -80); 357 }); 358} 359 360function scrollToSection(elem, offset) { 361 $jq('html, body').animate({ 362 scrollTop: ($jq(elem).offset().top + offset) 363 }, 500); 364} 365 366function socialLinks() { 367 var url = $jq(location).attr('href'); 368 var title = $jq('.product-header').text(); 369 var w = 500; 370 var h = 450; 371 $jq('#share-links a').click(function () { 372 if ($jq(this).hasClass('mail')) { 373 location.href = 'mailto:?subject=' + title + '&body=' + url; 374 } else if ($jq(this).hasClass('twitter')) { 375 window.open('https://twitter.com/intent/tweet?text=' + title + '&url=' + url + '&related=', '', 'width=' + w + ',height=250'); 376 } else if ($jq(this).hasClass('facebook')) { 377 window.open('https://www.facebook.com/sharer/sharer.php?u=' + url + '&p[title]=' + title + '&display=popup', '', 'width=' + w + ',height=' + h); 378 } 379 return false; 380 }); 381} 382 383function sortTable(querySelector, reloadTable, list = false) { 384 if ($jq(".productpage").length) { 385 if (list) { 386 $jq(querySelector).each(function (element) { 387 $jq("#" + this.id)?.DataTable({ 388 searching: false, paging: false, info: false, columnDefs: [ 389 { orderable: false, targets: 0 } 390 ], 391 order: [[1, 'asc']] 392 }); 393 }) 394 } 395 else { 396 $jq(querySelector)?.DataTable({ 397 searching: false, paging: false, info: false, columnDefs: [ 398 { orderable: false, targets: 0 } 399 ], 400 order: [[1, 'asc']] 401 }); 402 } 403 } 404 $jq('.dataTables_length').addClass('bs-select'); 405 reloadTable; 406} 407 408function moreFacts() { 409 var originalLength = 2; // orginal length = 4 410 var rowCount = $jq('.facts-lists table tr').length; 411 var hidden = true; 412 var $table = $jq('.facts-lists table').find('tbody'); 413 414 $table.find('tr:lt(' + rowCount + ')').hide(); 415 $table.find('tr:lt(' + (originalLength - 1) + ')').show(); 416 $jq('.col-sm-6 .facts-lists').hide(); 417 $jq('.col-sm-6 .facts-lists:first-child').show(); 418 $jq('.col-sm-6 .facts-lists:first-child table tr:lt(' + originalLength + ')').show(); 419 420 $jq('a.more-facts').on('click', function (e) { 421 e.preventDefault(); 422 if (hidden) { 423 $table.find('tr:lt(' + rowCount + ')').show(); 424 $jq('.facts-lists').show(); 425 $jq(this).html('View less <i class="fa fa-chevron-up"></i>') //change html 426 427 } else { 428 $table.find('tr:lt(' + rowCount + ')').hide(); 429 $table.find('tr:lt(' + (originalLength - 1) + ')').show(); 430 $jq('.col-sm-6 .facts-lists').hide(); 431 $jq('.col-sm-6 .facts-lists:first-child').show(); 432 $jq('.col-sm-6 .facts-lists:first-child table tr:lt(' + originalLength + ')').show(); 433 $jq(this).html('View More <i class="fa fa-chevron-down"></i>') //change html 434 } 435 hidden = !hidden; 436 }); 437} 438 439function moreDownloads() { 440 var originalLength = 7; // orginal length = 4 441 442 $jq('.documentDtoSectionsTable table tr').hide(); 443 $jq('.documentDtoSectionsTable table tr:lt(' + originalLength + ')').show(); 444 $jq('.documentDtoSectionsTable').hide(); 445 $jq('.documentDtoSectionsTable:first-child').show(); 446 447 var rowCount = $jq('.documentDtoSectionsTable table tr').length; 448 449 var hidden = true; 450 var $table = $jq('.documentDtoSectionsTable table'); 451 452 $jq('a.more-downloads').on('click', function (e) { 453 e.preventDefault(); 454 if (hidden) { 455 // first on click, it is hidden, so expand 456 $table.find('tr:lt(' + rowCount + ')').hide(); 457 $table.find('tr:lt(' + rowCount + ')').show(); 458 $jq('.documentDtoSectionsTable').show(); 459 $jq(this).html('View less <i class="fa fa-chevron-up"></i>') //change html 460 461 } else { 462 $table.find('tr:lt(' + rowCount + ')').hide(); 463 $table.find('tr:lt(' + (originalLength - 1) + ')').show(); 464 $jq('.documentDtoSectionsTable').hide(); 465 $jq('.documentDtoSectionsTable:first-child').show(); 466 $jq(this).html('View More <i class="fa fa-chevron-down"></i>') //change html 467 } 468 hidden = !hidden; 469 });
470} 471 472function moreSmartEngineeringResources() { 473 var originalLength = 3; // orginal length = 4 474 475 $jq('.ser-lists table tr').hide(); 476 $jq('.ser-lists table tr:lt(' + originalLength + ')').show(); 477 478 var rowCount = $jq('.ser-lists table tr').length; 479 480 var hidden = true; 481 var $table = $jq('.ser-lists table').find('tbody'); 482 483 $jq('a.more-ser').on('click', function (e) { 484 e.preventDefault(); 485 if (hidden) { 486 // first on click, it is hidden, so expand 487 $table.find('tr:lt(' + rowCount + ')').hide(); 488 $table.find('tr:lt(' + rowCount + ')').show(); 489 $jq(this).html('View less <i class="fa fa-chevron-up"></i>') //change html 490 491 } else { 492 $table.find('tr:lt(' + rowCount + ')').hide(); 493 $table.find('tr:lt(' + (originalLength - 1) + ')').show(); 494 $jq(this).html('View More <i class="fa fa-chevron-down"></i>') //change html 495 } 496 hidden = !hidden; 497 }); 498 499 500 501} 502 503function moreDrivers() { 504 var originalLength = 3; // orginal length = 4 505 506 $jq('.drivers-lists1 table tr').hide(); 507 $jq('.drivers-lists1 table tr:lt(' + originalLength + ')').show(); 508 $jq('.drivers-lists2 table tr').hide(); 509 $jq('.drivers-lists2 table tr:lt(' + originalLength + ')').show(); 510 511 var rowCount1 = $jq('.drivers-lists1 table tr').length; 512 var rowCount2 = $jq('.drivers-lists2 table tr').length; 513 514 var hidden = true; 515 var $table1 = $jq('.drivers-lists1 table').find('tbody'); 516 var $table2 = $jq('.drivers-lists2 table').find('tbody'); 517 518 $jq('a.more-drivers').on('click', function (e) { 519 e.preventDefault(); 520 if (hidden) { 521 // first on click, it is hidden, so expand 522 $table1.find('tr:lt(' + rowCount1 + ')').hide(); 523 $table1.find('tr:lt(' + rowCount1 + ')').show(); 524 $table2.find('tr:lt(' + rowCount2 + ')').hide(); 525 $table2.find('tr:lt(' + rowCount2 + ')').show(); 526 $jq(this).html('View less <i class="fa fa-chevron-up"></i>') //change html 527 528 } else { 529 $table1.find('tr:lt(' + rowCount1 + ')').hide(); 530 $table1.find('tr:lt(' + (originalLength - 1) + ')').show(); 531 $table2.find('tr:lt(' + rowCount2 + ')').hide(); 532 $table2.find('tr:lt(' + (originalLength - 1) + ')').show(); 533 534 $jq(this).html('View More <i class="fa fa-chevron-down"></i>') //change html 535 } 536 hidden = !hidden; 537 }); 538} 539 540function readMoreBtn() { 541 $jq('a.read-more').each(function () { 542 $jq(this).html('<i class="fa fa-chevron-right"></i>' + $jq(this).html()); 543 }); 544} 545 546function headerSlider(load) { 547 if (load) { 548 var i = 0; 549 var ol = '<ol class="carousel-indicators" style="display:none;">'; 550 $jq('.header-page-slider .carousel-inner img').each(function () { 551 var cssClass = ''; 552 if (i === 0) { 553 cssClass = ' class="active"'; 554 $jq(this).parent().addClass('active'); 555 } 556 ol += '<li data-target="#carousel-start-page" data-slide-to="' + i + '"' + cssClass + '></li>'; 557 i++; 558 }); 559 ol += '</ol>'; 560 $jq('#carousel-start-page').prepend(ol); 561 } 562 $jq('.header-page-slider .carousel-inner img').each(function () { 563 if ($jq(this).attr('data-mobile-src')) { 564 var mobileSrc = $jq(this).attr('data-mobile-src'); 565 var desktopSrc = $jq(this).attr('data-desktop-src'); 566 if (isMobile()) { 567 $jq(this).attr('src', mobileSrc); 568 } else { 569 $jq(this).attr('src', desktopSrc); 570 } 571 } 572 }); 573} 574 575function showJsTree() { 576 $jq('.jstree-toggle').click(function () { 577 $jq('.jstree-container').slideToggle('fast'); 578 }); 579} 580 581function showFileArchiveTree(treeNode) { 582 $jq("#loading").show(); 583 584 treeNode 585 .jstree({ 586 'core': { 587 'data': function (obj, cb) { 588 $jq.getJSON("/api/Tree", function (data) { 589 cb.call(this, data); 590 }); 591 }, 592 "initially_open": ["Root"], 593 'multiple': false 594 } 595 }).bind("loaded.jstree", function () { 596 $jq(this).jstree("open_node", $jq("#Root"));
597 $jq("#Root").find("a:first").hide(); 598 $jq("#Root").find("i:first").hide(); 599 }).delegate(".jstree-open>a", "click.jstree", function (e) { 600 $jq.jstree.reference(this).close_node(this, false, false); 601 }).delegate(".jstree-closed>a", "click.jstree", function (e) { 602 $jq.jstree.reference(this).open_node(this, false, false); 603 }).on("activate_node.jstree", function (e, node) { 604 doBrowse(node.node.id); 605 }).on("after_open.jstree", function (e, node) { 606 var obj = $jq(".jstree-children a.jstree-clicked span img"); 607 obj.removeClass("invisible").addClass("visible"); 608 }).on("after_close.jstree", function (e, node) { 609 var obj = $jq(".jstree-children a.jstree-clicked span img"); 610 obj.removeClass("invisible").addClass("visible"); 611 }).on("select_node.jstree", function (e, node) { 612 $jq("#Tree a").removeClass('jstree-funky'); 613 $jq.each(node.node.parents, function (i) { 614 var id = node.node.parents[i].replace(',', '\\,'); 615 if (id && id !== '#') { 616 $jq("#" + id).children('a').addClass('jstree-funky'); 617 } 618 }); 619 $jq("#" + node.node.id.replace(',', '\\,')).children('a').addClass('jstree-funky'); 620 }).on("ready.jstree", function () { 621 $jq("#loading").hide(); 622 }); 623} 624 625function doBrowse(id, type) { 626 $jq.getJSON("/api/DocPages/" + id + "/" + DocTypeAll, function (data) { 627 var sections = $jq("#sectionsContent"); 628 sections.empty(); 629 if (data.HasDocPages) { 630 sections.show(); 631 632 var template = $jq('#browse-template').html(); 633 Mustache.parse(template); 634 var rendered = Mustache.render(template, { DocumentSections: data.DocumentSections, authenticated: $auth.authenticated, index: function () { return data.DocumentSections.indexOf(this); } }); 635 sections.append(rendered); 636 637 var obj = $jq("img.tree-spinner"); 638 obj.removeClass("visible").addClass("invisible"); 639 640 $jq(".fb-link").fancybox(); 641 $jq(".push-link").on("click", function () { 642 var docId = $jq(this).data("docid"); 643 docView(docId, "treeview"); 644 history.pushState(null, "docId:", "?docId=" + docId); 645 }); 646 } else { 647 var obj = $jq("img.tree-spinner"); 648 obj.removeClass("visible").addClass("invisible"); 649 sections.hide(); 650 } 651 }); 652} 653 654function docView(docId, origin) { 655 $jq.getJSON("/api/DocView/" + docId + "/" + origin, function (data) { 656 }); 657} 658 659function doFileSearch(text, type, page) { 660 var sections = $jq("#sectionsContent"); 661 var pageSize = 25; 662 663 page = page ? page : 0; 664 $jq('#currentPage').val(page); 665 text = text.trim(); 666 if (text.length === 0) 667 return false; 668 text = text.replace(/\*/g, '%2A'); 669 670 var url = "/api/DocPagesSearch/" + text + "/" + encodeURIComponent(type) + "/" + page; 671 672 $jq.getJSON(url, function (data) { 673 $jq("#defaultMessageField").hide(); 674 var cf = $jq("#contentField"); 675 var nd = $jq("#noDocumentsField"); 676 677 sections.empty(); 678 cf.empty(); 679 if (data.HasDocPages) { 680 cf.show(); 681 nd.hide(); 682 sections.show(); 683 684 var boxTemplate = $jq("#box-template").html(); 685 var partials = { "box-template": boxTemplate }; 686 var template = $jq('#search-hit-template').html(); 687 Mustache.parse(template); 688 var rendered = Mustache.render(template, { Hits: data.Hits, authenticated: $auth.authenticated, index: function () { return data.Hits.indexOf(this); } }, partials); 689 sections.append(rendered); 690 691 $jq(".fb-link").fancybox(); 692 $jq(".push-link").on("click", function () { 693 var docId = $jq(this).data("docid"); 694 docView(docId, "search"); 695 history.pushState(null, "docId:", "?docId=" + docId); 696 }); 697 698 /* $jq('html, body').animate({ 699 scrollTop: sections.offset().top - 120 700 }, 500); */ 701 702 if (data.TotalHits > pageSize) {
703 var pager = $jq("#pager"); 704 $jq(pager).pagination({ 705 items: data.TotalHits, 706 itemsOnPage: pageSize, 707 currentPage: page + 1, 708 selectOnClick: false, 709 cssStyle: 'beijer-theme', 710 onPageClick: function (pageNumber) { 711 doFileSearch($jq("#fileSearchQuery").val(), $jq("#fileSearchDocType").val(), pageNumber - 1); 712 } 713 }); 714 } 715 else { 716 $jq("#pager").html("<ul></ul>"); 717 } 718 719 } else { 720 nd.show(); 721 cf.hide(); 722 sections.hide(); 723 } 724 if (data.Hits.length > 0) { 725 $jq("#searchResultCount").text((data.HitsStart + 1) + '-' + Math.min(data.HitsEnd, data.Hits.length) + ' / ' + data.TotalHits); 726 $jq("#searchResultHeader").show(); 727 $jq("#noDocumentsField").hide(); 728 } else { 729 $jq("#searchResultHeader").hide(); 730 $jq("#noDocumentsField").show(); 731 } 732 }).fail(function (data) { 733 console.log("error "); 734 console.log(data); 735 }); 736 return false; 737} 738 739function getByDocId(docId) { 740 741 var url = "/api/DocPageByDocId/" + docId; 742 743 $jq.getJSON(url, function (data) { 744 745 if (data) { 746 var sections = $jq("#sectionsContent"); 747 sections.empty(); 748 sections.show(); 749 750 var template = $jq("#box-template-doc").html(); 751 Mustache.parse(template); 752 data.authenticated = $auth.authenticated; 753 var rendered = Mustache.render(template, data); 754 sections.append(rendered); 755 $jq("#fbstartlink").fancybox().trigger("click"); 756 757 } else { 758 var nd = $jq("#noDocumentsField"); 759 nd.show(); 760 } 761 }).fail(function (data) { 762 var nd = $jq("#noDocumentsField"); 763 nd.show(); 764 console.log("error "); 765 console.log(data); 766 }); 767 return false; 768} 769 770function getByDocCode(code) { 771 772 var url = "/api/DocPageByCode/" + code; 773 774 $jq.getJSON(url, function (data) { 775 776 if (data) { 777 var sections = $jq("#sectionsContent"); 778 sections.empty(); 779 sections.show(); 780 781 var template = $jq("#box-template-doc").html(); 782 Mustache.parse(template); 783 data.authenticated = $auth.authenticated; 784 var rendered = Mustache.render(template, data); 785 sections.append(rendered); 786 $jq("#fbstartlink").fancybox().trigger("click"); 787 788 } else { 789 var nd = $jq("#noDocumentsField"); 790 nd.show(); 791 } 792 }).fail(function (data) { 793 var nd = $jq("#noDocumentsField"); 794 nd.show(); 795 console.log("error "); 796 console.log(data); 797 }); 798 return false; 799} 800 801function getTreeByDocId(docId) { 802 803 var url = "/api/DocPageByDocId/" + docId; 804 805 $jq.getJSON(url, function (data) { 806 807 if (data) { 808 var sections = $jq("#sectionsContent"); 809 sections.empty(); 810 sections.show(); 811 812 var template = $jq("#box-template").html(); 813 Mustache.parse(template); 814 data.authenticated = $auth.authenticated; 815 var rendered = Mustache.render(template, data); 816 sections.append(rendered); 817 $jq("#fbstartlink").fancybox().trigger("click"); 818 819 } else { 820 //var nd = $jq("#noDocumentsField"); 821 //nd.show(); 822 } 823 }).fail(function (data) { 824 console.log("error "); 825 console.log(data); 826 }); 827 return false; 828} 829 830function moveWffMErrorMessageToTop() { 831 if ($jq("form div.has-error").length > 0) { 832 $jq("#content .container:nth-child(1) .row:nth-child(1) .col-sm-12:nth-child(1)") 833 .prepend($jq("form div.has-error")); 834 } 835} 836 837function scrollToVideo() { 838 document.addEventListener("webkitfullscreenchange", (e) => { 839 setTimeout(() => { 840 if (document.webkitFullscreenElement === null) { 841 console.log("webkitfullscreenchanged recognized"); 842 e.target.parentElement.scrollIntoView(false); 843 window.scrollBy(0, 200); 844 } 845 }, 200) 846 847 });
848} 849 850function startVideo() { 851 $jq(window).scroll(function () { 852 document.querySelectorAll(".startOnScroll")?.forEach(element => { 853 if (element.paused) { 854 var hT = $jq(element).offset().top, 855 hH = $jq(element).outerHeight(), 856 wH = $jq(window).height(), 857 wS = $jq(this).scrollTop(); 858 if (wS > (hT + hH - wH)) { 859 element.play(); 860 } 861 } 862 }) 863 }); 864}
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.