PageSourceSearch

https://myhome.glenoaks.org.uk/modules/baseTemplate/scripts/design.js?v=v2.3.7

js glenoaks.org.uk collected 2026-09-26 11:17:29 UTC 14,581 bytes, 369 lines download raw bytes

1/* eslint-disable */
2(function() {
3    jQuery(document).ready(function(){
4        $(this).find('a.print-action').show().click(function (event) {
5            window.print();
6            event.preventDefault();
7        });
8
9        $(this).find('li.printpage').each(function() {
10            var label = $(this).find('span').html();
11            if(label===undefined) {
12                label = $(this).find('a').html();
13            }
14            $(this).html('<a href="#">'+label+'</a>');
15            $(this).find('a').click(function (event) {
16                window.print();
17                event.preventDefault();
18            });
19        });
20    });
21}());
22
23(function( $ ) {
24    $(document).ready(function() {
25        $(".is-tool-prompt:not(.is-target-blank)").each(function () {
26            $(this).click(function (event) {
27                if (!confirm($(this).attr('title') + '?')) {
28                    event.preventDefault();
29                }
30            })
31        });
32    });
33}( jQuery ));
34
35$(document).ready(function() {
36    $("a.is-target-blank, li.is-target-blank a").each(function () {
37        $(this).click(function (event) {
38            if ($(this).hasClass('is-tool-prompt') && !confirm($(this).attr('title') + '?')) {
39
40            } else {
41                if($(this).attr('href').indexOf("http://") != -1 || $(this).attr('href').indexOf("https://") != -1) {
42                    window.open($(this).attr('href'));
43                }  else {
44                    window.open($('base').attr('href')+'/'+$(this).attr('href'));
45                }
46            }
47            event.preventDefault();
48        })
49    });
50});
51
52(function( $ ) {
53
54    $.fn.ajaxTool = function() {
55        var unloadForm = function(target) {
56            $('.'+target+'-form').unbind('validated').unbind('cancelled').empty();
57        };
58
59        var addLoading = function(classname, type) {
60            if(type===undefined) {
61                type = 'replace';
62            }
63
64            var html = '<span class="m-ajax-loading m-loader-'+type+'"><span class="hide">Loading...</span></span>';
65            if(type==='append') {
66                $(classname).append(html);
67            } else {
68                $(classname).html(html);
69            }
70        }
71
72        return this.each(function() {
73            var url = $(this).attr('data-ajaxurl');
74            var type = $(this).attr('data-ajaxtype');
75            var target = $(this).attr('data-ajaxtarget');
76            var auto = $(this).attr('data-ajaxauto');
77            var secondary_target = $(this).attr('data-ajaxsecondarytarget');
78            var handleData = function(data) {
79                try {
80                    result = JSON.parse(data);
81                    if(result.error!==undefined&&result.error) {
82                        alert(result.message);
83                        unloadForm(target);
84                        if(result.html!==undefined) {
85                            loadForm(result.html, true);
86                        }
87                    } else if(result.success!==undefined&&result.success) {
88                        if(type=='replace') {
89                            $('.'+target).children().remove();
90                            $('.'+target).replaceWith(result.output);
91                            $('.'+target).addClass('flash');
92                            setInterval(function() {
93                                $('.'+target).removeClass('flash')
94                            }, 1000);
95                            $('.'+target+ ' .tool-ajax').ajaxTool();
96                        } else if (type=='prepend') {
97                            $('.'+target).prepend(result.output);
98                            $('.'+target).children().first().find('.tool-ajax').ajaxTool();
99                        } else if (type=='append') {
100                            $('.'+target).append(result.output);
101                            $('.'+target).children().last().find('.tool-ajax').ajaxTool();
102                        } else if (type=='remove') {
103                            $('.'+target).hide("puff", function() {
104                                $(this).remove();
105                            });
106                        } else if (type=='move_replace'||type=='move_append'||type=='move_prepend') {
107                            $('.'+target).hide("puff", function() {
108                                $(this).remove();
109                            });
110
111                            if(type=='move_replace') {
112                                $('.'+secondary_target).children().remove();
113                                $('.'+secondary_target).replaceWith(result.output);
114                                $('.'+secondary_target+ ' .tool-ajax').ajaxTool();
115                            } else if (type=='move_prepend') {
116                                $('.'+secondary_target).prepend(result.output);
117                                $('.'+secondary_target).children().first().find('.tool-ajax')
118                            } else if (type=='move_append') {
119                                $('.'+secondary_target).append(result.output);
120                                $('.'+secondary_target).children().last(
120).find('.tool-ajax')
121                            }
122
123                        }
124                        unloadForm(target);
125                        if(result.message!==undefined && result.message !== "") {
126                            alert(result.message);
127                        }
128                    } else if(result.html!==undefined) {
129                        unloadForm(target);
130                        loadForm(result.html);
131                    }
132                } catch(e) {
133                    //@TODO remove debug alert
134                    alert(data);
135                    alert('Something went wrong - reload the page and try again')
136                    unloadForm(target);
137                }
138            }
139
140            var loadForm = function(data, loaded) {
141                if(loaded===undefined) {
142                    loaded = false;
143                }
144
145                if(!loaded) {
146                    $('.'+target+'-form').hide();
147                    $('.'+target+'-form').html(data);
148                    $('.'+target+'-form').show('fast', function() {
149                        $('html, body').animate({
150                            scrollTop: $(this).offset().top - 200
151                        }, 500);
152                    });
153                } else {
154                    $('.'+target+'-form').html(data);
155                }
156
157                $('.'+target+'-form').find('.fh').fhHandling();
158
159                $('.'+target+'-form').bind('cancelled', function(event, original_event) {
160                    event.preventDefault();
161                    original_event.preventDefault();
162                    unloadForm(target);
163                });
164
165                $('.'+target+'-form').attr('form-submission-in-progress', 'no');
166
167                $('.'+target+'-form').bind('validated', function(event, original_event) {
168                    var self = $(original_event.currentTarget);
169
170                    event.preventDefault();
171                    original_event.preventDefault();
172
173                    if($('.'+target+'-form').attr('form-submission-in-progress')==='no') {
174                        $('.'+target+'-form').attr('form-submission-in-progress','yes');
175                        addLoading('.'+target+'-form'+' .fh-button-primary', 'append');
176                        $('.'+target+'-form'+' .fh-button-submit').attr('disabled', 'disabled');
177                        $.ajax({
178                            url: url,
179                            data: $(self).serialize() + '&' + $(self).find('.fh-button-primary').attr('name') + '=SET',
180                            type: 'POST'
181                        }).done(function (data) {
182                            if(data) {
183                                handleData(data);
184                            } else {
185                                alert('No data received after submission - reload the page and try again')
186                                unloadForm(target);
187                            }
188                        }).error(function () {
189                            unloadForm(target);
190                            alert('Unable to submit the form - reload the page and try again');
191                        });
192                    }
193                });
194            }
195
196            $(this).css({display: 'inline-block'});
197            $(this).click(function(event) {
198                if($(this).hasClass('is-tool-prompt')) {
199                    if (!confirm($(this).attr('title') + '?')) {
200                        event.preventDefault();
201                        event.stopImmediatePropagation();
202                        return;
203                    }
204                }
205                event.preventDefault();
206                event.stopImmediatePropagation();
207                unloadForm(target);
208                addLoading('.'+target+'-form');
209                $.ajax({
210                    url: url
211                }).done(function (data) {
212                    if(data) {
213                        handleData(data);
214                    } else {
215                        alert('No data received - reload the page and try again');
216                        unloadForm(target);
217                    }
218                }).error(function () {
219                    alert('Unable to make that request - reload the page and try again');
220                    unloadForm(target);
221                });
222            });
223
224            if(auto==="1") {
225                $(this).removeAttr('data-ajaxauto');
226                $(this).trigger('click');
227            }
228        });
229    };
230}( jQuery ));
231
232jQuery('.tool-ajax').ajaxTool();
233
234$(document).ready(function() {
235    $('.responsive-menu-wrapper').each( function() {
236        var element = this;
237        if($(element).find('#custom-responsive-menu-wrapper').length) {
238            $(element).prepend('<p class="responsive-menu-toggle">'+$(this).attr('data-menu-text')+'</p>');
239
240            var status = 'closed';
241            $(element).find('.responsive-toggle').click(function(event) {
242                if(status==='closed') {
243                    $(element).find('button.hamburger').addClass('is-active');
244                    status = 'open';
245                } else {
246                    $(element).find('button.hamburger').removeClass('is-active');
247                    status = 'closed';
248                }
249                $(element).find('#custom-responsive-menu-wrapper').slideToggle('fast');
250                event.preventDefault();
251            });
252        }
253        $(element).find('#custom-responsive-menu-wrapper').hide();
254    });
255});
256
257(function( $ ) {
258    $(document).ready(function() {
259        $('a.is-scroll-nicely').each(function() {
260            var self = this;
261            $(self).click(function (event) {
262                if($(this).attr('href')!=undefined) {
263                    var offset = 20;
264                    if($(this)[0].hasAttribute("data-scroll-offset")) {
265                        offset = parseInt($(this).attr('data-scroll-offset'));
266                    }
267                    var href = $(this).attr('href');
268                    if(href.indexOf('#') != -1) {
269                        var elementid = href.substr(href.indexOf("#")+1);
270                        if($('#'+elementid).length) {
271                            $('html, body').animate({
272                                scrollTop: $('#'+elementid).first().offset().top - offset
273                            }, 1000);
274                            event.preventDefault();
275                        } else {
276                            $('a').each(function() {
277                                if($(this).attr('name')!=undefined && $(this).attr('name')==elementid) {
278                                    $('html, body').animate({
279                                        scrollTop: $(this).offset().top - offset
280                                    }, 1000);
281                                    event.preventDefault();
282                                }
283                            });
284                        }
285                    }
286                }
287            });
288        });
289    });
290}( jQuery ));
291
292function DuplicateProtect(button) {
293    this.button = button;
294    this.triggered_label = button.attr('data-triggered-label');
295
296    if (
297        typeof this.triggered_label === typeof undefined ||
298        this.triggered_label === false
299    ) {
300        this.triggered_label = 'Submitting - please wait';
301    }
302    this.form = this.button.parents('form').first();
303    this.form.on('submit', $.proxy(this, 'onFormSubmit'));
304}
305
306DuplicateProtect.prototype.onFormSubmit = function(event) {
307    if (this.form.hasClass('is-already-submitted')) {
308        event.preventDefault();
309    } else {
310
311        var validated = true;
312
313        if(this.form.hasClass('is-not-valid')){
314            validated = false;
315            return false;
316        }
317
318        if(validated) {
319            this.form.addClass('is-already-submitted');
320            this.button.html(`<span><i class="fas fa-cog fa-spin"></i> ${this.triggered_label}</span>`);
321        }
322    }
323};
324
325(function( $ ) {
326    $(window).load(function() {
327        if($('.scroll-to-nicely').length) {
328            var hash = window.location.hash.replace("#", "");
329            $('#'+hash).each(function () {
330                if($(this).hasClass('scroll-to-nicely')) {
331                    var offset = 20;
332                    if($(this)[0].hasAttribute("data-scroll-offset")) {
333                        offset = parseInt($(this).attr('data-scroll-offset'));
334                    }
335                    $('html, body').animate({
336                        scrollTop: $(this).offset().top - offset
337                    }, 1000);
338                }
339            });
340        }
341
342        $('button.is-duplicate-protected').each(function() {
343            const duplicateProtected = new DuplicateProtect($(this));
344        });
345    });
346}( jQuery ));
347
348// bake a cookie
349function createCookie(name,value,days) {
350    if (days) {
351        var date = new Date();
352        date.setTime(date.getTime()+(days*24*60*60*1000));
353        var expires = "; expires="+date.toGMTString();
354    }
355    else expires = "";
356    document.cookie = name+"="+value+expires+"; path=/";
357}
358
359// eat a cookie
360function readCookie(name) {
361    var nameEQ = name + "=";
362    var ca = document.cookie.split(';');
363    for(var i=0;i < ca.length;i++) {
364        var c = ca[i];
365        while (c.charAt(0)==' ') c = c.substring(1,c.length);
366        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
367    }
368    return null;
369}

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.