cookie-网页里的一段超级复杂的javascript代码,不知道做什么用的,问了几个高手都无法解答

问题描述

网页里的一段超级复杂的javascript代码,不知道做什么用的,问了几个高手都无法解答

第一段:
<br>
/*&lt;![CDATA[*/<br>
var DataBrainConfig = {'SiteId':'5960','ConfigurationId':'1','AutoIntegration':true,'checkTimeMeter':1,'useDMP':true,'timeRequestLimit':500,'dmpPartnerKey':'6SysO2MEZq69sDxIvJm58g2','customAttributes':[{'Name':'vertical','Value':'dating'}]};var data_brain = false;<br>
var JSON; if (!JSON) { JSON = {}; }</p>

<p>if (typeof JSON.stringify !== 'function') {<br>
JSON.stringify = function (value, replacer, space) {<br>
var i; gap = ''; indent = ''; if (typeof space === 'number') { for (i = 0; i &lt; space; i += 1) { indent += ' '; } } else if (typeof space === 'string') { indent = space; }<br>
rep = replacer; if (replacer &amp;&amp; typeof replacer !== 'function' &amp;&amp; (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); }<br>
return str('', { '': value });<br>
};<br>
}</p>

<p>/**<br>
*</p>

<ul>
<li>@constructor
*/
function DataBrain() {
this.TrackerUrl = '<a href="http://tracker.databrain.com">http://tracker.databrain.com</a>';
this.AT_LOADPAGE = 1;
this.siteid = 0;
this.cfid = 0;
this.at = 0;
this.vid = 0;
this.checkTimeMeter = 0;
this.startTime = 0;
this.startResponseTime = 0;
this.endTime = 0;
this.trackError = 0;
this.RequestStatuses = ['start', 'progress', 'finished', 'error'];
this.requestStatus = this.RequestStatuses[0];
this.methods = ['ajax', 'script'];
this.method = this.methods[1];
this.ap = {};
this.timeRequestLimit = 300;
this.useDMP = false;
this.mergeData = {};
this.dmpPartnerKey = '';
this.ca = [];
this.init();
}</li>
</ul>

<p>/**</p>

<ul>
<li>init
*/
DataBrain.prototype.init = function() {
this.getVid();
this.setParam();
if ( 0 != this.checkTimeMeter) {
this.startTrackMeter();
}
this.trackDataBrain();
};</li>
</ul>

<p>/**</p>

<ul>
<li>Start Track Meter
*/
DataBrain.prototype.startTrackMeter = function() {
this.startTime = new Date().getTime();
};</li>
</ul>

<p>/**</p>

<ul>
<li>Start Track Response Meter
*/
DataBrain.prototype.startReponseMeter = function() {
this.startResponseTime = new Date().getTime();
};</li>
</ul>

<p>/**</p>

<ul>
<li>End Track Meter
*/
DataBrain.prototype.endTrackMeter = function() {
this.endTime = new Date().getTime();
};</li>
</ul>

<p>/**</p>

<ul>
<li>End Track Meter
*/
DataBrain.prototype.getTrackMeterTime = function() {
var timeDiff = this.endTime - this.startTime;
return timeDiff;
};</li>
</ul>

<p>DataBrain.prototype.getCurrentMeterTime = function() {<br>
return new Date().getTime() - this.startResponseTime;<br>
}</p>

<p>/**</p>

<ul>
<li>Get Vid
*/
DataBrain.prototype.getVid = function() {
this.vid = document.cookie.substr(document.cookie.indexOf('vid=')+4, 36);
};</li>
</ul>

<p>/**<br>
*</p>

<ul>
<li>@param cookieName</li>
<li>@param cookieValue</li>
<li>@param nDays</li>
<li>@constructor
*/
DataBrain.prototype.SetCookie = function(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+'='+escape(cookieValue)
+ ';expires='+expire.toGMTString() + ';path=/';
};</li>
</ul>

<p>/**</p>

<ul>
<li>Set Vid To Cookie
*/
DataBrain.prototype.setVid = function(vid) {
this.SetCookie('vid', vid, 365);
};</li>
</ul>

<p>/**</p>

<ul>
<li>Check Vid</li>
<li>@returns {boolean}
*/
DataBrain.prototype.isSettedVid = function() {
var result = false;
if ( 0 &lt; parseInt(this.vid) ) {
result = true;
}
return result;
};</li>
</ul>

<p>/**</p>

<ul>
<li>Set Parameters to track action in DataBrain
*/
DataBrain.prototype.setParam = function() {
this.siteid = DataBrainConfig.SiteId;
this.cfid = parseInt(DataBrainConfig.ConfigurationId);
this.at = parseInt(DataBrainConfig.AutoIntegration);
this.checkTimeMeter = parseInt(DataBrainConfig.checkTimeMeter);
this.ap = this.getActionParam();
this.ca = DataBrainConfig.customAttributes;
this.useDMP = DataBrainConfig.useDMP;
this.timeRequestLimit = parseInt(DataBrainConfig.timeRequestLimit);
this.dmpPartnerKey = DataBrainConfig.dmpPartnerKey;
};</li>
</ul>

<p>/**</p>

<ul>
<li>Return parameters of page to Action</li>
<li><p>@returns {{Content: string, Referrer: string, Title: string}}<br>
*/<br>
DataBrain.prototype.getActionParam = function() {<br>
var _location = document.location.href.substring(0, 300);<br>
var _referrer = document.referrer.substring(0, 300);<br>
var _title = document.title.substring(0, 300);</p>

<p>return { Content: _location, Referrer: _referrer, Title: _title };<br>
};</p></li>
</ul>

<p>/**</p>

<ul>
<li>init request to trackDataBrain
*/
DataBrain.prototype.trackDataBrain = function() {
if ( this.methods[1] == this.method ) {
this.scriptDataBrain();
} else {
this.requestToDataBrain();
}
};</li>
</ul>

<p>/**</p>

<ul>
<li>Prepare Data to send request</li>
<li><p>@returns {string}<br>
*/<br>
DataBrain.prototype.prepareData = function() {</p>

<p>var params = 'siteid=' + this.siteid + '&amp;cfid=' + this.cfid + '&amp;at=' + this.AT_LOADPAGE;</p>

<p>if (this.useDMP != true) {<br>
params = '/track.ashx?' + params;<br>
} else {<br>
params = '/bridge.ashx?' + params + '&amp;partnerKey=' + this.dmpPartnerKey;<br>
}</p>

<p>params += (this.ap == {} ? '' : '&amp;ap=' + escape(JSON.stringify(this.ap)));<br>
params += (this.ca ? '&amp;ca=' + escape(JSON.stringify(this.ca)) : '');<br>
return params;<br>
};</p></li>
</ul>

<p>/**</p>

<ul>
<li>Prepare Data to send request</li>
<li><p>@returns {string}<br>
*/<br>
DataBrain.prototype.prepareDataScript = function() {<br>
var params = 'siteid=' + this.siteid + '&amp;cfid=' + this.cfid + '&amp;at=' + this.AT_LOADPAGE;</p>

<p>if (this.useDMP != true) {<br>
params = '/track.ashx?' + params;<br>
} else {<br>
params = '/bridge.ashx?' + params + '&amp;partnerKey=' + this.dmpPartnerKey;<br>
}</p>

<p>params += (this.ap == {} ? '' : '&amp;ap=' + encodeURIComponent(JSON.stringify(this.ap)));<br>
params += (this.ca ? '&amp;ca=' + encodeURIComponent(JSON.stringify(this.ca)) : '');<br>
return params;<br>
};</p></li>
</ul>

<p>/**</p>

<ul>
<li><p>Send request<br>
*/<br>
DataBrain.prototype.requestToDataBrain = function() {<br>
var req = new XMLHttpRequest();<br>
var body = '';<br>
var self = this;<br>
this.requestStatus = this.RequestStatuses[1];<br>
if ('withCredentials' in req) {<br>
self.startReponseMeter();<br>
req.open('GET', this.TrackerUrl + this.prepareData(), true);<br>
req.onreadystatechange = function() {<br>
if (req.readyState === 4) {<br>
if (req.status &gt;= 200 &amp;&amp; req.status &lt; 400) {<br>
var res = req.responseText;</p>

<pre><code> if (self.useDMP == true) {
self.handleResponseDMP(self, res);
} else {
self.handleResponse(self, res);
}
} else {
self.handleError(self);
}
}
};
req.send(body);
</code></pre>

<p>}<br>
};</p></li>
</ul>

<p>/**</p>

<ul>
<li><p>Request script<br>
*/<br>
DataBrain.prototype.scriptDataBrain = function() {<br>
var req = new XMLHttpRequest();<br>
var body = '';<br>
var self = this;<br>
this.requestStatus = this.RequestStatuses[1];<br>
document.addEventListener('DOMContentLoaded',<br>
function(){<br>
var script = document.createElement('script');<br>
self.startReponseMeter();<br>
script.setAttribute('src', self.TrackerUrl + self.prepareDataScript());<br>
document.body.appendChild(script);</p>

<pre><code> script.onload = function(){
if (self.useDMP == true) {
self.handleResponseDMP(self);
} else {
self.handleResponse(self);
}
};
});
</code></pre>

<p>};</p></li>
</ul>

<p>/**</p>

<ul>
<li>Request Callback
*/
DataBrain.prototype.handleResponse = function(self, res) {
if ( this.methods[1] != this.method ) {
eval(res);
}
if ( !self.isSettedVid() || self.vid != <strong><em>dbVid ) {
self.setVid(</em></strong>dbVid);
}
self.requestStatus = this.RequestStatuses[2];
if ( 0 != self.checkTimeMeter) {
self.endTrackMeter();
console.log(self.getTrackMeterTime());
}
};</li>
</ul>

<p>/**</p>

<ul>
<li>Request Callback using DMP data
*/
DataBrain.prototype.handleResponseDMP = function(self, res) {</li>
</ul>

<p>// console.log(self.TrackerUrl + self.prepareDataScript());</p>

<pre><code>if ( this.methods[1] != this.method ) {
eval(res);
}

if (typeof ___dbDmpVisit.Vid !== &quot;undefined&quot;) {
if ( !self.isSettedVid() || self.vid != ___dbDmpVisit.Vid ) {
self.setVid(___dbDmpVisit.Vid);
}
}

if (typeof ___dbDmpVisit.SessionStats !== &quot;undefined&quot;) {
self.setMergeData(___dbDmpVisit);
}

self.requestStatus = this.RequestStatuses[2];
if ( 0 != self.checkTimeMeter) {
self.endTrackMeter();
// console.log(self.getTrackMeterTime());
}
</code></pre>

<p>};</p>

<p>/**</p>

<ul>
<li>Request Callback
*/
DataBrain.prototype.handleError = function(self) {
self.trackError = 1;
self.requestStatus = this.RequestStatuses[3];
};</li>
</ul>

<p>DataBrain.prototype.getMergeData = function() {<br>
return this.mergeData;<br>
};</p>

<p>DataBrain.prototype.getData = function() {<br>
return (this.mergeData.dmpData) ? this.mergeData.dmpData : {};<br>
}</p>

<p>DataBrain.prototype.setMergeData = function(data) {<br>
this.mergeData.dmpData = data;<br>
this.mergeData.dbTimeScript = this.getCurrentMeterTime();<br>
};</p>

<p>/**</p>

<ul>
<li>Function Track action to DataBrain and get parameter Vid
<em>/
(function() {
data_brain = new DataBrain();
})();
/</em>]]&gt;*/

第二段:

/*<![CDATA[*/
var _isGotoJump = false; window.open=function(url){ if(!_isGotoJump) {location.href=url; _isGotoJump = true; return false;}}
document.body.style.display = 'none';
autoLogin = {
href : 'http://www.xxxx.com/site/redirectpage?ca=link&sid=6170&trid=16596&hv=f5fb029be166ab63f639a6e7c0e794b1',
tRid : '16596',
sid : 6170,
rules : [{"name":"Rule0","conditions":[{"domain":"benaughty.com","condition":"!=","count":"0"}],"url":"http://www.targeturl.com/ext.php?dynamicpage=5step_focus&a_aid=adsbr","parameters":"static"}],
useDMP : true
};
var hv="f5fb029be166ab63f639a6e7c0e794b1";document.addEventListener("DOMContentLoaded", function(event) {var link = document.getElementsByTagName('a');for(var i=0;i<link.length;i++){attribute = link[i].getAttribute('onclick');if(Boolean(attribute) && attribute.match('/site/redirectpage')){link[i].setAttribute('onclick', attribute.replace("',", "&hv=" + hv + "',"));}}});
/*]]>*/

解决方案

你最起码应该format一下再发上来吧?
这有谁愿意去看

时间: 2024-09-25 18:47:37

cookie-网页里的一段超级复杂的javascript代码,不知道做什么用的,问了几个高手都无法解答的相关文章

一个网页上随鼠标移动显示时钟的javascript 代码

javascript|时钟|鼠标|网页|显示 <SCRIPT language=JavaScript><!--dCol='0000FF';//date colour.fCol='0000FF';//face colour.sCol='0000FF';//seconds colour.mCol='0000FF';//minutes colour.hCol='0000FF';//hours colour.ClockHeight=40;ClockWidth=40;ClockFromMouseY

网页上显示时间的最简单的Javascript代码

javascript|网页|显示 <div id="webjx"><script>setInterval("webjx.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);</script></div>

怎样将网页地址加入浏览器中 用javascript代码编写的代码实现

问题描述 [size=24px][size=18px]如何将网页地址添加到浏览器收藏夹中用javascript代码编写的我在把自己写的网页路径添加到浏览器中怎么不行呀浏览器中地址的格式一定要为http开头的吗??谢谢大家帮我解决一下 解决方案 解决方案二:谢谢各位学哥学姐们啦帮小弟解答一下

求c#获取指定网页的cookie值并截取其中一段!

问题描述 求c#获取指定网页的cookie值并截取其中一段!登录一个网页获取网页的cookie值,并截取其中段,然后添加到www.xxx.com/1.php=获取的指定值! 解决方案 解决方案二:用正则或者IndexOf()然后substring下解决方案三:字符串处理下即可解决方案四:我现在是不知道用什么获取cookie解决方案五:HttpWebRequesthttpRequest.CookieContainer解决方案六:HttpCookiecookie=Request.Cookies["名

利用javascript和canvas获取UIWebView网页里的图片(不用再下载)

在UIWebView网页里要获取img标签的图片,网上的方法都是通过获取到URL然后自己再下载一遍,耗流量.耗时间.不能通过验证. 这里是利用UIWebView的stringByEvaluatingJavaScriptFromString函数,执行一段js,返回图片数据. 流程为: 获取img标签,可以用各种方法,ById,ByTags,elementFromPoint等. 创建canvas标签,创建context,把canvas设置成和图片一样大 把img画到context里 返回canvas

百度工程师告诉你网页里注释的内容是否会被抓取

摘要: 很多站长都知道网页代码里面有注释代码这么个东西,其形式是!-注释内容-,在HTML里面注释的内容出现在网页源代码,而用户浏览网页的过程中是看不到的.因为注释内容在源代码展现 很多站长都知道网页代码里面有注释代码这么个东西,其形式是<!-注释内容->,在HTML里面注释的内容出现在网页源代码,而用户浏览网页的过程中是看不到的.因为注释内容在源代码展现又不会影响页面内容,所以很多人觉得蜘蛛会抓取注释信息并参与到网页的分析排名,于是在网页加入大量的注释内容,甚至直接在注释里面堆砌关键词. 那

网页里注释的内容会被抓取吗?

很多站长都知道网页代码里面有注释代码这么个东西,其形式是,在HTML里面注释的内容出现在网页源代码,而用户浏览网页的过程中是看不到的.因为注释内容在源代码展现又不会影响页面内容,所以很多人觉得蜘蛛会抓取注释信息并参与到网页的分析排名,于是在网页加入大量的注释内容,甚至直接在注释里面堆砌关键词. 那么网页里注释的内容会被抓取吗?我们先来看看百度工程师是如何回答的: 问:注释掉的内容否会被百度抓取分析? 百度工程师:在html中的注释内容,会在正文提取环节忽略.虽然注释的代码不会被抓取,但也会造成代

php获取网页里所有图片并存入数组的方法

 本文实例讲述了php获取网页里所有图片并存入数组的方法.分享给大家供大家参考.具体如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 $images = array(); preg_match_all('/(img|src)=("|')[^"'>]+/i', $data, $media); unset($data); $data=preg_replace('/(img|src)("|'|="|=')(.*)/i',"

安全-Delphi7做的ocx在本地网页里调用不到

问题描述 Delphi7做的ocx在本地网页里调用不到 在开发机器里可以正常调用. 把ocx复制到其他机器,regsvr32注册,就调用失败. 已经实现了安全接口. 请问是什么问题啊? 解决方案 估计是权限的问题,把ocx的权限设置为IIS可以访问,再试试 解决方案二: 现在还没有在服务器上跑.只是在本地的html里调用. ocx权限IIS可访问在哪里可以设置? 解决方案三: 权限的问题,把ocx的权限设置为IIS可以访问. 你用iis打开,可能是用的本地internet区域,找到这个区域的权限