$.support.cors = true;
//load config
var configInfo = config[7];
var IframeOnClick = {
resolution: 200,
iframes: [],
interval: null,
Iframe: function() {
this.element = arguments[0];
this.cb = arguments[1];
this.hasTracked = false;
},
track: function(element, cb) {
this.iframes.push(new this.Iframe(element, cb));
if (!this.interval) {
var _this = this;
this.interval = setInterval(function() { _this.checkClick(); }, this.resolution);
}
},
checkClick: function() {
if (document.activeElement) {
var activeElement = document.activeElement;
for (var i in this.iframes) {
if (activeElement === this.iframes[i].element) {
if (this.iframes[i].hasTracked == false) {
this.iframes[i].cb.apply(window, []);
this.iframes[i].hasTracked = true;
}
} else {
this.iframes[i].hasTracked = false;
}
}
}
}
};
function uploadZhike(uploadAction) {
var params = {
project:ProjectConfig.GetQueryString('project') || 'default',
data:ProjectConfig.GetQueryString('data') || 'default',
os:ProjectConfig.getSystem() || 'default',
browser:ProjectConfig.getBrowser() || 'default',
act:uploadAction.act || 'default',
ad_id:uploadAction.ad_id || '2299618',
ad_pos:uploadAction.ad_pos || 'kuaiya_tips_1',
ad_time:new Date().getTime() || 'default',
ad_type:uploadAction.ad_type || 'dianshang',
strategy_id:uploadAction.strategy_id || '916',
idea_id:uploadAction.idea_id || '78',
plan_id:uploadAction.plan_id || '50'
};
var url = "http://sspreport.7654.com/ssp/user_click?code="+params.project + encodeURI('\t')+ params.data + encodeURI('\t')+params.os+ encodeURI('\t')+params.browser+ encodeURI('\t')+params.act+encodeURI('\t')+params.ad_id+encodeURI('\t')+params.ad_pos+encodeURI('\t')+params.ad_time+encodeURI('\t')+params.ad_type+encodeURI('\t')+params.strategy_id+encodeURI('\t')+params.idea_id+encodeURI('\t')+params.plan_id;
$.getJSON(url).done(function (data) {});
}
//function uploadAd(uploadAction) {
// var params = {
// time:new Date().getTime() || 'default',
// position:uploadAction.position || 'top_news_1',
// url:location.href,
// action:uploadAction.action,
// project:'kuaizip'
// };
// var url = "http://360adreport.news.7654.com/advertise_baidu/userclick?=time"+params.time+'&position='+params.position+'&url='+params.url+'&action='+params.action+'&project='+params.project;
// $.getJSON(url).done(function (data) {});
//}
(function () {
var ProjectConfig = {
GetQueryString: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
},
Assign :function(target) {
target = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source != null) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
},
getBrowser:function () {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
var isIE = userAgent.indexOf("compatible") > -1
&& userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
var isEdge = userAgent.indexOf("Edge") > -1; //判断是否IE的Edge浏览器
var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
var isSafari = userAgent.indexOf("Safari") > -1
&& userAgent.indexOf("Chrome") == -1; //判断是否Safari浏览器
var isChrome = userAgent.indexOf("Chrome") > -1
&& userAgent.indexOf("Safari") > -1; //判断Chrome浏览器
if (isIE) {
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp["$1"]);
if (fIEVersion == 7) {
return "IE7";
} else if (fIEVersion == 8) {
return "IE8";
} else if (fIEVersion == 9) {
return "IE9";
} else if (fIEVersion == 10) {
return "IE10";
} else if (fIEVersion == 11) {
return "IE11";
} else {
return "0";
}//IE版本过低
return "IE";
}
if (isOpera) {
return "Opera";
}
if (isEdge) {
return "Edge";
}
if (isFF) {
return "FF";
}
if (isSafari) {
return "Safari";
}
if (isChrome) {
return "Chrome";
}
},
getCookie: function () {
if (!$.cookie('dspUid')) {
var dspUid = new Date().getTime() + Math.random() * 100000 | 0;
$.cookie('dspUid', dspUid, {expires: 300, path: '/'});
}
return $.cookie('dspUid');
},
getSystem: function () {
var sUserAgent = navigator.userAgent;
var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");
if (isMac) return "Mac";
var isUnix = (navigator.platform == "X11") && !isWin && !isMac;
if (isUnix) return "Unix";
var isLinux = (String(navigator.platform).indexOf("Linux") > -1);
if (isLinux) return "Linux";
if (isWin) {
var isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1 || sUserAgent.indexOf("Windows 2000") > -1;
if (isWin2K) return "Win2000";
var isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1 || sUserAgent.indexOf("Windows XP") > -1;
if (isWinXP) return "WinXP";
var isWin2003 = sUserAgent.indexOf("Windows NT 5.2") > -1 || sUserAgent.indexOf("Windows 2003") > -1;
if (isWin2003) return "Win2003";
var isWinVista = sUserAgent.indexOf("Windows NT 6.0") > -1 || sUserAgent.indexOf("Windows Vista") > -1;
if (isWinVista) return "WinVista";
var isWin7 = sUserAgent.indexOf("Windows NT 6.1") > -1 || sUserAgent.indexOf("Windows 7") > -1;
if (isWin7) return "Win7";
var isWin10 = sUserAgent.indexOf("Windows NT 10") > -1 || sUserAgent.indexOf("Windows 10") > -1;
if (isWin10) return "Win10";
}
return "other";
},
loadBase: function () {
$('.container').append('快压-广告');
uploadZhike(uploadConfig);
document.getElementById("ak").onload = function () {
uploadConfig.act = 'show';
uploadZhike(uploadConfig);
var page_size = '370,' + document.getElementById('ak').offsetHeight;
$('head').append('');
if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') {
window.external.CppCall(page_size);
}
};
$('#ak').on('click',function () {
uploadConfig.act = 'click';
uploadZhike(uploadConfig);
});
},
uploadUrl: function (url) {
var images = new Image();
images.src = url;
}
};
window.ProjectConfig = ProjectConfig;
window.uploadConfig = {};
})();
function loadDspAd(e) {
if (e.data && e.data.length > 0) {
uploadConfig.act = 'load';
uploadZhike(uploadConfig);
var data = e.data[0];
$('.container').append('快压-广告>');
$('.image-wrapper > img')[0].src = data.miniimg[0].src;
$('.image-wrapper')[0].href = data.url;
document.getElementById("ak").onload = function () {
var page_size = "370," + document.getElementById('ak').offsetHeight;
$('head').append('');
if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') {
window.external.CppCall(page_size);
}
};
document.getElementById("ak").onerror = function () {
uploadConfig.act = 'img-fail';
uploadConfig.ad_time = data.miniimg[0].src + '&' + data.url;
uploadZhike(uploadConfig);
loadBase();
};
// 渲染
ProjectConfig.uploadUrl(data.showbackurls[0]);
uploadConfig.act = 'show';
uploadZhike(uploadConfig);
//进入可视区s域上报
if (data.isinviewbackurl) {
ProjectConfig.uploadUrl(data.inviewbackurls[0]);
}
//关闭上报
$('.close').on('click', function () {
ProjectConfig.uploadUrl(data.closebackurls[0])
});
//点击上报
$('.image-wrapper').on('click', function () {
ProjectConfig.uploadUrl(data.clickbackurls[0]);
uploadConfig.act = 'click';
uploadZhike(uploadConfig);
})
} else {
ProjectConfig.loadBase()
}
};
function closePanel() {
$('.close-panel').hide();
window.open('tag=boring');
}
function showPanel() {
if(ProjectConfig.GetQueryString('pop_menu') == 1){
$('.close-panel').show();
}else{
$('.close-panel').hide();
window.open('tag=close')
}
}
function closeWindow(){
window.open('tag=close');
}
var url = '';
if(location.host == 'news.7654.com'){
url = 'http://ssp.7654.com/ssp/list?qid=';
}else{
url = 'http://test-ssp.7654.com/ssp/list?qid='
}
$.ajax({
url: url + ProjectConfig.GetQueryString('project') + '&time='+new Date().getTime(),
type: 'get',
dataType: 'json',
success: function (obj) {
var render = true;
if(obj.data && obj.data.kuaiya_tips_1){
var data = obj.data.kuaiya_tips_1;
if(data.script.length){
for(var i =0;i不感兴趣
关闭
快压-广告