You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
4.2 KiB
JavaScript
108 lines
4.2 KiB
JavaScript
var startTimes;
|
|
function $(id){
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function openDialog(typeName){
|
|
switch(typeName){
|
|
case "message":
|
|
var openSet = "height=500, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-500)/2 + ",Left= "+(screen.width-900)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "../message/message.aspx?post=1";
|
|
window.open (openUrl,openType,openSet);
|
|
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
function recycleCount(timeCount){
|
|
startTimes = new Date();
|
|
|
|
setInterval(function(){
|
|
var frameObj = null;
|
|
frameObj = parent.document.getElementById("iFrameH").contentWindow;
|
|
|
|
if(frameObj.document.getElementById("scrA") == null){
|
|
var url = "../js/popmessage.js?uid="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
var jsVal = loader.xmlDoc.responseText;
|
|
|
|
var oHead = frameObj.document.getElementsByTagName('HEAD').item(0);
|
|
var oScript = frameObj.document.createElement( "script" );
|
|
|
|
oScript.language = "javascript";
|
|
oScript.type = "text/javascript";
|
|
oScript.id = "scrA";
|
|
oScript.defer = true;
|
|
oScript.text = jsVal;
|
|
|
|
oHead.appendChild(oScript);
|
|
}
|
|
var messageCountObj = null;
|
|
var url = "../message/MessageService.aspx?handle=messagetotal&uid="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
var messageVal = loader.xmlDoc.responseText;
|
|
|
|
if(messageVal.trim() != ""){
|
|
messageCountObj = eval('(' + messageVal + ')');
|
|
|
|
var msgInterval = messageCountObj.totals[0].interval;
|
|
if(messageCountObj.totals[0].read != 0){
|
|
var oldUrl = parent.document.getElementById("iFrameH").contentWindow.location.href;
|
|
var doubleUrl = 0;
|
|
if(oldUrl.indexOf("//") >= 0){
|
|
doubleUrl = oldUrl.indexOf("//")+2;
|
|
}
|
|
var tempUrl = oldUrl.substring(doubleUrl,oldUrl.substring(doubleUrl,oldUrl.length).indexOf("/")+doubleUrl);
|
|
var newUrl = oldUrl.substring(0,doubleUrl)+tempUrl+"/"+"message/message.aspx";
|
|
|
|
$("dvMessage").innerText = "我的消息("+messageCountObj.totals[0].read+"/"+messageCountObj.totals[0].total+")";
|
|
|
|
var currentTimes = new Date();
|
|
var spaceTimes = currentTimes.getTime() - startTimes.getTime();
|
|
|
|
var days = Math.floor(spaceTimes/(24*3600*1000));
|
|
//计算小时
|
|
var leave1 = spaceTimes%(24*3600*1000);
|
|
var hours= Math.floor(leave1/(3600*1000));
|
|
|
|
//计算分钟
|
|
var leave2= leave1%(3600*1000);
|
|
var minutes=Math.floor(leave2/(60*1000));
|
|
//计算秒数
|
|
var leave3=leave2%(60*1000);
|
|
var seconds=Math.round(leave3/1000);
|
|
|
|
if(msgInterval > 0){
|
|
if(minutes >= msgInterval){
|
|
startTimes = new Date();
|
|
frameObj.openPop("我的消息("+messageCountObj.totals[0].read+"/"+messageCountObj.totals[0].total+")",messageCountObj.totals[0].read,messageCountObj.totals[0].total,newUrl);
|
|
}
|
|
}else{
|
|
frameObj.openPop("我的消息("+messageCountObj.totals[0].read+"/"+messageCountObj.totals[0].total+")",messageCountObj.totals[0].read,messageCountObj.totals[0].total,newUrl);
|
|
}
|
|
}else{
|
|
$("dvMessage").innerText = "我的消息(0/"+messageCountObj.totals[0].total+")";
|
|
}
|
|
}
|
|
|
|
},timeCount);
|
|
}
|
|
|
|
//获取GUID
|
|
function newGuid()
|
|
{
|
|
var guid = "";
|
|
for (var i = 1; i <= 32; i++){
|
|
var n = Math.floor(Math.random()*16.0).toString(16);
|
|
guid += n;
|
|
if((i==8)||(i==12)||(i==16)||(i==20))
|
|
guid += "-";
|
|
}
|
|
return guid.toUpperCase();
|
|
}
|
|
|
|
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); } |