PageSourceSearch

https://fernkloof.org.za/media/templates/site/transport/js/sparky-id98-260825002718.js

js fernkloof.org.za collected 2026-10-02 11:23:19 UTC 11,641 bytes, 285 lines download raw bytes

1/* SPARKY DYNAMICALLY GENERATED JAVASCRIPT - DO NOT EDIT THIS FILE!
2YOUR CHANGES WILL BE OVERWRITTEN AFTER NEXT SAVE OF TEMPLATE PARAMETERS!
3You can add your custom JavaScript code in template options, under Custom tab or
4you can edit file custom.js to add your JavaScript code. */
5
6// Mega menu
7
8(function(jQuery, undefined) {
9    jQuery.widget("hjt.megamenu", {
10        options: {
11            fade: true,
12            slide: true,
13            animation_speed: "slow",
14            down_arrows: true,
15            mega_pane_width: 160,
16            pane_border_size: 1
17        },
18
19        _BaseHTML: "",
20        _Container: null,
21        _InnerElements: null,
22        _AnimatedItem: null,
23
24        _create: function() {
25            var self = this,
26                options = self.options;
27            var $el = jQuery(this.element);
28
29            $el.hide();
30
31            var n = 0;
32            $el.find('.separator, a:contains("#LOAD#"), a:contains("#load#"), a:contains("#Load#")').each(function(index) {
33                var sHtml = jQuery(jQuery(document).find(".megamenu_separator" + String(n + 1))[0]);
34                if (sHtml[0]) {
35                    sHtml.remove();
36                    jQuery(jQuery(this)[0]).replaceWith(sHtml);
37                }
38                n++;
39            });
40            
41            $el.addClass("hjt-megamenu-menubar");
42            $el.children().addClass("hjt-megamenu-menubar-item");
43
44            $el.show();
45            $el.children().each(function(index) {
46                if (this.nodeName.toUpperCase() == "LI") {
47                    var ULs = jQuery(this).find("UL").length - jQuery(this).find('*[class*="megamenu_separator"] UL').length;
48                    if (ULs > 0) {
49
50                        try {
51                            if (options.down_arrows) {
52                                jQuery(jQuery(this).find("A")[0]).append(jQuery("<span class='hjt-megamenu-menubar-droparrow' >&nbsp;</span>"));
53                            }
54                        } catch (ecx) {
55                        }
56
57                        var Cols = ULs;
58
59                        var i = 0;
60                        var sTDs = "";
61                        for (i = 0; i < Cols; i++) {
62                            sTDs = sTDs + "<div class='hjt-megamenu-dropdown-panel-content' ></div>";
63                        }
64
65                        var DropDownDiv = jQuery("<div class='hjt-megamenu-dropdown-panel'><div class='mega_menu_table'>" + sTDs + "</div></div>");
66
67                        var Cells = DropDownDiv.find('.hjt-megamenu-dropdown-panel-content');
68                        var c = 0;
69                        var r = 0;
70
71                        jQuery(this).children("ul").each(function(index) {
72                            jQuery(this).remove();
73                            var Multiple = false;
74                            var Title = null;
75
76                            jQuery(this).children("li").each(function(index) {
77                                jQuery(this).children("ul").each(function(index) {
78                                    Multiple = true;
79                                    try {
80                                        if (this.parentNode.children[0].nodeName != "ul") {
81                                            Title = jQuery(this.parentNode.children[0]);
82                                            Title.addClass("hjt-megamenu-dropdown-panel-list-title");
83                                        }
84                                    } catch (exp) { }
85                                    if (Title != null) jQuery(Cells[r * Cols + c]).append(Title);
86                                    jQuery(Cells[r * Cols + c]).append(jQuery(this));
87                                    jQuery(this).addClass("hjt-megamenu-dropdown-panel-list");
88                                    c++;
89                                    if (c == Cols) {
90                                        c = 0;
91                                        r++;
92                                    }
93                                });
94                            });
95
96                            if (Multiple == false) {
97                                jQuery(Cells[r * Cols + c]).append(jQuery(this));
98                                jQuery(this).addClass("hjt-megamenu-dropdown-panel-list");
99                                c++;
100                                if (c == Cols) {
101                                    c = 0;
102                                    r++;
103                                }
104                            }
105                        });
106
107                        jQuery(this).append(DropDownDiv);
108
109                        if (DropDownDiv.innerWidth() < jQuery(this).innerWidth()) {
110                            DropDownDiv.find(".mega_menu_table").css({ minWidth: jQuery(this).innerWidth() + "px" });
111                            DropDownDiv.find(".mega_menu_table").css({ width: jQuery(this).innerWidth() + "px" });
112                        }
113
114                        if (options.slide) {
115                            DropDownDiv.animate({ height: "toggle" }, 0);
116                            DropDownDiv.animate({ height: "toggle" }, 0);
117                        }
118                    }
119                }
120                jQuery(this).addClass("hjt-megamenu-menubar-item-normal");
121                jQuery(this).bind("mouseenter", { Sender: jQuery(this), Self: self }, self.onBarItem_Enter);
122                jQuery(this).bind("mouseleave", { Sender: jQuery(this), Self: self }, self.onBarItem_Leave);
123            });
124            
125            jQuery(window).resize(function(){
126                if(self._AnimatedItem){
127                    if(self._AnimatedItem.is(":visible")){
128                        self.positionDropDown(self._AnimatedItem);
129                    }
130                }
131            });
132
133            // remove empty panels
134
135            jQuery( ".hjt-megamenu-dropdown-panel-content" ).each(function() {
136                if ( jQuery(this).children().length == 0 ) {
137                    jQuery(this).remove();
138                }
139            });
140
141            // check if drop-down panel width should be reduced
142
143            var drop_down_panes, drop_down_pane_width, needed_pane_width;
144
145            jQuery( ".hjt-megamenu-menubar-item" ).each(function() {
146
147                drop_down_panes = jQuery(this).find(".hjt-megamenu-dropdown-panel-content").length;
148                drop_down_pane_width = jQuery(this).children(".hjt-megamenu-dropdown-panel").width();
149                needed_pane_width = drop_down_panes * options.mega_pane_width + options.pane_border_size * 2;
150
151                if (needed_pane_width < drop_down_pane_width) {
152                    jQuery(this).children(".hjt-megamenu-dropdown-panel").css("width", needed_pane_width + "px");
153                }
154
155            });
156
157            var screenWidth = jQuery("body").width();
158            
159
160            // remove modules on mobile (if enabled)
161
162            jQuery( ".hjt-megamenu-dropdown-panel-content" ).each(function() {
163                if ( screenWidth < 992 ) {
164                    if ( jQuery(this).find("[class^='megamenu_separator']").length > 0 ) {
165                        jQuery(this).remove();
166                    }
167                }
168            });
169
170            // double tap needed on mobiles if menu item is linked and has children
171
172            if( screenWidth < 992 ) {
173                jQuery(".touchevents ul.mega").find("li > .hjt-megamenu-dropdown-panel").prev().addClass("firstClick");
174            }
175
176            jQuery(".firstClick").on("click", function(e){
177                if(jQuery(this).hasClass("firstClick")) {
178                    jQuery(this).removeClass("firstClick");
179                    e.preventDefault();
180                } else {
181                    return true;
182                }
183            });
184            
185            
186
187        },
188
189        _setOption: function(key, value) {
190            this.options[key] = value;
191        },
192
193        positionDropDown:function(Panel){
194            var offView = (jQuery(window).width() - Panel.parent().offset().left) - Panel.innerWidth();
195            var forBorder;
196
197            if (offView > 0) {
198                forBorder = 0;
199                offView = 0;
200                Panel.css("left",(Panel.parent().position().left + offView - forBorder) + "px");
201            } else {
202                Panel.css("right", 0);
203            };
204            
205            
206
207        },
208        onBarItem_Enter: function(eArgs) {
209            var Sender = eArgs.data.Sender;
210            var options = eArgs.data.Self.options; 
211            if(Sender.hasClass("hjt-megamenu-menubar-item-hover")) return;
212            Sender.addClass("hjt-megamenu-menubar-item-hover").removeClass("hjt-megamenu-menubar-item-normal");
213            var Panels = Sender.find(".hjt-megamenu-dropdown-panel");
214            if (Panels.length > 0) {
215                if (eArgs.data.Self._AnimatedItem != null) {
216                    eArgs.data.Self._AnimatedItem.stop(true, true);
217                }
218                eArgs.data.Self._AnimatedItem = jQuery(Panels[0]);
219                eArgs.data.Self.positionDropDown(eArgs.data.Self._AnimatedItem);
220                
221                if (options.fade && options.slide) {
222                    jQuery(Panels[0]).animate({ opacity: "toggle", height: "toggle" }, options.animation_speed);
223                } else if (options.fade) {
224                    jQuery(Panels[0]).animate({ opacity: "toggle" }, options.animation_speed);
225                } else if (options.slide) {
226                    jQuery(Panels[0]).animate({ height: "toggle" }, options.animation_speed);
227                } else {
228                    jQuery(Panels[0]).show();
229                }
230
231                var MaxWidth = 0;
232                jQuery(Panels[0]).find(".hjt-megamenu-dropdown-panel-content").each(function(index) {
233                    if (jQuery(this).innerWidth() > MaxWidth) {
234                        MaxWidth = jQuery(this).innerWidth();
235                    }
236                });
237
238            }
239        },
240
241        onBarItem_Leave: function(eArgs) {
242            var Sender = eArgs.data.Sender;
243            var options = eArgs.data.Self.options;
244            Sender.addClass("hjt-megamenu-menubar-item-normal").removeClass("hjt-megamenu-menubar-item-hover");
245            var Panels = Sender.find(".hjt-megamenu-dropdown-panel");
246            if (Panels.length > 0) {
247                if (eArgs.data.Self._AnimatedItem != null) {
248                    eArgs.data.Self._AnimatedItem.stop(true, true);
249                }
250                eArgs.data.Self._AnimatedItem = jQuery(Panels[0]);
251                if (options.fade && options.slide) {
252                    jQuery(Panels[0]).animate({ opacity: "toggle", height: "toggle" }, options.animation_speed);
253                }
254                else if (options.fade) {
255                    jQuery(Panels[0]).animate({ opacity: "toggle" }, options.animation_speed);
256                }
257                else if (options.slide) {
258                    jQuery(Panels[0]).animate({ height: "toggle" }, options.animation_speed);
259                }
260                else {
261                    jQuery(Panels[0]).hide();
262                }
263            }
264        },
265
266        destroy: function() {
267            jQuery(this.element).html(this._baseHTML);
268            jQuery.Widget.prototype.destroy.call(this);
269        }
270
271    }); // widget
272})(jQuery);
273
274
275jQuery(document).ready(function() {
276    jQuery(".mnu_topmenu").megamenu({
277        fade:true,
278        slide:true,
279        animation_speed: 300,
280        down_arrows:false,
281        mega_pane_width: 250,
282        pane_border_size: 1
283
284    });
285});

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.