?? nnselect.js
字號:
/*----------------code for Nielsen--------------------*/ var nn_undefined;function nn_isNull(object) { return nn_undefined == object || object == null;}var nn_domainSuffixes = [ "com", "net", "org", "biz", "info", "gov", "edu", "mil" ];function nn_arrayContains(nn_array, nn_token) { for (var nn_i = 0; nn_i < nn_array.length; nn_i++) { if (nn_array[nn_i] == nn_token) { return true; } } return false;}function nn_removePort(nn_domain) { var nn_colonIndex = nn_domain.lastIndexOf(':'); if (nn_colonIndex > 0) { return nn_domain.substring(0, nn_colonIndex); } return nn_domain;}function nn_getMinimumDomain(nn_domain) { if (nn_isNull(nn_domain)) { return null; } nn_domain = nn_domain.toLowerCase(); nn_domain = nn_removePort(nn_domain); var nn_index = nn_domain.length; while (3 < nn_index && nn_domain.charAt(nn_index - 3) == '.') { nn_index -= 3; } var nn_previousIndex = nn_index; nn_index = nn_domain.lastIndexOf('.', nn_index - 1); var nn_token = nn_domain.substring(nn_index + 1, nn_previousIndex); if (nn_arrayContains(nn_domainSuffixes, nn_token) && nn_index > 0) { nn_previousIndex = nn_index; nn_index = nn_domain.lastIndexOf('.', nn_index - 1); } if (nn_index == -1 || nn_domain.charAt(nn_index) == '.') { nn_index ++; } if (nn_index == nn_previousIndex) { return "." + nn_domain; } return "." + nn_domain.substring(nn_index);}var nn_THREE_YEARS_IN_MILLIS = (1000 * 60 * 60 * 24 * 365 * 3);/* public */ function nn_Cookie(name) { /* public */ this.setCookie = nn_Cookie_setCookie; this.getCookie = nn_Cookie_getCookie; this.expireCookie = nn_Cookie_expireCookie; /* private */ this.m_name = name;}/* private */ function nn_Cookie_getExpirationDate(expireDate) { if (!nn_isNull(expireDate)) { return expireDate; } else { return new Date(new Date().getTime() + nn_THREE_YEARS_IN_MILLIS); }}/* private */ function nn_Cookie_getExpirationDateAsString(expireDate) { return nn_Cookie_getExpirationDate(expireDate).toGMTString();}function nn_Cookie_createCookieDescriptionWithoutDomain(name, value, expireDate) { var cookieDescription = name + "=" + escape(value); cookieDescription += "; path=/"; cookieDescription += "; expires=" + nn_Cookie_getExpirationDateAsString(expireDate); return cookieDescription;}function nn_Cookie_createCookieDescription(name, value, expireDate, domain) { var cookieDescription = nn_Cookie_createCookieDescriptionWithoutDomain(name, value, expireDate); if (nn_isNull(domain) && document.domain) { domain = document.domain; } if (!nn_isNull(domain)) { cookieDescription += "; domain=" + escape(nn_getMinimumDomain(domain)); } return cookieDescription;}/* public */ function nn_Cookie_setCookie(name, value, expireDate, domain) { nn_Cookie_expireCookie(name); document.cookie = nn_Cookie_createCookieDescription(name, value, expireDate, domain); if (nn_isNull(nn_Cookie_getCookie(name))) { document.cookie = nn_Cookie_createCookieDescriptionWithoutDomain(name, value, expireDate); }}/* private */ function nn_Cookie_getCookie(name) { var key = name + "="; var startOfCookie = document.cookie.indexOf("; " + key); if (-1 != startOfCookie) { startOfCookie += 2; } else if (0 == document.cookie.indexOf(key)) { startOfCookie = 0; } else { return null; } var endOfCookie = document.cookie.indexOf(";", startOfCookie); if (endOfCookie == -1) { endOfCookie = document.cookie.length; } var value = document.cookie.substring(startOfCookie + key.length, endOfCookie); value = unescape(value); return (value != "") ? value : null;}/* public */ function nn_Cookie_expireCookie(name, domain) { var expiredTime = new Date(new Date().getTime() - 1000*60*60); document.cookie = nn_Cookie_createCookieDescription(name, "", expiredTime, domain); if (!nn_isNull(nn_Cookie_getCookie(name))) { document.cookie = nn_Cookie_createCookieDescriptionWithoutDomain(name, "", expiredTime); }}var nn_DATE_THROTTLE_COOKIE_NAME = "nnselect";var nn_ONE_DAY_IN_MILLIS = 1000 * 60 * 60 * 24;function nn_DateThrottle() { // public this.shouldThrottle = nn_DateThrottle_shouldThrottle; // private this.getOrCreate = nn_DateThrottle_getOrCreate; this.getCookie = nn_DateThrottle_getCookie; this.createCookie = nn_DateThrottle_createCookie; this.updateCookie = nn_DateThrottle_updateCookie; this.createCookieValue = nn_DateThrottle_createCookieValue; this.m_cookieName = nn_DATE_THROTTLE_COOKIE_NAME;}/* public */ function nn_DateThrottle_shouldThrottle() { var cookieValue = parseInt(this.getOrCreate()); var now = new Date().getTime(); var dateToStartSurvey = cookieValue + (nn_ONE_DAY_IN_MILLIS * 7); return (now < dateToStartSurvey);}/* private */ function nn_DateThrottle_getOrCreate() { var cookie = this.getCookie(); if (nn_isNull(cookie)) { cookie = this.createCookie(); } return cookie;}/* private */ function nn_DateThrottle_getCookie() { return nn_Cookie_getCookie(this.m_cookieName);}/* private */ function nn_DateThrottle_createCookie() { var now = new Date(); var offset = nn_ONE_DAY_IN_MILLIS * -8; var cookieValue = this.createCookieValue(now, offset); nn_Cookie_setCookie(this.m_cookieName, cookieValue); return cookieValue;}/* private */ function nn_DateThrottle_updateCookie() { var now = new Date(); var cookieValue = this.createCookieValue(now, 0); nn_Cookie_expireCookie(this.m_cookieName); nn_Cookie_setCookie(this.m_cookieName, cookieValue); return cookieValue;}/* private */ function nn_DateThrottle_createCookieValue(date, offset) { var cookieValue = date.getTime() + offset; return cookieValue.toString();}function nn_write_document(str) { document.write(str);}function nn_survey(visitorid) { var nn_dateThrottle = new nn_DateThrottle(); if ((visitorid % 64 == 0) && !nn_dateThrottle.shouldThrottle()) { nn_dateThrottle.updateCookie(); nn_write_document("<iframe src='http://survey.nnselect.com/survey/confirm_panelist_119.html' name='nn_frame' height='0' width='0' scrolling='no' frameborder='0' marginWidth='0' marginHeight='0'></iframe>"); }}function nn_build_ping_url(filename) { var nn_now = new Date(); var nn_title; if (!window.encodeURI) { nn_title = escape(document.title); } else { nn_title = window.encodeURI(document.title); } var nn_imageUrl = "http://ping.nnselect.com/" + filename + "?d=" + nn_now.getTime() + "&c=119" + "&u=" + escape(document.URL) + "&t=" + nn_title; return nn_imageUrl;}function nn_send_ping(url) { if (document.images) { var nn_image = new Image(); nn_image.src = url; } else { nn_write_document("<img src='" + url + "' height='1' width='1'>"); }}function nn_simple_ping() { nn_send_ping(nn_build_ping_url("ping.gif"));}function nn_ping_and_set_local_cookie() { nn_write_document("<scr" + "ipt language='javascript' src='" + nn_build_ping_url("sping.js") + "'></scr" + "ipt>");}function nn_set_visitor_cookie(cookieValue) { nn_Cookie_setCookie("nn_V", cookieValue); nn_survey(cookieValue);}function nn_survey_main() { var nn_cookieValue = nn_Cookie_getCookie("nn_V"); if (!nn_isNull(nn_cookieValue)) { if ((nn_cookieValue % 64) == 0) { nn_simple_ping(); nn_survey(nn_cookieValue); } } else { nn_ping_and_set_local_cookie(); }}nn_survey_main();/*----------------code for Nielsen--------------------*/ /*----------------code for Sohu.com--------------------*/var COOKIESPAN = 1000*86400*365*5;var cv = new Date().getTime();var ckexp;var name="scid";var bgn = document.cookie.indexOf("; " + name+"="); if ((bgn==-1)&&(0 != document.cookie.indexOf(name+"="))) { var cvstr=escape(cv*1000+Math.round(Math.random()*1000)); ckexp=new Date( cv + COOKIESPAN ); if (document.URL.indexOf(".sohu.com/") > 0) { var ckstr=name+"="+cvstr+"; path=/; expires="+ckexp.toGMTString()+"; domain=sohu.com"; document.cookie=ckstr; window.open('http://js.chinaren.com/scid.htm?'+cvstr,'scid', 'width=1,height=1,left=1000,top=1000'); } else if (document.URL.indexOf(".chinaren.com/") > 0) { var ckstr=name+"="+cvstr+"; path=/; expires="+ckexp.toGMTString()+"; domain=chinaren.com"; document.cookie=ckstr; window.open('http://js.sohu.com/scid.htm?'+cvstr,'scid', 'width=1,height=1,left=1000,top=1000'); } } else { var imageUrl; if (document.URL.indexOf(".chinaren.com/") > 0) { imageUrl ="http://pv.chinaren.com/pv.gif" +"?t?=" + cv +"?r?="+document.referrer; } else { if ( 2 == Math.round(Math.random()* 10)) { imageUrl ="http://"+document.cookie.substr(bgn+11,5)+escape(new Date().getTime()).substr(7,6)+".dom.sohu.com/pv.gif"; } else { imageUrl ="http://pv.sohu.com/pv.gif" +"?t?=" + cv +"?r?="+document.referrer; } } if (document.images) { var image = new Image(); image.src = imageUrl; } else { document.write("<img src='" + imageUrl + "' height='1' width='1'>"); } } //add by Chenye to set cookie SUV var domainstr; if ((document.cookie == "")||(document.cookie.indexOf("SUV=")<0)) { if (document.URL.indexOf(".sohu.com/") > 0) { domainstr="sohu.com"; } else if(document.URL.indexOf(".chinaren.com/") > 0) { domainstr="chinaren.com"; } else if(document.URL.indexOf(".sohu.net/") > 0) { domainstr="sohu.net"; } else if(document.URL.indexOf(".17173.com/") > 0) { domainstr="17173.com"; } else if(document.URL.indexOf(".focus.cn/") > 0) { domainstr="focus.cn"; } else { domainstr="sohu.com"; } document.write("<scr" + "ipt language='javascript' src='http://pv.sohu.com/suv/" + domainstr + "'></scr" + "ipt>"); }/*----------------code for Sohu.com--------------------*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -