增加github

pull/30/head
taoshihan1991 4 years ago
parent 512c4de4b3
commit 41be88ad78

@ -237,7 +237,7 @@
this.addOnlineUser(redata.data); this.addOnlineUser(redata.data);
//发送通知 //发送通知
let _this=this; let _this=this;
this.notify(redata.data.username, { notify(redata.data.username, {
body: "来了", body: "来了",
icon: redata.data.avator icon: redata.data.avator
}, function(notification) { }, function(notification) {
@ -293,7 +293,7 @@
this.msgList.push(content); this.msgList.push(content);
} }
//发送通知 //发送通知
this.notify(msg.name, { notify(msg.name, {
body: msg.content, body: msg.content,
icon: msg.avator icon: msg.avator
}, function(notification) { }, function(notification) {
@ -528,26 +528,6 @@
$('.chatBox').scrollTop($(".chatBox")[0].scrollHeight); $('.chatBox').scrollTop($(".chatBox")[0].scrollHeight);
}); });
}, },
notify(title, options, callback) {
// 先检查浏览器是否支持
if (!window.Notification) {
return;
}
var notification;
// 检查用户曾经是否同意接受通知
if (Notification.permission === 'granted') {
notification = new Notification(title, options); // 显示通知
} else {
var promise = Notification.requestPermission();
}
if (notification && callback) {
notification.onclick = function(event) {
callback(notification, event);
}
}
},
}, },
created: function () { created: function () {
this.getKefuInfo(); this.getKefuInfo();

@ -127,6 +127,7 @@
<a class="try" href="/docs/index.html" target="_blank">{{.Document}}</a> <a class="try" href="/docs/index.html" target="_blank">{{.Document}}</a>
<a class="try" id="visitorBtn">{{.VisitorBtn}}</a> <a class="try" id="visitorBtn">{{.VisitorBtn}}</a>
<a class="try" href="/login?lang={{.Lang}}" target="_blank">{{.AgentBtn}}</a> <a class="try" href="/login?lang={{.Lang}}" target="_blank">{{.AgentBtn}}</a>
<a class="try" href="https://github.com/taoshihan1991/go-fly" target="_blank">Github</a>
</div> </div>
<div class="copyright"> <div class="copyright">
{{.Copyright}}&copy; 2020 {{.Copyright}}&copy; 2020

@ -18,3 +18,23 @@ function getWsBaseUrl() {
} }
return url; return url;
} }
function notify(title, options, callback) {
// 先检查浏览器是否支持
if (!window.Notification) {
return;
}
var notification;
// 检查用户曾经是否同意接受通知
if (Notification.permission === 'granted') {
notification = new Notification(title, options); // 显示通知
} else {
var promise = Notification.requestPermission();
}
if (notification && callback) {
notification.onclick = function(event) {
callback(notification, event);
}
}
}
Loading…
Cancel
Save