PageSourceSearch

https://cpcchatt.org/_assets/js/app/dropdown.js

js cpcchatt.org collected 2026-10-04 21:16:30 UTC 1,493 bytes, 61 lines download raw bytes

1/**
2 * dropdowns.js - Search
3 *
4 * @author - Kenny Kaye <[email protected]>
5 *
6 */
7function dropdownInit(args) {
8
9    //default arguments
10    var defaults = {
11        close: null,
12        trigger: null,
13        dropdown: null,
14        onOpen: function () {
15        },
16        onClose: function () {
17        }
18    };
19    //extend default to options
20    var options = $.extend(defaults, args);
21
22    // Register events
23    if (options.trigger) {
24        options.trigger.click(function (event) {
25
26            event.preventDefault();
27
28            // Toggle Dropdown Class
29            options.dropdown.toggleClass('active');
30
31            // Callbacks
32            // If dropdown opened
33            if (options.dropdown.hasClass('active')) {
34                if (options.onOpen && typeof(options.onOpen) === "function") {
35                    options.onOpen();
36                }
37            }
38            // If dropdown is closed
39            else {
40                if (options.onClose && typeof(options.onClose) === "function") {
41                    options.onClose();
42                }
43            }
44        });
45    }
46
47    if (options.close) {
48        options.close.click(function (event) {
49
50            event.preventDefault();
51
52            // Close Dropdown
53            options.dropdown.removeClass('active');
54
55            // If dropdown is closed
56            if (options.onClose && typeof(options.onClose) === "function") {
57                options.onClose();
58            }
59        });
60    }
61}

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.