PageSourceSearch

https://stjohnsfoodshare.org/wp-content/themes/crio/inc/boldgrid-t…/assets/js/goup/jquery.goup.js?ver=2.17.3

js stjohnsfoodshare.org collected 2026-10-01 16:20:30 UTC 8,325 bytes, 264 lines download raw bytes

1/*
2 *
3 * Copyright (c) 2014-2017 Daniele Lenares (https://github.com/dnlnrs)
4 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
5 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
6 *
7 * Version 1.1.3
8 *
9 */
10(function ($) {
11
12    'use strict';
13
14    /**
15     * Animate the input object
16     *
17     * @param $obj
18     * @param type
19     * @param animation
20     */
21    function do_animation($obj, type, animation) {
22        if (type === 'show') {
23            switch (animation) {
24                case 'fade':
25                    $obj.fadeIn();
26                    break;
27
28                case 'slide':
29                    $obj.slideDown();
30                    break;
31
32                default:
33                    $obj.fadeIn();
34            }
35        } else {
36            switch (animation) {
37                case 'fade':
38                    $obj.fadeOut();
39                    break;
40
41                case 'slide':
42                    $obj.slideUp();
43                    break;
44
45                default:
46                    $obj.fadeOut();
47            }
48        }
49    }
50
51    /**
52     * Bind click event
53     *
54     * @param $obj
55     * @param speed
56     */
57    function click_event($obj, speed) {
58        var not_clicked = true;
59        $obj.on('click', function () {
60            if (not_clicked === true) {
61                not_clicked = false;
62                $('html, body').animate({scrollTop: 0}, speed, function () {
63                    not_clicked = true;
64                });
65            }
66        });
67    }
68
69
70    $.goup = function (user_params) {
71
72        /* Default Params */
73        var params = $.extend({
74            location: 'right',
75            locationOffset: 20,
76            bottomOffset: 10,
77            containerSize: 40,
78            containerRadius: 10,
79            containerClass: 'goup-container',
80            arrowClass: 'goup-arrow',
81            alwaysVisible: false,
82            trigger: 500,
83            entryAnimation: 'fade',
84            goupSpeed: 'slow',
85            hideUnderWidth: 500,
86            containerColor: '#000',
87            arrowColor: '#fff',
88            title: '',
89            titleAsText: false,
90            titleAsTextClass: 'goup-text',
91            zIndex: 1
92        }, user_params);
93        /* */
94
95        /* Parameters check */
96        if (params.location !== 'right' && params.location !== 'left') {
97            params.location = 'right';
98        }
99
100        if (params.locationOffset < 0) {
101            params.locationOffset = 0;
102        }
103
104        if (params.bottomOffset < 0) {
105            params.bottomOffset = 0;
106        }
107
108        if (params.containerSize < 20) {
109            params.containerSize = 20;
110        }
111
112        if (params.containerRadius < 0) {
113            params.containerRadius = 0;
114        }
115
116        if (params.trigger < 0) {
117            params.trigger = 0;
118        }
119
120        if (params.hideUnderWidth < 0) {
121            params.hideUnderWidth = 0;
122        }
123
124        var checkColor = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;
125        if (!checkColor.test(params.containerColor)) {
126            params.containerColor = '#000';
127        }
128        if (!checkColor.test(params.arrowColor)) {
129            params.arrowColor = '#fff';
130        }
131
132        if (params.title === '') {
133            params.titleAsText = false;
134        }
135
136        if (isNaN(params.zIndex)) {
137            params.zIndex = 1;
138        }
139        /* */
140
141        /* Create required elements */
142        var $body = $('body');
143        var $window = $(window);
144
145        var $container = $('<div>');
146        $container.addClass(params.containerClass);
147        var $arrow = $('<div>');
148        $arrow.addClass(params.arrowClass);
149
150        $container.html($arrow);
151
152        $body.append($container);
153
154
155        /* Container Style */
156        var containerStyle = {
157            position: 'fixed',
158            width: params.containerSize,
159            height: params.containerSize,
160            background: params.containerColor,
161            cursor: 'pointer',
162            display: 'none',
163            'z-index': params.zIndex
164        };
165        containerStyle['bottom'] = params.bottomOffset;
166        containerStyle[params.location] = params.locationOffset;
167        containerStyle['border-radius'] = params.containerRadius;
168
169        $container.css(containerStyle);
170
171        if (!params.titleAsText) {
172            $container.attr('title', params.title);
173        } else {
174            var $textContainer = $('<div>');
175            $body.append($textContainer);
176            $textContainer.addClass(params.titleAsTextClass).text(params.title);
177            $textContainer.attr('style', $container.attr('style'));
178            $textContainer.css('background', 'transparent')
179                .css('width', params.containerSize + 40)
180                .css('height', 'auto')
181                .css('text-align', 'center')
182                .css(params.location, params.locationOffset - 20);
183            var textContainerHeight = parseInt($textContainer.height()) + 10;
184            var containerBottom = parseInt($container.css('bottom'));
185            var containerNewBottom = textContainerHeight + containerBottom;
186            $container.css('bottom', containerNewBottom);
187        }
188
189
190        /* Arrow Style */
191        var borderSize = 0.25 * params.containerSize;
192        var arrowStyle = {
193            width: 0,
194            height: 0,
195            margin: '0 auto',
196            'padding-top': Math.ceil(0.325 * params.containerSize),
197            'border-style': 'solid',
198            'border-width': '0 ' + borderSize + 'px ' + borderSize + 'px ' + borderSize + 'px',
199            'border-color': 'transparent transparent ' + params.arrowColor + ' transparent'
200        };
201        $arrow.css(arrowStyle);
202        /* */
203
204
205        /* params.trigger Hide under a certain width */
206        var isHidden = false;
207        $window.resize(function () {
208            if ($window.outerWidth() <= params.hideUnderWidth) {
209                isHidden = true;
210                do_animation($container, 'hide', params.entryAnimation);
211                if (typeof($textContainer) !== 'undefined') {
212                    do_animation($textContainer, 'hide', params.entryAnimation);
213                }
214            } else {
215                isHidden = false;
216                $window.trigger('scroll');
217            }
218        });
219        /* If i load the page under a certain width, i don't have the event 'resize' */
220        if ($window.outerWidth() <= params.hideUnderWidth) {
221            isHidden = true;
222            $container.hide();
223            if (typeof($textContainer) !== 'undefined')
224                $textContainer.hide();
225        }
226
227
228        /* params.trigger show event */
229        if (!params.alwaysVisible) {
230            $window.scroll(function () {
231                if ($window.scrollTop() >= params.trigger && !isHidden) {
232                    do_animation($container, 'show', params.entryAnimation);
233                    if (typeof($textContainer) !== 'undefined') {
234                        do_animation($textContainer, 'show', params.entryAnimation);
235                    }
236                }
237
238                if ($window.scrollTop() < params.trigger && !isHidden) {
239                    do_animation($container, 'hide', params.entryAnimation);
240                    if (typeof($textContainer) !== 'undefined') {
241                        do_animation($textContainer, 'hide', params.entryAnimation);
242                    }
243                }
244            });
245        } else {
246            do_animation($container, 'show', params.entryAnimation);
247            if (typeof($textContainer) !== 'undefined') {
248                do_animation($textContainer, 'show', params.entryAnimation);
249            }
250        }
251        /* If i load the page and the scroll is over the trigger, i don't have immediately the event 'scroll' */
252        if ($window.scrollTop() >
252= params.trigger && !isHidden) {
253            do_animation($container, 'show', params.entryAnimation);
254            if (typeof($textContainer) !== 'undefined') {
255                do_animation($textContainer, 'show', params.entryAnimation);
256            }
257        }
258
259        click_event($container, params.goupSpeed);
260        if (typeof($textContainer) !== 'undefined') {
261            click_event($textContainer, params.goupSpeed);
262        }
263    };
264}(jQuery));

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.