//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);
},
getIeVersion:function () {
if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/7./i)=="7.") {
return "IE 7.0";
} else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i)=="8.") {
return "IE 8.0";
} else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i)=="9.") {
return "IE 9.0" ;
} else if(navigator.appName == "Microsoft Internet Explorer") {
return "IE 6.0";
}else{
return "!IE"
}
},
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;
},
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;
}
};
window.Common = common;
})();
configuration();
//根据域名配置
var proConfig;
function configuration() {
// 默认配置
var proObject = {
name: 'kuaiya',
mini_name: '005',
qid: {rewen:'heinote_tips_iconnews',toutiao:'kuaiya07',shehui:'kuaiya07',yule:'kuaiya07',shipin:'k002',tiyu:'k002',qiche:'k002',junshi:'k002',yangsheng:'03062',youxi:'kuaiya07',guoji:'kuaiya07',shishang:'kuaiya07',lishi:'kuaiya07',keji:'kuaiya07',caijing:'kuaiya07',xiaohua:'kuaiya07'},
left_tab:{youxi:'游戏',yangsheng:'养生',junshi:'军事',qiche:'汽车',tiyu:'体育',shipin:'视频',yule:'娱乐',shehui:'社会',toutiao:'推荐'},
left_tab_more:{guoji:'国际',shishang:'时尚',lishi:'历史',keji:'科技',caijing:'财经',xiaohua:'笑话'},
loadUrl:{onlineUrl1:'//news.toutiaobashi.com/api/tpop/list_new/heinote_tips_iconnews/1/',onlineUrl2:'//news.toutiaobashi.com/api/tpop/list_new/heinote_tips_iconnews/1/',hotUrl:'//api.qihaxiaoshuo.com/api/minipage/list?qid=qh005_002',recommendUrl:'//news.toutiaobashi.com/api/tpop/list_new/heinote_tips_iconnews/1/34/6'},
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},
typeKey: {rewen:33,toutiao:34,shehui:14,yule:16,shipin:24,tiyu:17,qiche:28,junshi:20,yangsheng:39,youxi:29,guoji:12,shishang:25,lishi:46,keji:19,caijing:18,xiaohua:13},
typeKeyRow: {rewen:'',toutiao:'',shehui:'',yule:'',shipin:'',tiyu:'',qiche:'',junshi:'',yangsheng:'',youxi:'',guoji:'',shishang:'',lishi:'',keji:'',caijing:'',xiaohua:''},
message_flow_showId: '6z6QHZ',
hot_showId: 'AUmXS4',
top_right_showId: 'laRVb9',
// message_flow_showId: '0GcxwV',
// hot_showId: 'lqsYyv',
// top_right_showId: 'lqsYyv',
message_flow_showId_first: true,
hot_showId_first: true,
top_right_showId_first: true,
refresh_baidu_smua: 'd=p&s=b&u=u3425374&w=495&h=130',
big_baidu_smua: 'd=p&s=b&u=u3441662&w=500&h=130', //百度多图广告
// normal_baidu_smua: 'd=p&s=b&u=u3636595&w=500&h=96', //数据流百度广告
// right_top_baidu_smua_1: 'd=p&s=b&u=u3636601&w=240&h=128', //右上1百度广告
// right_top_baidu_smua_2: 'd=p&s=b&u=u3636601&w=240&h=128', //右上2 百度广告
// hot_baidu_smua_1: 'd=p&s=b&u=u3636984&w=200&h=64', //热闻百度广告1
// hot_baidu_smua_2: 'd=p&s=b&u=u3636984&w=200&h=64' //热闻百度广告2
normal_baidu_smua: 'd=p&s=b&u=u3778287&w=500&h=74', //数据流百度广告 左侧信息流
right_top_baidu_smua_1: 'd=p&s=b&u=u3668370&w=240&h=128', //右上1百度广告
right_top_baidu_smua_2: 'd=p&s=b&u=u3668373&w=240&h=128', //右上2 百度广告
hot_baidu_smua_1: 'd=p&s=b&u=u3668377&w=200&h=64', //热闻百度广告1
hot_baidu_smua_2: 'd=p&s=b&u=u3668377&w=200&h=64' //热闻百度广告2
};
proConfig = proObject;
};
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 == 'xiaoshuo') {
$(".mask").show();
Mini['showChoice']($(that), window.event);
}else{
$(".mask").hide();
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.currentIndex = $('.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.typeArray.length; i++) {
if (type == Mini.typeArray[i]) {
var flag = false;
break;
} else {
var flag = true;
}
}
Mini.typeArray.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');
});
/**
* All频道 对象 key=value
*/
// 将参数序列化,形如 ‘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 loadPjs(url, id, pid, op) {
var scriptAd = document.createElement("script");
scriptAd.type = "text/javascript";
scriptAd.src = url;
scriptAd.setAttribute('smua', op);
if ($('#' + pid).length > 0) {
$('#' + pid)[0].appendChild(scriptAd);
}
scriptAd.id = id;
}
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 miniPage() {
var obj = this;
this.pgnum_bot = 1;
this.startkey = '';
this.newkey = '';
this.uid = user_uid;
this.vqid = getUrlParamVal('vqid') || '';
this.vv = getUrlParamVal('vv') || '';
this.vuid = getUrlParamVal('vuid') || '';
this.bool = 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.typeArray = [];
this.bottomOutTime = 1;
this.imptk360 = [];
this.ad360data = [];
this.ad360index = 0;
this.pos_pro = '';
this.pos_city = '';
if (typeof miniPage.instance === 'object') {
return miniPage.instance;
}
this.instance = this;
this.zhike_bool_0410 = true;
this.pathname = window.location.pathname.slice(1, -1);
}
miniPage.prototype = {
// 页面初始化
bindEvent: function () {
var obj = this;
obj.typeArray.push(obj.type);
$.ajax({
url:proConfig.loadUrl.recommendUrl,
type: 'get',
dataType: 'json',
success: function (response) {
var data = response.data.list.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');
});
$('.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;
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);
});
var blockArea = ["北京", "上海", "天津"];
var blockTime = ["2018-12-11 12:00:00", "2018-12-11 12:30:00"];
var firstSspObject ={url:'http://ky2.jczhu.com',img:'//news.7654.com/mini_new2/003/statics/common/images/company.png'};
var secondSspObject ={url:'http://ky2.jczhu.com',img:'//news.7654.com/mini_new2/002/statics/common/images/company2.png'};
var startTime = Common.newDate(blockTime[0]).getTime();
var endTime = Common.newDate(blockTime[1]).getTime();
var nowTime = new Date().getTime();
if (nowTime > startTime && nowTime < endTime) {
var dom = '';
var dom2 = '';
$('.scroll_con .list_item:eq(0)').before(dom);
$('.scroll_con .list_item:eq(2)').before(dom2);
$.ajax({
url: '//iplocation.7654.com/v1?timestamp='+nowTime,
type: 'get',
dataType: 'json',
success: function (data) {
var hideCompany = false;
for(var i=0;i < blockArea.length;i++){
if(data.city.indexOf(blockArea[i]) >-1){
hideCompany = true;
break;
}
}
if (hideCompany) {
$('#company_1').remove();
$('#company_2').remove();
if (res[0]) {
if (res[0].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(0)', res[0], 1);
} else {
obj.render360('.scroll_con .list_item:eq(0)', res[0], 1);
}
url_scroll(res[0].imptk);
}
if (res[1]) {
if (res[1].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(2)', res[1], 3);
} else {
obj.render360('.scroll_con .list_item:eq(2)', res[1], 3);
}
url_scroll(res[1].imptk);
}
} else {
var dom = '' + '' + '';
var dom2 = '' + '' + '';
$('#company_1').html(dom);
$('#company_2').html(dom2);
}
},
error: function () {
if (res[0]) {
if (res[0].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(0)', res[0], 1);
} else {
obj.render360('.scroll_con .list_item:eq(0)', res[0], 1);
}
url_scroll(res[0].imptk);
}
if (res[1]) {
if (res[1].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(2)', res[1], 3);
} else {
obj.render360('.scroll_con .list_item:eq(2)', res[1], 3);
}
url_scroll(res[1].imptk);
}
}
});
} else {
if (res[0]) {
if (res[0].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(0)', res[0], 1);
} else {
obj.render360('.scroll_con .list_item:eq(0)', res[0], 1);
}
url_scroll(res[0].imptk);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(0)');
}
if (res[1]) {
if (res[1].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(2)', res[1], 3);
} else {
obj.render360('.scroll_con .list_item:eq(2)', res[1], 3);
}
url_scroll(res[1].imptk);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(2)');
}
}
// if (res[0]) {
// if (res[0].type == 3) {
// obj.renderBig360('.scroll_con .list_item:eq(0)', res[0]);
// } else {
// obj.render360('.scroll_con .list_item:eq(0)', res[0]);
// }
// url_scroll(res[0].imptk);
// }
// if (res[1]) {
// if (res[1].type == 3) {
// obj.renderBig360('.scroll_con .list_item:eq(2)', res[1]);
// } else {
// obj.render360('.scroll_con .list_item:eq(2)', res[1]);
// }
// url_scroll(res[1].imptk);
// }
if (res[2]) {
obj.render360('.scroll_con .list_item:eq(4)', res[2]);
if ($('.scroll_con .list_item:eq(4)').offset()) {
var nowTop = $('.scroll_con .list_item:eq(4)').offset().top;
if (nowTop < 570 && window.first_item_360bool_3) {
url_scroll(res[2].imptk);
window.first_item_360bool_3 = false;
}
}
}else{
obj.renderBaidu('.scroll_con .list_item:eq(4)');
}
if (res[3]) {
obj.render360('.scroll_con .list_item:eq(6)', res[3]);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(6)');
}
if (res[4]) {
obj.render360('.scroll_con .list_item:eq(8)', res[4]);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(8)');
}
if (res[5]) {
obj.render360('.scroll_con .list_item:eq(10)', res[5]);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(10)');
}
var showRefreshBool = true;
$('.content').on('scroll', function (event) {
var SCROLL_TOP = $(this).scrollTop();
var thirdTop = $('.scroll_con .list_item:eq(4)').offset().top;
var fourththirdTop = $('.scroll_con .list_item:eq(6)').offset().top;
var fifthTop = $('.scroll_con .list_item:eq(8)').offset().top;
var sixthTop = $('.scroll_con .list_item:eq(10)').offset().top;
if (thirdTop - 570 < 0 && window.first_item_360bool_3) {
window.first_item_360bool_3 = false;
if (obj.ad360data[2]) {
url_scroll(obj.ad360data[2].imptk);
}
}
if (fourththirdTop - 570 < 0 && window.first_item_360bool_4) {
// $('#refresh').show();
window.first_item_360bool_4 = false;
if (obj.ad360data[3]) {
url_scroll(obj.ad360data[3].imptk);
}
}
if (fifthTop - 570 < 0 && window.first_item_360bool_5) {
window.first_item_360bool_5 = false;
if (obj.ad360data[4]) {
url_scroll(obj.ad360data[4].imptk);
}
}
if (sixthTop - 570 < 0 && window.first_item_360bool_6) {
window.first_item_360bool_6 = false;
if (obj.ad360data[5]) {
url_scroll(obj.ad360data[5].imptk);
}
}
});
}, '', 6);
}, 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');
});
$('.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;
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]) {
if (res[0].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(0)', res[0], 1);
} else {
obj.render360('.scroll_con .list_item:eq(0)', res[0], 1);
}
url_scroll(res[0].imptk);
}else {
obj.renderBaidu('.scroll_con .list_item:eq(0)');
}
if (res[1]) {
if (res[1].type == 3) {
obj.renderBig360('.scroll_con .list_item:eq(2)', res[1], 3);
} else {
obj.render360('.scroll_con .list_item:eq(2)', res[1], 3);
}
url_scroll(res[1].imptk);
}else {
obj.renderBaidu('.scroll_con .list_item:eq(2)');
}
if (res[2]) {
obj.render360('.scroll_con .list_item:eq(4)', res[2],5);
if ($('.scroll_con .list_item:eq(4)').offset()) {
var nowTop = $('.scroll_con .list_item:eq(4)').offset().top;
if (nowTop < 500 && window.first_item_360bool_3) {
url_scroll(res[2].imptk);
window.first_item_360bool_3 = false;
}
}
}else {
obj.renderBaidu('.scroll_con .list_item:eq(4)');
}
if (res[3]) {
obj.render360('.scroll_con .list_item:eq(6)', res[3], 7);
}else {
obj.renderBaidu('.scroll_con .list_item:eq(6)');
}
if (res[4]) {
obj.render360('.scroll_con .list_item:eq(8)', res[4], 9);
}else {
obj.renderBaidu('.scroll_con .list_item:eq(8)');
}
if (res[5]) {
obj.render360('.scroll_con .list_item:eq(10)', res[5], 11);
}else {
obj.renderBaidu('.scroll_con .list_item:eq(10)');
}
var showRefreshBool = true;
$('.content').on('scroll', function (event) {
var SCROLL_TOP = $(this).scrollTop();
var thirdTop = $('.scroll_con .list_item:eq(4)').offset().top;
var fourththirdTop = $('.scroll_con .list_item:eq(6)').offset().top;
var fifthTop = $('.scroll_con .list_item:eq(8)').offset().top;
var sixthTop = $('.scroll_con .list_item:eq(10)').offset().top;
if (thirdTop - 500 < 0 && window.first_item_360bool_3) {
window.first_item_360bool_3 = false;
if (obj.ad360data[2]) {
url_scroll(obj.ad360data[2].imptk);
}
}
if (fourththirdTop - 500 < 0 && window.first_item_360bool_4) {
$('#refresh').show();
window.first_item_360bool_4 = false;
if (obj.ad360data[3]) {
url_scroll(obj.ad360data[3].imptk);
}
}
if (fifthTop - 500 < 0 && window.first_item_360bool_5) {
window.first_item_360bool_5 = false;
if (obj.ad360data[4]) {
url_scroll(obj.ad360data[4].imptk);
}
}
if (sixthTop - 500 < 0 && window.first_item_360bool_6) {
window.first_item_360bool_6 = false;
if (obj.ad360data[5]) {
url_scroll(obj.ad360data[5].imptk);
}
}
});
$('.scroll_con .list_item:eq(11)').after('刚刚看到这里 点击刷新
');
}, '', 6);
}, 1000);
},
error:function(){}
});
}
});
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曝光*/
var url_scroll = function (arr) {
$.each(arr, function (index, val) {
$('body').append('');
});
};
/*360点击曝光*/
$('body').on('mousedown', '.img_click_gg', function (e) {
var x = Math.floor(e.pageX - $(this).offset().left),
y = Math.floor(e.pageY - $(this).offset().top);
x = x<0 ? 0:x;
y = y<0 ? 0:y;
mouseDownMacro($(this), x, y);
}).on('click', '.img_click_gg', function () {
mouseUpMacro($(this));
var str = $(this).attr('data-clktk');
var href = $(this).attr('href');
if (str) {
var arr = str.split(',');
$.each(arr, function (index, val) {
$('body').append('');
});
}
});
// 加载 右侧顶部的 360广告 百度广告打底
obj.get360Ad(1, function (res) {
if (res[0]) {
$('.right_pannel .showcase:eq(0)').html('')
url_scroll(res[0].imptk);
} else {
obj.renderTopRightBaiduO('.right_pannel .showcase')
}
if (res[1]) {
$('.right_pannel .showcase:eq(1)').html('')
url_scroll(res[1].imptk);
} else {
obj.renderTopRightBaiduT('.right_pannel .showcase')
}
}, proConfig.top_right_showId, 2);
$('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 = 570;
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: '01747',
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.fetchData(params);
}
});
},
// 页面初始化数据获取
fetchData: function (params, btn) {
var loading_dom = '加载中⋅⋅⋅'+Common.getIeVersion()+' ';
$('.content').prepend(loading_dom);
var obj = this;
var onlineUrl1 = proConfig.loadUrl.onlineUrl1;
var onlineUrl2 = proConfig.loadUrl.onlineUrl2;
if (obj.refresh_dev) {
onlineUrl = onlineUrl1 +proConfig.typeKey[params.type] + '/10/'+ proConfig.typeKeyRow[params.type]
}
if (obj.refresh_scroll || obj.refresh_tab) {
onlineUrl = onlineUrl1 +proConfig.typeKey[params.type] + '/10/'+ proConfig.typeKeyRow[params.type]
}
$.ajax({
url: onlineUrl,
type: 'get',
dataType: 'json',
cache:false,
error: function () {
fetchData(null);
},
success: function (res) {
if (res.status == 1) {
proConfig.typeKeyRow[params.type]= res.data.last_row;
res.data = res.data.list;
//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);
});
//SSPStart
var blockArea = ["北京", "上海", "天津"];
var blockTime = ["2018-12-11 12:00:00", "2018-12-11 12:30:00"];
var firstSspObject ={url:'http://ky2.jczhu.com',img:'//news.7654.com/mini_new2/003/statics/common/images/company.png'};
var secondSspObject ={url:'http://ky2.jczhu.com',img:'//news.7654.com/mini_new2/002/statics/common/images/company2.png'};
var startTime = Common.newDate(blockTime[0]).getTime();
var endTime = Common.newDate(blockTime[1]).getTime();
var nowTime = new Date().getTime();
if (nowTime > startTime && nowTime < endTime) {
var dom = '';
var dom2 = '';
$('.scroll_con .list_item:eq(0)').before(dom);
$('.scroll_con .list_item:eq(2)').before(dom2);
$.ajax({
url: '//iplocation.7654.com/v1',
type: 'get',
dataType: 'json',
success: function (data) {
var hideCompany = false;
for(var i=0;i < blockArea.length;i++){
if(data.city.indexOf(blockArea[i]) >-1){
hideCompany = true;
break;
}
}
if (hideCompany) {
$('#company_1').remove();
$('#company_2').remove();
if (res[0]) {
if (res[0].type == 3) {
obj.renderBig360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0] , 1);
} else {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0], 1);
}
url_scroll(res[0].imptk);
}
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);
}
url_scroll(res[1].imptk);
}
} else {
var dom = '' + '' + '';
var dom2 = '' + '' + '';
$('#company_1').html(dom);
$('#company_2').html(dom2);
}
},
error: function () {
if (res[0]) {
if (res[0].type == 3) {
obj.renderBig360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0] , 1);
} else {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0], 1);
}
url_scroll(res[0].imptk);
}
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);
}
url_scroll(res[1].imptk);
}
}
});
} else {
if (res[0]) {
if (res[0].type == 3) {
obj.renderBig360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0] , 1);
} else {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0], 1);
}
url_scroll(res[0].imptk);
}else{
obj.renderBaidu('.scroll_con.' + oType + ' .list_item:eq(0)');
}
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);
}
url_scroll(res[1].imptk);
}else{
obj.renderBaidu('.scroll_con.' + oType + ' .list_item:eq(2)');
}
}
// if (res[0]) {
// if (res[0].type == 3) {
// obj.renderBig360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0]);
// } else {
// obj.render360('.scroll_con.' + oType + ' .list_item:eq(0)', res[0]);
// }
// url_scroll(res[0].imptk);
// }
// if (res[1]) {
// if (res[1].type == 3) {
// obj.renderBig360('.scroll_con.' + oType + ' .list_item:eq(2)', res[1]);
// } else {
// obj.render360('.scroll_con.' + oType + ' .list_item:eq(2)', res[1]);
// }
// url_scroll(res[1].imptk);
// }
//
if (res[2]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(4)', res[2]);
if ($('.scroll_con.' + oType + ' .list_item:eq(4)').offset()) {
var nowTop = $('.scroll_con.' + oType + ' .list_item:eq(4)').offset().top;
}
if (nowTop < 570 && window.first_item_360bool_3) {
url_scroll(res[2].imptk);
window.first_item_360bool_3 = false;
}
}else{
obj.renderBaidu('.scroll_con.' + oType + ' .list_item:eq(4)');
}
if (res[3]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(6)', res[3]);
}else{
obj.renderBaidu('.scroll_con.' + oType + ' .list_item:eq(6)');
}
if (res[4]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(8)', res[4]);
}else{
obj.renderBaidu('.scroll_con.' + oType + ' .list_item:eq(8)');
}
if (res[5]) {
obj.render360('.scroll_con.' + oType + ' .list_item:eq(10)', res[5]);
}else{
obj.renderBaidu('.scroll_con.' + oType + ' .list_item:eq(10)');
}
var showRefreshBool = true;
}, '', 6);
}, 1000)
//每次网络请求后 把type当做key, res当做value 存入对象中
if (oType !== 'lieqi') {
// $('.scroll_con .news_item:eq(9)').after('刚刚看到这里 点击刷新
');
}
$('.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]);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(' + (list_len + 2) + ')');
}
if (res[1]) {
obj.render360('.scroll_con .list_item:eq(' + (list_len + 6) + ')', res[1]);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(' + (list_len + 6) + ')');
}
if (res[2]) {
obj.render360('.scroll_con .list_item:eq(' + (list_len + 10) + ')', res[2]);
}else{
obj.renderBaidu('.scroll_con .list_item:eq(' + (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]) {
url_scroll(obj.imptk360[0]);
}
}
if (570 + SCROLL_TOP > list_360item_h_2 && item_360bool_2) {
item_360bool_2 = false;
if (obj.imptk360[1]) {
url_scroll(obj.imptk360[1]);
}
}
if (570 + SCROLL_TOP > list_360item_h_3 && item_360bool_3) {
item_360bool_3 = false;
if (obj.imptk360[1]) {
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',
recommend_type = 1,
recommend_of = 4,
reqtimes = reqtime || 1,
recommend_newf = 1,
tck = Common.GetQueryString("tck"),
recommend_showid = showId || proConfig.message_flow_showId,
recommend_adnum = num || 3,
recommendk_uid = recommendUid(),
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;
} 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;
}
$.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);
var pso ={
timestamp: new Date().getTime(),
project: location.pathname,
action:"show",
p1:'messageFlow',
p2: recommend_showid,
p3: !data.ads ? "error": "success",
p4:"null"
};
upload2(pso);
},
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);
var pso ={
timestamp: new Date().getTime(),
project: location.pathname,
action:"show",
p1:'topRight',
p2: recommend_showid,
p3: !data.ads ? "error": "success",
p4:"null"
};
upload2(pso);
},
error: function () {callback(null);}
})
}
}else{
var d = data.ads || [];
callback && callback(d);
}
},
error: function () {callback(null);}
})
},
showChoice:function () {
$("#maskIframe").attr("src","./choice.html?qid=qh005_001");
},
// 数据渲染
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 = '' ,
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.content_img_num == 3 || content.content_img_num == 4) {
var more_imgs = '';
var should_reduce_h = '';
if (content.content_img_list.length == 4) {
$.each(content.content_img_list, function (index, val) {
if(val.indexOf('://') > -1){
val = '//' + val.split('://')[1];
}
more_imgs += '';
});
} else {
$.each(content.content_img_list, function (index, val) {
if(val.indexOf('://') > -1){
val = '//' + val.split('://')[1];
}
more_imgs += '';
});
more_imgs += '查看详情>>'
}
dom = '';
} else {
if(content.content_img_list[0] && content.content_img_list[0].indexOf('://') > -1){
content.content_img_list[0] = '//' + content.content_img_list[0].split('://')[1];
}
dom = '';
};
if (render_way == 'prepend') {
$(target_dom).prepend(dom);
} else {
$(target_dom).append(dom);
}
// pdata.init();
},
// 百度多图
renderBigBaidu: function (target_dom) {
$(target_dom).before('');
loadPjs('//www.nkscdn.com/smu0/o.js', 'b-bigbaidu', 'bigbaidu', proConfig.big_baidu_smua);
},
// 百度数据流广告
renderBaidu: function (target_dom) {
var obj = this;
obj.adsid++;
$(target_dom).before('');
loadPjs('//www.nkscdn.com/smu0/o.js', 'b-flowbaidu', 'flowbaidu_' + obj.adsid, proConfig.normal_baidu_smua);
},
// 百度广告右上一
renderTopRightBaiduO: function (target_dom) {
$(target_dom).eq(0).append('');
loadPjs('//www.nkscdn.com/smu0/o.js', 'b-toprighto', 'toprighto', proConfig.right_top_baidu_smua_1);
},
// 百度广告右上二
renderTopRightBaiduT: function (target_dom) {
$(target_dom).eq(1).append('');
loadPjs('//www.nkscdn.com/smu0/o.js', 'b-toprightt', 'toprightt', proConfig.right_top_baidu_smua_2);
},
// 百度广告24小时热闻_1
renderHotBaidu1: function (target_dom) {
if(proConfig.hot_baidu_smua_1){
$(target_dom).after('');
loadPjs('//www.nkscdn.com/smu0/o.js', 'b-hotad', 'hotad', proConfig.hot_baidu_smua_1);
}
},
// 百度广告24小时热闻_2
renderHotBaidu2: function (target_dom) {
if(proConfig.hot_baidu_smua_2){
$(target_dom).after('');
loadPjs('//www.nkscdn.com/smu0/o.js', 'b-hotad', 'hotad2', proConfig.hot_baidu_smua_2);
}
},
//360大图样式
renderBig360: function (target_dom, adData) {
this.ad360index++;
var dom = '';
$(target_dom).before(dom);
},
// 360广告数据流
render360: function (target_dom, adData) {
this.ad360index++;
if (adData.type == 2) {
var more_imgs = '';
$.each(adData.assets, function (i, v) {
more_imgs += ''
})
var dom = '';
} else {
var dom = '';
}
$(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.currentIndex) {
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: '01747'
};
$('.scroll_con').html("").attr('class', 'scroll_con ' + oType);
obj.refresh_tab = true;
obj.fetchData(params, btn);
}
};
// 广告uid
function recommendUid() {
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;
}
/*360曝光*/
var url_scroll = function (arr) {
$.each(arr, function (index, val) {
$('body').append('');
});
}
// 热闻360广告请求
function getRight360(callback) {
var recommend_url = '//show.g.mediav.com/s',
recommend_type = 1,
recommend_of = 4,
reqtimes = 1,
recommend_newf = 1,
recommend_showid = proConfig.hot_showId,
tck = Common.GetQueryString("tck"),
recommend_adnum = 2,
recommendk_uid = recommendUid(),
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;
} 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;
}
$.ajax({
type: 'get',
url: recommend_param,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
if(!data.ads){
if(proConfig.hot_showId_first){
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);
var pso ={
timestamp: new Date().getTime(),
project: location.pathname,
action:"show",
p1:'hotNews',
p2: recommend_showid,
p3: !data.ads ? "error": "success",
p4:"null"
};
upload2(pso);
}
})
}
}else{
var d = data.ads || [];
callback && callback(d);
}
}
})
}
var Mini = new miniPage();
Mini.bindEvent();
// 热闻数据init
$.ajax({
url: proConfig.loadUrl.hotUrl,
type: 'get',
dataType: 'json',
success: function (res) {
// var today_news_data;
// if(proConfig.loadUrl.hotUrl === '//miniapi.7654.com/mini/news/hot'){
// today_news_data = res.data;
// }else{
// today_news_data = res;
// }
// var arr_index = [];
// $.each(today_news_data, function (index, val) {
// arr_index.push(val);
// });
// var now_data_arr = arr_index;
// var sspObj=[{
// title:'19岁的她冷暴力新婚丈夫,一朝重生后却陷入...',
// img_url:'./statics/assets/images/xy1.png',
// url:'http://www.qihaxiaoshuo.com/chapter?bookId=2914&chapterId=2914_8&qid=qh005_002'
// },{
// title:'美女酒吧门口秀车技,暧昧男子险被吓晕?',
// img_url:'./statics/assets/images/xy2.png',
// url:'http://www.qihaxiaoshuo.com/chapter?bookId=3062&chapterId=3062_4&qid=qh005_002'
// }];
// now_data_arr[0]=sspObj[0];
// now_data_arr[1]=sspObj[1];
// renderTodayNews(now_data_arr);
var today_news_data=res.data;
var arr_index = [];
$.each(today_news_data, function (index, val) {
arr_index.push(val);
});
var now_data_arr = arr_index;
renderNovel(now_data_arr);
getRight360(function (res) {
if (res[0]) {
renderToday360Ad('.today_news ul li:eq(0)', res[0]);
url_scroll(res[0].imptk);
} else {
// 右侧添加 百度广告
var obj = new miniPage
obj.renderHotBaidu1('.today_news ul li:eq(0)')
}
if (res[1]) {
renderToday360Ad('.today_news ul li:eq(2)', res[1]);
url_scroll(res[1].imptk);
} else {
// 右侧添加 百度广告
var obj = new miniPage
obj.renderHotBaidu2('.today_news ul li:eq(2)')
}
})
}
});
function renderNovel(arr) {
var dom = '';
var i = 0;
$.each(arr, function (index, val) {
i--;
dom += '' + val.title + '
';
});
$('.today_news ul').append(dom);
}
function renderTodayNews(arr) {
var dom = '';
var i = 0;
$.each(arr, function (index, val) {
var myQId = proConfig.qid['rewen'] || 'k002'
i--;
if(proConfig.loadUrl.hotUrl === '//miniapi.7654.com/mini/news/hot'){
dom += '' + val.title + '
';
}else{
dom += '' + val.title + '
';
}
});
$('.today_news ul').append(dom);
}
var adRightIndex = 0;
function renderToday360Ad(target_dom, adData) {
adRightIndex++;
var dom = '' + adData.title + '
广告'
$(target_dom).after(dom);
}
// function reloadAdvers(){
// if($('.right_pannel .showcase:eq(0)').html() == "" && $('.right_pannel .showcase:eq(1)').html() == ""){
// var obj = new miniPage();
// obj.get360Ad(1, function (res) {
// if (res[0]) {
// $('.right_pannel .showcase:eq(0)').html('')
// url_scroll(res[0].imptk);
// } else {
// obj.renderTopRightBaiduO('.right_pannel .showcase')
// }
// if (res[1]) {
// $('.right_pannel .showcase:eq(1)').html('')
// url_scroll(res[1].imptk);
// } else {
// obj.renderTopRightBaiduT('.right_pannel .showcase')
// }
// }, proConfig.top_right_showId, 2);
// }
// }
//
// setTimeout(function () {
// reloadAdvers();
// },20000);
// SSP 强弹- Start
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(["2018-12-11 00:00:00", "2018-12-11 20:59:59"],"https://s.click.taobao.com/o4lf8Jw","showDouble_013_2",["杭州","深圳"]);
showPop(["2018-12-11 21:00:00", "2018-12-11 23:59:59"],"https://s.click.taobao.com/o4lf8Jw","showDouble_013_3",["杭州","深圳"]);
// SSP 强弹- End
function upload(e) {
$.getJSON("//ad.kuaizip.com/advertise/userclick", {
time: new Date().getTime(),
localUrl: $.base64.encode("kZip.com" + location.pathname),
project: $.base64.encode("ys001"),
position: $.base64.encode(e.getAttribute("position-tag"))
}).done(function(data) {});
}
function upload2(e) {
$.getJSON("//360adreport.news.7654.com/advertise/ssp", {
timestamp: new Date().getTime(),
project: e.project,//项目地址 location.pathname
action: e.action,//动作统一上报 'show'
p1:e.p1,// position:{ messageFlow/topRight/hotNews}
p2:e.p2,// showId:当前位置 showId
p3:e.p3,// 二次请求是否成功 data.ads 如果有上报 success 失败上报 error
p4:"mini" // 空字符或其他字段 ""
}).done(function(data) {});
}
$(document).ready(function () {
console.log('我完成了加载!');
if (typeof (external.WebFinished) != 'undefined') {
external.WebFinished();
}
});