1 2(function ($, Drupal, cookies, once) { 3 const hash_target = window.location.hash; 4 window.onscroll = function () { 5 if(document.readyState === 'interactive'){ 6 window.scrollTo(0, 0); 7 } 8 }; 9 $(document).ready(function ($) { 10 if (hash_target) { 11 window.scrollTo(0, 0); 12 history.replaceState("", document.title, window.location.pathname + window.location.search); 13 setTimeout(function () { 14 15 $('html, body').animate({ 16 scrollTop: $(hash_target).offset().top - 20 17 }, 1000); 18 }, 1); 19 } 20 }); 21 22 23 Drupal.behaviors.main_menu = { 24 attach: function attach(context, settings) { 25 if (context === document) { 26 var header = $('#site-header'); 27 var body = $('body'); 28 var menus = $('.menu--main, .menu--top-menu'); 29 30 var items_with_children = $('.level-0.menu-item--expanded > a', $('.menu--main')).append('<span class="down"></span>'); 31 items_with_children.push($('.level-1.menu-item--expanded > a', $('.menu--main, .menu--top-menu')).append('<span class="right"></span>')); 32 items_with_children.push($('.level-0.menu-item--expanded > a', $('.menu--top-menu')).append('<span class="down"></span>')); 33 34 var main_items_with_children = $('.level-0.menu-item--expanded > a', $('.menu--main')); 35 var top_items_with_children = $('.level-0.menu-item--expanded > a', $('.menu--top-menu')); 36 37 var menu_close = $('.menu-close', menus); 38 39 $('.menu-item--expanded > a', $('.menu--main, .menu--top-menu')).each(function () { 40 var linktext; 41 linktext = $(this).text(); 42 $(this).next().find('> .container > ul').prepend("<span class='menu-subtitle'>" + linktext + '</span>'); 43 }); 44 45 // Smooth scroll to anchor 46 $("a[href*='#']", menus).click(function(e) { 47 const my_hash = this.hash; 48 if(location.pathname === this.pathname && $(my_hash).length > 0) { 49 e.preventDefault(); 50 window.scrollTo(0, 0); 51 $('html, body').animate({ 52 scrollTop: $(my_hash).offset().top - 20 53 }, 1000); 54 } 55 }); 56 57 children_menus_set_state(items_with_children); 58 59 menu_close.on('click', function (e) { 60 e.preventDefault(); 61 menu_set_state(menus, false, false); 62 children_menus_set_state(items_with_children); 63 }); 64 65 $(document).on('click', function (event) { 66 var $target = $(event.target); 67 if (!$target.closest('.menu--main').length) { 68 children_menus_set_state(main_items_with_children); 69 $('.menu-item--expanded > a', $('.menu--main')).removeClass('open'); 70 } 71 if (!$target.closest('.menu--top-menu').length) { 72 children_menus_set_state(top_items_with_children); 73 $('.menu-item--expanded > a', $('.menu--top-menu')).removeClass('open'); 74 } 75 if (!$target.closest('.menu--main').length && !$target.closest('.menu--top-menu').length) { 76 body.toggleClass('overflow-hidden', false); 77 //header.toggleClass('active', false); 78 } 79 if (!$target.closest('#block-seagroup-formespostosearchsearch-block').length && !$target.closest('#block-seagroup-search').length) { 80 body.removeClass("active-search"); 81 } 82 }); 83 84 items_with_children.each(function () { 85 86 $(this).on('click', function (e) { 87 if ($(e.target).is('a')) { 88 return; 89 } 90 91 e.preventDefault(); 92 93 var that = $(this); 94 95 var menu_below = that.next(); 96 menu_below.toggle(); 97 var opened = menu_below.is(':visible'); 98 that.toggleClass('open', opened); 99 menu_set_state(that.closest('ul'), that, menu_below); 100 children_menus_set_state($('.menu-item--expanded > a', menu_below)); 101 102 var that_siblings = that.parent().siblings('.menu-item--expanded').find('a:first'); 103 that_siblings.removeClass('open'); 104 var menu_below_sibilings = that_siblings.next(); 105 menu_below_sibilings.hide().find('.menu-item--expanded > a').removeClass('open'); 106 }); 107 }); 108 109 function menu_set_state(menu, link, menu_below) { 110 if (link === false && menu_below === false) { 111 menu.trigger('changeState', [false]); 112 return; 113 } 114 115 if (!link.hasClass('level-0')) { 116 return; 117 } 118 119 var opened = menu_below.is(':visible'); 120 121 menu.toggleClass('opened', opened).trigger('changeState', [opened]); 122 menu.find('.level-0.menu-item--expanded > a').toggleClass('open', opened); 123 } 124 125 function children_menus_set_state(links) { 126 links.each(function () { 127 var that = $(this); 128 129 var menu_below = that.next(); 130 131 return (child_menu_must_be_closed(that)) ? menu_below.hide() : menu_below.show(); 132 }); 133 } 134 135 function child_menu_must_be_closed(link) { 136 if (link.hasClass('level-0')) { 137 return true; 138 } 139 140 return !link.hasClass('link-item--active-trail'); 141 } 142 } 143 } 144 145 }; 146 147 Drupal.behaviors.header = { 148 attach: function attach(context, settings) { 149 if (context === document) { 150 var header = $('#site-header'); 151 var body = $('body'); 152 var menus = $('.menu--main, .menu--top-menu'); 153 154 $('.header-search').on("click", function (e) { 155 e.preventDefault(); 156 body.toggleClass("active-search"); 157 header.toggleClass('active', body.hasClass('active-search')); 158 }); 159 160 $('.menu--main .level-0.menu-item--expanded, .menu--top-menu .level-0.menu-item--expanded').each(function (index) { 161 var dropdown = $(this).find('.menu-dropdown-0'); 162 dropdown.each(function () { 163 var that = $(this); 164 var heights = []; 165 $(this).find('.menu.level-1, .menu.level-2, .field--name-field-menu-item-details .wrapper').each(function () { 166 heights.push(parseInt($(this).actual('innerHeight'))); 167 }); 168 that.find('.menu.level-1').css('min-height', Math.max.apply(null, heights) + 30 + 'px'); 169 }); 170 }); 171 172 if (body.hasClass('page-node-type-special-pages')) { 173 header.addClass('white'); 174 } 175 176 if (body.hasClass('path-frontpage')) { 177 header.scrollClassChange({ 178 class_before_limit: '', 179 class_after_limit: 'white', 180 limit: 150 181 }); 182 } 183 184 header.scrollToggle(); 185 header.on('scrollToggle', function (e, visible) { 186 body.toggleClass('header-invisible', !visible); 187 }); 188 189 var is_desktop = window.matchMedia("(min-width: 1024px)"); 190
191 if (is_desktop.matches) { 192 menus_listeners_set(); 193 } 194 195 is_desktop.addListener(function (e) { 196 $('.menu-close:first', menus).trigger('click'); 197 menus.unbind('changeState'); 198 }); 199 200 function menus_listeners_set() { 201 menus.on('changeState', function (event, opened) { 202 header.toggleClass('active', opened); 203 body.toggleClass('overflow-hidden', opened); 204 body.toggleClass("active-search", opened); 205 }); 206 } 207 } 208 } 209 }; 210 211 Drupal.behaviors.scroll_indicator = { 212 attach: function attach(context, settings) { 213 if (context === document) { 214 $(window).on('load', function () { 215 var maxScrollableHeight = $('body').height() - $(window).height(); 216 217 scroll_percentage(); 218 219 $(window).on('scroll', scroll_percentage); 220 221 function scroll_percentage() { 222 var percentage = ($(window).scrollTop() / maxScrollableHeight) * 100 + '%'; 223 $('#block-seagroup-scrollindicator').width(percentage); 224 } 225 }); 226 } 227 } 228 }; 229 230 Drupal.behaviors.popup = { 231 attach: function attach(context, settings) { 232 $('.image-popup , .pop-next').magnificPopup({ 233 type: 'inline', 234 fixedContentPos: true, 235 fixedBgPos: true, 236 overflowY: 'auto', 237 closeBtnInside: true, 238 preloader: false, 239 midClick: true, 240 removalDelay: 300, 241 mainClass: 'my-mfp-zoom-in wrapper-image-popup' 242 }); 243 244 $('.video-caller').on('click', function () { 245 var sib = $(this).siblings('.video-container'); 246 $.magnificPopup.open({ 247 items: { 248 src: sib, 249 type: 'inline', 250 }, 251 fixedContentPos: true, 252 fixedBgPos: true, 253 overflowY: 'auto', 254 closeBtnInside: true, 255 preloader: false, 256 midClick: true, 257 removalDelay: 300, 258 mainClass: 'my-mfp-zoom-in wrapper-video-popup' 259 }); 260 }); 261 262 } 263 }; 264 265 Drupal.behaviors.modFor = { 266 attach: function (context, settings) { 267 268 $(".fancy-modal-iframe").each(function(e) { 269 $_f = $(this); 270 $_f.data('type', 'iframe'); 271 $_f.data('src', $_f.attr('href')); 272 273 $_f.fancybox({ 274 smallBtn: false, 275 toolbar: true, 276 infobar: false, 277 arrows: false, 278 buttons: [ 279 "close" 280 ], 281 baseTpl: 282 '<div class="fancybox-container" role="dialog" tabindex="-1">' + 283 '<div class="fancybox-bg"></div>' + 284 '<div class="fancybox-inner">' + 285 '<div class="fancybox-ctoolbar">{{buttons}}</div>' + 286 '<div class="fancybox-stage"></div>' + 287 '<div class="fancybox-caption"></div>' + 288 "</div>" + 289 "</div>", 290 btnTpl: { 291 close: 292 '<label>CHIUDI FINESTRA</label>' + 293 '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' + 294 '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' + 295 "</button>", 296 } 297 }); 298 }); 299 } 300 } 301 302 Drupal.behaviors.various = { 303 attach: function attach(context, settings) { 304 $('.video-dialog, .field--name-field-popup-video a', context).magnificPopup({ 305 type: 'iframe', 306 closeMarkup: '<div title="Close" class="mfp-close mfp-close-video icnsea-delete"></div>', 307 mainClass: 'wrapper-video-popup', 308 iframe: { 309 patterns: { 310 youtube: { 311 index: 'youtube.com/', 312 id: function (url) { 313 var m = url.match(/[\\?\\&]v=([^\\?\\&]+)/); 314 if (!m || !m[1]) return null; 315 return m[1]; 316 }, 317 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0&cc_load_policy=0&showinfo=0&fs=0&disablekb=1&controls=0' 318 }, 319 vimeo: { 320 index: 'vimeo.com/', 321 id: function (url) { 322 var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/);
323 if (!m || !m[5]) return null; 324 return m[5]; 325 }, 326 src: '//player.vimeo.com/video/%id%?autoplay=1' 327 } 328 } 329 } 330 }); 331 332 if ($('.field--name-field-body').find('table').length > 0) { 333 $('.field--name-field-body').find('table').wrap('<div class="scroller-table"></div>'); 334 } 335 336 $('.scroll-down-interaction').on('click', function () { 337 var offset = $(this).offset().top + 150; 338 $('body,html').animate({ scrollTop: offset }, '4000'); 339 }); 340 341 $('.paragraph--type--section-title').each(function (e) { 342 if (e % 2 == 0) { 343 $(this).addClass('odd').children().addClass('odd'); 344 } else { 345 $(this).addClass('even').children().addClass('even'); 346 } 347 }); 348 349 $('.paragraph--type--_-column').each(function (e) { 350 if ($(this).find('.field--name-field-right-column > .field--item > .paragraph--type--square-image-video').length) { 351 $(this).addClass('reverse-column'); 352 } 353 }); 354 355 if ($('.paragraph--type--contenitore-filettato').length > 0) { 356 $('.paragraph--type--contenitore-filettato').each(function () { 357 if ($(this).parent('.field--item').prev('.field--item').children().hasClass('paragraph--type--_-column')) { 358 $(this).parent('.field--item').prev('.field--item').children('.paragraph--type--_-column').addClass("next-contenitore-filettato"); 359 } 360 }); 361 } 362 363 if ($('.paragraph--type--related-contents').length > 0) { 364 $('body').addClass('page-with-related-contents'); 365 } 366 367 $('.msg-zip-container label', context).on("click", function () { 368 if ($(this).children('input:checkbox:checked').length > 0) { 369 $(this).addClass('active-input-checkbox'); 370 } else { 371 $(this).removeClass('active-input-checkbox'); 372 } 373 }); 374 375 376 $('#block-modellodibusiness').prepend("<div class='clickme'><div class='icon'></div><span>CLICCA PER ESPLORARE IL MODELLO</span></div><div class='icon-pointer amb'></div><div class='icon-pointer per'></div><div class='icon-pointer ter'></div>"); 377 378 $('#modello-di-business #point-ambiente, #block-modellodibusiness .icon-pointer.amb', context).on("click", function () { 379 $('#modello-di-business').attr('class', ''); 380 $('#modello-di-business').addClass('point-ambiente'); 381 }); 382 $('#modello-di-business #point-persone, #block-modellodibusiness .icon-pointer.per', context).on("click", function () { 383 $('#modello-di-business').attr('class', ''); 384 $('#modello-di-business').addClass('point-persone'); 385 }); 386 $('#modello-di-business #point-territorio, #block-modellodibusiness .icon-pointer.ter', context).on("click", function () { 387 $('#modello-di-business').attr('class', ''); 388 $('#modello-di-business').addClass('point-territorio'); 389 }); 390 391 } 392 }; 393 394 Drupal.behaviors.aos = { 395 attach: function (context, settings) { 396 397 /*$('article.special-pages .field--name-field-content > .field--item > .paragraph', context).once('aos').each(function () { 398 //if(!$(this).children().hasClass('paragraph--type--blocco')){ 399 $(this).attr('data-aos', 'fade-left'); 400 //} 401 });*/ 402 403 var anims = { 404 'fade-left': { 405 selectors: [ 406 'article.special-pages .field--name-field-content > .field--item > .paragraph--type--data-slide', 407 '.page-node-type-progetto .field--name-field-left-column', 408 '.sustainability .field--name-field-left-column' 409 ], 410 //delay: 100, 411 }, 412 'fade-left': { 413 selectors: [ 414 'article.special-pages .field--name-field-content > .field--item > .paragraph--type--section-title.odd', 415 '.page-node-type-progetto .field--name-field-left-column', 416 '.sustainability .field--name-field-left-column', 417 '.paragraph--type--text-image .textimg-txt.txt-right', 418 '.paragraph--type--text-image .textimg-bck.txt-left', 419 ], 420 //delay: 800, 421 //duration: 2000 422 }, 423 'fade-right': { 424 selectors: [ 425 'article.special-pages .field--name-field-content > .field--item > .paragraph--type--_-column', 426 'article.special-pages .field--name-field-content > .field--item > .paragraph--type--dora-section', 427 '.page-node-type-progetto .field--name-field-right-column', 428 '.sustainability .field--name-field-right-column' 429 ], 430 //delay: 100 431 }, 432 'fade-right': { 433 selectors: [ 434 'article.special-pages .field--name-field-content > .field--item > .paragraph--type--section-title.even', 435 '.page-node-type-progetto .field--name-field-right-column', 436 '.sustainability .field--name-field-right-column', 437 '.paragraph--type--text-image .textimg-txt.txt-left', 438 '.paragraph--type--text-image .textimg-bck.txt-right', 439 ], 440 //delay: 800, 441 //duration: 1000 442 }, 443 'fade-up': { 444 selectors: [ 445 'article.special-pages .field--name-field-content > .field--item .paragraph--type--square-image-video', 446 'article.special-pages .field--name-field-content > .field--item .paragraph--type--body', 447 'article.special-pages .field--name-field-content > .field--item .paragraph--type--highlights', 448 '.paragraph--type--fullwidth-section.quote', 449 //'.paragraph--type--fullwidth-section.project-section', 450 '.paragraph--type--fullwidth-section.colored', 451 '.paragraph--type--fullwidth-section.net-zero-carbon-footprint', 452 '.paragraph--type--fullwidth-section.gradient-bg-down', 453 '.page-node-type-progetto .paragraph--type--gallery-img', 454 '.paragraph--type--animation', 455 '.paragraph--type--highlights-carousel', 456 '.paragraph--type--highlights-banner', 457 '.paragraph--type--cards' 458 ], 459 //delay: 100 460 }, 461 'zoom-in-up': { 462 selectors: [ 463 //'article.special-pages .field--name-field-content > .field--item >.paragraph--type--download-center', 464 'article.special-pages .field--name-field-content > .field--item >.paragraph--type--left-slide', 465 '.paragraph--type--attachments', 466 'p.scream' 467 ], 468 //delay: 100 469 } 470 }; 471 472 $.each(anims, function (aniClass, anidata) { 473 $.each(anidata.selectors, function (k, sel) { 474 $(sel).each(function (i, el) { 475 $(this).attr('data-aos', aniClass); 476 if (anidata.duration !== 'undefined') { 477 $(this).attr('data-aos-duration', anidata.duration); 478 } 479 if (anidata.delay !== 'undefined') { 480 $(this).attr('data-aos-delay', anidata.delay); 481 } 482 }); 483 }); 484 }); 485 486 $(window).on('load', function () { 487 AOS.init({ 488 offset: 150, 489 once: true, 490 anchorPlacement: 'top-bottom',
491 duration: 800, 492 delay: 200, 493 }); 494 }); 495 } 496 }; 497 498 Drupal.behaviors.mmenuBehavior = { 499 attach: function (context, settings) { 500 $(once('mmenuBehavior', 'body', context)).each(function () { 501 if ($("#mobile-menu").length === 1) { 502 503 // Pre init MMenu - creo la voce che collega se stesso nell'elenco dei figli 504 $('#mobile-menu li a.hasChild').each(function (i) { 505 const myTitl = $(this).text(); 506 const myChilds = $(this).next('ul'); 507 if (myTitl !== '' && myChilds.length > 0) { 508 myChilds.prepend('<li><span class="parentLink">' + myTitl + '</span></li>') 509 } 510 }); 511 512 $("#mobile-menu").mmenu({ 513 slidingSubmenus: true, 514 extensions: ["multiline", "position-front", "fullscreen"], 515 counters: false, 516 iconPanels: false, 517 navbar: { "add": true, "title": null } 518 }, { selectedClass: "Selected", }); 519 520 var API = $("#mobile-menu").data("mmenu"); 521 522 API.bind('close:finish', function () { $(".hamburger").removeClass('is-active'); }); 523 API.bind('open:finish', function () { $(".hamburger").addClass('is-active'); }); 524 525 $(".hamburger").click(function () { 526 if ($(this).hasClass('is-active')) { 527 API.close(); 528 } else { API.open(); } 529 }); 530 531 // Post init MMenu - ripasso i panel per cambiare il testo del back 532 $("#mobile-menu .mm-panel").each(function (i) { 533 if ($(this).find('.mm-navbar').length === 1) { 534 const myId = $(this).attr('id'); 535 const myLinker = $("#mobile-menu .mm-btn_next[href='#" + myId + "']"); 536 const myLinkerPane = myLinker.closest('.mm-panel'); 537 let myLinkerTit = Drupal.t('Back to main'); 538 if (myLinkerPane.attr('id') !== 'mm-1') { 539 const linkerItem = myLinkerPane.find('span.parentLink'); 540 myLinkerTit = linkerItem.text() 541 } 542 543 $(this).find('.mm-navbar a.mm-navbar__title').text(myLinkerTit); 544 } 545 546 }); 547 548 } 549 }); 550 } 551 }; 552 553 /** 554 * Behavior per footer menu accordion 555 */ 556 Drupal.behaviors.footermenuBehaviors = { 557 attach: function (context, settings) { 558 $(once('footermenuBehaviors', 'body', context)).each(function () { 559 560 var is_tablet = window.matchMedia("(min-width: 768px)"); 561 562 if (!is_tablet.matches) { 563 $('.region--footer-top-right h2').on('click', function (e) { 564 e.preventDefault(); 565 566 if ($(this).hasClass('open')) { 567 $(this).removeClass('open'); 568 $(this).parent().find('ul.menu:not(.submenu)').slideUp(); 569 } else { 570 $(this).addClass('open'); 571 $(this).parent().find('ul.menu:not(.submenu)').slideDown(); 572 $(this).parent().siblings().find('h2').removeClass('open'); 573 $(this).parent().siblings().find('ul.menu:not(.submenu)').slideUp(); 574 } 575 }); 576 } 577 }); 578 } 579 }; 580 581 Drupal.behaviors.footerBehavior = { 582 attach: function (context, settings) { 583 $(once('footerBehavior', 'body', context)).each(function () { 584 585 $(".blockToTop a").on('click', function (e) { 586 e.preventDefault(); 587 588 $('html, body').animate({ scrollTop: 0 }, 600); 589 }); 590 591 const toTop = $(".blockToTop"); 592 $(document).scroll(function () { 593 var scrolled = $(this).scrollTop(); 594 if (scrolled >= 600) { 595 toTop.fadeIn(); 596 } else { toTop.fadeOut(); } 597 }); 598 599 }); 600 } 601 }; 602 603 Drupal.behaviors.alertPopupBehavior = { 604 attach: function (context, settings) { 605 $(once('alertPopupBehavior', 'body', context)).each(function () { 606 607 if ($(".block-alert-popup").length === 1) { 608 609 var alreadySeen = cookies.get('strilloneHPSeen'); 610 611 cookies.set('strilloneHPSeen', 1); 612 613 if(alreadySeen != 1) { 614 $(".block-alert-popup").addClass('opened'); 615 } 616 617 /* 618 setTimeout(function () { 619 $(".block-alert-popup").addClass('timed'); 620 }, 6000); 621 */ 622 623 $(".block-alert-popup .apTitle, .block-alert-popup .apArrow").on("click", function (e) { 624 e.preventDefault(); 625 e.stopPropagation(); 626 627 const myPop = $(this).closest('.block-alert-popup'); 628 myPop.toggleClass('opened'); 629 }); 630 } 631 632 }); 633 } 634 }; 635 636 637 function checkBannerDimension() { 638 var header_banner_content = $('.banner-content-wrapper').height(); 639 var header_banner_wrapper = $('#breadcrumb.has-banner').height(); 640 641 if (header_banner_content + 200 > header_banner_wrapper) { 642 $('#breadcrumb.has-banner .banner-content-wrapper').addClass('no-absolute'); 643 } else { 644 $('#breadcrumb.has-banner .banner-content-wrapper').removeClass('no-absolute'); 645 } 646 647 //eccezione per progetti 648 if (header_banner_content == 0) { 649 $('#breadcrumb.has-banner').css('min-height', 'auto'); 650 } 651 } 652 653 $(window).on("load resize", function () { 654 checkBannerDimension(); 655 }); 656 657})(jQuery, Drupal, window.Cookies, once, drupalSettings); 658 659/*! Copyright 2012, Ben Lin (http://dreamerslab.com/) 660 * Licensed under the MIT License (LICENSE.txt). 661 * 662 * Version: 1.0.19 663 * 664 * Requires: jQuery >= 1.2.3 665 */ 666; (function (factory) { 667 if (typeof define === 'function' && define.amd) { 668 // AMD. Register module depending on jQuery using requirejs define. 669 define(['jquery'], factory); 670 } else { 671 // No AMD. 672 factory(jQuery); 673 } 674}(function ($) { 675 $.fn.addBack = $.fn.addBack || $.fn.andSelf; 676 677 $.fn.extend({ 678 679 actual: function (method, options) { 680 // check if the jQuery method exist 681 if (!this[method]) { 682 throw '$.actual => The jQuery method "' + method + '" you called does not exist'; 683 } 684 685 var defaults = { 686 absolute: false, 687 clone: false, 688 includeMargin: false, 689 display: 'block' 690 }; 691 692 var configs = $.extend(defaults, options); 693 694 var $target = this.eq(0); 695 var fix, restore; 696 697 if (configs.clone === true) { 698 fix = function () { 699 var style = 'position: absolute !important; top: -1000 !important; '; 700 701 // this is useful with css3pie 702 $target = $target. 703 clone(). 704 attr('style', style). 705 appendTo('body'); 706 }; 707 708 restore = function () { 709 // remove DOM element after getting the width 710 $target.remove(); 711 }; 712 } else { 713 var tmp = []; 714 var style = ''; 715 var $hidden; 716 717 fix = function () { 718 // get all hidden parents 719 $hidden = $target.parents().addBack().filter(':hidden'); 720 style += 'visibility: hidden !important; display: ' + configs.display + ' !important; '; 721 722 if (configs.absolute === true) style += 'position: absolute !important; '; 723 724 // save the origin style props 725 // set the hidden el css to be got the actual value later 726 $hidden.each(function () { 727 // Save original style. If no style was set, attr() returns undefined 728 var $this = $(this); 729 var thisStyle = $this.attr('style'); 730 731 tmp.push(thisStyle); 732 // Retain as much of the original style as possible, if there is one 733 $this.attr('style', thisStyle ? thisStyle + ';' + style : style); 734 }); 735 }; 736 737 restore = function () { 738 // restore origin style values 739 $hidden.each(function (i) { 740 var $this = $(this); 741 var _tmp = tmp[i]; 742 743 if (_tmp === undefined) { 744 $this.removeAttr('style'); 745 } else { 746 $this.attr('style', _tmp); 747 } 748 }); 749 }; 750 } 751 752 fix(); 753 // get the actual value with user specific methed 754 // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc 755 // configs.includeMargin only works for 'outerWidth' and 'outerHeight' 756 var actual = /(outer)/.test(method) ? 757 $target[method](configs.includeMargin) : 758 $target[method](); 759
760 restore(); 761 // IMPORTANT, this plugin only return the value of the first element 762 return actual; 763 } 764 }); 765}));
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.