PageSourceSearch

https://www.gimp.org/js/push-menu.js

js gimp.org collected 2026-09-24 06:39:40 UTC 3,275 bytes, 111 lines download raw bytes

1/**
2 *
3 * @source: http://www.gimp.org/js/push-menu.js
4 *
5 * @licstart  The following is the entire license notice for the 
6 *  JavaScript code in this page.
7 *
8 * Copyright (C) 2016 Pat David
9 *
10 *
11 * The JavaScript code in this page is free software: you can
12 * redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GNU GPL) as published by the Free Software
14 * Foundation, either version 3 of the License, or (at your option)
15 * any later version.  The code is distributed WITHOUT ANY WARRANTY;
16 * without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
18 *
19 * As additional permission under GNU GPL version 3 section 7, you
20 * may distribute non-source (e.g., minimized or compacted) forms of
21 * that code without the copy of the GNU GPL normally required by
22 * section 4, provided you include this license notice and a URL
23 * through which recipients can access the Corresponding Source.
24 *
25 * @licend  The above is the entire license notice
26 * for the JavaScript code in this page.
27 *
28 */
29
30/*
31 * If you thought my Python was bad
32 * wait until you get a load of my js
33 */
34
35var navel = document.getElementById('navel');
36var page = document.getElementById('pushPage');
37var menu = document.getElementById('menu');
38
39menu.style.visibility = 'visible';
40
41var toggle = function(e){
42    e.preventDefault();
43
44    var page = document.getElementById('pushPage');
45    var menu = document.getElementById('menu');
46
47    if( menu.className.indexOf('show') !== -1 ){
48        menu.className = "hide";
49        // navel.className = "initial";
50        page.removeEventListener('click', toggle, false);
51        page.removeEventListener('touchstart', toggle, false);
52    }else{
53        menu.className = "show";
54        // navel.className = "bottom";
55        page.addEventListener('click', toggle, false);
56        page.addEventListener('touchstart', toggle, false);
57    }
58}
59
60navel.addEventListener("touchstart", toggle, false);
61navel.addEventListener("click", toggle, false);
62
63
64/* Scroll detection for showing/hiding navigation strip
65 * on mobile
66 */
67
68var didScroll = false;
69var navbar = document.getElementById('navstrip');
70var navHeight = navbar.offsetHeight;
71var delta = 10;
72var lastScrollTop = 0;
73
74window.onscroll = doScroll;
75
76function doScroll(){
77    /*
78    if( window.innerWidth >= 1024 ){
79    }else{
80        didScroll = true;
81    }
82    */
83    if( window.innerWidth < 1024) didScroll = true;
84}
85
86setInterval( function() {
87    if( didScroll ) {
88        didScroll = false;
89        var st = window.pageYOffset;
90
91        if(Math.abs(lastScrollTop - st) <= delta)
92            return;
93
94        //console.log( st );
95
96        // If scroll past navbar, add class .nav-up
97        if ( st > lastScrollTop && st > 30){
98            //scroll down
99            navbar.className = navbar.className.replace('nav-down','nav-up');
100			//b.backgroundPositionY = parseInt( b.backgroundPositionY ) + 4 + '%';
101        }else{
102            //scroll up?
103            navbar.className = navbar.className.replace('nav-up','nav-down');
104			//b.backgroundPositionY = parseInt( b.backgroundPositionY ) - 4 + '%';
105        }
106        lastScrollTop = st;
107    }
108}, 250);
109
110menu.style.display = 'block';
111menu.style.zIndex = '1';

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.