PageSourceSearch

https://www.hketousa.gov.hk/js/alerts.js

js hketousa.gov.hk collected 2026-10-02 19:10:17 UTC 1,567 bytes, 61 lines download raw bytes

1var alerts = [];
2
3function getAlerts(){
4    $.ajax({
5        type: "GET",
6        url: "data/alerts.xml?r=" + Math.floor(Math.random() * 101),
7        dataType: "xml",
8        cache: false,
9        success: function(xml) {
10        	var count = 0;
11          $(xml).find('alert').each(function(i){
12            count++;
13            //Limit how many alerts show.
14            if(count <= 5){	            	
15              var data = {
16                id: $(this).find('id').text(),
17                title: $(this).find('title').text(),
18                text: $(this).find('text').html(),
19                image: $(this).find('image').text(),
20                row: i
21              };
22
23              if(isIE()){
24                data.text = $(this).find('text').text();
25              }
26
27              alerts.push(data);
28              $('#newAlert').tmpl(data).appendTo('#alertsContainer');
29            }else{
30              return true;
31            }
32          });
33          if(count==0) {
34            $('#alertsContainer').removeClass('pt-4').removeClass('pb-2');
35          }
36        },
37        error: function(e) {
38            console.warn('ERROR', e);
39        }
40    });
41}
42
43function closeModal(){
44	$("#alertModal").modal('hide');
45}
46
47function openAlert(id) {
48	var data = {};
49	
50	$('#alertData').html('');
51	
52   	for(var i=0;i<alerts.length;i++){
53   		if(alerts[i].id === id){
54   			data = alerts[i];
55   			break;
56   		}
57   	}
58   	
59	$('#alertTemplate').tmpl(data).appendTo('#alertData');
60	$('#alertModal').modal('show');
61}

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.