PageSourceSearch

https://www.hketousa.gov.hk/js/home.js?v=2.0

js hketousa.gov.hk collected 2026-10-02 19:10:14 UTC 3,116 bytes, 100 lines download raw bytes

1function getNews(){
2    $.ajax({
3        type: "GET",
4        url: "data/news.xml?r=" + Math.floor(Math.random() * 101),
5        dataType: "xml",
6        cache: false,
7        success: function(xml) {
8        	var count = 0;
9            $(xml).find('news').each(function(i){
10            	count++;
11            	//Limit how many news show in the home.
12            	/*if(count <= 10){*/
13              var link = $(this).find('link').text();
14              var linkType = "";
15              if(link) {
16                linkType = $(this).find('link').attr('type');
17              }
18
19              var imgLink = $(this).find('imagelink').text();
20              var imgLinkType = "";
21              if(imgLink) {
22                imgLinkType = $(this).find('imagelink').attr('type');
23              }
24	            	
25	            	var data = {
26	            		id: $(this).find('id').text(),
27	            		title: $(this).find('title').text(),
28	            		source: $(this).find('source').text(),
29	            		date: $(this).find('date').text(),
30		            	lead: $(this).find('lead').html(),
31		            	image: $(this).find('cover').text(),
32		            	row: i
33	            	};
34	            	
35                if(link && link !== ''){
36                  data.link = link;
37                  data.linkType = linkType;
38                }
39                if(imgLink && imgLink !== ''){
40                  data.imgLink = imgLink;
41                  data.imgLinkType = imgLinkType;
42                }
43                  
44	            	if(isIE()){
45	            		data.lead = $(this).find('lead').text();
46	            	}
47					
48                $('#newTemplate').tmpl(data).appendTo('#newsContainer');
49				      /*}*/
50            });
51        },
52        error: function() {
53            console.warn('ERROR');
54        }
55    });
56}
57
58
59function goToViewAll(){
60	var pathname = window.location.pathname;
61	var origin = window.location.origin;
62	var replaceIndex = pathname.replace("index.html", "");
63	window.location.href= origin + replaceIndex + 'archives.html';
64}
65
66function goToDetail(id){
67	var pathname = window.location.pathname;
68	var origin = window.location.origin;
69	var replaceIndex = pathname.replace("index.html", "");
70	window.location.href= origin + replaceIndex + 'detail.html?id=' + id;
71}
72
73function closePopup(){
74	$("#popupModal").modal('hide');
75}
76
77$(document).ready(function(){
78  getNews();
79  getAlerts();
80  $(".bottomMore").click(function(){ goToViewAll() });
81});
82
83
84/* VIDEO */
85document.addEventListener("DOMContentLoaded", function () {
86  var videoModal = document.getElementById("videoModal");
87  var videoFrame = document.getElementById("videoFrame");
88
89  videoModal.addEventListener("show.bs.modal", function (event) {
90      var button = event.relatedTarget;
91      var videoId = button.getAttribute("data-src");
92      if (videoId) {
93          videoFrame.src = "https://www.youtube.com/embed/" + videoId + "?autoplay=1";
94      }
95  });
96
97  videoModal.addEventListener("hidden.bs.modal", function () {
98      videoFrame.src = "";
99  });
100});

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.