// 360广告宏替换参数 var Macro = {start: "__EVENT_TIME_START__", end: "__EVENT_TIME_END__", x: "__OFFSET_X__", y: "__OFFSET_Y__"}; 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(''); }); }; (function () { var common = { getUserId: function () { return (+new Date()) + Math.random().toString(10).substring(2, 6); }, 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; }, 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; }, 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"; } }, }; window.Common = common; })(); // 360数据请求 function get360Ad(reqtime, callback, showId, num) { var recommend_url = '//show.g.mediav.com/s', recommend_type = 1, recommend_of = 4, reqtimes = reqtime || 1, recommend_newf = 1, recommend_showid = showId || config.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){ $.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{ var d = data.ads || []; callback && callback(d); } }, error: function () {callback(null);} }) }