PageSourceSearch

https://moodle.com/wp-content/themes/thetheme/plugins/general-scripts.js?ver=1.5.8

js moodle.com collected 2026-10-01 08:40:34 UTC 4,174 bytes, 134 lines download raw bytes

1
2(function($){	
3
4  $(document).on('gform_post_render', function(){
5      
6    /*$('ul.gfield_checkbox li, ul.gfield_radio li').each(function(){
7      var section = $(this);
8      if (!section.hasClass('processed')) {
9        $('label, span', section).click(function(e) {
10          var checkbox = $('input', section);
11          checkbox.prop('checked', !checkbox.prop('checked'));
12          $('input[type=text]', section).focus();
13        });
14        $('input[type=text]', section).focus(function(){
15          $(this).siblings('input').click();
16        })
17        section.addClass('processed');
18      }
19    });*/
20  });
21
22  $(document).ready(function() {
23    if (!$('body').hasClass('body-processed-general')) {
24      $('html').addClass('has-js');
25      
26      /*$('select').select2({
27        minimumResultsForSearch: Infinity,
28        width: '100%'
29      });*/
30
31      $('a[href="#no-link"], a.no-link, li.no-link > a, div.no-link > a').each(function() {
32        $(this).attr('href', '');
33        $(this).attr('aria-disabled', 'true');
34        $(this).click(function(event) {
35          event.preventDefault();
36          event.stopPropagation();
37          return false;
38        });
39      });
40
41      // Open external links in new tab
42      $('a:not([href^="https://youtu.be/"]):not([href^="https://www.youtube.com/watch"]):not([href^="tel:"]):not([href^="mailto:"])').each(function() {
43
44        if (this.href.length > 0) {
45          var a = new RegExp('/' + window.location.host + '/');
46          if(!a.test(this.href) && !$(this).hasClass('fancybox') && $(this).attr('href') != 'javascript:void(0)') {
47            if ($(this).hasClass('same-tab')) {
48              add_external_label($(this));
49            }
50            else {
51              new_tab($(this));
52            }
53          }
54        }
55      });
56
57      // Open external links in new tab
58      $('a[href$=".pdf"]').each(function() {
59        new_tab($(this));
60      });
61
62      function new_tab(link) {
63        let link_types = (link.attr('rel') || '').split(' ');
64        if (!link_types.includes('noopener')) {
65          link_types.push('noopener');
66        }
67        let link_label = (link.attr('aria-label') || '');
68        if (link_label.length < 1) {
69          link_label = link.text().trim();
70        }
71        link_label = link_label + ' (external link, opens in a new tab)';
72        link.attr('rel', link_types.join(' ').trim()).attr('aria-label', link_label);
73        link.click(function(event) {
74          event.preventDefault();
75          event.stopPropagation();
76          window.open(this.href, '_blank');
77        });
78      }
79
80      function add_external_label(link) {
81        let link_label = (link.attr('aria-label') || '');
82        if (link_label.length < 1) {
83          link_label = link.text().trim();
84        }
85        link.attr('aria-label', link_label + ' (external link)');
86      }
87
88      // Animate in sections
89      var sections = $('.hentry-wrapper > .entry-content > div');
90      
91      // Already visible modules
92      sections.each(function(i) {
93        var row = $(this);
94        if (row.visible(true)) {
95          row.addClass("already-visible"); 
96        } 
97        else {
98          row.addClass('ready-anim');
99        }
100      });
101
102      $(window).scroll(function(event) {
103        sections.each(function(i, el) {
104          var row = $(this);
105          if (!row.hasClass('already-visible') && !row.hasClass('come-in') && row.visible(true)) {
106            sections.splice(i, 1);
107            row.addClass("come-in");
108          } 
109        });
110      }),scroll();
111
112      $('body').addClass('body-processed-general');
113    }
114  });
115
116})(jQuery);
117
118(function($) {
119  var isIE11 = !!navigator.userAgent.match(/Trident.*rv\:11\./);
120
121  if (!isIE11) {
122    // Passive event listeners
123    jQuery.event.special.touchstart = {
124      setup: function (_, ns, handle) {
125        this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
126      }
127    };
128    jQuery.event.special.touchmove = {
129      setup: function (_, ns, handle) {
130        this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") });
131      }
132    };  
133  }
134}(window.jQuery || window.$)); 

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.