PageSourceSearch

https://www.studyinhongkong.edu.hk/en/custom/custom.js?v=1790958747

js studyinhongkong.edu.hk collected 2026-10-02 16:32:57 UTC 6,392 bytes, 186 lines download raw bytes

1$(function() {
2
3	if (window.location.href.indexOf('#skiptocontent') == -1) {
4		$('a.skiptocontent').attr('href', window.location.href+'#skiptocontent');
5	} else {
6		$('a.skiptocontent').attr('href', window.location.href);
7	}
8	if ($('#ms-container').length > 0) {
9		$('#ms-container').first().before('<a name="skiptocontent" id=""skiptocontent></a>');
10	} else if ($('.t3-sidebar.t3-sidebar-4.span9').length > 0) {			
11		$('.t3-sidebar.t3-sidebar-4.span9').first().before('<a name="skiptocontent" id="skiptocontent"></a>');
12	} else if ($('article').length > 0) {			
13		$('article').first().before('<a name="skiptocontent" id="skiptocontent"></a>');
14	} else if ($('#t3-content .wrap').length > 0) {			
15		$('#t3-content .wrap').first().before('<a name="skiptocontent" id="skiptocontent"></a>');
16	}
17
18	$($("#custom-search")).keypress(function(e) {
19		if(e.which == 13) { do_search(); }
20	});
21
22/*	$(document).on('focus', 'input, textarea', function() {
23		setTimeout(function() {
24			window.scrollTo(document.body.scrollLeft, document.body.scrollTop);
25		}, 0);
26	});*/
27	
28	// if(tectom_responsive) $(".wrap.t3-mainnav.navbar-collapse-fixed-top").css("position", "absolute");
29
30	// create <img> logo for printing layout
31	$(".logo-image").append('<img src="images/studyinhk-logo.png" title="Study in Hong Kong logo">');
32	$('.mod-languages').remove();
33	$('#system-message-container').remove();
34
35	$.preload(
36		'custom/studyinhk-slider/images/1.jpg',
37		'custom/studyinhk-slider/images/2.jpg',
38		'custom/studyinhk-slider/images/3.jpg',
39		'custom/studyinhk-slider/images/cityu.jpg',
40		'custom/studyinhk-slider/images/hkbu.jpg',
41		'custom/studyinhk-slider/images/cuhk.jpg',
42		'custom/studyinhk-slider/images/eduhk.jpg',
43		'custom/studyinhk-slider/images/polyu.jpg',
44		'custom/studyinhk-slider/images/hkust.jpg'
45	);
46	
47	if(parseInt(readCookie("fontsize"))==0) textSize(0);
48	if(parseInt(readCookie("fontsize"))==1) textSize(1);
49	if(parseInt(readCookie("fontsize"))==-1) textSize(-1);
50	
51	$(document).on('change', '.switcher select', function() {
52		document.location.href = '/'+$(this).val();
53	});
54	// clone language switcher to mobile menu
55	var switcher = $('.languageswitcherload .switcher').html();
56	$('#off-canvas-nav .main-nav > li:first-child').after('<div class="switcher">'+switcher+'</div>');
57
58	//handling mobile menu//
59	$(document).ready(function() {
60		$('#off-canvas-nav .main-nav .dropdown a.dropdown-toggle').attr('href', 'javascript:');
61		$(document).on('mouseup', '.studyinhk-mobile-menu-category', function(e) {
62			$(this).closest('li.dropdown').toggleClass('opened');
63		});
64	});
65	//handling mobile menu//
66
67	//handling institutions list//
68	$(document).ready(function() {
69		$(document).on('mouseup', '.studyinhk-institutions-list h3', function(e) {
70			$(this).closest('.studyinhk-institutions-list').toggleClass('opened');
71		});
72	});
73	//handling institutions list//
74
75	// add alt text from title for img
76	$(document).ready(function() {
77		$('img').each(function() {
78			if ($(this).attr('alt') == undefined && $(this).attr('title') != undefined) {
79				$(this).attr('alt', $(this).attr('title'));
80			} else if ($(this).attr('alt') != undefined && $(this).attr('title') == undefined) {
81				$(this).attr('title', $(this).attr('alt'));
82			} else if ($(this).attr('alt') == undefined && $(this).attr('title') == undefined) {
83				$(this).attr('title', '');
84				$(this).attr('alt', '');
85			}
86		});
87	});
88	// add alt text from title for img
89
90	// student voice table (title / scope)
91	$('.stds-student-left, .stds-student-right').each(function() {
92		$(this).find('td.stds-student-info').attr('scope', 'col');
93		$(this).attr('title', $(this).find('.stds-student-name').text());
94	});
95	// student voice table (title / scope)
96
97	// special announcement
98	$(document).ready(() => {
99		const shownAnnouncement = readCookie('shown-announcement-en');
100		if (shownAnnouncement !== 'shown') {
101			$('.special-announcement').addClass('show');
102		}
103	});
104	$(document).on('click', '.announcement-close', () => {
105		$('.special-announcement').removeClass('show');
106		document.cookie = 'shown-announcement-en=shown';
107	});
108	$(document).on('click', '.announcement-close', () => {
109		$('.special-announcement').removeClass('show');
110		document.cookie = 'shown-announcement-en=shown';
111	});
112
113});
114
115$(window).on('load', function() {
116	$(".loading").hide(0);
117	$("#t3-mainbody").fadeIn(200);
118});
119
120function gototop() {
121	window.scrollTo(0,0);
122}
123
124var ie = (function(){
125    var undef, v = 3, div = document.createElement('div');
126    while (
127        div.innerHTML = '<!--[if gt IE '+(++v)+']><i></i><![endif]-->',
128        div.getElementsByTagName('i')[0]
129    );
130    return v> 4 ? v : undef;
131}());
132function msieversion() {
133	var ua = window.navigator.userAgent;
134	var msie = ua.indexOf("MSIE ");
135
136	if (msie > 0)      // If Internet Explorer, return version number
137		return (parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))));
138	else                 // If another browser, return 0
139		return '';
140}
141
142
143function do_search() {
144	var query = $("#custom-search").val();
145	window.open("http://search.gov.hk/result?gp1=studyinhongkong_home&gp0=studyinhongkong_home&web=this&query="+query+"&tpl_id=OSP&ui_charset=utf-8&ui_lang=en", "_blank");
146	window.focus();
147}
148
149function detectmob() { 
150	if(	 		  navigator.userAgent.match(/Android/i)
151				|| navigator.userAgent.match(/webOS/i)
152				|| navigator.userAgent.match(/iPhone/i)
153				|| navigator.userAgent.match(/iPad/i)
154				|| navigator.userAgent.match(/iPod/i)
155				|| navigator.userAgent.match(/BlackBerry/i)
156				|| navigator.userAgent.match(/Windows Phone/i)
157	) {
158		return true;
159	} else {
160		return false;
161	}
162}
163
164var fontsize = 0;
165function textSize(size) {
166	document.cookie = "fontsize="+size;
167	resizeText(size);
168	fontsize = size;
169}
170
171function resizeText(action) {
172	if(action==1) $("body").css("font-size", "100%");
173	if(action==0) $("body").css("font-size", "85%");
174	if(action==-1) $("body").css("font-size", "70%");
175}
176
177function readCookie(name) {
178    var nameEQ = name + "=";
179    var ca = document.cookie.split(';');
180    for(var i=0;i < ca.length;i++) {
181        var c = ca[i];
182        while (c.charAt(0)==' ') c = c.substring(1,c.length);
183        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
184    }
185    return null;
186}

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.