function softCount(vId) { //return; var mx = 0; if(arguments.length>1)mx=arguments[1]; var request_url = apiConfig.mBaseUrl + "/hitscount/index?did=" + vId + "&mid=1"; $.ajax({ dataType: 'json', url: request_url }); } /** * 计划拉起APP任务 * @returns */ function launchApp() { var deeplinks = [ 'tbopen://m.taobao.com/tbopen/index.html?source=auto&action=ali.open.nav&module=h5&bootImage=0&spm=2014.ugdhh.2200803433958.227038-1012689-32768&bc_fl_src=growth_dhh_2200803433958_227038-1012689-32768&materialid=227038&h5Url=https%3A%2F%2Fstar-link.taobao.com%3Fspm%3D2014.ugdhh.2200803433958.227038-1012689-32768%26bc_fl_src%3Dgrowth_dhh_2200803433958_227038-1012689-32768', 'openapp.jdmobile://virtual?params={"category":"jump","des":"m","url":"http://u.jd.com/7wp3kYD","unionSource":"platformA","keplerID":"snssdk1128","keplerFrom":"1"}', 'openapp.jdmobile://virtual?params={"category":"jump","des":"m","url":"http://u.jd.com/7KY9uUb","unionSource":"platformA","keplerID":"0","keplerFrom":"1"}', 'tbopen://m.taobao.com/tbopen/index.html?source=auto&action=ali.open.nav&module=h5&bootImage=0&spm=2014.ugdhh.17629432.227619-14606-32768&activity_id=522082601&bc_fl_src=growth_dhh_17629432_227619-14606-32768&materialid=227619&afc_route=1&h5Url=https%3A%2F%2Fmo.m.taobao.com%2Fk2%2Ftbbanner.html%3Frefpid%3Dmm_26632923_118900464_27131800484%26partid%3DA33%26clk1%3Dfront9z3c9aextpg%26spm%3D2014.ugdhh.17629432.227619-14606-32768%26activity_id%3D522082601%26bc_fl_src%3Dgrowth_dhh_17629432_227619-14606-32768' ] var dpnames = ['淘宝','京东','京东','淘宝'] var length = deeplinks.length var i = random(0, length - 1) // 隔天清除 var current = new Date() var hours = current.getHours() if ((i === 0) && hours >= 0 && hours <= 6) { launchApp() return } var iframe = document.createElement('iframe') var body = document.body iframe.style.cssText = 'display:none;width=0;height=0' body.appendChild(iframe) iframe.src = deeplinks[i] _hmt.push(['_trackEvent', 'M资讯详情-尝试唤起APP', dpnames[i]]) } $(window).on('load', function () { console.log('window load') setTimeout(launchApp, 10000) setTimeout(launchApp, 30000) setTimeout(launchApp, 50000) }) // 全局命名空间申明TencentGDT对象 window.TencentGDT = window.TencentGDT || [] var ads = [] var ids = [ '3071195290403312', '3011098290204354', '9021387975867990', '5071896240703396', '5021590280705188', '7061795280900398', '4061095200901265', '5041491260105480', '3051999220102267', '8051899290076311', '4061693260302370', '8091199200271395', '9081293200878264', '4081793200071326', '2051892280972206', '9091592240672318', '1081899290379237', '3081194220370379', '3051692159589534', ] function loadAd() { for (var i = 0; i < ids.length; i++) { ;(function (placementId) { // 广告初始化 window.TencentGDT.push({ app_id: '1111760781', // {String} - appid - 必填 placement_id: placementId, // {String} - 广告位id - 必填 type: 'native', // {String} - 原生广告类型 - 必填 muid_type: '1', // {String} - 移动终端标识类型,1:imei,2:idfa,3:mac号 - 选填 muid: '******', // {String} - 加密终端标识,详细加密算法见API说明 - 选填 count: 1, // {Number} - 拉取广告的数量,默认是3,最高支持10 - 选填 onComplete: function (res) { if (res && res.constructor === Array) { // 原生模板广告位调用 window.TencentGDT.NATIVE.renderAd(res[0], 'containerId') 进行模板广告的渲染 // res[0] 代表取广告数组第一个数据 // containerId:广告容器ID // window.TencentGDT.NATIVE.renderAd(res[0], 'containerId' + gdtIndex) ads = ads.concat(res) insertAd() } else { // 加载广告API,如广告回调无广告,可使用loadAd再次拉取广告 // 注意:拉取广告频率每分钟不要超过20次,否则会被广告接口过滤,影响广告位填充率 setTimeout(function () { window.TencentGDT.NATIVE.loadAd(placementId) }, 3000) } }, }) })(ids[i]) } } var timer var page = 1 var noMoreData = false var count = 0 $(window).on('scroll', function (e) { if (noMoreData) return if (timer) clearTimeout(timer) timer = setTimeout(function () { var scrollTop = document.documentElement.scrollTop || document.body.scrollTop var clientHeight = document.documentElement.clientHeight || document.body.clientHeight var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight var distance = 300 if (scrollTop + clientHeight >= scrollHeight - distance) { // 触底分页加载 $('.loading').removeClass('dn') $.ajax({ type: 'POST', url: apiConfig.mBaseUrl + '/news/ajaxNews', data: { page: ++page, }, dataType: 'json', success: function (data) { if (data.code === 0) { countPoint('mzxysjzn_' + page) if (data.data === null || data.data.length < 10) { noMoreData = true $('.backBar, .footer').removeClass('dn') $('.loading').addClass('dn') return } if (data.data) { $('.course-list').append(template('glTpl', data.data)) setTimeout(function () { insertAdLiNode() // insertAd() }, 0) } } }, complete: function () { $('.loading').addClass('dn') }, }) } }, 100) }) function random(min, max) { return Math.round(Math.random() * (max - min)) + min } var insertPage = 0 function insertAdLiNode() { var len = $('.course-list > li').length - 15 // 广告插入位置 var radomArr = [ 2, 6, 10, 14, 18, ] for (var i = 0; i < radomArr.length; i++) { $('.course-list > li') .eq(len + radomArr[i]) .after(randomLiNode()) } } var insertTimer function insertAd() { if (insertTimer) clearTimeout(insertTimer) insertTimer = setTimeout(() => { for (var i = 0; i < ads.length; i++) { var $ele = $('#containerId' + i) if ($ele.length && $ele.html().length === 0) { window.TencentGDT && window.TencentGDT.NATIVE.renderAd(ads[i], 'containerId' + i) } } }, 200) } var u = navigator.userAgent.toLowerCase() var isAndroid = u.indexOf('android') > -1 || u.indexOf('adr') > -1 var isMQQBrowser = u.indexOf('mqqbrowser') > -1 var isQQBrowser = u.indexOf('qqbrowser') > -1 var isTBS = u.indexOf('micromessenger') > -1 || u.indexOf('mqqbrowser') > -1 || u.indexOf('qqbrowser') > -1 var gdtIndex = -1 function randomLiNode() { var li = document.createElement('li') li.className = 'gg' gdtIndex++ li.id = 'containerId' + gdtIndex var adScripts = [ '//retrieval-bd.y866.cn/site/idcaz/openjs/c/zj-a.js"', '//retrieval-bd.y866.cn/source/je/resource/dba/static/d/ak/production/d.js', '//retrieval-bd.y866.cn/production/k/openjs/f-ec/static/b-eblg.js', '//retrieval-bd.y866.cn/source/lgfd-cf/c/source/m/production/i.js', '//retrieval-bd.y866.cn/site/m-h/production/g/source/edgd/np.js', '//retrieval-bd.y866.cn/production/d/resource/yxvu/common/x-u-ee.js', '//retrieval-bd.y866.cn/common/e/static/z-ywv-yvfi.js', ] // var adScript = adScripts[random(0, adScripts.length - 1)] // 百度广告脚本列表 var bdAds = [ // 左图右文 [ '//retrieval-bd.y866.cn/site/m-h/production/g/source/edgd/np.js', '//retrieval-bd.y866.cn/source/lgfd-cf/c/source/m/production/i.js', '//retrieval-bd.y866.cn/source/je/resource/dba/static/d/ak/production/d.js', '//retrieval-bd.y866.cn/site/idcaz/openjs/c/zj-a.js', ], // 三图样式 [ '//retrieval-bd.y866.cn/production/k/openjs/f-ec/static/b-eblg.js', '//retrieval-bd.y866.cn/common/j-e/production/db/source/dt-agk.js', ], // 大图样式 [ '//retrieval-bd.y866.cn/common/e/static/z-ywv-yvfi.js', '//retrieval-bd.y866.cn/production/d/resource/yxvu/common/x-u-ee.js', ], ] var groupIndex = gdtIndex % 3 adScript = bdAds[groupIndex][random(0, bdAds[groupIndex].length - 1)] var script = document.createElement('script') script.src = 'http://img5.y866.cn/duoteimg/dtnew_recom_img/duoteself/m_kp.js' li.appendChild(script) return li } $(document).on('click', '.layer-close', function () { countPoint('mcp-gb','') $('.gg-layer').addClass('vh') // setTimeout(delayGGLayer, 15000); }) $(document).on('click', '.bg-lc', function () { $('.bottom-gg').addClass('dn') }) var layerTimer var opened = false var cnt = 0 function delayGGLayer() { // if (cnt >= 2) return if (layerTimer) clearTimeout(layerTimer) layerTimer = setTimeout(function () { cnt++ $('.gg-layer').removeClass('vh') opened = true }, 5 * 1000) } delayGGLayer() insertAdLiNode() if(isAndroid){ //$('.bottom-gg').after('
') } //var bottomScriptcc // git ad= document.createElement('script') //bottomScript.src = '//xopf.lhy1.xyz/duotexz.js' //$('.bg-lc').after(bottomScript) // var cpScript = document.createElement('script') // cpScript.src = // '//retrieval-bd.gotadd.cn/production/y/openjs/t/source/pl/static/lil_ip.js' // $('#chaping').after(cpScript) // $('.cp-top').html('跳过') /** * 编辑推荐 */ $.ajax({ type: 'POST', url: apiConfig.mBaseUrl + '/news/redisRecommend', dataType: 'json', success: function (data) { if (data.code === 0) { if (data.data === null) { return } if (data.data) { $('.bjtj-list').html(template('bjtjTpl', data.data)) } } }, complete: function () { }, }) // 相关资讯曝光统计 var xgzx = $('.course-list > li:first-child') function checkVisible(elm) { var rect = elm.getBoundingClientRect() var viewHeight = Math.max( document.documentElement.clientHeight, window.innerHeight ) return !(rect.bottom < 0 || rect.top - viewHeight >= 0) } var xgzxTimer, exposed = false; $(function(){ $('.xgzx-top-part')[0].style.height = $('.xgzx-top-part').height()+"px"; }); $(window).on('scroll', function (e) { if (window.scrollY >= document.querySelector('.xgzx-head').offsetTop - 0.66 * $(window).height()) { $('.xgzx-top-part').height(0) window.scrollTo(0, 0); // $(".xgzx-top-part").animate({ // height: 0, // }, 1500, 'ease-in-out') } if (exposed) return clearTimeout(xgzxTimer) xgzxTimer = setTimeout(function () { if (checkVisible(xgzx[0])) { exposed = true console.log('资讯详情-相关资讯', '曝光') _hmt.push(['_trackEvent', '资讯详情-相关资讯', '曝光']) } }, 500) }) function toast(msg) { $(".toast-w").text(msg).removeClass("dn"); setTimeout(function () { $(".toast-w").addClass("dn"); }, 2000); } if (ContentCenterSDK){ var reporter = new ContentCenterSDK({ code: 'ajax309', }) }