Provides various official and user-released code examples and code reference. You are welcome to exchange and learn about the customer service plug-ins, and collect instant messaging tools such as qq, trademanager, skype, Baidu hi, and msn, you can also add supported communication tools by yourself.
The customer service plug-in integrates qq, trademanager, skype, Baidu hi, msn, and other instant messaging tools. You can also add supported communication tools by yourself, which are simple and easy to use. My blog http://www.qiling.org
Script
// Online customer service plug-in powered by casejs minimalistic http://www.mlrzw.cn
Function CaseService (caseServiceConfig ){
This. config = caseServiceConfig;
This. elementId = this. config. elementId;
This. tpl = {
'Qq ':{
'Href ': 'http: // wpa.qq.com/msgrd? V = 3 & uin ={# account #}& site = qq & menu = yes ',
'Img ': 'http: // wpa.qq.com/pa? P = 2: {# account #}:{# style #}& time = {# rand #}'
}, 'Wangwang ':{
'Href ': 'http: // www.taobao.com/webww/ww.php? Ver = 3 & touid = {# account #}& siteid = cntaobao & status = {# style #}& charset = UTF-8 ',
'Img ': 'http: // amos.alicdn.com/online.aw? V = 2 & uid = {# account #}& site = cntaobao & s = 1 & charset = UTF-8'
}, 'Skype ':{
'Href ': 'skype: {# account #}? Call ',
'Img ': 'http: // mystatus.skype.com/smallclassic/?account= #}'
}, 'Baiduhi ':{
'Href ': 'Baidu: // message /? Id = {# account #}',
'Img ': 'http: // tieba.baidu.com/tb/img/hi/hiOnline.gif'
}, 'Msn ':{
'Href ': 'msnim: chat? Contact = {# account #}',
'Img ': 'http: // tieba.baidu.com/tb/img/hi/hiOnline.gif'
}
};
// Create html
This. buildHtml ();
// Set to close
Var that = this;
Document. getElementById (this. elementId + '_ sbtnclose'). onclick = function (){
That. hide ();
};
// Set to open
Document. getElementById (this. elementId + '_ sBtnOpenArea'). onclick = function (){
That. show ();
};
// Assign an html object to element
This. element = document. getElementById (this. config. elementId );
// Determine whether to display
This. config. isOpen? This. show (): this. hide ();
// The final scroll position
This. lastScrollY = 0;
// Scroll
This. slide ();
}
// Display the floating window
CaseService. prototype. show = function (){
Document. getElementById (this. elementId + "_ sBtnOpenArea"). style. display = 'none ';
Document. getElementById (this. elementId + "_ serviceWin"). style. display = 'block ';
};
// Hide the floating window
CaseService. prototype. hide = function (){
Document. getElementById (this. elementId + "_ serviceWin"). style. display = 'none ';
Document. getElementById (this. elementId + "_ sBtnOpenArea"). style. display = 'block ';
// Disable the cancel event and clear the dom if the event is hidden.
If (this. config. closeAsHide = false ){
If (this. interval ){
Window. clearInterval (this. interval );
}
// Clear the dom
This. element. innerHTML = '';
}
};
// Scroll the floating window
CaseService. prototype. slide = function (){
// Automatically set scheduled events
If (! This. interval ){
Var that = this;
This. interval = window. setInterval (function (){
That. slide ();
}, 1 );
}
// Obtain the distance from the top
If (document.doc umentElement & document.doc umentElement. scrollTop ){
Var diffY = document.doc umentElement. scrollTop;
} Else {
Var diffY = document. body. scrollTop
}
Var percent =. 1 * (diffY-this. lastScrollY );
Percent = (percent> 0 )? Math. ceil (percent): Math. floor (percent );
This. element. style. top = parseInt (this. element. style. top) + percent + "px ";
This. lastScrollY + = percent;
};
CaseService. prototype. buildHtml = function (){
// Set the Close event
Var accountList = '';
For (I = 0; I <this. config. accountArray. length; I ++ ){
AccountList + = (function (){/*
{# Label #}
*/}. ToString (). replace (/^. +? \ * | \\(? = \/) | \ *. +? $/Gi ,""))
// The Link and status image must be replaced at the front.
. Replace (/{# href #}/g, this. tpl [this. config. accountArray [I]. type]. href)
. Replace (/{# img #}/g, this. tpl [this. config. accountArray [I]. type]. img)
// Replace other parameters
. Replace (/{# label #}/ g, this. config. accountArray [I]. label)
. Replace (/{# account #}/ g, this. config. accountArray [I]. account)
. Replace (/{# style #}/ g, this. config. accountArray [I]. style)
. Replace (/{# tip #}/ g, this. config. accountArray [I]. tip)
. Replace (/{# rand #}/g, this. config. accountArray [I]. rand );
};
Var css = (function (){/*
*/}. ToString (). replace (/^. +? \ * | \\(? = \/) | \ *. +? $/Gi, ""). replace (/{# cssColor #}/ g, this. config. color );
Var tpl = (function (){/*
+
{# CloseTitle #}
{# OpenTitle #}
×
{# AccoundList #}
{# Other #}
*/}. ToString (). replace (/^. +? \ * | \\(? = \/) | \ *. +? $/Gi ,""));
// Splice Html
ServiceWinTpl = css + tpl
. Replace (/{# elementId #}/g, this. config. elementId)
. Replace ('{# other #}', this. config. other)
. Replace ('{# accoundList #}', accountList)
. Replace ('{# width #}', this. config. width)
. Replace ('{# style #}', this. config. style)
. Replace ('{# closeTitle #}', this. config. closeTitle)
. Replace ('{# openTitle #}', this. config. openTitle );
Document. write (serviceWinTpl );
};
// Online customer service plug-in powered by casejs
New CaseService ({
"ElementId": "myServiceWin ",
"Color": "#266ed2 ",
"OpenTitle": "customer service center ",
"CloseTitle": "connection
System
Me
",
"Style": "right: 0px; top: 180px; position: absolute ;",
"Width": "width: 170px ;",
"IsOpen": "true ",
"CloseAsHide": "true ",
"Other": "Service Hotline
0546-8238915 ",
"AccountArray ":[
{
"Type": "qq ",
"Label": "online customer service :",
"Account": "2095128673 ",
"Tip": "Customer Service is currently online. Please contact me ",
"Style": "1"
},
{
"Type": "qq ",
"Label": "online customer service :",
"Account": "1113635625 ",
"Tip": "Customer Service online ",
"Style": "1"
},
{
"Type": "qq ",
"Label": "technology QQ :",
"Account": "781787584 ",
"Tip": "click to contact me ",
"Style": "7"
},
{
"Type": "wangwang ",
"Label": "technology trademanager :",
"Account": "colorful ",
"Tip": "click to contact me ",
"Style": "1"
},
{
"Type": "msn ",
"Label": "technology MSN :",
"Account": "Wang reizhi ",
"Tip": "click to contact me ",
"Style": "0"
},
{
"Type": "skype ",
"Label": "Skype :",
"Account": "15154625521 ",
"Tip": "Please contact me online ",
"Style": "0"
}
]
});
Script
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB