|
|
@ -1,34 +1,86 @@
|
|
|
|
var launchButtonFlag=false;
|
|
|
|
var launchButtonFlag=false;
|
|
|
|
$("#launchButton").click(function() {
|
|
|
|
var titleTimer,titleNum=0;
|
|
|
|
if (launchButtonFlag) return;
|
|
|
|
var originTitle = document.title;
|
|
|
|
var width=$(window).width();
|
|
|
|
if (typeof GOFLY_URL=="undefined"){
|
|
|
|
if(width<768){
|
|
|
|
var GOFLY_URL="https://gofly.sopans.com";
|
|
|
|
window.open(GOFLY_URL+'/chatIndex?kefu_id='+GOFLY_KEFU_ID+'&refer='+window.document.title);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
if (typeof GOFLY_KEFU_ID=="undefined"){
|
|
|
|
}
|
|
|
|
var GOFLY_KEFU_ID="";
|
|
|
|
layer.open({
|
|
|
|
}
|
|
|
|
type: 2,
|
|
|
|
if (typeof GOFLY_BTN_TEXT=="undefined"){
|
|
|
|
title: "Chat with me",
|
|
|
|
var GOFLY_BTN_TEXT="Chat with me";
|
|
|
|
closeBtn: 1, //不显示关闭按钮
|
|
|
|
}
|
|
|
|
shade: [0],
|
|
|
|
dynamicLoadCss(GOFLY_URL+"/static/css/gofly-front.css");
|
|
|
|
area: ['520px', '530px'],
|
|
|
|
if (typeof $!="function"){
|
|
|
|
offset: 'rb', //右下角弹出
|
|
|
|
dynamicLoadJs("https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js",function () {
|
|
|
|
anim: 2,
|
|
|
|
dynamicLoadJs("https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js",function () {
|
|
|
|
content: [GOFLY_URL+'/chatIndex?kefu_id='+GOFLY_KEFU_ID+'&refer='+window.document.title, 'yes'], //iframe的url,no代表不显示滚动条
|
|
|
|
clickBtn();
|
|
|
|
end: function(){
|
|
|
|
});
|
|
|
|
launchButtonFlag=false;
|
|
|
|
});
|
|
|
|
$(".launchButton").show();
|
|
|
|
}else{
|
|
|
|
|
|
|
|
dynamicLoadJs("https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js",function () {
|
|
|
|
|
|
|
|
clickBtn();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clickBtn(){
|
|
|
|
|
|
|
|
$('body').append('<div id="launchButton" class="launchButton animateUpDown"><div class="launchButtonText">'+GOFLY_BTN_TEXT+'</div></div>');
|
|
|
|
|
|
|
|
$("#launchButton").on("click",function() {
|
|
|
|
|
|
|
|
if (launchButtonFlag) return;
|
|
|
|
|
|
|
|
var width=$(window).width();
|
|
|
|
|
|
|
|
if(width<768){
|
|
|
|
|
|
|
|
window.open(GOFLY_URL+'/chatIndex?kefu_id='+GOFLY_KEFU_ID+'&refer='+window.document.title);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
layer.open({
|
|
|
|
|
|
|
|
type: 2,
|
|
|
|
|
|
|
|
title: GOFLY_BTN_TEXT,
|
|
|
|
|
|
|
|
closeBtn: 1, //不显示关闭按钮
|
|
|
|
|
|
|
|
shade: [0],
|
|
|
|
|
|
|
|
area: ['520px', '530px'],
|
|
|
|
|
|
|
|
offset: 'rb', //右下角弹出
|
|
|
|
|
|
|
|
anim: 2,
|
|
|
|
|
|
|
|
content: [GOFLY_URL+'/chatIndex?kefu_id='+GOFLY_KEFU_ID+'&refer='+window.document.title, 'yes'], //iframe的url,no代表不显示滚动条
|
|
|
|
|
|
|
|
end: function(){
|
|
|
|
|
|
|
|
launchButtonFlag=false;
|
|
|
|
|
|
|
|
$(".launchButton").show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
launchButtonFlag=true;
|
|
|
|
|
|
|
|
$(".launchButton").hide();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
launchButtonFlag=true;
|
|
|
|
$("body").click(function () {
|
|
|
|
$(".launchButton").hide();
|
|
|
|
clearTimeout(titleTimer);
|
|
|
|
});
|
|
|
|
document.title = originTitle;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function dynamicLoadCss(url) {
|
|
|
|
|
|
|
|
var head = document.getElementsByTagName('head')[0];
|
|
|
|
|
|
|
|
var link = document.createElement('link');
|
|
|
|
|
|
|
|
link.type='text/css';
|
|
|
|
|
|
|
|
link.rel = 'stylesheet';
|
|
|
|
|
|
|
|
link.href = url;
|
|
|
|
|
|
|
|
head.appendChild(link);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function dynamicLoadJs(url, callback) {
|
|
|
|
|
|
|
|
var head = document.getElementsByTagName('head')[0];
|
|
|
|
|
|
|
|
var script = document.createElement('script');
|
|
|
|
|
|
|
|
script.type = 'text/javascript';
|
|
|
|
|
|
|
|
script.src = url;
|
|
|
|
|
|
|
|
if(typeof(callback)=='function'){
|
|
|
|
|
|
|
|
script.onload = script.onreadystatechange = function () {
|
|
|
|
|
|
|
|
if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete"){
|
|
|
|
|
|
|
|
callback();
|
|
|
|
|
|
|
|
script.onload = script.onreadystatechange = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
head.appendChild(script);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var titleTimer,titleNum=0;
|
|
|
|
|
|
|
|
var originTitle = document.title;
|
|
|
|
|
|
|
|
function flashTitle() {
|
|
|
|
function flashTitle() {
|
|
|
|
titleNum++;
|
|
|
|
titleNum++;
|
|
|
|
if (titleNum == 3) {
|
|
|
|
if (titleNum >=3) {
|
|
|
|
titleNum = 1;
|
|
|
|
titleNum = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (titleNum == 1) {
|
|
|
|
if (titleNum == 1) {
|
|
|
@ -49,3 +101,4 @@ window.onfocus = function () {
|
|
|
|
clearTimeout(titleTimer);
|
|
|
|
clearTimeout(titleTimer);
|
|
|
|
document.title = originTitle;
|
|
|
|
document.title = originTitle;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|