统计京东通信当前当页通话记录总时间脚本
2017-04-07 12:38
190 查看
用以解决京东通信无法统计既定时间段内通话总分钟数的问题
目前只能按照一页一页的统计,如果要统计下一页,需要跳到第二页后手动再执行一次方法,2333333
//方法调用
statisticalTatalTimeRecord();
function statisticalTatalTimeRecord(){
//总分钟数
var totalMinute = 0;
//总秒数
var totalSecond = 0;
//统计次数
var recordCount = 0;
$.each($($("table")[1]).find("tr"), function(){
var $this = $(this);
//获取时间段
var timePeriod = $($this.find("td")[3]);
//检查是否为正常数据段
if (0 != timePeriod.length) {
//时间段(分)截取索引
var timeMinuteIndex = timePeriod.text().indexOf("分");
//时间段(秒)截取索引
var timeSecondIndex = timePeriod.text().indexOf("秒");
//无秒数的则不进行统计
if (-1 != timeSecondIndex) {
//当前秒数--正则替换其中数字
var nowSecond = Number.parseInt(timePeriod.text().substr(timeMinuteIndex + 1, timeSecondIndex).replace(/[^0-9]/ig,""), 10);
//递增秒数--大于60秒则递增分钟数
totalSecond += nowSecond;
if (60 <= totalSecond) {
totalMinute++;
totalSecond = totalSecond - 60;
}
//递增当前分钟数
if (-1 != timeMinuteIndex) {
//当前分钟--正则替换其中数字
var nowMinute = Number.parseInt(timePeriod.text().substr(0, timeMinuteIndex).replace(/[^0-9]/ig,""), 10);
totalMinute += nowMinute;
}
//递增统计次数
++recordCount;
}
}
});
console.log("总消耗时间:" + totalMinute + "分" + totalSecond + "秒");
console.log("统计条数:" + recordCount);
}
目前只能按照一页一页的统计,如果要统计下一页,需要跳到第二页后手动再执行一次方法,2333333
//方法调用
statisticalTatalTimeRecord();
function statisticalTatalTimeRecord(){
//总分钟数
var totalMinute = 0;
//总秒数
var totalSecond = 0;
//统计次数
var recordCount = 0;
$.each($($("table")[1]).find("tr"), function(){
var $this = $(this);
//获取时间段
var timePeriod = $($this.find("td")[3]);
//检查是否为正常数据段
if (0 != timePeriod.length) {
//时间段(分)截取索引
var timeMinuteIndex = timePeriod.text().indexOf("分");
//时间段(秒)截取索引
var timeSecondIndex = timePeriod.text().indexOf("秒");
//无秒数的则不进行统计
if (-1 != timeSecondIndex) {
//当前秒数--正则替换其中数字
var nowSecond = Number.parseInt(timePeriod.text().substr(timeMinuteIndex + 1, timeSecondIndex).replace(/[^0-9]/ig,""), 10);
//递增秒数--大于60秒则递增分钟数
totalSecond += nowSecond;
if (60 <= totalSecond) {
totalMinute++;
totalSecond = totalSecond - 60;
}
//递增当前分钟数
if (-1 != timeMinuteIndex) {
//当前分钟--正则替换其中数字
var nowMinute = Number.parseInt(timePeriod.text().substr(0, timeMinuteIndex).replace(/[^0-9]/ig,""), 10);
totalMinute += nowMinute;
}
//递增统计次数
++recordCount;
}
}
});
console.log("总消耗时间:" + totalMinute + "分" + totalSecond + "秒");
console.log("统计条数:" + recordCount);
}
相关文章推荐
- shell启动另一个脚本进行统计,awk在每一行添加当前时间
- 统计当前目录文件扩展名字的脚本
- 使用脚本得到当前的时间函数
- DBA用于查询当前数据库表格记录条数的脚本
- 批处理: 统计当前时间的某端口的连接数
- VBS统计页面加载时间脚本
- 【批处理脚本】按当前时间备份
- 巨简单循环shell脚本验证&符号后台操作(并记录查看当前shell的方法)
- 统计ORACLE当前用户下所有表中的记录数
- 用于查询当前数据库中所有表格的记录条数的脚本(转)
- 用js统计用户下载网页所需时间的脚本
- 统计当前数据库所有表的记录数
- 用于查询当前数据库中所有表格的记录条数的脚本
- 用于查询当前数据库中所有表格的记录条数的脚本
- 一个能对访问者进行编号、记录访问次数、IP、时间的统计制作实例
- 简单统计postfix发送人记录的脚本
- js统计网页在线时间的脚本
- freemarker相对路径和记录当前时间
- 在DNS服务器上用vbs脚本访问WMI对象导出加入域的计算机的IP地址和时间记录
- 某服务器经常死机。。所以写个一秒钟记录当前服务器状态的脚本。。