PageSourceSearch

https://yummypos.io/js/admin/helpers.js?20

js yummypos.io collected 2026-10-02 00:37:19 UTC 7,877 bytes, 231 lines download raw bytes

1window.slideUp = (target, duration=500) => {
2    target.style.transitionProperty = 'height, margin, padding';
3    target.style.transitionDuration = duration + 'ms';
4    target.style.boxSizing = 'border-box';
5    target.style.height = target.offsetHeight + 'px';
6    target.offsetHeight;
7    target.style.overflow = 'hidden';
8    target.style.height = 0;
9    target.style.paddingTop = 0;
10    target.style.paddingBottom = 0;
11    target.style.marginTop = 0;
12    target.style.marginBottom = 0;
13    window.setTimeout( () => {
14          target.style.display = 'none';
15          target.style.removeProperty('height');
16          target.style.removeProperty('padding-top');
17          target.style.removeProperty('padding-bottom');
18          target.style.removeProperty('margin-top');
19          target.style.removeProperty('margin-bottom');
20          target.style.removeProperty('overflow');
21          target.style.removeProperty('transition-duration');
22          target.style.removeProperty('transition-property');
23          //alert("!");
24    }, duration);
25}
26
27/* SLIDE DOWN */
28window.slideDown = (target, duration=500) => {
29    target.style.removeProperty('display');
30    let display = window.getComputedStyle(target).display;
31    if (display === 'none') display = 'block';
32    target.style.display = display;
33    let height = target.offsetHeight;
34    target.style.overflow = 'hidden';
35    target.style.height = 0;
36    target.style.paddingTop = 0;
37    target.style.paddingBottom = 0;
38    target.style.marginTop = 0;
39    target.style.marginBottom = 0;
40    target.offsetHeight;
41    target.style.boxSizing = 'border-box';
42    target.style.transitionProperty = "height, margin, padding";
43    target.style.transitionDuration = duration + 'ms';
44    target.style.height = height + 'px';
45    target.style.removeProperty('padding-top');
46    target.style.removeProperty('padding-bottom');
47    target.style.removeProperty('margin-top');
48    target.style.removeProperty('margin-bottom');
49    window.setTimeout( () => {
50      target.style.removeProperty('height');
51      target.style.removeProperty('overflow');
52      target.style.removeProperty('transition-duration');
53      target.style.removeProperty('transition-property');
54    }, duration);
55}
56
57/* TOOGLE */
58window.slideToggle = (target, duration = 500) => {
59    if (window.getComputedStyle(target).display === 'none') {
60      return slideDown(target, duration);
61    } else {
62      return slideUp(target, duration);
63    }
64}
65
66// clicker ======================
67/*
68let Widget_filter = toggleClicker(
69    "[data-widget-open]", // Кликабельный элемент
70    "active", // Название класса для active
71    "[data-widget]", // Родитель кликабельного элемента
72    true, // Клик вне элемента true | false
73    (element, event) => {
74
75    }
76);
77*/
78window.toggleClicker = (el_togglers, class_active, parent, outside_bool, fn, closed = true) => {
79    var el_toggle = document.querySelectorAll(el_togglers);
80
81    if(el_toggle.length > 0){
82
83        for(let i = 0; i < el_toggle.length; i++){
84            var target_el;
85
86            el_toggle[i].addEventListener
87            ("click", function(ev){
88
89                ev.preventDefault();
90                var parent_el = el_toggle[i].closest(parent);
91
92                function template_code(elem2, elem3, fn){
93                    target_el = elem2;
94                    if(target_el === elem2 && elem2.classList.contains(class_active)){
95                        target_el.classList.remove(class_active);
96                    }else{
97                        if(closed === true){
98                            document.querySelectorAll(elem3).forEach(element => {
99                                element.classList.remove(class_active);
100                            })
101                        }
102                        /*
103                        document.querySelectorAll(elem3).forEach(element => {
104                            element.classList.remove(class_active);
105                        })*/
106                        target_el.classList.add(class_active);
107                    }
108
109                    if(fn) fn(target_el, ev);
110
111                }
112
113                if(parent){
114                    template_code(parent_el, parent, fn);
115                }else{
116                    template_code(el_toggle[i], el_togglers, fn);
117
118                }
119
120            })
121        }
122    }
123
124    function bool_outside(){
125        if(outside_bool === true){
126            document.addEventListener('click', function(e) {
127                const targer = e.target
128                if(parent && !targer.closest(parent)){
129                   let parents = document.querySelectorAll(parent);
130                    for(item of parents) {
131                        item.classList.remove(class_active);
132                    }
133                }else{
134                    if(!targer.closest(el_togglers)){
135                        let targets = document.querySelectorAll(el_togglers);
136                        for(item of targets) {
137                            item.classList.remove(class_active);
138                        }
139                    }
140                }
141
142            })
143        }else{
144            return false;
145        }
146
147    }
148    bool_outside();
149}
150
151const generateRandomString = (length) => {
152    let result = '';
153    const characters =
154        // 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
155        'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
156    const charactersLength = characters.length;
157    for (let i = 0; i < length; i++) {
158        result += characters.charAt(Math.floor(Math.random() * charactersLength));
159    }
160    return result;
161};
162
163var $ = jQuery.noConflict();
164
165$(document).ready(function () {
166    initPopup()
167});
168
169function initPopup() {
170    $(document).on('click', '.modal__content', function(e) {
171        e.stopPropagation();
172    });
173
174    // Use event delegation to handle both existing and dynamically loaded elements
175    var currentTarget = null;
176    
177    $(document).on('click', '[data-modal]', function(e) {
178        e.preventDefault();
179        
180        // Close previous modal if open
181        if(currentTarget !== null){
182            currentTarget.classList.remove("modal--show");
183            $('body').removeClass('lock');
184        }
185
186        // Open new modal
187        var modalSelector = $(this).attr("data-modal");
188        currentTarget = document.querySelector('.modal' + modalSelector);
189        
190        if(currentTarget){
191            currentTarget.classList.add("modal--show");
192            $('body').addClass('lock');
193        }
194    });
195
196    $(document).on('click', '[data-close-modal], .modal', function(e) {
197        e.preventDefault();
198        $('.modal').removeClass('modal--show');
199        $('body').removeClass('lock');
200    });
201}
202
203/**
204 * Pyta, na jak długo obsługa wyłącza danie albo składnik.
205 *
206 * Klient chciał wyboru przy każdym wyłączeniu, bo powody są dwa: „skończyła się rukola" mija
207 * razem z dniem, a „nie robimy już tej pizzy" nie mija wcale. Wcześniej istniał tylko ten drugi
208 * tryb i to on doprowadził do sytuacji, w której na Piltzy „Rukola" wisiała 42 dni.
209 *
210 * Zwraca 'end_of_day', 'indefinite' albo null, gdy ktoś się rozmyślił.
211 */
212async function askBlockScope(nazwa) {
213    const wynik = await swal.fire({
214        title: nazwa ? `Wyłączasz: ${nazwa}` : 'Wyłączasz pozycję',
215        text: 'Na jak długo? Do końca dnia wróci sama o północy.',
216        icon: 'question',
217        showDenyButton: true,
218        showCancelButton: true,
219        confirmButtonText: 'Do końca dnia',
220        denyButtonText: 'Do odwołania',
221        cancelButtonText: 'Anuluj',
222        confirmButtonColor: '#E2487A',
223        denyButtonColor: '#5b6670',
224        reverseButtons: true,
225    });
226
227    if (wynik.isConfirmed) return 'end_of_day';
228    if (wynik.isDenied) return 'indefinite';
229
230    return null;
231}

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.