PageSourceSearch

https://dailybulletin.com.au/templates/gk_university/js/gk.menu.js

js dailybulletin.com.au collected 2026-10-01 06:41:07 UTC 10,012 bytes, 229 lines download raw bytes

1jQuery(window).on("load", function() {
2    if(jQuery('#gkExtraMenu').length > 0  && jQuery('#gkMainMenu').hasClass('gkMenuClassic')) {
3        // fix for the iOS devices     
4        jQuery('#gkExtraMenu ul li span').each(function(i, el) {
5            el.attr('onmouseover', '');
6        });
7
8        jQuery('#gkExtraMenu ul li a').each(function(i, el) {
9            el = jQuery(el);
10            el.attr('onmouseover', '');
11            
12            if(el.parent().hasClass('haschild') && jQuery('body').attr('data-tablet') !== undefined) {
13                el.click(function(e) {
14                    if(el.attr("dblclick") === undefined) {
15                        e.preventDefault();
16                        e.stopPropagation();
17                        el.attr("dblclick", new Date().getTime());
18                    } else {
19                        if(el.parent().find('div.childcontent').eq(0).css('overflow') === 'visible') {
20                            window.location = el.attr('href');
21                        }
22                        var now = new Date().getTime();
23                        if(now - el.attr("dblclick", 0) < 500) {
24                            window.location = el.attr('href');
25                        } else {
26                           e.preventDefault();
27                           e.stopPropagation();
28                           el.attr("dblclick", new Date().getTime());
29                        }
30                    }
31                });
32            }
33        });
34
35        var base = jQuery('#gkExtraMenu');
36
37        base.find('.childcontent-inner').each(function(i, submenu) {
38            var cols = jQuery(submenu).children('.gkcol');
39            
40            if(cols.length > 1) {
41                var max = jQuery(cols[0]).outerHeight();
42                
43                for(i = 0; i < cols.length; i++) {
44                    max = jQuery(cols[i]).outerHeight() > max ? jQuery(cols[i]).outerHeight() : max;
45                }
46                
47                cols.css('height', max + "px");
48            }
49        });
50        
51        if($GKMenu && ($GKMenu.height || $GKMenu.width)) {    
52            base.find('li.haschild').each(function(i, el){   
53                el = jQuery(el);  
54                if(el.children('.childcontent').length > 0) {
55                    var content = el.children('.childcontent').first();
56                    var prevh = content.outerHeight();
57                    var prevw = content.outerWidth();
58                    var duration = $GKMenu.duration;
59                    var heightAnim = $GKMenu.height;
60                    var widthAnim = $GKMenu.width;
61                    
62                    // hide the menu till opened
63                    if(content.parent().parent().hasClass('level0')) {
64                        content.css('margin-left', "-999px");
65                    }
66    
67                    var fxStart = { 
68                        'height' : heightAnim ? 0 : prevh, 
69                        'width' : widthAnim ? 0 : prevw, 
70                        'opacity' : 0 
71                    };
72                    var fxEnd = { 
73                        'height' : prevh, 
74                        'width' : prevw, 
75                        'opacity' : 1 
76                    };  
77                    
78                    
79                    content.css(fxStart);
80                    content.css({'left' : 'auto', 'overflow' : 'hidden' });
81                    //                      
82                    el.mouseenter(function() {                    
83                        var content = el.children('.childcontent').first();
84                        var basicMargin = (el.parent().hasClass('level0')) ? -1 * ((prevw / 2) - (el.outerWidth() / 2)) : 0;
85                        content.css('display', 'block');
86                    
87                        var pos = content.offset();
88                        var winWidth = jQuery(window).outerWidth();
89                        var winScroll = jQuery(window).scrollLeft();
90                        
91                        // calculations
92                        var posStart = pos.left;
93                        var posEnd = pos.left + prevw;
94                        var diff;
95						
96						content.addClass('active');
97						
98                        if(el.parent().hasClass('level0')) {
99                            content.css('margin-left', basicMargin + "px");
100                            pos = content.offset();
101                            posStart = pos.left;
102                            posEnd = pos.left + prevw;
103                            
104                            if(posStart < 0) {
105                                content.css('margin-left', content.css('margin-left').toInt() + (-1 * posStart) + 10);
106                            }
107                            
108                            if(posEnd > winWidth + winScroll) {
109                                diff = (winWidth + winScroll) - posEnd;
110                                content.css('margin-left', content.css('margin-left').toInt() + diff - 24);
111                            }
112                        } else {
113                            diff = (winWidth + winScroll) - posEnd;
114                            
115                            if(posEnd > winWidth + winScroll) {
116                                content.css('margin-left', "-160px");
117                            }
118                        }
119                        //
120                        content.stop().animate(
121                            fxEnd, 
122                            {
123                                "duration": duration, 
124                                "queue": false,
125                                "complete": function() { 
126                                                if(content.outerHeight() === 0){ 
127                                                    content.css('overflow', 'hidden'); 
128                                                } else if(
129                                                    content.outerHeight(true) - prevh < 30 && 
130                                                    content.outerHeight(true) - prevh >= 0
131                                                ) {
132                                                    content.css('overflow', 'visible');
133                                                }
134                                            }
135                            }
136                        );
137                    });
138                el.mouseleave(function(){
139                
140                        content.css({
141                            'overflow': 'hidden'
142                        });
143                        //
144                        content.stop().animate(
145                            fxStart, 
146                            {
147                                "duration": duration, 
148                                "queue": false,
149                                "complete": function() { 
150                                                if(content.outerHeight() === 0){ 
151                                                    content.css('overflow', 'hidden'); 
152                                                } else if(
153                                                    content.outerHeight(true) - prevh < 30 && 
154                                                    content.outerHeight(true) - prevh >= 0
155                                                ) {
156                                                    content.css('overflow', 'visible');
157                                                }
158                                                content.removeClass('active');
159                                                content.css('display', 'none');
160                                            }
161                            }
162                        );
163                    });
164                }
165            });    
166        }
167    }
168    
169    // Aside menu
170    if(jQuery('#aside-menu').length > 0) {
171        var staticToggler = jQuery('#static-aside-menu-toggler');
172        
173        staticToggler.click(function() {
174            gkOpenAsideMenu();
175        });
176        
177        jQuery('#close-menu').click( function() {
178            jQuery('#close-menu').toggleClass('menu-open');
179            jQuery('#gkBg').toggleClass('menu-open');
180            jQuery('#aside-menu').toggleClass('menu-open'); /* HERE */
181        });
182
183        jQuery('#aside-menu').find('a[href^="#"]').click(function() {
184            jQuery('#close-menu').trigger('click');
185        });
186    }
187    // detect android browser
188    var ua = navigator.userAgent.toLowerCase();
189    var isAndroid = ua.indexOf("android") > -1 && !window.chrome;
190    
191    if(isAndroid) {
192        jQuery('body').addClass('android-stock-browser');
193    }
194    // Android stock browser fix for the aside menu
195    if(jQuery('body').hasClass('android-stock-browser') && jQuery('#aside-menu').length > 0) {
196        jQuery('#static-aside-menu-toggler').click( function() {
197            window.scrollTo(0, 0);
198        });
199        // menu dimensions
200        var asideMenu = jQuery('#aside-menu');
201        var menuHeight = jQuery('#aside-menu').height();
202        //
203        jQuery(window).scroll( function(e) {
204            if(asideMenu.hasClass('menu-open')) {
205                // get the necessary values and positions
206                var currentPosition = jQuery(window).scrollTop();
207                var windowHeight = jQuery(window).height();
208
209                // compare the values
210                if(currentPosition > menuHeight - windowHeight) {
211                    jQuery('#close-menu').trigger('click');
212                }
213            }
214        });
215    }
216    
217    function gkOpenAsideMenu() {
218        jQuery('#gkBg').toggleClass('menu-open');
219        jQuery('#aside-menu').toggleClass('menu-open');
220    
221        if(!jQuery('#close-menu').hasClass('menu-open')) {
222            setTimeout(function() {
223                jQuery('#close-menu').toggleClass('menu-open');
224            }, 300);
225        } else {
226            jQuery('#close-menu').removeClass('menu-open');
227        }
228    }
229}); 

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.