//ajax/json cors跨域开关
$.support.cors = true;
if (typeof console == 'undefined') {window.console = {log: function () {}}}
// 360宏替换参数
var Macro = {start: "__EVENT_TIME_START__", end: "__EVENT_TIME_END__", x: "__OFFSET_X__", y: "__OFFSET_Y__"};
//公用
(function () {
var common = {
getUserId: function () {
return (+new Date()) + Math.random().toString(10).substring(2, 6);
},
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;
},
getIeVersion:function () {
if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i)=="8.") {
return "IE8";
} else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i)=="9.") {
return "IE9" ;
}else{
return "!IE"
}
},
recommend_uid:function(){
function gethash(s) {
var m;
if (s.indexOf('?') > 0) {
var k = s.split('?')[1];
m = k.length;
} else {
m = 0;
}
return m;
}
var uid = function () {
var d = (new Date() - 0);
var s = window.location.href;
var hash = gethash(s);
uid = "" + d + hash + Math.random() + Math.random() + Math.random() + Math.random();
uid = uid.replace(/\./g, "").substring(0, 32);
return uid;
};
var ml = uid();
var cookie_uid = function () {
$.cookie('cookie_uid_ad', ml, {
expires: 30,
path: '/',
domain: 'news.7654.com'
});
};
if (!$.cookie('cookie_uid_ad')) {
uidm = ml;
cookie_uid(ml);
} else {
uidm = $.cookie('cookie_uid_ad');
}
return uidm;
},
newDate:function(str){
var day = str.split(' ');
var days = day[0].split('-');
var mi = day[day.length - 1].split(':');
var date = new Date();
date.setUTCFullYear(days[0], days[1] - 1, days[2]);
date.setUTCHours(mi[0] - 8, mi[1], mi[2]);
return date;
},
getProject:function(pro){
var newsproject=Common.GetQueryString("newsproject")?Common.GetQueryString("newsproject"):"mininews_ys001_kuaizip_kuaiya"
var arr=newsproject.split("_");
if(pro=="upload_project"){
return ''+arr[0]+'_'+arr[1]+''
}else if(pro=="ssp_project"){
return arr[2]
}else{
return arr[3]
}
},
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";
},
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";
}
},
mini_readerExp:function (data){
var mini_reader;
if(data.readStatus== 1){//mini阅读器
mini_reader=data.openUrl.indexOf("?")>0?"&adtype=zhike":'?adtype=zhike"';
}else{
mini_reader=data.openUrl.indexOf("?")>0?'&adtype=""':'?adtype=""';
}
return mini_reader;
}
};
window.Common = common;
})();
//根据域名配置
var proConfig = {
upload_project:Common.getProject("upload_project"),
ssp_project:Common.getProject("ssp_project"),
adpos_project:Common.getProject("adpos_project"),
mini_name: '002',
qid: {rewen:'k002',toutiao:'k002',shehui:'k002',yule:'k002',shipin:'k002',tiyu:'k002',qiche:'k002',junshi:'k002',yangsheng:'k002',youxi:'k002',guoji:'k002',shishang:'k002',lishi:'k002',keji:'k002',caijing:'k002',xiaohua:'k002'},
left_tab:{youxi:'游戏',yangsheng:'养生',junshi:'军事',qiche:'汽车',tiyu:'体育',shipin:'视频',yule:'娱乐',shehui:'社会',toutiao:'推荐'},
left_tab_more:{guoji:'国际',shishang:'时尚',lishi:'历史',keji:'科技',caijing:'财经',xiaohua:'笑话'},
loadUrl:{online_url1:'//miniapi.7654.com/mini/news/page_type/pn/abckantu/type/',hotUrl:'//news.7654.com/tpop4/miniapi/recommend.json',
recommendUrl:'//miniapi.7654.com/mini/news/recommend'},
qid_index: {rewen:1,toutiao:1,shehui:1,yule:1,shipin:1,tiyu:1,qiche:1,junshi:1,yangsheng:1,youxi:1,guoji:1,shishang:1,lishi:1,keji:1,caijing:1,xiaohua:1},
message_flow_showId_first: true,
hot_showId_first: true,
top_right_showId_first: true,
sspAdpos_top_1:Common.getProject("adpos_project")+'_minitop_1',
sspAdpos_out_1:Common.getProject("adpos_project")+'_miniout_1',
loadList:[],
titledspFlag:true,
outdspFlag:true,
renderFlag:true,
currentIndex:0,
render360Flag:true,
sspData:[]
};
var user_uid = Common.getUserId();
var timer0510;
$('.left_nav .nav_item').hover(function () {
if ($(this).hasClass('hover')) {
$(this).find('.more_nav').show()
}
var x = 0;
var that = this;
timer0510 = setInterval(function () {
x++;
if (x > 3) {
clearInterval(timer0510)
$('.left_nav .nav_item').removeClass('active');
$(that).addClass('active');
$('.left_nav .nav_item_part').removeClass('active');
var type = $(that).attr('date-type');
if (type) {
var method = $(that).attr('method');
var first_view = $('.left_nav li:eq(0)').attr('method');
if (type != 'toutiao' && !first_view) {
$('.left_nav li:eq(0)').attr('method', 'change_view');
}
Mini[method] ? Mini[method]($(that), event) : '';
}
}
}, 100)
}, function () {
if ($(this).hasClass('hover')) {
$(this).find('.more_nav').hide()
}
clearInterval(timer0510)
});
$('body').on('mouseout', '.left_nav .nav_item:not(:last)', function () {
window.current_index1 = $('.left_nav .active').index();
});
$('body').on('click', '.more_nav .nav_item_part', function () {
var type = $(this).attr('date-type');
for (var i = 0; i < Mini.type_arr.length; i++) {
if (type == Mini.type_arr[i]) {
var flag = false;
break;
} else {
var flag = true;
}
}
Mini.type_arr.push(type);
});
// 点击更多 事件处理
$('body').on('mouseover', '.left_nav .nav_item_part', function () {
$('.left_nav .nav_item_part').removeClass('active');
$('.left_nav .nav_item:not(:last)').removeClass('active');
$(this).addClass('active');
$('.left_nav .nav_item:last').addClass('active');
});
// 将参数序列化,形如 ‘key1=孙平&key2=bbb’
function GetParams(temp, name) {
var theRequest = new Object();
var strs = temp.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
}
// 获取 参数对象的指定key 的 value值
var result = theRequest[name] || null;
return result;
}
function getUrlParamVal(name) {
// 获取当前 URL参数集
var r = decodeURI(window.location.search);
var arr1 = r.split("?");
arr1.shift();
var params = arr1.join("&");
var res = GetParams(params, name);
return res;
}
$('body').on('mouseover', '.xxl_ad,iframe', function () {
return false
});
function Mini_page() {
var obj = this;
this.upload_time = 0;
this.pgnum_bot = 1;
this.pgnum_top = 0;
this.startkey = '';
this.newkey = '';
this.uid = user_uid;
this.vqid = getUrlParamVal('vqid') || '';
this.vv = getUrlParamVal('vv') || '';
this.vuid = getUrlParamVal('vuid') || '';
this.bool = true;
this.getBaiDuAd = true;
this.type = 'toutiao';
this.position = "";
this.logo = '';
this.l;
this.adsid = 1;
this.l1 = 0;
this.l2 = 7;
this.refresh_dev;
this.refresh_tab;
this.refresh_scroll;
this.type_arr = [];
this.bottomOutTime = 1;
this.imptk360 = [];
this.ad360data = [];
this.ad360index = 0;
this.adPosition = ['北京', '上海', '浙江', '天津'];
this.pos_pro = '';
this.pos_city = '';
if (typeof Mini_page.instance === 'object') {
return Mini_page.instance;
}
this.instance = this;
this.zhike_bool_0410 = true;
this.pathname = window.location.pathname.slice(1, -1);
}
Mini_page.prototype = {
// 页面初始化
bindEvent: function () {
var obj = this;
obj.type_arr.push(obj.type);
var urlhost;
if(location.host == 'news.7654.com'){
urlhost ='prod/'+location.host+location.pathname.replace(/\//g,".");
}else{
urlhost = location.hostname==="localhost"?"test/test.gamma-minipage.news.7654.com.0109.":'test/'+location.host+location.pathname.replace(/\//g,".");
}
$.ajax({
url:'http://ads.7654.com/'+urlhost+'json?t='+new Date().getTime(),
// url:'http://ads.7654.com/test/test.gamma-minipage.news.7654.com.bz02.json',
type:'get',
dataType:'json',
success:function(res){
proConfig.message_flow_showId=res.l;//信息流(1和其他)
proConfig.top_right_showId=res.rt;//左上2个广告位
proConfig.message_first_showId=res.rb;//信息流大图
proConfig.title_showid="Q1fFva";//右下
$.ajax({
url:proConfig.loadUrl.recommendUrl,
type: 'get',
dataType: 'json',
success: function (response) {
var data = response.data.slice(0,6);
var orderIndex = 1; //首次加载六条热闻
$.each(data, function (index, val) {
val.indexOrder = orderIndex;
orderIndex++;
obj.render('.scroll_con', val, "append", 'show', true, false, 'pdata');
});
proConfig.titledspFlag&&obj.skinShow()&&obj.renderDspAnd360(proConfig.sspAdpos_top_1);
proConfig.outdspFlag&&obj.renderDspAnd360(proConfig.sspAdpos_out_1)
$('.scroll_con').prepend('
为您推荐了6篇文章
');
$('#toast').addClass('hide_now');
setTimeout(function () {$('.scroll_con #toast').remove();}, 2000);
setTimeout(function () {
obj.get360Ad(1,function(res){
if(res[0]){
var adData=res[0]
var dom = '';
$('.bb').html(dom);
obj.url_scroll(res[0].imptk);
obj.upload($('.bb .img_click_gg'),'show')//左侧show上报
}
},proConfig.message_first_showId,1)
obj.get360Ad(obj.bottomOutTime, function (res) {
var first_item_360bool_1 = true,
first_item_360bool_2 = true;
window.first_item_360bool_3 = true;
window.first_item_360bool_4 = true;
window.first_item_360bool_5 = true;
window.first_item_360bool_6 = true;
$.each(res, function (index, val) {
obj.ad360data.push(val);
obj.imptk360.push(val.imptk);
});
if(res[0]){
var adData=res[0]
var dom1= '';
$('.aa').html(dom1);
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
obj.upload($('.aa .img_click_gg'),'show')//左侧show上报
}
if (res[1]) {
obj.render360('.scroll_con .list_item:eq(0)', res[1], "after");
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
$('.scroll_con .list_item:eq(1)').removeClass("ggggg")
}
if (res[2]) {
obj.render360('.scroll_con .list_item:eq(2)', res[2],"after");
}
if (res[3]) {
obj.render360('.scroll_con .list_item:eq(4)', res[3],"after");
}
if (res[4]) {
obj.render360('.scroll_con .list_item:eq(6)', res[4], "after");
}
// var showRefreshBool = true;
$(".content").on("scroll",function(event){
var _el = $(".ggggg");
if (_el.length) {
if (_el.eq(0)[0].getBoundingClientRect().top <750) {
_el.eq(0).removeClass("ggggg");
if (obj.ad360data.length) {
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
}
}
}
})
}, '', 4);
}, 1000);
},
error:function(){
$.ajax({
url:'//news.7654.com/tpop4/miniapi/recommend.json',
type: 'get',
dataType: 'json',
success: function (response) {
var data = response.data.slice(0,6);
var orderIndex = 1; //首次加载六条热闻
$.each(data, function (index, val) {
val.indexOrder = orderIndex;
orderIndex++;
obj.render('.scroll_con', val, "append", 'show', true, false, 'pdata');
});
proConfig.titledspFlag&&obj.skinShow()&&obj.renderDspAnd360(proConfig.sspAdpos_top_1);
proConfig.outdspFlag&&obj.renderDspAnd360(proConfig.sspAdpos_out_1)
$('.scroll_con').prepend('为您推荐了6篇文章
');
$('#toast').addClass('hide_now');
setTimeout(function () {$('.scroll_con #toast').remove();}, 2000);
setTimeout(function () {
obj.get360Ad(1,function(res){
if(res[0]){
var adData=res[0]
var dom = '';
$('.bb').html(dom);
obj.url_scroll(res[0].imptk);
obj.upload($('.bb .img_click_gg'),'show')//左侧show上报
}
},proConfig.message_second_showId,1)
obj.get360Ad(obj.bottomOutTime, function (res) {
var first_item_360bool_1 = true,
first_item_360bool_2 = true;
window.first_item_360bool_3 = true;
window.first_item_360bool_4 = true;
window.first_item_360bool_5 = true;
window.first_item_360bool_6 = true;
$.each(res, function (index, val) {
obj.ad360data.push(val);
obj.imptk360.push(val.imptk);
});
if(res[0]){
var adData=res[0]
var dom1= '';
$('.aa').html(dom1);
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
obj.upload($('.aa .img_click_gg'),'show')//左侧show上报
}
if (res[1]) {
obj.render360('.scroll_con .list_item:eq(0)', res[1], "after");
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
$('.scroll_con .list_item:eq(1)').removeClass("ggggg")
}
if (res[2]) {
obj.render360('.scroll_con .list_item:eq(2)', res[2],"after");
}
if (res[3]) {
obj.render360('.scroll_con .list_item:eq(4)', res[3],"after");
}
if (res[4]) {
obj.render360('.scroll_con .list_item:eq(6)', res[4], "after");
}
// var showRefreshBool = true;
$(".content").on("scroll",function(event){
var _el = $(".ggggg");
if (_el.length) {
if (_el.eq(0)[0].getBoundingClientRect().top <750) {
_el.eq(0).removeClass("ggggg");
if (obj.ad360data.length) {
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
}
}
}
})
}, '', 4);
}, 1000);
}
});
}
});
obj.get360Ad(1,function(res){
obj.renderRight360($('.right_pannel .showcase:eq(0)'),res[0],proConfig.loadList[1],true)
obj.renderRight360($('.right_pannel .showcase:eq(1)'),res[1],proConfig.loadList[2])
},proConfig.top_right_showId,2)
obj.renderLoad(function(list){
var qid=proConfig.qid["rewen"]
var dom1=''+
'' + list[0].title.substring(0,10) + '
'+
'' + list[0].title.substring(10,16) + '
'+
''
var dom2=''+
'' + list[1].title.substring(0,10) + '
'+
'' + list[1].title.substring(10,16) + '
'+
''
$(".swiper-wrapper .adCase").html(dom1)
$(".swiper-wrapper .adCase1").html(dom2)
var mySwiper = new Swiper('.swiper-container',{
autoplay : false,
loop:true,
autoplayDisableOnInteraction: false,
})
$('.leftBtn').click(function(){
mySwiper.swipePrev();
})
$('.rightBtn').click(function(){
mySwiper.swipeNext();
})
},'swiper_news')
$(".swiper-container").hover(function(){
$(".arrow").show();
},function(){
$(".arrow").hide();
})
}
})
var _clktk, _curl, start_time, end_time;
//宏替换-1
function mouseDownMacro(el, x, y) {
start_time = Math.round(new Date());
_clktk = el.data('oldclktk');
_curl = el.data("oldcurl");
if (_clktk.indexOf(Macro["start"]) > -1) {
_clktk = _clktk.replace(Macro["start"], start_time);
}
if (_clktk.indexOf(Macro["x"]) > -1) {
_clktk = _clktk.replace(Macro["x"], x);
}
if (_clktk.indexOf(Macro["y"]) > -1) {
_clktk = _clktk.replace(Macro["y"], y);
}
if (_curl.indexOf(Macro["start"]) > -1) {
_curl = _curl.replace(Macro["start"], start_time);
}
if (_curl.indexOf(Macro["x"]) > -1) {
_curl = _curl.replace(Macro["x"], x);
}
if (_curl.indexOf(Macro["y"]) > -1) {
_curl = _curl.replace(Macro["y"], y);
}
el.attr('data-clktk', _clktk);
el.attr('href', _curl);
}
//宏替换-2
function mouseUpMacro(el) {
end_time = Math.round(new Date());
_curl = el.attr("href");
if (_clktk.indexOf(Macro["end"]) > -1) {
_clktk = _clktk.replace(Macro["end"], end_time);
}
if (_curl.indexOf(Macro["end"]) > -1) {
_curl = _curl.replace(Macro["end"], end_time);
}
el.attr('data-clktk', _clktk);
el.attr('href', _curl);
}
/*360点击曝光*/
$('body').on('mousedown', '.img_click_gg', function (e) {
var target = $(this).parents(".ima360ad_more").length>0?$(this).parents(".ima360ad_more"):$(this);
var x = Math.floor(e.pageX - target.offset().left),
y = Math.floor(e.pageY - target.offset().top);
x=x<0?0:x;
y=y<0?0:y;
mouseDownMacro($(this), x, y);
}).on('click', '.img_click_gg', function () {
obj.upload($(this)[0],'click');
mouseUpMacro($(this));
var str = $(this).attr('data-clktk');
if (str) {
var arr = str.split(',');
$.each(arr, function (index, val) {
$('body').append('');
});
}
});
$("body").on('click','.news_click_gg',function(){
obj.upload($(this)[0],'click');
})
$('body').on('click', '.click_event', function (event) {
var method = $(this).attr('method');
obj[method] ? obj[method]($(this), event) : '';
});
$('.content').on('scroll', function (event) {
var SCROLL_TOP = $(this).scrollTop();
var CLIENT_HEIGHT = 590;
var TOTAL_HEIGHT = $('.scroll_con').height() - $('.scroll_con .list_item:last').height();
if (SCROLL_TOP + CLIENT_HEIGHT >= TOTAL_HEIGHT && obj.bool && TOTAL_HEIGHT != 0) {
obj.imptk360 = [];
obj.bool = false;
obj.pgnum_bot++;
obj.bottomOutTime++;
var params = {
type: obj.type,
startkey: obj.startkey,
newkey: obj.newkey,
pgnum: obj.pgnum_bot,
uid: user_uid,
qid: 'k002',
pos_pro: encodeURIComponent(obj.pos_pro),
pos_city: encodeURIComponent(obj.pos_city),
position: encodeURIComponent(obj.position),
domain: 'news.7654.com'
};
obj.refresh_scroll = true;
obj.fetch_data(params);
}
});
},
// 页面初始化数据获取
fetch_data: function (params, btn) {
var loading_dom = '';
$('.content').prepend(loading_dom);
var obj = this;
var online_url1 = proConfig.loadUrl.online_url1;
var online_url2 = proConfig.loadUrl.online_url2;
if (obj.refresh_dev) {
var pgnum = obj.pgnum_top++
online_url = online_url2 + params.type + '/page/' + pgnum
}
if (obj.refresh_scroll || obj.refresh_tab) {
online_url = online_url1 + params.type + '/page/' + params.pgnum
}
$.ajax({
url: online_url,
type: 'get',
dataType: 'json',
error: function () {
obj.fetch_data(null);
},
success: function (res) {
if (res.code == 0) {
proConfig.message_flow_showId_first =true;
//tab切换
if (obj.refresh_tab) {
obj.refresh_tab = false
obj.l1 = 6;
obj.l2 = 7;
var oType = btn.attr('date-type');
var orderIndex = 10;
$.each(res.data, function (index, val) {
val.indexOrder = orderIndex;
orderIndex--;
obj.render('.scroll_con.' + oType, val, "prepend", "no_show", false, true);
});
$('.scroll_con').prepend('为您推荐了6篇文章
');
$('#toast').addClass('hide_now');
setTimeout(function () {
$('.scroll_con #toast').remove();
}, 2000);
setTimeout(function () {
obj.get360Ad(obj.bottomOutTime, function (res) {
var first_item_360bool_1 = true,
first_item_360bool_2 = true;
$.each(res, function (index, val) {
obj.ad360data.push(val);
obj.imptk360.push(val.imptk);
});
if (res[0]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0], 1);
obj.upload(('.scroll_con.' + oType + ' .list_item:eq(0) .img_click_gg'),"show")
var _el = $(".ggggg");
if (_el.length) {
if (_el.eq(0)[0].getBoundingClientRect().top <750) {
_el.eq(0).removeClass("ggggg");
if (obj.ad360data.length) {
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
}
}
}
}
if (res[1]) {
if (res[1].type ==3) {
obj.renderBig360('.scroll_con.' + oType + ' .list_item:eq(2)', res[1], 3);
}else {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(2)', res[1], 3);
}
var _el = $(".ggggg");
if (_el.length) {
if (_el.eq(0)[0].getBoundingClientRect().top <750) {
_el.eq(0).removeClass("ggggg");
if (obj.ad360data.length) {
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
}
}
}
}
if (res[2]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(4)', res[2] , 5);
var _el = $(".ggggg");
if (_el.length) {
if (_el.eq(0)[0].getBoundingClientRect().top <750) {
_el.eq(0).removeClass("ggggg");
if (obj.ad360data.length) {
obj.url_scroll(obj.ad360data[0].imptk);
obj.ad360data.shift();
}
}
}
}
if (res[3]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(6)', res[3], 7);
}
if (res[4]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(8)', res[4], 9);
}
if (res[5]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(10)', res[5], 11);
}
var showRefreshBool = true;
}, '', 6);
}, 1000)
$('.content').css({'scrollTop': '0'});
}
// 下拉刷新
if (obj.refresh_scroll) {
obj.refresh_scroll = false
var list_len = $('.scroll_con .list_item').length;
$.each(res.data, function (index, val) {
val.indexOrder = proConfig.qid_index[obj.type] + 10;
proConfig.qid_index[obj.type]++;
obj.render('.scroll_con', val, "append", "no_show", true, false, 'pdata');
});
obj.get360Ad(obj.bottomOutTime, function (res) {
var item_360bool_1 = true,
item_360bool_2 = true,
item_360bool_3 = true;
$.each(res, function (index, val) {
obj.imptk360.push(val.imptk);
});
if (res[0]) {
obj.render360('.scroll_con .list_item:eq(' + (list_len + 2) + ')', res[0], list_len + 2);
obj.upload('.scroll_con .list_item:eq(' + (list_len + 2) + ') .img_click_gg',"show")
}
if (res[1]) {
obj.render360('.scroll_con .list_item:eq(' + (list_len + 6) + ')', res[1],list_len + 6);
}
if (res[2]) {
obj.render360('.scroll_con .list_item:eq(' + (list_len + 10) + ')', res[2],list_len + 10);
}
var list_360item_h_1 = $('.scroll_con').outerHeight() - $('.scroll_con .list_item:nth-last-child(1)').outerHeight() - $('.scroll_con .list_item:nth-last-child(2)').outerHeight() - $('.scroll_con .list_item:nth-last-child(3)').outerHeight() - $('.scroll_con .list_item:nth-last-child(4)').outerHeight() - $('.scroll_con .list_item:nth-last-child(5)').outerHeight() - $('.scroll_con .list_item:nth-last-child(6)').outerHeight() - $('.scroll_con .list_item:nth-last-child(7)').outerHeight() - $('.scroll_con .list_item:nth-last-child(8)').outerHeight() - $('.scroll_con .list_item:nth-last-child(9)').outerHeight() - $('.scroll_con .list_item:nth-last-child(10)').outerHeight() - $('.scroll_con .list_item:nth-last-child(11)').outerHeight();
var list_360item_h_2 = $('.scroll_con').outerHeight() - $('.scroll_con .list_item:nth-last-child(1)').outerHeight() - $('.scroll_con .list_item:nth-last-child(2)').outerHeight() - $('.scroll_con .list_item:nth-last-child(3)').outerHeight() - $('.scroll_con .list_item:nth-last-child(4)').outerHeight() - $('.scroll_con .list_item:nth-last-child(5)').outerHeight() - $('.scroll_con .list_item:nth-last-child(6)').outerHeight() - $('.scroll_con .list_item:nth-last-child(7)').outerHeight()
var list_360item_h_3 = $('.scroll_con').outerHeight() - $('.scroll_con .list_item:nth-last-child(1)').outerHeight() - $('.scroll_con .list_item:nth-last-child(2)').outerHeight() - $('.scroll_con .list_item:nth-last-child(3)').outerHeight()
$('.content').on('scroll', function (event) {
var SCROLL_TOP = $(this).scrollTop();
if (570 + SCROLL_TOP > list_360item_h_1 && item_360bool_1) {
item_360bool_1 = false;
if (obj.imptk360[0]) {
obj.url_scroll(obj.imptk360[0]);
}
}
if (570 + SCROLL_TOP > list_360item_h_2 && item_360bool_2) {
item_360bool_2 = false;
if (obj.imptk360[1]) {
obj.url_scroll(obj.imptk360[1]);
}
}
if (570 + SCROLL_TOP > list_360item_h_3 && item_360bool_3) {
item_360bool_3 = false;
if (obj.imptk360[1]) {
obj.url_scroll(obj.imptk360[2]);
}
}
});
obj.bool = true;
})
}
} else {
alert('Sorry, ' + res.info);
}
$('.loading_ajax').remove();
}
});
},
// 数据流360获取
get360Ad: function (reqtime, callback, showId, num) {
var recommend_url = '//show.g.mediav.com/s',
// var recommend_url = '//ad-test.mediav.com/s',
recommend_type = 1,
recommend_of = 4,
reqtimes = reqtime || 1,
recommend_newf = 1,
recommend_showid = showId || proConfig.message_flow_showId,
tck = Common.GetQueryString("tck"),
recommend_adnum = num || 3,
recommendk_uid =Common.recommend_uid(),
recommend_refurl=encodeURIComponent(document.referrer),
recommend_param;
tck = tck ? '&tck='+ tck:'';
if (document.location.protocol == "https:") {
recommend_param = 'https://show-g.mediav.com/s' + '?type=' + recommend_type + '&of=' + recommend_of + '&newf=' + recommend_newf + '&scheme=https&showid=' + recommend_showid + '&uid=' + recommendk_uid + '&impct=' + recommend_adnum + '&reqtimes=' + reqtimes + tck+'&refurl='+recommend_refurl;
} else {
recommend_param = recommend_url + '?type=' + recommend_type + '&of=' + recommend_of + '&newf=' + recommend_newf + '&showid=' + recommend_showid + '&uid=' + recommendk_uid + '&impct=' + recommend_adnum + '&reqtimes=' + reqtimes + tck+'&refurl='+recommend_refurl;
}
$.ajax({
type: 'get',
url: recommend_param,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
if(!data.ads){
if(proConfig.message_flow_showId_first && proConfig.message_flow_showId == recommend_showid){
proConfig.message_flow_showId_first = false;
$.ajax({
type: 'get',
url: recommend_param,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
var d = data.ads || [];
callback && callback(d);
},
error: function () {callback(null);}
})
}else if(proConfig.top_right_showId_first &&proConfig.top_right_showId == recommend_showid){
proConfig.top_right_showId_first = false;
$.ajax({
type: 'get',
url: recommend_param,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
var d = data.ads || [];
callback && callback(d);
},
error: function () {callback(null);}
})
}else if(proConfig.hot_showId_first&& proConfig.hot_showId == recommend_showid){
proConfig.hot_showId_first = false;
$.ajax({
type: 'get',
url: recommend_param,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
var d = data.ads || [];
callback && callback(d);
}
})
}else{
var d = data.ads || [];
callback && callback(d);
}
}else{
var d = data.ads || [];
callback && callback(d);
}
},
error: function () {callback(null);}
})
},
// 数据渲染
render: function (target_dom, content, render_way, show_type, flag1, flag2, updata) {
var obj = this;
if (flag1) {
obj.l1++;
if (obj.l1 > 100) {
obj.l1 = 101;
}
obj.l = obj.l1;
}
if (flag2) {
obj.l2--;
obj.l = obj.l2;
}
var myQId = proConfig.qid[obj.type];
var dom = '',
author_info = '',
type_dom = '',
important_href = '?qid=' + myQId ,
point_dom = '';
if ( content.url.indexOf('www.lieqinews.com') > -1) {
important_href = '';
}
if (obj.type == "toutiao" || obj.type == "redian") {
point_dom = '·';
}
obj.logo = obj.type;
if (obj.type == 'redian') {
obj.logo = 'toutiao2'
}
if (content.dfh_nickname) {
author_info = point_dom + '' + content.dfh_nickname + '';
} else {
author_info = '';
}
type_dom = '' + content.source + '';
if (obj.vuid) {
important_href += "&vuid=" + obj.vuid;
}
if (obj.vv) {
important_href += "&vv=" + obj.vv;
}
if (obj.vqid) {
important_href += "&vqid=" + obj.vqid;
}
//生成所有important_href
var commonObj = $.extend(proConfig.left_tab,proConfig.left_tab_more);
important_href += "&_"+content.indexOrder+"_"+commonObj[obj.type]+"1";
var url = content.url.split('?qid')[0];
var pda = updata === 'updata'?'updata':'pdata';
if (content.img_size == 3 || content.img_size == 4) {
var more_imgs = '';
var should_reduce_h = '';
if (content.img.length == 4) {
$.each(content.img, function (index, val) {
if(val.indexOf('://') > -1){
val = '//' + val.split('://')[1];
}
more_imgs += '';
});
} else {
$.each(content.img, function (index, val) {
if(val.indexOf('://') > -1){
val = '//' + val.split('://')[1];
}
more_imgs += '';
});
more_imgs += '查看详情>>'
}
dom = '';
} else {
if(content.img[0] && content.img[0].indexOf('://') > -1){
content.img[0] = '//' + content.img[0].split('://')[1];
}
dom = '';
};
if (render_way == 'prepend') {
$(target_dom).prepend(dom);
} else {
$(target_dom).append(dom);
}
// pdata.init();
},
//右上新闻打底
//右上新闻打底
renderTopnews:function(target_dom,adData){
var qid=proConfig.qid["rewen"]
var dom='';
$(target_dom).append(dom)
},
//右下新闻打底
renderBottomnews:function(target_dom,adData){
var dom='' + adData.title + '
';
$(target_dom).append(dom)
},
//右下小说
renderLoad:function(callback){
$.ajax({
url:proConfig.loadUrl.hotUrl,
type:'GET',
dataType:'json',
success:function(res){
var d=res.data.slice(0,2);
proConfig.loadList=res.data.slice(2,10);
callback&&callback(d)
}
})
},
//360大图样式
renderBig360: function (target_dom, adData,render_way) {
this.ad360index++;
var dom = '';
if (render_way == 'after') {
$(target_dom).after(dom);
} else {
$(target_dom).before(dom);
}
},
// 360数据流
render360: function (target_dom, adData, render360_way) {
this.ad360index++;
if (adData.type == 2) {
var more_imgs = '';
$.each(adData.assets, function (i, v) {
more_imgs += ''
})
var dom = '';
} else {
var dom = '';
}
if (render360_way == 'after') {
$(target_dom).after(dom);
} else {
$(target_dom).before(dom);
}
},
// tab切换
change_view: function (btn) {
this.ad360data = [];
this.ad360index = 0;
this.bottomOutTime = 1;
window.first_item_360bool_3 = true;
window.first_item_360bool_4 = true;
window.first_item_360bool_5 = true;
window.first_item_360bool_6 = true;
if (btn.hasClass('nav_item')) {
if (btn.index() == window.current_index1) {
return
}
} else {
if (btn.attr('click_time') == 1) {
$('.more_nav .nav_item_part').attr('click_time', '');
return
}
}
$('.content').scrollTop(0);
this.startkey = '';
this.newkey = '';
var obj = this;
this.bool = true;
this.pgnum_bot = 1;
this.pgnum_top = 1;
var oType = btn.attr('date-type');
if (oType === 'lieqi') {
$('#refresh').hide();
} else {
$('#refresh').show();
}
this.type = oType;
this.bottomOutTime = 1;
proConfig.qid_index[oType]= 1;
var params = {
type: oType,
startkey: obj.startkey,
newkey: obj.newkey,
pgnum: obj.pgnum_bot,
uid: user_uid,
qid: 'k002',
// pos_pro: encodeURIComponent(obj.pos_pro),
// pos_city: encodeURIComponent(obj.pos_city),
// position: encodeURIComponent(obj.position),
// domain: 'news.7654.com'
};
$('.scroll_con').html("").attr('class', 'scroll_con ' + oType);
obj.refresh_tab = true;
obj.fetch_data(params, btn);
},
getSkinData: function (showId,callback) {
var recommend_type = 1,
recommend_of = 4,
// reqtimes = reqtime || 1,
recommend_newf = 2,
recommend_showid = showId,
tck = Common.GetQueryString("tck"),
// recommend_adnum = 3,
recommendk_uid = Common.recommend_uid(),
recommend_refurl = encodeURIComponent(document.referrer),
recommend_param;
tck = tck ? '&tck=' + tck : '';
// tck = '';
if (document.location.protocol == "https:") {
recommend_param = 'https://show-g.mediav.com/s' + '?type=' + recommend_type + '&of=' + recommend_of + '&newf=' + recommend_newf + '&scheme=https&showids=' + recommend_showid + '&uid=' + recommendk_uid + tck + '&refurl=' + recommend_refurl;
} else {
recommend_param = 'http://show.g.mediav.com/s' + '?type=' + recommend_type + '&of=' + recommend_of + '&newf=' + recommend_newf + '&showids=' + recommend_showid + '&uid=' + recommendk_uid + tck + '&refurl=' + recommend_refurl;
}
$.ajax({
type: 'get',
url: recommend_param,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
if (!data.adspaces) {
$.ajax({
type: 'get',
url: recommend_param,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
if(!$.isEmptyObject(data)){
var d = data.adspaces[showId].ads || [];
callback && callback(d);
}else{
callback && callback([]);
}
},
error: function () {
callback(null);
}
})
} else {
var d = data.adspaces[showId].ads || [];
callback && callback(d);
}
},
error: function () {
callback(null);
}
})
},
addSkin: function (start,data,sspAdpos) {
var _this = this;
proConfig.renderFlag=false;
if(proConfig.render360Flag){window.uploadConfig1= {
act:"show",
ad_id:data.baidu_id,
ad_pos:sspAdpos,
ad_type:"dsp_360",
strategy_id:data.script[start].strategy_id,
idea_id:data.script[start].idea_id,
plan_id:data.script[start].plan_id,
product_category:data.script[start].product_category
}}
_this.get360Ad(1,function (res) {
if (res[0]){
if("SetPageSize" in window.external) window.external.SetPageSize(900,760);
$("#skin_360_container").show();
var data = JSON.parse(JSON.stringify(res));
data[0].type = "skin";
var dom= '' +
'' +
'' + data[0].title + '
' +
''
$("#skin_360_container").html(dom);
_this.url_scroll(data[0].imptk);
_this.upload($("#skin_360_container .img_click_gg")[0], 'show');//右上show上报
$("#skin_360_container").addClass("skin_"+data[0].imgw);
if(proConfig.render360Flag){
_this.uploadZhike(uploadConfig1);
$("body").on('click','.img_click_gg',function(){
uploadConfig1.act="click";
_this.uploadZhike(uploadConfig1);
});
}
}else{
if(proConfig.render360Flag){//顺位
proConfig.renderFlag= true;
var start =proConfig.currentIndex + 1;
if(proConfig.sspData.script.length>start){
_this.renderFunc(start,proConfig.sspData,sspAdpos);
}
}else{//不顺位
// console.log("360无值不顺位")
}
}
},proConfig.title_showid,1);
},
renderOutDsp:function(data,sspAdpos){
var _this=this;
if(data.script[0].content) {
var sspConfig = JSON.parse(data.script[0].content);
var zmDsp = {
requestId: 1e18 * Math.random(),
slot: {
proj: proConfig.ssp_project || (location.hostname === "127.0.0.1" ? 'kuaizip':"default"),
mixData: Common.GetQueryString('data') || (location.hostname === "127.0.0.1" ? 'Bgkf5I00GXLpdeGj+lum8GProo2U417UuxDU5acuL8ltzpm8vfFCD5JVVkFmsQRCH4fYM9aIgtdBKBxUmshLsHEfNooq6j+h+8HPOmcPGZ0jo4CKvknDzdBGHdQneTv3rXp0aII38MhyJ0G6suIJvQXb1+KQkocZ3KI=' : 'default'),
// mixData: Common.GetQueryString('data'),
groupid: sspConfig.groupid || 2, // 删除
}
};
var datas = encodeURI(JSON.stringify((zmDsp)));
var url = sspConfig.url + $.base64.encode(datas);
window.uploadConfig2= {
act:"request",
ad_id:data.baidu_id,
ad_pos:sspAdpos,
ad_type:'dsp_zm',
strategy_id:data.script[0].strategy_id,
idea_id:data.script[0].idea_id,
plan_id:data.script[0].plan_id,
product_category:data.script[0].product_category
}
_this.dspUpload(uploadConfig2);
$.ajax({
type: "get",
url: url,
dataType: "json",
success: function (res) {
if(res.code == 0) {
if(res.result.ads[0].imageType ==16){
var ads = res.result.ads[0];
uploadConfig2.act="show";
_this.uploadZhike(uploadConfig2);
uploadConfig2.dspData=JSON.stringify(ads);
_this.dspUpload(uploadConfig2);
$("head").append('')
var ext = window.external;
if (ext != null){
ext.ShowSkinAD("right");
}
window.kkk=function(){
uploadConfig2.act="click";
_this.uploadZhike(uploadConfig2);
uploadConfig2.dspData=JSON.stringify(ads);
_this.dspUpload(uploadConfig2);
window.open(ads.openUrl+Common.mini_readerExp(ads))
}
}
}
},
error:function () {
uploadConfig2.act="error"
_this.dspUpload(uploadConfig2);
}
});
}
},
renderDsp:function(start,data,sspAdpos){
var _this=this;
if(data.script[start].content) {
var sspConfig = JSON.parse(data.script[start].content);
var zmDsp = {
requestId: 1e18 * Math.random(),
slot: {
proj: proConfig.ssp_project || (location.hostname === "127.0.0.1" ? 'kuaizip':"default"),
mixData: Common.GetQueryString('data') || (location.hostname === "127.0.0.1" ? 'Bgkf5I00GXLpdeGj+lum8GProo2U417UuxDU5acuL8ltzpm8vfFCD5JVVkFmsQRCH4fYM9aIgtdBKBxUmshLsHEfNooq6j+h+8HPOmcPGZ0jo4CKvknDzdBGHdQneTv3rXp0aII38MhyJ0G6suIJvQXb1+KQkocZ3KI=' : 'default'),
// mixData: Common.GetQueryString('data'),
groupid: sspConfig.groupid || 2, // 删除
}
};
var datas = encodeURI(JSON.stringify((zmDsp)));
var url = sspConfig.url + $.base64.encode(datas);
window.uploadConfig1= {
act:"request",
ad_id:data.baidu_id,
ad_pos:sspAdpos,
ad_type:'dsp_zm',
strategy_id:data.script[start].strategy_id,
idea_id:data.script[start].idea_id,
plan_id:data.script[start].plan_id,
product_category:data.script[start].product_category
}
_this.dspUpload(uploadConfig1);
proConfig.renderFlag=false;
$.ajax({
type: "get",
url: url,
dataType: "json",
success: function (res) {
if(res.code == 0) {
if(res.result.ads[0].imageType ==15) {
var ads = res.result.ads[0];
if("SetPageSize" in window.external) window.external.SetPageSize(900,760);
var dom ='';
$('#skin_360_container').show()
$('#skin_360_container').append(dom);
uploadConfig1.act="show";
_this.uploadZhike(uploadConfig1);
uploadConfig1.dspData=JSON.stringify(ads);
_this.dspUpload(window.uploadConfig1);
$("body").on('click','#ak',function(){
uploadConfig1.act="click";
_this.uploadZhike(uploadConfig1);
uploadConfig1.dspData=JSON.stringify(ads);
_this.dspUpload(window.uploadConfig1);
});
}
} else {
uploadConfig1.act="null"
_this.dspUpload(uploadConfig1);
var start =proConfig.currentIndex + 1;
if(start!=data.script.length){//只有一个
proConfig.renderFlag= true;
_this.renderFunc(start,proConfig.sspData,sspAdpos);
}else{//360非顺位
proConfig.render360Flag=false;
_this.addSkin()
}
}
},
error:function () {
uploadConfig1.act="error"
_this.dspUpload(uploadConfig1);
var start =proConfig.currentIndex + 1;
if(start!=data.script.length){//只有一个
proConfig.renderFlag= true;
_this.renderFunc(start,proConfig.sspData,sspAdpos);
}else{//360非顺位
proConfig.render360Flag=false;
_this.addSkin()
}
}
});
}
},
renderDspAnd360:function(sspAdpos){
var _this = this;
var urlssp=location.host == 'news.7654.com'?"//ssp.7654.com/ssp/v2/ads?qid=":"//test-ssp.7654.com/ssp/v2/ads?qid=";
$.ajax({
url:urlssp+proConfig.ssp_project+'&ad='+sspAdpos+'&mixData='+Common.GetQueryString('data'),
type:"GET",
dataType:"json",
success: function (res) {
var sspAdposTop=sspAdpos.indexOf('top')>0;//顶部广告位
if(sspAdposTop){
//1.如果没有配置广告位res.data为{},直接走前端渲染360
//2.外挂广告位,res.data[sspAdpos].script为【】
if ($.isEmptyObject(res.data)||res.data[sspAdpos].script.length === 0) {
proConfig.render360Flag=false;
_this.addSkin();
}else if(!res.data[sspAdpos].script.length==0){
proConfig.sspData=res.data[sspAdpos];
_this.renderFunc(0,proConfig.sspData,sspAdpos)
}
}else{
(!$.isEmptyObject(res.data))&&res.data[sspAdpos].script.length!=0&&_this.renderOutDsp(res.data[sspAdpos],sspAdpos)
}
},
error: function () {
proConfig.render360Flag=false;
sspAdpos.indexOf('top')>0&&_this.addSkin();
}
})
},
renderFunc:function(start,data,sspAdpos){
var _this=this;
for(var i=start;i' +
'' +
'' + ads.title + '
' +
''
$("#skin_360_container").show();
$('#skin_360_container').append(dom);
uploadConfig3.act="show";
_this.uploadZhike(uploadConfig3);
_this.url_scroll(ads.imp);
$("body").on('click','#skin_360_container',function(){
uploadConfig3.act="click";
_this.uploadZhike(uploadConfig3);
_this.url_scroll(ads.clk);
});
}else if(res.ads.native_material.type ==7){//横幅图片
var ads = JSON.parse(res.ads.native_material.image_snippet);
if("SetPageSize" in window.external) window.external.SetPageSize(900,760);
var dom= '' +
'' +
'' +
''
$("#skin_360_container").show();
$('#skin_360_container').append(dom);
uploadConfig3.act="show";
_this.uploadZhike(uploadConfig3);
_this.url_scroll(ads.imp);
$("body").on('click','#skin_360_container',function(){
uploadConfig3.act="click";
_this.uploadZhike(uploadConfig3);
_this.url_scroll(ads.clk);
});
}else{
var start =proConfig.currentIndex + 1;
if(start!=data.script.length){//最后一位
proConfig.renderFlag= true;
_this.renderFunc(start,proConfig.sspData,sspAdpos);
}else{//360非顺位
proConfig.render360Flag=false;
_this.addSkin()
}
}
} else{
var start =proConfig.currentIndex + 1;
if(start!=data.script.length){//最后一位
proConfig.renderFlag= true;
_this.renderFunc(start,proConfig.sspData,sspAdpos);
}else{//360非顺位
proConfig.render360Flag=false;
_this.addSkin()
}
}
}else if(typeof(res)=="undefined"){
var start =proConfig.currentIndex + 1;
if(start!=data.script.length){//最后一位
proConfig.renderFlag= true;
_this.renderFunc(start,proConfig.sspData,sspAdpos);
}else{//360非顺位
proConfig.render360Flag=false;
_this.addSkin()
}
}
},
error:function () {
var start =proConfig.currentIndex + 1;
if(start!=data.script.length){//最后一位
proConfig.renderFlag= true;
_this.renderFunc(start,proConfig.sspData,sspAdpos);
}else{//360非顺位
proConfig.render360Flag=false;
_this.addSkin()
}
}
});
}
},
uploadZhike: function (uploadAction) {
var params = {
project:proConfig.ssp_project|| 'kuaizip',
data: Common.GetQueryString('data') || 'default',
os: Common.getSystem() || 'default',
browser: Common.getBrowser() || 'default',
act: uploadAction.act || 'default',
ad_id: uploadAction.ad_id || '2299669',
ad_pos: uploadAction.ad_pos || 'default',
ad_time: new Date().getTime() || 'default',
ad_type: uploadAction.ad_type || 'zhike',
strategy_id: uploadAction.strategy_id || '918',
idea_id: uploadAction.idea_id || '80',
plan_id: uploadAction.plan_id || '50',
product_category: uploadAction.product_category || 'undefined'
};
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 + encodeURI('\t') + params.product_category;
$.getJSON(url).done(function (data) {
});
},
dspUpload: function (uploadAction) {
var param_dsp;
param_dsp = {
project:proConfig.ssp_project|| 'default',
data: Common.GetQueryString('data') || 'default',
os: Common.getSystem() || 'default',
browser: Common.getBrowser() || 'default',
act: uploadAction.act || 'default',
ad_id: uploadAction.ad_id || '',
ad_pos: uploadAction.ad_pos || 'default',
ad_time: new Date().getTime() || 'default',
ad_type: uploadAction.ad_type || 'dianshang',
strategy_id: uploadAction.strategy_id || '',
idea_id: uploadAction.idea_id || '',
plan_id: uploadAction.plan_id || '',
dspData: uploadAction.dspData || 'default',
product_category: uploadAction.product_category || 'undefined' // mini无
};
var objParams = param_dsp.project + '\t' + param_dsp.data + '\t' + param_dsp.os + '\t' + param_dsp.browser + '\t' + param_dsp.act + '\t' + param_dsp.ad_id + '\t' + param_dsp.ad_pos + '\t' + param_dsp.ad_time + '\t' + param_dsp.ad_type + '\t' + param_dsp.strategy_id + '\t' + param_dsp.idea_id + '\t' + param_dsp.plan_id + '\t' + param_dsp.dspData;
var newUrl = $.base64.encode(encodeURI(objParams));
var url = "http://adtj.glzip.com/dsp/user_click?code=" + newUrl;
$.getJSON(url).done(function (data) {
});
},
renderRight360:function(target,data,loadList,uploadflag){
var _this=this;
if(data){
$(target).html('')
_this.url_scroll(data.imptk);
uploadflag&&_this.upload($(target).children().find(".img_click_gg"),'show')//右上show上报
}else{
_this.renderTopnews(target,loadList)
}
},
url_scroll:function (arr) {
$.each(arr, function (index, val) {
$('body').append('');
});
},
upload:function (target,actType) {
$.getJSON("//ad.kuaizip.com/advertise/userclick", {
// project:proConfig.upload_project,
// position:$(target).attr('position-tag'),
// act:actType,
// type:$(target).attr("position-ad"),
time: new Date().getTime(),
localUrl: $.base64.encode("kZip.com" + location.pathname),
project: $.base64.encode(proConfig.upload_project),
position:$.base64.encode($(target).attr('position-tag')),
qid:$.base64.encode(Common.GetQueryString('qid')),
env:$.base64.encode(Common.GetQueryString('env')),
uid:$.base64.encode(Common.GetQueryString('uid') || "none"),
act:$.base64.encode(actType),
type:$.base64.encode($(target).attr("position-ad")),
}).done(function(data) {});
},
skinShow:function(){
var screen_h = Common.GetQueryString("screen_h")*1||600;
var skin_h = 160;
var ad_h = $("#container").height();
var is_show = (skin_h + ad_h + 42 + 40) <=screen_h;
return is_show
}
};
var Mini = new Mini_page();
Mini.bindEvent();
function showPop(showTime,showUrl,showKey,blockArea) {
var nowTime = new Date().getTime();
if (nowTime > Common.newDate(showTime[0]).getTime() && nowTime < Common.newDate(showTime[1]).getTime()) {
$.ajax({
url: '//iplocation.7654.com/v1',
type: 'get',
dataType: 'json',
success: function (data) {
var canPop = true;
for(var i=0;i < blockArea.length;i++){
if(data.city.indexOf(blockArea[i]) >-1){
canPop = false;
break;
}
}
if (canPop) {
if(!$.cookie(showKey)){
$.cookie(showKey, showKey, {expires: 30, path: '/'});
window.open(showUrl);
}
}
}
});
}
}
showPop(["2020-06-15 20:00:00", "2020-06-15 23:59:59"],"https://s.click.taobao.com/fONuxzu","showDouble_0508_1",["杭州","北京","深圳","珠海","上海"]);
showPop(["2020-06-16 00:00:00", "2020-06-16 23:59:59"],"https://s.click.taobao.com/fONuxzu","showDouble_0508_2",["杭州","北京","深圳","珠海","上海"]);
$(document).ready(function () {
if (typeof (external.WebFinished) != 'undefined') {
external.WebFinished();
}
});