expept forfor的同义词是什么词

* 企话通公共 JS 代码
* 为悬挂代码、聊天页面等提供公共的 JS 调用
* Object 属性扩展
(function() {
function eptoneExtend(destination, source) {
for (var property in source)
destination[property] = source[property];
* Eptone 属性扩展
eptoneExtend(Object, {
eptoneExtend:
eptoneExtend
(function() {
if (window.$Eptone && window.$Eptone.initialized) {
// 防止 $Eptone 重定义
* Eptone.js
var $Eptone = {
* 标识是否已初始化
initialized: false,
* 保存浏览器信息.
Actual_Name: 名称;
Actual_Version: 版本;
Browser: {}
window.$Eptone = $E
* 检查flash版本,是否安装
* Eptone's Flash.js
$Eptone.Flash = {
install : false,
version : 0,
isIE : document.all,
isOk: false, /* if install and execute ep_vistorOk() than true */
check : function (){
if(this.isIE){
swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
}catch(ex){
this.install=
VSwf=swf.GetVariable("$version");
this.version=parseInt(VSwf.split(" ")[1].split(",")[0]);
if (navigator.plugins && navigator.plugins.length > 0){
var swf=navigator.plugins["Shockwave Flash"];
this.install=
var words = swf.description.split(" ");
for (var i = 0; i < words. ++i){
if (isNaN(parseInt(words[i])))
this.version = parseInt(words[i]);
getObject : function(movieName){
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
return document[movieName];
$Eptone.Flash.check(); // check first
* Ajax 请求处理对象.
* Eptone's AjaxScript.js
* 实现跨域访问
$Eptone.AjaxScript = function(options) {
this.options = {
language: 'javascript',
type: 'text/javascript',
charset: 'UTF-8',
noCache: true,
* if ready(readyState = 4 or 0) than prepare data.
* and you will set options here.
* if return false, than donot send ajax
prepare: false
Object.eptoneExtend(this.options, options || {});
Object.eptoneExtend($Eptone.AjaxScript.prototype, {
* 发送请求
send: function(options) {
if (this.running) // 请求中
if (this.options.prepare) {
var result = $Eptone.Function.bind(this.options.prepare, this, [options])();
if (result == false)
this.running =
var old = this.
options = Object.eptoneExtend({url: old.url}, options);
var url = options.
var nowtime = new Date().getTime();
// 添加一个回调 JSON 对象:jsoncallback
var jsonName = this.jsoncallback = "json" + // 回调函数名
url += (url.indexOf('?') > -1 ? '&' : '?') + "jsoncallback=" + jsonN
if (this.options.noCache) {
var noCache = 'noCache=' +
url += '&' + noC
var id = this.options.id || new Date().getTime();
var oldScript = document.getElementById(id);
if (oldScript && oldScript.parentNode) {
oldScript.parentNode.removeChild(oldScript);
var script = this.script = document.createElement('script');
script.id =
script.src =
script.language = this.options.
script.type = this.options.
script.charset = this.options.
document.getElementsByTagName("head")[0].appendChild(script);
script.onload = script.onreadystatechange = $Eptone.Function.bind(this.onStateChange, this);
* 请求状态处理
onStateChange: function() {
var state = this.script.readyS
if (!state || state == "loaded" || state == "interactive" || state == "complete") {
this.running =
var response = {"json": window[this.jsoncallback]};
if (!this.handleResponse(response)) {
// 异常处理
if (this.options.onHandleError) {
$Eptone.Function.bind(this.options.onHandleError, this, [response])();
if (this.options.onSuccess) {
// 处理返回信息
$Eptone.Function.bind(this.options.onSuccess, this, [response])();
* Ajax 返回信息处理
handleResponse: function(response) {
var json = response.
if (typeof json.code == "number" && json.code <= -100) {
if (json.code == -102 && $eptone) { // 访客屏蔽
$Eptone.Utils.setCookie("bother" + $eptone.userId, "true");
} catch(e) {
* Eptone's Utils.js
$Eptone.Utils = {
* 顶级域名后缀
"com","net","","","","","ac.cn","bj.cn","sh.cn","tj.cn","cq.cn",
"jl.cn","hl.cn","js.cn","zj.cn","ah.cn","fj.cn","jx.cn","sd.cn","ha.cn","hb.cn","gd.cn","gx.cn","hi.cn","sc.cn",
"gz.cn","yn.cn","xz.cn","sn.cn","gs.cn","qh.cn","nx.cn","xj.cn","tw.cn","hk.cn","mo.cn",
"he.cn","sx.cn","nm.cn","ln.cn","cn","cc","org","biz","info","mobi", "com.tw", "com.hk",
"hk","tw", "io","ac","name","pro","ws","sh","hn","edu","gov","eu","jp","travel","tv","im"],
* 获取兼容的 DocumentElement
* BackCompat:标准兼容模式关闭;CSS1Compat:标准兼容模式开启
getCompatDocElement: function() {
if (patMode == "BackCompat" || /webkit/ig.test( navigator.userAgent )) {
docEle = document.
} else {//patMode == "CSS1Compat"
docEle = document.documentE
return docE
* 生成访客ID:当前时间戳 + 五位随机数
createVistorId: function() {
var randomStr = "";
for (var i = 0; i < 5; i++) {
randomStr += Math.floor(Math.random() * 10);
return new Date().getTime() + randomS
* 获取 cookie 值
getCookie: function(sName) {
var aCookie = document.cookie.split('; ');
for (var i=0; i < aCookie. i++) {
var aCrumb = aCookie[i].split('=');
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
return '';
* 写入 cookie 值
setCookie: function(name, value, time) {
var nameString = name + '=' + escape(value);
var expdate = new Date();
if(time == null || isNaN(time)) time = 60*60*24*;
expdate.setTime(expdate.getTime() +
var expiryString = ' ;expires = '+ expdate.toGMTString();
if(time == -1) expiryString = '';
var path = " ;path =/";
var domain = "; domain=" + this.getDomain("" + document.location);
document.cookie = nameString + expiryString + path +
* 获取主域名.
* 提供 Cookie 的 domain 设置,支持同个域下的 Cookie 共享
getDomain: function(url) {
//先去掉 http://
if (url.indexOf("https://")!=-1) {
url = url.substring(si, url.length);
if (url.indexOf("/")==-1) {
url += "/";
url = url.substring(0, url.indexOf("/"));
if(url.indexOf(":")!=-1) {
url = url.substring(0, url.indexOf(":"));
// 是ip地址的话自己返回ip
if (this.isIP(url)) {}
// 匹配后缀
for (i=0; i < this.topUrl. i++) {
if ($Eptone.Utils.endWith(url, this.topUrl[i])) {
// 判断是否是没有前缀的直接返回
point = 1;
if (this.topUrl[i].indexOf(".")) {
point = 2;
if(url.split(".").length == point)
// 去掉前缀
url = url.substring(0, url.length - this.topUrl[i].length - 1);
var index = url.lastIndexOf("\.");
if (index != -1) {
url = url.substring(index+1, url.length);
return url+"."+this.topUrl[i];
// 无法匹配的直接返回
* 判断字符串是否以 endStr 结尾
endWith: function(str, endStr) {
var reg = new RegExp(endStr+"$");
return reg.test(str);
* 去掉前后空格
trim: function(str) {
return str.replace(/(^\s*)|(\s*$)/g, "");
isIP: function(url) {
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/;
if (reg.test(url))
* 检验 item 是否为真
* 字符串"true"表示通过
check: function(item) {
if (typeof(item) == "string") {
return item == "true";
return item ==
* 单字节转码双字节不转码
singleEncode: function(str){
var tempStr = "";
for(i=0;i256)
tempStr += tempS
tempStr += encodeURIComponent(tempSub);
return tempS
* 打开新窗口
winopen: function(url){
window.open(url, "_blank");
* 动态加载/管理 JavaScript
javascript: function(src, options) {
var element = document.createElement('script');
element.src =
element.type = "text/javascript";
element.charset="UTF-8";
Object.eptoneExtend(element, options || {});
document.getElementsByTagName("head")[0].appendChild(element);
* 动态加载/管理 CSS
css: function(src, options) {
var element = document.createElement("link");
element.rel =
"stylesheet";
element.rev =
"stylesheet";
element.href =
element.type = "text/css";
element.media = "all";
Object.eptoneExtend(element, options || {});
document.getElementsByTagName("head")[0].appendChild(element);
* html标签转义
encodeHtml:function(str){
return str.replace(//g,"&").replace(/\//g,"&");
* 函数功能扩展
* Eptone's Function.js
$Eptone.Function = {
* 函数绑定
* 用法很简单,注意最后一个参数 args 传的是数组
bind: function(func, bind, args) {
return function() {
return func.apply(bind, args != undefined ? args : []);
* 返回方法合并后的新方法
append: function(func, appender) {
var __method = func ||
return function() {
if (__method == appender) {
return __method();
var result = __method();
appender(arguments);
* 企话通展示页面JS核心代码
* on.js + eptone.core.js -> eptone.min.js
(function() {
if (window.$Eptone && window.$Eptone.initialized) {
// 防止 $Eptone 重定义
* 显示“自动邀请”窗口
var ep_showWindow = function(message){
if (message == null || message == ""){
message = ept_langSet.
document.getElementById("inviteMessage").innerHTML =
document.getElementById("eptone_wrap").style.display = "";
window.ep_showWindow = ep_showW
* 隐藏“自动邀请”窗口
* isOK 是否接受邀请 0:接收;1:拒绝
var ep_hideWindow = function(isOK){
document.getElementById("eptone_wrap").style.display = "none";
document.getElementById("eptone_wrap_iframe").style.display = "none";
if (inviteServer !=0 && isOK == 1){// 被拒绝的情况下
$Eptone.Request.RejectAjax.send();
window.ep_hideWindow = ep_hideW
* 获取浏览器信息
(function(){
var Browser_Name=navigator.appN
var Browser_Version=parseFloat(navigator.appVersion);
var Browser_Agent=navigator.userA
var Actual_Version,Actual_N
var is_IE=(Browser_Name=="Microsoft Internet Explorer");
var is_NN=(Browser_Name=="Netscape");
if(is_NN){
if(Browser_Version>=5.0){
var Split_Sign=Browser_Agent.lastIndexOf("/");
var Version=Browser_Agent.indexOf(" ",Split_Sign);
var Bname=Browser_Agent.lastIndexOf(" ",Split_Sign);
Actual_Version=Browser_Agent.substring(Split_Sign+1,Version);
Actual_Name=Browser_Agent.substring(Bname+1,Split_Sign);
Actual_Version=Browser_V
Actual_Name=Browser_N
} else if(is_IE) {
var Version_Start=Browser_Agent.indexOf("MSIE");
var Version_End=Browser_Agent.indexOf(";",Version_Start);
Actual_Version=Browser_Agent.substring(Version_Start+5,Version_End)
Actual_Name=Browser_N
if(Browser_Agent.indexOf("Maxthon")!=-1){
Actual_Name+="(Maxthon)";
} else if (Browser_Agent.indexOf("Opera")!=-1) {
Actual_Name="Opera";
var tempstart=Browser_Agent.indexOf("Opera");
var tempend=Browser_Agent.
Actual_Version=Browser_Agent.substring(tempstart+6,tempend)
Actual_Name="Unknown Navigator"
Actual_Version="Unknown Version"
$Eptone.Browser.Actual_Name=Actual_N
$Eptone.Browser.Actual_Version=Actual_V
* Eptone Chat.js
$Eptone.Chat = {
* 是否正在打开聊天窗口
_chatOpening: false,
_openChat: function(winName, url) {
window.open(url, "", "width=520,height=442,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no");
_openFreeCall: function(winName, url) {
window.open(url, "", "width=450,height=220,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no");
* 打开客服聊天窗口
cleanMin: function(serverId, typeId) {
if (this._chatOpening)
this._chatOpening =
ep_hideWindow(0); // 隐藏邀请窗
var newurl = ept_url+"&cookie="+ept_cookieV
newurl += "&free=1&s_i=" + serverId + "&t_i=" + typeId;
this._openChat(winName,newurl);
this._chatOpening =
* 跳到“免费咨询页面”
freeCall: function() {
var callurl = $eptone.site + "call/call.do?method=open&u_i="+ept_userId+"&lang="+ept_lang+"&r_u="+ept_referUrl+"&v_u="+ept_localadd+"&skin="+$eptone.
// var newurl = callurl+"&cookie=" + ept_cookieValue + "&s_i=0&t_i=0";
this._openFreeCall(callName, callurl);
* 树节点的折叠/展开
treeShow: function(t_id,sumid){
for(i=0;i<i++){
var obj = document.getElementById("ul"+i);
if(obj==null || typeof obj=="undefined")
if(i==t_id){
if(obj.style.display=="none")
obj.style.display = "";
obj.style.display = "none";
obj.style.display = "none";
// 显示列表后要确保浮动框在可见区域内
$Eptone.Controller.setVisible("eptone_style1");
$Eptone.Controller.setVisible("eptone_style2");
* EPTONE 悬挂代码.
* Eptone's Element.js
* 通过一下方式可生成自动邀请弹窗、客服列表等
* new $Eptone.Element(eptoneJSON);
$Eptone.Element = function(eptoneJSON) {
this.initialize(eptoneJSON);
* EPTONE 悬挂代码方法扩展.
* Eptone's Element.js
Object.eptoneExtend($Eptone.Element.prototype, {
* 初始化方法
* @param eptoneJSON Eptone.class的JSON对象
initialize: function(eptoneJSON) {
Object.eptoneExtend(this, eptoneJSON);
this.initJavaScript();
this.initCss();
this.errorlogo = "http://" + this.domain + "/chat/images/logo.gif";
switch(this.type) {
this.createCodeEmbed();
this.createCodeEasy();
// 自定样式型
this.createCodeDiy();
default: // 左右
this.createCodeClassic();
this.setAttribute();
if (!document.getElementById("eptone_wrap")) { // 防止挂多个代码时重复显示
this.createWrapper();
// 滚动“自动邀请”窗口
setTimeout(function(){window.setInterval("$Eptone.Controller.setScrollable('', 'eptone_wrap')", 20)}, 500);
$Eptone.Controller.makeDraggable('eptone_wrap', 2);
this.onWinResize(true);
if ($Eptone.Utils.check(this.reflush)) {
this.showInvite();
// -------------------- 图层滚动设置(position 0:悬挂;1:嵌入) --------------------
// 嵌入时(position = 1 或者 type = 3——自由内嵌)
if (this.isFloat()) {
var eptoneId = this.eptoneId;
setTimeout(function(){window.setInterval("$Eptone.Controller.setScrollable('" + eptoneId + "', '')", 20)}, 500);
this.onWinResize(false);
// -------------------- 图层拖动设置 --------------------
// eptone_wrap “自动邀请”窗口允许拖动
// eptoneId
服务图层当为“左右侧挂型” type = 1 时,才允许拖动(JHong, )
if(this.type == 1 && this.funcStyle != 3 && this.funcStyle != 4) {
$Eptone.Controller.makeDraggable(this.eptoneId, 1);
* 初始化 Css 样式.
* 直接写到页面上(禁止只用document.write)
initCss: function() {
$Eptone.Utils.css(this.site + "chat/show_style/pub/eptone_sp.css");
$Eptone.Utils.css(this.site + "chat/" + this.getCssStyle());
$Eptone.Utils.css(this.site + "chat/" + this.getPosCss());
* 初始化 JavaScript 代码.
* 直接写到页面上,只会初始化一次(禁止只用document.write)
initJavaScript: function() {
if ($Eptone.includedScript == true) {
$Eptone.includedScript =
var script = $Eptone.Utils.javascript("/339.js", {
id: "zzy_tr_script"
script.setAttribute("trId", this.trId);
script.setAttribute("trSid", this.trSiteId);
script.setAttribute("show", "none");
* css 文件格式为 eptone_[cssLan]_[cssStyle].css eg. eptone_en_side1.css
getCssStyle: function() {
var cssStyle = "";
var cssLan = "";
if (this.language == 1 && this.type != 1)
cssLan = "en_";
if (this.type == 1) { // 左右悬浮式
cssStyle = "side";
} else if (this.type == 4) { // 简易商务型
cssStyle = "side1";
} else if (this.type == 5) { // 上下悬浮
cssStyle = "side3";
} else { // 简易商务型
cssStyle = "embed";
if (this.type == 1 || (this.type == 4 && this.showstyle == 2)) { // 左右悬浮式
return "show_style/skin" + this.showstyle + "/style/eptone_" + cssLan + cssStyle + ".css";
return "show_style/skin1/style/eptone_" + cssLan + cssStyle + ".css";
* 获取 popCSS 样式
getPosCss: function() {
var cssLan = "";
if (this.type == 1 || (this.type == 4 && this.showstyle == 2) || this.type == 5) { // 左右悬浮式
return "show_style/skin" + this.showstyle + "/style/eptone_" + cssLan + "pop.css";
return "show_style/skin1/style/eptone_" + cssLan + "pop.css";
* 判断是否自动邀请,,同时根据 cookie 判断是否弹出主动邀请框
isAlertInvite: function() {
* 属性设置.
* 设置 tb -> obj.__ept_tb 等属性,用于滚动、拖动等的控制
setAttribute: function() {
this.eptone = document.getElementById(this.eptoneId);
this.eptone.__ept_tb = this.posTB;
* 添加改变窗口大小事件
onWinResize: function(isInvite) {
window.onresize = $Eptone.Function.append(window.onresize,
$Eptone.Function.bind(this.setVisible, this, [isInvite]));
* 设置悬浮代码在可见区域内
* @param isWrapper 是否为邀请框
setVisible: function(isInvite) {
// 在 IE 下必须延迟,等重新绘图完毕后才能调用 $Eptone.Controller.setVisible()
// 否则,不能获取到页面元素 offsetTop 等的理想值(得到的是重绘前的值)
if (isInvite) {
setTimeout("$Eptone.Controller.setVisible('eptone_wrap', 2)", 50);
setTimeout("$Eptone.Controller.setVisible('" + this.eptoneId + "', 1)", 50);
* 显示自动邀请弹窗
showInvite: function() {
if ($Eptone.Utils.getCookie("bother" + this.userId) == "true") {
var key = "isAlertInvite" + this.userId;
if ($Eptone.Utils.check(this.inviteonetime) && $Eptone.Utils.getCookie(key)) {
// 控制自动邀请一次
$Eptone.Utils.setCookie(key, "", -1); // 当前session内有效
var bindFunc = $Eptone.Function.bind(function() {
setTimeout("ep_showWindow()", this.reflushTime);
setTimeout(bindFunc, 500);
* 创建“商务”悬挂代码 4
createCodeEasy: function() {
this.eptoneId = this.funcStyle == 1 ? "eptone_style9" : "eptone_style8";
var code = ""
if ($Eptone.Utils.check(this.openFreeCall)) {
code += ""+ept_langSet.freeCall+"";
code += ""+ept_langSet.liveChat+""
+ ""+ept_langSet.email+"";
if (this.qq != "") {
code += "";
if(ept_langSet.qq!="" && ept_langSet.qq!=null){
code += ept_langSet.qq+"";
code += this.qq +"";
if (this.msn != "") {
code += "";
if(ept_langSet.msn !="" &&ept_langSet.msn!=null)
code += ept_langSet.msn+"";
code += this.msn+"";
if (this.ww != "") {
code += ""+ept_langSet.ww+""
code += "";
this.write(code);
* 创建“用户自定义”悬挂代码 5
createCodeDiy: function() {
this.eptoneId = this.position == 0 ? "eptone_style15" : "eptone_style14";
if (!this.pictureUrl) {
this.pictureUrl = this.site + "images/ept_chat.gif";
var code = ""
this.write(code);
* 创建“左右”悬挂代码 1
createCodeClassic: function() {
this.eptoneId = this.funcStyle != 1 ? "eptone_style2" : "eptone_style1";
var code = ""
code += ""
+""+ept_langSet.list+""
// 客服列表
+ this.getServerList();
code += this.getQqList();
code += this.getMsnList();
code += "";
if ($Eptone.Utils.check(this.openFreeCall)) {
code += "";
code += "";
code += "&";
this.write(code);
this.setEvent();
* 获取访客列表
getServerList: function() {
var html = "";
var groupNum = this.serverList.
for (var i = 0 ; i < groupN i++) {
var group = this.serverList[i];
var serverNum = group.servers.
if (serverNum <= 0)
var typeName = this.getNameByLang(group.name, group.enname);
if (group.spread == 2) { // 平均分配,即不展开分组(点击后,在指定分组内随机抽取客服打开聊天页面)
html += "" + typeName + "";
html += "" + typeName + "" +
* 获取 QQ 列表
getQqList: function() {
var html = "";
for (var i = 0; i < this.qq. i++) {
var qqObject = this.qq[i];
html += "" ;
if(qqObject.name ==""||qqObject.name==null){
html += $Eptone.Utils.encodeHtml(qqObject.qq)+ "";
html += $Eptone.Utils.encodeHtml(qqObject.name)+ "";
if (html != "") {
if ($Eptone.Utils.check(this.qqExpand)){
html = "QQ" +
html + "";
html = "QQ";
* 获取 MSN 列表
getMsnList: function() {
var html = "";
for (var i = 0; i < this.msn. i++) {
var msnObject = this.msn[i];
html += "" ;
if(msnObject.name ==""||msnObject.name==null){
html += $Eptone.Utils.encodeHtml(msnObject.msn)+ "";
html += $Eptone.Utils.encodeHtml(msnObject.name)+ "";
if (html != "") {
if ($Eptone.Utils.check(this.msnExpand)){
html = "MSN" +
html + "";
html = "MSN";
* 根据当前语言设置获取名称
* @param name 中文名
* @param enname 英文名
* @param def 默认名称
getNameByLang: function(name, enname, def) {
if (this.language == 1 && enname) {
return name || def || "";
* 设置事件响应
setEvent: function() {
// QQ 展示列表
var qqList = document.getElementById("eptone_qq_list");
if (qqList) {
qqList.onclick = $Eptone.Function.bind(this.collapse, this, ["ep_qqlist"]);
// MSN 展示列表
var msnList = document.getElementById("eptone_msn_list");
if (msnList) {
msnList.onclick = $Eptone.Function.bind(this.collapse, this, ["ep_msnlist"]);
// 关闭按钮
var closeBtn = document.getElementById("eptone_close");
if (closeBtn) {
closeBtn.onclick = $Eptone.Function.bind(this.hide, this);
* 展示/收缩
* @param eId 元素ID
collapse: function(eId) {
var element = document.getElementById(eId);
if (element.style.display == "")
element.style.display = "none";
element.style.display = "";
// 显示列表后要确保浮动框在可见区域内
$Eptone.Controller.setVisible(this.eptoneId);
* 隐藏浮动客服列表
hide: function() {
document.getElementById(this.eptoneId).style.display = "none";
iframeObject = document.getElementById(this.eptoneId + "_iframe");
if (iframeObject) {
iframeObject.style.display = "none";
* 创建“嵌入”悬挂代码 其他
createCodeEmbed: function() {
var style = this.funcS
if (this.vtype == 1)
style = 2;
var text = this.
var image = "";
var method = "";
if (style == 1) {
method = "$Eptone.Chat.freeCall()";
method = "$Eptone.Chat.cleanMin(inviteServer);";
if (style == 1 && this.size == 1) {
this.eptoneId = "eptone_style6";
} else if (style == 1 && this.size == 2) {
image = "style10_bg.gif";
this.eptoneId = "eptone_style10";
} else if (style == 1 && this.size == 3) {
image = "style12.gif";
this.eptoneId = "eptone_style12";
} else if (style == 2 && this.size == 1) {
this.eptoneId = "eptone_style5";
} else if (style == 2 && this.size == 2) {
this.eptoneId = "eptone_style11";
image = "style11_bg.gif";
} else if (style == 2 && this.size == 3) {
this.eptoneId = "eptone_style13";
image = "style12.gif";
var code = "";
code += "";
if (image == "") {
code += "" + text + "";
code += "" +
if ($Eptone.Utils.check(this.showCall)) {
this.createCallAjax();
code += "" + this.labelPhone + "" +
"" + this.labelFormat + "" +
"" + this.labelSend + "";
code += "";
this.write(code);
* 免费电话咨询 Ajax.
createCallAjax: function() {
if ($Eptone.CallAjax) {
$Eptone.CallAjax = new $Eptone.AjaxScript({
id: "eptone_call_script",
prepare: function(options) {
// 在这里做校验太痛苦了,涉及到多语言的问题,这里我都在后台做。。。
// 电话号码
var number = $Eptone.Utils.trim(options.form.eptone_phone_code.value);
this.options.url = $eptone.site + "call/call.do?method=embed&valid=0&u_i=" + $eptone.userId + "&lang=" + $eptone.language + "&tel=" +
onSuccess: function(response) {
var result = response.
alert(result.reason.replace(//g, "\r\n"));
* 创建邀请弹窗.
* 即使初始化的时候不显示也得创建,因为客服主动邀请会用到
createWrapper: function() {
var errInvitePhoto = "http://" + this.domain + "/chat/images/kf.gif";
var html = ""
html += "";
this.write(html, true);
* 获取位置样式
getStylePosition: function() {
var position = "top:150left:6";
if (this.position == 0) { // 悬浮
if (this.posTB == 0) { // 上
position = "top:" + this.offsetTB + "";
} else { // 下
position = "bottom:" + this.offsetTB + "";
if (this.posLR == 0 && this.funcStyle == 2) { // 左
position += "left:" + this.offsetLR + "";
} else { // 右
position += "right:" + this.offsetLR + "";
} else { // 嵌入
position = "";
* @param html 写入的内容
* @param isWrapper 是否写在外面(document.body)
write: function(html, isWrapper) {
// document.write(html);
// document.body.innerHTML +=
var div = document.createElement("DIV");
div.innerHTML =
var parent = isWrapper || this.isFloat() ? document.body : document.getElementById(this.nestedId);
for (; div.childNodes.length > 0;) {
parent.appendChild(div.childNodes[0]);
* 扩展 Eptone's Flash.js 初始化方法——访客 Flash ID: eptone_vistor
Object.eptoneExtend($Eptone.Flash, {
init: function() {
if (this.install && !this.getObject("eptone_vistor")) {
this.createVistorFlash();
* 创建访客记录 Flash
createVistorFlash: function() {
var flashHtml = "" +
document.writeln(flashHtml);
* Eptone's Controller.js
$Eptone.Controller = {
* 限制只能悬挂一个浮动访客列表
isAppend: false,
* 悬挂代码列表.
* 使用 type_style_pos 标识 Eptone 代码
appendList: "",
* 是否允许拖动(0 不允许拖动,1 允许拖动)
draggable: false,
* 判断能否悬挂 Eptone 代码
* 使用 type_style_pos 标识 Eptone 代码
canAppend: function(type, style, pos) {
// 拒绝悬挂两个悬浮代码
if (pos == 0 && this.isAppend) {
// 使用 type_style_pos 标识 Eptone
var style = style == 1?"1":"0";
var reg = new RegExp("^" + type + "_" + style); // 以这个开头的
if (reg.test(this.appendList)) {
// 存在同类型的悬浮代码,则禁止其他悬挂
if (this.appendList.indexOf(type + "_" + style + "_0") > -1) {
} else if (pos == 0) { // 对于同类代码,要不只有一个悬浮列表,要不都为嵌入
if (pos == 0) {
this.isAppend = // 标识成已悬浮
this.appendList += type + "_" + style + "_" + pos + ";";
* 设置 Eptone 可移动.
* 需要循环调用控制悬挂代码的滚动效果,如下:
* window.setInterval("$Eptone.Controller.setScrollable(eptoneId, eptoneWrap)", 20);
* @param eptoneId 悬挂代码ID
* @param eptoneWrap 自动邀请弹窗ID
setScrollable: function(eptoneId, eptoneWrap) {
var id = eptoneId || "";
var wrapId = eptoneWrap || "";
var divEle = id ? document.getElementById(id) : "";
var docEle = $Eptone.Utils.getCompatDocElement();
// 注意:如果是以 top 定位,则应该只调整 style.top 的值;同理如果是以 bottom 定位,则应该只调整 style.bottom 的值;
否则必须对两个值进行同步调整(因为在 Firefox 下如果同时定义了 top&bottom,则改变其中一个的值,另一个是不会改变,导致其高度会变化)
if (divEle) {
var percent = $Eptone.Controller._getMoveDiff(divEle);
var ept_tb = divEle.__ept_
if ($Eptone.Browser.Actual_Version == "6.0") {
if (ept_tb == 0) {
// 以 Top 定位
divEle.style.top = parseInt(divEle.style.top) + percent + "px";
// 以 Bottom 定位
var offsetY = $Eptone.Controller._getMoveDiff(divEle, 0.9);
if (!divEle.__CONST_OFFSET_BOTTOM && parseInt(divEle.__CONST_OFFSET_BOTTOM) != 0) {
divEle.__CONST_OFFSET_BOTTOM = parseInt(divEle.style.bottom);
divEle.style.bottom = divEle.__CONST_OFFSET_BOTTOM + offsetY + "px";
if (ept_tb == 0) {
var divTop = parseInt(divEle.style.top);
divEle.style.top = divTop + percent + "px";
var divBottom = parseInt(divEle.style.bottom);
divEle.style.bottom = divBottom - percent + "px";
$Eptone.Controller.setIframeSuitable(id);
divEle.lastScrollY = divEle.lastScrollY +
var wrapEle = wrapId ? document.getElementById(wrapId) : "";
if(wrapEle) {
var percent = $Eptone.Controller._getMoveDiff(wrapEle);
wrapEle.style.top = parseInt(wrapEle.style.top) + percent + "px";
$Eptone.Controller.setIframeSuitable(wrapId);
wrapEle.lastScrollY = wrapEle.lastScrollY +
* 计算每次移动的距离.
* @param moveObject 移动对象
* @param rate 每次移动百分比 0.0~1.0
_getMoveDiff: function(moveObjet, rate) {
var docEle = $Eptone.Utils.getCompatDocElement();
var diffY = docEle.scrollT
if (isNaN(moveObjet.lastScrollY)) {
moveObjet.lastScrollY = 0;
if (isNaN(rate)) {
rate = 0.1;
percent = rate * (diffY - moveObjet.lastScrollY);
if (percent > 0) {
percent = Math.ceil(percent);
percent = Math.floor(percent);
* obj 移动对象
* hotspot 移动热点,是否以鼠标点为中心定位进行移动 1:不以鼠标点为中心;其他(当前取 2):以鼠标点为中心
makeDraggable: function(obj, hotspot) {
var docEle = $Eptone.Utils.getCompatDocElement();
if (typeof obj == "string") obj = document.getElementById(obj);
obj.orig_x = parseInt(obj.style.left) - docEle.scrollL
obj.orig_y = parseInt(obj.style.top) - docEle.scrollT
obj.orig_index = obj.style.zI
obj.onclick = "return false";
obj.onmousedown = function(event) {
if (!$Eptone.Controller.draggable)
this.style.zIndex = 10000;
if(!event) event = window.
var x = event.clientX + docEle.scrollLeft - obj.offsetL
var y = event.clientY + docEle.scrollTop - obj.offsetT
doc.ondragstart = ""
doc.onselectstart = ""
doc.onselect = "document.selection.empty();"
// Firefox 私有属性,屏蔽内容不能选择
if (!obj.style.MozUserSelect) {
obj.style.MozUserSelect = "none";
if(obj.setCapture)
obj.setCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
var bodyWidth = docEle.clientW
var bodyHeight = docEle.clientH // 高
var oWidth = obj.clientW
// 移动对象的宽度
var oHeight = obj.clientH
// 移动对象的高
var scrollHeight = docEle.scrollT
// 滚动高度
doc.onmousemove = function(event) {
var scrollWidth = docEle.scrollL
// 滚动宽度
if(!event) event = window.
if (hotspot == 1) {
obj.style.left = (event.clientX + docEle.scrollLeft - x) + "px";
obj.style.left = (event.clientX) + "px";
obj.style.top = (event.clientY + docEle.scrollTop - y) + "px";
// 调整 Bottom 属性的值(通用)
if ($Eptone.Browser.Actual_Version == "6.0") {
obj.style.bottom = scrollHeight + bodyHeight - (obj.offsetTop + oHeight) + "px";
obj.style.bottom = bodyHeight - (obj.offsetTop + oHeight) + "px";
if (obj.id != "eptone_wrap") { // “在线客服列表”
var ept_tb = obj.__ept_
if (ept_tb == 0) {
// 以 Top 定位
// 改变 Bottom 属性的值
obj.style.bottom = "";
// 以 Bottom 定位
// 改变 Bottom 属性的值
obj.__CONST_OFFSET_BOTTOM = parseInt(obj.style.bottom);
obj.style.top = "";
$Eptone.Controller.setVisible(obj, hotspot);
obj.orig_x = (parseInt(obj.style.left) - docEle.scrollLeft) + "px";
obj.orig_y = (parseInt(obj.style.top) - docEle.scrollTop) + "px";
$Eptone.Controller.setIframeSuitable(obj);
doc.onmouseup = function() {
if (obj.releaseCapture) {
obj.releaseCapture();
} else if(window.releaseEvents) {
window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
doc.onmousemove =
doc.onmouseup =
doc.ondragstart =
doc.onselectstart =
doc.onselect =
// obj.style.cursor = "normal";
obj.style.zIndex = obj.orig_
* 禁止拖动
cancleDrag: function() {
this.draggable =
* 允许拖动
reDrag: function() {
this.draggable =
* 调用本函数可保证在可见区域显示“在线客服列表”浮动框或“欢迎框”
* 1、底部超出,则上移;2、顶部超出,则下移
* eptDivParam 移动对象参数(可为 Div 元素、divId)
* isMiddle 是否以鼠标点为中心定位(未定义,则不需调整左右位置)
1:不以鼠标点为中心;其他(当前取 2):以鼠标点为中心
setVisible: function(eptDivParam, isMiddle) {
if (typeof(eptDivParam) == "object") {
ept_div = eptDivP
} else if (typeof(eptDivParam) == "string") {
ept_div = document.getElementById(eptDivParam);
if (!ept_div) {
var docEle = $Eptone.Utils.getCompatDocElement();
var bodyWidth = docEle.clientW
// 可见区域宽
var bodyHeight = docEle.clientH
// 可见区域高
var scrollWidth = docEle.scrollL
// 滚动宽度
var scrollHeight = docEle.scrollT
// 滚动高度
var ept_width = ept_div.clientW
// 移动对象的宽度
var ept_height = ept_div.clientH
// 移动对象的高
// 左/右超出显示区域,则进行调整
if (isMiddle) {
var ept_Left = ept_div.offsetLeft - scrollW
// 移动对象相对于左边的位置
if (ept_Left = bodyWidth) {
if (isMiddle == 1) {
ept_div.style.left = bodyWidth - ept_width + scrollWidth + "px";
// ept_div.style.right = bodyWidth - (ept_div.offsetLeft + ept_width) + "px";
// “自动邀请”窗口
ept_div.style.left = bodyWidth - ept_width/2 + scrollWidth + "px";
var ept_top = ept_div.offsetTop - scrollH
// 移动对象相对于可见区域上方的位置
// 底部/顶部超出显示区域,则进行调整
if (ept_top + ept_height > bodyHeight) {
// 重新调整高度
ept_div.style.top = bodyHeight - ept_height + scrollHeight + "px";
if ($Eptone.Browser.Actual_Version == "6.0") {
ept_div.style.bottom = 0 + "px";
ept_div.style.bottom = - scrollHeight + "px";
ept_top = ept_div.offsetTop - scrollH
if (ept_top < 0) {
ept_div.style.top = scrollHeight + "px";
if ($Eptone.Browser.Actual_Version == "6.0") {
ept_div.style.bottom = bodyHeight - ept_height + "px";
ept_div.style.bottom = bodyHeight - ept_height - scrollHeight + "px";
// 取消 top/bottom 定位(否则高度不会自动变化)
if (ept_div.id != "eptone_wrap") { // “在线客服列表”
var ept_tb = ept_div.__ept_
if (ept_tb == 0) {
// 以 Top 定位
// 改变 Bottom 属性的值
ept_div.style.bottom = "";
// 以 Bottom 定位
// 改变 Bottom 属性的值
ept_div.__CONST_OFFSET_BOTTOM = parseInt(ept_div.style.bottom);
ept_div.style.top = "";
* iframe 自动适应(元素 ID 为 divID_iframe).
* @param divObject Div对象/元素ID
setIframeSuitable: function(divObject) {
var iframeO
if (typeof(divObject) == "string") {
divObject = document.getElementById(divObject);
iframeObject = document.getElementById(divObject.id + "_iframe");
if (iframeObject) {
iframeObject.style.top = divObject.offsetTop + "px";
iframeObject.style.left = divObject.offsetLeft + "px";
iframeObject.style.width = divObject.clientWidth + "px";
iframeObject.style.height = divObject.clientHeight + "px";
// 访客 Cookie 标识
var ept_cookieValue = $Eptone.Utils.getCookie("chatOnlyCookies");
window.ept_cookieValue = ept_cookieV
* 添加临时访客列表
var ept_setChatOnlyCookies = function(cId, isBother) {
$Eptone.Utils.setCookie("chatOnlyCookies", cId);
window.ept_cookieValue = cId;
if (!isBother) {
$Eptone.RequestAjax = new $Eptone.AjaxScript({
id: 'eptone_request_script',
url: $eptone.site + "chat/ajax_js/eptone.request.js"
// 访客逗留 3s 后通知服务端访客上线
setTimeout(function() {
$Eptone.RequestAjax.send();
}, 3 * 1000);
* eptone_vistor Flash 加载完成执行
var ep_vistorOk = function() {
var fo = $Eptone.Flash.getObject("eptone_vistor");
var soValue = fo.get("chatOnlyCookies");
var soBother = fo.get("bother");
if (soBother == "true") {
$Eptone.Utils.setCookie("bother"+ept_userId, "true");
ept_setChatOnlyCookies(soValue, true);
var cid = soV
(soValue == null || soValue == "") {
cid = ept_cookieValue || $Eptone.Utils.createVistorId();
fo.set("chatOnlyCookies", cid);
ept_setChatOnlyCookies(cid, false);
window.ep_vistorOk = ep_vistorOk;
$Eptone.Flash.init();
if (!$Eptone.Flash.install && $Eptone.Utils.getCookie("bother"+ept_userId) != "true") {
ept_setChatOnlyCookies(ept_cookieValue || $Eptone.Utils.createVistorId(), false);
* 已初始化的
$Eptone.initialized =
var ept_lang = $eptone.
var ept_langSet = $eptone.langS
var ept_userId = $eptone.userId;
// 邀请访客聊天的客服,默认为0
var inviteServer = 0;
var winName = "BrowserMaxWindow"+ept_userId;
var callName = "BrowserCallWindow"+ept_userId;
var ept_localadd =
encodeURI(document.location);// 本地地址
ept_localadd = $Eptone.Utils.singleEncode(ept_localadd);
var ept_referUrl = encodeURI(document.referrer);// 来源地址
ept_referUrl = $Eptone.Utils.singleEncode(ept_referUrl);
if (ept_referUrl == null) {
ept_referUrl = '';
var ept_url = $eptone.site + "chat/webChat?u_i="+ept_userId+"&lang="+ept_lang+"&r_u="+ept_referUrl+"&v_u="+ept_localadd+"&skin="+$eptone.chatstyle+"&target=chat";
* Prototype's DomReady.js
* just create eptone element
(function() {
/* Support for the DOMContentLoaded event is based on work by Dan Webb,
Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
function fireContentLoadedEvent() {
if (timer) window.clearTimeout(timer);
var aEptone = $eptoneQueue.pop();
if (aEptone && $Eptone.Controller.canAppend(aEptone.type, aEptone.funcStyle, aEptone.position)) {
// 构造悬挂代码
new $Eptone.Element(aEptone);
function checkReadyState() {
if (document.readyState === 'complete') {
document.detachEvent('onreadystatechange', checkReadyState);
fireContentLoadedEvent();
function pollDoScroll() {
try { document.documentElement.doScroll('left'); }
catch(e) {
timer = window.setTimeout(pollDoScroll, 50);
fireContentLoadedEvent();
if (document.addEventListener) {
fireContentLoadedEvent();
if (window == top) {
timer = window.setTimeout(pollDoScroll, 50);}

我要回帖

更多关于 for的同义词是什么 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信