telecom 产品分析js

1

var G = {
cgi: {
telecom_query :
"http://222.68.223.242/cgi-bin/telecom_business.fcgi",
company:
"",
product:
"",
category:
"新闻",
feature:
"",
timename:
"",
time_l:
"",
time_r:
"",
page:
"",
is_time_exact:
""
},
flex_select:
"新闻"
};


var div_hiden = {
init_:
function()
{
this.duibilan();
//info.leibie(0);
this.content_big();
this.float_position();
this.flex_hide();
this.zfmian_hide();
},

duibilan:
function()
{
var window_height = document.documentElement.clientHeight;
var top =(window_height - $('#js_duibilan').height())/2;
$('#js_duibilan').css({left:0,top:top});

},

content_big:
function()
{
$(
'#js_content_big').hide();
},
float_position:
function()
{
$(
'#js_float').hide();
},
flex_hide:
function()
{
$(
'#js_flex').hide();
},
zfmian_hide:
function()
{
$(
'#js_zfmian').hide();
}




};




$(document).ready(
function()
{
div_hiden.init_();
$(
".input02" ).datepicker();
$(
".input02" ).datepicker( "option", "dateFormat", "yy-mm-dd");
info.search();
hotsearch(
"http://222.68.223.242/cgi-bin/telecom_business.fcgi?category=新闻");
hotsearch(
"http://222.68.223.242/cgi-bin/telecom_business.fcgi?category=帖子");
hotsearch(
"http://222.68.223.242/cgi-bin/telecom_business.fcgi?category=博客")

});


function shit(json) {
try {
deal(json);
//TimeLine2.getLineChart().addEventListener("itemClick", flash);
} catch(e) {
setTimeout(
function(){ shit(json) },500);
}
}

function deal(json)
{
var column = TimeLine3.getZ_data();
// JavaScript准备数据
var dp = [];
var i = 0;
var i = 0;
for(i = 0; i < json.time_line.length ; i++)
{
dp.push( {z_name: json.time_line[i].date, z_value02: json.time_line[i].count, z_value01: json.time_line[i].score} );
}

column.setSource(dp);
}

function telecom_business_info(json)
{
info.init(json);
info.min.show();
}

function telecom_business(json)
{
if(content.is_detail)
{
shit(json);
}

if(json.category == G.flex_select)
{
shit(json);
page.initPagination(json.post_total_page);
}
info.change(G.cgi.company);
content.init(json);
}

function content_search()
{
if(content.content_big_type == "news")
{
G.cgi.category
= "新闻";
}
else if (content.content_big_type == "luntan")
{
G.cgi.category
= "帖子";
}
else if (content.content_big_type == "boke")
{
G.cgi.category
= "博客";
}


/*
var strings = G.cgi.telecom_query + "?company=" + G.cgi.company + "&product=" + G.cgi.product + "&category=" + G.cgi.category + "&page=" + G.cgi.page ;
if(!G.cgi.is_time_exact)
{
strings = strings + "&timename=" + G.cgi.timename;
}
else
{
G.cgi.time_l = $('#sjfl input:eq(0)').val();
G.cgi.time_r = $('#sjfl input:eq(1)').val();
strings = strings + "&time_l=" + G.cgi.time_l + "&time_r" + G.cgi.time_r ;
}
hotsearch(strings);
*/
search_content();
}

function search_content()
{
var strings = G.cgi.telecom_query + "?company=" + G.cgi.company + "&product=" + G.cgi.product + "&category=" + G.cgi.category + "&page=" + G.cgi.page ;
var strings = G.cgi.telecom_query + "?company=" + G.cgi.company + "&product=" + G.cgi.product + "&category=" + G.cgi.category + "&page=" + G.cgi.page ;
if(!G.cgi.is_time_exact)
{
strings
= strings + "&timename=" + G.cgi.timename;
}
else
{
G.cgi.time_l
= $('#sjfl input:eq(0)').val();
G.cgi.time_r
= $('#sjfl input:eq(1)').val();
strings
= strings + "&time_l=" + G.cgi.time_l + "&time_r" + G.cgi.time_r ;
}
hotsearch(strings);
}


var info = {
fl:
"电信",
is_in_detail:
0,
json:
"",
duibi_html:
"<div id='js_jiaruduibi_min'> <table width='780' border='0' cellspacing='1' cellpadding='0' > <tr> <td><a href='chanpin02.htm' target='_blank'><img src='images/right13.gif' border='0' vspace='12' /></a></td> </tr> </table> </div ",
init:
function(json)
{
this.json = json;
},

change:
function (type) {
if(type != "")
{
this.fl = type;
}
if(this.is_in_detail)
{
this.max.show();
}
else
{
this.min.show();
}
},

search:
function()
{
hotsearch(
"http://222.68.223.242/cgi-bin/telecom_business_info.fcgi");
},
min: {
html:{
table:
""
},
show:
function () {


$(
'#js_jiaru_duibilan').html(info.duibi_html);


info.is_in_detail
= 0;
$(
'#js_max').hide();
$(
'#js_min').show(400);
var date;
var i = 0;
for(i = 0; i < info.json.root.length ; i++)
{
if(info.json.root[i].company == info.fl)
{
//date = info.json.root[i].items;
var j = 0;
for(j = 0; j < info.json.root[i].items.length; j++)
{
if((info.json.root[i].items[j].value.length != 0) || (j == (info.json.root[i].items.length - 1)) )
{
date
= info.json.root[i].items[j];
break;
}
}

break;
}
}


$(
'.js_chanpin_min_lable').html("&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+date.name);
$(
'.js_chanpin_min_con').html("<tr bgcolor='#b4b4b4'> <td height='1' colspan='15'></td> </tr> <tr> <td height='15'></td> <td></td> <td></td> </tr> ");

var scl = Math.ceil(date.value.length/5);
var i = 0;
for(i = 0; i < scl ; i++)
{
$(
'.js_chanpin_min_con').append("<tr class='js_min_con_ele'><td width='20'></td></tr>");
var j = 0;

var yushu = 5;
if(i == (scl - 1))
{
yushu
= date.value.length%(5);
}

for(j = 0; j < yushu ; j++)
{
if(j != 0)
{
$(
'.js_chanpin_min_con .js_min_con_ele:eq('+ i +')').append("<td width='15' class='right03'>| </td>");
}
$(
'.js_chanpin_min_con .js_min_con_ele:eq('+ i +')').append("<td width='135' class='js_ele_min' height='24' ><input type='checkbox' name='checkbox' id='checkbox1' onclick='show()' /> <a href='javascript:void(0)' class='right06' >情天翼视讯 </a></td>");

$(
'.js_chanpin_min_con .js_min_con_ele:eq('+ i +') a:eq('+ j +')').html(date.value[i * 5 + j]);
}

}

$(
'.js_chanpin_min_con').append("<tr> <td height='20'></td> </tr> ");

this.fuwu_float();

},

fuwu_float:
function () {
$(
'.js_chanpin_min_con .js_ele_min').each(function( i){



$(
this).mouseout(function(){
alert(
"yes");
});
$(
this).mouseover(function(){
alert(
"no");
});
/*
$(this).hover(
function()
{
$('#js_float').show();
var top = $('.js_chanpin_min_con .js_ele_min:eq('+ i +')').offset().top;
var left = $('.js_chanpin_min_con .js_ele_min:eq('+ i +')').offset().left;
var height = $('.js_ele_min:eq('+ i +')').height();

$('#js_float').css({top:top+height, left:left});


}
);
*/




});
$(
".js_ele_min").blur(function() {
alert(
"1111");
});

}


},
max: {
html:{
table:
" <table class='js_table' border='0' cellspacing='0' cellpadding='0' > <tr> <td height='24' background='images/right21.gif' style='background-repeat:no-repeat;' class='right004 js_name'>  数据业务</td> <td width='18'></td> <td width='72'></td> </tr> <tr> <td class='js_insert_ss' > <table width='780' border='0' cellspacing='0' cellpadding='0' class='boder2' > <tr bgcolor='#b4b4b4'> <td height='1' colspan='15'></td> </tr> <tr class='js_insert_ele'> <td height='15'></td> <td></td> <td></td> </tr> <tr> <td height='20'></td> </tr> </table> <table width='780' border='0' cellspacing='0' cellpadding='0' > </table></td> </tr> </table>",
sousuo:
" <td width='18'></td> <td width='72' valign='top'><img onclick='info.min.show()' src='images/right017.gif' /></td>"
},


fuwu_float:
function () {

$(
'.js_ele_min').each(function( i){
$(
this).hover(
function()
{
$(
'#js_float').show();

var top = $('.js_ele_min:eq('+ i +')').offset().top;
var left = $('.js_ele_min:eq('+ i +')').offset().left;
var height = $('.js_ele_min:eq('+ i +')').height();

$(
'#js_float').css({top:top+height, left:left});
}
);
});

},


show:
function ()
{
info.is_in_detail
= 1;
$(
'#js_min').hide(400);
$(
'#js_max').show();

var date;
var i = 0;
for(i = 0; i < info.json.root.length ; i++)
{
if(info.json.root[i].company == info.fl)
{
date
= info.json.root[i].items;
break;
}
}
var i = 0;
for(i = 0; i < date.length ; i++)
{
if(i == 0)
{
$(
'#js_max').html(this.html.table);
$(
'#js_max .js_insert_ss').after(this.html.sousuo);
}
else
{
$(
'#js_max').append(this.html.table);
}
$(
'#js_max .js_table:eq('+ i +')').append("<tr><td>"+info.duibi_html+"</td></tr>");

$(
'#js_max .js_name:eq('+ i +')').html("&nbsp&nbsp&nbsp&nbsp&nbsp"+date[i].name);

var hangshu = Math.ceil(date[i].value.length/5);
var j = 0;
for(j = 0; j < hangshu ; j++)
{
$(
'#js_max .js_insert_ele:eq('+ i +')').after("<tr class='js_max_con_ele'></tr>");

}
}

for(i = 0; i < date.length ; i++)
{
var hangshu = Math.ceil(date[i].value.length/5);
var j = 0;
for(j = 0; j < hangshu ; j++)
{
var max;
if(j == (hangshu - 1))
{
max
= (date[i].value.length - j*5)
}
else
{
max
= 5;
}
for(k = 0; k < max ; k++)
{
if(k == 0)
{
$(
'#js_max .js_table:eq('+ i +') .js_max_con_ele:eq('+ j +')').html("<td width='20'></td>");
}
else
{
$(
'#js_max .js_table:eq('+ i +') .js_max_con_ele:eq('+ j +')').append("<td width='15' class='right03'>| </td>");
}
$(
'#js_max .js_table:eq('+ i +') .js_max_con_ele:eq('+ j +')').append("<td class='js_ele_min' width='135' height='24' ><input type='checkbox' name='checkbox' id='checkbox1' onclick='show()' /> <a href='javascript:void(0)' class='right06' >情天翼视讯 </a></td>");
$(
'#js_max .js_table:eq('+ i +') .js_max_con_ele:eq('+ j +') a:eq('+ k +')').html(date[i].value[j * 5 + k]);
}

}

}
this.fuwu_float();
}
}
}

  

function hotsearch(strings)
{
gScriptObj
= document.createElement("script");
gScriptObj.setAttribute(
"type", "text/javascript");
gScriptObj.setAttribute(
"charset", "utf-8");
gScriptObj.setAttribute(
"src", strings); //index为ajax需要访问的urlml地址
headObj = document.getElementsByTagName("head").item(0);
headObj.appendChild(gScriptObj);
}




var content = {
content_big_type:
"news",
is_detail:
false,
init:
function(json)
{
if(json.category == "新闻")
{
this.news.json = json;
if(this.is_detail)
{
content.detail.show_xinwen_big(
"news");
}
else
{
this.news.content_write();
}
}
else if(json.category == "博客")
{
this.boke.json = json;
if(this.is_detail)
{
content.detail.show_xinwen_big(
"boke");
}
else
{
this.boke.draw();
}


}
else if(json.category == "帖子")
{
this.luntan.json = json;
if(this.is_detail)
{
content.detail.show_xinwen_big(
"luntan");
}
else
{
this.luntan.draw();
}

}
},

detail: {
html: {
space:
"<tr><td height='10'></td></tr>",
con:
" <tr class='js_detail_ele'> <td ><a rel='external' href='#' class='listtitle_g 1' >在<span class='listtitle_o'>网络时代</span>信息是堵不住的</a><span class='text 2'> [2011-07-27 16:00:23]</span></td> </tr> <tr> <td class='text 3'><span class='text_o'>网络</span>使得信息传播速度更快、节点更多、范围更广,想要堵住信息是不现实的,也不符合人民群众的利益诉传播速度更快、节点更多、范围 更广,想要堵住信息是不现实的,也不符合人民群+众的利益诉求...</td> </tr> <tr> <td ><a rel='external' href='#' class='listtitle_s 4'>http://roll.sohu.com/20110625/n311663518.shtml</a></td> </tr> <tr> <td height='8' ></td> </tr> <tr> <td height='1' bgcolor='#cecece' ></td> </tr> <tr> <td height='10' ></td> </tr "
},
show_xinwen_big:
function (type)
{
var date;
var eq_num;
if(type == "news")
{
content.content_big_type
= "news";
date
= content.news.json;
G.flex_select
= "新闻";
eq_num
= 1;
}
else if(type == "luntan")
{
content.content_big_type
= "luntan";
date
= content.luntan.json;
G.flex_select
= "帖子";
eq_num
= 2;
}
else if(type == "boke")
{
content.content_big_type
= "boke";
date
= content.boke.json;
G.flex_select
= "博客";
eq_num
= 3;
}
$(
'#js_laiyuan a').attr("class", "right06");
$(
'#js_laiyuan a:eq('+ eq_num +')').attr("class", "rightye");

page.initPagination(date.post_total_page);
content.is_detail
= true;
$(
'#js_content_big').show();
$(
'#content_con').hide();
$(
'#js_con_have_page').html("");

var i = 0;
$(
'#js_con_have_page').append(this.html.space);
for(i = 0; i < date.post.length ; i++)
{
$(
'#js_con_have_page').append(this.html.con);
}

for(i = 0; i < date.post.length ; i++)
{
$(
'#js_con_have_page .1:eq(' + i + ')').html(date.post[i].sen_title);
$(
'#js_con_have_page .1:eq(' + i + ')').attr("href", date.post[i].sen_url);
$(
'#js_con_have_page .2:eq(' + i + ')').html(" [" + date.post[i].sen_datetime + "] ");

$(
'#js_con_have_page .3:eq(' + i + ')').html(getString(date.post[i].sen_sen, 80)+"...");
$(
'#js_con_have_page .4:eq(' + i + ')').html(date.post[i].sen_url);
$(
'#js_con_have_page .4:eq(' + i + ')').attr("href", date.post[i].sen_url);
}
jQuery(
"body").find('a[rel*="external"]').click(function() {
window.open(
this.href);
return false;
});

}
},
boke: {
json:
"",
draw:
function()
{

}
},
luntan: {
json:
"",
html:{
space:
"<tr> <td height='10'></td> </tr ",
ele:
" <tr> <td ><a href='#' rel='external' class='listtitle_g 1' >在<span class='listtitle_o'>网络时代</span>信息是堵不住的</a><span class='text 2'> [2011-07-27 16:00:23]</span></td> </tr> <tr> <td class='text 3'><span class='text_o'>网络</span>使得信息传播速度更快、节点更多、范围更广,想要堵住信息是不现实的,也不符合人民群众的利益诉传播速度更快、节点更多、范围 更广,想要堵住信息是不现实的,也不符合人民群+众的利益诉求...</td> </tr> <tr> <td height='10' ></td> </tr "
},
draw:
function()
{
$(
'.js_content_luntan').html("");
var i = 0;
$(
'.js_content_luntan').html(this.space);
for(i = 0; (i < this.json.post.length && i <5) ; i++)
{
$(
'.js_content_luntan').append(this.html.ele);
$(
'.js_content_luntan .1:eq('+ i +')').html(this.json.post[i].sen_title);
$(
'.js_content_luntan .1:eq('+ i +')').attr("href",this.json.post[i].sen_url);
$(
'.js_content_luntan .2:eq('+ i +')').html(" ["+this.json.post[i].sen_datetime+"] ");
var strings = getString(this.json.post[i].sen_sen, 30);
$(
'.js_content_luntan .3:eq('+ i +')').html(strings + "...");
}
open_link_new();

}
},
news: {
json:
"",
html_min:{
space:
"<tr> <td height='10'></td> </tr> ",
content:
"<tr> <td ><a href='#' class='listtitle_g 1' >在<span class='listtitle_o'>网络时代</span>信息是堵不住的</a><span class='text 2'> [2011-07-27 16:00:23]</span></td> </tr> <tr> <td class='text 3'><span class='text_o'>网络</span>使得信息传播速度更快、节点更多、范围更广,想要堵住信息是不现实的,也不符合人民群众的利益诉传播速度更快、节点更多、范围 更广,想要堵住信息是不现实的,也不符合人民群+众的利益诉求...</td> </tr> <tr> <td height='8' ></td> </tr> <tr> <td height='1' bgcolor='#cecece' ></td> </tr> <tr> <td height='10' ></td> </tr> "
},
content_write:
function()
{
this.is_detail = false;
$(
'.js_xinwen').html("");
var i = 0;
$(
'.js_xinwen').append(this.html_min.space);
for(i = 0; i < this.json.post.length ; i++)
{
$(
'.js_xinwen').append(this.html_min.content);
$(
'.js_xinwen .1:eq('+ i +')').html(this.json.post[i].sen_title);
$(
'.js_xinwen .1:eq('+ i +')').attr("href",this.json.post[i].sen_url);

$(
'.js_xinwen .2:eq('+ i +')').html(" ["+this.json.post[i].sen_datetime+"] ");
$(
'.js_xinwen .3:eq('+ i +')').html(getString(this.json.post[i].sen_sen,50)+"...");
}
}
}

};


function open_link_new()
{
jQuery(
"body").find('a[rel*="external"]').click(function() {
window.open(
this.href);
});
}

function getString(s,n){ //提取摘要
var count = 0;
var i = 0;
while(count < n && i < s.length)
{
if(s.charCodeAt(i) > 255)
{
count
++;
}
i
++;
}
var ins = String.fromCharCode(160);
ins
= new RegExp(ins, "g");
s
= s.replace(ins, "");
return s.substring(0,i);
}

var page = {
max:
"",
is_this_action:
false,
searchPageselectCallback:
function (page_index, jq){
G.cgi.page
= page_index + 1;
page.is_this_action
= true;
content_search();
},
initPagination:
function (max) {
if(!this.is_this_action)
{
this.max = max;
// count entries inside the hidden content
var num_entries = max;
// Create content inside pagination element
$(".searchresult_pagination").pagination(num_entries, {
num_edge_entries:
2,
num_display_entries:
6,
prev_text:
"上一页",
next_text:
"下一页",
link_to:
"javascript:void(0)",
callback: page.searchPageselectCallback,
items_per_page:
1 // Show only one item per page
});

this.is_this_action = false;
this.pageinfo();
}
},
pageinfo:
function()
{
$(
'.js_page_count').html(""+this.max+"页 &nbsp ");
}
}


var condition = {
yys:
function (args, eq_num) {
G.cgi.company
= args;
search_content();
$(
'.js_yys a').attr("class", "right06");
$(
'.js_yys a:eq('+ eq_num +')').attr("class", "rightye");
},
chanpin:
function(args)
{
},
laiyuan:
function(args, eq_num)
{
var type;
switch(eq_num)
{
case 0:
$(
'#js_content_big').hide();
$(
'#content_con').show();
break;
case 1:
type
= "news";
break;
case 2:
type
= "boke";
break;
case 3:
type
= "luntan";
break;
}
if(eq_num != 0)
{
content.detail.show_xinwen_big(type);
}

$(
'#js_laiyuan a').attr("class", "right06");
$(
'#js_laiyuan a:eq('+ eq_num +')').attr("class", "rightye");

},
shijian:
function(args, eq_num)
{
G.cgi.timename
= args;
//G.flex_select = args;
search_content();

$(
'#js_shijian a').attr("class", "right06");
$(
'#js_shijian a:eq('+ eq_num +')').attr("class", "rightye");
}
}


var duibi = {
go:
function () {
alert(
"123");
},
clear:
function () {
alert(
"clear");
}
}

  

2

posted @ 2011-08-26 11:46  wangkangluo1  阅读(413)  评论(0编辑  收藏  举报