$.support.cors = true; //load config var configInfo = config[1]; var renderStatus = 0; var project_ad_pos = "kuaiya"; 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; } } } } }; //Zhike曝光上报 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 || '2299623', ad_pos:uploadAction.ad_pos || 'kuaiya_tnews_1', ad_time:new Date().getTime() || 'default', ad_type:uploadAction.ad_type || 'dianshang', strategy_id:uploadAction.strategy_id || '918', idea_id:uploadAction.idea_id || '80', plan_id:uploadAction.plan_id || '50', product_category:uploadAction.product_category||'13' }; 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) {}); } function newUpload(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 || '', ad_pos:uploadAction.ad_pos || 'kuaiya_tnews_1', 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' }; var objParams = params.project + '\t'+ params.data + '\t'+params.os+ '\t'+params.browser+ '\t'+params.act+'\t'+params.ad_id+'\t'+params.ad_pos+'\t'+params.ad_time+'\t'+params.ad_type+'\t'+params.strategy_id+'\t'+params.idea_id+'\t'+params.plan_id+'\t'+params.dspData+'\t'+params.product_category; var newUrl = $.base64.encode(encodeURI(objParams)); var url = "http://adtj.kpzip.com/dsp/user_click?code="+ newUrl; $.getJSON(url).done(function (data) {}); } var currentCity = ""; var getJson = ""; if("GetCity" in window.external){ currentCity = window.external.GetCity() || ""; } if("GetCloseButtonJson" in window.external){ getJson = window.external.GetCloseButtonJson() || ""; } var closeRule = "",otherRule =""; if(getJson){ var allCloseRule = JSON.parse(getJson); closeRule = allCloseRule[currentCity] || ""; otherRule = allCloseRule.others || ""; } function getCloseImg(type){ var defaultImg = "14"; switch(type){ case "dianshang": defaultImg = "14"; break; case "dsp": defaultImg = "8"; break; case "zhike": defaultImg = "8"; break; default: defaultImg = "14"; } var imgName = defaultImg; if(closeRule[type] && closeRule[type].level){ imgName = closeRule[type].level; }else if(otherRule[type] && otherRule[type].level){ imgName = otherRule[type].level; }else{ imgName = defaultImg; } var imgUrl = "../../libs/images/closebutton/"+imgName+".png"+"?v="+new Date().getTime(); return imgUrl; } (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 () { if(renderStatus==0){ renderStatus=1; $('.container').empty(); uploadConfig.ad_type="dianshang"; uploadConfig.act="load"; var dom='
不感兴趣
关闭
'+ ''+ '快压-广告' $('.container').append(dom); $(".close_big").html(''); uploadZhike(uploadConfig); getNews(); document.getElementById("ak").onload = function () { uploadConfig.act = 'show'; uploadConfig.product_category = '13'; uploadZhike(uploadConfig); var page_size ='370,394'; $('head').append(''); if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } }; $("body").on('click','#ak',function(){ uploadConfig.act = 'click'; uploadConfig.product_category = '13'; uploadZhike(uploadConfig); }); } }, uploadUrl: function (url) { var images = new Image(); images.src = url; } }; window.ProjectConfig = ProjectConfig; window.uploadConfig = {}; })(); 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 render = true; var currentIndex = 0; var dataRes; var url = ''; var urlOrigin=''; var ccUrl=""; // 橱窗跳转链接 if(location.host == 'news.7654.com'){ url = 'http://ssp.7654.com/ssp/v2/ads?qid='; urlOrigin='http://news.7654.com'; ccUrl="http://news.698283.vip/tnews_ad360/02/s11/sf.html"; }else{ url = 'http://test-ssp.7654.com/ssp/v2/ads?qid='; urlOrigin='http://test.gamma-minipage.news.7654.com'; ccUrl="http://test.698283.vip/tnews_ad360/02/s11/sf.html"; } var mixData = ProjectConfig.GetQueryString('data') || ''; var uid=""; if('GetX' in window.external){ uid =window.external.GetX()||""; } var user_type=ProjectConfig.GetQueryString('nc')|| ''; var browser=ProjectConfig.GetQueryString('browser')|| ''; $.ajax({ url: url + ProjectConfig.GetQueryString('project') + '&ad=kuaiya_tnews_1&time='+new Date().getTime()+'&uid='+uid+'&user_type='+user_type+'&mixData='+mixData+'&browser='+browser, type: 'get', dataType: 'json', success: function (obj) { if(obj.data && obj.data.kuaiya_tnews_1){ dataRes = obj.data.kuaiya_tnews_1; if(dataRes.script.length){ getFor(0,dataRes) }else{ renderStatus=0; ProjectConfig.loadBase() } } }, error:function () { renderStatus=0; ProjectConfig.loadBase() } }); function getFor(start,data){ for(var i =start;i' $('.container').append(dom); $(".close_big").html(''); getNews(); render = false; var height=parseInt(data.script[i].idea.main_img_h)+144; var width=data.script[i].idea.main_img_w; var page_size =''+width+','+height+''; if(data.script[i].mini_reader == 1){ // swpiw 1用阅读器打开 $('head').append(''); }else{ $('head').append(''); } if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } // iframe 点击上报 $("body").on('click','#ak',function(){ uploadConfig.act = 'click'; uploadZhike(uploadConfig); }) uploadConfig.act = 'show'; uploadZhike(uploadConfig); }else{//直客 zhikeRender(data,i,product_category_url); } } }else if(data.script[i].type == 3){ //加载 dsp if(data.script[i].ad_type==5){ // var uploadUrl = '&ad_type=dsp_360' + '&ad_pos='+'kuaiya_tnews_1'+'&baidu_id='+ data.baidu_id +'&strategy_id='+data.script[i].strategy_id+'&idea_id='+data.script[i].idea_id+'&plan_id='+data.script[i].plan_id+'&product_category='+data.script[i].product_category; // var openUrl = urlOrigin + "/tnewsdsp/02/s11/sf.html?" + location.search.split('?')[1] + uploadUrl; // window.external.RedirectUrl(openUrl); RedirectSf(data,i,project_ad_pos,ccUrl) render = false; }else if(data.script[i].ad_type==2){ if(data.script[i].content){ var sspConfig = JSON.parse(data.script[i].content); // 展盟dsp上报 var zmDsp ={ requestId:1e18*Math.random(), slot:{ proj:ProjectConfig.GetQueryString('project') || 'kuaizip', mixData:ProjectConfig.GetQueryString('data') || '', imageType: sspConfig.imageType || 3, popType:'tnews' } }; var datas = encodeURI(JSON.stringify((zmDsp))); window.uploadConfig = { act:'load', ad_id:data.baidu_id, ad_pos:'kuaiya_tnews_1', ad_type:'dsp_zm', strategy_id:data.script[i].strategy_id, idea_id:data.script[i].idea_id, plan_id:data.script[i].plan_id, product_category:data.script[i].product_category }; var url = sspConfig.url + $.base64.encode(datas); render = false; $.ajax({ url: url, // url:'http://ads.7654.com/zcxxlxwerrorjson', type: 'get', dataType: 'json', success: function (obj) { if(obj.code == 0){ var ads = obj.result.ads[0]; var readStatus = ads.readStatus || ''; var dom =''; $('.container').append(dom); $(".close_big").html(''); getNews(); uploadConfig.act = 'load'; uploadConfig.dspData = JSON.stringify(ads); newUpload(uploadConfig); uploadZhike(uploadConfig); document.getElementById("ak").onload = function () { uploadConfig.act = 'show'; newUpload(uploadConfig); uploadZhike(uploadConfig); var page_size ='370,394'; $('head').append(''); if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } }; $("body").on('click','#ak',function(){ uploadConfig.act = 'click'; uploadConfig.dspData = JSON.stringify(ads); newUpload(uploadConfig); uploadZhike(uploadConfig); }); if(readStatus == 1){ // showType 2 用阅读器打开 $('head').append(''); }else{ $('head').append(''); } if (typeof window.external != 'undefined' && typeof window.external.CppCall != 'undefined') { window.external.CppCall(page_size); } }else{ render = true; var start = currentIndex + 1; getFor(start,dataRes); } }, error:function () { render = true; var start = currentIndex + 1; getFor(start,dataRes); } }); } }else if(data.script[i].ad_type == 9){ //快果dsp showKgdsp(data,i,project_ad_pos) }else if(data.script[i].ad_type == 10){ // 嵩恒dsp2 showShdsp2(data,i,project_ad_pos,ccUrl) }else if(data.script[i].ad_type==1){ window.uploadConfig = { act:'load', ad_id:data.baidu_id, ad_pos:'kuaiya_tnews_1', ad_type:'dsp_songheng', strategy_id:data.script[i].strategy_id, idea_id:data.script[i].idea_id, plan_id:data.script[i].plan_id, product_category:data.script[i].product_category, project_cn:"快压", mini_reader:data.script[i].mini_reader }; var sspConfig = JSON.parse(data.script[i].content); var params= { uid: ProjectConfig.getCookie(), os: ProjectConfig.getSystem(), thisurl: location.href, jsonpcallback:'loadDspAd' }; params = ProjectConfig.Assign(params,sspConfig); var configParams = { url:params.url, params:params }; delete configParams.params.url; $.ajax({ url: configParams.url, type: 'get', dataType: 'jsonp', jsonp: 'jsonp', timeout: 5000, data: configParams.params, jsonpCallback: 'loadDspAd', success: function (e) {}, error: function (e) { uploadConfig.act = 'songheng_error'; uploadZhike(uploadConfig); render = true; var start = currentIndex + 1; getFor(start,dataRes); renderStatus=1; } }); render = false; } } } } } } } function getNews(){ $.ajax({ url:'http://news.7654.com/api/tnews_news_list/tnews6/kuaiya101', type:'get', dataType:'json', success:function(res){ var arr=res.data; var newsDom=''; $.each(arr,function(index,val){ newsDom+='
  • '+ '

    '+val.title+'

    新闻
  • ' }); $(".box").append(newsDom); } }) }