PageSourceSearch

https://beobasket.net/resources/js/sw4i-global-1.0.0.js

js beobasket.net collected 2026-10-02 11:22:19 UTC 27,776 bytes, 806 lines download raw bytes

1$(document).ready(function(){
2    /* navigation drop down */
3    $("li.level1").hover(
4
5        function () {
6            $(this).addClass("hoverL1");
7        }, function () {
8            $(this).removeClass("hoverL1");
9        });
10    
11    $("div.navL1 li").hover(
12        function () {
13            $(this).addClass("hoverL2");
14        }, function () {
15            $(this).removeClass("hoverL2");
16        });    
17    
18    
19//    $("ul.secNav").hover(
20//
21//    function () {
22//        $(this).addClass("hover-secNav");
23//    }, function () {
24//        $(this).removeClass("hover-secNav");
25//    });
26
27//    $("li.level2").hover(
28//
29//    function () {
30//        $(this).addClass("hoverL2");
31//    }, function () {
32//        $(this).removeClass("hoverL2");
33//    });
34//	
35//	$('.navL2 ul li a').removeClass('onPath');
36//	$('.navL2 ul li a').removeClass('current');
37/*	
38    $('div.navL2').each(function () {
39        var length = $(this).children('ul').width();
40        $(this).css('width', length + 'px');
41    });*/
42});
43
44
45/* boxing works */
46$(document).ready(function(){
47    //        console.time('test');
48    $('#content p, #content pre, #content h1, #content h2, #content h3, #content h4, #content h5, #content h6').contents().filter(function() {
49        return this.nodeType == 8; // 8 = Node.COMMENT_NODE ali ie ne zna za tu konstantu
50    }).each(function(index, value) {
51        
52        var that = value;
53        var cls = null;
54        var classes = $(that).parent().attr('class');
55        var classList = null;
56        if(typeof classes != 'undefined'){
57            classList = classes.split(/\s+/);
58        }
59        if(classList != null){
60            $.each( classList, function(index, item){
61                if (item.indexOf("box-") >= 0) {
62                    cls = item;
63                }
64            });
65        }
66        var name = that.nodeName;
67        var copy = $(that).parent().clone();
68        copy.empty();
69        $(that).parent().contents().filter(function() {
70            return true;
71        }).each(function(index,value) {
72            if (value.nodeType != 8){
73                copy.append($(value));
74            } else {
75                if(!isEmpty(copy)){
76                    $(that).parent().before(copy);
77                }
78                copy = $(that).parent().clone();
79                copy.empty();
80                var valueCopy = $(value).clone();
81                $(that).parent().before(valueCopy);
82                var tag = value.nodeValue.replace('>', '').split(' ');
83
84                if (!cls){
85                    cls = tag[1];
86                }
87                var id = tag[2];
88                var type = tag[3];
89
90                //	    console.log('1 : ' + id);
91                //	    console.log('2 : ' + type);
92                //	    console.log('3 : ' + cls);
93                $.get('/boxes/' + type + 'Box.jsp', {
94                    boxId : id, 
95                    autoplay: false, 
96                    pClass: cls
97                }, function(data) {
98                    $(valueCopy).replaceWith(data);
99                });
100            }
101        });
102        if(!isEmpty(copy)){
103            $(that).parent().before(copy);
104        }
105        $(that).parent().remove();
106    });
107
108//    console.timeEnd('test');
109});
110
111function isEmpty(el){
112    return !$.trim(el.html())
113}
114
115/* popup window */
116(function($){
117    $.fn.popupWindow = function(instanceSettings){
118
119        return this.each(function(){
120
121            $(this).click(function(){
122
123                $.fn.popupWindow.defaultSettings = {
124                    centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
125                    centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
126                    height:500, // sets the height in pixels of the window.
127                    left:0, // left position when the window appears.
128                    location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
129                    menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
130                    resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
131                    scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
132                    status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
133                    width:500, // sets the width in pixels of the window.
134                    windowName:null, // name of window set from the name attribute of the element that invokes the click
135                    windowURL:null, // url used for the popup
136                    top:0, // top position when the window appears.
137                    toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
138                };
139
140                settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
141
142                var windowFeatures =    'height=' + settings.height +
143                ',width=' + settings.width +
144                ',toolbar=' + settings.toolbar +
145                ',scrollbars=' + settings.scrollbars +
146                ',status=' + settings.status +
147                ',resizable=' + settings.resizable +
148                ',location=' + settings.location +
149                ',menuBar=' + settings.menubar;
150
151                settings.windowName = this.name || settings.windowName;
152                settings.windowURL = this.href || settings.windowURL;
153                var centeredY,centeredX;
154
155                if(settings.centerBrowser){
156
157                    if ($.browser.msie) {//hacked together for IE browsers
158                        centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
159                        centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
160                    }else{
161                        centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
162                        centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
163                    }
164                    window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
165                }else if(settings.centerScreen){
166                    centeredY = (screen.height - settings.height)/2;
167                    centeredX = (screen.width - settings.width)/2;
168                    window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
169                }else{
170                    window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();
171                }
172                return false;
173            });
174
175        });
176    };
177})(jQuery);
178
179/* scroll content */
180(function($){
181    function fireEvent(opts,name,self,arg){
182        var fn=opts[name];
183        if($.isFunction(fn)){
184            try{
185                return fn.call(self,arg);
186            }catch(error){
187                if(opts.alert){
188                    alert("Error calling scrollable."+name+": "+error);
189                }else{
190                    throw error;
191                }
192                return false;
193            }
194        }
195        return true;
196    }
197    var current=null;
198    function Scrollable(root,conf){
199        var self=this;
200        if(!current){
201            current=self;
202        }
203        var horizontal=!conf.vertical;
204        var wrap=$(conf.items,root);
205        var index=0;
206        var navi=root.siblings(conf.navi).eq(0);
207        var prev=root.siblings(conf.prev).eq(0);
208        var next=root.siblings(conf.next).eq(0);
209        var prevPage=root.siblings(conf.prevPage).eq(0);
210        var nextPage=root.siblings(conf.nextPage).eq(0);
211        $.extend(self,{
212            getVersion:function(){
213                return[1,0,1];
214            },
215            getIndex:function(){
216                return index;
217            },
218            getConf:function(){
219                return conf;
220            },
221            getSize:function(){
222                return self.getItems().size();
223            },
224            getPageAmount:function(){
225                return Math.ceil(this.getSize()/conf.size);
226            },
227            getPageIndex:function(){
228                return Math.ceil(index/conf.size);
229            },
230            getRoot:function(){
231                return root;
232            },
233            getItemWrap:function(){
234                return wrap;
235            },
236            getItems:function(){
237                return wrap.children();
238            },
239            seekTo:function(i,time,fn){
240                time=time||conf.speed;
241                if($.isFunction(time)){
242                    fn=time;
243                    time=conf.speed;
244                }
245                if(i<0){
246                    i=0;
247                }
248                if(i>self.getSize()-conf.size){
249                    return self;
250                }
251                var item=self.getItems().eq(i);
252                if(!item.length){
253                    return self;
254                }
255                if(fireEvent(conf,"onBeforeSeek",self,i)===false){
256                    return self;
257                }
258                if(horizontal){
259                    var left=-(item.outerWidth(true)*i);
260                    wrap.animate({
261                        left:left
262                    },time,conf.easing,fn?function(){
263                        fn.call(self);
264                    }:null);
265                }else{
266                    var top=-(item.outerHeight(true)*i);
267                    wrap.animate({
268                        top:top
269                    },time,conf.easing,fn?function(){
270                        fn.call(self);
271                    }:null);
272                }
273                if(navi.length){
274                    var klass=conf.activeClass;
275                    var page=Math.ceil(i/conf.size);
276                    page=Math.min(page,navi.children().length-1);
277                    navi.children().removeClass(klass).eq(page).addClass(klass);
278                }
279                if(i===0){
280                    prev.add(prevPage).addClass(conf.disabledClass);
281                }else{
282                    prev.add(prevPage).removeClass(conf.disabledClass);
283                }
284                if(i>=self.getSize()-conf.size){
285                    next.add(nextPage).addClass(conf.disabledClass);
286                }else{
287                    next.add(nextPage).removeClass(conf.disabledClass);
288                }
289                current=self;
290                index=i;
291                fireEvent(conf,"onSeek",self,i);
292                return self;
293            },
294            move:function(offset,time,fn){
295                var to=index+offset;
296                if(conf.loop&&to>(self.getSize()-conf.size)){
297                    to=0;
298                }
299                return this.seekTo(to,time,fn);
300            },
301            next:function(time,fn){
302                return this.move(1,time,fn);
303            },
304            prev:function(time,fn){
305                return this.move(-1,time,fn);
306            },
307            movePage:function(offset,time,fn){
308                return this.move(conf.size*offset,time,fn);
309            },
310            setPage:function(page,time,fn){
311                var size=conf.size;
312                var index=size*page;
313                var lastPage=index+size>=this.getSize();
314                if(lastPage){
315                    index=this.getSize()-conf.size;
316                }
317                return this.seekTo(index,time,fn);
318            },
319            prevPage:function(time,fn){
320                return this.setPage(this.getPageIndex()-1,time,fn);
321            },
322            nextPage:function(time,fn){
323                return this.setPage(this.getPageIndex()+1,time,fn);
324            },
325            begin:function(time,fn){
326                return this.seekTo(0,time,fn);
327            },
328            end:function(time,fn){
329                return this.seekTo(this.getSize()-conf.size,time,fn);
330            },
331            reload:function(){
332                return load();
333            },
334            click:function(index,time,fn){
335                var item=self.getItems().eq(index);
336                var klass=conf.activeClass;
337                if(!item.hasClass(klass)&&(index>=0||index<this.getSize())){
338                    self.getItems().removeClass(klass);
339                    item.addClass(klass);
340                    var delta=Math.floor(conf.size/2);
341                    var to=index-delta;
342                    if(to>self.getSize()-conf.size){
343                        to--;
344                    }
345                    if(to!==index){
346                        return this.seekTo(to,time,fn);
347                    }
348                }
349                return self;
350            }
351        });
352        if($.isFunction($.fn.mousewheel)){
353            root.bind("mousewheel.scrollable",function(e,delta){
354                var step=$.browser.opera?1:-1;
355                self.move(delta>0?step:-step,50);
356                return false;
357            });
358        }
359        prev.addClass(conf.disabledClass).click(function(){
360            self.prev();
361        });
362        next.click(function(){
363            self.next();
364        });
365        nextPage.click(function(){
366            self.nextPage();
367        });
368        prevPage.addClass(conf.disabledClass).click(function(){
369            self.prevPage();
370        });
371        if(conf.keyboard){
372            $(window).unbind("keypress.scrollable").bind("keypress.scrollable",function(evt){
373                var el=current;
374                if(!el){
375                    return;
376                }
377                if(horizontal&&(evt.keyCode==37||evt.keyCode==39)){
378                    el.move(evt.keyCode==37?-1:1);
379                    return evt.preventDefault();
380                }
381                if(!horizontal&&(evt.keyCode==38||evt.keyCode==40)){
382                    el.move(evt.keyCode==38?-1:1);
383                    return evt.preventDefault();
384                }
385                return true;
386            });
387        }
388        function load(){
389            navi.each(function(){
390                var nav=$(this);
391                if(nav.is(":empty")||nav.data("me")==self){
392                    nav.empty();
393                    nav.data("me",self);
394                    for(var i=0;i<self.getPageAmount();i++){
395                        var item=$("<"+conf.naviItem+"/>").attr("href",i).click(function(e){
396                            var el=$(this);
397                            el.parent().children().removeClass(conf.activeClass);
398                            el.addClass(conf.activeClass);
399                            self.setPage(el.attr("href"));
400                            return e.preventDefault();
401                        });
402                        if(i===0){
403                            item.addClass(conf.activeClass);
404                        }
405                        nav.append(item);
406                    }
407                }else{
408                    var els=nav.children();
409                    els.each(function(i){
410                        var item=$(this);
411                        item.attr("href",i);
412                        if(i===0){
413                            item.addClass(conf.activeClass);
414                        }
415                        item.click(function(){
416                            nav.find("."+conf.activeClass).removeClass(conf.activeClass);
417                            item.addClass(conf.activeClass);
418                            self.setPage(item.attr("href"));
419                        });
420                    });
421                }
422            });
423            if(conf.clickable){
424                self.getItems().each(function(index,arg){
425                    var el=$(this);
426                    if(!el.data("set")){
427                        el.bind("click.scrollable",function(){
428                            self.click(index);
429                        });
430                        el.data("set",true);
431                    }
432                });
433            }
434            if(conf.hoverClass){
435                self.getItems().hover(function(){
436                    $(this).addClass(conf.hoverClass);
437                },function(){
438                    $(this).removeClass(conf.hoverClass);
439                });
440            }
441            return self;
442        }
443        load();
444        var timer=null;
445        function setTimer(){
446            timer=setInterval(function(){
447                self.next();
448            },conf.interval);
449        }
450        if(conf.interval>0){
451            root.hover(function(){
452                clearInterval(timer);
453            },function(){
454                setTimer();
455            });
456            setTimer();
457        }
458    }
459    jQuery.prototype.scrollable=function(conf){
460        var api=this.eq(typeof conf=='number'?conf:0).data("scrollable");
461        if(api){
462            return api;
463        }
464        var opts={
465            size:5,
466            vertical:false,
467            clickable:true,
468            loop:false,
469            interval:0,
470            speed:400,
471            keyboard:true,
472            activeClass:'active',
473            disabledClass:'disabled',
474            hoverClass:null,
475            easing:'swing',
476            items:'.items',
477            prev:'.prev',
478            next:'.next',
479            prevPage:'.prevPage',
480            nextPage:'.nextPage',
481            navi:'.navigator',
482            naviItem:'a',
483            onBeforeSeek:null,
484            onSeek:null,
485            alert:true
486        };
487
488        $.extend(opts,conf);
489        this.each(function(){
490            var el=new Scrollable($(this),opts);
491            $(this).data("scrollable",el);
492        });
493        return this;
494    };
495
496})(jQuery);
497
498
499
500/* text resize */
501$(document).ready(function(){
502  
503    $(".increaseFont").click(function(){
504        jQuery('div.story p,div.story h1,div.story h2,div.story h3,div.story h4,div.story h5,div.story td,div.story li p,div.item p,div.item h1,div.item h2,div.item h3,div.item h4,div.item h5,div.item td,div.item li p,span.priceText,p.lead, div.productSpec p,div.holderSize label, div.productBody,p').each(function(){
505            var oldf = parseInt( jQuery(this).css('font-size') );
506            jQuery(this).css({
507                'font-size' : oldf + 2 + 'px',
508                'line-height' : Math.round(oldf*1.5) + 'px'
509            });
510        });
511        return false;
512    });
513  
514    $(".decreaseFont").click(function(){
515        jQuery('div.story p,div.story h1,div.story h2,div.story h3,div.story h4,div.story h5,div.story td,div.story li p,div.item p,div.item h1,div.item h2,div.item h3,div.item h4,div.item h5,div.item td,div.item li p,span.priceText,p.lead, div.productSpec p,div.holderSize label, div.productBody, p').each(function(){
516            var oldf = parseFloat( jQuery(this).css('font-size') );
517            jQuery(this).css({
518                'font-size' : oldf - 2 + 'px',
519                'line-height' : Math.round(oldf*1.5) + 'px'
520            });
521        });
522        return false;
523    });
524	
525    $(".resetFont").click(function(){
526        jQuery('div.story p,div.story h1,div.story h2,div.story h3,div.story h4,div.story h5,div.story td,div.story li p,div.item p,div.item h1,div.item h2,div.item h3,div.item h4,div.item h5,div.item td,div.item li p,span.priceText,p.lead, div.productSpec p,div.holderSize label, div.productBody, p').each(function(){
527            jQuery(this).removeAttr("style");
528        });
529        return false;
530    });
531  
532});
533
534/* focus input */
535function showValue1(defaultText){
536    var search=document.getElementById('searchText1');
537    if (search.value=='') search.value=defaultText;
538    return ;
539}
540function hideValue1(defaultText){
541   
542    var search=document.getElementById('searchText1');
543    if (search.value==defaultText) search.value='';
544    return ;
545}
546function showValue2(defaultText){
547    var search=document.getElementById('searchText2');
548    if (search.value=='') search.value=defaultText;
549    return ;
550}
551function hideValue2(defaultText){
552   
553    var search=document.getElementById('searchText2');
554    if (search.value==defaultText) search.value='';
555    return ;
556}
557function showValue3(defaultText){
558    var search=document.getElementById('searchText3');
559    if (search.value=='') search.value=defaultText;
560    return ;
561}
562function hideValue3(defaultText){
563   
564    var search=document.getElementById('searchText3');
565    if (search.value==defaultText) search.value='';
566    return ;
567}
568function showValue4(defaultText){
569    var search=document.getElementById('searchText4');
570    if (search.value=='') search.value=defaultText;
571    return ;
572}
573function hideValue4(defaultText){
574   
575    var search=document.getElementById('searchText4');
576    if (search.value==defaultText) search.value='';
577    return ;
578}
579
580
581
582$('.userName').focusin(function(){
583
584    if ($(this).val() == 'Korisničko ime:'){
585        $(this).val('');
586    }
587});
588$('.userPass').focusin(function(){
589    if ($(this).val() == 'Lozinka:'){
590        $(this).val('');
591    }
592});
593$('.userName').focusout(function(){
594    if ($(this).val() == ''){
595        $(this).val('Korisničko ime:');
596    }
597});
598$('.userPass').focusin(function(){
599    if ($(this).val() == ''){
600        $(this).val('Lozinka:');
601    }
602});
603
604
605
606function focusInput(selector) {
607    $(selector).each(function(){
608        var domObj = $(this)[0];
609        var defaultValue = domObj.value;
610
611        console.log(domObj);
612
613        $(this).focus(function () {
614            if (this.value==defaultValue) this.value='';
615            console.log("focus: "+this.value);
616            return ;
617        });
618
619        $(this).blur(function() {
620            if (this.value=='') this.value=defaultValue;
621            console.log("blur: "+this.value);
622            return ;
623        });
624    });
625}
626
627
628/* used on every page! */
629/* colorbox call for mail to a friend form */
630$(document).ready(function(){
631    $(".mailFriend").colorbox({
632        width:"400px", 
633        inline:true, 
634        href:"#mailFriend"
635    });
636});
637
638/* colobox call for attached mediaset */
639$(document).ready(function(){
640    $("a[rel='gallery']").colorbox();
641});
642
643/* top scroller */
644$(document).ready(function() {
645    $('a[href=#top]').click(function(){
646        $('html, body').animate({
647            scrollTop:0
648        }, 'slow');
649        return false;
650    });
651});
652
653/* call to popup window */
654$(document).ready(function() {
655    $('.printPage').popupWindow({
656        height:500,
657        width:800,
658        centerBrowser:1,
659        scrollbars:1
660    });
661});
662
663function pollSubmit(warningMessage,pollId,questionId){
664    if (!pollValidate(warningMessage, questionId)){
665        return false;
666    }
667    var message;
668    var poruka;
669    var type;
670    var form = $('#answers'+questionId);
671    var span = $('#message'+questionId);
672    var nesto = $.ajax({
673        type: "POST",
674        url: form.attr('action'),
675        data: form.serialize(),
676        success: function(response) {
677            //        alert("Response: " + response);
678            message = nesto.getResponseHeader('message');
679            if (message=='poll_cant_vote'){
680                poruka = 'Možete glasati samo jednom!';
681                span.text("" + poruka);
682                span.show();
683            } else {
684                poruka = 'Hvala što ste glasali!';
685                span.text("" + poruka);
686                span.show();
687                type = nesto.getResponseHeader('type');
688                var json = nesto.responseText.toString();
689                var array = jQuery.parseJSON(json);
690                //        alert("SUCCESS: " + array.length);
691                drawChartAjax(array, type, questionId);
692            }
693        },
694        error: function(e){
695            alert("GRESKA!");
696            return false;
697        }
698    });
699    form.hide();
700    return false;
701}
702
703function getChartData(pollId,questionId){
704    var nesto = $.ajax({
705        type: "POST",
706        url: '/sw4i/poll/vote',
707        data: {
708            pollId: pollId, 
709            questionId: questionId, 
710            ajax: 'yes', 
711            noVote: 'true'
712        },
713        success: function(response) {
714            var type = nesto.getResponseHeader('type');
715            var json = nesto.responseText.toString();
716            var array = jQuery.parseJSON(json);
717            drawChartAjax(array, type, questionId);
718        },
719        error: function(e){
720            return false;
721        }
722    });
723}
724
725function pollValidate(warningMessage,id) {
726    var pollValid = false;
727    $('#answers' + id + ' input:radio').each(function(index, value) {
728        if(value.checked) pollValid = true;
729    });
730    
731    if(!pollValid)
732        alert(warningMessage);
733    return pollValid;
734}
735
736function drawChartAjax(data,type,id){
737    if (typeof google === "object" && typeof google.visualization === "object") {
738        var chart;
739        var options;
740        var dataNew = google.visualization.arrayToDataTable(data);
741        if (type=='pie' || type=='donut'){
742            chart = new google.visualization.PieChart(document.getElementById('question'+id));
743        } else {
744            chart = new google.visualization.BarChart(document.getElementById('question'+id));
745        }
746        if (type=='donut'){
747            options = {
748                legend: 'none',
749                pieHole: 0.3
750            };
751        } else {
752            options = {
753                legend: 'none'
754            }
755        }
756        chart.draw(dataNew,options);
757    } else {
758        google.load("visualization", "1", {packages:["corechart"]});
759        google.setOnLoadCallback(drawChartAjax(data, type, id));
760    }
761}
762
763/* normalni popup prozor */
764function openPopup(url, width, height) {
765    window.open(url, "popup_id", "location=no,scrollbars=no,resizeble=no,status=no,width="+width+",height="+height);
766    return false;
767}
768
769
770/* breaking news */
771var starteddd=false;
772$(function(){
773    //$("ul#ticker02").liScroll({travelocity: 0.03});
774    var nnn = $(".breakingDiv").length;
775    var iiiii = 0;
776    var pauseddd=false;
777    var refreshIntervalId;
778    if(nnn>0 && !starteddd){
779        starteddd=true;
780        refreshIntervalId = setInterval(function() {
781            if(!pauseddd){
782                if(iiiii+1<nnn){
783                    iiiii++;
784                }else{
785                    iiiii=0;
786                }
787                //                    alert($(".breakingDiv:visible").attr("id"));
788                $(".breakingDiv:visible").slideUp(500);
789                $("#breakingDiv"+iiiii).slideDown(1000);
790            }
791        }, 3000);
792    }
793    $(".breakingDiv").hover(function(){
794        pauseddd=true;
795    //clearInterval(refreshIntervalId);
796    }, function(){
797        pauseddd=false;
798    //starteddd=false;
799    });
800    $(window).focus(function() {
801        pauseddd=false;
802    });
803    $(window).blur(function() {
804        pauseddd=true;
805    });
806});

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.