Chia sẻ thủ thuật blogspot - blogger

luat1x1

10/13/2011

Script trích xuất tin tức từ 6 kênh báo mạng Việt Nam

Công nghệ "chôm chĩa" tin tức hàng đầu từ 6 kênh báo uy tín tại Việt Nam. Code được phát triển dựa trên công nghệ truy xuất từ website Javascript-fx.com. 

<script type='text/javascript'>
var _url;
var cosspider_posDist;
var cosspider_posNow = 0;
var cosspider_popupRunning;
//Param cho new job
var job_posDist;
var job_posNow = 0;
var job_popupRunning;
/* *********************************************************
* You may use this code for free on any web page provided that
* these comment lines and the following credit remain in the code.
* Floating Div from http://www.javascript-fx.com
******************************************************** */
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
var px = document.layers ? "" : "px";
function JSFX_FloatDiv(id, sx, sy)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
window[id + "_obj"] = el;
if(d.layers)el.style=el;
el.cx = el.sx = sx;el.cy = el.sy = sy;
el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
el.flt=function()
{
var pX, pY;
pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
document.documentElement && document.documentElement.clientWidth ?
document.documentElement.clientWidth : document.body.clientWidth;
pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ?
document.documentElement.scrollTop : document.body.scrollTop;
if(this.sy<0)
pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
document.documentElement.clientHeight : document.body.clientHeight;
this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
this.sP(this.cx, this.cy);
setTimeout(this.id + "_obj.flt()", 40);
}
return el;
}
//Kết thúc mã nguồn tạo float-div lấy từ site http://www.javascript-fx.com
function GiaoLuu()
{
document.write("<a href='javascript:MoCuaSo(_url)'><img src='http://www.dichvucongdong.com/giaoluu.png' border='0' alt='Phòng giao lưu trực tuyến'/></a>");
}
function MoCuaSo(url)
{
window.open(url,'','width=710, height=550, status=No, scrollbars=Yes, resizable=Yes', '_blank');
}
//Hàm chống sql inject và XSS attack
function Chong_Hack(ketqua)
{
var _kq;
//Loại bỏ khoảng trống
_kq = ketqua.replace(" ","_");
return _kq;
}
function Call_COSSpider(_x,_y,_news,_content)
{
document.write("<iframe style='width:" + Chong_Hack(_x) + "; height:" + Chong_Hack(_y) + "; text-align: justify; overflow-x:hidden; overflow-y:scroll;' frameborder='0' style='background-color: white; z-index:auto;' allowtransparency='true' src='http://www.dichvucongdong.com/Tester/COSSpider.aspx?news="+ Chong_Hack(_news) +"&content="+ Chong_Hack(_content) +"';></iframe>");
}
function Call_COSSpider2(_img,_news,_content)
{
//Vẽ button trước
document.write("<img src='"+ Chong_Hack(_img) +"' onclick='ShowPopup();' style='cursor:hand; cursor:pointer;' alt='Dịch vụ tự động thu thập tin tức được cung cấp tại http://www.dichvucongdong.com' title='Dịch vụ tự động thu thập tin tức được cung cấp tại http://www.dichvucongdong.com'/>");
//Vẽ div control chứa kết quả tin trả về
document.write("<div id='cosspider_newsdiv' style='border-right: mediumturquoise 1px solid; border-top: mediumturquoise 1px solid; border-left: mediumturquoise 1px solid; border-bottom: mediumturquoise 1px solid; background-color: lightcyan; z-index:100001; display:none; width: 650px; position: absolute; margin-left:auto; margin-right:auto; left:0; right:0; margin-top:auto; margin-bottom:auto;'><span onclick='ShowPopupDown();' style='cursor:hand; cursor:pointer; font-family:Tahoma; font-size:8pt; color:red; font-weight:bold; margin-left:620px;' title='Đóng cửa sổ tin tức'>[ X ]</span><iframe style='width:100%; height:370px; overflow-x:hidden; overflow-y:scroll;' frameborder='0' style='background-color: white; z-index:auto;' allowtransparency='true' src='http://www.dichvucongdong.com/Tester/COSSpider.aspx?news="+ Chong_Hack(_news) +"&content="+ Chong_Hack(_content) +"'></iframe></div>");
//FLoat div
JSFX_FloatDiv("cosspider_newsdiv", 10, 10).flt();
}
//3 Hàm hiển thị popup tin
function ShowPopup()
{
if( cosspider_popupRunning) return;
cosspider_popupRunning = true;
var div = document.getElementById("cosspider_newsdiv");
// Thiết đặt vị trí xuất hiện
div.style.display = "block";
cosspider_posDist = div.offsetHeight;
div.style.height = "0px";
div.style.overflow = "hidden";
ShowPopupUp();
}
function ShowPopupUp()
{
var div = document.getElementById( "cosspider_newsdiv");
var dist = cosspider_posDist - cosspider_posNow;
if( dist >1)
{
cosspider_posNow += Math.ceil( dist/2);
div.style.height = cosspider_posNow +"px";
setTimeout( "ShowPopupUp();", 25);
}
else
{
div.style.height = cosspider_posDist;
//setTimeout( "popupDown();", 500);
}
}

function ShowPopupDown()
{
var div = document.getElementById( "cosspider_newsdiv");
var dist = cosspider_posNow;
if( dist >1)
{
cosspider_posNow -= Math.ceil( dist/2);
div.style.height = cosspider_posNow +"px";
setTimeout( "ShowPopupDown();", 25);
}
else
{
div.style.height = cosspider_posDist +"px";
div.style.display = "none";
cosspider_popupRunning = false;
}
}
//3 Hàm hiển thị job
function ShowJPopup()
{
if( job_popupRunning) return;
job_popupRunning = true;
var div = document.getElementById("new_Jobs");
// Thiết đặt vị trí xuất hiện
div.style.display = "block";
job_posDist = div.offsetHeight;
div.style.height = "0px";
div.style.overflow = "hidden";
ShowJPopupUp();
}
function ShowJPopupUp()
{
var div = document.getElementById( "new_Jobs");
var dist = job_posDist - job_posNow;
if( dist >1)
{
job_posNow += Math.ceil( dist/8);
div.style.height = job_posNow +"px";
setTimeout( "ShowJPopupUp();", 25);
}
else
{
div.style.height = job_posDist;
setTimeout( "ShowJPopupDown();", 7000);
}
}

function ShowJPopupDown()
{
var div = document.getElementById( "new_Jobs");
var dist = job_posNow;
if( dist >1)
{
job_posNow -= Math.ceil( dist/8);
div.style.height = job_posNow +"px";
setTimeout( "ShowJPopupDown();", 25);
}
else
{
div.style.height = job_posDist +"px";
div.style.display = "none";
job_popupRunning = false;
}
}
</script>

<script type='text/javascript'>Call_COSSpider('560px','300px','Không chỉ định','');</script>

Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 nhận xét

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© 2011 Luat1x1
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0
Posts RSSComments RSS
Back to top