init: 项目初始代码

This commit is contained in:
2026-10-14 14:00:29 +08:00
commit cc434cf89f
464 changed files with 66984 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
/**
* 获取访问者IP
*/
getVisitorIp = function () {
let ip = '127.0.0.1'
$.ajax({
type: 'get',
url: 'https://get.geojs.io/v1/ip.json',
data: {},
dataType: 'json',
async:false,
}).done(function (responseData) {
// console.log(responseData)
if (responseData.ip) {
ip = responseData.ip
} else {
ip = '127.0.0.1'
}
});
return ip;
}
const visitIp = getVisitorIp()
/**
* 请求开始
*/
const RequestUrl = "/index/base/submitActionLog"
// 图片选择器,记录图片点击的
const imgAction = $("[log='img']");
const aAction = $("[log='a']");
imgAction.click(function ($this){
// console.log('click-img',$this)
// console.log(window.location.href)
const content = $this.target.outerHTML
// console.log(content)
actionSub($this,1,content,visitIp)
});
imgAction.dblclick(function ($this){
const content = $this.target.outerHTML
actionSub($this,2,content,visitIp)
});
// a标签行为监控
aAction.click(function ($this){
const content = $this.target.parentElement.outerHTML
actionSub($this,1,content,visitIp)
});
// a标签行为监控
aAction.dblclick(function ($this){
const content = $this.target.parentElement.outerHTML
actionSub($this,2,content,visitIp)
});
/**
* 日志请求提交
*/
function actionSub(obj,clickNum,content,visitIp) {
$.ajax({
type: 'POST',
url: RequestUrl,
data: {
'url' : window.location.href, /*访问页*/
'refer' : obj.src, /*访问来源*/
'click' : clickNum, /*点击次数*/
'content' : content, /*访问内容*/
'ip' : visitIp, /*访客IP*/
'start_time' : obj.timeStamp, /*点击时间*/
'drive' : window.navigator.userAgent.toLowerCase(), /*PC OR 移动端*/
// 'system' : window.navigator.userAgent.toLowerCase(), /*设备系统*/
// 'brower' : window.navigator.userAgent.toLowerCase(), /*浏览器*/
// 'models' : window.navigator.userAgent.toLowerCase(), /*设备型号*/
'date_time' : (new Date()).valueOf() /*生成时间*/
},
dataType: 'json',
// success: function (json) {
// console.log(json);
// }
});
}

View File

@@ -0,0 +1,73 @@
function SelectTag(t) {
this.child = t.child || ".default",
this.over = t.over || "on",
this.all = t.all || ".all",
this.init()
}
$.extend(SelectTag.prototype, {
init: function() {
var t = this;
t._bindEvent(),
t._select()
},
_bindEvent: function() {
var t = this;
$(t.child).click(function(e) {
e.preventDefault();
var i = window.location.href
, n = $(this).attr("rel")
, r = $(this).attr("name");
$(this).hasClass(t.over) || (window.location.href = t._changeURLPar(i, r, n))
}),
$(t.all).click(function(e) {
e.preventDefault();
var i = window.location.href
, n = $(this).attr("name");
$("[name=" + n + "]").removeClass(t.over),
$(this).addClass(t.over),
window.location.href = t._delUrlPar(i, n)
})
},
_delUrlPar: function(t, e) {
var n = "";
if (t.indexOf("?") == -1)
return t;
n = t.substr(t.indexOf("?") + 1);
var r = ""
, a = "";
if (n.indexOf("&") != -1) {
r = n.split("&");
for (i in r)
r[i].split("=")[0] != e && (a = a + r[i].split("=")[0] + "=" + r[i].split("=")[1] + "&");
return t.substr(0, t.indexOf("?")) + "?" + a.substr(0, a.length - 1)
}
return r = n.split("="),
r[0] == e ? t.substr(0, t.indexOf("?")) : t
},
_changeURLPar: function(t, e, i) {
var n = this
, r = e + "=([^&]*)"
, a = e + "=" + i
, s = encodeURI(n._getQueryString(e));
return t.match(r) ? t = t.replace(s, i) : t.match("[?]") ? t + "&" + a : t + "?" + a
},
_getQueryString: function(t) {
var e = new RegExp("(^|&)" + t + "=([^&]*)(&|$)","i")
, i = window.location.search.substr(1).match(e);
return null != i ? decodeURI(i[2]) : null
},
_select: function() {
var t = this
, e = window.location.href;
$(t.child).each(function() {
var i = $(this).attr("name") + "=" + $(this).attr("rel")
, n = new RegExp(encodeURI(i),"g");
if (n.test(e)) {
$(this).addClass(t.over);
var r = $(this).attr("name");
$("[name=" + r + "]").eq(0).removeClass(t.over)
} else
$(this).removeClass(t.over)
})
}
});

File diff suppressed because it is too large Load Diff

1
public/assets/js/main.js Normal file

File diff suppressed because one or more lines are too long

117
public/assets/js/plugins/plugins.min.js vendored Normal file

File diff suppressed because one or more lines are too long

19
public/assets/js/vendor/vendor.min.js vendored Normal file

File diff suppressed because one or more lines are too long