PageSourceSearch

https://www.chaimweizmann.org.il/sites/chaimweizmann/files/js/js_k…t3hD6OsCgDy1-7IrF4Bmg__tWfaKgoVOqpP7j7AQ.js

js chaimweizmann.org.il collected 2026-09-25 06:55:21 UTC 20,241 bytes, 639 lines download raw bytes

1(function ($, Drupal, drupalSettings) {
2  "use strict";
3  // This function is called from the accessibility toolbar. Please implement it to stop all animations in page.
4  Drupal.stopAllAnimations = function () {
5    $("video").each(function () {
6      $(this).get(0).pause();
7      $(this).get(0).currentTime = 0;
8    });
9  };
10})(jQuery, Drupal, drupalSettings);
11;
12(function ($, Drupal, drupalSettings) {
13  'use strict';
14
15  Drupal.behaviors.targetBlank = {
16    attach: function(context, settings) {
17      $('a[target]').each(function() {
18        $(this).attr({
19          'rel' : 'noindex,nofollow',
20          'target' : 'new' + Date.now(),
21        });
22      });
23    }
24  }
25
26  Drupal.behaviors.initAOS = {
27    attach: function(context, settings) {
28      AOS.init();
29      $('body').attr({
30        'data-aos-duration': '1000',
31        'data-aos-delay': '100'
32      });
33    }
34  }
35  Drupal.behaviors.resizeHeader = {
36    attach: function(context, settings) {
37      var global_width = $(window).width();
38      function resizeHeader() {
39        //var header_width = $('.top-header-line').outerWidth();
40        if (1610 > global_width) {
41          var zoom = global_width / 1610;
42          $('#headline').css('zoom', zoom);
43        } else {
44          $('#headline').css('zoom', '1');
45        }
46        if (global_width < 999){
47          $('#headline').css('zoom', '1');
48        }
49      }
50      resizeHeader();
51      $(window).resize(function () {
52        resizeHeader();
53      });
54    }
55  }
56
57
58  Drupal.behaviors.ariaTabs = {
59    attach: function(context, settings) {
60      // close all inner and outer tabs
61      closeAllTabs(1);
62
63      // add tabindex -1 to all inner and outer tabs links - envoke focus
64      $(".outertabs li a, .innertabs li a").each(function(){
65        $(this).attr("tabindex","-1");
66      });
67
68      // add click functionality for inner and outer tabs links
69      $(".outertabs li a, .innertabs li a").click(function(){
70        switchTab($(this));
71      });
72
73      // function that closes inner/outer/both panels
74      function closeAllTabs(type = 0) {
75        var el = ".outerpanel";
76        if(type == 1){ el = ".innerpanel , .outerpanel"; }
77        if(type == 2){ el = ".innerpanel"; }
78        $(el).each(function() {
79          $(this).attr("hidden",true);
80          $(this).attr("tabindex","-1");
81          $(this).attr("aria-selected",false);
82        });
83        $(".tab-selected").removeClass("tab-selected");
84      }
85
86      // if window bigger then 1000px (not mobile) open the first panel
87      if($(window).width() > 1000){
88        switchTab($("#tab-1"));
89      }
90      // if url contains spesific tab open it
91      if (location.hash) {
92        switchTab($(location.hash));
93      }
94
95      function switchTab(newtab){
96        var prev = $("[aria-selected=true]");
97
98        // close panel only if other tab is clicked (not if subtab clicked)
99        if(newtab.parents(".innertabs").length == 0){
100          $("[aria-selected=true]").attr("tabindex","-1");
101          $("[aria-selected=true]").attr("aria-selected",false);
102          closeAllTabs();
103        }else{
104          $(".innertabs [aria-selected=true]").attr("tabindex","-1");
105          $(".innertabs [aria-selected=true]").attr("aria-selected",false);
106          closeAllTabs(2);
107          // keep selected class on main tab if inner tab selected
108          $("#" + $("#"+$(newtab).parents(".outerpanel")[0].id).attr("aria-labelledby")).parent().addClass("tab-selected");
109        }
110
111        newtab.attr("tabindex","0");
112        newtab.attr("aria-selected",true);
113        $("#" + newtab.attr("aria-controls")).removeAttr("hidden");
114        // open first subtab if available
115        if($("#"+newtab.attr("aria-controls")).find(".innertabs").length > 0){
116          $("#" + newtab.attr("aria-controls") + " .innertabs li a")[0].click();
117        }
118        newtab.parent().addClass("tab-selected");
119        // if window smaller then 1000px (mobile) click on same tab closes it
120        if(newtab[0] == prev[0] && $(window).width() < 1000 && prev){
121        $("[aria-selected=true]").attr("aria-selected",false);
122          closeAllTabs();
123        }
124      }
125
126      // get index of element in its parent
127      function getIndex(el,arr){
128        var out = -1;
129        arr.each(function (i){
130          if($(this).attr("id") == el.id){
131            out = i;
132          }
133        });
134        return out;
135      }
136
137      // arrow navigation
138      var LEFT_ARROW = 37;
139      var RIGHT_ARROW = 39;
140      const DOWN_ARROW = 40;
141      const UP_ARROW = 38;
142      // switch arrows on english
143      if($('html')[0].lang == "en"){
144        var LEFT_ARROW = 39;
145        var RIGHT_ARROW = 37;
146      }
147
148      $(".outertabs li a").keydown(function(event){
149        if(event.which == DOWN_ARROW){
150          event.preventDefault();
151          $("#" + $(event.target).attr("aria-controls")).focus();;
152        }
153        if(event.which == RIGHT_ARROW){
154          event.preventDefault();
155          var index = getIndex(event.target,$(".outertabs li a")) - 1;
156          changeTabFocus(".outertabs li a",index);
157        }
158        if(event.which == LEFT_ARROW){
159          event.preventDefault();
160          var index = getIndex(event.target,$(".outertabs li a")) + 1;
161          changeTabFocus(".outertabs li a",index);
162        }
163      });
164
165      $(".innertabs li a").keydown(function(event){
166        if(event.which == LEFT_ARROW){
167          event.preventDefault();
168          $("#" + $(event.target).attr("aria-controls")).focus();;
169        }
170        if(event.which == UP_ARROW){
171          event.preventDefault();
172          var index = getIndex(event.target,$(".innertabs li a")) - 1;
173          changeTabFocus(".innertabs li a",index);
174        }
175        if(event.which == DOWN_ARROW){
176          event.preventDefault();
177          var index = getIndex(event.target,$(".innertabs li a")) + 1;
178          changeTabFocus(".innertabs li a",index);
179        }
180      });
181
182      function changeTabFocus(query,index){
183        // if element exists move to it
184        if($(query)[index]){
185          $(query)[index].click();
186          $(query)[index].focus();
187        }
188      }
189
190    }
191  };
192
193  Drupal.behaviors.tabsArrowsNavigation = {
194    attach: function(context, settings) {
195
196    }
197  };
198
199  Drupal.behaviors.setVideoAsBackground = {
200    attach: function(context, settings) {
201      var elem = $('.background-video-container').clone();
202
203      $('.background-video-container').remove();
204      $('#page').prepend(elem);
205    }
206  }
207
208  Drupal.behaviors.homepageBanner = {
209    attach: function(context, settings) {
210      $('.overlay .play').click(function() {
211        $('.video-container').addClass('active');
212        $('.overlay').addClass('active');
213        $('body').addClass('video-playing');
214        var video =  $('.video-container video').get(0);
215        video.play();
216      });
217      $('.overlay .stop').click(function() {
218        $('.video-container').removeClass('active');
219        $('.overlay').removeClass('active');
220        $('body').addClass('video-playing');
221        var video =  $('.video-container video').get(0);
222        video.pause();
223        $('body').removeClass('video-playing');
224      });
225    }
226  }
227
228  Drupal.behaviors.homepageToursActivitiesTitle = {
229    attach: function(context, settings) {
230      if (!$('#block-views-block-tours-activities-frontpage-block').length) {
231        return;
232      }
233      if ($('#block-views-block-tours-activities-frontpage-block article').hasClass('processed')) {
234        return;
235      }
236
237      var $h2 = $('#block-views-block-tours-activities-frontpage-block h2').clone();
238      $('#block-views-block-tours-activities-frontpage-block h2').remove();
239      $('#block-views-block-tours-activities-frontpage-block article').prepend($h2);
240
241      $('#block-views-block-tours-activities-frontpage-block article').addClass('processed');
242    }
243  }
244
245  Drupal.behaviors.specialActivitiesBlockToggle = {
246    attach: function(context, settings) {
247      $('.open-close-special-activities, .special-activities-background').click(function(e) {
248        // setTimeout(function() {
249        $('.special-activities-content').toggleClass('hide', 3000);
250        $('.special-activities-background').toggleClass('hide', 3000);
251        $('#block-special-activities-block').toggleClass('visible', 3000);
252        setTimeout(function() {
253          $('#block-special-activities-block').toggleClass('rotate', 3000);
254        }, 200);
255        e.stopPropagation();
256      });
257    }
258  }
259
260  Drupal.behaviors.scrollButton = {
261    attach: function(context, settings) {
262      $('.node--type-weizmann-house-page').append('<button class="scroll"><span class="scroll-indicator"></span></button>');
263      $('.scroll').click(function() {
264        // scroll to #content
265        $('.scroll').toggleClass('is-scrolling');
266        $([document.documentElement, document.body]).animate({
267          scrollTop: $("#content").offset().top
268        }, 1000);
269      });
270    }
271  }
272
273  Drupal.behaviors.menuAppendStyles = {
274    attach: function(context, settings)  {
275      var elem = $('#superfish-main .secondary:first-of-type, ' +
276        '#superfish-main-menu .secondary:first-of-type')[0];
277      $(elem).parent().addClass('secondary-menu-start');
278
279    }
280  }
281
282  Drupal.behaviors.menuLanguageTweaks = {
283    attach: function(context, settings) {
284      const curr_url = location.href;
285      $('.lang-link').removeClass('is-active');
286      if (settings.path.currentLanguage == 'he') {
287        // hide HE links
288        $('.he-link').parent().remove();
289        //$('.secondary.en-link').attr('href', curr_url.replace('/he', '/en'));
290        //$('.secondary.en-link').attr('href', curr_url.replace(drupalSettings.path.baseUrl, drupalSettings.path.baseUrl + 'en/'));
291        $('.secondary.en-link').attr('href', location.origin + drupalSettings.path.baseUrl + 'en' + location.pathname)
292
293      }
294      else if (settings.path.currentLanguage == 'en') {
295        $('.en-link').parent().remove();
296        $('.secondary.he-link').attr('href', curr_url.replace('/en', ''));
297      }
298    }
299  }
300
301  Drupal.behaviors.footerMenuTargetBlankFix = {
302    attach: function(context, settings) {
303      $('a[href^=http]:not(.lang-link)').each(function() {
304        $(this).attr('target', 'blank');
305      });
306    }
307  }
308
309  Drupal.behaviors.fadeOnScroll = {
310    attach: function (context, settings) {
311      $('.path-frontpage #block-wis-theme-content .house-content-wrapper article .node__content', context).once('fade-on-scroll').each(function () {
312        const container = this;
313
314        container.addEventListener('scroll', function () {
315          const isBottom =
316            container.scrollTop + container.clientHeight >= container.scrollHeight - 1;
317
318          if (isBottom) {
319            container.closest('.house-content-wrapper').classList.add('hide-fade');
320          } else {
321            container.closest('.house-content-wrapper').classList.remove('hide-fade');
322          }
323        });
324      });
325    }
326  };
327
328
329
330})(jQuery, Drupal, drupalSettings);
331;
332(function ($, Drupal, drupalSettings) {
333
334  $(document).ready(function() {
335    if (!window.matchMedia('only screen').matches) {
336      return;
337    }
338
339    Drupal.wis_a11y.init();
340    Drupal.wis_a11y.setFromLocalStorage();
341  });
342
343  Drupal.wis_a11y = {
344
345    cache: {
346      $document: $( document ),
347      $window: $( window )
348    },
349
350    cacheElements: function() {
351      this.cache.$toolbar = $( '#wis-a11y-toolbar' );
352      this.cache.$toolbarLinks = this.cache.$toolbar.find( 'button,  .wis-a11y-toolbar-items a' );
353      this.cache.$toolbarToolsLinks = this.cache.$toolbar.find( '.wis-a11y-toolbar-items button' );
354      this.cache.$btnToolbarToggle = this.cache.$toolbar.find( 'div.wis-a11y-toolbar-toggle > a' );
355      this.cache.$skipToContent = $( '#wis-a11y-skip-content' );
356      this.cache.$body = $( 'body' );
357      this.cache.$mainWrapper = $( 'body' );
358    },
359
360    settings: {
361      minFontSize: 100,
362      maxFontSize: 160,
363      //buttonsClassPrefix: 'wis-a11y-btn-',
364      bodyClassPrefix: 'wis-a11y-',
365      bodyFontClassPrefix: 'wis-a11y-resize-font-',
366      storageKey: 'wis-a11y',
367      expires: drupalSettings.WisA11yOptions.save_expiration ? drupalSettings.WisA11yOptions.save_expiration * 36e5 /* hours to ms */ : 43200000 // 12 hours
368    },
369
370    variables: {
371      currentFontSize: 100,
372      currentSchema: null
373    },
374
375    activeActions: {},
376
377    buildElements: function() {
378      // Move the `toolbar/skip to content` to top
379      this.cache.$body.prepend( this.cache.$toolbar );
380      //this.cache.$body.prepend( this.cache.$skipToContent );
381    },
382
383    bindEvents: function() {
384      var $self = this;
385
386      $self.cache.$btnToolbarToggle.on( 'click', function( event ) {
387        event.preventDefault();
388
389        $self.cache.$toolbar.toggleClass( 'wis-a11y-toolbar-open' );
390
391        if ( $self.cache.$toolbar.hasClass( 'wis-a11y-toolbar-open' ) ) {
392          $self.cache.$toolbarLinks.attr( 'tabindex', '0' );
393        } else {
394          $self.cache.$toolbarLinks.attr( 'tabindex', '-1' );
395        }
396      } );
397
398      /*$(document).on( 'keyup', function( event ) {
399        var TAB_KEY = 9;
400
401        if ( TAB_KEY !== event.which || ! $self.cache.$btnToolbarToggle.is( ':focus' ) ) {
402          return;
403        }
404        $self.cache.$toolbar.addClass( 'wis-a11y-toolbar-open' );
405        $self.cache.$toolbarLinks.attr( 'tabindex', '0' );
406      });*/
407
408      $(document).on( 'keyup', function( event ) {
409        var SPACE_KEY = 32;
410
411        if ( SPACE_KEY !== event.which || ! $self.cache.$btnToolbarToggle.is( ':focus' ) ) {
412          return;
413        }
414        $self.cache.$toolbar.addClass( 'wis-a11y-toolbar-open' );
415        $self.cache.$toolbarLinks.attr( 'tabindex', '0' );
416      });
417
418      $( document ).on( 'keydown', function ( event ) {
419        if ( event.which === 27 ) { // ESC
420          if ($self.cache.$toolbar.hasClass( 'wis-a11y-toolbar-open' )) {
421            $self.cache.$btnToolbarToggle.click();
422          }
423        }
424      });
425
426      $self.bindToolbarButtons();
427    },
428
429    bindToolbarButtons: function() {
430      var self = this;
431
432      self.cache.$toolbarToolsLinks.on('click', function(event) {
433        event.preventDefault();
434
435        var $this = $( this ),
436          action = $this.data( 'action' ),
437          actionGroup = $this.data( 'action-group' ),
438          deactivate = false;
439
440        if ( 'stop' === action ) {
441          if(typeof Drupal.stopAllAnimations !== 'undefined') {
442            Drupal.stopAllAnimations();
443          }else {
444            console.error('Drupal.stopAllAnimations function is undefined. Please create it and implemet it to stop animations on page.');
445          }
446          return;
447        }
448
449        if ( 'reset' === action ) {
450          self.reset();
451          return;
452        }
453
454        if ( -1 !== [ 'toggle', 'schema' ].indexOf( actionGroup ) ) {
455          deactivate = $this.hasClass( 'active' );
456        }
457
458        self.activateButton( action, deactivate );
459      });
460    },
461
462    activateButton: function(action, deactivate) {
463      var $button = this.getButtonByAction(action),
464        actionGroup = $button.data('action-group');
465
466      this.activeActions[action] = !deactivate;
467
468      this.actions[actionGroup].call(this, action, deactivate);
469
470      this.saveToLocalStorage();
471    },
472
473    getActiveButtons: function() {
474      return this.cache.$toolbarToolsLinks.filter( '.active' );
475    },
476
477    getButtonByAction: function( action ) {
478      return this.cache.$toolbarToolsLinks.filter('[data-action="'+action+'"]');
479      //return this.cache.$toolbarToolsLinks.filter( '.' + this.settings.buttonsClassPrefix + action );
480    },
481
482    actions: {
483      toggle: function(action, deactivate) {
484        var $button = this.getButtonByAction(action),
485          fn = deactivate ? 'removeClass' : 'addClass';
486
487        if (deactivate) {
488          $button.removeClass('active');
489        } else {
490          $button.addClass('active');
491        }
492
493        this.cache.$body[fn](this.settings.bodyClassPrefix + action);
494      },
495      highlight_a: function(action, deactivate) {
496
497      },
498      resize: function(action, deactivate) {
499        var oldFontSize = this.variables.currentFontSize;
500
501        if ('resize-plus' === action && this.settings.maxFontSize > oldFontSize) {
502          this.variables.currentFontSize += 10;
503        }
504
505        if ('resize-minus' === action && this.settings.minFontSize < oldFontSize) {
506          this.variables.currentFontSize -= 10;
507        }
508
509        if (deactivate) {
510          this.variables.currentFontSize = this.settings.minFontSize;
511        }
512
513        this.cache.$mainWrapper.removeClass(this.settings.bodyFontClassPrefix + oldFontSize);
514
515        var isPlusActive = 100 < this.variables.currentFontSize,
516          plusButtonAction = isPlusActive ? 'addClass' : 'removeClass';
517
518        this.getButtonByAction('resize-plus')[plusButtonAction]('active');
519
520        if (isPlusActive) {
521          this.cache.$mainWrapper.addClass(this.settings.bodyFontClassPrefix + this.variables.currentFontSize);
522        }
523
524        this.activeActions['resize-minus'] = false;
525        this.activeActions['resize-plus'] = isPlusActive;
526        this.cache.$window.trigger('resize');
527      },
528      schema: function(action, deactivate) {
529        var currentSchema = this.variables.currentSchema;
530
531        if (currentSchema) {
532          this.cache.$mainWrapper.removeClass(this.settings.bodyClassPrefix + currentSchema);
533          this.getButtonByAction(currentSchema).removeClass('active');
534          this.activeActions[currentSchema] = false;
535
536          this.saveToLocalStorage();
537        }
538
539        if (deactivate) {
540          this.variables.currentSchema = null;
541          return;
542        }
543
544        currentSchema = this.variables.currentSchema = action;
545        this.cache.$mainWrapper.addClass(this.settings.bodyClassPrefix + currentSchema);
546        this.getButtonByAction(currentSchema).addClass('active');
547      }
548    },
549
550    reset: function() {
551      for (var action in this.activeActions) {
552        if (this.activeActions.hasOwnProperty(action) && this.activeActions[action]) {
553          this.activateButton(action, true);
554        }
555      }
556
557      localStorage.removeItem(this.settings.storageKey);
558    },
559
560    saveToLocalStorage: function() {
561      if ('1' !== drupalSettings.WisA11yOptions.enable_save) {
562        return;
563      }
564
565      if (!this.variables.expires) {
566        this.variables.expires = (new Date()).getTime() + this.settings.expires;
567      }
568
569      var data = {
570        actions: this.activeActions,
571        variables: {
572          currentFontSize: this.variables.currentFontSize,
573          expires: this.variables.expires
574        }
575      };
576
577      localStorage.setItem(this.settings.storageKey, JSON.stringify(data));
578    },
579
580    setFromLocalStorage: function() {
581      if ('1' !== drupalSettings.WisA11yOptions.enable_save) {
582        return;
583      }
584
585      var localData = JSON.parse( localStorage.getItem( this.settings.storageKey ) );
586      if ( ! localData ) {
587        return;
588      }
589
590      var currentDate = new Date(),
591        expires = localData.variables.expires;
592
593      if ( currentDate > expires ) {
594        localStorage.removeItem( this.settings.storageKey );
595        return;
596      }
597
598      var actions = localData.actions;
599
600      if ( localData.variables.currentFontSize > 100 ) {
601        localData.variables.currentFontSize -= 10;
602      }
603
604      $.extend( this.variables, localData.variables );
605
606      for ( var action in actions ) {
607        if ( actions.hasOwnProperty( action ) && actions[ action ] ) {
608          this.activateButton( action, false );
609        }
610      }
611    },
612
613    handleGlobalOptions: function() {
614      if ( '1' === drupalSettings.WisA11yOptions.focusable ) {
615        this.cache.$mainWrapper.addClass( 'wis-a11y-focusable' );
616      }
617
618      if ( '1' === drupalSettings.WisA11yOptions.remove_link_target ) {
619        $( 'a[target="_blank"]' ).attr( 'target', '' );
620      }
621
622      /*if ( '1' === drupalSettings.WisA11yOptions.add_role_links ) {
623        $( 'a' ).attr( 'role', 'link' );
624      }*/
625    },
626
627    init: function() {
628      this.cacheElements();
629      this.buildElements();
630      this.bindEvents();
631      this.handleGlobalOptions();
632    }
633  };
634
635  // $(document).on('keyup', function() {console.log(document.activeElement)});
636
637
638})(jQuery, Drupal, drupalSettings);
639;

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.