PageSourceSearch

https://cdn-china.editage.cn/eos/prod/assets/js/jquery.ticker.js

js editage.cn collected 2026-10-02 10:05:12 UTC 5,696 bytes, 170 lines download raw bytes

1//Javascript codes
2
3(function(jQuery){
4
5    $.fn.customTicker = function(params){
6        var defaults={
7            width			:'100%',
8            modul			:'customTicker',
9            color			:'default',
10            border			:false,
11            effect			:'fade',
12            fontstyle		:'normal',
13            autoplay		:false,
14            timer			:4000,
15            feed			:false,
16            feedlabels		:false,
17            feedcount		:5
18        };
19        var feeds=[];
20        var labels=[];
21        var params=$.extend(defaults,params);
22
23        return this.each(function(){
24            //Variables------------------------------------
25            params.modul=$("#"+$(this).attr("id"));
26            var timername=params.modul;
27            var active=0;
28            var previous=0;
29            var count=params.modul.find("ul li").length;
30            var changestate=true;
31
32            params.modul.find("ul li").eq(active).fadeIn();
33
34            resizeEvent();
35
36            if (params.autoplay)
37            {
38                timername=setInterval(function(){autoPlay()},params.timer);
39                $(params.modul).on("mouseenter",function (){
40                    clearInterval(timername);
41                });
42
43                $(params.modul).on("mouseleave",function (){
44                    timername=setInterval(function(){autoPlay()},params.timer);
45                });
46            }
47            else
48            {
49                clearInterval(timername);
50            }
51
52            if (!params.border)
53            {
54                params.modul.addClass("bn-bordernone");
55            }
56
57            if (params.fontstyle=="italic")
58                params.modul.addClass("bn-italic");
59
60            if (params.fontstyle=="bold")
61                params.modul.addClass("bn-bold");
62
63            if (params.fontstyle=="bold-italic")
64                params.modul.addClass("bn-bold bn-italic");
65
66            params.modul.addClass("bn-"+params.color);
67
68            //Events---------------------------------------
69            $(window).on("resize",function (){
70                resizeEvent();
71            });
72
73            params.modul.find(".bn-navi span").on("click",function(){
74                if (changestate)
75                {
76                    changestate=false;
77                    if ($(this).index()==0)
78                    {
79                        active--;
80                        if (active<0)
81                            active=count-1;
82
83                        changeNews();
84                    }
85                    else
86                    {
87                        active++;
88                        if (active==count)
89                            active=0;
90
91                        changeNews();
92                    }
93                }
94            });
95
96            //functions------------------------------------
97            function resizeEvent()
98            {
99                if (params.modul.width()<480)
100                {
101                    params.modul.find(".bn-title h2").css({"display":"none"});
102                    params.modul.find(".bn-title").css({"width":10});
103                    params.modul.find("ul").css({"left":30});
104                }
105                else
106                {
107                    params.modul.find(".bn-title h2").css({"display":"inline-block"});
108                    params.modul.find(".bn-title").css({"width":"auto"});
109                    params.modul.find("ul").css({"left":$(params.modul).find(".bn-title").width()+30});
110                }
111            }
112
113            function autoPlay()
114            {
115                active++;
116                if (active==count)
117                    active=0;
118
119                changeNews();
120            }
121
122            function changeNews()
123            {
124                if (params.effect=="fade")
125                {
126                    params.modul.find("ul li").css({"display":"none"});
127                    params.modul.find("ul li").eq(active).fadeIn("normal",function (){
128                        changestate=true;
129                    });
130                }
131                else if (params.effect=="slide-h")
132                {
133                    params.modul.find("ul li").eq(previous).animate({width:0},function(){
134                        $(this).css({"display":"none","width":"100%"});
135                        params.modul.find("ul li").eq(active).css({"width":0,"dis
135play":"block"});
136                        params.modul.find("ul li").eq(active).animate({width:"100%"},function(){
137                            changestate=true;
138                            previous=active;
139                        });
140                    });
141                }
142                else if (params.effect=="slide-v")
143                {
144                    if (previous<=active)
145                    {
146                        params.modul.find("ul li").eq(previous).animate({top:-60});
147                        params.modul.find("ul li").eq(active).css({top:60,"display":"block"});
148                        params.modul.find("ul li").eq(active).animate({top:0},function(){
149                            previous=active;
150                            changestate=true;
151                        });
152                    }
153                    else
154                    {
155                        params.modul.find("ul li").eq(previous).animate({top:60});
156                        params.modul.find("ul li").eq(active).css({top:-60,"display":"block"});
157                        params.modul.find("ul li").eq(active).animate({top:0},function(){
158                            previous=active;
159                            changestate=true;
160                        });
161                    }
162                }
163            }
164        });
165
166
167    };
168
169})(jQuery);
170

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.