PageSourceSearch

https://richardmagazine.com/wp-content/themes/richard-magazine-europe-US/js/scripts.js?v=1790332973&ver=7.1.2

js richardmagazine.com collected 2026-09-25 10:43:16 UTC 2,902 bytes, 102 lines download raw bytes

1var search_logic = function(){
2  var formShowing = false; //only used for fixing search field still appearing when window is resized
3
4  //if they click elsewhere on non-mobile views, close the search form:
5  var bodyClick = function(event){
6        if (window.innerWidth > 768 && $(event.target)[0].className !== 'search-field'){
7          $('.search-form').fadeOut("slow", function(){
8            $('.search-form input').val(''); //removes value from search form after fadeOut 
9          });
10          $(this).off('click'); //removes itself
11       }
12
13  }
14
15  var searchClick = function(){
16    $(".search-form").fadeIn("slow");
17    $(this).off('click'); //removes click event
18    var open_searchbar = this;
19    window.setTimeout(function(){
20      $('body').click(bodyClick)
21    }, 500)
22  }
23
24  $('#open_searchbar').click(searchClick.bind(this));
25
26  $(window).resize(function(){
27    if (window.innerWidth < 768){
28      $('.search-form').show(); //could also use fadeIn
29      formShowing = true;
30    }
31    if (formShowing === true && window.innerWidth > 768){
32      $('body').off('click'); //event handler that closes search window was still attached when you resized. this fixes
33      $('.search-form').hide();
34      formShowing = false;
35    }
36
37    //not search related but less expensive to place here
38    if (window.innerWidth > 768 && window.innerWidth < 992){
39      if ($('#player').length && $('.next_one').length){
40      if ($("#player").height() !== $(".next_one")[0].clientHeight){
41        var x = $(".next_one")[0].clientHeight;
42        $("#player").attr('height', x);
43      }
44      }
45    }
46  });
47
48}
49
50var scrollLatest = function(){
51    $('#latest_boilerplate')
52  .click(function(event) {
53      var target = $(this);
54      if (target) {
55        event.preventDefault();
56        $('html, body').animate({
57          scrollTop: target.offset().top
58        }, 1000, function() {
59        });
60      }
61  });
62}
63
64
65var IEPolyfill = function(){
66
67  var detectIE = function() {
68    var ua = window.navigator.userAgent;
69
70    var msie = ua.indexOf('MSIE ');
71    if (msie > 0) {
72      // IE 10 or older => return version number
73      return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
74    }
75
76    var trident = ua.indexOf('Trident/');
77    if (trident > 0) {
78      // IE 11 => return version number
79      var rv = ua.indexOf('rv:');
80      return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
81    }
82
83    var edge = ua.indexOf('Edge/');
84    if (edge > 0) {
85      // Edge (IE 12+) => return version number
86      return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
87    }
88
89    // other browser
90    return false;
91  }
92
93  if (detectIE() == true || /\.NET/.test(navigator.userAgent)){ 
94    $('footer').css('clear', 'both'); //hack to fix the footer in IE11. may not be necessary
95  }
96}
97
98$(document).ready(function(){    
99    search_logic();
100    scrollLatest();
101    IEPolyfill();
102});

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.