PageSourceSearch

https://plus.rmfclassic.pl/dist-v2021/scripts/p.plus.js?v=5

js rmfclassic.pl collected 2026-10-02 10:41:28 UTC 20,303 bytes, 499 lines download raw bytes

1
2
3var lib_plus = {
4    init: function() {
5        if (document.location.href.match('#')) {
6            sp = document.location.href.split('#')
7            if (sp.length > 0 && document.querySelector('*[name="'+sp[1]+'"]')) document.querySelector('*[name="'+sp[1]+'"]').scrollIntoView({block: "start", inline: "center"});
8        }
9
10
11        Array.from(document.querySelectorAll('form.active-on-focus')).map(function(f) { 
12            f.onclick = function() {
13                this.classList.add('form-activated');
14            }
15        });
16
17        Array.from(document.querySelectorAll('form.disable-on-submit')).map(function(f) { 
18            f.onsubmit = function() {
19                f.querySelector('[type="submit"]').setAttribute('disabled', 'disabled');
20                
21                if (f.getAttribute('class').match('activation-form') || f.getAttribute('class').match('order-form')) {
22                    lib_stat.event_register('Inne', 'RmfClassicPlus', 'BtnZamawiamPlace');
23                }
24            }
25        });
26
27        if (document.querySelector('input[name="gtag_client_id"]')) setInterval(lib_plus.get_gtag, 2000);
28
29
30        if (document.querySelector('form') && document.querySelector('.invalid-feedback')) {
31            document.querySelector('.invalid-feedback').scrollIntoView({block: "start", inline: "center"});
32        }
33
34    },
35    get_gtag: function() {
36        if (typeof gtag == 'function' && document.querySelector('input[name="gtag_client_id"]') && document.querySelector('input[name="gtag_client_id"]').value.length < 1) {
37            const client_id = lib_plus.get_client_id();
38            if (client_id != null) {
39                document.querySelector('input[name="gtag_client_id"]').value = client_id;
40            }
41        }
42    },
43    get_client_id: function() {
44        const cookies = document.cookie.split(';');
45        for (let i = 0; i < cookies.length; i++) {
46            const cookie = cookies[i].trim();
47            if (cookie.startsWith('_ga')) {
48                const parts = cookie.split('.');
49                if (parts.length === 4) {
50                    return parts[2] + '.' + parts[3];
51                }
52            }
53        }
54        return null;
55    }
56};
57
58var lib_secure_form = {
59    init: function() {
60        
61        if (
62            document.querySelector('#payu-card-field') == null || 
63            typeof _payu_pos_id == "undefined"
64        ) {
65            return;
66        }
67
68        var optionsForms = {
69            style: {
70                basic: {
71                    fontSize: '19px',
72                    fontFamily: 'Roboto,Arial',
73                    fontWeight: '400'
74                }
75            },
76    
77            lang: 'pl'
78        }
79    
80    
81        //inicjalizacja SDK poprzez podanie POS ID oraz utworzenie obiektu secureForms
82        var payuSdkForms = PayU(_payu_pos_id);
83        var secureForms = payuSdkForms.secureForms();
84        /*
85        var card = secureForms.add('card', optionsForms);
86        card.render('#payu-card-field');*/
87
88        //utworzenie formularzy podając ich typ oraz opcje
89        var cardNumber = secureForms.add('number', optionsForms);
90        var cardDate = secureForms.add('date', optionsForms);
91        var cardCvv = secureForms.add('cvv', optionsForms);
92
93        //renderowanie formularzy
94        cardNumber.render('#payu-card-number');
95        cardDate.render('#payu-card-date');
96        cardCvv.render('#payu-card-cvv');
97    
98        var tokenizeButton = document.getElementById('tokenizeButton');
99        var responseElement = document.getElementById('responseTokenize');
100    
101        tokenizeButton.addEventListener('click', function() {
102            try {
103                payuSdkForms.tokenize('MULTI').then(function(result) {
104                    if (result.status === 'SUCCESS') {
105                        lib_secure_form.tokenize_success(result.body);
106                    } else {
107                        lib_secure_form.tokenize_error(result.error.messages);
108                    }
109                });
110            } catch(e) {
111                console.log(e);
112            }
113        });
114    },
115    tokenize_error: function(errors) {
116        var messages = [];
117        errors.forEach(function(error) {
118            messages.push(error.message);
119        });
120
121        //document.querySelector('.payu-card-feedback').classList.add('invalid-feedback')
122        //document.querySelector('.payu-card-feedback').innerHTML = messages.join(', ');
123        lib_secure_form.print_feedback('invalid', messages.join(', '))
124    },
125    print_feedback: function(type, text) {
126        if (document.querySelector('.payu-card-feedback')) document.querySelector('.payu-card-feedback').innerHTML = '<span class="d-block '+type+'-feedback">'+text+'</span>';
127    },
128    tokenize_success: function(result) {
129
130        document.querySelector('input[name="card_token"]').value = result.token;
131        document.querySelector('input[name="card_mask"]').value = result.mask;
132
133        
134        var event = new Event('change');
135        document.querySelector('input[name="card_mask"]').dispatchEvent(event);
136
137        if ( tokenizeButton.closest('.payu-secure-form.auto-proceed') != null ) {
138            tokenizeButton.closest('form').submit();
139        } else {
140            tokenizeButton.classList.add('d-none');
141            card_number_format = lib_secure_form.card_number_format(result.mask);
142
143            document.querySelector('#payu-card-preview').innerHTML = `
144                <div class="bg-white mx-auto p-3 px-4 shadow-sm rounded d-inline-block">
145                    <div class="d-flex">
146                        <div class="pe-3">
147                            <img src="/dist-v2021/a/plus/options/c-other.png" class="rounded" width="60">
148                        </div>
149                        <div class="flex-fill d-flex text-center">
150                            <span class="fw-bold fs-5 align-self-center">${card_number_format}</span>
151                        </div>
152                    </div>
153                </div>
154                <div class="text-center pt-2">
155                    <a href="#" onclick="return lib_secure_form.change_card();" role="button" class="fw-normal text-muted"><small>Zmień kartę</small></a>
156                </div>
157
158            `;
159
160            lib_secure_form.print_feedback('valid', 'Karta została poprawnie zdefiniowana.')
161
162            document.querySelector('#payu-card-field').classList.add('d-none');
163            document.querySelector('#payu-card-preview').classList.remove('d-none');
164        }
165    },
166    change_card: function() {
167        tokenizeButton.classList.remove('d-none');
168        document.querySelector('#payu-card-preview').classList.add('d-none');
169        document.querySelector('#payu-card-field').classList.remove('d-none');
170
171        lib_secure_form.print_feedback('valid', '')
172
173        return false;
174    },
175    card_number_format: function(card_number) {
176        answer = '';
177        for (i = 0; i < card_number.length; i++) {
178            answer += card_number.substr(i,1);
179            if (i == 3 || i == 7 || i == 11) {
180                answer += ' ';
181            }
182        }
183
184        return answer;
185    }
186};
187
188
189var lAuthType = '';
190var auth_type_mode = 'login';
191
192
193
194var lib_auth_types = {
195    init: function() {
196
197        if (document.querySelectorAll('.options-container.auth-type-options input[type="radio"], input[name="auth_type_token"]').length > 0) {
198
199            if (document.location.href.match('logowanie')) {
200                auth_type_mode = 'login';
201            } else {
202                auth_type_mode = 'register';
203            }
204
205            var fbs = document.createElement('script');
206            fbs.async = !0;
207            fbs.type = "text/javascript";
208            fbs.src = 'https://connect.facebook.net/pl_PL/sdk.js';
209            var b = document.getElementsByTagName("script")[0]; b.parentNode.insertBefore(fbs, b);
210
211            // Facebook Init
212            window.fbAsyncInit = function() {
213                FB.init({
214                    appId      : '2826742800968272',
215                    cookie     : true,
216                    xfbml      : true,
217                    version    : 'v14.0'
218                });
219            }
220
221
222            var gs = document.createElement('script');
223            gs.async = !0;
224            gs.type = "text/javascript";
225            gs.src = 'https://accounts.google.com/gsi/client';
226            var b = document.getElementsByTagName("script")[0]; b.parentNode.insertBefore(gs, b);
227
228			window.onGoogleLibraryLoad = function () {
229                google.accounts.id.initialize({
230                    client_id: "1051581970318-i41cittamte911755dadehut7hb989fk.apps.googleusercontent.com",
231                    ux_mode: 'popup',
232                    callback: lib_auth_types.google_login_status
233                });
234                google.accounts.id.renderButton(
235                    document.getElementById("google-login-button"),
236                    { width: (auth_type_mode == 'login') ? 280 : 160, theme: "filled_black", shape: "rectangular", size: (auth_type_mode == 'login') ? 'large' : 'medium', text: (auth_type_mode == 'login') ? 'signin' : 'signup_with', logo_alignment: "left" }  // customization attributes
237                );
238            }
239
240            Array.from(document.querySelectorAll('.options-container.auth-type-options input[type="radio"]')).map(function(fi) {
241                fi.onclick = function() { lib_auth_types.change_auth_option(); }
242            });
243
244            if (document.querySelector('input[name="auth_type_token"]').value && document.querySelector('input[name="auth_type_token"]').value.length > 10) {
245                authType = lib_auth_types.get_auth_type();
246
247                if (authType != "email") {
248                    lib_auth_types.fetch_data(authType, document.querySelector('input[name="auth_type_token"]').value, lib_auth_types.fetch_data_result)
249                }
250            }
251        }
252    },
253
254    get_auth_type: function() {
255        return document.querySelector('input[name="auth_type"]').value;
256    },
257
258    change_auth_option: function(authType) {
259        if (typeof authType == "undefined" || authType == null) authType = lib_auth_types.get_auth_type();
260
261
262        if (lAuthType != authType) {
263            if (document.querySelector('input[name="auth_type"][type="hidden"]')) document.querySelector('input[name="auth_type"][type="hidden"]').value = authType;
264            document.querySelector('input[name="auth_type_token"]').value = '';
265            if (document.querySelector('#auth-type-error')) document.querySelector('#auth-type-error').style.display = 'none';
266
267            lib_auth_types.render_type_element(authType);
268            if (authType == 'facebook') lib_auth_types.facebook_login_status();
269
270
271            lAuthType = authType;
272        }
273    },
274    
275    render_type_element: function(authType, status) {
276        if (typeof authType == "undefined" || authType == null) authType = lib_auth_types.get_auth_type();
277
278        authTypeElement = '';
279
280        if (typeof status != "undefined") {
281            if (status.type == "error") {
282                authTypeElement += `<div class="text-danger d-block text-center"><small>${status.text}</small></div>`;
283            }
284        }
285
286        document.querySelector('#auth-type-options-details').innerHTML = authTypeElement;
287    },
288
289    facebook_login_status: function() {
290        FB.getLoginStatus(function(response) {
291            if (response.status === 'connected') {  
292                lib_auth_types.fetch_data('facebook', response.authResponse.accessToken, lib_auth_types.fetch_data_result)
293            } else {
294                FB.login(function(response){
295                    lib_auth_types.facebook_login_status(); 
296                });
297            }
298        });
299    },
300
301    google_login_status: function( response ) {
302        if (response && response.credential) {
303            lib_auth_types.fetch_data('google', response.credential, lib_auth_types.fetch_data_result)
304        }
305    },
306
307    fetch_data: function(service, token_value, callback) {
308        document.querySelector('#auth-type-options-details').innerHTML = '<div class=""><div class="text-muted text-help"><small>Pobieranie danych. Proszę czekać ...</small></div></div>';
309
310        var requestData = new FormData();
311        requestData.append("s", service);
312        requestData.append("tv", token_value);
313
314        response = fetch(
315            '/plus/at/',
316            {
317                method: 'post',
318                cache: 'no-cache',
319                headers: {
320                    'X-Requested-With': 'XMLHttpRequest'
321                },
322                redirect: 'follow',
323                body: requestData
324            }
325        )
326        .then(function(response) {
327            return response.json();
328        })
329        .then(function(data) {
330            if (data.data) {
331                if (callback != undefined) {
332                    callback('success', data.data);
333                }
334            } else {
335                callback('error', { error: 'Nie udało się potwierdzić tożsamości. Spróbuj ponownie.' });
336            }
337            return true;
338        })
339        .catch(function(error) {
340            if (callback != undefined) {
341                callback('error', { error: 'Wystąpił problem z połączeniem. Spróbuj ponownie.' });
342            }
343        });
344    },
345
346    fetch_data_result: function(status, result) {
347        
348        if (result.id) {
349            console.log(result.id)
350            if (result.email && result.email.length > 4) document.querySelector('input[name="email"]').value = result.email;
351
352            lib_auth_types.update_auth_token(result.tv);
353            document.querySelector('input[name="auth_type"]').value = result.t;
354
355            document.querySelector('#auth-type-options-details').innerHTML = `
356                <div class="">
357                    ${auth_type_mode == 'register' ? '<div class="text-muted text-help mb-1"><small>Logowanie do RMF Classic+ będzie możliwe z pomocą konta '+(result.t == 'facebook' ? 'Facebook' : 'Google')+':</small></div>' : ''}
358                    ${auth_type_mode == 'login' ? '<div class="text-muted text-help mb-1"><small>Proszę czekać ... Próba logowania za pomocą konta:</small></div>' : ''}
359                    <div class="mx-auto bg-silver  rounded p-3 px-4 d-inline-flex mt-2 align-self-center align-items-center" style="font-size: .9em;">
360                        <div class="position-relative me-3">
361                            <img src="${result.picture}" width="50" class="rounded ">
362                            <div class="sl-badge"><img src="/dist-v2021/a/plus/icon-sl-${result.t}.png"></div>
363                        </div>
364                        <div class="fw-bold">${result.name}</div>
365                        ${auth_type_mode == 'register' ? '<button type="button" class="btn btn-plus ms-4 fw-normal btn-disconnect" style="font-size: .9em;">Anuluj</button>' : ''}
366                    </div>
367                </div>
368            `;
369
370            if (bd = document.querySelector('#auth-type-options-details .btn-disconnect')) {
371                bd.onclick = lib_auth_types.disconnect;
372            }
373
374            // Logowanie
375            if (auth_type_mode == 'login') {
376                login_form = document.querySelector('#auth-type-options-details').closest('form');
377                login_form.setAttribute('action','/plus/logowanie-at/')
378                login_form.submit();
379            }
380        } else {
381            console.log('aaa')
382            lib_auth_types.render_type_element(null, { type: 'error', text: result.error });
383            lib_auth_types.update_auth_token('');
384        }
385    },
386    update_auth_token: function(tv) {
387        if (document.querySelector('input[name="auth_type_token"]').value != tv) {
388            document.querySelector('input[name="auth_type_token"]').value = tv;
389            if (document.querySelector('#auth-type-error')) document.querySelector('#auth-type-error').style.display = 'none';
390        }
391    },
392    disconnect: function() {
393        document.querySelector('input[name="auth_type"]').value = 'email';
394        document.querySelector('input[name="auth_type_token"]').value = '';
395        document.querySelector('#auth-type-options-details').innerHTML = '';
396        lib_auth_types.update_auth_token('');
397    }
398};
399
400var lib_mobile_bill = {
401    init: function() {
402        if (btn_mobile_bill_valid = document.querySelector('#btn-mobile-bill-valid')) {
403            btn_mobile_bill_valid.onclick = lib_mobile_bill.check_number;
404        }
405
406    },
407    check_number: function() {
408        document.querySelector('#mobile-check-state').innerHTML = '<span class="text-muted small">Sprawdzanie dostępności usługi.<br />Proszę czekać ...</span>';
409
410        var requestData = new FormData();
411        requestData.append("numer", document.querySelector('input[name="mobile_bill_phone"]').value);
412
413        response = fetch(
414            '/plus-dv/sprawdz-numer',
415            {
416                method: 'post',
417                cache: 'no-cache',
418                headers: {
419                    'X-Requested-With': 'XMLHttpRequest'
420                },
421                redirect: 'follow',
422                body: requestData
423            }
424        )
425        .then(function(response) {
426            
427            return response.json();
428        })
429        .then(function(data) {
430            if (data.status == 'AVAILABLE') {
431                document.querySelector('#mobile-bill-state-available').classList.remove('d-none');
432                document.querySelector('#mobile-bill-state-check').classList.add('d-none');
433                document.querySelector('#mobile-check-state').innerHTML = '';
434                document.querySelector('#mobile-bill-phone-number-printable').innerHTML = data.number_printable;
435            } else {
436                stateClass = '';
437                if (data.status == 'ERROR') stateClass = 'text-danger';
438                if (data.status == 'UNAVAILABLE') stateClass = 'alert alert-warning ';
439                document.querySelector('#mobile-check-state').innerHTML = '<div class="small '+stateClass+'">'+data.description+'</div>';
440            }
441
442            return true;
443        })
444        .catch(function(error) {
445            /*
446            if (callback != undefined) {
447                callback('error', { error: 'Wystąpił problem z połączeniem. Spróbuj ponownie.' });
448            }
449            */
450        });
451    },
452    change_number: function() {
453        document.querySelector('#mobile-bill-state-available').classList.add('d-none');
454        document.querySelector('#mobile-bill-state-check').classList.remove('d-none');
455    }
456};
457
458
459(function() {
460    lib_plus.init();
461    lib_secure_form.init();
462    lib_auth_types.init();
463    //lib_mobile_bill.init();
464})();
465
466
467
468(function() {
469    Array.from(document.querySelectorAll('.option-item input[type="radio"]')).map(function(f) {
470        f.onchange = function() {
471            Array.from(this.closest('.options-container').querySelectorAll('.option-selected')).map(function(fi) {
472                fi.classList.remove('option-selected')
473            })
474
475            if (this.checked) {
476                this.closest('.option-item').classList.add('option-selected');
477            }
478        }
479
480        if (f.checked) {
481            f.closest('.option-item').classList.add('option-selected');
482        }
483    });
484
485    Array.from(document.querySelectorAll('.plus-row.clickable')).map(function(f) {
486        f.onclick = function() {
487            this.classList.add('opened')
488        }
489    });
490
491
492    Array.from(document.querySelectorAll('.confirm-form')).map(function(f) {
493        f.onsubmit = function() {
494            return confirm(f.hasAttribute('data-confirm') ? f.getAttribute('data-confirm') : 'Czy potwierdzasz chęć wykonania operacji?')
495        }
496    });
497
498})();
499

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.