PageSourceSearch

https://dorzeczy.pl/_js/questioning.js?q=

js dorzeczy.pl collected 2026-10-01 10:29:38 UTC 19,169 bytes, 401 lines download raw bytes

1var assignedPageQuestioningsEvents = false;
2       
3if ($('body').data('js') != 'bottom') 
4{ 
5    $(document).ready(function() {     
6        initPageQuestionings();                             
7    }); 
8} 
9else        
10    initPageQuestionings(); 
11    
12function initPageQuestionings()    
13{       
14    var wW = $(window).width();  
15                        
16    if ($('.questioning').length > 0)
17    {        
18        $('.questioning').each(function(){ 
19            var iq = $(this).data('idq');
20            if (!$(this).hasClass('assigned'))
21            {
22                if (iq > 0)
23                {                
24                    var qo = this,
25                        ql = false,
26                        px = new Image,                  
27                        vc = 0 + ($.trim($(qo).data('vc'))),
28                        cv = 0 + ($.trim($(qo).data('vote')));                            
29                    if ((cv == 1) && (typeof(Storage) !== 'undefined'))  
30                    {
31                     //   if (parseInt(localStorage.getItem('questioning-'+iq)) > 0)  
32                     //       cv = 0;  
33                    }    
34                    // cv = 1                    
35                    // $(qo).data('vote', cv).attr('data-vote', cv);     
36                        
37                    if (! (($(qo).hasClass('box-questioning-color-none')) 
38                          || ($(qo).hasClass('box-questioning-color-white')) 
39                          || ($(qo).hasClass('box-questioning-color-light')) 
40                          || ($(qo).hasClass('box-questioning-color-silver')) 
41                          || ($(qo).hasClass('box-questioning-color-yellow'))
42                        ))                            
43                        $(qo).addClass('box-questioning-color-fc-white')        
44                    if ($(qo).hasClass('box-questioning-image')) 
45                    {
46                        px.src = $('.bq-image', qo).first().data('image');  
47                        px.onload = function () {  
48                            $('.bq-image', qo).html('<div class="image" style="background-image: url('+px.src+');"></div>');  
49                            $('.bq-image .image', qo)
50                                .html('<span class="item-containers"><span class="cntr-questioning">Sonda</span></span>')  
51                                .addClass('visible');
52                        };                             
53                        px.onerror = function () {  
54                            $('.bq-image', qo).remove();  
55                            $(qo).removeClass('box-questioning-image').addClass('box-questioning-no-image');
56                        };  
57                    }      
58                    $('.bq-answers', qo).clone().addClass('bq-answers-bg').prependTo( $('.bq-area', qo) );    
59                    $('.bq-answers-bg *', qo).removeAttr('id').removeData();  
60                    $('.bq-answers-bg .bq-answer', qo).addClass('bq-answer-bg');
61                                            
62                    $('.bq-related-data', qo).each(function () {   
63                        if (($('#element').data('id') == $(this).data('rel-id')) || (ql))
64                        {
65                            $(this).remove();
66                        }    
67                        else 
68                        {
69                            ql = true;
70                            var h = location.host;
71                            if ((h.indexOf('wprost.pl') >= 0)||(h.indexOf('wprost.ss') >= 0))
72                                h = 'Wprost.pl'; 
73                            $('.bq-answers', qo).not('.bq-answers-bg').append(
74                                '<span class="bq-related-link"><a href="'+$(this).data('rel-url')+'" title="Czytaj: '+$(this).data('rel-title')+'" target="qrel'+$(this).data('rel-id')+'"><span>Dowiedz się więcej</span></a></span>'
75                            );  
76                        }
77                    });         
78                    
79                    if (cv == 1)                        
80                        $('.bq-answers', qo).not('.bq-answers-bg').append('<span class="button">Głosuj</span>');
81                    else  
82                        $('.bq-answers', qo).not('.bq-answers-bg').append('<span class="button">Zobacz wyniki</span>');   
83                        
84                    $('.bq-question', qo).prepend('<span class="close"></span>');
85                    $('.bq-question .close', qo).on('click', function () {      
86                        $(this).parents('.box-questionings-collection').first().removeClass('box-questionings-collection-over');
87                        $(this).parents('.bq-area').first().removeClass('bq-area-fullscreen', 400);   
88                        $('.bq-answers', $(this).parents('.bq-area').first()).css('top', 'auto');
89                        resizeQuestioningsPage();     
90                    });     
91                    $('.bq-answers .button', qo).on('click', function () {          
92                        $(this).parents('.box-questionings-collection').first().addClass('box-questionings-collection-over');
93                        $(this).parents('.bq-area').first().addClass('bq-area-fullscreen', 400);   
94                        resizeQuestioningsPage();          
95                    });                         
96                    $('.bq-answer', qo).not('.bq-answer-bg').each(function () {     
97                        var v = 0 + ($.trim($(this).data('votes')))
98                            p = ((vc == 0) || (v == 0)) ? 0 : ((v * 100 / vc).toFixed(1));
99                        $('.bq-answer-votes', this)  
100                            .attr('data-pr', parseInt(p))
101                            .data('pr', parseInt(p))                   
102                            .html('<span><span></span></span>');       
103                        $('.bq-answer-votes span span', this).width(p+'%');
104                        if (cv == 1)              
105                        {                                         
106                            $(this).on('click', function (event) {      
107                                event.preventDefault();     
108                                var idq = ($.trim($(this).data('idq'))),
109                                    idqa = ($.trim($(this).data('idqa')));       
110                                console.log(idq, idqa);
111                                if ((idq > 0) && (idqa >= 0)) 
112                                {     
113                                    sendQuestioningAnswer(idq, idqa);
114                                }      
115                            })    
116                        }  
117                    });    
118                    questioningsThinMode(qo);             
119                }                           
120                $(this).addClass('assigned'); 
121            }    
122        })                   
123        
124        if ($('.box-questionings-collection').length > 0)
125            initPageQuestioningsCollection();  
126        
127        if (!assignedPageQuestioningsEvents)
128        {       
129            $(window).resize(function(e){     
130                resizeQuestioningsPage();   
131            });                              
132            $(document).resize(function(e){
133                resizeQuestioningsPage();   
134            });                                                    
135            setTimeout(function() { 
136                resizeQuestioningsPage();   
137                $('body').on('DOMNodeInserted', function(e){  
138                    resizeQuestioningsPage();    
139                });  
140            }, 150);     
141            assignedPageQuestioningsEvents = true;
142        }
143        else
144        {   
145            resizeQuestioningsPage();  
146        }                                                 
147    }      
148}
149
150function sendQuestioningAnswer(id_questioning, id_answer)
151{                  
152    if ((id_questioning > 0) && (id_answer > 0))
153    {           
154        console.log(1, id_questioning, id_answer);          
155                var v = 0 + parseInt($('#questioning-answer-'+id_questioning+'-'+id_answer).data('votes')),
156                    c = 0 + parseInt($('#questioning-'+id_questioning).data('vc')),
157                    p = 0;                                    
158                v++;     
159                c++;                                      
160                $('#questioning-'+id_questioning+' .button').text('Zobacz wyniki');   
161                $('#questioning-'+id_questioning+' .bq-answer').removeClass('bq-selected');                       
162                $('#questioning-'+id_questioning)   
163                    .attr('data-vote', 0) 
164                    .attr('data-vc', c)
165                    .data('vote', 0)
166                    .data('vc', c);   
167                $('#questioning-answer-'+id_questioning+'-'+id_answer)     
168                    .addClass('bq-selected')
169                    .attr('data-votes', v)
170                    .data('votes', v);              
171                $('#questioning-'+id_questioning+' .bq-answer').off('click');
172                $('#questioning-'+id_questioning+' .bq-answer').each(function () {     
173                    var v = parseInt($.trim($(this).data('votes')))
174                        p = (v * 100 / c).toFixed(1);
175                    $('.bq-answer-votes', this)  
176                        .attr('data-pr', p)  
177                        .data('pr', p);
178                    $('.bq-answer-votes span span', this).width(p+'%');
179                }); 
180           
181        $.ajax({  
182            type: 'POST',  
183            url: '/hits.php',
184            data: {                      
185                'id':    ''+id_questioning,              
186                'type':  '6', 
187                'answer': id_answer,   
188                'director':  location.href, 
189                'event': 'answer',
190                'action':'set'
191            },          
192            dataType: 'json', 
193            success: function(oJsonObject) {      
194                console.log(5, id_questioning, id_answer);      
195                if ((typeof gtag == 'function') || (typeof GA_TRACKING_ID == 'string')) 
196                { 
197                    gtag('event', 'Questioning', {
198                         'event_category': 'Interaction',
199                         'event_label':    'Answer'
200                    });
201                } 
202                if (typeof(Storage) !== 'undefined') 
203                    localStorage.setItem('questioning-'+id_questioning, id_answer);    
204            },     
205            error: function() {  
206            
207            }
208        });  
209        return false;
210    }             
211}    
212
213function initPageQuestioningsCollection()
214{     
215    if ($('.box-questionings-collection').length > 0)
216    {        
217        $('.box-questionings-collection').each(function() { 
218            var qi = 1,
219                qoc = this;                   
220            if ($('.box-questioning', qoc).length > 1)
221            {       
222                var firstIndex = 1;     
223                $('.box-questioning', qoc).each(function() { 
224                    $(this)            
225                        .css('left', 0)
226                        .attr('data-index', qi)  
227                        .data('index', qi);   
228                    if ($(this).data('vote') == 1)
229                        firstIndex = qi;  
230                    qi++;
231                });  
232                $(qoc)                    
233                    .append('<span class="bqc-nav bqc-nav-prev" title="Poprzednia sonda"></span><span class="bqc-nav bqc-nav-next" title="Następna sonda"></span>')  
234                    .attr('data-count', qi-1) 
235                    .attr('data-index', firstIndex)  
236                    .data('count', qi-1)
237                    .data('index', firstIndex);   
238                $('.box-questioning[data-index='+firstIndex+']', qoc)
239                    .addClass('active');
240            }
241            else  
242            if ($('.box-questioning', qoc).length == 1) 
243                $('.box-questioning', qoc).addClass('alone');
244        });  
245        if ($('.bqc-nav').length > 0)
246        {
247            $('.bqc-nav').on('click', function () {
248                var qoc = $(this).parents('.box-questionings-collection').first(); 
249                if ($(qoc).length == 1)
250                {                  
251                    var quw = $(qoc).width(),
252                        quc = $(qoc).data('count'),
253                        qui = $(qoc).data('index'),
254                        qun = qui,
255                        qnx = ($(this).hasClass('bqc-nav-next'));
256                    $('.box-questioning', qoc)
257                        .addClass('stable')
258                        .removeClass('active deactivated');   
259                    $('.box-questioning[data-index='+qui+']', qoc)  
260                        .removeClass('stable')
261                        .addClass('deactivated');              
262                    setTimeout(function() {          
263                        if (qnx)       
264                        {      
265                            qun--;
266                            if (qun < 1)
267                                qun = quc;                           
268                            $('.box-questioning[data-index='+qun+']', qoc).css('left', (0 - quw - 100));   
269                        }                
270                        else
271                        {            
272                            qun++;
273                            if (qun > quc)
274                                qun = 1;                                         
275                            $('.box-questioning[data-index='+qun+']', qoc).css('left', (quw + 100));  
276                        }                                                          
277                        setTimeout(function() {                     
278                            $('.box-questioning[data-index='+qun+']', qoc)   
279                                .removeClass('stable')
280                                .addClass('active');  
281                            $(qoc)
282                                .attr('data-index', qun)  
283                                .data('index', qun);    
284                        }, 10);                
285                    }, 10);          
286                }                  
287            });
288        }
289    }
290}
291
292function resizeQuestioningsPage()
293{         
294    var wH = $(window).height(),   
295        wW = $(window).width();      
296    $('.box-questioning').each(function () {
297        questioningsThinMode(this)
298    });        
299    $('.box-questioning.box-questioning-image').each(function () {
300        if (wW <= 840)
301        {
302            if (($('.bq-answers', this).not('.bq-answers-bg').length == 1) && ($('.bq-answers-bg', this).length == 1))  
303            {
304                var qH = $(this).height(),
305                    tH = $('.bq-question', this).outerHeight(),
306                    aH = $('.bq-answers-bg', this).outerHeight();
307                if ((qH - tH - aH) < (tH + 40))    
308                    $('.bq-answers', this).addClass('bq-answers-colapssed');
309                else    
310                    $('.bq-answers', this).removeClass('bq-answers-colapssed');
311            }   
312            if ($('.bq-area', this).hasClass('bq-area-fullscreen'))  
313                $('.bq-answers', this).css('top', $('.bq-question', this).outerHeight());
314            else                                                                    
315                $('.bq-answers', this).css('top', 'auto');
316        }              
317        else
318        {                                                         
319            $('.box-questionings-collection').removeClass('box-questionings-collection-over');
320            $('.bq-answers', this).removeClass('bq-answers-colapssed'); 
321            $('.bq-area', this).removeClass('bq-area-fullscreen');
322        }
323    });   
324    
325    if ($('.box-questionings-collection').length > 0)
326    {        
327        $('.box-questionings-collection').each(function(){ 
328            var qoc = this,
329                qcW = $(qoc).outerWidth(true),
330                qcio = 0;                   
331            if ($('.questioning.box-questioning', qoc).length > 0)
332            {
333                var maxH = 0;     
334                $('.questioning.box-questioning', qoc).each(function() {  
335                    if (($(this).hasClass('box-questioning-color-none')) || ($(this).hasClass('box-questioning-color-light')) || ($(this).hasClass('box-questioning-color-white')))
336                        qcio = 2; 
337                    else 
338                        qcio = 0; 
339                    $(this).width(qcW - qcio);  
340                   // var qciH = $(this).outerHeight();    
341                    var qciH = $(this).height() - qcio;   
342                    if (qciH > maxH)
343                        maxH = qciH;
344                }); 
345                if (maxH < 400)
346                    maxH = 400; 
347                $('.questioning.box-questioning', qoc).each(function() {         
348                    if (($(this).hasClass('box-questioning-color-none')) || ($(this).hasClass('box-questioning-color-light')) || ($(this).hasClass('box-questioning-color-white')))
349                        qcio = 2; 
350                    else 
351                        qcio = 0; 
352                    if ($(this).hasClass('box-questioning-thin-mode'))
353                    {
354                        var qstH = $('.bq-question', this).outerHeight(true);     
355                        $('.bq-image', this).height(maxH - qstH - qcio);   
356                    }          
357                    else          
358                        $('.bq-image', this).height('auto');
359                    $(this).height(maxH - qcio); 
360                });                                  
361                $('.box-questionings-collection-inner', qoc).height(maxH);  
362            }             
363        });  
364    }  
365    $('.box-questionings-collection').addClass('visible');  
366    $('.questioning.assigned').addClass('visible');      
367}    
368
369function questioningsThinMode(qo)
370{             
371    var wH = $(window).height(),   
372        wW = $(window).width();          
373    $('.box-questioning').each(function () {
374        if (wW >= 1195)
375        {          
376            if ($(qo).parent().width() < 680)                        
377                $(qo).addClass('box-questioning-thin-mode');   
378            else
379                $(qo).removeClass('box-questioning-thin-mode');  
380        }    
381        else     
382        if (wW >= 840)
383        {          
384            if ($(qo).parent().width() <= 720)                        
385                $(qo).addClass('box-questioning-thin-mode');   
386            else
387                $(qo).removeClass('box-questioning-thin-mode');  
388        }    
389        else
390            $(qo).removeClass('box-questioning-thin-mode');  
391            
392        if ($(qo).hasClass('box-questioning-thin-mode'))
393        {
394            var qH = $('.bq-question', qo).outerHeight(),
395                aH = $('.bq-answers', qo).outerHeight();
396            $('.bq-image', qo).height(qH + aH + 80);
397        }  
398        else    
399            $('.bq-image', qo).height('auto');
400    });  
401}

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.