PageSourceSearch

https://www.hbfu.edu.cn/resources/js/Date.js

js hbfu.edu.cn collected 2026-10-05 23:15:56 UTC 2,303 bytes, 84 lines download raw bytes

1Date.prototype.format = function(format){
2    var o =
3    {
4        "M+" : this.getMonth()+1, //month
5        "d+" : this.getDate(),    //day
6        "h+" : this.getHours(),   //hour
7        "m+" : this.getMinutes(), //minute
8        "s+" : this.getSeconds(), //second
9        "q+" : Math.floor((this.getMonth()+3)/3),  //quarter
10        "S" : this.getMilliseconds(), //millisecond
11        "w" : this.getDay()
12    }
13    if(/(y+)/.test(format))
14    format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
15    for(var k in o)
16    if(new RegExp("("+ k +")").test(format))
17    format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
18    return format;
19}
20// js截取字符串,中英文都能用
21// 如果给定的字符串大于指定长度,截取指定长度返回,否者返回源字符串。
22// 字符串,长度
23function cutstr(str, len) {
24	var str_length = 0;
25	var str_len = 0;
26	str_cut = new String();
27	if(str == null){
28	  return '';
29	}
30	str_len = str.length;
31	
32	for (var i = 0; i < str_len; i++) {
33		a = str.charAt(i);
34		str_length++;
35		if (escape(a).length > 4) {
36			// 中文字符的长度经编码之后大于4
37			str_length++;
38		}
39		str_cut = str_cut.concat(a);
40		if (str_length >= len) {
41			str_cut = str_cut.concat("...");
42			return str_cut;
43		}
44	}
45	// 如果给定字符串小于指定长度,则返回源字符串;
46	if (str_length < len) {
47		return str;
48	}
49}
50/**
51 * 如果超过了指定的长度,截断字符串并在其末尾添加一个省略号('...') 
52 * @param {} len  字符串长度
53 * @return {String}
54 */
55String.prototype.ellipsis = function(len) {
56	var str_length = 0;
57	var str_len = 0;
58	if(this == undefined || this == ''){
59			return '';
60	}
61	str_cut = new String();
62	str_len = this.length;
63	for (var i = 0; i < str_len; i++) {
64		a = this.charAt(i);
65		str_length++;
66		if (escape(a).length > 4) {
67			// 中文字符的长度经编码之后大于4
68			str_length++;
69		}
70		str_cut = str_cut.concat(a);
71		if (str_length >= len) {
72			str_cut = str_cut.concat("...");
73			return str_cut;
74		}
75	}
76	// 如果给定字符串小于指定长度,则返回源字符串;
77	if (str_length < len) {
78		return this;
79	}
80
81}
82
83
84

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.