PageSourceSearch

https://saili.science/js/custom.js

js saili.science collected 2026-09-25 22:37:43 UTC 1,385 bytes, 40 lines download raw bytes

1// 对 Next 主题进行定制
2
3// 函数: html 中去掉 某 tag 最后那一次出现
4var rmLastElm = function(text, selector) {
5    var wrapped = $("<div>" + text + "</div>");
6    wrapped.find(selector).last().remove();
7    return wrapped.html();
8}
9// 弹出 tip 显示 脚注
10var $fRef = $(".footnoteRef");
11for(let i=0; i<$fRef.length; i++) {
12	var sup = $fRef.children("sup")[i];		//work reliably as long as there's exactly one sup per footnotRef
13//	var sup = $fRef[i].children("sup");		//a classic Dom Element, so it doesn't have any children method
14	sup.onmouseover = function(event) {
15		$('.footnoteTip').remove();
16		var pTip = document.createElement('div');
17		pTip.className = 'footnoteTip';		// CSS
18		pTip.innerHTML = rmLastElm(document.getElementById($fRef[i].getAttribute("href").substring(1)).innerHTML,"a");
19		document.body.appendChild(pTip);
20
21		var posLeft = event.pageX - 180;
22		if (posLeft<0) posLeft = 20;
23		var posTop = event.pageY + 20;
24		var od = $('.footnoteTip');
25		var oH = od.outerHeight();
26		var oW = od.outerWidth();
27		if(posTop + oH - window.pageYOffset > $(window).height()) 	posTop = posTop - oH -40;
28		if (posLeft + oW > $(window).width()) posLeft = $(window).width() - oW -20;	//NexT.Mist pageXOffset=0
29		pTip.style.left = posLeft + 'px';
30		pTip.style.top = posTop + 'px';
31
32	};
33
34	sup.onmouseout = function(event) {
35		$('.footnoteTip').remove();
36	};
37}
38
39
40

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.