PageSourceSearch

https://floram.org/javascripts/scrollActions.js?v=1790944464

js floram.org collected 2026-10-02 12:34:40 UTC 11,785 bytes, 314 lines download raw bytes

1// Hide Header on on scroll down
2$(document).ready(function() {
3     var ec = new EcMobileFlow({});
4});
5
6function EcMobileFlow (options) {
7    this.options = {
8        breakpoint: options.breakpoint || 640,
9        animationTime: options.animationTime || 300
10    };
11
12    if($(window).width() <= this.options.breakpoint){
13        this.core();
14    }
15}
16
17EcMobileFlow.prototype = {
18    constructor: EcMobileFlow,
19
20    mobileScrollingMenu:function(){
21            var didScroll;
22            var lastScrollTop = 0;
23            var delta = 5; //pixels to scroll before hide/show the menu
24            var navbarHeight = $('#mobile-top-bar').outerHeight();
25
26            $(window).scroll(function(event){
27                didScroll = true;
28            });
29
30            setInterval(function() {
31                if (didScroll) {
32                    hasScrolled();
33                    didScroll = false;
34                }
35            }, 250);
36
37            function hasScrolled() {
38                //if any mobile menu is opened dont do anything
39                if($('*').hasClass('ec-expanded')){
40
41                //otherwise hide/show menus when scrolling the page
42                }else{
43                    var st = $(this).scrollTop()-2;
44                    // Make sure they scroll more than delta
45                    if(Math.abs(lastScrollTop - st) <= delta)
46                        return;
47
48                    if (st > lastScrollTop && st > navbarHeight){
49                        // Scroll Down
50                        //enable buttons
51                        $('#mobile-menu-button').prop("disabled",true);
52                        $('#mobile-share-button').prop("disabled",true);
53                        $('#mobile-download-button').prop("disabled",true);
54                        $('#mobile-page-button').prop("disabled",true);
55
56                        //show-hide events
57                        $('#mobile-menu-button').removeClass('show-top');
58                        $('#mobile-top-bar').removeClass('show-top');
59                        $('#bigScreen-go-top').removeClass('show-right');
60                        $('#faqPage-button').removeClass('show-right');
61
62                        $('#mobile-bottom-bar').removeClass('show-bottom');
63                        $('*').removeClass('ec-expanded');
64
65                    } else {
66                        // Scroll Up
67                        //disable buttons
68                        $('#mobile-menu-button').prop("disabled",false);
69                        $('#mobile-share-button').prop("disabled",false);
70                        $('#mobile-download-button').prop("disabled",false);
71                        $('#mobile-page-button').prop("disabled",false);
72
73                            if($('body').scrollTop() <= 40){
74                                $('#mobile-go-top').fadeOut();
75                            }
76                            else{
77                                $('#mobile-go-top').fadeIn();
78                            }
79                            //console.log('scrolling Up');
80                            $('#mobile-menu-button').addClass('show-top');
81                            $('#bigScreen-go-top').addClass('show-right');
82                            $('#faqPage-button').addClass('show-right');
83
84                            $('#mobile-top-bar').addClass('show-top');
85                            $('#mobile-bottom-bar').addClass('show-bottom');
86
87                    }
88
89                    lastScrollTop = st;
90                }
91            }
92    },
93
94    contentNavigationLinks: function(){
95        var summaryCount = 0;
96
97        $("#journal-main-area h1, #journal-main-area h2").each(function(i) {
98            var attr = $(this).attr('data-ec-summary');
99
100            $(this).attr('id', 'nav'+i);
101
102            if($(this).hasClass('summary-ignore') || $(this).text().length == 0){
103
104            }else{
105                if (typeof attr !== 'undefined' && attr !== false) {
106                    if ( $(this).is( "h1" ) ) {
107                        $('#mobile-page-area ul').append('<li class="heading1"><a href="#'+$(this).attr('id')+'">'+$(this).attr('data-ec-summary')+'</a></li>');
108                    }else{
109                        $('#mobile-page-area ul').append('<li class="heading2"><a href="#'+$(this).attr('id')+'">'+$(this).attr('data-ec-summary')+'</a></li>');
110                    }
111                }else{
112                    if ( $(this).is( "h1" ) ) {
113                        $('#mobile-page-area  ul').append('<li class="heading1"><a href="#nav'+i+'">'+$(this).text()+'</a></li>');
114                    }else{
115                        $('#mobile-page-area  ul').append('<li class="heading2"><a href="#nav'+i+'">'+$(this).text()+'</a></li>');
116                    }
117                }
118
119                summaryCount++;
120            }
121        });
122    },
123
124    scrollToTarget:function(){
125        var animationTime = this.options.animationTime;
126        $('a[href^="#"]').on('click',function (e) {
127            if($('#faqSidebar').hasClass('faq-expanded')){
128
129
130            }else{
131                e.preventDefault();
132                var target = this.hash,
133                $target = $(target);
134                if((target !== '') && (target !== undefined)){
135                    $('*').removeClass('ec-expanded');
136                    $('html, body').stop().animate({
137                        'scrollTop': $target.offset().top-$('#mobile-top-bar').outerHeight()
138                    }, animationTime, 'swing', function () {
139                        window.location.hash = target;
140                    });
141                }else{
142                    $('html, body').stop().animate({
143                        'scrollTop': $('body').offset().top-$('#mobile-top-bar').outerHeight()
144                    }, animationTime, 'swing');
145                }
146            }
147
148
149        });
150    },
151
152    goToTop:function(){
153        var animationTime = this.options.animationTime;
154        $('#mobile-go-top').click(function(){
155            $("html, body").animate({ scrollTop: 0 }, animationTime);
156            return false;
157        })
158    },
159
160    core:function(){
161        if($('body').scrollTop() <= 40){
162            $('#mobile-go-top').hide();
163        }
164        else{
165            $('#mobile-go-top').show();
166        }
167        $('#mobile-menu-area').height($(window).height()+50);
168        $('#mobile-page-area .ecMobile_actions').css('max-height',$(window).height()/2);
169        $('#mobile-share-area .ecMobile_actions').css('max-height',$(window).height()/2);
170        //enable buttons
171        $('#mobile-menu-button').prop("disabled",false);
172        $('#mobile-share-button').prop("disabled",false);
173        $('#mobile-download-button').prop("disabled",false);
174        $('#mobile-page-button').prop("disabled",false);
175
176
177        //alert($(window).height());
178
179        function disableButtons(){
180            $('#mobile-menu-button').prop("disabled",true);
181            $('#mobile-share-button').prop("disabled",true);
182            $('#mobile-download-button').prop("disabled",true);
183            $('#mobile-page-button').prop("disabled",true);
184        }
185
186        function enableButtons(){
187            $('#mobile-menu-button').prop("disabled",false);
188            $('#mobile-share-button').prop("disabled",false);
189            $('#mobile-download-button').prop("disabled",false);
190            $('#mobile-page-button').prop("disabled",false);
191        }
192
193
194        $('#mobile-bottom-bar button').click(function(){
195            $('*').removeClass('ec-active');
196            $(this).addClass('ec-active')
197            var id = $(this).attr('data-target');
198
199            if($(id).hasClass('ec-expanded') == true){
200                $('*').removeClass('ec-expanded');
201            }else{
202                $('*').removeClass('ec-expanded');
203                $(id).addClass('ec-expanded');
204            }
205        });
206
207        $('#mobile-menu-button').click(function(){
208            if($('#mobile-menu-area').hasClass('ec-expanded') == true){
209                $('*').removeClass('ec-active');
210                $('*').removeClass('ec-expanded');
211                $('#mobile-bottom-bar').addClass('show-bottom');
212            }else{
213                $('*').removeClass('ec-expanded');
214                $('*').removeClass('ec-active');
215                $('#mobile-bottom-bar').removeClass('show-bottom');
216                $('#mobile-menu-area').addClass('ec-expanded');
217            }
218        });
219
220        $('#site-content').click(function(){
221            if($('body').scrollTop() <= 40){
222                $('*').removeClass('ec-active');
223                $('*').removeClass('ec-expanded');
224                $('#mobile-bottom-bar').addClass('show-bottom');
225            }else{
226                //disable buttons
227                $('#mobile-menu-button').prop("disabled",true);
228                $('#mobile-share-button').prop("disabled",true);
229                $('#mobile-download-button').prop("disabled",true);
230                $('#mobile-page-button').prop("disabled",true);
231
232                //show-hide events
233                $('#mobile-top-bar').removeClass('show-top');
234                $('#mobile-menu-button').removeClass('show-top');
235                $('#mobile-bottom-bar').removeClass('show-bottom');
236                $('*').removeClass('ec-active');
237                $('*').removeClass('ec-expanded');
238            }
239        })
240
241        $('#journals-list').click(function(){
242            if($('body').scrollTop() <= 40){
243                $('*').removeClass('ec-active');
244                $('*').removeClass('ec-expanded');
245                $('#mobile-bottom-bar').addClass('show-bottom');
246            }else{
247                //disable buttons
248                $('#mobile-menu-button').prop("disabled",true);
249                $('#mobile-share-button').prop("disabled",true);
250                $('#mobile-download-button').prop("disabled",true);
251                $('#mobile-page-button').prop("disabled",true);
252
253                //show-hide events
254                $('#mobile-top-bar').removeClass('show-top');
255                $('#mobile-menu-button').removeClass('show-top');
256                $('#mobile-bottom-bar').removeClass('show-bottom');
257                $('*').removeClass('ec-active');
258                $('*').removeClass('ec-expanded');
259            }
260        })
261
262
263
264        $('#searchFormFooter #q').focus(function(){
265            setTimeout(function(){
266                //enable buttons
267                $('#mobile-menu-button').prop("disabled",false);
268                $('#mobile-share-button').prop("disabled",false);
269                $('#mobile-download-button').prop("disabled",false);
270                $('#mobile-page-button').prop("disabled",false);
271
272                //show-hide-actions
273                $('#mobile-top-bar').addClass('show-top');
274                $('#mobile-menu-button').addClass('show-top');
275                $('#mobile-bottom-bar').addClass('show-bottom');
276            }, 1000);
277        })
278
279         this.goToTop();
280         this.mobileScrollingMenu();
281         this.contentNavigationLinks();
282         this.scrollToTarget();
283
284
285    }
286
287}
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303/* jQuery Mobile: Swipe function (need to add jquery mobile js and css to index)
304¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨*/
305/*$(document).on('pageinit', function(event){
306    $.event.special.swipe.scrollSupressionThreshold = 10; // More than this horizontal displacement, and we will suppress scrolling.
307    $.event.special.swipe.horizontalDistanceThreshold = 10; // Swipe horizontal displacement must be more than this.
308    $.event.special.swipe.durationThreshold = 500;  // More time than this, and it isn't a swipe.
309    $.event.special.swipe.verticalDistanceThreshold = 75;
310
311    $("#mobile-top-bar").on("swipeleft",function(){
312        $("#mobile-top-bar").toggleClass('ec-expanded');
313    });
314});*/

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.