{"size": 1705, "ext": "js", "max_stars_repo_path": "js/SiteRunningTime.js", "max_stars_repo_name": "tsukiikekaoru/SiteRunningTime", "max_stars_repo_stars_event_min_datetime": "2018-02-02T07:45:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T06:32:52.000Z", "max_issues_repo_path": "js/SiteRunningTime.js", "max_issues_repo_name": "tsukiikekaoru/SiteRunningTime", "max_issues_repo_issues_event_min_datetime": "2018-03-18T07:41:40.000Z", "max_issues_repo_issues_event_max_datetime": "2019-09-30T09:18:57.000Z", "max_forks_repo_path": "js/SiteRunningTime.js", "max_forks_repo_name": "tsukiikekaoru/SiteRunningTime", "max_forks_repo_forks_event_min_datetime": "2020-04-05T17:00:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T06:37:32.000Z"}
{"max_stars_count": 20, "max_issues_count": 2, "max_forks_count": 6, "avg_line_length": 34.1, "max_line_length": 93, "alphanum_fraction": 0.6651026393}
var SiteRunningTime = function(config)
{
	var node = document.createElement("span");
	node.innerHTML = config.startTimeText;
	node.className = "SiteRunningTime";
	document.getElementById("footer").appendChild(node);

	var _selector = function(selector)
	{
		return document.querySelector(selector);
	}
	var refreshTime = function(startTime)
	{
		//fix bug#2 在ios中使用时间戳加减使用 Data.parse()转换
		var s1 = Date.parse(startTime.replace(/-/g, "/")),
		s2 = new Date(),
		runTime = parseInt((s2.getTime() - s1) / 1000);

		var year = month = day = hour = minute = second = 0;
		
		year = Math.floor(runTime / 86400 / 365);
		runTime = runTime % (86400 * 365);
		month = Math.floor(runTime / 86400 / 30);
		runTime = runTime % (86400 * 30);
		day = Math.floor(runTime / 86400);
		runTime = runTime % 86400;
		hour = Math.floor(runTime / 3600);
		runTime = runTime % 3600;
		minute = Math.floor(runTime / 60);
		runTime = runTime % 60;
		second = runTime;

		var _year = _month = _day = _hour = _minute = _second = null;
		if((_year = _selector(".SiteRunningTime > .year")) != null) _year.innerText = year;
		if((_month = _selector(".SiteRunningTime > .month")) != null) _month.innerText = month;
		if((_day = _selector(".SiteRunningTime > .day")) != null) _day.innerText = day;
		if((_hour = _selector(".SiteRunningTime > .hour")) != null) _hour.innerText = hour;
		if((_minute = _selector(".SiteRunningTime > .minute")) != null) _minute.innerText = minute;
		if((_second = _selector(".SiteRunningTime > .second")) != null) _second.innerText = second;
	};
	if(config.autoRefresh == "1")
	{
		setInterval(function()
			{
				refreshTime.call(null,config.startTime);
			}, 1000);
	}
	refreshTime(config.startTime);
};
