PageSourceSearch

https://corporate.tvb.com/cdn/js/module.js?ts=20210329

js tvb.com collected 2026-09-24 17:15:41 UTC 8,502 bytes, 257 lines download raw bytes

1
2
3jQuery(function($){
4	function responsive_ui() {
5		if($('#mod-index-image-show').find('img').eq(0).height() > 0){
6			$('#mod-index-image-show .my-slide-show').css('height',$('#mod-index-image-show').find('img').eq(0).height()+'px');
7		};
8		if(window.innerWidth < 1000){
9			$('#mod-left-menu').insertAfter('#hd .menu-content .top-nav-scroll-wrap');
10		} else {
11			$('.layout-left-panel').append($('#mod-left-menu'));
12			$('#mod-hd').removeClass('open');
13		}
14	}
15
16    $("#mod-ft").each(function(){
17        var $this=$(this);
18        var $ft=$("#ft");
19        var $body=$(document.body);
20        var ftHeight=$ft.height();
21        var top=$ft.offset().top+ftHeight;
22        var status=null;
23        var init=function(){
24            /*var scrollTop=win.scrollTop()+win.height();
25            var bool=top>scrollTop;
26            if(status!=bool){
27                $ft.css({position:bool?"fixed":"static"});
28                $body.css({paddingBottom:bool?ftHeight:0});
29                status=bool;
30            }*/
31            if(top<win.height()){
32                $ft.css({position:"fixed"});
33                $body.css({paddingBottom:ftHeight});
34            }else{
35                $ft.css({position:"static"});
36                $body.css({paddingBottom:0});
37            }
38        };
39
40        var scrollTopButton=$this.find(".scroll-top-button").css({bottom:$ft.height()+35,marginLeft:720}).click(function(){
41            scrollTopButton.windowScroll(0);
42        });
43        var pageName=$body.attr("class");
44        var win=$(window).scroll(function () {
45            if(pageName!="index"){
46                if(win.scrollTop()==0){
47                    scrollTopButton.hide();
48                }else{
49                    scrollTopButton.show();
50                }
51            }
52        }).resize(function () {
53            init();
54        });
55        init();
56    });
57
58    $("#mod-stock-price").each(function(){
59        var $this=$(this);
60        var loading=$this.find(".loading");
61        var container=$this.find(".box");
62        $.getJSON("/api/stock/?random="+Math.random(), function(stock){
63            $.each(stock.stock_price,function(i,v){
64                $("#"+i).text(v);
65            });
66            loading.hide();
67            container.css({visibility:"visible"});
68        });
69    });
70
71    $("#mod-left-menu").each(function(){
72        var $this=$(this);
73        var cat=TVB.context.cat;
74        var parentCategoryNodes=$this.find(".menu-list-item>a").click(function(){
75            var _self=$(this);
76            //console.log(parentCategoryNodes.next());
77            //parentCategoryNodes.next().slideUp();
78            //_self.next().slideDown();
79
80            //_self.next().slideToggle().parent().toggleClass("expand");
81
82        });//.eq(1).click();
83        if(cat!=""){
84            $this.find("a[cat='"+cat+"']").addClass("current").closest("div").toggleClass("expand").addClass("current").find("ul").toggle();
85        }
86        $this.find("a[cat=8]").css('cursor','pointer').click(function(){
87            $(this).addClass("current").closest("div").toggleClass("expand").addClass("current").find("ul").toggle();
88        });
89    });
90
91
92    $("#mod-index-image-show").each(function(){
93        var $this=$(this);
94        $this.find(".my-slide-show").mySlideShow({
95            effect:"fade",
96            themes:"default"
97        });
98    });
99    $("#mod-photo-album").each(function(){
100        var $this=$(this);
101        $this.find(".my-slide-show").mySlideShow({
102            slideWidth:185,
103            themes:"button",
104            autoPlayInterval:5000,
105            autoPlay:true
106        });
107    });
108    $("#mod-hd").each(function(){
109        var $this=$(this);
110        var langItems=$this.find(".lang a");
111        var lang= $.TVB.getQueryParam("lang") || $.cookie("lang") || "en";
112        langItems.click(function(){
113            var _self=$(this);
114            if(!_self.hasClass(lang+"-current")){
115            	$.cookie("lang",_self.attr("lang"),{path:"/"});
116				window.location.href=$.TVB.updateQueryParam('lang',_self.attr("lang"));
117                //window.location.reload();
118            } else {
119				$('.lang').toggleClass('open');
120			}
121        });
122        langItems.filter("[lang='"+lang+"']").addClass(lang+"-current");
123        var $keyword=$this.find('[name=keyword]');
124        var placeholder=$keyword.attr('placeholder');
125        $keyword.val(placeholder)
126                .removeAttr('placeholder')
127                .focus(function(){
128                    $(this).val('');
129                })
130                .blur(function(){
131                    if(!$keyword.val())
132                    {
133                         $(this).val(placeholder);
134                    }
135                });
136        /*
137        $('.top-nav-center').each(function(){
138        	if($(this).width()<90)
139        		$(this).width(90);
140
141        });
142        */
143    });
144
145    $("#mod-calendar").each(function(){
146        var $this=$(this);
147        var monthData={};
148        var eventsUI=$this.find(".event-list");
149        var calendar=$this.find(".calendar").datepicker({
150            autoSize: true,
151            showOtherMonths: true,
152            onChangeMonthYear:function(year,month,inst){
153                getData(year,month);
154            },
155            onSelect:function(dateText,inst){
156                getData(inst.selectedYear,inst.selectedMonth+1,inst.selectedDay);
157            }
158        });
159        var getData=function(year,month,day){
160            day && eventsUI.html("<div class='loading'>Loading...</div>");
161            if(!monthData[year+"-"+month]){
162                $.get("/api/calendar_events?random="+Math.random(),{year:year,month:month},function(data){
163                    if(data.status==1){
164                        monthData[year+"-"+month]=data.count>0?data.events:{};
165                        lightHeightEvent(monthData[year + "-" + month]);
166                        day && showEvent(year,month,day);
167                    }
168                },"json");
169            }else{
170                day && showEvent(year,month,day);
171                lightHeightEvent(monthData[year + "-" + month]);
172            }
173        };
174        var lightHeightEvent=function(data){
175            if(data)
176            setTimeout(function(){
177                var daysUI=$this.find(".ui-datepicker-calendar a.ui-state-default");
178                /*for (var key in data) {
179                    daysUI.filter(":contains('"+key+"')").addClass("event");
180                }*/
181                daysUI.each(function(){
182                    var _self=$(this);
183                    data[_self.text()] && _self.addClass("event").parent().addClass("event-td");
184                });
185            },0);
186        };
187        var showEvent=function(year,month,day){
188            var data=monthData[year+"-"+month][day];
189            if(data){
190                //console.log(data);
191                var str="<ul>";
192                for (var i = 0; i < data.length; i++) {
193                    var obj = data[i];
194                    str+="<li>"+obj.date+"<br>";
195                    //str+="<a href='"+obj.link+"'>"+obj.title+"</a>";
196                    str+=obj.title;
197                    str+="</li>";
198                }
199                str+="</ul>";
200                eventsUI.html(str);
201            }else{
202                eventsUI.html("");
203            }
204        };
205        var now=new Date();
206        getData(now.getFullYear(),now.getMonth()+1,now.getDate());
207    });
208
209
210
211    $("#mod-article-list").each(function(){
212        var $this=$(this);
213        //var articleCat=$("#mod-left-menu .menu-list").find();
214        $this.find(".pagination").myPagination();
215    });
216    $("#mod-feature-photo").each(function(){
217        var $this=$(this);
218        var bg=$this.find(".bg");
219        var text=$this.find(".text");
220        bg.height(text.height());
221    });
222
223	 $("#mod-search").each(function(){
224        var $this=$(this);
225        $this.find(".pagination").myPagination();
226        $this.find('ul.search_result li').click(function(){
227        	var url = $(this).find('a').attr('href');
228			if (url != undefined) {
229				window.open(url,"_blank");
230			}
231        });
232
233	  });
234
235	$('.mobile-menu-toggle').click(function(){
236		$('#mod-hd').toggleClass('open');
237	});
238
239	responsive_ui();
240
241	$(window).resize(function(){
242		responsive_ui();
243	});
244});
245
246
247
248
249
250
251
252
253
254
255
256
257

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.